https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92606
--- Comment #24 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #22)
> Should be fixed on trunk. Confirmation would be nice (checked x86 only).
Tested with: gcc version 14.0.0 20231210 (experimental) (GCC)
Still fails for the progmem test case from above. It still has
.set xyz,xyz_prog
typedef __UINT16_TYPE__ uint16_t;
typedef __UINT32_TYPE__ uint32_t;
typedef uint32_t T;
#define read_u32(X) \
(__extension__( \
{ \
uint16_t __addr16 = (uint16_t)(X); \
uint32_t __result; \
__asm__ __volatile__ ("lpm %A0, Z+" "\n\t" \
"lpm %B0, Z+" "\n\t" \
"lpm %C0, Z+" "\n\t" \
"lpm %D0, Z" "\n\t" \
: "=r" (__result), "+z" (__addr16)); \
__result; \
}))
#define NI __attribute__((noinline,noclone))
__attribute((progmem))
static const T xyz_prog[] = { 123, 123, 123 };
static T xyz[] = { 123, 123, 123 };
volatile int x = 0;
NI void prf (T f)
{
if (f != 123)
__builtin_abort();
}
NI void func_progmem()
{
prf (read_u32 (& xyz_prog[0]));
}
NI void func_ram()
{
prf (xyz[x]);
}
int main()
{
func_progmem();
func_ram();
}