Discussion:
RFA: Fix debug address mode for TARGET_MEM_REF
Joern Rennecke
2014-10-08 08:16:45 UTC
Permalink
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?
Richard Biener
2014-10-08 11:02:50 UTC
Permalink
On Wed, Oct 8, 2014 at 10:16 AM, Joern Rennecke
Post by Joern Rennecke
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.
Joern Rennecke
2014-10-08 12:37:38 UTC
Permalink
On 8 October 2014 12:02, Richard Biener <***@gmail.com> wrote:
...
Post by Richard Biener
- 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. manually applied, avr2 strftime build confirmed,
i386-pc-linux-gnu bootstrapped, and checked in.

Loading...