OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [uninit-A-O0.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Inspired by part of java/parse.y.
2
   May be a real bug in CSE. */
3
 
4
/* { dg-do compile } */
5
/* { dg-options "-Wall" } */
6
 
7
struct tree
8
{
9
    struct tree *car, *cdr, *wfl;
10
    int code;
11
    struct { unsigned int renp:1;
12
      unsigned int rtnp:1;
13
      unsigned int rpnp:1; } flags;
14
};
15
typedef struct tree *tree;
16
#define NULL_TREE ((tree)0)
17
 
18
/* Codes */
19
enum
20
{
21
    CALL_EXPR, NEW_ARRAY_EXPR, NEW_CLASS_EXPR, CONVERT_EXPR,
22
    ARRAY_REF, CONDITIONAL_EXPR, STRING_CST, EXPR_WITH_FILE_LOCATION
23
};
24
 
25
/* Flags */
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)
29
 
30
/* Macros */
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)
40
 
41
extern tree current_class, this_identifier_node;
42
extern tree super_identifier_node, length_identifier_node;
43
 
44
tree resolve_and_layout (tree, tree);
45
tree lookup_field_wrapper (tree, tree);
46
 
47
void
48
qualify_ambiguous_name (id)
49
     tree id;
50
{
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;
56
 
57
  qual = EXPR_WFL_QUALIFICATION (id);
58
  do {
59
    qual_wfl = QUAL_WFL (qual);
60
    switch (TREE_CODE (qual_wfl))
61
      {
62
      case CALL_EXPR:
63
        qual_wfl = TREE_OPERAND (qual_wfl, 0);
64
        if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
65
          {
66
            qual = EXPR_WFL_QUALIFICATION (qual_wfl);
67
            qual_wfl = QUAL_WFL (qual);
68
          }
69
        break;
70
      case NEW_ARRAY_EXPR:
71
        qual = TREE_CHAIN (qual);
72
        new_array_found = again = 1;
73
        continue;
74
      case NEW_CLASS_EXPR:
75
      case CONVERT_EXPR:
76
        qual_wfl = TREE_OPERAND (qual_wfl, 0);
77
        break;
78
      case ARRAY_REF:
79
        while (TREE_CODE (qual_wfl) == ARRAY_REF)
80
          qual_wfl = TREE_OPERAND (qual_wfl, 0);
81
        break;
82
      default:
83
        break;
84
      }
85
 
86
    name = EXPR_WFL_NODE (qual_wfl);
87
    ptr_type = current_class;
88
    again = 0;
89
 
90
  } while (again);
91
 
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. */
95
 
96
  if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
97
    {
98
      RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
99
      QUAL_RESOLUTION (qual) = decl;
100
    }
101
  else if ((decl = lookup_field_wrapper (ptr_type, name))
102
           || (new_array_found && name == length_identifier_node))
103
    {
104
      RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
105
      QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
106
    }
107
  else if ((decl = resolve_and_layout (name, NULL_TREE)))
108
    {
109
      RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
110
      QUAL_RESOLUTION (qual) = decl;
111
    }
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;
115
  else
116
    RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
117
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.