<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 --- - Inline asm with constraint 'i' fails with --fsanitize=undefined"
   href="http://llvm.org/bugs/show_bug.cgi?id=19763">19763</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inline asm with constraint 'i' fails with --fsanitize=undefined
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>kdev@fishzet.co.uk
          </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>Created <span class=""><a href="attachment.cgi?id=12517" name="attach_12517" title="Preprocessed source code from Libav which triggers the bug (3x)">attachment 12517</a> <a href="attachment.cgi?id=12517&action=edit" title="Preprocessed source code from Libav which triggers the bug (3x)">[details]</a></span>
Preprocessed source code from Libav which triggers the bug (3x)

% cat min.i
fn1() { __asm__("" ::"r"(0), "i"(0 * 0)); }

% clang -fsanitize=undefined -c -o obj.o min.i 2>&1 | grep -A 2 error
dsputil_mmx.i:1:17: error: invalid operand for inline asm constraint 'i'
fn1() { __asm__("" ::"r"(0), "i"(0 * 0)); }

Without -fsanitize=undefined, the above code compiles. The above code is
generated with creduce from the attached file (dsputil_mmx.i) and the following
creduce script:

% cat <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - x86fastcc and allocas cause stange crashes"
   href="show_bug.cgi?id=683">bug683</a>libav.sh 
#!/bin/bash
rm -f out.txt *.o
ulimit -t 1

if
    clang -c -o good.o dsputil_mmx.i &&\
    ! clang -fsanitize=undefined -c -o no.o dsputil_mmx.i > out.txt 2>&1 &&\
    grep "invalid operand for inline asm constraint" out.txt
then exit 0
else exit 1
fi

References:
<a href="https://bugzilla.libav.org/show_bug.cgi?id=683">https://bugzilla.libav.org/show_bug.cgi?id=683</a> (the original Libav bug)
<a href="http://git.videolan.org/?p=ffmpeg.git;a=blobdiff;f=libavcodec/x86/dsputil_mmx.c;h=86100ba6ff86e9c6791364b3b4b00be1fea03b41;hp=c574458a20639d90567627e99d105bd20d5d570f;hb=bebce653e5601ceafa004db0eb6b2c7d4d16f0c0;hpb=d1310c591eb24202ecc28af4adb28cce690109e5">http://git.videolan.org/?p=ffmpeg.git;a=blobdiff;f=libavcodec/x86/dsputil_mmx.c;h=86100ba6ff86e9c6791364b3b4b00be1fea03b41;hp=c574458a20639d90567627e99d105bd20d5d570f;hb=bebce653e5601ceafa004db0eb6b2c7d4d16f0c0;hpb=d1310c591eb24202ecc28af4adb28cce690109e5</a>
(the FFmpeg workaround).

% clang --version
Ubuntu clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5)
Target: x86_64-pc-linux-gnu
Thread model: posix</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>