This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
crash fix for unhanded operation
- From: Mike Stump <mikestump at comcast dot net>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 9 Sep 2013 14:32:52 -0700
- Subject: crash fix for unhanded operation
- Authentication-results: sourceware.org; auth=none
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);
}