]>
Commit | Line | Data |
---|---|---|
86b33565 PS |
1 | --- gcc/gcc/ada/trans.c (revision 107434) |
2 | +++ gcc/gcc/ada/trans.c (working copy) | |
3 | @@ -4570,7 +4570,6 @@ int | |
4 | gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED) | |
5 | { | |
6 | tree expr = *expr_p; | |
7 | - tree op; | |
8 | ||
9 | if (IS_ADA_STMT (expr)) | |
10 | return gnat_gimplify_stmt (expr_p); | |
11 | @@ -4600,53 +4599,6 @@ gnat_gimplify_expr (tree *expr_p, tree * | |
12 | *expr_p = TREE_OPERAND (*expr_p, 0); | |
13 | return GS_OK; | |
14 | ||
15 | - case ADDR_EXPR: | |
16 | - op = TREE_OPERAND (expr, 0); | |
17 | - | |
18 | - /* If we're taking the address of a constant CONSTRUCTOR, force it to | |
19 | - be put into static memory. We know it's going to be readonly given | |
20 | - the semantics we have and it's required to be static memory in | |
21 | - the case when the reference is in an elaboration procedure. */ | |
22 | - if (TREE_CODE (op) == CONSTRUCTOR && TREE_CONSTANT (op)) | |
23 | - { | |
24 | - tree new_var = create_tmp_var (TREE_TYPE (op), "C"); | |
25 | - | |
26 | - TREE_READONLY (new_var) = 1; | |
27 | - TREE_STATIC (new_var) = 1; | |
28 | - TREE_ADDRESSABLE (new_var) = 1; | |
29 | - DECL_INITIAL (new_var) = op; | |
30 | - | |
31 | - TREE_OPERAND (expr, 0) = new_var; | |
32 | - recompute_tree_invarant_for_addr_expr (expr); | |
33 | - return GS_ALL_DONE; | |
34 | - } | |
35 | - | |
36 | - /* Otherwise, if we are taking the address of something that is neither | |
37 | - reference, declaration, or constant, make a variable for the operand | |
38 | - here and then take its address. If we don't do it this way, we may | |
39 | - confuse the gimplifier because it needs to know the variable is | |
40 | - addressable at this point. This duplicates code in | |
41 | - internal_get_tmp_var, which is unfortunate. */ | |
42 | - else if (TREE_CODE_CLASS (TREE_CODE (op)) != tcc_reference | |
43 | - && TREE_CODE_CLASS (TREE_CODE (op)) != tcc_declaration | |
44 | - && TREE_CODE_CLASS (TREE_CODE (op)) != tcc_constant) | |
45 | - { | |
46 | - tree new_var = create_tmp_var (TREE_TYPE (op), "A"); | |
47 | - tree mod = build (MODIFY_EXPR, TREE_TYPE (op), new_var, op); | |
48 | - | |
49 | - TREE_ADDRESSABLE (new_var) = 1; | |
50 | - | |
51 | - if (EXPR_HAS_LOCATION (op)) | |
52 | - SET_EXPR_LOCUS (mod, EXPR_LOCUS (op)); | |
53 | - | |
54 | - gimplify_and_add (mod, pre_p); | |
55 | - TREE_OPERAND (expr, 0) = new_var; | |
56 | - recompute_tree_invarant_for_addr_expr (expr); | |
57 | - return GS_ALL_DONE; | |
58 | - } | |
59 | - | |
60 | - return GS_UNHANDLED; | |
61 | - | |
62 | case COMPONENT_REF: | |
63 | /* We have a kludge here. If the FIELD_DECL is from a fat pointer and is | |
64 | from an early dummy type, replace it with the proper FIELD_DECL. */ | |
65 | @@ -5436,7 +5388,6 @@ addressable_p (tree gnu_expr) | |
66 | ||
67 | case UNCONSTRAINED_ARRAY_REF: | |
68 | case INDIRECT_REF: | |
69 | - case CONSTRUCTOR: | |
70 | case NULL_EXPR: | |
71 | case SAVE_EXPR: | |
72 | return true; | |
73 | --- gcc/gcc/ada/utils2.c (revision 107414) | |
74 | +++ gcc/gcc/ada/utils2.c (working copy) | |
75 | @@ -45,6 +45,8 @@ | |
76 | #include "einfo.h" | |
77 | #include "ada-tree.h" | |
78 | #include "gigi.h" | |
79 | +#include "tree-gimple.h" | |
80 | +#include "toplev.h" | |
81 | ||
82 | static tree find_common_type (tree, tree); | |
83 | static bool contains_save_expr_p (tree); | |
84 | @@ -998,6 +1000,7 @@ build_unary_op (enum tree_code op_code, | |
85 | tree operation_type = result_type; | |
86 | tree result; | |
87 | bool side_effects = false; | |
88 | + tree before = NULL; | |
89 | ||
90 | if (operation_type | |
91 | && TREE_CODE (operation_type) == RECORD_TYPE | |
92 | @@ -1116,6 +1119,22 @@ build_unary_op (enum tree_code op_code, | |
93 | result); | |
94 | break; | |
95 | } | |
96 | + else | |
97 | + { | |
98 | + /* Create a temporary variable to hold the CONSTRUCTON. */ | |
99 | + tree new_var = create_tmp_var_raw (type, "C"); | |
100 | + TREE_ADDRESSABLE (new_var) = 1; | |
101 | + TREE_READONLY (new_var) = 1; | |
102 | + if (global_bindings_p ()) | |
103 | + TREE_STATIC (new_var) = 1; | |
104 | + DECL_INITIAL (new_var) = operand; | |
105 | + gnat_pushdecl (new_var, Empty); | |
106 | + if (global_bindings_p ()) | |
107 | + rest_of_decl_compilation (new_var, 1, 0); | |
108 | + else | |
109 | + before = build1 (DECL_EXPR, void_type_node, new_var); | |
110 | + operand = new_var; | |
111 | + } | |
112 | ||
113 | goto common; | |
114 | ||
115 | @@ -1170,6 +1189,9 @@ build_unary_op (enum tree_code op_code, | |
116 | } | |
117 | ||
118 | TREE_CONSTANT (result) = staticp (operand) || TREE_CONSTANT (operand); | |
119 | + if (before) | |
120 | + result = build2 (COMPOUND_EXPR, TREE_TYPE (result), before, | |
121 | + result); | |
122 | break; | |
123 | ||
124 | case INDIRECT_REF: | |
125 | @@ -2003,10 +2025,6 @@ gnat_mark_addressable (tree expr_node) | |
126 | expr_node = TREE_OPERAND (expr_node, 0); | |
127 | break; | |
128 | ||
129 | - case CONSTRUCTOR: | |
130 | - TREE_ADDRESSABLE (expr_node) = 1; | |
131 | - return true; | |
132 | - | |
133 | case VAR_DECL: | |
134 | case PARM_DECL: | |
135 | case RESULT_DECL: | |
05786948 PS |
136 | --- gcc/gcc/ada/Makefile.in.orig 2005-11-23 16:48:27.000000000 +0000 |
137 | +++ gcc/gcc/ada/Makefile.in 2005-11-24 10:14:25.987115520 +0000 | |
138 | @@ -1899,6 +1899,12 @@ | |
139 | $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 $(ADA_INCLUDES) \ | |
140 | $< $(OUTPUT_OPTION) | |
141 | ||
142 | +# [Bug ada/22533] [4.1/4.2 regression] Ada ICE during bootstrap on many platforms | |
143 | + | |
144 | +make.o : make.adb make.ads | |
145 | + $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 $(ADA_INCLUDES) \ | |
146 | + $< $(OUTPUT_OPTION) | |
147 | + | |
148 | adadecode.o : adadecode.c adadecode.h | |
149 | aux-io.o : aux-io.c | |
150 | argv.o : argv.c |