[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#133574: gcc: gcc generates incorrect executables if huge static arrays are used



Package: gcc
Version: 2:2.95.4-9
Severity: normal


-- System Information
Debian Release: testing/unstable
Kernel Version: Linux atrey 2.2.20 #4 Tue Nov 6 15:21:30 CET 2001 i586 unknown

Versions of the packages gcc depends on:
ii  cpp            2.95.4-9       The GNU C preprocessor.
ii  cpp-2.95       2.95.4-0.01090 The GNU C preprocessor.
ii  gcc-2.95       2.95.4-0.01090 The GNU C compiler.

Hi!

I have reported this before:

If big arrays are in use, gcc compiles statically linked executable
(even through dynamic compilation was requested) and resulting
executable coredumps. Pretty nasty error.

binutils:
pavel@atrey:~/sf/nltools/slm$ ld --version
GNU ld version 2.11.92.0.12.3 20011121 Debian/GNU Linux
Copyright 2001 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License.  This program has absolutely no
warranty.
pavel@atrey:~/sf/nltools/slm$ 

In its previous incarnation, bug was hidden by going to new gcc
version... But it looks like it only raised a bar a bit.

To reproduce:

pavel@atrey:~/sf/nltools/slm$ gcc delme.c -o delme
delme.c: In function `main':
delme.c:21: warning: return type of `main' is not `int'
pavel@atrey:~/sf/nltools/slm$ ldd ./delme
	not a dynamic executable
pavel@atrey:~/sf/nltools/slm$ cat delme.c

#define MAXLEN 20
#define MAXTAG 10
double
#speedup[MAXLEN][MAXLEN][MAXLEN][MAXLEN][MAXTAG][MAXTAG][MAXTAG];

void
init_speedup(void)
{
	int i, j, k, l, o, m, n;
	for (i=0; i<MAXLEN; i++)
		for (j=0; j<MAXLEN; j++)
			for (k=0; k<MAXLEN; k++)
				for (l=0; l<MAXLEN; l++)
					for (o=0; o<MAXTAG; o++)
						for (m=0; m<MAXTAG;
m++)
							for (n=0;
n<MAXTAG; n++)
								speedup[i][j][k][l][o][m][n] = -1.0;
}

void main(void)
{
	init_speedup();
}
pavel@atrey:~/sf/nltools/slm$ 

If you fail to reproduce it (i.e. it generates dynamic executable) try
to make array bigger.

									Pavel




Reply to: