https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92999
Bug ID: 92999 Summary: [armhf] struct with adjacent __fp16's copies wrongly Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jimreesma at gmail dot com Target Milestone: --- Created attachment 47523 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47523&action=edit Reproducer source Discovered on "cc (Raspbian 8.3.0-6+rpi1) 8.3.0" -dumpmachine ==> arm-linux-gnueabihf Copying a struct with two adjacent __fp16's effectively copies the second __fp16 onto the first. See attached reproducer code. Upon examining the assembly, it seems to be expecting to return the structure in a single-precision floating point register -- the copy function converts the 2nd field to the single-precision register, then the caller treats that result as the value from both fields. The bug is consistent with -O0 through -O3. The copy function must not be inlined, else the compiler bypasses the copy entirely, so this is an issue with structure copy semantics.