https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124637
Bug ID: 124637
Summary: powerpc64: invalid code while passing a struct via
register
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: gcc at breakpoint dot cc
Target Milestone: ---
Created attachment 64027
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64027&action=edit
Archive with testcase and compile script
OpenSSL has struct such as
typedef struct {
uint16_t kem_id;
uint16_t kdf_id;
uint16_t aead_id;
} OSSL_HPKE_SUITE;
which is then passed argument. For the content { 0x20, 1, 1 } the compiler
produces the following opcodes:
lis 9,0x20
lis 4,0x1
ori 9,9,0x1
rldimi 4,9,32,0
which ends with r4 = 0x0020_0001_0000_0000
Correct would be: 0x0000_0020_0001_0001
powerpc64-linux-gnu is affected with -O1+, -O0 is fine.
powerpc64le-linux-gnu is not affected but it does not use rldimi.
I'm attaching a testcase to
$ ./tc-comp.sh && ./m-0 && ./m-2
20 1 1
1 1 0
The output should "20 1 1" from both m-0 (compiled at -O0) and m-2 (compiled at
-O2)
Sebastian