--- gcc/testsuite/gcc.dg/20041227-1.c.jj 2004-12-27 13:57:19.126504511 +0100 +++ gcc/testsuite/gcc.dg/20041227-1.c 2004-12-27 13:57:15.864087556 +0100 @@ -0,0 +1,5 @@ +/* { dg-do compile { target i?86-*-* } } */ +/* { dg-options "-mmmx" } */ + +typedef short int V __attribute__ ((vector_size (8))); +static V v = (V) 0x00FF00FF00FF00FFLL; gives ICE in both GCC 3.4.3-RH and on HEAD. Depending whether checking is enabled or not, it either results in checking failure in digest_init or in a segfault in build_vector. The problematic hunk is (c-typeck.c (digest_init)): /* Build a VECTOR_CST from a *constant* vector constructor. If the vector constructor is not constant (e.g. {1,2,3,foo()}) then punt below and handle as a constructor. */ if (code == VECTOR_TYPE && TREE_CODE (TREE_TYPE (inside_init)) == VECTOR_TYPE && vector_types_convertible_p (TREE_TYPE (inside_init), type) && TREE_CONSTANT (inside_init)) { if (TREE_CODE (inside_init) == VECTOR_CST && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), TYPE_MAIN_VARIANT (type))) return inside_init; else return build_vector (type, CONSTRUCTOR_ELTS (inside_init)); } Changing it to else if (TREE_CODE (inside_init) == CONSTRUCTOR) return build_vector (type, CONSTRUCTOR_ELTS (inside_init)); else return inside_init; fixes this, but I have trouble to understand what the code really wants to do. If inside_init is a VECTOR_CST, then if comptypes returns 0, this results in a checking failure too, as a VECTOR_CST is not a CONSTRUCTOR and CONSTRUCTOR_ELTS is solely for CONSTRUCTORs. So, either the inner test should be only if (TREE_CODE (inside_init) == CONSTRUCTOR) return build_vector ...; else return inside_init; with no checking for VECTOR_CST etc., or there needs to be different actions for VECTOR_CST that are compatible, for those where comptypes on TREE_TYPE (inside_init) and type gives non-zero, but for their main variants gives zero (is that even possible?), for CONSTRUCTORS and for other trees that can end up in that place (the testcase here has there a NOP_EXPR with INTEGER_CST inside).
This is a regression on all of the open branches. : Search converges between 2003-07-24-3.3 (#133) and 2003-07-25-3.3 (#134). : Search converges between 2003-03-31-trunk (#217) and 2003-04-01-trunk (#218).
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00739.html>.
Subject: Bug 19164 CVSROOT: /cvs/gcc Module name: gcc Changes by: jakub@gcc.gnu.org 2005-01-19 09:27:24 Modified files: gcc : ChangeLog c-typeck.c gimplify.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: 20050113-1.c gcc/testsuite/gcc.dg: 20050113-1.c Log message: PR c/17297 * c-typeck.c (digest_init): Only call build_vector if all constructor elements are *_CST nodes. * gimplify.c (gimplify_init_constructor): Likewise. * gcc.c-torture/compile/20050113-1.c: New testcase. PR middle-end/19164 * c-typeck.c (digest_init): Only call build_vector if inside_init is a CONSTRUCTOR. * gcc.dg/20050113-1.c: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7183&r2=2.7184 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.410&r2=1.411 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.103&r2=2.104 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4907&r2=1.4908 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20050113-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20050113-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 19164 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: jakub@gcc.gnu.org 2005-01-19 09:44:49 Modified files: gcc : ChangeLog c-typeck.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: 20050113-1.c gcc/testsuite/gcc.dg: 20050113-1.c Log message: PR c/17297 * c-typeck.c (digest_init): Only call build_vector if all constructor elements are *_CST nodes. * gcc.c-torture/compile/20050113-1.c: New testcase. PR middle-end/19164 * c-typeck.c (digest_init): Only call build_vector if inside_init is a CONSTRUCTOR. * gcc.dg/20050113-1.c: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.777&r2=2.2326.2.778 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.272.2.12&r2=1.272.2.13 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.346&r2=1.3389.2.347 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20050113-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20050113-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Not critical for 3.3.6
fixed on 3.4.x