1 extern int var       __attribute__((weak));
   2 extern int arr[]     __attribute__((weak));
   3 extern int fun(void) __attribute__((weak));
   4 
   5 int test_addr_weak_fun(void)
   6 {
   7         if ( &var) return 1;
   8         if (  arr) return 1;
   9         if ( &arr) return 1;
  10         if (  fun) return 1;
  11         if ( &fun) return 1;
  12         if ( *fun) return 1;
  13         if (!&var) return 0;
  14         if (! arr) return 0;
  15         if (!&arr) return 0;
  16         if (! fun) return 0;
  17         if (!&fun) return 0;
  18         if (!*fun) return 0;
  19         return -1;
  20 }
  21 
  22 /*
  23  * check-name: Waddress-weak
  24  * check-note: Undefined weak symbols (can) have a null address.
  25  * check-command: sparse -Wno-decl -Waddress $file
  26  * check-known-to-fail
  27  */