https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97404
Bug ID: 97404 Summary: [9/10/11 Regression] aarch64: Wrong code since r9-3666-g74ca1c01d Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- AArch64 GCC miscompiles the following testcase: char a, b; long c; short d, e; long *f = &c; int g; char h(signed char i) { return 0; } static short j(short i, int k) { return i < 0 ? 0 : i >> k; } void l(void); void m(void) { e = j(d | 9766, 11); *f = e; } void l(void) { a = 5 | g; b = h(a); } int main() { m(); if (c != 4) __builtin_abort(); } when built with -O2 -fno-inline since r9-3666-g74ca1c01d02e548f32aa26f9a887dcc0730703fb. Immediately prior to this revision we have: j.constprop.0: .LFB5: .cfi_startproc tst w0, 32768 sbfx w0, w0, 11, 5 csel w0, w0, wzr, eq ret and afterwards we have: j.constprop.0: .LFB5: .cfi_startproc mov w0, 0 ret which would suggest that GCC has determined that j is always called with arguments such that it returns 0, but this is not the case.