<html>
    <head>
      <base href="https://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 --- - replaceAllUsesWith asserts on initialized GS-relative global ptr"
   href="https://llvm.org/bugs/show_bug.cgi?id=27533">27533</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>replaceAllUsesWith asserts on initialized GS-relative global ptr
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aaronc@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This test program:

-------- x8 --------

unsigned int *x __attribute__((address_space(256))) = 0;

int main(int argc, char *argv[])
{
    *x = 42;
}

-------- x8 --------

triggers this assertion on r267628:

Assertion failed: (New->getType() == getType() && "replaceAllUses of value with
new value of different type!"), function replaceAllUsesWith, file
/Users/aaronc/dev/llvm.mainline/lib/IR/Value.cpp, line 375.
0  clang-3.9                0x000000010944691e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1  clang-3.9                0x0000000109446e49
PrintStackTraceSignalHandler(void*) + 25
2  clang-3.9                0x0000000109443339 llvm::sys::RunSignalHandlers() +
425
3  clang-3.9                0x00000001094473d2 SignalHandler(int) + 354
4  libsystem_platform.dylib 0x00007fff9279e52a _sigtramp + 26
5  clang-3.9                0x000000010d439bdc guard variable for
shouldAddRequirement(clang::Module*, llvm::StringRef, bool&)::IOKitAVC + 126748
6  clang-3.9                0x0000000109446e6b raise + 27
7  clang-3.9                0x0000000109446f12 abort + 18
8  clang-3.9                0x0000000109446efe __assert_rtn + 126
9  clang-3.9                0x0000000108cc845b
llvm::Value::replaceAllUsesWith(llvm::Value*) + 299
10 clang-3.9                0x0000000108ef0cc4 (anonymous
namespace)::AddressSanitizerModule::InstrumentGlobals(llvm::IRBuilder<llvm::ConstantFolder,
llvm::IRBuilderDefaultInserter>&, llvm::Module&) + 3060
11 clang-3.9                0x0000000108eefcb1 (anonymous
namespace)::AddressSanitizerModule::runOnModule(llvm::Module&) + 561
12 clang-3.9                0x0000000108c0264f (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 1967
13 clang-3.9                0x0000000108c01c26
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 342
14 clang-3.9                0x0000000108c032a1
llvm::legacy::PassManager::run(llvm::Module&) + 33
15 clang-3.9                0x0000000109736500 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_pwrite_stream*) + 3840
16 clang-3.9                0x0000000109734ad6
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) + 150
17 clang-3.9                0x0000000109a22ba1
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1473
18 clang-3.9                0x000000010aeeb5e4 clang::ParseAST(clang::Sema&,
bool, bool) + 1284
19 clang-3.9                0x0000000109f97e35
clang::ASTFrontendAction::ExecuteAction() + 485
20 clang-3.9                0x0000000109a21ced
clang::CodeGenAction::ExecuteAction() + 6125
21 clang-3.9                0x0000000109f96f00 clang::FrontendAction::Execute()
+ 112
22 clang-3.9                0x0000000109ee6d74
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1828
23 clang-3.9                0x000000010a02312d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4765
24 clang-3.9                0x0000000107153a66 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 4870
25 clang-3.9                0x0000000107144216
ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) + 470
26 clang-3.9                0x0000000107141744 main + 3524
27 libdyld.dylib            0x00007fff884fa5ad start + 1
28 libdyld.dylib            0x0000000000000033 start + 2008046215

Built with:
clang -Wall test.c -fsanitize=address 

The assertion does not trip if I remove the initializer.</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>