aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-struct-reorg.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-10-28 15:45:03 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-10-28 15:45:03 +0100
commita1c6569544feb45d1fffff211a7970a8069d8c34 (patch)
treee0feaa9d7b18ec6d15d20b0f9b34f2eed1395296 /gcc/ipa-struct-reorg.c
parentf46835f5ad524deb0ad74cefb74b0494544f59c2 (diff)
downloadgcc-a1c6569544feb45d1fffff211a7970a8069d8c34.zip
gcc-a1c6569544feb45d1fffff211a7970a8069d8c34.tar.gz
gcc-a1c6569544feb45d1fffff211a7970a8069d8c34.tar.bz2
re PR middle-end/41837 (Using '-O -fipa-struct-reorg -fwhole-program -fprofile-generate' gives 'internal compiler error: Segmentation fault')
PR middle-end/41837 * ipa-struct-reorg.c (find_field_in_struct_1): Return NULL if fields don't have DECL_NAME. * gcc.dg/pr41837.c: New test. From-SVN: r153670
Diffstat (limited to 'gcc/ipa-struct-reorg.c')
-rw-r--r--gcc/ipa-struct-reorg.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index bc84eee..7b05bf6 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -258,15 +258,21 @@ find_field_in_struct_1 (tree str_type, tree field)
{
tree str_field;
+ if (!DECL_NAME (field))
+ return NULL;
+
for (str_field = TYPE_FIELDS (str_type); str_field;
str_field = TREE_CHAIN (str_field))
{
- const char * str_field_name;
- const char * field_name;
+ const char *str_field_name;
+ const char *field_name;
+
+ if (!DECL_NAME (str_field))
+ continue;
str_field_name = IDENTIFIER_POINTER (DECL_NAME (str_field));
field_name = IDENTIFIER_POINTER (DECL_NAME (field));
-
+
gcc_assert (str_field_name);
gcc_assert (field_name);
@@ -274,7 +280,7 @@ find_field_in_struct_1 (tree str_type, tree field)
{
/* Check field types. */
if (is_equal_types (TREE_TYPE (str_field), TREE_TYPE (field)))
- return str_field;
+ return str_field;
}
}