public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57381] New: array of volatile pointers hangs gcc
@ 2013-05-22 21:49 dhazeghi at yahoo dot com
  2013-05-23  8:05 ` [Bug rtl-optimization/57381] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-05-22 21:49 UTC (permalink / raw)
  To: gcc-bugs

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;
}


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-29 13:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-22 21:49 [Bug rtl-optimization/57381] New: array of volatile pointers hangs gcc dhazeghi at yahoo dot com
2013-05-23  8:05 ` [Bug rtl-optimization/57381] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-05-23 10:09 ` [Bug rtl-optimization/57381] [4.8 " rguenth at gcc dot gnu.org
2013-08-29 13:15 ` jakub at gcc dot gnu.org
2013-08-29 13:18 ` 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).