Patchwork [ARM] Fix an internal error

login
register
mail settings
Submitter Bernd Schmidt
Date Dec. 17, 2010, 1:47 p.m.
Message ID <4D0B6A08.5070206@codesourcery.com>
Download mbox | patch
Permalink /patch/75899/
State New
Headers show

Comments

Bernd Schmidt - Dec. 17, 2010, 1:47 p.m.
On 12/14/2010 02:41 PM, Richard Earnshaw wrote:
> 
> On Mon, 2010-12-13 at 23:59 +0100, Bernd Schmidt wrote:
>> This fixes a crash while compiling a customer testcase (which I don't
>> know yet whether it can be posted) for ARM.  Going into combine, we have

>> Ok?
>>
> 
> Yes.

The customer agreed to let us use the testcase, but said they hope we
can mark it as provided by them. I've installed the following.


Bernd

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 167979)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2010-12-17  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* config/arm/arm.c (arm_select_cc_mode): Before calling
+	arm_select_dominance_cc_mode for AND or IOR operations, ensure
+	that op is NE or EQ.
+
 2010-12-17  Dodji Seketeli  <dodji@redhat.com>
 
 	* dwarf2out.c (gen_type_die_with_usage): Do not try to emit debug
Index: testsuite/gcc.c-torture/compile/20101217-1.c
===================================================================
--- testsuite/gcc.c-torture/compile/20101217-1.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/20101217-1.c	(revision 0)
@@ -0,0 +1,36 @@ 
+/* Testcase provided by HUAWEI.  */
+#include <stdio.h>
+int main()
+{
+        int cur_k;
+        int cur_j=0;
+        int cur_i=28;
+        unsigned char temp_data[8];
+        unsigned int Data_Size=20;
+
+        for (cur_k=0;cur_j<7;cur_j++,cur_i++) {
+                if (cur_j%2==0) {
+                        temp_data[cur_k++]=0;
+                }
+                if (cur_k==7) {
+                        for (;cur_k>0;cur_k--) {
+                                if (cur_k>2) {
+                                        if ((temp_data[7-cur_k]=='n' || temp_data[7-cur_k]=='N' ) && (temp_data[7-cur_k+1]=='a' || temp_data[7-cur_k+1]=='A' )) {
+                                                break;
+                                        }
+                                }
+                                if (cur_k==1) {
+                                        if (temp_data[7-cur_k]=='n' || temp_data[7-cur_k]=='N' ) {
+                                                break;
+                                        }
+                                }
+                        }
+                        if (cur_k==7) {
+                        } else {
+                                if (cur_k>0)
+                                        printf("dfjk");
+                        }
+                }
+        }
+return 0;
+}
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 167979)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,7 @@ 
+2010-12-17  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* gcc.c-torture/compile/20101217-1.c: New test.
+
 2010-12-17  Janus Weil  <janus@gcc.gnu.org>
 
 	PR fortran/46849
Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 167979)
+++ config/arm/arm.c	(working copy)
@@ -10602,12 +10602,14 @@  arm_select_cc_mode (enum rtx_code op, rt
 
   /* Alternate canonicalizations of the above.  These are somewhat cleaner.  */
   if (GET_CODE (x) == AND
+      && (op == EQ || op == NE)
       && COMPARISON_P (XEXP (x, 0))
       && COMPARISON_P (XEXP (x, 1)))
     return arm_select_dominance_cc_mode (XEXP (x, 0), XEXP (x, 1),
 					 DOM_CC_X_AND_Y);
 
   if (GET_CODE (x) == IOR
+      && (op == EQ || op == NE)
       && COMPARISON_P (XEXP (x, 0))
       && COMPARISON_P (XEXP (x, 1)))
     return arm_select_dominance_cc_mode (XEXP (x, 0), XEXP (x, 1),