gcc 4.0 ICEs after replacing a call via a function pointer with
a call to a noreturn function (unless that call falls through
to the exit block).  The expected fake edge to the exit block
is not added after modifying the CALL_EXPR.

I'm not up to speed on gimple yet, so I'm just filing this for info.
It's a 4.0 regression.

$ cat foo.c
extern void foo (void) __attribute__((noreturn));
int n;

void
g (void)
{
  void (*f) (void) = foo;
  if (n)
    f ();
  n = 1;
}
$ gcc -O foo.c
foo.c: In function 'g':
foo.c:11: error: verify_flow_info: Incorrect fallthru 2->3
foo.c:11: error: wrong insn in the fallthru edge
(barrier 17 16 18)
foo.c:11: internal compiler error: in rtl_verify_flow_info, at cfgrtl.c:2201
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

...or (shorter, but rather less likely)...

$ cat bar.c
extern void foo (void) __attribute__((noreturn));

void g (void)
{
  void (*f) (void) = foo;
  f ();
  f ();
}
$ gcc -O bar.c
bar.c: In function 'g':
bar.c:4: error: Control flow in the middle of basic block 0

bar.c:4: error: Control flow in the middle of basic block 0

bar.c:4: internal compiler error: verify_flow_info failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

-- 
           Summary: [4.0 Regression] function pointer propagation fails for
                    noreturn functions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rsandifo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to