public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97960] New: [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d
@ 2020-11-23 17:13 acoplan at gcc dot gnu.org
  2020-11-23 17:53 ` [Bug tree-optimization/97960] " acoplan at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: acoplan at gcc dot gnu.org @ 2020-11-23 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97960
           Summary: [8/9/10/11 Regression] Wrong code at -O3 since
                    r8-6511-g3ae129323d
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

GCC miscompiles the following C++ testcase at -O3 (reproduced on both x86 and
aarch64):

const int &c(const int &d, const int &f) {
  if (d < f)
    return f;
  return d;
}

short a[575];
unsigned b[25];
unsigned char g;
int main()
{
  for (int e = 0; e < 23; ++e)
    a[e * 23] = 16137;
  for (signed char h = c(g, 253) + 3; h < 24; h++)
    b[h] = 1064739102;
  for (int e = 0; e < 23; ++e)
    if (a[e * 23] != 16137)
      __builtin_abort();
}

When compiled with -O{0,g,s,1,2} (with or without -ftree-vectorize), the
program exits cleanly, but aborts when compiled with -O3 since the above
revision. The program also exits cleanly when compiled with clang on x86 and
aarch64 at various optimization levels.

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

end of thread, other threads:[~2021-04-23  9:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 17:13 [Bug tree-optimization/97960] New: [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d acoplan at gcc dot gnu.org
2020-11-23 17:53 ` [Bug tree-optimization/97960] " acoplan at gcc dot gnu.org
2020-11-23 17:55 ` marxin at gcc dot gnu.org
2020-11-24  8:20 ` rguenth at gcc dot gnu.org
2020-11-24 15:12 ` rguenth at gcc dot gnu.org
2020-11-24 15:29 ` rsandifo at gcc dot gnu.org
2021-01-21 11:59 ` jakub at gcc dot gnu.org
2021-01-22  8:01 ` rguenth at gcc dot gnu.org
2021-01-22  9:27 ` acoplan at gcc dot gnu.org
2021-02-01 16:53 ` jakub at gcc dot gnu.org
2021-02-02  9:03 ` cvs-commit at gcc dot gnu.org
2021-02-02  9:35 ` [Bug tree-optimization/97960] [8/9/10 " jakub at gcc dot gnu.org
2021-04-22 13:27 ` rsandifo at gcc dot gnu.org
2021-04-23  9:21 ` rsandifo 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).