Got a nasty problem: camellia.cpp crashes llvm compiler.

I've submitted a bug report to llvm.com/bugs
http://llvm.org/bugs/show_bug.cgi?id=21194, and they answered that llvm
performs exactly as expected, and the problem is with the camellia code:

The user code is incorrect, clang already has the diagnosis. You must pass
integer constants to assembly with the "i" constraint. You cannot thread
one through an always_inline function. This is a well-known compatibility
issue. You have to use a macro. Sorry. :(

...................

Justin and I discussed this.

Like Reid said, the assertion in LLVM is a fallout from the new diagnostic
handler, but the errors reported are legit.

If it worked previously, this is likely by accident... Sorry.

To fix the compiler assertion, we would likely need to teach the pass
manager the notion of a failure in a pass, so that it can stop the
compilation process, since the MIR is not in the expected shape.
Previously, the error reporting was aborting directly so we were not seeing
that, but we would have get just the first error.


Here's what the compiler says:

clang++ -DNDEBUG -g -O2 -std=c++11 -ansi -maes -mpclmul -fPIC
-ffunction-sections -fdata-sections -m64 -arch x86_64
-DCRYPTOPP_DISABLE_ASM -Wno-tautological-compare -c camellia.cpp

In file included from camellia.cpp:16:

./cpu.h:34:64: warning: unknown attribute '__artificial__' ignored

      [-Wattributes]

__inline int __attribute__((__gnu_inline__, __always_inline__,
__artificial__))

                                                               ^

./cpu.h:41:68: warning: unknown attribute '__artificial__' ignored

      [-Wattributes]

__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __art...

                                                                   ^

./cpu.h:38:7: error: invalid operand for inline asm constraint 'i'

        asm ("pextrd %2, %1, %0" : "=rm"(r) : "x"(a), "i"(i));

             ^

./cpu.h:44:7: error: invalid operand for inline asm constraint 'i'

        asm ("pinsrd %2, %1, %0" : "+x"(a) : "rm"(b), "i"(i));

             ^

Assertion failed: (MRI->getVRegDef(reg) && "Register use before def!"),
function HandleVirtRegUse, file LiveVariables.cpp, line 133.

0  libLLVM-3.4.dylib        0x000000010b4938e9
llvm::sys::PrintStackTrace(__sFILE*) + 40

1  libLLVM-3.4.dylib        0x000000010b493cd9 SignalHandler(int) + 248

2  libsystem_platform.dylib 0x00007fff89cb25aa _sigtramp + 26

3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1983175280

4  libLLVM-3.4.dylib        0x000000010b493b40 abort + 22

5  libLLVM-3.4.dylib        0x000000010b493b2a abort + 0

6  libLLVM-3.4.dylib        0x000000010ade57f9
llvm::LiveVariables::HandleVirtRegUse(unsigned int,
llvm::MachineBasicBlock*, llvm::MachineInstr*) + 363

7  libLLVM-3.4.dylib        0x000000010ade708b
llvm::LiveVariables::runOnMachineFunction(llvm::MachineFunction&) + 1339

8  libLLVM-3.4.dylib        0x000000010ae06b60
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 48

9  libLLVM-3.4.dylib        0x000000010af68239
llvm::FPPassManager::runOnFunction(llvm::Function&) + 297

10 libLLVM-3.4.dylib        0x000000010af683d1
llvm::FPPassManager::runOnModule(llvm::Module&) + 41

11 libLLVM-3.4.dylib        0x000000010af68728
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 648

12 clang                    0x000000010980b7f4
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 5034

13 clang                    0x00000001098e17b0
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 422

14 clang                    0x00000001099248c7
clang::ParseAST(clang::Sema&, bool, bool) + 348

15 clang                    0x00000001098e0ec0
clang::CodeGenAction::ExecuteAction() + 484

16 clang                    0x000000010970c79b
clang::FrontendAction::Execute() + 103

17 clang                    0x00000001096efdcf
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 571

18 clang                    0x00000001096c6629
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3861

19 clang                    0x00000001096c017a cc1_main(char const**, char
const**, char const*, void*) + 794

20 clang                    0x00000001096c4c2d main + 6504

21 libdyld.dylib            0x00007fff937155fd start + 1

22 libdyld.dylib            0x000000000000003e start + 1821289026

Stack dump:

0. Program arguments: /opt/local/libexec/llvm-3.4/bin/clang -cc1 -triple
x86_64-apple-macosx10.9.0 -emit-obj -disable-free -main-file-name
camellia.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -target-feature +aes
-target-feature +pclmul -target-linker-version 236.3 -gdwarf-2
-ffunction-sections -fdata-sections -coverage-file
/Users/ur20980/src/cryptopp-5.6.2-clang/camellia.o -resource-dir
/opt/local/libexec/llvm-3.4/bin/../lib/clang/3.4.2 -D NDEBUG -D
CRYPTOPP_DISABLE_ASM -stdlib=libc++ -O2 -Wno-tautological-compare
-std=c++98 -fdeprecated-macro -fdebug-compilation-dir
/Users/ur20980/src/cryptopp-5.6.2-clang -ferror-limit 19 -fmessage-length
80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0
-fencode-extended-block-signature -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops
-vectorize-slp -o camellia.o -x c++ camellia.cpp

1. <eof> parser at end of file

2. Code generation

3. Running pass 'Function Pass Manager' on module 'camellia.cpp'.

4. Running pass 'Live Variable Analysis' on function
'@_Z16_mm_insert_epi32Dv2_xii'

clang: error: unable to execute command: Illegal instruction: 4

clang: error: clang frontend command failed due to signal (use -v to see
invocation)

clang version 3.4.2 (tags/RELEASE_34/dot2-final)

Target: x86_64-apple-darwin13.4.0

Thread model: posix

clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source,
and associated run script.

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/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/camellia-20466f.cpp

clang: note: diagnostic msg:
/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/camellia-20466f.sh

clang: note: diagnostic msg:


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

make: *** [camellia.o] Error 254


A solution to this problem/bug would be nice!  According to LLVM people,
those inline functions should be changed to macros...?
  --
Regards,
Mouse

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to