Web lists-archives.com

Strict aliasing, yes or no?

Just wondering what the position on this is. I've seen a few conflicting indications:

(1) The new meson patches pass -fno-strict-aliasing to GCC and Clang: https://git.gnome.org/browse/gtk+/commit/?h=wip/meson&id=1e3daf3178bb3db56ab12a55195969857f685101 The rationale is "We don't want to build buggy code." Well, technically, code that relies on aliasing is
inherently buggy from the outset, because that violates the standard. Assuming that's not something you strive for, the next bit is worse: I can't see an equivalent directive for MSVC. Surely this means, without forcing the compiler to make aliasing well-defined, code that relies on aliasing is free to start wildly bugging out on MSVC at any time?

(2) The Autotools build files do not seem to pass this flag, indicating that avoidance of strict aliasing was not a requirement.

(3) There's this old bug (and possibly others) to remove aliasing violations: https://bugzilla.gnome.org/show_bug.cgi?id=140722

So, which is true? Do we want to forbid breaking strict aliasing rules, or do we want to require compilers that allow us to override the Standard and rely on aliasing violations?

gtk-devel-list mailing list