<div dir="ltr"><div>The .s does have a way to carry the location. GCC emits location lines around inline asm, like this:</div><div><div><div>#APP</div><div># 3 "/tmp/test-asm.c" 1</div><div>        cmp %ax, %ax</div><div># 0 "" 2</div><div><div>#NO_APP</div></div></div></div><div><br></div><div>Clang doesn't do that. Clang emits for the same code:</div><div><div>        #APP</div><div>        cmpw    %ax, %ax</div><div>        #NO_APP</div></div><div><br></div><div>Emitting location directives that seems like it's really a separate patch, IMO.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 25, 2016 at 10:29 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> That's not the case that I'm concerned about.<br>
><br>
> Let's say it's an expression (TEST1 - TEST0 - 4) for which we don't know should cause an error until we generate an object. With this we will to output this to the file without checking. If it's a problem, we will absolutely error when we attempt to generate an object but we've lost the original location of the error and we'll instead get the location from the new file which we do not gaurantee to be the same.<br>
<br>
</span>For the sake of argument lets say it is clang creating that expression.<br>
<br>
If someone is running "clang -S test.c && clang -c test.s" we will<br>
report an error in the .s. There is no way around it: the .s doesn't<br>
have a way to cary the location for use in the error message.<br>
<br>
If someone is running "clang -c test.c" we will not use the asm streamer.<br>
<span class=""><br>
> This breaks the property that generating an assembly and then making an object file has the same output as just generating the object file directly.<br>
<br>
</span>If there is no error, that property is not broken.<br>
If there is an error, that property doesn't exist already. It is<br>
perfectly possible to create a .s that will not assemble.<br>
<br>
If there is the desire to change that, what I think should happen is<br>
for -S to create and discard an object file in memory. Without<br>
creating an actual assembler we will never know for sure if a .s can<br>
or cannot be assembled, but that is independent from this change.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div>