re PR testsuite/91065 (gcc.dg/plugin/start_unit_plugin.c uses ggc memory without...
authorJoern Rennecke <joern.rennecke@riscy-ip.com>
Wed, 3 Jul 2019 00:22:53 +0000 (00:22 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Wed, 3 Jul 2019 00:22:53 +0000 (01:22 +0100)
        PR testsuite/91065
        * testsuite/gcc.dg/plugin/start_unit_plugin.c: Register a root tab
        to reference fake_var.

From-SVN: r272954

gcc/ChangeLog
gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c

index 62b126fb5b80ff6be84546f86818e0df930f1c4f..c7fed52b573ff746d1cb39e94baa652142b85c09 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-02  Joern Rennecke  <joern.rennecke@riscy-ip.com>
+
+       PR testsuite/91065
+       * testsuite/gcc.dg/plugin/start_unit_plugin.c: Register a root tab
+       to reference fake_var.
+
 2019-07-02  qing zhao  <qing.zhao@oracle.com>
 
        PR preprocessor/90581
index b98cf55eddd4bce6844d147eb8c315111cc17839..61e9494038c7b574c34a7b06e29c669e21dd0503 100644 (file)
@@ -40,6 +40,19 @@ gate_start_unit (void)
 
 static void start_unit_callback (void *gcc_data, void *user_data)
 {
+  static const struct ggc_root_tab root[] = {
+    {
+      &fake_var,
+      1,
+      sizeof (fake_var),
+      &gt_ggc_mx_tree_node,
+      &gt_pch_nx_tree_node
+    },
+    LAST_GGC_ROOT_TAB
+  };
+
+  register_callback ("start_unit", PLUGIN_REGISTER_GGC_ROOTS, NULL,
+                    (void *)root);
   if (integer_type_node) {
     fake_var = build_decl (UNKNOWN_LOCATION, VAR_DECL, 
                            get_identifier ("_fake_var_"),