view gcc/testsuite/gcc.dg/analyzer/compound-assignment-3.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

#include <stdlib.h>

struct union_wrapper
{
  union
  {
    int i;
    void *ptr;
  } u;
};

struct union_wrapper
test_1 (void)
{
  struct union_wrapper uw1;
  uw1.u.ptr = malloc (1024);
  return uw1;
}

struct union_wrapper
test_2 (void)
{
  struct union_wrapper uw2;
  uw2.u.ptr = malloc (1024);
} /* { dg-warning "leak of '\\(void \\*\\)uw2.u'" } */