llvm-project/llvm
Yonghong Song a63178f756 bpf: fix a strict-aliasing issue
Davide Italiano reported the following issue if llvm
is compiled with gcc -Wstrict-aliasing -Werror:
.....
lib/Target/BPF/CMakeFiles/LLVMBPFCodeGen.dir/BPFISelDAGToDAG.cpp.o
../lib/Target/BPF/BPFISelDAGToDAG.cpp: In member function ‘virtual
void {anonymous}::BPFDAGToDAGISel::PreprocessISelDAG()’:
../lib/Target/BPF/BPFISelDAGToDAG.cpp:264:26: warning: dereferencing
type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
       val = *(uint16_t *)new_val;
.....

The error is caused by my previous commit (revision 305560).

This patch fixed the issue by introducing an union to avoid
type casting.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 305608
2017-06-16 23:28:04 +00:00
..
bindings [Go] Subtypes function 2017-06-08 07:32:29 +00:00
cmake Addressed Takumi's comment about redundancy. 2017-06-12 19:17:55 +00:00
docs [Atomics] Rename and change prototype for atomic memcpy intrinsic 2017-06-16 14:43:59 +00:00
examples Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
include Revert rL305578. There is still some buildbot failure to be fixed. 2017-06-16 23:14:35 +00:00
lib bpf: fix a strict-aliasing issue 2017-06-16 23:28:04 +00:00
projects Add temporary workaround to allow in-tree libc++ builds on Windows 2017-05-11 01:44:30 +00:00
resources
runtimes [CMake][runtimes] Add install target for runtimes builtins 2017-06-02 19:38:11 +00:00
test Revert rL305578. There is still some buildbot failure to be fixed. 2017-06-16 23:14:35 +00:00
tools Clean up some things in the WindowsResource changes. 2017-06-16 22:00:42 +00:00
unittests UnitTests: Followup to 305519 2017-06-15 22:50:57 +00:00
utils utils: Add a git-r utility for mapping svn revisions to git revisions in the monorepo. 2017-06-16 22:15:18 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt Enable c++1z experimental builds. 2017-06-09 22:09:57 +00:00
CODE_OWNERS.TXT
CREDITS.TXT update of the url 2017-05-14 07:55:01 +00:00
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.