| 1 |
/* PR tree-optimization/92683 - strncmp incorrect result with equal substrings |
| 2 |
and nonconst bound |
| 3 |
{ dg-do run } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
#include "strlenopt.h" |
| 7 |
|
| 8 |
#define ident(n) ident (n) |
| 9 |
|
| 10 |
__attribute__ ((noclone, noinline, noipa)) size_t |
| 11 |
ident (size_t x) |
| 12 |
{ |
| 13 |
return x; |
| 14 |
} |
| 15 |
|
| 16 |
int nfails; |
| 17 |
|
| 18 |
__attribute__ ((noclone, noinline, noipa)) void |
| 19 |
failure_on_line (int line) |
| 20 |
{ |
| 21 |
__builtin_printf ("failure on line %i\n", line); |
| 22 |
++nfails; |
| 23 |
} |
| 24 |
|
| 25 |
#include "strcmpopt_8.c" |
| 26 |
|
| 27 |
int main (void) |
| 28 |
{ |
| 29 |
test_literal (); |
| 30 |
test_cst_array (); |
| 31 |
|
| 32 |
if (nfails) |
| 33 |
__builtin_abort (); |
| 34 |
} |