A very weird bug happened to me with gcc/9.3.0. Below is the minimal reproduced code test.c.
#include <stdio.h>
#include <math.h>
int main()
{
double tmp[] = {3.0000, 2.0000, 1.0000, 2.0000, 1.0000, 2.0000, 3.0000,
2.0000, 1.0000, 2.0000, 3.0000, 2.0000, 2.0000, 2.0000,
2.0000, 1.0000, 3.0000, 2.0000, 2.0000, 1.0000, 3.0000,
3.0000, 1.0000, 2.0000, 2.0000};
double tmp2 = tmp[12] * log(tmp[10] * tmp[1] - tmp[2]);
printf("log 3 is %.3f\n", tmp2);
}
compile error is the following:
$ gcc ./test/test.c -o test_log
/hpc/apps/gcc/9.3.0/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccotSPH5.o: in function `main':
test.c:(.text+0x199): undefined reference to `log'
collect2: error: ld returned 1 exit status
Please advise. Thanks for your time.