Debian Codegraph @

gcc/testsuite/gcc.dg/Walloc-size-2.c

raw
1 /* Test that VLA types do not crash with -Walloc-size
2 { dg-do compile }
3 { dg-options "-Walloc-size" }
4 * */
5
6 struct foo { int x[10]; };
7
8 void fo0(int n)
9 {
10 struct foo (*p)[n] = __builtin_malloc(sizeof *p);
11 }
12
13 void fo1(int n)
14 {
15 struct bar { int x[n]; };
16 struct bar *p = __builtin_malloc(sizeof *p);
17 }
18