Commit cbd84ae
authored
Auto merge of #34942 - porglezomp:master, r=sfackler
Fix overflow checking in unsigned pow()
The pow() method for unsigned integers produced 0 instead of trapping overflow for certain inputs. Calls such as 2u32.pow(1024) produced 0 when they should trap an overflow. This also adds tests for the correctly handling overflow in unsigned pow().
This was previously fixed for signed integers in #28248, but it seems unsigned integers got missed that time.
For issue number #34913File tree
3 files changed
+27
-15
lines changed- src
- libcore/num
- test/run-fail
3 files changed
+27
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2211 | 2211 | | |
2212 | 2212 | | |
2213 | 2213 | | |
2214 | | - | |
2215 | | - | |
2216 | | - | |
| 2214 | + | |
2217 | 2215 | | |
2218 | | - | |
2219 | | - | |
2220 | | - | |
2221 | | - | |
2222 | | - | |
2223 | | - | |
2224 | | - | |
2225 | | - | |
| 2216 | + | |
2226 | 2217 | | |
2227 | | - | |
2228 | | - | |
2229 | | - | |
2230 | | - | |
2231 | 2218 | | |
| 2219 | + | |
2232 | 2220 | | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
2233 | 2229 | | |
2234 | 2230 | | |
2235 | 2231 | | |
| |||
File renamed without changes.
| 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 | + | |
0 commit comments