From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5563 invoked by alias); 18 Dec 2002 19:42:55 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 5539 invoked from network); 18 Dec 2002 19:42:53 -0000 Received: from unknown (HELO fenway.scenix.com) (4.20.168.10) by 209.249.29.67 with SMTP; 18 Dec 2002 19:42:53 -0000 Received: from nkelseyxp (NKELSEY-XP [192.168.1.246]) by fenway.scenix.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2656.59) id Y3L4CL0Y; Wed, 18 Dec 2002 11:41:32 -0800 Message-ID: <0f1001c2a6cd$a12be470$f601a8c0@nkelseyxp> Reply-To: "Nick Kelsey" From: "Nick Kelsey" To: References: Subject: Re: Problem with keyword parsing for gas Date: Wed, 18 Dec 2002 11:42:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0F0D_01C2A68A.92DDC3E0" X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2002-q4/txt/msg00109.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0F0D_01C2A68A.92DDC3E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-length: 1712 After sleeping on this I have come to the conclusing that an underscore should always be considered a symbol character regardless how weird the port is so I have submitted the attached patch to binutils for review. Nick ----- Original Message ----- From: "Nick Kelsey" To: Sent: Tuesday, December 17, 2002 6:03 PM Subject: Problem with keyword parsing for gas *This message was transferred with a trial version of CommuniGate(tm) Pro* Hi guys, A change was made to cgen in mid 2001 that affects keyword parsing.... opcodes/cgen-asm.c (early 2001): cgen_parse_keyword: /* Now allow letters, digits, and _. */ while (((p - start) < (int) sizeof (buf)) && (isalnum ((unsigned char) *p) || *p == '_')) ++p; This would correctly treat _temp as a non keyword. The new code reads as follows: /* Allow letters, digits, and any special characters. */ while (((p - start) < (int) sizeof (buf)) && *p && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p))) ++p; This does not treat an underscore as a symbol character and gas barfs on a symbol that starts underscore. Possible solutions that spring to mind... Add an explicit check for underscore to the while statement, or add an underscore to nonalpha_chars. Adding an underscore to nonalpha_chars is easy as it is global and pre-initialized... CGEN_KEYWORD xxx_cgen_opval_register_names = { & xxx_cgen_opval_register_names_entries[0], 121, 0, 0, 0, 0, "_" }; However this is generated code so there are bigger implications. I am completly open to suggestions and implications as to the best way to fix this without breaking other ports. Thanks Nick ------=_NextPart_000_0F0D_01C2A68A.92DDC3E0 Content-Type: application/octet-stream; name="gas_cgen_parse.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="gas_cgen_parse.patch" Content-length: 788 *** cgen-asm.c 26 Nov 2002 18:12:48 -0000=0A= --- cgen-asm.c 18 Dec 2002 02:16:00 -0000=0A= *************** cgen_parse_keyword (cd, strp, keyword_ta=0A= *** 225,231 ****=0A= /* Allow letters, digits, and any special characters. */=0A= while (((p - start) < (int) sizeof (buf))=0A= && *p=0A= ! && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p)))=0A= ++p;=0A= =20=20=0A= if (p - start >=3D (int) sizeof (buf))=0A= --- 225,233 ----=0A= /* Allow letters, digits, and any special characters. */=0A= while (((p - start) < (int) sizeof (buf))=0A= && *p=0A= ! && (ISALNUM (*p) ||=0A= ! strchr (keyword_table->nonalpha_chars, *p) ||=0A= ! *p =3D=3D '_'))=0A= ++p;=0A= =20=20=0A= if (p - start >=3D (int) sizeof (buf))=0A= ------=_NextPart_000_0F0D_01C2A68A.92DDC3E0 Content-Type: application/octet-stream; name="ChangeLog" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ChangeLog" Content-length: 204 2002-12-18 Nick Kelsey =0A= =0A= * cgen-asm.c (cgen_parse_keyword): Added underscore to symbol character=0A= check to fix false keyword trigger with names such as _foo.=0A= ------=_NextPart_000_0F0D_01C2A68A.92DDC3E0--