Commit b2ab44b
authored
Fix "access violation" failures that have appeared in new windows builds by disabling compiler optimization on windows (#1077)
The root cause was a compiler autovectorization bug. Turning off
optimizations will hurt performance but at least make the code not
*totally broken*.
Reproduction of the bug in a simpler instance:
```
#include <cstdint>
#include <iostream>
uint64_t repro() {
uint32_t targets[6]{0, 27, 0, 0, 27, 0};
uint64_t t = 6;
for (size_t k = 0; k < 6; k++) {
if (targets[k] == 27) {
t -= 2;
}
}
return t;
}
int main() {
std::cerr << "t=" << repro() << "\n";
return 0;
}
```
Go to godbolt, paste the above code, compile it with the compiler `x64
msvc v19.51 VS18.6` and flags `/O2` and run it and it will print
`t=8589934594` instead of `t=2`.
Fixes #10781 parent 56769dd commit b2ab44b
2 files changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
0 commit comments