[llvm-bugs] [Bug 43344] New: CallExpr::getArgs violates strict aliasing

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 17 17:38:23 PDT 2019


            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: unassignedclangbugs at nondot.org
          Reporter: comexk at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

For a CallExpr, the array trailing the object can be accessed in two different

- 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.


You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190918/e3a0cc4b/attachment-0001.html>

More information about the llvm-bugs mailing list