public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29318]  New: ICE: type_info of pointer to variable array
@ 2006-10-02 10:47 s__nakayama at infoseek dot jp
  2006-10-02 16:47 ` [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: s__nakayama at infoseek dot jp @ 2006-10-02 10:47 UTC (permalink / raw)
  To: gcc-bugs

The following invalid code causes an ICE.

$ cat foo.cpp
#include <typeinfo>

int main()
{
  int i = 5;
  int va[i];
  const std::type_info& info(typeid(&va));

  return 0;
}

$ g++ foo.cpp
foo.cpp: In function 'int main()':
foo.cpp:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: ICE: type_info of pointer to variable array
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s__nakayama at infoseek dot jp


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


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

* [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA
  2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
@ 2006-10-02 16:47 ` pinskia at gcc dot gnu dot org
  2006-10-12 12:39 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-02 16:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-10-02 16:47 -------
Confirmed.  3.0.4 and above ICE so this is a regression. 


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-02 16:47:37
               date|                            |
            Summary|ICE: type_info of pointer to|[4.0/4.1/4.2 Regression]
                   |variable array              |ICE: type_info of pointer to
                   |                            |VLA
   Target Milestone|---                         |4.0.4


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


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

* [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA
  2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
  2006-10-02 16:47 ` [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA pinskia at gcc dot gnu dot org
@ 2006-10-12 12:39 ` rguenth at gcc dot gnu dot org
  2006-10-13  0:11 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-12 12:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-10-12 12:39 -------
EDG chooses to reject the code with

t.C(7): error: a variable-length array type is not allowed
    const std::type_info& info(typeid(&va));
                                      ^

though I cannot find anything in the standard that justifies this behavior.  Of
course C++ VLA are a gcc extension... (but we still ICE even with -pedantic)

We're ICEing in mangling the VLA type

  intD.2[0:(long unsigned intD.7) (SAVE_EXPR <(<unnamed type>) iD.2580 - 1>)]

if we "fix" that by patching write_array_type to strip NOPs and SAVE_EXPRs
in the VLA case like so:

          /* Strip NOP and SAVE_EXPR  */
          while (TREE_CODE (max) == NOP_EXPR
                 || TREE_CODE (max) == SAVE_EXPR)
            max = TREE_OPERAND (max, 0);
          max = TREE_OPERAND (max, 0);
          if (!abi_version_at_least (2))
            {

that case goes fine, but then we ICE mangling

  intD.2[0:D.2586]

which doesn't tell us the number of elements in a symbolical way?  (and
so we ICE on the TREE_OPERAND (max, 0))

The gimplifier produces that out of the first variant and we get to the
mangler again through

#2  0x00000000005d22b1 in write_array_type (type=0x2b0b2b686b00)
    at /space/rguenther/src/svn/trunk/gcc/cp/mangle.c:2396
#3  0x00000000005cd546 in write_type (type=0x2b0b2b686b00)
    at /space/rguenther/src/svn/trunk/gcc/cp/mangle.c:1557
#4  0x00000000005cd9f0 in write_type (type=0x2b0b2b686d10)
    at /space/rguenther/src/svn/trunk/gcc/cp/mangle.c:1620
#5  0x00000000005d323f in mangle_type_string (type=0x2b0b2b686d10)
    at /space/rguenther/src/svn/trunk/gcc/cp/mangle.c:2617
#6  0x000000000053a437 in tinfo_name (type=0x2b0b2b686d10)
    at /space/rguenther/src/svn/trunk/gcc/cp/rtti.c:330
#7  0x000000000053c720 in tinfo_base_init (ti=0x2b0b2b4d6598, 
    target=0x2b0b2b686d10) at /space/rguenther/src/svn/trunk/gcc/cp/rtti.c:813
#8  0x000000000053cebd in ptr_initializer (ti=0x2b0b2b4d6598, 
    target=0x2b0b2b686d10) at /space/rguenther/src/svn/trunk/gcc/cp/rtti.c:908
#9  0x000000000053d59d in get_pseudo_ti_init (type=0x2b0b2b686d10, tk_index=6)
    at /space/rguenther/src/svn/trunk/gcc/cp/rtti.c:1018
#10 0x000000000053fce3 in emit_tinfo_decl (decl=0x2b0b2b686dc0)
    at /space/rguenther/src/svn/trunk/gcc/cp/rtti.c:1491
#11 0x000000000050498c in cp_finish_file ()
    at /space/rguenther/src/svn/trunk/gcc/cp/decl2.c:3127
#12 0x0000000000402945 in finish_file ()
    at /space/rguenther/src/svn/trunk/gcc/cp/cp-lang.c:144
