view gcc/testsuite/c-c++-common/pr43395.c @ 16:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
line wrap: on
line source

/* PR c/43395 */
/* { dg-do compile } */
/* { dg-require-effective-target label_values } */

void *
foo (void)
{
 lab: /* { dg-line foo_lab } */
  return &&lab;
/* { dg-warning "function returns address of label" "" { target c } .-1 } */
/* { dg-warning "address of label" "" { target c++ } foo_lab } */
}

void *
bar (void)
{
  __label__ lab;
 lab: /* { dg-line bar_lab } */
  return &&lab;
/* { dg-warning "function returns address of label" "" { target c } .-1 } */
/* { dg-warning "address of label" "" { target c++ } bar_lab } */
}

void *
baz (void)
{
  int i; /* { dg-line baz_i } */
  return &i;
/* { dg-warning "function returns address of local variable" "" { target c } .-1 } */
/* { dg-warning "address of local variable" "" { target c++ } baz_i } */
}