Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Complex Constant Zero Value Assignment Crashes Codegen #18585

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR18586
Status NEW
Importance P normal
Reported by John Leidel (jleidel@micron.com)
Reported on 2014-01-22 15:26:58 -0800
Last modified on 2014-01-22 15:26:58 -0800
Version 3.3
Hardware PC All
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments caxpy-60RjaU.c (50417 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 11921
preprocessed C

Setting a constant, complex variable to zero crashes/asserts the codegen.

#include <complex.h>

float complex caxpy_chop()
{
    const float complex zero=0.0f;

    return zero;
}

Using LLVM/Clang 3.3 [released].
$> clang -v
clang version 3.3
Target: x86_64-unknown-linux-gnu
Thread model: posix

CFLAGS: -O0 -Wall -pedantic -std=c99 -c

Trace:
clang: /scratch/REMOVED/tot//llvm/include/llvm/Support/Casting.h:237: typename
llvm::enable_if<llvm::is_same<Y, typename
llvm::simplify_type<From>::SimpleType>, typename llvm::cast_retty<X,
Y*>::ret_type>::type llvm::cast(Y*) [with X = llvm::ConstantStruct; Y =
llvm::Constant; typename llvm::enable_if<llvm::is_same<Y, typename
llvm::simplify_type<From>::SimpleType>, typename llvm::cast_retty<X,
Y*>::ret_type>::type = llvm::ConstantStruct*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.
0  clang           0x00000000020e2d22 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  clang           0x00000000020e29b1
2  libpthread.so.0 0x0000003c7820f710
3  libc.so.6       0x0000003c77e32925 gsignal + 53
4  libc.so.6       0x0000003c77e34105 abort + 373
5  libc.so.6       0x0000003c77e2ba4e
6  libc.so.6       0x0000003c77e2bb10 __assert_perror_fail + 0
7  clang           0x0000000000a0a779
8  clang           0x0000000000667767
9  clang           0x0000000000a09e8a
10 clang           0x0000000000a0a914
clang::CodeGen::CodeGenFunction::EmitComplexExprIntoLValue(clang::Expr const*,
clang::CodeGen::LValue, bool) + 84
11 clang           0x0000000000a76850
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) + 1664
12 clang           0x0000000000a76bac
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 396
13 clang           0x0000000000a7706f
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 79
14 clang           0x000000000093c78d
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&)
+ 93
15 clang           0x0000000000941169
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1257
16 clang           0x0000000000955c8c
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 572
17 clang           0x0000000000956ccc
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 460
18 clang           0x0000000000958cb4
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1492
19 clang           0x00000000009593d5
20 clang           0x0000000000930a4c
21 clang           0x00000000009300fc
22 clang           0x0000000000a95da6 clang::ParseAST(clang::Sema&, bool, bool)
+ 310
23 clang           0x000000000092edfc clang::CodeGenAction::ExecuteAction() + 60
24 clang           0x00000000007c3f89 clang::FrontendAction::Execute() + 249
25 clang           0x00000000007a55b5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 357
26 clang           0x000000000078eb05
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1765
27 clang           0x0000000000786648 cc1_main(char const**, char const**, char
const*, void*) + 1208
28 clang           0x000000000078c398 main + 2072
29 libc.so.6       0x0000003c77e1ed1d __libc_start_main + 253
30 clang           0x0000000000785415
Stack dump:
0.      Program arguments: /opt/REMOVED/llvm-3.3/bin/clang -cc1 -triple x86_64-
unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name caxpy.c -
mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -
mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.20.51.0.2 -coverage-file /home/REMOVED/bugs/tmp/caxpy.llvmbase -resource-dir
/opt/REMOVED/llvm-3.3/bin/../lib/clang/3.3 -internal-isystem /usr/local/include
-internal-isystem /opt/REMOVED/llvm-3.3/bin/../lib/clang/3.3/include -internal-
externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wall -
pedantic -std=c99 -fdebug-compilation-dir /home/REMOVED/bugs/tmp -ferror-limit
19 -fmessage-length 139 -mstackrealign -fobjc-runtime=gcc -fobjc-default-
synthesize-properties -fdiagnostics-show-option -fcolor-diagnostics -backend-
option -vectorize-loops -o caxpy.llvmbase -x c caxpy.c
1.      <eof> parser at end of file
2.      caxpy.c:5:15: LLVM IR generation of declaration 'caxpy_chop'
3.      caxpy.c:5:15: Generating code for declaration 'caxpy_chop'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (svn+ssh://REMOVED.REMOVED.com/svn/trunk/llvm/3.3/cfe-3.3.src
82)
Target: x86_64-unknown-linux-gnu
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: /tmp/caxpy-60RjaU.c
clang: note: diagnostic msg: /tmp/caxpy-60RjaU.sh
clang: note: diagnostic msg:
Quuxplusone commented 10 years ago

Attached caxpy-60RjaU.c (50417 bytes, application/octet-stream): preprocessed C