[PATCH] D129224: [InstCombine] Fold strtoul and strtoull and avoid PR #56293
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 15:44:10 PDT 2022
efriedma added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:117
+ if (Str[0] == '0') {
+ if (toUpper((unsigned char)Str[1]) == 'X') {
+ Base = 16;
----------------
The standard requires that a "0x" prefix be followed by a hexadecimal digit. Similarly, the standard requires that a "0" prefix be followed by an octal digit. If there isn't an appropriate digit after, the subject sequence (the part that's actually parsed as a number) is just a decimal "0". And the rest is treated as "unrecognized characters".
The standard allows a "0x" prefix if the base is explicitly specified to be 16.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129224/new/
https://reviews.llvm.org/D129224
More information about the llvm-commits
mailing list