]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2018-07-18 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Jul 2018 06:54:23 +0000 (06:54 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Jul 2018 06:54:23 +0000 (06:54 +0000)
PR debug/86523
cp/
* decl2.c (c_parse_final_cleanups): Call write_out_vars before
start_static_storage_duration_function sets current_function_decl.

* g++.dg/lto/pr86523-3_0.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262849 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/pr86523-3_0.C [new file with mode: 0644]

index f6f439851255cfb6c9f3d2ee6a9f489ab6f8a8ea..7161565280a6abbaa0b68bace5568143205d93e8 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-18  Richard Biener  <rguenther@suse.de>
+
+       PR debug/86523
+       * decl2.c (c_parse_final_cleanups): Call write_out_vars before
+       start_static_storage_duration_function sets current_function_decl.
+
 2018-07-17  Jason Merrill  <jason@redhat.com>
 
        PR c++/86480 - nested variadic lambda and constexpr if.
index f8fc20e409359c3c1af60b1fa18b7c1e4daec6ae..d67ced097daf019911dca9d7f0c572b68215fda5 100644 (file)
@@ -4754,14 +4754,14 @@ c_parse_final_cleanups (void)
             inline, with resulting performance improvements.  */
          tree ssdf_body;
 
+         /* Make sure the back end knows about all the variables.  */
+         write_out_vars (vars);
+
          /* Set the line and file, so that it is obviously not from
             the source file.  */
          input_location = locus_at_end_of_parsing;
          ssdf_body = start_static_storage_duration_function (ssdf_count);
 
-         /* Make sure the back end knows about all the variables.  */
-         write_out_vars (vars);
-
          /* First generate code to do all the initializations.  */
          if (vars)
            do_static_initialization_or_destruction (vars, /*initp=*/true);
index b09943993ddb2c64af81601ae54906929b6eea21..7fc2a42fbcef33a59bcaf8af0ffd30c620d85aa0 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-18  Richard Biener  <rguenther@suse.de>
+
+       PR debug/86523
+       * g++.dg/lto/pr86523-3_0.C: New testcase.
+
 2018-07-17  Andreas Schwab  <schwab@linux-m68k.org>
 
        * gcc.target/m68k/mulsi_highpart.c: New test.
diff --git a/gcc/testsuite/g++.dg/lto/pr86523-3_0.C b/gcc/testsuite/g++.dg/lto/pr86523-3_0.C
new file mode 100644 (file)
index 0000000..31063b8
--- /dev/null
@@ -0,0 +1,24 @@
+// { dg-lto-do link }
+// { dg-require-effective-target fpic }
+// { dg-require-effective-target shared }
+// { dg-lto-options { { -fPIC -flto -g -shared } } }
+class a {
+    int b;
+};
+int const c = 0, d = 1, f = 2, g = 3;
+struct B {
+    typedef a h;
+    h i;
+};
+template <class> B j();
+template <class> struct k_context { static B const e_missingvar; };
+template <class l> B const k_context<l>::e_missingvar = j<l>();
+inline B m() {
+    switch (0) {
+      case c:
+      case d:
+      return k_context<int>::e_missingvar;
+      case f:
+      case g:;
+    }
+}