aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorQing Zhao <qing.zhao@oracle.com>2023-06-29 17:07:08 +0000
committerQing Zhao <qing.zhao@oracle.com>2023-06-29 17:13:09 +0000
commit3967da96556163d78cbeafe342c16b820aa85799 (patch)
treefb68c4f2731df7d84d6b05e1a826f6a5d09d2654 /gcc/lto
parent6a1cf0d0d9cbf79f30aa5d76bca19615f12ea57f (diff)
downloadgcc-3967da96556163d78cbeafe342c16b820aa85799.zip
gcc-3967da96556163d78cbeafe342c16b820aa85799.tar.gz
gcc-3967da96556163d78cbeafe342c16b820aa85799.tar.bz2
Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension
on a structure with a C99 flexible array member being nested in another structure GCC extension accepts the case when a struct with a flexible array member is embedded into another struct or union (possibly recursively) as the last field. This patch is to introduce the IR bit TYPE_INCLUDES_FLEXARRAY (reuse the existing IR bit TYPE_NO_NAMED_ARGS_SATDARG_P), set it correctly in C FE, stream it correctly in Middle-end, and print it during IR dumping. gcc/c/ChangeLog: * c-decl.cc (finish_struct): Set TYPE_INCLUDES_FLEXARRAY for struct/union type. gcc/lto/ChangeLog: * lto-common.cc (compare_tree_sccs_1): Compare bit TYPE_NO_NAMED_ARGS_STDARG_P or TYPE_INCLUDES_FLEXARRAY properly for its corresponding type. gcc/ChangeLog: * print-tree.cc (print_node): Print new bit type_include_flexarray. * tree-core.h (struct tree_type_common): Use bit no_named_args_stdarg_p as type_include_flexarray for RECORD_TYPE or UNION_TYPE. * tree-streamer-in.cc (unpack_ts_type_common_value_fields): Stream in bit no_named_args_stdarg_p properly for its corresponding type. * tree-streamer-out.cc (pack_ts_type_common_value_fields): Stream out bit no_named_args_stdarg_p properly for its corresponding type. * tree.h (TYPE_INCLUDES_FLEXARRAY): New macro TYPE_INCLUDES_FLEXARRAY.
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/lto-common.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
index afe051e..97105c9 100644
--- a/gcc/lto/lto-common.cc
+++ b/gcc/lto/lto-common.cc
@@ -1275,7 +1275,10 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
if (AGGREGATE_TYPE_P (t1))
compare_values (TYPE_TYPELESS_STORAGE);
compare_values (TYPE_EMPTY_P);
- compare_values (TYPE_NO_NAMED_ARGS_STDARG_P);
+ if (FUNC_OR_METHOD_TYPE_P (t1))
+ compare_values (TYPE_NO_NAMED_ARGS_STDARG_P);
+ if (RECORD_OR_UNION_TYPE_P (t1))
+ compare_values (TYPE_INCLUDES_FLEXARRAY);
compare_values (TYPE_PACKED);
compare_values (TYPE_RESTRICT);
compare_values (TYPE_USER_ALIGN);