On Wed, Oct 8, 2014 at 10:16 AM, Joern Rennecke <joern.renne...@embecosm.com> wrote: > Trying to build avr2 strftime of avr-libc ICEs as we are trying to > convert a PSImode address to HImode. There is no reason to > do this conversion in the first place - it is a case of failing to recognize > the proper address space. > > The attached patch fixes this. > > Bootstrapped on i686-pc-linux-gnu. > > OK to apply?
The address-space of TARGET_MEM_REFs is in TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))))) see TARGET_MEM_REF expansion or the MEM_REF handling. It's unconditionally there, all the if()s in the existing code are bogus. Thus Index: cfgexpand.c =================================================================== --- cfgexpand.c (revision 215917) +++ cfgexpand.c (working copy) @@ -3286,7 +3286,7 @@ expand_gimple_stmt_1 (gimple stmt) @@ -3983,11 +3983,7 @@ expand_debug_expr (tree exp) if (!op0) return NULL; - if (POINTER_TYPE_P (TREE_TYPE (exp))) - as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp))); - else - as = ADDR_SPACE_GENERIC; - + as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0)))); op0 = convert_debug_memory_address (targetm.addr_space.address_mode (as), op0, as); if (op0 == NULL_RTX) is pre-approved. Thanks, Richard.