| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-additional-options "-fipa-pta" } */ |
| 3 |
|
| 4 |
static int |
| 5 |
is_valid_domain_name (const char *string) |
| 6 |
{ |
| 7 |
const char *s; |
| 8 |
|
| 9 |
for (s=string; *s; s++) |
| 10 |
if (*s == '.') |
| 11 |
{ |
| 12 |
if (string == s) |
| 13 |
return 0; |
| 14 |
} |
| 15 |
|
| 16 |
return !!*string; |
| 17 |
} |
| 18 |
|
| 19 |
int |
| 20 |
main (void) |
| 21 |
{ |
| 22 |
static struct |
| 23 |
{ |
| 24 |
const char *name; |
| 25 |
int valid; |
| 26 |
} testtbl[] = |
| 27 |
{ |
| 28 |
{ ".", 0 }, |
| 29 |
{ nullptr, 0 } |
| 30 |
}; |
| 31 |
int idx; |
| 32 |
|
| 33 |
for (idx=0; testtbl[idx].name; idx++) |
| 34 |
{ |
| 35 |
if (is_valid_domain_name (testtbl[idx].name) != testtbl[idx].valid) |
| 36 |
__builtin_abort (); |
| 37 |
} |
| 38 |
return 0; |
| 39 |
} |