Skip to content

Case 116: _Atomic qualifier added (C11)

Field Value
Verdict ๐Ÿ”ด BREAKING
Category Breaking
Platforms Linux
Flags ABI break
Detected ChangeKinds atomic_qualifier_changed
Source files examples/case116_atomic_qualifier_changed/

Category: Binary ABI break / C11 | Verdict: ๐Ÿ”ด BREAKING

What changed

v1 exposes a struct counter whose value field is a plain (unqualified) int. v2 adds the C11 _Atomic qualifier to that field. The accessor get_count() returns a plain long in both versions โ€” only the field changed.

Per WG14, the size and alignment of an _Atomic-qualified type may differ from the unqualified type and varies across implementations (some lock-free types carry extra padding/alignment). So the struct counter layout can diverge: a consumer built against v1 reads the field at the wrong offset/width against v2.

How abicheck catches it

atomic_qualifier_changed fires for each public slot (parameter, return, or field) where the _Atomic qualifier is added or removed. Layout-level findings (type_size_changed / struct_field_*) may also appear; the specialised kind names the _Atomic root cause.

Files

  • v1.h / v2.h โ€” plain vs _Atomic declarations
  • v1.c / v2.c โ€” the two library builds
  • app.c โ€” consumer built against the plain interface

Source files

  • CMakeLists.txt
  • app.c
  • v1.c
  • v1.h
  • v2.c
  • v2.h

See also: Examples overview ยท All BREAKING cases ยท Category: Breaking.