Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

asm volatile causes "Assertion `ConstraintID != InlineAsm::Constraint_Unknown" #43551

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR44581
Status NEW
Importance P enhancement
Reported by Alan Hayward (alan.hayward@arm.com)
Reported on 2020-01-17 07:57:16 -0800
Last modified on 2020-01-21 03:47:56 -0800
Version trunk
Hardware PC All
CC arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
Fixed by commit(s)
Attachments flag.diff (1092 bytes, text/plain)
compileBroker-123210.sh (9219 bytes, text/x-sh)
compileBroker-123210.sh (9219 bytes, text/x-sh)
volatile-f5dca4.cpp (95 bytes, text/plain)
volatile-f5dca4.sh (2568 bytes, text/x-sh)
Blocks
Blocked by
See also
Created attachment 23024
cflag changes for openJDK

Using this build:
http://lab.llvm.org:8011/builders/clang-aarch64-linux-build-cache/builds/21031
On Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-45-generic aarch64)

Building OpenJDK recent HEAD (Fri Jan 17 16:17:22 2020 +0100) from
http://hg.openjdk.java.net/jdk/jdk

Firstly, I needed to add extra Cflags to prevent new warnings. See the attached
flag.diff

I then configure and built with:
JAVA_HOME=/usr/java/jdk-12.0.1+12/ CC=clang CXX=clang++ bash ../../configure --
with-toolchain-type=clang --with-debug-level=release; make images JOBS=55

The following error occurs part way through the build.

