typedef unsigned long uint32_t;
typedef unsigned int uint16_t;
extern const __memx unsigned int data;
#define pgm_read_word_far(addr) \
uint32_t __addr32 = (uint32_t)(addr); \
uint16_t __result; \
__asm__("; much code" \
: "=r" (__result) \
: "r" (__addr32)); \
int ice (void)
return pgm_read_word_far (0x20000 + (unsigned long) &data);
== Command Line ==
>> avr-gcc ice-memx.c -S -Os -g3 -v
== ICE ==
ice-memx.c: In function 'ice':
ice-memx.c:18:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
ice-memx.c:16:5: internal compiler error: in convert_debug_memory_address, at cfgexpand.c:2491
== Configure ==
Using built-in specs.
Configured with: ../gcc-trunk/configure --with-gmp=/usr/local --prefix=/usr/local/avr --target=avr --enable-languages=c,c++ --with-dwarf2 --disable-shared --disable-libada --disable-libssp --disable-nls
Thread model: single
gcc version 4.7.0 20120217 (experimental) (GCC)
GNU C (GCC) version 4.7.0 20120217 (experimental) (avr)
compiled by GNU C version 4.6.2, GMP version 5.0.4, MPFR version 3.1.0, MPC version 0.9
Created attachment 26820 [details]
ice-memx.c: C source
The !POINTERS_EXTEND_UNSIGNED path seems to be not implemented if it would
require codegen. I suppose instead we should have a way of saying
"not possible" here?
I thought about setting POINTERS_EXTEND_UNSIGNED but am unsure about other side effects of that define.
Presumably, POINTERS_EXTEND_UNSIGNED is undefined because it was never needed before?
What do you think?
#define POINTERS_EXTEND_UNSIGNED 1
but this runs into ICE some lines later in cfgexpand.c:2496
mode = PSI
as = 0
x = symbol_ref:PSI ("data")
Of course PSImode is not a valid pointer mode for generic address space.
convert_debug_memory_address can just return NULL_RTX if it can't handle it. Can't reproduce this though.
(In reply to comment #5)
> Can't reproduce this though.
Strange. I still see the ICE with current trunk. It's a 32 bit build and host; might this have an impact?
Reduced test-case: Compile with:
$ avr-gcc ice-memx.c -S -g -Os
extern const __memx unsigned data;
unsigned long ice (void)
unsigned long addr32;
return addr32 = (unsigned long) data;
*** Bug 56792 has been marked as a duplicate of this bug. ***
Date: Thu Jun 5 18:34:43 2014
New Revision: 211288
* cfgexpand.c (expand_debug_expr): Use address space of nested
TREE_TYPE for ADDR_EXPR and MEM_REF.
* gcc.target/avr/pr52472.c: New test.
Fixed over 2 years ago but forgot to close.