[llvm-bugs] [Bug 33679] New: [AArch64] Unexpected 'brk' in function returned 'int' but without 'return' statement
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jul 3 05:04:18 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33679
Bug ID: 33679
Summary: [AArch64] Unexpected 'brk' in function returned 'int'
but without 'return' statement
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: dantipov at nvidia.com
CC: llvm-bugs at lists.llvm.org
Created attachment 18745
--> https://bugs.llvm.org/attachment.cgi?id=18745&action=edit
Sample
For the sample code attached, 'int test_complexStructure()' has no 'return'
statement, and the latter seems causes clang to produce an unexpected result:
00000000004005e4 <test_complexStructure()>:
4005e4: f81e0ffc str x28, [sp, #-32]!
4005e8: a9017bfd stp x29, x30, [sp, #16]
4005ec: 910043fd add x29, sp, #0x10
4005f0: d10783e9 sub x9, sp, #0x1e0
4005f4: 9278dd3f and sp, x9, #0xffffffffffffff00
4005f8: 2a1f03e8 mov w8, wzr
4005fc: b27803e2 orr x2, xzr, #0x100
400600: 910003e9 mov x9, sp
400604: 9000000a adrp x10, 400000 <_init-0x460>
400608: 911c014a add x10, x10, #0x700
40060c: b940014b ldr w11, [x10]
400610: b901d3eb str w11, [sp, #464]
400614: b940054b ldr w11, [x10, #4]
400618: b901d7eb str w11, [sp, #468]
40061c: b940094b ldr w11, [x10, #8]
400620: b901dbeb str w11, [sp, #472]
400624: aa0903e0 mov x0, x9
400628: 53001d01 uxtb w1, w8
40062c: 97ffffa9 bl 4004d0 <memset at plt>
400630: d4200020 brk #0x1 ;; Why this?
LLVM/clang was configured to use AArch64 sysroot from
gcc-linaro-7.1.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz (installed at
/home/dantipov/.local/aarch64-linux-gnu) with:
cmake -DCMAKE_C_FLAGS_RELEASE='-O3 -DNDEBUG -march=native -mtune=native'
-DCMAKE_CXX_FLAGS_RELEASE='-O3 -DNDEBUG -march=native -mtune=native'
-DCMAKE_INSTALL_PREFIX=/home/dantipov/.local/aarch64-linux-gnu
-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CROSSCOMPILING=1
-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu -DLLVM_TARGET_ARCH=AArch64
-DLLVM_TARGETS_TO_BUILD=AArch64
-DDEFAULT_SYSROOT=/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc
and invoked with:
$ ~/.local/aarch64-linux-gnu/bin/clang++ -v bug.cc
clang version 5.0.0 (trunk 307018)
Target: aarch64--linux-gnu
Thread model: posix
InstalledDir: /home/dantipov/.local/aarch64-linux-gnu/bin
Found candidate GCC installation:
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1
Selected GCC installation:
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/home/dantipov/.local/aarch64-linux-gnu/bin/clang-5.0" -cc1 -triple
aarch64--linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name bug.cc -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature
+neon -target-abi aapcs -v -dwarf-column-info -debugger-tuning=gdb
-resource-dir /home/dantipov/.local/aarch64-linux-gnu/lib/clang/5.0.0 -isysroot
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc
-internal-isystem
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/include/c++/7.1.1
-internal-isystem
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/include/c++/7.1.1/aarch64-linux-gnu
-internal-isystem
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/include/c++/7.1.1/backward
-internal-isystem
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/local/include
-internal-isystem
/home/dantipov/.local/aarch64-linux-gnu/lib/clang/5.0.0/include
-internal-externc-isystem
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/include
-internal-externc-isystem
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/dantipov/llvm -ferror-limit 19
-fmessage-length 180 -fallow-half-arguments-and-returns -fno-signed-char
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/bug-7d9a84.o -x c++ bug.cc
clang -cc1 version 5.0.0 based upon LLVM 5.0.0svn-r307018 default target
aarch64--linux-gnu
ignoring nonexistent directory
"/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/local/include"
ignoring nonexistent directory
"/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/include"
#include "..." search starts here:
#include <...> search starts here:
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/include/c++/7.1.1
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/include/c++/7.1.1/aarch64-linux-gnu
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/include/c++/7.1.1/backward
/home/dantipov/.local/aarch64-linux-gnu/lib/clang/5.0.0/include
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include
End of search list.
bug.cc:32:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
"/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/bin/ld"
--sysroot=/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc -z
relro --hash-style=gnu --eh-frame-hdr -m aarch64linux -dynamic-linker
/lib/ld-linux-aarch64.so.1 -o a.out
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/lib/crt1.o
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/lib/crti.o
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/crtbegin.o
-L/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1
-L/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/lib/../lib64
-L/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/../../../../aarch64-linux-gnu/lib
-L/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/lib
-L/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/lib
/tmp/bug-7d9a84.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/home/dantipov/.local/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.1.1/crtend.o
/home/dantipov/.local/aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/lib/crtn.o
The problem was initially observed on clang from Android NDK r15, where the
compiler announces itself as 'Android clang version 5.0.300080 (based on LLVM
5.0.300080)'.
--
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/20170703/1f719aa1/attachment-0001.html>
More information about the llvm-bugs
mailing list