| 1 |
// PR rtl-optimization/113994 |
| 2 |
// { dg-do run } |
| 3 |
// { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } } |
| 4 |
|
| 5 |
#include <string> |
| 6 |
|
| 7 |
void |
| 8 |
foo (const std::string &x, size_t &y, std::string &z) |
| 9 |
{ |
| 10 |
size_t w = x.find (']'); |
| 11 |
if (w >= x.size ()) |
| 12 |
return; |
| 13 |
else if (w == 1) |
| 14 |
y = std::string::npos; |
| 15 |
while (++w < x.size () && x[w] == u'.') |
| 16 |
; |
| 17 |
z = x.substr (w); |
| 18 |
} |
| 19 |
|
| 20 |
__attribute__((noipa)) void |
| 21 |
bar () |
| 22 |
{ |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
main () |
| 27 |
{ |
| 28 |
size_t y = 0; |
| 29 |
std::string z; |
| 30 |
foo ("[0]", y, z); |
| 31 |
bar (); |
| 32 |
} |