I built an x86 -> sh4 crosscompiler using http://kegel.com/crosstool and either gcc-3.3 or gcc-ss-3_3-20030714, and am seeing the following testsuite failures. The "size of array foo is negative" errors are what worry me. FAIL: gcc.dg/pack-test-1.c (test for excess errors) Excess errors: ... /crosstool-0.14/build/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/gcc-ss-3_3-20030714/gcc/testsuite/gcc.dg/pack-test-1.c:44: error: size of array `test_0' is negative /crosstool-0.14/build/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/gcc-ss-3_3-20030714/gcc/testsuite/gcc.dg/pack-test-1.c:45: error: size of array `test_1' is negative /crosstool-0.14/build/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/gcc-ss-3_3-20030714/gcc/testsuite/gcc.dg/pack-test-1.c:51: warning: #pragma pack(push[, id], <n>) is not supported on this target ... FAIL: gcc.dg/pack-test-2.c (test for errors, line 7) FAIL: gcc.dg/pack-test-2.c (test for errors, line 14) FAIL: gcc.dg/pack-test-2.c (test for errors, line 19) FAIL: gcc.dg/pack-test-2.c (test for excess errors) Excess errors: /crosstool-0.14/build/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/gcc-ss-3_3-20030714/gcc/testsuite/gcc.dg/pack-test-2.c:7: warning: #pragma pack(pop[, id], <n>) is not supported on this target ...
Looks like these tests should not be tested on sh4-*-linux*.
Are you sure the "size of array foo is negative" errors are spurious?
No I am saying "warning: #pragma pack(push[, id], <n>) is not supported on this target" is the excess errors so this test is not really meaning full on sh4-*-linux.
Right, I was just worried that the parts of the test that are supported on sh4 might be failing. A quick look makes me feel better - they seem to be passing. We could totally exclude these two tests from running on sh4, but to be really correct, we should also extract the parts of the test that don't use #pragma pack(push...) and put them into gcc.dg/pack-test-0.c or something like that.
http://www.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm may contain a patch that adds #pragma pack(push...) support to gcc for sh4, so maybe the right fix is to arrange for the appropriate part of that patch to be committed...
I can confirm this on the mainline (20030718).
Patches should go to gcc-patches@.
I'm not sure since when, but at least as of rev 189180 (4.8) this problem does not occur anymore.