From 3ae2086419cac0721865c8530084b7b6ab52f482 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 31 Oct 2018 12:32:41 -0400
Subject: [PATCH 45/83] FIXME: more fixups

---
 current-comparison.txt |  2 --
 gcc/convert.c          | 20 ++++++++++++--------
 gcc/tree.h             |  6 ++++++
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/current-comparison.txt b/current-comparison.txt
index 6b6e34d..38b3647 100644
--- a/current-comparison.txt
+++ b/current-comparison.txt
@@ -21,8 +21,6 @@ Tests appeared in gcc/testsuite/g++/g++.sum: FAIL: 7, PASS: 104, UNRESOLVED: 2,
 Tests changing outcome in gcc/testsuite/g++/g++.sum: 89
 -------------------------------------------------------
 
- PASS -> FAIL : g++.dg/cpp0x/constexpr-reinterpret1.C  -std=c++14  (test for errors, line 20)
- PASS -> FAIL : g++.dg/cpp0x/constexpr-reinterpret1.C  -std=c++17  (test for errors, line 20)
  PASS -> FAIL : g++.dg/cpp0x/error2.C  -std=c++14  (test for errors, line 8)
  PASS -> FAIL : g++.dg/cpp0x/error2.C  -std=c++14 (test for excess errors)
  PASS -> FAIL : g++.dg/cpp0x/error2.C  -std=c++17  (test for errors, line 8)
diff --git a/gcc/convert.c b/gcc/convert.c
index 68705f3..b42f40e 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -108,12 +108,13 @@ convert_to_pointer (tree type, tree expr)
 }
 
 /* A wrapper around convert_to_pointer_1 that only folds the
-   expression if DOFOLD, or if it is CONSTANT_CLASS_P.  */
+   expression if DOFOLD, or if it is CONSTANT_CLASS_OR_WRAPPER_P.  */
 
 tree
 convert_to_pointer_maybe_fold (tree type, tree expr, bool dofold)
 {
-  return convert_to_pointer_1 (type, expr, dofold || CONSTANT_CLASS_P (expr));
+  return convert_to_pointer_1 (type, expr,
+			       dofold || CONSTANT_CLASS_OR_WRAPPER_P (expr));
 }
 
 /* Convert EXPR to some floating-point type TYPE.
@@ -408,12 +409,13 @@ convert_to_real (tree type, tree expr)
 }
 
 /* A wrapper around convert_to_real_1 that only folds the
-   expression if DOFOLD, or if it is CONSTANT_CLASS_P.  */
+   expression if DOFOLD, or if it is CONSTANT_CLASS_OR_WRAPPER_P.  */
 
 tree
 convert_to_real_maybe_fold (tree type, tree expr, bool dofold)
 {
-  return convert_to_real_1 (type, expr, dofold || CONSTANT_CLASS_P (expr));
+  return convert_to_real_1 (type, expr,
+			    dofold || CONSTANT_CLASS_OR_WRAPPER_P (expr));
 }
 
 /* Try to narrow EX_FORM ARG0 ARG1 in narrowed arg types producing a
@@ -1017,12 +1019,13 @@ convert_to_integer (tree type, tree expr)
 }
 
 /* A wrapper around convert_to_complex_1 that only folds the
-   expression if DOFOLD, or if it is CONSTANT_CLASS_P.  */
+   expression if DOFOLD, or if it is CONSTANT_CLASS_OR_WRAPPER_P.  */
 
 tree
 convert_to_integer_maybe_fold (tree type, tree expr, bool dofold)
 {
-  return convert_to_integer_1 (type, expr, dofold || CONSTANT_CLASS_P (expr));
+  return convert_to_integer_1 (type, expr,
+			       dofold || CONSTANT_CLASS_OR_WRAPPER_P (expr));
 }
 
 /* Convert EXPR to the complex type TYPE in the usual ways.  If FOLD_P is
@@ -1101,12 +1104,13 @@ convert_to_complex (tree type, tree expr)
 }
 
 /* A wrapper around convert_to_complex_1 that only folds the
-   expression if DOFOLD, or if it is CONSTANT_CLASS_P.  */
+   expression if DOFOLD, or if it is CONSTANT_CLASS_OR_WRAPPER_P.  */
 
 tree
 convert_to_complex_maybe_fold (tree type, tree expr, bool dofold)
 {
-  return convert_to_complex_1 (type, expr, dofold || CONSTANT_CLASS_P (expr));
+  return convert_to_complex_1 (type, expr,
+			       dofold || CONSTANT_CLASS_OR_WRAPPER_P (expr));
 }
 
 /* Convert EXPR to the vector type TYPE in the usual ways.  */
diff --git a/gcc/tree.h b/gcc/tree.h
index 6dce26c..b259322 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -131,6 +131,12 @@ as_internal_fn (combined_fn code)
 #define CONSTANT_CLASS_P(NODE)\
 	(TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_constant)
 
+/* Nonzero if NODE represents a constant, or is a location wrapper
+   around such a node.  */
+
+#define CONSTANT_CLASS_OR_WRAPPER_P(NODE)\
+	(CONSTANT_CLASS_P (tree_strip_any_location_wrapper (NODE)))
+
 /* Nonzero if NODE represents a type.  */
 
 #define TYPE_P(NODE)\
-- 
1.8.5.3

