<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 - OpenMP/declare_reduction_codegen.cpp, OpenMP/parallel_copyin_codegen.cpp fail on targets that have no TLS"
   href="https://bugs.llvm.org/show_bug.cgi?id=40156">40156</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>OpenMP/declare_reduction_codegen.cpp, OpenMP/parallel_copyin_codegen.cpp fail on targets that have no TLS
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>OpenMP
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When LLVM_DEFAULT_TARGET_TRIPLE is set to a target that doesn't support TLS
(for example x86_64-apple-darwin instead of x86_64-apple-darwin16.7.0), then
OpenMP/declare_reduction_codegen.cpp and OpenMP/parallel_copyin_codegen.cpp
fail.

They check for the presence of 

; Function Attrs: noinline
define internal void @__cxx_global_var_init() #6 section
"__TEXT,__StaticInit,regular,pure_instructions" {
entry:
  call void @_ZN3SSSIiEC1Ev(%struct.SSS* @d)
  ret void
}

; Function Attrs: noinline nounwind optnone
define linkonce_odr void @_ZN3SSSIiEC1Ev(%struct.SSS* %this) unnamed_addr #0
align 2 {
entry:
  %this.addr = alloca %struct.SSS*, align 4
  store %struct.SSS* %this, %struct.SSS** %this.addr, align 4
  %this1 = load %struct.SSS*, %struct.SSS** %this.addr, align 4
  call void @_ZN3SSSIiEC2Ev(%struct.SSS* %this1)
  ret void
}


in this order, but without TLS these pieces get emitted a lot later, in
different order, and with a lot of code in between.



VarDecl::getTLSKind() contains

    if (!hasAttr<ThreadAttr>() &&
        !(getASTContext().getLangOpts().OpenMPUseTLS &&
          getASTContext().getTargetInfo().isTLSSupported() &&
          hasAttr<OMPThreadPrivateDeclAttr>()))
      return TLS_None;

and the two tests don't pass -fnoopenmp-use-tls. The probably should, to make
sure the expectations are independent of the default target triple.</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>