This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

[PATCH] Improve checking by gas of 64-bit conditions on pa


After spending more than two days hunting a gcc bug that turned out
to be a typo in a 64-bit condition, I decided that the assembler
should be checking that 64-bit conditions are valid.  Currently, if
a 64-bit condition doesn't match, the assembler silently uses the
condition "never" for nullifying the following instruction.  The
enclosed patch causes the assembler to generate an error when an
invalid condition is detected.

Tested by running the testsuite and a gcc build on hppa64-hp-hpux11.11.

Installed to trunk.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2003-09-27  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* config/tc-hppa.c (pa_ip): Check for invalid 64-bit conditions.

Index: config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.105
diff -u -3 -p -r1.105 tc-hppa.c
--- config/tc-hppa.c	21 May 2003 19:40:54 -0000	1.105
+++ config/tc-hppa.c	27 Sep 2003 00:33:57 -0000
@@ -2357,7 +2357,6 @@ pa_ip (str)
 			  }
 			else if (*s == '*')
 			  break;
-			name = s;
 
 			name = s;
 			while (*s != ',' && *s != ' ' && *s != '\t')
@@ -2419,7 +2418,7 @@ pa_ip (str)
 			    flag = 1;
 			  }
 			/* ",*" is a valid condition.  */
-			else if (*args == 'a')
+			else if (*args == 'a' || *name)
 			  as_bad (_("Invalid Add Condition: %s"), name);
 			*s = c;
 		      }
@@ -2525,7 +2524,6 @@ pa_ip (str)
 			  }
 			else if (*s == '*')
 			  break;
-			name = s;
 
 			name = s;
 			while (*s != ',' && *s != ' ' && *s != '\t')
@@ -2587,7 +2585,7 @@ pa_ip (str)
 			    flag = 1;
 			  }
 			/* ",*" is a valid condition.  */
-			else if (*args != 'S')
+			else if (*args != 'S' || *name)
 			  as_bad (_("Invalid Compare/Subtract Condition: %s"),
 				  name);
 			*s = c;
@@ -2710,7 +2708,7 @@ pa_ip (str)
 			    flag = 1;
 			  }
 			/* ",*" is a valid condition.  */
-			else if (*args != 'L')
+			else if (*args != 'L' || *name)
 			  as_bad (_("Invalid Logical Instruction Condition."));
 			*s = c;
 		      }
@@ -2765,7 +2763,7 @@ pa_ip (str)
 			    continue;
 			  }
 			/* ",*" is a valid condition.  */
-			else if (*args != 'X')
+			else if (*args != 'X' || *name)
 			  as_bad (_("Invalid Shift/Extract/Deposit Condition."));
 			*s = c;
 		      }
@@ -2877,7 +2875,7 @@ pa_ip (str)
 			    s += 3;
 			  }
 			/* ",*" is a valid condition.  */
-			else if (*args != 'U')
+			else if (*args != 'U' || (*s != ' ' && *s != '\t'))
 			  as_bad (_("Invalid Unit Instruction Condition."));
 		      }
 		    opcode |= cmpltr << 13;


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