This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

crash fix for unhanded operation


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);
 }
 



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