===================================================================
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2011, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2012, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -1849,17 +1849,19 @@ potential_alignment_gap (tree prev_field
return true;
}
-/* Return a LABEL_DECL node for LABEL_NAME. */
+/* Return a LABEL_DECL with LABEL_NAME. GNAT_NODE is used for the position
+ of the decl. */
tree
-create_label_decl (tree label_name)
+create_label_decl (tree label_name, Node_Id gnat_node)
{
- tree label_decl = build_decl (input_location,
- LABEL_DECL, label_name, void_type_node);
+ tree label_decl
+ = build_decl (input_location, LABEL_DECL, label_name, void_type_node);
- DECL_CONTEXT (label_decl) = current_function_decl;
- DECL_MODE (label_decl) = VOIDmode;
- DECL_SOURCE_LOCATION (label_decl) = input_location;
+ DECL_MODE (label_decl) = VOIDmode;
+
+ /* Add this decl to the current binding level. */
+ gnat_pushdecl (label_decl, gnat_node);
return label_decl;
}
===================================================================
@@ -4619,7 +4619,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
break;
case E_Label:
- gnu_decl = create_label_decl (gnu_entity_name);
+ gnu_decl = create_label_decl (gnu_entity_name, gnat_entity);
break;
case E_Block:
===================================================================
@@ -672,8 +672,9 @@ extern tree create_field_decl (tree fiel
extern tree create_param_decl (tree param_name, tree param_type,
bool readonly);
-/* Return a LABEL_DECL node for LABEL_NAME. */
-extern tree create_label_decl (tree label_name);
+/* Return a LABEL_DECL with LABEL_NAME. GNAT_NODE is used for the position
+ of the decl. */
+extern tree create_label_decl (tree, Node_Id);
/* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
===================================================================
@@ -5881,7 +5881,8 @@ gnat_to_gnu (Node_Id gnat_node)
the next statement that the middle-end knows how to preserve. */
if (!optimize && Comes_From_Source (gnat_node))
{
- tree stmt, label = create_label_decl (NULL_TREE);
+ tree stmt, label = create_label_decl (NULL_TREE, gnat_node);
+ DECL_IGNORED_P (label) = 1;
start_stmt_group ();
stmt = build1 (GOTO_EXPR, void_type_node, label);
set_expr_location_from_node (stmt, gnat_node);