[Bug rtl-optimization/53705] wrong code with custom flags - stores to memory are lost

amylaar at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 30 13:37:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53705

Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amylaar at gcc dot gnu.org

--- Comment #3 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> ---
(In reply to Zdenek Sojka from comment #0)
> Created attachment 27640 [details]
> reduced testcase (from testsuite/gcc.c-torture/execute/loop-2e.c)
> 
> GCC 4.3-4.8 fails, while with GCC 4.2, the code is reduced just to return 0.
> I am not sure if this should be marked as a regression.
> 
> Compiler output:
> $ gcc -O2 -fno-omit-frame-pointer -fpeel-loops -fsched2-use-superblocks
> -fno-tree-loop-optimize -fno-web --param=max-completely-peel-times=256
> testcase.c
> $ ./a.out
> Aborted
> 
> Looking at the assembly:
> ...
> 	sub	rsp, 320	#,
> 	mov	rdx, QWORD PTR p[rip]	# p.0, p
> 	lea	rcx, [rbp-320]	# q,
> ...
> 	mov	QWORD PTR [rcx+240], rdi	# *q_19, tmp73
> 	lea	rax, [rdx+144]	# tmp73,
> 	lea	rsi, [rdx+148]	# tmp73,
> 	lea	rdi, [rdx+152]	# tmp73,
> 	lea	rdx, [rdx+156]	# tmp73,
> 	cmp	QWORD PTR [rbp-8], rdx	# q, tmp73
> 	mov	QWORD PTR [rcx+280], rax	# *q_19, tmp73
> 	mov	QWORD PTR [rcx+248], r8	# *q_19, tmp73
> 	mov	QWORD PTR [rcx+256], r9	# *q_19, tmp73
> 	mov	QWORD PTR [rcx+264], r10	# *q_19, tmp73
> 	mov	QWORD PTR [rcx+272], r11	# *q_19, tmp73
> 	mov	QWORD PTR [rcx+288], rsi	# *q_19, tmp73
> 	mov	QWORD PTR [rcx+296], rdi	# *q_19, tmp73
> 	mov	QWORD PTR [rcx+304], rdx	# *q_19, tmp73
> 	jne	.L46	#,
> ...
> It seems the dependency between storing to *q++ (esp. q[39]) in foo() and
> verifying it in main() is lost. Furthermore, it seems q[39] ([rcx+312]) is
> not stored to at all.

I can't reproduce the unrolling with an i686-pc-linux-gnu X x86_64-pc-linux-gnu
compiler, neither for 4.8.2 20130729 (prerelease) , nor for 4.9.0 20130729
(experimental) sources.

Is that an issuse with the cross-compiler, or with the compiler version?


More information about the Gcc-bugs mailing list