The atoi function has undefined behavior if its argument is outside the range of int. Thus, GCC should not use it for any user input that might be outside that range.
For example, -O4294967296 should act like -O3, but on 64-bit systems with glibc it acts like -O0 (glibc's atoi converts the return from strtol to int, thereby losing high bits). In most cases (like the above), using strtol and saturating for input out of range of int is probably appropriate, but some cases may need errors for large input. A helper function - like atoi, but saturating - may be appropriate. -- Summary: Avoid use of atoi Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jsm28 at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574