Bug 31422

Summary: math.h functions generate warnings on newer version of gcc
Product: gcc Reporter: Matthew Topper <mjt9>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: gcc-bugs
Priority: P3    
Version: 4.1.2   
Target Milestone: ---   
Host: i486-linux-gnu Target: i486-linux-gnu
Build: i486-linux-gnu Known to work:
Known to fail: Last reconfirmed:
Attachments: compiler output with the -v flag
original source file

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)