xref: /llvm-project/clang/test/CodeGen/builtin-redeclaration.c (revision e09107ab80dced55414fa458cf78e6cdfe90da6e)
1*e09107abSRaul Tambre // RUN: %clang_cc1 -emit-llvm-only %s
2*e09107abSRaul Tambre 
3*e09107abSRaul Tambre // PR45410
4*e09107abSRaul Tambre // Ensure we mark local extern redeclarations with a different type as non-builtin.
non_builtin()5*e09107abSRaul Tambre void non_builtin() {
6*e09107abSRaul Tambre   extern float exp();
7*e09107abSRaul Tambre   exp(); // Will crash due to wrong number of arguments if this calls the builtin.
8*e09107abSRaul Tambre }
9*e09107abSRaul Tambre 
10*e09107abSRaul Tambre // PR45410
11*e09107abSRaul Tambre // We mark exp() builtin as const with -fno-math-errno (default).
12*e09107abSRaul Tambre // We mustn't do that for extern redeclarations of builtins where the type differs.
attribute()13*e09107abSRaul Tambre float attribute() {
14*e09107abSRaul Tambre   extern float exp();
15*e09107abSRaul Tambre   return exp(1);
16*e09107abSRaul Tambre }
17