Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: scalar-to-vector conversion failed, possible invalid constraint for vector type #1420

Closed
DanAlbert opened this issue Jan 5, 2021 · 6 comments
Assignees
Projects

Comments

@DanAlbert
Copy link
Member

similar log:

/var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca/dither.c:1268:18: error: scalar-to-vector conversion failed, possible invalid constraint for vector type
    asm volatile("fldl2e\n\t"
                 ^
/var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca/dither.c:1277:18: error: scalar-to-vector conversion failed, possible invalid constraint for vector type
    asm volatile("fscale"
                 ^
/var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca/dither.c:1277:18: error: scalar-to-vector conversion failed, possible invalid constraint for vector type
Stack dump:
0.	Program arguments: /usr/local/Cellar/android-sdk/6609375/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -cc1 -triple x86_64-unknown-linux-android21 -emit-obj -mnoexecstack -disable-free -disable-llvm-verifier -discard-value-names -main-file-name dither.c -mrelocation-model pic -pic-level 2 -mthread-model posix -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-feature +sse4.2 -target-feature +popcnt -target-feature +cx16 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -target-linker-version 305 -momit-leaf-frame-pointer -coverage-notes-file /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/1609399549/x86_64/caca/.libs/libcaca_la-dither.gcno -resource-dir /usr/local/Cellar/android-sdk/6609375/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/9.0.8 -dependency-file .deps/libcaca_la-dither.Tpo -sys-header-deps -MP -MT libcaca_la-dither.lo -D HAVE_CONFIG_H -I . -I /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca -I .. -I /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne -D PLUGINDIR="" -D __LIBCACA__ -I /Users/leleliu008/.ndk-pkg/pkg/imlib2/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/libwebp/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/libtiff/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/libjpeg-turbo/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/giflib/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/freetype2/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/brotli/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/bzip2/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/libpng/x86_64/include -I /Users/leleliu008/.ndk-pkg/pkg/zlib/x86_64/include -D ftello=ftell -D fseeko=fseek -D X_DISPLAY_MISSING -D PIC -isysroot /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -internal-isystem /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/local/include -internal-isystem /usr/local/Cellar/android-sdk/6609375/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/9.0.8/include -internal-externc-isystem /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/x86_64-linux-android -internal-externc-isystem /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/include -internal-externc-isystem /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include -O2 -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -fdebug-compilation-dir /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/1609399549/x86_64/caca -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o .libs/libcaca_la-dither.o -x c /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca/dither.c
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca/dither.c'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@caca_set_dither_gamma'
0  clang                    0x00000001015d1f98 void std::__1::__call_once_proxy<std::__1::tuple<void (&)()> >(void*) + 452872
1  clang                    0x00000001015d0fd8 void std::__1::__call_once_proxy<std::__1::tuple<void (&)()> >(void*) + 448840
2  clang                    0x00000001015d25b9 void std::__1::__call_once_proxy<std::__1::tuple<void (&)()> >(void*) + 454441
3  libsystem_platform.dylib 0x00007fff67ee05fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338772511264
5  clang                    0x00000001020603cf llvm::Pass* llvm::callDefaultCtor<llvm::RegBankSelect>() + 782559
6  clang                    0x00000001020813bf llvm::Pass* llvm::callDefaultCtor<llvm::RegBankSelect>() + 917711
7  clang                    0x0000000102086555 llvm::Pass* llvm::callDefaultCtor<llvm::RegBankSelect>() + 938597
8  clang                    0x0000000102153546 llvm::Pass* llvm::callDefaultCtor<llvm::RegBankSelect>() + 1778262
9  clang                    0x000000010215307a llvm::Pass* llvm::callDefaultCtor<llvm::RegBankSelect>() + 1777034
10 clang                    0x0000000102150904 llvm::Pass* llvm::callDefaultCtor<llvm::RegBankSelect>() + 1766932
11 clang                    0x00000001007f9fbd void std::__1::__call_once_proxy<std::__1::tuple<void* (&)(llvm::PassRegistry&), std::__1::reference_wrapper<llvm::PassRegistry>&&> >(void*) + 1175661
12 clang                    0x0000000100d263fd llvm::Pass* llvm::callDefaultCtor<llvm::MachineDominatorTree>() + 92477
13 clang                    0x0000000100ff06e1 llvm::SymbolTableListTraits<llvm::BasicBlock>::toPtr(llvm::ValueSymbolTable&) + 249473
14 clang                    0x0000000100ff09e3 llvm::SymbolTableListTraits<llvm::BasicBlock>::toPtr(llvm::ValueSymbolTable&) + 250243
15 clang                    0x0000000100ff0fd4 llvm::SymbolTableListTraits<llvm::BasicBlock>::toPtr(llvm::ValueSymbolTable&) + 251764
16 clang                    0x00000001017a21cb void llvm::DomTreeBuilder::Calculate<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >(llvm::DominatorTreeBase<llvm::VPBlockBase, false>&) + 559739
17 clang                    0x00000001019e570a void llvm::DomTreeBuilder::Calculate<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >(llvm::DominatorTreeBase<llvm::VPBlockBase, false>&) + 2932666
18 clang                    0x0000000102934763 llvm::RawInstrProfReader<unsigned long long>::getCounter(unsigned long long) const + 72083
19 clang                    0x0000000101ca844a llvm::Registry<clang::PluginASTAction>::begin() + 16218
20 clang                    0x0000000101c46c30 void llvm::DomTreeBuilder::Calculate<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >(llvm::DominatorTreeBase<llvm::VPBlockBase, false>&) + 5428448
21 clang                    0x0000000101d26044 llvm::Registry<clang::PluginASTAction>::begin() + 531284
22 clang                    0x0000000100407259
23 clang                    0x0000000100404fd9
24 libdyld.dylib            0x00007fff67ce7cc9 start + 1
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
Target: x86_64-unknown-linux-android21
Thread model: posix
InstalledDir: /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin
clang: note: diagnostic msg: PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
clang: warning: optimization flag '-fno-strength-reduce' is not supported [-Wignored-optimization-argument]
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/dither-06efae.c
clang: note: diagnostic msg: /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/dither-06efae.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/leleliu008/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg:

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

environment =>

NDK version => 21.3.6528147

build machine =>
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H15

details are in bug_report_res.zip

to reproduce this issue please run the following commands in your terminal on Unix-ish system:

ndk-pkg update
ndk-pkg install libcaca -v

about ndk-pkg

Originally posted by @leleliu008 in #1377 (comment)

@pirama-arumuga-nainar
Copy link
Collaborator

From the crash report in bug_report_res.zip:

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [29779]

Two questions:

  1. Does the crash go away when error: scalar-to-vector conversion failed, possible invalid constraint for vector type is fixed? That might suggest that Clang is hitting an llvm_unreachable, which triggers a SIGILL in the MacOS clang.
  2. From basic google searches, the "Illegal Instruction: code 4" error can happen on older MacOS versions but you're on MacOs 10.15. Can you share the actual model of your device?

@DanAlbert DanAlbert added this to Awaiting triage in LLVM via automation Jan 6, 2021
@pirama-arumuga-nainar
Copy link
Collaborator

@leleliu008 in case you missed my previous reply. PTAL at my questions.

@leleliu008
Copy link

@pirama-arumuga-nainar

  1. I didn't try to fix this problem. Beacuse I don't know how to fix.
  2. I'm sorry I didn't quite catch what you said Can you share the actual model of your device? what would you like me to do?

image

@pirama-arumuga-nainar
Copy link
Collaborator

Never mind about this being a Mac specific issue. This crashes on Linux as well. Newer Clang versions report failure rather than a crash:

fatal error: error in backend: Cannot select: 0x53fd038: ch = store<(store 2 into %stack.1 + 8, align 8), trunc to i16> 
0x52fe5f8, 0x54585c0, 0x53f5108, undef:i64, /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca/dither.c:
1277 @[ /var/folders/jw/7vmz4m1970932zln9tb1whxr0000gn/T/tmp.AfBnEXne/caca/dither.c:476 ]

Clang tries to make progress even on invalid input (mainly to print additional diagnostics). It then crashes if the initial error causes an inconsistent internal state. IMO, fixing the error: scalar-to-vector conversion failed, possible invalid constraint for vector type should stop the crash.

@leleliu008
Copy link

@pirama-arumuga-nainar I got it. Thank you very much!

@pirama-arumuga-nainar
Copy link
Collaborator

(If the crash or backend error still happens after fixing the errors, please reopen).

@DanAlbert DanAlbert moved this from Awaiting triage to Prebuilts submitted in LLVM Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
LLVM
  
Prebuilts submitted
Development

No branches or pull requests

3 participants