This is the mail archive of the binutils@sourceware.org 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]

Blackfin: better error checks in gas for comparisons


I've committed this patch, which improves checking for invalid input and adds related testcases. Previously, some of the invalid forms could cause gas to segfault.


Bernd -- This footer brought to you by insane German lawmakers. Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368 Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.3512
diff -c -p -r1.3512 ChangeLog
*** ChangeLog	19 Mar 2008 10:29:16 -0000	1.3512
--- ChangeLog	26 Mar 2008 15:14:41 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2008-03-26  Bernd Schmidt  <bernd.schmidt@analog.com>
+ 
+ 	From Jie Zhang  <jie.zhang@analog.com>
+ 	* config/bfin-parse.y (asm_1): Check AREGS in comparison
+ 	instructions. And call yyerror () when comparing PREG with
+ 	DREG.
+ 
  2008-03-19  Andreas Krebbel  <krebbel1@de.ibm.com>
  
  	* config/tc-s390.c (md_parse_option): z10 option added.
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/testsuite/ChangeLog,v
retrieving revision 1.1324
diff -c -p -r1.1324 ChangeLog
*** testsuite/ChangeLog	26 Mar 2008 14:50:52 -0000	1.1324
--- testsuite/ChangeLog	26 Mar 2008 15:14:41 -0000
***************
*** 2,7 ****
--- 2,10 ----
  
  	From Jie Zhang  <jie.zhang@analog.com>
  	* gas/bfin/load.d: Update.
+ 	* gas/bfin/expected_comparison_errors.l: New test.
+ 	* gas/bfin/expected_comparison_errors.s: New test.
+ 	* gas/bfin/bfin.exp: Add expected_comparison_errors.
  
  2008-03-19  Andreas Krebbel  <krebbel1@de.ibm.com>
  
