------- Comment #6 from rguenth at gcc dot gnu dot org 2005-10-24 11:01 ------- Also, while we have the same types for lhs and rhs in do_structure_copy, namely
(gdb) call debug_tree(lhstype) <record_type 0x40232c94 adaptsint sizes-gimplified needs-constructing type_1 type_5 HI size <integer_cst 0x4018d300 type <integer_type 0x4019f05c bit_size_type> constant invariant 16> unit size <integer_cst 0x4018d318 type <integer_type 0x4019f000 unsigned int> constant invariant 2> align 8 symtab 0 alias set -1 fields <field_decl 0x40232f18 functor_ type <record_type 0x40232bdc adaptor_functorint sizes-gimplified type_1 type_5 QI size <integer_cst 0x4018d1f8 constant invariant 8> unit size <integer_cst 0x4018d210 constant invariant 1> align 8 symtab 0 alias set -1 fields <type_decl 0x40212c30 adaptor_functorint> X() X(constX&) this=(X&) n_parents=1 use_template=0 interface-unknown pointer_to_this <pointer_type 0x402377e8> chain <type_decl 0x40212bc8 adaptor_functorint>> nonlocal decl_3 QI file /suse/rguenther/src/tests/pr24351.C line 8 size <integer_cst 0x4018d1f8 8> unit size <integer_cst 0x4018d210 1> align 8 offset_align 128 offset <integer_cst 0x4018d198 constant invariant 0> bit offset <integer_cst 0x4018d1f8 8> context <record_type 0x40232c94 adaptsint> chain <type_decl 0x40212d68 adaptsint type <record_type 0x40232c94 adaptsint> nonlocal decl_4 VOID file /suse/rguenther/src/tests/pr24351.C line 6 align 1 context <record_type 0x40232c94 adaptsint> >> needs-constructor X(constX&) this=(X&) n_parents=1 use_template=0 interface-unknown pointer_to_this <pointer_type 0x40232e60> chain <type_decl 0x40212d00 adaptsint>> the full sizes from the variable infos for lhs/rhs do not match: (gdb) print *get_varinfo(lhs.var) $9 = {id = 6, name = 0x898aaf7 "a", decl = 0x4019a7e8, offset = 8, size = 8, fullsize = 24, next = 0x899ca54, node = 6, address_taken = 1, indirect_target = 0, is_artificial_var = 0, is_special_var = 0, is_unknown_size_var = 0, has_union = 0, is_heap_var = 0, solution = 0x89996c8, variables = 0x89996d8, complex = 0x0} (gdb) print *get_varinfo(rhs.var) $10 = {id = 8, name = 0x896d7d0 "D.1877", decl = 0x4019ae18, offset = 8, size = 8, fullsize = 16, next = 0x0, node = 8, address_taken = 0, indirect_target = 0, is_artificial_var = 0, is_special_var = 0, is_unknown_size_var = 0, has_union = 0, is_heap_var = 0, solution = 0x8999708, variables = 0x8999718, complex = 0x0} This is during the assignment of (gdb) call debug_generic_expr(t) # SFT.2D.1881_20 = V_MAY_DEF <SFT.2D.1881_17>; # VUSE <SFT.0D.1879_8>; aD.1849.functor_D.1824.functor_D.1764 = D.1877 i.e. during the second may-alias pass. So another workaround may be in do_structure_copy: /* The size only really matters insofar as we don't set more or less of the variable. If we hit an unknown size var, the size should be the whole darn thing. */ if (get_varinfo (rhs.var)->is_unknown_size_var) rhssize = ~0; else rhssize = get_varinfo (rhs.var)->fullsize; /*TREE_INT_CST_LOW (rhstypesize);*/ if (get_varinfo (lhs.var)->is_unknown_size_var) lhssize = ~0; else lhssize = get_varinfo (lhs.var)->fullsize; /*TREE_INT_CST_LOW (lhstypesize);*/ Oh well. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24351