This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ 2.95.2 ICE on legal code
- To: gcc-bugs at gcc dot gnu dot org
- Subject: g++ 2.95.2 ICE on legal code
- From: "Daniel D. Weston" <ddweston at cinesite dot com>
- Date: Tue, 08 Aug 2000 14:11:40 -0700
- Organization: Cinesite Digital Effects
- Reply-To: "Daniel D. Weston" <ddweston at cinesite dot com>
GNU bug report
Originator: Dan Weston <ddweston@cinesite.com>
Date: Tue Aug 8 14:23:02 PDT 2000
Release: gcc 2.95.2
Category: c++
Confidential: no
Severity: serious
Priority: medium
Class: ice-on-legal-code
Synopsis:
Including <valarray> triggers ICE 390 when passing in built-in
function exp to a user-defined function that expects a
double (*)(double) arg.
Workaround:
There is no error if #include <valarray> is removed, or if
an explicit function ptr is used.
Source code:
// File: buggy.C
#include <math.h>
typedef double (*FuncPtr)(double);
double SomeFunc(FuncPtr fPtr) { return (*fPtr)(1.0); }
double MyFunc(double x) { return exp(x); }
// If the following line is commented out, the code compiles fine
#include <valarray>
int
main()
{
// No problem with user-defined function or function ptr:
FuncPtr myFuncPtr = MyFunc;
const double a = SomeFunc(MyFunc);
const double b = SomeFunc(&MyFunc);
const double c = SomeFunc(myFuncPtr);
// No problem with ptr to built-in function:
FuncPtr builtInFuncPtr = exp;
const double d = SomeFunc(builtInFuncPtr);
// Compiler has internal error 390 passing in built-in function:
const double e = SomeFunc(exp);
// This doesn't work either:
const double f = SomeFunc(&exp);
return 0;
}
Compilation Log:
gcc -v --save-temps -c buggy.C
Reading specs from /usr/local/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/local/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/cpp -lang-c++ -v
-D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dunix
-Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 -D_LONGLONG
-D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix__ -D__mips__ -D__sgi__
-D__host_mips__ -D__MIPSEB__ -D_MIPSEB -D__SYSTYPE_SVR4__ -D_LONGLONG
-D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix -D__mips -D__sgi
-D__host_mips -D__MIPSEB -D__SYSTYPE_SVR4 -Asystem(unix) -Asystem(svr4)
-Acpu(mips) -Amachine(sgi) -D__EXCEPTIONS -D__CHAR_UNSIGNED__
-D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS
-D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__EXTENSIONS__
-D_SGI_SOURCE -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3 -D_ABIN32=2
-D_MIPS_SIM=_ABIN32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32
-D_COMPILER_VERSION=601 -U__mips -D__mips=3 -D__mips64 buggy.C buggy.ii
GNU CPP version 2.95.2 19991024 (release) [AL 1.1, MM 40] SGI running
IRIX 6.x
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/../../../../include/g++-3
/usr/local/include
/usr/local/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/../../../../mips-sgi-irix6.2/include
/usr/local/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path:
End of omitted list.
/usr/local/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/cc1plus buggy.ii -quiet
-dumpbase buggy.cc -version -o buggy.s
GNU C++ version 2.95.2 19991024 (release) (mips-sgi-irix6.2) compiled by
GNU C version 2.95.2 19991024 (release).
buggy.C: In function `int main()':
buggy.C:28: Internal compiler error 390.
buggy.C:28: Please submit a full bug report.
buggy.C:28: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport>
for instructions.