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