diff mbox

[4/9] ENABLE_CHECKING refactoring: Fortran

Message ID 56130837.2020202@gmail.com
State New
Headers show

Commit Message

Mikhail Maltsev Oct. 5, 2015, 11:31 p.m. UTC
gcc/fortran/ChangeLog:

2015-10-05  Mikhail Maltsev  <maltsevm@gmail.com>

	* trans-common.c (create_common): Adjust to use flag_checking.
	* trans.c (gfc_add_modify_loc): Use gcc_checking_assert.

Comments

Jeff Law Oct. 23, 2015, 10:37 p.m. UTC | #1
On 10/05/2015 05:31 PM, Mikhail Maltsev wrote:
> 2015-10-05  Mikhail Maltsev<maltsevm@gmail.com>
>
> 	* trans-common.c (create_common): Adjust to use flag_checking.
> 	* trans.c (gfc_add_modify_loc): Use gcc_checking_assert.
I went ahead and did independent testing on this patch, x86_64-linux-gnu 
as well as building everything in config-list.mk

I've installed this patch on the trunk.

I believe Richi has already approved the updated patch #5.  So please go 
ahead and install that patch.

Thanks,
Jeff
diff mbox

Patch

From 8113b4d5bc943772145abdd6562d4af6093d9718 Mon Sep 17 00:00:00 2001
From: Mikhail Maltsev <maltsevm@gmail.com>
Date: Sat, 3 Oct 2015 10:02:21 +0300
Subject: [PATCH 4/9] Fortran

---
 gcc/fortran/trans-common.c | 15 +++++++--------
 gcc/fortran/trans.c        |  6 ++----
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 7f4bfe5..ae336c1 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -686,14 +686,13 @@  create_common (gfc_common_head *com, segment_info *head, bool saw_equiv)
       TREE_STATIC (ctor) = 1;
       DECL_INITIAL (decl) = ctor;
 
-#ifdef ENABLE_CHECKING
-      {
-	tree field, value;
-	unsigned HOST_WIDE_INT idx;
-	FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), idx, field, value)
-	  gcc_assert (TREE_CODE (field) == FIELD_DECL);
-      }
-#endif
+      if (flag_checking)
+	{
+	  tree field, value;
+	  unsigned HOST_WIDE_INT idx;
+	  FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), idx, field, value)
+	    gcc_assert (TREE_CODE (field) == FIELD_DECL);
+	}
     }
 
   /* Build component reference for each variable.  */
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index f30809a..4eaea53 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -151,7 +151,6 @@  gfc_add_modify_loc (location_t loc, stmtblock_t * pblock, tree lhs, tree rhs)
 {
   tree tmp;
 
-#ifdef ENABLE_CHECKING
   tree t1, t2;
   t1 = TREE_TYPE (rhs);
   t2 = TREE_TYPE (lhs);
@@ -159,9 +158,8 @@  gfc_add_modify_loc (location_t loc, stmtblock_t * pblock, tree lhs, tree rhs)
      for scalar assignments.  We should probably have something
      similar for aggregates, but right now removing that check just
      breaks everything.  */
-  gcc_assert (t1 == t2
-	      || AGGREGATE_TYPE_P (TREE_TYPE (lhs)));
-#endif
+  gcc_checking_assert (t1 == t2
+		       || AGGREGATE_TYPE_P (TREE_TYPE (lhs)));
 
   tmp = fold_build2_loc (loc, MODIFY_EXPR, void_type_node, lhs,
 			 rhs);
-- 
2.1.4