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 in using functions defined in math.h


Hello,

Following is a test file where I have shown the calls which work correctly and also the calls that fail. Only one failing call was included, the rest are in comments. I've attached the file test.i.bz2.

/* test.c - test what happens when getchar is called after EOF */

#include <math.h>

int main()
{
  double r, x, y;
  int n;

  n = 10;
  x = 100.0;
  y = 10.0;

  r = fabs(x);
  r = ldexp(x,n);
  r = frexp(x,&n);
  r = modf(x,&y);
  r = sin(x);
  /*  r = cos(x); */
  /*  r = tan(x); */
  /*  r = asin(x); */
  /*  r = acos(x); */
  /*  r = atan(x); */
  /*  r = atan2(x,y); */
  /*  r = sinh(x); */
  /*  r = cosh(x); */
  /*  r = tanh(x); */
  /*  r = exp(x); */
  /*  r = log(x); */
  /*  r = log10(x); */
  /*  r = pow(x,y); */
  /*  r = sqrt(x); */
  /*  r = ceil(x); */
  /*  r = floor(x); */
  /*  r = fmod(x,y); */
  return 0;
}

The output from emacs is as follows:

cd /home/sedge/study/bug/
gcc -v -save-temps -g -o test test.c
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/specs
Configured with: ../gcc-3.2.2/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i386-slackware-linux --host=i386-slackware-linux
Thread model: posix
gcc version 3.2.2
/usr/lib/gcc-lib/i386-slackware-linux/3.2.2/cpp0 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ test.c test.i
GNU CPP version 3.2.2 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i386-slackware-linux/3.2.2/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i386-slackware-linux/3.2.2/cc1 -fpreprocessed test.i -quiet -dumpbase test.c -g -version -o test.s
GNU CPP version 3.2.2 (cpplib) (i386 Linux/ELF)
GNU C version 3.2.2 (i386-slackware-linux)
compiled by GNU C version 3.2.2.


/usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../../i386-slackware-linux/bin/as -V -Qy -o test.o test.s
GNU assembler version 2.13.90.0.18 (i386-slackware-linux) using BFD version 2.13.90.0.18 20030121
/usr/lib/gcc-lib/i386-slackware-linux/3.2.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../crt1.o /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../crti.o /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/crtbegin.o -L/usr/lib/gcc-lib/i386-slackware-linux/3.2.2 -L/usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../../i386-slackware-linux/lib -L/usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../.. test.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/crtend.o /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../crtn.o
test.o(.text+0x96): In function `main':
/home/sedge/study/bug/test.c:18: undefined reference to `sin'
collect2: ld returned 1 exit status


Compilation exited abnormally with code 1 at Mon Sep 1 16:46:52

I hope this is enough information. Thank you for your consideration.

Sincerely,
Chester Rouse
CSRouse@mn.rr.com

Attachment: test.i.bz2
Description: Binary data


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