This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Internal compiler error


On Tue, Apr 24, 2001 at 12:20:59PM -0400, Luca Hall wrote:
> [ xinitric@unix ] $ gcc -v -save-temps -Wall digits.c -o digits
...
> GNU C version 2.95.2 19991024 (release) (i386-unknown-freebsd) compiled by 
> GNU C version 2.95.2 19991024 (release).
> digits.c: In function `main':
> digits.c:7: int-array initialized from non-wide string
> digits.c:7: (near initialization for `digits[0]')
...
> digits.c:9: (near initialization for `digits[9]')
> digits.c:10: Internal compiler error in `const_hash', at varasm.c:2372
> Please submit a full bug report.

Reproducible with close-to-tip of 2.95 branch and with a smaller test
case:

$ cat test.c
int main (void) {
        int digits[1][10] = {
                "zero"
                };
	return 0;
}
$ gcc -v -c test.c
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20010319 (Debian prerelease)
 /usr/lib/gcc-lib/i386-linux/2.95.4/cpp0 -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ test.c /tmp/ccYG1Wzt.i
GNU CPP version 2.95.4 20010319 (Debian prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/2.95.4/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3
 /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../i386-linux/include
End of omitted list.
 /usr/lib/gcc-lib/i386-linux/2.95.4/cc1 /tmp/ccYG1Wzt.i -quiet -dumpbase test.c -version -o /tmp/cc6nBsxM.s
GNU C version 2.95.4 20010319 (Debian prerelease) (i386-linux) compiled by GNU C version 2.95.4 20010319 (Debian prerelease).
test.c: In function `main':
test.c:4: invalid initializer
test.c:4: (near initialization for `digits[0]')
test.c:4: Internal compiler error in `const_hash', at varasm.c:2377
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Unfortunately I don't have a debug build of 2.95 branch right now so I
cannot chase this further.

The bug is also present in 3.0 and in mainline, although it manifests
differently.  In mainline we hit a tree-check ICE in store_constructor,
trying to take TYPE_ALIGN of the error_mark_node.  In 3.0 (which is
built without tree checking), we abort in tree_low_cst, because
output_constructor has done

4492     if (index != 0)
4493       pos = (tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (val)), 1)
4494              * (tree_low_cst (index, 0) - tree_low_cst (min_index, 0)));

and val is error_mark_node.  tree_low_cst gets handed a garbage
pointer which happens to flunk host_integerp.

I'm thinking the appropriate fix here is, when we emit that "invalid
initializer" message, instead of handing back the error_mark_node, we
should gin up a dummy initializer of the appropriate type and use
that, thus avoiding having to teach lots of backend code about
error_marks.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]