This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/41144] [4.5 Regression] ice for legal code with -O2 in get_alias_set



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-09-06 14:04 -------
The future canonical type with structual equality set is built from

#0  0x089afcf4 in build_array_type (elt_type=0xb7d75620, index_type=0xb7d734d0)
    at /home/richard/src/trunk/gcc/tree.c:6906
#1  0x082ecaa7 in build_cplus_array_type_1 (elt_type=0xb7d75620, 
    index_type=0xb7d734d0) at /home/richard/src/trunk/gcc/cp/tree.c:649
#2  0x082ecd0b in build_cplus_array_type (elt_type=0xb7d75620, 
    index_type=0xb7d734d0) at /home/richard/src/trunk/gcc/cp/tree.c:669
#3  0x0818fa4a in tsubst (t=0xb7d73540, args=0xb7d62d58, complain=3, 
    in_decl=0xb7d68540) at /home/richard/src/trunk/gcc/cp/pt.c:9909
#4  0x08188473 in tsubst_decl (t=0xb7d68540, args=0xb7d62d58, complain=3)
    at /home/richard/src/trunk/gcc/cp/pt.c:8859
#5  0x0818affd in tsubst (t=0xb7d68540, args=0xb7d62d58, complain=3, 
    in_decl=0x0) at /home/richard/src/trunk/gcc/cp/pt.c:9382
#6  0x0817bce9 in instantiate_class_template (type=0xb7d75460)
    at /home/richard/src/trunk/gcc/cp/pt.c:7523
#7  0x0826dea8 in complete_type (type=0xb7d75460)
    at /home/richard/src/trunk/gcc/cp/typeck.c:130
#8  0x0826dec4 in complete_type_or_else (type=0xb7d75460, value=0x0)
    at /home/richard/src/trunk/gcc/cp/typeck.c:142
#9  0x081313c8 in xref_basetypes (ref=0xb7d752a0, base_list=0xb7d62dac)
    at /home/richard/src/trunk/gcc/cp/decl.c:10770
#10 0x0817aeeb in instantiate_class_template (type=0xb7d752a0)
    at /home/richard/src/trunk/gcc/cp/pt.c:7411
#11 0x0826dea8 in complete_type (type=0xb7d753f0)
    at /home/richard/src/trunk/gcc/cp/typeck.c:130
#12 0x08109ed7 in start_decl_1 (decl=0xb7d68600, initialized=0 '\0')
    at /home/richard/src/trunk/gcc/cp/decl.c:4299
#13 0x08109c8a in start_decl (declarator=0x8ff42d8, declspecs=0xbfffef28, 
    initialized=0, attributes=0x0, prefix_attributes=0x0, 
    pushed_scope_p=0xbfffee90) at /home/richard/src/trunk/gcc/cp/decl.c:4262
#14 0x082503a1 in cp_parser_init_declarator (parser=0xb7fde6b4, 
...

with element type

 <record_type 0xb7d75620 coord_type type_5 VOID
    align 8 symtab 0 alias set -1 canonical type 0xb7d75620 context
<record_type 0xb7d75460 span_gouraud>
    full-name "struct span_gouraud<rgba8>::coord_type"
    no-binfo use_template=1 interface-unknown
    chain <type_decl 0xb7d75690 coord_type>>

thus layout_type() re-sets the original TYPE_CANONICAL (t) == t to NULL.

Later the frontend completes that coord_type and thus following array
types using that element type are no longer falling back to structural
equality by default:

#0  finalize_record_size (rli=0x8fdbf98)
    at /home/richard/src/trunk/gcc/stor-layout.c:1482
#1  0x087a4005 in finish_record_layout (rli=0x8fdbf98, free_p=1)
    at /home/richard/src/trunk/gcc/stor-layout.c:1707
#2  0x081ff0ef in layout_class_type (t=0xb7d75620, virtuals_p=0xbfffdb00)
    at /home/richard/src/trunk/gcc/cp/class.c:5192
#3  0x08200198 in finish_struct_1 (t=0xb7d75620)
    at /home/richard/src/trunk/gcc/cp/class.c:5297
#4  0x0817c5cb in instantiate_class_template (type=0xb7d75620)
    at /home/richard/src/trunk/gcc/cp/pt.c:7704
#5  0x0826dea8 in complete_type (type=0xb7d75620)
    at /home/richard/src/trunk/gcc/cp/typeck.c:130
#6  0x0826da29 in complete_type (type=0xb7d75700)
    at /home/richard/src/trunk/gcc/cp/typeck.c:115
#7  0x0817be9f in instantiate_class_template (type=0xb7d75460)
    at /home/richard/src/trunk/gcc/cp/pt.c:7556
#8  0x0826dea8 in complete_type (type=0xb7d75460)
    at /home/richard/src/trunk/gcc/cp/typeck.c:130
#9  0x0826dec4 in complete_type_or_else (type=0xb7d75460, value=0x0)
    at /home/richard/src/trunk/gcc/cp/typeck.c:142
#10 0x081313c8 in xref_basetypes (ref=0xb7d752a0, base_list=0xb7d62dac)
    at /home/richard/src/trunk/gcc/cp/decl.c:10770
#11 0x0817aeeb in instantiate_class_template (type=0xb7d752a0)
    at /home/richard/src/trunk/gcc/cp/pt.c:7411
#12 0x0826dea8 in complete_type (type=0xb7d753f0)
    at /home/richard/src/trunk/gcc/cp/typeck.c:130
#13 0x08109ed7 in start_decl_1 (decl=0xb7d68600, initialized=0 '\0')
    at /home/richard/src/trunk/gcc/cp/decl.c:4299

So either the C++ frontend should be more careful and completing the element
type first before building an array type or we need to not look up the
structual equality marked array type when building the canonical type for
our second array type we build (where the element type is not the canonical
type).  This 2nd version is easy enough to implement.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]