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]

[applied patch] fix gas run_dump_test #stderr meaning, andfallout.


So, the gas testsuite '#stderr' flag (that I added about a year and a
half ago), had a serious flaw that was overlooked:

If a stderr output comparison file was specified, but no error output
actually occurred, that was considered "OK."

Obviously, if error output was expected, and it didn't occur, that's a
failure.

I noticed this because a change I had in my source tree here, to
generate certain error output, never made it into the mips assembler
source, but the test suite entry which checked for the output *did*.
I was confused by this, and found that the latter continued to pass
because of the run_dump_test flaw.

"Whee!"


Solution: fix the test harness, and add in the missing warnings.
Altogether obvious, and all in all it makes me feel kinda lame for
having missed it for so long...  8-)

The change in capitalization to the existing error message makes it
match the prevailing style (first word capitalized unless a macro or
instruction mnemonic).  AFAICT, nothing checked it, so no tests break.

Likewise, the change to gas-defs.exp isn't exactly as i'd write it,
but matches the prevailing surrounding style.


Tested against a bunch of MIPS targets.  Looks like one other test
(for sh) uses #stderr.  I didn't test it, but either it's already
generating the stderr output and will continue to work, or the
assembler isn't and that's a bug which will cause a failure.



chris
--
[ gas/ChangeLog ]
2003-09-30  Chris Demetriou  <cgd@broadcom.com>

	* config/tc-mips.c (mips_ip): Capitalize first word of
	existing condition code warning, and add condition code
	warnings for .ps instructions, and for bc1any[24][tf].

[ gas/testsuite/ChangeLog ]
2003-09-30  Chris Demetriou  <cgd@broadcom.com>

	* lib/gas-defs.exp (run_dump_test): If stderr file is specified
	and there was no stderr output, compare anyway (i.e., cause a
	test failure).
	* gas/mips/mips64-mips3d.s: Add some new instructions to test warnings.
	* gas/mips/mips64-mips3d.l: New file.
	* gas/mips/mips64-mips3d.d: Use mips64-mips3d.l, and update for
	changes to mips64-mips3d.s.
	* gas/mips/mips64-mips3d-incl.d: Likewise.
	* gas/mips/set-arch.l: New file.
	* gas/mips/set-arch.d: Specify set-arch.l as stderr output to check.
	* gas/mips/mips5.l: Make error messages match source.

Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.230
diff -u -p -r1.230 tc-mips.c
--- gas/config/tc-mips.c	30 Sep 2003 16:17:12 -0000	1.230
+++ gas/config/tc-mips.c	30 Sep 2003 20:54:03 -0000
@@ -9369,7 +9369,18 @@ do_msbd:
 		}
 	      while (ISDIGIT (*s));
 	      if (regno > 7)
-		as_bad (_("invalid condition code register $fcc%d"), regno);
+		as_bad (_("Invalid condition code register $fcc%d"), regno);
+	      if ((strcmp(str + strlen(str) - 3, ".ps") == 0
+		   || strcmp(str + strlen(str) - 5, "any2f") == 0
+		   || strcmp(str + strlen(str) - 5, "any2t") == 0)
+		  && (regno & 1) != 0)
+		as_warn(_("Condition code register should be even for %s, was %d"),
+			str, regno);
+	      if ((strcmp(str + strlen(str) - 5, "any4f") == 0
+		   || strcmp(str + strlen(str) - 5, "any4t") == 0)
+		  && (regno & 3) != 0)
+		as_warn(_("Condition code register should be 0 or 4 for %s, was %d"),
+			str, regno);
 	      if (*args == 'N')
 		ip->insn_opcode |= regno << OP_SH_BCC;
 	      else
Index: gas/testsuite/gas/mips/mips5.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips5.l,v
retrieving revision 1.1
diff -u -p -r1.1 mips5.l
--- gas/testsuite/gas/mips/mips5.l	4 Apr 2003 17:35:44 -0000	1.1
+++ gas/testsuite/gas/mips/mips5.l	30 Sep 2003 20:54:04 -0000
@@ -1,3 +1,3 @@
 .*: Assembler messages:
