Commit 32cf8c7
committed
Fix pointer aliasing bug in constant optimization
Variables modified through pointers incorrectly returned cached constant
values instead of reloading from memory. This caused wrong results when
a variable was initialized with a constant, had its address taken, and
was modified through pointer indirection.
Example that was broken:
int b = 10;
int *a = &b;
a[0] = 5;
return b;
Previously returned 10 (cached), now correctly returns 5 (reloaded).1 parent 3746f8d commit 32cf8c7
3 files changed
+42
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
356 | 357 | | |
357 | 358 | | |
358 | 359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1092 | 1100 | | |
1093 | 1101 | | |
1094 | 1102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
116 | 125 | | |
117 | 126 | | |
118 | 127 | | |
119 | 128 | | |
120 | 129 | | |
121 | 130 | | |
122 | 131 | | |
| 132 | + | |
123 | 133 | | |
124 | | - | |
| 134 | + | |
125 | 135 | | |
126 | 136 | | |
127 | 137 | | |
| |||
207 | 217 | | |
208 | 218 | | |
209 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
210 | 230 | | |
211 | 231 | | |
212 | 232 | | |
| |||
471 | 491 | | |
472 | 492 | | |
473 | 493 | | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | 494 | | |
478 | 495 | | |
479 | 496 | | |
| |||
490 | 507 | | |
491 | 508 | | |
492 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
493 | 516 | | |
494 | 517 | | |
495 | 518 | | |
| |||
500 | 523 | | |
501 | 524 | | |
502 | 525 | | |
| 526 | + | |
| 527 | + | |
503 | 528 | | |
504 | 529 | | |
505 | 530 | | |
| |||
792 | 817 | | |
793 | 818 | | |
794 | 819 | | |
795 | | - | |
| 820 | + | |
796 | 821 | | |
797 | 822 | | |
798 | 823 | | |
| |||
0 commit comments