Community
cancel
Showing results for 
Search instead for 
Did you mean: 
TRUONG__PHONG
Novice
554 Views

math.h and C++ intel compiler 19.1

Hi,

We are trying to compile our code (which compiles fine with 16.x on SUSE) with intel compiler 19.1 on redhat and get the following error:

allowing all exceptions is incompatible with previous function "gamma"  (and all the math functions have the same error)

 icpc -c -m64 -DLS64BIT -fPIC -O2 -Kc++ -DDB2UDB  -DSQL_KERNEL_EXTENSION -DUNIX -DBUILDLEVEL=\"11-ls_8700\" -DLINUX -DLS64BIT -DUNIX_64 -I/home/****/v87ls/src/ls -I/home/****/v87ls/inc -I/home/****/v87ls/build/resources/lnx/icc64/inc -I/home/****/v87ls/build/resources/lnx/oi/common -I/home/db2inst1/sqllib/include -I/home/****/v87ls/src/ldap  -DNULL=0 -o icmplsbv.o /home/****/v87ls/build/objs/db2/icmplsbv.cpp
12:05:14 [albus] /home/****/v87ls/build/objs/db2/icmplsbv.cpp(7610): error: allowing all exceptions is incompatible with previous function "gamma" (declared at line 7287)
12:05:14 [albus]   extern "C" double    gamma( double __x );

Looking at our generated code, this is what I see:

extern double lgamma (double) throw ();

extern "C" double    gamma( double __x );

Obviously the throw() declaration causes the problem.  I am not sure which declaration comes from math.h and where the other one comes from.

Please advise.

Thanks

Phong

 

0 Kudos
11 Replies
Viet_H_Intel
Moderator
554 Views

You can create a preprocessed file (replace -c with -E) and look at the output to see where they are coming from.

TRUONG__PHONG
Novice
554 Views

I think i found why.  I compared the math.h between the 19.1 and 16 (my code works on 16), the difference is:

19.1:

#if (!defined(__linux__) && !defined(__APPLE__) && !defined(__NetBSD__) && !defined(__QNX__) && !defined(__VXWORKS__)) || defined(__PURE_INTEL_C99_HEADERS__)

 _LIBIMF_EXTERN_C double   _LIBIMF_PUBAPI erf( double __x );
 _LIBIMF_EXTERN_C float    _LIBIMF_PUBAPI erff( float __x );

 _LIBIMF_EXTERN_C double   _LIBIMF_PUBAPI erfc( double __x );
 _LIBIMF_EXTERN_C float    _LIBIMF_PUBAPI erfcf( float __x );

 _LIBIMF_EXTERN_C double   _LIBIMF_PUBAPI lgamma( double __x );
 _LIBIMF_EXTERN_C float    _LIBIMF_PUBAPI lgammaf( float __x );
#endif  /* !__linux__ && !__APPLE__ && !__NetBSD__ && !__QNX__ || __PURE_INTEL_C99_HEADERS__ */

/* Obsolete alias for `lgamma'.  */
_LIBIMF_EXTERN_C double   _LIBIMF_PUBAPI gamma( double __x );
_LIBIMF_EXTERN_C float    _LIBIMF_PUBAPI gammaf( float __x );

/* reentrant gamma functions */
_LIBIMF_EXTERN_C double   _LIBIMF_PUBAPI lgamma_r(double __x, int *__signgam);
_LIBIMF_EXTERN_C float    _LIBIMF_PUBAPI lgammaf_r( float __x, int *__signgam );

_LIBIMF_EXTERN_C double   _LIBIMF_PUBAPI gamma_r( double __x, int *__signgam );
_LIBIMF_EXTERN_C float    _LIBIMF_PUBAPI gammaf_r( float __x, int *__signgam );

 

==> Notice that the gamma and gammaf, lgamma, lgammf functions are defined OUTSIDE of the ifdef. As a result these are declared in my program and cause problem.

In version 16, these functions are INSIDE the ifdef, and not declared for my env.

I manually change the math.h and put them back into the ifdef, it worked.

 

Is this a bug, any idea?

 

