This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/42094] New: Overwritten floor() function
- From: "mindez at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Nov 2009 15:43:10 -0000
- Subject: [Bug c/42094] New: Overwritten floor() function
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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