clang++: /home/buildslave/buildslave/clang-aarch64-linux-build-
cache/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8383: void
llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite): Assertion
`ConstraintID != InlineAsm::Constraint_Unknown && "Failed to convert memory
constraint code to constraint id."' failed.
Stack dump:
0.  Program arguments: /home/alahay01/llvm/clang-2020-01-17_14-50-39-
b21031/bin//clang++ -MMD -MF /home/alahay01/work/jdkHEAD/build/clang10-
release/hotspot/variant-server/libjvm/objs/compileBroker.d -include-pch
/home/alahay01/work/jdkHEAD/build/clang10-release/hotspot/variant-
server/libjvm/objs/precompiled/precompiled.hpp.pch -D__STDC_FORMAT_MACROS -
D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -pipe -fno-rtti -
fno-exceptions -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer
-flimit-debug-info -mno-omit-leaf-frame-pointer -mstack-alignment=16 -mllvm -
inlinehint-threshold=100000 -DSUPPORTS_CLOCK_MONOTONIC -DLINUX -Wall -Wextra -
Wformat=2 -Wpointer-arith -Wsign-compare -Wreorder -Wunused-function -Wundef -
Wunused-value -Woverloaded-virtual -fPIC -fmacro-prefix-map=/= -
DVM_LITTLE_ENDIAN -D_LP64=1 -DPRODUCT -DTARGET_ARCH_aarch64 -
DINCLUDE_SUFFIX_OS=_linux -DINCLUDE_SUFFIX_CPU=_aarch64 -
DINCLUDE_SUFFIX_COMPILER=_gcc -DTARGET_COMPILER_gcc -DAARCH64 -
DHOTSPOT_LIB_ARCH="aarch64" -DCOMPILER1 -DCOMPILER2 -DDTRACE_ENABLED -
I/home/alahay01/work/jdkHEAD/build/clang10-release/hotspot/variant-
server/gensrc/adfiles -I/home/alahay01/work/jdkHEAD/src/hotspot/share -
I/home/alahay01/work/jdkHEAD/src/hotspot/os/linux -
I/home/alahay01/work/jdkHEAD/src/hotspot/os/posix -
I/home/alahay01/work/jdkHEAD/src/hotspot/cpu/aarch64 -
I/home/alahay01/work/jdkHEAD/src/hotspot/os_cpu/linux_aarch64 -
I/home/alahay01/work/jdkHEAD/build/clang10-release/hotspot/variant-
server/gensrc -I/home/alahay01/work/jdkHEAD/src/hotspot/share/precompiled -
I/home/alahay01/work/jdkHEAD/src/hotspot/share/include -
I/home/alahay01/work/jdkHEAD/src/hotspot/os/posix/include -
I/home/alahay01/work/jdkHEAD/build/clang10-
release/support/modules_include/java.base -
I/home/alahay01/work/jdkHEAD/build/clang10-
release/support/modules_include/java.base/linux -
I/home/alahay01/work/jdkHEAD/src/java.base/share/native/libjimage -g -Wno-
unknown-warning-option -Wno-unused-parameter -Wno-unused -Wno-tautological-
compare -Wno-undefined-var-template -Wno-sometimes-uninitialized -Wno-unknown-
pragmas -Wno-delete-non-virtual-dtor -Wno-missing-braces -Wno-char-subscripts -
Wno-ignored-qualifiers -Wno-missing-field-initializers -Wno-mismatched-tags -
Werror -O3 -Wno-deprecated-copy -Wno-misleading-indentation -Wno-string-compare
-Wno-sizeof-array-div -c -o /home/alahay01/work/jdkHEAD/build/clang10-
release/hotspot/variant-server/libjvm/objs/compileBroker.o
/home/alahay01/work/jdkHEAD/src/hotspot/share/compiler/compileBroker.cpp
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module
'/home/alahay01/work/jdkHEAD/src/hotspot/share/compiler/compileBroker.cpp'.
4.  Running pass 'AArch64 Instruction Selection' on function
'@_ZN13CompileBroker25invoke_compiler_on_methodEP11CompileTask'
Compiling 3 files for BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR
#0 0x00000000019e9cec PrintStackTraceSignalHandler(void*)
(/home/alahay01/llvm/clang-2020-01-17_14-50-39-b21031/bin//clang+++0x19e9cec)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (/home/buildslave/buildslave/clang-aarch64-linux-build-
cache/llvm/clang 8eb4d25a0943bce6e8a4859825dce4f67a4f6384)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/alahay01/llvm/clang-2020-01-17_14-50-39-b21031/bin
clang-11: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-11: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/compileBroker-123210.cpp
clang-11: note: diagnostic msg: /tmp/compileBroker-123210.sh
clang-11: note: diagnostic msg:

********************

Running the newly created script reproduced the error.
Quuxplusone commented 4 years ago

CPP file is too big to attach. Finding a way to work around.

Quuxplusone commented 4 years ago

the produced cpp file is 274001 lines / 11M. I'll try and reduce this down a little and update next week.

Quuxplusone commented 4 years ago
Ok, I've reduced this down to a single line!

$ cat volatile.cpp
void func() { __asm__ __volatile__ ("\n" :: "nop" ("")); }

$ /home/alahay01/llvm/clang-2020-01-17_14-50-39-b21031/bin/clang-11 -c
volatile.cpp
clang-11: /home/buildslave/buildslave/clang-aarch64-linux-build-
cache/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8383: void
llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite): Assertion
`ConstraintID != InlineAsm::Constraint_Unknown && "Failed to convert memory
constraint code to constraint id."' failed.
Stack dump:
0.  Program arguments: /home/alahay01/llvm/clang-2020-01-17_14-50-39-
b21031/bin/clang-11 -c volatile.cpp
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module 'volatile.cpp'.
4.  Running pass 'AArch64 Instruction Selection' on function '@_Z4funcv'
#0 0x00000000019e9cec PrintStackTraceSignalHandler(void*)
(/home/alahay01/llvm/clang-2020-01-17_14-50-39-b21031/bin/clang-11+0x19e9cec)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (/home/buildslave/buildslave/clang-aarch64-linux-build-
cache/llvm/clang 8eb4d25a0943bce6e8a4859825dce4f67a4f6384)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/alahay01/llvm/clang-2020-01-17_14-50-39-b21031/bin
clang-11: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-11: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/volatile-f5dca4.cpp
clang-11: note: diagnostic msg: /tmp/volatile-f5dca4.sh
clang-11: note: diagnostic msg:

********************
LLVM ERROR: out of memory
Aborted
Quuxplusone commented 4 years ago

Attached flag.diff (1092 bytes, text/plain): cflag changes for openJDK

Quuxplusone commented 4 years ago

Attached compileBroker-123210.sh (9219 bytes, text/x-sh): sh file created by llvm

Quuxplusone commented 4 years ago

Attached compileBroker-123210.sh (9219 bytes, text/x-sh): file created by llvm

Quuxplusone commented 4 years ago

Attached volatile-f5dca4.cpp (95 bytes, text/plain): C file created by crash report

Quuxplusone commented 4 years ago

Attached volatile-f5dca4.sh (2568 bytes, text/x-sh): sh file created by crash report

Quuxplusone commented 4 years ago
Note that the attached failure isn't useful (or possibly correct) C code.

The code is a heavy reduction of the code created when using the STAP_PROBE
macros found in /usr/include/aarch64-linux-gnu/sys/sdt.h. These macros create a
large block of asm volatile code. When used they create exactly the same error
as my 1 line attached file.

An alternative, more real-world way of producing the same error is by simply
using:

#include <sys/sdt.h>
void func() { STAP_PROBE1("a","b","c"); };