(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Waddress-3.c
       1  /* PR c/102103 - missing warning comparing array address to null
       2     { dg-do compile }
       3     { dg-options "-Wall" } */
       4  
       5  typedef _Complex float Cflt;
       6  
       7  extern Cflt cf, cfa[], cfa2[][2];
       8  
       9  Cflt *pcf (void);
      10  
      11  void T (int);
      12  
      13  void test_complex (Cflt *p, int i)
      14  {
      15    T (&__real__ cf == 0);              // { dg-warning "address of '__real__ cf'" }
      16    T (&__imag__ cf == 0);              // { dg-warning "address of '__imag__ cf'" }
      17  
      18    T (0 != &__real__ cf);              // { dg-warning "-Waddress" }
      19    T (0 != &__imag__ cf);              // { dg-warning "-Waddress" }
      20  
      21    T (&__real__ cfa[0] == 0);          // { dg-warning "-Waddress" }
      22    T (&__imag__ cfa[1] == 0);          // { dg-warning "-Waddress" }
      23  
      24    T (0 != &__real__ cfa2[i][i]);      // { dg-warning "-Waddress" }
      25    T (0 != &__imag__ cfa2[i][i]);      // { dg-warning "-Waddress" }
      26  
      27    T (0 == &__real__ *p);              // { dg-warning "-Waddress" }
      28    T (0 == &__imag__ *p);              // { dg-warning "-Waddress" }
      29  
      30    T (0 == &__real__ p[i]);            // { dg-warning "-Waddress" }
      31    T (0 == &__imag__ p[i]);            // { dg-warning "-Waddress" }
      32  
      33    T (&__real__ *pcf () == 0);         // { dg-warning "-Waddress" }
      34    T (0 != &__imag__ *pcf ());         // { dg-warning "-Waddress" }
      35  }