public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39132] New: wrong code generated with -ftree-loop-disttribution
@ 2009-02-08 19:05 kazu at gcc dot gnu dot org
2009-02-10 13:16 ` [Bug tree-optimization/39132] " rguenth at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: kazu at gcc dot gnu dot org @ 2009-02-08 19:05 UTC (permalink / raw)
To: gcc-bugs
The following testcase calls abort when it is compiled with
-O3 -ftree-loop-distribution.
/* Derived from gcc.c-torture/execute/20010910-1.c. */
extern void abort(void);
struct epic_private
{
unsigned int *rx_ring;
unsigned int rx_skbuff[5];
};
int
main (void)
{
struct epic_private ep;
unsigned int rx_ring[5];
int i;
ep.rx_skbuff[0] = 5;
ep.rx_ring = rx_ring;
for (i = 0; i < 5; i++)
{
ep.rx_ring[i] = i;
ep.rx_skbuff[i] = 0;
}
if (ep.rx_skbuff[0] != 0)
abort ();
return 0;
}
The loop distribution pass produces:
<bb 2>:
ep.rx_skbuff[0] = 5;
<bb 8>:
# i_22 = PHI <i_36(9), 0(2)>
D.1604_11 = (long unsigned int) i_22;
D.1605_30 = D.1604_11 * 4;
D.1606_31 = &rx_ring + D.1605_30;
i.0_32 = (unsigned int) i_22;
*D.1606_31 = i.0_32;
i_36 = i_22 + 1;
if (i_36 <= 4)
goto <bb 9>;
else
goto <bb 10>;
<bb 9>:
goto <bb 8>;
<bb 10>:
Invalid sum of outgoing probabilities 0.0%
D.1642_37 = &ep + 8;
__builtin_memset (D.1642_37, 0, 20);
<bb 5>:
Invalid sum of incoming frequencies 0, should be 1667
D.1609_10 = ep.rx_skbuff[0];
if (D.1609_10 != 0)
goto <bb 6>;
else
goto <bb 7>;
<bb 6>:
abort ();
<bb 7>:
return 0;
dom2 in turn produces:
ep.rx_skbuff[0] = 5;
rx_ring[0] = 0;
D.1606_47 = &rx_ring[1];
rx_ring[1] = 1;
D.1606_59 = &rx_ring[2];
rx_ring[2] = 2;
D.1606_71 = &rx_ring[3];
rx_ring[3] = 3;
D.1606_31 = &rx_ring[4];
rx_ring[4] = 4;
D.1642_37 = &ep + 8;
__builtin_memset (D.1642_37, 0, 20);
D.1609_10 = 5;
abort ();
Note that the end of the function is replaced with an unconditional
abort.
GCC puts an unconditional abort at the rtl level when compiling The
original gcc.c-torture/execute/20010910-1.c. Once I remove extra
source code, I can observe an unconditional abort at the tree level.
The compiler probably does not notice that the value of
ep.rx_skbuff[0] changes across __builtin_memset. This sounds like an
alias problem of some sort.
--
Summary: wrong code generated with -ftree-loop-disttribution
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at gcc dot gnu dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39132
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39132] wrong code generated with -ftree-loop-disttribution
2009-02-08 19:05 [Bug tree-optimization/39132] New: wrong code generated with -ftree-loop-disttribution kazu at gcc dot gnu dot org
@ 2009-02-10 13:16 ` rguenth at gcc dot gnu dot org
2009-02-10 13:30 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-10 13:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-02-10 13:15 -------
Confirmed. There is wrong alias-information on the memset:
<bb 10>:
Invalid sum of outgoing probabilities 0.0%
D.1641_35 = &ep + 8;
# rx_ring_36 = VDEF <rx_ring_31>
# SMT.12_37 = VDEF <SMT.12_32>
__builtin_memset (D.1641_35, 0, 20);
<bb 5>:
Invalid sum of incoming frequencies 0, should be 1667
# VUSE <ep_15>
D.1609_10 = ep.rx_skbuff[0];
if (D.1609_10 != 0)
the memset should clobber ep. Investigating.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-02-10 13:15:51
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39132
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39132] wrong code generated with -ftree-loop-disttribution
2009-02-08 19:05 [Bug tree-optimization/39132] New: wrong code generated with -ftree-loop-disttribution kazu at gcc dot gnu dot org
2009-02-10 13:16 ` [Bug tree-optimization/39132] " rguenth at gcc dot gnu dot org
@ 2009-02-10 13:30 ` rguenth at gcc dot gnu dot org
2009-02-10 14:54 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-10 13:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-02-10 13:29 -------
I have a patch.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2009-02-10 13:15:51 |2009-02-10 13:29:52
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39132
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39132] wrong code generated with -ftree-loop-disttribution
2009-02-08 19:05 [Bug tree-optimization/39132] New: wrong code generated with -ftree-loop-disttribution kazu at gcc dot gnu dot org
2009-02-10 13:16 ` [Bug tree-optimization/39132] " rguenth at gcc dot gnu dot org
2009-02-10 13:30 ` rguenth at gcc dot gnu dot org
@ 2009-02-10 14:54 ` rguenth at gcc dot gnu dot org
2009-02-10 16:12 ` rguenth at gcc dot gnu dot org
2009-02-10 16:20 ` kazu at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-10 14:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2009-02-10 14:54 -------
Subject: Bug 39132
Author: rguenth
Date: Tue Feb 10 14:54:13 2009
New Revision: 144060
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144060
Log:
2009-02-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/39132
* tree-loop-distribution.c (todo): New global var.
(generate_memset_zero): Trigger TODO_rebuild_alias.
(tree_loop_distribution): Return todo.
* gcc.dg/torture/pr39132.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/torture/pr39132.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-loop-distribution.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39132
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39132] wrong code generated with -ftree-loop-disttribution
2009-02-08 19:05 [Bug tree-optimization/39132] New: wrong code generated with -ftree-loop-disttribution kazu at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-02-10 14:54 ` rguenth at gcc dot gnu dot org
@ 2009-02-10 16:12 ` rguenth at gcc dot gnu dot org
2009-02-10 16:20 ` kazu at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-10 16:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2009-02-10 16:12 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39132
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/39132] wrong code generated with -ftree-loop-disttribution
2009-02-08 19:05 [Bug tree-optimization/39132] New: wrong code generated with -ftree-loop-disttribution kazu at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-02-10 16:12 ` rguenth at gcc dot gnu dot org
@ 2009-02-10 16:20 ` kazu at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: kazu at gcc dot gnu dot org @ 2009-02-10 16:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from kazu at gcc dot gnu dot org 2009-02-10 16:19 -------
Thanks, Richard!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39132
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-02-10 16:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-08 19:05 [Bug tree-optimization/39132] New: wrong code generated with -ftree-loop-disttribution kazu at gcc dot gnu dot org
2009-02-10 13:16 ` [Bug tree-optimization/39132] " rguenth at gcc dot gnu dot org
2009-02-10 13:30 ` rguenth at gcc dot gnu dot org
2009-02-10 14:54 ` rguenth at gcc dot gnu dot org
2009-02-10 16:12 ` rguenth at gcc dot gnu dot org
2009-02-10 16:20 ` kazu at gcc dot gnu dot 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).