Commit ca2fc22
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 73d835c commit ca2fc22
File tree
33 files changed
+377
-339
lines changed- llvm
- include/llvm/ADT
- lib
- Analysis
- Bitcode/Reader
- CodeGen/SelectionDAG
- FuzzMutate
- IR
- Support
- Transforms
- IPO
- InstCombine
- Scalar
- Utils
- Vectorize
- unittests
- ADT
- Analysis
- FuzzMutate
- IR
- Support
33 files changed
+377
-339
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 | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
112 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
113 | 127 | | |
114 | 128 | | |
115 | | - | |
| 129 | + | |
| 130 | + | |
116 | 131 | | |
117 | 132 | | |
118 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
890 | | - | |
| 890 | + | |
| 891 | + | |
891 | 892 | | |
892 | 893 | | |
893 | 894 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
663 | | - | |
| 663 | + | |
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1481 | 1481 | | |
1482 | 1482 | | |
1483 | 1483 | | |
1484 | | - | |
| 1484 | + | |
1485 | 1485 | | |
1486 | 1486 | | |
1487 | 1487 | | |
| |||
1496 | 1496 | | |
1497 | 1497 | | |
1498 | 1498 | | |
1499 | | - | |
| 1499 | + | |
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9516 | 9516 | | |
9517 | 9517 | | |
9518 | 9518 | | |
9519 | | - | |
| 9519 | + | |
9520 | 9520 | | |
9521 | 9521 | | |
9522 | 9522 | | |
| |||
9671 | 9671 | | |
9672 | 9672 | | |
9673 | 9673 | | |
9674 | | - | |
| 9674 | + | |
9675 | 9675 | | |
9676 | 9676 | | |
9677 | 9677 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3190 | 3190 | | |
3191 | 3191 | | |
3192 | 3192 | | |
3193 | | - | |
| 3193 | + | |
3194 | 3194 | | |
3195 | 3195 | | |
3196 | 3196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1628 | 1628 | | |
1629 | 1629 | | |
1630 | 1630 | | |
1631 | | - | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
1632 | 1635 | | |
1633 | 1636 | | |
1634 | 1637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2142 | 2142 | | |
2143 | 2143 | | |
2144 | 2144 | | |
2145 | | - | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
2146 | 2148 | | |
2147 | 2149 | | |
2148 | 2150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
0 commit comments