This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GCC v.2.95.2 Bug Report on Solaris 2.6
- To: gcc-bugs at gcc dot gnu dot org
- Subject: GCC v.2.95.2 Bug Report on Solaris 2.6
- From: Jackie Zoucha <Jackie dot Zoucha at trw dot com>
- Date: Tue, 21 Mar 2000 14:44:30 -0800
- Organization: TRW ESD
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;
}
# 1 "main.cpp"
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;
}
.file "main.cpp"
gcc2_compiled.:
section ".data"
.align 4
.type MAX_NUMBER,#object
.size MAX_NUMBER,4
MAX_NUMBER:
.uaword 256
section ".text"
.align 4
.global main
.type main,#function
.proc 04
main:
LLFB1:
!#PROLOGUE# 0
save %sp, -112, %sp
LLCFI0:
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
sethi %hi(MAX_NUMBER), %o1
or %o1, %lo(MAX_NUMBER), %o0
ld [%o0], %o1
add %o1, -1, %l0
add %l0, 1, %l1
mov %l1, %o0
sll %o0, 5, %o1
mov %o1, %l1
add %l0, 1, %l2
mov %l2, %o0
sll %o0, 2, %o1
mov %o1, %l2
add %l0, 2, %l4
add %l4, 1, %l3
mov %l3, %o0
sll %o0, 5, %o1
mov %o1, %l3
add %l4, 1, %l5
mov %l5, %o0
sll %o0, 2, %o1
mov %o1, %l5
mov %sp, %l6
srl %l3, 3, %o0
add %o0, 7, %o1
add %sp, 92, %o0
sub %o0, %sp, %o2
srl %o1, 3, %o0
mov %o0, %o3
sll %o3, 3, %o0
add %o1, %o2, %o1
add %o1, 7, %o2
srl %o2, 3, %o1
mov %o1, %o2
sll %o2, 3, %o1
sub %sp, %o0, %sp
add %sp, 92, %o0
add %o0, 7, %o1
srl %o1, 3, %o0
mov %o0, %o1
sll %o1, 3, %l7
mov %l7, %o0
call initialize__FP4info, 0
nop
mov %l6, %sp
mov 0, %i0
b .LL2
nop
mov 0, %i0
b .LL2
nop
LL2:
ret
restore
LLFE1:
LLfe1:
.size main,.LLfe1-main