Bug 110210 - problem with strtol strtoll strtoul strtoull
Summary: problem with strtol strtoll strtoul strtoull
Status: RESOLVED MOVED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-11 15:15 UTC by actri_lxlong3
Modified: 2023-06-11 16:25 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description actri_lxlong3 2023-06-11 15:15:24 UTC
When using strtol, strtoll, strtoul, and strtoull functions in code to convert values that exceed the representation range,

Incorrect error number after execution

The requirement of C standard for this Class function: if the correct value exceeds the representation range, LONG_ MIN, LONG_ MAX, LLONG_ MIN, LLONG_ MAX, ULONG_ MAX or ULLONG_ MAX (corresponding symbol bit) will be used as the return value, and the value of macro ERANGE will be stored in errno.

During testing, it was found that the returned errno was not an ERANGE value
Comment 1 Andrew Pinski 2023-06-11 16:02:09 UTC
Gcc does not provide these functions. They are provided by the libc that gcc links to.

In the case of Linux, it is most likely glibc but it could be musl or uclibc .
Comment 2 Andrew Pinski 2023-06-11 16:25:04 UTC
Gcc does not provide these functions. They are provided by the libc that gcc links to.

In the case of Linux, it is most likely glibc but it could be musl or uclibc .
If you are using a -elf target, then libc is most likely provided by newlib.


Also GCC 4.8.x is no longer supported upstream, you should try a much newer GCC, like GCC 9.x or even better GCC 13.