This is the mail archive of the gcc-bugs@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]

[Bug c++/70594] [6 Regression] -fcompare-debug failure


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70594

--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Tobias, could you try your to reproduce your #c0 issue, with a debugging patch
like:

--- gcc/tree.c.jj       2016-03-11 17:37:42.000000000 +0100
+++ gcc/tree.c  2016-04-12 10:43:10.463675009 +0200
@@ -981,6 +981,9 @@ record_node_allocation_statistics (enum
   tree_node_sizes[(int) kind] += length;
 }

+int in_build_decl = 0;
+int in_constexpr_handling = 0;
+
 /* Allocate and return a new UID from the DECL_UID namespace.  */

 int
@@ -1032,6 +1035,12 @@ make_node_stat (enum tree_code code MEM_
       else
        {
          DECL_UID (t) = allocate_decl_uid ();
+if (!in_build_decl)
+{
+FILE *f = fopen ("/tmp/uids", "a");
+fprintf (f, "\"<unnamed>\" %s %u %d 1\n", get_tree_code_name (code), DECL_UID
(t), in_constexpr_handling);
+fclose (f);
+}
          SET_DECL_PT_UID (t, -1);
        }
       if (TREE_CODE (t) == LABEL_DECL)
@@ -1154,6 +1163,11 @@ copy_node_stat (tree node MEM_STAT_DECL)
       else
        {
          DECL_UID (t) = allocate_decl_uid ();
+{
+FILE *f = fopen ("/tmp/uids", "a");
+fprintf (f, "\"%s\" %s %u %d 2\n", DECL_NAME (node) ? IDENTIFIER_POINTER
(DECL_NAME (node)) : "<unnamed>", get_tree_code_name (code), DECL_UID (t),
in_constexpr_handling);
+fclose (f);
+}
          if (DECL_PT_UID_SET_P (node))
            SET_DECL_PT_UID (t, DECL_PT_UID (node));
        }
@@ -4721,9 +4735,20 @@ build_decl_stat (location_t loc, enum tr
 {
   tree t;

+in_build_decl = 1;
+int prev_uid = next_decl_uid;
+
   t = make_node_stat (code PASS_MEM_STAT);
   DECL_SOURCE_LOCATION (t) = loc;

+in_build_decl = 0;
+if (prev_uid != next_decl_uid)
+{
+FILE *f = fopen ("/tmp/uids", "a");
+fprintf (f, "\"%s\" %s %u %d 3\n", name ? IDENTIFIER_POINTER (name) :
"<unnamed>", get_tree_code_name (code), DECL_UID (t), in_constexpr_handling);
+fclose (f);
+}
+
 /*  if (type == error_mark_node)
     type = integer_type_node; */
 /* That is not done, deliberately, so that having error_mark_node
--- gcc/cp/constexpr.c.jj       2016-04-09 13:21:08.000000000 +0200
+++ gcc/cp/constexpr.c  2016-04-12 10:37:34.274308652 +0200
@@ -1463,6 +1463,9 @@ cxx_eval_call_expression (const constexp
          gcc_assert (DECL_SAVED_TREE (fun));
          tree body, parms, res;

+extern int in_constexpr_handling;
+in_constexpr_handling++;
+
          /* Reuse or create a new unshared copy of this function's body.  */
          fundef_copy *copy = get_fundef_copy (fun);
          body = copy->body;
@@ -1545,6 +1548,7 @@ cxx_eval_call_expression (const constexp

          /* Make the unshared function copy we used available for re-use.  */
          save_fundef_copy (fun, copy);
+in_constexpr_handling--;
        }

       if (result == error_mark_node)

Either by running the driver with -fcompare-debug -v first, and then
rm /tmp/uids
paste one cc1plus invocation
mv /tmp/uids{,2}
paste the second cc1plus invocation
And then try to figure out (if in the -fdump-final-insns the yyreduce/yyerrlab
vars are still shifted around) if there are any hints on what is going on with
those in the log file?

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