re PR ada/34098 (xgcc: Internal error: Segmentation fault (program gnat1))
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 19 Nov 2007 17:49:11 +0000 (17:49 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 19 Nov 2007 17:49:11 +0000 (17:49 +0000)
        PR ada/34098
ada/
        * misc.c (gnat_adjust_rli): Delete.
        (gnat_init): Do not initialize the translation code here.
        Do not call set_lang_adjust_rli.
        * trans.c (init_code_table): Make static.
        (gnat_init_stmt_group): Delete.
        (gigi): Initialize the translation code entirely here.
        Emit debug info for the common types here instead of...
        * utils.c (gnat_init_decl_processing): ...here.
        * gigi.h (init_code_table): Delete.
        (gnat_init_stmt_group): Likewise.

        * stor-layout.c (lang_adjust_rli): Delete.
        (set_lang_adjust_rli): Likewise.
        (layout_type): Do not call lang_adjust_rli hook.
        * tree.h (set_lang_adjust_rli): Delete.

From-SVN: r130294

gcc/ada/ChangeLog
gcc/ada/gigi.h
gcc/ada/misc.c
gcc/ada/trans.c
gcc/ada/utils.c
gcc/stor-layout.c
gcc/tree.h

index 0faaf57494685627e98794037b63796c8b6bf70d..bf19108be22ffa91a57cf64131ec1132f310ae37 100644 (file)
@@ -1,3 +1,17 @@
+2007-11-19  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR ada/34098
+       * misc.c (gnat_adjust_rli): Delete.
+       (gnat_init): Do not initialize the translation code here.
+       Do not call set_lang_adjust_rli.
+       * trans.c (init_code_table): Make static.
+       (gnat_init_stmt_group): Delete.
+       (gigi): Initialize the translation code entirely here.
+       Emit debug info for the common types here instead of...
+       * utils.c (gnat_init_decl_processing): ...here.
+       * gigi.h (init_code_table): Delete.
+       (gnat_init_stmt_group): Likewise.
+
 2007-11-16  Olivier Hainque  <hainque@adacore.com>
 
        * utils2.c (build_call_alloc_dealloc) <if gnu_obj>: Move the code
index fd7e5967904dcb0ace1cfa6a2910658c51eb6a23..f4acd146b51a37569df5eb6d0eb4049770958d5b 100644 (file)
@@ -271,10 +271,6 @@ extern void post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent,
 /* Protect EXP from multiple evaluation.  This may make a SAVE_EXPR.  */
 extern tree protect_multiple_eval (tree exp);
 
-/* Initialize the table that maps GNAT codes to GCC codes for simple
-   binary and unary operations.  */
-extern void init_code_table (void);
-
 /* Return a label to branch to for the exception type in KIND or NULL_TREE
    if none.  */
 extern tree get_exception_label (char);
@@ -455,7 +451,6 @@ extern void insert_block (tree block);
    and uses GNAT_NODE for location information.  */
 extern void gnat_pushdecl (tree decl, Node_Id gnat_node);
 
-extern void gnat_init_stmt_group (void);
 extern void gnat_init_decl_processing (void);
 extern void init_gigi_decls (tree long_long_float_type, tree exception_type);
 extern void gnat_init_gcc_eh (void);
index 03cce3a94d4826fa75c066e6a3b9ea73feb6414b..c54bd9f7b9066dff59b1827d65754eadaec80117 100644 (file)
@@ -101,7 +101,6 @@ static void gnat_parse_file         (int);
 static rtx gnat_expand_expr            (tree, rtx, enum machine_mode, int,
                                         rtx *);
 static void internal_error_function    (const char *, va_list *);
-static void gnat_adjust_rli            (record_layout_info);
 static tree gnat_type_max_size         (const_tree);
 
 /* Definitions for our language-specific hooks.  */
@@ -433,9 +432,6 @@ internal_error_function (const char *msgid, va_list *ap)
 static bool
 gnat_init (void)
 {
-  /* Initialize translations and the outer statement group.  */
-  gnat_init_stmt_group ();
-
   /* Performs whatever initialization steps needed by the language-dependent
      lexical analyzer.  */
   gnat_init_decl_processing ();
@@ -450,8 +446,6 @@ gnat_init (void)
   /* Show that REFERENCE_TYPEs are internal and should be Pmode.  */
   internal_reference_types ();
 
-  set_lang_adjust_rli (gnat_adjust_rli);
-
   return true;
 }
 
@@ -675,35 +669,6 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode,
   return expand_expr_real (new, target, tmode, modifier, alt_rtl);
 }
 
