Earlier quoted context omitted.
I think this might not be a shortcoming of MSVC but rather a deliberate design decision. It seems likely that MSVC is failing to apply strict aliasing, but that it's deliberately avoiding it, probably for compatibility reasons with code that wasn't/isn't written to spec. And frankly it can be very onerous to write code that is 100% correct per the standard when dealing with e.g. memory-mapped files; I'm struggling to…
AFIK MSVC has never implemented TBAA by design.
Aliasing
31–36 of 36 posts
Re: Aliasing
#32Earlier quoted context omitted.
LOL, nope. Those annotations must be part of the type system (e.g. `&mut T` in Rust) and must be checked by the compiler (the borrow checker). The language can provide escape hatches like `unsafe`, but they should be rarely used. Without it you get a fragile footgunny mess. Just look at the utter failure of `restrict`. It was so rarely used in C that it took several years of constant nagging from Rust developers to i…
Does make me wonder what restrict-related bugs will be (have been?) uncovered in GCC, if any. Or whether the GCC devs saw what LLVM went through and decided to try to address any issues preemptively.
Re: Aliasing
#33Earlier quoted context omitted.
Does make me wonder what restrict-related bugs will be (have been?) uncovered in GCC, if any. Or whether the GCC devs saw what LLVM went through and decided to try to address any issues preemptively.
gcc has had restrict for 25 years I think. I would hope most bugs have been squashed by now.
Now that I think about it some more, perhaps gfortran might be a differentiating factor? Not familiar enough with Fortran to guess as to how much it would exercise aliasing-related optimizations, though.
Re: Aliasing
#34Earlier quoted context omitted.
LOL, nope. Those annotations must be part of the type system (e.g. `&mut T` in Rust) and must be checked by the compiler (the borrow checker). The language can provide escape hatches like `unsafe`, but they should be rarely used. Without it you get a fragile footgunny mess. Just look at the utter failure of `restrict`. It was so rarely used in C that it took several years of constant nagging from Rust developers to i…
Does make me wonder what restrict-related bugs will be (have been?) uncovered in GCC, if any. Or whether the GCC devs saw what LLVM went through and decided to try to address any issues preemptively.
Re: Aliasing
#35Earlier quoted context omitted.
gcc has had restrict for 25 years I think. I would hope most bugs have been squashed by now.
Possibly? LLVM had been around for a while as well but Rust still ended up running into aliasing-related optimizer bugs. Now that I think about it some more, perhaps gfortran might be a differentiating factor? Not familiar enough with Fortran to guess as to how much it would exercise aliasing-related optimizations, though.
Re: Aliasing
#36Earlier quoted context omitted.
Possibly? LLVM had been around for a while as well but Rust still ended up running into aliasing-related optimizer bugs. Now that I think about it some more, perhaps gfortran might be a differentiating factor? Not familiar enough with Fortran to guess as to how much it would exercise aliasing-related optimizations, though.
I think Fortran function arguments are assumed not to alias. I'm not sure if it matches C restrict semantics though.