| 1 |
/* Verify that strcmp doesn't make assumptions about the size of a weak |
| 2 |
symbol. |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
/* An ordinary definition of A with more elements might be provided |
| 7 |
in another translation unit. Even though that would be undefined |
| 8 |
(the type of the actual definition must be the same as the type |
| 9 |
of the weak declaration) this test verifies that GCC doesn't rely |
| 10 |
on the size of this A for optimization (as a matter of QoI). */ |
| 11 |
__attribute__ ((weak)) char a[3]; |
| 12 |
|
| 13 |
int cmp_a3_x (void) |
| 14 |
{ |
| 15 |
return __builtin_strcmp (a, "1234567") == 0; |
| 16 |
} |