aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-09-04 01:53:01 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-09-04 01:53:01 +0000
commitbcfb807527a1ae01d056ce4a7e70ca0b4b86b35e (patch)
tree6141bc0566ce12f77e9b89892e9124b9e2a30347 /gcc
parent2a3ef884df38aba49d59970c91da8a8471dd2ff8 (diff)
downloadgcc-bcfb807527a1ae01d056ce4a7e70ca0b4b86b35e.zip
gcc-bcfb807527a1ae01d056ce4a7e70ca0b4b86b35e.tar.gz
gcc-bcfb807527a1ae01d056ce4a7e70ca0b4b86b35e.tar.bz2
re PR rtl-optimization/11700 ([M68K] ICE in subreg_hard_regno)
PR optimization/11700. * simplify-rtx.c (simplify_subreg): Check that the subreg offset of a hard register is representable before trying to simplify it using subreg_hard_regno. * gcc.c-torture/compile/20030903-1.c: New test case. From-SVN: r71046
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/simplify-rtx.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030903-1.c33
4 files changed, 50 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6d54b34..d432719 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2003-09-03 Roger Sayle <roger@eyesopen.com>
+
+ PR optimization/11700.
+ * simplify-rtx.c (simplify_subreg): Check that the subreg offset
+ of a hard register is representable before trying to simplify it
+ using subreg_hard_regno.
+
2003-09-04 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* configure.in (gcc_cv_ld_hidden): Disable unless using GNU ld.
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 919bea6..6ace348 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3017,10 +3017,12 @@ simplify_subreg (enum machine_mode outermode, rtx op,
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
&& REGNO (op) != ARG_POINTER_REGNUM
#endif
- && REGNO (op) != STACK_POINTER_REGNUM)
+ && REGNO (op) != STACK_POINTER_REGNUM
+ && subreg_offset_representable_p (REGNO (op), innermode,
+ byte, outermode))
{
- int final_regno = subreg_hard_regno (gen_rtx_SUBREG (outermode, op, byte),
- 0);
+ rtx tem = gen_rtx_SUBREG (outermode, op, byte);
+ int final_regno = subreg_hard_regno (tem, 0);
/* ??? We do allow it if the current REG is not valid for
its mode. This is a kludge to work around how float/complex
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a6d708c..d417f83 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-03 Roger Sayle <roger@eyesopen.com>
+
+ PR optimization/11700.
+ * gcc.c-torture/compile/20030903-1.c: New test case.
+
2003-09-03 Mark Mitchell <mark@codesourcery.com>
PR c++/12053
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030903-1.c b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c
new file mode 100644
index 0000000..fa4d30d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c
@@ -0,0 +1,33 @@
+/* Derived from PR optimization/11700. */
+/* The compiler used to ICE during reload for m68k targets. */
+
+void check_complex (__complex__ double, __complex__ double,
+ __complex__ double, __complex__ int);
+void check_float (double, double, double, int);
+extern double _Complex conj (double _Complex);
+extern double carg (double _Complex __z);
+
+static double minus_zero;
+
+void
+conj_test (void)
+{
+ check_complex (conj (({ __complex__ double __retval;
+ __real__ __retval = (0.0);
+ __imag__ __retval = (0.0);
+ __retval; })),
+ ({ __complex__ double __retval;
+ __real__ __retval = (0.0);
+ __imag__ __retval = (minus_zero);
+ __retval; }), 0, 0);
+}
+
+void
+carg_test (void)
+{
+ check_float (carg (({ __complex__ double __retval;
+ __real__ __retval = (2.0);
+ __imag__ __retval = (0);
+ __retval; })), 0, 0, 0);
+}
+