public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min()
@ 2012-05-04 21:41 proski at gnu dot org
2012-05-04 21:43 ` [Bug c++/53239] " proski at gnu dot org
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: proski at gnu dot org @ 2012-05-04 21:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
Bug #: 53239
Summary: [4.7 Regression] -ftree-vrp breaks min()
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: proski@gnu.org
GNU Lilypond is miscompiled on Fedora 17. It manifests as a failure to process
any non-trivial input. Both i386 and x86_64 are affected.
$ gcc --version
gcc (GCC) 4.7.0 20120502 (Red Hat 4.7.0-3)
It turns out that adding -fno-tree-vrp fixes the problem. A call to min() is
affected. Comparing the assembly output without and with -fno-tree-vrp shows
that the generated assembly code wrongly eliminates a conditional register move
after calling the compare (_ZN6Moment7compareERKS_S1_) function.
The attached file was generated on i386.
Credit for finding a problem in the assembly goes to David Kastrup.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/53239] [4.7 Regression] -ftree-vrp breaks min()
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
@ 2012-05-04 21:43 ` proski at gnu dot org
2012-05-04 21:54 ` pinskia at gcc dot gnu.org
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: proski at gnu dot org @ 2012-05-04 21:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #1 from proski at gnu dot org 2012-05-04 21:43:11 UTC ---
Created attachment 27310
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27310
Example (made on i386)
This line is miscompiled:
next = min (next, it->pending_moment ());
The result of comparison in min() is unused unless the -fno-tree-vrp option is
used.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/53239] [4.7 Regression] -ftree-vrp breaks min()
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
2012-05-04 21:43 ` [Bug c++/53239] " proski at gnu dot org
@ 2012-05-04 21:54 ` pinskia at gcc dot gnu.org
2012-05-04 21:55 ` pinskia at gcc dot gnu.org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-04 21:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-04 21:54:03 UTC ---
s_6 = this_5(D)->children_list_;
x.4_39 = (long unsigned int) s_6;
D.36426_37 = x.4_39 & 6;
I think the code is depending on undefined code dealing with alignment
requirements on pointers.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/53239] [4.7 Regression] -ftree-vrp breaks min()
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
2012-05-04 21:43 ` [Bug c++/53239] " proski at gnu dot org
2012-05-04 21:54 ` pinskia at gcc dot gnu.org
@ 2012-05-04 21:55 ` pinskia at gcc dot gnu.org
2012-05-04 22:03 ` [Bug middle-end/53239] [4.7 Regression] VRP vs named value return opt pinskia at gcc dot gnu.org
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-04 21:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-04 21:55:04 UTC ---
prephitmp.102_38 = MEM[(struct scm_unused_struct * *)s_6];
D.36424_34 = (long unsigned int) prephitmp.102_38;
D.36423_40 = D.36424_34 & 1;
Is the real place.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug middle-end/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (2 preceding siblings ...)
2012-05-04 21:55 ` pinskia at gcc dot gnu.org
@ 2012-05-04 22:03 ` pinskia at gcc dot gnu.org
2012-05-04 23:21 ` hjl.tools at gmail dot com
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-04 22:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-04
Component|c++ |middle-end
Summary|[4.7 Regression] -ftree-vrp |[4.7 Regression] VRP vs
|breaks min() |named value return opt
Ever Confirmed|0 |1
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-04 22:02:59 UTC ---
Actually the following is what is being removed:
if (D.36751_45 < 0)
goto <bb 6>;
else
goto <bb 7>;
<bb 6>:
<bb 7>:
# D.36747_44 = PHI <<retval>_2(D)(6), &D.35100(5)>
So it is not VRP really as it is doing something fine. It is just we say
<retval>_2 is uninitialized.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug middle-end/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (3 preceding siblings ...)
2012-05-04 22:03 ` [Bug middle-end/53239] [4.7 Regression] VRP vs named value return opt pinskia at gcc dot gnu.org
@ 2012-05-04 23:21 ` hjl.tools at gmail dot com
2012-05-07 3:22 ` proski at gnu dot org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-04 23:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-04 23:20:49 UTC ---
Is there a self-contained run-time testcase?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug middle-end/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (4 preceding siblings ...)
2012-05-04 23:21 ` hjl.tools at gmail dot com
@ 2012-05-07 3:22 ` proski at gnu dot org
2012-05-07 7:14 ` [Bug tree-optimization/53239] " jakub at gcc dot gnu.org
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: proski at gnu dot org @ 2012-05-07 3:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #6 from proski at gnu dot org 2012-05-07 02:50:04 UTC ---
Created attachment 27330
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27330
Self-contained test case
Run the "compile" script. The output would be:
return = 2/1
return = 1/1
It means that the output depends on whether -fno-tree-vrp is used.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (5 preceding siblings ...)
2012-05-07 3:22 ` proski at gnu dot org
@ 2012-05-07 7:14 ` jakub at gcc dot gnu.org
2012-05-07 7:27 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-07 7:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Component|middle-end |tree-optimization
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-07 07:08:30 UTC ---
VRP bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (6 preceding siblings ...)
2012-05-07 7:14 ` [Bug tree-optimization/53239] " jakub at gcc dot gnu.org
@ 2012-05-07 7:27 ` jakub at gcc dot gnu.org
2012-05-07 9:35 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-07 7:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
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 #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-07 07:13:44 UTC ---
Created attachment 27331
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27331
gcc47-pr53239.patch
Untested fix.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (7 preceding siblings ...)
2012-05-07 7:27 ` jakub at gcc dot gnu.org
@ 2012-05-07 9:35 ` rguenth at gcc dot gnu.org
2012-05-07 9:38 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-07 9:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (8 preceding siblings ...)
2012-05-07 9:35 ` rguenth at gcc dot gnu.org
@ 2012-05-07 9:38 ` rguenth at gcc dot gnu.org
2012-05-07 12:36 ` proski at gnu dot org
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-07 9:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-07 09:33:56 UTC ---
Doh. Patch looks ok.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (9 preceding siblings ...)
2012-05-07 9:38 ` rguenth at gcc dot gnu.org
@ 2012-05-07 12:36 ` proski at gnu dot org
2012-05-07 13:24 ` [Bug tree-optimization/53239] [4.7/4.8 " hjl.tools at gmail dot com
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: proski at gnu dot org @ 2012-05-07 12:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #10 from proski at gnu dot org 2012-05-07 12:35:40 UTC ---
I applied the patch to gcc 4.7.0 and tested it with my example and GNU
Lilypond. Both are fixed. Thanks!
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7/4.8 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (10 preceding siblings ...)
2012-05-07 12:36 ` proski at gnu dot org
@ 2012-05-07 13:24 ` hjl.tools at gmail dot com
2012-05-07 13:33 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-07 13:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.7 Regression] VRP vs |[4.7/4.8 Regression] VRP vs
|named value return opt |named value return opt
--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-07 13:22:13 UTC ---
This is caused by revision 176918:
http://gcc.gnu.org/ml/gcc-cvs/2011-07/msg01186.html
Does the fix improve gcc.dg/uninit-suppress.c/gcc.dg/uninit-suppress_2.c?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7/4.8 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (12 preceding siblings ...)
2012-05-07 13:33 ` jakub at gcc dot gnu.org
@ 2012-05-07 13:33 ` dak at gnu dot org
2012-05-07 13:34 ` jakub at gcc dot gnu.org
2012-05-16 15:58 ` jakub at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: dak at gnu dot org @ 2012-05-07 13:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
David Kastrup <dak at gnu dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dak at gnu dot org
--- Comment #12 from David Kastrup <dak at gnu dot org> 2012-05-07 13:31:03 UTC ---
Unrelated question: this kind of code is quite common in connection with
user-defined arithmetic classes. While I understand that changing the bug
priority from "P3 normal" will likely do nothing with regard to which releases
of gcc the fix will appear in, it might make a difference for distributors that
tend to cherry-pick important fixes ahead of regular releases. For example,
the next release of Fedora is slated to be delivered using gcc 4.7.0, and its
miscompilation of LilyPond, a bonafide application, was what triggered this
report.
Given that the triggering pattern is quite typical for C++ and the problem
being present on all architectures, it might make sense to adjust the priority.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7/4.8 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (11 preceding siblings ...)
2012-05-07 13:24 ` [Bug tree-optimization/53239] [4.7/4.8 " hjl.tools at gmail dot com
@ 2012-05-07 13:33 ` jakub at gcc dot gnu.org
2012-05-07 13:33 ` dak at gnu dot org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-07 13:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-07 13:31:08 UTC ---
Author: jakub
Date: Mon May 7 13:31:00 2012
New Revision: 187240
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187240
Log:
PR tree-optimization/53239
* tree-vrp.c (get_value_range): Set VR of
SSA_NAME_IS_DEFAULT_DEF of DECL_BY_REFERENCE RESULT_DECL
to nonnull.
* g++.dg/opt/vrp3.C: New test.
* g++.dg/opt/vrp3-aux.cc: New file.
* g++.dg/opt/vrp3.h: New file.
Added:
trunk/gcc/testsuite/g++.dg/opt/vrp3-aux.cc
trunk/gcc/testsuite/g++.dg/opt/vrp3.C
trunk/gcc/testsuite/g++.dg/opt/vrp3.h
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7/4.8 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (13 preceding siblings ...)
2012-05-07 13:33 ` dak at gnu dot org
@ 2012-05-07 13:34 ` jakub at gcc dot gnu.org
2012-05-16 15:58 ` jakub at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-07 13:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-07 13:33:34 UTC ---
Author: jakub
Date: Mon May 7 13:33:27 2012
New Revision: 187241
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187241
Log:
PR tree-optimization/53239
* tree-vrp.c (get_value_range): Set VR of
SSA_NAME_IS_DEFAULT_DEF of DECL_BY_REFERENCE RESULT_DECL
to nonnull.
* g++.dg/opt/vrp3.C: New test.
* g++.dg/opt/vrp3-aux.cc: New file.
* g++.dg/opt/vrp3.h: New file.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/opt/vrp3-aux.cc
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/opt/vrp3.C
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/opt/vrp3.h
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
branches/gcc-4_7-branch/gcc/tree-vrp.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug tree-optimization/53239] [4.7/4.8 Regression] VRP vs named value return opt
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
` (14 preceding siblings ...)
2012-05-07 13:34 ` jakub at gcc dot gnu.org
@ 2012-05-16 15:58 ` jakub at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-16 15:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-16 15:24:11 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-05-16 15:25 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04 21:41 [Bug c++/53239] New: [4.7 Regression] -ftree-vrp breaks min() proski at gnu dot org
2012-05-04 21:43 ` [Bug c++/53239] " proski at gnu dot org
2012-05-04 21:54 ` pinskia at gcc dot gnu.org
2012-05-04 21:55 ` pinskia at gcc dot gnu.org
2012-05-04 22:03 ` [Bug middle-end/53239] [4.7 Regression] VRP vs named value return opt pinskia at gcc dot gnu.org
2012-05-04 23:21 ` hjl.tools at gmail dot com
2012-05-07 3:22 ` proski at gnu dot org
2012-05-07 7:14 ` [Bug tree-optimization/53239] " jakub at gcc dot gnu.org
2012-05-07 7:27 ` jakub at gcc dot gnu.org
2012-05-07 9:35 ` rguenth at gcc dot gnu.org
2012-05-07 9:38 ` rguenth at gcc dot gnu.org
2012-05-07 12:36 ` proski at gnu dot org
2012-05-07 13:24 ` [Bug tree-optimization/53239] [4.7/4.8 " hjl.tools at gmail dot com
2012-05-07 13:33 ` jakub at gcc dot gnu.org
2012-05-07 13:33 ` dak at gnu dot org
2012-05-07 13:34 ` jakub at gcc dot gnu.org
2012-05-16 15:58 ` 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).