This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The following (perhaps questionable) code causes an ICE in in set_mem_attributes_minus_bitpos, at emit-rtl.c:1539 compile command line: avr-g++ -mmcu=atmega128 -c -o romproblems.o romproblems.cpp program: #define PROGMEM __attribute__((__progmem__)) struct ROMVar1 { int const val; ROMVar1(int const& init) : val(init) { } }; ROMVar1 PROGMEM rv1b(123);
We ICE in if (base && DECL_P (base) && TREE_READONLY (base) && (TREE_STATIC (base) || DECL_EXTERNAL (base))) { tree base_type = TREE_TYPE (base); gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING (base_type)) || DECL_ARTIFICIAL (base)); MEM_READONLY_P (ref) = 1; Now, it is indeed questionable to put a non-POD into ro memory. So I think this is INVALID - but let's see what others think.
(In reply to comment #1) > We ICE in > Now, it is indeed questionable to put a non-POD into ro memory. So I think > this is INVALID - but let's see what others think. The target should have rejected progmem and not placed const on the decl.