GCC v.2.95.2 Bug Report on Solaris 2.6

Jackie Zoucha Jackie.Zoucha@trw.com
Tue Mar 21 14:45:00 GMT 2000


Here is the bug I found; the compiler told me to submit a bug report.
Source code, *.ii and *.s are included (I condensed my code down to a
very simple example that still has the problem). 

The main problem is that I accidentally declared static a variable
that should have been const. A version of gcc on a Linux system gave
me a useful error and pointed me to the problem.

Version:: GCC 2.95.2
OS:: Solaris 2.6
Compile Line:: 
hawaii% gcc -v --save-temps main.cpp
Reading specs from
/SunOS5.6/free/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /SunOS5.6/free/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/cpp -lang-c++
-v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc
-Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__
-D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix)
-Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc)
-Amachine(sparc) main.cpp main.ii
GNU CPP version 2.95.2 19991024 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:

/SunOS5.6/free/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3
 /usr/local/include

/SunOS5.6/free/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../sparc-sun-solaris2.6/include
 /SunOS5.6/free/lib/gcc-lib/sparc-sun-solaris2.6/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.
 /SunOS5.6/free/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/cc1plus
main.ii -quiet -dumpbase main.cc -version -o main.s
GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.6)
compiled by GNU C version 2.95.2 19991024 (release).
main.cpp: In function `void initialize(Info *)':
main.cpp:30: Internal compiler error in `find_function_data', at
function.c:542
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for
instructions.


Jackie Zoucha


// NOTE: This is the bug. I accidently said "static" instead of "const"
static int MAX_NUMBER = 256;

typedef struct info {
  int type;
  int Array[MAX_NUMBER];
  int *ptr;
} Info;


void initialize(Info *);


int main (int argc, char **argv)
{
  Info stuff;

  initialize(&stuff);

  return 0;
}


void initialize(Info *info)
{
  int i;
   
  info->ptr = info->Array;
  for (i=0; i<MAX_NUMBER; i++)
    info->ptr[i] = 0;
}


More information about the Gcc-bugs mailing list