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