]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/48204 (ICE: in decimal_to_decnumber, at dfp.c:115 with -fno...
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Apr 2011 18:29:28 +0000 (20:29 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Apr 2011 18:29:28 +0000 (20:29 +0200)
Backported from mainline
2011-03-24  Jakub Jelinek  <jakub@redhat.com>

PR debug/48204
* simplify-rtx.c (simplify_const_unary_operation): Call
real_convert when changing mode class with FLOAT_EXTEND.

* gcc.dg/dfp/pr48204.c: New test.

From-SVN: r172117

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/dfp/pr48204.c [new file with mode: 0644]

index 01ce6860d7d748a08af460e83e7ec15a302e785e..181277fe7df71a217d3db66a78a7ac5a27c0a6e4 100644 (file)
@@ -1,6 +1,12 @@
 2011-04-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2011-03-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/48204
+       * simplify-rtx.c (simplify_const_unary_operation): Call
+       real_convert when changing mode class with FLOAT_EXTEND.
+
        2011-03-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/48141
index 6f754674c7f9dffd5468e759722e894b3e972d95..e50a3904ed7af5406c60d60769c463c07ea1e450 100644 (file)
@@ -1468,7 +1468,8 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
     }
 
   else if (GET_CODE (op) == CONST_DOUBLE
-          && SCALAR_FLOAT_MODE_P (mode))
+          && SCALAR_FLOAT_MODE_P (mode)
+          && SCALAR_FLOAT_MODE_P (GET_MODE (op)))
     {
       REAL_VALUE_TYPE d, t;
       REAL_VALUE_FROM_CONST_DOUBLE (d, op);
@@ -1491,7 +1492,10 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
          d = real_value_truncate (mode, d);
          break;
        case FLOAT_EXTEND:
-         /* All this does is change the mode.  */
+         /* All this does is change the mode, unless changing
+            mode class.  */
+         if (GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op)))
+           real_convert (&d, mode, &d);
          break;
        case FIX:
          real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL);
index 175a4548ac81b5679d5ae9fce776753170609c2c..185b616707f449897c5926c8f2a4dcde2baa2351 100644 (file)
@@ -1,6 +1,11 @@
 2011-04-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2011-03-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/48204
+       * gcc.dg/dfp/pr48204.c: New test.
+
        2011-03-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/48141
diff --git a/gcc/testsuite/gcc.dg/dfp/pr48204.c b/gcc/testsuite/gcc.dg/dfp/pr48204.c
new file mode 100644 (file)
index 0000000..7b42158
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR debug/48204 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-fre -g" } */
+
+void
+foo (void)
+{
+  float cf = 3.0f;
+  _Decimal64 d64 = cf;
+}