|
|
|
|
|
by masklinn
719 days ago
|
|
> Hmm, it could be that once UB is encountered the entire program becomes invalid, then. The UB doesn't actually need to be encountered, just guaranteed to be encountered eventually (in a non-statistical meaning), that is where the time travel comes from e.g. if you have if (condition) {
printf("thing\n");
1/0;
} else {
// other thing
}
the compiler can turn this into if (condition) {
// crash
} else {
// other thing
}
as well as // other thing
In the first case you have "time travel" because the crash occurs before the print, even though in a sequentially consistent world where division by zero was defined as a crash (e.g. in python) you should see the print first. |
|
That's what I meant. Anything that leads to UB itself has UB.