dwarf2out.c (add_bound_info): Don't crash on an unexpanded SAVE_EXPR.
authorJason Merrill <jason@casey.cygnus.com>
Wed, 26 Apr 2000 00:36:56 +0000 (00:36 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 26 Apr 2000 00:36:56 +0000 (20:36 -0400)
        * dwarf2out.c (add_bound_info): Don't crash on an unexpanded SAVE_EXPR.

        * dwarfout.c (output_decl): Ignore NAMESPACE_DECLs.

        * dwarf2out.c (gen_subprogram_die): The class-scope declaration DIE
        is the primary DIE for a member function.
        (gen_decl_die): Call set_decl_origin_self here.
        * dwarfout.c (output_decl): And here.
        * integrate.c (output_inline_function): Not here.
        Don't clear DECL_INLINE until after calling rest_of_compilation.
        (set_decl_origin_self): No longer static.
        * tree.h: Add prototype.
        * toplev.c (note_deferral_of_defined_inline_function): Only write
        out abstract instance for actual inlines.

        * cp/decl.c (finish_function): Don't play games with DECL_INLINE.

From-SVN: r33430

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/dwarf2out.c
gcc/dwarfout.c
gcc/integrate.c
gcc/toplev.c
gcc/tree.h

index 4be14940535b4fbabc797fb44579840eb19a5a03..d25411df513565074840d95db3b7716097e1e243 100644 (file)
@@ -1,3 +1,20 @@
+2000-04-26  Jason Merrill  <jason@casey.cygnus.com>
+
+       * dwarf2out.c (add_bound_info): Don't crash on an unexpanded SAVE_EXPR.
+
+       * dwarfout.c (output_decl): Ignore NAMESPACE_DECLs.
+
+       * dwarf2out.c (gen_subprogram_die): The class-scope declaration DIE
+       is the primary DIE for a member function.
+       (gen_decl_die): Call set_decl_origin_self here.
+       * dwarfout.c (output_decl): And here.
+       * integrate.c (output_inline_function): Not here.
+       Don't clear DECL_INLINE until after calling rest_of_compilation.
+       (set_decl_origin_self): No longer static.
+       * tree.h: Add prototype.
+       * toplev.c (note_deferral_of_defined_inline_function): Only write
+       out abstract instance for actual inlines.
+
 2000-04-25  Alexandre Oliva  <aoliva@cygnus.com>
 
        * config/mn10300/mn10300.h (REG_CLASS_FROM_LETTER): Return
index c21f40fc43d2e0fd76eb3b4cd9bfaac617b837b3..0cfe024dd3197667947a8db805a1544067a68571 100644 (file)
@@ -1,3 +1,7 @@
+2000-04-26  Jason Merrill  <jason@casey.cygnus.com>
+
+       * decl.c (finish_function): Don't play games with DECL_INLINE.
+
 2000-04-25  Gabriel Dos Reis  <dosreis@cmla.ens-cachan.fr>
 
        * ir.texi: Correct typo.
index 5b9592052587f63d2d9b62abf02f05f2f7667bae..cd6fd493a951e972f6c451067d1164ae75b14551 100644 (file)
@@ -14173,22 +14173,7 @@ finish_function (flags)
 
       /* Run the optimizers and output the assembler code for this
          function.  */
-      if (DECL_ARTIFICIAL (fndecl))
-       {
-         /* Do we really *want* to inline this synthesized method?  */
-
-         int save_fif = flag_inline_functions;
-         flag_inline_functions = 1;
-
-         /* Turn off DECL_INLINE for the moment so function_cannot_inline_p
-            will check our size.  */
-         DECL_INLINE (fndecl) = 0;
-
-         rest_of_compilation (fndecl);
-         flag_inline_functions = save_fif;
-       }
-      else
-       rest_of_compilation (fndecl);
+      rest_of_compilation (fndecl);
 
       /* Undo the call to ggc_push_context above.  */
       if (function_depth > 1)
index d5807877a706419da596584e78868627f1dea4db..79bffccce90a3b9d8607d78bc397f8f6a97e5c13 100644 (file)
@@ -7119,7 +7119,8 @@ add_bound_info (subrange_die, bound_attr, bound)
         We assume that a MEM rtx is safe because gcc wouldn't put the
         value there unless it was going to be used repeatedly in the
         function, i.e. for cleanups.  */
-      if (! optimize || GET_CODE (SAVE_EXPR_RTL (bound)) == MEM)
+      if (! optimize || (SAVE_EXPR_RTL (bound)
+                        && GET_CODE (SAVE_EXPR_RTL (bound)) == MEM))
        {
          register dw_die_ref ctx = lookup_decl_die (current_function_decl);
          register dw_die_ref decl_die = new_die (DW_TAG_variable, ctx);
@@ -8006,12 +8007,7 @@ gen_unspecified_parameters_die (decl_or_type, context_die)
 /* Generate a list of nameless DW_TAG_formal_parameter DIEs (and perhaps a
    DW_TAG_unspecified_parameters DIE) to represent the types of the formal
    parameters as specified in some function type specification (except for
-   those which appear as part of a function *definition*).
-
-   Note we must be careful here to output all of the parameter DIEs before*
-   we output any DIEs needed to represent the types of the formal parameters.
-   This keeps svr4 SDB happy because it (incorrectly) thinks that the first
-   non-parameter DIE it sees ends the formal parameter list.  */
+   those which appear as part of a function *definition*).  */
 
 static void
 gen_formal_types_die (function_or_method_type, context_die)
@@ -8151,6 +8147,14 @@ gen_subprogram_die (decl, context_die)
      case, `declaration' takes priority; we'll get back to the abstract
      instance when we're done with the class.  */
 
+  /* The class-scope declaration DIE must be the primary DIE.  */
+  if (origin && declaration && class_scope_p (context_die))
+    {
+      origin = NULL;
+      if (old_die)
+       abort ();
+    }
+
   if (origin != NULL)
     {
       if (declaration && ! local_scope_p (context_die))
@@ -9322,10 +9326,14 @@ gen_decl_die (decl, context_die)
          && (current_function_decl == NULL_TREE || DECL_ARTIFICIAL (decl)))
        break;
 
-      /* Emit info for the abstract instance first, if we haven't yet.  */
-      origin = decl_ultimate_origin (decl);
-      if (origin)
-       gen_abstract_function (origin);
+      /* If we're emitting an out-of-line copy of an inline function,
+        emit info for the abstract instance and set up to refer to it.  */
+      if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
+         && ! class_scope_p (context_die))
+       {
+         gen_abstract_function (decl);
+         set_decl_origin_self (decl);
+       }
 
       if (debug_info_level > DINFO_LEVEL_TERSE)
        {
index 400dc785ca134f528b11af6d99e9fc9fd3ed7589..fafbcaa926fbf2b3e47f4fd7439b00cd0355202a 100644 (file)
@@ -4791,6 +4791,13 @@ output_decl (decl, containing_scope)
          output_type (origin, containing_scope);
       }
 
+      /* If we're emitting an out-of-line copy of an inline function,
+        set up to refer to the abstract instance emitted from
+        note_deferral_of_defined_inline_function.  */
+      if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
+         && ! (containing_scope && TYPE_P (containing_scope)))
+       set_decl_origin_self (decl);
+
       /* If the following DIE will represent a function definition for a
         function with "extern" linkage, output a special "pubnames" DIE
         label just ahead of the actual DIE.  A reference to this label
@@ -5084,6 +5091,10 @@ output_decl (decl, containing_scope)
       output_die (output_formal_parameter_die, decl);
       break;
 
+    case NAMESPACE_DECL:
+      /* Ignore for now.  */
+      break;
+
     default:
       abort ();
     }
index 6fa0be17fc73e59dc496ba7f3e3e008fba5ccff4..622acf49deb6d60a6bf45f8b04dfb463762f1e49 100644 (file)
@@ -78,7 +78,6 @@ static tree integrate_decl_tree               PARAMS ((tree,
 static void subst_constants            PARAMS ((rtx *, rtx,
                                                 struct inline_remap *, int));
 static void set_block_origin_self      PARAMS ((tree));
-static void set_decl_origin_self       PARAMS ((tree));
 static void set_block_abstract_flags   PARAMS ((tree, int));
 static void process_reg_param          PARAMS ((struct inline_remap *, rtx,
                                                 rtx));
@@ -2647,7 +2646,7 @@ set_block_origin_self (stmt)
    set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN values to
    point to themselves.  */
 
-static void
+void
 set_decl_origin_self (decl)
      register tree decl;
 {
@@ -2738,16 +2737,8 @@ output_inline_function (fndecl)
 
   set_new_last_label_num (f->inl_max_label_num);
 
-  /* We must have already output DWARF debugging information for the
-     original (abstract) inline function declaration/definition, so
-     we want to make sure that the debugging information we generate
-     for this special instance of the inline function refers back to
-     the information we already generated.  To make sure that happens,
-     we simply have to set the DECL_ABSTRACT_ORIGIN for the function
-     node (and for all of the local ..._DECL nodes which are its children)
-     so that they all point to themselves.  */
-
-  set_decl_origin_self (fndecl);
+  /* Compile this function all the way down to assembly code.  */
+  rest_of_compilation (fndecl);
 
   /* We're not deferring this any longer.  */
   DECL_DEFER_OUTPUT (fndecl) = 0;
@@ -2756,9 +2747,6 @@ output_inline_function (fndecl)
   f->inlinable = 0;
   DECL_INLINE (fndecl) = 0;
 
-  /* Compile this function all the way down to assembly code.  */
-  rest_of_compilation (fndecl);
-
   cfun = old_cfun;
   current_function_decl = old_cfun ? old_cfun->decl : 0;
 }
index b479c8443c172c75e951d1ab1e82c5280b45b6f2..8e021788903fb14f6fa3b2d324ddc7186e7bc0d5 100644 (file)
@@ -2727,7 +2727,7 @@ note_deferral_of_defined_inline_function (decl)
   /* Generate the DWARF info for the "abstract" instance of a function
      which we may later generate inlined and/or out-of-line instances
      of.  */
-  if (write_symbols == DWARF_DEBUG)
+  if (write_symbols == DWARF_DEBUG && DECL_INLINE (decl))
     {
       /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
         DWARF code expects it to be set in this case.  Intuitively,
index 189b7805c16da0289b3806aa42c6445eccdc5a59..165a87f5edeea4e2cd9d454fa8ce0f9053363cbf 100644 (file)
@@ -2567,6 +2567,7 @@ extern void save_for_inline_nocopy        PARAMS ((tree));
 extern void save_for_inline_copying    PARAMS ((tree));
 extern void set_decl_abstract_flags    PARAMS ((tree, int));
 extern void output_inline_function     PARAMS ((tree));
+extern void set_decl_origin_self       PARAMS ((tree));
 
 /* In c-lex.c */
 extern void set_yydebug                        PARAMS ((int));