re PR c/35739 (ICE with _Decimal128 and va_list)
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Apr 2008 16:01:57 +0000 (18:01 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 16 Apr 2008 16:01:57 +0000 (18:01 +0200)
PR c/35739
* tree-nrv.c (tree_nrv): Don't optimize if result_type is GIMPLE
reg type.

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

From-SVN: r134351

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/dfp/pr35739.c [new file with mode: 0644]
gcc/tree-nrv.c

index 3797049a6f64ae2ef8c1ebae5f04cd2f702d8ab6..57d334c17e0c2fb08c5c67734978847e87e48cca 100644 (file)
@@ -1,5 +1,9 @@
 2008-04-16  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/35739
+       * tree-nrv.c (tree_nrv): Don't optimize if result_type is GIMPLE
+       reg type.
+
        PR tree-optimization/35899
        * tree-inline.c (expand_call_inline): Use GIMPLE_STMT_OPERAND
        rather than TREE_OPERAND.
index 7ba05e88885082e6f3b460d856b99c28f1e159e5..85f4cb37bcd793866b7c55d92532c83d976eb503 100644 (file)
@@ -1,5 +1,8 @@
 2008-04-16  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/35739
+       * gcc.dg/dfp/pr35739.c: New test.
+
        PR tree-optimization/35899
        * gcc.dg/pr35899.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/dfp/pr35739.c b/gcc/testsuite/gcc.dg/dfp/pr35739.c
new file mode 100644 (file)
index 0000000..d4e1839
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR c/35739 */
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O -fpreprocessed -fmudflap" } */
+
+_Decimal128
+foo (int n, ...)
+{
+  int i;
+  _Decimal128 j = 0;
+  __builtin_va_list ap;
+  __builtin_va_start (ap, n);
+  for (i = 0; i < n; i++)
+    j += __builtin_va_arg (ap, _Decimal128);
+  __builtin_va_end (ap);
+  return j;
+}
index 7330d2896b5e952fce6652bea2f37a3c1e85b71e..35928ea99e707cac63dc2a271cbefe675b0b0d10 100644 (file)
@@ -1,5 +1,5 @@
 /* Language independent return value optimizations
-   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -115,6 +115,11 @@ tree_nrv (void)
   if (!aggregate_value_p (result, current_function_decl))
     return 0;
 
+  /* If a GIMPLE type is returned in memory, finalize_nrv_r might create
+     non-GIMPLE.  */
+  if (is_gimple_reg_type (result_type))
+    return 0;
+
   /* Look through each block for assignments to the RESULT_DECL.  */
   FOR_EACH_BB (bb)
     {