-/* Adjusts the RLI used to layout a record after all the fields have been
-   added.  We only handle the packed case and cause it to use the alignment
-   that will pad the record at the end.  */
-
-static void
-gnat_adjust_rli (record_layout_info rli ATTRIBUTE_UNUSED)
-{
-#if 0
-  /* ??? This code seems to have no actual effect; record_align should already
-     reflect the largest alignment desired by a field.  jason 2003-04-01  */
-  unsigned int record_align = rli->unpadded_align;
-  tree field;
-
-  /* If an alignment has been specified, don't use anything larger unless we
-     have to.  */
-  if (TYPE_ALIGN (rli->t) != 0 && TYPE_ALIGN (rli->t) < record_align)
-    record_align = MAX (rli->record_align, TYPE_ALIGN (rli->t));
-
-  /* If any fields have variable size, we need to force the record to be at
-     least as aligned as the alignment of that type.  */
-  for (field = TYPE_FIELDS (rli->t); field; field = TREE_CHAIN (field))
-    if (TREE_CODE (DECL_SIZE_UNIT (field)) != INTEGER_CST)
-      record_align = MAX (record_align, DECL_ALIGN (field));
-
-  if (TYPE_PACKED (rli->t))
-    rli->record_align = record_align;
-#endif
-}
-
 /* Do nothing (return the tree node passed).  */
 
 static tree
index 449f0f7fc3a0168982653631c58bea7cd2ed07fa..df6ab75bf04929c10450ad48a24bf593c12a1143 100644 (file)
@@ -181,6 +181,7 @@ static enum tree_code gnu_codes[Number_Node_Kinds];
 /* Current node being treated, in case abort called.  */
 Node_Id error_gnat_node;
 
+static void init_code_table (void);
 static void Compilation_Unit_to_gnu (Node_Id);
 static void record_code_position (Node_Id);
 static void insert_code_for (Node_Id);
@@ -269,6 +270,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
     }
 #endif
 
+  /* Initialize ourselves.  */
+  init_code_table ();
   init_gnat_to_gnu ();
   gnat_compute_largest_alignment ();
   init_dummy_type ();
@@ -281,6 +284,20 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
       TYPE_SIZE_UNIT (void_type_node) = size_zero_node;
     }
 
+  /* Enable GNAT stack checking method if needed */
+  if (!Stack_Check_Probes_On_Target)
+    set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check"));
+
+  /* Give names and make TYPE_DECLs for common types.  */
+  create_type_decl (get_identifier (SIZE_TYPE), sizetype,
+                   NULL, false, true, Empty);
+  create_type_decl (get_identifier ("integer"), integer_type_node,
+                   NULL, false, true, Empty);
+  create_type_decl (get_identifier ("unsigned char"), char_type_node,
+                   NULL, false, true, Empty);
+  create_type_decl (get_identifier ("long integer"), long_integer_type_node,
+                   NULL, false, true, Empty);
+
   /* Save the type we made for integer as the type for Standard.Integer.
      Then make the rest of the standard types.  Note that some of these
      may be subtypes.  */
@@ -313,6 +330,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
     gnat_init_gcc_eh ();
 
   gcc_assert (Nkind (gnat_root) == N_Compilation_Unit);
