[Bug c/42094] New: Overwritten floor() function
mindez at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 18 15:43:00 GMT 2009
Consider the following code:
#include <stdio.h>
double floor(double d) {
return 5;
}
int main() {
printf("Floor: %f", floor(3.4) );
}
Note I'm not importing math.h so floor(3.4) should return 5, but the output
from this function is:
lyond8@soba-testing-) floor2
Floor: 3.000000
So it replaces it before checking for any overwritten* functions which return
and take the same types and parameters. I assume this goes for ceil and trunc
as well, but haven't tested them. It's not even overwritten because I'm not
even importing math.h. The built in optimisation functions shouldn't have
replaced floor(3.4) because I'm not importing math.h, but they did.
This is compiled simply with 'gcc floor2.c floor2'
--
Summary: Overwritten floor() function
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mindez at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42094
More information about the Gcc-bugs
mailing list