Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 74689

Summary: /usr/include/math.h has macros that are incompatible with icc 8.1.
Product: Gentoo Linux Reporter: Henrik Grubbström <grubba>
Component: [OLD] DevelopmentAssignee: Karl Trygve Kalleberg (RETIRED) <karltk>
Status: RESOLVED UPSTREAM    
Severity: major CC: nikolaymetchev, tove, xtv
Priority: High    
Version: unspecified   
Hardware: IA64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Henrik Grubbström 2004-12-16 14:21:37 UTC
/usr/include/math.h from sys-libs/glibc-2.3.4.20041102 contains the following segment:
#if __USE_ISOC99 && __GNUC_PREREQ(2,97)
/* ISO C99 defines some macros to compare number while taking care for
   unordered numbers.  Many FPUs provide special instructions to support
   these operations.  Generic support in GCC for these as builtins went
   in before 3.0.0, but not all cpus added their patterns.  We define
   versions that use the builtins here, and <bits/mathinline.h> will
   undef/redefine as appropriate for the specific GCC version in use.  */
# define isgreater(x, y)        __builtin_isgreater(x, y)
# define isgreaterequal(x, y)   __builtin_isgreaterequal(x, y)
# define isless(x, y)           __builtin_isless(x, y)
# define islessequal(x, y)      __builtin_islessequal(x, y)
# define islessgreater(x, y)    __builtin_islessgreater(x, y)
# define isunordered(u, v)      __builtin_isunordered(u, v)
#endif

which appears to be enabled for icc when compiling with _GNU_SOURCE:

$ cat fp_test.c 
#define _GNU_SOURCE
#include <math.h>
int main(int argc, char **argv)
{
  return isless(0.1, 0.0);
}
$ icc -E fp_test.c | tail -n 5
# 3 "fp_test.c"
int main(int argc, char **argv)
{
  return __builtin_isless(0.1, 0.0);
}
$ icc -o fp_test fp_test.c            
/tmp/iccKdN1lv.o(.text+0x32): In function `main':
: undefined reference to `__builtin_isless'


Reproducible: Always
Steps to Reproduce:
1. See above.

Actual Results:  
The binary failed to link.

Expected Results:  
It should have succeeded in linking the binary.

# emerge info
Portage 2.0.51-r8 (default-linux/ia64/2004.3, gcc-3.4.3,
glibc-2.3.4.20041102-r0, 2.6.8-gentoo-r3 ia64)
=================================================================
System uname: 2.6.8-gentoo-r3 ia64 
Gentoo Base System version 1.6.7
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Nov 29 2004, 11:29:43)]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.6.3, 1.8.5-r2, 1.7.9, 1.4_p6, 1.9.3
sys-devel/binutils:  2.14.90.0.8-r1, 2.15.92.0.2-r1
sys-devel/libtool:   1.5.2-r7
virtual/os-headers:  2.6.8.1, 2.6.8.1-r1
ACCEPT_KEYWORDS="ia64"
AUTOCLEAN="yes"
CFLAGS="-O2 -pipe"
CHOST="ia64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage_overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acpi berkdb bitmap-fonts bzlib canna cjk crypt cups emacs encode f77
foomaticdb fortran freetds gdbm gif gmp gnutls gpm gtk gtk2 ia64 imlib ipv6 jpeg
libg++ libwww maildir mbox mhash mikmod mime motif mule multilib mysql mysqli
ncurses nis nls nptl odbc offensive oggvorbis opengl oss pam pcre pdflib perl
pic pie png posix python qt quicktime readline recode samba sdl spell sqlite ssl
tcpd tiff truetype unicode xml2 xmms xpm xv zlib"

$ qpkg -I -v -f `type -path icc`
dev-lang/icc-8.1.021 *

Suggested work-around:
  Add a /opt/intel/intel_cc_80/include/math.h with content similar to the following:

#ifndef __INTEL_MATH_H
#define __INTEL_MATH_H 1

#include_next <math.h>

#include <mathimf.h>

#endif /* __INTEL_MATH_H */
Comment 1 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2005-07-30 12:11:53 UTC
This is really an upstream bug. The label on the tin says icc should be
compatible with gcc. In as much as it isn't (what a stupid sentence!), it's an
bug with icc.

That being said, I do agree we may want to come up with a workaround. Do you
know how many packages your suggested workaround will break? 
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2006-10-19 16:37:46 UTC
Obsolete bug, current stable glibc is 2.3.6 or 2.4.