public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/98211] New: [11 Regression] Wrong code at -O3 since r11-4482-gb626b00823af9ca9
@ 2020-12-09  8:52 marxin at gcc dot gnu.org
  2020-12-09  8:52 ` [Bug tree-optimization/98211] " marxin at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-09  8:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98211
           Summary: [11 Regression] Wrong code at -O3 since
                    r11-4482-gb626b00823af9ca9
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

Reduced from a yarpgen test-case. Started with r11-4482-gb626b00823af9ca9 when
a new SLP opportunity happens.

$ cat pr.C
unsigned long long seed;
void hash(unsigned long long *seed, int v) { *seed ^= v; }

long var_11 = -4439057030159136246;
short arr_19[8][2][16];
void test(unsigned long long, bool, unsigned long long);

void
__attribute__((noipa, optimize("-O0")))
calculate_hash(void)
{
  for (long i_0 = 0; i_0 < 8; ++i_0)
    for (long i_1 = 0; i_1 < 2; ++i_1)
      for (long i_2 = 0; i_2 < 16; ++i_2)
        hash(&seed, arr_19[i_0][i_1][i_2]);
}

int main() {
  test(407382096781995, 0, 4);
  calculate_hash ();

  __builtin_printf("%llu\n", seed);
  if (seed != 2570)
    __builtin_abort ();

  return 0;
}

long val_or_zero(long __b) {
  if (__b)
    return __b;
  return 0;
}

int test_var_3;
int counter = 0;

void test(unsigned long long var_1, bool var_9, unsigned long long var_12) {
  for (unsigned i_0 = 0; i_0 < 7; i_0 += 9)
    for (bool i_1 = 0; i_1 < (bool)var_1; i_1 += 4)
      for (unsigned i_5 = 0; i_5 < (int)val_or_zero(var_11) - 1940523515U;
i_5++)
        arr_19[i_0][i_1][i_5] = (test_var_3 ?: var_12) ? (short)var_11 : var_9;
}

$ gcc -O3 pr.C && ./a.out
0
Aborted (core dumped)

$ gcc pr.C && ./a.out
2570

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

end of thread, other threads:[~2020-12-10 11:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09  8:52 [Bug tree-optimization/98211] New: [11 Regression] Wrong code at -O3 since r11-4482-gb626b00823af9ca9 marxin at gcc dot gnu.org
2020-12-09  8:52 ` [Bug tree-optimization/98211] " marxin at gcc dot gnu.org
2020-12-09  9:09 ` rguenth at gcc dot gnu.org
2020-12-09 10:39 ` rguenth at gcc dot gnu.org
2020-12-09 10:44 ` rguenth at gcc dot gnu.org
2020-12-09 11:26 ` rguenth at gcc dot gnu.org
2020-12-09 11:47 ` rguenth at gcc dot gnu.org
2020-12-09 12:43 ` rguenth at gcc dot gnu.org
2020-12-10 10:01 ` rguenth at gcc dot gnu.org
2020-12-10 10:28 ` rsandifo at gcc dot gnu.org
2020-12-10 11:36 ` cvs-commit at gcc dot gnu.org
2020-12-10 11:37 ` rguenth at gcc dot gnu.org
2020-12-10 11:41 ` rguenth 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).