Tag

strict aliasing

0 views collected around this technical thread.

ByteDance SYS Tech
ByteDance SYS Tech
Jun 9, 2023 · Backend Development

Why Strict Aliasing Matters: Deep Dive into LLVM TBAA and TypeSanitizer

This article explains the Strict Aliasing Rule, how compilers use Type‑Based Alias Analysis (TBAA) for optimization, demonstrates LLVM’s metadata‑based implementation, introduces the TypeSanitizer tool for detecting aliasing violations, and offers practical guidance to avoid common pitfalls in C/C++ code.

Compiler OptimizationLLVMSanitizer
0 likes · 33 min read
Why Strict Aliasing Matters: Deep Dive into LLVM TBAA and TypeSanitizer
Tencent Database Technology
Tencent Database Technology
Dec 20, 2018 · Fundamentals

Unexpected Behavior with -O2 Optimization Due to Strict Aliasing Violations in C++

The article explains why a C++ program produces different outputs with and without the -O2 optimization flag, tracing the issue to strict aliasing violations caused by type‑punning pointer casts, and shows how disabling -fstrict-aliasing or using -fno‑strict‑aliasing resolves the problem.

CCompiler OptimizationOptimization Flags
0 likes · 8 min read
Unexpected Behavior with -O2 Optimization Due to Strict Aliasing Violations in C++