http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51782
Martin Jambor <jamborm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #16 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-02-17 17:53:34 UTC --- OK, I clearly misremembered where the address space information is supposed to be stored. Richi's patch in comment #12 clearly shows it's the address operand of MEM_REF should carry that information, so please disregard my previous comment. Nevertheless, during expansion of a COMPONENT_REF or any handled_component we do rely on its type's TYPE_ADDR_SPACE because expand_expr_real_1 calls set_mem_attributes with the whole reference tree to deduce the attributes from and it uses the address space of its type. If only the base object or pointer of a reference is supposed to hold the address space information, then this function needs to be changed to look at the base object. I'll attach an untested patch straight away. Alternatively, we could alter types o references built by SRA at each step (in build_ref_for_offset and build_ref_for_model) which also works (I also have a patch) but would be rather inconsistent with how we expand MEM_REFs (but front-end generated stuff looks like this).