https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71588

            Bug ID: 71588
           Summary: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu:
                    in execute_todo, at passes.c:2009
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk at
-O2 and -O3on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It is a regression from 6.1.x.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160619 (experimental) [trunk revision 237580] (GCC) 
$ 
$ gcc-trunk -Os -c small.c
$ gcc-6.1 -O2 -c small.c
$ 
$ gcc-trunk -O2 -c small.c
small.c: In function ‘foo’:
small.c:7:7: internal compiler error: in execute_todo, at passes.c:2009
 char *foo ()
       ^~~
0xafa57c execute_todo
        ../../gcc-source-trunk/gcc/passes.c:2009
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 


-----------------------------------------------------------------


char *strcpy (char *, const char *)  __attribute__ ((__pure__));
unsigned long strlen (const char *);
void *malloc (unsigned long); 

char a; 

char *foo ()
{
  unsigned long b = strlen (&a);
  char *c = malloc (b);
  return strcpy (c, &a);
}

Reply via email to