diff mbox

Small C++ PATCH to set DECL_CONTEXT in declare_global_var

Message ID CADzB+2kTMiDeYyenbce-opc8vBX5k+H+28KrE_hLc8aRPm3hoQ@mail.gmail.com
State New
Headers show

Commit Message

Jason Merrill Aug. 1, 2017, 4:37 p.m. UTC
richi's LTO debug patch mentioned in a comment that __dso_handle
didn't have a proper DECL_CONTEXT; this fixes that.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit b96b9abccb1afd301fb907dcfb327ffac05998b1
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jul 31 16:46:46 2017 -0400

            * decl.c (declare_global_var): Set DECL_CONTEXT.
diff mbox

Patch

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4ec38b8..aab2019 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7583,6 +7583,7 @@  declare_global_var (tree name, tree type)
   TREE_PUBLIC (decl) = 1;
   DECL_EXTERNAL (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
+  DECL_CONTEXT (decl) = FROB_CONTEXT (global_namespace);
   /* If the user has explicitly declared this variable (perhaps
      because the code we are compiling is part of a low-level runtime
      library), then it is possible that our declaration will be merged