aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-39.c
blob: 4d17f14725f185bb6f16ac548608710bda3b926d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* PR c/98592 - ICE in gimple_canonical_types_compatible_p while formatting
   a MEM_REF
   { dg-do compile }
   { dg-options "-O2 -Wall" }
   { dg-require-effective-target alloca } */

void f (int);

void vlaNx3_to_pia1 (int n)
{
  int a[n][3];

  /* The VLA isn't formatted correctly due to PR 98587.  Just verify
     there is no ICE and a warning is issued.  */
  f (((*(int(*)[4])&a[1][2]))[3]);      // { dg-warning "\\\[-Wuninitialized" }
}

void vlaNxN_to_pia1 (int n)
{
  int a[n][n];

  /* Same as above.  */
  f (((*(int(*)[4])&a[1][2]))[3]);      // { dg-warning "\\\[-Wuninitialized" }
}

void vlaNxN_to_pvla4xN (int n)
{
  int a[n][n];

  /* Same as above.  */
  f (((*(int(*)[4][n])&a[1][2]))[3][4]);  // { dg-warning "\\\[-Wuninitialized" }
}

void vlaN_to_pia2 (int n)
{
  int a[n];

  /* Same as above.  */
  f (((*(int(*)[3][4])&a[1]))[2][3]);   // { dg-warning "\\\[-Wuninitialized" }
}

void vlaN_to_pvlaNx4 (int n)
{
  int a[n];

  /* Same as above.  */
  f (((*(int(*)[n][4])&a[1]))[1][3]);   // { dg-warning "\\\[-Wuninitialized" }
}