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]

[debuglocus] fix sharing issue in gimple_copy


Pretty obvious.  With this patch we can bootstrap C/C++ even while
forcing the verifier to abort on shared debuglocus entries.

There are still more sharing issues found in the testsuite, but since we
don't run verifier by default (or abort on shared entries), it is safe
to commit sharing fixes incrementally.

Tested on x86-64 Linux.  OK for branch?

        * gimple.c (gimple_copy): Unshare the debuglocus.

Index: gimple.c
===================================================================
--- gimple.c	(revision 146206)
+++ gimple.c	(working copy)
@@ -2070,10 +2070,18 @@ gimple_copy (gimple stmt)
   unsigned num_ops = gimple_num_ops (stmt);
   gimple copy = gimple_alloc (code, num_ops);
   unsigned i;
+  location_t locus = gimple_location (stmt);
 
   /* Shallow copy all the fields from STMT.  */
   memcpy (copy, stmt, gimple_size (code));
 
+  /* Debuglocus's cannot be shared.  */
+  if (is_debuglocus (locus))
+    {
+      locus = create_duplicate_debuglocus (locus);
+      gimple_set_location (copy, locus);
+    }
+
   /* If STMT has sub-statements, deep-copy them as well.  */
   if (gimple_has_substatements (stmt))
     {


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