[Bug tree-optimization/18746] New: segfault with cc1 compiled with checking disabled

kazu at cs dot umass dot edu gcc-bugzilla@gcc.gnu.org
Wed Dec 1 00:52:00 GMT 2004


Build cc1 with checking disabled.
Then compile the following with ./cc1 -quiet -O2.

extern void abort (void) __attribute__ ((noreturn));
extern char *strcpy (char *__restrict __dest, __const char *__restrict __src);

int
foo (int aaa, int bbb)
{
  static char buf[30];
  const char *p;

  switch (aaa)
    {
    case 10:
      p = "hello";
      break;

    case 20:
      p = "world";
      break;

    default:
      abort ();
    }

  if (bbb)
    {
      strcpy (buf, "banana");
      return 1;
    }
  strcpy (buf, p);

  return 0;
}

I get "internal compiler error: Segmentation fault".

The testcase was reduced from i386.c.

-- 
           Summary: segfault with cc1 compiled with checking disabled
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18746



More information about the Gcc-bugs mailing list