-.*:61: Warning: Condition flag should be even for c.eq.ps, was 3
-.*:62: Warning: Condition flag should be even for movf.ps, was 3
+.*:61: Warning: Condition code register should be even for c.eq.ps, was 3
+.*:62: Warning: Condition code register should be even for movf.ps, was 3
Index: gas/testsuite/gas/mips/mips64-mips3d-incl.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips64-mips3d-incl.d,v
retrieving revision 1.1
diff -u -p -r1.1 mips64-mips3d-incl.d
--- gas/testsuite/gas/mips/mips64-mips3d-incl.d	27 Dec 2002 23:51:49 -0000	1.1
+++ gas/testsuite/gas/mips/mips64-mips3d-incl.d	30 Sep 2003 20:54:04 -0000
@@ -1,6 +1,7 @@
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS MIPS64 MIPS-3D ASE instructions
 #source: mips64-mips3d.s
+#stderr: mips64-mips3d.l
 
 # Check MIPS64 MIPS-3D ASE instruction assembly and disassembly
 # Same as mips64-mips3d.d, but does not need -mips3d assembler
@@ -137,4 +138,12 @@ Disassembly of section .text:
 0+01f4 <[^>]*> 4633411f 	rsqrt2\.d	\$f4,\$f8,\$f19
 0+01f8 <[^>]*> 4613411f 	rsqrt2\.s	\$f4,\$f8,\$f19
 0+01fc <[^>]*> 46d3411f 	rsqrt2\.ps	\$f4,\$f8,\$f19
+0+0200 <[^>]*> 4524ff7f 	bc1any2f	\$fcc1,0+0000 <text_label>
+0+0204 <[^>]*> 00000000 	nop
+0+0208 <[^>]*> 452dff7d 	bc1any2t	\$fcc3,0+0000 <text_label>
+0+020c <[^>]*> 00000000 	nop
+0+0210 <[^>]*> 4544ff7b 	bc1any4f	\$fcc1,0+0000 <text_label>
+0+0214 <[^>]*> 00000000 	nop
+0+0218 <[^>]*> 4549ff79 	bc1any4t	\$fcc2,0+0000 <text_label>
+0+021c <[^>]*> 00000000 	nop
 	\.\.\.
Index: gas/testsuite/gas/mips/mips64-mips3d.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips64-mips3d.d,v
retrieving revision 1.2
diff -u -p -r1.2 mips64-mips3d.d
--- gas/testsuite/gas/mips/mips64-mips3d.d	27 Dec 2002 23:51:49 -0000	1.2
+++ gas/testsuite/gas/mips/mips64-mips3d.d	30 Sep 2003 20:54:04 -0000
@@ -1,6 +1,7 @@
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa64
 #name: MIPS MIPS64 MIPS-3D ASE instructions (-mips3d flag)
 #as: -mips64 -mips3d
+#stderr: mips64-mips3d.l
 
 # Check MIPS64 MIPS-3D ASE instruction assembly and disassembly
 
@@ -135,4 +136,12 @@ Disassembly of section .text:
 0+01f4 <[^>]*> 4633411f 	rsqrt2\.d	\$f4,\$f8,\$f19
 0+01f8 <[^>]*> 4613411f 	rsqrt2\.s	\$f4,\$f8,\$f19
 0+01fc <[^>]*> 46d3411f 	rsqrt2\.ps	\$f4,\$f8,\$f19
