public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56448] New: cc1 hangs on volatile array with -O or above
@ 2013-02-25 21:11 dhazeghi at yahoo dot com
2013-02-25 22:17 ` [Bug tree-optimization/56448] [4.8 Regression] " jakub at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-02-25 21:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56448
Bug #: 56448
Summary: cc1 hangs on volatile array with -O or above
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dhazeghi@yahoo.com
The following snippet (reduced from a larger test case) causes top-of-trunk cc1
to hang (infinite loop) on x86_64-linux using -O or above. This is a
regression from 4.7.2 which does not have this issue.
$ cat volatile.c
volatile int a[1];
int b;
void fn1 ()
{
for (;;)
{
int *c[3][6] =
{ 0, 0, 0, &b, 0, 0, 0, 0, &b, 0, 0, 0, 0, 0, 0, 0, &b, (int *)&a[0] };
b = *c[2][5];
}
}
$ gcc-trunk --version
gcc-trunk (GCC) 4.8.0 20130225 (experimental) [trunk revision 196255]
$ gcc-4.7 -O -c volatile.c
$ gcc-trunk -c volatile.c
$ gcc-trunk -O -c volatile.c
<hangs>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56448] [4.8 Regression] cc1 hangs on volatile array with -O or above
2013-02-25 21:11 [Bug tree-optimization/56448] New: cc1 hangs on volatile array with -O or above dhazeghi at yahoo dot com
@ 2013-02-25 22:17 ` jakub at gcc dot gnu.org
2013-02-25 22:41 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-25 22:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56448
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-02-25
CC| |jakub at gcc dot gnu.org
Target Milestone|--- |4.8.0
Summary|cc1 hangs on volatile array |[4.8 Regression] cc1 hangs
|with -O or above |on volatile array with -O
| |or above
Ever Confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-25 22:17:01 UTC ---
Started with my http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195136 fix.
I think the problem is that for:
tree val; // which is &a[0] where a is volatile array
operand_equal_p (val, unshare_expr (val), OEP_PURE_SAME)
is false.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56448] [4.8 Regression] cc1 hangs on volatile array with -O or above
2013-02-25 21:11 [Bug tree-optimization/56448] New: cc1 hangs on volatile array with -O or above dhazeghi at yahoo dot com
2013-02-25 22:17 ` [Bug tree-optimization/56448] [4.8 Regression] " jakub at gcc dot gnu.org
@ 2013-02-25 22:41 ` jakub at gcc dot gnu.org
2013-02-26 10:01 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-25 22:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56448
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 #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-25 22:40:42 UTC ---
Created attachment 29536
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29536
gcc48-pr56448.patch
Untested fix.
For OEP_CONSTANT_ADDRESS_OF, we should ignore side-effects of the reference
from which the address is taken, they change the value, not its address.
OEP_CONSTANT_ADDRESS_OF in flags is fine to propagate to the first operand of
some references, so e.g. &a.b[0].c[9] is constant, even when c and b arrays are
volatile, but not the other arguments (e.g. array indexes, etc.), but for
*MEM_REF not even the first argument should get that.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56448] [4.8 Regression] cc1 hangs on volatile array with -O or above
2013-02-25 21:11 [Bug tree-optimization/56448] New: cc1 hangs on volatile array with -O or above dhazeghi at yahoo dot com
2013-02-25 22:17 ` [Bug tree-optimization/56448] [4.8 Regression] " jakub at gcc dot gnu.org
2013-02-25 22:41 ` jakub at gcc dot gnu.org
@ 2013-02-26 10:01 ` jakub at gcc dot gnu.org
2013-02-26 10:19 ` jakub at gcc dot gnu.org
2013-02-26 17:47 ` dhazeghi at yahoo dot com
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-26 10:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56448
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-26 10:00:55 UTC ---
Author: jakub
Date: Tue Feb 26 10:00:31 2013
New Revision: 196278
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196278
Log:
PR tree-optimization/56448
* fold-const.c (operand_equal_p) <case tcc_reference>: Don't look at
TREE_SIDE_EFFECTS if flags contain OEP_CONSTANT_ADDRESS_OF.
Clear OEP_CONSTANT_ADDRESS_OF from flags before recursing on second or
later operands of the references, or even first operand for
INDIRECT_REF, TARGET_MEM_REF or MEM_REF.
* gcc.c-torture/compile/pr56448.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr56448.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56448] [4.8 Regression] cc1 hangs on volatile array with -O or above
2013-02-25 21:11 [Bug tree-optimization/56448] New: cc1 hangs on volatile array with -O or above dhazeghi at yahoo dot com
` (2 preceding siblings ...)
2013-02-26 10:01 ` jakub at gcc dot gnu.org
@ 2013-02-26 10:19 ` jakub at gcc dot gnu.org
2013-02-26 17:47 ` dhazeghi at yahoo dot com
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-26 10:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56448
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> 2013-02-26 10:19:31 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/56448] [4.8 Regression] cc1 hangs on volatile array with -O or above
2013-02-25 21:11 [Bug tree-optimization/56448] New: cc1 hangs on volatile array with -O or above dhazeghi at yahoo dot com
` (3 preceding siblings ...)
2013-02-26 10:19 ` jakub at gcc dot gnu.org
@ 2013-02-26 17:47 ` dhazeghi at yahoo dot com
4 siblings, 0 replies; 6+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-02-26 17:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56448
--- Comment #5 from Dara Hazeghi <dhazeghi at yahoo dot com> 2013-02-26 17:47:04 UTC ---
Thanks! That was a very quick fix.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-26 17:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25 21:11 [Bug tree-optimization/56448] New: cc1 hangs on volatile array with -O or above dhazeghi at yahoo dot com
2013-02-25 22:17 ` [Bug tree-optimization/56448] [4.8 Regression] " jakub at gcc dot gnu.org
2013-02-25 22:41 ` jakub at gcc dot gnu.org
2013-02-26 10:01 ` jakub at gcc dot gnu.org
2013-02-26 10:19 ` jakub at gcc dot gnu.org
2013-02-26 17:47 ` dhazeghi at yahoo dot com
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).