https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66768
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Target| |avr Status|UNCONFIRMED |NEW Last reconfirmed| |2015-07-07 Version|unknown |6.0 Summary|__seg_fs and __seg_gs: |address space gets lost on |issue when adding address |literal pointer |space support | Ever confirmed|0 |1 --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- IVOPTs seems to carry address-space info on 'type' here (in fact if I amend tree dumping with address-space dumping on memory references I fail to get proper address-space info on the first function _before_ IVOPTs...). Address-space info is on the base object type, not on the type of the memory reference (for MEM_REF and TARGET_MEM_REF, that is). For the IVOPTs issue a way to fix the particular testcase is Index: gcc/tree-ssa-address.c =================================================================== --- gcc/tree-ssa-address.c (revision 225504) +++ gcc/tree-ssa-address.c (working copy) @@ -395,7 +395,7 @@ create_mem_ref_raw (tree type, tree alia } else { - base = build_int_cst (ptr_type_node, 0); + base = build_int_cst (build_pointer_type (type), 0); index2 = addr->base; } but then we ICE in convert_memory_address_addr_space_1 #1 0x000000000093323b in convert_memory_address_addr_space_1 ( to_mode=PSImode, x=0x7ffff69f5c60, as=7 '\a', in_const=false) at /space/rguenther/tramp3d/trunk/gcc/explow.c:282 282 gcc_assert (GET_MODE (x) == to_mode || GET_MODE (x) == VOIDmode); (gdb) p debug_rtx (x) (subreg:HI (reg:PSI 42 [ ivtmp.21 ]) 0) at least the address-space is now on the MEM_REF: <bb 3>: # total_11 = PHI <total_5(3), 0(2)> # ivtmp.21_2 = PHI <ivtmp.21_7(3), 4660(2)> _12 = (sizetype) ivtmp.21_2; _4 = MEM[base: 0B, index: _12, offset: 0B]<address-space-7> ; the ICE is probably a AVR bug (it's inside POITNERS_EXTEND_UNSIGNED). Possibly the subreg case can be applied for POINTERS_EXTEND_UNSIGNED as well.