<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 - Optimization bug compiling for ARM v7a (32-bit)"
   href="https://bugs.llvm.org/show_bug.cgi?id=44639">44639</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Optimization bug compiling for ARM v7a (32-bit)
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.0
          </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>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>brianp@dashlogic.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23048" name="attach_23048" title="Android Studio example project">attachment 23048</a> <a href="attachment.cgi?id=23048&action=edit" title="Android Studio example project">[details]</a></span>
Android Studio example project

My development environment is using Windows 10, Android Studio v3.5.3, Android
NDK v20.0.5594570, with Clang v8.0.7. This bug appears to only happen when
targeting armeabi-v7a for 32-bit Android, and not for arm64-v8a or any x86
variant.

While working with the pixman graphics library compiling for Android, we've
found a bug when optimizations are turned off using #pragma optimize off during
a release variant build of the app. The exact error message is:

[armeabi-v7a] Compile arm    : myappnative <= android.c
fatal error: error in backend: symbol '.LPC5_0' can not be undefined in a
subtraction expression

I've pulled some snippets of source out of the pixman library into an example
project that reproduces this error (attached).

In the attached example project, in the file android.c, the error happens on
line 144 and line 174, as follows (line 144 shown):

src_flags = narrow | op_flags[op].src;

If replaced with src_flags = 0, the error goes away. The error also gets
resolved if #pragma optimize is removed, or if compiled as a debug build.

I don't understand the LLVM/Clang code well enough to know for sure, but in
researching this bug I came across the following possibly related bugs:
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - clang/llvm generates undefined symbol"
   href="show_bug.cgi?id=7334">https://bugs.llvm.org/show_bug.cgi?id=7334</a>
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Undefined symbol '__ZNSbIcED1Ev' when using extern templates and -fvisibility-hidden"
   href="show_bug.cgi?id=7353">https://bugs.llvm.org/show_bug.cgi?id=7353</a>
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Symbol alias can not be undefined in a subtraction expression"
   href="show_bug.cgi?id=10992">https://bugs.llvm.org/show_bug.cgi?id=10992</a></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>