This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/42094] New: Overwritten floor() function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]