https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96058

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
So the corrupted STRING_CST is created in LTRANS here:

gcc/expr.c:

   │11714         if (TREE_CODE (init) == CONSTRUCTOR && initializer_zerop
(init))  
   │11715           {                                                           
   │11716             /* Fold an empty/zero constructor for an implicitly
initialized 
   │11717                object or subobject into the empty string.  */         
   │11718                                                                       
   │11719             /* Determine the character type from that of the original 
   │11720                expression.  */  
B+ │11721             tree chartype = argtype;
   │11722             if (POINTER_TYPE_P (chartype))
   │11723               chartype = TREE_TYPE (chartype);
   │11724             while (TREE_CODE (chartype) == ARRAY_TYPE)
   │11725               chartype = TREE_TYPE (chartype);
   │11726             /* Convert a char array to an empty STRING_CST having an
array

(gdb) p debug_tree(init)
 <constructor 0x7ffff0185120
    type <record_type 0x7ffff4514000 VectorIcon addressable cxx-odr-p BLK
        size <integer_cst 0x7ffff7824078 constant 192>
        unit-size <integer_cst 0x7ffff7824048 constant 24>
        align:64 warn_if_not_align:0 symtab:0 alias-set 407 canonical-type
0x7ffff4514000
        fields <field_decl 0x7ffff450ebe0 reps type <pointer_type
0x7ffff450df18>
            readonly unsigned nonlocal DI
../../ui/gfx/vector_icon_types.h:102:0
            size <integer_cst 0x7ffff7806bb8 constant 64>
            unit-size <integer_cst 0x7ffff7806bd0 constant 8>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff7806be8 constant 0>
            bit-offset <integer_cst 0x7ffff7806c30 constant 0> context
<record_type 0x7ffff4514000 VectorIcon> chain <field_decl 0x7ffff450eb48
reps_size>> context <namespace_decl 0x7ffff7635390 gfx>
        pointer_to_this <pointer_type 0x7ffff0114150>>
    constant length:3
    idx <field_decl 0x7ffff450ebe0 reps
        type <pointer_type 0x7ffff450df18 type <record_type 0x7ffff450ddc8
VectorIconRep>
            readonly unsigned DI size <integer_cst 0x7ffff7806bb8 64> unit-size
<integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality>
        readonly unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:102:0
size <integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
        align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806be8 0> bit-offset <integer_cst 0x7ffff7806c30 0> context
<record_type 0x7ffff4514000 VectorIcon>
        chain <field_decl 0x7ffff450eb48 reps_size type <integer_type
0x7ffff760c150 size_t>
            unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:103:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806be8 0> bit-offset <integer_cst 0x7ffff7806bb8 64> context
<record_type 0x7ffff4514000 VectorIcon> chain <field_decl 0x7ffff450eab0
name>>>
    val <integer_cst 0x7ffff1f36fc0 type <pointer_type 0x7ffff437ec78> constant
0>
    idx <field_decl 0x7ffff450eb48 reps_size
        type <integer_type 0x7ffff760c150 size_t public unsigned DI size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff781b738 precision:64 min <integer_cst 0x7ffff7806e88 0> max <integer_cst
0x7ffff7807500 18446744073709551615>
            pointer_to_this <pointer_type 0x7ffff61c8498> reference_to_this
<reference_type 0x7ffff31cc3f0>>
        unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:103:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
        align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806be8 0> bit-offset <integer_cst 0x7ffff7806bb8 64> context
<record_type 0x7ffff4514000 VectorIcon>
        chain <field_decl 0x7ffff450eab0 name type <pointer_type
0x7ffff76b2dc8>
            unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:108:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff7806c18 constant 16> bit-offset
<integer_cst 0x7ffff7806c30 0> context <record_type 0x7ffff4514000
VectorIcon>>>
    val <integer_cst 0x7ffff29b9f30 type <integer_type 0x7ffff760c150 size_t>
constant 0>
    idx <field_decl 0x7ffff450eab0 name
        type <pointer_type 0x7ffff76b2dc8 type <integer_type 0x7ffff76402a0
char>
            public unsigned DI size <integer_cst 0x7ffff7806bb8 64> unit-size
<integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set 409
structural-equality
            pointer_to_this <pointer_type 0x7ffff522adc8> reference_to_this
<reference_type 0x7ffff3176f18>>
        unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:108:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
        align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806c18 16> bit-offset <integer_cst 0x7ffff7806c30 0> context
<record_type 0x7ffff4514000 VectorIcon>>
    val <integer_cst 0x7ffff29b9e40 type <pointer_type 0x7ffff76b2dc8> constant
0>>
$18 = void

(gdb) p debug_tree(argtype)
 <pointer_type 0x7ffff77b5f18
    type <record_type 0x7ffff77b5e70 VectorIcon readonly cxx-odr-p VOID
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff4514000 context <namespace_decl 0x7ffff7635390 gfx>
        pointer_to_this <pointer_type 0x7ffff77b5f18> reference_to_this
<reference_type 0x7ffff5e93b28>>
    public unsigned DI
    size <integer_cst 0x7ffff7806bb8 type <integer_type 0x7ffff781b0a8
bitsizetype> constant 64>
    unit-size <integer_cst 0x7ffff7806bd0 type <integer_type 0x7ffff781b000
sizetype> constant 8>
    align:64 warn_if_not_align:0 symtab:0 alias-set 1025 structural-equality>

(gdb) p debug_tree(chartype)
 <record_type 0x7ffff77b5e70 VectorIcon readonly cxx-odr-p VOID
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff4514000 context <namespace_decl 0x7ffff7635390 gfx>
    pointer_to_this <pointer_type 0x7ffff77b5f18> reference_to_this
<reference_type 0x7ffff5e93b28>>
$21 = void

@Martin: Can you please take a look?

Reply via email to