This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gimple-classes, committed 32/44] Fix issues with gimple_assign_single_p and gimple_assign_load_p


gcc/ChangeLog.gimple-classes:
	* asan.c (get_mem_ref_of_assignment): Weaken param "assignment"
	from const gassign * to gassign *.
	* gimple.h (gimple_assign_single_p): Eliminate const_gimple variant,
	since this could call itself, leading to an infinite recursion.
	(gimple_assign_load_p): Likewise.
---
 gcc/ChangeLog.gimple-classes |  8 ++++++++
 gcc/asan.c                   |  2 +-
 gcc/gimple.h                 | 28 ++++++----------------------
 3 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index bfa2a15..776073d 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,3 +1,11 @@
+2014-11-04  David Malcolm  <dmalcolm@redhat.com>
+
+	* asan.c (get_mem_ref_of_assignment): Weaken param "assignment"
+	from const gassign * to gassign *.
+	* gimple.h (gimple_assign_single_p): Eliminate const_gimple variant,
+	since this could call itself, leading to an infinite recursion.
+	(gimple_assign_load_p): Likewise.
+
 2014-11-03  David Malcolm  <dmalcolm@redhat.com>
 
 	* ipa-polymorphic-call.c (walk_ssa_copies): Add checked cast.
diff --git a/gcc/asan.c b/gcc/asan.c
index 1f65fe6..9b25f56 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -465,7 +465,7 @@ has_mem_ref_been_instrumented (const asan_mem_ref *ref, tree len)
    otherwise.  */
 
 static bool
-get_mem_ref_of_assignment (const gassign *assignment,
+get_mem_ref_of_assignment (gassign *assignment,
 			   asan_mem_ref *ref,
 			   bool *ref_is_store)
 {
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 50e1555..b4782e8 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2487,21 +2487,13 @@ gimple_assign_rhs_class (const_gimple gs)
   return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
 }
 
-/* Return true if GS is an assignment with a singleton RHS, i.e.,
-   there is no operator associated with the assignment itself.
-   Unlike gimple_assign_copy_p, this predicate returns true for
+/* Return GS (as a gassign *) if GS is an assignment with a singleton
+   RHS, i.e., there is no operator associated with the assignment itself,
+   Otherwise, return NULL.
+   Unlike gimple_assign_copy_p, this predicate returns non-NULL for
    any RHS operand, including those that perform an operation
    and do not have the semantics of a copy, such as COND_EXPR.  */
 
-static inline bool
-gimple_assign_single_p (const_gimple gs)
-{
-  return gimple_assign_single_p (const_cast <gimple> (gs));
-}
-
-/* As above, but non-const, and return GS as a gassign * if
-   the predicate holds.  */
-
 static inline gassign *
 gimple_assign_single_p (gimple gs)
 {
@@ -2521,16 +2513,8 @@ gimple_store_p (const_gimple gs)
   return lhs && !is_gimple_reg (lhs);
 }
 
-/* Return true if GS is an assignment that loads from its rhs1.  */
-
-static inline bool
-gimple_assign_load_p (const_gimple gs)
-{
-  return gimple_assign_load_p (const_cast <gimple> (gs));
-}
-
-/* As above, but non-const, and return GS as a gassign * if
-   the predicate holds.  */
+/* Return GS (as a gassign *) if GS is an assignment that loads from its rhs1,
+   or NULL otherwise.  */
 
 static inline gassign *
 gimple_assign_load_p (gimple gs)
-- 
1.7.11.7


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]