public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/97404] New: [9/10/11 Regression] aarch64: Wrong code since r9-3666-g74ca1c01d
@ 2020-10-13 16:36 acoplan at gcc dot gnu.org
  2020-10-13 18:19 ` [Bug ipa/97404] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: acoplan at gcc dot gnu.org @ 2020-10-13 16:36 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-16  8:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 16:36 [Bug ipa/97404] New: [9/10/11 Regression] aarch64: Wrong code since r9-3666-g74ca1c01d acoplan at gcc dot gnu.org
2020-10-13 18:19 ` [Bug ipa/97404] " marxin at gcc dot gnu.org
2020-10-14  6:20 ` rguenth at gcc dot gnu.org
2020-10-16  7:44 ` cvs-commit at gcc dot gnu.org
2020-10-16  7:53 ` marxin at gcc dot gnu.org
2020-10-16  8:52 ` [Bug ipa/97404] [9/10 " cvs-commit at gcc dot gnu.org
2020-10-16  8:52 ` cvs-commit at gcc dot gnu.org
2020-10-16  8:53 ` marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).