This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: output # <srcline> between #APP and #NO_APP, for asm statements


On Mar  5, 2007, Mark Mitchell <mark@codesourcery.com> wrote:

> Alexandre Oliva wrote:
>> - There's no currently way to tell the assembler to return to whatever
>> logical line number it had before we switch to an "included" file.
>> I've adopted '# 0 "" 2' to convey this information, but current
>> assemblers don't implement this.  

> I don't think there's any point in emitting the magic comment until we
> have an assembler that understands that syntax.

GAS already understands the line number syntax already.  It just
doesn't assign to this particular case the special meaning I proposed.
My plan was add support for this particular case in GAS as soon as I
got buy-in from GCC for the general approach.

> Please remove that.

Removing that means also removing the trailing " 1" from the initial #
line, and adding it back one or two days later when the assembler
support is in place.  Is there really any point in suggesting this
change?  Maybe if I promise that the assembler patch isn't accepted in
say one week, I'll take this out right away?

> So, IIUC, the tradeoff with your patch is that we'll get good error
> messages about the user's inline assembly (with proper location
> information), but, then, bad information if there's an error in the
> compiler-generated assembly after that point?  Is that correct?

In the absence of imminent support in the assembler, yes.

> That's a tough tradeoff.  I'd love to see errors in inline assembly from
> headers correctly highlighted, since many users think that errors from
> the assembler indicate compiler bugs.  However, your change runs the
> risk that we'll make compiler bugs (which do occur) look even more
> confusing by pointing at random lines in system header files.

With the patch I posted, they won't post at random lines in system
header files, but rather at random lines in nameless files.  If the
assembler is too old.

> If I'm understanding this correctly, I think we really ought to solve it
> correctly, by adding a pop-line directive to GAS, and then using it.

That's exactly the plan, and that's exactly what the '# 0 ""'
construct means in my proposal.  Not using a syntax that older
assemblers can swallow would mean having to test for it at compile
time, which makes little sense for such a corner case situation,
methinks.

> I'd be fine with saying that you get the compiler-bug-masking behavior
> if you don't use an up-to-date GAS, but I'd be nervous about not doing
> anything to protect users from that situation.

I'm not sure what you mean here.  Do you have any other kind of
protection in mind?  If assembly fails, we could always re-run the
assembler after stripping off # <line> lines, such that you'd then get
error numbers for the temporary asm file, but this sounds excessive,
considering that the temporary asm file is probably going to be
removed right away anyway.

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]