Implicit declarations of builtins

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. Even more
nasty: -Werror=implicit-function-declaration makes it still continue.

Is this really desirable behavior?

Joerg

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.

-Eli

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.

I agree. Clang should do the same. I could swear that it worked that way at one point.