public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation
@ 2015-02-13 16:31 jakub at gcc dot gnu.org
2015-02-13 16:32 ` [Bug tree-optimization/65053] " jakub at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-13 16:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053
Bug ID: 65053
Summary: [5 Regression] PostgreSQL miscompilation
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Following testcase is miscompiled at -O2 starting with r220164:
int i;
__attribute__ ((noinline))
unsigned int foo (void)
{
return 0;
}
int
main ()
{
unsigned int u = -1;
if (u == -1)
{
unsigned int n = foo ();
if (n > 0)
u = n - 1;
}
while (u != -1)
{
asm ("" : "+g" (u));
u = -1;
i = 1;
}
if (i)
__builtin_abort ();
return 0;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/65053] [5 Regression] PostgreSQL miscompilation
2015-02-13 16:31 [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation jakub at gcc dot gnu.org
@ 2015-02-13 16:32 ` jakub at gcc dot gnu.org
2015-02-13 16:43 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-13 16:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-13
Target Milestone|--- |5.0
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/65053] [5 Regression] PostgreSQL miscompilation
2015-02-13 16:31 [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation jakub at gcc dot gnu.org
2015-02-13 16:32 ` [Bug tree-optimization/65053] " jakub at gcc dot gnu.org
@ 2015-02-13 16:43 ` jakub at gcc dot gnu.org
2015-02-13 17:50 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-13 16:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I believe this is a phiopt1 bug.
In *.ifcombine we have:
<bb 2>:
n_5 = foo ();
if (n_5 != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
# RANGE [0, 4294967294]
u_6 = n_5 + 4294967295;
<bb 4>:
# u_3 = PHI <u_6(3), 4294967295(2)>
goto <bb 6>;
which looks right, for non-zero n_5 u_6 really is != 0xffffffffU.
But then *.phiopt optimizes this into:
<bb 2>:
n_5 = foo ();
# RANGE [0, 4294967294]
u_6 = n_5 + 4294967295;
goto <bb 4>;
which is wrong, either it should have adjusted the value range or drop it when
making u_6 unconditional.
What r220164 did is just start using the VR information during the next VRP
pass, but as the info is bogus due to phiopt, it resulted in wrong optimization
later on.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/65053] [5 Regression] PostgreSQL miscompilation
2015-02-13 16:31 [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation jakub at gcc dot gnu.org
2015-02-13 16:32 ` [Bug tree-optimization/65053] " jakub at gcc dot gnu.org
2015-02-13 16:43 ` jakub at gcc dot gnu.org
@ 2015-02-13 17:50 ` jakub at gcc dot gnu.org
2015-02-13 18:34 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-13 17:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 34749
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34749&action=edit
gcc5-pr65053.patch
Untested fix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/65053] [5 Regression] PostgreSQL miscompilation
2015-02-13 16:31 [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2015-02-13 17:50 ` jakub at gcc dot gnu.org
@ 2015-02-13 18:34 ` jakub at gcc dot gnu.org
2015-02-13 23:21 ` jakub at gcc dot gnu.org
2015-02-13 23:34 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-13 18:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/65053] [5 Regression] PostgreSQL miscompilation
2015-02-13 16:31 [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2015-02-13 18:34 ` jakub at gcc dot gnu.org
@ 2015-02-13 23:21 ` jakub at gcc dot gnu.org
2015-02-13 23:34 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-13 23:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Feb 13 23:20:31 2015
New Revision: 220700
URL: https://gcc.gnu.org/viewcvs?rev=220700&root=gcc&view=rev
Log:
PR tree-optimization/65053
* tree-ssa-phiopt.c (value_replacement): When moving assign before
cond, either reset VR on lhs or set it to phi result VR.
* gcc.c-torture/execute/pr65053-1.c: New test.
* gcc.c-torture/execute/pr65053-2.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr65053-1.c
trunk/gcc/testsuite/gcc.c-torture/execute/pr65053-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-phiopt.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/65053] [5 Regression] PostgreSQL miscompilation
2015-02-13 16:31 [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2015-02-13 23:21 ` jakub at gcc dot gnu.org
@ 2015-02-13 23:34 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-13 23:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-02-13 23:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 16:31 [Bug tree-optimization/65053] New: [5 Regression] PostgreSQL miscompilation jakub at gcc dot gnu.org
2015-02-13 16:32 ` [Bug tree-optimization/65053] " jakub at gcc dot gnu.org
2015-02-13 16:43 ` jakub at gcc dot gnu.org
2015-02-13 17:50 ` jakub at gcc dot gnu.org
2015-02-13 18:34 ` jakub at gcc dot gnu.org
2015-02-13 23:21 ` jakub at gcc dot gnu.org
2015-02-13 23:34 ` 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).