view gcc/testsuite/g++.dg/torture/pr81354.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR81354 reported this test as crashing in a limited range of revisions.
// { dg-do compile }

struct T { double a; double b; };

void foo(T Ad[], int As[2])
{
  int j;
  int i;
  int Bs[2] = {0,0};
  T Bd[16];

  for (j = 0; j < 4; j++) {
    for (i = 0; i + 1 <= j + 1; i++) {
      Ad[i + As[0] * j] = Bd[i + Bs[0] * j];
    }

    i = j + 1;  // <- comment out this line and it does not crash
    for (; i + 1 < 5; i++) {
      Ad[i + As[0] * j].a = 0.0;
      Ad[i + As[0] * j].b = 0.0;
    }
  }
}