[cfe-dev] interesting clang issue with "floor"
reed kotler
rkotler at mips.com
Fri Jul 26 18:26:33 PDT 2013
Maybe there is some special C rule here that I don't understand but I
am declaring floor and floor_.
consider floor1.c
extern double floor(double);
extern double floor_(double);
double x = 1.5;
double y, y_;
void foo() {
y = floor(x);
y_ = floor_(x);
}
and floor.c
#include <stdio.h>
extern double x, y, y_;
double floor(double x) {
return 2*x;
}
double floor_(double x) {
return 3*x;
}
extern void foo();
int main() {
foo();
printf("%e %e %e \n", x, y, y_);
return 0;
}
/local/llvmpb_config/install/bin/clang floor1.c floor.c
rkotler at ubuntu-rkotler:~/testmips16$ ./a.out
1.500000e+00 3.000000e+00 4.500000e+00
On 07/26/2013 06:14 PM, Richard Smith wrote:
> On Fri, Jul 26, 2013 at 6:05 PM, reed kotler <rkotler at mips.com
> <mailto:rkotler at mips.com>> wrote:
>
> I'm chasing down another issue with floor in llvm but noticed this
> strange behavior:
>
> Consider the following code:
>
> extern double floor(double);
> extern double floor_(double);
>
> double x = 1.5;
> double y, y_;
>
> void foo() {
>
> double y = floor(x);
> double y_ = floor_(x);
> }
>
>
> /local/llvmpb_config/install/bin/clang floor1.c -o floor1.llc
> -emit-llvm -S
>
> The attributes for floor and floor_ are different.
>
>
> This is expected; we recognise 'floor' as a builtin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130726/d9f22a68/attachment.html>
More information about the cfe-dev
mailing list