[LLVMbugs] [Bug 21643] New: __attribute__((address_space)) doesn't work with atomic builtins

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Nov 22 01:43:04 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21643

            Bug ID: 21643
           Summary: __attribute__((address_space)) doesn't work with
                    atomic builtins
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: admin at chys.info
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Test case:

void foo() {
        typedef int __attribute__((address_space(257))) *ptr_fs_t;
        __atomic_or_fetch((ptr_fs_t)0x308, 1, __ATOMIC_RELAXED);
}


Expected result:

        lock
        orl     $1, %fs:776
        retq


Actual result 1 (clang 3.5.0):

        lock
        orl     $1, 776
        retq


Actual result 2 (trunk version):

clang-3.6: /home/x/prog/P/llvm/lib/IR/Constants.cpp:1556: static llvm::Constant
*llvm::ConstantExpr::getCast(unsigned int, llvm::Constant *, llvm::Type *,
bool): Assertion `CastInst::castIsValid(opc, C, Ty) && "Invalid constantexpr
cast!"' failed.
#0 0x1431ce8 llvm::sys::PrintStackTrace(_IO_FILE*)
(/usr/local/llvm-svn/bin/clang-3.6+0x1431ce8)
#1 0x143339b SignalHandler(int) (/usr/local/llvm-svn/bin/clang-3.6+0x143339b)
#2 0x7f79065994e0 (/lib64/libpthread.so.0+0x104e0)
#3 0x7f7905a065d7 gsignal (/lib64/libc.so.6+0x385d7)
#4 0x7f7905a078f8 abort (/lib64/libc.so.6+0x398f8)
#5 0x7f79059ff706 (/lib64/libc.so.6+0x31706)
#6 0x7f79059ff7b2 (/lib64/libc.so.6+0x317b2)
#7 0x10a1a94 (/usr/local/llvm-svn/bin/clang-3.6+0x10a1a94)
#8 0x1a2b992
clang::CodeGen::CodeGenFunction::EmitAtomicExpr(clang::AtomicExpr*,
llvm::Value*) (/usr/local/llvm-svn/bin/clang-3.6+0x1a2b992)
#9 0x19c887e clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
(/usr/local/llvm-svn/bin/clang-3.6+0x19c887e)
#10 0x19be6a3 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr
const*, bool) (/usr/local/llvm-svn/bin/clang-3.6+0x19be6a3)
#11 0x1991439 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool)
(/usr/local/llvm-svn/bin/clang-3.6+0x1991439)
#12 0x1894c41 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*)
(/usr/local/llvm-svn/bin/clang-3.6+0x1894c41)
#13 0x189dd4b
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/local/llvm-svn/bin/clang-3.6+0x189dd4b)
#14 0x18b1817
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/usr/local/llvm-svn/bin/clang-3.6+0x18b1817)
#15 0x18b1ebd clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/local/llvm-svn/bin/clang-3.6+0x18b1ebd)
#16 0x18c0fcf
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/llvm-svn/bin/clang-3.6+0x18c0fcf)
#17 0x18bdd8f
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/llvm-svn/bin/clang-3.6+0x18bdd8f)
#18 0x18c29e1 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/usr/local/llvm-svn/bin/clang-3.6+0x18c29e1)
#19 0x1860fff (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/llvm-svn/bin/clang-3.6+0x1860fff)
#20 0x1858227 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/llvm-svn/bin/clang-3.6+0x1858227)
#21 0x1e1e1d3 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/llvm-svn/bin/clang-3.6+0x1e1e1d3)
#22 0x15d3a5e clang::FrontendAction::Execute()
(/usr/local/llvm-svn/bin/clang-3.6+0x15d3a5e)
#23 0x15a4c9c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/llvm-svn/bin/clang-3.6+0x15a4c9c)
#24 0x165a9d2 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/llvm-svn/bin/clang-3.6+0x165a9d2)
#25 0x6c74fe cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/local/llvm-svn/bin/clang-3.6+0x6c74fe)
#26 0x6c5f05 main (/usr/local/llvm-svn/bin/clang-3.6+0x6c5f05)
#27 0x7f79059f2dc5 __libc_start_main (/lib64/libc.so.6+0x24dc5)
#28 0x6c2cdd _start (/usr/local/llvm-svn/bin/clang-3.6+0x6c2cdd)
Stack dump:
0.      Program arguments: /usr/local/llvm-svn/bin/clang-3.6 -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name a.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -coverage-file /tmp/a.c
-resource-dir /usr/local/llvm-svn/bin/../lib/clang/3.6.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/llvm-svn/bin/../lib/clang/3.6.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir
/tmp -ferror-limit 19 -fmessage-length 230 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o a.s -x c a.c 
1.      a.c:7:1: current parser token 'int'
2.      a.c:3:6: LLVM IR generation of declaration 'foo'
3.      a.c:3:6: Generating code for declaration 'foo'
clang-3.6: error: unable to execute command: Aborted
clang-3.6: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0 
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-3.6: 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-3.6: note: diagnostic msg: 
********************

-- 
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/20141122/c18cce36/attachment.html>


More information about the llvm-bugs mailing list