Commit 0c95523
committed
gccrs: Fix 128-bit non-decimal integer literal saturation
This patch replaces std::strtol with GNU MP (GMP) for arbitrary-precision
parsing. Additionally, the hex literal dispatcher was corrected to
avoid prepending "0x" to the internal string, ensuring compatibility
with mpz_set_str.
gcc/rust/ChangeLog:
* lex/rust-lex.cc (Lexer::parse_non_decimal_int_literal): Use GMP
for base conversion to support 128-bit literals.
(Lexer::parse_non_decimal_int_literals): Fix hex prefix inconsistency
by passing pure string.
gcc/testsuite/ChangeLog:
* rust/execute/non_decimal_128_saturation.rs: New test.
Signed-off-by: Enes Cevik <nsvke@proton.me>1 parent 7b26919 commit 0c95523
File tree
2 files changed
+33
-4
lines changed- gcc
- rust/lex
- testsuite/rust/execute
2 files changed
+33
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2271 | 2271 | | |
2272 | 2272 | | |
2273 | 2273 | | |
2274 | | - | |
2275 | | - | |
2276 | | - | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
2277 | 2281 | | |
2278 | 2282 | | |
2279 | 2283 | | |
| |||
2313 | 2317 | | |
2314 | 2318 | | |
2315 | 2319 | | |
2316 | | - | |
| 2320 | + | |
| 2321 | + | |
2317 | 2322 | | |
2318 | 2323 | | |
2319 | 2324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments