re PR c++/66211 (Rvalue conversion in ternary operator causes internal compiler error)
authorRichard Biener <rguenther@suse.de>
Thu, 21 May 2015 13:23:41 +0000 (13:23 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 21 May 2015 13:23:41 +0000 (13:23 +0000)
2015-05-21  Richard Biener  <rguenther@suse.de>

PR c++/66211
* match.pd: Guard pattern optimzing (int)(float)int
conversions to apply only on GIMPLE.

* g++.dg/conversion/pr66211.C: New testcase.
* gcc.dg/tree-ssa/forwprop-18.c: Adjust.

From-SVN: r223483

gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/conversion/pr66211.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/forwprop-18.c

index f4012b795364b51d7b30b20d6d06a02c487cb816..af2225b159583bdac8241ba173d516b1fc5e026d 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-21  Richard Biener  <rguenther@suse.de>
+
+       PR c++/66211
+       * match.pd: Guard pattern optimzing (int)(float)int
+       conversions to apply only on GIMPLE.
+
 2015-05-21  Jeff Law  <law@redhat.com>
 
        * combine.c (find_split_point): Handle ASHIFT like MULT to encourage
index 54500d9191685c6c0bc5e757d875225f6da786ff..ce628531136bc68ed0730cb19e115b9349a3a53c 100644 (file)
@@ -791,7 +791,8 @@ along with GCC; see the file COPYING3.  If not see
    /* If we are converting an integer to a floating-point that can
       represent it exactly and back to an integer, we can skip the
       floating-point conversion.  */
-   (if (inside_int && inter_float && final_int &&
+   (if (GIMPLE /* PR66211 */
+       && inside_int && inter_float && final_int &&
        (unsigned) significand_size (TYPE_MODE (inter_type))
        >= inside_prec - !inside_unsignedp)
     (convert @0))))))
index 283644cdba28ac3d47a10ce6ef23999d2b5d7461..e681453384859874066287d0e374e416a7d15e18 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-21  Richard Biener  <rguenther@suse.de>
+
+       PR c++/66211
+       * g++.dg/conversion/pr66211.C: New testcase.
+       * gcc.dg/tree-ssa/forwprop-18.c: Adjust.
+
 2015-05-21  Jeff Law  <law@redhat.com>
 
        * gcc.target/hppa/shadd-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/conversion/pr66211.C b/gcc/testsuite/g++.dg/conversion/pr66211.C
new file mode 100644 (file)
index 0000000..49d2478
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/66211
+// { dg-do compile }
+
+void f(int&){}
+
+int main()
+{
+  int x = 0;
+  double y = 1;
+  f(1 > 0 ? x : y); // { dg-error "from an rvalue" }
+}
index 2c4d120e999133fe27cda90cee75ec7abcb24aed..b0445fd20fb700a1a77cae9c8ea92ff846e909e3 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-cddce1" } */
 
 signed char f1(signed char n)
 {
@@ -19,6 +19,6 @@ signed char g2(unsigned long long n)
   return (float)n;
 }
 
-/* { dg-final { scan-tree-dump-times "\\\(float\\\)" 2 "forwprop1" } } */
-/* { dg-final { scan-tree-dump-not "\\\(long double\\\)" "forwprop1" } } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "\\\(float\\\)" 2 "cddce1" } } */
+/* { dg-final { scan-tree-dump-not "\\\(long double\\\)" "cddce1" } } */
+/* { dg-final { cleanup-tree-dump "cddce1" } } */