+  start_stmt_group ();
   Compilation_Unit_to_gnu (gnat_root);
 
   /* Now see if we have any elaboration procedures to deal with. */
@@ -361,20 +379,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
   error_gnat_node = Empty;
 }
 \f
-/* Perform initializations for this module.  */
-
-void
-gnat_init_stmt_group (void)
-{
-  /* Initialize ourselves.  */
-  init_code_table ();
-  start_stmt_group ();
-
-  /* Enable GNAT stack checking method if needed */
-  if (!Stack_Check_Probes_On_Target)
-    set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check"));
-}
-\f
 /* Returns a positive value if GNAT_NODE requires an lvalue for an
    operand of OPERAND_TYPE, whose aliasing is specified by ALIASED,
    zero otherwise.  This is int instead of bool to facilitate usage
@@ -6763,7 +6767,7 @@ post_error_ne_tree_2 (const char *msg,
 /* Initialize the table that maps GNAT codes to GCC codes for simple
    binary and unary operations.  */
 
-void
+static void
 init_code_table (void)
 {
   gnu_codes[N_And_Then] = TRUTH_ANDIF_EXPR;
index 77be01dc6d91d7ba11c2fcd049e0fc5768866895..9fed4a9cb5eaa335bdaf981898f6278408851abd 100644 (file)
@@ -495,16 +495,6 @@ gnat_init_decl_processing (void)
   set_sizetype (size_type_node);
   build_common_tree_nodes_2 (0);
 
-  /* Give names and make TYPE_DECLs for common types.  */
-  create_type_decl (get_identifier (SIZE_TYPE), sizetype,
-                   NULL, false, true, Empty);
-  create_type_decl (get_identifier ("integer"), integer_type_node,
-                   NULL, false, true, Empty);
-  create_type_decl (get_identifier ("unsigned char"), char_type_node,
-                   NULL, false, true, Empty);
-  create_type_decl (get_identifier ("long integer"), long_integer_type_node,
-                   NULL, false, true, Empty);
-
   ptr_void_type_node = build_pointer_type (void_type_node);
 
   gnat_install_builtins ();
index 23e0cf5549e146c1539859e47340f40521c20f68..1ae2db5ca002730d3f12c0bd64d8aba5fc65f974 100644 (file)
@@ -496,17 +496,6 @@ relayout_decl (tree decl)
   layout_decl (decl, 0);
 }
 \f
-/* Hook for a front-end function that can modify the record layout as needed
-   immediately before it is finalized.  */
-
-static void (*lang_adjust_rli) (record_layout_info) = 0;
-
-void
-set_lang_adjust_rli (void (*f) (record_layout_info))
-{
-  lang_adjust_rli = f;
-}
-
 /* Begin laying out type T, which may be a RECORD_TYPE, UNION_TYPE, or
    QUAL_UNION_TYPE.  Return a pointer to a struct record_layout_info which
    is to be passed to all other layout functions for this record.  It is the
@@ -1866,9 +1855,6 @@ layout_type (tree type)
        if (TREE_CODE (type) == QUAL_UNION_TYPE)
          TYPE_FIELDS (type) = nreverse (TYPE_FIELDS (type));
 
-       if (lang_adjust_rli)
-         (*lang_adjust_rli) (rli);
-
        /* Finish laying out the record.  */
        finish_record_layout (rli, /*free_p=*/true);
       }
index 0fb68ed7fd9e2a947383ae7e809ac8774f5a449d..75702ec060668a4bd7a7a1559cb2c3e53fe85dff 100644 (file)
@@ -4274,7 +4274,6 @@ typedef struct record_layout_info_s
   int packed_maybe_necessary;
 } *record_layout_info;
 
-extern void set_lang_adjust_rli (void (*) (record_layout_info));
 extern record_layout_info start_record_layout (tree);
 extern tree bit_from_pos (tree, tree);
 extern tree byte_from_pos (tree, tree);