#13 0x00000000006451ee in c_common_parse_file (set_yydebug=0)
    at /space/rguenther/src/svn/trunk/gcc/c-opts.c:1176
#14 0x0000000000b860fc in compile_file ()
    at /space/rguenther/src/svn/trunk/gcc/toplev.c:1033
#15 0x0000000000b87c72 in do_compile ()
    at /space/rguenther/src/svn/trunk/gcc/toplev.c:2006
#16 0x0000000000b87cd6 in toplev_main (argc=3, argv=0x7fff7f92b998)
    at /space/rguenther/src/svn/trunk/gcc/toplev.c:2038
#17 0x000000000065bc1b in main (argc=3, argv=0x7fff7f92b998)
    at /space/rguenther/src/svn/trunk/gcc/main.c:35


-- 


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


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

* [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA
  2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
  2006-10-02 16:47 ` [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA pinskia at gcc dot gnu dot org
  2006-10-12 12:39 ` rguenth at gcc dot gnu dot org
@ 2006-10-13  0:11 ` mmitchel at gcc dot gnu dot org
  2006-10-13  4:10 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-13  0:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA
  2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
                   ` (2 preceding siblings ...)
  2006-10-13  0:11 ` mmitchel at gcc dot gnu dot org
@ 2006-10-13  4:10 ` mmitchel at gcc dot gnu dot org
  2006-10-13  4:16 ` [Bug c++/29318] [4.0 " mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-13  4:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2006-10-13 04:09 -------
Subject: Bug 29318

Author: mmitchel
Date: Fri Oct 13 04:09:41 2006
New Revision: 117683

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117683
Log:
        PR c++/29318
        * rtti.c (get_tinfo_decl): Refuse to create type info objects for
        variably modified types.
        PR c++/29318
        * g++.dg/ext/vla4.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/vla4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/rtti.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/29318] [4.0 Regression] ICE: type_info of pointer to VLA
  2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
                   ` (3 preceding siblings ...)
  2006-10-13  4:10 ` mmitchel at gcc dot gnu dot org
@ 2006-10-13  4:16 ` mmitchel at gcc dot gnu dot org
  2006-10-13  8:34 ` mmitchel at gcc dot gnu dot org
  2007-02-03 20:29 ` gdr at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-13  4:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mmitchel at gcc dot gnu dot org  2006-10-13 04:15 -------
Fixed in 4.1.2, 4.2.0.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|mark at codesourcery dot com|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
            Summary|[4.0/4.1/4.2 Regression]    |[4.0 Regression] ICE:
                   |ICE: type_info of pointer to|type_info of pointer to VLA
                   |VLA                         |


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


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

* [Bug c++/29318] [4.0 Regression] ICE: type_info of pointer to VLA
  2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
                   ` (4 preceding siblings ...)
  2006-10-13  4:16 ` [Bug c++/29318] [4.0 " mmitchel at gcc dot gnu dot org
@ 2006-10-13  8:34 ` mmitchel at gcc dot gnu dot org
  2007-02-03 20:29 ` gdr at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-13  8:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2006-10-13 08:34 -------
Subject: Bug 29318

Author: mmitchel
Date: Fri Oct 13 08:34:14 2006
New Revision: 117686

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117686
Log:
        PR c++/29318
        * rtti.c (get_tinfo_decl): Refuse to create type info objects for
        variably modified types.
        PR c++/29318
        * g++.dg/ext/vla4.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/ext/vla4.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/rtti.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/29318] [4.0 Regression] ICE: type_info of pointer to VLA
  2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
                   ` (5 preceding siblings ...)
  2006-10-13  8:34 ` mmitchel at gcc dot gnu dot org
@ 2007-02-03 20:29 ` gdr at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gdr at gcc dot gnu dot org  2007-02-03 20:29 -------
Fixed in GCC-4.1.2.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.0.4                       |4.1.2


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


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

end of thread, other threads:[~2007-02-03 20:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-02 10:47 [Bug c++/29318] New: ICE: type_info of pointer to variable array s__nakayama at infoseek dot jp
2006-10-02 16:47 ` [Bug c++/29318] [4.0/4.1/4.2 Regression] ICE: type_info of pointer to VLA pinskia at gcc dot gnu dot org
2006-10-12 12:39 ` rguenth at gcc dot gnu dot org
2006-10-13  0:11 ` mmitchel at gcc dot gnu dot org
2006-10-13  4:10 ` mmitchel at gcc dot gnu dot org
2006-10-13  4:16 ` [Bug c++/29318] [4.0 " mmitchel at gcc dot gnu dot org
2006-10-13  8:34 ` mmitchel at gcc dot gnu dot org
2007-02-03 20:29 ` gdr at gcc dot gnu dot org

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).