vt_expand_loc unnecessarily when location is not a register nor
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
* builtins.c (get_builtin_sync_mem): Expand loc in ptr_mode,
call convert_memory_address on addr.
{
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);
{
/* Check field types. */
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>
+ PR middle-end/41837
+ * gcc.dg/pr41837.c: New test.
+
PR debug/41801
* g++.dg/ext/sync-3.C: New test.
--- /dev/null
+/* 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);
+}