public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
@ 2010-12-04 19:49 zsojka at seznam dot cz
2010-12-06 14:56 ` [Bug rtl-optimization/46804] " zsojka at seznam dot cz
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-12-04 19:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
Summary: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90
FAILs with -fregmove
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zsojka@seznam.cz
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 22632
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22632
auto-reduced testcase
Output:
$ /mnt/svn/gcc-trunk/binary-167453-lto-fortran-checking-yes-rtl-df/bin/gfortran
-O -fPIC -fexpensive-optimizations -fgcse -foptimize-register-move -fpeel-loops
-fno-tree-loop-optimize pr46804.f90
$ ./a.out
Aborted
In the assembly, the problem is apparent (intel syntax):
...
mov r12d, DWORD PTR A.4.1573[rip+3] # tmp310, A.4
mov DWORD PTR 16[rsp+r8*4], r12d # shift3, tmp310
...
32bit (unaligned) value is loaded instead of sign-extend byte as is done
without -fregmove:
...
movsx r11d, BYTE PTR A.4.1573[rip+3] # tmp310, A.4
mov DWORD PTR 16[rsp+r8*4], r11d # shift3, tmp310
...
so shift3 contains invalid data
The problem seems to first appear in the 182r.regmove dump:
$ diff pr46804.f90.180r.ce2 pr46804.f90.182r.regmove
...
2009,2010c1409,1410
< (sign_extend:SI (reg:QI 236))) pr46804.f90:17 132 {extendqisi2}
< (expr_list:REG_DEAD (reg:QI 236)
---
> (reg:SI 236)) pr46804.f90:17 64 {*movsi_internal}
> (expr_list:REG_DEAD (reg:SI 236)
...
Output:
r167453 - fail
r158095 - fail
4.5 r166509 - fail
4.4 r166509 - OK
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
@ 2010-12-06 14:56 ` zsojka at seznam dot cz
2010-12-06 16:39 ` hjl.tools at gmail dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-12-06 14:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> 2010-12-06 14:56:13 UTC ---
There are two likely related failures, but they both need -fno-tree-ter:
gfortran.dg/char_eoshift_[24].f90
$ gfortran -O -fPIC -fexpensive-optimizations -fgcse -foptimize-register-move
-fpeel-loops -fno-tree-loop-optimize -fno-tree-ter char_eoshift_2.f90 &&
./a.out
Aborted
$ gfortran -O -fPIC -fexpensive-optimizations -fgcse -foptimize-register-move
-fpeel-loops -fno-tree-loop-optimize -fno-tree-ter char_eoshift_4.f90 &&
./a.out
Aborted
Neither of them fails in 4.4.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
2010-12-06 14:56 ` [Bug rtl-optimization/46804] " zsojka at seznam dot cz
@ 2010-12-06 16:39 ` hjl.tools at gmail dot com
2010-12-08 10:50 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: hjl.tools at gmail dot com @ 2010-12-06 16:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2010.12.06 16:38:55
CC| |bernds at codesourcery dot
| |com
Target Milestone|--- |4.5.2
Ever Confirmed|0 |1
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-06 16:38:55 UTC ---
It is caused by revision 145357:
http://gcc.gnu.org/ml/gcc-cvs/2009-03/msg00864.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
2010-12-06 14:56 ` [Bug rtl-optimization/46804] " zsojka at seznam dot cz
2010-12-06 16:39 ` hjl.tools at gmail dot com
@ 2010-12-08 10:50 ` jakub at gcc dot gnu.org
2010-12-08 11:17 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-08 10:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-08 10:49:42 UTC ---
Regmove seems to change:
(insn 107 105 816 9 (set (reg:QI 236)
(mem/s/u/j:QI (const:DI (plus:DI (symbol_ref:DI ("A.4.1573") [flags
0x2] <var_decl # A.4>)
(const_int 3 [0x3]))) [0 A.4 S1 A8])) pr46804.f90:15 66
{*movqi_internal}
(expr_list:REG_EQUAL (mem/s/u/j:QI (const:DI (plus:DI (symbol_ref:DI
("A.4.1573") [flags 0x2] <var_decl # A.4>)
(const_int 3 [0x3]))) [0 A.4 S1 A8])
(nil)))
...
(insn 108 824 643 9 (set (mem/s/j:QI (plus:DI (plus:DI (mult:DI (reg:DI 235 [
S.5 ])
(const_int 2 [0x2]))
(reg/f:DI 20 frame))
(const_int -781 [0xfffffffffffffcf3])) [0 FRAME.22.shift1 S1
A8])
(reg:QI 236)) pr46804.f90:15 66 {*movqi_internal}
(nil))
...
(insn 117 116 832 9 (set (reg:HI 272)
(sign_extend:HI (reg:QI 236))) pr46804.f90:16 134 {extendqihi2}
(nil))
...
(insn 133 510 134 9 (set (reg:SI 310)
(sign_extend:SI (reg:QI 236))) pr46804.f90:17 132 {extendqisi2}
(expr_list:REG_DEAD (reg:QI 236)
(nil)))
into:
(insn 107 105 816 9 (set (reg:SI 236)
(sign_extend:SI (mem/s/u/j:QI (const:DI (plus:DI (symbol_ref:DI
("A.4.1573") [flags 0x2] <var_decl # A.4>)
(const_int 3 [0x3]))) [0 A.4 S1 A8]))) pr46804.f90:15
132 {extendqisi2}
(expr_list:REG_EQUAL (mem/s/u/j:QI (const:DI (plus:DI (symbol_ref:DI
("A.4.1573") [flags 0x2] <var_decl # A.4>)
(const_int 3 [0x3]))) [0 A.4 S1 A8])
(nil)))
...
(insn 108 824 643 9 (set (mem/s/j:QI (plus:DI (plus:DI (mult:DI (reg:DI 235 [
S.5 ])
(const_int 2 [0x2]))
(reg/f:DI 20 frame))
(const_int -781 [0xfffffffffffffcf3])) [0 FRAME.22.shift1 S1
A8])
(subreg:QI (reg:SI 236) 0)) pr46804.f90:15 66 {*movqi_internal}
(nil))
...
(insn 117 116 832 9 (set (reg:HI 272)
(sign_extend:HI (subreg:QI (reg:SI 236) 0))) pr46804.f90:16 134
{extendqihi2}
(nil))
...
(insn 133 510 134 9 (set (reg:SI 310)
(reg:SI 236)) pr46804.f90:17 64 {*movsi_internal}
(expr_list:REG_DEAD (reg:SI 236)
(nil)))
The problem is that REG_EQUAL note on insn 107 isn't adjusted and then with
high register pressure just results in wrong code.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
` (2 preceding siblings ...)
2010-12-08 10:50 ` jakub at gcc dot gnu.org
@ 2010-12-08 11:17 ` jakub at gcc dot gnu.org
2010-12-08 11:54 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-08 11:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-08 11:17:00 UTC ---
Ah, it seems Bernd committed a patch for this 9 years ago:
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01250.html
but probably had just testcase for REG_EQUIV and not REG_EQUAL, so didn't
discover that p at that point is not the p it wants, as there has been a
forward loop too. I guess if the REG_EQUAL note is identical to the source
operand, it could be sign/zero extended instead of removing it, for anything
else of course we want to remove it, but from the right insn.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
` (3 preceding siblings ...)
2010-12-08 11:17 ` jakub at gcc dot gnu.org
@ 2010-12-08 11:54 ` jakub at gcc dot gnu.org
2010-12-10 16:41 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-08 11:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-08 11:53:31 UTC ---
Created attachment 22682
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22682
gcc46-pr46804.patch
Untested fix.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
` (4 preceding siblings ...)
2010-12-08 11:54 ` jakub at gcc dot gnu.org
@ 2010-12-10 16:41 ` jakub at gcc dot gnu.org
2010-12-10 16:47 ` [Bug rtl-optimization/46804] [4.5 " jakub at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-10 16:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-10 16:40:57 UTC ---
Author: jakub
Date: Fri Dec 10 16:40:51 2010
New Revision: 167695
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167695
Log:
PR rtl-optimization/46804
* regmove.c (optimize_reg_copy_3): Look for REG_EQUAL note
on the setter of src_reg rather than on insn. If it is
equal to the setter's original SET_SRC, replace it with its
zero or sign extension instead of dropping it.
* gfortran.dg/pr46804.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/pr46804.f90
Modified:
trunk/gcc/ChangeLog
trunk/gcc/regmove.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
` (5 preceding siblings ...)
2010-12-10 16:41 ` jakub at gcc dot gnu.org
@ 2010-12-10 16:47 ` jakub at gcc dot gnu.org
2010-12-16 13:11 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-10 16:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.6.0
Summary|[4.5/4.6 Regression] |[4.5 Regression]
|gfortran.dg/char_cshift_2.f |gfortran.dg/char_cshift_2.f
|90 FAILs with -fregmove |90 FAILs with -fregmove
Known to fail|4.6.0 |
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-10 16:47:35 UTC ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
` (6 preceding siblings ...)
2010-12-10 16:47 ` [Bug rtl-optimization/46804] [4.5 " jakub at gcc dot gnu.org
@ 2010-12-16 13:11 ` rguenth at gcc dot gnu.org
2011-01-16 20:20 ` jakub at gcc dot gnu.org
2011-01-17 8:28 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-16 13:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.5.2 |4.5.3
--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-16 13:03:18 UTC ---
GCC 4.5.2 is being released, adjusting target milestone.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
` (7 preceding siblings ...)
2010-12-16 13:11 ` rguenth at gcc dot gnu.org
@ 2011-01-16 20:20 ` jakub at gcc dot gnu.org
2011-01-17 8:28 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-16 20:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-16 20:16:34 UTC ---
Author: jakub
Date: Sun Jan 16 20:16:30 2011
New Revision: 168863
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168863
Log:
Backport from mainline
2010-12-10 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/46804
* regmove.c (optimize_reg_copy_3): Look for REG_EQUAL note
on the setter of src_reg rather than on insn. If it is
equal to the setter's original SET_SRC, replace it with its
zero or sign extension instead of dropping it.
* gfortran.dg/pr46804.f90: New test.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/pr46804.f90
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/regmove.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/46804] [4.5 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
` (8 preceding siblings ...)
2011-01-16 20:20 ` jakub at gcc dot gnu.org
@ 2011-01-17 8:28 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-17 8:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46804
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-17 08:08:05 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-01-17 8:08 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-04 19:49 [Bug rtl-optimization/46804] New: [4.5/4.6 Regression] gfortran.dg/char_cshift_2.f90 FAILs with -fregmove zsojka at seznam dot cz
2010-12-06 14:56 ` [Bug rtl-optimization/46804] " zsojka at seznam dot cz
2010-12-06 16:39 ` hjl.tools at gmail dot com
2010-12-08 10:50 ` jakub at gcc dot gnu.org
2010-12-08 11:17 ` jakub at gcc dot gnu.org
2010-12-08 11:54 ` jakub at gcc dot gnu.org
2010-12-10 16:41 ` jakub at gcc dot gnu.org
2010-12-10 16:47 ` [Bug rtl-optimization/46804] [4.5 " jakub at gcc dot gnu.org
2010-12-16 13:11 ` rguenth at gcc dot gnu.org
2011-01-16 20:20 ` jakub at gcc dot gnu.org
2011-01-17 8:28 ` jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).