News for hackers. Stuff that matters.
Re:Aliasing by newpavlov on Monday December 22, 2025 @02:13PM (#46357638)
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 iron out various bugs in compilers caused by it.

Re:Aliasing by aw1621107 on Monday December 22, 2025 @05:41PM (#46360046)
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 by gpderetta on Tuesday December 23, 2025 @03:30AM (#46363530)
gcc has had restrict for 25 years I think. I would hope most bugs have been squashed by now.
Re:Aliasing by aw1621107 on Tuesday December 23, 2025 @04:34AM (#46363836)
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 by gpderetta on Tuesday December 23, 2025 @07:06PM (#46370996)
I think Fortran function arguments are assumed not to alias. I'm not sure if it matches C restrict semantics though.
Re:Aliasing by aw1621107 on Wednesday December 24, 2025 @09:00PM (#46381410)
Yeah, that's why I was wondering whether GCC might have shaken out its aliasing bugs. Sibling seems to recall otherwise, though.
Re:Aliasing by newpavlov on Tuesday December 23, 2025 @01:59PM (#46368175)
IIRC at least one of the `restrict` bugs found by Rust was reproduced on both LLVM and GCC.