Subject: bin/5564: gcc-2.7.2.2 cc1 dumps core optimizing u_long_long on newsmips
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tsutsui@ceres.dti.ne.jp>
List: netbsd-bugs
Date: 06/10/1998 23:05:41
>Number:         5564
>Category:       bin
>Synopsis:       gcc-2.7.2.2 cc1 dumps core optimizing u_long_long on newsmips
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 10 07:20:01 1998
>Last-Modified:
>Originator:     Izumi Tsutsui
>Organization:
DTI
>Release:        1.3E-980517
>Environment:
System: NetBSD galant 1.3E NetBSD 1.3E (GALANT) #8: Sat Jun 6 21:13:45 JST 1998 tsutsui@mirage:/usr/src/sys/arch/newsmips/compile/GALANT newsmips


>Description:
gcc-2.7.2.2 cc1 dumps core in optimizing unsigned long long value.
It occured on newsmips, but probably does not mips specific problem.
cc1 for cross compiler(target=mipseb) on i386 also dumps core.

>How-To-Repeat:
Compile sys/ufs/ufs/ufs_lookup.c with -O on newsmips then cc1 dumps core.
Tsubai Masanari told me compiling following code caused same result.

---
unsigned long long int size;

f()
{
        long long int off = 0;

        reutnr (off < size);
}
---

>Fix:
Fix from gcc-2.8.0;

--- /usr/src/gnu/usr.bin/gcc/common/combine.c   1998/05/16 03:51:49     1.1
+++ /usr/src/gnu/usr.bin/gcc/common/combine.c   1998/05/16 03:53:17     1.2
@@ -4018,6 +4018,10 @@
       SUBST (XEXP (x, 2), true);
 
       temp = true, true = false, false = temp, cond = XEXP (x, 0);
+
+      /* It is possible that the conditional has been simplified out.  */
+      true_code = GET_CODE (cond);
+      comparison_p = GET_RTX_CLASS (true_code) == '<';
     }
 
   /* If the two arms are identical, we don't need the comparison.  */

>Audit-Trail:
>Unformatted: