[cfe-dev] Implicit declarations of builtins

Eli Friedman eli.friedman at gmail.com
Sun Jan 22 14:54:21 PST 2012

On Sun, Jan 22, 2012 at 2:37 PM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> Hi all,
> I've just stumbled over a nasty surprise with the implicit prototypes
> for library builtins. Consider the following input:
> int main() { char *p = powl; return 0; }
> This is from a configure test and expected to fail on NetBSD. Compiling
> it with -O2 gives the expected
> warning: implicitly declaring C library function 'powl' with type
> 'long double (long double, long double)'
> warning, but the undefined reference gets optimised away. Dow.

Hmm... IIRC, gcc only does implicit builtin declarations in contexts
where the builtin is used as a function call.  Might be worth changing
clang to follow gcc's example.

> Even more
> nasty: -Werror=implicit-function-declaration makes it still continue.

That's definitely a bug.


More information about the cfe-dev mailing list