crash fix for unhanded operation

Mike Stump mikestump@comcast.net
Mon Sep 9 22:49:00 GMT 2013


Presently gcc just dies with a crash for an unhanded operation, the below handles it better.

I'm torn between sorry and error, error might be better.  Thoughts?

Ok?

diff --git a/gcc/expmed.c b/gcc/expmed.c
index a83d549..127085f 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -4954,6 +4954,12 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
 	}
     }
 
+  if (rem_flag ? (remainder == 0) : (quotient == 0))
+    {
+      sorry ("operation not supported");
+      return CONST0_RTX (mode);
+    }
+
   return gen_lowpart (mode, rem_flag ? remainder : quotient);
 }
 




More information about the Gcc-patches mailing list