https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97641

--- Comment #6 from Dmitriy Ovdienko <dmitriy.ovdienko at gmail dot com> ---
This code does not work
```
#include <cstdio>

int Parse1(char const* ptr) noexcept
{
    int result = 0;
    while ('\x01' != *ptr)
    {
        result = result * 10 + *ptr++ - '0';
    }
    return result;
}

int main()
{
    if(2147483600 != Parse1("2147483600\x01")) 
        printf("does not match\n");
    else
        printf("matches\n");
}
```

But this does work:

```
#include <cstdio>

int Parse1(char const* ptr) noexcept
{
    int result = 0;
    while ('\x01' != *ptr)
    {
        result = result * 10 + (*ptr++ - '0');
    }
    return result;
}

int main()
{
    if(2147483600 != Parse1("2147483600\x01")) 
        printf("does not match\n");
    else
        printf("matches\n");
}
```

Reply via email to