[Bug c/107389] Alignment not inferred from type at -O0

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 25 12:46:13 GMT 2022


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yes, that's definitely a no-go since pointer types have no semantic meanings.

I don't understand s390 assembly much but I see calls to __atomic_load_16@PLT
for both -O0 and -O2 so I wonder if it is the testcase you are seeing a
difference for?

If __atomic_load_n (and others) imply certain alignment of the pointer
arguments then their expanders have to explicitely add that.  But I guess
there's no requirement that __builtin_atomic_load (p, 16) has p 16 byte
aligned?

There was talks to "rectify" specified type alignment for pointers in
function arguments but IIRC that has never materialized.  See duplicate
bugreports about memcpy involving properly align-typed function parameters.

That said, iff __atomic_* constraints are not exploited we should do that.


More information about the Gcc-bugs mailing list