Index: config/bfin-parse.y
===================================================================
RCS file: /cvs/src/src/gas/config/bfin-parse.y,v
retrieving revision 1.13
diff -c -p -r1.13 bfin-parse.y
*** config/bfin-parse.y	18 Sep 2007 11:59:00 -0000	1.13
--- config/bfin-parse.y	26 Mar 2008 15:14:42 -0000
*************** asm_1:   
*** 1554,1576 ****
  	}
  	| CCREG ASSIGN REG_A _ASSIGN_ASSIGN REG_A
  	{
! 	  if (!REG_SAME ($3, $5))
  	    {
  	      notethat ("CCflag: CC = A0 == A1\n");
  	      $$ = CCFLAG (0, 0, 5, 0, 0);
  	    }
  	  else
! 	    return yyerror ("CC register expected");
  	}
  	| CCREG ASSIGN REG_A LESS_THAN REG_A
  	{
! 	  if (!REG_SAME ($3, $5))
  	    {
  	      notethat ("CCflag: CC = A0 < A1\n");
  	      $$ = CCFLAG (0, 0, 6, 0, 0);
  	    }
  	  else
! 	    return yyerror ("Register mismatch");
  	}
  	| CCREG ASSIGN REG LESS_THAN REG iu_or_nothing
  	{
--- 1554,1576 ----
  	}
  	| CCREG ASSIGN REG_A _ASSIGN_ASSIGN REG_A
  	{
! 	  if ($3.regno == REG_A0 && $5.regno == REG_A1)
  	    {
  	      notethat ("CCflag: CC = A0 == A1\n");
  	      $$ = CCFLAG (0, 0, 5, 0, 0);
  	    }
  	  else
! 	    return yyerror ("AREGs are in bad order or same");
  	}
  	| CCREG ASSIGN REG_A LESS_THAN REG_A
  	{
! 	  if ($3.regno == REG_A0 && $5.regno == REG_A1)
  	    {
  	      notethat ("CCflag: CC = A0 < A1\n");
  	      $$ = CCFLAG (0, 0, 6, 0, 0);
  	    }
  	  else
! 	    return yyerror ("AREGs are in bad order or same");
  	}
  	| CCREG ASSIGN REG LESS_THAN REG iu_or_nothing
  	{
*************** asm_1:   
*** 1599,1605 ****
  	    {
  	      notethat ("CCflag: CC = dpregs == dpregs\n");
  	      $$ = CCFLAG (&$3, $5.regno & CODE_MASK, 0, 0, IS_PREG ($3) ? 1 : 0);
! 	    } 
  	}
  	| CCREG ASSIGN REG _ASSIGN_ASSIGN expr
  	{
--- 1599,1607 ----
  	    {
  	      notethat ("CCflag: CC = dpregs == dpregs\n");
  	      $$ = CCFLAG (&$3, $5.regno & CODE_MASK, 0, 0, IS_PREG ($3) ? 1 : 0);
! 	    }
! 	  else
! 	    return yyerror ("Compare only of same register class");
  	}
  	| CCREG ASSIGN REG _ASSIGN_ASSIGN expr
  	{
*************** asm_1:   
*** 1613,1625 ****
  	}
  	| CCREG ASSIGN REG_A _LESS_THAN_ASSIGN REG_A
  	{
! 	  if (!REG_SAME ($3, $5))
  	    {
  	      notethat ("CCflag: CC = A0 <= A1\n");
  	      $$ = CCFLAG (0, 0, 7, 0, 0);
  	    }
  	  else
! 	    return yyerror ("CC register expected");
  	}
  	| CCREG ASSIGN REG _LESS_THAN_ASSIGN REG iu_or_nothing
  	{
--- 1615,1627 ----
  	}
  	| CCREG ASSIGN REG_A _LESS_THAN_ASSIGN REG_A
  	{
! 	  if ($3.regno == REG_A0 && $5.regno == REG_A1)
  	    {
  	      notethat ("CCflag: CC = A0 <= A1\n");
  	      $$ = CCFLAG (0, 0, 7, 0, 0);
  	    }
  	  else
! 	    return yyerror ("AREGs are in bad order or same");
  	}
  	| CCREG ASSIGN REG _LESS_THAN_ASSIGN REG iu_or_nothing
  	{
Index: testsuite/gas/bfin/expected_comparison_errors.l
===================================================================
RCS file: testsuite/gas/bfin/expected_comparison_errors.l
diff -N testsuite/gas/bfin/expected_comparison_errors.l
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gas/bfin/expected_comparison_errors.l	26 Mar 2008 15:14:42 -0000
***************
*** 0 ****
--- 1,16 ----
+ .*: Assembler messages:
+ .*:1: Error: AREGs are in bad order or same. Input text was A0.
+ .*:2: Error: AREGs are in bad order or same. Input text was A1.
+ .*:3: Error: AREGs are in bad order or same. Input text was A0.
+ .*:4: Error: AREGs are in bad order or same. Input text was a0.
+ .*:5: Error: AREGs are in bad order or same. Input text was a1.
+ .*:6: Error: AREGs are in bad order or same. Input text was a0.
+ .*:7: Error: AREGs are in bad order or same. Input text was a0.
+ .*:8: Error: AREGs are in bad order or same. Input text was a1.
+ .*:9: Error: AREGs are in bad order or same. Input text was a0.
+ .*:10: Error: Compare only of same register class. Input text was P0.
+ .*:11: Error: Compare only of same register class.
+ .*:12: Error: Compare only of same register class.
+ .*:13: Error: Compare only of same register class. Input text was R0.
+ .*:14: Error: Compare only of same register class.
+ .*:15: Error: Compare only of same register class.
Index: testsuite/gas/bfin/expected_comparison_errors.s
===================================================================
RCS file: testsuite/gas/bfin/expected_comparison_errors.s
diff -N testsuite/gas/bfin/expected_comparison_errors.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gas/bfin/expected_comparison_errors.s	26 Mar 2008 15:14:42 -0000
***************
*** 0 ****
--- 1,15 ----
+ 	CC = A0 == A0;
+ 	CC = A1 == A1;
+ 	CC = A1 == A0;
+ 	cc = A0 < a0;
+ 	cc = A1 < a1;
+ 	cc = A1 < a0;
+ 	cc = a0 <= a0;
+ 	cc = a1 <= a1;
+ 	cc = a1 <= a0;
+ 	CC = R0 == P0;
+ 	CC = R0 < P0;
+ 	CC = R0 <= P0;
+ 	CC = P0 == R0;
+ 	CC = P0 < R0;
+ 	CC = P0 <= R0;
Index: testsuite/gas/bfin/bfin.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/bfin/bfin.exp,v
retrieving revision 1.2
diff -c -p -r1.2 bfin.exp
*** testsuite/gas/bfin/bfin.exp	5 Jun 2007 17:00:31 -0000	1.2
--- testsuite/gas/bfin/bfin.exp	26 Mar 2008 15:14:42 -0000
*************** if [istarget bfin*-*-*] {
*** 12,17 ****
--- 12,18 ----
  	run_dump_test "event2"
  	run_list_test "expected_errors" ""
  	run_list_test "expected_move_errors" ""
+ 	run_list_test "expected_comparison_errors" ""
  	run_dump_test "flow"
  	run_dump_test "flow2"
  	run_dump_test "load"

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