diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2023-02-21 20:47:19 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2023-02-21 20:47:19 +0100 |
commit | bc644ac37771b9119254831af264e1132b3259da (patch) | |
tree | 37123bbb3c81fff06974b7a2008d99ef1abe3e02 | |
parent | 87e7c9dedacd4d12636e6c626aab14bcecf686f2 (diff) | |
parent | ae113080a9f98e807db239f3ad2157c64324542f (diff) | |
download | gcc-bc644ac37771b9119254831af264e1132b3259da.zip gcc-bc644ac37771b9119254831af264e1132b3259da.tar.gz gcc-bc644ac37771b9119254831af264e1132b3259da.tar.bz2 |
Merge commit 'ae113080a9f98e807db239f3ad2157c64324542f' into HEAD
42 files changed, 899 insertions, 214 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 9455b79..219a2e2 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2023-02-17 Petr Sumbera <petr.sumbera@oracle.com> + + * make_sunver.pl: Escape brace. + 2023-02-10 Flavio Cruz <flaviocruz@gmail.com> * config-list.mk: Add x86_64-gnu to list of archs. diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index f7d5592..9d9b31a 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,8 @@ +2023-02-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * inclhack.def (solaris_math_12): Add bypass. + * fixincl.x: Regenerate. + 2023-01-21 Iain Sandoe <iain@sandoe.co.uk> * fixincl.x: Regenerate. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8fbe64..a473929 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,250 @@ +2023-02-18 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/108819 + * tree-ssa-reassoc.cc (update_ops): Fold new stmt in place. + +2023-02-18 Jakub Jelinek <jakub@redhat.com> + + PR target/108832 + * config/i386/i386-protos.h (ix86_replace_reg_with_reg): Declare. + * config/i386/i386-expand.cc (ix86_replace_reg_with_reg): New + function. + * config/i386/i386.md: Replace replace_rtx calls in all peephole2s + with ix86_replace_reg_with_reg. + +2023-02-18 Gerald Pfeifer <gerald@pfeifer.com> + + * doc/invoke.texi (AVR Options): Update link to AVR-LibC. + +2023-02-18 Xi Ruoyao <xry111@xry111.site> + + * config.gcc (triplet_abi): Set its value based on $with_abi, + instead of $target. + (la_canonical_triplet): Set it after $triplet_abi is set + correctly. + * config/loongarch/t-linux (MULTILIB_OSDIRNAMES): Make the + multiarch tuple for lp64d "loongarch64-linux-gnu" (without + "f64" suffix). + +2023-02-18 Andrew Pinski <apinski@marvell.com> + + * match.pd: Remove #if GIMPLE around the + "1 - a" pattern + +2023-02-18 Andrew Pinski <apinski@marvell.com> + + * value-query.h (get_range_query): Return the global ranges + for a nullptr func. + +2023-02-17 Siddhesh Poyarekar <siddhesh@gotplt.org> + + * doc/invoke.texi (@item -Wall): Fix typo in + -Wuse-after-free. + +2023-02-17 Uroš Bizjak <ubizjak@gmail.com> + + PR target/108831 + * config/i386/predicates.md + (nonimm_x64constmem_operand): New predicate. + * config/i386/i386.md (*addqi_ext<mode>_0): New insn pattern. + (*subqi_ext<mode>_0): Ditto. + (*andqi_ext<mode>_0): Ditto. + (*<any_or:code>qi_ext<mode>_0): Ditto. + +2023-02-17 Uroš Bizjak <ubizjak@gmail.com> + + PR target/108805 + * simplify-rtx.cc (simplify_context::simplify_subreg): Use + int_outermode instead of GET_MODE (tem) to prevent + VOIDmode from entering simplify_gen_subreg. + +2023-02-17 Richard Biener <rguenther@suse.de> + + PR tree-optimization/108821 + * tree-ssa-loop-im.cc (sm_seq_valid_bb): We can also not + move volatile accesses. + +2023-02-17 Richard Biener <rguenther@suse.de> + + * tree-ssa.cc (ssa_undefined_value_p): Assert we are not + called on virtual operands. + * tree-ssa-sccvn.cc (vn_phi_lookup): Guard + ssa_undefined_value_p calls. + (vn_phi_insert): Likewise. + (set_ssa_val_to): Likewise. + (visit_phi): Avoid extra work with equivalences for + virtual operand PHIs. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-vector-builtins-bases.cc (class mask_logic): New + class. + (class mask_nlogic): Ditto. + (class mask_notlogic): Ditto. + (class vmmv): Ditto. + (class vmclr): Ditto. + (class vmset): Ditto. + (class vmnot): Ditto. + (class vcpop): Ditto. + (class vfirst): Ditto. + (class mask_misc): Ditto. + (class viota): Ditto. + (class vid): Ditto. + (BASE): Ditto. + * config/riscv/riscv-vector-builtins-bases.h: Ditto. + * config/riscv/riscv-vector-builtins-functions.def (vmand): Ditto. + (vmnand): Ditto. + (vmandn): Ditto. + (vmxor): Ditto. + (vmor): Ditto. + (vmnor): Ditto. + (vmorn): Ditto. + (vmxnor): Ditto. + (vmmv): Ditto. + (vmclr): Ditto. + (vmset): Ditto. + (vmnot): Ditto. + (vcpop): Ditto. + (vfirst): Ditto. + (vmsbf): Ditto. + (vmsif): Ditto. + (vmsof): Ditto. + (viota): Ditto. + (vid): Ditto. + * config/riscv/riscv-vector-builtins-shapes.cc (struct alu_def): Ditto. + (struct mask_alu_def): Ditto. + (SHAPE): Ditto. + * config/riscv/riscv-vector-builtins-shapes.h: Ditto. + * config/riscv/riscv-vector-builtins.cc: Ditto. + * config/riscv/riscv-vsetvl.cc (pass_vsetvl::cleanup_insns): Fix bug + for dest it scalar RVV intrinsics. + * config/riscv/vector-iterators.md (sof): New iterator. + * config/riscv/vector.md (@pred_<optab>n<mode>): New pattern. + (@pred_<optab>not<mode>): New pattern. + (@pred_popcount<VB:mode><P:mode>): New pattern. + (@pred_ffs<VB:mode><P:mode>): New pattern. + (@pred_<misc_op><mode>): New pattern. + (@pred_iota<mode>): New pattern. + (@pred_series<mode>): New pattern. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-vector-builtins-functions.def (vadc): Rename. + (vsbc): Ditto. + (vmerge): Ditto. + (vmv_v): Ditto. + * config/riscv/riscv-vector-builtins.cc: Ditto. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + kito-cheng <kito.cheng@sifive.com> + + * config/riscv/riscv-protos.h (sew64_scalar_helper): New function. + * config/riscv/riscv-v.cc (has_vi_variant_p): Adjust. + (sew64_scalar_helper): New function. + * config/riscv/vector.md: Normalization. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-vector-builtins-functions.def (vsetvlmax): Rearrange. + (vsm): Ditto. + (vsse): Ditto. + (vsoxei64): Ditto. + (vsub): Ditto. + (vand): Ditto. + (vor): Ditto. + (vxor): Ditto. + (vsll): Ditto. + (vsra): Ditto. + (vsrl): Ditto. + (vmin): Ditto. + (vmax): Ditto. + (vminu): Ditto. + (vmaxu): Ditto. + (vmul): Ditto. + (vmulh): Ditto. + (vmulhu): Ditto. + (vmulhsu): Ditto. + (vdiv): Ditto. + (vrem): Ditto. + (vdivu): Ditto. + (vremu): Ditto. + (vnot): Ditto. + (vsext): Ditto. + (vzext): Ditto. + (vwadd): Ditto. + (vwsub): Ditto. + (vwmul): Ditto. + (vwmulu): Ditto. + (vwmulsu): Ditto. + (vwaddu): Ditto. + (vwsubu): Ditto. + (vsbc): Ditto. + (vmsbc): Ditto. + (vnsra): Ditto. + (vmerge): Ditto. + (vmv_v): Ditto. + (vmsne): Ditto. + (vmslt): Ditto. + (vmsgt): Ditto. + (vmsle): Ditto. + (vmsge): Ditto. + (vmsltu): Ditto. + (vmsgtu): Ditto. + (vmsleu): Ditto. + (vmsgeu): Ditto. + (vnmsac): Ditto. + (vmadd): Ditto. + (vnmsub): Ditto. + (vwmacc): Ditto. + (vsadd): Ditto. + (vssub): Ditto. + (vssubu): Ditto. + (vaadd): Ditto. + (vasub): Ditto. + (vasubu): Ditto. + (vsmul): Ditto. + (vssra): Ditto. + (vssrl): Ditto. + (vnclip): Ditto. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/vector.md (@pred_<optab><mode>): Rearrange. + (@pred_<optab><mode>_scalar): Ditto. + (*pred_<optab><mode>_scalar): Ditto. + (*pred_<optab><mode>_extended_scalar): Ditto. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-protos.h (riscv_run_selftests): Remove 'extern'. + (init_builtins): Ditto. + (mangle_builtin_type): Ditto. + (verify_type_context): Ditto. + (handle_pragma_vector): Ditto. + (builtin_decl): Ditto. + (expand_builtin): Ditto. + (const_vec_all_same_in_range_p): Ditto. + (legitimize_move): Ditto. + (emit_vlmax_op): Ditto. + (emit_nonvlmax_op): Ditto. + (get_vlmul): Ditto. + (get_ratio): Ditto. + (get_ta): Ditto. + (get_ma): Ditto. + (get_avl_type): Ditto. + (calculate_ratio): Ditto. + (enum vlmul_type): Ditto. + (simm5_p): Ditto. + (neg_simm5_p): Ditto. + (has_vi_variant_p): Ditto. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-protos.h (simm32_p): Remove. + * config/riscv/riscv-v.cc (simm32_p): Ditto. + * config/riscv/vector.md: Use immediate_operand + instead of riscv_vector::simm32_p. + 2023-02-16 Gerald Pfeifer <gerald@pfeifer.com> * doc/invoke.texi (Optimize Options): Reword the explanation diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ef30947..09ddb49 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230217 +20230220 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 5bc8fa5..41977aa 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2023-02-18 Martin Uecker <uecker@tugraz.at> + + PR c/105660 + * c-attribs.cc (append_access_attr): Use order of arguments when + construction string. + (append_access_attr_idxs): Rename and make static. + * c-warn.cc (warn_parm_array_mismatch): Add assertion. + 2023-02-16 Patrick Palka <ppalka@redhat.com> * c-common.h: Mechanically drop static from static inline diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index 4667f6d..072cfb6 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -4728,22 +4728,27 @@ append_access_attr (tree node[3], tree attrs, const char *attrstr, rdwr_map cur_idxs; init_attr_rdwr_indices (&cur_idxs, attrs); + tree args = TYPE_ARG_TYPES (node[0]); + int argpos = 0; std::string spec; - for (auto it = new_idxs.begin (); it != new_idxs.end (); ++it) + for (tree arg = args; arg; arg = TREE_CHAIN (arg), argpos++) { - const auto &newaxsref = *it; + const attr_access* const newa = new_idxs.get (argpos); + + if (!newa) + continue; /* The map has two equal entries for each pointer argument that has an associated size argument. Process just the entry for the former. */ - if ((unsigned)newaxsref.first != newaxsref.second.ptrarg) + if ((unsigned)argpos != newa->ptrarg) continue; - const attr_access* const cura = cur_idxs.get (newaxsref.first); + const attr_access* const cura = cur_idxs.get (argpos); if (!cura) { /* The new attribute needs to be added. */ - tree str = newaxsref.second.to_internal_string (); + tree str = newa->to_internal_string (); spec += TREE_STRING_POINTER (str); continue; } @@ -4751,7 +4756,6 @@ append_access_attr (tree node[3], tree attrs, const char *attrstr, /* The new access spec refers to an array/pointer argument for which an access spec already exists. Check and diagnose any conflicts. If no conflicts are found, merge the two. */ - const attr_access* const newa = &newaxsref.second; if (!attrstr) { @@ -4886,7 +4890,7 @@ append_access_attr (tree node[3], tree attrs, const char *attrstr, continue; /* Merge the CURA and NEWA. */ - attr_access merged = newaxsref.second; + attr_access merged = *newa; /* VLA seen in a declaration takes precedence. */ if (cura->minsize == HOST_WIDE_INT_M1U) @@ -4912,9 +4916,9 @@ append_access_attr (tree node[3], tree attrs, const char *attrstr, /* Convenience wrapper for the above. */ -tree -append_access_attr (tree node[3], tree attrs, const char *attrstr, - char code, HOST_WIDE_INT idxs[2]) +static tree +append_access_attr_idxs (tree node[3], tree attrs, const char *attrstr, + char code, HOST_WIDE_INT idxs[2]) { char attrspec[80]; int n = sprintf (attrspec, "%c%u", code, (unsigned) idxs[0] - 1); @@ -5204,7 +5208,7 @@ handle_access_attribute (tree node[3], tree name, tree args, int flags, attributes specified on previous declarations of the same type and if not, concatenate the two. */ const char code = attr_access::mode_chars[mode]; - tree new_attrs = append_access_attr (node, attrs, attrstr, code, idxs); + tree new_attrs = append_access_attr_idxs (node, attrs, attrstr, code, idxs); if (!new_attrs) return NULL_TREE; @@ -5217,7 +5221,7 @@ handle_access_attribute (tree node[3], tree name, tree args, int flags, { /* Repeat for the previously declared type. */ attrs = TYPE_ATTRIBUTES (TREE_TYPE (node[1])); - new_attrs = append_access_attr (node, attrs, attrstr, code, idxs); + new_attrs = append_access_attr_idxs (node, attrs, attrstr, code, idxs); if (!new_attrs) return NULL_TREE; diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc index 29efce3..a6fb95b 100644 --- a/gcc/c-family/c-warn.cc +++ b/gcc/c-family/c-warn.cc @@ -3617,6 +3617,8 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms) for (tree newvbl = newa->size, curvbl = cura->size; newvbl; newvbl = TREE_CHAIN (newvbl), curvbl = TREE_CHAIN (curvbl)) { + gcc_assert (curvbl); + tree newpos = TREE_PURPOSE (newvbl); tree curpos = TREE_PURPOSE (curvbl); diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 26eeee2..d3cd60b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,24 @@ +2023-02-18 Martin Uecker <uecker@tugraz.at> + + PR c/108375 + * c-decl.cc (decl_jump_unsafe): Use c_type_variably_modified_p. + (diagnose_mismatched_decl): Dito. + (warn_about_goto): Dito: + (c_check_switch_jump_warnings): Dito. + (finish_decl): Dito. + (finish_struct): Dito. + (grokdeclarator): Set C_TYPE_VARIABLY_MODIFIED. + (finish_struct): Set C_TYPE_VARIABLY_MODIFIED. + * c-objc-common.cc (c_var_mod_p): New function. + (c_var_unspec_p): Remove. + * c-objc-common.h: Set lang hook. + * c-parser.cc (c_parser_declararion_or_fndef): Use c_type_variably_modified_p. + (c_parser_typeof_specifier): Dito. + (c_parser_has_attribute_expression): Dito. + (c_parser_generic_selection): Dito. + * c-tree.h: Define C_TYPE_VARIABLY_MODIFIED and define c_var_mode_p. + * c-typeck.cc: Remove c_vla_mod_p and use C_TYPE_VARIABLY_MODIFIED. + 2023-02-16 Patrick Palka <ppalka@redhat.com> * c-parser.h: Mechanically drop static from static inline diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 20e7d18..08078ea 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -683,7 +683,7 @@ decl_jump_unsafe (tree decl) /* Always warn about crossing variably modified types. */ if ((VAR_P (decl) || TREE_CODE (decl) == TYPE_DECL) - && variably_modified_type_p (TREE_TYPE (decl), NULL_TREE)) + && c_type_variably_modified_p (TREE_TYPE (decl))) return true; /* Otherwise, only warn if -Wgoto-misses-init and this is an @@ -2247,7 +2247,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, || warning_suppressed_p (olddecl, OPT_Wpedantic)) return true; /* Allow OLDDECL to continue in use. */ - if (variably_modified_type_p (newtype, NULL)) + if (c_type_variably_modified_p (newtype)) { error ("redefinition of typedef %q+D with variably modified type", newdecl); @@ -3975,7 +3975,7 @@ static void warn_about_goto (location_t goto_loc, tree label, tree decl) { auto_diagnostic_group d; - if (variably_modified_type_p (TREE_TYPE (decl), NULL_TREE)) + if (c_type_variably_modified_p (TREE_TYPE (decl))) error_at (goto_loc, "jump into scope of identifier with variably modified type"); else @@ -4249,7 +4249,7 @@ c_check_switch_jump_warnings (struct c_spot_bindings *switch_bindings, { auto_diagnostic_group d; bool emitted; - if (variably_modified_type_p (TREE_TYPE (b->decl), NULL_TREE)) + if (c_type_variably_modified_p (TREE_TYPE (b->decl))) { saw_error = true; error_at (case_loc, @@ -5862,7 +5862,7 @@ finish_decl (tree decl, location_t init_loc, tree init, if (TREE_CODE (decl) == TYPE_DECL) { if (!DECL_FILE_SCOPE_P (decl) - && variably_modified_type_p (TREE_TYPE (decl), NULL_TREE)) + && c_type_variably_modified_p (TREE_TYPE (decl))) add_stmt (build_stmt (DECL_SOURCE_LOCATION (decl), DECL_EXPR, decl)); rest_of_decl_compilation (decl, DECL_FILE_SCOPE_P (decl), 0); @@ -6682,7 +6682,7 @@ grokdeclarator (const struct c_declarator *declarator, if ((decl_context == NORMAL || decl_context == FIELD) && current_scope == file_scope - && variably_modified_type_p (type, NULL_TREE)) + && c_type_variably_modified_p (type)) { if (name) error_at (loc, "variably modified %qE at file scope", name); @@ -6928,6 +6928,8 @@ grokdeclarator (const struct c_declarator *declarator, array_parm_static = false; } + bool varmod = C_TYPE_VARIABLY_MODIFIED (type); + switch (declarator->kind) { case cdk_attrs: @@ -7282,8 +7284,7 @@ grokdeclarator (const struct c_declarator *declarator, variable size, so the enclosing shared array type must too. */ if (size && TREE_CODE (size) == INTEGER_CST) - type - = build_distinct_type_copy (TYPE_MAIN_VARIANT (type)); + type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type)); C_TYPE_VARIABLE_SIZE (type) = 1; } @@ -7493,7 +7494,7 @@ grokdeclarator (const struct c_declarator *declarator, the size evaluation prior to the side effects. We therefore use BIND_EXPRs in TYPENAME contexts too. */ if (!TYPE_NAME (type) - && variably_modified_type_p (type, NULL_TREE)) + && c_type_variably_modified_p (type)) { tree bind = NULL_TREE; if (decl_context == TYPENAME || decl_context == PARM) @@ -7534,6 +7535,8 @@ grokdeclarator (const struct c_declarator *declarator, default: gcc_unreachable (); } + if (type != error_mark_node) + C_TYPE_VARIABLY_MODIFIED (type) = varmod || size_varies; } *decl_attrs = chainon (returned_attrs, *decl_attrs); *decl_attrs = chainon (decl_id_attrs, *decl_attrs); @@ -7728,7 +7731,7 @@ grokdeclarator (const struct c_declarator *declarator, } if (pedantic && decl_context == FIELD - && variably_modified_type_p (type, NULL_TREE)) + && c_type_variably_modified_p (type)) { /* C99 6.7.2.1p8 */ pedwarn (loc, OPT_Wpedantic, "a member of a structure or union cannot " @@ -7996,7 +7999,7 @@ grokdeclarator (const struct c_declarator *declarator, have a member with such a qualifier. const qualification is implicitly added, and, at file scope, has internal linkage. */ - if (variably_modified_type_p (type, NULL_TREE)) + if (c_type_variably_modified_p (type)) error_at (loc, "%<constexpr%> object has variably modified " "type"); if (type_quals @@ -8078,7 +8081,7 @@ grokdeclarator (const struct c_declarator *declarator, || (storage_class == csc_none && TREE_CODE (type) == FUNCTION_TYPE && !funcdef_flag)) - && variably_modified_type_p (type, NULL_TREE)) + && c_type_variably_modified_p (type)) { /* C99 6.7.5.2p2 */ if (TREE_CODE (type) == FUNCTION_TYPE) @@ -9233,6 +9236,10 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, if (C_DECL_VARIABLE_SIZE (x)) C_TYPE_VARIABLE_SIZE (t) = 1; + /* If any field is variably modified, record this fact. */ + if (C_TYPE_VARIABLY_MODIFIED (TREE_TYPE (x))) + C_TYPE_VARIABLY_MODIFIED (t) = 1; + if (DECL_C_BIT_FIELD (x)) { unsigned HOST_WIDE_INT width = tree_to_uhwi (DECL_INITIAL (x)); @@ -9431,6 +9438,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, C_TYPE_FIELDS_VOLATILE (x) = C_TYPE_FIELDS_VOLATILE (t); C_TYPE_FIELDS_NON_CONSTEXPR (x) = C_TYPE_FIELDS_NON_CONSTEXPR (t); C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t); + C_TYPE_VARIABLY_MODIFIED (x) = C_TYPE_VARIABLY_MODIFIED (t); C_TYPE_INCOMPLETE_VARS (x) = NULL_TREE; } @@ -9447,7 +9455,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, /* If we're inside a function proper, i.e. not file-scope and not still parsing parameters, then arrange for the size of a variable sized type to be bound now. */ - if (building_stmt_list_p () && variably_modified_type_p (t, NULL_TREE)) + if (building_stmt_list_p () && c_type_variably_modified_p(t)) add_stmt (build_stmt (loc, DECL_EXPR, build_decl (loc, TYPE_DECL, NULL, t))); diff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc index 0350733..e4aed61 100644 --- a/gcc/c/c-objc-common.cc +++ b/gcc/c/c-objc-common.cc @@ -371,12 +371,12 @@ c_types_compatible_p (tree x, tree y) return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y)); } -/* Determine if the type is a vla type for the backend. */ +/* Determine if the type is a variably modified type for the backend. */ bool -c_vla_unspec_p (tree x, tree fn ATTRIBUTE_UNUSED) +c_var_mod_p (tree x, tree fn ATTRIBUTE_UNUSED) { - return c_vla_type_p (x); + return C_TYPE_VARIABLY_MODIFIED (x); } /* Special routine to get the alias set of T for C. */ diff --git a/gcc/c/c-objc-common.h b/gcc/c/c-objc-common.h index 3861093..d31dacb 100644 --- a/gcc/c/c-objc-common.h +++ b/gcc/c/c-objc-common.h @@ -123,5 +123,5 @@ along with GCC; see the file COPYING3. If not see #define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP c_omp_clause_copy_ctor #undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P -#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P c_vla_unspec_p +#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P c_var_mod_p #endif /* GCC_C_OBJC_COMMON */ diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 4342788..21bc316 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -2494,8 +2494,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, init = convert_lvalue_to_rvalue (init_loc, init, true, true, true); tree init_type = TREE_TYPE (init.value); - bool vm_type = variably_modified_type_p (init_type, - NULL_TREE); + bool vm_type = c_type_variably_modified_p (init_type); if (vm_type) init.value = save_expr (init.value); finish_init (); @@ -4143,7 +4142,7 @@ c_parser_typeof_specifier (c_parser *parser) if (type != NULL) { ret.spec = groktypename (type, &ret.expr, &ret.expr_const_operands); - pop_maybe_used (variably_modified_type_p (ret.spec, NULL_TREE)); + pop_maybe_used (c_type_variably_modified_p (ret.spec)); } } else @@ -4158,7 +4157,7 @@ c_parser_typeof_specifier (c_parser *parser) error_at (here, "%<typeof%> applied to a bit-field"); mark_exp_read (expr.value); ret.spec = TREE_TYPE (expr.value); - was_vm = variably_modified_type_p (ret.spec, NULL_TREE); + was_vm = c_type_variably_modified_p (ret.spec); /* This is returned with the type so that when the type is evaluated, this can be evaluated. */ if (was_vm) @@ -9058,7 +9057,7 @@ c_parser_has_attribute_expression (c_parser *parser) if (tname) { oper = groktypename (tname, NULL, NULL); - pop_maybe_used (variably_modified_type_p (oper, NULL_TREE)); + pop_maybe_used (c_type_variably_modified_p (oper)); } } else @@ -9071,7 +9070,7 @@ c_parser_has_attribute_expression (c_parser *parser) mark_exp_read (cexpr.value); oper = cexpr.value; tree etype = TREE_TYPE (oper); - bool was_vm = variably_modified_type_p (etype, NULL_TREE); + bool was_vm = c_type_variably_modified_p (etype); /* This is returned with the type so that when the type is evaluated, this can be evaluated. */ if (was_vm) @@ -9320,7 +9319,7 @@ c_parser_generic_selection (c_parser *parser) error_at (assoc.type_location, "%<_Generic%> association has incomplete type"); - if (variably_modified_type_p (assoc.type, NULL_TREE)) + if (c_type_variably_modified_p (assoc.type)) error_at (assoc.type_location, "%<_Generic%> association has " "variable length type"); diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index e5eefe6..e6b6fe9 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -59,6 +59,10 @@ along with GCC; see the file COPYING3. If not see #define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE) #define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE) +/* Record whether a type is variably modified. */ +#define C_TYPE_VARIABLY_MODIFIED(TYPE) TYPE_LANG_FLAG_6 (TYPE) + + /* Record whether a type is defined inside a struct or union type. This is used for -Wc++-compat. */ #define C_TYPE_DEFINED_IN_STRUCT(TYPE) TYPE_LANG_FLAG_2 (TYPE) @@ -714,7 +718,7 @@ extern bool c_objc_common_init (void); extern bool c_missing_noreturn_ok_p (tree); extern bool c_warn_unused_global_decl (const_tree); extern void c_initialize_diagnostics (diagnostic_context *); -extern bool c_vla_unspec_p (tree x, tree fn); +extern bool c_var_mod_p (tree x, tree fn); extern alias_set_type c_get_alias_set (tree); /* in c-typeck.cc */ @@ -729,6 +733,15 @@ extern location_t c_last_sizeof_loc; extern struct c_switch *c_switch_stack; extern bool null_pointer_constant_p (const_tree); + + +inline +bool c_type_variably_modified_p (tree t) +{ + return error_mark_node != t && C_TYPE_VARIABLY_MODIFIED (t); +} + + extern bool char_type_p (tree); extern tree c_objc_common_truthvalue_conversion (location_t, tree); extern tree require_complete_type (location_t, tree); @@ -736,7 +749,6 @@ extern bool same_translation_unit_p (const_tree, const_tree); extern int comptypes (tree, tree); extern int comptypes_check_different_types (tree, tree, bool *); extern int comptypes_check_enum_int (tree, tree, bool *); -extern bool c_vla_type_p (const_tree); extern bool c_mark_addressable (tree, bool = false); extern void c_incomplete_type_error (location_t, const_tree, const_tree); extern tree c_type_promotes_to (tree); diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index e37b097..45bacc0 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -356,16 +356,6 @@ qualify_type (tree type, tree like) | ENCODE_QUAL_ADDR_SPACE (as_common)); } -/* Return true iff the given tree T is a variable length array. */ - -bool -c_vla_type_p (const_tree t) -{ - if (TREE_CODE (t) == ARRAY_TYPE - && C_TYPE_VARIABLE_SIZE (t)) - return true; - return false; -} /* If NTYPE is a type of a non-variadic function with a prototype and OTYPE is a type of a function without a prototype and ATTRS @@ -471,8 +461,8 @@ composite_type (tree t1, tree t2) d2_variable = (!d2_zero && (TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)); - d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); - d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); + d1_variable = d1_variable || (d1_zero && C_TYPE_VARIABLE_SIZE (t1)); + d2_variable = d2_variable || (d2_zero && C_TYPE_VARIABLE_SIZE (t2)); /* Save space: see if the result is identical to one of the args. */ if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1) @@ -1248,8 +1238,8 @@ comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p, d2_variable = (!d2_zero && (TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)); - d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); - d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); + d1_variable = d1_variable || (d1_zero && C_TYPE_VARIABLE_SIZE (t1)); + d2_variable = d2_variable || (d2_zero && C_TYPE_VARIABLE_SIZE (t2)); if (different_types_p != NULL && d1_variable != d2_variable) @@ -3346,7 +3336,7 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc, /* In this improbable scenario, a nested function returns a VM type. Create a TARGET_EXPR so that the call always has a LHS, much as what the C++ FE does for functions returning non-PODs. */ - if (variably_modified_type_p (TREE_TYPE (fntype), NULL_TREE)) + if (C_TYPE_VARIABLY_MODIFIED (TREE_TYPE (fntype))) { tree tmp = create_tmp_var_raw (TREE_TYPE (fntype)); result = build4 (TARGET_EXPR, TREE_TYPE (fntype), tmp, result, diff --git a/gcc/config.gcc b/gcc/config.gcc index b7288d4..f56482c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4936,20 +4936,16 @@ case "${target}" in case ${target} in loongarch64-*-*-*f64) abi_pattern="lp64d" - triplet_abi="f64" ;; loongarch64-*-*-*f32) abi_pattern="lp64f" - triplet_abi="f32" ;; loongarch64-*-*-*sf) abi_pattern="lp64s" - triplet_abi="sf" ;; loongarch64-*-*-*) abi_pattern="lp64[dfs]" abi_default="lp64d" - triplet_abi="" ;; *) echo "Unsupported target ${target}." 1>&2 @@ -4970,9 +4966,6 @@ case "${target}" in ;; esac - la_canonical_triplet="loongarch64-${triplet_os}${triplet_abi}" - - # Perform initial sanity checks on --with-* options. case ${with_arch} in "" | loongarch64 | la464) ;; # OK, append here. @@ -5043,6 +5036,13 @@ case "${target}" in ;; esac + case ${with_abi} in + "lp64d") triplet_abi="";; + "lp64f") triplet_abi="f32";; + "lp64s") triplet_abi="sf";; + esac + la_canonical_triplet="loongarch64-${triplet_os}${triplet_abi}" + # Set default value for with_abiext (internal) case ${with_abiext} in "") diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index e59c7b0..1094ece 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -7093,6 +7093,37 @@ ix86_expand_v1ti_ashiftrt (rtx operands[]) } } +/* Replace all occurrences of REG FROM with REG TO in X, including + occurrences with different modes. */ + +rtx +ix86_replace_reg_with_reg (rtx x, rtx from, rtx to) +{ + gcc_checking_assert (REG_P (from) + && REG_P (to) + && GET_MODE (from) == GET_MODE (to)); + if (!reg_overlap_mentioned_p (from, x)) + return x; + rtx ret = copy_rtx (x); + subrtx_ptr_iterator::array_type array; + FOR_EACH_SUBRTX_PTR (iter, array, &ret, NONCONST) + { + rtx *loc = *iter; + x = *loc; + if (REG_P (x) && REGNO (x) == REGNO (from)) + { + if (x == from) + *loc = to; + else + { + gcc_checking_assert (REG_NREGS (x) == 1); + *loc = gen_rtx_REG (GET_MODE (x), REGNO (to)); + } + } + } + return ret; +} + /* Return mode for the memcpy/memset loop counter. Prefer SImode over DImode for constant loop counts. */ diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index e4037dc..bfb2198 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -168,6 +168,7 @@ extern void ix86_split_lshr (rtx *, rtx, machine_mode); extern void ix86_expand_v1ti_shift (enum rtx_code, rtx[]); extern void ix86_expand_v1ti_rotate (enum rtx_code, rtx[]); extern void ix86_expand_v1ti_ashiftrt (rtx[]); +extern rtx ix86_replace_reg_with_reg (rtx, rtx, rtx); extern rtx ix86_find_base_term (rtx); extern bool ix86_check_movabs (rtx, int); extern bool ix86_check_no_addr_space (rtx); diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 55042e7..6382cfb 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -22101,8 +22101,10 @@ (match_dup 0)))] { operands[7] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (1)), 0, 0)); - operands[8] = replace_rtx (operands[5], operands[0], operands[1], true); - operands[9] = replace_rtx (operands[6], operands[0], operands[1], true); + operands[8] + = ix86_replace_reg_with_reg (operands[5], operands[0], operands[1]); + operands[9] + = ix86_replace_reg_with_reg (operands[6], operands[0], operands[1]); }) ;; Eliminate a reg-reg mov by inverting the condition of a cmov (#2). @@ -22134,8 +22136,10 @@ (match_dup 0)))] { operands[7] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (2)), 0, 0)); - operands[8] = replace_rtx (operands[5], operands[0], operands[1], true); - operands[9] = replace_rtx (operands[6], operands[0], operands[1], true); + operands[8] + = ix86_replace_reg_with_reg (operands[5], operands[0], operands[1]); + operands[9] + = ix86_replace_reg_with_reg (operands[6], operands[0], operands[1]); }) (define_insn "movhf_mask" @@ -23274,7 +23278,10 @@ (parallel [(set (match_dup 0) (match_op_dup 3 [(match_dup 0) (match_dup 1)])) (clobber (reg:CC FLAGS_REG))])] - "operands[4] = replace_rtx (operands[2], operands[0], operands[1], true);") +{ + operands[4] + = ix86_replace_reg_with_reg (operands[2], operands[0], operands[1]); +}) (define_peephole2 [(set (match_operand 0 "mmx_reg_operand") diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux index 131c45f..e40da17 100644 --- a/gcc/config/loongarch/t-linux +++ b/gcc/config/loongarch/t-linux @@ -40,7 +40,7 @@ ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) MULTILIB_OSDIRNAMES = \ mabi.lp64d=../lib64$\ - $(call if_multiarch,:loongarch64-linux-gnuf64) + $(call if_multiarch,:loongarch64-linux-gnu) MULTILIB_OSDIRNAMES += \ mabi.lp64f=../lib64/f32$\ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 148276b..20b2fe5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,72 @@ +2023-02-18 Jason Merrill <jason@redhat.com> + + DR 2518 + PR c++/52809 + PR c++/53638 + PR c++/87389 + PR c++/89741 + PR c++/92099 + PR c++/104041 + PR c++/104691 + * semantics.cc (finish_static_assert): Don't diagnose in + template context. + +2023-02-17 Patrick Palka <ppalka@redhat.com> + + PR c++/108243 + PR c++/97553 + * cp-gimplify.cc (enum fold_flags): Define. + (fold_flags_t): Declare. + (cp_fold_data::genericize): Replace this data member with ... + (cp_fold_data::fold_flags): ... this. + (cp_fold_r): Adjust use of cp_fold_data and calls to cp_fold. + (cp_fold_function): Likewise. + (cp_fold_maybe_rvalue): Add an internal overload that + additionally takes and propagates a fold_flags_t parameter, and + define the existing public overload in terms of it. + (cp_fold_rvalue): Likewise. + (cp_fully_fold_init): Adjust use of cp_fold_data. + (fold_cache): Replace with ... + (fold_caches): ... this 2-element array of caches. + (get_fold_cache): Define. + (clear_fold_cache): Adjust. + (cp_fold): Add fold_flags_t parameter. Use get_fold_cache. + Pass flags to calls to cp_fold, cp_fold_rvalue and + cp_fold_maybe_rvalue. + <case CALL_EXPR>: If ff_mce_false is set, fold + __builtin_is_constant_evaluated to false and pass mce_false to + maybe_constant_value. + +2023-02-17 Patrick Palka <ppalka@redhat.com> + + * constexpr.cc (constexpr_call::manifestly_const_eval): Give + it type int instead of bool. + (constexpr_ctx::manifestly_const_eval): Give it type mce_value + instead of bool. + (cxx_eval_builtin_function_call): Adjust after making + manifestly_const_eval tri-state. + (cxx_eval_call_expression): Likewise. + (cxx_eval_binary_expression): Likewise. + (cxx_eval_conditional_expression): Likewise. + (cxx_eval_constant_expression): Likewise. + (cxx_eval_outermost_constant_expr): Likewise. + (cxx_constant_value): Likewise. + (cxx_constant_dtor): Likewise. + (maybe_constant_value): Give manifestly_const_eval parameter + type mce_value instead of bool and adjust accordingly. + (fold_non_dependent_expr_template): Adjust call + to cxx_eval_outermost_constant_expr. + (fold_non_dependent_expr): Likewise. + (maybe_constant_init_1): Likewise. + * constraint.cc (satisfy_atom): Adjust call to + maybe_constant_value. + * cp-tree.h (enum class mce_value): Define. + (maybe_constant_value): Adjust manifestly_const_eval parameter + type and default argument. + * decl.cc (compute_array_index_type_loc): Adjust call to + maybe_constant_value. + * pt.cc (convert_nontype_argument): Likewise. + 2023-02-16 Patrick Palka <ppalka@redhat.com> PR c++/107773 diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index c2df0b6..79b7cc7 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -11232,14 +11232,16 @@ finish_static_assert (tree condition, tree message, location_t location, if (check_for_bare_parameter_packs (condition)) condition = error_mark_node; + /* Save the condition in case it was a concept check. */ + tree orig_condition = condition; + if (instantiation_dependent_expression_p (condition)) { /* We're in a template; build a STATIC_ASSERT and put it in the right place. */ - tree assertion; - - assertion = make_node (STATIC_ASSERT); - STATIC_ASSERT_CONDITION (assertion) = condition; + defer: + tree assertion = make_node (STATIC_ASSERT); + STATIC_ASSERT_CONDITION (assertion) = orig_condition; STATIC_ASSERT_MESSAGE (assertion) = message; STATIC_ASSERT_SOURCE_LOCATION (assertion) = location; @@ -11253,9 +11255,6 @@ finish_static_assert (tree condition, tree message, location_t location, return; } - /* Save the condition in case it was a concept check. */ - tree orig_condition = condition; - /* Fold the expression and convert it to a boolean value. */ condition = contextual_conv_bool (condition, complain); condition = fold_non_dependent_expr (condition, complain, @@ -11270,6 +11269,10 @@ finish_static_assert (tree condition, tree message, location_t location, if (integer_zerop (condition)) { + /* CWG2518: static_assert failure in a template is not IFNDR. */ + if (processing_template_decl) + goto defer; + int sz = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (message)))); int len = TREE_STRING_LENGTH (message) / sz - 1; diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a5ea86f..078d29d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -22888,7 +22888,7 @@ points to. The startup code from libgcc never sets @code{EIND}. Notice that startup code is a blend of code from libgcc and AVR-LibC. For the impact of AVR-LibC on @code{EIND}, see the -@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. +@w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. @item It is legitimate for user-specific startup code to set up @code{EIND} diff --git a/gcc/match.pd b/gcc/match.pd index e7b7003..e352bd4 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1732,7 +1732,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (!FIXED_POINT_TYPE_P (type)) (plus @0 (negate @1)))) -#if GIMPLE /* 1 - a is a ^ 1 if a had a bool range. */ /* This is only enabled for gimple as sometimes cfun is not set for the function which contains @@ -1743,7 +1742,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (INTEGRAL_TYPE_P (type) && ssa_name_has_boolean_range (@1)) (bit_xor @1 @0))) -#endif /* Other simplifications of negation (c.f. fold_negate_expr_1). */ (simplify diff --git a/gcc/rust/ChangeLog b/gcc/rust/ChangeLog index 033b0ff..6c6d7f9 100644 --- a/gcc/rust/ChangeLog +++ b/gcc/rust/ChangeLog @@ -1,3 +1,7 @@ +2023-02-17 Thomas Schwinge <thomas@codesourcery.com> + + * backend/rust-tree.cc: '#include "tm_p.h"'. + 2023-01-31 Philip Herron <philip.herron@embecosm.com> * Make-lang.in: Remove `rust-hir-typecheck-toplevel` object and add diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 63968c7..fcef7d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,85 @@ +2023-02-18 Jason Merrill <jason@redhat.com> + + DR 2518 + PR c++/52809 + PR c++/53638 + PR c++/87389 + PR c++/89741 + PR c++/92099 + PR c++/104041 + PR c++/104691 + * g++.dg/DRs/dr2518.C: New test. + +2023-02-18 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/108819 + * gcc.dg/pr108819.c: New test. + +2023-02-18 Jakub Jelinek <jakub@redhat.com> + + PR target/108832 + * gcc.target/i386/pr108832.c: New test. + +2023-02-18 Martin Uecker <uecker@tugraz.at> + + PR c/108375 + * gcc.dg/pr108375-1.c: New test. + * gcc.dg/pr108375-2.c: New test. + +2023-02-18 Martin Uecker <uecker@tugraz.at> + + PR c/105660 + PR c/105660 + * gcc.dg/pr105660-1.c: New test. + * gcc.dg/pr105660-2.c: New test. + +2023-02-17 Patrick Palka <ppalka@redhat.com> + + PR c++/108243 + PR c++/97553 + * g++.dg/opt/is_constant_evaluated1.C: New test. + * g++.dg/opt/is_constant_evaluated2.C: New test. + +2023-02-17 Uroš Bizjak <ubizjak@gmail.com> + + PR target/108831 + * gcc.target/i386/pr108831-1.c: New test. + * gcc.target/i386/pr108831-2.c: Ditto. + +2023-02-17 Uroš Bizjak <ubizjak@gmail.com> + + PR target/108805 + * gcc.dg/pr108805.c: New test. + +2023-02-17 Richard Biener <rguenther@suse.de> + + PR tree-optimization/108821 + * gcc.dg/tree-ssa/ssa-lim-24.c: New testcase. + +2023-02-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * gfortran.dg/ISO_Fortran_binding_14.f90: Change example function to + CLOCK which is available on mingw as well as other platforms. + * gfortran.dg/pr96486.f90: Change variable to PATH likewise. + +2023-02-17 Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/base/binop_vx_constraint-148.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-149.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-150.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-151.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-152.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-153.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-156.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-157.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-159.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-160.c: Change vmnot.mm to vmnot.m. + * gcc.target/riscv/rvv/base/binop_vx_constraint-161.c: Change vmnot.mm to vmnot.m. + +2023-02-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * gfortran.dg/bind_c_array_params_2.f90: Add *-*-ming* to dg-final. + 2023-02-16 David Malcolm <dmalcolm@redhat.com> PR analyzer/108806 diff --git a/gcc/testsuite/g++.dg/DRs/dr2518.C b/gcc/testsuite/g++.dg/DRs/dr2518.C new file mode 100644 index 0000000..2401862 --- /dev/null +++ b/gcc/testsuite/g++.dg/DRs/dr2518.C @@ -0,0 +1,7 @@ +// CWG 2518 +// { dg-do compile { target c++11 } } + +template <class T> void f() +{ + static_assert (false, ""); +} diff --git a/gcc/testsuite/gcc.dg/pr105660-1.c b/gcc/testsuite/gcc.dg/pr105660-1.c new file mode 100644 index 0000000..d4454f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105660-1.c @@ -0,0 +1,13 @@ +/* PR105660 + * { dg-do compile } + * { dg-options "-std=c17" } + */ + +void gatherConservativeVars(int, int, int, int, int, int, int Hnvar, int, + int Hnyt, int Hnxyt, int, int Hstep, double[Hnyt], + double[Hnvar][Hstep][Hnxyt]); +void gatherConservativeVars(int, int, int, int, int, int, int Hnvar, int, int Hnyt, + int Hnxyt, int, int Hstep, double[Hnyt], + double[Hnvar][Hstep][Hnxyt]); + + diff --git a/gcc/testsuite/gcc.dg/pr105660-2.c b/gcc/testsuite/gcc.dg/pr105660-2.c new file mode 100644 index 0000000..29fd82f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105660-2.c @@ -0,0 +1,12 @@ +/* PR105660 + * { dg-do compile } + * { dg-options "-Wall -std=c17" } + */ + + +struct bat_gen_conf_s; +void batch_generator_create2(struct bat_gen_conf_s* config, int D, int N, const long bat_dims[D][N], const long tot_dims[D][N], const long tot_strs[D][N], const _Complex float* data[D]); +void batch_generator_create2(struct bat_gen_conf_s* config, int D, int N, const long bat_dims[D][N], const long tot_dims[D][N], const long tot_strs[D][N], const _Complex float* data[D]); + + + diff --git a/gcc/testsuite/gcc.dg/pr108375-1.c b/gcc/testsuite/gcc.dg/pr108375-1.c new file mode 100644 index 0000000..1cbb05b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr108375-1.c @@ -0,0 +1,14 @@ +/* PR 108375 + * { dg-do compile } + * { dg-options "" } + * */ + +void +f (int a) +{ + goto x; /* { dg-error "jump into scope of identifier with variably modified type" } */ + struct { char (*p)[a]; } B; + x : ; +} + + diff --git a/gcc/testsuite/gcc.dg/pr108375-2.c b/gcc/testsuite/gcc.dg/pr108375-2.c new file mode 100644 index 0000000..0401ead --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr108375-2.c @@ -0,0 +1,15 @@ +/* PR 108375 + * { dg-do compile } + * { dg-options "" } + * */ + +void +f (int a) +{ + typedef int A[a]; + goto x; /* { dg-error "jump into scope of identifier with variably modified type" } */ + A *p[2]; + x : ; +} + + diff --git a/gcc/testsuite/gcc.dg/pr108819.c b/gcc/testsuite/gcc.dg/pr108819.c new file mode 100644 index 0000000..28fa558 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr108819.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/108819 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-ccp -fno-tree-forwprop" } */ + +int a, b; + +int +main () +{ + int d = 1; + for (; b; b++) + if (a < 1) + while (d <= a && a <= 0UL) + { + int *e = &d; + *e = 0; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr108825.c b/gcc/testsuite/gcc.dg/torture/pr108825.c new file mode 100644 index 0000000..ada2da8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr108825.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int safe_mul_func_uint8_t_u_u_ui2, g_231, g_277_1, g_568, func_35___trans_tmp_10; +int g_81[7]; +extern int g_96[]; +char func_35___trans_tmp_11; +static inline int safe_add_func_int32_t_s_s(int si1, int si2) +{ return si1 > 647 - si2 ?: si1; } +void func_35() { + for (; g_277_1; g_277_1 += 1) { + g_231 = 0; + for (; g_231 <= 6; g_231 += 1) { + func_35___trans_tmp_10 = + safe_add_func_int32_t_s_s(g_81[g_231], g_568 || g_96[1]); + func_35___trans_tmp_11 = + func_35___trans_tmp_10 * safe_mul_func_uint8_t_u_u_ui2; + g_81[g_231] = func_35___trans_tmp_11; + } + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr108832.c b/gcc/testsuite/gcc.target/i386/pr108832.c new file mode 100644 index 0000000..b6d4731 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr108832.c @@ -0,0 +1,19 @@ +/* PR target/108832 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -funroll-loops" } */ + +unsigned int m; +short int n; + +long int +bar (unsigned int x) +{ + return x ? x : 1; +} + +__attribute__ ((simd)) void +foo (void) +{ + int a = m / bar (3); + n = 1 % bar (a << 1); +} diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc index 14fe65f..09acc1c 100644 --- a/gcc/tree-ssa-loop-manip.cc +++ b/gcc/tree-ssa-loop-manip.cc @@ -681,15 +681,15 @@ verify_loop_closed_ssa (bool verify_ssa_p, class loop *loop) if (number_of_loops (cfun) <= 1) return; - if (verify_ssa_p) - verify_ssa (false, true); - timevar_push (TV_VERIFY_LOOP_CLOSED); if (loop == NULL) { basic_block bb; + if (verify_ssa_p) + verify_ssa (false, true); + FOR_EACH_BB_FN (bb, cfun) if (bb->loop_father && bb->loop_father->num > 0) check_loop_closed_ssa_bb (bb); @@ -698,6 +698,11 @@ verify_loop_closed_ssa (bool verify_ssa_p, class loop *loop) { basic_block *bbs = get_loop_body (loop); + /* We do not have loop-local SSA verification so just + check there's no update queued. */ + if (verify_ssa_p) + gcc_assert (!need_ssa_update_p (cfun)); + for (unsigned i = 0; i < loop->num_nodes; ++i) check_loop_closed_ssa_bb (bbs[i]); diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc index 581bf5d..1ce5e73 100644 --- a/gcc/tree-ssa-loop-niter.cc +++ b/gcc/tree-ssa-loop-niter.cc @@ -2354,7 +2354,8 @@ number_of_iterations_cltz (loop_p loop, edge exit, gimple *and_stmt = SSA_NAME_DEF_STMT (gimple_cond_lhs (cond_stmt)); if (!is_gimple_assign (and_stmt) || gimple_assign_rhs_code (and_stmt) != BIT_AND_EXPR - || !integer_pow2p (gimple_assign_rhs2 (and_stmt))) + || !integer_pow2p (gimple_assign_rhs2 (and_stmt)) + || TREE_CODE (gimple_assign_rhs1 (and_stmt)) != SSA_NAME) return false; checked_bit = tree_log2 (gimple_assign_rhs2 (and_stmt)); @@ -2382,7 +2383,8 @@ number_of_iterations_cltz (loop_p loop, edge exit, precision. */ iv_2 = gimple_assign_rhs1 (test_value_stmt); tree rhs_type = TREE_TYPE (iv_2); - if (TREE_CODE (rhs_type) != INTEGER_TYPE + if (TREE_CODE (iv_2) != SSA_NAME + || TREE_CODE (rhs_type) != INTEGER_TYPE || (TYPE_PRECISION (rhs_type) != TYPE_PRECISION (test_value_type))) return false; diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc index f163612..8fd2259 100644 --- a/gcc/tree-ssa-reassoc.cc +++ b/gcc/tree-ssa-reassoc.cc @@ -4687,6 +4687,9 @@ update_ops (tree var, enum tree_code code, const vec<operand_entry *> &ops, gimple_set_uid (g, gimple_uid (stmt)); gimple_set_visited (g, true); gsi_insert_before (&gsi, g, GSI_SAME_STMT); + gimple_stmt_iterator gsi2 = gsi_for_stmt (g); + if (fold_stmt_inplace (&gsi2)) + update_stmt (g); } return var; } diff --git a/gcc/value-query.h b/gcc/value-query.h index 6387896..2d7bf8f 100644 --- a/gcc/value-query.h +++ b/gcc/value-query.h @@ -140,7 +140,7 @@ get_global_range_query () ATTRIBUTE_RETURNS_NONNULL inline range_query * get_range_query (const struct function *fun) { - return fun->x_range_query ? fun->x_range_query : &global_ranges; + return (fun && fun->x_range_query) ? fun->x_range_query : &global_ranges; } // Query the global range of NAME in function F. Default to cfun. diff --git a/libgm2/ChangeLog b/libgm2/ChangeLog index c7c2c3a..611a980 100644 --- a/libgm2/ChangeLog +++ b/libgm2/ChangeLog @@ -1,3 +1,10 @@ +2023-02-19 Gaius Mulley <gaiusmod2@gmail.com> + + PR testsuite/108835 + * libm2iso/RTco.cc: Re-implementation using a single lock + mutex and inlined wait/signal implementation within + transfer. + 2023-02-13 Gaius Mulley <gaiusmod2@gmail.com> * libm2iso/RTco.cc (tprintf): Replace definition. diff --git a/libgm2/libm2iso/RTco.cc b/libgm2/libm2iso/RTco.cc index 0a0f1c0..8b8a4dc 100644 --- a/libgm2/libm2iso/RTco.cc +++ b/libgm2/libm2iso/RTco.cc @@ -1,4 +1,4 @@ -/* RTco.c provides minimal access to thread primitives. +/* RTco.cc provides minimal access to thread primitives. Copyright (C) 2019-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. @@ -30,8 +30,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <sys/select.h> #include <stdlib.h> #include <m2rts.h> +#include <cstdio> -// #define TRACEON +#define EXPORT(FUNC) RTco_ ## FUNC +#define M2EXPORT(FUNC) _M2_RTco_ ## FUNC + +/* This implementation of RTco.cc uses a single lock for mutex across + the whole module. It also forces context switching between threads + in transfer by combining an implementation of wait and signal. + + All semaphores are implemented using the same mutex lock and + separate condition variables. */ + +#undef TRACEON #define POOL #define SEM_POOL 10000 @@ -63,19 +74,22 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define tprintf(...) #endif + typedef struct threadCB_s { void (*proc) (void); - int execution; pthread_t p; - int tid; + int tid; /* The thread id. */ unsigned int interruptLevel; + __gthread_cond_t run_counter; /* Used to block the thread and force + a context switch. */ + int value; /* Count 0 or 1. */ + bool waiting; /* Is this thread waiting on the run_counter? */ } threadCB; typedef struct threadSem_s { - __gthread_mutex_t mutex; __gthread_cond_t counter; int waiting; int sem_value; @@ -87,25 +101,27 @@ static unsigned int nSemaphores = 0; static threadSem **semArray = NULL; /* These are used to lock the above module data structures. */ -static threadSem lock; +static __gthread_mutex_t lock; /* This is the only mutex for + the whole module. */ static int initialized = FALSE; +static int currentThread = 0; -extern "C" int RTco_init (void); +extern "C" int EXPORT(init) (void); extern "C" void -_M2_RTco_dep (void) +M2EXPORT(dep) (void) { } extern "C" void -_M2_RTco_init (int argc, char *argv[], char *envp[]) +M2EXPORT(init) (int argc, char *argv[], char *envp[]) { } extern "C" void -_M2_RTco_fini (int argc, char *argv[], char *envp[]) +M2EXPORT(fini) (int argc, char *argv[], char *envp[]) { } @@ -114,7 +130,6 @@ static void initSem (threadSem *sem, int value) { __GTHREAD_COND_INIT_FUNCTION (&sem->counter); - __GTHREAD_MUTEX_INIT_FUNCTION (&sem->mutex); sem->waiting = FALSE; sem->sem_value = value; } @@ -122,43 +137,41 @@ initSem (threadSem *sem, int value) static void waitSem (threadSem *sem) { - __gthread_mutex_lock (&sem->mutex); + __gthread_mutex_lock (&lock); if (sem->sem_value == 0) { sem->waiting = TRUE; - __gthread_cond_wait (&sem->counter, &sem->mutex); + __gthread_cond_wait (&sem->counter, &lock); sem->waiting = FALSE; } else sem->sem_value--; - __gthread_mutex_unlock (&sem->mutex); + __gthread_mutex_unlock (&lock); } static void signalSem (threadSem *sem) { - __gthread_mutex_unlock (&sem->mutex); + __gthread_mutex_lock (&lock); if (sem->waiting) __gthread_cond_signal (&sem->counter); else sem->sem_value++; - __gthread_mutex_unlock (&sem->mutex); + __gthread_mutex_unlock (&lock); } -void stop (void) {} - extern "C" void -RTco_wait (int sid) +EXPORT(wait) (int sid) { - RTco_init (); + EXPORT(init) (); tprintf ("wait %d\n", sid); waitSem (semArray[sid]); } extern "C" void -RTco_signal (int sid) +EXPORT(signal) (int sid) { - RTco_init (); + EXPORT(init) (); tprintf ("signal %d\n", sid); signalSem (semArray[sid]); } @@ -207,90 +220,58 @@ initSemaphore (int value) } extern "C" int -RTco_initSemaphore (int value) +EXPORT(initSemaphore) (int value) { int sid; - RTco_init (); - waitSem (&lock); + tprintf ("initSemaphore (%d) called\n", value); + EXPORT(init) (); + tprintf ("about to access lock\n"); + __gthread_mutex_lock (&lock); sid = initSemaphore (value); - signalSem (&lock); + __gthread_mutex_unlock (&lock); return sid; } -/* signalThread signal the semaphore associated with thread tid. */ - -extern "C" void -RTco_signalThread (int tid) -{ - int sem; - RTco_init (); - tprintf ("signalThread %d\n", tid); - waitSem (&lock); - sem = threadArray[tid].execution; - signalSem (&lock); - RTco_signal (sem); -} - -/* waitThread wait on the semaphore associated with thread tid. */ - -extern "C" void -RTco_waitThread (int tid) -{ - RTco_init (); - tprintf ("waitThread %d\n", tid); - RTco_wait (threadArray[tid].execution); -} - -extern "C" int -currentThread (void) -{ - int tid; - - for (tid = 0; tid < nThreads; tid++) - if (pthread_self () == threadArray[tid].p) - return tid; - M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "failed to find currentThread"); -} - extern "C" int -RTco_currentThread (void) +EXPORT(currentThread) (void) { int tid; - RTco_init (); - waitSem (&lock); - tid = currentThread (); + EXPORT(init) (); + __gthread_mutex_lock (&lock); + tid = currentThread; tprintf ("currentThread %d\n", tid); - signalSem (&lock); + __gthread_mutex_unlock (&lock); return tid; } /* currentInterruptLevel returns the interrupt level of the current thread. */ extern "C" unsigned int -RTco_currentInterruptLevel (void) +EXPORT(currentInterruptLevel) (void) { - RTco_init (); + EXPORT(init) (); + __gthread_mutex_lock (&lock); tprintf ("currentInterruptLevel %d\n", - threadArray[RTco_currentThread ()].interruptLevel); - return threadArray[RTco_currentThread ()].interruptLevel; + threadArray[currentThread].interruptLevel); + int level = threadArray[currentThread].interruptLevel; + __gthread_mutex_unlock (&lock); + return level; } /* turninterrupts returns the old interrupt level and assigns the interrupt level to newLevel. */ extern "C" unsigned int -RTco_turnInterrupts (unsigned int newLevel) +EXPORT(turnInterrupts) (unsigned int newLevel) { - int tid = RTco_currentThread (); - unsigned int old = RTco_currentInterruptLevel (); - + EXPORT(init) (); + __gthread_mutex_lock (&lock); + unsigned int old = threadArray[currentThread].interruptLevel; tprintf ("turnInterrupts from %d to %d\n", old, newLevel); - waitSem (&lock); - threadArray[tid].interruptLevel = newLevel; - signalSem (&lock); + threadArray[currentThread].interruptLevel = newLevel; + __gthread_mutex_unlock (&lock); return old; } @@ -306,12 +287,30 @@ execThread (void *t) { threadCB *tp = (threadCB *)t; + tprintf ("exec thread tid = %d coming to life\n", tp->tid); + __gthread_mutex_lock (&lock); tprintf ("exec thread tid = %d function = 0x%p arg = 0x%p\n", tp->tid, tp->proc, t); - RTco_waitThread ( - tp->tid); /* Forcing this thread to block, waiting to be scheduled. */ - tprintf (" exec thread [%d] function = 0x%p arg = 0x%p\n", tp->tid, + /* Has the thread been signalled? */ + if (tp->value == 0) + { + /* Not been signalled therefore we force ourselves to block. */ + tprintf ("%s: forcing thread tid = %d to wait\n", + __FUNCTION__, tp->tid); + tp->waiting = true; /* We are waiting. */ + __gthread_cond_wait (&tp->run_counter, &lock); + tp->waiting = false; /* Running again. */ + } + else + { + /* Yes signalled, therefore just take the recorded signal and continue. */ + tprintf ("%s: no need for thread tid = %d to wait\n", + __FUNCTION__, tp->tid); + tp->value--; + } + tprintf (" running exec thread [%d] function = 0x%p arg = 0x%p\n", tp->tid, tp->proc, t); + __gthread_mutex_unlock (&lock); tp->proc (); /* Now execute user procedure. */ #if 0 M2RTS_CoroutineException ( __FILE__, __LINE__, __COLUMN__, __FUNCTION__, "coroutine finishing"); @@ -356,21 +355,24 @@ initThread (void (*proc) (void), unsigned int stackSize, threadArray[tid].proc = proc; threadArray[tid].tid = tid; - threadArray[tid].execution = initSemaphore (0); + /* Initialize the thread run_counter used to force a context switch. */ + __GTHREAD_COND_INIT_FUNCTION (&threadArray[tid].run_counter); threadArray[tid].interruptLevel = interrupt; + threadArray[tid].waiting = false; /* The thread is running. */ + threadArray[tid].value = 0; /* No signal has been seen yet. */ - /* set thread creation attributes. */ + /* Set thread creation attributes. */ result = pthread_attr_init (&attr); if (result != 0) M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "failed to create thread attribute"); + "failed to create thread attribute"); if (stackSize > 0) { result = pthread_attr_setstacksize (&attr, stackSize); if (result != 0) M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "failed to set stack size attribute"); + "failed to set stack size attribute"); } tprintf ("initThread [%d] function = 0x%p (arg = 0x%p)\n", tid, proc, @@ -385,85 +387,132 @@ initThread (void (*proc) (void), unsigned int stackSize, } extern "C" int -RTco_initThread (void (*proc) (void), unsigned int stackSize, - unsigned int interrupt) +EXPORT(initThread) (void (*proc) (void), unsigned int stackSize, + unsigned int interrupt) { int tid; - RTco_init (); - waitSem (&lock); + EXPORT(init) (); + __gthread_mutex_lock (&lock); tid = initThread (proc, stackSize, interrupt); - signalSem (&lock); + __gthread_mutex_unlock (&lock); return tid; } /* transfer unlocks thread p2 and locks the current thread. p1 is - updated with the current thread id. */ + updated with the current thread id. + The implementation of transfer uses a combined wait/signal. */ extern "C" void -RTco_transfer (int *p1, int p2) +EXPORT(transfer) (int *p1, int p2) { - int tid = currentThread (); - - if (!initialized) - M2RTS_HaltC ( - __FILE__, __LINE__, __FUNCTION__, - "cannot transfer to a process before the process has been created"); - if (tid == p2) - { - /* error. */ + __gthread_mutex_lock (&lock); + { + if (!initialized) M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "attempting to transfer to ourself"); - } - else - { - *p1 = tid; - tprintf ("start, context switching from: %d to %d\n", tid, p2); - RTco_signalThread (p2); - RTco_waitThread (tid); - tprintf ("end, context back to %d\n", tid); + "cannot transfer to a process before the process has been created"); + if (currentThread == p2) + { + /* Error. */ + M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, + "attempting to transfer to ourself"); } + else + { + *p1 = currentThread; + int old = currentThread; + tprintf ("start, context switching from: %d to %d\n", currentThread, p2); + /* Perform signal (p2 sem). Without the mutex lock as we have + already obtained it above. */ + if (threadArray[p2].waiting) + { + /* p2 is blocked on the condition variable, release it. */ + tprintf ("p1 = %d cond_signal to p2 (%d)\n", currentThread, p2); + __gthread_cond_signal (&threadArray[p2].run_counter); + tprintf ("after p1 = %d cond_signal to p2 (%d)\n", currentThread, p2); + } + else + { + /* p2 hasn't reached the condition variable, so bump value + ready for p2 to test. */ + tprintf ("no need for thread %d to cond_signal - bump %d value (pre) = %d\n", + currentThread, p2, threadArray[p2].value); + threadArray[p2].value++; + } + /* Perform wait (old sem). Again without obtaining mutex as + we've already claimed it. */ + if (threadArray[old].value == 0) + { + currentThread = p2; + /* Record we are about to wait on the condition variable. */ + threadArray[old].waiting = true; + __gthread_cond_wait (&threadArray[old].run_counter, &lock); + threadArray[old].waiting = false; + /* We are running again. */ + currentThread = old; + } + else + { + tprintf ("(currentThread = %d) no need for thread %d to cond_wait - taking value (pre) = %d\n", + currentThread, old, threadArray[old].value); + /* No need to block as we have been told a signal has + effectively already been recorded. We remove the signal + notification without blocking. */ + threadArray[old].value--; + } + tprintf ("end, context back to %d\n", currentThread); + if (currentThread != old) + M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, + "wrong process id"); + } + } + __gthread_mutex_unlock (&lock); } extern "C" int -RTco_select (int p1, fd_set *p2, fd_set *p3, fd_set *p4, const timespec *p5) +EXPORT(select) (int p1, fd_set *p2, fd_set *p3, fd_set *p4, const timespec *p5) { - RTco_init (); + EXPORT(init) (); tprintf ("[%x] RTco.select (...)\n", pthread_self ()); return pselect (p1, p2, p3, p4, p5, NULL); } extern "C" int -RTco_init (void) +EXPORT(init) (void) { + tprintf ("checking init\n"); if (! initialized) { - int tid; + initialized = TRUE; tprintf ("RTco initialized\n"); - initSem (&lock, 0); + __GTHREAD_MUTEX_INIT_FUNCTION (&lock); + __gthread_mutex_lock (&lock); /* Create initial thread container. */ #if defined(POOL) threadArray = (threadCB *)malloc (sizeof (threadCB) * THREAD_POOL); semArray = (threadSem **)malloc (sizeof (threadSem *) * SEM_POOL); #endif - tid = newThread (); /* For the current initial thread. */ - threadArray[tid].tid = tid; - threadArray[tid].execution = initSemaphore (0); - threadArray[tid].p = pthread_self (); - threadArray[tid].interruptLevel = 0; - threadArray[tid].proc - = never; /* This shouldn't happen as we are already running. */ - initialized = TRUE; + /* Create a thread control block for the main program (or process). */ + currentThread = newThread (); /* For the current initial thread. */ + threadArray[currentThread].p = pthread_self (); + threadArray[currentThread].tid = currentThread; + __GTHREAD_COND_INIT_FUNCTION (&threadArray[currentThread].run_counter); + threadArray[currentThread].interruptLevel = 0; + /* The line below shouldn't be necessary as we are already running. */ + threadArray[currentThread].proc = never; + threadArray[currentThread].waiting = false; /* We are running. */ + threadArray[currentThread].value = 0; /* No signal from anyone yet. */ tprintf ("RTco initialized completed\n"); - signalSem (&lock); + __gthread_mutex_unlock (&lock); } return 0; } extern "C" void __attribute__((__constructor__)) -_M2_RTco_ctor (void) +M2EXPORT(ctor) (void) { - M2RTS_RegisterModule ("RTco", _M2_RTco_init, _M2_RTco_fini, - _M2_RTco_dep); + M2RTS_RegisterModule ("RTco", + M2EXPORT(init), M2EXPORT(fini), + M2EXPORT(dep)); } diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 00aafa4..7eb41df 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2023-02-18 Gerald Pfeifer <gerald@pfeifer.com> + + * doc/xml/faq.xml: Switch two links to www.open-std.org to https. + * doc/html/faq.html: Regenerate. + 2023-02-16 Matthias Kretz <m.kretz@gsi.de> * include/experimental/bits/simd_math.h (__hypot): Bitcasting diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html index f49b84c..965aa91 100644 --- a/libstdc++-v3/doc/html/faq.html +++ b/libstdc++-v3/doc/html/faq.html @@ -541,7 +541,7 @@ For those people who are not part of the ISO Library Group (i.e., nearly all of us needing to read this page in the first place), a public list of the library defects is occasionally - published on <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/" target="_top">the WG21 + published on <a class="link" href="https://www.open-std.org/jtc1/sc22/wg21/" target="_top">the WG21 website</a>. Many of these issues have resulted in <a class="link" href="manual/bugs.html#manual.intro.status.bugs.iso" title="Standard Bugs">code changes in libstdc++</a>. @@ -825,7 +825,7 @@ Yes. </p><p> The C++ Standard Library - <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top"> + <a class="link" href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top"> Technical Report 1</a> added many new features to the library. </p><p> The implementation status of TR1 in libstdc++ can be tracked diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml index 9ae4966..b38091a 100644 --- a/libstdc++-v3/doc/xml/faq.xml +++ b/libstdc++-v3/doc/xml/faq.xml @@ -754,7 +754,7 @@ (i.e., nearly all of us needing to read this page in the first place), a public list of the library defects is occasionally published on <link xmlns:xlink="http://www.w3.org/1999/xlink" - xlink:href="http://www.open-std.org/jtc1/sc22/wg21/">the WG21 + xlink:href="https://www.open-std.org/jtc1/sc22/wg21/">the WG21 website</link>. Many of these issues have resulted in <link linkend="manual.intro.status.bugs.iso">code changes in libstdc++</link>. @@ -1181,7 +1181,7 @@ </para> <para> The C++ Standard Library - <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf"> + <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf"> Technical Report 1</link> added many new features to the library. </para> <para> |