On Wed, Nov 5, 2014 at 6:50 AM, Kirill Yukhin <kirill.yuk...@gmail.com> wrote:
> Hello,
> On 24 Oct 17:56, Yury Gribov wrote:
> ...
>> +const struct test_data_t test_data[] = {
>> +  { STRTOL,  "-0x80000000", 0, -0x80000000L,  0      },
> ...
>> +      switch (test_data[i].fun)
>> +     {
>> +     case STRTOL:
>> +       res = strtol (test_data[i].nptr, 0, test_data[i].base);
>> +       break;
> As far as we might have `long long int' on 32-bit, `res' will fail
> to compare with corresponding `test_data[i].base'.
>
> Tiny patch fixes it.
>
> --
> Thanks, K
>
> diff --git a/libiberty/testsuite/test-strtol.c 
> b/libiberty/testsuite/test-strtol.c
> index 96d6871..6faf81b 100644
> --- a/libiberty/testsuite/test-strtol.c
> +++ b/libiberty/testsuite/test-strtol.c
> @@ -132,7 +132,8 @@ run_tests (const struct test_data_t *test_data, size_t 
> ntests)
>        switch (test_data[i].fun)
>         {
>         case STRTOL:
> -         res = strtol (test_data[i].nptr, 0, test_data[i].base);
> +         res = (unsigned long) strtol (test_data[i].nptr,
> +                                       0, test_data[i].base);
>           break;
>         case STRTOUL:
>           res = strtoul (test_data[i].nptr, 0, test_data[i].base);

I am checking it in as an obvious fix.

-- 
H.J.

Reply via email to