PR tree-optimization/81428
* match.pd (X / X -> one): Don't optimize _Fract divisions, as 1
can't be built for those types.
* gcc.dg/fixed-point/pr81428.c: New test.
From-SVN: r250265
+2017-07-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/81428
+ * match.pd (X / X -> one): Don't optimize _Fract divisions, as 1
+ can't be built for those types.
+
2017-07-17 Georg-Johann Lay <avr@gjlay.de>
Remove stuff dead since r239246.
/* X / X is one. */
(simplify
(div @0 @0)
- /* But not for 0 / 0 so that we can get the proper warnings and errors. */
- (if (!integer_zerop (@0))
+ /* But not for 0 / 0 so that we can get the proper warnings and errors.
+ And not for _Fract types where we can't build 1. */
+ (if (!integer_zerop (@0) && !ALL_FRACT_MODE_P (TYPE_MODE (type)))
{ build_one_cst (type); }))
/* X / abs (X) is X < 0 ? -1 : 1. */
(simplify
2017-07-17 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/81428
+ * gcc.dg/fixed-point/pr81428.c: New test.
+
PR tree-optimization/81365
* g++.dg/torture/pr81365.C: New test.
--- /dev/null
+/* PR tree-optimization/81428 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (long _Fract *a, long _Fract *b)
+{
+ *b = *a / *a;
+}