Thanks

Phong

 

 

Viet_H_Intel
Moderator
554 Views

Can you attached that preprocessed file?

TRUONG__PHONG
Novice
554 Views

Attached preprocessed file . Thanks

Viet_H_Intel
Moderator
554 Views

I can't recompile your file. it doesn't look like it's a preprocessed file.

$ icpc -c -m64 -DLS64BIT -fPIC -O2 -Kc++ -DDB2UDB  -DSQL_KERNEL_EXTENSION -DUNIX -DBUILDLEVEL=\"11-ls_8700\" -DLINUX -DLS64BIT -DUNIX_64 icmplsbv.cpp -w
icmplsbv.cpp(19): catastrophic error: cannot open source file "sqladef.h"
  #include "sqladef.h"
 

TRUONG__PHONG
Novice
554 Views

Hi I am attaching 2 .h files so that you can compile it.  For reference:  After we do -E , our files go thru database preprocess which add these .h files.

 

Thanks,

Phong

Viet_H_Intel
Moderator
554 Views

I downloaded your 3 attached files, but couldn't able to compile (even with g++).

Can you attached a zip file, which contains all files, command line options  and at least be able to compile with g++?

$icpc -c -m64 -DLS64BIT -fPIC -O2 -Kc++ -DDB2UDB  -DSQL_KERNEL_EXTENSION -DUNIX -DBUILDLEVEL=\"11-ls_8700\" -DLINUX -DLS64BIT -DUNIX_64 icmplsbv.cpp -w
icmplsbv.cpp(7228): error #77: this declaration has no storage class or type specifier
  math.h 
  ^

icmplsbv.cpp(7228): error: expected a ";"
  math.h 
      ^

icmplsbv.cpp(7530): error: expected a declaration
  }
  ^

icmplsbv.cpp(7534): error: linkage specification is incompatible with previous "isinff" (declared at line 7352)
   extern "C" int isinff         ( float              __x ) throw();
                  ^

icmplsbv.cpp(7536): error: linkage specification is incompatible with previous "isinfl" (declared at line 7434)
   extern "C" int isinfl         ( long double            __x ) throw();
                  ^

icmplsbv.cpp(7537): error: linkage specification is incompatible with previous "isnanf" (declared at line 7359)
   extern "C" int isnanf         ( float              __x ) throw();
                  ^

icmplsbv.cpp(7539): error: linkage specification is incompatible with previous "isnanl" (declared at line 7441)
   extern "C" int isnanl         ( long double            __x ) throw();
                  ^

icmplsbv.cpp(7546): error: linkage specification is incompatible with previous "finitef" (declared at line 7353)
   extern "C" int finitef        ( float              __x ) throw();
                  ^

$ g++ -c -m64 -DLS64BIT -fPIC -O2 -Kc++ -DDB2UDB  -DSQL_KERNEL_EXTENSION -DUNIX -DBUILDLEVEL=\"11-ls_8700\" -DLINUX -DLS64BIT -DUNIX_64 icmplsbv.cpp -w
g++: error: unrecognized command line option ‘-Kc++’
$ g++ -c -m64 -DLS64BIT -fPIC -O2  -DDB2UDB  -DSQL_KERNEL_EXTENSION -DUNIX -DBUILDLEVEL=\"11-ls_8700\" -DLINUX -DLS64BIT -DUNIX_64 icmplsbv.cpp -w
icmplsbv.cpp:7228:1: error: ‘math’ does not name a type; did you mean ‘hash’?
 math.h 
 ^~~~
 hash
icmplsbv.cpp:7646:12: error: ‘_LIB_VERSION_TYPE’ does not name a type
 extern "C" _LIB_VERSION_TYPE  _LIB_VERSIONIMF;
            ^~~~~~~~~~~~~~~~~
icmplsbv.cpp: In function ‘char* itoa(int, char*, int)’:
icmplsbv.cpp:8674:32: error: ‘floor’ was not declared in this scope
             uvalue = (unsigned)floor( (double)uvalue / (double)radix );
                                ^~~~~
