https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92499

--- Comment #2 from sandra at gcc dot gnu.org ---
As I suspected, MIPS has exactly the same bug.  It generates GP-relative
addressing in get_flexible and get_flexible_nonzero, and puts flexible_nonzero
in .sdata instead of .data.

This isn't terribly surprising since they both use int_size_in_bytes (TREE_TYPE
(exp)) to get compute the object size in the TARGET_IN_SMALL_DATA_P hook, and
SYMBOL_REF_SMALL_P (which uses that hook) to determine whether to use
GP-relative addressing.

I checked all the targets that define TARGET_IN_SMALL_DATA_P if they use
int_size_in_bytes:

alpha: Y
arc: Y
c6x: N (looks like it rejects objects of aggregate type instead)
frv: Y
ia64: Y
lm32: Y
m32r: Y
microblaze: Y
mips: Y
nios2: Y
riscv: Y
rs6000: Y
rx: Y

Looks like we need a new function in common code that returns 0 for types with
flexible array members and int_size_in_bytes otherwise, and use it in all of
these backends.

Reply via email to