Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/nested-func-9.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line source
/* PR c/70093 */ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-require-effective-target alloca } */ void foo (int n) { struct S { int a[n]; }; struct S fn (void) { struct S s; s.a[0] = 42; return s; } auto struct S fn2 (void) { return fn (); } struct S x; fn (); fn2 (); x = fn (); if (x.a[0] != 42) __builtin_abort (); if (fn ().a[0] != 42) __builtin_abort (); __typeof__ (fn ()) *p = &x; if (p->a[0] != 42) __builtin_abort (); if (fn2 ().a[0] != 42) __builtin_abort (); } int main (void) { foo (1); }