Bug 31422 - math.h functions generate warnings on newer version of gcc
Summary: math.h functions generate warnings on newer version of gcc
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2007-04-01 20:12 UTC by Matthew Topper
Modified: 2007-04-01 20:23 UTC (History)
1 user (show)

See Also:
Host: i486-linux-gnu
Target: i486-linux-gnu
Build: i486-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:

compiler output with the -v flag (879 bytes, text/plain)
2007-04-01 20:14 UTC, Matthew Topper
original source file (1.09 KB, text/plain)
2007-04-01 20:16 UTC, Matthew Topper

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Topper 2007-04-01 20:12:23 UTC
Hi there.  Some very simple code generates a warning when compiled on gcc 4.1.2.  The code compiles cleanly, when using gcc 3.4.6

The bug involves the use of fmaxf function that is defined in math.h.  First, here is the relevant section: I'm attaching the source file along with the output of the compile command with the -v and -save-temps option.  Feel free to let me know what more information is required.

Next, this is the command I used to compile this file, along with the results.
matt@s226n11:~$ gcc Lab9.c -Wall -o Lab9 -lm
Lab9.c: In function ‘printResults’:
Lab9.c:115: warning: implicit declaration of function ‘fmaxf’
Lab9.c:115: warning: incompatible implicit declaration of built-in function ‘fmaxf’

On a machine that has the older version of gcc installed, I do not receive this warning.

The code still runs correctly in both cases, however.
Comment 1 Matthew Topper 2007-04-01 20:14:59 UTC
Created attachment 13317 [details]
compiler output with the -v flag
Comment 2 Matthew Topper 2007-04-01 20:16:55 UTC
Created attachment 13318 [details]
original source file
Comment 3 Richard Biener 2007-04-01 20:23:59 UTC
You need to build with -std=c99 (see the manual page for fmax)