http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60789

            Bug ID: 60789
           Summary: [4.9 Regression] Missing -lm while checking for math
                    functions (e.g., atan2f)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.abdurachmanov at gmail dot com

Math functions tests are failing with GCC 4.9.0 (trunk, r209221), while working
fine at least up to 4.8.1.

Tested on x86_64 (Scientific Linux 6.5) and aarch64 (Fedora 19).

Looking at compile time, seems that `-lm` was lost.

This caused a number of _GLIBCXX_HAVE_* not being defined for math functions in
`c++config.h`, thus causes functions like `atan2f` to call `(float)atan2(x,
y)`.

##### Fragment from ./x86_64-unknown-linux-gnu/libstdc++-v3/config.log, GCC
4.8.1, checking for `atan2f`.

configure:22347: checking for atan2f declaration
configure:22372: 
/build1/davidlt/gcc421diff/a/BUILD/slc6_amd64_gcc481/external/gcc/4.8.1-cms/gcc-gcc-4_8-branch-199526/obj/./gcc/xgcc
-shared-libgcc
-B/build1/davidlt/gcc421diff/a/BUILD/slc6_amd64_gcc481/external/gcc/4.8.1-cms/gcc-gcc-4_8-branch-199526/obj/./gcc
-nostdinc++
-L/build1/davidlt/gcc421diff/a/BUILD/slc6_amd64_gcc481/external/gcc/4.8.1-cms/gcc-gcc-4_8-branch-199526/obj/x86_64-redhat-linux-gnu/libstdc++-v3/src
-L/build1/davidlt/gcc421diff/a/BUILD/slc6_amd64_gcc481/external/gcc/4.8.1-cms/gcc-gcc-4_8-branch-199526/obj/x86_64-redhat-linux-gnu/libstdc++-v3/src/.libs
-B/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/bin/
-B/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/lib/
-isystem
/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/include
-isystem
/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/sys-include
   -c -fno-builtin -D_GNU_SOURCE  conftest.cpp >&5
configure:22372: $? = 0
configure:22388: result: yes
configure:22394: checking for atan2f
configure:22394:
/build1/davidlt/gcc421diff/a/BUILD/slc6_amd64_gcc481/external/gcc/4.8.1-cms/gcc-gcc-4_8-branch-199526/obj/./gcc/xgcc
-B/build1/davidlt/gcc421diff/a/BUILD/slc6_amd64_gcc481/external/gcc/4.8.1-cms/gcc-gcc-4_8-branch-199526/obj/./gcc/
-B/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/bin/
-B/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/lib/
-isystem
/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/include
-isystem
/build1/davidlt/gcc421diff/a/tmp/BUILDROOT/abdabd72f629a2521d29cea96ef20750/opt/cmssw/slc6_amd64_gcc481/external/gcc/4.8.1-cms/x86_64-redhat-linux-gnu/sys-include
   -o conftest -g -O2   conftest.c  -lm >&5
conftest.c:161:6: warning: conflicting types for built-in function 'atan2f'
[enabled by default]
 char atan2f ();
      ^
configure:22394: $? = 0
configure:22394: result: yes

##### Same from GCC 4.9.0

configure:22559: checking for atan2f declaration
configure:22584:
/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/./gcc/xgcc
-shared-libgcc
-B/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/./gcc
-nostdinc++
-L/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/x86_64-redhat-linux-gnu/libstdc++-v3/src
-L/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/x86_64-redhat-linux-gnu/libstdc++-v3/src/.libs
-L/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/x86_64-redhat-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/bin/
-B/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/lib/
-isystem
/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/include
-isystem
/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/sys-include
   -c -fno-builtin -D_GNU_SOURCE  conftest.cpp >&5
configure:22584: $? = 0
configure:22600: result: yes
configure:22606: checking for atan2f
configure:22606:
/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/./gcc/xgcc
-B/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/./gcc/
-B/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/bin/
-B/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/lib/
-isystem
/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/include
-isystem
/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/x86_64-redhat-linux-gnu/sys-include
   -o conftest -g -O2
-I/build1/davidlt/gcc421diff/490/a/tmp/BUILDROOT/b60735266dcb81302bac5b296e8c0965/opt/cmssw/slc6_amd64_gcc490/external/gcc/4.9.0-cms/tmp/sw/include
  conftest.c   >&5
conftest.c:143:6: warning: conflicting types for built-in function 'atan2f'
char atan2f ();
     ^
