public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23337] New: ICE initializing array of vectors in C++
@ 2005-08-11 18:36 ian at airs dot com
  2005-08-11 18:45 ` [Bug c++/23337] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ian at airs dot com @ 2005-08-11 18:36 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1585 bytes --]

This C++ program:

typedef int vec __attribute__ ((vector_size (8)));
extern int bar (vec);
int
foo (int i)
{
  vec a[] = { (vec) { 0, i }, (vec) { 4, 5 } };
  return bar (a[0]) + bar (a[1]);
}

when compiled with or without optimization gives this ICE in a compiler with
checking enabled:

/home/ian/foo.cc: In function ‘int foo(int)’:
/home/ian/foo.cc:6: internal compiler error: tree check: expected field_decl,
have integer_cst in component_ref_field_offset, at expr.c:5683

The misstep which leads to that is in gimplify_init_ctor_eval which assumes that
if array_elt_type is NULL that purpose is a FIELD_DECL.  That is not true when
constructing a vector type.  However, the problem presumably has to be fixed at
a higher level, since as far as I know there is no equivalent to ARRAY_REF or
COMPONENT_REF for vector types.

The same program does not ICE in C, so I'm reporting this as a C++ bug.  Perhaps
C++ is generating incorrect GENERIC.  Or perhaps the fact that C uses
COMPOUND_LITERAL_EXPR makes it work more or less by accident in C.

-- 
           Summary: ICE initializing array of vectors in C++
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian at airs dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23337


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/23337] [4.0/4.1 Regression] ICE initializing array of vectors in C++
  2005-08-11 18:36 [Bug c++/23337] New: ICE initializing array of vectors in C++ ian at airs dot com
@ 2005-08-11 18:45 ` pinskia at gcc dot gnu dot org
  2005-08-16 22:17 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-11 18:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-11 18:45 -------
Confirmed, 3.4.0 accepted the code without an ICE even with checking enabled.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-11 18:45:51
               date|                            |
            Summary|ICE initializing array of   |[4.0/4.1 Regression] ICE
                   |vectors in C++              |initializing array of
                   |                            |vectors in C++
   Target Milestone|---                         |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23337


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/23337] [4.0/4.1 Regression] ICE initializing array of vectors in C++
  2005-08-11 18:36 [Bug c++/23337] New: ICE initializing array of vectors in C++ ian at airs dot com
  2005-08-11 18:45 ` [Bug c++/23337] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-08-16 22:17 ` cvs-commit at gcc dot gnu dot org
  2005-08-16 22:18 ` cvs-commit at gcc dot gnu dot org
  2005-08-16 22:24 ` ian at airs dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-16 22:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-16 22:07 -------
Subject: Bug 23337

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ian@gcc.gnu.org	2005-08-16 22:07:45

Modified files:
	gcc            : ChangeLog gimplify.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: vector2.C 

Log message:
	./
	PR c++/23337
	* gimplify.c (gimplify_init_ctor_eval): If we see an element of
	vector type, don't try to construct it element by element.  Add an
	assertion that we use a FIELD_DECL when building a COMPONENT_REF.
	testsuite/
	PR c++/23337
	* g++.dg/ext/vector2.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9748&r2=2.9749
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.145&r2=2.146
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5930&r2=1.5931
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vector2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23337


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/23337] [4.0/4.1 Regression] ICE initializing array of vectors in C++
  2005-08-11 18:36 [Bug c++/23337] New: ICE initializing array of vectors in C++ ian at airs dot com
  2005-08-11 18:45 ` [Bug c++/23337] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-08-16 22:17 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-16 22:18 ` cvs-commit at gcc dot gnu dot org
  2005-08-16 22:24 ` ian at airs dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-16 22:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-16 22:17 -------
Subject: Bug 23337

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	ian@gcc.gnu.org	2005-08-16 22:17:10

Modified files:
	gcc            : ChangeLog gimplify.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: vector2.C 

Log message:
	./
	PR c++/23337
	* gimplify.c (gimplify_init_ctor_eval): If we see an element of
	vector type, don't try to construct it element by element.  Add an
	assertion that we use a FIELD_DECL when building a COMPONENT_REF.
	testsuite/
	PR c++/23337
	* g++.dg/ext/vector2.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.373&r2=2.7592.2.374
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.113.2.10&r2=2.113.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.338&r2=1.5084.2.339
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/vector2.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23337


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/23337] [4.0/4.1 Regression] ICE initializing array of vectors in C++
  2005-08-11 18:36 [Bug c++/23337] New: ICE initializing array of vectors in C++ ian at airs dot com
                   ` (2 preceding siblings ...)
  2005-08-16 22:18 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-16 22:24 ` ian at airs dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ian at airs dot com @ 2005-08-16 22:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2005-08-16 22:18 -------
Now fixed on mainline and 4.0 branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23337


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-16 22:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-11 18:36 [Bug c++/23337] New: ICE initializing array of vectors in C++ ian at airs dot com
2005-08-11 18:45 ` [Bug c++/23337] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-08-16 22:17 ` cvs-commit at gcc dot gnu dot org
2005-08-16 22:18 ` cvs-commit at gcc dot gnu dot org
2005-08-16 22:24 ` ian at airs dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).