Bug 10850 - .lflags wrong end of line detection
Summary: .lflags wrong end of line detection
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-26 17:22 UTC by Benjamin Lesage
Modified: 2009-10-27 07:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Lesage 2009-10-26 17:22:06 UTC
Upon a .lflags in the .s file, the function listing_flags in gas/listing.c (http://sourceware.org/cgi-
bin/cvsweb.cgi/src/gas/listing.c?cvsroot=src) does not detect correctly the end of line:
void
listing_flags (int ignore ATTRIBUTE_UNUSED)
{
  while ((*input_line_pointer++) && (*input_line_pointer != '\n'))
    input_line_pointer++;

}

a correct version should be:
void
listing_flags (int ignore ATTRIBUTE_UNUSED)
{
  while ((*input_line_pointer) && (*input_line_pointer != '\n'))
    input_line_pointer++;
 input_line_pointer++;
}

The actual problem is that the input_line_pointer is increased twice, possibly missing the end of line 
character. So the directive skipping (normal behavior for the .lflags) might alter other instructions as it 
will have to "find" a '\n' somewhere else.
Comment 1 Sourceware Commits 2009-10-26 23:57:57 UTC
Subject: Bug 10850

CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2009-10-26 23:57:43

Modified files:
	gas            : ChangeLog listing.c listing.h read.c 

Log message:
	PR gas/10850
	* listing.c (listing_flags): Delete.
	* listing.h: Likewise.
	* read.c (potable <lflags>): Call s_ignore.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.3997&r2=1.3998
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/listing.c.diff?cvsroot=src&r1=1.43&r2=1.44
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/listing.h.diff?cvsroot=src&r1=1.8&r2=1.9
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/read.c.diff?cvsroot=src&r1=1.158&r2=1.159

Comment 2 Alan Modra 2009-10-27 00:00:15 UTC
Fixed.
Comment 3 Benjamin Lesage 2009-10-27 07:52:41 UTC
Thank you gentleman.