This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[csl-arm] expand_twoval_binop_libfunc and queued rtx
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Mar 2005 04:16:31 +0100
- Subject: [csl-arm] expand_twoval_binop_libfunc and queued rtx
- Organization: CodeSourcery
expand_twoval_binop_libfunc wasn't calling protect_from_queue. This was
causing bad rtl, eventually leading to a segfault.
The attached patch fixes this. 4.0 doesn't use protect_from_queue, and 3.4
doesn't have expand_twoval_binop_libfunc, so neither of those are affected.
Tested with cross to arm-none-eabi.
Applied to csl-arm-branch.
Paul
2005-03-30 Paul Brook <paul@codesourcery.com>
* optabs.c (expand_twoval_binop_libfunc): Call protect_from_queue.
* testsuite/gcc.dg/divmod-1.c: New test.
Index: optabs.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/optabs.c,v
retrieving revision 1.202.2.6
diff -u -p -r1.202.2.6 optabs.c
--- optabs.c 26 Jan 2005 20:14:15 -0000 1.202.2.6
+++ optabs.c 30 Mar 2005 02:28:48 -0000
@@ -2335,6 +2335,9 @@ expand_twoval_binop_libfunc (optab binop
if (!((targ0 != NULL_RTX) ^ (targ1 != NULL_RTX)))
abort ();
+ op0 = protect_from_queue (op0, 0);
+ op1 = protect_from_queue (op1, 0);
+
mode = GET_MODE (op0);
if (!binoptab->handlers[(int) mode].libfunc)
return false;
Index: testsuite/gcc.dg/divmod-1.c
===================================================================
RCS file: testsuite/gcc.dg/divmod-1.c
diff -N testsuite/gcc.dg/divmod-1.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/divmod-1.c 30 Mar 2005 02:41:36 -0000
@@ -0,0 +1,9 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* expand_twoval_binop_libfunc wasn't calling protect_from_queue. */
+int b;
+int
+foo (int a)
+{
+ return a % (b--);
+}