/build1/davidlt/gcc421diff/490/a/tmp/ccVJvdmR.o: In function `main':
/build1/davidlt/gcc421diff/490/a/BUILD/slc6_amd64_gcc490/external/gcc/4.9.0-cms/gcc-trunk-209221/obj/x86_64-redhat-linux-gnu/libstdc++-v3/conftest.c:154:
undefined reference to `atan2f'
collect2: error: ld returned 1 exit status
configure:22606: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "package-unused"
| #define PACKAGE_TARNAME "libstdc++"
| #define PACKAGE_VERSION "version-unused"
| #define PACKAGE_STRING "package-unused version-unused"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define _GLIBCXX_HOSTED 1
| #define _GLIBCXX_VERBOSE 1
| #define _GLIBCXX_USE_DECIMAL_FLOAT 1
| #define _GLIBCXX_USE_INT128 1
| #define _GLIBCXX_USE_FLOAT128 1
| #define HAVE_STRXFRM_L 1
| #define HAVE_STRERROR_L 1
| #define HAVE_STRERROR_R 1
| #define _GLIBCXX_USE_LONG_LONG 1
| #define HAVE_WCHAR_H 1
| #define HAVE_MBSTATE_T 1
| #define HAVE_WCTYPE_H 1
| #define _GLIBCXX_USE_WCHAR_T 1
| #define _GLIBCXX_USE_C99_MATH 1
| #define HAVE_TGMATH_H 1
| #define HAVE_COMPLEX_H 1
| #define _GLIBCXX_USE_C99_COMPLEX 1
| #define HAVE_VFWSCANF 1
| #define HAVE_VSWSCANF 1
| #define HAVE_VWSCANF 1
| #define HAVE_WCSTOF 1
| #define HAVE_ISWBLANK 1
| #define _GLIBCXX_USE_C99 1
| #define _GLIBCXX_FULLY_DYNAMIC_STRING 0
| #define HAVE_GETS 1
| #define HAVE_EOWNERDEAD 1
| #define HAVE_ENOTRECOVERABLE 1
| #define HAVE_ENOLINK 1
| #define HAVE_EPROTO 1
| #define HAVE_ENODATA 1
| #define HAVE_ENOSR 1
| #define HAVE_ENOSTR 1
| #define HAVE_ETIME 1
| #define HAVE_EBADMSG 1
| #define HAVE_ECANCELED 1
| #define HAVE_EOVERFLOW 1
| #define HAVE_ENOTSUP 1
| #define HAVE_EIDRM 1
| #define HAVE_ETXTBSY 1
| #define HAVE_ECHILD 1
| #define HAVE_ENOSPC 1
| #define HAVE_EPERM 1
| #define HAVE_ETIMEDOUT 1
| #define HAVE_EWOULDBLOCK 1
| #define HAVE_INT64_T 1
| #define HAVE_INT64_T_LONG 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_UIO_H 1
| #define HAVE_FENV_H 1
| #define HAVE_COMPLEX_H 1
| #define HAVE_COMPLEX_H 1
| #define _GLIBCXX_USE_C99_COMPLEX_TR1 1
| #define _GLIBCXX_USE_C99_CTYPE_TR1 1
| #define HAVE_FENV_H 1
| #define _GLIBCXX_USE_C99_FENV_TR1 1
| #define _GLIBCXX_USE_C99_STDINT_TR1 1
| #define _GLIBCXX_USE_C99_MATH_TR1 1
| #define _GLIBCXX_USE_C99_INTTYPES_TR1 1
| #define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1
| #define HAVE_STDBOOL_H 1
| #define HAVE_STDALIGN_H 1
| #define _GLIBCXX_STDIO_EOF -1
| #define _GLIBCXX_STDIO_SEEK_CUR 1
| #define _GLIBCXX_STDIO_SEEK_END 2
| #define HAVE_SYS_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL 1
| #define _GLIBCXX_USE_CLOCK_MONOTONIC 1
| #define _GLIBCXX_USE_CLOCK_REALTIME 1
| #define _GLIBCXX_USE_SCHED_YIELD 1
| #define HAVE_SLEEP 1
| #define HAVE_USLEEP 1
| #define HAVE_LC_MESSAGES 1
| #define HAVE_SYS_SYSINFO_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ENDIAN_H 1
| #define HAVE_EXECINFO_H 1
| #define HAVE_FLOAT_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_LOCALE_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_IPC_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SEM_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_WCTYPE_H 1
| #define HAVE_ISINF 1
| #define HAVE_ISNAN 1
| #define HAVE_FINITE 1
| #define HAVE_ISNANF 1
| #define HAVE_ISINFF 1
| /* end confdefs.h.  */
| /* Define atan2f to an innocuous variant, in case <limits.h> declares atan2f.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define atan2f innocuous_atan2f
| 
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char atan2f (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
| 
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| 
| #undef atan2f
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char atan2f ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_atan2f || defined __stub___atan2f
| choke me
| #endif
| 
| int
| main ()
| {
| return atan2f ();
|   ;
|   return 0;
| }
configure:22606: result: no

Reply via email to