Bug 27413 - compiling with -ansi puts in broken version of atanh
Summary: compiling with -ansi puts in broken version of atanh
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-04 01:23 UTC by anonymous
Modified: 2006-05-04 01:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
.i file created with -save-temps flag (4.06 KB, application/octet-stream)
2006-05-04 01:25 UTC, anonymous
Details
.s file created with -save-temps (315 bytes, application/octet-stream)
2006-05-04 01:27 UTC, anonymous
Details
output of compiler with --save-temps (639 bytes, text/plain)
2006-05-04 01:28 UTC, anonymous
Details

Note You need to log in before you can comment on or make changes to this bug.
Description anonymous 2006-05-04 01:23:09 UTC
If you use -ansi to compile a program that uses the atanh function, the compiler somehow replaces atanh with a function that just returns 0.  I think the compiler should either put in the correct atanh function or refuses to link/compile.  The following shows how to reproduce the bug:


$ cat > bug.c

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main() { printf("atanh(%f) returns %f!\n",.32,atanh(.32)); return 0;}

$ gcc bug.c -o bug.exe -lm && bug.exe
atanh(0.320000) returns 0.331647!
$ gcc -ansi bug.c -o bug.exe -lm && bug.exe
atanh(0.320000) returns 0.000000!
Comment 1 anonymous 2006-05-04 01:25:56 UTC
Created attachment 11370 [details]
.i file created with -save-temps flag
Comment 2 anonymous 2006-05-04 01:27:33 UTC
Created attachment 11371 [details]
.s file created with -save-temps
Comment 3 anonymous 2006-05-04 01:28:15 UTC
Created attachment 11372 [details]
output of compiler with --save-temps
Comment 4 Andrew Pinski 2006-05-04 01:52:18 UTC
t1.c: In function 'main':
t1.c:5: warning: implicit declaration of function 'atanh'
t1.c:5: warning: format '%f' expects type 'double', but argument 3 has type 'int'


You need either -std=c99 or not use -ansi as atanh is a C99 math function and not part of C90.  Also this is more of a glibc issue than a GCC one.