https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87886
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- It doesn't avoid the ICE but my latest patch for pr83656 at least diagnoses the invalid call (see below). The warning is predicated on the front-end preserving the built-in property of the function despite the missing prototype. If the front-end were to treat the function as ordinary (as it does with sqrtf because of pr87890), the warning for the call disappears in lieu of one for the declaration. In both cases, the undefined call is made at runtime. For best results I think the front-end needs to preserve the fact that a function is a built-in, not just so that invalid calls to it can be diagnosed but also to make it possible for the middle-end to handle them in a safer way (e.g., by replacing the undefined ones with a trap in response to some option, as discussed at Cauldron). $ cat t.c && /ssd/build/gcc-83656/gcc/xgcc -B /ssd/build/gcc-83656/gcc -S t.c extern double sqrt (); int f (int x) { return sqrt (x); } extern float sqrtf (); int g (int x) { return sqrtf (x); } t.c: In function ‘f’: t.c:5:16: warning: ‘sqrt’ argument 1 type is ‘int’ where ‘double’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch] 5 | return sqrt (x); | ^ t.c:1:15: note: built-in ‘sqrt’ declared here 1 | extern double sqrt (); | ^~~~ t.c: At top level: t.c:9:14: warning: conflicting types for built-in function ‘sqrtf’; expected ‘float(float)’ [-Wbuiltin-declaration-mismatch] 9 | extern float sqrtf (); | ^~~~~ t.c:1:1: note: ‘sqrtf’ is declared in header ‘<math.h>’ +++ |+#include <math.h> 1 | extern double sqrt ();