<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - __attribute__((address_space)) doesn't work with atomic builtins"
   href="http://llvm.org/bugs/show_bug.cgi?id=21643">21643</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__attribute__((address_space)) doesn't work with atomic builtins
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>admin@chys.info
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.6: note: diagnostic msg: 
********************</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>