Commit a1c65695 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/41837 (Using '-O -fipa-struct-reorg -fwhole-program…

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
parent f46835f5
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
vt_expand_loc unnecessarily when location is not a register nor vt_expand_loc unnecessarily when location is not a register nor
memory. memory.
PR middle-end/41837
* ipa-struct-reorg.c (find_field_in_struct_1): Return NULL if
fields don't have DECL_NAME.
PR debug/41801 PR debug/41801
* builtins.c (get_builtin_sync_mem): Expand loc in ptr_mode, * builtins.c (get_builtin_sync_mem): Expand loc in ptr_mode,
call convert_memory_address on addr. call convert_memory_address on addr.
...@@ -258,15 +258,21 @@ find_field_in_struct_1 (tree str_type, tree field) ...@@ -258,15 +258,21 @@ find_field_in_struct_1 (tree str_type, tree field)
{ {
tree str_field; tree str_field;
if (!DECL_NAME (field))
return NULL;
for (str_field = TYPE_FIELDS (str_type); str_field; for (str_field = TYPE_FIELDS (str_type); str_field;
str_field = TREE_CHAIN (str_field)) str_field = TREE_CHAIN (str_field))
{ {
const char * str_field_name; const char *str_field_name;
const char * field_name; const char *field_name;
if (!DECL_NAME (str_field))
continue;
str_field_name = IDENTIFIER_POINTER (DECL_NAME (str_field)); str_field_name = IDENTIFIER_POINTER (DECL_NAME (str_field));
field_name = IDENTIFIER_POINTER (DECL_NAME (field)); field_name = IDENTIFIER_POINTER (DECL_NAME (field));
gcc_assert (str_field_name); gcc_assert (str_field_name);
gcc_assert (field_name); gcc_assert (field_name);
...@@ -274,7 +280,7 @@ find_field_in_struct_1 (tree str_type, tree field) ...@@ -274,7 +280,7 @@ find_field_in_struct_1 (tree str_type, tree field)
{ {
/* Check field types. */ /* Check field types. */
if (is_equal_types (TREE_TYPE (str_field), TREE_TYPE (field))) if (is_equal_types (TREE_TYPE (str_field), TREE_TYPE (field)))
return str_field; return str_field;
} }
} }
......
2009-10-28 Jakub Jelinek <jakub@redhat.com> 2009-10-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/41837
* gcc.dg/pr41837.c: New test.
PR debug/41801 PR debug/41801
* g++.dg/ext/sync-3.C: New test. * g++.dg/ext/sync-3.C: New test.
......
/* PR middle-end/41837 */
/* { dg-do compile } */
/* { dg-options "-fipa-struct-reorg -O -fwhole-program -fprofile-generate" } */
typedef struct { int a, b; } T1;
typedef struct S1 *T2;
typedef struct S2 *T3;
typedef struct S3 *T4;
typedef struct S4 *T5;
struct S4 { union { int c; } d; };
struct S2 { int e; T2 f; int g; };
typedef struct { T3 h; } T6;
typedef struct { int i; } *T7;
struct S3 { T6 j; T7 k; };
void
f1 (T4 x)
{
if (!x->j.h->e)
f5 (x);
}
void
f2 (void)
{
f6 (f1);
}
void
f3 (T5 x, T1 *y)
{
}
void
f4 (void)
{
f7 (f3);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment