(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
transparent-union-1.c
       1  /* PR c/20043 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-std=gnu99" } */
       4  
       5  extern void f0 (int *);
       6  extern void f0 (int *__restrict);
       7  
       8  extern void f1 (int *__restrict);
       9  extern void f1 (int *);
      10  
      11  typedef union { int *i; long *l; } U2
      12    __attribute__((transparent_union));
      13  extern void f2 (U2);
      14  extern void f2 (int *);
      15  
      16  typedef union { int *__restrict i; long *__restrict l; } U3
      17    __attribute__((transparent_union));
      18  extern void f3 (U3);
      19  extern void f3 (int *__restrict);
      20  
      21  extern void f4 (U3);
      22  extern void f4 (int *);
      23  
      24  extern void f5 (U2);
      25  extern void f5 (int *__restrict);
      26  
      27  typedef union { long *l; int *i; } U6
      28    __attribute__((transparent_union));
      29  extern void f6 (U6);
      30  extern void f6 (int *);
      31  
      32  typedef union { long *__restrict l; int *__restrict i; } U7
      33    __attribute__((transparent_union));
      34  extern void f7 (U7);
      35  extern void f7 (int *__restrict);
      36  
      37  extern void f8 (U7);
      38  extern void f8 (int *);
      39  
      40  extern void f9 (U6);
      41  extern void f9 (int *__restrict);
      42  
      43  extern void f10 (U2);
      44  extern void f11 (U3);
      45  extern void f12 (U6);
      46  extern void f13 (U7);
      47  
      48  int i;
      49  long l;
      50  
      51  int
      52  main (void)
      53  {
      54    f0 (&i);
      55    f0 (&l);	/* { dg-warning "passing argument 1 of 'f0' from incompatible pointer type" } */
      56    f1 (&i);
      57    f1 (&l);	/* { dg-warning "passing argument 1 of 'f1' from incompatible pointer type" } */
      58    f2 (&i);
      59    f2 (&l);	/* { dg-warning "passing argument 1 of 'f2' from incompatible pointer type" } */
      60    f3 (&i);
      61    f3 (&l);	/* { dg-warning "passing argument 1 of 'f3' from incompatible pointer type" } */
      62    f4 (&i);
      63    f4 (&l);	/* { dg-warning "passing argument 1 of 'f4' from incompatible pointer type" } */
      64    f5 (&i);
      65    f5 (&l);	/* { dg-warning "passing argument 1 of 'f5' from incompatible pointer type" } */
      66    f6 (&i);
      67    f6 (&l);	/* { dg-warning "passing argument 1 of 'f6' from incompatible pointer type" } */
      68    f7 (&i);
      69    f7 (&l);	/* { dg-warning "passing argument 1 of 'f7' from incompatible pointer type" } */
      70    f8 (&i);
      71    f8 (&l);	/* { dg-warning "passing argument 1 of 'f8' from incompatible pointer type" } */
      72    f9 (&i);
      73    f9 (&l);	/* { dg-warning "passing argument 1 of 'f9' from incompatible pointer type" } */
      74    f10 (&i);
      75    f10 (&l);
      76    f11 (&i);
      77    f11 (&l);
      78    f12 (&i);
      79    f12 (&l);
      80    f13 (&i);
      81    f13 (&l);
      82    return 0;
      83  }
      84  
      85  /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */