<html>
    <head>
      <base href="https://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 --- - Negative line number on 'expected relocation error'"
   href="https://llvm.org/bugs/show_bug.cgi?id=30817">30817</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Negative line number on 'expected relocation error'
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.9
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pmatos@linki.tools
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>test.S:

.4byte ~foo
#include "foo.h"

foo.h: is an empty file. 

Then run:
$ clang -cc1as -filetype obj -main-file-name test.S -dwarf-version=4
-fdebug-compilation-dir /home/pmatos/Clients/embecosm/BUGS/b447/asm-lineno
-mrelocation-model static -dwarf-version=4 -o test.o test.s
test.S:-2:8: error: expected relocatable expression
.4byte ~foo
       ^

I very much doubt there's a line -2 in the file.

However, I know what the problem is. At this point the parsing of the asm has
finished. However the error handler calls DiagHandler which assumes the parsing
is ongoing and uses CppHashLoc variables. These variable are however of no more
use because they all now point to the last Hash line seen in the file, not the
one before the error.

I will submit a patch to fix this soon.</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>