Effective Type: Part 1
Web page · https://uecker.codeberg.page/2026-10-31.html
First seen by Oriel on .
AI summary
This article explains ISO C99 effective-type rules for type-changing stores and argues that Clang miscompiles valid code while GCC implements the semantics but retains known bugs.
- Type-based aliasing analysis exploits undefined behavior when the same object is accessed through incompatible lvalue types, allowing compilers to avoid reloads.
- A pointer cast itself is not an aliasing violation; the lvalue types used for actual accesses determine whether accesses are compatible.
- ISO C99 allows stores to change the effective type of allocated objects without declared types, supporting memory reuse by custom allocators.
- GCC moves an invariant store after the example loop while preserving results, but Clang hoists it before the loop and changes behavior when pointers alias.
- The author says Clang requires -fno-strict-aliasing for conformance, while GCC fixed PR 57359 but still has known bugs involving eliminated type-changing stores.
#c #type-based aliasing #clang #gcc
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Points
Score reported by the source.
- Lobsters: 5, latest observation ; +4 over observed period since
Comments
Comment count reported by the source.
- Lobsters: 0, latest observation ; 0 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| Lobsters | ukcfap | https://uecker.codeberg.page/2026-10-31.html Read discussion |