This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/57381] New: array of volatile pointers hangs gcc
- From: "dhazeghi at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 22 May 2013 21:49:49 +0000
- Subject: [Bug rtl-optimization/57381] New: array of volatile pointers hangs gcc
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57381
Bug ID: 57381
Summary: array of volatile pointers hangs gcc
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: dhazeghi at yahoo dot com
The following code causes gcc trunk and 4.8 branch to hang at -O1 or above due
to it consuming all available memory (well over 2GB after 10 seconds).
$ gcc-trunk -v
Target: x86_64-unknown-linux-gnu
gcc version 4.9.0 20130522 (experimental) [trunk revision 199191] (GCC)
$ time gcc-trunk -O0 -c small.c
real 0m0.023s
user 0m0.008s
sys 0m0.008s
$ time gcc-4.7 -O1 -c small.c
real 0m0.028s
user 0m0.004s
sys 0m0.016s
$ time timeout 10 gcc-trunk -O1 -c small.c
real 0m10.002s
user 0m0.000s
sys 0m0.004s
$ echo $?
124
----------------------------------
struct S0 { int f0, f1, f2; };
struct S1 {
int f0;
volatile struct S0 f2;
};
static struct S1 s = {0x47BED265,{0x06D4EB3E,5,0U}};
int foo(struct S0 p)
{
for (s.f2.f2 = 0; (s.f2.f2 <= 12); s.f2.f2++)
{
volatile int *l_61[5][2][2] =
{{{&s.f2.f0,&s.f2.f0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,&s.f2.f0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,(void*)0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,&s.f2.f0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,&s.f2.f0},{(void*)0,&s.f2.f0}}};
volatile int **l_68 = &l_61[0][0][1];
volatile int *l_76 = &s.f2.f0;
(*l_68) = l_61[0][0][0];
if ((*l_76 = (p.f2 % 5))) ;
}
return p.f0;
}