https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84724
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-03-06 CC| |msebor at gcc dot gnu.org Known to work| |6.4.0 Summary|internal compiler error: in |[7/8 Regression] internal |single_succ_edge, at |compiler error: in |basic-block.h:339 |single_succ_edge, at | |basic-block.h:339 with a | |declaration of | |__builtin_trap Ever confirmed|0 |1 Known to fail| |7.3.0, 8.0 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed with r244114 (gcc 7.0.0) as the first revision to ICE: r244114 | jakub | 2017-01-05 16:14:19 -0500 (Thu, 05 Jan 2017) | 12 lines PR tree-optimization/71016 Prior to that GCC accepted the test case (with -fpermissive): t.C:2:5: warning: new declaration ‘int __builtin_trap()’ ambiguates built-in declaration ‘void __builtin_trap()’ [-Wbuiltin-declaration-mismatch] int __builtin_trap(); ^~~~~~~~~~~~~~ t.C: In function ‘int a()’: t.C:6:9: warning: invalid conversion from ‘int*’ to ‘int’ [-fpermissive] int c(&b); ^~ A simpler test case is int __builtin_trap (); int a (int i) { const char *p = i < 0 ? 0 : ""; return *p; } The trouble seems to be that __builtin_trap is expected not to return but the extern C++ declaration in the program says otherwise and overrides the built-in. I'd say re-declarations of built-ins that GCC itself depends on/makes assumptions about should be rejected with a hard error.