view gcc/testsuite/g++.old-deja/g++.other/anon6.C @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do run  }
extern "C" void abort ();

struct A {
  union {
    int a;
    double b;
    int d;
  };
  int c;
};

struct B : public A {
  union {
    double a;
    void *c;
  };
  float b;
  int e;
};

int main ()
{
  struct B b;

  b.a = 1.5;
  b.b = 2.5;
  b.d = 1;
  b.e = 2;
  if (b.a != 1.5 || b.b != 2.5 || b.d != 1 || b.e != 2)
    abort ();
  b.c = &b.a;
  b.d = b.e;
  if (b.c != &b.a || b.d != 2)
    abort ();
  return 0;
}