[Bug tree-optimization/79649] Memset pattern in named address space crashes compiler or generates wrong code

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Tue Feb 21 09:05:00 GMT 2017


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

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 21 Feb 2017, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79649
> 
> --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> typedef __SIZE_TYPE__ size_t;
> struct A { int a; char b[1024]; };
> extern struct A __seg_gs a;
> 
> void
> f1 (size_t n)
> {
>   for (size_t i = 0; i < n; ++i)
>     a.b[i] = 0;
> }
> 
> certainly compiles fine with my patch.

Ok.  So we have

    arg 0 <component_ref 0x7ffff69e3c60
        type <array_type 0x7ffff69c11f8 type <integer_type 0x7ffff69c1150 
char address-space-2>
            BLK
            size <integer_cst 0x7ffff69d4300 constant 8192>
            unit size <integer_cst 0x7ffff69d42d0 constant 1024>
            align 8 symtab 0 alias set -1 canonical type 0x7ffff69c11f8 
domain <integer_type 0x7ffff69c1498>>

        arg 0 <var_decl 0x7ffff7feee10 a type <record_type 0x7ffff69c15e8 
A address-space-2>
            addressable used public external BLK file t.c line 3 col 26
            size <integer_cst 0x7ffff69d4318 constant 8224>
            unit size <integer_cst 0x7ffff69d4330 constant 1028>
            align 32 context <translation_unit_decl 0x7ffff68b02d0 t.c> 
chain <function_decl 0x7ffff69c4e00 f1>>
        arg 1 <field_decl 0x7ffff68ca558 b type <array_type 
0x7ffff69c1540>

the FIELD_DECL has a type in the generic address-space but the
type of the COMPONENT_REF is in the appropriate address-space.  I also
see this is what set_mem_attributes_minus_bitpos does (just look at
the type of the ref).  So if your patch tests fine you can commit it.


More information about the Gcc-bugs mailing list