+0+0200 <[^>]*> 4524ff7f 	bc1any2f	\$fcc1,0+0000 <text_label>
+0+0204 <[^>]*> 00000000 	nop
+0+0208 <[^>]*> 452dff7d 	bc1any2t	\$fcc3,0+0000 <text_label>
+0+020c <[^>]*> 00000000 	nop
+0+0210 <[^>]*> 4544ff7b 	bc1any4f	\$fcc1,0+0000 <text_label>
+0+0214 <[^>]*> 00000000 	nop
+0+0218 <[^>]*> 4549ff79 	bc1any4t	\$fcc2,0+0000 <text_label>
+0+021c <[^>]*> 00000000 	nop
 	\.\.\.
Index: gas/testsuite/gas/mips/mips64-mips3d.l
===================================================================
RCS file: gas/testsuite/gas/mips/mips64-mips3d.l
diff -N gas/testsuite/gas/mips/mips64-mips3d.l
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/mips/mips64-mips3d.l	30 Sep 2003 20:54:04 -0000
@@ -0,0 +1,5 @@
+.*: Assembler messages:
+.*:150: Warning: Condition code register should be even for bc1any2f, was 1
+.*:152: Warning: Condition code register should be even for bc1any2t, was 3
+.*:154: Warning: Condition code register should be 0 or 4 for bc1any4f, was 1
+.*:156: Warning: Condition code register should be 0 or 4 for bc1any4t, was 2
Index: gas/testsuite/gas/mips/mips64-mips3d.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips64-mips3d.s,v
retrieving revision 1.2
diff -u -p -r1.2 mips64-mips3d.s
--- gas/testsuite/gas/mips/mips64-mips3d.s	5 Sep 2002 00:05:44 -0000	1.2
+++ gas/testsuite/gas/mips/mips64-mips3d.s	30 Sep 2003 20:54:04 -0000
@@ -147,5 +147,14 @@ text_label:
 	rsqrt2.s	$f4, $f8, $f19
 	rsqrt2.ps	$f4, $f8, $f19
 
+	bc1any2f	$fcc1, text_label	# warns
+	nop
+	bc1any2t	$fcc3, text_label	# warns
+	nop
+	bc1any4f	$fcc1, text_label	# warns
+	nop
+	bc1any4t	$fcc2, text_label	# warns
+	nop
+
 # Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
       .space  8
Index: gas/testsuite/gas/mips/set-arch.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/set-arch.d,v
retrieving revision 1.2
diff -u -p -r1.2 set-arch.d
--- gas/testsuite/gas/mips/set-arch.d	2 Jul 2003 00:40:12 -0000	1.2
+++ gas/testsuite/gas/mips/set-arch.d	30 Sep 2003 20:54:04 -0000
@@ -1,5 +1,6 @@
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:sb1 -M gpr-names=32
 #name: .set arch=FOO
+#stderr: set-arch.l
 
 dump\.o:     file format .*mips
 
Index: gas/testsuite/gas/mips/set-arch.l
===================================================================
RCS file: gas/testsuite/gas/mips/set-arch.l
diff -N gas/testsuite/gas/mips/set-arch.l
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/mips/set-arch.l	30 Sep 2003 20:54:04 -0000
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+.*:146: Warning: Condition code register should be even for c.eq.ps, was 3
+.*:147: Warning: Condition code register should be even for movf.ps, was 3
Index: gas/testsuite/lib/gas-defs.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/lib/gas-defs.exp,v
retrieving revision 1.13
diff -u -p -r1.13 gas-defs.exp
--- gas/testsuite/lib/gas-defs.exp	10 Jun 2003 13:31:59 -0000	1.13
+++ gas/testsuite/lib/gas-defs.exp	30 Sep 2003 20:54:05 -0000
@@ -411,7 +411,7 @@ proc run_dump_test { name {extra_options
     catch "exec $srcdir/lib/run $AS $ASFLAGS $opts(as) -o dump.o $sourcefile" comp_output
     set comp_output [prune_warnings $comp_output]
 
-    if ![string match "" $comp_output] then {
+    if { ![string match "" $comp_output] || $opts(stderr) != "" } then {
 	if { $opts(stderr) == "" }  then {
 	    send_log "$comp_output\n"
 	    verbose "$comp_output" 3




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