icmplsbv.cpp:8674:32: note: suggested alternative: ‘float’
             uvalue = (unsigned)floor( (double)uvalue / (double)radix );
                                ^~~~~
                                float
 

TRUONG__PHONG
Novice
554 Views

I cleaned up and resend all the needed files here in gamma.tar.  the file icmplsbv.cpp only needs 2 .h included.  Please take a look. I also have the comp script for compiling.

Thanks,

Phong

Viet_H_Intel
Moderator
554 Views

This is what I am seeing with icpc and g++, with the same errors.

$ icpc -c -m64 -DLS64BIT  -DDB2UDB  -DSQL_KERNEL_EXTENSION -DUNIX -DLS64BIT -DUNIX_64 icmplsbv.cpp -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.1.144 Build 20181018
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

Edison Design Group C/C++ Front End, version 5.0 (Oct 18 2018 02:20:23)
Copyright 1988-2018 Edison Design Group, Inc.

icmplsbv.cpp(7612): error: allowing all exceptions is incompatible with previous function "gamma" (declared at line 7287)
    extern "C" double    gamma( double __x );
                                            ^

icmplsbv.cpp(7613): error: allowing all exceptions is incompatible with previous function "gammaf" (declared at line 7369)
    extern "C" float     gammaf( float __x );
                                            ^

icmplsbv.cpp(7614): error: allowing all exceptions is incompatible with previous function "lgamma_r" (declared at line 7288)
    extern "C" double    lgamma_r(double __x, int *__signgam);
                                                             ^

icmplsbv.cpp(7615): error: allowing all exceptions is incompatible with previous function "lgammaf_r" (declared at line 7370)
    extern "C" float     lgammaf_r( float __x, int *__signgam );
                                                               ^

compilation aborted for icmplsbv.cpp (code 2)
$ g++ -c -m64 -DLS64BIT  -DDB2UDB  -DSQL_KERNEL_EXTENSION -DUNIX -DLS64BIT -DUNIX_64 icmplsbv.cpp -w
icmplsbv.cpp:7612:24: error: declaration of ‘double gamma(double)’ has a different exception specifier
   extern "C" double    gamma( double __x );
                        ^~~~~
icmplsbv.cpp:7287:15: note: from previous declaration ‘double gamma(double) throw ()’
 extern double gamma (double) throw (); extern double __gamma (double) throw ();
               ^~~~~
icmplsbv.cpp:7613:24: error: declaration of ‘float gammaf(float)’ has a different exception specifier
   extern "C" float     gammaf( float __x );
                        ^~~~~~
icmplsbv.cpp:7369:14: note: from previous declaration ‘float gammaf(float) throw ()’
 extern float gammaf (float) throw (); extern float __gammaf (float) throw ();
              ^~~~~~
icmplsbv.cpp:7614:24: error: declaration of ‘double lgamma_r(double, int*)’ has a different exception specifier
   extern "C" double    lgamma_r(double __x, int *__signgam);
                        ^~~~~~~~
icmplsbv.cpp:7288:15: note: from previous declaration ‘double lgamma_r(double, int*) throw ()’
 extern double lgamma_r (double, int *__signgamp) throw (); extern double __lgamma_r (double, int *__signgamp) throw ();
               ^~~~~~~~
icmplsbv.cpp:7615:24: error: declaration of ‘float lgammaf_r(float, int*)’ has a different exception specifier
   extern "C" float     lgammaf_r( float __x, int *__signgam );
                        ^~~~~~~~~
icmplsbv.cpp:7370:14: note: from previous declaration ‘float lgammaf_r(float, int*) throw ()’
 extern float lgammaf_r (float, int *__signgamp) throw (); extern float __lgammaf_r (float, int *__signgamp) throw ();
              ^~~~~~~~~
 

TRUONG__PHONG
Novice
554 Views

Yes, that is the problem.

 

The gamma functions are being complained as double declared.  I am guessing on with throw() and one without.  Any idea? NOte that These are system included files, I only include math.h

 

Thanks

TRUONG__PHONG
Novice
554 Views

Hi,

Any help? or advise how I report this problem to intel? Thanks

Reply