GCC 15.1

Union initialization change ({0} vs {})

  • GCC 15.1 changes {0} on unions to only zero-initialize the first member (except for static storage), not the entire union including padding; {} or a new flag restores whole-union zeroing.
  • Several commenters predict subtle breakage, especially in code that relied on “everything gets zeroed” without fully understanding the standard. One security library is already reported affected.
  • Others argue the breakage will be rare: it only changes behavior when the first member is smaller than another member and {0} is used.
  • Some note Clang previously behaved like “new GCC” and then reversed, while GCC moved in the opposite direction at the same time, creating a confusing behavior matrix.

Standards conformance vs legacy expectations

  • Defenders of the change emphasize that GCC is aligning with long-standing C/C++ standards, where union initialization with {0} only guarantees initialization of the selected member.
  • Critics respond that, regardless of the spec, GCC had a de facto contract with users and silently changing widely relied-on behavior is risky.
  • Broader debate: should mature languages largely stop evolving to avoid “moving footguns,” or must they keep changing to correct old design mistakes?

Type punning, undefined vs unspecified behavior

  • Long sub-thread debates whether union-based type punning is well-defined in C.
  • Participants quote current and past C standards: footnotes explicitly describe union type punning, while an annex lists the values of non-active members as unspecified, not undefined.
  • Others cite GCC bug comments claiming it is undefined in both C and C++, leading to confusion about how compilers actually treat it.
  • Consensus in the thread trends toward: C permits union type punning with unspecified value representations; C++ generally treats it as undefined.

Initialization defaults and safety

  • Some argue that “uninitialized by default” in C was a historical mistake and that default zero-initialization (possibly with opt-out attributes or flags) would meaningfully improve safety.
  • Counterarguments: zeroing by default can hide real bugs, especially for lengths/counters; performance-critical domains (kernels, HFT, embedded) may need fine-grained control.
  • GCC’s new -ftrivial-auto-var-init is mentioned as a partial, compiler-specific safety knob.

Tooling, distros, and ecosystem

  • Ideas raised for distribution-level static analysis or compiler plugins to find unions whose behavior changes under GCC 15.
  • Practical expectation: many distros will likely use compiler flags to restore old semantics if compatibility problems appear.

Other GCC 15.1 features

  • C++ modules: commenters say GCC 14’s support was effectively unusable; GCC 15 is viewed as a major step toward practical modules, though std modules are still described as incomplete by some.
  • New #embed support for C/C++ draws enthusiasm as a cleaner way to include binary data.
  • [[clang::musttail]]-style musttail support and work on the Modula-2 frontend are briefly noted with interest.