<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - clang fatal error using __declspec(allocator) with -O3 : "error in backend: invalid symbol redefinition""
   href="https://bugs.llvm.org/show_bug.cgi?id=43695">43695</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang fatal error using __declspec(allocator) with -O3 : "error in backend: invalid symbol redefinition"
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>sylvain.audi@ubisoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I discovered this bug with clang 9.0.0, under windows. It seems to be there in
trunk too.
Note that removing the _declspec(allocator), the expression in the alloc() call
parameter, or even the call to f2() will compile.


F:\>type test.cpp
__declspec(allocator) void *alloc(unsigned int size);

void f2();

void f1(unsigned int *size_ptr) {
    void *hg = alloc(size_ptr ? *size_ptr : 1UL);
    f2();
}

F:\>
F:\>
F:\>clang++.exe -cc1 -S -x86-asm-syntax=intel -debug-info-kind=limited
-fms-extensions -O3 -x c++ test.cpp

fatal error: error in backend: invalid symbol redefinition
Stack dump:
0.      Program arguments: clang++.exe -cc1 -S -x86-asm-syntax=intel
-debug-info-kind=limited -fms-extensions -O3 -x c++ test.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'test.cpp'.
4.      Running pass 'X86 Assembly Printer' on function '@"?f1@@YAXPEAI@Z"'</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>