aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-10-27 08:47:25 -0700
committerIan Lance Taylor <iant@golang.org>2021-10-27 08:47:25 -0700
commita6d3012b274f38b20e2a57162106f625746af6c6 (patch)
tree09ff8b13eb8ff7594c27dc8812efbf696dc97484 /gcc/c-family
parentcd2fd5facb5e1882d3f338ed456ae9536f7c0593 (diff)
parent99b1021d21e5812ed01221d8fca8e8a32488a934 (diff)
downloadgcc-a6d3012b274f38b20e2a57162106f625746af6c6.zip
gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.gz
gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.bz2
Merge from trunk revision 99b1021d21e5812ed01221d8fca8e8a32488a934.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog37
-rw-r--r--gcc/c-family/c-common.h4
-rw-r--r--gcc/c-family/c-format.c27
-rw-r--r--gcc/c-family/c-format.h14
-rw-r--r--gcc/c-family/c-omp.c225
-rw-r--r--gcc/c-family/c-opts.c6
6 files changed, 142 insertions, 171 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index c3ee247..9044f66 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,40 @@
+2021-10-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/64888
+ * c-omp.c (c_omp_predefined_variable): Return true also for
+ ubsan_create_data created artificial variables.
+
+2021-10-14 Joseph Myers <joseph@codesourcery.com>
+
+ * c-format.c (printf_length_specs, scanf_length_specs)
+ (print_char_table, scan_char_table): Support DFP formats for C2X.
+ * c-format.h (TEX_D32, TEX_D64, TEX_D128): Remove.
+ (T2X_D32, T2X_D64, T2X_D128): New macros.
+
+2021-10-14 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * c-omp.c (c_omp_check_context_selector): Rename to
+ omp_check_context_selector and move to omp-general.c.
+ (c_omp_mark_declare_variant): Rename to omp_mark_declare_variant and
+ move to omp-general.c.
+
+2021-10-12 Joseph Myers <joseph@codesourcery.com>
+
+ * c-format.c (print_char_table): Add %b and %B formats.
+ (scan_char_table): Add %b format.
+ * c-format.h (T2X_UI, T2X_UL, T2X_ULL, T2X_US, T2X_UC, T2X_ST)
+ (T2X_UPD, T2X_UIM): New macros.
+
+2021-10-12 Jakub Jelinek <jakub@redhat.com>
+
+ * c-omp.c (c_finish_omp_atomic): Use
+ clear_padding_type_may_have_padding_p.
+
+2021-10-08 Martin Liska <mliska@suse.cz>
+
+ * c-opts.c (c_common_post_options): Use new macro
+ OPTION_SET_P.
+
2021-10-07 Martin Liska <mliska@suse.cz>
* c-common.c (parse_optimize_options): Make
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 078730f..f60714e 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1234,8 +1234,8 @@ extern void c_finish_omp_taskyield (location_t);
extern tree c_finish_omp_for (location_t, enum tree_code, tree, tree, tree,
tree, tree, tree, tree, bool);
extern bool c_omp_check_loop_iv (tree, tree, walk_tree_lh);
-extern bool c_omp_check_loop_iv_exprs (location_t, tree, int, tree, tree, tree,
- walk_tree_lh);
+extern bool c_omp_check_loop_iv_exprs (location_t, enum tree_code, tree, int,
+ tree, tree, tree, walk_tree_lh);
extern tree c_finish_oacc_wait (location_t, tree, tree);
extern tree c_oacc_split_loop_clauses (tree, tree *, bool);
extern void c_omp_split_clauses (location_t, enum tree_code, omp_clause_mask,
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index ca66c81..e735e09 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -493,8 +493,8 @@ static const format_length_info printf_length_specs[] =
{ "Z", FMT_LEN_z, STD_EXT, NO_FMT, 0 },
{ "t", FMT_LEN_t, STD_C99, NO_FMT, 0 },
{ "j", FMT_LEN_j, STD_C99, NO_FMT, 0 },
- { "H", FMT_LEN_H, STD_EXT, NO_FMT, 0 },
- { "D", FMT_LEN_D, STD_EXT, "DD", FMT_LEN_DD, STD_EXT, 0 },
+ { "H", FMT_LEN_H, STD_C2X, NO_FMT, 0 },
+ { "D", FMT_LEN_D, STD_C2X, "DD", FMT_LEN_DD, STD_C2X, 0 },
{ NO_FMT, NO_FMT, 0 }
};
@@ -530,8 +530,8 @@ static const format_length_info scanf_length_specs[] =
{ "z", FMT_LEN_z, STD_C99, NO_FMT, 0 },
{ "t", FMT_LEN_t, STD_C99, NO_FMT, 0 },
{ "j", FMT_LEN_j, STD_C99, NO_FMT, 0 },
- { "H", FMT_LEN_H, STD_EXT, NO_FMT, 0 },
- { "D", FMT_LEN_D, STD_EXT, "DD", FMT_LEN_DD, STD_EXT, 0 },
+ { "H", FMT_LEN_H, STD_C2X, NO_FMT, 0 },
+ { "D", FMT_LEN_D, STD_C2X, "DD", FMT_LEN_DD, STD_C2X, 0 },
{ NO_FMT, NO_FMT, 0 }
};
@@ -703,20 +703,23 @@ static const format_char_info print_char_table[] =
{ "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "-wp0 +'I", "i", NULL },
{ "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0#", "i", NULL },
{ "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0'I", "i", NULL },
- { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "-wp0 +#'I", "", NULL },
- { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "-wp0 +#I", "", NULL },
+ { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL },
+ { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#I", "", NULL },
{ "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
{ "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
{ "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL },
{ "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL },
/* C99 conversion specifiers. */
- { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "-wp0 +#'I", "", NULL },
- { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "-wp0 +#", "", NULL },
+ { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL },
+ { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#", "", NULL },
+ /* C2X conversion specifiers. */
+ { "b", 0, STD_C2X, { T2X_UI, T2X_UC, T2X_US, T2X_UL, T2X_ULL, TEX_ULL, T2X_ST, T2X_UPD, T2X_UIM, BADLEN, BADLEN, BADLEN }, "-wp0#", "i", NULL },
/* X/Open conversion specifiers. */
{ "C", 0, STD_EXT, { TEX_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
{ "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL },
/* GNU conversion specifiers. */
{ "m", 0, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", NULL },
+ { "B", 0, STD_EXT, { T2X_UI, T2X_UC, T2X_US, T2X_UL, T2X_ULL, TEX_ULL, T2X_ST, T2X_UPD, T2X_UIM, BADLEN, BADLEN, BADLEN }, "-wp0#", "i", NULL },
{ NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
};
@@ -867,15 +870,17 @@ static const format_char_info scan_char_table[] =
{ "di", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "*w'I", "W", NULL },
{ "u", 1, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "*w'I", "W", NULL },
{ "oxX", 1, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL },
- { "efgEG", 1, STD_C89, { T89_F, BADLEN, BADLEN, T89_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "*w'", "W", NULL },
+ { "efgEG", 1, STD_C89, { T89_F, BADLEN, BADLEN, T89_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "*w'", "W", NULL },
{ "c", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*mw", "cW", NULL },
{ "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*amw", "cW", NULL },
{ "[", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*amw", "cW[", NULL },
{ "p", 2, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL },
{ "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL },
/* C99 conversion specifiers. */
- { "F", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "*w'", "W", NULL },
- { "aA", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "*w'", "W", NULL },
+ { "F", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "*w'", "W", NULL },
+ { "aA", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "*w'", "W", NULL },
+ /* C2X conversion specifiers. */
+ { "b", 1, STD_C2X, { T2X_UI, T2X_UC, T2X_US, T2X_UL, T2X_ULL, TEX_ULL, T2X_ST, T2X_UPD, T2X_UIM, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL },
/* X/Open conversion specifiers. */
{ "C", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*mw", "W", NULL },
{ "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*amw", "W", NULL },
diff --git a/gcc/c-family/c-format.h b/gcc/c-family/c-format.h
index 2f926f4..dfa1e11 100644
--- a/gcc/c-family/c-format.h
+++ b/gcc/c-family/c-format.h
@@ -278,13 +278,17 @@ struct format_kind_info
#define T89_S { STD_C89, NULL, T_S }
#define T_UI &unsigned_type_node
#define T89_UI { STD_C89, NULL, T_UI }
+#define T2X_UI { STD_C2X, NULL, T_UI }
#define T_UL &long_unsigned_type_node
#define T89_UL { STD_C89, NULL, T_UL }
+#define T2X_UL { STD_C2X, NULL, T_UL }
#define T_ULL &long_long_unsigned_type_node
#define T9L_ULL { STD_C9L, NULL, T_ULL }
+#define T2X_ULL { STD_C2X, NULL, T_ULL }
#define TEX_ULL { STD_EXT, NULL, T_ULL }
#define T_US &short_unsigned_type_node
#define T89_US { STD_C89, NULL, T_US }
+#define T2X_US { STD_C2X, NULL, T_US }
#define T_F &float_type_node
#define T89_F { STD_C89, NULL, T_F }
#define T99_F { STD_C99, NULL, T_F }
@@ -300,6 +304,7 @@ struct format_kind_info
#define T99_SC { STD_C99, NULL, T_SC }
#define T_UC &unsigned_char_type_node
#define T99_UC { STD_C99, NULL, T_UC }
+#define T2X_UC { STD_C2X, NULL, T_UC }
#define T_V &void_type_node
#define T89_G { STD_C89, NULL, &local_gimple_ptr_node }
#define T_CGRAPH_NODE { STD_C89, NULL, &local_cgraph_node_ptr_node }
@@ -314,22 +319,25 @@ struct format_kind_info
#define TEX_WI { STD_EXT, "wint_t", T_WI }
#define T_ST &size_type_node
#define T99_ST { STD_C99, "size_t", T_ST }
+#define T2X_ST { STD_C2X, "size_t", T_ST }
#define T_SST &signed_size_type_node
#define T99_SST { STD_C99, "signed size_t", T_SST }
#define T_PD &ptrdiff_type_node
#define T99_PD { STD_C99, "ptrdiff_t", T_PD }
#define T_UPD &unsigned_ptrdiff_type_node
#define T99_UPD { STD_C99, "unsigned ptrdiff_t", T_UPD }
+#define T2X_UPD { STD_C2X, "unsigned ptrdiff_t", T_UPD }
#define T_IM &intmax_type_node
#define T99_IM { STD_C99, "intmax_t", T_IM }
#define T_UIM &uintmax_type_node
#define T99_UIM { STD_C99, "uintmax_t", T_UIM }
+#define T2X_UIM { STD_C2X, "uintmax_t", T_UIM }
#define T_D32 &dfloat32_type_node
-#define TEX_D32 { STD_EXT, "_Decimal32", T_D32 }
+#define T2X_D32 { STD_C2X, "_Decimal32", T_D32 }
#define T_D64 &dfloat64_type_node
-#define TEX_D64 { STD_EXT, "_Decimal64", T_D64 }
+#define T2X_D64 { STD_C2X, "_Decimal64", T_D64 }
#define T_D128 &dfloat128_type_node
-#define TEX_D128 { STD_EXT, "_Decimal128", T_D128 }
+#define T2X_D128 { STD_C2X, "_Decimal128", T_D128 }
/* Structure describing how format attributes such as "printf" are
interpreted as "gnu_printf" or "ms_printf" on a particular system.
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index d8b9855..fad0606 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -381,7 +381,9 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
bool clear_padding = false;
HOST_WIDE_INT non_padding_start = 0;
HOST_WIDE_INT non_padding_end = 0;
- if (BITS_PER_UNIT == 8 && CHAR_BIT == 8)
+ if (BITS_PER_UNIT == 8
+ && CHAR_BIT == 8
+ && clear_padding_type_may_have_padding_p (cmptype))
{
HOST_WIDE_INT sz = int_size_in_bytes (cmptype), i;
gcc_assert (sz > 0);
@@ -1351,6 +1353,20 @@ c_omp_check_loop_iv_r (tree *tp, int *walk_subtrees, void *data)
}
d->fail = true;
}
+ else if ((d->kind & 4)
+ && TREE_CODE (*tp) != TREE_VEC
+ && TREE_CODE (*tp) != PLUS_EXPR
+ && TREE_CODE (*tp) != MINUS_EXPR
+ && TREE_CODE (*tp) != MULT_EXPR
+ && TREE_CODE (*tp) != POINTER_PLUS_EXPR
+ && !CONVERT_EXPR_P (*tp))
+ {
+ *walk_subtrees = 0;
+ d->kind &= 3;
+ walk_tree_1 (tp, c_omp_check_loop_iv_r, data, NULL, d->lh);
+ d->kind |= 4;
+ return NULL_TREE;
+ }
else if (d->ppset->add (*tp))
*walk_subtrees = 0;
/* Don't walk dtors added by C++ wrap_cleanups_r. */
@@ -1462,6 +1478,18 @@ c_omp_check_nonrect_loop_iv (tree *tp, struct c_omp_check_loop_iv_data *d,
}
a2 = integer_zero_node;
break;
+ case POINTER_PLUS_EXPR:
+ a1 = TREE_OPERAND (t, 0);
+ a2 = TREE_OPERAND (t, 1);
+ while (CONVERT_EXPR_P (a1))
+ a1 = TREE_OPERAND (a1, 0);
+ if (DECL_P (a1) && c_omp_is_loop_iterator (a1, d) >= 0)
+ {
+ a2 = TREE_OPERAND (t, 1);
+ t = a1;
+ break;
+ }
+ break;
default:
break;
}
@@ -1584,10 +1612,7 @@ c_omp_check_loop_iv (tree stmt, tree declv, walk_tree_lh lh)
data.fail = true;
}
/* Handle non-rectangular loop nests. */
- if (TREE_CODE (stmt) != OACC_LOOP
- && (TREE_CODE (TREE_OPERAND (init, 1)) == TREE_VEC
- || INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (init, 1))))
- && i > 0)
+ if (TREE_CODE (stmt) != OACC_LOOP && i > 0)
kind = 4;
data.kind = kind;
data.idx = i;
@@ -1649,11 +1674,13 @@ c_omp_check_loop_iv (tree stmt, tree declv, walk_tree_lh lh)
/* Similar, but allows to check the init or cond expressions individually. */
bool
-c_omp_check_loop_iv_exprs (location_t stmt_loc, tree declv, int i, tree decl,
- tree init, tree cond, walk_tree_lh lh)
+c_omp_check_loop_iv_exprs (location_t stmt_loc, enum tree_code code,
+ tree declv, int i, tree decl, tree init, tree cond,
+ walk_tree_lh lh)
{
hash_set<tree> pset;
struct c_omp_check_loop_iv_data data;
+ int kind = (code != OACC_LOOP && i > 0) ? 4 : 0;
data.declv = declv;
data.fail = false;
@@ -1672,7 +1699,7 @@ c_omp_check_loop_iv_exprs (location_t stmt_loc, tree declv, int i, tree decl,
if (init)
{
data.expr_loc = EXPR_LOCATION (init);
- data.kind = 0;
+ data.kind = kind;
walk_tree_1 (&init,
c_omp_check_loop_iv_r, &data, NULL, lh);
}
@@ -1680,7 +1707,7 @@ c_omp_check_loop_iv_exprs (location_t stmt_loc, tree declv, int i, tree decl,
{
gcc_assert (COMPARISON_CLASS_P (cond));
data.expr_loc = EXPR_LOCATION (init);
- data.kind = 1;
+ data.kind = kind | 1;
if (TREE_OPERAND (cond, 0) == decl)
walk_tree_1 (&TREE_OPERAND (cond, 1),
c_omp_check_loop_iv_r, &data, NULL, lh);
@@ -2858,13 +2885,44 @@ c_omp_predefined_variable (tree decl)
{
if (VAR_P (decl)
&& DECL_ARTIFICIAL (decl)
- && TREE_READONLY (decl)
&& TREE_STATIC (decl)
- && DECL_NAME (decl)
- && (DECL_NAME (decl) == ridpointers[RID_C99_FUNCTION_NAME]
- || DECL_NAME (decl) == ridpointers[RID_FUNCTION_NAME]
- || DECL_NAME (decl) == ridpointers[RID_PRETTY_FUNCTION_NAME]))
- return true;
+ && DECL_NAME (decl))
+ {
+ if (TREE_READONLY (decl)
+ && (DECL_NAME (decl) == ridpointers[RID_C99_FUNCTION_NAME]
+ || DECL_NAME (decl) == ridpointers[RID_FUNCTION_NAME]
+ || DECL_NAME (decl) == ridpointers[RID_PRETTY_FUNCTION_NAME]))
+ return true;
+ /* For UBSan handle the same also ubsan_create_data created
+ variables. There is no magic flag for those, but user variables
+ shouldn't be DECL_ARTIFICIAL or have TYPE_ARTIFICIAL type with
+ such names. */
+ if ((flag_sanitize & (SANITIZE_UNDEFINED
+ | SANITIZE_UNDEFINED_NONDEFAULT)) != 0
+ && DECL_IGNORED_P (decl)
+ && !TREE_READONLY (decl)
+ && TREE_CODE (DECL_NAME (decl)) == IDENTIFIER_NODE
+ && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
+ && TYPE_ARTIFICIAL (TREE_TYPE (decl))
+ && TYPE_NAME (TREE_TYPE (decl))
+ && TREE_CODE (TYPE_NAME (TREE_TYPE (decl))) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (TREE_TYPE (decl)))
+ && (TREE_CODE (DECL_NAME (TYPE_NAME (TREE_TYPE (decl))))
+ == IDENTIFIER_NODE))
+ {
+ tree id1 = DECL_NAME (decl);
+ tree id2 = DECL_NAME (TYPE_NAME (TREE_TYPE (decl)));
+ if (IDENTIFIER_LENGTH (id1) >= sizeof ("ubsan_data") - 1
+ && IDENTIFIER_LENGTH (id2) >= sizeof ("__ubsan__data")
+ && !memcmp (IDENTIFIER_POINTER (id2), "__ubsan_",
+ sizeof ("__ubsan_") - 1)
+ && !memcmp (IDENTIFIER_POINTER (id2) + IDENTIFIER_LENGTH (id2)
+ - sizeof ("_data") + 1, "_data",
+ sizeof ("_data") - 1)
+ && strstr (IDENTIFIER_POINTER (id1), "ubsan_data"))
+ return true;
+ }
+ }
return false;
}
@@ -2909,143 +2967,6 @@ c_omp_predetermined_mapping (tree decl)
}
-/* Diagnose errors in an OpenMP context selector, return CTX if
- it is correct or error_mark_node otherwise. */
-
-tree
-c_omp_check_context_selector (location_t loc, tree ctx)
-{
- /* Each trait-set-selector-name can only be specified once.
- There are just 4 set names. */
- for (tree t1 = ctx; t1; t1 = TREE_CHAIN (t1))
- for (tree t2 = TREE_CHAIN (t1); t2; t2 = TREE_CHAIN (t2))
- if (TREE_PURPOSE (t1) == TREE_PURPOSE (t2))
- {
- error_at (loc, "selector set %qs specified more than once",
- IDENTIFIER_POINTER (TREE_PURPOSE (t1)));
- return error_mark_node;
- }
- for (tree t = ctx; t; t = TREE_CHAIN (t))
- {
- /* Each trait-selector-name can only be specified once. */
- if (list_length (TREE_VALUE (t)) < 5)
- {
- for (tree t1 = TREE_VALUE (t); t1; t1 = TREE_CHAIN (t1))
- for (tree t2 = TREE_CHAIN (t1); t2; t2 = TREE_CHAIN (t2))
- if (TREE_PURPOSE (t1) == TREE_PURPOSE (t2))
- {
- error_at (loc,
- "selector %qs specified more than once in set %qs",
- IDENTIFIER_POINTER (TREE_PURPOSE (t1)),
- IDENTIFIER_POINTER (TREE_PURPOSE (t)));
- return error_mark_node;
- }
- }
- else
- {
- hash_set<tree> pset;
- for (tree t1 = TREE_VALUE (t); t1; t1 = TREE_CHAIN (t1))
- if (pset.add (TREE_PURPOSE (t1)))
- {
- error_at (loc,
- "selector %qs specified more than once in set %qs",
- IDENTIFIER_POINTER (TREE_PURPOSE (t1)),
- IDENTIFIER_POINTER (TREE_PURPOSE (t)));
- return error_mark_node;
- }
- }
-
- static const char *const kind[] = {
- "host", "nohost", "cpu", "gpu", "fpga", "any", NULL };
- static const char *const vendor[] = {
- "amd", "arm", "bsc", "cray", "fujitsu", "gnu", "ibm", "intel",
- "llvm", "nvidia", "pgi", "ti", "unknown", NULL };
- static const char *const extension[] = { NULL };
- static const char *const atomic_default_mem_order[] = {
- "seq_cst", "relaxed", "acq_rel", NULL };
- struct known_properties { const char *set; const char *selector;
- const char *const *props; };
- known_properties props[] = {
- { "device", "kind", kind },
- { "implementation", "vendor", vendor },
- { "implementation", "extension", extension },
- { "implementation", "atomic_default_mem_order",
- atomic_default_mem_order } };
- for (tree t1 = TREE_VALUE (t); t1; t1 = TREE_CHAIN (t1))
- for (unsigned i = 0; i < ARRAY_SIZE (props); i++)
- if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t1)),
- props[i].selector)
- && !strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t)),
- props[i].set))
- for (tree t2 = TREE_VALUE (t1); t2; t2 = TREE_CHAIN (t2))
- for (unsigned j = 0; ; j++)
- {
- if (props[i].props[j] == NULL)
- {
- if (TREE_PURPOSE (t2)
- && !strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
- " score"))
- break;
- if (props[i].props == atomic_default_mem_order)
- {
- error_at (loc,
- "incorrect property %qs of %qs selector",
- IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
- "atomic_default_mem_order");
- return error_mark_node;
- }
- else if (TREE_PURPOSE (t2))
- warning_at (loc, 0,
- "unknown property %qs of %qs selector",
- IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
- props[i].selector);
- else
- warning_at (loc, 0,
- "unknown property %qE of %qs selector",
- TREE_VALUE (t2), props[i].selector);
- break;
- }
- else if (TREE_PURPOSE (t2) == NULL_TREE)
- {
- const char *str = TREE_STRING_POINTER (TREE_VALUE (t2));
- if (!strcmp (str, props[i].props[j])
- && ((size_t) TREE_STRING_LENGTH (TREE_VALUE (t2))
- == strlen (str) + 1))
- break;
- }
- else if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
- props[i].props[j]))
- break;
- }
- }
- return ctx;
-}
-
-/* Register VARIANT as variant of some base function marked with
- #pragma omp declare variant. CONSTRUCT is corresponding construct
- selector set. */
-
-void
-c_omp_mark_declare_variant (location_t loc, tree variant, tree construct)
-{
- tree attr = lookup_attribute ("omp declare variant variant",
- DECL_ATTRIBUTES (variant));
- if (attr == NULL_TREE)
- {
- attr = tree_cons (get_identifier ("omp declare variant variant"),
- unshare_expr (construct),
- DECL_ATTRIBUTES (variant));
- DECL_ATTRIBUTES (variant) = attr;
- return;
- }
- if ((TREE_VALUE (attr) != NULL_TREE) != (construct != NULL_TREE)
- || (construct != NULL_TREE
- && omp_context_selector_set_compare ("construct", TREE_VALUE (attr),
- construct)))
- error_at (loc, "%qD used as a variant with incompatible %<construct%> "
- "selector sets", variant);
-}
-
/* For OpenACC, the OMP_CLAUSE_MAP_KIND of an OMP_CLAUSE_MAP is used internally
to distinguish clauses as seen by the user. Return the "friendly" clause
name for error messages etc., where possible. See also
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 3eaab5e..0225cba 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -831,7 +831,7 @@ c_common_post_options (const char **pfilename)
for -ffp-contract=off). */
if (flag_iso
&& !c_dialect_cxx ()
- && (global_options_set.x_flag_fp_contract_mode
+ && (OPTION_SET_P (flag_fp_contract_mode)
== (enum fp_contract_mode) 0)
&& flag_unsafe_math_optimizations == 0)
flag_fp_contract_mode = FP_CONTRACT_OFF;
@@ -842,7 +842,7 @@ c_common_post_options (const char **pfilename)
the set specified in ISO C99/C11. */
if (!flag_iso
&& !c_dialect_cxx ()
- && (global_options_set.x_flag_permitted_flt_eval_methods
+ && (OPTION_SET_P (flag_permitted_flt_eval_methods)
== PERMITTED_FLT_EVAL_METHODS_DEFAULT))
flag_permitted_flt_eval_methods = PERMITTED_FLT_EVAL_METHODS_TS_18661;
else
@@ -1040,7 +1040,7 @@ c_common_post_options (const char **pfilename)
/* Unless -f{,no-}ext-numeric-literals has been used explicitly,
for -std=c++{11,14,17,20,23} default to -fno-ext-numeric-literals. */
- if (flag_iso && !global_options_set.x_flag_ext_numeric_literals)
+ if (flag_iso && !OPTION_SET_P (flag_ext_numeric_literals))
cpp_opts->ext_numeric_literals = 0;
}
else if (warn_narrowing == -1)