1 /* Inspired by part of java/parse.y.
2 May be a real bug in CSE. */
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -Wall" } */
9 struct tree
*car
, *cdr
, *wfl
;
11 struct { unsigned int renp
:1;
13 unsigned int rpnp
:1; } flags
;
15 typedef struct tree
*tree
;
16 #define NULL_TREE ((tree)0)
21 CALL_EXPR
, NEW_ARRAY_EXPR
, NEW_CLASS_EXPR
, CONVERT_EXPR
,
22 ARRAY_REF
, CONDITIONAL_EXPR
, STRING_CST
, EXPR_WITH_FILE_LOCATION
26 #define RESOLVE_EXPRESSION_NAME_P(t) ((t)->flags.renp)
27 #define RESOLVE_TYPE_NAME_P(t) ((t)->flags.rtnp)
28 #define RESOLVE_PACKAGE_NAME_P(t) ((t)->flags.rpnp)
31 #define EXPR_WFL_QUALIFICATION(t) ((t)->wfl)
32 #define QUAL_WFL(t) ((t)->wfl)
33 #define EXPR_WFL_NODE(t) ((t)->wfl)
34 #define TREE_CODE(t) ((t)->code)
35 #define TREE_OPERAND(t,x) ((t)->car)
36 #define CLASSTYPE_SUPER(t) ((t)->car)
37 #define IDENTIFIER_LOCAL_VALUE(t) ((t)->car)
38 #define TREE_CHAIN(t) ((t)->cdr)
39 #define QUAL_RESOLUTION(t) ((t)->cdr)
41 extern tree current_class
, this_identifier_node
;
42 extern tree super_identifier_node
, length_identifier_node
;
44 tree
resolve_and_layout (tree
, tree
);
45 tree
lookup_field_wrapper (tree
, tree
);
48 qualify_ambiguous_name (id
)
51 tree qual
, qual_wfl
, decl
;
52 tree name
; /* { dg-bogus "name" "uninitialized variable warning" } */
53 tree ptr_type
; /* { dg-bogus "ptr_type" "uninitialized variable warning" } */
54 int again
, new_array_found
= 0;
55 int super_found
= 0, this_found
= 0;
57 qual
= EXPR_WFL_QUALIFICATION (id
);
59 qual_wfl
= QUAL_WFL (qual
);
60 switch (TREE_CODE (qual_wfl
))
63 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
64 if (TREE_CODE (qual_wfl
) != EXPR_WITH_FILE_LOCATION
)
66 qual
= EXPR_WFL_QUALIFICATION (qual_wfl
);
67 qual_wfl
= QUAL_WFL (qual
);
71 qual
= TREE_CHAIN (qual
);
72 new_array_found
= again
= 1;
76 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
79 while (TREE_CODE (qual_wfl
) == ARRAY_REF
)
80 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
86 name
= EXPR_WFL_NODE (qual_wfl
);
87 ptr_type
= current_class
;
92 /* If you put straightforward uses of name and ptr_type here
93 instead of the if-else sequence below, the warnings go away.
94 Therefore I suspect a real bug. */
96 if (!this_found
&& !super_found
&& (decl
= IDENTIFIER_LOCAL_VALUE (name
)))
98 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
99 QUAL_RESOLUTION (qual
) = decl
;
101 else if ((decl
= lookup_field_wrapper (ptr_type
, name
))
102 || (new_array_found
&& name
== length_identifier_node
))
104 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
105 QUAL_RESOLUTION (qual
) = (new_array_found
? NULL_TREE
: decl
);
107 else if ((decl
= resolve_and_layout (name
, NULL_TREE
)))
109 RESOLVE_TYPE_NAME_P (qual_wfl
) = 1;
110 QUAL_RESOLUTION (qual
) = decl
;
112 else if (TREE_CODE (QUAL_WFL (qual
)) == CALL_EXPR
113 || TREE_CODE (QUAL_WFL (qual
)) == ARRAY_REF
)
114 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
116 RESOLVE_PACKAGE_NAME_P (qual_wfl
) = 1;