[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Sauvegarde modifs
https://gcc.gnu.org/g:f351cbb70cb7ab639e9aac76bc0e538f72067479 commit f351cbb70cb7ab639e9aac76bc0e538f72067479 Author: Mikael Morin Date: Sat Dec 7 22:22:10 2024 +0100 Sauvegarde modifs Annulation suppression else Correction assertions Initialisation vptr Non initialisation elem_len pour les conteneurs de classe Mise à jour class_allocatable_14 Diff: --- gcc/fortran/trans-array.cc | 52 ++ gcc/fortran/trans-array.h | 2 + gcc/fortran/trans-decl.cc | 58 + gcc/testsuite/gfortran.dg/class_allocate_14.f90 | 2 +- 4 files changed, 66 insertions(+), 48 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 091d47798b1e..4a686e8bf20b 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -734,6 +734,58 @@ gfc_build_null_descriptor (tree type, gfc_typespec &ts, } +tree +gfc_build_default_class_descriptor (tree type, gfc_typespec &ts) +{ + vec *v = nullptr; + + tree fields = TYPE_FIELDS (type); + +#define CLASS_DATA_FIELD 0 +#define CLASS_VPTR_FIELD 1 + + tree data_field = gfc_advance_chain (fields, CLASS_DATA_FIELD); + tree data_type = TREE_TYPE (data_field); + + gcc_assert (ts.type == BT_CLASS); + tree data_value; + if (ts.u.derived->components->attr.dimension + || (ts.u.derived->components->attr.codimension + && flag_coarray != GFC_FCOARRAY_LIB)) +{ + gcc_assert (GFC_DESCRIPTOR_TYPE_P (data_type)); + data_value = gfc_build_null_descriptor (data_type, + ts, + ts.u.derived->components->as->rank, + ts.u.derived->components->attr); +} + else +{ + gcc_assert (POINTER_TYPE_P (data_type)); + data_value = fold_convert (data_type, null_pointer_node); +} + CONSTRUCTOR_APPEND_ELT (v, data_field, data_value); + + tree vptr_field = gfc_advance_chain (fields, CLASS_VPTR_FIELD); + + tree vptr_value; + if (ts.u.derived->attr.unlimited_polymorphic) +vptr_value = fold_convert (TREE_TYPE (vptr_field), null_pointer_node); + else +{ + gfc_symbol *vsym = gfc_find_derived_vtab (ts.u.derived); + tree vsym_decl = gfc_get_symbol_decl (vsym); + vptr_value = gfc_build_addr_expr (nullptr, vsym_decl); +} + CONSTRUCTOR_APPEND_ELT (v, vptr_field, vptr_value); + +#undef CLASS_DATA_FIELD +#undef CLASS_VPTR_FIELD + + return build_constructor (type, v); +} + + void gfc_clear_descriptor (gfc_expr *var_ref, gfc_se &var) { diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h index ab27f15cab22..58b7a6aec336 100644 --- a/gcc/fortran/trans-array.h +++ b/gcc/fortran/trans-array.h @@ -140,6 +140,8 @@ void gfc_set_delta (gfc_loopinfo *); void gfc_conv_resolve_dependencies (gfc_loopinfo *, gfc_ss *, gfc_ss *); /* Build a null array descriptor constructor. */ tree gfc_build_null_descriptor (tree); +tree gfc_build_default_class_descriptor (tree, gfc_typespec &); +void gfc_clear_descriptor (stmtblock_t *block, gfc_symbol *sym, tree descriptor); /* Get a single array element. */ void gfc_conv_array_ref (gfc_se *, gfc_array_ref *, gfc_expr *, locus *); diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index a62fe3f0441c..dff435d53acb 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -4741,16 +4741,14 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) else if (proc_sym == proc_sym->result && IS_CLASS_ARRAY (proc_sym)) { /* Nullify explicit return class arrays on entry. */ - tree type; tmp = get_proc_result (proc_sym); - if (tmp && GFC_CLASS_TYPE_P (TREE_TYPE (tmp))) - { - gfc_start_block (&init); - tmp = gfc_class_data_get (tmp); - type = TREE_TYPE (gfc_conv_descriptor_data_get (tmp)); - gfc_conv_descriptor_data_set (&init, tmp, build_int_cst (type, 0)); - gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE); - } + if (tmp && GFC_CLASS_TYPE_P (TREE_TYPE (tmp))) + { + gfc_start_block (&init); + tmp = gfc_class_data_get (tmp); + gfc_clear_descriptor (&init, proc_sym, tmp); + gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE); + } } @@ -4892,48 +4890,13 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) } } - if (sym->attr.pointer && sym->attr.dimension - && sym->attr.save == SAVE_NONE - && !sym->attr.use_assoc - && !sym->attr.host_assoc - && !sym->attr.dummy - && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (sym->backend_decl))) - { - gfc_init_block (&tmpblock); - gfc_conv_descriptor_span_set (&tmpblock, sym->backend_decl, -
[gcc/aoliva/heads/testme] (2 commits) ifcombine field-merge: saturate align at inner object size
The branch 'aoliva/heads/testme' was updated to point to: a06c5b1386d3... ifcombine field-merge: saturate align at inner object size It previously pointed to: 8391a5d0a61e... ifcombine field-merge: saturate align at load size Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- 8391a5d... ifcombine field-merge: saturate align at load size 643e436... fold fold_truth_andor field merging into ifcombine d376d81... Add units required for exception handling 812f6c0... Handle C++ exception hierarchies Summary of changes (added commits): --- a06c5b1... ifcombine field-merge: saturate align at inner object size 5789a91... fold fold_truth_andor field merging into ifcombine
[gcc(refs/users/aoliva/heads/testme)] fold fold_truth_andor field merging into ifcombine
https://gcc.gnu.org/g:5789a91dc3a173a97c80d1f167f62c7a1a9851f5 commit 5789a91dc3a173a97c80d1f167f62c7a1a9851f5 Author: Alexandre Oliva Date: Sun Dec 1 08:17:58 2024 -0300 fold fold_truth_andor field merging into ifcombine This patch introduces various improvements to the logic that merges field compares, while moving it into ifcombine. Before the patch, we could merge: (a.x1 EQNE b.x1) ANDOR (a.y1 EQNE b.y1) into something like: (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK) if both of A's fields live within the same alignment boundaries, and so do B's, at the same relative positions. Constants may be used instead of the object B. The initial goal of this patch was to enable such combinations when a field crossed alignment boundaries, e.g. for packed types. We can't generally access such fields with a single memory access, so when we come across such a compare, we will attempt to combine each access separately. Some merging opportunities were missed because of right-shifts, compares expressed as e.g. ((a.x1 ^ b.x1) & MASK) EQNE 0, and narrowing conversions, especially after earlier merges. This patch introduces handlers for several cases involving these. The merging of multiple field accesses into wider bitfield-like accesses is undesirable to do too early in compilation, so we move it from folding to ifcombine, and guard its warnings with -Wtautological-compare, turned into a common flag. When the second of a noncontiguous pair of compares is the first that accesses a word, we may merge the first compare with part of the second compare that refers to the same word, keeping the compare of the remaining bits at the spot where the second compare used to be. Handling compares with non-constant fields was somewhat generalized from what fold used to do, now handling non-adjacent fields, even if a field of one object crosses an alignment boundary but the other doesn't. for gcc/ChangeLog * fold-const.cc (make_bit_field): Export. (unextend, all_ones_mask_p): Drop. (decode_field_reference, fold_truth_andor_1): Move field compare merging logic... * gimple-fold.cc: (fold_truth_andor_for_ifcombine) ... here, with -Wtautological-compare warning guards, and... (decode_field_reference): ... here. Rework for gimple. (gimple_convert_def_p, gimple_binop_def_p): New. (compute_split_boundary_from_align): New. (make_bit_field_load, build_split_load): New. (reuse_split_load): New. * fold-const.h: (make_bit_field_ref): Declare (fold_truth_andor_for_ifcombine): Declare. * tree-ssa-ifcombine.cc (ifcombine_ifandif): Try fold_truth_andor_for_ifcombine. * common.opt (Wtautological-compare): Move here. for gcc/c-family/ChangeLog * c.opt (Wtautological-compare): Move to ../common.opt. for gcc/testsuite/ChangeLog * gcc.dg/field-merge-1.c: New. * gcc.dg/field-merge-2.c: New. * gcc.dg/field-merge-3.c: New. * gcc.dg/field-merge-4.c: New. * gcc.dg/field-merge-5.c: New. * gcc.dg/field-merge-6.c: New. * gcc.dg/field-merge-7.c: New. * gcc.dg/field-merge-8.c: New. * gcc.dg/field-merge-9.c: New. * gcc.dg/field-merge-10.c: New. * gcc.dg/field-merge-11.c: New. * gcc.dg/field-merge-12.c: New. * gcc.target/aarch64/long_branch_1.c: Disable ifcombine. Diff: --- gcc/c-family/c.opt |4 - gcc/common.opt |4 + gcc/fold-const.cc| 512 +- gcc/fold-const.h | 10 + gcc/gimple-fold.cc | 1148 ++ gcc/testsuite/gcc.dg/field-merge-1.c | 64 ++ gcc/testsuite/gcc.dg/field-merge-10.c| 36 + gcc/testsuite/gcc.dg/field-merge-11.c| 32 + gcc/testsuite/gcc.dg/field-merge-12.c| 33 + gcc/testsuite/gcc.dg/field-merge-2.c | 31 + gcc/testsuite/gcc.dg/field-merge-3.c | 36 + gcc/testsuite/gcc.dg/field-merge-4.c | 40 + gcc/testsuite/gcc.dg/field-merge-5.c | 40 + gcc/testsuite/gcc.dg/field-merge-6.c | 26 + gcc/testsuite/gcc.dg/field-merge-7.c | 23 + gcc/testsuite/gcc.dg/field-merge-8.c | 25 + gcc/testsuite/gcc.dg/field-merge-9.c | 38 + gcc/testsuite/gcc.target/aarch64/long_branch_1.c |2 +- gcc/tree-ssa-ifcombine.cc| 14 +- 19 files changed, 1604 insertions(+), 514 deletions(-)
[gcc(refs/users/aoliva/heads/testme)] ifcombine field-merge: saturate align at inner object size
https://gcc.gnu.org/g:a06c5b1386d397d149abfca9ed988d75273c1996 commit a06c5b1386d397d149abfca9ed988d75273c1996 Author: Alexandre Oliva Date: Tue Dec 10 06:49:32 2024 -0300 ifcombine field-merge: saturate align at inner object size A bootstrap on aarch64-linux-gnu revealed that sometimes (for example, when building shorten_branches in final.cc) we will find such things as MEM , where unsigned int happen to be a variant of the original unsigned int type, given 64-bit alignment. This unusual alignment circumstance caused get_best_mode to choose DImode instead of SImode, and that failed gimple verification because there aren't that many bits in the unsigned int object. Arrange for alignment to saturate at the inner object size to avoid tripping this error. for gcc/ChangeLog * gimple-fold.cc (fold_truth_andor_for_ifcombine): Saturate align at inner object size. Diff: --- gcc/gimple-fold.cc | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index a31fc283d51b..c9927f94f657 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -8204,24 +8204,31 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, to be relative to a field of that size. */ first_bit = MIN (ll_bitpos, rl_bitpos); end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize); + HOST_WIDE_INT ll_align = TYPE_ALIGN (TREE_TYPE (ll_inner)); + /* Guard from types with wider-than-size alignment. We must not widen the + load beyond its total size. This is rare. */ + while (ll_align > BITS_PER_UNIT +&& TYPE_SIZE (TREE_TYPE (ll_inner))1 +&& uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (ll_inner))) +&& known_gt ((unsigned HOST_WIDE_INT)ll_align, + tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (ll_inner) +ll_align /= 2; if (get_best_mode (end_bit - first_bit, first_bit, 0, 0, -TYPE_ALIGN (TREE_TYPE (ll_inner)), BITS_PER_WORD, -volatilep, &lnmode)) +ll_align, BITS_PER_WORD, volatilep, &lnmode)) l_split_load = false; else { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (ll_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); + (ll_align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); if (boundary < 0 || !get_best_mode (boundary - first_bit, first_bit, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode) +ll_align, BITS_PER_WORD, volatilep, &lnmode) || !get_best_mode (end_bit - boundary, boundary, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode2)) +ll_align, BITS_PER_WORD, volatilep, &lnmode2)) return 0; /* If we can't have a single load, but can with two, figure out whether @@ -8368,16 +8375,24 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, and then we use two separate compares. */ first_bit = MIN (lr_bitpos, rr_bitpos); end_bit = MAX (lr_bitpos + lr_bitsize, rr_bitpos + rr_bitsize); + HOST_WIDE_INT lr_align = TYPE_ALIGN (TREE_TYPE (lr_inner)); + /* Guard from types with wider-than-size alignment. We must not widen the +load beyond its total size. This is rare. */ + while (lr_align > BITS_PER_UNIT +&& TYPE_SIZE (TREE_TYPE (lr_inner)) +&& uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (lr_inner))) +&& known_gt ((unsigned HOST_WIDE_INT)lr_align, + tree_to_poly_uint64 (TYPE_SIZE + (TREE_TYPE (lr_inner) + align /= 2; if (!get_best_mode (end_bit - first_bit, first_bit, 0, 0, - TYPE_ALIGN (TREE_TYPE (lr_inner)), BITS_PER_WORD, - volatilep, &rnmode)) + lr_align, BITS_PER_WORD, volatilep, &rnmode)) { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (lr_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); + (lr_align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); if (boundary < 0 /* If we're to split both, make sure the split point is @@ -8386,9 +840
[gcc/aoliva/heads/testme] ifcombine field-merge: saturate align at inner object size
The branch 'aoliva/heads/testme' was updated to point to: 78591179a40a... ifcombine field-merge: saturate align at inner object size It previously pointed to: a06c5b1386d3... ifcombine field-merge: saturate align at inner object size Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- a06c5b1... ifcombine field-merge: saturate align at inner object size Summary of changes (added commits): --- 7859117... ifcombine field-merge: saturate align at inner object size
[gcc(refs/users/aoliva/heads/testme)] ifcombine field-merge: saturate align at inner object size
https://gcc.gnu.org/g:78591179a40a21372576ff1eed14d0c16252d583 commit 78591179a40a21372576ff1eed14d0c16252d583 Author: Alexandre Oliva Date: Tue Dec 10 06:49:32 2024 -0300 ifcombine field-merge: saturate align at inner object size A bootstrap on aarch64-linux-gnu revealed that sometimes (for example, when building shorten_branches in final.cc) we will find such things as MEM , where unsigned int happen to be a variant of the original unsigned int type, given 64-bit alignment. This unusual alignment circumstance caused get_best_mode to choose DImode instead of SImode, and that failed gimple verification because there aren't that many bits in the unsigned int object. Arrange for alignment to saturate at the inner object size to avoid tripping this error. for gcc/ChangeLog * gimple-fold.cc (fold_truth_andor_for_ifcombine): Saturate align at inner object size. Diff: --- gcc/gimple-fold.cc | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index a31fc283d51b..3c0bd631610a 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -8204,24 +8204,31 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, to be relative to a field of that size. */ first_bit = MIN (ll_bitpos, rl_bitpos); end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize); + HOST_WIDE_INT ll_align = TYPE_ALIGN (TREE_TYPE (ll_inner)); + /* Guard from types with wider-than-size alignment. We must not widen the + load beyond its total size. This is rare. */ + while (ll_align > BITS_PER_UNIT +&& TYPE_SIZE (TREE_TYPE (ll_inner))1 +&& uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (ll_inner))) +&& known_gt ((unsigned HOST_WIDE_INT)ll_align, + tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (ll_inner) +ll_align /= 2; if (get_best_mode (end_bit - first_bit, first_bit, 0, 0, -TYPE_ALIGN (TREE_TYPE (ll_inner)), BITS_PER_WORD, -volatilep, &lnmode)) +ll_align, BITS_PER_WORD, volatilep, &lnmode)) l_split_load = false; else { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (ll_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); + (ll_align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); if (boundary < 0 || !get_best_mode (boundary - first_bit, first_bit, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode) +ll_align, BITS_PER_WORD, volatilep, &lnmode) || !get_best_mode (end_bit - boundary, boundary, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode2)) +ll_align, BITS_PER_WORD, volatilep, &lnmode2)) return 0; /* If we can't have a single load, but can with two, figure out whether @@ -8368,16 +8375,24 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, and then we use two separate compares. */ first_bit = MIN (lr_bitpos, rr_bitpos); end_bit = MAX (lr_bitpos + lr_bitsize, rr_bitpos + rr_bitsize); + HOST_WIDE_INT lr_align = TYPE_ALIGN (TREE_TYPE (lr_inner)); + /* Guard from types with wider-than-size alignment. We must not widen the +load beyond its total size. This is rare. */ + while (lr_align > BITS_PER_UNIT +&& TYPE_SIZE (TREE_TYPE (lr_inner)) +&& uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (lr_inner))) +&& known_gt ((unsigned HOST_WIDE_INT)lr_align, + tree_to_poly_uint64 (TYPE_SIZE + (TREE_TYPE (lr_inner) + lr_align /= 2; if (!get_best_mode (end_bit - first_bit, first_bit, 0, 0, - TYPE_ALIGN (TREE_TYPE (lr_inner)), BITS_PER_WORD, - volatilep, &rnmode)) + lr_align, BITS_PER_WORD, volatilep, &rnmode)) { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (lr_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); + (lr_align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); if (boundary < 0 /* If we're to split both, make sure the split point is @@ -8386,9 +
[gcc(refs/users/aoliva/heads/testme)] ifcombine field-merge: saturate align at inner object size
https://gcc.gnu.org/g:e58a7d75e81b3f4b3286a49455452c3a2cc02721 commit e58a7d75e81b3f4b3286a49455452c3a2cc02721 Author: Alexandre Oliva Date: Tue Dec 10 06:49:32 2024 -0300 ifcombine field-merge: saturate align at inner object size A bootstrap on aarch64-linux-gnu revealed that sometimes (for example, when building shorten_branches in final.cc) we will find such things as MEM , where unsigned int happen to be a variant of the original unsigned int type, given 64-bit alignment. This unusual alignment circumstance caused get_best_mode to choose DImode instead of SImode, and that failed gimple verification because there aren't that many bits in the unsigned int object. Arrange for alignment to saturate at the inner object size to avoid tripping this error. for gcc/ChangeLog * gimple-fold.cc (fold_truth_andor_for_ifcombine): Saturate align at inner object size. Diff: --- gcc/gimple-fold.cc | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index a31fc283d51b..967356a95019 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -8204,24 +8204,31 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, to be relative to a field of that size. */ first_bit = MIN (ll_bitpos, rl_bitpos); end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize); + HOST_WIDE_INT ll_align = TYPE_ALIGN (TREE_TYPE (ll_inner)); + /* Guard from types with wider-than-size alignment. We must not widen the + load beyond its total size. This is rare. */ + while (ll_align > BITS_PER_UNIT +&& TYPE_SIZE (TREE_TYPE (ll_inner)) +&& uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (ll_inner))) +&& known_gt ((unsigned HOST_WIDE_INT)ll_align, + tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (ll_inner) +ll_align /= 2; if (get_best_mode (end_bit - first_bit, first_bit, 0, 0, -TYPE_ALIGN (TREE_TYPE (ll_inner)), BITS_PER_WORD, -volatilep, &lnmode)) +ll_align, BITS_PER_WORD, volatilep, &lnmode)) l_split_load = false; else { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (ll_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); + (ll_align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); if (boundary < 0 || !get_best_mode (boundary - first_bit, first_bit, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode) +ll_align, BITS_PER_WORD, volatilep, &lnmode) || !get_best_mode (end_bit - boundary, boundary, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode2)) +ll_align, BITS_PER_WORD, volatilep, &lnmode2)) return 0; /* If we can't have a single load, but can with two, figure out whether @@ -8368,16 +8375,24 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, and then we use two separate compares. */ first_bit = MIN (lr_bitpos, rr_bitpos); end_bit = MAX (lr_bitpos + lr_bitsize, rr_bitpos + rr_bitsize); + HOST_WIDE_INT lr_align = TYPE_ALIGN (TREE_TYPE (lr_inner)); + /* Guard from types with wider-than-size alignment. We must not widen the +load beyond its total size. This is rare. */ + while (lr_align > BITS_PER_UNIT +&& TYPE_SIZE (TREE_TYPE (lr_inner)) +&& uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (lr_inner))) +&& known_gt ((unsigned HOST_WIDE_INT)lr_align, + tree_to_poly_uint64 (TYPE_SIZE + (TREE_TYPE (lr_inner) + lr_align /= 2; if (!get_best_mode (end_bit - first_bit, first_bit, 0, 0, - TYPE_ALIGN (TREE_TYPE (lr_inner)), BITS_PER_WORD, - volatilep, &rnmode)) + lr_align, BITS_PER_WORD, volatilep, &rnmode)) { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (lr_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); + (lr_align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); if (boundary < 0 /* If we're to split both, make sure the split point is @@ -8386,9 +8
[gcc/aoliva/heads/testme] ifcombine field-merge: saturate align at inner object size
The branch 'aoliva/heads/testme' was updated to point to: e58a7d75e81b... ifcombine field-merge: saturate align at inner object size It previously pointed to: 78591179a40a... ifcombine field-merge: saturate align at inner object size Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- 7859117... ifcombine field-merge: saturate align at inner object size Summary of changes (added commits): --- e58a7d7... ifcombine field-merge: saturate align at inner object size
[gcc r15-6109] middle-end: Add initial support for poly_int64 BIT_FIELD_REF in expand pass [PR96342]
https://gcc.gnu.org/g:b6242bd122757ec6c75c73a4921f24a9a382b090 commit r15-6109-gb6242bd122757ec6c75c73a4921f24a9a382b090 Author: Victor Do Nascimento Date: Wed Dec 11 12:00:58 2024 + middle-end: Add initial support for poly_int64 BIT_FIELD_REF in expand pass [PR96342] While `poly_int64' has been the default representation of bitfield size and offset for some time, there was a lack of support for the use of non-constant `poly_int64' values for those values throughout the compiler, limiting the applicability of the BIT_FIELD_REF rtl expression for variable length vectors, such as those used by SVE. This patch starts work on extending the functionality of relevant functions in the expand pass such as to enable their use by the compiler for such vectors. gcc/ChangeLog: PR target/96342 * expr.cc (store_constructor): Enable poly_{u}int64 type usage. (get_inner_reference): Ditto. Co-authored-by: Tamar Christina Diff: --- gcc/expr.cc | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index 88fa56cb299d..babf00f34dcf 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -7901,15 +7901,14 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, { unsigned HOST_WIDE_INT idx; constructor_elt *ce; - int i; bool need_to_clear; insn_code icode = CODE_FOR_nothing; tree elt; tree elttype = TREE_TYPE (type); int elt_size = vector_element_bits (type); machine_mode eltmode = TYPE_MODE (elttype); - HOST_WIDE_INT bitsize; - HOST_WIDE_INT bitpos; + poly_int64 bitsize; + poly_int64 bitpos; rtvec vector = NULL; poly_uint64 n_elts; unsigned HOST_WIDE_INT const_n_elts; @@ -8006,7 +8005,7 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, ? TREE_TYPE (CONSTRUCTOR_ELT (exp, 0)->value) : elttype); if (VECTOR_TYPE_P (val_type)) - bitsize = tree_to_uhwi (TYPE_SIZE (val_type)); + bitsize = tree_to_poly_uint64 (TYPE_SIZE (val_type)); else bitsize = elt_size; @@ -8019,12 +8018,12 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, need_to_clear = true; else { - unsigned HOST_WIDE_INT count = 0, zero_count = 0; + poly_uint64 count = 0, zero_count = 0; tree value; FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value) { - int n_elts_here = bitsize / elt_size; + poly_int64 n_elts_here = exact_div (bitsize, elt_size); count += n_elts_here; if (mostly_zeros_p (value)) zero_count += n_elts_here; @@ -8033,7 +8032,7 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, /* Clear the entire vector first if there are any missing elements, or if the incidence of zero elements is >= 75%. */ need_to_clear = (maybe_lt (count, n_elts) -|| 4 * zero_count >= 3 * count); +|| maybe_gt (4 * zero_count, 3 * count)); } if (need_to_clear && maybe_gt (size, 0) && !vector) @@ -8060,9 +8059,13 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, /* Store each element of the constructor into the corresponding element of TARGET, determined by counting the elements. */ - for (idx = 0, i = 0; -vec_safe_iterate (CONSTRUCTOR_ELTS (exp), idx, &ce); -idx++, i += bitsize / elt_size) + HOST_WIDE_INT chunk_size = 0; + bool chunk_multiple_p = constant_multiple_p (bitsize, elt_size, +&chunk_size); + gcc_assert (chunk_multiple_p || vec_vec_init_p); + + for (idx = 0; vec_safe_iterate (CONSTRUCTOR_ELTS (exp), idx, &ce); +idx++) { HOST_WIDE_INT eltpos; tree value = ce->value; @@ -8073,7 +8076,7 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, if (ce->index) eltpos = tree_to_uhwi (ce->index); else - eltpos = i; + eltpos = idx * chunk_size; if (vector) { @@ -8461,10 +8464,8 @@ get_inner_reference (tree exp, poly_int64 *pbitsize, if (size_tree != 0) { - if (! tree_fits_uhwi_p (size_tree)) + if (!poly_int_tree_p (size_tree, pbitsize)) mode = BLKmode, *pbitsize = -1; - else - *pbitsize = tree_to_uhwi (size_tree); } *preversep = reverse_storage_order_for_component_p (exp);
[gcc r15-6110] ipa: Update value range jump functions during inlining
https://gcc.gnu.org/g:92e0e0f8177530b8c6fcafe1d61ba03b00dff6a6 commit r15-6110-g92e0e0f8177530b8c6fcafe1d61ba03b00dff6a6 Author: Martin Jambor Date: Wed Dec 11 14:55:27 2024 +0100 ipa: Update value range jump functions during inlining When inlining (during the analysis phase) a call graph edge, we update all pass-through jump functions corresponding to edges going out of the newly inlined function to be relative to the function into which we are inlining or to expose the information originally captured for the edge that is being inlined. Similarly, we can combine the value range information in pass-through jump functions corresponding to both edges, which is what this patch adds - at least for the case when the inlined pass-through is a simple, non-arithmetic one, which is the case that we also handle for constant and aggregate jump function parts. gcc/ChangeLog: 2024-11-01 Martin Jambor * ipa-cp.h: Forward declare class ipa_vr. (ipa_vr_operation_and_type_effects) Declare. * ipa-cp.cc (ipa_vr_operation_and_type_effects): Make public. * ipa-prop.cc (update_jump_functions_after_inlining): Also update value range jump functions. Diff: --- gcc/ipa-cp.cc | 4 ++-- gcc/ipa-cp.h| 13 + gcc/ipa-prop.cc | 18 ++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index e6d707c286db..a664bc03f62a 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -1653,7 +1653,7 @@ ipa_context_from_jfunc (ipa_node_params *info, cgraph_edge *cs, int csidx, DST_TYPE on value range in SRC_VR and store it to DST_VR. Return true if the result is a range that is not VARYING nor UNDEFINED. */ -static bool +bool ipa_vr_operation_and_type_effects (vrange &dst_vr, const vrange &src_vr, enum tree_code operation, @@ -1679,7 +1679,7 @@ ipa_vr_operation_and_type_effects (vrange &dst_vr, /* Same as above, but the SRC_VR argument is an IPA_VR which must first be extracted onto a vrange. */ -static bool +bool ipa_vr_operation_and_type_effects (vrange &dst_vr, const ipa_vr &src_vr, enum tree_code operation, diff --git a/gcc/ipa-cp.h b/gcc/ipa-cp.h index ba2ebfede63f..4f569c1ee838 100644 --- a/gcc/ipa-cp.h +++ b/gcc/ipa-cp.h @@ -299,4 +299,17 @@ ipa_vr_supported_type_p (tree type) return irange::supports_p (type) || prange::supports_p (type); } +class ipa_vr; + +bool ipa_vr_operation_and_type_effects (vrange &dst_vr, + const vrange &src_vr, + enum tree_code operation, + tree dst_type, tree src_type); +bool ipa_vr_operation_and_type_effects (vrange &dst_vr, + const ipa_vr &src_vr, + enum tree_code operation, + tree dst_type, tree src_type); + + + #endif /* IPA_CP_H */ diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc index 9070a45f6835..3d72794e37c4 100644 --- a/gcc/ipa-prop.cc +++ b/gcc/ipa-prop.cc @@ -3471,6 +3471,24 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs, gcc_unreachable (); } + if (src->m_vr && src->m_vr->known_p ()) + { + value_range svr (src->m_vr->type ()); + if (!dst->m_vr || !dst->m_vr->known_p ()) + ipa_set_jfunc_vr (dst, *src->m_vr); + else if (ipa_vr_operation_and_type_effects (svr, *src->m_vr, + NOP_EXPR, + dst->m_vr->type (), + src->m_vr->type ())) + { + value_range dvr; + dst->m_vr->get_vrange (dvr); + dvr.intersect (svr); + if (!dvr.undefined_p ()) + ipa_set_jfunc_vr (dst, dvr); + } + } + if (src->agg.items && (dst_agg_p || !src->agg.by_ref)) {
[gcc r15-6113] Ada: Add GNU/Hurd x86_64 support
https://gcc.gnu.org/g:d9f87b7b02d3a58c1cab889d075f5496e95799fa commit r15-6113-gd9f87b7b02d3a58c1cab889d075f5496e95799fa Author: Samuel Thibault Date: Tue Dec 10 21:51:49 2024 +0100 Ada: Add GNU/Hurd x86_64 support This is essentially the same as the i386-pc-gnu section, the differences are the same as between freebsd i386 and freebsd x86_64. gcc/ada/ChangeLog: * Makefile.rtl: Add x86_64-pc-gnu section. Signed-off-by: Samuel Thibault Diff: --- gcc/ada/Makefile.rtl | 36 1 file changed, 36 insertions(+) diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 67c17eaa4a0e..6379c84693dd 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -1786,6 +1786,42 @@ ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),) endif endif +# x86_64-pc-gnu i.e. GNU Hurd +ifeq ($(SELECTED_PAIRS),PAIRS_NONE) +ifeq ($(strip $(filter-out x86_64 pc gnu,$(target_cpu) $(target_vendor) $(target_os))),) + + SELECTED_PAIRS=x86_64-gnuhurd + + LIBGNAT_TARGET_PAIRS = \ + a-intnam.ads
[gcc r15-6111] Ada: Factorize bsd signal definitions
https://gcc.gnu.org/g:aeab6f88a1152ea77c78e06247169e0226654f30 commit r15-6111-gaeab6f88a1152ea77c78e06247169e0226654f30 Author: Samuel Thibault Date: Tue Dec 10 21:51:47 2024 +0100 Ada: Factorize bsd signal definitions They are all the same on all BSD-like systems (including GNU/Hurd). gcc/ada/ChangeLog: * libgnarl/a-intnam__freebsd.ads: Rename to... * libgnarl/a-intnam__bsd.ads: ... new file. * libgnarl/a-intnam__dragonfly.ads: Remove file. * Makefile.rtl (x86-kfreebsd, x86-gnuhurd, x86_64-kfreebsd, aarch64-freebsd, x86-freebsd, x86_64-freebsd): Use libgnarl/a-intnam__bsd.ads instead of libgnarl/a-intnam__freebsd.ads. (x86_64-dragonfly): Use libgnarl/a-intnam__bsd.ads instead of libgnarl/a-intnam__dragonfly.ads. Signed-off-by: Samuel Thibault Diff: --- gcc/ada/Makefile.rtl | 14 +-- .../{a-intnam__freebsd.ads => a-intnam__bsd.ads} | 2 +- gcc/ada/libgnarl/a-intnam__dragonfly.ads | 136 - 3 files changed, 8 insertions(+), 144 deletions(-) diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index e93a583058c9..dea6fef6a88d 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -1686,7 +1686,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),) SELECTED_PAIRS=x86-kfreebsd LIBGNAT_TARGET_PAIRS = \ - a-intnam.adshttp://www.gnu.org/licenses/>. -- --- -- --- GNARL was developed by the GNARL team at Florida State University. -- --- Extensive contributions were provided by Ada Core Technologies, Inc. -- --- -- --- - --- This is the DragonFly BSD THREADS version of this package - -with System.OS_Interface; - -package Ada.Interrupts.Names is - - -- All identifiers in this unit are implementation defined - - pragma Implementation_Defined; - - -- Beware that the mapping of names to signals may be many-to-one. There - -- may be aliases. Also, for all signal names that are not supported on - -- the current system the value of the corresponding constant will be zero. - - SIGHUP : constant Interrupt_ID := - System.OS_Interface.SIGHUP; -- hangup - - SIGINT : constant Interrupt_ID := - System.OS_Interface.SIGINT; -- interrupt (rubout) - - SIGQUIT : constant Interrupt_ID := - System.OS_Interface.SIGQUIT; -- quit (ASCD FS) - - SIGILL : constant Interrupt_ID := - System.OS_Interface.SIGILL; -- illegal instruction (not reset) - - SIGTRAP : constant Interrupt_ID := - System.OS_Interface.SIGTRAP; -- trace trap (not reset) - - SIGIOT : constant Interrupt_ID := - System.OS_Interface.SIGIOT; -- IOT instruction - - SIGABRT : constant Interrupt_ID := -- used by abort, - System.OS_Interface.SIGABRT; -- replace SIGIOT in the future - - SIGFPE : constant Interrupt_ID := - System.OS_Interface.SIGFPE; -- floating point exception - - SIGKILL : constant Interrupt_ID := - System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored) - - SIGBUS : constant Interrupt_ID := - System.OS_Interface.SIGBUS; -- bus error - - SIGSEGV : constant Interrupt_ID := - System.OS_Interface.SIGSEGV; -- segmentation violation - - SIGPIPE : constant Interrupt_ID := -- write on a pipe with - System.OS_Interface.SIGPIPE; -- no one to read it - - SIGALRM : constant Interrupt_ID := - System.OS_Interface.SIGALRM; -- alarm clock - - SIGTERM : constant Interrupt_ID := - System.OS_Interface.SIGTERM; -- software termination signal from kill - - SIGURG : constant Interrupt_ID := - System.OS_Interface.SIGURG; -- urgent condition on IO channel - - SIGSTOP : constant Interrupt_ID := - System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored) - - SIGTSTP : constant Interrupt_ID := - System.OS_Interface.SIGTSTP; -- user stop requested from tty - - SIGCONT : constant Interrupt_ID := - System.OS_Interface.SIGCONT; -- stopped process has been continued - - SIGCHLD : constant Interrupt_ID := - System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD - - SIGCLD : constant Interrupt_ID := - System.OS_Interface.SIGCLD; -- child status change - - SIGTTIN : constant Interrupt_ID := - System.OS_Interface.SIGTTIN; -- background tty read attempted - - SIGTTOU : constant Interrupt_ID := - System.OS_Interface.SIGTTOU; -- background tty write attempted - - SIGIO : constant Interrupt_ID := -- input/output possible, - System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris) - - S
[gcc r15-6112] Ada: Fix GNU/Hurd priority range
https://gcc.gnu.org/g:d56e82d1a9370b33d91ccdd7289e854f6604a563 commit r15-6112-gd56e82d1a9370b33d91ccdd7289e854f6604a563 Author: Samuel Thibault Date: Tue Dec 10 21:51:48 2024 +0100 Ada: Fix GNU/Hurd priority range GNU/Mach currently uses a 0..63 range. gcc/ada/ChangeLog: * libgnat/system-gnu.ads: New file. * Makefile.rtl (x86-gnuhurd): Use libgnat/system-gnu.ads instead of libgnat/system-freebsd.ads. Signed-off-by: Samuel Thibault Diff: --- gcc/ada/Makefile.rtl | 2 +- gcc/ada/libgnat/system-gnu.ads | 148 + 2 files changed, 149 insertions(+), 1 deletion(-) diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index dea6fef6a88d..67c17eaa4a0e 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -1735,7 +1735,7 @@ ifeq ($(strip $(filter-out %86 pc gnu,$(target_cpu) $(target_vendor) $(target_os $(TRASYM_DWARF_UNIX_PAIRS) \ $(ATOMICS_TARGET_PAIRS) \ $(X86_TARGET_PAIRS) \ - system.adshttp://www.gnu.org/licenses/>. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +-- + +package System is + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). + + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + + type Name is (SYSTEM_NAME_GNAT); + System_Name : constant Name := SYSTEM_NAME_GNAT; + + -- System-Dependent Named Numbers + + Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1); + Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1; + + Max_Binary_Modulus: constant := 2 ** Standard'Max_Integer_Size; + Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; + + Max_Base_Digits : constant := Long_Long_Float'Digits; + Max_Digits: constant := Long_Long_Float'Digits; + + Max_Mantissa : constant := Standard'Max_Integer_Size - 1; + Fine_Delta: constant := 2.0 ** (-Max_Mantissa); + + Tick : constant := 0.000_001; + + -- Storage-related Declarations + + type Address is private; + pragma Preelaborable_Initialization (Address); + Null_Address : constant Address; + + Storage_Unit : constant := 8; + Word_Size: constant := Standard'Word_Size; + Memory_Size : constant := 2 ** Word_Size; + + -- Address comparison + + function "<" (Left, Right : Address) return Boolean; + function "<=" (Left, Right : Address) return Boolean; + function ">" (Left, Right : Address) return Boolean; + function ">=" (Left, Right : Address) return Boolean; + function "=" (Left, Right : Address) return Boolean; + + pragma Import (Intrinsic, "<"); + pragma Import (Intrinsic, "<="); + pragma Import (Intrinsic, ">"); + pragma Import (Intrinsic, ">="); + pragma Import (Intrinsic, "="); + + -- Other System-Dependent Declarations + + type Bit_Order is (High_Order_First, Low_Order_First); + Default_Bit_Order : constant Bit_Order := + Bit_Order'Val (Standard'Default_Bit_Order); + pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning + + -- Priority-related Declarations (RM D.1) + + Max_Priority : constant Positive := 0; + Max_Interrupt_Priority : constant Positive := 63; + + subtype Any_Priority is Integer range 0 .. 63; + subtype Priority is Any_Priority range 0 .. 60; + subtype Interrupt_Priority is Any_Priority range 63 .. 63; + + Default_Priority : constant Priority := 25; + +private + + type Address is mod Memory_Size; + for Address'Size use Standard'Address_Size; + + Null_Address : constant Address := 0; + + -- + -- System Implementation Parameters -- + -- + + -- These parameters provide information about the target that is used + -- by the compiler. They are in the private part of System, where they + -- can be accessed using the special circuitry in the Targparm unit + -- whose source should be consulted for more detailed descriptions + -- of the individual switch values. + + Backend_Divide_Checks : constant Boolean := False; + Backend_Overflow_Checks : constant Boolean := True; + Command_Line_Args : constant Boolean := True; + Configurable_Run_Time : constant Boolean := False; + Denorm
[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Utilisation gfc_clear_descriptor dans gfc_conv_derived_to_class
https://gcc.gnu.org/g:fc1734ccc2996a69ad2f1b13006d0745ba57b97b commit fc1734ccc2996a69ad2f1b13006d0745ba57b97b Author: Mikael Morin Date: Wed Dec 11 16:03:10 2024 +0100 Utilisation gfc_clear_descriptor dans gfc_conv_derived_to_class Diff: --- gcc/fortran/trans-expr.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 41d06a99f757..d07c3e12a4e4 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -960,10 +960,9 @@ gfc_conv_derived_to_class (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym, tmp = gfc_finish_block (&block); gfc_init_block (&block); - gfc_conv_descriptor_data_set (&block, ctree, null_pointer_node); + gfc_clear_descriptor (&block, fsym, ctree); if (derived_array && *derived_array != NULL_TREE) - gfc_conv_descriptor_data_set (&block, *derived_array, - null_pointer_node); + gfc_clear_descriptor (&block, fsym, *derived_array); tmp = build3_v (COND_EXPR, cond_optional, tmp, gfc_finish_block (&block));
[gcc r15-6114] input.cc: rename file_cache:in_context
https://gcc.gnu.org/g:e4ef3aa2911f1a1548089712b0bf34c812c19438 commit r15-6114-ge4ef3aa2911f1a1548089712b0bf34c812c19438 Author: David Malcolm Date: Wed Dec 11 10:14:37 2024 -0500 input.cc: rename file_cache:in_context No functional change intended. gcc/ChangeLog: * input.cc (file_cache::initialize_input_context): Rename member "in_context" to "m_input_context". (file_cache::add_file): Likewise. * input.h (class file_cache): Likewise. Signed-off-by: David Malcolm Diff: --- gcc/input.cc | 6 +++--- gcc/input.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/input.cc b/gcc/input.cc index 20b5f62371ac..7fc683db23f1 100644 --- a/gcc/input.cc +++ b/gcc/input.cc @@ -45,8 +45,8 @@ void file_cache::initialize_input_context (diagnostic_input_charset_callback ccb, bool should_skip_bom) { - in_context.ccb = (ccb ? ccb : default_charset_callback); - in_context.should_skip_bom = should_skip_bom; + m_input_context.ccb = (ccb ? ccb : default_charset_callback); + m_input_context.should_skip_bom = should_skip_bom; } /* This is a cache used by get_next_line to store the content of a @@ -435,7 +435,7 @@ file_cache::add_file (const char *file_path) unsigned highest_use_count = 0; file_cache_slot *r = evicted_cache_tab_entry (&highest_use_count); - if (!r->create (in_context, file_path, fp, highest_use_count)) + if (!r->create (m_input_context, file_path, fp, highest_use_count)) return NULL; return r; } diff --git a/gcc/input.h b/gcc/input.h index c6eb1aeda3e9..a5863eb9e091 100644 --- a/gcc/input.h +++ b/gcc/input.h @@ -162,7 +162,7 @@ class file_cache private: static const size_t num_file_slots = 16; file_cache_slot *m_file_slots; - input_context in_context; + input_context m_input_context; }; extern expanded_location
[gcc r15-6116] c++: print z candidate count and number them (v2)
https://gcc.gnu.org/g:d3dd24acd74605488ebdb93c8b95da958053d43f commit r15-6116-gd3dd24acd74605488ebdb93c8b95da958053d43f Author: David Malcolm Date: Wed Dec 11 10:24:26 2024 -0500 c++: print z candidate count and number them (v2) Changed in v2: changed wording to "there is"/"there are" rather than "we found". This patch is a followup to: "c++: use diagnostic nesting [PR116253]" Following Sy Brand's UX suggestions in P2429R0 for example 1, this patch tweaks print_z_candidates to add a note about the number of candidates, and adds a candidate number to each one. Various examples of output can be seen in the testsuite part of the patch. gcc/cp/ChangeLog: * call.cc (print_z_candidates): Count the number of candidates and issue a note stating the count at an intermediate nesting level. Number the individual candidates. gcc/testsuite/ChangeLog: * g++.dg/concepts/diagnostic9.C: Update expected results for candidate count and numbering. * g++.dg/concepts/nested-diagnostics-1-truncated.C: * g++.dg/concepts/nested-diagnostics-1.C: Likewise. * g++.dg/concepts/nested-diagnostics-2.C: Likewise. * g++.dg/cpp23/explicit-obj-lambda11.C: Likewise. * g++.dg/cpp2a/desig4.C: Likewise. * g++.dg/cpp2a/desig6.C: Likewise. * g++.dg/cpp2a/spaceship-eq15.C: Likewise. * g++.dg/diagnostic/function-color1.C: Likewise. * g++.dg/diagnostic/param-type-mismatch-2.C: Likewise. * g++.dg/diagnostic/pr100716-1.C: Likewise. * g++.dg/diagnostic/pr100716.C: Likewise. * g++.dg/lookup/operator-2.C: Likewise. * g++.dg/lookup/pr80891-5.C: Likewise. * g++.dg/modules/adhoc-1_b.C: Likewise. * g++.dg/modules/err-1_c.C: Likewise. * g++.dg/modules/err-1_d.C: Likewise. * g++.dg/other/return2.C: Likewise. * g++.dg/overload/error6.C: Likewise. * g++.dg/template/local6.C: Likewise. Signed-off-by: David Malcolm Diff: --- gcc/cp/call.cc | 16 +++- gcc/testsuite/g++.dg/concepts/diagnostic9.C| 2 +- .../concepts/nested-diagnostics-1-truncated.C | 25 +++-- .../g++.dg/concepts/nested-diagnostics-1.C | 43 +++--- .../g++.dg/concepts/nested-diagnostics-2.C | 27 +++--- gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda11.C | 3 +- gcc/testsuite/g++.dg/cpp2a/desig4.C| 4 +- gcc/testsuite/g++.dg/cpp2a/desig6.C| 4 +- gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C| 8 ++-- gcc/testsuite/g++.dg/diagnostic/function-color1.C | 2 +- .../g++.dg/diagnostic/param-type-mismatch-2.C | 10 - gcc/testsuite/g++.dg/diagnostic/pr100716-1.C | 14 +++ gcc/testsuite/g++.dg/diagnostic/pr100716.C | 14 +++ gcc/testsuite/g++.dg/lookup/operator-2.C | 2 +- gcc/testsuite/g++.dg/lookup/pr80891-5.C| 6 +-- gcc/testsuite/g++.dg/modules/adhoc-1_b.C | 4 +- gcc/testsuite/g++.dg/modules/err-1_c.C | 10 ++--- gcc/testsuite/g++.dg/modules/err-1_d.C | 6 +-- gcc/testsuite/g++.dg/other/return2.C | 2 +- gcc/testsuite/g++.dg/overload/error6.C | 4 +- gcc/testsuite/g++.dg/template/local6.C | 2 +- 21 files changed, 116 insertions(+), 92 deletions(-) diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 43f229d6f693..c8420db568ea 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -4133,6 +4133,16 @@ print_z_candidates (location_t loc, struct z_candidate *candidates, auto_diagnostic_nesting_level sentinel; + int num_candidates = 0; + for (auto iter = candidates; iter; iter = iter->next) +++num_candidates; + + inform_n (loc, + num_candidates, "there is %i candidate", "there are %i candidates", + num_candidates); + auto_diagnostic_nesting_level sentinel2; + + int candidate_idx = 0; for (; candidates; candidates = candidates->next) { if (only_viable_p.is_true () && candidates->viable != 1) @@ -4143,7 +4153,11 @@ print_z_candidates (location_t loc, struct z_candidate *candidates, "use %<-fdiagnostics-all-candidates%> to display them"); break; } - print_z_candidate (loc, N_("candidate:"), candidates); + pretty_printer pp; + pp_printf (&pp, N_("candidate %i:"), candidate_idx + 1); + const char *const msgstr = pp_formatted_text (&pp); + print_z_candidate (loc, msgstr, candidates); + ++candidate_idx; } } diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic9.C b/gcc/testsuite/g++.dg/concepts/diagnostic9.C index 8eecfe6f81dd..e3617145ac12 100644 --- a/gcc/testsuite/g++.dg/concepts/diagnostic9.C +++ b/gcc/testsuite/g++.dg/con
[gcc r15-6117] diagnostics: suppress "note: " prefix in nested diagnostics [PR116253]
https://gcc.gnu.org/g:7435d1dbae8ae1db239228811b1e1f2452674704 commit r15-6117-g7435d1dbae8ae1db239228811b1e1f2452674704 Author: David Malcolm Date: Wed Dec 11 10:26:17 2024 -0500 diagnostics: suppress "note: " prefix in nested diagnostics [PR116253] This patch is a followup to: "c++: use diagnostic nesting [PR116253]" This patch tweaks how text output with experimental-nesting=yes prints nested diagnostics, by omitting the leading "note: " from nested notes. This reduces the amount of visual cruft the user has to ignore when reading C++ template errors; see the examples in the testsuite. This doesn't affect the output for users who have not opted-in to nested diagnostic-printing. gcc/ChangeLog: PR other/116253 * diagnostic-format-text.cc (build_prefix): Don't add the "note: " prefix when showing nested diagnostics. gcc/testsuite/ChangeLog: PR other/116253 * g++.dg/concepts/nested-diagnostics-1-truncated.C: Update expected output. * g++.dg/concepts/nested-diagnostics-1.C: Likewise. * g++.dg/concepts/nested-diagnostics-2.C: Likewise. * gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c: Likewise. * gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c: Likewise. * gcc.dg/plugin/diagnostic-test-nesting-text-indented.c: Likewise. Signed-off-by: David Malcolm Diff: --- gcc/diagnostic-format-text.cc | 6 ++ .../concepts/nested-diagnostics-1-truncated.C | 20 +- .../g++.dg/concepts/nested-diagnostics-1.C | 24 +++--- .../g++.dg/concepts/nested-diagnostics-2.C | 20 +- ...nostic-test-nesting-text-indented-show-levels.c | 24 +++--- ...diagnostic-test-nesting-text-indented-unicode.c | 24 +++--- .../plugin/diagnostic-test-nesting-text-indented.c | 24 +++--- 7 files changed, 74 insertions(+), 68 deletions(-) diff --git a/gcc/diagnostic-format-text.cc b/gcc/diagnostic-format-text.cc index 2f26582fa2be..856d25e8482c 100644 --- a/gcc/diagnostic-format-text.cc +++ b/gcc/diagnostic-format-text.cc @@ -309,6 +309,12 @@ build_prefix (const diagnostic_info &diagnostic) const if (m_show_nesting && nesting_level > 0) { char *indent_prefix = build_indent_prefix (true); + + /* Reduce verbosity of nested diagnostics by not printing "note: " +all the time. */ + if (diagnostic.kind == DK_NOTE) + return indent_prefix; + char *result = build_message_string ("%s%s%s%s", indent_prefix, text_cs, text, text_ce); free (indent_prefix); diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C index 3f1f494dcf51..0cb16105bb5b 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C @@ -26,17 +26,17 @@ int main() { } /* { dg-begin-multiline-output "" } - * note: there are 3 candidates -* note: candidate 1: 'template requires pettable void pet(auto:1)' - * note: template argument deduction/substitution failed: -* note: constraints not satisfied + * there are 3 candidates +* candidate 1: 'template requires pettable void pet(auto:1)' + * template argument deduction/substitution failed: +* constraints not satisfied * In substitution of 'template requires pettable void pet(auto:1) [with auto:1 = lizard]': * required from here * required for the satisfaction of 'pettable' [with auto:1 = lizard] - * note: no operand of the disjunction is satisfied - * note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail -* note: candidate 2: 'void pet(dog)' - * note: no known conversion for argument 1 from 'lizard' to 'dog' -* note: candidate 3: 'void pet(cat)' - * note: no known conversion for argument 1 from 'lizard' to 'cat' + * no operand of the disjunction is satisfied + * set '-fconcepts-diagnostics-depth=' to at least 2 for more detail +* candidate 2: 'void pet(dog)' + * no known conversion for argument 1 from 'lizard' to 'dog' +* candidate 3: 'void pet(cat)' + * no known conversion for argument 1 from 'lizard' to 'cat' { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C index 8713046df6d7..e642676841d3 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C @@ -27,26 +27,26 @@ int main() { } /* { dg-begin-multiline-output "" } -
[gcc r15-6115] diagnostics: tweak output for nested messages [PR116253]
https://gcc.gnu.org/g:331226fd87c2010928329ef35b6d4f680d9234d1 commit r15-6115-g331226fd87c2010928329ef35b6d4f680d9234d1 Author: David Malcolm Date: Wed Dec 11 10:21:35 2024 -0500 diagnostics: tweak output for nested messages [PR116253] When printing nested messages with -fdiagnostics-set-output=text:experimental-nesting=yes avoid printing a line such as the "cc1plus:" in the following: • note: set ‘-fconcepts-diagnostics-depth=’ to at least 2 for more detail cc1plus: for "special" locations such as UNKNOWN_LOCATION. gcc/ChangeLog: PR other/116253 * diagnostic-format-text.cc (on_report_diagnostic): When showing locations for nested messages on new lines, don't print UNKNOWN_LOCATION or BUILTINS_LOCATION. Signed-off-by: David Malcolm Diff: --- gcc/diagnostic-format-text.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/diagnostic-format-text.cc b/gcc/diagnostic-format-text.cc index d85c88083485..2f26582fa2be 100644 --- a/gcc/diagnostic-format-text.cc +++ b/gcc/diagnostic-format-text.cc @@ -226,11 +226,12 @@ on_report_diagnostic (const diagnostic_info &diagnostic, const int nesting_level = get_context ().get_diagnostic_nesting_level (); if (nesting_level > 0) { + location_t loc = diagnostic_location (&diagnostic); pp_set_prefix (pp, nullptr); char *indent_prefix = build_indent_prefix (false); /* Only print changes of location. */ - if (diagnostic_location (&diagnostic) - != get_context ().m_last_location) + if (loc != get_context ().m_last_location + && loc > BUILTINS_LOCATION) { const expanded_location s = diagnostic_expand_location (&diagnostic);
[gcc r15-6118] c++: tweak colorization of incompatible declspecs
https://gcc.gnu.org/g:4b4023d52986b20369a0bdc9366d82c2b2f1efc7 commit r15-6118-g4b4023d52986b20369a0bdc9366d82c2b2f1efc7 Author: David Malcolm Date: Wed Dec 11 10:32:14 2024 -0500 c++: tweak colorization of incompatible declspecs Introduce a helper function for complaining about "signed unsigned" and "short long". Add colorization there so that e.g. the 'signed' and 'unsigned' are given consistent contrasting colors in both the message and the quoted source. gcc/cp/ChangeLog: * decl.cc: Add #include "diagnostic-highlight-colors.h" and #include "pretty-print-markup.h". (complain_about_incompatible_declspecs): New. (grokdeclarator): Use it when complaining about both 'signed' and 'unsigned', and both 'long' and 'short'. gcc/ChangeLog: * diagnostic-highlight-colors.h: Tweak comment. * pretty-print-markup.h (class pp_element_quoted_string): New, based on pretty-print.cc's selftest::test_element, adding an optional highlight color. * pretty-print.cc (class test_element): Drop. (selftest::test_pp_format): Use pp_element_quoted_string. (selftest::test_urlification): Likewise. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/long-short-colorization.C: New test. Signed-off-by: David Malcolm Diff: --- gcc/cp/decl.cc | 36 +++--- gcc/diagnostic-highlight-colors.h | 3 +- gcc/pretty-print-markup.h | 25 +++ gcc/pretty-print.cc| 22 ++--- .../g++.dg/diagnostic/long-short-colorization.C| 20 5 files changed, 75 insertions(+), 31 deletions(-) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 2b56e15eb1a6..4ba6e3784cac 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -61,6 +61,8 @@ along with GCC; see the file COPYING3. If not see #include "langhooks-def.h" /* For lhd_simulate_record_decl */ #include "coroutines.h" #include "gcc-urlifier.h" +#include "diagnostic-highlight-colors.h" +#include "pretty-print-markup.h" /* Possible cases of bad specifiers type used by bad_specifiers. */ enum bad_spec_place { @@ -12437,6 +12439,23 @@ check_decltype_auto (location_t loc, tree type) return false; } +/* Issue an error about two mutually incompatible declspecs + with the given names and locations + e.g. "error: `signed' and `unsigned' specified together" */ + +static void +complain_about_incompatible_declspecs (const char *name_a, location_t loc_a, + const char *name_b, location_t loc_b) +{ + gcc_rich_location richloc (loc_a, nullptr, highlight_colors::lhs); + richloc.add_range (loc_b, SHOW_RANGE_WITHOUT_CARET, +nullptr, highlight_colors::rhs); + pp_element_quoted_string e_name_a (name_a, highlight_colors::lhs); + pp_element_quoted_string e_name_b (name_b, highlight_colors::rhs); + error_at (&richloc, "%e and %e specified together", + &e_name_a, &e_name_b); +} + /* Given declspecs and a declarator (abstract or otherwise), determine the name and type of the object declared and construct a DECL node for it. @@ -13070,18 +13089,13 @@ grokdeclarator (const cp_declarator *declarator, int ok = 0; if (signed_p && unsigned_p) - { - gcc_rich_location richloc (declspecs->locations[ds_signed]); - richloc.add_range (declspecs->locations[ds_unsigned]); - error_at (&richloc, - "% and % specified together"); - } + complain_about_incompatible_declspecs + ("signed", declspecs->locations[ds_signed], + "unsigned", declspecs->locations[ds_unsigned]); else if (long_p && short_p) - { - gcc_rich_location richloc (declspecs->locations[ds_long]); - richloc.add_range (declspecs->locations[ds_short]); - error_at (&richloc, "% and % specified together"); - } + complain_about_incompatible_declspecs + ("long", declspecs->locations[ds_long], + "short", declspecs->locations[ds_short]); else if (TREE_CODE (type) != INTEGER_TYPE || type == char8_type_node || type == char16_type_node diff --git a/gcc/diagnostic-highlight-colors.h b/gcc/diagnostic-highlight-colors.h index 66acfc8e8145..72e3ade358dc 100644 --- a/gcc/diagnostic-highlight-colors.h +++ b/gcc/diagnostic-highlight-colors.h @@ -47,7 +47,8 @@ namespace highlight_colors { extern const char *const expected; extern const char *const actual; -/* Color names for expressing "LHS" vs "RHS" values in a binary operation. */ +/* Color names for expressing "LHS" vs "RHS" values in a binary operation + or when we are listing two different things. */ extern const char *const lhs; extern const char *const rhs; diff --git a/gcc/pretty-
[gcc/aoliva/heads/testme] ifcombine field-merge: saturate align at inner object size
The branch 'aoliva/heads/testme' was updated to point to: 8cc16190a694... ifcombine field-merge: saturate align at inner object size It previously pointed to: e58a7d75e81b... ifcombine field-merge: saturate align at inner object size Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- e58a7d7... ifcombine field-merge: saturate align at inner object size Summary of changes (added commits): --- 8cc1619... ifcombine field-merge: saturate align at inner object size
[gcc(refs/users/aoliva/heads/testme)] ifcombine field-merge: saturate align at inner object size
https://gcc.gnu.org/g:8cc16190a694af2fb4c6d10456b6bea5adaa0ce8 commit 8cc16190a694af2fb4c6d10456b6bea5adaa0ce8 Author: Alexandre Oliva Date: Tue Dec 10 06:49:32 2024 -0300 ifcombine field-merge: saturate align at inner object size A bootstrap on aarch64-linux-gnu revealed that sometimes (for example, when building shorten_branches in final.cc) we will find such things as MEM , where unsigned int happen to be a variant of the original unsigned int type, given 64-bit alignment. This unusual alignment circumstance caused get_best_mode to choose DImode instead of SImode, and that failed gimple verification because there aren't that many bits in the unsigned int object. Arrange for alignment to saturate at the inner object size to avoid tripping this error. for gcc/ChangeLog * gimple-fold.cc (fold_truth_andor_for_ifcombine): Saturate align at inner object size. Diff: --- gcc/gimple-fold.cc | 41 +++-- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index a31fc283d51b..8f45428dc5d9 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -8204,24 +8204,26 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, to be relative to a field of that size. */ first_bit = MIN (ll_bitpos, rl_bitpos); end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize); - if (get_best_mode (end_bit - first_bit, first_bit, 0, 0, -TYPE_ALIGN (TREE_TYPE (ll_inner)), BITS_PER_WORD, -volatilep, &lnmode)) + HOST_WIDE_INT ll_align = TYPE_ALIGN (TREE_TYPE (ll_inner)); + poly_uint64 ll_end_region = 0; + if (uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (ll_inner +ll_end_region = tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (ll_inner))); + if (get_best_mode (end_bit - first_bit, first_bit, 0, ll_end_region, +ll_align, BITS_PER_WORD, volatilep, &lnmode)) l_split_load = false; else { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (ll_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); + (ll_align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); if (boundary < 0 - || !get_best_mode (boundary - first_bit, first_bit, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode) - || !get_best_mode (end_bit - boundary, boundary, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode2)) + || !get_best_mode (boundary - first_bit, first_bit, 0, ll_end_region, +ll_align, BITS_PER_WORD, volatilep, &lnmode) + || !get_best_mode (end_bit - boundary, boundary, 0, ll_end_region, +ll_align, BITS_PER_WORD, volatilep, &lnmode2)) return 0; /* If we can't have a single load, but can with two, figure out whether @@ -8368,16 +8370,18 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, and then we use two separate compares. */ first_bit = MIN (lr_bitpos, rr_bitpos); end_bit = MAX (lr_bitpos + lr_bitsize, rr_bitpos + rr_bitsize); - if (!get_best_mode (end_bit - first_bit, first_bit, 0, 0, - TYPE_ALIGN (TREE_TYPE (lr_inner)), BITS_PER_WORD, - volatilep, &rnmode)) + HOST_WIDE_INT lr_align = TYPE_ALIGN (TREE_TYPE (lr_inner)); + poly_uint64 lr_end_region = 0; + if (uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (lr_inner + lr_end_region = tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (lr_inner))); + if (!get_best_mode (end_bit - first_bit, first_bit, 0, lr_end_region, + lr_align, BITS_PER_WORD, volatilep, &rnmode)) { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (lr_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); + (lr_align, lr_bitpos, lr_bitsize, rr_bitpos, rr_bitsize); if (boundary < 0 /* If we're to split both, make sure the split point is @@ -8385,10 +8389,11 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, || (l_split_load && (boundary - lr_bitpos != (lnbitpos + GET_MODE_BITSIZE (lnmode)) - ll_bitpos)) - || !get_best_mode (boundary -
[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] essai suppression
https://gcc.gnu.org/g:f197e8e4368ff21896d92bc57c0d583f878ba154 commit f197e8e4368ff21896d92bc57c0d583f878ba154 Author: Mikael Morin Date: Wed Dec 11 17:09:19 2024 +0100 essai suppression Diff: --- gcc/fortran/trans-expr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index d07c3e12a4e4..03175aff881e 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -7535,7 +7535,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, /* Unallocated allocatable arrays and unassociated pointer arrays need their dtype setting if they are argument associated with assumed rank dummies to set the rank. */ - set_dtype_for_unallocated (&parmse, e); + //set_dtype_for_unallocated (&parmse, e); } else if (e->expr_type == EXPR_VARIABLE && e->symtree->n.sym->attr.dummy
[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Suppression fonction inutilisée
https://gcc.gnu.org/g:44959b9e60a913e4b1ed682a072a9c1e001d8ef2 commit 44959b9e60a913e4b1ed682a072a9c1e001d8ef2 Author: Mikael Morin Date: Wed Dec 11 17:12:16 2024 +0100 Suppression fonction inutilisée Diff: --- gcc/fortran/trans-expr.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 03175aff881e..dcbc75844fda 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -5723,6 +5723,7 @@ expr_may_alias_variables (gfc_expr *e, bool array_may_alias) /* A helper function to set the dtype for unallocated or unassociated entities. */ +#if 0 static void set_dtype_for_unallocated (gfc_se *parmse, gfc_expr *e) @@ -5765,7 +5766,7 @@ set_dtype_for_unallocated (gfc_se *parmse, gfc_expr *e) build_empty_stmt (input_location)); gfc_add_expr_to_block (&parmse->pre, cond); } - +#endif /* Provide an interface between gfortran array descriptors and the F2018:18.4
[gcc/aoliva/heads/testme] ifcombine field-merge: saturate align at inner object size
The branch 'aoliva/heads/testme' was updated to point to: 321efd0c8983... ifcombine field-merge: saturate align at inner object size It previously pointed to: 8cc16190a694... ifcombine field-merge: saturate align at inner object size Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- 8cc1619... ifcombine field-merge: saturate align at inner object size Summary of changes (added commits): --- 321efd0... ifcombine field-merge: saturate align at inner object size
[gcc(refs/users/aoliva/heads/testme)] ifcombine field-merge: saturate align at inner object size
https://gcc.gnu.org/g:321efd0c8983659b43843d9877166801678ace9b commit 321efd0c8983659b43843d9877166801678ace9b Author: Alexandre Oliva Date: Tue Dec 10 06:49:32 2024 -0300 ifcombine field-merge: saturate align at inner object size A bootstrap on aarch64-linux-gnu revealed that sometimes (for example, when building shorten_branches in final.cc) we will find such things as MEM , where unsigned int happen to be a variant of the original unsigned int type, given 64-bit alignment. This unusual alignment circumstance caused get_best_mode to choose DImode instead of SImode, and that failed gimple verification because there aren't that many bits in the unsigned int object. Arrange for alignment to saturate at the inner object size to avoid tripping this error. for gcc/ChangeLog * gimple-fold.cc (fold_truth_andor_for_ifcombine): Saturate align at inner object size. Diff: --- gcc/gimple-fold.cc | 52 ++-- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index a31fc283d51b..9179010c9eaf 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -7751,6 +7751,15 @@ make_bit_field_load (location_t loc, tree inner, tree orig_inner, tree type, if (!point) return ref; + /* If we're remaking the same load, reuse the SSA NAME it is already loaded + into. */ + if (gimple_assign_load_p (point) + && operand_equal_p (ref, gimple_assign_rhs1 (point))) +{ + gcc_checking_assert (TREE_CODE (gimple_assign_lhs (point)) == SSA_NAME); + return gimple_assign_lhs (point); +} + gimple_seq stmts = NULL; tree ret = force_gimple_operand (ref, &stmts, true, NULL_TREE); @@ -8204,24 +8213,27 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, to be relative to a field of that size. */ first_bit = MIN (ll_bitpos, rl_bitpos); end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize); - if (get_best_mode (end_bit - first_bit, first_bit, 0, 0, -TYPE_ALIGN (TREE_TYPE (ll_inner)), BITS_PER_WORD, -volatilep, &lnmode)) + HOST_WIDE_INT ll_align = TYPE_ALIGN (TREE_TYPE (ll_inner)); + poly_uint64 ll_end_region = 0; + if (TYPE_SIZE (TREE_TYPE (ll_inner)) + && uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (ll_inner +ll_end_region = tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (ll_inner))); + if (get_best_mode (end_bit - first_bit, first_bit, 0, ll_end_region, +ll_align, BITS_PER_WORD, volatilep, &lnmode)) l_split_load = false; else { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ - HOST_WIDE_INT align = TYPE_ALIGN (TREE_TYPE (ll_inner)); HOST_WIDE_INT boundary = compute_split_boundary_from_align - (align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); + (ll_align, ll_bitpos, ll_bitsize, rl_bitpos, rl_bitsize); if (boundary < 0 - || !get_best_mode (boundary - first_bit, first_bit, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode) - || !get_best_mode (end_bit - boundary, boundary, 0, 0, -align, BITS_PER_WORD, volatilep, &lnmode2)) + || !get_best_mode (boundary - first_bit, first_bit, 0, ll_end_region, +ll_align, BITS_PER_WORD, volatilep, &lnmode) + || !get_best_mode (end_bit - boundary, boundary, 0, ll_end_region, +ll_align, BITS_PER_WORD, volatilep, &lnmode2)) return 0; /* If we can't have a single load, but can with two, figure out whether @@ -8368,16 +8380,19 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, and then we use two separate compares. */ first_bit = MIN (lr_bitpos, rr_bitpos); end_bit = MAX (lr_bitpos + lr_bitsize, rr_bitpos + rr_bitsize); - if (!get_best_mode (end_bit - first_bit, first_bit, 0, 0, - TYPE_ALIGN (TREE_TYPE (lr_inner)), BITS_PER_WORD, - volatilep, &rnmode)) + HOST_WIDE_INT lr_align = TYPE_ALIGN (TREE_TYPE (lr_inner)); + poly_uint64 lr_end_region = 0; + if (TYPE_SIZE (TREE_TYPE (lr_inner)) + && uniform_integer_cst_p (TYPE_SIZE (TREE_TYPE (lr_inner + lr_end_region = tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (lr_inner))); + if (!get_best_mode (end_bit - first_bit, first_bit, 0, lr_end_region, + lr_align, BITS_PER_WORD, volatilep, &rnmode)) { /* Consider the possibility of recombining loads if any of the fields straddles across an alignment boundary, so that either part can be loaded along with the other field. */ -
[gcc r15-6119] c++: allow stores to anon union vars to change current union member in constexpr [PR117614]
https://gcc.gnu.org/g:337815c8bbd0fb5034223ad0e7899d1493e958a2 commit r15-6119-g337815c8bbd0fb5034223ad0e7899d1493e958a2 Author: Jakub Jelinek Date: Wed Dec 11 17:28:47 2024 +0100 c++: allow stores to anon union vars to change current union member in constexpr [PR117614] Since r14-4771 the FE tries to differentiate between cases where the lhs of a store allows changing the current union member and cases where it doesn't, and cases where it doesn't includes everything that has gone through the cxx_eval_constant_expression path on the lhs. As the testcase shows, DECL_ANON_UNION_VAR_P vars were handled like that too, even when stores to them are the only way how to change the current union member in the sources. So, the following patch just handles that case manually without calling cxx_eval_constant_expression and without setting evaluated to true. 2024-12-11 Jakub Jelinek PR c++/117614 * constexpr.cc (cxx_eval_store_expression): For stores to DECL_ANON_UNION_VAR_P vars just continue with DECL_VALUE_EXPR of it, without setting evaluated to true or full cxx_eval_constant_expression. * g++.dg/cpp2a/constexpr-union8.C: New test. Diff: --- gcc/cp/constexpr.cc | 8 +++ gcc/testsuite/g++.dg/cpp2a/constexpr-union8.C | 31 +++ 2 files changed, 39 insertions(+) diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 08765c9caa61..c16597dfaece 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -6418,6 +6418,14 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, object = probe; else { + tree pvar = tree_strip_any_location_wrapper (probe); + if (VAR_P (pvar) && DECL_ANON_UNION_VAR_P (pvar)) + { + /* Stores to DECL_ANON_UNION_VAR_P var are allowed to change +active union member. */ + probe = DECL_VALUE_EXPR (pvar); + break; + } probe = cxx_eval_constant_expression (ctx, probe, vc_glvalue, non_constant_p, overflow_p); evaluated = true; diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-union8.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-union8.C new file mode 100644 index ..1e51857b3dff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-union8.C @@ -0,0 +1,31 @@ +// PR c++/117614 +// { dg-do compile { target c++20 } } + +constexpr int +foo () +{ + union { +int x{0}; +char y; + }; + y = 1; + return y; +} + +constexpr int +bar () +{ + union { +union { + int x{0}; + char y; +}; +long long z; + }; + y = 1; + z = 2; + return z; +} + +static_assert (foo () == 1); +static_assert (bar () == 2);
[gcc r15-6102] autoupdate: replace obsolete macros in libiberty
https://gcc.gnu.org/g:f78b4da602b2bde56182765980c7e009285b1a04 commit r15-6102-gf78b4da602b2bde56182765980c7e009285b1a04 Author: Matthieu Longo Date: Tue May 28 10:49:41 2024 +0100 autoupdate: replace obsolete macros in libiberty Autoreconf-2.72 warns about obsolete macros. This patch aims at removing the noise from a future upgrade to autoreconf-2.72 or later. This is in no a way a complete patch allowing the upgrade to autoreconf-2.72. - AC_GNU_SOURCE by AC_USE_SYSTEM_EXTENSIONS https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/ autoconf.html#index-AC_005fGNU_005fSOURCE-1 - AC_CONFIG_HEADER by AC_CONFIG_HEADERS https://www.gnu.org/software/automake/manual/1.12.2/html_node/Obsolete- Macros.html#index-AM_005fCONFIG_005fHEADER Those fixes were originally submitted in a patch series in binutils. https://inbox.sourceware.org/binutils/878qthm6a0@gentoo.org/ libiberty/ChangeLog: * configure: Regenerate. * configure.ac: Fix autoupdate warnings. Diff: --- libiberty/configure| 1 - libiberty/configure.ac | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libiberty/configure b/libiberty/configure index 5c69fee56c10..38856a07e5f0 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -4413,7 +4413,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 0888e6388965..c27e08e14288 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -172,7 +172,7 @@ AC_MSG_NOTICE([target_header_dir = $target_header_dir]) GCC_NO_EXECUTABLES AC_PROG_CC -AC_GNU_SOURCE +AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_PROG_CPP_WERROR @@ -205,7 +205,7 @@ dnl AM_PROG_LIBTOOL dnl When we start using automake: dnl AM_CONFIG_HEADER(config.h:config.in) -AC_CONFIG_HEADER(config.h:config.in) +AC_CONFIG_HEADERS([config.h:config.in]) dnl When we start using automake: dnl AM_MAINTAINER_MODE
[gcc r15-6108] middle-end: add vec_init support for variable length subvector concatenation. [PR96342]
https://gcc.gnu.org/g:d069eb91d5696a8642bd5fc44a6d47fd7f74d18b commit r15-6108-gd069eb91d5696a8642bd5fc44a6d47fd7f74d18b Author: Victor Do Nascimento Date: Wed Dec 11 12:00:09 2024 + middle-end: add vec_init support for variable length subvector concatenation. [PR96342] For architectures where the vector-length is a compile-time variable, rather representing a runtime constant, as is the case with SVE it is perfectly reasonable that such vector be made up of two (or more) subvector components of a compatible sub-length variable. One example of this would be the concatenation of two VNx4QI vectors into a single VNx8QI vector. This patch adds initial support for the enablement of this feature in the middle-end, removing the `.is_constant()' constraint on the vector's number of elements, instead making the constant no. of elements the multiple of the number of subvectors (which must then also be of variable length, such that their polynomial ratio then results in a compile-time constant) required to fill the vector. gcc/ChangeLog: PR target/96342 * expr.cc (store_constructor): add support for variable-length vectors. Co-authored-by: Tamar Christina Diff: --- gcc/expr.cc | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index 980ac415cfc7..88fa56cb299d 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -7966,12 +7966,9 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, n_elts = TYPE_VECTOR_SUBPARTS (type); if (REG_P (target) - && VECTOR_MODE_P (mode) - && n_elts.is_constant (&const_n_elts)) + && VECTOR_MODE_P (mode)) { - machine_mode emode = eltmode; - bool vector_typed_elts_p = false; - + const_n_elts = 0; if (CONSTRUCTOR_NELTS (exp) && (TREE_CODE (TREE_TYPE (CONSTRUCTOR_ELT (exp, 0)->value)) == VECTOR_TYPE)) @@ -7980,23 +7977,26 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, gcc_assert (known_eq (CONSTRUCTOR_NELTS (exp) * TYPE_VECTOR_SUBPARTS (etype), n_elts)); - emode = TYPE_MODE (etype); - vector_typed_elts_p = true; + + icode = convert_optab_handler (vec_init_optab, mode, + TYPE_MODE (etype)); + const_n_elts = CONSTRUCTOR_NELTS (exp); + vec_vec_init_p = icode != CODE_FOR_nothing; } - icode = convert_optab_handler (vec_init_optab, mode, emode); - if (icode != CODE_FOR_nothing) + else if (exact_div (n_elts, GET_MODE_NUNITS (eltmode)) + .is_constant (&const_n_elts)) { - unsigned int n = const_n_elts; - - if (vector_typed_elts_p) - { - n = CONSTRUCTOR_NELTS (exp); - vec_vec_init_p = true; - } - vector = rtvec_alloc (n); - for (unsigned int k = 0; k < n; k++) - RTVEC_ELT (vector, k) = CONST0_RTX (emode); + /* For a non-const type vector, we check it is made up of + similarly non-const type vectors. */ + icode = convert_optab_handler (vec_init_optab, mode, eltmode); } + + if (const_n_elts && icode != CODE_FOR_nothing) + { + vector = rtvec_alloc (const_n_elts); + for (unsigned int k = 0; k < const_n_elts; k++) + RTVEC_ELT (vector, k) = CONST0_RTX (eltmode); + } } /* Compute the size of the elements in the CTOR. It differs
[gcc r14-11079] Fortran: Fix READ with padding in BLANK ZERO mode.
https://gcc.gnu.org/g:2d9dbaf06e4cd83125781d1eb760f5404da3d175 commit r14-11079-g2d9dbaf06e4cd83125781d1eb760f5404da3d175 Author: Jerry DeLisle Date: Mon Dec 9 20:11:23 2024 -0800 Fortran: Fix READ with padding in BLANK ZERO mode. PR fortran/117819 libgfortran/ChangeLog: * io/read.c (read_decimal): If the read value is short of the specified width and pad mode is PAD yes, check for BLANK ZERO and adjust the value accordingly. (read_radix): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/pr117819.f90: New test. (cherry picked from commit cf406a6c79ce404c45f99bcf2df3293269dbb462) Diff: --- gcc/testsuite/gfortran.dg/pr117819.f90 | 45 ++ libgfortran/io/read.c | 36 +-- 2 files changed, 73 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/gfortran.dg/pr117819.f90 b/gcc/testsuite/gfortran.dg/pr117819.f90 new file mode 100644 index ..d9a9b7f6f9be --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr117819.f90 @@ -0,0 +1,45 @@ +! { dg-do run } +! PR117819 +Program xe1 + Implicit None + Character(6) string + Integer x + Logical :: ok = .True. + string = '11' + !print *, "String we read from is: ", string + Read(string,1) x +1 Format(BZ,B8) + If (x/=Int(b'1100')) Then +Print *,'FAIL B8 BZ wrong result' +Print *,'Expected',Int(b'1100') +Print *,'Received',x +ok = .False. + End If + string = '123456' + !print *, "String we read from is: ", string + Read(string,2) x +2 Format(BZ,I8) + If (x/=12345600) Then +Print *,'FAIL I8 BZ wrong result' +Print *,'Expected',12345600 +Print *,'Received',x +ok = .False. + End If + Read(string,3) x +3 Format(BZ,O8) + If (x/=Int(o'12345600')) Then +Print *,'FAIL O8 BZ wrong result' +Print *,'Expected',Int(o'12345600') +Print *,'Received',x +ok = .False. + End If + Read(string,4) x +4 Format(BZ,Z8) + If (x/=Int(z'12345600')) Then +Print *,'FAIL OZ BZ wrong result' +Print *,'Expected',Int(z'12345600') +Print *,'Received',x +ok = .False. + End If + If (.not. ok) stop 1 +End Program diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index 7a9e341d7d80..24cfe8599cd0 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -675,11 +675,11 @@ read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length) { GFC_UINTEGER_LARGEST value, maxv, maxv_10; GFC_INTEGER_LARGEST v; - size_t w; + size_t w, padding; int negative; char c, *p; - w = f->u.w; + w = padding = f->u.w; /* This is a legacy extension, and the frontend will only allow such cases * through when -fdec-format-defaults is passed. @@ -692,6 +692,10 @@ read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length) if (p == NULL) return; + /* If the read was not the full width we may need to pad with blanks or zeros + * depending on the PAD mode. Save the number of pad characters needed. */ + padding -= w; + p = eat_leading_spaces (&w, p); if (w == 0) { @@ -729,8 +733,14 @@ read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length) { c = next_char (dtp, &p, &w); if (c == '\0') - break; - + { + if (dtp->u.p.blank_status == BLANK_ZERO) + { + for (size_t n = 0; n < padding; n++) + value = 10 * value; + } + break; + } if (c == ' ') { if (dtp->u.p.blank_status == BLANK_NULL) @@ -778,7 +788,6 @@ read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length) } - /* read_radix()-- This function reads values for non-decimal radixes. The difference here is that we treat the values here as unsigned values for the purposes of overflow. If minus sign is present and @@ -790,17 +799,21 @@ read_radix (st_parameter_dt *dtp, const fnode *f, char *dest, int length, { GFC_UINTEGER_LARGEST value, maxv, maxv_r; GFC_INTEGER_LARGEST v; - size_t w; + size_t w, padding; int negative; char c, *p; - w = f->u.w; + w = padding = f->u.w; p = read_block_form (dtp, &w); if (p == NULL) return; + /* If the read was not the full width we may need to pad with blanks or zeros + * depending on the PAD mode. Save the number of pad characters needed. */ + padding -= w; + p = eat_leading_spaces (&w, p); if (w == 0) { @@ -838,7 +851,14 @@ read_radix (st_parameter_dt *dtp, const fnode *f, char *dest, int length, { c = next_char (dtp, &p, &w); if (c == '\0') - break; + { + if (dtp->u.p.blank_status == BLANK_ZERO) + { + for (size_t n = 0; n < padding; n++) + value = radix * value; + } + break; + } if (c == ' ') { if (dtp->u.p.
[gcc r15-6120] gimple: Add limit after which slower switchlower algs are used [PR117091] [PR117352]
https://gcc.gnu.org/g:56946c801a7cf3a831a11870b7e11ba08bf9bd87 commit r15-6120-g56946c801a7cf3a831a11870b7e11ba08bf9bd87 Author: Filip Kastl Date: Wed Dec 11 19:57:04 2024 +0100 gimple: Add limit after which slower switchlower algs are used [PR117091] [PR117352] This patch adds a limit on the number of cases of a switch. When this limit is exceeded, switch lowering decides to use faster but less powerful algorithms. In particular this means that for finding bit tests switch lowering decides between the old dynamic programming O(n^2) algorithm and the new greedy algorithm that Andi Kleen recently added but then reverted due to PR117352. It also means that switch lowering may bail out on finding jump tables if the switch is too large (Btw it also may not bail! It can happen that the greedy algorithms finds some bit tests which then basically split the switch into multiple smaller switches and those may be small enough to fit under the limit.) The limit is implemented as --param switch-lower-slow-alg-max-cases. Exceeding the limit is reported through -Wdisabled-optimization. This patch fixes the issue with the greedy algorithm described in PR117352. The problem was incorrect usage of the is_beneficial() heuristic. gcc/ChangeLog: PR middle-end/117091 PR middle-end/117352 * doc/invoke.texi: Add switch-lower-slow-alg-max-cases. * params.opt: Add switch-lower-slow-alg-max-cases. * tree-switch-conversion.cc (jump_table_cluster::find_jump_tables): Note in a comment that we are looking for jump tables in case sequences delimited by the already found bit tests. (bit_test_cluster::find_bit_tests): Decide between find_bit_tests_fast() and find_bit_tests_slow(). (bit_test_cluster::find_bit_tests_fast): New function. (bit_test_cluster::find_bit_tests_slow): New function. (switch_decision_tree::analyze_switch_statement): Report exceeding the limit. * tree-switch-conversion.h: Add find_bit_tests_fast() and find_bit_tests_slow(). Co-Authored-By: Andi Kleen Signed-off-by: Filip Kastl Diff: --- gcc/doc/invoke.texi | 3 ++ gcc/params.opt| 4 ++ gcc/tree-switch-conversion.cc | 112 +++--- gcc/tree-switch-conversion.h | 18 +++ 4 files changed, 130 insertions(+), 7 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 14afd1934bd2..3cb9a50b6909 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -16500,6 +16500,9 @@ Switch initialization conversion refuses to create arrays that are bigger than @option{switch-conversion-max-branch-ratio} times the number of branches in the switch. +@item switch-lower-slow-alg-max-cases +Maximum number of cases for slow switch lowering algorithms to be used. + @item max-partial-antic-length Maximum length of the partial antic set computed during the tree partial redundancy elimination optimization (@option{-ftree-pre}) when diff --git a/gcc/params.opt b/gcc/params.opt index 5853bf02f9ee..1c88d5212c40 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -1052,6 +1052,10 @@ Maximum number of instruction distance that a small store forwarded to a larger Common Joined UInteger Var(param_switch_conversion_branch_ratio) Init(8) IntegerRange(1, 65536) Param Optimization The maximum ratio between array size and switch branches for a switch conversion to take place. +-param=switch-lower-slow-alg-max-cases= +Common Joined UInteger Var(param_switch_lower_slow_alg_max_cases) Init(1000) IntegerRange(1, 10) Param Optimization +Maximum number of cases for slow switch lowering algorithms to be used. + -param=modref-max-bases= Common Joined UInteger Var(param_modref_max_bases) Init(32) Param Optimization Maximum number of bases stored in each modref tree. diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc index 3436c2a8b98c..b98e70cf7d16 100644 --- a/gcc/tree-switch-conversion.cc +++ b/gcc/tree-switch-conversion.cc @@ -54,6 +54,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "tree-cfgcleanup.h" #include "hwint.h" #include "internal-fn.h" +#include "diagnostic-core.h" /* ??? For lang_hooks.types.type_for_mode, but is there a word_mode type in the GIMPLE type system that is language-independent? */ @@ -1641,6 +1642,11 @@ jump_table_cluster::find_jump_tables (vec &clusters) return clusters.copy (); unsigned l = clusters.length (); + + /* Note: l + 1 is the number of cases of the switch. */ + if (l + 1 > (unsigned) param_switch_lower_slow_alg_max_cases) +return clusters.copy (); + auto_vec min; min.reserve (l + 1); @@ -1771,16 +1777,80 @@ jump_table_cluster::is_beneficial (const vec &, return
[gcc r15-6121] Fortran: Add DECL_EXPR for variable length assoc name [PR117901]
https://gcc.gnu.org/g:bbb7c53d32ece75ec0c336663ec37df9e63652d3 commit r15-6121-gbbb7c53d32ece75ec0c336663ec37df9e63652d3 Author: Paul Thomas Date: Wed Dec 11 16:14:05 2024 + Fortran: Add DECL_EXPR for variable length assoc name [PR117901] 2024-12-11 Paul Thomas gcc/fortran PR fortran/117901 * trans-stmt.cc (trans_associate_var): A variable character length array associate name must generate a DECL expression for the data pointer type. gcc/testsuite/ PR fortran/117901 * gfortran.dg/pr117901.f90: New test. Diff: --- gcc/fortran/trans-stmt.cc | 14 ++ gcc/testsuite/gfortran.dg/pr117901.f90 | 30 ++ 2 files changed, 44 insertions(+) diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 80a9502a8a41..ae3266fb867f 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -2065,6 +2065,20 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block) || GFC_ARRAY_TYPE_P (TREE_TYPE (se.expr))); gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (sym->backend_decl))); + if (sym->ts.type == BT_CHARACTER) + { + /* Emit a DECL_EXPR for the variable sized array type in so the +gimplification of its type sizes works correctly. */ + tree arraytype; + tmp = TREE_TYPE (sym->backend_decl); + arraytype = TREE_TYPE (GFC_TYPE_ARRAY_DATAPTR_TYPE (tmp)); + if (! TYPE_NAME (arraytype)) + TYPE_NAME (arraytype) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, + NULL_TREE, arraytype); + gfc_add_expr_to_block (&se.pre, build1 (DECL_EXPR, +arraytype, TYPE_NAME (arraytype))); + } + if (GFC_ARRAY_TYPE_P (TREE_TYPE (se.expr))) { if (INDIRECT_REF_P (se.expr)) diff --git a/gcc/testsuite/gfortran.dg/pr117901.f90 b/gcc/testsuite/gfortran.dg/pr117901.f90 new file mode 100644 index ..b5c3a4fc2779 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr117901.f90 @@ -0,0 +1,30 @@ +! { dg-do compile } +! { dg-options "-O3" } +! +! Test the fix for pr117901, in which the variable length character in +! the SELECT TYPE construct caused an ICE in make_ssa_name_fn. This is +! a much reduced testcase, extracted from class_transformational_1.f90. +! Note that it does not have references to transformational functions +! of class objects! +! +Module class_tests +contains + subroutine class_rebar (arg) +class(*), allocatable :: arg(:) +call class_bar (arg) + end + subroutine class_bar(x) +class(*), intent(in) :: x(..) +integer :: checksum +select rank (x) + rank (1) +select type (x) + type is (character(*)) +checksum = sum(ichar(x(:)(1:1)) + ichar(x(:)(2:2))) +print *, checksum +end select + rank (2) + rank (3) + end select + end +end module class_tests
[gcc r15-6123] libstdc++: Remove constraints on std::generator::promise_type::operator new
https://gcc.gnu.org/g:2835bd76c1eabc8b5379aaec0d6190f14f62d5be commit r15-6123-g2835bd76c1eabc8b5379aaec0d6190f14f62d5be Author: Jonathan Wakely Date: Wed Dec 11 10:44:33 2024 + libstdc++: Remove constraints on std::generator::promise_type::operator new This was approved in Wrocław as LWG 3900, so that passing an incorrect argument intended as an allocator will be ill-formed, instead of silently ignored. This also renames the template parameters and function parameters for the allocators, to align with the names in the standard. I found it too confusing to have a parameter _Alloc which doesn't correspond to Alloc in the standard. Rename _Alloc to _Allocator (which the standard calls Allocator) and rename _Na to _Alloc (which the standard calls Alloc). libstdc++-v3/ChangeLog: * include/std/generator (_Promise_alloc): Rename template parameter. Use __alloc_rebind to rebind allocator. (_Promise_alloc::operator new): Replace constraints with a static_assert in the body. Rename allocator parameter. (_Promise_alloc::_M_allocate): Rename allocator parameter. Use __alloc_rebind to rebind allocator. (_Promise_alloc::operator new): Rename allocator parameter. * testsuite/24_iterators/range_generators/alloc.cc: New test. * testsuite/24_iterators/range_generators/lwg3900.cc: New test. Reviewed-by: Arsen Arsenović Diff: --- libstdc++-v3/include/std/generator | 59 +- .../24_iterators/range_generators/alloc.cc | 71 ++ .../24_iterators/range_generators/lwg3900.cc | 16 + 3 files changed, 117 insertions(+), 29 deletions(-) diff --git a/libstdc++-v3/include/std/generator b/libstdc++-v3/include/std/generator index 0a14e70064e3..bba85bd0aa4e 100644 --- a/libstdc++-v3/include/std/generator +++ b/libstdc++-v3/include/std/generator @@ -416,13 +416,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION concept _Stateless_alloc = (allocator_traits<_All>::is_always_equal::value && default_initializable<_All>); -template +template class _Promise_alloc { - using _ATr = allocator_traits<_Alloc>; - using _Rebound = typename _ATr::template rebind_alloc<_Alloc_block>; - using _Rebound_ATr = typename _ATr - ::template rebind_traits<_Alloc_block>; + using _Rebound = __alloc_rebind<_Allocator, _Alloc_block>; + using _Rebound_ATr = allocator_traits<_Rebound>; static_assert(is_pointer_v, "Must use allocators for true pointers with generators"); @@ -465,30 +463,35 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: void* operator new(std::size_t __sz) - requires default_initializable<_Rebound> // _Alloc is non-void + requires default_initializable<_Rebound> // _Allocator is non-void { return _M_allocate({}, __sz); } - template + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3900. The allocator_arg_t overloads of promise_type::operator new + // should not be constrained + template void* operator new(std::size_t __sz, -allocator_arg_t, const _Na& __na, +allocator_arg_t, const _Alloc& __a, const _Args&...) - requires convertible_to { - return _M_allocate(static_cast<_Rebound>(static_cast<_Alloc>(__na)), -__sz); + static_assert(convertible_to, + "the allocator argument to the coroutine must be " + "convertible to the generator's allocator type"); + return _M_allocate(_Rebound(_Allocator(__a)), __sz); } - template + template void* operator new(std::size_t __sz, const _This&, -allocator_arg_t, const _Na& __na, +allocator_arg_t, const _Alloc& __a, const _Args&...) - requires convertible_to { - return _M_allocate(static_cast<_Rebound>(static_cast<_Alloc>(__na)), -__sz); + static_assert(convertible_to, + "the allocator argument to the coroutine must be " + "convertible to the generator's allocator type"); + return _M_allocate(_Rebound(_Allocator(__a)), __sz); } void @@ -578,20 +581,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } - template + template static void* - _M_allocate(const _Na& __na, std::size_t __csz) + _M_allocate(const _Alloc& __a, std::size_t __csz) { - using _Rebound = typename std::allocator_traits<_Na> - ::template rebind_alloc<_Alloc_block>; - using _Rebound_ATr = typename std::a
[gcc r15-6126] libstdc++: Disable __gnu_debug::__is_singular(T*) in constexpr [PR109517]
https://gcc.gnu.org/g:9616deb23a17ebe81ad89ede191d7f9f752abdec commit r15-6126-g9616deb23a17ebe81ad89ede191d7f9f752abdec Author: Jonathan Wakely Date: Tue Dec 10 10:56:41 2024 + libstdc++: Disable __gnu_debug::__is_singular(T*) in constexpr [PR109517] Because of PR c++/85944 we have several bugs where _GLIBCXX_DEBUG causes errors for constexpr code. Although Bug 117966 could be fixed by avoiding redundant debug checks in std::span, and Bug 106212 could be fixed by avoiding redundant debug checks in std::array, there are many more cases where similar __glibcxx_requires_valid_range checks fail to compile and removing the checks everywhere isn't desirable. This just disables the __gnu_debug::__check_singular(T*) check during constant evaluation. Attempting to dereference a null pointer will certainly fail during constant evaluation (if it doesn't fail then it's a compiler bug and not the library's problem). Disabling this check during constant evaluation shouldn't do any harm. libstdc++-v3/ChangeLog: PR libstdc++/109517 PR libstdc++/109976 * include/debug/helper_functions.h (__valid_range_aux): Treat all input iterator ranges as valid during constant evaluation. Diff: --- libstdc++-v3/include/debug/helper_functions.h | 5 + 1 file changed, 5 insertions(+) diff --git a/libstdc++-v3/include/debug/helper_functions.h b/libstdc++-v3/include/debug/helper_functions.h index d686a29e8ee9..8d6a5fb41fb4 100644 --- a/libstdc++-v3/include/debug/helper_functions.h +++ b/libstdc++-v3/include/debug/helper_functions.h @@ -168,6 +168,11 @@ namespace __gnu_debug __valid_range_aux(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) { + // FIXME: The checks for singular iterators fail during constant eval + // due to PR c++/85944. e.g. PR libstdc++/109517 and PR libstdc++/109976. + if (std::__is_constant_evaluated()) + return true; + return __first == __last || (!__gnu_debug::__check_singular(__first) && !__gnu_debug::__check_singular(__last));
[gcc r15-6124] libstdc++: Skip redundant assertions in std::span construction [PR117966]
https://gcc.gnu.org/g:e95bda027e0b81922c1bf44770674190bdf787e8 commit r15-6124-ge95bda027e0b81922c1bf44770674190bdf787e8 Author: Jonathan Wakely Date: Mon Dec 9 17:35:24 2024 + libstdc++: Skip redundant assertions in std::span construction [PR117966] As PR c++/117966 shows, the Debug Mode checks cause a compilation error for a global constexpr std::span. Those debug checks are redundant when constructing from an array or a range, because we already know we have a valid range and we know its size. Instead of delegating to the std::span(contiguous_iterator, contiguous_iterator) constructor, just initialize the data members directly. libstdc++-v3/ChangeLog: PR libstdc++/117966 * include/std/span (span(T (&)[N])): Do not delegate to constructor that performs redundant checks. (span(array&), span(const array&)): Likewise. (span(Range&&), span(const span&)): Likewise. * testsuite/23_containers/span/117966.cc: New test. Diff: --- libstdc++-v3/include/std/span | 10 +- libstdc++-v3/testsuite/23_containers/span/117966.cc | 13 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span index f1c19b58737c..67227348c905 100644 --- a/libstdc++-v3/include/std/span +++ b/libstdc++-v3/include/std/span @@ -190,21 +190,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION requires (_Extent == dynamic_extent || _ArrayExtent == _Extent) constexpr span(type_identity_t (&__arr)[_ArrayExtent]) noexcept - : span(static_cast(__arr), _ArrayExtent) + : _M_ptr(__arr), _M_extent(_ArrayExtent) { } template requires __is_compatible_array<_Tp, _ArrayExtent>::value constexpr span(array<_Tp, _ArrayExtent>& __arr) noexcept - : span(static_cast(__arr.data()), _ArrayExtent) + : _M_ptr(__arr.data()), _M_extent(_ArrayExtent) { } template requires __is_compatible_array::value constexpr span(const array<_Tp, _ArrayExtent>& __arr) noexcept - : span(static_cast(__arr.data()), _ArrayExtent) + : _M_ptr(__arr.data()), _M_extent(_ArrayExtent) { } template @@ -218,7 +218,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION span(_Range&& __range) noexcept(noexcept(ranges::data(__range)) && noexcept(ranges::size(__range))) - : span(ranges::data(__range), ranges::size(__range)) + : _M_ptr(ranges::data(__range)), _M_extent(ranges::size(__range)) { if constexpr (extent != dynamic_extent) { @@ -236,7 +236,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr explicit(extent != dynamic_extent && _OExtent == dynamic_extent) span(const span<_OType, _OExtent>& __s) noexcept - : _M_extent(__s.size()), _M_ptr(__s.data()) + : _M_ptr(__s.data()), _M_extent(__s.size()) { if constexpr (extent != dynamic_extent) { diff --git a/libstdc++-v3/testsuite/23_containers/span/117966.cc b/libstdc++-v3/testsuite/23_containers/span/117966.cc new file mode 100644 index ..8bbb5ca1e079 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/span/117966.cc @@ -0,0 +1,13 @@ +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile { target c++20 } } + +// Bug 117966 +// constexpr std::span construction fails to compile with D_GLIBCXX_DEBUG + +#include +#include + +struct A { + constexpr A(std::span) {} +}; +constexpr A val{std::array{0x11, 0x22}};
[gcc r15-6125] libstdc++: Skip redundant assertions in std::array equality [PR106212]
https://gcc.gnu.org/g:3aeb2edee2f9fc39ab77c7e020f09d7204b167ac commit r15-6125-g3aeb2edee2f9fc39ab77c7e020f09d7204b167ac Author: Jonathan Wakely Date: Mon Dec 9 17:35:24 2024 + libstdc++: Skip redundant assertions in std::array equality [PR106212] As PR c++/106212 shows, the Debug Mode checks cause a compilation error for equality comparisons involving std::array prvalues in constant expressions. Those Debug Mode checks are redundant when comparing two std::array objects, because we already know we have a valid range. We can also avoid the unnecessary step of using std::__niter_base to do __normal_iterator unwrapping, which isn't needed because our std::array iterators are just pointers. Using std::__equal_aux1 instead of std::equal avoids the redundant checks in std::equal and std::__equal_aux. libstdc++-v3/ChangeLog: PR libstdc++/106212 * include/std/array (operator==): Use std::__equal_aux1 instead of std::equal. * testsuite/23_containers/array/comparison_operators/106212.cc: New test. Diff: --- libstdc++-v3/include/std/array| 2 +- .../23_containers/array/comparison_operators/106212.cc| 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 172b3203ccd6..1b1c5cc596e6 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -303,7 +303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX20_CONSTEXPR inline bool operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) -{ return std::equal(__one.begin(), __one.end(), __two.begin()); } +{ return std::__equal_aux1(__one.begin(), __one.end(), __two.begin()); } #if __cpp_lib_three_way_comparison // C++ >= 20 && lib_concepts template diff --git a/libstdc++-v3/testsuite/23_containers/array/comparison_operators/106212.cc b/libstdc++-v3/testsuite/23_containers/array/comparison_operators/106212.cc new file mode 100644 index ..f7b12bd04efd --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/array/comparison_operators/106212.cc @@ -0,0 +1,15 @@ +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile { target c++20 } } + +// Bug libstdc++/106212 - Code becomes non-constexpr with _GLIBCXX_DEBUG + +#include + +struct A +{ + constexpr A(int i) : e{i} {} + constexpr bool operator==(const A& a) const = default; + std::array e; +}; + +static_assert(A{1} != A{2}, "");
[gcc r15-6122] [PR116778][LRA]: Check pseudos assigned to FP after rematerialization to build live ranges
https://gcc.gnu.org/g:fca0ab08cd936464b152e9b45356f625eba27575 commit r15-6122-gfca0ab08cd936464b152e9b45356f625eba27575 Author: Vladimir N. Makarov Date: Wed Dec 11 15:36:21 2024 -0500 [PR116778][LRA]: Check pseudos assigned to FP after rematerialization to build live ranges This is a better fix of the PR permitting to avoid building live ranges after rematerialization. It checks that FP can not be eliminated now and that pseudos assigned to FP will be spilled. In this case we need to build live ranges after rematerialization for correct assignments of stack slots to spilled pseudos involved in rematerialization. gcc/ChangeLog: PR rtl-optimization/116778 * ira-int.h (x_ira_class_hard_reg_index): Fix comment typo. * lra-eliminations.cc (lra_fp_pseudo_p): New function. * lra-int.h (lra_fp_pseudo_p): External declaration. * lra-spills.cc (lra_need_for_spills_p): Fix formatting. * lra.cc (lra): Use lra_fp_pseudo_p in lra_create_live_range after lra_remat. Diff: --- gcc/ira-int.h | 2 +- gcc/lra-eliminations.cc | 19 +++ gcc/lra-int.h | 1 + gcc/lra-spills.cc | 3 ++- gcc/lra.cc | 7 +-- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gcc/ira-int.h b/gcc/ira-int.h index 8c3c5941de54..5ce930b6d22a 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -868,7 +868,7 @@ public: /* Index (in ira_class_hard_regs; for given register class and hard register (in general case a hard register can belong to several - register classes;. The index is negative for hard registers + register classes). The index is negative for hard registers unavailable for the allocation. */ short x_ira_class_hard_reg_index[N_REG_CLASSES][FIRST_PSEUDO_REGISTER]; diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc index 96772f2904a6..5343d8c5102d 100644 --- a/gcc/lra-eliminations.cc +++ b/gcc/lra-eliminations.cc @@ -1428,6 +1428,25 @@ lra_update_fp2sp_elimination (int *spilled_pseudos) return n; } +/* Return true if we have a pseudo assigned to hard frame pointer. */ +bool +lra_fp_pseudo_p (void) +{ + HARD_REG_SET set; + + if (frame_pointer_needed) +/* At this stage it means we have no pseudos assigned to FP: */ +return false; + CLEAR_HARD_REG_SET (set); + add_to_hard_reg_set (&set, Pmode, HARD_FRAME_POINTER_REGNUM); + for (int i = FIRST_PSEUDO_REGISTER; i < max_reg_num (); i++) +if (lra_reg_info[i].nrefs != 0 && reg_renumber[i] >= 0 + && overlaps_hard_reg_set_p (set, PSEUDO_REGNO_MODE (i), + reg_renumber[i])) + return true; + return false; +} + /* Entry function to do final elimination if FINAL_P or to update elimination register offsets (FIRST_P if we are doing it the first time). */ diff --git a/gcc/lra-int.h b/gcc/lra-int.h index 5f605c3ae410..abee008e6423 100644 --- a/gcc/lra-int.h +++ b/gcc/lra-int.h @@ -419,6 +419,7 @@ extern rtx lra_eliminate_regs_1 (rtx_insn *, rtx, machine_mode, bool, bool, poly_int64, bool); extern void eliminate_regs_in_insn (rtx_insn *insn, bool, bool, poly_int64); extern int lra_update_fp2sp_elimination (int *spilled_pseudos); +extern bool lra_fp_pseudo_p (void); extern void lra_eliminate (bool, bool); extern poly_int64 lra_update_sp_offset (rtx, poly_int64); diff --git a/gcc/lra-spills.cc b/gcc/lra-spills.cc index 3f5c8d2bcb00..6e9a8c3e34e3 100644 --- a/gcc/lra-spills.cc +++ b/gcc/lra-spills.cc @@ -594,8 +594,9 @@ lra_need_for_scratch_reg_p (void) bool lra_need_for_spills_p (void) { - int i; max_regno = max_reg_num (); + int i; + max_regno = max_reg_num (); for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0 && ! ira_former_scratch_p (i)) diff --git a/gcc/lra.cc b/gcc/lra.cc index 6b740ed23252..55737deba3f1 100644 --- a/gcc/lra.cc +++ b/gcc/lra.cc @@ -2555,8 +2555,11 @@ lra (FILE *f, int verbose) rematerialize them first. */ if (lra_remat ()) { - /* We need full live info -- see the comment above. */ - lra_create_live_ranges (true, true); + /* We need full live info -- see the comment above. We also might +need live info if we have a pseudo assigned to hard frame pointer +reg and will need FP for usual purposes. */ + lra_create_live_ranges (lra_reg_spill_p || lra_fp_pseudo_p (), + true); live_p = true; if (! lra_need_for_spills_p ()) {
[gcc r15-6104] middle-end: refactor type to be explicit in operand_equal_p [PR114932]
https://gcc.gnu.org/g:3c32575e5b6370270d38a80a7fa8eaa144e083d0 commit r15-6104-g3c32575e5b6370270d38a80a7fa8eaa144e083d0 Author: Tamar Christina Date: Wed Dec 11 11:45:36 2024 + middle-end: refactor type to be explicit in operand_equal_p [PR114932] This is a refactoring with no expected behavioral change. The goal with this is to make the type of the expressions being used explicit. I did not change all the recursive calls to operand_equal_p () to recurse directly to the new function but instead this goes through the top level call which re-extracts the types. This was done because in most of the cases where we recurse type == arg. The second patch makes use of this new flexibility to implement an overload of operand_equal_p which checks for equality under two's complement. gcc/ChangeLog: PR tree-optimization/114932 * fold-const.cc (operand_compare::operand_equal_p): Split into one that takes explicit type parameters and use that in public one. * fold-const.h (class operand_compare): Add operand_equal_p private overload. Diff: --- gcc/fold-const.cc | 99 --- gcc/fold-const.h | 6 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index af2851ec0919..33dc3a731e45 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -3168,6 +3168,17 @@ combine_comparisons (location_t loc, bool operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) +{ + return operand_equal_p (TREE_TYPE (arg0), arg0, TREE_TYPE (arg1), arg1, flags); +} + +/* The same as operand_equal_p however the type of ARG0 and ARG1 are assumed to be + the TYPE0 and TYPE1 respectively. */ + +bool +operand_compare::operand_equal_p (tree type0, const_tree arg0, + tree type1, const_tree arg1, + unsigned int flags) { bool r; if (verify_hash_value (arg0, arg1, flags, &r)) @@ -3178,25 +3189,25 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, /* If either is ERROR_MARK, they aren't equal. */ if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK - || TREE_TYPE (arg0) == error_mark_node - || TREE_TYPE (arg1) == error_mark_node) + || type0 == error_mark_node + || type1 == error_mark_node) return false; /* Similar, if either does not have a type (like a template id), they aren't equal. */ - if (!TREE_TYPE (arg0) || !TREE_TYPE (arg1)) + if (!type0 || !type1) return false; /* Bitwise identity makes no sense if the values have different layouts. */ if ((flags & OEP_BITWISE) - && !tree_nop_conversion_p (TREE_TYPE (arg0), TREE_TYPE (arg1))) + && !tree_nop_conversion_p (type0, type1)) return false; /* We cannot consider pointers to different address space equal. */ - if (POINTER_TYPE_P (TREE_TYPE (arg0)) - && POINTER_TYPE_P (TREE_TYPE (arg1)) - && (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0))) - != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg1) + if (POINTER_TYPE_P (type0) + && POINTER_TYPE_P (type1) + && (TYPE_ADDR_SPACE (TREE_TYPE (type0)) + != TYPE_ADDR_SPACE (TREE_TYPE (type1 return false; /* Check equality of integer constants before bailing out due to @@ -3216,19 +3227,20 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, because they may change the signedness of the arguments. As pointers strictly don't have a signedness, require either two pointers or two non-pointers as well. */ - if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1)) - || POINTER_TYPE_P (TREE_TYPE (arg0)) -!= POINTER_TYPE_P (TREE_TYPE (arg1))) + if (TYPE_UNSIGNED (type0) != TYPE_UNSIGNED (type1) + || POINTER_TYPE_P (type0) != POINTER_TYPE_P (type1)) return false; /* If both types don't have the same precision, then it is not safe to strip NOPs. */ - if (element_precision (TREE_TYPE (arg0)) - != element_precision (TREE_TYPE (arg1))) + if (element_precision (type0) != element_precision (type1)) return false; STRIP_NOPS (arg0); STRIP_NOPS (arg1); + + type0 = TREE_TYPE (arg0); + type1 = TREE_TYPE (arg1); } #if 0 /* FIXME: Fortran FE currently produce ADDR_EXPR of NOP_EXPR. Enable the @@ -3287,9 +3299,9 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, /* When not checking adddresses, this is needed for conversions and for COMPONENT_REF. Might as well play it safe and always test this. */ - if (TREE_CODE (TREE_TYPE (arg0)) == ERROR_MARK - || TREE_CODE (TREE_TYPE (arg1)) == ERROR_MARK -
[gcc r15-6103] MAINTAINERS: add myself to write after approval
https://gcc.gnu.org/g:979e9dbf568f0b4d75782984833e4257080995e9 commit r15-6103-g979e9dbf568f0b4d75782984833e4257080995e9 Author: Matthieu Longo Date: Wed Dec 11 11:36:04 2024 + MAINTAINERS: add myself to write after approval ChangeLog: * MAINTAINERS: Add myself to write after approval. Diff: --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7d65ed64bdda..44153a7a51ea 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -630,6 +630,7 @@ Sa Liu saliu Ralph Loaderralph Sheldon Lobosmlobo Gabor Loki loki +Matthieu Longo mlongo Sandra Loosemoresandra Manuel López-Ibáñez manu Carl Love carll
[gcc r15-6105] middle-end: use two's complement equality when comparing IVs during candidate selection [PR114932]
https://gcc.gnu.org/g:9403b035befe3537c343f7430e321468c0f2c28b commit r15-6105-g9403b035befe3537c343f7430e321468c0f2c28b Author: Tamar Christina Date: Wed Dec 11 11:47:49 2024 + middle-end: use two's complement equality when comparing IVs during candidate selection [PR114932] IVOPTS normally uses affine trees to perform comparisons between different IVs, but these seem to have been missing in two key spots and instead normal tree equivalencies used. In some cases where we have a two-complements equivalence but not a strict signedness equivalencies we end up generating both a signed and unsigned IV for the same candidate. This patch implements a new OEP flag called OEP_ASSUME_WRAPV. This flag will check if the operands would produce the same bit values after the computations even if the final sign is different. This happens quite a lot with Fortran but can also happen in C because this came code is unable to figure out when one expression is a multiple of another. As an example in the attached testcase we get: Initial set of candidates: cost: 24 (complexity 3) reg_cost: 9 cand_cost: 15 cand_group_cost: 0 (complexity 3) candidates: 1, 6, 8 group:0 --> iv_cand:6, cost=(0,1) group:1 --> iv_cand:1, cost=(0,0) group:2 --> iv_cand:8, cost=(0,1) group:3 --> iv_cand:8, cost=(0,1) invariant variables: 6 invariant expressions: 1, 2 : inv_expr 1: stride.3_27 * 4 inv_expr 2: (unsigned long) stride.3_27 * 4 These end up being used in the same group: Group 1: cand costcompl. inv.expr. inv.vars 1 0 0 NIL;6 2 0 0 NIL;6 3 0 0 NIL;6 which ends up with IV opts picking the signed and unsigned IVs: Improved to: cost: 24 (complexity 3) reg_cost: 9 cand_cost: 15 cand_group_cost: 0 (complexity 3) candidates: 1, 6, 8 group:0 --> iv_cand:6, cost=(0,1) group:1 --> iv_cand:1, cost=(0,0) group:2 --> iv_cand:8, cost=(0,1) group:3 --> iv_cand:8, cost=(0,1) invariant variables: 6 invariant expressions: 1, 2 and so generates the same IV as both signed and unsigned: ;; basic block 21, loop depth 3, count 214748368 (estimated locally, freq 58.2545), maybe hot ;;prev block 28, next block 31, flags: (NEW, REACHABLE, VISITED) ;;pred: 28 [always] count:23622320 (estimated locally, freq 6.4080) (FALLTHRU,EXECUTABLE) ;;25 [always] count:191126046 (estimated locally, freq 51.8465) (FALLTHRU,DFS_BACK,EXECUTABLE) # .MEM_66 = PHI <.MEM_34(28), .MEM_22(25)> # ivtmp.22_41 = PHI <0(28), ivtmp.22_82(25)> # ivtmp.26_51 = PHI # ivtmp.28_90 = PHI ... ;; basic block 24, loop depth 3, count 214748366 (estimated locally, freq 58.2545), maybe hot ;;prev block 22, next block 25, flags: (NEW, REACHABLE, VISITED)' ;;pred: 22 [always] count:95443719 (estimated locally, freq 25.8909) (FALLTHRU) ;;21 [33.3% (guessed)] count:71582790 (estimated locally, freq 19.4182) (TRUE_VALUE,EXECUTABLE) ;;31 [33.3% (guessed)] count:47721860 (estimated locally, freq 12.9455) (TRUE_VALUE,EXECUTABLE) # .MEM_22 = PHI <.MEM_44(22), .MEM_31(21), .MEM_79(31)> ivtmp.22_82 = ivtmp.22_41 + 1; ivtmp.26_72 = ivtmp.26_51 + _80; ivtmp.28_98 = ivtmp.28_90 + _39; These two IVs are always used as unsigned, so IV ops generates: _73 = stride.3_27 * 4; _80 = (unsigned long) _73; _54 = (unsigned long) stride.3_27; _39 = _54 * 4; Which means that in e.g. exchange2 we generate a lot of duplicate code. This is because candidate 6 and 8 are equivalent under two's complement but have different signs. This patch changes it so that if you have two IVs that are affine equivalent to just pick one over the other. IV already has code for this, so the patch just uses affine trees instead of tree for the check. With it we get: : inv_expr 1: stride.3_27 * 4 : Group 0: cand costcompl. inv.expr. inv.vars 5 0 2 NIL;NIL; 6 0 3 NIL;NIL; Group 1: cand costcompl. inv.expr. inv.vars 1 0 0 NIL;6 2 0 0 NIL;6 3 0 0 NIL;6 4 0 0 NIL;6 Initial set of candidates: cost: 16 (complexity 3) reg_cost: 6 cand_cost: 10 cand_group_cost: 0 (complexity 3) candidates: 1, 6 group:0 --> iv_cand:6, cost=(0,3) group:1 --> iv_cand:1, cost=(0,0) invariant variables: 6 invariant expressions:
[gcc r15-6107] middle-end: Fix mask length arg in call to vect_get_loop_mask [PR96342]
https://gcc.gnu.org/g:240cbd2f26c0f1c1f83cfc3b69cc0271b56172e2 commit r15-6107-g240cbd2f26c0f1c1f83cfc3b69cc0271b56172e2 Author: Victor Do Nascimento Date: Wed Dec 11 11:58:55 2024 + middle-end: Fix mask length arg in call to vect_get_loop_mask [PR96342] When issuing multiple calls to a simdclone in a vectorized loop, TYPE_VECTOR_SUBPARTS(vectype) gives the incorrect number when compared to the TYPE_VECTOR_SUBPARTS result we get from the mask type derived from the relevant `rgroup_controls' entry within `vect_get_loop_mask'. By passing `masktype' instead, we are able to get the correct number of vector subparts and thu eliminate the ICE in the call to `vect_get_loop_mask' when the data type for which we retrieve the mask is wider than the one used when defining the mask at mask registration time. gcc/ChangeLog: PR target/96342 * tree-vect-stmts.cc (vectorizable_simd_clone_call): s/vectype/masktype/ in call to vect_get_loop_mask. Diff: --- gcc/tree-vect-stmts.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 497a31322acc..be1139a423c8 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -4964,7 +4964,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, { vec_loop_masks *loop_masks = &LOOP_VINFO_MASKS (loop_vinfo); mask = vect_get_loop_mask (loop_vinfo, gsi, loop_masks, -ncopies, vectype, j); +ncopies, masktype, j); } else mask = vect_build_all_ones_mask (vinfo, stmt_info, masktype);
[gcc r15-6106] middle-end: Pass stmt_vec_info to TARGET_SIMD_CLONE_USABLE [PR96342]
https://gcc.gnu.org/g:561ef7c8477ba58ea64de259af9c2d0870afd9d4 commit r15-6106-g561ef7c8477ba58ea64de259af9c2d0870afd9d4 Author: Andre Vieira Date: Wed Dec 11 11:50:22 2024 + middle-end: Pass stmt_vec_info to TARGET_SIMD_CLONE_USABLE [PR96342] This patch adds stmt_vec_info to TARGET_SIMD_CLONE_USABLE to make sure the target can reject a simd_clone based on the vector mode it is using. This is needed because for VLS SVE vectorization the vectorizer accepts Advanced SIMD simd clones when vectorizing using SVE types because the simdlens might match. This will cause type errors later on. Other targets do not currently need to use this argument. gcc/ChangeLog: PR target/96342 * target.def (TARGET_SIMD_CLONE_USABLE): Add argument. * tree-vect-stmts.cc (vectorizable_simd_clone_call): Pass stmt_info to call TARGET_SIMD_CLONE_USABLE. * config/aarch64/aarch64.cc (aarch64_simd_clone_usable): Add argument and use it to reject the use of SVE simd clones with Advanced SIMD modes. * config/gcn/gcn.cc (gcn_simd_clone_usable): Add unused argument. * config/i386/i386.cc (ix86_simd_clone_usable): Likewise. * doc/tm.texi: Regenerate Co-authored-by: Victor Do Nascimento Co-authored-by: Tamar Christina Diff: --- gcc/config/aarch64/aarch64.cc | 4 ++-- gcc/config/gcn/gcn.cc | 3 ++- gcc/config/i386/i386.cc | 2 +- gcc/doc/tm.texi | 8 gcc/target.def| 8 gcc/tree-vect-stmts.cc| 9 - 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 4d1b3cca0c42..77a2a6bfa3a3 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -29490,12 +29490,12 @@ aarch64_simd_clone_adjust (struct cgraph_node *node) /* Implement TARGET_SIMD_CLONE_USABLE. */ static int -aarch64_simd_clone_usable (struct cgraph_node *node) +aarch64_simd_clone_usable (struct cgraph_node *node, machine_mode vector_mode) { switch (node->simdclone->vecsize_mangle) { case 'n': - if (!TARGET_SIMD) + if (!TARGET_SIMD || aarch64_sve_mode_p (vector_mode)) return -1; return 0; default: diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index d017f22d1bc4..634171a0a93b 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -5653,7 +5653,8 @@ gcn_simd_clone_adjust (struct cgraph_node *ARG_UNUSED (node)) /* Implement TARGET_SIMD_CLONE_USABLE. */ static int -gcn_simd_clone_usable (struct cgraph_node *ARG_UNUSED (node)) +gcn_simd_clone_usable (struct cgraph_node *ARG_UNUSED (node), + machine_mode ARG_UNUSED (vector_mode)) { /* We don't need to do anything here because gcn_simd_clone_compute_vecsize_and_simdlen currently only returns one diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 62f758b32ef5..ca763e1eb334 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -25721,7 +25721,7 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, slightly less desirable, etc.). */ static int -ix86_simd_clone_usable (struct cgraph_node *node) +ix86_simd_clone_usable (struct cgraph_node *node, machine_mode) { switch (node->simdclone->vecsize_mangle) { diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 7e8e02e3f423..d7170f452068 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6531,11 +6531,11 @@ This hook should add implicit @code{attribute(target("..."))} attribute to SIMD clone @var{node} if needed. @end deftypefn -@deftypefn {Target Hook} int TARGET_SIMD_CLONE_USABLE (struct cgraph_node *@var{}) +@deftypefn {Target Hook} int TARGET_SIMD_CLONE_USABLE (struct cgraph_node *@var{}, @var{machine_mode}) This hook should return -1 if SIMD clone @var{node} shouldn't be used -in vectorized loops in current function, or non-negative number if it is -usable. In that case, the smaller the number is, the more desirable it is -to use it. +in vectorized loops in current function with @var{vector_mode}, or +non-negative number if it is usable. In that case, the smaller the number +is, the more desirable it is to use it. @end deftypefn @deftypefn {Target Hook} int TARGET_SIMT_VF (void) diff --git a/gcc/target.def b/gcc/target.def index 5ee33bf0cf91..8cf29c57eaee 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1645,10 +1645,10 @@ void, (struct cgraph_node *), NULL) DEFHOOK (usable, "This hook should return -1 if SIMD clone @var{node} shouldn't be used\n\ -in vectorized loops in current function, or non-negative number if it is\n\ -usable. In that case, the smaller the number is, the more desirable it is\n\ -to use it.", -int, (struct cgraph_node *), NULL) +in vectorized loops in current function with @var{vector_mode}, or\n\ +non-ne
[gcc r15-6100] aix: Resolve build failure with default C23
https://gcc.gnu.org/g:e76df3586417d645dd84e8a1ab165605a8924796 commit r15-6100-ge76df3586417d645dd84e8a1ab165605a8924796 Author: Sangamesh Mallayya Date: Sun Dec 8 01:23:49 2024 -0600 aix: Resolve build failure with default C23 libiberty/getopt.c file is defining _NO_PROTO, which causes conflicting declarations for the functions in AIX header files like stdio.h & stdlib.h. Looks like _NO_PROTO define were added long back and conflicting declarations were always present until C23 standard uncovered it. Remove the block defining _NO_PROTO as both Tru64 UNIX (ex-OSF/1) and AIX 3.2 is no more supported. libiberty/ChangeLog: * getopt.c: Remove _NO_PROTO block Diff: --- libiberty/getopt.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/libiberty/getopt.c b/libiberty/getopt.c index 2f7086cc0c89..48736d4db418 100644 --- a/libiberty/getopt.c +++ b/libiberty/getopt.c @@ -23,12 +23,6 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - #ifdef HAVE_CONFIG_H # include #endif
[gcc r15-6101] libstdc++: Make std::println use locale from ostream (LWG 4088)
https://gcc.gnu.org/g:1fd7e36e990396c22823cedd068def2aa3b112ce commit r15-6101-g1fd7e36e990396c22823cedd068def2aa3b112ce Author: Jonathan Wakely Date: Wed Dec 11 09:37:48 2024 + libstdc++: Make std::println use locale from ostream (LWG 4088) This was just approved in Wrocław. libstdc++-v3/ChangeLog: * include/std/ostream (println): Pass stream's locale to std::format, as per LWG 4088. * testsuite/27_io/basic_ostream/print/1.cc: Check std::println with custom locale. Remove unused brit_punc class. Diff: --- libstdc++-v3/include/std/ostream | 6 -- libstdc++-v3/testsuite/27_io/basic_ostream/print/1.cc | 18 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream index 637aad5a5a41..327313a881d4 100644 --- a/libstdc++-v3/include/std/ostream +++ b/libstdc++-v3/include/std/ostream @@ -1028,8 +1028,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline void println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { - std::print(__os, "{}\n", -std::format(__fmt, std::forward<_Args>(__args)...)); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4088. println ignores the locale imbued in std::ostream + std::print(__os, "{}\n", std::format(__os.getloc(), __fmt, + std::forward<_Args>(__args)...)); } // Defined for C++26, supported as an extension to C++23. diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/print/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/print/1.cc index cd4b116ac1c0..183e08733d23 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/print/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/print/1.cc @@ -63,14 +63,6 @@ test_vprint_nonunicode() // { dg-output "garbage in . garbage out" } } -struct brit_punc : std::numpunct -{ - std::string do_grouping() const override { return "\3\3"; } - char do_thousands_sep() const override { return ','; } - std::string do_truename() const override { return "yes mate"; } - std::string do_falsename() const override { return "nah bruv"; } -}; - void test_locale() { @@ -82,7 +74,7 @@ test_locale() // The default C locale. std::locale cloc = std::locale::classic(); - // A custom locale using comma digit separators. + // A custom locale using tilde digit separators. std::locale bloc(cloc, new stream_punc); { @@ -101,6 +93,14 @@ test_locale() std::print(os, "{:L} {}", 12345, 6789); VERIFY(os.str() == "1~23~45 6789"); } + + { +// LWG 4088. println ignores the locale imbued in std::ostream +std::ostringstream os; +os.imbue(bloc); +std::println(os, "{:L} {}", 12345, 6789); +VERIFY(os.str() == "1~23~45 6789\n"); + } } void
[gcc r15-6128] Fix misplaced x86 -mstack-protector-guard-symbol documentation [PR117150]
https://gcc.gnu.org/g:fa878dc8c45fa30aeeaafbe8ab2ff2bae3fbb572 commit r15-6128-gfa878dc8c45fa30aeeaafbe8ab2ff2bae3fbb572 Author: Sandra Loosemore Date: Thu Dec 12 04:20:37 2024 + Fix misplaced x86 -mstack-protector-guard-symbol documentation [PR117150] Commit e1769bdd4cef522ada32aec863feba41116b183a accidentally inserted the documentation for the x86 -mstack-protector-guard-symbol option in the wrong place. Fixed thusly. gcc/ChangeLog PR target/117150 * doc/invoke.texi (RS/6000 and PowerPC Options): Move description of -mstack-protector-guard-symbol from here... (x86 Options): ...to here. Diff: --- gcc/doc/invoke.texi | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3cb9a50b6909..b85084459b12 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -32376,11 +32376,9 @@ The @option{-mno-compat-align-parm} option is the default. @opindex mstack-protector-guard @opindex mstack-protector-guard-reg @opindex mstack-protector-guard-offset -@opindex mstack-protector-guard-symbol @item -mstack-protector-guard=@var{guard} @itemx -mstack-protector-guard-reg=@var{reg} @itemx -mstack-protector-guard-offset=@var{offset} -@itemx -mstack-protector-guard-symbol=@var{symbol} Generate stack protection code using canary at @var{guard}. Supported locations are @samp{global} for global canary or @samp{tls} for per-thread canary in the TLS block (the default with GNU libc version 2.4 or later). @@ -32390,8 +32388,7 @@ With the latter choice the options @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify which register to use as base register for reading the canary, and from what offset from that base register. The default for those is as specified in the -relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides -the offset with a symbol reference to a canary in the TLS block. +relevant ABI. @opindex mpcrel @opindex mno-pcrel @@ -36216,9 +36213,11 @@ Split 32-byte AVX unaligned load and store. @opindex mstack-protector-guard @opindex mstack-protector-guard-reg @opindex mstack-protector-guard-offset +@opindex mstack-protector-guard-symbol @item -mstack-protector-guard=@var{guard} @itemx -mstack-protector-guard-reg=@var{reg} @itemx -mstack-protector-guard-offset=@var{offset} +@itemx -mstack-protector-guard-symbol=@var{symbol} Generate stack protection code using canary at @var{guard}. Supported locations are @samp{global} for global canary or @samp{tls} for per-thread canary in the TLS block (the default). This option has effect only when @@ -36231,6 +36230,9 @@ which segment register (@code{%fs} or @code{%gs}) to use as base register for reading the canary, and from what offset from that base register. The default for those is as specified in the relevant ABI. +@option{-mstack-protector-guard-symbol=@var{symbol}} overrides +the offset with a symbol reference to a canary in the TLS block. + @opindex mgeneral-regs-only @item -mgeneral-regs-only Generate code that uses only the general-purpose registers. This