Re: netbsd-11 gcc bug
Mouse <[email protected]> Thu, 28 May 2026 18:36:17 -0400 (EDT)
| Newsgroups | gmane.os.netbsd.devel.toolchain |
|---|---|
| Message-ID | <[email protected]> |
> The reason for the "belief" that UB is (often) related to optimizers > is squarely resting on the fact that when the optimizer is turned off > then the UB goes away. No, it doesn't. It is still UB. All that changes is what the compiler chooses to do in that case where its behaviour is undefined by the spec. A more accurate phrasing would be that the compiler's choice of behaviour changes depending on optimization. The compiler must do *something* when faced with UB, whether it's compiling code that does what the source author intended, segfaulting, making usefulness-impairing inferences, or (in non-runtime cases) printing all primes from 2 to 4294967291 at compile time. UB just means that the spec does not constrain what the compiler does. > As I said, efforts to eliminate UB from C are actually happening at > the standards committee level, so.... That will be difficult, unless some of them are handled by converting UB to IDB by fiat. Indirecting through a garbage pointer comes to mind as an example. (You're not going to get rid of garbage pointers without crippling the language for use cases such as implementing VM subsystems.) /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML [email protected] / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B