view gcc/testsuite/c-c++-common/guality/Og-dce-2.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-g" } */

struct s { int a, b, c, d; };

struct s gs1 = { 1, 2, 3, 4 };
struct s gs2 = { 5, 6, 7, 8 };

struct s *__attribute__((noipa)) consume (struct s *ptr) { return ptr; }

int
main (void)
{
  struct s x;
  struct s *volatile ptr = consume (&x);
  x = gs1;
  x = gs2;	/* { dg-final { gdb-test . "ptr->a" "1" } } */
  return 0;	/* { dg-final { gdb-test . "ptr->a" "5" } } */
}