aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1997-04-13 10:59:54 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1997-04-13 10:59:54 -0400
commita68b98cf6d528a31bb5f69e7f11f25b1d7d048f0 (patch)
tree2c4d9a27b03f6f3370c75ab31b8bcc82a5ce359f
parent06140bdfa1c2a5aabd241d03e9d1bb62ad89c9c3 (diff)
downloadgcc-a68b98cf6d528a31bb5f69e7f11f25b1d7d048f0.zip
gcc-a68b98cf6d528a31bb5f69e7f11f25b1d7d048f0.tar.gz
gcc-a68b98cf6d528a31bb5f69e7f11f25b1d7d048f0.tar.bz2
(lookup_field): Don't recurse unless FIELD is a RECORD_TYPE or
UNION_TYPE. From-SVN: r13870
-rw-r--r--gcc/c-typeck.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 32d5c27..32111d0 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1,5 +1,5 @@
/* Build expressions with type checking for C compiler.
- Copyright (C) 1987, 88, 91, 92-6, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 91-6, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -1151,10 +1151,13 @@ lookup_field (type, component, indirect)
/* Step through all anon unions in linear fashion. */
while (DECL_NAME (field_array[bot]) == NULL_TREE)
{
- tree anon, junk;
+ tree anon = 0, junk;
field = field_array[bot++];
- anon = lookup_field (TREE_TYPE (field), component, &junk);
+ if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
+ || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ anon = lookup_field (TREE_TYPE (field), component, &junk);
+
if (anon != NULL_TREE)
{
*indirect = field;
@@ -1190,7 +1193,12 @@ lookup_field (type, component, indirect)
if (DECL_NAME (field) == NULL_TREE)
{
tree junk;
- tree anon = lookup_field (TREE_TYPE (field), component, &junk);
+ tree anon = 0;
+
+ if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
+ || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ anon = lookup_field (TREE_TYPE (field), component, &junk);
+
if (anon != NULL_TREE)
{
*indirect = field;