Commit f5cc0bf
committed
[APInt] Assert correct values in APInt constructor
If the uint64_t constructor is used, assert that the value is
actuall a signed or unsigned N-bit integer depending on whether
the isSigned flag is set.
Currently, we allow values to be silently truncated, which is
a constant source of subtle bugs -- a particularly common mistake
is to create -1 values without setting the isSigned flag, which
will work fine for all common bit widths (<= 64-bit) and miscompile
for larger integers.1 parent 7f09aa9 commit f5cc0bf
File tree
37 files changed
+388
-348
lines changed- llvm
- include/llvm/ADT
- lib
- Analysis
- Bitcode/Reader
- CodeGen
- SelectionDAG
- Frontend/OpenMP
- FuzzMutate
- IR
- Support
- Transforms
- IPO
- InstCombine
- Scalar
- Utils
- Vectorize
- unittests
- ADT
- Analysis
- FuzzMutate
- IR
- Support
37 files changed
+388
-348
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
111 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
112 | 126 | | |
113 | 127 | | |
114 | | - | |
| 128 | + | |
| 129 | + | |
115 | 130 | | |
116 | 131 | | |
117 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
892 | | - | |
| 892 | + | |
| 893 | + | |
893 | 894 | | |
894 | 895 | | |
895 | 896 | | |
| |||
3401 | 3402 | | |
3402 | 3403 | | |
3403 | 3404 | | |
3404 | | - | |
3405 | | - | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
3406 | 3408 | | |
3407 | 3409 | | |
3408 | 3410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
675 | 675 | | |
676 | 676 | | |
677 | 677 | | |
678 | | - | |
| 678 | + | |
679 | 679 | | |
680 | 680 | | |
681 | 681 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1460 | 1460 | | |
1461 | 1461 | | |
1462 | 1462 | | |
1463 | | - | |
| 1463 | + | |
1464 | 1464 | | |
1465 | 1465 | | |
1466 | 1466 | | |
| |||
1475 | 1475 | | |
1476 | 1476 | | |
1477 | 1477 | | |
1478 | | - | |
| 1478 | + | |
1479 | 1479 | | |
1480 | 1480 | | |
1481 | 1481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9303 | 9303 | | |
9304 | 9304 | | |
9305 | 9305 | | |
9306 | | - | |
| 9306 | + | |
9307 | 9307 | | |
9308 | 9308 | | |
9309 | 9309 | | |
| |||
9454 | 9454 | | |
9455 | 9455 | | |
9456 | 9456 | | |
9457 | | - | |
| 9457 | + | |
9458 | 9458 | | |
9459 | 9459 | | |
9460 | 9460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3147 | 3147 | | |
3148 | 3148 | | |
3149 | 3149 | | |
3150 | | - | |
| 3150 | + | |
3151 | 3151 | | |
3152 | 3152 | | |
3153 | 3153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1643 | 1643 | | |
1644 | 1644 | | |
1645 | 1645 | | |
1646 | | - | |
| 1646 | + | |
1647 | 1647 | | |
1648 | 1648 | | |
1649 | 1649 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
593 | | - | |
| 593 | + | |
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1625 | 1625 | | |
1626 | 1626 | | |
1627 | 1627 | | |
1628 | | - | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
1629 | 1632 | | |
1630 | 1633 | | |
1631 | 1634 | | |
| |||
0 commit comments