<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 - Building alsa-tools-1.1.0 fails linkage due to inlining"
   href="https://bugs.llvm.org/show_bug.cgi?id=33768">33768</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Building alsa-tools-1.1.0 fails linkage due to inlining
          </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>Linux
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>moxian@protonmail.ch
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18785" name="attach_18785" title="as10k1-minified.c">attachment 18785</a> <a href="attachment.cgi?id=18785&action=edit" title="as10k1-minified.c">[details]</a></span>
as10k1-minified.c

When trying to compile alsa-tools-1.1.0 (source at
<a href="ftp://ftp.alsa-project.org/pub/tools/alsa-tools-1.1.0.tar.bz2">ftp://ftp.alsa-project.org/pub/tools/alsa-tools-1.1.0.tar.bz2</a>), clang fails
with the following log:


make[2]: Entering directory
'/home/moxian/work/alsa-tools/alsa-tools-1.1.0/as10k1'
clang-3.9 -DPACKAGE_NAME=\"as10k1.c\" -DPACKAGE_TARNAME=\"as10k1-c\"
-DPACKAGE_VERSION=\"A0.99\" -DPACKAGE_STRING=\"as10k1.c\ A0.99\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1
-DPACKAGE=\"as10k1-c\" -DVERSION=\"A0.99\" -I.    -fno-strict-aliasing -O2
-Wall -pipe -g -MT as10k1.o -MD -MP -MF .deps/as10k1.Tpo -c -o as10k1.o
as10k1.c
mv -f .deps/as10k1.Tpo .deps/as10k1.Po
clang-3.9 -DPACKAGE_NAME=\"as10k1.c\" -DPACKAGE_TARNAME=\"as10k1-c\"
-DPACKAGE_VERSION=\"A0.99\" -DPACKAGE_STRING=\"as10k1.c\ A0.99\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1
-DPACKAGE=\"as10k1-c\" -DVERSION=\"A0.99\" -I.    -fno-strict-aliasing -O2
-Wall -pipe -g -MT parse.o -MD -MP -MF .deps/parse.Tpo -c -o parse.o parse.c
mv -f .deps/parse.Tpo .deps/parse.Po
clang-3.9 -DPACKAGE_NAME=\"as10k1.c\" -DPACKAGE_TARNAME=\"as10k1-c\"
-DPACKAGE_VERSION=\"A0.99\" -DPACKAGE_STRING=\"as10k1.c\ A0.99\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1
-DPACKAGE=\"as10k1-c\" -DVERSION=\"A0.99\" -I.    -fno-strict-aliasing -O2
-Wall -pipe -g -MT assemble.o -MD -MP -MF .deps/assemble.Tpo -c -o assemble.o
assemble.c
mv -f .deps/assemble.Tpo .deps/assemble.Po
clang-3.9 -DPACKAGE_NAME=\"as10k1.c\" -DPACKAGE_TARNAME=\"as10k1-c\"
-DPACKAGE_VERSION=\"A0.99\" -DPACKAGE_STRING=\"as10k1.c\ A0.99\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1
-DPACKAGE=\"as10k1-c\" -DVERSION=\"A0.99\" -I.    -fno-strict-aliasing -O2
-Wall -pipe -g -MT macro.o -MD -MP -MF .deps/macro.Tpo -c -o macro.o macro.c
mv -f .deps/macro.Tpo .deps/macro.Po
clang-3.9 -fno-strict-aliasing -O2 -Wall -pipe -g   -o as10k1 as10k1.o parse.o
assemble.o macro.o  
as10k1.o: In function `header':
/home/moxian/work/alsa-tools/alsa-tools-1.1.0/as10k1/as10k1.c:524: undefined
reference to `output_tram_line'
/home/moxian/work/alsa-tools/alsa-tools-1.1.0/as10k1/as10k1.c:527: undefined
reference to `output_tram_line'
/home/moxian/work/alsa-tools/alsa-tools-1.1.0/as10k1/as10k1.c:539: undefined
reference to `output_tram_line'
/home/moxian/work/alsa-tools/alsa-tools-1.1.0/as10k1/as10k1.c:543: undefined
reference to `output_tram_line'
clang-3.9: error: linker command failed with exit code 1 (use -v to see
invocation)
make[2]: *** [Makefile:320: as10k1] Error 1


The problem seems to be that output_tram_line is declared as inline and is
elided, yet still has references to it.

Minified reproduction case attached (reproducible by simply running `clang
as10k1-minified.c`) . Trying to do *any* modifications to the output_tram_line
function make the code compile suddenly.

Reading <a href="http://llvm.org/docs/HowToSubmitABug.html">http://llvm.org/docs/HowToSubmitABug.html</a> I'm not sure what kind of
additional information is needed (as the compiler does not crash), but am happy
to provide any, if needed.

I can reproduce the bug with both clang-3.9 and with clang-5.0 from (a ~week
old) trunk.</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>