+2020-04-29 Richard Biener <rguenther@suse.de>
+ Li Zekun <lizekun1@huawei.com>
+
+ PR lto/94822
+ * tree.c (component_ref_size): Guard against error_mark_node
+ DECL_INITIAL as it happens with LTO.
+
2020-04-29 Richard Sandiford <richard.sandiford@arm.com>
* config/aarch64/aarch64.c (aarch64_function_arg_alignment): Add a
+2020-04-29 Richard Biener <rguenther@suse.de>
+ Li Zekun <lizekun1@huawei.com>
+
+ PR lto/94822
+ * gcc.dg/lto/pr94822_0.c: New testcase.
+ * gcc.dg/lto/pr94822_1.c: Alternate file.
+ * gcc.dg/lto/pr94822.h: Likewise.
+
2020-04-29 Richard Sandiford <richard.sandiford@arm.com>
* g++.target/aarch64/no_unique_address_1.C: New test.
/* MEMBER is a true flexible array member. Compute its size from
the initializer of the BASE object if it has one. */
if (tree init = DECL_P (base) ? DECL_INITIAL (base) : NULL_TREE)
- {
- init = get_initializer_for (init, member);
- if (init)
- {
- memsize = TYPE_SIZE_UNIT (TREE_TYPE (init));
- if (tree refsize = TYPE_SIZE_UNIT (reftype))
- {
- /* Use the larger of the initializer size and the tail
- padding in the enclosing struct. */
- poly_int64 rsz = tree_to_poly_int64 (refsize);
- rsz -= baseoff;
- if (known_lt (tree_to_poly_int64 (memsize), rsz))
- memsize = wide_int_to_tree (TREE_TYPE (memsize), rsz);
- }
+ if (init != error_mark_node)
+ {
+ init = get_initializer_for (init, member);
+ if (init)
+ {
+ memsize = TYPE_SIZE_UNIT (TREE_TYPE (init));
+ if (tree refsize = TYPE_SIZE_UNIT (reftype))
+ {
+ /* Use the larger of the initializer size and the tail
+ padding in the enclosing struct. */
+ poly_int64 rsz = tree_to_poly_int64 (refsize);
+ rsz -= baseoff;
+ if (known_lt (tree_to_poly_int64 (memsize), rsz))
+ memsize = wide_int_to_tree (TREE_TYPE (memsize), rsz);
+ }
- baseoff = 0;
- }
- }
+ baseoff = 0;
+ }
+ }
if (!memsize)
{