https://bugs.llvm.org/show_bug.cgi?id=43344
Bug ID: 43344
Summary: CallExpr::getArgs violates strict aliasing
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
For a CallExpr, the array trailing the object can be accessed in two different
ways:
- As `Stmt **`: getTrailingStmts(), children()
- As `Expr **`: getArgs()
Accessing the same memory using both types is a strict aliasing violation –
it's of course legal to access an `Expr` through a pointer to `Stmt`, but not
to access an `Expr *` through a pointer to `Stmt *` or vice versa.
However, note that Clang itself does not enforce strict aliasing between
pointer types [1], and Clang's build system sets -fno-strict-aliasing when
built with GCC-compatible compilers other than Clang itself [2]. And the other
major C++ compiler, MSVC, does not enforce strict aliasing at all. So for now
this should not cause any problems in practice.
[1]
https://github.com/llvm-mirror/clang/blob/168f5196982f3aa5abce4e28c75bd6194ce0d9f0/lib/CodeGen/CodeGenTBAA.cpp#L161
[2]
https://github.com/llvm-mirror/clang/blob/168f5196982f3aa5abce4e28c75bd6194ce0d9f0/CMakeLists.txt#L363
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs