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

            Bug ID: 84740
           Summary: [8 Regression] ICE in build_constructors, at
                    tree-switch-conversion.c:965
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Gives an ICE at -O[s23] since at least 20170618.
Shrinked/modified from gcc.dg/tree-ssa/cswtch-4.c


$ cat z1.c
void
frobulate_for_gcc (unsigned int v)
{
  const char *s;
  switch (v)
    {
    case 0:
      s = "foo";
      break;
    case 1:
      s = "bar";
      break;
    case 2:
      s = "spam";
      break;
    default:
      s = (const char *) 0;
      break;
    }
  if (!s)
    __builtin_printf ("%s\n", s);
}


$ gcc-7          -c z1.c -O2
$ gcc-8-20180304 -c z1.c -O1
$ gcc-8-20180304 -c z1.c -O2
during GIMPLE pass: switchconv
z1.c: In function 'frobulate_for_gcc':
z1.c:22:1: internal compiler error: in build_constructors, at
tree-switch-conversion.c:965
 }
 ^
0xbb98a0 build_constructors
        ../../gcc/tree-switch-conversion.c:965
0xbb98a0 process_switch
        ../../gcc/tree-switch-conversion.c:1566
0xbb98a0 execute
        ../../gcc/tree-switch-conversion.c:1630


No ICE without line "if (!s)".

Reply via email to