diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2024-04-10 11:01:28 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2024-04-10 11:01:28 +0200 |
commit | 9575360bad470025b131fa74fdc11ac28409cb9c (patch) | |
tree | 05cf796db40f12d45a44de0be6c8e9276a27bc4b /gcc | |
parent | 1cae91f78a006bcd494e4846142fc170099af71e (diff) | |
parent | 5329b94188206e9f8c96d9a63931c415fa5d39d7 (diff) | |
download | gcc-9575360bad470025b131fa74fdc11ac28409cb9c.zip gcc-9575360bad470025b131fa74fdc11ac28409cb9c.tar.gz gcc-9575360bad470025b131fa74fdc11ac28409cb9c.tar.bz2 |
Merge commit 'f0b1cf01782ba975cfda32800c91076df78058d6^' into HEAD
Diffstat (limited to 'gcc')
316 files changed, 6163 insertions, 1411 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4997309..6116a33 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,454 @@ +2024-02-14 Uros Bizjak <ubizjak@gmail.com> + + PR target/113871 + * config/i386/mmx.md (V248FI): New mode iterator. + (V24FI_32): DItto. + (vec_shl_<V248FI:mode>): New expander. + (vec_shl_<V24FI_32:mode>): Ditto. + (vec_shr_<V248FI:mode>): Ditto. + (vec_shr_<V24FI_32:mode>): Ditto. + * config/i386/sse.md (vec_shl_<V_128:mode>): Simplify expander. + (vec_shr_<V248FI:mode>): Ditto. + +2024-02-14 Jan Hubicka <jh@suse.cz> + + PR tree-optimization/111054 + * tree-ssa-loop-split.cc (split_loop): Check for profile being present. + +2024-02-14 Tamar Christina <tamar.christina@arm.com> + + * tree-cfg.cc (replace_loop_annotate): Inspect loop edges for annotations. + +2024-02-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113910 + * bitmap.cc (bitmap_hash): Mix the full element "hash" to + the hashval_t hash. + +2024-02-14 Jakub Jelinek <jakub@redhat.com> + + * pretty-print.cc (PTRDIFF_MAX): Define if not yet defined. + (pp_integer_with_precision): For unsigned ptrdiff_t printing + with u, o or x print ptrdiff_t argument converted to + unsigned long long and masked with 2ULL * PTRDIFF_MAX + 1. + +2024-02-14 Richard Biener <rguenther@suse.de> + + PR middle-end/113576 + * expr.cc (do_store_flag): For vector bool compares of vectors + with padding zero that. + * dojump.cc (do_compare_and_jump): Likewise. + +2024-02-14 Gerald Pfeifer <gerald@pfeifer.com> + + * doc/install.texi (Prerequisites): Update gettext link. + +2024-02-13 H.J. Lu <hjl.tools@gmail.com> + + PR target/113876 + * config/i386/i386.cc (ix86_pro_and_epilogue_can_use_push2pop2): + Return false if the incoming stack isn't 16-byte aligned. + +2024-02-13 Tobias Burnus <tburnus@baylibre.com> + + PR middle-end/113904 + * omp-general.cc (struct omp_ts_info): Update for splitting of + OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. + * omp-selectors.h (enum omp_tp_type): Replace + OMP_TRAIT_PROPERTY_EXPR by OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. + +2024-02-13 Monk Chiang <monk.chiang@sifive.com> + + PR target/113742 + * config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Fix + recognizes UNSPEC_AUIPC for RISCV_FUSE_LUI_ADDI. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113895 + * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Track + offset to discover constant array indices in bits, handle + COMPONENT_REF to bitfields. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113831 + * tree-ssa-sccvn.cc (ao_ref_init_from_vn_reference): Fix + typo in comment. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113902 + * tree-vect-loop.cc (move_early_exit_stmts): Track + last_seen_vuse for VUSE updating. + +2024-02-13 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113734 + * tree-vect-loop.cc (vect_transform_loop): Treat the final iteration of + an early break loop as partial. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113898 + * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Add + missing accumulated off adjustment. + +2024-02-13 Jakub Jelinek <jakub@redhat.com> + + * hwint.h (GCC_PRISZ, fmt_size_t): Fix preprocessor conditions, + instead of comparing SIZE_MAX against INT_MAX and LONG_MAX compare + it against UINT_MAX and ULONG_MAX. + +2024-02-13 David Malcolm <dmalcolm@redhat.com> + + * diagnostic-core.h (emit_diagnostic_valist): Rename overload + to... + (emit_diagnostic_valist_meta): ...this. + * diagnostic.cc (emit_diagnostic_valist): Likewise, to... + (emit_diagnostic_valist_meta): ...this. + +2024-02-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113849 + * gimple-lower-bitint.cc (bitint_large_huge::handle_cast): Don't use + fast path for widening casts where !m_upwards_2limb and lhs_type + has precision which is a multiple of limb_prec. + +2024-02-12 Jakub Jelinek <jakub@redhat.com> + + PR c++/113674 + * attribs.cc (extract_attribute_substring): Remove. + (lookup_scoped_attribute_spec): Don't call it. + +2024-02-12 Jakub Jelinek <jakub@redhat.com> + + * gengtype.cc (adjust_field_rtx_def): Use HOST_SIZE_T_PRINT_UNSIGNED + and cast to fmt_size_t instead of %lu and cast to unsigned long. + +2024-02-12 Christophe Lyon <christophe.lyon@linaro.org> + + * Makefile.in: Add no-info dependency. + * configure.ac: Set BUILD_INFO=no-info if makeinfo is not + available. + * configure: Regenerate. + +2024-02-12 Iain Sandoe <iain@sandoe.co.uk> + + PR target/113855 + * config/i386/darwin.h (DARWIN_HEAP_T_LIB): Moved to be + available to all sub-targets. + * config/i386/darwin32-biarch.h (DARWIN_HEAP_T_LIB): Delete. + * config/i386/darwin64-biarch.h (DARWIN_HEAP_T_LIB): Delete. + +2024-02-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113831 + PR tree-optimization/108355 + * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): When + we see variable array indices and get_ref_base_and_extent + can resolve those to constants fix up the ops to constants + as well. + (ao_ref_init_from_vn_reference): Use 'off' member for + ARRAY_REF and ARRAY_RANGE_REF instead of recomputing it. + (valueize_refs_1): Also fixup 'off' of ARRAY_RANGE_REF. + +2024-02-12 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-vector-builtins.cc (resolve_overloaded_builtin): + Replace args to arguments for misspelled term. + +2024-02-12 Georg-Johann Lay <avr@gjlay.de> + + PR target/112944 + * config/avr/gen-avr-mmcu-specs.cc (print_mcu) [have_flmap]: + <*link_rodata_in_ram>: Spec undefs symbol __do_flmap_init + when not linked with -mrodata-in-ram. + +2024-02-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113863 + * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): + Record crossed virtual PHIs. + * tree-vect-loop.cc (move_early_exit_stmts): Elide crossed + virtual PHIs. + +2024-02-10 Marek Polacek <polacek@redhat.com> + + DR 2237 + PR c++/107126 + PR c++/97202 + * doc/invoke.texi: Document -Wtemplate-id-cdtor. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * gimple-lower-bitint.cc (itint_large_huge::lower_addsub_overflow): Fix + computation of idx for i == 4 of bitint_prec_huge. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/110754 + * gimple-low.cc (assumption_copy_decl): For TREE_THIS_VOLATILE + decls create PARM_DECL with pointer to original type, set + TREE_READONLY and keep TREE_THIS_VOLATILE, TREE_ADDRESSABLE, + DECL_NOT_GIMPLE_REG_P and DECL_BY_REFERENCE cleared. + (adjust_assumption_stmt_op): For remapped TREE_THIS_VOLATILE decls + wrap PARM_DECL into a simple TREE_THIS_NO_TRAP MEM_REF. + (lower_assumption): For TREE_THIS_VOLATILE vars pass ADDR_EXPR + of the var as argument. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * pretty-print.cc (pp_integer_with_precision): Handle precision 3 for + size_t and precision 4 for ptrdiff_t. Formatting fix. + (pp_format): Document %{t,z}{d,i,u,o,x}. Implement t and z modifiers. + Formatting fixes. + (test_pp_format): Test t and z modifiers. + * gcc.cc (read_specs): Use %td instead of %ld and casts to long. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * ipa-icf.cc (sem_item_optimizer::process_cong_reduction, + sem_item_optimizer::dump_cong_classes): Use HOST_SIZE_T_PRINT_UNSIGNED + and casts to fmt_size_t instead of "%lu" and casts to unsigned long. + * tree.cc (print_debug_expr_statistics): Use HOST_SIZE_T_PRINT_DEC + and casts to fmt_size_t instead of "%ld" and casts to long. + (print_value_expr_statistics, print_type_hash_statistics): Likewise. + * dwarf2out.cc (output_macinfo_op): Use HOST_WIDE_INT_PRINT_UNSIGNED + instead of "%lu" and casts to unsigned long. + * gcov-dump.cc (dump_gcov_file): Use %u instead of %lu and casts to + unsigned long. + * tree-ssa-dom.cc (htab_statistics): Use HOST_SIZE_T_PRINT_DEC + and casts to fmt_size_t instead of "%ld" and casts to long. + * cfgexpand.cc (dump_stack_var_partition): Use + HOST_SIZE_T_PRINT_UNSIGNED and casts to fmt_size_t instead of "%lu" + and casts to unsigned long. + * gengtype.cc (adjust_field_rtx_def): Likewise. + * tree-into-ssa.cc (htab_statistics): Use HOST_SIZE_T_PRINT_DEC + and casts to fmt_size_t instead of "%ld" and casts to long. + * postreload-gcse.cc (dump_hash_table): Likewise. + * ggc-page.cc (alloc_page): Use HOST_SIZE_T_PRINT_UNSIGNED + and casts to fmt_size_t instead of "%lu" and casts to unsigned long. + (ggc_internal_alloc, ggc_free): Likewise. + * genpreds.cc (write_lookup_constraint_1): Likewise. + (write_insn_constraint_len): Likewise. + * tree-dfa.cc (dump_dfa_stats): Use HOST_SIZE_T_PRINT_DEC + and casts to fmt_size_t instead of "%ld" and casts to long. + * varasm.cc (output_constant_pool_contents): Use + HOST_WIDE_INT_PRINT_DEC instead of "%ld" and casts to long. + * var-tracking.cc (dump_var): Likewise. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113783 + * gimple-lower-bitint.cc (bitint_large_huge::lower_stmt): Look + through VIEW_CONVERT_EXPR for final cast checks. Handle + VIEW_CONVERT_EXPRs from large/huge _BitInt to > MAX_FIXED_MODE_SIZE + INTEGER_TYPEs. + (gimple_lower_bitint): Don't merge mergeable operations or other + casts with VIEW_CONVERT_EXPRs to > MAX_FIXED_MODE_SIZE INTEGER_TYPEs. + * expr.cc (expand_expr_real_1): Don't use convert_modes if either + mode is BLKmode. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + * hwint.h (GCC_PRISZ, fmt_size_t, HOST_SIZE_T_PRINT_DEC, + HOST_SIZE_T_PRINT_UNSIGNED, HOST_SIZE_T_PRINT_HEX, + HOST_SIZE_T_PRINT_HEX_PURE): Define. + * ira-conflicts.cc (build_conflict_bit_table): Use it. Formatting + fixes. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/113415 + * cfgexpand.cc (expand_asm_stmt): For asm goto, use + duplicate_insn_chain to duplicate after_rtl_seq sequence instead + of hand written loop with emit_insn of copy_insn and emit original + after_rtl_seq on the last edge. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113818 + * gimple-lower-bitint.cc (add_eh_edge): New function. + (bitint_large_huge::handle_load, + bitint_large_huge::lower_mergeable_stmt, + bitint_large_huge::lower_muldiv_stmt): Use it. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113774 + * gimple-lower-bitint.cc (bitint_large_huge::handle_cast): Don't + emit any comparison if m_first and low + 1 is equal to + m_upwards_2limb, simplify condition for that. If not + single_comparison, not m_first and we can prove that the idx <= low + comparison will be always true, emit instead of idx <= low + comparison low <= low such that cfg cleanup will optimize it at + the end of the pass. + +2024-02-08 Aldy Hernandez <aldyh@redhat.com> + + PR tree-optimization/113735 + * value-relation.cc (equiv_oracle::add_equiv_to_block): Call + limit_check(). + +2024-02-08 Georg-Johann Lay <avr@gjlay.de> + + * config/avr/gen-avr-mmcu-specs.cc (struct McuInfo): New. + (main, print_mcu, diagnose_mrodata_in_ram): Pass it down. + +2024-02-08 H.J. Lu <hjl.tools@gmail.com> + + PR target/113711 + PR target/113733 + * config/i386/constraints.md: List all constraints with j prefix. + (j>): Change auto-dec to auto-inc in documentation. + (je): Changed to a memory constraint with APX NDD TLS operand + check. + (jM): New memory constraint for APX NDD instructions. + (jO): Likewise. + * config/i386/i386-protos.h (x86_poff_operand_p): Removed. + * config/i386/i386.cc (x86_poff_operand_p): Likewise. + * config/i386/i386.md (*add<dwi>3_doubleword): Use rjO. + (*add<mode>_1[SWI48]): Use je and jM. + (addsi_1_zext): Use jM. + (*addv<dwi>4_doubleword_1[DWI]): Likewise. + (*sub<mode>_1[SWI]): Use jM. + (@add<mode>3_cc_overflow_1[SWI]): Likewise. + (*add<dwi>3_doubleword_cc_overflow_1): Use rjO. + (*and<dwi>3_doubleword): Likewise. + (*anddi_1): Use jM. + (*andsi_1_zext): Likewise. + (*and<mode>_1[SWI24]): Likewise. + (*<code><dwi>3_doubleword[any_or]): Use rjO + (*code<mode>_1[any_or SWI248]): Use jM. + (*<code>si_1_zext[zero_extend + any_or]): Likewise. + * config/i386/predicates.md (apx_ndd_memory_operand): New. + (apx_ndd_add_memory_operand): Likewise. + +2024-02-08 Georg-Johann Lay <avr@gjlay.de> + + PR target/113824 + * config/avr/avr-mcus.def (ata5797): Move from avr5 to avr4. + * doc/avr-mmcu.texi: Rebuild. + +2024-02-08 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113808 + * tree-vect-loop.cc (vectorizable_live_operation): Don't cache the + value cross iterations. + +2024-02-08 Georg-Johann Lay <avr@gjlay.de> + + * config/avr/gen-avr-mmcu-specs.cc (print_mcu) <*cpp_mcu>: Spec always + defines __AVR_PM_BASE_ADDRESS__ if the core has it. + +2024-02-08 Richard Biener <rguenther@suse.de> + + * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): + Revert last change to dr_may_alias_p. + +2024-02-08 Georg-Johann Lay <avr@gjlay.de> + + * config/avr/gen-avr-mmcu-specs.cc: Rename spec cc1_misc to + cc1_rodata_in_ram. Rename spec link_misc to link_rodata_in_ram. + Remove spec asm_misc. + * config/avr/specs.h: Same. + +2024-02-08 Pan Li <pan2.li@intel.com> + + PR target/113766 + * config/riscv/riscv-vector-builtins-shapes.cc (struct alu_def): Make + sure the c.arg_num is >= 2 before checking. + (struct build_frm_base): Ditto. + (struct narrow_alu_def): Ditto. + +2024-02-07 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113796 + * tree-if-conv.cc (combine_blocks): Wipe range-info before + replacing PHIs and inserting predicates. + +2024-02-07 Roger Sayle <roger@nextmovesoftware.com> + Uros Bizjak <ubizjak@gmail.com> + + PR target/113690 + * config/i386/i386-features.cc (timode_convert_cst): New helper + function to convert a TImode CONST_SCALAR_INT_P to a V1TImode + CONST_VECTOR. + (timode_scalar_chain::convert_op): Use timode_convert_cst. + (timode_scalar_chain::convert_insn): Delete REG_EQUAL notes. + Use timode_convert_cst. + +2024-02-07 Victor Do Nascimento <victor.donascimento@arm.com> + + * config/aarch64/aarch64-sys-regs.def: Copy from Binutils. + * config/aarch64/aarch64.h (AARCH64_FL_AIE): New. + (AARCH64_FL_DEBUGv8p9): Likewise. + (AARCH64_FL_FGT2): Likewise.Likewise. + (AARCH64_FL_ITE): Likewise. + (AARCH64_FL_PFAR): Likewise. + (AARCH64_FL_PMUv3_ICNTR): Likewise. + (AARCH64_FL_PMUv3_SS): Likewise. + (AARCH64_FL_PMUv3p9): Likewise. + (AARCH64_FL_RASv2): Likewise. + (AARCH64_FL_S1PIE): Likewise. + (AARCH64_FL_S1POE): Likewise. + (AARCH64_FL_S2PIE): Likewise. + (AARCH64_FL_S2POE): Likewise. + (AARCH64_FL_SCTLR2): Likewise. + (AARCH64_FL_SEBEP): Likewise. + (AARCH64_FL_SPE_FDS): Likewise. + (AARCH64_FL_TCR2): Likewise. + +2024-02-07 Richard Biener <rguenther@suse.de> + + * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): + Only check whether reads are in-bound in places that are not safe. + Fix dependence check. Add missing newline. Clarify comments. + +2024-02-07 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113750 + * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): Check + for single predecessor when doing early break vect. + * tree-vect-loop.cc (move_early_exit_stmts): Get gsi at the start but + after labels. + +2024-02-07 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113731 + * gimple-iterator.cc (gsi_move_before): Take new parameter for update + method. + * gimple-iterator.h (gsi_move_before): Default new param to + GSI_SAME_STMT. + * tree-vect-loop.cc (move_early_exit_stmts): Call gsi_move_before with + GSI_NEW_STMT. + +2024-02-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113756 + * range-op.cc (update_known_bitmask): For GIMPLE_UNARY_RHS, + use TYPE_SIGN (lh.type ()) instead of sign for widest_int::from + of lh_bits value and mask. + +2024-02-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113753 + * wide-int.cc (wi::mul_internal): Unpack op1val and op2val with + UNSIGNED rather than SIGNED. If high or needs_overflow and prec is + not a multiple of HOST_BITS_PER_WIDE_INT, shift left bits above prec + so that they start with r[half_blocks_needed] lowest bit. Fix up + computation of top mask for SIGNED. + +2024-02-07 Pan Li <pan2.li@intel.com> + + PR target/113766 + * config/riscv/riscv-protos.h (resolve_overloaded_builtin): Adjust + the signature of func. + * config/riscv/riscv-c.cc (riscv_resolve_overloaded_builtin): Ditto. + * config/riscv/riscv-vector-builtins.cc (resolve_overloaded_builtin): Make + overloaded func with empty args error. + 2024-02-06 H.J. Lu <hjl.tools@gmail.com> PR target/113689 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fb89643..fb6e4f0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20240207 +20240215 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 95caa54..a74761b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -3480,6 +3480,13 @@ install-no-fixedincludes: doc: $(BUILD_INFO) $(GENERATED_MANPAGES) +# If BUILD_INFO is set to no-info by configure, we still want to check +# 'info' dependencies even the build rules are no-ops because +# BUILD_INFO != info (see %.info rule) +ifeq ($(BUILD_INFO),no-info) +no-info: info +endif + INFOFILES = doc/cpp.info doc/gcc.info doc/gccint.info \ doc/gccinstall.info doc/cppinternals.info diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index f666c73..29ebffe 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,10 @@ +2024-02-13 David Malcolm <dmalcolm@redhat.com> + + * pending-diagnostic.cc (diagnostic_emission_context::warn): + Update for renaming of emit_diagnostic_valist overload to + emit_diagnostic_valist_meta. + (diagnostic_emission_context::inform): Likewise. + 2024-01-31 David Malcolm <dmalcolm@redhat.com> PR analyzer/113253 diff --git a/gcc/analyzer/pending-diagnostic.cc b/gcc/analyzer/pending-diagnostic.cc index e49aaa5..b2961c2 100644 --- a/gcc/analyzer/pending-diagnostic.cc +++ b/gcc/analyzer/pending-diagnostic.cc @@ -129,10 +129,10 @@ diagnostic_emission_context::warn (const char *gmsgid, ...) auto_diagnostic_group d; va_list ap; va_start (ap, gmsgid); - const bool result = emit_diagnostic_valist (DK_WARNING, - &m_rich_loc, &m_metadata, - pd.get_controlling_option (), - gmsgid, &ap); + const bool result = emit_diagnostic_valist_meta (DK_WARNING, + &m_rich_loc, &m_metadata, + pd.get_controlling_option (), + gmsgid, &ap); va_end (ap); return result; } @@ -147,10 +147,10 @@ diagnostic_emission_context::inform (const char *gmsgid, ...) auto_diagnostic_group d; va_list ap; va_start (ap, gmsgid); - emit_diagnostic_valist (DK_NOTE, - &m_rich_loc, &m_metadata, - pd.get_controlling_option (), - gmsgid, &ap); + emit_diagnostic_valist_meta (DK_NOTE, + &m_rich_loc, &m_metadata, + pd.get_controlling_option (), + gmsgid, &ap); va_end (ap); } diff --git a/gcc/attribs.cc b/gcc/attribs.cc index 4df5d24..fc7459c 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -116,15 +116,6 @@ get_gnu_namespace () return gnu_namespace_cache; } -/* Return base name of the attribute. Ie '__attr__' is turned into 'attr'. - To avoid need for copying, we simply return length of the string. */ - -static void -extract_attribute_substring (struct substring *str) -{ - canonicalize_attr_name (str->str, str->length); -} - /* Insert SPECS into its namespace. IGNORED_P is true iff all unknown attributes in this namespace should be ignored for the purposes of -Wattributes. The function returns the namespace into which the @@ -398,7 +389,6 @@ lookup_scoped_attribute_spec (const_tree ns, const_tree name) attr.str = IDENTIFIER_POINTER (name); attr.length = IDENTIFIER_LENGTH (name); - extract_attribute_substring (&attr); return attrs->attribute_hash->find_with_hash (&attr, substring_hash (attr.str, attr.length)); diff --git a/gcc/bitmap.cc b/gcc/bitmap.cc index 6cf326b..459e32c 100644 --- a/gcc/bitmap.cc +++ b/gcc/bitmap.cc @@ -2706,7 +2706,7 @@ bitmap_hash (const_bitmap head) for (ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++) hash ^= ptr->bits[ix]; } - return (hashval_t)hash; + return iterative_hash (&hash, sizeof (hash), 0); } diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 6741eb5..11589f4 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,23 @@ +2024-02-10 Marek Polacek <polacek@redhat.com> + + DR 2237 + PR c++/107126 + PR c++/97202 + * c-opts.cc (c_common_post_options): In C++20 or with -Wc++20-compat, + turn on -Wtemplate-id-cdtor. + * c.opt (Wtemplate-id-cdtor): New. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * c-format.cc (gcc_diag_length_specs): Add t and z modifiers. + (PP_FORMAT_CHAR_TABLE, gcc_gfc_char_table): Add entries for t and + z modifiers. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * c-ada-spec.cc (dump_template_types): Use HOST_SIZE_T_PRINT_UNSIGNED + and casts to fmt_size_t instead of "%lu" and casts to unsigned long. + 2024-02-01 Lewis Hyatt <lhyatt@gmail.com> PR preprocessor/105608 diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc index 4b245ed..e56ef10f 100644 --- a/gcc/c-family/c-ada-spec.cc +++ b/gcc/c-family/c-ada-spec.cc @@ -1852,7 +1852,8 @@ dump_template_types (pretty_printer *buffer, tree types, int spc) if (!dump_ada_node (buffer, elem, NULL_TREE, spc, false, true)) { pp_string (buffer, "unknown"); - pp_scalar (buffer, "%lu", (unsigned long) TREE_HASH (elem)); + pp_scalar (buffer, HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t) TREE_HASH (elem)); } } } diff --git a/gcc/c-family/c-format.cc b/gcc/c-family/c-format.cc index 08d5a66..9c4deab 100644 --- a/gcc/c-family/c-format.cc +++ b/gcc/c-family/c-format.cc @@ -512,6 +512,8 @@ static const format_length_info gcc_diag_length_specs[] = { { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89, 0 }, { "w", FMT_LEN_w, STD_C89, NO_FMT, 0 }, + { "z", FMT_LEN_z, STD_C99, NO_FMT, 0 }, + { "t", FMT_LEN_t, STD_C99, NO_FMT, 0 }, { NO_FMT, NO_FMT, 0 } }; @@ -758,9 +760,9 @@ static const format_char_info asm_fprintf_char_table[] = by all pretty_printer instances within GCC. */ #define PP_FORMAT_CHAR_TABLE \ - { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, \ - { "ox", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, \ - { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, \ + { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, \ + { "ox", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, T99_ST, T99_UPD, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, \ + { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, T99_ST, T99_UPD, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, \ { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, \ { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "pq", "cR", NULL }, \ { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "c", NULL }, \ @@ -833,8 +835,8 @@ static const format_char_info gcc_cxxdiag_char_table[] = static const format_char_info gcc_gfc_char_table[] = { /* C89 conversion specifiers. */ - { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, - { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, + { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, + { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, T99_ST, T99_UPD, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "cR", NULL }, diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index b845aff..be3058d 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -998,6 +998,11 @@ c_common_post_options (const char **pfilename) warn_deprecated_enum_float_conv, cxx_dialect >= cxx20 && warn_deprecated); + /* -Wtemplate-id-cdtor is enabled by default in C++20. */ + SET_OPTION_IF_UNSET (&global_options, &global_options_set, + warn_template_id_cdtor, + cxx_dialect >= cxx20 || warn_cxx20_compat); + /* Declone C++ 'structors if -Os. */ if (flag_declone_ctor_dtor == -1) flag_declone_ctor_dtor = optimize_size; diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 9c0a280..b7a4a1a 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1408,6 +1408,10 @@ Wtautological-compare C ObjC C++ ObjC++ Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Warn if a comparison always evaluates to true or false. +Wtemplate-id-cdtor +C++ ObjC++ Var(warn_template_id_cdtor) Warning +Warn about simple-template-id in a constructor or destructor. + Wterminate C++ ObjC++ Warning Var(warn_terminate) Init(1) Warn if a throw expression will always result in a call to terminate(). diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 002bf41..553b7a2 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,21 @@ +2024-02-13 Tobias Burnus <tburnus@baylibre.com> + + PR middle-end/113904 + * c-parser.cc (c_parser_omp_context_selector): Handle splitting of + OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * c-decl.cc (get_parm_array_spec): Use HOST_WIDE_INT_PRINT_UNSIGNED + instead of "%lu" and casts to unsigned long or unsigned long long. + +2024-02-08 Joseph Myers <josmyers@redhat.com> + + PR c/113776 + * c-typeck.cc (c_objc_common_truthvalue_conversion): Return an + integer constant expression for boolean conversion of floating + constant. + 2024-02-05 Jakub Jelinek <jakub@redhat.com> PR c/113740 diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index fe20bc2..c747abe 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -6236,7 +6236,7 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs) index. */ HOST_WIDE_INT n = tree_to_shwi (max) + 1; char buf[40]; - sprintf (buf, "%lu", (unsigned long)n); + sprintf (buf, HOST_WIDE_INT_PRINT_UNSIGNED, n); spec += buf; } continue; @@ -6309,7 +6309,7 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs) char buf[40]; unsigned HOST_WIDE_INT n = tree_to_uhwi (nelts); - sprintf (buf, "%llu", (unsigned long long)n); + sprintf (buf, HOST_WIDE_INT_PRINT_UNSIGNED, n); spec += buf; break; } diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index c31349d..3be91d6 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -24656,7 +24656,8 @@ c_parser_omp_context_selector (c_parser *parser, enum omp_tss_code set, } while (1); break; - case OMP_TRAIT_PROPERTY_EXPR: + case OMP_TRAIT_PROPERTY_DEV_NUM_EXPR: + case OMP_TRAIT_PROPERTY_BOOL_EXPR: t = c_parser_expr_no_commas (parser, NULL).value; if (t != error_mark_node) { diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 3b519c4..ddeab1e 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -13572,7 +13572,17 @@ c_objc_common_truthvalue_conversion (location_t location, tree expr, tree type) break; } - int_const = (TREE_CODE (expr) == INTEGER_CST && !TREE_OVERFLOW (expr)); + /* Conversion of a floating constant to boolean goes through here + and yields an integer constant expression. Otherwise, the result + is only an integer constant expression if the argument is. */ + int_const = ((TREE_CODE (expr) == INTEGER_CST && !TREE_OVERFLOW (expr)) + || ((TREE_CODE (expr) == REAL_CST + || TREE_CODE (expr) == COMPLEX_CST) + && (TREE_CODE (type) == BOOLEAN_TYPE + || (TREE_CODE (type) == ENUMERAL_TYPE + && ENUM_UNDERLYING_TYPE (type) != NULL_TREE + && (TREE_CODE (ENUM_UNDERLYING_TYPE (type)) + == BOOLEAN_TYPE))))); int_operands = EXPR_INT_CONST_OPERANDS (expr); if (int_operands && TREE_CODE (expr) != INTEGER_CST) { diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 316b883..d36dfc8 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc @@ -1024,7 +1024,8 @@ dump_stack_var_partition (void) if (stack_vars[i].representative != i) continue; - fprintf (dump_file, "Partition %lu: size ", (unsigned long) i); + fprintf (dump_file, "Partition " HOST_SIZE_T_PRINT_UNSIGNED ": size ", + (fmt_size_t) i); print_dec (stack_vars[i].size, dump_file); fprintf (dump_file, " align %u\n", stack_vars[i].alignb); @@ -3671,16 +3672,21 @@ expand_asm_stmt (gasm *stmt) { edge e; edge_iterator ei; - + unsigned int cnt = EDGE_COUNT (gimple_bb (stmt)->succs); + FOR_EACH_EDGE (e, ei, gimple_bb (stmt)->succs) { - start_sequence (); - for (rtx_insn *curr = after_rtl_seq; - curr != NULL_RTX; - curr = NEXT_INSN (curr)) - emit_insn (copy_insn (PATTERN (curr))); - rtx_insn *copy = get_insns (); - end_sequence (); + rtx_insn *copy; + if (--cnt == 0) + copy = after_rtl_seq; + else + { + start_sequence (); + duplicate_insn_chain (after_rtl_seq, after_rtl_end, + NULL, NULL); + copy = get_insns (); + end_sequence (); + } insert_insn_on_edge (copy, e); } } diff --git a/gcc/config/aarch64/aarch64-sys-regs.def b/gcc/config/aarch64/aarch64-sys-regs.def index fffc35f..6a94817 100644 --- a/gcc/config/aarch64/aarch64-sys-regs.def +++ b/gcc/config/aarch64/aarch64-sys-regs.def @@ -54,6 +54,10 @@ SYSREG ("amair_el12", CPENC (3,5,10,3,0), F_ARCHEXT, AARCH64_FEATURE (V8_1A)) SYSREG ("amair_el2", CPENC (3,4,10,3,0), 0, AARCH64_NO_FEATURES) SYSREG ("amair_el3", CPENC (3,6,10,3,0), 0, AARCH64_NO_FEATURES) + SYSREG ("amair2_el1", CPENC (3,0,10,3,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) + SYSREG ("amair2_el12", CPENC (3,5,10,3,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) + SYSREG ("amair2_el2", CPENC (3,4,10,3,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) + SYSREG ("amair2_el3", CPENC (3,6,10,3,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) SYSREG ("amcfgr_el0", CPENC (3,3,13,2,1), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (V8_4A)) SYSREG ("amcg1idr_el0", CPENC (3,3,13,2,6), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (V8_6A)) SYSREG ("amcgcr_el0", CPENC (3,3,13,2,2), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (V8_4A)) @@ -400,6 +404,7 @@ SYSREG ("erxaddr_el1", CPENC (3,0,5,4,3), F_ARCHEXT, AARCH64_FEATURE (RAS)) SYSREG ("erxctlr_el1", CPENC (3,0,5,4,1), F_ARCHEXT, AARCH64_FEATURE (RAS)) SYSREG ("erxfr_el1", CPENC (3,0,5,4,0), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (RAS)) + SYSREG ("erxgsr_el1", CPENC (3,0,5,3,2), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (RASv2)) SYSREG ("erxmisc0_el1", CPENC (3,0,5,5,0), F_ARCHEXT, AARCH64_FEATURE (RAS)) SYSREG ("erxmisc1_el1", CPENC (3,0,5,5,1), F_ARCHEXT, AARCH64_FEATURE (RAS)) SYSREG ("erxmisc2_el1", CPENC (3,0,5,5,2), F_ARCHEXT, AARCH64_FEATURE (RAS)) @@ -438,10 +443,14 @@ SYSREG ("hcr_el2", CPENC (3,4,1,1,0), 0, AARCH64_NO_FEATURES) SYSREG ("hcrx_el2", CPENC (3,4,1,2,2), F_ARCHEXT, AARCH64_FEATURE (V8_7A)) SYSREG ("hdfgrtr_el2", CPENC (3,4,3,1,4), F_ARCHEXT, AARCH64_FEATURE (V8_6A)) + SYSREG ("hdfgrtr2_el2", CPENC (3,4,3,1,0), F_ARCHEXT, AARCH64_FEATURE (FGT2)) SYSREG ("hdfgwtr_el2", CPENC (3,4,3,1,5), F_ARCHEXT, AARCH64_FEATURE (V8_6A)) + SYSREG ("hdfgwtr2_el2", CPENC (3,4,3,1,1), F_ARCHEXT, AARCH64_FEATURE (FGT2)) SYSREG ("hfgitr_el2", CPENC (3,4,1,1,6), F_ARCHEXT, AARCH64_FEATURE (V8_6A)) SYSREG ("hfgrtr_el2", CPENC (3,4,1,1,4), F_ARCHEXT, AARCH64_FEATURE (V8_6A)) + SYSREG ("hfgrtr2_el2", CPENC (3,4,3,1,2), F_ARCHEXT, AARCH64_FEATURE (FGT2)) SYSREG ("hfgwtr_el2", CPENC (3,4,1,1,5), F_ARCHEXT, AARCH64_FEATURE (V8_6A)) + SYSREG ("hfgwtr2_el2", CPENC (3,4,3,1,3), F_ARCHEXT, AARCH64_FEATURE (FGT2)) SYSREG ("hpfar_el2", CPENC (3,4,6,0,4), 0, AARCH64_NO_FEATURES) SYSREG ("hstr_el2", CPENC (3,4,1,1,3), 0, AARCH64_NO_FEATURES) SYSREG ("icc_ap0r0_el1", CPENC (3,0,12,8,4), 0, AARCH64_NO_FEATURES) @@ -515,6 +524,8 @@ SYSREG ("id_aa64mmfr0_el1", CPENC (3,0,0,7,0), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("id_aa64mmfr1_el1", CPENC (3,0,0,7,1), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("id_aa64mmfr2_el1", CPENC (3,0,0,7,2), F_REG_READ, AARCH64_NO_FEATURES) + SYSREG ("id_aa64mmfr3_el1", CPENC (3,0,0,7,3), F_REG_READ, AARCH64_NO_FEATURES) + SYSREG ("id_aa64mmfr4_el1", CPENC (3,0,0,7,4), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("id_aa64pfr0_el1", CPENC (3,0,0,4,0), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("id_aa64pfr1_el1", CPENC (3,0,0,4,1), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("id_aa64smfr0_el1", CPENC (3,0,0,4,5), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (SME)) @@ -549,12 +560,17 @@ SYSREG ("mair_el12", CPENC (3,5,10,2,0), F_ARCHEXT, AARCH64_FEATURE (V8_1A)) SYSREG ("mair_el2", CPENC (3,4,10,2,0), 0, AARCH64_NO_FEATURES) SYSREG ("mair_el3", CPENC (3,6,10,2,0), 0, AARCH64_NO_FEATURES) + SYSREG ("mair2_el1", CPENC (3,0,10,2,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) + SYSREG ("mair2_el12", CPENC (3,5,10,2,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) + SYSREG ("mair2_el2", CPENC (3,4,10,1,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) + SYSREG ("mair2_el3", CPENC (3,6,10,1,1), F_ARCHEXT, AARCH64_FEATURE (AIE)) SYSREG ("mdccint_el1", CPENC (2,0,0,2,0), 0, AARCH64_NO_FEATURES) SYSREG ("mdccsr_el0", CPENC (2,3,0,1,0), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("mdcr_el2", CPENC (3,4,1,1,1), 0, AARCH64_NO_FEATURES) SYSREG ("mdcr_el3", CPENC (3,6,1,3,1), 0, AARCH64_NO_FEATURES) SYSREG ("mdrar_el1", CPENC (2,0,1,0,0), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("mdscr_el1", CPENC (2,0,0,2,2), 0, AARCH64_NO_FEATURES) + SYSREG ("mdselr_el1", CPENC (2,0,0,4,2), F_ARCHEXT, AARCH64_FEATURE (DEBUGv8p9)) SYSREG ("mecid_a0_el2", CPENC (3,4,10,8,1), 0, AARCH64_NO_FEATURES) SYSREG ("mecid_a1_el2", CPENC (3,4,10,8,3), 0, AARCH64_NO_FEATURES) SYSREG ("mecid_p0_el2", CPENC (3,4,10,8,0), 0, AARCH64_NO_FEATURES) @@ -593,19 +609,31 @@ SYSREG ("oseccr_el1", CPENC (2,0,0,6,2), 0, AARCH64_NO_FEATURES) SYSREG ("oslar_el1", CPENC (2,0,1,0,4), F_REG_WRITE, AARCH64_NO_FEATURES) SYSREG ("oslsr_el1", CPENC (2,0,1,1,4), F_REG_READ, AARCH64_NO_FEATURES) + SYSREG ("pir_el1", CPENC (3,0,10,2,3), F_ARCHEXT, AARCH64_FEATURE (S1PIE)) + SYSREG ("pir_el12", CPENC (3,5,10,2,3), F_ARCHEXT, AARCH64_FEATURE (S1PIE)) + SYSREG ("pir_el2", CPENC (3,4,10,2,3), F_ARCHEXT, AARCH64_FEATURE (S1PIE)) + SYSREG ("pir_el3", CPENC (3,6,10,2,3), F_ARCHEXT, AARCH64_FEATURE (S1PIE)) + SYSREG ("pire0_el1", CPENC (3,0,10,2,2), F_ARCHEXT, AARCH64_FEATURE (S1PIE)) + SYSREG ("pire0_el12", CPENC (3,5,10,2,2), F_ARCHEXT, AARCH64_FEATURE (S1PIE)) + SYSREG ("pire0_el2", CPENC (3,4,10,2,2), F_ARCHEXT, AARCH64_FEATURE (S1PIE)) SYSREG ("pan", CPENC (3,0,4,2,3), F_ARCHEXT, AARCH64_FEATURE (PAN)) SYSREG ("par_el1", CPENC (3,0,7,4,0), F_REG_128, AARCH64_NO_FEATURES) + SYSREG ("pfar_el1", CPENC (3,0,6,0,5), F_ARCHEXT, AARCH64_FEATURE (PFAR)) + SYSREG ("pfar_el12", CPENC (3,5,6,0,5), F_ARCHEXT, AARCH64_FEATURE (PFAR)) + SYSREG ("pfar_el2", CPENC (3,4,6,0,5), F_ARCHEXT, AARCH64_FEATURE (PFAR)) SYSREG ("pmbidr_el1", CPENC (3,0,9,10,7), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmblimitr_el1", CPENC (3,0,9,10,0), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmbptr_el1", CPENC (3,0,9,10,1), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmbsr_el1", CPENC (3,0,9,10,3), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmccfiltr_el0", CPENC (3,3,14,15,7), 0, AARCH64_NO_FEATURES) SYSREG ("pmccntr_el0", CPENC (3,3,9,13,0), 0, AARCH64_NO_FEATURES) + SYSREG ("pmccntsvr_el1", CPENC (2,0,14,11,7), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) SYSREG ("pmceid0_el0", CPENC (3,3,9,12,6), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("pmceid1_el0", CPENC (3,3,9,12,7), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("pmcntenclr_el0", CPENC (3,3,9,12,2), 0, AARCH64_NO_FEATURES) SYSREG ("pmcntenset_el0", CPENC (3,3,9,12,1), 0, AARCH64_NO_FEATURES) SYSREG ("pmcr_el0", CPENC (3,3,9,12,0), 0, AARCH64_NO_FEATURES) + SYSREG ("pmecr_el1", CPENC (3,0,9,14,5), F_ARCHEXT, AARCH64_FEATURE (SEBEP)) SYSREG ("pmevcntr0_el0", CPENC (3,3,14,8,0), 0, AARCH64_NO_FEATURES) SYSREG ("pmevcntr10_el0", CPENC (3,3,14,9,2), 0, AARCH64_NO_FEATURES) SYSREG ("pmevcntr11_el0", CPENC (3,3,14,9,3), 0, AARCH64_NO_FEATURES) @@ -637,6 +665,37 @@ SYSREG ("pmevcntr7_el0", CPENC (3,3,14,8,7), 0, AARCH64_NO_FEATURES) SYSREG ("pmevcntr8_el0", CPENC (3,3,14,9,0), 0, AARCH64_NO_FEATURES) SYSREG ("pmevcntr9_el0", CPENC (3,3,14,9,1), 0, AARCH64_NO_FEATURES) + SYSREG ("pmevcntsvr0_el1", CPENC (2,0,14,8,0), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr10_el1", CPENC (2,0,14,9,2), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr11_el1", CPENC (2,0,14,9,3), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr12_el1", CPENC (2,0,14,9,4), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr13_el1", CPENC (2,0,14,9,5), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr14_el1", CPENC (2,0,14,9,6), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr15_el1", CPENC (2,0,14,9,7), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr16_el1", CPENC (2,0,14,10,0), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr17_el1", CPENC (2,0,14,10,1), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr18_el1", CPENC (2,0,14,10,2), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr19_el1", CPENC (2,0,14,10,3), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr1_el1", CPENC (2,0,14,8,1), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr20_el1", CPENC (2,0,14,10,4), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr21_el1", CPENC (2,0,14,10,5), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr22_el1", CPENC (2,0,14,10,6), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr23_el1", CPENC (2,0,14,10,7), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr24_el1", CPENC (2,0,14,11,0), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr25_el1", CPENC (2,0,14,11,1), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr26_el1", CPENC (2,0,14,11,2), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr27_el1", CPENC (2,0,14,11,3), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr28_el1", CPENC (2,0,14,11,4), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr29_el1", CPENC (2,0,14,11,5), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr2_el1", CPENC (2,0,14,8,2), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr30_el1", CPENC (2,0,14,11,6), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr3_el1", CPENC (2,0,14,8,3), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr4_el1", CPENC (2,0,14,8,4), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr5_el1", CPENC (2,0,14,8,5), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr6_el1", CPENC (2,0,14,8,6), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr7_el1", CPENC (2,0,14,8,7), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr8_el1", CPENC (2,0,14,9,0), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) + SYSREG ("pmevcntsvr9_el1", CPENC (2,0,14,9,1), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) SYSREG ("pmevtyper0_el0", CPENC (3,3,14,12,0), 0, AARCH64_NO_FEATURES) SYSREG ("pmevtyper10_el0", CPENC (3,3,14,13,2), 0, AARCH64_NO_FEATURES) SYSREG ("pmevtyper11_el0", CPENC (3,3,14,13,3), 0, AARCH64_NO_FEATURES) @@ -668,6 +727,10 @@ SYSREG ("pmevtyper7_el0", CPENC (3,3,14,12,7), 0, AARCH64_NO_FEATURES) SYSREG ("pmevtyper8_el0", CPENC (3,3,14,13,0), 0, AARCH64_NO_FEATURES) SYSREG ("pmevtyper9_el0", CPENC (3,3,14,13,1), 0, AARCH64_NO_FEATURES) + SYSREG ("pmiar_el1", CPENC (3,0,9,14,7), F_ARCHEXT, AARCH64_FEATURE (SEBEP)) + SYSREG ("pmicfiltr_el0", CPENC (3,3,9,6,0), F_ARCHEXT, AARCH64_FEATURE (PMUv3_ICNTR)) + SYSREG ("pmicntr_el0", CPENC (3,3,9,4,0), F_ARCHEXT, AARCH64_FEATURE (PMUv3_ICNTR)) + SYSREG ("pmicntsvr_el1", CPENC (2,0,14,12,0), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) SYSREG ("pmintenclr_el1", CPENC (3,0,9,14,2), 0, AARCH64_NO_FEATURES) SYSREG ("pmintenset_el1", CPENC (3,0,9,14,1), 0, AARCH64_NO_FEATURES) SYSREG ("pmmir_el1", CPENC (3,0,9,14,6), F_REG_READ|F_ARCHEXT, AARCH64_FEATURE (V8_4A)) @@ -676,6 +739,7 @@ SYSREG ("pmscr_el1", CPENC (3,0,9,9,0), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmscr_el12", CPENC (3,5,9,9,0), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmscr_el2", CPENC (3,4,9,9,0), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) + SYSREG ("pmsdsfr_el1", CPENC (3,4,9,10,4), F_ARCHEXT, AARCH64_FEATURE (SPE_FDS)) SYSREG ("pmselr_el0", CPENC (3,3,9,12,5), 0, AARCH64_NO_FEATURES) SYSREG ("pmsevfr_el1", CPENC (3,0,9,9,5), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmsfcr_el1", CPENC (3,0,9,9,4), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) @@ -684,10 +748,18 @@ SYSREG ("pmsirr_el1", CPENC (3,0,9,9,3), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmslatfr_el1", CPENC (3,0,9,9,6), F_ARCHEXT, AARCH64_FEATURE (PROFILE)) SYSREG ("pmsnevfr_el1", CPENC (3,0,9,9,1), F_ARCHEXT, AARCH64_FEATURE (V8_7A)) + SYSREG ("pmsscr_el1", CPENC (3,0,9,13,3), F_ARCHEXT, AARCH64_FEATURE (PMUv3_SS)) SYSREG ("pmswinc_el0", CPENC (3,3,9,12,4), F_REG_WRITE, AARCH64_NO_FEATURES) + SYSREG ("pmuacr_el1", CPENC (3,0,9,14,4), F_ARCHEXT, AARCH64_FEATURE (PMUv3p9)) SYSREG ("pmuserenr_el0", CPENC (3,3,9,14,0), 0, AARCH64_NO_FEATURES) SYSREG ("pmxevcntr_el0", CPENC (3,3,9,13,2), 0, AARCH64_NO_FEATURES) SYSREG ("pmxevtyper_el0", CPENC (3,3,9,13,1), 0, AARCH64_NO_FEATURES) + SYSREG ("pmzr_el0", CPENC (3,3,9,13,4), F_REG_WRITE|F_ARCHEXT, AARCH64_FEATURE (PMUv3_ICNTR)) + SYSREG ("por_el0", CPENC (3,3,10,2,4), F_ARCHEXT, AARCH64_FEATURE (S1POE)) + SYSREG ("por_el1", CPENC (3,0,10,2,4), F_ARCHEXT, AARCH64_FEATURE (S1POE)) + SYSREG ("por_el12", CPENC (3,5,10,2,4), F_ARCHEXT, AARCH64_FEATURE (S1POE)) + SYSREG ("por_el2", CPENC (3,4,10,2,4), F_ARCHEXT, AARCH64_FEATURE (S1POE)) + SYSREG ("por_el3", CPENC (3,6,10,2,4), F_ARCHEXT, AARCH64_FEATURE (S1POE)) SYSREG ("prbar10_el1", CPENC (3,0,6,13,0), F_ARCHEXT, AARCH64_FEATURE (V8R)) SYSREG ("prbar10_el2", CPENC (3,4,6,13,0), F_ARCHEXT, AARCH64_FEATURE (V8R)) SYSREG ("prbar11_el1", CPENC (3,0,6,13,4), F_ARCHEXT, AARCH64_FEATURE (V8R)) @@ -773,6 +845,10 @@ SYSREG ("sctlr_el12", CPENC (3,5,1,0,0), F_ARCHEXT, AARCH64_FEATURE (V8_1A)) SYSREG ("sctlr_el2", CPENC (3,4,1,0,0), 0, AARCH64_NO_FEATURES) SYSREG ("sctlr_el3", CPENC (3,6,1,0,0), 0, AARCH64_NO_FEATURES) + SYSREG ("sctlr2_el1", CPENC (3,0,1,0,3), F_ARCHEXT, AARCH64_FEATURE (SCTLR2)) + SYSREG ("sctlr2_el12", CPENC (3,5,1,0,3), F_ARCHEXT, AARCH64_FEATURE (SCTLR2)) + SYSREG ("sctlr2_el2", CPENC (3,4,1,0,3), F_ARCHEXT, AARCH64_FEATURE (SCTLR2)) + SYSREG ("sctlr2_el3", CPENC (3,6,1,0,3), F_ARCHEXT, AARCH64_FEATURE (SCTLR2)) SYSREG ("scxtnum_el0", CPENC (3,3,13,0,7), F_ARCHEXT, AARCH64_FEATURE (SCXTNUM)) SYSREG ("scxtnum_el1", CPENC (3,0,13,0,7), F_ARCHEXT, AARCH64_FEATURE (SCXTNUM)) SYSREG ("scxtnum_el12", CPENC (3,5,13,0,7), F_ARCHEXT, AARCH64_FEATURE (SCXTNUM)) @@ -803,11 +879,16 @@ SYSREG ("spsr_und", CPENC (3,4,4,3,2), 0, AARCH64_NO_FEATURES) SYSREG ("ssbs", CPENC (3,3,4,2,6), F_ARCHEXT, AARCH64_FEATURE (SSBS)) SYSREG ("svcr", CPENC (3,3,4,2,2), F_ARCHEXT, AARCH64_FEATURE (SME)) + SYSREG ("s2pir_el2", CPENC (3,4,10,2,5), F_ARCHEXT, AARCH64_FEATURE (S2PIE)) + SYSREG ("s2por_el1", CPENC (3,0,10,2,5), F_ARCHEXT, AARCH64_FEATURE (S2POE)) SYSREG ("tco", CPENC (3,3,4,2,7), F_ARCHEXT, AARCH64_FEATURE (MEMTAG)) SYSREG ("tcr_el1", CPENC (3,0,2,0,2), 0, AARCH64_NO_FEATURES) SYSREG ("tcr_el12", CPENC (3,5,2,0,2), F_ARCHEXT, AARCH64_FEATURE (V8_1A)) SYSREG ("tcr_el2", CPENC (3,4,2,0,2), 0, AARCH64_NO_FEATURES) SYSREG ("tcr_el3", CPENC (3,6,2,0,2), 0, AARCH64_NO_FEATURES) + SYSREG ("tcr2_el1", CPENC (3,0,2,0,3), F_ARCHEXT, AARCH64_FEATURE (TCR2)) + SYSREG ("tcr2_el12", CPENC (3,5,2,0,3), F_ARCHEXT, AARCH64_FEATURE (TCR2)) + SYSREG ("tcr2_el2", CPENC (3,4,2,0,3), F_ARCHEXT, AARCH64_FEATURE (TCR2)) SYSREG ("teecr32_el1", CPENC (2,2,0,0,0), 0, AARCH64_NO_FEATURES) SYSREG ("teehbr32_el1", CPENC (2,2,1,0,0), 0, AARCH64_NO_FEATURES) SYSREG ("tfsr_el1", CPENC (3,0,5,6,0), F_ARCHEXT, AARCH64_FEATURE (MEMTAG)) @@ -944,6 +1025,10 @@ SYSREG ("trcimspec6", CPENC (2,1,0,6,7), 0, AARCH64_NO_FEATURES) SYSREG ("trcimspec7", CPENC (2,1,0,7,7), 0, AARCH64_NO_FEATURES) SYSREG ("trcitctrl", CPENC (2,1,7,0,4), 0, AARCH64_NO_FEATURES) + SYSREG ("trcitecr_el1", CPENC (3,0,1,2,3), F_ARCHEXT, AARCH64_FEATURE (ITE)) + SYSREG ("trcitecr_el12", CPENC (3,5,1,2,3), F_ARCHEXT, AARCH64_FEATURE (ITE)) + SYSREG ("trcitecr_el2", CPENC (3,4,1,2,3), F_ARCHEXT, AARCH64_FEATURE (ITE)) + SYSREG ("trciteedcr", CPENC (2,1,0,2,1), F_ARCHEXT, AARCH64_FEATURE (ITE)) SYSREG ("trclar", CPENC (2,1,7,12,6), F_REG_WRITE, AARCH64_NO_FEATURES) SYSREG ("trclsr", CPENC (2,1,7,13,6), F_REG_READ, AARCH64_NO_FEATURES) SYSREG ("trcoslar", CPENC (2,1,1,0,4), F_REG_WRITE, AARCH64_NO_FEATURES) diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 157a0b9..45e901c 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -297,6 +297,26 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF; #define AARCH64_FL_SCXTNUM AARCH64_FL_V8_5A #define AARCH64_FL_ID_PFR2 AARCH64_FL_V8_5A +/* Armv8.9-A extension feature bits defined in Binutils but absent from GCC, + aliased to their base architecture. */ +#define AARCH64_FL_AIE AARCH64_FL_V8_9A +#define AARCH64_FL_DEBUGv8p9 AARCH64_FL_V8_9A +#define AARCH64_FL_FGT2 AARCH64_FL_V8_9A +#define AARCH64_FL_ITE AARCH64_FL_V8_9A +#define AARCH64_FL_PFAR AARCH64_FL_V8_9A +#define AARCH64_FL_PMUv3_ICNTR AARCH64_FL_V8_9A +#define AARCH64_FL_PMUv3_SS AARCH64_FL_V8_9A +#define AARCH64_FL_PMUv3p9 AARCH64_FL_V8_9A +#define AARCH64_FL_RASv2 AARCH64_FL_V8_9A +#define AARCH64_FL_S1PIE AARCH64_FL_V8_9A +#define AARCH64_FL_S1POE AARCH64_FL_V8_9A +#define AARCH64_FL_S2PIE AARCH64_FL_V8_9A +#define AARCH64_FL_S2POE AARCH64_FL_V8_9A +#define AARCH64_FL_SCTLR2 AARCH64_FL_V8_9A +#define AARCH64_FL_SEBEP AARCH64_FL_V8_9A +#define AARCH64_FL_SPE_FDS AARCH64_FL_V8_9A +#define AARCH64_FL_TCR2 AARCH64_FL_V8_9A + /* SHA2 is an optional extension to AdvSIMD. */ #define TARGET_SHA2 (AARCH64_ISA_SHA2) diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 7ddfba0..27812d4 100644 --- a/gcc/config/avr/avr-mcus.def +++ b/gcc/config/avr/avr-mcus.def @@ -138,9 +138,10 @@ AVR_MCU ("attiny167", ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATtiny167__", AVR_MCU ("attiny1634", ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATtiny1634__", 0x0100, 0x0, 0x4000, 0) /* Enhanced, <= 8K. */ AVR_MCU ("avr4", ARCH_AVR4, AVR_ISA_NONE, NULL, 0x0060, 0x0, 0x2000, 0) +AVR_MCU ("ata5795", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA5795__", 0x0100, 0x0, 0x2000, 0) AVR_MCU ("ata6285", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA6285__", 0x0100, 0x0, 0x2000, 0) AVR_MCU ("ata6286", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA6286__", 0x0100, 0x0, 0x2000, 0) -AVR_MCU ("ata6289", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA6289__", 0x0100, 0x0, 0x2000, 0) +AVR_MCU ("ata6289", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA6289__", 0x0100, 0x0, 0x2000, 0) AVR_MCU ("ata6612c", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA6612C__", 0x0100, 0x0, 0x2000, 0) AVR_MCU ("atmega8", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATmega8__", 0x0060, 0x0, 0x2000, 0) AVR_MCU ("atmega8a", ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATmega8A__", 0x0060, 0x0, 0x2000, 0) @@ -172,7 +173,6 @@ AVR_MCU ("ata5787", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5787__", AVR_MCU ("ata5790", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5790__", 0x0100, 0x0, 0x4000, 0) AVR_MCU ("ata5790n", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5790N__", 0x0100, 0x0, 0x4000, 0) AVR_MCU ("ata5791", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5791__", 0x0100, 0x0, 0x4000, 0) -AVR_MCU ("ata5795", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5795__", 0x0100, 0x0, 0x2000, 0) AVR_MCU ("ata5831", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5831__", 0x0200, 0x8000, 0xd000, 0) AVR_MCU ("ata5835", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5835__", 0x0200, 0x8000, 0xd200, 0) AVR_MCU ("ata6613c", ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA6613C__", 0x0100, 0x0, 0x4000, 0) diff --git a/gcc/config/avr/gen-avr-mmcu-specs.cc b/gcc/config/avr/gen-avr-mmcu-specs.cc index 02778aa..bb94bea 100644 --- a/gcc/config/avr/gen-avr-mmcu-specs.cc +++ b/gcc/config/avr/gen-avr-mmcu-specs.cc @@ -129,62 +129,70 @@ static const bool have_avrxmega3_rodata_in_flash = false; #endif -static void -diagnose_mrodata_in_ram (FILE *f, const char *spec, const avr_mcu_t *mcu) +struct McuInfo { - enum avr_arch_id arch_id = mcu->arch_id; - const avr_arch_t *arch = &avr_arch_types[arch_id]; - const bool is_arch = mcu->macro == NULL; - const bool flmap = (mcu->dev_attribute & AVR_ISA_FLMAP); - const bool have_flmap2 = have_avrxmega2_flmap && arch_id == ARCH_AVRXMEGA2; - const bool have_flmap4 = have_avrxmega4_flmap && arch_id == ARCH_AVRXMEGA4; - const bool have_flmap = flmap && (have_flmap2 || have_flmap4); - - const bool rodata_in_flash = (arch_id == ARCH_AVRTINY - || (arch_id == ARCH_AVRXMEGA3 - && have_avrxmega3_rodata_in_flash)); + enum avr_arch_id arch_id; + const avr_arch_t *arch; + bool is_arch, is_device; + bool flmap, have_flmap2, have_flmap4, have_flmap; + bool rodata_in_flash; // Device name as used by the vendor, extracted from "__AVR_<Name>__". char mcu_Name[50] = { 0 }; - if (! is_arch) - snprintf (mcu_Name, 1 + strlen (mcu->macro) - strlen ("__AVR___"), - "%s", mcu->macro + strlen ("__AVR_")); + McuInfo (const avr_mcu_t *mcu) + : arch_id (mcu->arch_id), arch (& avr_arch_types[arch_id]), + is_arch (mcu->macro == NULL), is_device (! is_arch), + flmap (mcu->dev_attribute & AVR_ISA_FLMAP), + have_flmap2 (have_avrxmega2_flmap && arch_id == ARCH_AVRXMEGA2), + have_flmap4 (have_avrxmega4_flmap && arch_id == ARCH_AVRXMEGA4), + have_flmap (flmap && (have_flmap2 || have_flmap4)), + rodata_in_flash (arch_id == ARCH_AVRTINY + || (arch_id == ARCH_AVRXMEGA3 + && have_avrxmega3_rodata_in_flash)) + { + if (is_device) + snprintf (mcu_Name, 1 + strlen (mcu->macro) - strlen ("__AVR_" "__"), + "%s", mcu->macro + strlen ("__AVR_")); + } +}; + + +static void +diagnose_mrodata_in_ram (FILE *f, const char *spec, const avr_mcu_t *mcu, + const McuInfo &mi) +{ fprintf (f, "%s:\n", spec); - if (rodata_in_flash && is_arch) + if (mi.rodata_in_flash && mi.is_arch) fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram is not supported" " for %s}", mcu->name); - else if (rodata_in_flash) + else if (mi.rodata_in_flash) fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram is not supported" - " for %s (arch=%s)}", mcu_Name, arch->name); - else if (is_arch) + " for %s (arch=%s)}", mi.mcu_Name, mi.arch->name); + else if (mi.is_arch) { - if (! have_flmap2 && ! have_flmap4) + if (! mi.have_flmap2 && ! mi.have_flmap4) fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram is not" " supported for %s}", mcu->name); } - else if (! have_flmap) + else if (! mi.have_flmap) fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram is not supported" - " for %s (arch=%s)}", mcu_Name, arch->name); + " for %s (arch=%s)}", mi.mcu_Name, mi.arch->name); fprintf (f, "\n\n"); } static void -print_mcu (const avr_mcu_t *mcu) +print_mcu (const avr_mcu_t *mcu, const McuInfo &mi) { const char *sp8_spec; const char *rcall_spec; const avr_mcu_t *arch_mcu; - const avr_arch_t *arch; - enum avr_arch_id arch_id = mcu->arch_id; for (arch_mcu = mcu; arch_mcu->macro; ) arch_mcu--; - if (arch_mcu->arch_id != arch_id) + if (arch_mcu->arch_id != mi.arch_id) exit (EXIT_FAILURE); - arch = &avr_arch_types[arch_id]; - char name[100]; if (snprintf (name, sizeof name, "specs-%s", mcu->name) >= (int) sizeof name) exit (EXIT_FAILURE); @@ -196,21 +204,26 @@ print_mcu (const avr_mcu_t *mcu) bool rmw = (mcu->dev_attribute & AVR_ISA_RMW) != 0; bool sp8 = (mcu->dev_attribute & AVR_SHORT_SP) != 0; bool rcall = (mcu->dev_attribute & AVR_ISA_RCALL); - bool flmap = (mcu->dev_attribute & AVR_ISA_FLMAP); - bool is_arch = mcu->macro == NULL; - bool is_device = ! is_arch; - int flash_pm_offset = 0; + int rodata_pm_offset = 0; + int pm_base_address = 0; - if (arch->flash_pm_offset + if (mi.arch->flash_pm_offset && mcu->flash_pm_offset - && mcu->flash_pm_offset != arch->flash_pm_offset) + && mcu->flash_pm_offset != mi.arch->flash_pm_offset) + { + rodata_pm_offset = mcu->flash_pm_offset; + } + + if (mi.arch->flash_pm_offset) { - flash_pm_offset = mcu->flash_pm_offset; + pm_base_address = mcu->flash_pm_offset + ? mcu->flash_pm_offset + : mi.arch->flash_pm_offset; } - if (is_arch - && (ARCH_AVR2 == arch_id - || ARCH_AVR25 == arch_id)) + if (mi.is_arch + && (ARCH_AVR2 == mi.arch_id + || ARCH_AVR25 == mi.arch_id)) { // Leave "avr2" and "avr25" alone. These two architectures are // the only ones that mix devices with 8-bit SP and 16-bit SP. @@ -221,8 +234,8 @@ print_mcu (const avr_mcu_t *mcu) sp8_spec = sp8 ? "-msp8" :"%<msp8"; } - if (is_arch - && ARCH_AVRXMEGA3 == arch_id) + if (mi.is_arch + && ARCH_AVRXMEGA3 == mi.arch_id) { // Leave "avrxmega3" alone. This architectures is the only one // that mixes devices with and without JMP / CALL. @@ -233,33 +246,30 @@ print_mcu (const avr_mcu_t *mcu) rcall_spec = rcall ? "-mshort-calls" : "%<mshort-calls"; } - const char *flmap_spec = flmap ? "-mflmap" : "%<mflmap"; + const char *flmap_spec = mi.flmap ? "-mflmap" : "%<mflmap"; const char *link_arch_spec = "%{mmcu=*:-m%*}"; const char *link_arch_flmap_spec = "%{mmcu=*:-m%*%{!mrodata-in-ram:_flmap}}"; - const bool have_flmap2 = have_avrxmega2_flmap && arch_id == ARCH_AVRXMEGA2; - const bool have_flmap4 = have_avrxmega4_flmap && arch_id == ARCH_AVRXMEGA4; - const bool have_flmap = flmap && (have_flmap2 || have_flmap4); - if (have_flmap) + if (mi.have_flmap) link_arch_spec = link_arch_flmap_spec; fprintf (f, "#\n" "# Auto-generated specs for AVR "); - if (is_arch) - fprintf (f, "core architecture %s\n", arch->name); + if (mi.is_arch) + fprintf (f, "core architecture %s\n", mi.arch->name); else - fprintf (f, "device %s (core %s, %d-bit SP%s%s)\n", mcu->name, - arch->name, sp8 ? 8 : 16, rcall ? ", short-calls" : "", - have_flmap ? ", FLMAP" : ""); + fprintf (f, "device %s (core %s, %d-bit SP%s%s)\n", mi.mcu_Name, + mi.arch->name, sp8 ? 8 : 16, rcall ? ", short-calls" : "", + mi.have_flmap ? ", FLMAP" : ""); fprintf (f, "%s\n", header); - if (is_device) + if (mi.is_device) fprintf (f, "%s\n", help_copy_paste); #if defined (WITH_AVRLIBC) // AVR-LibC specific. See avrlibc.h for the specs using them as subspecs. - if (is_device) + if (mi.is_device) { fprintf (f, "*avrlibc_startfile:\n"); fprintf (f, "\tcrt%s.o%%s", mcu->name); @@ -272,7 +282,7 @@ print_mcu (const avr_mcu_t *mcu) #endif // WITH_AVRLIBC // Diagnose usage of -m[no-]rodata-in-ram. - diagnose_mrodata_in_ram (f, "*check_rodata_in_ram", mcu); + diagnose_mrodata_in_ram (f, "*check_rodata_in_ram", mcu, mi); // avr-gcc specific specs for the compilation / the compiler proper. @@ -294,11 +304,11 @@ print_mcu (const avr_mcu_t *mcu) : "\t%{mabsdata}"); // -m[no-]rodata-in-ram basically affects linking, but sanity-check early. - fprintf (f, "*cc1_misc:\n\t%%(check_rodata_in_ram)\n\n"); + fprintf (f, "*cc1_rodata_in_ram:\n\t%%(check_rodata_in_ram)\n\n"); // avr-gcc specific specs for assembling / the assembler. - fprintf (f, "*asm_arch:\n\t-mmcu=%s\n\n", arch->name); + fprintf (f, "*asm_arch:\n\t-mmcu=%s\n\n", mi.arch->name); #ifdef HAVE_AS_AVR_MLINK_RELAX_OPTION fprintf (f, "*asm_relax:\n\t%s\n\n", ASM_RELAX_SPEC); @@ -319,8 +329,6 @@ print_mcu (const avr_mcu_t *mcu) ? "\t%{mno-skip-bug}" : "\t%{!mskip-bug: -mno-skip-bug}"); - fprintf (f, "*asm_misc:\n" /* empty */ "\n\n"); - // avr-specific specs for linking / the linker. int wrap_k = @@ -340,16 +348,16 @@ print_mcu (const avr_mcu_t *mcu) fprintf (f, "*link_relax:\n\t%s\n\n", LINK_RELAX_SPEC); fprintf (f, "*link_arch:\n\t%s", link_arch_spec); - if (is_device - && flash_pm_offset) - fprintf (f, " --defsym=__RODATA_PM_OFFSET__=0x%x", flash_pm_offset); + if (mi.is_device + && rodata_pm_offset) + fprintf (f, " --defsym=__RODATA_PM_OFFSET__=0x%x", rodata_pm_offset); fprintf (f, "\n\n"); - if (is_device) + if (mi.is_device) { fprintf (f, "*link_data_start:\n"); if (mcu->data_section_start - != arch->default_data_section_start) + != mi.arch->default_data_section_start) fprintf (f, "\t%%{!Tdata:-Tdata 0x%lX}", 0x800000UL + mcu->data_section_start); fprintf (f, "\n\n"); @@ -361,14 +369,17 @@ print_mcu (const avr_mcu_t *mcu) } // -m[no-]rodata-in-ram affects linking. Sanity check its usage. - fprintf (f, "*link_misc:\n\t%%(check_rodata_in_ram)\n\n"); + fprintf (f, "*link_rodata_in_ram:\n\t%%(check_rodata_in_ram)"); + if (mi.is_device && mi.have_flmap) + fprintf (f, " %%{!mrodata-in-ram:-u __do_flmap_init}"); + fprintf (f, "\n\n"); // Specs known to GCC. - if (is_device) + if (mi.is_device) { fprintf (f, "*self_spec:\n"); - fprintf (f, "\t%%<mmcu=* -mmcu=%s ", arch->name); + fprintf (f, "\t%%<mmcu=* -mmcu=%s ", mi.arch->name); fprintf (f, "%s ", flmap_spec); fprintf (f, "%s ", rcall_spec); fprintf (f, "%s\n\n", sp8_spec); @@ -383,23 +394,20 @@ print_mcu (const avr_mcu_t *mcu) fprintf (f, "*cpp_mcu:\n"); fprintf (f, "\t-D%s", mcu->macro); - if (flash_pm_offset) + if (pm_base_address) { fprintf (f, " -U__AVR_PM_BASE_ADDRESS__"); - fprintf (f, " -D__AVR_PM_BASE_ADDRESS__=0x%x", flash_pm_offset); + fprintf (f, " -D__AVR_PM_BASE_ADDRESS__=0x%x", pm_base_address); } - if (have_flmap) + if (mi.have_flmap) fprintf (f, " -D__AVR_HAVE_FLMAP__"); fprintf (f, "\n\n"); // *cpp_mcu - const bool rodata_in_flash = (arch_id == ARCH_AVRTINY - || (arch_id == ARCH_AVRXMEGA3 - && have_avrxmega3_rodata_in_flash)); fprintf (f, "*cpp_rodata_in_ram:\n\t-D__AVR_RODATA_IN_RAM__="); - if (rodata_in_flash) + if (mi.rodata_in_flash) fprintf (f, "0"); - else if (! have_flmap) + else if (! mi.have_flmap) fprintf (f, "1"); else fprintf (f, "%%{!mrodata-in-ram:%%{!mno-rodata-in-ram:0}}" @@ -423,7 +431,7 @@ print_mcu (const avr_mcu_t *mcu) int main (void) { for (const avr_mcu_t *mcu = avr_mcu_types; mcu->name; mcu++) - print_mcu (mcu); + print_mcu (mcu, McuInfo (mcu)); return EXIT_SUCCESS; } diff --git a/gcc/config/avr/specs.h b/gcc/config/avr/specs.h index 5744020..0ccc37b 100644 --- a/gcc/config/avr/specs.h +++ b/gcc/config/avr/specs.h @@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see "%(cc1_errata_skip) " \ "%(cc1_rmw) " \ "%(cc1_absdata) " \ - "%(cc1_misc) " + "%(cc1_rodata_in_ram) " #undef CC1PLUS_SPEC #define CC1PLUS_SPEC \ @@ -54,8 +54,7 @@ along with GCC; see the file COPYING3. If not see "%(asm_relax) " \ "%(asm_rmw) " \ "%(asm_gccisr) " \ - "%(asm_errata_skip) " \ - "%(asm_misc) " + "%(asm_errata_skip) " #define LINK_RELAX_SPEC \ "%{mrelax:--relax} " @@ -67,7 +66,7 @@ along with GCC; see the file COPYING3. If not see "%(link_text_start) " \ "%(link_relax) " \ "%(link_pmem_wrap) " \ - "%(link_misc) " \ + "%(link_rodata_in_ram) " \ "%{shared:%eshared is not supported} " #undef LIB_SPEC diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md index 280e4c8..64702d9 100644 --- a/gcc/config/i386/constraints.md +++ b/gcc/config/i386/constraints.md @@ -372,6 +372,24 @@ "Address operand without segment register" (match_operand 0 "address_no_seg_operand")) +;; j prefix is used for APX operand constraints. +;; < Auto-dec memory operand without GPR32. +;; > Auto-inc memory operand without GPR32. +;; a Vector memory operand without GPR32. +;; b VSIB address operand without EGPR. +;; c Integer register. GENERAL_GPR16 for TARGET_APX_EGPR and +;; !TARGET_AVX, otherwise GENERAL_REGS. +;; e Memory operand for APX NDD ADD. +;; j Integer register. GENERAL_GPR16 for TARGET_APX_EGPR, otherwise +;; GENERAL_REGS. +;; o Offsetable memory operand without GPR32. +;; p General address operand without GPR32. +;; m Memory operand without GPR32. +;; M Memory operand, with APX NDD check. +;; R Integer register. GENERAL_REGS. +;; O Offsettable memory operand, with APX NDD check. +;; V Non-offsetable memory operand without GPR32. + ;; Constraint that force to use EGPR, can only adopt to register class. (define_register_constraint "jR" "GENERAL_REGS") @@ -393,7 +411,7 @@ (match_test "x86_extended_rex2reg_mentioned_p (op)"))))) (define_constraint "j>" - "@internal auto-dec memory operand without GPR32." + "@internal auto-inc memory operand without GPR32." (and (and (match_code "mem") (ior (match_test "GET_CODE (XEXP (op, 0)) == PRE_INC") (match_test "GET_CODE (XEXP (op, 0)) == POST_INC"))) @@ -438,7 +456,15 @@ (define_register_constraint "jc" "TARGET_APX_EGPR && !TARGET_AVX ? GENERAL_GPR16 : GENERAL_REGS") -(define_constraint "je" - "@internal constant that do not allow any unspec global offsets" - (and (match_operand 0 "x86_64_immediate_operand") - (match_test "!x86_poff_operand_p (op)"))) +(define_memory_constraint "je" + "@internal Memory operand for APX NDD ADD." + (match_operand 0 "apx_ndd_add_memory_operand")) + +(define_memory_constraint "jM" + "@internal Memory operand, with APX NDD check." + (match_operand 0 "apx_ndd_memory_operand")) + +(define_memory_constraint "jO" + "@internal Offsettable memory operand, with APX NDD check." + (and (match_operand 0 "apx_ndd_memory_operand") + (match_test "offsettable_nonstrict_memref_p (op)"))) diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 8e64b4e..bf9c45d 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -119,9 +119,10 @@ along with GCC; see the file COPYING3. If not see /* We default to x86_64 for single-arch builds, bi-arch overrides. */ #define DARWIN_ARCH_SPEC "x86_64" #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC +#endif + #undef DARWIN_HEAP_T_LIB #define DARWIN_HEAP_T_LIB " -lheapt_w " -#endif #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ diff --git a/gcc/config/i386/darwin32-biarch.h b/gcc/config/i386/darwin32-biarch.h index 2180f5a..051ad12 100644 --- a/gcc/config/i386/darwin32-biarch.h +++ b/gcc/config/i386/darwin32-biarch.h @@ -27,9 +27,6 @@ along with GCC; see the file COPYING3. If not see #undef DARWIN_SUBARCH_SPEC #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC -#undef DARWIN_HEAP_T_LIB -#define DARWIN_HEAP_T_LIB " %{m64:-lheapt_w}" - #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ DARWIN_EXTRA_SPECS \ diff --git a/gcc/config/i386/darwin64-biarch.h b/gcc/config/i386/darwin64-biarch.h index 6208007..8543679 100644 --- a/gcc/config/i386/darwin64-biarch.h +++ b/gcc/config/i386/darwin64-biarch.h @@ -28,9 +28,6 @@ along with GCC; see the file COPYING3. If not see #undef DARWIN_SUBARCH_SPEC #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC -#undef DARWIN_HEAP_T_LIB -#define DARWIN_HEAP_T_LIB "%{!m32:-lheapt_w}" - #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ DARWIN_EXTRA_SPECS \ diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index e0b9615..f1b1cf2 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -1749,6 +1749,19 @@ timode_scalar_chain::fix_debug_reg_uses (rtx reg) } } +/* Helper function to convert immediate constant X to V1TImode. */ +static rtx +timode_convert_cst (rtx x) +{ + /* Prefer all ones vector in case of -1. */ + if (constm1_operand (x, TImode)) + return CONSTM1_RTX (V1TImode); + + rtx *v = XALLOCAVEC (rtx, 1); + v[0] = x; + return gen_rtx_CONST_VECTOR (V1TImode, gen_rtvec_v (1, v)); +} + /* Convert operand OP in INSN from TImode to V1TImode. */ void @@ -1775,18 +1788,8 @@ timode_scalar_chain::convert_op (rtx *op, rtx_insn *insn) } else if (CONST_SCALAR_INT_P (*op)) { - rtx vec_cst; rtx tmp = gen_reg_rtx (V1TImode); - - /* Prefer all ones vector in case of -1. */ - if (constm1_operand (*op, TImode)) - vec_cst = CONSTM1_RTX (V1TImode); - else - { - rtx *v = XALLOCAVEC (rtx, 1); - v[0] = *op; - vec_cst = gen_rtx_CONST_VECTOR (V1TImode, gen_rtvec_v (1, v)); - } + rtx vec_cst = timode_convert_cst (*op); if (!standard_sse_constant_p (vec_cst, V1TImode)) { @@ -1827,16 +1830,11 @@ timode_scalar_chain::convert_insn (rtx_insn *insn) } if (GET_MODE (dst) == V1TImode) { - tmp = find_reg_equal_equiv_note (insn); - if (tmp) - { - if (GET_MODE (XEXP (tmp, 0)) == TImode) - PUT_MODE (XEXP (tmp, 0), V1TImode); - else if (CONST_SCALAR_INT_P (XEXP (tmp, 0))) - XEXP (tmp, 0) - = gen_rtx_CONST_VECTOR (V1TImode, - gen_rtvec (1, XEXP (tmp, 0))); - } + /* It might potentially be helpful to convert REG_EQUAL notes, + but for now we just remove them. */ + rtx note = find_reg_equal_equiv_note (insn); + if (note) + remove_note (insn, note); } break; case MEM: @@ -1876,7 +1874,7 @@ timode_scalar_chain::convert_insn (rtx_insn *insn) } else { - src = gen_rtx_CONST_VECTOR (V1TImode, gen_rtvec (1, src)); + src = timode_convert_cst (src); src = validize_mem (force_const_mem (V1TImode, src)); use_move = MEM_P (dst); } diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 34b9377..46214a6 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -66,7 +66,6 @@ extern bool x86_extended_QIreg_mentioned_p (rtx_insn *); extern bool x86_extended_reg_mentioned_p (rtx); extern bool x86_extended_rex2reg_mentioned_p (rtx); extern bool x86_evex_reg_mentioned_p (rtx [], int); -extern bool x86_poff_operand_p (rtx); extern bool x86_maybe_negate_const_int (rtx *, machine_mode); extern machine_mode ix86_cc_mode (enum rtx_code, rtx, rtx); diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 10bd534..a4e1260 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -6807,6 +6807,12 @@ get_probe_interval (void) static bool ix86_pro_and_epilogue_can_use_push2pop2 (int nregs) { + /* Use push2/pop2 only if the incoming stack is 16-byte aligned. */ + unsigned int incoming_stack_boundary + = (crtl->parm_stack_boundary > ix86_incoming_stack_boundary + ? crtl->parm_stack_boundary : ix86_incoming_stack_boundary); + if (incoming_stack_boundary % 128 != 0) + return false; int aligned = cfun->machine->fs.sp_offset % 16 == 0; return TARGET_APX_PUSH2POP2 && !cfun->machine->frame.save_regs_using_mov @@ -23467,31 +23473,6 @@ x86_evex_reg_mentioned_p (rtx operands[], int nops) return false; } -/* Return true when rtx operand does not contain any UNSPEC_*POFF related - constant to avoid APX_NDD instructions excceed encoding length limit. */ -bool -x86_poff_operand_p (rtx operand) -{ - if (GET_CODE (operand) == CONST) - { - rtx op = XEXP (operand, 0); - if (GET_CODE (op) == PLUS) - op = XEXP (op, 0); - - if (GET_CODE (op) == UNSPEC) - { - int unspec = XINT (op, 1); - return (unspec == UNSPEC_NTPOFF - || unspec == UNSPEC_TPOFF - || unspec == UNSPEC_DTPOFF - || unspec == UNSPEC_GOTTPOFF - || unspec == UNSPEC_GOTNTPOFF - || unspec == UNSPEC_INDNTPOFF); - } - } - return false; -} - /* If profitable, negate (without causing overflow) integer constant of mode MODE at location LOC. Return true in this case. */ bool diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a82f2e4..d5db538 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -6290,10 +6290,10 @@ }) (define_insn_and_split "*add<dwi>3_doubleword" - [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r") + [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r") (plus:<DWI> - (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r") - (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,r"))) + (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r") + (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,r"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD)" "#" @@ -6332,7 +6332,7 @@ DONE; } } -[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) +[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")]) (define_insn_and_split "*add<dwi>3_doubleword_zext" [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=r,o,&r,&r") @@ -6424,10 +6424,10 @@ "split_double_mode (<DWI>mode, &operands[0], 1, &operands[0], &operands[5]);") (define_insn "*add<mode>_1" - [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r,r,r,r,r") + [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r,r,r,r") (plus:SWI48 - (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r,r,rm,r,m,r") - (match_operand:SWI48 2 "x86_64_general_operand" "re,BM,0,le,r,e,je,BM"))) + (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r,r,rje,jM,r") + (match_operand:SWI48 2 "x86_64_general_operand" "re,BM,0,le,r,e,BM"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" { @@ -6462,7 +6462,7 @@ : "add{<imodesuffix>}\t{%2, %0|%0, %2}"; } } - [(set_attr "isa" "*,*,*,*,apx_ndd,apx_ndd,apx_ndd,apx_ndd") + [(set_attr "isa" "*,*,*,*,apx_ndd,apx_ndd,apx_ndd") (set (attr "type") (cond [(eq_attr "alternative" "3") (const_string "lea") @@ -6484,10 +6484,10 @@ ;; patterns constructed from addsi_1 to match. (define_insn "addsi_1_zext" - [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r") + [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r") (zero_extend:DI - (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r,r,r,rm") - (match_operand:SI 2 "x86_64_general_operand" "rBMe,0,le,rBMe,re")))) + (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r,r,r,rm,rjM") + (match_operand:SI 2 "x86_64_general_operand" "rBMe,0,le,rBMe,r,e")))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)" @@ -6523,7 +6523,7 @@ : "add{l}\t{%2, %k0|%k0, %2}"; } } - [(set_attr "isa" "*,*,*,apx_ndd,apx_ndd") + [(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,apx_ndd") (set (attr "type") (cond [(eq_attr "alternative" "2") (const_string "lea") @@ -7463,7 +7463,7 @@ (eq:CCO (plus:<QPWI> (sign_extend:<QPWI> - (match_operand:<DWI> 1 "nonimmediate_operand" "%0,rm")) + (match_operand:<DWI> 1 "nonimmediate_operand" "%0,rjM")) (match_operand:<QPWI> 3 "const_scalar_int_operand" "n,n")) (sign_extend:<QPWI> (plus:<DWI> @@ -7833,18 +7833,19 @@ [(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) (define_insn "*sub<mode>_1" - [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") + [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r,r") (minus:SWI - (match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,r") - (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>"))) + (match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,rjM,r") + (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r,<i>,<m>"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" "@ sub{<imodesuffix>}\t{%2, %0|%0, %2} sub{<imodesuffix>}\t{%2, %0|%0, %2} sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} + sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "*,*,apx_ndd,apx_ndd") + [(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd") (set_attr "type" "alu") (set_attr "mode" "<MODE>")]) @@ -9370,18 +9371,19 @@ [(set (reg:CCC FLAGS_REG) (compare:CCC (plus:SWI - (match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r") - (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>")) + (match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,rjM,r") + (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r,<i>,<m>")) (match_dup 1))) - (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") + (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r,r") (plus:SWI (match_dup 1) (match_dup 2)))] "ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" "@ add{<imodesuffix>}\t{%2, %0|%0, %2} add{<imodesuffix>}\t{%2, %0|%0, %2} add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} + add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "*,*,apx_ndd,apx_ndd") + [(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd") (set_attr "type" "alu") (set_attr "mode" "<MODE>")]) @@ -9501,10 +9503,10 @@ [(set (reg:CCC FLAGS_REG) (compare:CCC (plus:<DWI> - (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r") - (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o")) + (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r") + (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,o")) (match_dup 1))) - (set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r") + (set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r") (plus:<DWI> (match_dup 1) (match_dup 2)))] "ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD)" "#" @@ -9546,7 +9548,7 @@ else operands[6] = gen_rtx_ZERO_EXTEND (<DWI>mode, operands[5]); } -[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) +[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")]) ;; x == 0 with zero flag test can be done also as x < 1U with carry flag ;; test, where the latter is preferrable if we have some carry consuming @@ -11690,10 +11692,10 @@ }) (define_insn_and_split "*and<dwi>3_doubleword" - [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r") + [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r") (and:<DWI> - (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r") - (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o"))) + (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r") + (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,o"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (AND, <DWI>mode, operands, TARGET_APX_NDD)" "#" @@ -11730,13 +11732,13 @@ DONE; } -[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) +[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")]) (define_insn "*anddi_1" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm,r,r,r,r,?k") + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm,r,r,r,r,r,?k") (and:DI - (match_operand:DI 1 "nonimmediate_operand" "%0,r,0,0,rm,r,qm,k") - (match_operand:DI 2 "x86_64_szext_general_operand" "Z,Z,re,m,re,m,L,k"))) + (match_operand:DI 1 "nonimmediate_operand" "%0,r,0,0,rm,rjM,r,qm,k") + (match_operand:DI 2 "x86_64_szext_general_operand" "Z,Z,re,m,r,e,m,L,k"))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && ix86_binary_operator_ok (AND, DImode, operands, TARGET_APX_NDD)" @@ -11747,11 +11749,12 @@ and{q}\t{%2, %0|%0, %2} and{q}\t{%2, %1, %0|%0, %1, %2} and{q}\t{%2, %1, %0|%0, %1, %2} + and{q}\t{%2, %1, %0|%0, %1, %2} # #" - [(set_attr "isa" "x64,apx_ndd,x64,x64,apx_ndd,apx_ndd,x64,avx512bw") - (set_attr "type" "alu,alu,alu,alu,alu,alu,imovx,msklog") - (set_attr "length_immediate" "*,*,*,*,*,*,0,*") + [(set_attr "isa" "x64,apx_ndd,x64,x64,apx_ndd,apx_ndd,apx_ndd,x64,avx512bw") + (set_attr "type" "alu,alu,alu,alu,alu,alu,alu,imovx,msklog") + (set_attr "length_immediate" "*,*,*,*,*,*,*,0,*") (set (attr "prefix_rex") (if_then_else (and (eq_attr "type" "imovx") @@ -11759,7 +11762,7 @@ (match_operand 1 "ext_QIreg_operand"))) (const_string "1") (const_string "*"))) - (set_attr "mode" "SI,SI,DI,DI,DI,DI,SI,DI")]) + (set_attr "mode" "SI,SI,DI,DI,DI,DI,DI,SI,DI")]) (define_insn_and_split "*anddi_1_btr" [(set (match_operand:DI 0 "nonimmediate_operand" "=rm") @@ -11814,25 +11817,26 @@ ;; See comment for addsi_1_zext why we do use nonimmediate_operand (define_insn "*andsi_1_zext" - [(set (match_operand:DI 0 "register_operand" "=r,r,r") + [(set (match_operand:DI 0 "register_operand" "=r,r,r,r") (zero_extend:DI - (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,r") - (match_operand:SI 2 "x86_64_general_operand" "rBMe,re,BM")))) + (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,rjM,r") + (match_operand:SI 2 "x86_64_general_operand" "rBMe,r,e,BM")))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && ix86_binary_operator_ok (AND, SImode, operands, TARGET_APX_NDD)" "@ and{l}\t{%2, %k0|%k0, %2} and{l}\t{%2, %1, %k0|%k0, %1, %2} + and{l}\t{%2, %1, %k0|%k0, %1, %2} and{l}\t{%2, %1, %k0|%k0, %1, %2}" [(set_attr "type" "alu") - (set_attr "isa" "*,apx_ndd,apx_ndd") + (set_attr "isa" "*,apx_ndd,apx_ndd,apx_ndd") (set_attr "mode" "SI")]) (define_insn "*and<mode>_1" - [(set (match_operand:SWI24 0 "nonimmediate_operand" "=rm,r,r,r,Ya,?k") - (and:SWI24 (match_operand:SWI24 1 "nonimmediate_operand" "%0,0,rm,r,qm,k") - (match_operand:SWI24 2 "<general_operand>" "r<i>,<m>,r<i>,<m>,L,k"))) + [(set (match_operand:SWI24 0 "nonimmediate_operand" "=rm,r,r,r,r,Ya,?k") + (and:SWI24 (match_operand:SWI24 1 "nonimmediate_operand" "%0,0,rm,rjM,r,qm,k") + (match_operand:SWI24 2 "<general_operand>" "r<i>,<m>,r,<i>,<m>,L,k"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (AND, <MODE>mode, operands, TARGET_APX_NDD)" "@ @@ -11840,19 +11844,20 @@ and{<imodesuffix>}\t{%2, %0|%0, %2} and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} + and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} # #" [(set (attr "isa") - (cond [(eq_attr "alternative" "2,3") + (cond [(eq_attr "alternative" "2,3,4") (const_string "apx_ndd") - (eq_attr "alternative" "5") + (eq_attr "alternative" "6") (if_then_else (eq_attr "mode" "SI") (const_string "avx512bw") (const_string "avx512f")) ] (const_string "*"))) - (set_attr "type" "alu,alu,alu,alu,imovx,msklog") - (set_attr "length_immediate" "*,*,*,*,0,*") + (set_attr "type" "alu,alu,alu,alu,alu,imovx,msklog") + (set_attr "length_immediate" "*,*,*,*,*,0,*") (set (attr "prefix_rex") (if_then_else (and (eq_attr "type" "imovx") @@ -11860,7 +11865,7 @@ (match_operand 1 "ext_QIreg_operand"))) (const_string "1") (const_string "*"))) - (set_attr "mode" "<MODE>,<MODE>,<MODE>,<MODE>,SI,<MODE>")]) + (set_attr "mode" "<MODE>,<MODE>,<MODE>,<MODE>,<MODE>,SI,<MODE>")]) (define_insn "*andqi_1" [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r,r,?k") @@ -12677,10 +12682,10 @@ }) (define_insn_and_split "*<code><dwi>3_doubleword" - [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r") + [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r") (any_or:<DWI> - (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r") - (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o"))) + (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r") + (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,o"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (<CODE>, <DWI>mode, operands, TARGET_APX_NDD)" "#" @@ -12733,13 +12738,13 @@ DONE; } -[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) +[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")]) (define_insn "*<code><mode>_1" - [(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm,r,r,r,?k") + [(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm,r,r,r,r,?k") (any_or:SWI248 - (match_operand:SWI248 1 "nonimmediate_operand" "%0,0,rm,r,k") - (match_operand:SWI248 2 "<general_operand>" "r<i>,<m>,r<i>,<m>,k"))) + (match_operand:SWI248 1 "nonimmediate_operand" "%0,0,rm,rjM,r,k") + (match_operand:SWI248 2 "<general_operand>" "r<i>,<m>,r,<i>,<m>,k"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)" "@ @@ -12747,9 +12752,10 @@ <logic>{<imodesuffix>}\t{%2, %0|%0, %2} <logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} <logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} + <logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} #" - [(set_attr "isa" "*,*,apx_ndd,apx_ndd,<kmov_isa>") - (set_attr "type" "alu, alu, alu, alu, msklog") + [(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd,<kmov_isa>") + (set_attr "type" "alu, alu, alu, alu, alu, msklog") (set_attr "mode" "<MODE>")]) (define_insn_and_split "*notxor<mode>_1" @@ -12864,19 +12870,20 @@ ;; See comment for addsi_1_zext why we do use nonimmediate_operand (define_insn "*<code>si_1_zext" - [(set (match_operand:DI 0 "register_operand" "=r,r,r") + [(set (match_operand:DI 0 "register_operand" "=r,r,r,r") (zero_extend:DI - (any_or:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,r") - (match_operand:SI 2 "x86_64_general_operand" "rBMe,re,BM")))) + (any_or:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,rjM,r") + (match_operand:SI 2 "x86_64_general_operand" "rBMe,r,e,BM")))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)" "@ <logic>{l}\t{%2, %k0|%k0, %2} <logic>{l}\t{%2, %1, %k0|%k0, %1, %2} + <logic>{l}\t{%2, %1, %k0|%k0, %1, %2} <logic>{l}\t{%2, %1, %k0|%k0, %1, %2}" [(set_attr "type" "alu") - (set_attr "isa" "*,apx_ndd,apx_ndd") + (set_attr "isa" "*,apx_ndd,apx_ndd,apx_ndd") (set_attr "mode" "SI")]) (define_insn "*<code>si_1_zext_imm" diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 6215b12..075309c 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -84,6 +84,11 @@ (define_mode_iterator V2FI [V2SF V2SI]) (define_mode_iterator V24FI [V2SF V2SI V4HF V4HI]) + +(define_mode_iterator V248FI [V2SF V2SI V4HF V4HI V8QI]) + +(define_mode_iterator V24FI_32 [V2HF V2HI V4QI]) + ;; Mapping from integer vector mode to mnemonic suffix (define_mode_attr mmxvecsize [(V8QI "b") (V4QI "b") (V2QI "b") @@ -3729,6 +3734,70 @@ DONE; }) +(define_expand "vec_shl_<mode>" + [(set (match_operand:V248FI 0 "register_operand") + (ashift:V1DI + (match_operand:V248FI 1 "nonimmediate_operand") + (match_operand:DI 2 "nonmemory_operand")))] + "TARGET_MMX_WITH_SSE" +{ + rtx op0 = gen_reg_rtx (V1DImode); + rtx op1 = force_reg (<MODE>mode, operands[1]); + + emit_insn (gen_mmx_ashlv1di3 + (op0, gen_lowpart (V1DImode, op1), operands[2])); + emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0)); + DONE; +}) + +(define_expand "vec_shl_<mode>" + [(set (match_operand:V24FI_32 0 "register_operand") + (ashift:V1SI + (match_operand:V24FI_32 1 "nonimmediate_operand") + (match_operand:DI 2 "nonmemory_operand")))] + "TARGET_SSE2" +{ + rtx op0 = gen_reg_rtx (V1SImode); + rtx op1 = force_reg (<MODE>mode, operands[1]); + + emit_insn (gen_mmx_ashlv1si3 + (op0, gen_lowpart (V1SImode, op1), operands[2])); + emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0)); + DONE; +}) + +(define_expand "vec_shr_<mode>" + [(set (match_operand:V248FI 0 "register_operand") + (lshiftrt:V1DI + (match_operand:V248FI 1 "nonimmediate_operand") + (match_operand:DI 2 "nonmemory_operand")))] + "TARGET_MMX_WITH_SSE" +{ + rtx op0 = gen_reg_rtx (V1DImode); + rtx op1 = force_reg (<MODE>mode, operands[1]); + + emit_insn (gen_mmx_lshrv1di3 + (op0, gen_lowpart (V1DImode, op1), operands[2])); + emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0)); + DONE; +}) + +(define_expand "vec_shr_<mode>" + [(set (match_operand:V24FI_32 0 "register_operand") + (lshiftrt:V1SI + (match_operand:V24FI_32 1 "nonimmediate_operand") + (match_operand:DI 2 "nonmemory_operand")))] + "TARGET_SSE2" +{ + rtx op0 = gen_reg_rtx (V1SImode); + rtx op1 = force_reg (<MODE>mode, operands[1]); + + emit_insn (gen_mmx_lshrv1si3 + (op0, gen_lowpart (V1SImode, op1), operands[2])); + emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0)); + DONE; +}) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Parallel integral comparisons diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 06027a8..4c1aedd 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -2248,3 +2248,68 @@ } return true; }) + +;; Return true if OP is a memory operand that can be also used in APX +;; NDD patterns with immediate operand. With non-default address space, +;; segment register or address size prefix, APX NDD instruction length +;; can exceed the 15 byte size limit. +(define_predicate "apx_ndd_memory_operand" + (match_operand 0 "memory_operand") +{ + /* OK if immediate operand size < 4 bytes. */ + if (GET_MODE_SIZE (mode) < 4) + return true; + + bool default_addr = ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (op)); + bool address_size_prefix = TARGET_X32 && Pmode == SImode; + + struct ix86_address parts; + int ok; + + op = XEXP (op, 0); + ok = ix86_decompose_address (op, &parts); + gcc_assert (ok); + + if (default_addr) + { + /* Default address space. */ + + /* Not OK with address size prefix, index register and disp. */ + if (address_size_prefix + && parts.index + && parts.disp + && parts.disp != const0_rtx) + return false; + } + else + { + /* Non-default address space. */ + + /* Not OK without base register. */ + if (!parts.base) + return false; + + /* Not OK with disp and address size prefix. */ + if (address_size_prefix && parts.disp) + return false; + } + + return true; +}) + +;; Return true if OP is a memory operand which can be used in APX NDD +;; ADD with register source operand. UNSPEC_GOTNTPOFF memory operand +;; isn't allowed with APX NDD ADD. +(define_predicate "apx_ndd_add_memory_operand" + (match_operand 0 "memory_operand") +{ + op = XEXP (op, 0); + + /* Disallow APX NDD ADD with UNSPEC_GOTNTPOFF. */ + if (GET_CODE (op) == CONST + && GET_CODE (XEXP (op, 0)) == UNSPEC + && XINT (XEXP (op, 0), 1) == UNSPEC_GOTNTPOFF) + return false; + + return true; +}) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index acd1090..1bc614a 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -16498,29 +16498,35 @@ "operands[3] = XVECEXP (operands[2], 0, 0);") (define_expand "vec_shl_<mode>" - [(set (match_dup 3) + [(set (match_operand:V_128 0 "register_operand") (ashift:V1TI - (match_operand:V_128 1 "register_operand") - (match_operand:SI 2 "const_0_to_255_mul_8_operand"))) - (set (match_operand:V_128 0 "register_operand") (match_dup 4))] + (match_operand:V_128 1 "nonimmediate_operand") + (match_operand:SI 2 "const_0_to_255_mul_8_operand")))] "TARGET_SSE2" { - operands[1] = gen_lowpart (V1TImode, operands[1]); - operands[3] = gen_reg_rtx (V1TImode); - operands[4] = gen_lowpart (<MODE>mode, operands[3]); + rtx op0 = gen_reg_rtx (V1TImode); + rtx op1 = force_reg (<MODE>mode, operands[1]); + + emit_insn (gen_sse2_ashlv1ti3 + (op0, gen_lowpart (V1TImode, op1), operands[2])); + emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0)); + DONE; }) (define_expand "vec_shr_<mode>" - [(set (match_dup 3) + [(set (match_operand:V_128 0 "register_operand") (lshiftrt:V1TI - (match_operand:V_128 1 "register_operand") - (match_operand:SI 2 "const_0_to_255_mul_8_operand"))) - (set (match_operand:V_128 0 "register_operand") (match_dup 4))] + (match_operand:V_128 1 "nonimmediate_operand") + (match_operand:SI 2 "const_0_to_255_mul_8_operand")))] "TARGET_SSE2" { - operands[1] = gen_lowpart (V1TImode, operands[1]); - operands[3] = gen_reg_rtx (V1TImode); - operands[4] = gen_lowpart (<MODE>mode, operands[3]); + rtx op0 = gen_reg_rtx (V1TImode); + rtx op1 = force_reg (<MODE>mode, operands[1]); + + emit_insn (gen_sse2_lshrv1ti3 + (op0, gen_lowpart (V1TImode, op1), operands[2])); + emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0)); + DONE; }) (define_expand "ashlv1ti3" diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc b/gcc/config/riscv/riscv-vector-builtins-shapes.cc index 8e90b17..c5ffcc1 100644 --- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc +++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc @@ -383,7 +383,10 @@ struct alu_def : public build_base /* Check whether rounding mode argument is a valid immediate. */ if (c.base->has_rounding_mode_operand_p ()) { - if (!c.any_type_float_p ()) + /* Some invalid overload intrinsic like below will have zero for + c.arg_num (). Thus, make sure arg_num is big enough here. + __riscv_vaadd () will make c.arg_num () == 0. */ + if (!c.any_type_float_p () && c.arg_num () >= 2) return c.require_immediate (c.arg_num () - 2, VXRM_RNU, VXRM_ROD); /* TODO: We will support floating-point intrinsic modeling rounding mode in the future. */ @@ -411,8 +414,11 @@ struct build_frm_base : public build_base { gcc_assert (c.any_type_float_p ()); - /* Check whether rounding mode argument is a valid immediate. */ - if (c.base->has_rounding_mode_operand_p ()) + /* Check whether rounding mode argument is a valid immediate. + Some invalid overload intrinsic like below will have zero for + c.arg_num (). Thus, make sure arg_num is big enough here. + __riscv_vaadd () will make c.arg_num () == 0. */ + if (c.base->has_rounding_mode_operand_p () && c.arg_num () >= 2) { unsigned int frm_num = c.arg_num () - 2; @@ -679,7 +685,10 @@ struct narrow_alu_def : public build_base /* Check whether rounding mode argument is a valid immediate. */ if (c.base->has_rounding_mode_operand_p ()) { - if (!c.any_type_float_p ()) + /* Some invalid overload intrinsic like below will have zero for + c.arg_num (). Thus, make sure arg_num is big enough here. + __riscv_vaadd () will make c.arg_num () == 0. */ + if (!c.any_type_float_p () && c.arg_num () >= 2) return c.require_immediate (c.arg_num () - 2, VXRM_RNU, VXRM_ROD); /* TODO: We will support floating-point intrinsic modeling rounding mode in the future. */ diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc index efcdc8f..c5881a5 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -4630,7 +4630,8 @@ resolve_overloaded_builtin (location_t loc, unsigned int code, tree fndecl, Here we report error when overloaded function with empty args. */ if (rfun->overloaded_p && arglist->length () == 0) - error_at (loc, "no matching function call to %qE with empty args", fndecl); + error_at (loc, "no matching function call to %qE with empty arguments", + fndecl); hashval_t hash = rfun->overloaded_hash (*arglist); registered_function *rfn diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 799d791..4100abc 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -8434,7 +8434,7 @@ riscv_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr) (lo_sum:DI (reg:DI rD) (const_int IMM12))) */ if (GET_CODE (SET_SRC (prev_set)) == UNSPEC - && XINT (prev_set, 1) == UNSPEC_AUIPC + && XINT (SET_SRC (prev_set), 1) == UNSPEC_AUIPC && (GET_CODE (SET_SRC (curr_set)) == LO_SUM || (GET_CODE (SET_SRC (curr_set)) == PLUS && SMALL_OPERAND (INTVAL (XEXP (SET_SRC (curr_set), 1)))))) diff --git a/gcc/configure b/gcc/configure index c83e09b..41b978b 100755 --- a/gcc/configure +++ b/gcc/configure @@ -8835,7 +8835,7 @@ if test $gcc_cv_prog_makeinfo_modern = no; then $as_echo "$as_me: WARNING: *** Makeinfo is missing or too old. *** Info documentation will not be built." >&2;} - BUILD_INFO= + BUILD_INFO=no-info else BUILD_INFO=info fi diff --git a/gcc/configure.ac b/gcc/configure.ac index 239856a..72012d6 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1245,7 +1245,7 @@ if test $gcc_cv_prog_makeinfo_modern = no; then AC_MSG_WARN([ *** Makeinfo is missing or too old. *** Info documentation will not be built.]) - BUILD_INFO= + BUILD_INFO=no-info else BUILD_INFO=info fi diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8a63a36..f2ad98d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,146 @@ +2024-02-14 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/113708 + * decl.cc (make_rtl_for_nonlocal_decl): Defer inline variables. + * decl2.cc (import_export_decl): Support inline variables. + +2024-02-14 Patrick Palka <ppalka@redhat.com> + + PR c++/113908 + PR c++/113332 + * method.cc (synthesized_method_walk): Use maybe_push_to_top_level. + +2024-02-14 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/99573 + * decl.cc (start_enum): Reorder check for redeclaring in module. + Add missing auto_diagnostic_groups. + +2024-02-13 Marek Polacek <polacek@redhat.com> + + DR 1693 + PR c++/113760 + * parser.cc (cp_parser_member_declaration): Only pedwarn about an extra + semicolon in C++98. + +2024-02-13 Tobias Burnus <tburnus@baylibre.com> + + PR middle-end/113904 + * parser.cc (cp_parser_omp_context_selector): Handle splitting of + OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. + +2024-02-13 Patrick Palka <ppalka@redhat.com> + + * Make-lang.in (CFLAGS-cp/module.o): Add $(ZLIBINC). + * module.cc: Include <zlib.h>. + (bytes::calc_crc): Use crc32 from zlib. + (bytes_out::set_crc): Use crc32_combine from zlib. + +2024-02-13 Patrick Palka <ppalka@redhat.com> + + * module.cc (depset::hash::add_specializations): Use + STRIP_TEMPLATE consistently. + (get_originating_module_decl): Handle class-scope CONST_DECL. + +2024-02-13 Patrick Palka <ppalka@redhat.com> + + * lambda.cc (lambda_function): Call get_class_binding_direct + instead of lookup_member to sidestep lazy loading. + * name-lookup.cc (check_local_shadow): Punt if we're in a + function context that's not actual parsing. + +2024-02-13 Jason Merrill <jason@redhat.com> + + PR c++/113612 + * pt.cc (process_partial_specialization): Return early + on redeclaration. + +2024-02-13 Marek Polacek <polacek@redhat.com> + + PR c++/112436 + * except.cc (expand_start_catch_block): Pass tf_warning_or_error to + is_admissible_throw_operand_or_catch_parameter. + (build_throw): Pass complain to + is_admissible_throw_operand_or_catch_parameter. + (complete_ptr_ref_or_void_ptr_p): Add a tsubst_flags_t parameter. Use + it. Return bool. Call complete_type_or_maybe_complain instead of + complete_type_or_else. + (is_admissible_throw_operand_or_catch_parameter): Add a tsubst_flags_t + parameter. Use it. Guard error calls. + +2024-02-13 Alex Coplan <alex.coplan@arm.com> + + PR c++/113658 + * cp-objcp-common.cc (cp_feature_table): Remove entry for + cxx_constexpr_string_builtins. + +2024-02-12 Marek Polacek <polacek@redhat.com> + + PR c++/113545 + * constexpr.cc (cxx_eval_switch_expr): If the condition doesn't reduce + to an INTEGER_CST, consider it non-constant. + +2024-02-10 Marek Polacek <polacek@redhat.com> + + DR 2237 + PR c++/107126 + PR c++/97202 + * parser.cc (cp_parser_unqualified_id): Downgrade the DR2237 error to + a pedwarn. + (cp_parser_constructor_declarator_p): Likewise. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * tree.cc (debug_binfo): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld" + and casts to long. + * pt.cc (print_template_statistics): Use HOST_SIZE_T_PRINT_DEC + and casts to fmt_size_t instead of "%ld" and casts to long. + * class.cc (dump_class_hierarchy_1): Use HOST_WIDE_INT_PRINT_UNSIGNED + instead of "%lu" and casts to unsigned long. For TYPE_ALIGN, use + %u instead of %lu and drop casts to unsigned long. + * parser.cc (cp_lexer_peek_nth_token): Use HOST_SIZE_T_PRINT_DEC + and casts to fmt_size_t instead of "%ld" and casts to long. + +2024-02-09 Marek Polacek <polacek@redhat.com> + + PR c++/113834 + * semantics.cc (finish_type_pack_element): Perform range checking + before tree_to_shwi. + +2024-02-09 Marek Polacek <polacek@redhat.com> + + PR c++/98388 + * coroutines.cc (coro_rewrite_function_body): Pass tf_warning_or_error + to build_throw. + (morph_fn_to_coro): Likewise. + * cp-tree.h (build_throw): Adjust. + * except.cc (expand_end_catch_block): Pass tf_warning_or_error to + build_throw. + (build_throw): Add a tsubst_flags_t parameter. Use it. Remove + redundant variable. Guard an inform call. + * parser.cc (cp_parser_throw_expression): Pass tf_warning_or_error + to build_throw. + * pt.cc (tsubst_expr) <case THROW_EXPR>: Pass complain to build_throw. + +2024-02-09 Patrick Palka <ppalka@redhat.com> + + PR c++/112580 + * module.cc (trees_in::read_class_def): When streaming in + an anonymous union field of an as-base class, don't overwrite + ANON_AGGR_TYPE_FIELD. + +2024-02-08 Patrick Palka <ppalka@redhat.com> + + PR c++/113649 + * pt.cc (do_class_deduction): Add outer_targs parameter. + Substitute outer arguments into the CTAD template. + (do_auto_deduction): Pass outer_targs to do_class_deduction. + +2024-02-08 Jason Merrill <jason@redhat.com> + + * pt.cc (create_template_parm_object): Pass TARGET_EXPR to + cxx_constant_value. + 2024-02-06 Jakub Jelinek <jakub@redhat.com> PR c++/113788 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 630db41..f153891 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -55,7 +55,7 @@ c++.serial = cc1plus$(exeext) CFLAGS-cp/g++spec.o += $(DRIVER_DEFINES) CFLAGS-cp/module.o += -DHOST_MACHINE=\"$(host)\" \ - -DTARGET_MACHINE=\"$(target)\" + -DTARGET_MACHINE=\"$(target)\" $(ZLIBINC) # In non-release builds, use a date-related module version. ifneq ($(DEVPHASE_c),) diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 556943c..5f25872 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -9585,14 +9585,14 @@ static void dump_class_hierarchy_1 (FILE *stream, dump_flags_t flags, tree t) { fprintf (stream, "Class %s\n", type_as_string (t, TFF_PLAIN_IDENTIFIER)); - fprintf (stream, " size=%lu align=%lu\n", - (unsigned long)(tree_to_shwi (TYPE_SIZE (t)) / BITS_PER_UNIT), - (unsigned long)(TYPE_ALIGN (t) / BITS_PER_UNIT)); + fprintf (stream, " size=" HOST_WIDE_INT_PRINT_UNSIGNED " align=%u\n", + tree_to_shwi (TYPE_SIZE (t)) / BITS_PER_UNIT, + TYPE_ALIGN (t) / BITS_PER_UNIT); if (tree as_base = CLASSTYPE_AS_BASE (t)) - fprintf (stream, " base size=%lu base align=%lu\n", - (unsigned long)(tree_to_shwi (TYPE_SIZE (as_base)) - / BITS_PER_UNIT), - (unsigned long)(TYPE_ALIGN (as_base) / BITS_PER_UNIT)); + fprintf (stream, " base size=" HOST_WIDE_INT_PRINT_UNSIGNED + " base align=%u\n", + tree_to_shwi (TYPE_SIZE (as_base)) / BITS_PER_UNIT, + TYPE_ALIGN (as_base) / BITS_PER_UNIT); dump_class_hierarchy_r (stream, flags, TYPE_BINFO (t), TYPE_BINFO (t), 0); fprintf (stream, "\n"); } diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 2ebb147..fa346fe 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -7106,6 +7106,16 @@ cxx_eval_switch_expr (const constexpr_ctx *ctx, tree t, cond = cxx_eval_constant_expression (ctx, cond, vc_prvalue, non_constant_p, overflow_p); VERIFY_CONSTANT (cond); + if (TREE_CODE (cond) != INTEGER_CST) + { + /* If the condition doesn't reduce to an INTEGER_CST it isn't a usable + switch condition even if it's constant enough for other things + (c++/113545). */ + gcc_checking_assert (ctx->quiet); + *non_constant_p = true; + return t; + } + *jump_target = cond; tree body diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index 3194c91..9b037ed 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -4246,7 +4246,7 @@ coro_rewrite_function_body (location_t fn_start, tree fnbody, tree orig, boolean_type_node, i_a_r_c); finish_if_stmt_cond (not_iarc, not_iarc_if); /* If the initial await resume called value is false, rethrow... */ - tree rethrow = build_throw (fn_start, NULL_TREE); + tree rethrow = build_throw (fn_start, NULL_TREE, tf_warning_or_error); suppress_warning (rethrow); finish_expr_stmt (rethrow); finish_then_clause (not_iarc_if); @@ -5151,7 +5151,7 @@ morph_fn_to_coro (tree orig, tree *resumer, tree *destroyer) tree del_coro_fr = coro_get_frame_dtor (coro_fp, orig, frame_size, promise_type, fn_start); finish_expr_stmt (del_coro_fr); - tree rethrow = build_throw (fn_start, NULL_TREE); + tree rethrow = build_throw (fn_start, NULL_TREE, tf_warning_or_error); suppress_warning (rethrow); finish_expr_stmt (rethrow); finish_handler (handler); diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc index f06edf0..85dde04 100644 --- a/gcc/cp/cp-objcp-common.cc +++ b/gcc/cp/cp-objcp-common.cc @@ -110,7 +110,6 @@ static constexpr cp_feature_info cp_feature_table[] = { "cxx_alignof", cxx11 }, { "cxx_attributes", cxx11 }, { "cxx_constexpr", cxx11 }, - { "cxx_constexpr_string_builtins", cxx11 }, { "cxx_decltype", cxx11 }, { "cxx_decltype_incomplete_return_types", cxx11 }, { "cxx_default_function_template_args", cxx11 }, diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 969c723..334c113 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7185,7 +7185,8 @@ extern void init_exception_processing (void); extern tree expand_start_catch_block (tree); extern void expand_end_catch_block (void); extern tree build_exc_ptr (void); -extern tree build_throw (location_t, tree); +extern tree build_throw (location_t, tree, + tsubst_flags_t); extern int nothrow_libfn_p (const_tree); extern void check_handlers (tree); extern tree finish_noexcept_expr (tree, tsubst_flags_t); diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 3e41fd4..e47f694 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -7954,6 +7954,10 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec) && DECL_IMPLICIT_INSTANTIATION (decl)) defer_p = 1; + /* Defer vague-linkage variables. */ + if (DECL_INLINE_VAR_P (decl)) + defer_p = 1; + /* If we're not deferring, go ahead and assemble the variable. */ if (!defer_p) rest_of_decl_compilation (decl, toplev, at_eof); @@ -16955,8 +16959,26 @@ start_enum (tree name, tree enumtype, tree underlying_type, to instantiation time is the comparison of underlying types. */ if (enumtype && TREE_CODE (enumtype) == ENUMERAL_TYPE) { - if (scoped_enum_p != SCOPED_ENUM_P (enumtype)) + /* Attempt to set the declaring module. */ + if (modules_p ()) { + tree decl = TYPE_NAME (enumtype); + if (!module_may_redeclare (decl)) + { + auto_diagnostic_group d; + error ("cannot declare %qD in different module", decl); + inform (DECL_SOURCE_LOCATION (decl), "previously declared here"); + enumtype = error_mark_node; + } + else + set_instantiating_module (decl); + } + + if (enumtype == error_mark_node) + ; + else if (scoped_enum_p != SCOPED_ENUM_P (enumtype)) + { + auto_diagnostic_group d; error_at (input_location, "scoped/unscoped mismatch " "in enum %q#T", enumtype); inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), @@ -16965,6 +16987,7 @@ start_enum (tree name, tree enumtype, tree underlying_type, } else if (ENUM_FIXED_UNDERLYING_TYPE_P (enumtype) != !! underlying_type) { + auto_diagnostic_group d; error_at (input_location, "underlying type mismatch " "in enum %q#T", enumtype); inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), @@ -16975,25 +16998,13 @@ start_enum (tree name, tree enumtype, tree underlying_type, && !same_type_p (underlying_type, ENUM_UNDERLYING_TYPE (enumtype))) { + auto_diagnostic_group d; error_at (input_location, "different underlying type " "in enum %q#T", enumtype); inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), "previous definition here"); underlying_type = NULL_TREE; } - - if (modules_p ()) - { - if (!module_may_redeclare (TYPE_NAME (enumtype))) - { - error ("cannot define %qD in different module", - TYPE_NAME (enumtype)); - inform (DECL_SOURCE_LOCATION (TYPE_NAME (enumtype)), - "declared here"); - enumtype = error_mark_node; - } - set_instantiating_module (TYPE_NAME (enumtype)); - } } if (!enumtype || TREE_CODE (enumtype) != ENUMERAL_TYPE diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index f569d40..1dddbaa 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -3360,7 +3360,9 @@ import_export_decl (tree decl) * implicit instantiations of function templates - * inline function + * inline functions + + * inline variables * implicit instantiations of static data members of class templates @@ -3383,6 +3385,7 @@ import_export_decl (tree decl) || DECL_DECLARED_INLINE_P (decl)); else gcc_assert (DECL_IMPLICIT_INSTANTIATION (decl) + || DECL_INLINE_VAR_P (decl) || DECL_VTABLE_OR_VTT_P (decl) || DECL_TINFO_P (decl)); /* Check that a definition of DECL is available in this translation @@ -3511,7 +3514,7 @@ import_export_decl (tree decl) this entity as undefined in this translation unit. */ import_p = true; } - else if (DECL_FUNCTION_MEMBER_P (decl)) + else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (decl)) { if (!DECL_DECLARED_INLINE_P (decl)) { diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc index d17a57d..f1ffda22 100644 --- a/gcc/cp/except.cc +++ b/gcc/cp/except.cc @@ -39,8 +39,8 @@ static tree do_end_catch (tree); static void initialize_handler_parm (tree, tree); static tree do_allocate_exception (tree); static tree wrap_cleanups_r (tree *, int *, void *); -static int complete_ptr_ref_or_void_ptr_p (tree, tree); -static bool is_admissible_throw_operand_or_catch_parameter (tree, bool); +static bool is_admissible_throw_operand_or_catch_parameter (tree, bool, + tsubst_flags_t); /* Sets up all the global eh stuff that needs to be initialized at the start of compilation. */ @@ -398,7 +398,8 @@ expand_start_catch_block (tree decl) if (decl) { - if (!is_admissible_throw_operand_or_catch_parameter (decl, false)) + if (!is_admissible_throw_operand_or_catch_parameter (decl, false, + tf_warning_or_error)) decl = error_mark_node; type = prepare_eh_type (TREE_TYPE (decl)); @@ -486,7 +487,8 @@ expand_end_catch_block (void) || DECL_DESTRUCTOR_P (current_function_decl)) && !in_nested_catch ()) { - tree rethrow = build_throw (input_location, NULL_TREE); + tree rethrow = build_throw (input_location, NULL_TREE, + tf_warning_or_error); /* Disable all warnings for the generated rethrow statement. */ suppress_warning (rethrow); finish_expr_stmt (rethrow); @@ -607,7 +609,7 @@ wrap_cleanups_r (tree *tp, int *walk_subtrees, void * /*data*/) /* Build a throw expression. */ tree -build_throw (location_t loc, tree exp) +build_throw (location_t loc, tree exp, tsubst_flags_t complain) { if (exp == error_mark_node) return exp; @@ -621,15 +623,14 @@ build_throw (location_t loc, tree exp) return exp; } - if (exp && null_node_p (exp)) + if (exp && null_node_p (exp) && (complain & tf_warning)) warning_at (loc, 0, "throwing NULL, which has integral, not pointer type"); - if (exp != NULL_TREE) - { - if (!is_admissible_throw_operand_or_catch_parameter (exp, true)) - return error_mark_node; - } + if (exp && !is_admissible_throw_operand_or_catch_parameter (exp, + /*is_throw=*/true, + complain)) + return error_mark_node; if (! doing_eh ()) return error_mark_node; @@ -642,8 +643,6 @@ build_throw (location_t loc, tree exp) tree object, ptr; tree allocate_expr; - tsubst_flags_t complain = tf_warning_or_error; - /* The CLEANUP_TYPE is the internal type of a destructor. */ if (!cleanup_type) { @@ -714,7 +713,6 @@ build_throw (location_t loc, tree exp) if (CLASS_TYPE_P (temp_type)) { int flags = LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING; - bool converted = false; location_t exp_loc = cp_expr_loc_or_loc (exp, loc); /* Under C++0x [12.8/16 class.copy], a thrown lvalue is sometimes @@ -727,23 +725,20 @@ build_throw (location_t loc, tree exp) exp = moved; /* Call the copy constructor. */ - if (!converted) - { - releasing_vec exp_vec (make_tree_vector_single (exp)); - exp = (build_special_member_call - (object, complete_ctor_identifier, &exp_vec, - TREE_TYPE (object), flags, tf_warning_or_error)); - } - + releasing_vec exp_vec (make_tree_vector_single (exp)); + exp = build_special_member_call (object, complete_ctor_identifier, + &exp_vec, TREE_TYPE (object), flags, + complain); if (exp == error_mark_node) { - inform (exp_loc, " in thrown expression"); + if (complain & tf_error) + inform (exp_loc, " in thrown expression"); return error_mark_node; } } else { - tree tmp = decay_conversion (exp, tf_warning_or_error); + tree tmp = decay_conversion (exp, complain); if (tmp == error_mark_node) return error_mark_node; exp = cp_build_init_expr (object, tmp); @@ -768,7 +763,7 @@ build_throw (location_t loc, tree exp) tree binfo = TYPE_BINFO (TREE_TYPE (object)); tree dtor_fn = lookup_fnfields (binfo, complete_dtor_identifier, 0, - tf_warning_or_error); + complain); dtor_fn = BASELINK_FUNCTIONS (dtor_fn); if (!mark_used (dtor_fn) || !perform_or_defer_access_check (binfo, dtor_fn, @@ -785,7 +780,7 @@ build_throw (location_t loc, tree exp) cleanup = build_int_cst (cleanup_type, 0); /* ??? Indicate that this function call throws throw_type. */ - tree tmp = cp_build_function_call_nary (throw_fn, tf_warning_or_error, + tree tmp = cp_build_function_call_nary (throw_fn, complain, ptr, throw_type, cleanup, NULL_TREE); @@ -807,7 +802,7 @@ build_throw (location_t loc, tree exp) /* ??? Indicate that this function call allows exceptions of the type of the enclosing catch block (if known). */ - exp = cp_build_function_call_vec (rethrow_fn, NULL, tf_warning_or_error); + exp = cp_build_function_call_vec (rethrow_fn, NULL, complain); } exp = build1_loc (loc, THROW_EXPR, void_type_node, exp); @@ -820,28 +815,26 @@ build_throw (location_t loc, tree exp) Return the zero on failure and nonzero on success. FROM can be the expr or decl from whence TYPE came, if available. */ -static int -complete_ptr_ref_or_void_ptr_p (tree type, tree from) +static bool +complete_ptr_ref_or_void_ptr_p (tree type, tree from, tsubst_flags_t complain) { - int is_ptr; - /* Check complete. */ - type = complete_type_or_else (type, from); + type = complete_type_or_maybe_complain (type, from, complain); if (!type) - return 0; + return false; /* Or a pointer or ref to one, or cv void *. */ - is_ptr = TYPE_PTR_P (type); + const bool is_ptr = TYPE_PTR_P (type); if (is_ptr || TYPE_REF_P (type)) { tree core = TREE_TYPE (type); if (is_ptr && VOID_TYPE_P (core)) /* OK */; - else if (!complete_type_or_else (core, from)) - return 0; + else if (!complete_type_or_maybe_complain (core, from, complain)) + return false; } - return 1; + return true; } /* If IS_THROW is true return truth-value if T is an expression admissible @@ -851,13 +844,14 @@ complete_ptr_ref_or_void_ptr_p (tree type, tree from) for its type plus rvalue reference type is also not admissible. */ static bool -is_admissible_throw_operand_or_catch_parameter (tree t, bool is_throw) +is_admissible_throw_operand_or_catch_parameter (tree t, bool is_throw, + tsubst_flags_t complain) { tree expr = is_throw ? t : NULL_TREE; tree type = TREE_TYPE (t); /* C++11 [except.handle] The exception-declaration shall not denote - an incomplete type, an abstract class type, or an rvalue reference + an incomplete type, an abstract class type, or an rvalue reference type. */ /* 15.1/4 [...] The type of the throw-expression shall not be an @@ -867,7 +861,7 @@ is_admissible_throw_operand_or_catch_parameter (tree t, bool is_throw) restrictions on type matching mentioned in 15.3, the operand of throw is treated exactly as a function argument in a call (5.2.2) or the operand of a return statement. */ - if (!complete_ptr_ref_or_void_ptr_p (type, expr)) + if (!complete_ptr_ref_or_void_ptr_p (type, expr, complain)) return false; tree nonref_type = non_reference (type); @@ -877,25 +871,30 @@ is_admissible_throw_operand_or_catch_parameter (tree t, bool is_throw) /* 10.4/3 An abstract class shall not be used as a parameter type, as a function return type or as type of an explicit conversion. */ - else if (abstract_virtuals_error (is_throw ? ACU_THROW : ACU_CATCH, type)) + else if (abstract_virtuals_error (is_throw ? ACU_THROW : ACU_CATCH, type, + complain)) return false; else if (!is_throw && TYPE_REF_P (type) && TYPE_REF_IS_RVALUE (type)) { - error ("cannot declare %<catch%> parameter to be of rvalue " - "reference type %qT", type); + if (complain & tf_error) + error ("cannot declare %<catch%> parameter to be of rvalue " + "reference type %qT", type); return false; } else if (variably_modified_type_p (type, NULL_TREE)) { - if (is_throw) - error_at (cp_expr_loc_or_input_loc (expr), - "cannot throw expression of type %qT because it involves " - "types of variable size", type); - else - error ("cannot catch type %qT because it involves types of " - "variable size", type); + if (complain & tf_error) + { + if (is_throw) + error_at (cp_expr_loc_or_input_loc (expr), + "cannot throw expression of type %qT because it involves " + "types of variable size", type); + else + error ("cannot catch type %qT because it involves types of " + "variable size", type); + } return false; } diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc index 1d37e5a..4b1f939 100644 --- a/gcc/cp/lambda.cc +++ b/gcc/cp/lambda.cc @@ -175,9 +175,7 @@ lambda_function (tree lambda) if (CLASSTYPE_TEMPLATE_INSTANTIATION (type) && !COMPLETE_OR_OPEN_TYPE_P (type)) return NULL_TREE; - lambda = lookup_member (type, call_op_identifier, - /*protect=*/0, /*want_type=*/false, - tf_warning_or_error); + lambda = get_class_binding_direct (type, call_op_identifier); if (lambda) lambda = STRIP_TEMPLATE (get_first_fn (lambda)); return lambda; diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc index 957496d..98c10e6 100644 --- a/gcc/cp/method.cc +++ b/gcc/cp/method.cc @@ -2760,6 +2760,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, return; } + bool push_to_top = maybe_push_to_top_level (TYPE_NAME (ctype)); ++cp_unevaluated_operand; ++c_inhibit_evaluation_warnings; push_deferring_access_checks (dk_no_deferred); @@ -2857,6 +2858,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, pop_deferring_access_checks (); --cp_unevaluated_operand; --c_inhibit_evaluation_warnings; + maybe_pop_from_top_level (push_to_top); } /* DECL is a defaulted function whose exception specification is now diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 3c2fef0e..0291d45 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -233,6 +233,7 @@ Classes used: /* This TU doesn't need or want to see the networking. */ #define CODY_NETWORKING 0 #include "mapper-client.h" +#include <zlib.h> // for crc32, crc32_combine #if 0 // 1 for testing no mmap #define MAPPED_READING 0 @@ -487,10 +488,7 @@ protected: unsigned bytes::calc_crc (unsigned l) const { - unsigned crc = 0; - for (size_t ix = 4; ix < l; ix++) - crc = crc32_byte (crc, buffer[ix]); - return crc; + return crc32 (0, (unsigned char *)buffer + 4, l - 4); } class elf_in; @@ -717,7 +715,7 @@ bytes_out::set_crc (unsigned *crc_ptr) unsigned crc = calc_crc (pos); unsigned accum = *crc_ptr; /* Only mix the existing *CRC_PTR if it is non-zero. */ - accum = accum ? crc32_unsigned (accum, crc) : crc; + accum = accum ? crc32_combine (accum, crc, pos - 4) : crc; *crc_ptr = accum; /* Buffer will be sufficiently aligned. */ @@ -12178,8 +12176,16 @@ trees_in::read_class_def (tree defn, tree maybe_template) if (TREE_CODE (decl) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (decl))) - ANON_AGGR_TYPE_FIELD - (TYPE_MAIN_VARIANT (TREE_TYPE (decl))) = decl; + { + tree anon_type = TYPE_MAIN_VARIANT (TREE_TYPE (decl)); + if (DECL_NAME (defn) == as_base_identifier) + /* ANON_AGGR_TYPE_FIELD should already point to the + original FIELD_DECL; don't overwrite it to point + to the as-base FIELD_DECL copy. */ + gcc_checking_assert (ANON_AGGR_TYPE_FIELD (anon_type)); + else + ANON_AGGR_TYPE_FIELD (anon_type) = decl; + } if (TREE_CODE (decl) == USING_DECL && TREE_CODE (USING_DECL_SCOPE (decl)) == RECORD_TYPE) @@ -13248,7 +13254,7 @@ depset::hash::add_specializations (bool decl_p) if (use_tpl == 1) /* Implicit instantiations only walked if we reach them. */ needs_reaching = true; - else if (!DECL_LANG_SPECIFIC (spec) + else if (!DECL_LANG_SPECIFIC (STRIP_TEMPLATE (spec)) || !DECL_MODULE_PURVIEW_P (STRIP_TEMPLATE (spec))) /* Likewise, GMF explicit or partial specializations. */ needs_reaching = true; @@ -18708,7 +18714,8 @@ get_originating_module_decl (tree decl) && (TREE_CODE (DECL_CONTEXT (decl)) == ENUMERAL_TYPE)) decl = TYPE_NAME (DECL_CONTEXT (decl)); else if (TREE_CODE (decl) == FIELD_DECL - || TREE_CODE (decl) == USING_DECL) + || TREE_CODE (decl) == USING_DECL + || CONST_DECL_USING_P (decl)) { decl = DECL_CONTEXT (decl); if (TREE_CODE (decl) != FUNCTION_DECL) diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index e58f3b5..6444db3 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -3275,6 +3275,23 @@ check_local_shadow (tree decl) if (TREE_CODE (decl) == PARM_DECL && !DECL_CONTEXT (decl)) return NULL_TREE; + if (DECL_FUNCTION_SCOPE_P (decl)) + { + tree ctx = DECL_CONTEXT (decl); + if (DECL_CLONED_FUNCTION_P (ctx) + || DECL_TEMPLATE_INSTANTIATED (ctx) + || (DECL_LANG_SPECIFIC (ctx) + && DECL_DEFAULTED_FN (ctx)) + || (LAMBDA_FUNCTION_P (ctx) + && LAMBDA_EXPR_REGEN_INFO (CLASSTYPE_LAMBDA_EXPR + (DECL_CONTEXT (ctx))))) + /* It suffices to check shadowing only when actually parsing. + So punt for clones, instantiations, defaulted functions and + regenerated lambdas. This optimization helps reduce lazy + loading cascades with modules. */ + return NULL_TREE; + } + tree old = NULL_TREE; cp_binding_level *old_scope = NULL; if (cxx_binding *binding = outer_binding (DECL_NAME (decl), NULL, true)) diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index c4292c4..9d09144 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -1310,7 +1310,8 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n) if (cp_lexer_debugging_p (lexer)) fprintf (cp_lexer_debug_stream, - "cp_lexer: peeking ahead %ld at token: ", (long)n); + "cp_lexer: peeking ahead " HOST_SIZE_T_PRINT_DEC " at token: ", + (fmt_size_t) n); --n; token = lexer->next_token; @@ -6719,12 +6720,19 @@ cp_parser_unqualified_id (cp_parser* parser, /* DR 2237 (C++20 only): A simple-template-id is no longer valid as the declarator-id of a constructor or destructor. */ - if (token->type == CPP_TEMPLATE_ID && declarator_p - && cxx_dialect >= cxx20) + if (token->type == CPP_TEMPLATE_ID && declarator_p) { - if (!cp_parser_simulate_error (parser)) - error_at (tilde_loc, "template-id not allowed for destructor"); - return error_mark_node; + auto_diagnostic_group d; + bool w = false; + if (cxx_dialect >= cxx20 && !cp_parser_simulate_error (parser)) + w = pedwarn (tilde_loc, OPT_Wtemplate_id_cdtor, + "template-id not allowed for destructor in C++20"); + else if (cxx_dialect < cxx20 + && !cp_parser_uncommitted_to_tentative_parse_p (parser)) + w = warning_at (tilde_loc, OPT_Wtemplate_id_cdtor, + "template-id not allowed for destructor in C++20"); + if (w) + inform (tilde_loc, "remove the %qs", "< >"); } /* If there was an explicit qualification (S::~T), first look @@ -27991,7 +27999,7 @@ cp_parser_member_declaration (cp_parser* parser) if (!decl_specifiers.any_specifiers_p) { cp_token *token = cp_lexer_peek_token (parser->lexer); - if (!in_system_header_at (token->location)) + if (cxx_dialect < cxx11 && !in_system_header_at (token->location)) { gcc_rich_location richloc (token->location); richloc.add_fixit_remove (); @@ -29310,7 +29318,7 @@ cp_parser_throw_expression (cp_parser* parser) the end at the end of the final token we consumed. */ location_t combined_loc = make_location (start_loc, start_loc, parser->lexer); - expression = build_throw (combined_loc, expression); + expression = build_throw (combined_loc, expression, tf_warning_or_error); return expression; } @@ -32331,9 +32339,7 @@ cp_parser_constructor_declarator_p (cp_parser *parser, cp_parser_flags flags, if (next_token->type != CPP_NAME && next_token->type != CPP_SCOPE && next_token->type != CPP_NESTED_NAME_SPECIFIER - /* DR 2237 (C++20 only): A simple-template-id is no longer valid as the - declarator-id of a constructor or destructor. */ - && (next_token->type != CPP_TEMPLATE_ID || cxx_dialect >= cxx20)) + && next_token->type != CPP_TEMPLATE_ID) return false; /* Parse tentatively; we are going to roll back all of the tokens @@ -32552,6 +32558,18 @@ cp_parser_constructor_declarator_p (cp_parser *parser, cp_parser_flags flags, /* We did not really want to consume any tokens. */ cp_parser_abort_tentative_parse (parser); + /* DR 2237 (C++20 only): A simple-template-id is no longer valid as the + declarator-id of a constructor or destructor. */ + if (constructor_p + && cp_lexer_peek_token (parser->lexer)->type == CPP_TEMPLATE_ID) + { + auto_diagnostic_group d; + if (emit_diagnostic (cxx_dialect >= cxx20 ? DK_PEDWARN : DK_WARNING, + input_location, OPT_Wtemplate_id_cdtor, + "template-id not allowed for constructor in C++20")) + inform (input_location, "remove the %qs", "< >"); + } + return constructor_p; } @@ -47966,7 +47984,8 @@ cp_parser_omp_context_selector (cp_parser *parser, enum omp_tss_code set, } while (1); break; - case OMP_TRAIT_PROPERTY_EXPR: + case OMP_TRAIT_PROPERTY_DEV_NUM_EXPR: + case OMP_TRAIT_PROPERTY_BOOL_EXPR: /* FIXME: this is bogus, the expression need not be constant. */ t = cp_parser_constant_expression (parser); diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 903a4a1..2803824 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -5417,9 +5417,14 @@ process_partial_specialization (tree decl) } if (VAR_P (decl)) - /* We didn't register this in check_explicit_specialization so we could - wait until the constraints were set. */ - decl = register_specialization (decl, maintmpl, specargs, false, 0); + { + /* We didn't register this in check_explicit_specialization so we could + wait until the constraints were set. */ + tree reg = register_specialization (decl, maintmpl, specargs, false, 0); + if (reg != decl) + /* Redeclaration. */ + return reg; + } else associate_classtype_constraints (type); @@ -7308,14 +7313,15 @@ invalid_tparm_referent_p (tree type, tree expr, tsubst_flags_t complain) static tree create_template_parm_object (tree expr, tsubst_flags_t complain) { + tree orig = expr; if (TREE_CODE (expr) == TARGET_EXPR) expr = TARGET_EXPR_INITIAL (expr); if (!TREE_CONSTANT (expr)) { if ((complain & tf_error) - && require_rvalue_constant_expression (expr)) - cxx_constant_value (expr); + && require_rvalue_constant_expression (orig)) + cxx_constant_value (orig); return error_mark_node; } if (invalid_tparm_referent_p (TREE_TYPE (expr), expr, complain)) @@ -21179,7 +21185,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) case THROW_EXPR: RETURN (build_throw - (input_location, RECUR (TREE_OPERAND (t, 0)))); + (input_location, RECUR (TREE_OPERAND (t, 0)), complain)); case CONSTRUCTOR: { @@ -30681,7 +30687,7 @@ ctad_template_p (tree tmpl) type. */ static tree -do_class_deduction (tree ptype, tree tmpl, tree init, +do_class_deduction (tree ptype, tree tmpl, tree init, tree outer_targs, int flags, tsubst_flags_t complain) { /* We should have handled this in the caller. */ @@ -30743,6 +30749,23 @@ do_class_deduction (tree ptype, tree tmpl, tree init, if (type_dependent_expression_p (init)) return ptype; + if (outer_targs) + { + int args_depth = TMPL_ARGS_DEPTH (outer_targs); + int parms_depth = TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl)); + if (parms_depth > 1) + { + /* Substitute outer arguments into this CTAD template from the + current instantiation. */ + int want = std::min (args_depth, parms_depth - 1); + outer_targs = strip_innermost_template_args (outer_targs, + args_depth - want); + tmpl = tsubst (tmpl, outer_targs, complain, NULL_TREE); + if (tmpl == error_mark_node) + return error_mark_node; + } + } + /* Don't bother with the alias rules for an equivalent template. */ tmpl = get_underlying_template (tmpl); @@ -30998,7 +31021,7 @@ do_auto_deduction (tree type, tree init, tree auto_node, if (tree ctmpl = CLASS_PLACEHOLDER_TEMPLATE (auto_node)) /* C++17 class template argument deduction. */ - return do_class_deduction (type, ctmpl, init, flags, complain); + return do_class_deduction (type, ctmpl, init, outer_targs, flags, complain); if (init == NULL_TREE || TREE_TYPE (init) == NULL_TREE) /* Nothing we can do with this, even in deduction context. */ @@ -31575,13 +31598,15 @@ init_template_processing (void) void print_template_statistics (void) { - fprintf (stderr, "decl_specializations: size %ld, %ld elements, " - "%f collisions\n", (long) decl_specializations->size (), - (long) decl_specializations->elements (), + fprintf (stderr, "decl_specializations: size " HOST_SIZE_T_PRINT_DEC ", " + HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n", + (fmt_size_t) decl_specializations->size (), + (fmt_size_t) decl_specializations->elements (), decl_specializations->collisions ()); - fprintf (stderr, "type_specializations: size %ld, %ld elements, " - "%f collisions\n", (long) type_specializations->size (), - (long) type_specializations->elements (), + fprintf (stderr, "type_specializations: size " HOST_SIZE_T_PRINT_DEC ", " + HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n", + (fmt_size_t) type_specializations->size (), + (fmt_size_t) type_specializations->elements (), type_specializations->collisions ()); } diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 3299e27..5784017 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -4650,20 +4650,19 @@ finish_type_pack_element (tree idx, tree types, tsubst_flags_t complain) error ("%<__type_pack_element%> index is not an integral constant"); return error_mark_node; } - HOST_WIDE_INT val = tree_to_shwi (idx); - if (val < 0) + if (tree_int_cst_sgn (idx) < 0) { if (complain & tf_error) error ("%<__type_pack_element%> index is negative"); return error_mark_node; } - if (val >= TREE_VEC_LENGTH (types)) + if (wi::to_widest (idx) >= TREE_VEC_LENGTH (types)) { if (complain & tf_error) error ("%<__type_pack_element%> index is out of range"); return error_mark_node; } - return TREE_VEC_ELT (types, val); + return TREE_VEC_ELT (types, tree_to_shwi (idx)); } /* Implement the __direct_bases keyword: Return the direct base classes diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 50dc345..ad31271 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -2253,9 +2253,10 @@ debug_binfo (tree elem) while (virtuals) { tree fndecl = TREE_VALUE (virtuals); - fprintf (stderr, "%s [%ld =? %ld]\n", + fprintf (stderr, "%s [" HOST_WIDE_INT_PRINT_DEC " =? " + HOST_WIDE_INT_PRINT_DEC "]\n", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)), - (long) n, (long) TREE_INT_CST_LOW (DECL_VINDEX (fndecl))); + n, TREE_INT_CST_LOW (DECL_VINDEX (fndecl))); ++n; virtuals = TREE_CHAIN (virtuals); } diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 45dd031..76c07400 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,26 @@ +2024-02-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/113125 + * types.cc (TypeVisitor::visit (TypeStruct *)): Generate TYPE_DECL and + apply UDAs to opaque struct declarations. + +2024-02-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/113772 + * dmd/MERGE: Merge upstream dmd 11240a9663. + * d-builtins.cc (build_frontend_type): Update for new front-end + interface. + * types.cc (same_type_p): Likewise. + +2024-02-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/113758 + * d-codegen.cc (d_build_call): Force a TARGET_EXPR when callee + destorys its arguments. + * decl.cc (DeclVisitor::visit (VarDeclaration *)): Set + SET_DECL_VALUE_EXPR on the temporary variable to make it a placeholder + for the TARGET_EXPR_SLOT. + 2024-02-04 Iain Buclaw <ibuclaw@gdcproject.org> * dmd/MERGE: Merge upstream dmd a6f1083699. diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index 4ed8751..24ac456 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -97,12 +97,15 @@ build_frontend_type (tree type) { /* Check for char * first. Needs to be done for chars/string. */ if (TYPE_MAIN_VARIANT (TREE_TYPE (type)) == char_type_node) - return Type::tchar->addMod (dtype->mod)->pointerTo ()->addMod (mod); + { + dtype = addMod (Type::tchar, dtype->mod); + return addMod (dtype->pointerTo (), mod); + } if (dtype->ty == TY::Tfunction) - return (TypePointer::create (dtype))->addMod (mod); + return addMod (TypePointer::create (dtype), mod); - return dtype->pointerTo ()->addMod (mod); + return addMod (dtype->pointerTo (), mod); } break; @@ -113,7 +116,7 @@ build_frontend_type (tree type) /* Want to assign ctype directly so that the REFERENCE_TYPE code can be turned into as an `inout' argument. Can't use pointerTo(), because the returned Type is shared. */ - dtype = (TypePointer::create (dtype))->addMod (mod); + dtype = addMod (TypePointer::create (dtype), mod); dtype->ctype = type; builtin_converted_decls.safe_push (builtin_data (dtype, type)); return dtype; @@ -122,7 +125,7 @@ build_frontend_type (tree type) case BOOLEAN_TYPE: /* Should be no need for size checking. */ - return Type::tbool->addMod (mod); + return addMod (Type::tbool, mod); case INTEGER_TYPE: { @@ -140,7 +143,7 @@ build_frontend_type (tree type) || size != dtype->size ()) continue; - return dtype->addMod (mod); + return addMod (dtype, mod); } break; } @@ -157,7 +160,7 @@ build_frontend_type (tree type) if (dtype->size () != size) continue; - return dtype->addMod (mod); + return addMod (dtype, mod); } break; } @@ -174,13 +177,13 @@ build_frontend_type (tree type) if (dtype->size () != size) continue; - return dtype->addMod (mod); + return addMod (dtype, mod); } break; } case VOID_TYPE: - return Type::tvoid->addMod (mod); + return addMod (Type::tvoid, mod); case ARRAY_TYPE: dtype = build_frontend_type (TREE_TYPE (type)); @@ -194,7 +197,7 @@ build_frontend_type (tree type) length = size_binop (PLUS_EXPR, size_one_node, convert (sizetype, length)); - dtype = dtype->sarrayOf (TREE_INT_CST_LOW (length))->addMod (mod); + dtype = addMod (dtype->sarrayOf (TREE_INT_CST_LOW (length)), mod); builtin_converted_decls.safe_push (builtin_data (dtype, type)); return dtype; } @@ -210,11 +213,11 @@ build_frontend_type (tree type) if (!dtype) break; - dtype = dtype->sarrayOf (nunits)->addMod (mod); + dtype = addMod (dtype->sarrayOf (nunits), mod); if (target.isVectorTypeSupported (dtype->size (), dtype->nextOf ())) break; - dtype = (TypeVector::create (dtype))->addMod (mod); + dtype = addMod (TypeVector::create (dtype), mod); builtin_converted_decls.safe_push (builtin_data (dtype, type)); return dtype; } @@ -238,7 +241,7 @@ build_frontend_type (tree type) sdecl->alignsize = TYPE_ALIGN_UNIT (type); sdecl->alignment.setDefault (); sdecl->sizeok = Sizeok::done; - sdecl->type = (TypeStruct::create (sdecl))->addMod (mod); + sdecl->type = addMod (TypeStruct::create (sdecl), mod); sdecl->type->ctype = type; merge2 (sdecl->type); @@ -331,7 +334,7 @@ build_frontend_type (tree type) if (args->length != 0 || varargs_p == VARARGnone) { dtype = TypeFunction::create (args, dtype, varargs_p, LINK::c); - return dtype->addMod (mod); + return addMod (dtype, mod); } } break; diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index 95dc8b6..dc52816 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -2270,10 +2270,17 @@ d_build_call (TypeFunction *tf, tree callable, tree object, Type *t = arg->type->toBasetype (); StructDeclaration *sd = t->baseElemOf ()->isTypeStruct ()->sym; - /* Nested structs also have ADDRESSABLE set, but if the type has - neither a copy constructor nor a destructor available, then we - need to take care of copying its value before passing it. */ - if (arg->op == EXP::structLiteral || (!sd->postblit && !sd->dtor)) + /* Need to take care of copying its value before passing the + argument in the following scenarios: + - The argument is a literal expression; a CONSTRUCTOR can't + have its address taken. + - The type has neither a copy constructor nor a destructor + available; nested structs also have ADDRESSABLE set. + - The ABI of the function expects the callee to destroy its + arguments; when the caller is handles destruction, then `targ' + has already been made into a temporary. */ + if (arg->op == EXP::structLiteral || (!sd->postblit && !sd->dtor) + || target.isCalleeDestroyingArgs (tf)) targ = force_target_expr (targ); targ = convert (build_reference_type (TREE_TYPE (targ)), diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index d2e84d3..827495b 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -863,10 +863,28 @@ public: /* Maybe put variable on list of things needing destruction. */ if (d->needsScopeDtor ()) { + /* Rewrite: `decl = exp' => TARGET_EXPR(decl, exp, dtor). */ vec_safe_push (d_function_chain->vars_in_scope, decl); + /* Force a TARGET_EXPR to add the corresponding cleanup. */ - exp = force_target_expr (compound_expr (exp, decl)); - TARGET_EXPR_CLEANUP (exp) = build_expr (d->edtor); + if (TREE_CODE (exp) != TARGET_EXPR) + { + if (VOID_TYPE_P (TREE_TYPE (exp))) + exp = compound_expr (exp, decl); + + exp = force_target_expr (exp); + } + + TARGET_EXPR_CLEANUP (exp) + = compound_expr (TARGET_EXPR_CLEANUP (exp), + build_expr (d->edtor)); + + /* The decl is really an alias for the TARGET_EXPR slot. */ + SET_DECL_VALUE_EXPR (decl, TARGET_EXPR_SLOT (exp)); + DECL_HAS_VALUE_EXPR_P (decl) = 1; + /* This tells the gimplifier not to emit a clobber for the decl + as its lifetime ends when the slot gets cleaned up. */ + TREE_ADDRESSABLE (decl) = 0; } add_stmt (exp); diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 57ac2dc..74c1945 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -a6f10836997d0b5526c8c363d781b4029c77f09f +11240a96635074b2f79d908b9348e9c0fbc3c7dc The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/aggregate.d b/gcc/d/dmd/aggregate.d index 2d32042..2c7622a 100644 --- a/gcc/d/dmd/aggregate.d +++ b/gcc/d/dmd/aggregate.d @@ -37,7 +37,7 @@ import dmd.identifier; import dmd.location; import dmd.mtype; import dmd.tokens; -import dmd.typesem : defaultInit; +import dmd.typesem : defaultInit, addMod; import dmd.visitor; /** diff --git a/gcc/d/dmd/aggregate.h b/gcc/d/dmd/aggregate.h index f466ba6..6a86400 100644 --- a/gcc/d/dmd/aggregate.h +++ b/gcc/d/dmd/aggregate.h @@ -42,6 +42,7 @@ enum class Baseok : uint8_t }; FuncDeclaration *search_toString(StructDeclaration *sd); +void semanticTypeInfoMembers(StructDeclaration *sd); enum class ClassKind : uint8_t { diff --git a/gcc/d/dmd/astcodegen.d b/gcc/d/dmd/astcodegen.d index f179077..fd8387a 100644 --- a/gcc/d/dmd/astcodegen.d +++ b/gcc/d/dmd/astcodegen.d @@ -82,6 +82,7 @@ struct ASTCodegen alias Tcomplex64 = dmd.mtype.Tcomplex64; alias Tcomplex80 = dmd.mtype.Tcomplex80; + alias ModToStc = dmd.mtype.ModToStc; alias ParameterList = dmd.mtype.ParameterList; alias VarArg = dmd.mtype.VarArg; alias STC = dmd.declaration.STC; diff --git a/gcc/d/dmd/astenums.d b/gcc/d/dmd/astenums.d index 77940b8..4fc1514 100644 --- a/gcc/d/dmd/astenums.d +++ b/gcc/d/dmd/astenums.d @@ -152,7 +152,7 @@ bool isRefReturnScope(const ulong stc) /* This is different from the one in declaration.d, make that fix a separate PR */ static if (0) -extern (C++) __gshared const(StorageClass) STCStorageClass = +__gshared const(StorageClass) STCStorageClass = (STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.const_ | STC.final_ | STC.abstract_ | STC.synchronized_ | STC.deprecated_ | STC.override_ | STC.lazy_ | STC.alias_ | STC.out_ | STC.in_ | STC.manifest | STC.immutable_ | STC.shared_ | diff --git a/gcc/d/dmd/clone.d b/gcc/d/dmd/clone.d index 46470ee..2e4833e 100644 --- a/gcc/d/dmd/clone.d +++ b/gcc/d/dmd/clone.d @@ -327,10 +327,19 @@ FuncDeclaration buildOpAssign(StructDeclaration sd, Scope* sc) auto e2 = new BlitExp(loc, new VarExp(loc, swap), new ThisExp(loc)); auto e3 = new BlitExp(loc, new ThisExp(loc), new IdentifierExp(loc, Id.p)); - /* Instead of running the destructor on s, run it - * on swap. This avoids needing to copy swap back in to s. - */ - auto e4 = new CallExp(loc, new DotVarExp(loc, new VarExp(loc, swap), sd.dtor, false)); + Expression e4; + if (target.isCalleeDestroyingArgs(tf)) + { /* callee destroys s + * Instead of running the destructor on s, run it + * on swap. + */ + e4 = new CallExp(loc, new DotVarExp(loc, new VarExp(loc, swap), sd.dtor, false)); + } + else + { /* caller destroys s, so copy contents of swap back into s + */ + e4 = new BlitExp(loc, new IdentifierExp(loc, Id.p), new VarExp(loc, swap)); + } e = Expression.combine(e1, e2, e3, e4); } diff --git a/gcc/d/dmd/constfold.d b/gcc/d/dmd/constfold.d index f5d2b60..0686e1b 100644 --- a/gcc/d/dmd/constfold.d +++ b/gcc/d/dmd/constfold.d @@ -36,6 +36,7 @@ import dmd.root.utf; import dmd.sideeffect; import dmd.target; import dmd.tokens; +import dmd.typesem : toDsymbol, equivalent; private enum LOG = false; @@ -1038,7 +1039,6 @@ UnionExp Cast(const ref Loc loc, Type type, Type to, Expression e1) else if (tb.ty == Tstruct && e1.op == EXP.int64) { // Struct = 0; - import dmd.typesem : toDsymbol; StructDeclaration sd = tb.toDsymbol(null).isStructDeclaration(); assert(sd); auto elements = new Expressions(); diff --git a/gcc/d/dmd/dcast.d b/gcc/d/dmd/dcast.d index 9ee8e8c..a49bd57 100644 --- a/gcc/d/dmd/dcast.d +++ b/gcc/d/dmd/dcast.d @@ -235,7 +235,7 @@ Expression implicitCastTo(Expression e, Scope* sc, Type t) * Returns: * The `MATCH` level between `e.type` and `t`. */ -extern(C++) MATCH implicitConvTo(Expression e, Type t) +MATCH implicitConvTo(Expression e, Type t) { MATCH visit(Expression e) { @@ -2848,7 +2848,7 @@ private bool isVoidArrayLiteral(Expression e, Type other) */ Type typeMerge(Scope* sc, EXP op, ref Expression pe1, ref Expression pe2) { - //printf("typeMerge() %s op %s\n", e1.toChars(), e2.toChars()); + //printf("typeMerge() %s op %s\n", pe1.toChars(), pe2.toChars()); Expression e1 = pe1; Expression e2 = pe2; @@ -3165,6 +3165,9 @@ Lagain: goto Lagain; } +LmergeClassTypes: + /* Merge different type modifiers on classes + */ if (t1.ty == Tclass && t2.ty == Tclass) { if (t1.mod != t2.mod) @@ -3233,9 +3236,23 @@ Lagain: if (t1.ty == Tclass && t2.ty == Tclass) { + /* t1 cannot be converted to t2, and vice versa + */ TypeClass tc1 = t1.isTypeClass(); TypeClass tc2 = t2.isTypeClass(); + //if (tc1.sym.interfaces.length || tc2.sym.interfaces.length) + if (tc1.sym.isInterfaceDeclaration() || + tc2.sym.isInterfaceDeclaration()) + { + ClassDeclaration cd = findClassCommonRoot(tc1.sym, tc2.sym); + if (!cd) + return null; // no common root + t1 = cd.type.castMod(t1.mod); + t2 = cd.type.castMod(t2.mod); + goto LmergeClassTypes; // deal with mod differences + } + /* Pick 'tightest' type */ ClassDeclaration cd1 = tc1.sym.baseClass; @@ -3251,6 +3268,7 @@ Lagain: t2 = cd2.type; else return null; + goto LmergeClassTypes; } else if (t1.ty == Tstruct && t1.isTypeStruct().sym.aliasthis) { @@ -3582,6 +3600,71 @@ LmodCompare: return null; } +/********************************** + * Find common root that both cd1 and cd2 can be implicitly converted to. + * Params: + * cd1 = first class + * cd2 = second class + * Returns: + * common base that both can implicitly convert to, null if none or + * multiple matches + */ +private +ClassDeclaration findClassCommonRoot(ClassDeclaration cd1, ClassDeclaration cd2) +{ + enum log = false; + if (log) printf("findClassCommonRoot(%s, %s)\n", cd1.toChars(), cd2.toChars()); + /* accumulate results in this */ + static struct Root + { + ClassDeclaration cd; + bool error; + + /* merge cd into results */ + void accumulate(ClassDeclaration cd) + { + if (log) printf(" accumulate(r.cd: %s r.error: %d cd: %s)\n", this.cd ? this.cd.toChars() : "null", error, cd ? cd.toChars() : null); + if (this.cd is cd) + { + } + else if (!this.cd) + this.cd = cd; + else + error = true; + } + } + + /* Find common root of cd1 and cd2. Accumulate results in r. depth is nesting level */ + void findCommonRoot(ClassDeclaration cd1, ClassDeclaration cd2, ref Root r) + { + if (log) printf("findCommonRoot(cd1: %s cd2: %s)\n", cd1.toChars(), cd2.toChars()); + /* Warning: quadratic time function + */ + if (cd1 is cd2) + { + r.accumulate(cd1); + return; + } + + foreach (b1; (*cd1.baseclasses)[]) + { + if (b1.sym != r.cd) + findCommonRoot(cd2, b1.sym, r); + } + foreach (b2; (*cd2.baseclasses)[]) + { + if (b2.sym != r.cd) + findCommonRoot(cd1, b2.sym, r); + } + } + + Root r; + findCommonRoot(cd1, cd2, r); + if (!r.cd || r.error) + return null; // no common root + return r.cd; +} + /************************************ * Bring leaves to common type. * Returns: diff --git a/gcc/d/dmd/declaration.d b/gcc/d/dmd/declaration.d index 93ef63f..3f9769d 100644 --- a/gcc/d/dmd/declaration.d +++ b/gcc/d/dmd/declaration.d @@ -213,7 +213,7 @@ bool modifyFieldVar(Loc loc, Scope* sc, VarDeclaration var, Expression e1) /****************************************** */ -extern (C++) void ObjectNotFound(Identifier id) +void ObjectNotFound(Identifier id) { error(Loc.initial, "`%s` not found. object.d may be incorrectly installed or corrupt.", id.toChars()); fatal(); @@ -1380,7 +1380,7 @@ extern (C++) class VarDeclaration : Declaration */ final bool needsScopeDtor() { - //printf("VarDeclaration::needsScopeDtor() %s\n", toChars()); + //printf("VarDeclaration::needsScopeDtor() %s %d\n", toChars(), edtor && !(storage_class & STC.nodtor)); return edtor && !(storage_class & STC.nodtor); } diff --git a/gcc/d/dmd/declaration.h b/gcc/d/dmd/declaration.h index afbb997..a393da8 100644 --- a/gcc/d/dmd/declaration.h +++ b/gcc/d/dmd/declaration.h @@ -107,8 +107,6 @@ bool functionSemantic3(FuncDeclaration* fd); #define STC_TYPECTOR (STCconst | STCimmutable | STCshared | STCwild) #define STC_FUNCATTR (STCref | STCnothrow | STCnogc | STCpure | STCproperty | STCsafe | STCtrusted | STCsystem) -void ObjectNotFound(Identifier *id); - /**************************************************************/ class Declaration : public Dsymbol diff --git a/gcc/d/dmd/dinterpret.d b/gcc/d/dmd/dinterpret.d index b078542..c3395a5 100644 --- a/gcc/d/dmd/dinterpret.d +++ b/gcc/d/dmd/dinterpret.d @@ -50,7 +50,7 @@ import dmd.rootobject; import dmd.root.utf; import dmd.statement; import dmd.tokens; -import dmd.typesem : mutableOf; +import dmd.typesem : mutableOf, equivalent; import dmd.utils : arrayCastBigEndian; import dmd.visitor; diff --git a/gcc/d/dmd/dsymbol.h b/gcc/d/dmd/dsymbol.h index e463d3d..db23627 100644 --- a/gcc/d/dmd/dsymbol.h +++ b/gcc/d/dmd/dsymbol.h @@ -427,7 +427,5 @@ public: void addMember(Dsymbol *dsym, Scope *sc, ScopeDsymbol *sds); Dsymbol *search(Dsymbol *d, const Loc &loc, Identifier *ident, SearchOptFlags flags = (SearchOptFlags)SearchOpt::localsOnly); -bool checkDeprecated(Dsymbol *d, const Loc &loc, Scope *sc); void setScope(Dsymbol *d, Scope *sc); void importAll(Dsymbol *d, Scope *sc); -void setFieldOffset(Dsymbol *d, AggregateDeclaration *ad, FieldState& fieldState, bool isunion); diff --git a/gcc/d/dmd/dsymbolsem.d b/gcc/d/dmd/dsymbolsem.d index 33a397a..4a4d82f 100644 --- a/gcc/d/dmd/dsymbolsem.d +++ b/gcc/d/dmd/dsymbolsem.d @@ -6907,7 +6907,7 @@ extern(C++) class ImportAllVisitor : Visitor override void visit(StaticForeachDeclaration _) {} } -extern(C++) void setFieldOffset(Dsymbol d, AggregateDeclaration ad, FieldState* fieldState, bool isunion) +void setFieldOffset(Dsymbol d, AggregateDeclaration ad, FieldState* fieldState, bool isunion) { scope v = new SetFieldOffsetVisitor(ad, fieldState, isunion); d.accept(v); diff --git a/gcc/d/dmd/errors.h b/gcc/d/dmd/errors.h index 308e81e..a47b5aa 100644 --- a/gcc/d/dmd/errors.h +++ b/gcc/d/dmd/errors.h @@ -24,8 +24,6 @@ enum class ErrorKind message = 4, }; -bool isConsoleColorSupported(); - #if defined(__GNUC__) #define D_ATTRIBUTE_FORMAT(m, n) __attribute__((format(printf, m, n))) __attribute__((nonnull (m))) #else diff --git a/gcc/d/dmd/expression.h b/gcc/d/dmd/expression.h index f713d25..8dbb4a6 100644 --- a/gcc/d/dmd/expression.h +++ b/gcc/d/dmd/expression.h @@ -46,15 +46,15 @@ typedef union tree_node Symbol; struct Symbol; // back end symbol #endif +// in expressionsem.d +Expression *expressionSemantic(Expression *e, Scope *sc); +// in typesem.d +Expression *defaultInit(Type *mt, const Loc &loc, const bool isCfile = false); + // Entry point for CTFE. // A compile-time result is required. Give an error if not possible Expression *ctfeInterpret(Expression *e); void expandTuples(Expressions *exps, Identifiers *names = nullptr); -StringExp *toUTF8(StringExp *se, Scope *sc); -Expression *resolveLoc(Expression *exp, const Loc &loc, Scope *sc); -MATCH implicitConvTo(Expression *e, Type *t); -Expression *toLvalue(Expression *_this, Scope *sc, const char* action); -Expression *modifiableLvalue(Expression* exp, Scope *sc); Expression *optimize(Expression *exp, int result, bool keepLvalue = false); typedef unsigned char OwnedBy; diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d index d7377db..9028ba1 100644 --- a/gcc/d/dmd/expressionsem.d +++ b/gcc/d/dmd/expressionsem.d @@ -2523,7 +2523,7 @@ private bool checkRightThis(Expression e, Scope* sc) return false; } -extern (C++) Expression resolveProperties(Scope* sc, Expression e) +Expression resolveProperties(Scope* sc, Expression e) { //printf("resolveProperties(%s)\n", e.toChars()); e = resolvePropertiesX(sc, e); @@ -3464,12 +3464,12 @@ private bool functionParameters(const ref Loc loc, Scope* sc, eprefix = ae.expressionSemantic(sc); } - for (ptrdiff_t i = 0; i != nargs; i++) + foreach (ptrdiff_t i; 0 .. nargs) { Expression arg = (*arguments)[i]; //printf("arg[%d]: %s\n", cast(int)i, arg.toChars()); - Parameter parameter = (i >= nparams ? null : tf.parameterList[i]); + Parameter parameter = i < nparams ? tf.parameterList[i] : null; const bool isRef = parameter && parameter.isReference(); const bool isLazy = parameter && parameter.isLazy(); @@ -3485,7 +3485,7 @@ private bool functionParameters(const ref Loc loc, Scope* sc, * 'eprefix' will therefore finally contain all args up to and including 'lastPrefix', * excluding all lazy parameters. */ - if (needsPrefix && (lastPrefix - i) >= 0) + if (needsPrefix && i <= lastPrefix) { const bool needsDtor = !isRef && arg.type.needsDestruction() && // Problem 3: last throwing arg doesn't require dtor patching @@ -3494,9 +3494,9 @@ private bool functionParameters(const ref Loc loc, Scope* sc, /* Declare temporary 'auto __pfx = arg' (needsDtor) or 'auto __pfy = arg' (!needsDtor) */ auto tmp = copyToTemp( - (parameter ? parameter.storageClass : tf.parameterList.stc) & (STC.scope_), + (parameter ? parameter.storageClass : tf.parameterList.stc) & (STC.return_ | STC.scope_), needsDtor ? "__pfx" : "__pfy", - !isRef ? arg : arg.addressOf()); + isRef ? arg.addressOf() : arg); tmp.dsymbolSemantic(sc); if (callerDestroysArgs) @@ -3511,15 +3511,7 @@ private bool functionParameters(const ref Loc loc, Scope* sc, /* Problem 2: Modify the destructor so it only runs if gate==false, * i.e., only if there was a throw while constructing the args */ - if (!needsDtor) - { - if (tmp.edtor) - { - assert(i == lastPrefix); - tmp.edtor = null; - } - } - else + if (needsDtor) { // edtor => (__gate || edtor) assert(tmp.edtor); @@ -3528,6 +3520,14 @@ private bool functionParameters(const ref Loc loc, Scope* sc, tmp.edtor = e.expressionSemantic(sc); //printf("edtor: %s\n", tmp.edtor.toChars()); } + else + { + if (tmp.edtor) + { + assert(i == lastPrefix); + tmp.edtor = null; + } + } } // eprefix => (eprefix, auto __pfx/y = arg) @@ -15534,7 +15534,7 @@ Expression addDtorHook(Expression e, Scope* sc) * action = for error messages, what the lvalue is needed for (e.g. take address of for `&x`, modify for `x++`) * Returns: converted expression, or `ErrorExp` on error */ -extern(C++) Expression toLvalue(Expression _this, Scope* sc, const(char)* action) +Expression toLvalue(Expression _this, Scope* sc, const(char)* action) { return toLvalueImpl(_this, sc, action, _this); } @@ -15955,7 +15955,7 @@ Modifiable checkModifiable(Expression exp, Scope* sc, ModifyFlags flag = ModifyF * sc = scope * Returns: `_this` converted to an lvalue, or an `ErrorExp` */ -extern(C++) Expression modifiableLvalue(Expression _this, Scope* sc) +Expression modifiableLvalue(Expression _this, Scope* sc) { return modifiableLvalueImpl(_this, sc, _this); } diff --git a/gcc/d/dmd/func.d b/gcc/d/dmd/func.d index ddf21a2..4881ad6 100644 --- a/gcc/d/dmd/func.d +++ b/gcc/d/dmd/func.d @@ -60,6 +60,7 @@ import dmd.statement; import dmd.statementsem; import dmd.templatesem; import dmd.tokens; +import dmd.typesem; import dmd.visitor; version (IN_GCC) {} @@ -518,7 +519,6 @@ extern (C++) class FuncDeclaration : Declaration int result = 0; if (fd.ident == ident) { - import dmd.typesem : covariant; const cov = type.covariant(fd.type); if (cov != Covariant.distinct) { @@ -625,7 +625,6 @@ extern (C++) class FuncDeclaration : Declaration */ if (t.ty == Tfunction) { - import dmd.typesem : covariant; auto tf = cast(TypeFunction)f.type; if (tf.covariant(t) == Covariant.yes && tf.nextOf().implicitConvTo(t.nextOf()) >= MATCH.constant) @@ -840,7 +839,6 @@ extern (C++) class FuncDeclaration : Declaration args.push(e); } - import dmd.typesem : callMatch; MATCH m = tg.callMatch(null, ArgumentList(&args, names), 1); if (m > MATCH.nomatch) { @@ -1151,7 +1149,6 @@ extern (C++) class FuncDeclaration : Declaration { //printf("FuncDeclaration::isPure() '%s'\n", toChars()); - import dmd.typesem : purityLevel; TypeFunction tf = type.toTypeFunction(); if (purityInprocess) @@ -1464,7 +1461,6 @@ extern (C++) class FuncDeclaration : Declaration case Tstruct: /* Drill down and check the struct's fields */ - import dmd.typesem : toDsymbol; auto sym = t.toDsymbol(null).isStructDeclaration(); const tName = t.toChars.toDString; const entry = parentTypes.insert(tName, t); @@ -1546,7 +1542,6 @@ extern (C++) class FuncDeclaration : Declaration case Tstruct: /* Drill down and check the struct's fields */ - import dmd.typesem : toDsymbol; auto sym = tp.toDsymbol(null).isStructDeclaration(); foreach (v; sym.fields) { @@ -2411,7 +2406,6 @@ extern (C++) class FuncDeclaration : Declaration { Type t1 = fdv.type.nextOf().toBasetype(); Type t2 = this.type.nextOf().toBasetype(); - import dmd.typesem : isBaseOf; if (t1.isBaseOf(t2, null)) { /* Making temporary reference variable is necessary @@ -3325,7 +3319,6 @@ if (is(Decl == TemplateDeclaration) || is(Decl == FuncDeclaration)) */ Type getIndirection(Type t) { - import dmd.typesem : hasPointers; t = t.baseElemOf(); if (t.ty == Tarray || t.ty == Tpointer) return t.nextOf().toBasetype(); @@ -3372,7 +3365,6 @@ private bool traverseIndirections(Type ta, Type tb) static bool traverse(Type ta, Type tb, ref scope AssocArray!(const(char)*, bool) table, bool reversePass) { - import dmd.typesem : hasPointers; //printf("traverse(%s, %s)\n", ta.toChars(), tb.toChars()); ta = ta.baseElemOf(); tb = tb.baseElemOf(); @@ -3409,7 +3401,6 @@ private bool traverseIndirections(Type ta, Type tb) else *found = true; - import dmd.typesem : toDsymbol; AggregateDeclaration sym = tb.toDsymbol(null).isAggregateDeclaration(); foreach (v; sym.fields) { diff --git a/gcc/d/dmd/hdrgen.h b/gcc/d/dmd/hdrgen.h index e38ca56..e0a2046 100644 --- a/gcc/d/dmd/hdrgen.h +++ b/gcc/d/dmd/hdrgen.h @@ -13,9 +13,17 @@ #include "globals.h" #include "mtype.h" +class Expression; +class Initializer; class Module; +class Statement; void genhdrfile(Module *m, bool doFuncBodies, OutBuffer &buf); void genCppHdrFiles(Modules &ms); void moduleToBuffer(OutBuffer& buf, bool vcg_ast, Module *m); const char *parametersTypeToChars(ParameterList pl); + +const char* toChars(const Expression* const e); +const char* toChars(const Initializer* const i); +const char* toChars(const Statement* const s); +const char* toChars(const Type* const t); diff --git a/gcc/d/dmd/init.h b/gcc/d/dmd/init.h index b4e15e3..cccd3c9 100644 --- a/gcc/d/dmd/init.h +++ b/gcc/d/dmd/init.h @@ -125,3 +125,4 @@ public: }; Expression *initializerToExpression(Initializer *init, Type *t = NULL, const bool isCfile = false); +Initializer *initializerSemantic(Initializer *init, Scope *sc, Type *&tx, NeedInterpret needInterpret); diff --git a/gcc/d/dmd/mtype.d b/gcc/d/dmd/mtype.d index c46f560..4f8ed75 100644 --- a/gcc/d/dmd/mtype.d +++ b/gcc/d/dmd/mtype.d @@ -444,11 +444,6 @@ extern (C++) abstract class Type : ASTNode return false; } - final bool equivalent(Type t) - { - return immutableOf(this).equals(t.immutableOf()); - } - // kludge for template.isType() override final DYNCAST dyncast() const { @@ -1192,111 +1187,6 @@ extern (C++) abstract class Type : ASTNode } /************************************ - * Add MODxxxx bits to existing type. - * We're adding, not replacing, so adding const to - * a shared type => "shared const" - */ - final Type addMod(MOD mod) - { - /* Add anything to immutable, and it remains immutable - */ - Type t = this; - if (!t.isImmutable()) - { - //printf("addMod(%x) %s\n", mod, toChars()); - switch (mod) - { - case 0: - break; - - case MODFlags.const_: - if (isShared()) - { - if (isWild()) - t = this.sharedWildConstOf(); - else - t = this.sharedConstOf(); - } - else - { - if (this.isWild()) - t = this.wildConstOf(); - else - t = t.constOf(); - } - break; - - case MODFlags.wild: - if (isShared()) - { - if (isConst()) - t = this.sharedWildConstOf(); - else - t = this.sharedWildOf(); - } - else - { - if (isConst()) - t = this.wildConstOf(); - else - t = this.wildOf(); - } - break; - - case MODFlags.wildconst: - if (isShared()) - t = this.sharedWildConstOf(); - else - t = this.wildConstOf(); - break; - - case MODFlags.shared_: - if (isWild()) - { - if (isConst()) - t = this.sharedWildConstOf(); - else - t = this.sharedWildOf(); - } - else - { - if (isConst()) - t = this.sharedConstOf(); - else - t = this.sharedOf(); - } - break; - - case MODFlags.shared_ | MODFlags.const_: - if (isWild()) - t = this.sharedWildConstOf(); - else - t = this.sharedConstOf(); - break; - - case MODFlags.shared_ | MODFlags.wild: - if (isConst()) - t = this.sharedWildConstOf(); - else - t = this.sharedWildOf(); - break; - - case MODFlags.shared_ | MODFlags.wildconst: - t = this.sharedWildConstOf(); - break; - - case MODFlags.immutable_: - t = this.immutableOf(); - break; - - default: - assert(0); - } - } - return t; - } - - /************************************ * Add storage class modifiers to type. */ Type addStorageClass(StorageClass stc) @@ -1315,7 +1205,7 @@ extern (C++) abstract class Type : ASTNode if (stc & STC.shared_) mod |= MODFlags.shared_; } - return addMod(mod); + return this.addMod(mod); } final Type pointerTo() diff --git a/gcc/d/dmd/mtype.h b/gcc/d/dmd/mtype.h index a7a41c6..df8cc4d 100644 --- a/gcc/d/dmd/mtype.h +++ b/gcc/d/dmd/mtype.h @@ -39,7 +39,6 @@ typedef union tree_node type; typedef struct TYPE type; #endif -extern const char* toChars(const Type* const t); Type *typeSemantic(Type *t, const Loc &loc, Scope *sc); Type *merge(Type *type); @@ -218,7 +217,6 @@ public: Type *copy() const; virtual Type *syntaxCopy(); bool equals(const RootObject * const o) const override; - bool equivalent(Type *t); // kludge for template.isType() DYNCAST dyncast() const override final { return DYNCAST_TYPE; } size_t getUniqueID() const; @@ -253,7 +251,6 @@ public: bool isSharedWild() const { return (mod & (MODshared | MODwild)) == (MODshared | MODwild); } bool isNaked() const { return mod == 0; } Type *nullAttributes() const; - Type *addMod(MOD mod); virtual Type *addStorageClass(StorageClass stc); Type *pointerTo(); Type *referenceTo(); @@ -889,10 +886,10 @@ AggregateDeclaration *isAggregate(Type *t); bool hasPointers(Type *t); // return the symbol to which type t resolves Dsymbol *toDsymbol(Type *t, Scope *sc); +bool equivalent(Type *src, Type *t); Covariant covariant(Type *, Type *, StorageClass * = NULL, bool = false); bool isBaseOf(Type *tthis, Type *t, int *poffset); Type *trySemantic(Type *type, const Loc &loc, Scope *sc); -void purityLevel(TypeFunction *type); Type *merge2(Type *type); Type *constOf(Type *type); Type *immutableOf(Type *type); @@ -905,3 +902,4 @@ Type *wildConstOf(Type *type); Type *sharedWildOf(Type *type); Type *sharedWildConstOf(Type *type); Type *castMod(Type *type, MOD mod); +Type *addMod(Type *type, MOD mod); diff --git a/gcc/d/dmd/parse.d b/gcc/d/dmd/parse.d index 0dc54ff..2d2e6fd 100644 --- a/gcc/d/dmd/parse.d +++ b/gcc/d/dmd/parse.d @@ -8730,7 +8730,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer else { AST.Type t = parseType(); // cast( type ) - t = t.addMod(m); // cast( const type ) + t = t.addSTC(AST.ModToStc(m)); // cast( const type ) check(TOK.rightParenthesis); e = parseUnaryExp(); e = new AST.CastExp(loc, e, t); diff --git a/gcc/d/dmd/statement.h b/gcc/d/dmd/statement.h index ee03d49..8a6bf3d 100644 --- a/gcc/d/dmd/statement.h +++ b/gcc/d/dmd/statement.h @@ -701,7 +701,12 @@ public: void accept(Visitor *v) override { v->visit(this); } }; +// in statementsem.d +Statement* statementSemantic(Statement *s, Scope *sc); +// in iasm.d Statement* asmSemantic(AsmStatement *s, Scope *sc); +// in iasmgcc.d +Statement *gccAsmSemantic(GccAsmStatement *s, Scope *sc); class AsmStatement : public Statement { diff --git a/gcc/d/dmd/template.h b/gcc/d/dmd/template.h index 153eb4e..c80f28b 100644 --- a/gcc/d/dmd/template.h +++ b/gcc/d/dmd/template.h @@ -317,6 +317,9 @@ public: void accept(Visitor *v) override { v->visit(this); } }; +// in templateparamsem.d +bool tpsemantic(TemplateParameter *tp, Scope *sc, TemplateParameters *parameters); + Expression *isExpression(RootObject *o); Dsymbol *isDsymbol(RootObject *o); Type *isType(RootObject *o); diff --git a/gcc/d/dmd/typesem.d b/gcc/d/dmd/typesem.d index b1ca92d..19c6912 100644 --- a/gcc/d/dmd/typesem.d +++ b/gcc/d/dmd/typesem.d @@ -520,7 +520,7 @@ int mutabilityOfType(bool isref, Type t) * Set 'purity' field of 'typeFunction'. * Do this lazily, as the parameter types might be forward referenced. */ -extern(C++) void purityLevel(TypeFunction typeFunction) +void purityLevel(TypeFunction typeFunction) { TypeFunction tf = typeFunction; if (tf.purity != PURE.fwdref) @@ -6106,6 +6106,11 @@ extern(C++) bool isBaseOf(Type tthis, Type t, int* poffset) return false; } +extern(C++) bool equivalent(Type src, Type t) +{ + return immutableOf(src).equals(t.immutableOf()); +} + /******************************** * Convert to 'const'. */ @@ -6405,6 +6410,111 @@ extern(C++) Type castMod(Type type, MOD mod) return t; } +/************************************ + * Add MODxxxx bits to existing type. + * We're adding, not replacing, so adding const to + * a shared type => "shared const" + */ +extern(C++) Type addMod(Type type, MOD mod) +{ + /* Add anything to immutable, and it remains immutable + */ + Type t = type; + if (!t.isImmutable()) + { + //printf("addMod(%x) %s\n", mod, toChars()); + switch (mod) + { + case 0: + break; + + case MODFlags.const_: + if (type.isShared()) + { + if (type.isWild()) + t = type.sharedWildConstOf(); + else + t = type.sharedConstOf(); + } + else + { + if (type.isWild()) + t = type.wildConstOf(); + else + t = t.constOf(); + } + break; + + case MODFlags.wild: + if (type.isShared()) + { + if (type.isConst()) + t = type.sharedWildConstOf(); + else + t = type.sharedWildOf(); + } + else + { + if (type.isConst()) + t = type.wildConstOf(); + else + t = type.wildOf(); + } + break; + + case MODFlags.wildconst: + if (type.isShared()) + t = type.sharedWildConstOf(); + else + t = type.wildConstOf(); + break; + + case MODFlags.shared_: + if (type.isWild()) + { + if (type.isConst()) + t = type.sharedWildConstOf(); + else + t = type.sharedWildOf(); + } + else + { + if (type.isConst()) + t = type.sharedConstOf(); + else + t = type.sharedOf(); + } + break; + + case MODFlags.shared_ | MODFlags.const_: + if (type.isWild()) + t = type.sharedWildConstOf(); + else + t = type.sharedConstOf(); + break; + + case MODFlags.shared_ | MODFlags.wild: + if (type.isConst()) + t = type.sharedWildConstOf(); + else + t = type.sharedWildOf(); + break; + + case MODFlags.shared_ | MODFlags.wildconst: + t = type.sharedWildConstOf(); + break; + + case MODFlags.immutable_: + t = type.immutableOf(); + break; + + default: + assert(0); + } + } + return t; +} + /******************************* Private *****************************************/ private: diff --git a/gcc/d/types.cc b/gcc/d/types.cc index 4e14b15..ed97aa3 100644 --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -144,7 +144,7 @@ same_type_p (Type *t1, Type *t2) return true; /* Types are mutably the same type. */ - if (tb1->ty == tb2->ty && tb1->equivalent (tb2)) + if (tb1->ty == tb2->ty && equivalent (tb1, tb2)) return true; return false; @@ -1230,6 +1230,11 @@ public: apply_user_attributes (t->sym, t->ctype); finish_aggregate_type (structsize, alignsize, t->ctype); } + else + { + build_type_decl (t->ctype, t->sym); + apply_user_attributes (t->sym, t->ctype); + } /* For structs with a user defined postblit, copy constructor, or a destructor, also set TREE_ADDRESSABLE on the type and all variants. diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index 7918bd7..f5e1e50 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -123,12 +123,12 @@ extern bool emit_diagnostic (diagnostic_t, rich_location *, int, const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); extern bool emit_diagnostic_valist (diagnostic_t, location_t, int, const char *, va_list *) ATTRIBUTE_GCC_DIAG (4,0); -extern bool emit_diagnostic_valist (diagnostic_t, - rich_location *, - const diagnostic_metadata *, - int, - const char *, - va_list *) ATTRIBUTE_GCC_DIAG (5,0); +extern bool emit_diagnostic_valist_meta (diagnostic_t, + rich_location *, + const diagnostic_metadata *, + int, + const char *, + va_list *) ATTRIBUTE_GCC_DIAG (5,0); extern bool seen_error (void); #ifdef BUFSIZ diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index f5411b1..1d143fa 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -1837,11 +1837,11 @@ emit_diagnostic_valist (diagnostic_t kind, location_t location, int opt, /* As above, but with rich_location and metadata. */ bool -emit_diagnostic_valist (diagnostic_t kind, - rich_location *richloc, - const diagnostic_metadata *metadata, - int opt, - const char *gmsgid, va_list *ap) +emit_diagnostic_valist_meta (diagnostic_t kind, + rich_location *richloc, + const diagnostic_metadata *metadata, + int opt, + const char *gmsgid, va_list *ap) { return diagnostic_impl (richloc, metadata, opt, gmsgid, ap, kind); } diff --git a/gcc/doc/avr-mmcu.texi b/gcc/doc/avr-mmcu.texi index f38a0e0..dcbf4ef 100644 --- a/gcc/doc/avr-mmcu.texi +++ b/gcc/doc/avr-mmcu.texi @@ -34,11 +34,11 @@ @item @anchor{avr4}avr4 ``Enhanced'' devices with up to 8@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atmega48}, @code{atmega48a}, @code{atmega48p}, @code{atmega48pa}, @code{atmega48pb}, @code{atmega8}, @code{atmega8a}, @code{atmega8hva}, @code{atmega88}, @code{atmega88a}, @code{atmega88p}, @code{atmega88pa}, @code{atmega88pb}, @code{atmega8515}, @code{atmega8535}, @code{ata6285}, @code{ata6286}, @code{ata6289}, @code{ata6612c}, @code{at90pwm1}, @code{at90pwm2}, @code{at90pwm2b}, @code{at90pwm3}, @code{at90pwm3b}, @code{at90pwm81}. +@*@var{mcu}@tie{}= @code{atmega48}, @code{atmega48a}, @code{atmega48p}, @code{atmega48pa}, @code{atmega48pb}, @code{atmega8}, @code{atmega8a}, @code{atmega8hva}, @code{atmega88}, @code{atmega88a}, @code{atmega88p}, @code{atmega88pa}, @code{atmega88pb}, @code{atmega8515}, @code{atmega8535}, @code{ata5795}, @code{ata6285}, @code{ata6286}, @code{ata6289}, @code{ata6612c}, @code{at90pwm1}, @code{at90pwm2}, @code{at90pwm2b}, @code{at90pwm3}, @code{at90pwm3b}, @code{at90pwm81}. @item @anchor{avr5}avr5 ``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory. -@*@var{mcu}@tie{}= @code{atmega16}, @code{atmega16a}, @code{atmega16hva}, @code{atmega16hva2}, @code{atmega16hvb}, @code{atmega16hvbrevb}, @code{atmega16m1}, @code{atmega16u4}, @code{atmega161}, @code{atmega162}, @code{atmega163}, @code{atmega164a}, @code{atmega164p}, @code{atmega164pa}, @code{atmega165}, @code{atmega165a}, @code{atmega165p}, @code{atmega165pa}, @code{atmega168}, @code{atmega168a}, @code{atmega168p}, @code{atmega168pa}, @code{atmega168pb}, @code{atmega169}, @code{atmega169a}, @code{atmega169p}, @code{atmega169pa}, @code{atmega32}, @code{atmega32a}, @code{atmega32c1}, @code{atmega32hvb}, @code{atmega32hvbrevb}, @code{atmega32m1}, @code{atmega32u4}, @code{atmega32u6}, @code{atmega323}, @code{atmega324a}, @code{atmega324p}, @code{atmega324pa}, @code{atmega324pb}, @code{atmega325}, @code{atmega325a}, @code{atmega325p}, @code{atmega325pa}, @code{atmega328}, @code{atmega328p}, @code{atmega328pb}, @code{atmega329}, @code{atmega329a}, @code{atmega329p}, @code{atmega329pa}, @code{atmega3250}, @code{atmega3250a}, @code{atmega3250p}, @code{atmega3250pa}, @code{atmega3290}, @code{atmega3290a}, @code{atmega3290p}, @code{atmega3290pa}, @code{atmega406}, @code{atmega64}, @code{atmega64a}, @code{atmega64c1}, @code{atmega64hve}, @code{atmega64hve2}, @code{atmega64m1}, @code{atmega64rfr2}, @code{atmega640}, @code{atmega644}, @code{atmega644a}, @code{atmega644p}, @code{atmega644pa}, @code{atmega644rfr2}, @code{atmega645}, @code{atmega645a}, @code{atmega645p}, @code{atmega649}, @code{atmega649a}, @code{atmega649p}, @code{atmega6450}, @code{atmega6450a}, @code{atmega6450p}, @code{atmega6490}, @code{atmega6490a}, @code{atmega6490p}, @code{ata5795}, @code{ata5790}, @code{ata5790n}, @code{ata5791}, @code{ata6613c}, @code{ata6614q}, @code{ata5782}, @code{ata5831}, @code{ata8210}, @code{ata8510}, @code{ata5787}, @code{ata5835}, @code{ata5700m322}, @code{ata5702m322}, @code{at90pwm161}, @code{at90pwm216}, @code{at90pwm316}, @code{at90can32}, @code{at90can64}, @code{at90scr100}, @code{at90usb646}, @code{at90usb647}, @code{at94k}, @code{m3000}. +@*@var{mcu}@tie{}= @code{atmega16}, @code{atmega16a}, @code{atmega16hva}, @code{atmega16hva2}, @code{atmega16hvb}, @code{atmega16hvbrevb}, @code{atmega16m1}, @code{atmega16u4}, @code{atmega161}, @code{atmega162}, @code{atmega163}, @code{atmega164a}, @code{atmega164p}, @code{atmega164pa}, @code{atmega165}, @code{atmega165a}, @code{atmega165p}, @code{atmega165pa}, @code{atmega168}, @code{atmega168a}, @code{atmega168p}, @code{atmega168pa}, @code{atmega168pb}, @code{atmega169}, @code{atmega169a}, @code{atmega169p}, @code{atmega169pa}, @code{atmega32}, @code{atmega32a}, @code{atmega32c1}, @code{atmega32hvb}, @code{atmega32hvbrevb}, @code{atmega32m1}, @code{atmega32u4}, @code{atmega32u6}, @code{atmega323}, @code{atmega324a}, @code{atmega324p}, @code{atmega324pa}, @code{atmega324pb}, @code{atmega325}, @code{atmega325a}, @code{atmega325p}, @code{atmega325pa}, @code{atmega328}, @code{atmega328p}, @code{atmega328pb}, @code{atmega329}, @code{atmega329a}, @code{atmega329p}, @code{atmega329pa}, @code{atmega3250}, @code{atmega3250a}, @code{atmega3250p}, @code{atmega3250pa}, @code{atmega3290}, @code{atmega3290a}, @code{atmega3290p}, @code{atmega3290pa}, @code{atmega406}, @code{atmega64}, @code{atmega64a}, @code{atmega64c1}, @code{atmega64hve}, @code{atmega64hve2}, @code{atmega64m1}, @code{atmega64rfr2}, @code{atmega640}, @code{atmega644}, @code{atmega644a}, @code{atmega644p}, @code{atmega644pa}, @code{atmega644rfr2}, @code{atmega645}, @code{atmega645a}, @code{atmega645p}, @code{atmega649}, @code{atmega649a}, @code{atmega649p}, @code{atmega6450}, @code{atmega6450a}, @code{atmega6450p}, @code{atmega6490}, @code{atmega6490a}, @code{atmega6490p}, @code{ata5790}, @code{ata5790n}, @code{ata5791}, @code{ata6613c}, @code{ata6614q}, @code{ata5782}, @code{ata5831}, @code{ata8210}, @code{ata8510}, @code{ata5787}, @code{ata5835}, @code{ata5700m322}, @code{ata5702m322}, @code{at90pwm161}, @code{at90pwm216}, @code{at90pwm316}, @code{at90can32}, @code{at90can64}, @code{at90scr100}, @code{at90usb646}, @code{at90usb647}, @code{at94k}, @code{m3000}. @item @anchor{avr51}avr51 ``Enhanced'' devices with 128@tie{}KiB of program memory. diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index c779443..1732330 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -477,8 +477,8 @@ is shown below: Necessary to build GCC with internationalization support via @option{--enable-nls}. It can be downloaded from -@uref{https://gnu.org/s/gettext/}. If a GNU gettext distribution is -found in a subdirectory of your GCC sources named @file{gettext}, it +@uref{https://www.gnu.org/software/gettext/}. If a GNU gettext distribution +is found in a subdirectory of your GCC sources named @file{gettext}, it will be built together with GCC, unless present in the system (either in libc or as a stand-alone library). diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 71339b8..0de184f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -270,7 +270,7 @@ in the following sections. -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions -Wself-move -Wsign-promo -Wsized-deallocation -Wsuggest-final-methods --Wsuggest-final-types -Wsuggest-override +-Wsuggest-final-types -Wsuggest-override -Wno-template-id-cdtor -Wno-terminate -Wno-vexing-parse -Wvirtual-inheritance -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant} @@ -4604,6 +4604,23 @@ namespaces, and this may be used to enforce that rule. The warning is inactive inside a system header file, such as the STL, so one can still use the STL. One may also use using directives and qualified names. +@opindex Wtemplate-id-cdtor +@opindex Wno-template-id-cdtor +@item -Wno-template-id-cdtor @r{(C++ and Objective-C++ only)} +Disable the warning about the use of simple-template-id as the declarator-id +of a constructor or destructor, which became invalid in C++20 via DR 2237. +For example: + +@smallexample +template<typename T> struct S @{ + S<T>(); // should be S(); + ~S<T>(); // should be ~S(); +@}; +@end smallexample + +@option{-Wtemplate-id-cdtor} is enabled by default with +@option{-std=c++20}; it is also enabled by @option{-Wc++20-compat}. + @opindex Wterminate @opindex Wno-terminate @item -Wno-terminate @r{(C++ and Objective-C++ only)} diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index b0c6192..33b37e7 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5746,6 +5746,7 @@ Operand 1 and operand 2 are of the same mode. Their product, which is of a wider mode, is computed and added to operand 3. Operand 3 is of a mode equal or wider than the mode of the product. The result is placed in operand 0, which is of the same mode as operand 3. +@var{m} is the mode of operand 1 and operand 2. Semantically the expressions perform the multiplication in the following signs @@ -5763,6 +5764,7 @@ Operand 1 and operand 2 are of the same mode. Their product, which is of a wider mode, is computed and added to operand 3. Operand 3 is of a mode equal or wider than the mode of the product. The result is placed in operand 0, which is of the same mode as operand 3. +@var{m} is the mode of operand 1 and operand 2. Semantically the expressions perform the multiplication in the following signs @@ -5779,6 +5781,7 @@ Operand 1 must be unsigned and operand 2 signed. Their product, which is of a wider mode, is computed and added to operand 3. Operand 3 is of a mode equal or wider than the mode of the product. The result is placed in operand 0, which is of the same mode as operand 3. +@var{m} is the mode of operand 1 and operand 2. Semantically the expressions perform the multiplication in the following signs @@ -5797,20 +5800,22 @@ Operand 1 and operand 2 are of the same mode. Their absolute difference, which is of a wider mode, is computed and added to operand 3. Operand 3 is of a mode equal or wider than the mode of the absolute difference. The result is placed in operand 0, which is of the same mode as operand 3. +@var{m} is the mode of operand 1 and operand 2. -@cindex @code{widen_ssum@var{m3}} instruction pattern -@cindex @code{widen_usum@var{m3}} instruction pattern -@item @samp{widen_ssum@var{m3}} -@itemx @samp{widen_usum@var{m3}} +@cindex @code{widen_ssum@var{m}3} instruction pattern +@cindex @code{widen_usum@var{m}3} instruction pattern +@item @samp{widen_ssum@var{m}3} +@itemx @samp{widen_usum@var{m}3} Operands 0 and 2 are of the same mode, which is wider than the mode of operand 1. Add operand 1 to operand 2 and place the widened result in operand 0. (This is used express accumulation of elements into an accumulator of a wider mode.) +@var{m} is the mode of operand 1. -@cindex @code{smulhs@var{m3}} instruction pattern -@cindex @code{umulhs@var{m3}} instruction pattern -@item @samp{smulhs@var{m3}} -@itemx @samp{umulhs@var{m3}} +@cindex @code{smulhs@var{m}3} instruction pattern +@cindex @code{umulhs@var{m}3} instruction pattern +@item @samp{smulhs@var{m}3} +@itemx @samp{umulhs@var{m}3} Signed/unsigned multiply high with scale. This is equivalent to the C code: @smallexample narrow op0, op1, op2; @@ -5819,11 +5824,13 @@ op0 = (narrow) (((wide) op1 * (wide) op2) >> (N / 2 - 1)); @end smallexample where the sign of @samp{narrow} determines whether this is a signed or unsigned operation, and @var{N} is the size of @samp{wide} in bits. +@var{m} is the mode for all 3 operands (narrow). The wide mode is not specified +and is defined to fit the whole multiply. -@cindex @code{smulhrs@var{m3}} instruction pattern -@cindex @code{umulhrs@var{m3}} instruction pattern -@item @samp{smulhrs@var{m3}} -@itemx @samp{umulhrs@var{m3}} +@cindex @code{smulhrs@var{m}3} instruction pattern +@cindex @code{umulhrs@var{m}3} instruction pattern +@item @samp{smulhrs@var{m}3} +@itemx @samp{umulhrs@var{m}3} Signed/unsigned multiply high with round and scale. This is equivalent to the C code: @smallexample @@ -5833,11 +5840,13 @@ op0 = (narrow) (((((wide) op1 * (wide) op2) >> (N / 2 - 2)) + 1) >> 1); @end smallexample where the sign of @samp{narrow} determines whether this is a signed or unsigned operation, and @var{N} is the size of @samp{wide} in bits. +@var{m} is the mode for all 3 operands (narrow). The wide mode is not specified +and is defined to fit the whole multiply. -@cindex @code{sdiv_pow2@var{m3}} instruction pattern -@cindex @code{sdiv_pow2@var{m3}} instruction pattern -@item @samp{sdiv_pow2@var{m3}} -@itemx @samp{sdiv_pow2@var{m3}} +@cindex @code{sdiv_pow2@var{m}3} instruction pattern +@cindex @code{sdiv_pow2@var{m}3} instruction pattern +@item @samp{sdiv_pow2@var{m}3} +@itemx @samp{sdiv_pow2@var{m}3} Signed division by power-of-2 immediate. Equivalent to: @smallexample signed op0, op1; diff --git a/gcc/dojump.cc b/gcc/dojump.cc index e2d2b3c..ac744e5 100644 --- a/gcc/dojump.cc +++ b/gcc/dojump.cc @@ -1266,6 +1266,7 @@ do_compare_and_jump (tree treeop0, tree treeop1, enum rtx_code signed_code, machine_mode mode; int unsignedp; enum rtx_code code; + unsigned HOST_WIDE_INT nunits; /* Don't crash if the comparison was erroneous. */ op0 = expand_normal (treeop0); @@ -1308,6 +1309,21 @@ do_compare_and_jump (tree treeop0, tree treeop1, enum rtx_code signed_code, emit_insn (targetm.gen_canonicalize_funcptr_for_compare (new_op1, op1)); op1 = new_op1; } + /* For boolean vectors with less than mode precision + make sure to fill padding with consistent values. */ + else if (VECTOR_BOOLEAN_TYPE_P (type) + && SCALAR_INT_MODE_P (mode) + && TYPE_VECTOR_SUBPARTS (type).is_constant (&nunits) + && maybe_ne (GET_MODE_PRECISION (mode), nunits)) + { + gcc_assert (code == EQ || code == NE); + op0 = expand_binop (mode, and_optab, op0, + GEN_INT ((1 << nunits) - 1), NULL_RTX, + true, OPTAB_WIDEN); + op1 = expand_binop (mode, and_optab, op1, + GEN_INT ((1 << nunits) - 1), NULL_RTX, + true, OPTAB_WIDEN); + } do_compare_rtx_and_jump (op0, op1, code, unsignedp, treeop0, mode, ((mode == BLKmode) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 4b09c35..5d64100 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -28987,8 +28987,9 @@ output_macinfo_op (macinfo_entry *ref) file_num = maybe_emit_file (fd); dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file"); dw2_asm_output_data_uleb128 (ref->lineno, - "Included from line number %lu", - (unsigned long) ref->lineno); + "Included from line number " + HOST_WIDE_INT_PRINT_UNSIGNED, + ref->lineno); dw2_asm_output_data_uleb128 (file_num, "file %s", ref->info); break; case DW_MACINFO_end_file: @@ -29014,8 +29015,10 @@ output_macinfo_op (macinfo_entry *ref) dw2_asm_output_data (1, ref->code, ref->code == DW_MACINFO_define ? "Define macro" : "Undefine macro"); - dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu", - (unsigned long) ref->lineno); + dw2_asm_output_data_uleb128 (ref->lineno, + "At line number " + HOST_WIDE_INT_PRINT_UNSIGNED, + ref->lineno); dw2_asm_output_nstring (ref->info, -1, "The macro"); break; case DW_MACRO_define_strp: @@ -29047,8 +29050,10 @@ output_macinfo_op (macinfo_entry *ref) gcc_assert (node && (node->form == DW_FORM_strp || node->form == dwarf_FORM (DW_FORM_strx))); - dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu", - (unsigned long) ref->lineno); + dw2_asm_output_data_uleb128 (ref->lineno, + "At line number " + HOST_WIDE_INT_PRINT_UNSIGNED, + ref->lineno); if (node->form == DW_FORM_strp) dw2_asm_output_offset (dwarf_offset_size, node->label, debug_str_section, "The macro: \"%s\"", diff --git a/gcc/expr.cc b/gcc/expr.cc index fc5e998..e238811 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -12445,7 +12445,10 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, } } /* If both types are integral, convert from one mode to the other. */ - else if (INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (treeop0))) + else if (INTEGRAL_TYPE_P (type) + && INTEGRAL_TYPE_P (TREE_TYPE (treeop0)) + && mode != BLKmode + && GET_MODE (op0) != BLKmode) op0 = convert_modes (mode, GET_MODE (op0), op0, TYPE_UNSIGNED (TREE_TYPE (treeop0))); /* If the output type is a bit-field type, do an extraction. */ @@ -13502,6 +13505,7 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) rtx op0, op1; rtx subtarget = target; location_t loc = ops->location; + unsigned HOST_WIDE_INT nunits; arg0 = ops->op0; arg1 = ops->op1; @@ -13694,6 +13698,22 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) expand_operands (arg0, arg1, subtarget, &op0, &op1, EXPAND_NORMAL); + /* For boolean vectors with less than mode precision + make sure to fill padding with consistent values. */ + if (VECTOR_BOOLEAN_TYPE_P (type) + && SCALAR_INT_MODE_P (operand_mode) + && TYPE_VECTOR_SUBPARTS (type).is_constant (&nunits) + && maybe_ne (GET_MODE_PRECISION (operand_mode), nunits)) + { + gcc_assert (code == EQ || code == NE); + op0 = expand_binop (mode, and_optab, op0, + GEN_INT ((1 << nunits) - 1), NULL_RTX, + true, OPTAB_WIDEN); + op1 = expand_binop (mode, and_optab, op1, + GEN_INT ((1 << nunits) - 1), NULL_RTX, + true, OPTAB_WIDEN); + } + if (target == 0) target = gen_reg_rtx (mode); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 22ca08d..67869d8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,62 @@ +2024-02-14 Steve Kargl <kargl@gcc.gnu.org> + + PR fortran/105847 + * trans-io.cc (transfer_namelist_element): When building the + namelist object name, if the use rename attribute is set, use + the local name specified in the use statement. + +2024-02-14 Jakub Jelinek <jakub@redhat.com> + + * error.cc (error_print): For u printing of ptrdiff_t, + print ptrdiff_t argument converted to unsigned long long and + masked with 2ULL * PTRDIFF_MAX + 1. + +2024-02-13 Tobias Burnus <tburnus@baylibre.com> + + PR middle-end/113904 + * trans-openmp.cc (gfc_trans_omp_declare_variant): Handle splitting of + OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. + * openmp.cc (gfc_match_omp_context_selector): Likewise; rejects + non-const device_num/condition; improve diagnostic. + +2024-02-13 Harald Anlauf <anlauf@gmx.de> + + PR fortran/113866 + * trans-expr.cc (gfc_conv_procedure_call): When passing an optional + dummy argument to an optional dummy argument of a bind(c) procedure + and the dummy argument is passed via a CFI descriptor, no special + presence check and passing of a default NULL pointer is needed. + +2024-02-13 Steve Kargl <kargl@gcc.gnu.org> + + PR fortran/113883 + * trans-array.cc (gfc_trans_deferred_array): Set length to zero, + avoiding extraneous diagnostics. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * error.cc (error_print): Handle z and t modifiers on d, i and u. + * check.cc (gfc_check_transfer): Use %zd instead of %ld and casts to + long. + * primary.cc (gfc_convert_to_structure_constructor): Use %td instead + of %ld and casts to long. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * trans-common.cc (build_common_decl): Use %wu instead of %lu and + casts to unsigned long. + * resolve.cc (resolve_ordinary_assign): Use %wd instead of %ld and + casts to long. + * array.cc (gfc_resolve_character_array_constructor): Likewise. + * data.cc (create_character_initializer): Likewise. + +2024-02-09 Harald Anlauf <anlauf@gmx.de> + + PR fortran/113799 + * arith.cc (reduce_unary): Remember any overflow encountered during + reduction of unary arithmetic operations on array constructors and + continue, and return error status, but terminate on serious errors. + 2024-01-28 Harald Anlauf <anlauf@gmx.de> PR fortran/113377 diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc index 0598f6a..d17d1aa 100644 --- a/gcc/fortran/arith.cc +++ b/gcc/fortran/arith.cc @@ -1323,6 +1323,7 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op, gfc_constructor *c; gfc_expr *r; arith rc; + bool ov = false; if (op->expr_type == EXPR_CONSTANT) return eval (op, result); @@ -1336,13 +1337,17 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op, { rc = reduce_unary (eval, c->expr, &r); - if (rc != ARITH_OK) + /* Remember any overflow encountered during reduction and continue, + but terminate on serious errors. */ + if (rc == ARITH_OVERFLOW) + ov = true; + else if (rc != ARITH_OK) break; gfc_replace_expr (c->expr, r); } - if (rc != ARITH_OK) + if (rc != ARITH_OK && rc != ARITH_OVERFLOW) gfc_constructor_free (head); else { @@ -1363,7 +1368,7 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op, *result = r; } - return rc; + return ov ? ARITH_OVERFLOW : rc; } diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc index 81fa99d..3a6e3a7 100644 --- a/gcc/fortran/array.cc +++ b/gcc/fortran/array.cc @@ -2212,9 +2212,9 @@ got_charlen: found_length = current_length; else if (found_length != current_length) { - gfc_error ("Different CHARACTER lengths (%ld/%ld) in array" - " constructor at %L", (long) found_length, - (long) current_length, &p->expr->where); + gfc_error ("Different CHARACTER lengths (%wd/%wd) in array" + " constructor at %L", found_length, + current_length, &p->expr->where); return false; } diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc index bf0ab83..d661cf3 100644 --- a/gcc/fortran/check.cc +++ b/gcc/fortran/check.cc @@ -6298,8 +6298,8 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size) if (source_size < result_size) gfc_warning (OPT_Wsurprising, "Intrinsic TRANSFER at %L has partly undefined result: " - "source size %ld < result size %ld", &source->where, - (long) source_size, (long) result_size); + "source size %zd < result size %zd", &source->where, + source_size, result_size); return true; } diff --git a/gcc/fortran/data.cc b/gcc/fortran/data.cc index deed2d3..7024749 100644 --- a/gcc/fortran/data.cc +++ b/gcc/fortran/data.cc @@ -209,8 +209,8 @@ create_character_initializer (gfc_expr *init, gfc_typespec *ts, else { gfc_warning_now (0, "Initialization string at %L was truncated to " - "fit the variable (%ld/%ld)", &rvalue->where, - (long) tlen, (long) len); + "fit the variable (%wd/%wd)", &rvalue->where, + tlen, len); len = tlen; } } diff --git a/gcc/fortran/error.cc b/gcc/fortran/error.cc index 9b90185..65e38b0 100644 --- a/gcc/fortran/error.cc +++ b/gcc/fortran/error.cc @@ -536,7 +536,8 @@ error_print (const char *type, const char *format0, va_list argp) { enum { TYPE_CURRENTLOC, TYPE_LOCUS, TYPE_INTEGER, TYPE_UINTEGER, TYPE_LONGINT, TYPE_ULONGINT, TYPE_LLONGINT, TYPE_ULLONGINT, - TYPE_HWINT, TYPE_HWUINT, TYPE_CHAR, TYPE_STRING, NOTYPE }; + TYPE_HWINT, TYPE_HWUINT, TYPE_CHAR, TYPE_STRING, TYPE_SIZE, + TYPE_SSIZE, TYPE_PTRDIFF, NOTYPE }; struct { int type; @@ -553,6 +554,9 @@ error_print (const char *type, const char *format0, va_list argp) unsigned HOST_WIDE_INT hwuintval; char charval; const char * stringval; + size_t sizeval; + ssize_t ssizeval; + ptrdiff_t ptrdiffval; } u; } arg[MAX_ARGS], spec[MAX_ARGS]; /* spec is the array of specifiers, in the same order as they @@ -662,6 +666,24 @@ error_print (const char *type, const char *format0, va_list argp) gcc_unreachable (); break; + case 'z': + c = *format++; + if (c == 'u') + arg[pos].type = TYPE_SIZE; + else if (c == 'i' || c == 'd') + arg[pos].type = TYPE_SSIZE; + else + gcc_unreachable (); + break; + + case 't': + c = *format++; + if (c == 'u' || c == 'i' || c == 'd') + arg[pos].type = TYPE_PTRDIFF; + else + gcc_unreachable (); + break; + case 'c': arg[pos].type = TYPE_CHAR; break; @@ -742,6 +764,18 @@ error_print (const char *type, const char *format0, va_list argp) arg[pos].u.hwuintval = va_arg (argp, unsigned HOST_WIDE_INT); break; + case TYPE_SSIZE: + arg[pos].u.ssizeval = va_arg (argp, ssize_t); + break; + + case TYPE_SIZE: + arg[pos].u.sizeval = va_arg (argp, size_t); + break; + + case TYPE_PTRDIFF: + arg[pos].u.ptrdiffval = va_arg (argp, ptrdiff_t); + break; + case TYPE_CHAR: arg[pos].u.charval = (char) va_arg (argp, int); break; @@ -839,6 +873,31 @@ error_print (const char *type, const char *format0, va_list argp) else error_hwint (spec[n++].u.hwuintval); break; + + case 'z': + format++; + if (*format == 'u') + error_uinteger (spec[n++].u.sizeval); + else + error_integer (spec[n++].u.ssizeval); + break; + + case 't': + format++; + if (*format == 'u') + { + unsigned long long a = spec[n++].u.ptrdiffval, m; +#ifdef PTRDIFF_MAX + m = PTRDIFF_MAX; +#else + m = INTTYPE_MAXIMUM (ptrdiff_t); +#endif + m = 2 * m + 1; + error_uinteger (a & m); + } + else + error_integer (spec[n++].u.ptrdiffval); + break; } } diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 0af80d5..d8cce69 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -5790,19 +5790,39 @@ gfc_match_omp_context_selector (gfc_omp_set_selector *oss) } while (1); break; - case OMP_TRAIT_PROPERTY_EXPR: + case OMP_TRAIT_PROPERTY_DEV_NUM_EXPR: + case OMP_TRAIT_PROPERTY_BOOL_EXPR: if (gfc_match_expr (&otp->expr) != MATCH_YES) { gfc_error ("expected expression at %C"); return MATCH_ERROR; } if (!gfc_resolve_expr (otp->expr) - || (otp->expr->ts.type != BT_LOGICAL + || (property_kind == OMP_TRAIT_PROPERTY_BOOL_EXPR + && otp->expr->ts.type != BT_LOGICAL) + || (property_kind == OMP_TRAIT_PROPERTY_DEV_NUM_EXPR && otp->expr->ts.type != BT_INTEGER) - || otp->expr->rank != 0) + || otp->expr->rank != 0 + || otp->expr->expr_type != EXPR_CONSTANT) { - gfc_error ("property must be constant integer or logical " - "expression at %C"); + if (property_kind == OMP_TRAIT_PROPERTY_BOOL_EXPR) + gfc_error ("property must be a constant logical expression " + "at %C"); + else + gfc_error ("property must be a constant integer expression " + "at %C"); + return MATCH_ERROR; + } + /* Device number must be conforming, which includes + omp_initial_device (-1) and omp_invalid_device (-4). */ + if (property_kind == OMP_TRAIT_PROPERTY_DEV_NUM_EXPR + && otp->expr->expr_type == EXPR_CONSTANT + && mpz_sgn (otp->expr->value.integer) < 0 + && mpz_cmp_si (otp->expr->value.integer, -1) != 0 + && mpz_cmp_si (otp->expr->value.integer, -4) != 0) + { + gfc_error ("property must be a conforming device number " + "at %C"); return MATCH_ERROR; } break; diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc index a1cc6c6..12e7bf3 100644 --- a/gcc/fortran/primary.cc +++ b/gcc/fortran/primary.cc @@ -1190,14 +1190,14 @@ got_delim: { if (istart < 1) { - gfc_error ("Substring start index (%ld) at %L below 1", - (long) istart, &e->ref->u.ss.start->where); + gfc_error ("Substring start index (%td) at %L below 1", + istart, &e->ref->u.ss.start->where); return MATCH_ERROR; } if (iend > (ssize_t) length) { - gfc_error ("Substring end index (%ld) at %L exceeds string " - "length", (long) iend, &e->ref->u.ss.end->where); + gfc_error ("Substring end index (%td) at %L exceeds string " + "length", iend, &e->ref->u.ss.end->where); return MATCH_ERROR; } length = iend - istart + 1; @@ -3240,8 +3240,8 @@ gfc_convert_to_structure_constructor (gfc_expr *e, gfc_symbol *sym, gfc_expr **c if (warn_line_truncation && c < e1) gfc_warning_now (OPT_Wcharacter_truncation, "CHARACTER expression will be truncated " - "in constructor (%ld/%ld) at %L", (long int) c, - (long int) e1, &actual->expr->where); + "in constructor (%td/%td) at %L", c, + e1, &actual->expr->where); } } diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 6148ed9..44f89f6 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -11291,8 +11291,8 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns) if (rlen && llen && rlen > llen) gfc_warning_now (OPT_Wcharacter_truncation, "CHARACTER expression will be truncated " - "in assignment (%ld/%ld) at %L", - (long) llen, (long) rlen, &code->loc); + "in assignment (%wd/%wd) at %L", + llen, rlen, &code->loc); } /* Ensure that a vector index expression for the lvalue is evaluated diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 1e0d698..2181990 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -11531,6 +11531,9 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block) if (sym->ts.type == BT_CHARACTER && !INTEGER_CST_P (sym->ts.u.cl->backend_decl)) { + if (sym->ts.deferred && !sym->ts.u.cl->length) + gfc_add_modify (&init, sym->ts.u.cl->backend_decl, + build_zero_cst (TREE_TYPE (sym->ts.u.cl->backend_decl))); gfc_conv_string_length (sym->ts.u.cl, NULL, &init); gfc_trans_vla_type_sizes (sym, &init); diff --git a/gcc/fortran/trans-common.cc b/gcc/fortran/trans-common.cc index 4fc9652..5f44e7b 100644 --- a/gcc/fortran/trans-common.cc +++ b/gcc/fortran/trans-common.cc @@ -409,10 +409,10 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init) if (!tree_int_cst_equal (DECL_SIZE_UNIT (decl), size) && strcmp (com->name, BLANK_COMMON_NAME)) gfc_warning (0, "Named COMMON block %qs at %L shall be of the " - "same size as elsewhere (%lu vs %lu bytes)", com->name, + "same size as elsewhere (%wu vs %wu bytes)", com->name, &com->where, - (unsigned long) TREE_INT_CST_LOW (size), - (unsigned long) TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl))); + TREE_INT_CST_LOW (size), + TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl))); if (tree_int_cst_lt (DECL_SIZE_UNIT (decl), size)) { diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 67abca9..a0593b7 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -7269,8 +7269,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, with an interface indicating an optional argument. When we call an intrinsic subroutine, however, fsym is NULL, but we might still have an optional argument, so we proceed to the substitution - just in case. */ - if (e && (fsym == NULL || fsym->attr.optional)) + just in case. Arguments passed to bind(c) procedures via CFI + descriptors are handled elsewhere. */ + if (e && (fsym == NULL || fsym->attr.optional) + && !(sym->attr.is_bind_c && is_CFI_desc (fsym, NULL))) { /* If an optional argument is itself an optional dummy argument, check its presence and substitute a null if absent. This is diff --git a/gcc/fortran/trans-io.cc b/gcc/fortran/trans-io.cc index 3cde1da..ee2cc56 100644 --- a/gcc/fortran/trans-io.cc +++ b/gcc/fortran/trans-io.cc @@ -1692,8 +1692,10 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name, gcc_assert (sym || c); /* Build the namelist object name. */ - - string = gfc_build_cstring_const (var_name); + if (sym && !sym->attr.use_only && sym->attr.use_rename) + string = gfc_build_cstring_const (sym->ns->use_stmts->rename->local_name); + else + string = gfc_build_cstring_const (var_name); string = gfc_build_addr_expr (pchar_type_node, string); /* Build ts, as and data address using symbol or component. */ diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 9599521..a2bf156 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -8426,7 +8426,8 @@ gfc_trans_omp_declare_variant (gfc_namespace *ns) { switch (otp->property_kind) { - case OMP_TRAIT_PROPERTY_EXPR: + case OMP_TRAIT_PROPERTY_DEV_NUM_EXPR: + case OMP_TRAIT_PROPERTY_BOOL_EXPR: { gfc_se se; gfc_init_se (&se, NULL); @@ -2410,8 +2410,7 @@ read_specs (const char *filename, bool main_p, bool user_p) if (*p1++ != '<' || p[-2] != '>') fatal_error (input_location, "specs %%include syntax malformed after " - "%ld characters", - (long) (p1 - buffer + 1)); + "%td characters", p1 - buffer + 1); p[-2] = '\0'; new_filename = find_a_file (&startfile_prefixes, p1, R_OK, true); @@ -2431,8 +2430,7 @@ read_specs (const char *filename, bool main_p, bool user_p) if (*p1++ != '<' || p[-2] != '>') fatal_error (input_location, "specs %%include syntax malformed after " - "%ld characters", - (long) (p1 - buffer + 1)); + "%td characters", p1 - buffer + 1); p[-2] = '\0'; new_filename = find_a_file (&startfile_prefixes, p1, R_OK, true); @@ -2458,8 +2456,7 @@ read_specs (const char *filename, bool main_p, bool user_p) if (! ISALPHA ((unsigned char) *p1)) fatal_error (input_location, "specs %%rename syntax malformed after " - "%ld characters", - (long) (p1 - buffer)); + "%td characters", p1 - buffer); p2 = p1; while (*p2 && !ISSPACE ((unsigned char) *p2)) @@ -2468,8 +2465,7 @@ read_specs (const char *filename, bool main_p, bool user_p) if (*p2 != ' ' && *p2 != '\t') fatal_error (input_location, "specs %%rename syntax malformed after " - "%ld characters", - (long) (p2 - buffer)); + "%td characters", p2 - buffer); name_len = p2 - p1; *p2++ = '\0'; @@ -2479,8 +2475,7 @@ read_specs (const char *filename, bool main_p, bool user_p) if (! ISALPHA ((unsigned char) *p2)) fatal_error (input_location, "specs %%rename syntax malformed after " - "%ld characters", - (long) (p2 - buffer)); + "%td characters", p2 - buffer); /* Get new spec name. */ p3 = p2; @@ -2490,8 +2485,7 @@ read_specs (const char *filename, bool main_p, bool user_p) if (p3 != p - 1) fatal_error (input_location, "specs %%rename syntax malformed after " - "%ld characters", - (long) (p3 - buffer)); + "%td characters", p3 - buffer); *p3 = '\0'; for (sl = specs; sl; sl = sl->next) @@ -2530,8 +2524,8 @@ read_specs (const char *filename, bool main_p, bool user_p) } else fatal_error (input_location, - "specs unknown %% command after %ld characters", - (long) (p1 - buffer)); + "specs unknown %% command after %td characters", + p1 - buffer); } /* Find the colon that should end the suffix. */ @@ -2542,8 +2536,8 @@ read_specs (const char *filename, bool main_p, bool user_p) /* The colon shouldn't be missing. */ if (*p1 != ':') fatal_error (input_location, - "specs file malformed after %ld characters", - (long) (p1 - buffer)); + "specs file malformed after %td characters", + p1 - buffer); /* Skip back over trailing whitespace. */ p2 = p1; @@ -2556,8 +2550,8 @@ read_specs (const char *filename, bool main_p, bool user_p) p = skip_whitespace (p1 + 1); if (p[1] == 0) fatal_error (input_location, - "specs file malformed after %ld characters", - (long) (p - buffer)); + "specs file malformed after %td characters", + p - buffer); p1 = p; /* Find next blank line or end of string. */ diff --git a/gcc/gcov-dump.cc b/gcc/gcov-dump.cc index 167b6f5..2ff352b 100644 --- a/gcc/gcov-dump.cc +++ b/gcc/gcov-dump.cc @@ -218,11 +218,11 @@ dump_gcov_file (const char *filename) /* stamp */ unsigned stamp = gcov_read_unsigned (); - printf ("%s:stamp %lu\n", filename, (unsigned long)stamp); + printf ("%s:stamp %u\n", filename, stamp); /* Checksum */ unsigned checksum = gcov_read_unsigned (); - printf ("%s:checksum %lu\n", filename, (unsigned long)checksum); + printf ("%s:checksum %u\n", filename, checksum); if (!is_data_type) { diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc index 6623acc..87f8090 100644 --- a/gcc/gengtype.cc +++ b/gcc/gengtype.cc @@ -1294,8 +1294,9 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt)) { error_at_line (&lexer_line, - "rtx type `%s' has `0' in position %lu, can't handle", - rtx_name[i], (unsigned long) aindex); + "rtx type `%s' has `0' in position " + HOST_SIZE_T_PRINT_UNSIGNED ", can't handle", + rtx_name[i], (fmt_size_t) aindex); t = &string_type; subname = "rt_int"; } @@ -1333,17 +1334,20 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt)) default: error_at_line (&lexer_line, - "rtx type `%s' has `%c' in position %lu, can't handle", + "rtx type `%s' has `%c' in position " + HOST_SIZE_T_PRINT_UNSIGNED ", can't handle", rtx_name[i], rtx_format[i][aindex], - (unsigned long) aindex); + (fmt_size_t) aindex); t = &string_type; subname = "rt_int"; break; } subfields = create_field (subfields, t, - xasprintf (".fld[%lu].%s", - (unsigned long) aindex, + xasprintf (".fld[" + HOST_SIZE_T_PRINT_UNSIGNED + "].%s", + (fmt_size_t) aindex, subname)); subfields->opt = nodot; if (t == note_union_tp) diff --git a/gcc/genpreds.cc b/gcc/genpreds.cc index 230a474..55d149e 100644 --- a/gcc/genpreds.cc +++ b/gcc/genpreds.cc @@ -1095,9 +1095,10 @@ write_lookup_constraint_1 (void) do { if (c->namelen > 2) - printf (" if (!strncmp (str + 1, \"%s\", %lu))\n" + printf (" if (!strncmp (str + 1, \"%s\", " + HOST_SIZE_T_PRINT_UNSIGNED "))\n" " return CONSTRAINT_%s;\n", - c->name + 1, (unsigned long int) c->namelen - 1, + c->name + 1, (fmt_size_t) (c->namelen - 1), c->c_name); else printf (" if (str[1] == '%c')\n" @@ -1174,8 +1175,8 @@ write_insn_constraint_len (void) } } - printf (" case '%c': return %lu;\n", - i, (unsigned long int) c->namelen); + printf (" case '%c': return " HOST_SIZE_T_PRINT_UNSIGNED ";\n", + i, (fmt_size_t) c->namelen); } puts (" default: break;\n" diff --git a/gcc/ggc-page.cc b/gcc/ggc-page.cc index fa90dff..4245f84 100644 --- a/gcc/ggc-page.cc +++ b/gcc/ggc-page.cc @@ -940,8 +940,9 @@ alloc_page (unsigned order) if (GGC_DEBUG_LEVEL >= 2) fprintf (G.debug_file, - "Allocating page at %p, object size=%lu, data %p-%p\n", - (void *) entry, (unsigned long) OBJECT_SIZE (order), + "Allocating page at %p, object size=" + HOST_SIZE_T_PRINT_UNSIGNED ", data %p-%p\n", + (void *) entry, (fmt_size_t) OBJECT_SIZE (order), (void *) page, (void *) (page + entry_size - 1)); return entry; @@ -1448,8 +1449,10 @@ ggc_internal_alloc (size_t size, void (*f)(void *), size_t s, size_t n if (GGC_DEBUG_LEVEL >= 3) fprintf (G.debug_file, - "Allocating object, requested size=%lu, actual=%lu at %p on %p\n", - (unsigned long) size, (unsigned long) object_size, result, + "Allocating object, requested size=" + HOST_SIZE_T_PRINT_UNSIGNED ", actual=" HOST_SIZE_T_PRINT_UNSIGNED + " at %p on %p\n", + (fmt_size_t) size, (fmt_size_t) object_size, result, (void *) entry); return result; @@ -1621,8 +1624,9 @@ ggc_free (void *p) if (GGC_DEBUG_LEVEL >= 3) fprintf (G.debug_file, - "Freeing object, actual size=%lu, at %p on %p\n", - (unsigned long) size, p, (void *) pe); + "Freeing object, actual size=" + HOST_SIZE_T_PRINT_UNSIGNED ", at %p on %p\n", + (fmt_size_t) size, p, (void *) pe); #ifdef ENABLE_GC_CHECKING /* Poison the data, to indicate the data is garbage. */ diff --git a/gcc/gimple-low.cc b/gcc/gimple-low.cc index e19fc2c..e037198 100644 --- a/gcc/gimple-low.cc +++ b/gcc/gimple-low.cc @@ -374,15 +374,22 @@ assumption_copy_decl (tree decl, copy_body_data *id) gcc_assert (VAR_P (decl) || TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == RESULT_DECL); + if (TREE_THIS_VOLATILE (decl)) + type = build_pointer_type (type); tree copy = build_decl (DECL_SOURCE_LOCATION (decl), PARM_DECL, DECL_NAME (decl), type); if (DECL_PT_UID_SET_P (decl)) SET_DECL_PT_UID (copy, DECL_PT_UID (decl)); - TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl); - TREE_READONLY (copy) = TREE_READONLY (decl); - TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl); - DECL_NOT_GIMPLE_REG_P (copy) = DECL_NOT_GIMPLE_REG_P (decl); - DECL_BY_REFERENCE (copy) = DECL_BY_REFERENCE (decl); + TREE_THIS_VOLATILE (copy) = 0; + if (TREE_THIS_VOLATILE (decl)) + TREE_READONLY (copy) = 1; + else + { + TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl); + TREE_READONLY (copy) = TREE_READONLY (decl); + DECL_NOT_GIMPLE_REG_P (copy) = DECL_NOT_GIMPLE_REG_P (decl); + DECL_BY_REFERENCE (copy) = DECL_BY_REFERENCE (decl); + } DECL_ARG_TYPE (copy) = type; ((lower_assumption_data *) id)->decls.safe_push (decl); return copy_decl_for_dup_finish (id, decl, copy); @@ -466,6 +473,11 @@ adjust_assumption_stmt_op (tree *tp, int *, void *datap) case PARM_DECL: case RESULT_DECL: *tp = remap_decl (t, &data->id); + if (TREE_THIS_VOLATILE (t) && *tp != t) + { + *tp = build_simple_mem_ref (*tp); + TREE_THIS_NOTRAP (*tp) = 1; + } break; default: break; @@ -600,6 +612,11 @@ lower_assumption (gimple_stmt_iterator *gsi, struct lower_data *data) /* Remaining arguments will be the variables/parameters mentioned in the condition. */ vargs[i - sz] = lad.decls[i - 1]; + if (TREE_THIS_VOLATILE (lad.decls[i - 1])) + { + TREE_ADDRESSABLE (lad.decls[i - 1]) = 1; + vargs[i - sz] = build_fold_addr_expr (lad.decls[i - 1]); + } /* If they have gimple types, we might need to regimplify them to make the IFN_ASSUME call valid. */ if (is_gimple_reg_type (TREE_TYPE (vargs[i - sz])) diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc index 41484a0..13b9b20 100644 --- a/gcc/gimple-lower-bitint.cc +++ b/gcc/gimple-lower-bitint.cc @@ -1267,13 +1267,17 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, tree idx) the most significant limb is handled in straight line code. If m_var_msb (on left shifts) or if m_upwards_2limb * limb_prec is equal to - lhs precision that is not the case. */ + lhs precision or if not m_upwards_2limb and lhs_type + has precision which is multiple of limb_prec that is + not the case. */ || (!m_var_msb && (CEIL (TYPE_PRECISION (lhs_type), limb_prec) == CEIL (TYPE_PRECISION (rhs_type), limb_prec)) - && (!m_upwards_2limb - || (m_upwards_2limb * limb_prec - < TYPE_PRECISION (lhs_type))))) + && ((!m_upwards_2limb + && (TYPE_PRECISION (lhs_type) % limb_prec != 0)) + || (m_upwards_2limb + && (m_upwards_2limb * limb_prec + < TYPE_PRECISION (lhs_type)))))) { rhs1 = handle_operand (rhs1, idx); if (tree_fits_uhwi_p (idx)) @@ -1350,9 +1354,7 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, tree idx) if (!tree_fits_uhwi_p (idx)) { if (m_upwards_2limb - && (m_upwards_2limb * limb_prec - <= ((unsigned) TYPE_PRECISION (rhs_type) - - !TYPE_UNSIGNED (rhs_type)))) + && low >= m_upwards_2limb - m_first) { rhs1 = handle_operand (rhs1, idx); if (m_first) @@ -1363,8 +1365,21 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, tree idx) } bool single_comparison = low == high || (m_upwards_2limb && (low & 1) == m_first); + tree idxc = idx; + if (!single_comparison + && m_upwards_2limb + && !m_first + && low + 1 == m_upwards_2limb) + /* In this case we know that idx <= low always, + so effectively we just needs a single comparison, + idx < low or idx == low, but we'd need to emit different + code for the 2 branches than single_comparison normally + emits. So, instead of special-casing that, emit a + low <= low comparison which cfg cleanup will clean up + at the end of the pass. */ + idxc = size_int (low); g = gimple_build_cond (single_comparison ? LT_EXPR : LE_EXPR, - idx, size_int (low), NULL_TREE, NULL_TREE); + idxc, size_int (low), NULL_TREE, NULL_TREE); edge edge_true_true, edge_true_false, edge_false; if_then_if_then_else (g, (single_comparison ? NULL : gimple_build_cond (EQ_EXPR, idx, @@ -1670,6 +1685,27 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, tree idx) return NULL_TREE; } +/* Add a new EH edge from SRC to EH_EDGE->dest, where EH_EDGE + is an older EH edge, and except for virtual PHIs duplicate the + PHI argument from the EH_EDGE to the new EH edge. */ + +static void +add_eh_edge (basic_block src, edge eh_edge) +{ + edge e = make_edge (src, eh_edge->dest, EDGE_EH); + e->probability = profile_probability::very_unlikely (); + for (gphi_iterator gsi = gsi_start_phis (eh_edge->dest); + !gsi_end_p (gsi); gsi_next (&gsi)) + { + gphi *phi = gsi.phi (); + tree lhs = gimple_phi_result (phi); + if (virtual_operand_p (lhs)) + continue; + const phi_arg_d *arg = gimple_phi_arg (phi, eh_edge->dest_idx); + add_phi_arg (phi, arg->def, e, arg->locus); + } +} + /* Helper function for handle_stmt method, handle a load from memory. */ tree @@ -1745,8 +1781,7 @@ bitint_large_huge::handle_load (gimple *stmt, tree idx) if (eh_edge) { edge e = split_block (gsi_bb (m_gsi), g); - make_edge (e->src, eh_edge->dest, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e->src, eh_edge); m_gsi = gsi_after_labels (e->dest); if (gsi_bb (save_gsi) == e->src) { @@ -1865,8 +1900,7 @@ bitint_large_huge::handle_load (gimple *stmt, tree idx) { edge e = split_block (gsi_bb (m_gsi), g); m_gsi = gsi_after_labels (e->dest); - make_edge (e->src, eh_edge->dest, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e->src, eh_edge); } } if (conditional) @@ -1923,8 +1957,7 @@ normal_load: { edge e = split_block (gsi_bb (m_gsi), g); m_gsi = gsi_after_labels (e->dest); - make_edge (e->src, eh_edge->dest, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e->src, eh_edge); } if (tree_fits_uhwi_p (idx)) { @@ -2543,8 +2576,8 @@ bitint_large_huge::lower_mergeable_stmt (gimple *stmt, tree_code &cmp_code, { edge e = split_block (gsi_bb (m_gsi), g); m_gsi = gsi_after_labels (e->dest); - make_edge (e->src, eh_pad, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e->src, + find_edge (gimple_bb (stmt), eh_pad)); } } if (kind == bitint_prec_large) @@ -2622,8 +2655,8 @@ bitint_large_huge::lower_mergeable_stmt (gimple *stmt, tree_code &cmp_code, { edge e = split_block (gsi_bb (m_gsi), g); m_gsi = gsi_after_labels (e->dest); - make_edge (e->src, eh_pad, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e->src, + find_edge (gimple_bb (stmt), eh_pad)); } } if (new_bb) @@ -2766,8 +2799,7 @@ bitint_large_huge::lower_mergeable_stmt (gimple *stmt, tree_code &cmp_code, { edge e = split_block (gsi_bb (m_gsi), g); m_gsi = gsi_after_labels (e->dest); - make_edge (e->src, eh_pad, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e->src, find_edge (gimple_bb (stmt), eh_pad)); } } if (kind == bitint_prec_huge && i == (bo_bit != 0)) @@ -2811,8 +2843,7 @@ bitint_large_huge::lower_mergeable_stmt (gimple *stmt, tree_code &cmp_code, { edge e = split_block (gsi_bb (m_gsi), g); m_gsi = gsi_after_labels (e->dest); - make_edge (e->src, eh_pad, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e->src, find_edge (gimple_bb (stmt), eh_pad)); } } } @@ -3468,8 +3499,7 @@ bitint_large_huge::lower_muldiv_stmt (tree obj, gimple *stmt) { edge e2 = split_block (gsi_bb (m_gsi), g); m_gsi = gsi_after_labels (e2->dest); - make_edge (e2->src, e1->dest, EDGE_EH)->probability - = profile_probability::very_unlikely (); + add_eh_edge (e2->src, e1); } } } @@ -4005,7 +4035,7 @@ bitint_large_huge::lower_addsub_overflow (tree obj, gimple *stmt) if (kind != bitint_prec_huge) idx = size_int (i); else if (i >= 2) - idx = size_int (fin + (i > 2)); + idx = size_int (fin + i - 2); if (!last_ovf || i < cnt - 1) { if (type0 != TREE_TYPE (arg0)) @@ -5263,6 +5293,8 @@ bitint_large_huge::lower_stmt (gimple *stmt) { lhs = gimple_assign_lhs (stmt); tree rhs1 = gimple_assign_rhs1 (stmt); + if (TREE_CODE (rhs1) == VIEW_CONVERT_EXPR) + rhs1 = TREE_OPERAND (rhs1, 0); if (TREE_CODE (TREE_TYPE (lhs)) == BITINT_TYPE && bitint_precision_kind (TREE_TYPE (lhs)) >= bitint_prec_large && INTEGRAL_TYPE_P (TREE_TYPE (rhs1))) @@ -5273,6 +5305,44 @@ bitint_large_huge::lower_stmt (gimple *stmt) || POINTER_TYPE_P (TREE_TYPE (lhs)))) { final_cast_p = true; + if (TREE_CODE (TREE_TYPE (lhs)) == INTEGER_TYPE + && TYPE_PRECISION (TREE_TYPE (lhs)) > MAX_FIXED_MODE_SIZE + && gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR) + { + /* Handle VIEW_CONVERT_EXPRs to not generally supported + huge INTEGER_TYPEs like uint256_t or uint512_t. These + are usually emitted from memcpy folding and backends + support moves with them but that is usually it. */ + if (TREE_CODE (rhs1) == INTEGER_CST) + { + rhs1 = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), + rhs1); + gcc_assert (rhs1 && TREE_CODE (rhs1) == INTEGER_CST); + gimple_assign_set_rhs1 (stmt, rhs1); + gimple_assign_set_rhs_code (stmt, INTEGER_CST); + update_stmt (stmt); + return; + } + gcc_assert (TREE_CODE (rhs1) == SSA_NAME); + if (SSA_NAME_IS_DEFAULT_DEF (rhs1) + && (!SSA_NAME_VAR (rhs1) || VAR_P (SSA_NAME_VAR (rhs1)))) + { + tree var = create_tmp_reg (TREE_TYPE (lhs)); + rhs1 = get_or_create_ssa_default_def (cfun, var); + gimple_assign_set_rhs1 (stmt, rhs1); + gimple_assign_set_rhs_code (stmt, SSA_NAME); + } + else + { + int part = var_to_partition (m_map, rhs1); + gcc_assert (m_vars[part] != NULL_TREE); + rhs1 = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), + m_vars[part]); + gimple_assign_set_rhs1 (stmt, rhs1); + } + update_stmt (stmt); + return; + } if (TREE_CODE (rhs1) == SSA_NAME && (m_names == NULL || !bitmap_bit_p (m_names, SSA_NAME_VERSION (rhs1)))) @@ -5903,6 +5973,47 @@ gimple_lower_bitint (void) { default: break; + case MULT_EXPR: + case TRUNC_DIV_EXPR: + case TRUNC_MOD_EXPR: + if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (s)) + { + location_t loc = gimple_location (stmt); + gsi = gsi_for_stmt (stmt); + tree rhs1 = gimple_assign_rhs1 (stmt); + tree rhs2 = gimple_assign_rhs2 (stmt); + /* For multiplication and division with (ab) + lhs and one or both operands force the operands + into new SSA_NAMEs to avoid coalescing failures. */ + if (TREE_CODE (rhs1) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) + { + first_large_huge = 0; + tree t = make_ssa_name (TREE_TYPE (rhs1)); + g = gimple_build_assign (t, SSA_NAME, rhs1); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + gimple_set_location (g, loc); + gimple_assign_set_rhs1 (stmt, t); + if (rhs1 == rhs2) + { + gimple_assign_set_rhs2 (stmt, t); + rhs2 = t; + } + update_stmt (stmt); + } + if (TREE_CODE (rhs2) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs2)) + { + first_large_huge = 0; + tree t = make_ssa_name (TREE_TYPE (rhs2)); + g = gimple_build_assign (t, SSA_NAME, rhs2); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + gimple_set_location (g, loc); + gimple_assign_set_rhs2 (stmt, t); + update_stmt (stmt); + } + } + break; case LROTATE_EXPR: case RROTATE_EXPR: { @@ -6103,7 +6214,13 @@ gimple_lower_bitint (void) if (gimple_assign_cast_p (use_stmt)) { tree lhs = gimple_assign_lhs (use_stmt); - if (INTEGRAL_TYPE_P (TREE_TYPE (lhs))) + if (INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + /* Don't merge with VIEW_CONVERT_EXPRs to + huge INTEGER_TYPEs used sometimes in memcpy + expansion. */ + && (TREE_CODE (TREE_TYPE (lhs)) != INTEGER_TYPE + || (TYPE_PRECISION (TREE_TYPE (lhs)) + <= MAX_FIXED_MODE_SIZE))) continue; } else if (gimple_store_p (use_stmt) @@ -6158,6 +6275,18 @@ gimple_lower_bitint (void) == gimple_bb (SSA_NAME_DEF_STMT (s)))) goto force_name; break; + case VIEW_CONVERT_EXPR: + /* Don't merge with VIEW_CONVERT_EXPRs to + huge INTEGER_TYPEs used sometimes in memcpy + expansion. */ + { + tree lhs = gimple_assign_lhs (use_stmt); + if (TREE_CODE (TREE_TYPE (lhs)) == INTEGER_TYPE + && (TYPE_PRECISION (TREE_TYPE (lhs)) + > MAX_FIXED_MODE_SIZE)) + goto force_name; + } + break; default: break; } diff --git a/gcc/hwint.h b/gcc/hwint.h index 38b7a14..25a94be 100644 --- a/gcc/hwint.h +++ b/gcc/hwint.h @@ -115,6 +115,27 @@ typedef HOST_WIDE_INT __gcc_host_wide_int__; #define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%" PRIx64 "%016" PRIx64 #define HOST_WIDE_INT_PRINT_PADDED_HEX "%016" PRIx64 +/* Similarly format modifier for printing size_t. As not all hosts support + z modifier in printf, use GCC_PRISZ and cast argument to fmt_size_t. + So, instead of doing fprintf ("%zu\n", sizeof (x) * y); use + fprintf (HOST_SIZE_T_PRINT_UNSIGNED "\n", + (fmt_size_t) (sizeof (x) * y)); */ +#if SIZE_MAX <= UINT_MAX +# define GCC_PRISZ "" +# define fmt_size_t unsigned int +#elif SIZE_MAX <= ULONG_MAX +# define GCC_PRISZ HOST_LONG_FORMAT +# define fmt_size_t unsigned long int +#else +# define GCC_PRISZ HOST_LONG_LONG_FORMAT +# define fmt_size_t unsigned long long int +#endif + +#define HOST_SIZE_T_PRINT_DEC "%" GCC_PRISZ "d" +#define HOST_SIZE_T_PRINT_UNSIGNED "%" GCC_PRISZ "u" +#define HOST_SIZE_T_PRINT_HEX "%#" GCC_PRISZ "x" +#define HOST_SIZE_T_PRINT_HEX_PURE "%" GCC_PRISZ "x" + /* Define HOST_WIDEST_FAST_INT to the widest integer type supported efficiently in hardware. (That is, the widest integer type that fits in a hardware register.) Normally this is "long" but on some hosts it diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc index 29ed1f1..f568913 100644 --- a/gcc/ipa-icf.cc +++ b/gcc/ipa-icf.cc @@ -3191,8 +3191,9 @@ sem_item_optimizer::process_cong_reduction (void) worklist_push ((*it)->classes[i]); if (dump_file) - fprintf (dump_file, "Worklist has been filled with: %lu\n", - (unsigned long) worklist.nodes ()); + fprintf (dump_file, "Worklist has been filled with: " + HOST_SIZE_T_PRINT_UNSIGNED "\n", + (fmt_size_t) worklist.nodes ()); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Congruence class reduction\n"); @@ -3239,8 +3240,9 @@ sem_item_optimizer::dump_cong_classes (void) } fprintf (dump_file, - "Congruence classes: %lu with total: %u items (in a non-singular " - "class: %u)\n", (unsigned long) m_classes.elements (), + "Congruence classes: " HOST_SIZE_T_PRINT_UNSIGNED " with total: " + "%u items (in a non-singular class: %u)\n", + (fmt_size_t) m_classes.elements (), m_items.length (), m_items.length () - single_element_classes); fprintf (dump_file, "Class size histogram [number of members]: number of classes\n"); diff --git a/gcc/ira-conflicts.cc b/gcc/ira-conflicts.cc index 671b4e4..83274c5 100644 --- a/gcc/ira-conflicts.cc +++ b/gcc/ira-conflicts.cc @@ -115,10 +115,10 @@ build_conflict_bit_table (void) > (uint64_t) param_ira_max_conflict_table_size * 1024 * 1024) { if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL) - fprintf - (ira_dump_file, - "+++Conflict table will be too big(>%dMB) -- don't use it\n", - param_ira_max_conflict_table_size); + fprintf (ira_dump_file, + "+++Conflict table will be too big(>%dMB) " + "-- don't use it\n", + param_ira_max_conflict_table_size); return false; } } @@ -148,11 +148,13 @@ build_conflict_bit_table (void) object_set_words = (ira_objects_num + IRA_INT_BITS - 1) / IRA_INT_BITS; if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL) - fprintf - (ira_dump_file, - "+++Allocating %ld bytes for conflict table (uncompressed size %ld)\n", - (long) allocated_words_num * sizeof (IRA_INT_TYPE), - (long) object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE)); + fprintf (ira_dump_file, + "+++Allocating " HOST_SIZE_T_PRINT_UNSIGNED + " bytes for conflict table (uncompressed size " + HOST_SIZE_T_PRINT_UNSIGNED ")\n", + (fmt_size_t) (sizeof (IRA_INT_TYPE) * allocated_words_num), + (fmt_size_t) (sizeof (IRA_INT_TYPE) * object_set_words + * ira_objects_num)); objects_live = sparseset_alloc (ira_objects_num); for (i = 0; i < ira_max_point; i++) diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 87f789d..111acf8 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,8 @@ +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * jit-playback.cc (new_bitcast): Use HOST_WIDE_INT_PRINT_DEC instead + of "%ld" and casts to long. + 2024-02-02 Antoni Boucher <bouanto@zoho.com> * docs/topics/compatibility.rst (LIBGCCJIT_ABI_27): New ABI tag. diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc index e277b01..6baa838 100644 --- a/gcc/jit/jit-playback.cc +++ b/gcc/jit/jit-playback.cc @@ -1602,11 +1602,11 @@ new_bitcast (location *loc, { active_playback_ctxt->add_error (loc, "bitcast with types of different sizes"); - fprintf (stderr, "input expression (size: %ld):\n", - (long) tree_to_uhwi (expr_size)); + fprintf (stderr, "input expression (size: " HOST_WIDE_INT_PRINT_DEC "):\n", + tree_to_uhwi (expr_size)); debug_tree (t_expr); - fprintf (stderr, "requested type (size: %ld):\n", - (long) tree_to_uhwi (type_size)); + fprintf (stderr, "requested type (size: " HOST_WIDE_INT_PRINT_DEC "):\n", + tree_to_uhwi (type_size)); debug_tree (t_dst_type); } tree t_bitcast = build1 (VIEW_CONVERT_EXPR, t_dst_type, t_expr); diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index a0ee55a..e206544 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + * lto-common.cc (print_lto_report_1): Use HOST_SIZE_T_PRINT_DEC + and casts to fmt_size_t instead of "%ld" and casts to long. Use + %d instead of %ld and casts to long for searches and collisions. + 2024-01-04 David Malcolm <dmalcolm@redhat.com> * lang.opt.urls: New file, autogenerated by diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index 11e7d63..e54ddf2 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -3021,10 +3021,10 @@ print_lto_report_1 (void) total_scc_size + num_unshared_trees_read); if (flag_wpa && tree_scc_hash && num_sccs_read) { - fprintf (stderr, "[%s] tree SCC table: size %ld, %ld elements, " - "collision ratio: %f\n", pfx, - (long) tree_scc_hash->size (), - (long) tree_scc_hash->elements (), + fprintf (stderr, "[%s] tree SCC table: size " HOST_SIZE_T_PRINT_DEC ", " + HOST_SIZE_T_PRINT_DEC " elements, collision ratio: %f\n", pfx, + (fmt_size_t) tree_scc_hash->size (), + (fmt_size_t) tree_scc_hash->elements (), tree_scc_hash->collisions ()); hash_table<tree_scc_hasher>::iterator hiter; tree_scc *scc, *max_scc = NULL; @@ -3052,12 +3052,13 @@ print_lto_report_1 (void) fprintf (stderr, "[%s] Merged %lu types\n", pfx, num_merged_types); fprintf (stderr, "[%s] %lu types prevailed (%lu associated trees)\n", pfx, num_prevailing_types, num_type_scc_trees); - fprintf (stderr, "[%s] GIMPLE canonical type table: size %ld, " - "%ld elements, %ld searches, %ld collisions (ratio: %f)\n", pfx, - (long) htab_size (gimple_canonical_types), - (long) htab_elements (gimple_canonical_types), - (long) gimple_canonical_types->searches, - (long) gimple_canonical_types->collisions, + fprintf (stderr, "[%s] GIMPLE canonical type table: size " + HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC + " elements, %d searches, %d collisions (ratio: %f)\n", pfx, + (fmt_size_t) htab_size (gimple_canonical_types), + (fmt_size_t) htab_elements (gimple_canonical_types), + gimple_canonical_types->searches, + gimple_canonical_types->collisions, htab_collisions (gimple_canonical_types)); fprintf (stderr, "[%s] GIMPLE canonical type pointer-map: " "%lu elements, %ld searches\n", pfx, diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index afd5bff..e17187e 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,9 @@ +2024-02-10 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/113848 + * gm2-libs/SArgs.mod (GetArg): Re-write address arithmetic + to avoid (void *) computation. + 2024-02-03 Gaius Mulley <gaiusmod2@gmail.com> PR modula2/113730 diff --git a/gcc/m2/gm2-libs/SArgs.mod b/gcc/m2/gm2-libs/SArgs.mod index d6cb448..3c3fe8d 100644 --- a/gcc/m2/gm2-libs/SArgs.mod +++ b/gcc/m2/gm2-libs/SArgs.mod @@ -60,12 +60,15 @@ if defined(GM2_DEBUG_SARGS) PROCEDURE GetArg (VAR s: String; n: CARDINAL) : BOOLEAN ; VAR i : INTEGER ; + a : ADDRESS ; ppc: PtrToPtrToChar ; BEGIN i := VAL (INTEGER, n) ; IF i < GetArgC () THEN - ppc := ADDRESS (ADDRESS (GetArgV ()) + (n * TSIZE (PtrToChar))) ; + a := ADDRESS (GetArgV ()) ; + INC (a, n * TSIZE (PtrToChar)) ; + ppc := a ; s := InitStringCharStar (ppc^) ; RETURN TRUE ELSE diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc index 2e31a3f..2c09520 100644 --- a/gcc/omp-general.cc +++ b/gcc/omp-general.cc @@ -1163,7 +1163,7 @@ struct omp_ts_info omp_ts_map[] = }, { "device_num", (1 << OMP_TRAIT_SET_TARGET_DEVICE), - OMP_TRAIT_PROPERTY_EXPR, false, + OMP_TRAIT_PROPERTY_DEV_NUM_EXPR, false, NULL }, { "vendor", @@ -1208,7 +1208,7 @@ struct omp_ts_info omp_ts_map[] = }, { "condition", (1 << OMP_TRAIT_SET_USER), - OMP_TRAIT_PROPERTY_EXPR, true, + OMP_TRAIT_PROPERTY_BOOL_EXPR, true, NULL }, { "target", diff --git a/gcc/omp-selectors.h b/gcc/omp-selectors.h index 78b810d..c61808e 100644 --- a/gcc/omp-selectors.h +++ b/gcc/omp-selectors.h @@ -64,7 +64,8 @@ enum omp_tp_type { OMP_TRAIT_PROPERTY_NONE, OMP_TRAIT_PROPERTY_ID, OMP_TRAIT_PROPERTY_NAME_LIST, - OMP_TRAIT_PROPERTY_EXPR, + OMP_TRAIT_PROPERTY_DEV_NUM_EXPR, + OMP_TRAIT_PROPERTY_BOOL_EXPR, OMP_TRAIT_PROPERTY_CLAUSE_LIST, OMP_TRAIT_PROPERTY_EXTENSION }; diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index c0ff212..92cfc9d 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2024-02-07 Joseph Myers <josmyers@redhat.com> + + * zh_CN.po: Update. + 2024-02-05 Joseph Myers <josmyers@redhat.com> * zh_CN.po: Update. diff --git a/gcc/po/zh_CN.po b/gcc/po/zh_CN.po index 0462ba2..d06739a 100644 --- a/gcc/po/zh_CN.po +++ b/gcc/po/zh_CN.po @@ -35,7 +35,7 @@ msgstr "" "Project-Id-Version: gcc 13.2.0\n" "Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n" "POT-Creation-Date: 2023-07-26 18:38+0000\n" -"PO-Revision-Date: 2024-02-05 15:48-0500\n" +"PO-Revision-Date: 2024-02-06 10:59-0500\n" "Last-Translator: Boyuan Yang <073plan@gmail.com>\n" "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" "Language: zh_CN\n" @@ -44,7 +44,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Bugs: Report translation errors to the Language-Team address.\n" -"X-Generator: Poedit 3.4.2\n" +"X-Generator: Poedit 2.4.3\n" #: cif-code.def:39 msgid "function not considered for inlining" @@ -103,20 +103,16 @@ msgid "call is unlikely and code size would grow" msgstr "调用不太可能且会导致代码膨胀" #: cif-code.def:88 -#, fuzzy -#| msgid "call is unlikely and code size would grow" msgid "call is considered never executed and code size would grow" -msgstr "调用不太可能且会导致代码膨胀" +msgstr "调用将被视为永远不会被执行且会导致代码膨胀" #: cif-code.def:92 msgid "function not declared inline and code size would grow" msgstr "函数未被声明成内联且会导致代码膨胀" #: cif-code.def:96 -#, fuzzy -#| msgid "expected iteration declaration or initialization" msgid "mismatched declarations during linktime optimization" -msgstr "需要迭代声明或初始化" +msgstr "链接时优化中的不匹配的声明" #: cif-code.def:100 msgid "variadic thunk call" @@ -540,10 +536,8 @@ msgid "gfortran does not support -E without -cpp" msgstr "gfortran 不支持单独使用 -E 而不带 -cpp" #: m2/lang-specs.h:48 -#, fuzzy -#| msgid "to generate dependencies you must specify either -M or -MM" msgid "to generate dependencies you must specify '-fcpp' " -msgstr "要生成依赖项,您必须指定 -M 或 -MM" +msgstr "要生成依赖项,您必须指定 '-fcpp' " #: objc/lang-specs.h:30 objc/lang-specs.h:41 msgid "GNU Objective C no longer supports traditional compilation" @@ -604,10 +598,9 @@ msgid "Warn if the type of a variable might be not interoperable with C." msgstr "对可能不与C语言互通的类型给出警告。" #: fortran/lang.opt:226 -#, fuzzy, no-c-format -#| msgid "Warn about truncated character expressions" +#, no-c-format msgid "Warn about truncated character expressions." -msgstr "对被截断的字符表达式给出警告" +msgstr "对被截断的字符表达式给出警告。" #: fortran/lang.opt:230 #, no-c-format @@ -708,9 +701,9 @@ msgid "Permit nonconforming uses of the tab character." msgstr "允许使用不符合规范的制表符" #: fortran/lang.opt:334 -#, fuzzy, no-c-format +#, no-c-format msgid "Warn about an invalid DO loop." -msgstr "对长度为 0 的格式字符串给出警告" +msgstr "对无效的 DO 循环给出警告。" #: fortran/lang.opt:338 #, fuzzy, no-c-format @@ -953,10 +946,9 @@ msgid "Specify that an external BLAS library should be used for matmul calls on msgstr "为大尺寸数组调用 matmul 时应当使用一个外部 BLAS 库" #: fortran/lang.opt:559 -#, fuzzy, no-c-format -#| msgid "Use f2c calling convention" +#, no-c-format msgid "Use f2c calling convention." -msgstr "使用 f2c 调用约定" +msgstr "使用 f2c 调用约定。" #: fortran/lang.opt:563 #, fuzzy, no-c-format @@ -1381,10 +1373,9 @@ msgid "Do not discard comments." msgstr "不丢弃注释。" #: c-family/c.opt:190 -#, fuzzy, no-c-format -#| msgid "Do not discard comments in macro expansions" +#, no-c-format msgid "Do not discard comments in macro expansions." -msgstr "展开宏时不丢弃注释" +msgstr "展开宏时不丢弃注释。" #: c-family/c.opt:194 #, fuzzy, no-c-format @@ -1991,10 +1982,9 @@ msgid "Warn about strftime formats yielding 2-digit years." msgstr "当 strftime 格式给出 2 位记年时给出警告" #: c-family/c.opt:725 -#, fuzzy, no-c-format -#| msgid "Warn about zero-length formats" +#, no-c-format msgid "Warn about zero-length formats." -msgstr "对长度为 0 的格式字符串给出警告" +msgstr "对长度为 0 的格式字符串给出警告。" #: c-family/c.opt:733 #, no-c-format @@ -2038,7 +2028,7 @@ msgstr "提领指向不完全类型的指针" #: c-family/c.opt:762 common.opt:650 #, no-c-format msgid "Warn for infinitely recursive calls." -msgstr "" +msgstr "为无限递归调用给出警告。" #: c-family/c.opt:766 #, no-c-format @@ -2074,16 +2064,14 @@ msgid "Warn about implicit conversions from \"float\" to \"double\"." msgstr "对从“float”到“double”的隐式转换给出警告" #: c-family/c.opt:795 -#, fuzzy, no-c-format -#| msgid "Warn if an undefined macro is used in an #if directive" +#, no-c-format msgid "Warn if \"defined\" is used outside #if." -msgstr "当 #if 指令中用到未定义的宏时给出警告" +msgstr "当 \"defined\" 在 #if 之外使用时给出警告。" #: c-family/c.opt:799 -#, fuzzy, no-c-format -#| msgid "Warn about implicit function declarations" +#, no-c-format msgid "Warn about implicit function declarations." -msgstr "对隐式函数声明给出警告" +msgstr "对隐式函数声明给出警告。" #: c-family/c.opt:803 #, fuzzy, no-c-format @@ -2131,9 +2119,9 @@ msgid "Warn about PCH files that are found but not used." msgstr "在找到了 PCH 文件但未使用的情况给出警告" #: c-family/c.opt:838 -#, fuzzy, no-c-format +#, no-c-format msgid "Warn about invalid UTF-8 characters." -msgstr "当定义在主文件中的宏未被使用时给出警告" +msgstr "对无效 UTF-8 字符给出警告。" #: c-family/c.opt:842 #, fuzzy, no-c-format @@ -2787,10 +2775,9 @@ msgid "Warn about the most vexing parse syntactic ambiguity." msgstr "" #: c-family/c.opt:1435 -#, fuzzy, no-c-format -#| msgid "Warn if a variable length array is used" +#, no-c-format msgid "Warn if a variable length array is used." -msgstr "使用变长数组时警告" +msgstr "使用变长数组时给出警告。" #: c-family/c.opt:1439 #, fuzzy, no-c-format @@ -3028,7 +3015,7 @@ msgstr "" #: c-family/c.opt:1733 #, no-c-format msgid "Enable C++ coroutines (experimental)." -msgstr "" +msgstr "启用 C++ 协程(实验性)。" #: c-family/c.opt:1737 #, fuzzy, no-c-format @@ -3130,10 +3117,9 @@ msgid "Generate code for GNU runtime environment." msgstr "为 GNU 运行时环境生成代码" #: c-family/c.opt:1829 -#, fuzzy, no-c-format -#| msgid "Use traditional GNU semantics for inline functions" +#, no-c-format msgid "Use traditional GNU semantics for inline functions." -msgstr "为内联函数使用传统的 GNU 语义" +msgstr "为内联函数使用传统的 GNU 语义。" #: c-family/c.opt:1842 #, fuzzy, no-c-format @@ -3249,10 +3235,9 @@ msgid "fmax-include-depth=<number> Set the maximum depth of the nested #include. msgstr "" #: c-family/c.opt:1947 -#, fuzzy, no-c-format -#| msgid "Don't warn about uses of Microsoft extensions" +#, no-c-format msgid "Don't warn about uses of Microsoft extensions." -msgstr "使用微软扩展时不给出警告" +msgstr "使用微软扩展时不给出警告。" #: c-family/c.opt:1966 #, no-c-format @@ -3260,10 +3245,9 @@ msgid "Implement resolution of DR 150 for matching of template template argument msgstr "" #: c-family/c.opt:1970 -#, fuzzy, no-c-format -#| msgid "Generate code for NeXT (Apple Mac OS X) runtime environment" +#, no-c-format msgid "Generate code for NeXT (Apple Mac OS X) runtime environment." -msgstr "为 NeXT (苹果 Mac OS X) 运行时环境生成代码" +msgstr "为 NeXT (苹果 Mac OS X) 运行时环境生成代码。" #: c-family/c.opt:1974 #, fuzzy, no-c-format @@ -3406,10 +3390,9 @@ msgid "Used in Fix-and-Continue mode to indicate that object files may be swappe msgstr "指定对象文件可能在运行时被换入以允许“修复并继续”调试模式" #: c-family/c.opt:2111 -#, fuzzy, no-c-format -#| msgid "Deprecated. This switch has no effect" +#, no-c-format msgid "Removed in GCC 10. This switch has no effect." -msgstr "已弃用。此开关不起作用。" +msgstr "已在 GCC 10 中移除。此开关不起作用。" #: c-family/c.opt:2115 #, fuzzy, no-c-format @@ -3436,10 +3419,9 @@ msgid "When \"signed\" or \"unsigned\" is not given make the bitfield signed." msgstr "没有给定“signed”或“unsigned”时将位段视作有符号的" #: c-family/c.opt:2131 ada/gcc-interface/lang.opt:85 -#, fuzzy, no-c-format -#| msgid "Make \"char\" signed by default" +#, no-c-format msgid "Make \"char\" signed by default." -msgstr "使“char”类型默认为有符号" +msgstr "使“char”类型默认为有符号。" #: c-family/c.opt:2135 #, fuzzy, no-c-format @@ -3548,10 +3530,9 @@ msgid "Generate lazy class lookup (via objc_getClass()) for use in Zero-Link mod msgstr "为 Zero-Link 模式生成后期类查找(通过 objc_getClass())" #: c-family/c.opt:2268 -#, fuzzy, no-c-format -#| msgid "Dump declarations to a .decl file" +#, no-c-format msgid "Dump declarations to a .decl file." -msgstr "将声明转储到一个 .decl 文件中" +msgstr "将声明转储到一个 .decl 文件中。" #: c-family/c.opt:2272 #, fuzzy, no-c-format @@ -3649,22 +3630,19 @@ msgid "Do not search standard system include directories for C++." msgstr "不搜索 C++ 标准系统头文件目录" #: c-family/c.opt:2351 -#, fuzzy, no-c-format -#| msgid "Generate C header of platform-specific features" +#, no-c-format msgid "Generate C header of platform-specific features." -msgstr "生成有平台相关特性的 C 头文件" +msgstr "生成有平台相关特性的 C 头文件。" #: c-family/c.opt:2355 -#, fuzzy, no-c-format -#| msgid "Remap file names when including files" +#, no-c-format msgid "Remap file names when including files." -msgstr "包含文件时映射短文件名" +msgstr "包含文件时重映射文件名。" #: c-family/c.opt:2359 c-family/c.opt:2363 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum" +#, no-c-format msgid "Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum." -msgstr "遵循 ISO 1998 C++ 标准于 2003 年的技术勘误版本" +msgstr "遵循 ISO 1998 C++ 标准于 2003 年的技术勘误版本。" #: c-family/c.opt:2367 #, no-c-format @@ -3672,97 +3650,85 @@ msgid "Conform to the ISO 2011 C++ standard." msgstr "遵循 ISO 2011 C++ 标准。" #: c-family/c.opt:2371 -#, fuzzy, no-c-format +#, no-c-format msgid "Deprecated in favor of -std=c++11." -msgstr "已弃用,请改用 -std=gnu99" +msgstr "已弃用,请改用 -std=c++11。" #: c-family/c.opt:2375 -#, fuzzy, no-c-format +#, no-c-format msgid "Deprecated in favor of -std=c++14." -msgstr "已弃用,请改用 -std=gnu99" +msgstr "已弃用,请改用 -std=c++14。" #: c-family/c.opt:2379 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2011 C++ standard" +#, no-c-format msgid "Conform to the ISO 2014 C++ standard." -msgstr "遵循 ISO 2011 C++ 标准" +msgstr "遵循 ISO 2014 C++ 标准。" #: c-family/c.opt:2383 -#, fuzzy, no-c-format +#, no-c-format msgid "Deprecated in favor of -std=c++17." -msgstr "已弃用,请改用 -std=gnu99" +msgstr "已弃用,请改用 -std=c++17。" #: c-family/c.opt:2387 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2011 C++ standard" +#, no-c-format msgid "Conform to the ISO 2017 C++ standard." -msgstr "遵循 ISO 2011 C++ 标准" +msgstr "遵循 ISO 2017 C++ 标准。" #: c-family/c.opt:2391 c-family/c.opt:2395 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2017(?) C++ draft standard (experimental and incomplete support)" +#, no-c-format msgid "Conform to the ISO 2020 C++ standard (experimental and incomplete support)." -msgstr "遵循 ISO 2017(?) C++ 标准草案(试验性质的不完全支持)" +msgstr "遵循 ISO 2020 C++ 标准(试验性质的不完全支持)。" #: c-family/c.opt:2399 c-family/c.opt:2403 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2017(?) C++ draft standard (experimental and incomplete support)" +#, no-c-format msgid "Conform to the ISO 2023 C++ draft standard (experimental and incomplete support)." -msgstr "遵循 ISO 2017(?) C++ 标准草案(试验性质的不完全支持)" +msgstr "遵循 ISO 2023 C++ 标准草案(试验性质的不完全支持)。" #: c-family/c.opt:2407 c-family/c.opt:2545 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2011 C++ standard" +#, no-c-format msgid "Conform to the ISO 2011 C standard." -msgstr "遵循 ISO 2011 C++ 标准" +msgstr "遵循 ISO 2011 C 标准。" #: c-family/c.opt:2411 -#, fuzzy, no-c-format +#, no-c-format msgid "Deprecated in favor of -std=c11." -msgstr "已弃用,请改用 -std=c99" +msgstr "已弃用,请改用 -std=c11。" #: c-family/c.opt:2415 c-family/c.opt:2419 c-family/c.opt:2549 #: c-family/c.opt:2553 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2011 C++ standard" +#, no-c-format msgid "Conform to the ISO 2017 C standard (published in 2018)." -msgstr "遵循 ISO 2011 C++ 标准" +msgstr "遵循 ISO 2017 C 标准(于2018年发布)。" #: c-family/c.opt:2423 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2017(?) C++ draft standard (experimental and incomplete support)" +#, no-c-format msgid "Conform to the ISO 202X C standard draft (experimental and incomplete support)." -msgstr "遵循 ISO 2017(?) C++ 标准草案(试验性质的不完全支持)" +msgstr "遵循 ISO 202X C++ 标准草案(试验性质的不完全支持)。" #: c-family/c.opt:2427 c-family/c.opt:2431 c-family/c.opt:2529 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1990 C standard" +#, no-c-format msgid "Conform to the ISO 1990 C standard." -msgstr "遵循 ISO 1990 C 标准" +msgstr "遵循 ISO 1990 C 标准。" #: c-family/c.opt:2435 c-family/c.opt:2537 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1999 C standard" +#, no-c-format msgid "Conform to the ISO 1999 C standard." -msgstr "遵循 ISO 1999 C 标准" +msgstr "遵循 ISO 1999 C 标准。" #: c-family/c.opt:2439 -#, fuzzy, no-c-format -#| msgid "Deprecated in favor of -std=c99" +#, no-c-format msgid "Deprecated in favor of -std=c99." -msgstr "已弃用,请改用 -std=c99" +msgstr "已弃用,请改用 -std=c99。" #: c-family/c.opt:2443 c-family/c.opt:2448 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum" +#, no-c-format msgid "Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum with GNU extensions." -msgstr "遵循 ISO 1998 C++ 标准于 2003 年的技术勘误版本" +msgstr "遵循 ISO 1998 C++ 标准于 2003 年的技术勘误版本,也支持 GNU 扩展。" #: c-family/c.opt:2453 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1990 C standard with GNU extensions" +#, no-c-format msgid "Conform to the ISO 2011 C++ standard with GNU extensions." -msgstr "遵循 ISO 1990 C 标准,也支持 GNU 扩展" +msgstr "遵循 ISO 2011 C++ 标准,也支持 GNU 扩展。" #: c-family/c.opt:2457 #, no-c-format @@ -3775,10 +3741,9 @@ msgid "Deprecated in favor of -std=gnu++14." msgstr "已弃用,请改用 -std=gnu++14。" #: c-family/c.opt:2465 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1990 C standard with GNU extensions" +#, no-c-format msgid "Conform to the ISO 2014 C++ standard with GNU extensions." -msgstr "遵循 ISO 1990 C 标准,也支持 GNU 扩展" +msgstr "遵循 ISO 2014 C++ 标准,也支持 GNU 扩展。" #: c-family/c.opt:2469 #, no-c-format @@ -3786,10 +3751,9 @@ msgid "Deprecated in favor of -std=gnu++17." msgstr "已弃用,请改用 -std=gnu+17。" #: c-family/c.opt:2473 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1990 C standard with GNU extensions" +#, no-c-format msgid "Conform to the ISO 2017 C++ standard with GNU extensions." -msgstr "遵循 ISO 1990 C 标准,也支持 GNU 扩展" +msgstr "遵循 ISO 2017 C++ 标准,也支持 GNU 扩展。" #: c-family/c.opt:2477 c-family/c.opt:2481 #, fuzzy, no-c-format @@ -3859,7 +3823,7 @@ msgstr "已弃用,为 -std=iso9899:1999 所取代" #: c-family/c.opt:2557 #, no-c-format msgid "-stdlib=[libstdc++|libc++]\tThe standard library to be used for C++ headers and runtime." -msgstr "" +msgstr "-stdlib=[libstdc++|libc++]\t要为 C++ 头文件和运行时使用的标准库。" #: c-family/c.opt:2574 #, no-c-format @@ -3872,10 +3836,9 @@ msgid "-trigraphs\tSupport ISO C trigraphs." msgstr "-trigraphs\t支持 ISO C 三元符。" #: c-family/c.opt:2582 -#, fuzzy, no-c-format -#| msgid "Do not predefine system-specific and GCC-specific macros" +#, no-c-format msgid "Do not predefine system-specific and GCC-specific macros." -msgstr "不预定义系统或 GCC 特定的宏" +msgstr "不预定义系统或 GCC 特有的宏。" #: ada/gcc-interface/lang.opt:61 #, no-c-format @@ -3893,9 +3856,9 @@ msgid "Do not look for object files in standard path." msgstr "不找寻目的文件在中标准路径" #: ada/gcc-interface/lang.opt:77 -#, fuzzy, no-c-format +#, no-c-format msgid "Select the runtime." -msgstr "运行时名称。" +msgstr "选择运行时。" #: ada/gcc-interface/lang.opt:93 #, fuzzy, no-c-format @@ -3916,7 +3879,7 @@ msgstr "-gnat<选项>\t指定给 GNAT 的选项" #: ada/gcc-interface/lang.opt:105 #, no-c-format msgid "Ignored." -msgstr "" +msgstr "已忽略。" #: d/lang.opt:51 #, no-c-format @@ -3947,10 +3910,9 @@ msgid "Warn from speculative compiles such as __traits(compiles)." msgstr "" #: d/lang.opt:163 -#, fuzzy, no-c-format -#| msgid "Generate H8S code." +#, no-c-format msgid "Generate JSON file." -msgstr "生成 H8S 代码。" +msgstr "生成 JSON 文件。" #: d/lang.opt:167 #, fuzzy, no-c-format @@ -4172,10 +4134,9 @@ msgid "Disable access to variables marked `@system' from @safe code." msgstr "认为按字节访问内存速度较慢。" #: d/lang.opt:413 -#, fuzzy, no-c-format -#| msgid "Display the compiler's version" +#, no-c-format msgid "Compile release version." -msgstr "显示编译器版本" +msgstr "编译发布版本。" #: d/lang.opt:417 #, no-c-format @@ -5109,22 +5070,19 @@ msgid "Force functions to be aligned to a 4 byte boundary." msgstr "将函数强行对齐到 4 字节边界上" #: config/mcore/mcore.opt:35 config/moxie/moxie.opt:23 config/csky/csky.opt:44 -#, fuzzy, no-c-format -#| msgid "Generate big-endian code" +#, no-c-format msgid "Generate big-endian code." -msgstr "生成大端在前的代码" +msgstr "生成大端在前的代码。" #: config/mcore/mcore.opt:39 -#, fuzzy, no-c-format -#| msgid "Emit call graph information" +#, no-c-format msgid "Emit call graph information." -msgstr "生成调用图信息" +msgstr "生成调用图信息。" #: config/mcore/mcore.opt:43 -#, fuzzy, no-c-format -#| msgid "Use the divide instruction" +#, no-c-format msgid "Use the divide instruction." -msgstr "使用除法指令" +msgstr "使用除法指令。" #: config/mcore/mcore.opt:47 #, fuzzy, no-c-format @@ -5133,10 +5091,9 @@ msgid "Inline constants if it can be done in 2 insns or less." msgstr "当常量可以为两个以下的指令生成时内联常量" #: config/mcore/mcore.opt:51 config/moxie/moxie.opt:27 config/csky/csky.opt:51 -#, fuzzy, no-c-format -#| msgid "Generate little-endian code" +#, no-c-format msgid "Generate little-endian code." -msgstr "生成小端在前的代码" +msgstr "生成小端在前的代码。" #: config/mcore/mcore.opt:56 config/fr30/fr30.opt:27 #, fuzzy, no-c-format @@ -5163,10 +5120,9 @@ msgid "Set the maximum amount for a single stack increment operation." msgstr "设定单个堆栈增量操作运算总量的上限" #: config/mcore/mcore.opt:75 -#, fuzzy, no-c-format -#| msgid "Always treat bitfields as int-sized" +#, no-c-format msgid "Always treat bitfields as int-sized." -msgstr "总认为位段长与 int 相同" +msgstr "总认为位段长与 int 相同。" #: config/linux-android.opt:23 #, no-c-format @@ -5606,10 +5562,9 @@ msgid "(Obsolete, ld_classic only) -seg_addr_table_filename <path>." msgstr "" #: config/darwin.opt:321 -#, fuzzy, no-c-format -#| msgid "Synonym for -Wcomment." +#, no-c-format msgid "Synonym for \"image_base\"." -msgstr "-Wcomment 的同义词。" +msgstr "“image_base”的同义词。" #: config/darwin.opt:325 #, no-c-format @@ -5848,100 +5803,84 @@ msgid "Use IEEE math for fp comparisons." msgstr "浮点数间的比较严格遵循 IEEE 标准" #: config/m68k/m68k.opt:30 -#, fuzzy, no-c-format -#| msgid "Generate code for a 520X" +#, no-c-format msgid "Generate code for a 520X." -msgstr "为 520X 生成代码" +msgstr "为 520X 生成代码。" #: config/m68k/m68k.opt:34 -#, fuzzy, no-c-format -#| msgid "Generate code for a 5206e" +#, no-c-format msgid "Generate code for a 5206e." -msgstr "为 5206e 生成代码" +msgstr "为 5206e 生成代码。" #: config/m68k/m68k.opt:38 -#, fuzzy, no-c-format -#| msgid "Generate code for a 528x" +#, no-c-format msgid "Generate code for a 528x." -msgstr "为 528x 生成代码" +msgstr "为 528x 生成代码。" #: config/m68k/m68k.opt:42 -#, fuzzy, no-c-format -#| msgid "Generate code for a 5307" +#, no-c-format msgid "Generate code for a 5307." -msgstr "为 5307 生成代码" +msgstr "为 5307 生成代码。" #: config/m68k/m68k.opt:46 -#, fuzzy, no-c-format -#| msgid "Generate code for a 5407" +#, no-c-format msgid "Generate code for a 5407." -msgstr "为 5407 生成代码" +msgstr "为 5407 生成代码。" #: config/m68k/m68k.opt:50 config/m68k/m68k.opt:111 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68000" +#, no-c-format msgid "Generate code for a 68000." -msgstr "为 68000 生成代码" +msgstr "为 68000 生成代码。" #: config/m68k/m68k.opt:54 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68010" +#, no-c-format msgid "Generate code for a 68010." -msgstr "为 68010 生成代码" +msgstr "为 68010 生成代码。" #: config/m68k/m68k.opt:58 config/m68k/m68k.opt:115 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68020" +#, no-c-format msgid "Generate code for a 68020." -msgstr "为 68020 生成代码" +msgstr "为 68020 生成代码。" #: config/m68k/m68k.opt:62 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68040, without any new instructions" +#, no-c-format msgid "Generate code for a 68040, without any new instructions." -msgstr "为 68040 生成代码,不使用新指令" +msgstr "为 68040 生成代码,不使用新指令。" #: config/m68k/m68k.opt:66 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68060, without any new instructions" +#, no-c-format msgid "Generate code for a 68060, without any new instructions." -msgstr "为 68060 生成代码,不使用新指令" +msgstr "为 68060 生成代码,不使用新指令。" #: config/m68k/m68k.opt:70 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68030" +#, no-c-format msgid "Generate code for a 68030." -msgstr "为 68030 生成代码" +msgstr "为 68030 生成代码。" #: config/m68k/m68k.opt:74 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68040" +#, no-c-format msgid "Generate code for a 68040." -msgstr "为 68040 生成代码" +msgstr "为 68040 生成代码。" #: config/m68k/m68k.opt:78 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68060" +#, no-c-format msgid "Generate code for a 68060." -msgstr "为 68060 生成代码" +msgstr "为 68060 生成代码。" #: config/m68k/m68k.opt:82 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68302" +#, no-c-format msgid "Generate code for a 68302." -msgstr "为 68302 生成代码" +msgstr "为 68302 生成代码。" #: config/m68k/m68k.opt:86 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68332" +#, no-c-format msgid "Generate code for a 68332." -msgstr "为 68332 生成代码" +msgstr "为 68332 生成代码。" #: config/m68k/m68k.opt:91 -#, fuzzy, no-c-format -#| msgid "Generate code for a 68851" +#, no-c-format msgid "Generate code for a 68851." -msgstr "为 68851 生成代码" +msgstr "为 68851 生成代码。" #: config/m68k/m68k.opt:95 #, fuzzy, no-c-format @@ -6387,9 +6326,9 @@ msgid "For shift operations by a constant amount, which require an individual in msgstr "" #: config/aarch64/aarch64.opt:49 -#, fuzzy, no-c-format +#, no-c-format msgid "The possible TLS dialects:" -msgstr "假定大的线程局部存储段" +msgstr "" #: config/aarch64/aarch64.opt:61 config/loongarch/loongarch.opt:171 #, no-c-format @@ -6581,28 +6520,24 @@ msgid "Limit how much the autovectorizer may unroll a loop." msgstr "" #: config/linux.opt:24 -#, fuzzy, no-c-format -#| msgid "Use Bionic C library" +#, no-c-format msgid "Use Bionic C library." -msgstr "使用 Bionic C 标准库" +msgstr "使用 Bionic C 标准库。" #: config/linux.opt:28 -#, fuzzy, no-c-format -#| msgid "Use GNU C library" +#, no-c-format msgid "Use GNU C library." -msgstr "使用 GNU C 标准库" +msgstr "使用 GNU C 标准库。" #: config/linux.opt:32 -#, fuzzy, no-c-format -#| msgid "Use uClibc C library" +#, no-c-format msgid "Use uClibc C library." -msgstr "使用 uClibc C 标准库" +msgstr "使用 uClibc C 标准库。" #: config/linux.opt:36 -#, fuzzy, no-c-format -#| msgid "Use uClibc C library" +#, no-c-format msgid "Use musl C library." -msgstr "使用 uClibc C 标准库" +msgstr "使用 musl C 标准库。" #: config/ia64/ilp32.opt:3 #, fuzzy, no-c-format @@ -6617,28 +6552,24 @@ msgid "Generate LP64 code." msgstr "生成 LP64 代码" #: config/ia64/ia64.opt:28 -#, fuzzy, no-c-format -#| msgid "Generate big endian code" +#, no-c-format msgid "Generate big endian code." -msgstr "生成大端在前的代码" +msgstr "生成大端在前的代码。" #: config/ia64/ia64.opt:32 -#, fuzzy, no-c-format -#| msgid "Generate little endian code" +#, no-c-format msgid "Generate little endian code." -msgstr "生成小端在前的代码" +msgstr "生成小端在前的代码。" #: config/ia64/ia64.opt:36 -#, fuzzy, no-c-format -#| msgid "Generate code for GNU as" +#, no-c-format msgid "Generate code for GNU as." -msgstr "为 GNU as 生成代码" +msgstr "为 GNU as 生成代码。" #: config/ia64/ia64.opt:40 -#, fuzzy, no-c-format -#| msgid "Generate code for GNU ld" +#, no-c-format msgid "Generate code for GNU ld." -msgstr "为 GNU ld 生成代码" +msgstr "为 GNU ld 生成代码。" #: config/ia64/ia64.opt:44 #, fuzzy, no-c-format @@ -7282,10 +7213,9 @@ msgid "sizeof(long double) is 16." msgstr "sizeof(long double) 等于 16" #: config/i386/i386.opt:202 config/i386/i386.opt:370 -#, fuzzy, no-c-format -#| msgid "Use hardware fp" +#, no-c-format msgid "Use hardware fp." -msgstr "使用硬件浮点单元" +msgstr "使用硬件浮点单元。" #: config/i386/i386.opt:206 #, fuzzy, no-c-format @@ -7294,9 +7224,9 @@ msgid "sizeof(long double) is 12." msgstr "sizeof(long double) 等于 12" #: config/i386/i386.opt:210 -#, fuzzy, no-c-format +#, no-c-format msgid "Use 80-bit long double." -msgstr "使用 64 位 long double" +msgstr "使用 80 位 long double。" #: config/i386/i386.opt:214 config/s390/s390.opt:163 #: config/sparc/long-double-switch.opt:27 config/alpha/alpha.opt:102 @@ -8493,10 +8423,9 @@ msgid "Use software floating point." msgstr "使用软件浮点单元。" #: config/pa/pa.opt:152 -#, fuzzy, no-c-format -#| msgid "Use software floating point comparisons." +#, no-c-format msgid "Use software integer multiplication." -msgstr "使用软件浮点比较。" +msgstr "使用软件整型乘法。" #: config/pa/pa.opt:160 #, no-c-format @@ -8661,10 +8590,9 @@ msgid "-G<number>\tPut global and static data smaller than <number> bytes into a msgstr "-G<N>\t将小于 N 字节的全局和静态数据放入一个特殊的节中(在某些目标机上)" #: config/lynx.opt:23 -#, fuzzy, no-c-format -#| msgid "Support legacy multi-threading" +#, no-c-format msgid "Support legacy multi-threading." -msgstr "支持传统多线程" +msgstr "支持传统多线程。" #: config/lynx.opt:27 #, no-c-format @@ -8741,10 +8669,9 @@ msgid "Specify the PTX ISA version to use." msgstr "ELF 文件 ABI 版本无效" #: config/nvptx/nvptx.opt:139 -#, fuzzy, no-c-format -#| msgid "Use fp registers" +#, no-c-format msgid "Initialize ptx registers." -msgstr "使用浮点寄存器" +msgstr "初始化 ptx 寄存器。" #: config/vxworks.opt:36 #, fuzzy, no-c-format @@ -8797,10 +8724,9 @@ msgid "Use RJMP / RCALL even though CALL / JMP are available." msgstr "" #: config/avr/avr.opt:57 -#, fuzzy, no-c-format -#| msgid "Use an 8-bit 'int' type" +#, no-c-format msgid "Use an 8-bit 'int' type." -msgstr "使用 8 位‘int’类型" +msgstr "使用 8 位‘int’类型。" #: config/avr/avr.opt:61 #, fuzzy, no-c-format @@ -9661,16 +9587,14 @@ msgid "Use UltraSPARC Subtract-Extended-with-Carry instruction." msgstr "使用硬件浮点指令" #: config/sparc/sparc.opt:110 -#, fuzzy, no-c-format -#| msgid "Pointers are 64-bit" +#, no-c-format msgid "Pointers are 64-bit." -msgstr "指针是 64 位" +msgstr "指针是 64 位。" #: config/sparc/sparc.opt:114 -#, fuzzy, no-c-format -#| msgid "Pointers are 32-bit" +#, no-c-format msgid "Pointers are 32-bit." -msgstr "指针是 32 位" +msgstr "指针是 32 位。" #: config/sparc/sparc.opt:118 #, no-c-format @@ -9755,16 +9679,14 @@ msgid "Specify the memory model in effect for the program." msgstr "指定内存式样在中效果用于程序。" #: config/rs6000/darwin.opt:38 config/rs6000/sysv4.opt:145 -#, fuzzy, no-c-format -#| msgid "Generate 64-bit code" +#, no-c-format msgid "Generate 64-bit code." -msgstr "生成 64 位代码" +msgstr "生成 64 位代码。" #: config/rs6000/darwin.opt:42 config/rs6000/sysv4.opt:149 -#, fuzzy, no-c-format -#| msgid "Generate 32-bit code" +#, no-c-format msgid "Generate 32-bit code." -msgstr "生成 32 位代码" +msgstr "生成 32 位代码。" #: config/rs6000/rs6000-tables.opt:24 #, no-c-format @@ -11975,10 +11897,9 @@ msgid "Known FR-V CPUs (for use with the -mcpu= option):" msgstr "已知 FR-V 处理器 (用于 -mcpu= 选项):" #: config/frv/frv.opt:122 -#, fuzzy, no-c-format -#| msgid "Use fp double instructions" +#, no-c-format msgid "Use fp double instructions." -msgstr "使用浮点双精度指令" +msgstr "使用浮点双精度指令。" #: config/frv/frv.opt:126 #, fuzzy, no-c-format @@ -12647,16 +12568,14 @@ msgid "Work around bug in multiplication instruction." msgstr "为乘法指令中的缺陷提供变通" #: config/cris/cris.opt:51 -#, fuzzy, no-c-format -#| msgid "Compile for ETRAX 4 (CRIS v3)" +#, no-c-format msgid "Compile for ETRAX 4 (CRIS v3)." -msgstr "为 ETRAX 4 (CRIS v3) 编译" +msgstr "为 ETRAX 4 (CRIS v3) 编译。" #: config/cris/cris.opt:56 -#, fuzzy, no-c-format -#| msgid "Compile for ETRAX 100 (CRIS v8)" +#, no-c-format msgid "Compile for ETRAX 100 (CRIS v8)." -msgstr "为 ETRAX 100 (CRIS v8) 编译" +msgstr "为 ETRAX 100 (CRIS v8) 编译。" #: config/cris/cris.opt:64 #, fuzzy, no-c-format @@ -12768,16 +12687,14 @@ msgid "Runtime name." msgstr "运行时名称。" #: config/sh/sh.opt:42 -#, fuzzy, no-c-format -#| msgid "Generate SH1 code" +#, no-c-format msgid "Generate SH1 code." -msgstr "生成 SH1 代码" +msgstr "生成 SH1 代码。" #: config/sh/sh.opt:46 -#, fuzzy, no-c-format -#| msgid "Generate SH2 code" +#, no-c-format msgid "Generate SH2 code." -msgstr "生成 SH2 代码" +msgstr "生成 SH2 代码。" #: config/sh/sh.opt:50 #, fuzzy, no-c-format @@ -12804,46 +12721,39 @@ msgid "Generate only single-precision SH2a-FPU code." msgstr "只生成单精度 SH4a-FPU 代码" #: config/sh/sh.opt:66 -#, fuzzy, no-c-format -#| msgid "Generate SH2e code" +#, no-c-format msgid "Generate SH2e code." -msgstr "生成 SH2e 代码" +msgstr "生成 SH2e 代码。" #: config/sh/sh.opt:70 -#, fuzzy, no-c-format -#| msgid "Generate SH3 code" +#, no-c-format msgid "Generate SH3 code." -msgstr "生成 SH3 代码" +msgstr "生成 SH3 代码。" #: config/sh/sh.opt:74 -#, fuzzy, no-c-format -#| msgid "Generate SH3e code" +#, no-c-format msgid "Generate SH3e code." -msgstr "生成 SH3e 代码" +msgstr "生成 SH3e 代码。" #: config/sh/sh.opt:78 -#, fuzzy, no-c-format -#| msgid "Generate SH4 code" +#, no-c-format msgid "Generate SH4 code." -msgstr "生成 SH4 代码" +msgstr "生成 SH4 代码。" #: config/sh/sh.opt:82 -#, fuzzy, no-c-format -#| msgid "Generate SH4-100 code" +#, no-c-format msgid "Generate SH4-100 code." -msgstr "生成 SH4-100 代码" +msgstr "生成 SH4-100 代码。" #: config/sh/sh.opt:86 -#, fuzzy, no-c-format -#| msgid "Generate SH4-200 code" +#, no-c-format msgid "Generate SH4-200 code." -msgstr "生成 SH4-200 代码" +msgstr "生成 SH4-200 代码。" #: config/sh/sh.opt:92 -#, fuzzy, no-c-format -#| msgid "Generate SH4-300 code" +#, no-c-format msgid "Generate SH4-300 code." -msgstr "生成 SH4-300 代码" +msgstr "生成 SH4-300 代码。" #: config/sh/sh.opt:96 #, fuzzy, no-c-format @@ -12935,10 +12845,9 @@ msgid "Generate only single-precision SH4-300 code." msgstr "只生成单精度 SH4-300 代码" #: config/sh/sh.opt:159 -#, fuzzy, no-c-format -#| msgid "Generate SH4a code" +#, no-c-format msgid "Generate SH4a code." -msgstr "生成 SH4a 代码" +msgstr "生成 SH4a 代码。" #: config/sh/sh.opt:163 #, fuzzy, no-c-format @@ -13480,16 +13389,14 @@ msgid "-mipsN\tGenerate code for ISA level N." msgstr "-mipsN\t为级别 N 的 ISA 生成代码" #: config/mips/mips.opt:268 -#, fuzzy, no-c-format -#| msgid "Generate MIPS16 code" +#, no-c-format msgid "Generate MIPS16 code." -msgstr "生成 MIPS16 代码" +msgstr "生成 MIPS16 代码。" #: config/mips/mips.opt:272 -#, fuzzy, no-c-format -#| msgid "Use MIPS-3D instructions" +#, no-c-format msgid "Use MIPS-3D instructions." -msgstr "使用 MIPS-3D 指令" +msgstr "使用 MIPS-3D 指令。" #: config/mips/mips.opt:276 #, fuzzy, no-c-format @@ -13616,10 +13523,9 @@ msgid "When generating -mabicalls code, make the code suitable for use in shared msgstr "生成 -mabicalls 代码时,使代码可用于共享库" #: config/mips/mips.opt:373 -#, fuzzy, no-c-format -#| msgid "Use SmartMIPS instructions" +#, no-c-format msgid "Use SmartMIPS instructions." -msgstr "使用 SmartMIPS 指令" +msgstr "使用 SmartMIPS 指令。" #: config/mips/mips.opt:381 #, fuzzy, no-c-format @@ -13655,9 +13561,9 @@ msgid "Generate code with unaligned load store, valid for MIPS R6." msgstr "" #: config/mips/mips.opt:417 -#, fuzzy, no-c-format +#, no-c-format msgid "Use Virtualization (VZ) instructions." -msgstr "使用十进制浮点指令" +msgstr "使用虚拟化(VZ)指令。" #: config/mips/mips.opt:421 #, fuzzy, no-c-format @@ -13771,10 +13677,9 @@ msgid "Generate ARCompact 32-bit code for ARC600 processor." msgstr "" #: config/arc/arc.opt:42 -#, fuzzy, no-c-format -#| msgid "Same as -mA6" +#, no-c-format msgid "Same as -mA6." -msgstr "与 -mA6 相同" +msgstr "与 -mA6 相同。" #: config/arc/arc.opt:46 #, no-c-format @@ -13787,10 +13692,9 @@ msgid "Generate ARCompact 32-bit code for ARC700 processor." msgstr "" #: config/arc/arc.opt:54 -#, fuzzy, no-c-format -#| msgid "Same as -mA7" +#, no-c-format msgid "Same as -mA7." -msgstr "与 -mA7 相同" +msgstr "与 -mA7 相同。" #: config/arc/arc.opt:58 #, no-c-format @@ -14195,23 +14099,22 @@ msgstr "自动变量未初始化时警告" #: lto/lang.opt:94 #, no-c-format msgid "Sort the symbols alphabetically." -msgstr "" +msgstr "按字母顺序对符号进行排序。" #: lto/lang.opt:98 #, no-c-format msgid "Sort the symbols according to size." -msgstr "" +msgstr "根据大小对符号进行排序。" #: lto/lang.opt:102 -#, fuzzy, no-c-format -#| msgid "Display the compiler's version" +#, no-c-format msgid "Display the symbols in reverse order." -msgstr "显示编译器版本" +msgstr "以逆序显示符号。" #: lto/lang.opt:109 #, no-c-format msgid "Dump the details of LTO objects." -msgstr "" +msgstr "转储 LTO 对象的详细信息。" #: lto/lang.opt:113 #, no-c-format @@ -14244,10 +14147,9 @@ msgid "Provide bash completion for options starting with provided string." msgstr "" #: common.opt:295 -#, fuzzy, no-c-format -#| msgid "Display this information" +#, no-c-format msgid "Display this information." -msgstr "显示此信息" +msgstr "显示此信息。" #: common.opt:299 #, fuzzy, no-c-format @@ -17168,28 +17070,24 @@ msgid "Do not display functions compiled or elapsed time." msgstr "不显示编译的函数或逝去的时间" #: common.opt:3594 -#, fuzzy, no-c-format -#| msgid "Enable verbose output" +#, no-c-format msgid "Enable verbose output." -msgstr "启用详细输出" +msgstr "启用详细输出。" #: common.opt:3598 -#, fuzzy, no-c-format -#| msgid "Display the compiler's version" +#, no-c-format msgid "Display the compiler's version." -msgstr "显示编译器版本" +msgstr "显示编译器版本。" #: common.opt:3602 -#, fuzzy, no-c-format -#| msgid "Suppress warnings" +#, no-c-format msgid "Suppress warnings." -msgstr "不显示警告" +msgstr "不显示警告。" #: common.opt:3612 -#, fuzzy, no-c-format -#| msgid "Create a shared library" +#, no-c-format msgid "Create a shared library." -msgstr "生成一个共享库" +msgstr "生成一个共享库。" #: common.opt:3672 #, fuzzy, no-c-format @@ -18771,10 +18669,9 @@ msgstr "无法打开 %s 并写入:%m" #. indicating what's gone wrong (also for DejaGnu, for pruning #. those messages). #: diagnostic-format-sarif.cc:1630 -#, fuzzy, c-format -#| msgid "internal compiler error: " +#, c-format msgid "Internal compiler error:\n" -msgstr "编译器内部错误:" +msgstr "编译器内部错误:\n" #: diagnostic.cc:160 #, c-format @@ -19247,7 +19144,7 @@ msgstr "支持的 LTO 压缩算法:zlib" #: gcc.cc:7545 #, c-format msgid " zstd" -msgstr "" +msgstr " zstd" #: gcc.cc:7547 gcov.cc:1510 gcov.cc:1568 gcov.cc:1580 gcov.cc:2903 #, c-format @@ -19518,10 +19415,9 @@ msgstr "" "%s。\n" #: gcov-tool.cc:595 -#, fuzzy, c-format -#| msgid "Copyright %s 2019 Free Software Foundation, Inc.\n" +#, c-format msgid "Copyright %s 2023 Free Software Foundation, Inc.\n" -msgstr "版权所有 %s 2019 自由软件基金会。\n" +msgstr "版权所有 %s 2023 自由软件基金会。\n" #: gcov.cc:925 #, c-format @@ -19666,24 +19562,23 @@ msgid " -x, --hash-filenames Hash long pathnames\n" msgstr " -m, --demangled-names 输出解码后的函数名\n" #: gcov.cc:953 -#, fuzzy, c-format -#| msgid "Options:\n" +#, c-format msgid "" "\n" "Obsolete options:\n" -msgstr "选项:\n" +msgstr "" +"\n" +"过时的选项:\n" #: gcov.cc:954 -#, fuzzy, c-format -#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n" +#, c-format msgid " -i, --json-format Replaced with -j, --json-format\n" -msgstr " -i, --json-format 以 JSON 中间格式输出至 .gcov.json.gz 文件\n" +msgstr " -i, --json-format 被 -j, --json-format 替代\n" #: gcov.cc:955 -#, fuzzy, c-format -#| msgid " -j, --human-readable Output human readable numbers\n" +#, c-format msgid " -j, --human-readable Replaced with -H, --human-readable\n" -msgstr " -j, --human-readable 输出人类可读的数字\n" +msgstr " -j, --human-readable 被 -H, --human-readable 替代\n" #: gcov.cc:966 #, c-format @@ -20126,10 +20021,9 @@ msgid "during %s pass: %s\n" msgstr "演绎 %qT 为 %qT" #: passes.cc:1844 -#, fuzzy, c-format -#| msgid "open %s failed: %s" +#, c-format msgid "dump file: %s\n" -msgstr "打开 %s 失败:%s" +msgstr "转储文件:%s\n" #: plugin.cc:965 msgid "Event" @@ -22005,10 +21899,8 @@ msgid "illegal operand address (4)" msgstr "检测到无效的操作数" #: config/xtensa/xtensa-dynconfig.cc:63 -#, fuzzy -#| msgid "Generate code for a DLL" msgid "Unable to load DLL." -msgstr "生成动态链接库的代码" +msgstr "无法加载 DLL。" #: config/xtensa/xtensa.cc:831 config/xtensa/xtensa.cc:869 msgid "bad test" @@ -22232,10 +22124,8 @@ msgid "expected label" msgstr "需要通道" #: cp/call.cc:4067 -#, fuzzy -#| msgid "candidate 1:" msgid "candidate:" -msgstr "备选 1:" +msgstr "备选:" #: cp/call.cc:8208 #, fuzzy @@ -22757,32 +22647,24 @@ msgid "obsolescent in Fortran 95" msgstr "" #: fortran/intrinsic.cc:4873 -#, fuzzy msgid "deleted in Fortran 95" -msgstr "在%q+D中缺少数组大小" +msgstr "在 Fortran 95 中删除" #: fortran/intrinsic.cc:4877 -#, fuzzy msgid "new in Fortran 95" -msgstr "Fortran 2003:%C处的 PAD= 不允许用在 Fortran 95 中" +msgstr "在 Fortran 95 中新增" #: fortran/intrinsic.cc:4881 -#, fuzzy -#| msgid "Fortran 2018:" msgid "new in Fortran 2003" -msgstr "Fortran 2018:" +msgstr "在 Fortran 2003 中新增" #: fortran/intrinsic.cc:4885 -#, fuzzy -#| msgid "Fortran 2018:" msgid "new in Fortran 2008" -msgstr "Fortran 2018:" +msgstr "在 Fortran 2008 中新增" #: fortran/intrinsic.cc:4889 -#, fuzzy -#| msgid "Fortran 2018:" msgid "new in Fortran 2018" -msgstr "Fortran 2018:" +msgstr "在 Fortran 2018 中新增" #: fortran/intrinsic.cc:4893 #, fuzzy @@ -23293,7 +23175,7 @@ msgstr "无效的影像号码 %d 在中同步影像" #: fortran/trans-stmt.cc:2488 msgid "Loop iterates infinitely" -msgstr "" +msgstr "循环无限次迭代" #: fortran/trans-stmt.cc:2508 fortran/trans-stmt.cc:2764 msgid "Loop variable has been modified" @@ -23308,10 +23190,9 @@ msgid "Array reference out of bounds" msgstr "对数组的引用超出范围" #: fortran/trans.cc:742 fortran/trans.cc:817 -#, fuzzy, c-format -#| msgid "Memory allocation failed" +#, c-format msgid "Error allocating %lu bytes" -msgstr "内存分配失败" +msgstr "分配 %lu 字节出错" #: fortran/trans.cc:1026 #, fuzzy, c-format @@ -23737,9 +23618,9 @@ msgid "func can only be compared to nil" msgstr "重复的类只会被编译一次" #: go/gofrontend/types.cc:568 -#, fuzzy, c-format +#, c-format msgid "invalid operation (%s)" -msgstr "操作无效的对象" +msgstr "无效的操作(%s)" #: go/gofrontend/types.cc:591 #, fuzzy @@ -24159,9 +24040,9 @@ msgid "mismatching parens" msgstr "参数不匹配" #: jit/docs/examples/tut05-bf.c:310 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "unable to open file" -msgstr "无法开启基本文件:%s" +msgstr "无法打开文件" #: m2/gm2-gcc/m2assert.h:36 m2/gm2-gcc/m2assert.h:59 #, gcc-internal-format, gfc-internal-format @@ -24275,16 +24156,14 @@ msgid "missing mapper" msgstr "缺少数字" #: c-family/c.opt:1930 -#, fuzzy, gcc-internal-format -#| msgid "missing number" +#, gcc-internal-format msgid "missing header name" -msgstr "缺少数字" +msgstr "" #: c-family/c.opt:1938 -#, fuzzy, gcc-internal-format -#| msgid "missing open paren" +#, gcc-internal-format msgid "missing module name" -msgstr "缺少左括号" +msgstr "缺少模块名称" #: c-family/c.opt:1985 #, fuzzy, gcc-internal-format @@ -24307,10 +24186,9 @@ msgid "unknown checkaction setting %qs" msgstr "未知的 TLS 模型%qs" #: d/lang.opt:303 -#, fuzzy, gcc-internal-format -#| msgid "unknown TLS model %qs" +#, gcc-internal-format msgid "unknown C++ standard %qs" -msgstr "未知的 TLS 模型 %qs" +msgstr "未知的 C++ 标准 %qs" #: config/vms/vms.opt:42 #, fuzzy, gcc-internal-format @@ -26094,9 +25972,9 @@ msgid "nodes with unreleased memory found" msgstr "找到未释放内存的节点" #: collect-utils.cc:106 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "cannot get program status: %m" -msgstr "无法获取程序状态:%s" +msgstr "无法获取程序状态:%m" #: collect-utils.cc:120 #, gcc-internal-format, gfc-internal-format @@ -26141,10 +26019,9 @@ msgid "%s: %m" msgstr "%s:%m" #: collect2.cc:613 -#, fuzzy, gcc-internal-format -#| msgid "environment variable COLLECT_GCC must be set" +#, gcc-internal-format msgid "environment variable %<COLLECT_LTO_WRAPPER%> must be set" -msgstr "环境变量 COLLECT_GCC 必须被设置" +msgstr "环境变量 %<COLLECT_LTO_WRAPPER%> 必须被设置" #: collect2.cc:756 #, gcc-internal-format, gfc-internal-format @@ -26169,8 +26046,7 @@ msgstr "LTO 支持在此配置下未被启用" #: collect2.cc:1324 graph.cc:55 lto-wrapper.cc:1720 lto-wrapper.cc:1776 #: toplev.cc:1513 objc/objc-act.cc:459 -#, fuzzy, gcc-internal-format -#| msgid "can't open %s: %m" +#, gcc-internal-format msgid "cannot open %s: %m" msgstr "无法打开 %s:%m" @@ -26198,15 +26074,14 @@ msgid "%s: %s" msgstr "%s:%s" #: collect2.cc:2359 -#, fuzzy, gcc-internal-format -#| msgid "cannot find 'nm'" +#, gcc-internal-format msgid "cannot find %<nm%>" -msgstr "找不到 ‘nm’" +msgstr "找不到 %<nm%>" #: collect2.cc:2407 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "cannot open nm output: %m" -msgstr "无法打开 %s:%m" +msgstr "无法打开 nm 输出:%m" #: collect2.cc:2462 #, gcc-internal-format, gfc-internal-format @@ -26219,10 +26094,9 @@ msgid "fini function found in object %s" msgstr "在对象 %s 中发现 fini 函数" #: collect2.cc:2530 -#, fuzzy, gcc-internal-format -#| msgid "cannot find 'ldd'" +#, gcc-internal-format msgid "cannot find %<ldd%>" -msgstr "找不到‘ldd’" +msgstr "找不到 %<ldd%>" #: collect2.cc:2576 #, fuzzy, gcc-internal-format diff --git a/gcc/postreload-gcse.cc b/gcc/postreload-gcse.cc index 84e4f89..141b5ae 100644 --- a/gcc/postreload-gcse.cc +++ b/gcc/postreload-gcse.cc @@ -487,9 +487,10 @@ static void dump_hash_table (FILE *file) { fprintf (file, "\n\nexpression hash table\n"); - fprintf (file, "size %ld, %ld elements, %f collision/search ratio\n", - (long) expr_table->size (), - (long) expr_table->elements (), + fprintf (file, "size " HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC + " elements, %f collision/search ratio\n", + (fmt_size_t) expr_table->size (), + (fmt_size_t) expr_table->elements (), expr_table->collisions ()); if (!expr_table->is_empty ()) { diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc index de454ab..67c213b 100644 --- a/gcc/pretty-print.cc +++ b/gcc/pretty-print.cc @@ -752,6 +752,9 @@ output_buffer::~output_buffer () obstack_free (&formatted_obstack, NULL); } +#ifndef PTRDIFF_MAX +#define PTRDIFF_MAX INTTYPE_MAXIMUM (ptrdiff_t) +#endif /* Format an integer given by va_arg (ARG, type-specifier T) where type-specifier is a precision modifier as indicated by PREC. F is @@ -769,7 +772,38 @@ output_buffer::~output_buffer () break; \ \ case 2: \ - pp_scalar (PP, "%" HOST_LONG_LONG_FORMAT F, va_arg (ARG, long long T)); \ + pp_scalar (PP, "%" HOST_LONG_LONG_FORMAT F, \ + va_arg (ARG, long long T)); \ + break; \ + \ + case 3: \ + if (T (-1) < T (0)) \ + pp_scalar (PP, "%" GCC_PRISZ F, \ + (fmt_size_t) va_arg (ARG, ssize_t)); \ + else \ + pp_scalar (PP, "%" GCC_PRISZ F, \ + (fmt_size_t) va_arg (ARG, size_t)); \ + break; \ + \ + case 4: \ + if (T (-1) >= T (0)) \ + { \ + unsigned long long a = va_arg (ARG, ptrdiff_t); \ + unsigned long long m = PTRDIFF_MAX; \ + m = 2 * m + 1; \ + pp_scalar (PP, "%" HOST_LONG_LONG_FORMAT F, \ + a & m); \ + } \ + else if (sizeof (ptrdiff_t) <= sizeof (int)) \ + pp_scalar (PP, "%" F, \ + (int) va_arg (ARG, ptrdiff_t)); \ + else if (sizeof (ptrdiff_t) <= sizeof (long)) \ + pp_scalar (PP, "%l" F, \ + (long int) va_arg (ARG, ptrdiff_t)); \ + else \ + pp_scalar (PP, "%" HOST_LONG_LONG_FORMAT F, \ + (long long int) \ + va_arg (ARG, ptrdiff_t)); \ break; \ \ default: \ @@ -1237,6 +1271,8 @@ on_end_quote (pretty_printer *pp, %ld, %li, %lo, %lu, %lx: long versions of the above. %lld, %lli, %llo, %llu, %llx: long long versions. %wd, %wi, %wo, %wu, %wx: HOST_WIDE_INT versions. + %zd, %zi, %zo, %zu, %zx: size_t versions. + %td, %ti, %to, %tu, %tx: ptrdiff_t versions. %f: double %c: character. %s: string. @@ -1422,7 +1458,7 @@ pp_format (pretty_printer *pp, obstack_1grow (&buffer->chunk_obstack, *p); p++; } - while (strchr ("qwl+#", p[-1])); + while (strchr ("qwlzt+#", p[-1])); if (p[-1] == '.') { @@ -1524,6 +1560,16 @@ pp_format (pretty_printer *pp, wide = true; continue; + case 'z': + gcc_assert (!precision); + precision = 3; + continue; + + case 't': + gcc_assert (!precision); + precision = 4; + continue; + case 'l': /* We don't support precision beyond that of "long long". */ gcc_assert (precision < 2); @@ -1570,8 +1616,8 @@ pp_format (pretty_printer *pp, if (wide) pp_wide_integer (pp, va_arg (*text->m_args_ptr, HOST_WIDE_INT)); else - pp_integer_with_precision - (pp, *text->m_args_ptr, precision, int, "d"); + pp_integer_with_precision (pp, *text->m_args_ptr, precision, + int, "d"); break; case 'o': @@ -1579,8 +1625,8 @@ pp_format (pretty_printer *pp, pp_scalar (pp, "%" HOST_WIDE_INT_PRINT "o", va_arg (*text->m_args_ptr, unsigned HOST_WIDE_INT)); else - pp_integer_with_precision - (pp, *text->m_args_ptr, precision, unsigned, "o"); + pp_integer_with_precision (pp, *text->m_args_ptr, precision, + unsigned, "o"); break; case 's': @@ -1599,8 +1645,8 @@ pp_format (pretty_printer *pp, pp_scalar (pp, HOST_WIDE_INT_PRINT_UNSIGNED, va_arg (*text->m_args_ptr, unsigned HOST_WIDE_INT)); else - pp_integer_with_precision - (pp, *text->m_args_ptr, precision, unsigned, "u"); + pp_integer_with_precision (pp, *text->m_args_ptr, precision, + unsigned, "u"); break; case 'f': @@ -1629,8 +1675,8 @@ pp_format (pretty_printer *pp, pp_scalar (pp, HOST_WIDE_INT_PRINT_HEX, va_arg (*text->m_args_ptr, unsigned HOST_WIDE_INT)); else - pp_integer_with_precision - (pp, *text->m_args_ptr, precision, unsigned, "x"); + pp_integer_with_precision (pp, *text->m_args_ptr, precision, + unsigned, "x"); break; case '.': @@ -2774,6 +2820,18 @@ test_pp_format () ASSERT_PP_FORMAT_2 ("17 12345678", "%wo %x", (HOST_WIDE_INT)15, 0x12345678); ASSERT_PP_FORMAT_2 ("0xcafebabe 12345678", "%wx %x", (HOST_WIDE_INT)0xcafebabe, 0x12345678); + ASSERT_PP_FORMAT_2 ("-27 12345678", "%zd %x", (ssize_t)-27, 0x12345678); + ASSERT_PP_FORMAT_2 ("-5 12345678", "%zi %x", (ssize_t)-5, 0x12345678); + ASSERT_PP_FORMAT_2 ("10 12345678", "%zu %x", (size_t)10, 0x12345678); + ASSERT_PP_FORMAT_2 ("17 12345678", "%zo %x", (size_t)15, 0x12345678); + ASSERT_PP_FORMAT_2 ("cafebabe 12345678", "%zx %x", (size_t)0xcafebabe, + 0x12345678); + ASSERT_PP_FORMAT_2 ("-27 12345678", "%td %x", (ptrdiff_t)-27, 0x12345678); + ASSERT_PP_FORMAT_2 ("-5 12345678", "%ti %x", (ptrdiff_t)-5, 0x12345678); + ASSERT_PP_FORMAT_2 ("10 12345678", "%tu %x", (ptrdiff_t)10, 0x12345678); + ASSERT_PP_FORMAT_2 ("17 12345678", "%to %x", (ptrdiff_t)15, 0x12345678); + ASSERT_PP_FORMAT_2 ("1afebabe 12345678", "%tx %x", (ptrdiff_t)0x1afebabe, + 0x12345678); ASSERT_PP_FORMAT_2 ("1.000000 12345678", "%f %x", 1.0, 0x12345678); ASSERT_PP_FORMAT_2 ("A 12345678", "%c %x", 'A', 0x12345678); ASSERT_PP_FORMAT_2 ("hello world 12345678", "%s %x", "hello world", diff --git a/gcc/rust/ChangeLog b/gcc/rust/ChangeLog index f1220b0..b04423a 100644 --- a/gcc/rust/ChangeLog +++ b/gcc/rust/ChangeLog @@ -1,3 +1,318 @@ +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * parse/rust-parse-impl.h (Parser::parse_trait_item): + Handle macros in trait items similar to how its handled for trait + implementation items. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * ast/rust-ast-collector.cc (TokenCollector::visit): + Remove obsolete classes and functions. + * ast/rust-ast-collector.h: + Likewise. + * ast/rust-ast-full-decls.h (class TraitFunctionDecl): + Likewise. + (class TraitItemFunc): + Likewise. + (class TraitMethodDecl): + Likewise. + (class TraitItemMethod): + Likewise. + * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): + Likewise. + * ast/rust-ast-visitor.h: + Likewise. + * ast/rust-ast.cc (TraitItemFunc::TraitItemFunc): + Likewise. + (TraitItemFunc::operator=): + Likewise. + (TraitItemFunc::as_string): + Likewise. + (TraitFunctionDecl::as_string): + Likewise. + (TraitItemMethod::TraitItemMethod): + Likewise. + (TraitItemMethod::operator=): + Likewise. + (TraitItemMethod::as_string): + Likewise. + (TraitMethodDecl::as_string): + Likewise. + (TraitItemFunc::accept_vis): + Likewise. + (TraitItemMethod::accept_vis): + Likewise. + * ast/rust-item.h (class TraitFunctionDecl): + Likewise. + (class TraitItemFunc): + Likewise. + (class TraitMethodDecl): + Likewise. + (class TraitItemMethod): + Likewise. + * checks/errors/rust-ast-validation.cc (ASTValidation::visit): + Likewise. + * checks/errors/rust-ast-validation.h: + Likewise. + * checks/errors/rust-feature-gate.h: + Likewise. + * expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_trait_function_decl): + Likewise. + (CfgStrip::maybe_strip_trait_method_decl): + Likewise. + (CfgStrip::visit): + Likewise. + * expand/rust-cfg-strip.h: + Likewise. + * expand/rust-derive.h: + Likewise. + * expand/rust-expand-visitor.cc (ExpandVisitor::expand_trait_function_decl): + Likewise. + (ExpandVisitor::expand_trait_method_decl): + Likewise. + (ExpandVisitor::visit): + Likewise. + * expand/rust-expand-visitor.h: + Likewise. + * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): + Likewise. + * hir/rust-ast-lower-base.h: + Likewise. + * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): + Likewise. + * hir/rust-ast-lower-implitem.h: + Likewise. + * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): + Likewise. + * resolve/rust-ast-resolve-base.h: + Likewise. + * resolve/rust-ast-resolve-implitem.h (visit): + Likewise. + * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): + Likewise. + * resolve/rust-ast-resolve-item.h: + Likewise. + * resolve/rust-default-resolver.cc (DefaultResolver::visit): + Likewise. + * resolve/rust-default-resolver.h: + Likewise. + * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): + Likewise. + * resolve/rust-toplevel-name-resolver-2.0.h: + Likewise. + * util/rust-attributes.cc (AttributeChecker::visit): + Likewise. + * util/rust-attributes.h: + Likewise. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * parse/rust-parse-impl.h (Parser::parse_trait_item): + Use parse_function() to parse trait functions. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): + Provide visitor for AST::Function. + * hir/rust-ast-lower-implitem.h: + Likewise. + * resolve/rust-ast-resolve-implitem.h: + Likewise. + * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): + Likewise. + * resolve/rust-ast-resolve-item.h: + Likewise. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * checks/errors/rust-ast-validation.cc (ASTValidation::visit): + Add checks for Trait functions. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * ast/rust-ast.h: Replace TraitItem with AssociatedItem. + * ast/rust-item.h (class Trait): Likewise. + * expand/rust-expand-visitor.cc (ExpandVisitor::visit): + Likewise. + * parse/rust-parse-impl.h (Parser::parse_trait): Likewise. + * parse/rust-parse.h: Likewise. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): use destructure + +2024-02-07 Nobel Singh <nobel2073@gmail.com> + + * Make-lang.in: Add rust-ast-lower-implitem.cc to list of objects. + * hir/rust-ast-lower-implitem.h (RUST_AST_LOWER_IMPLITEM_H): Remove + implementation. + * hir/rust-ast-lower-implitem.cc: Copy implementation from header. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): refactor + * typecheck/rust-hir-type-check.h: new prototype + * typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables): x + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * typecheck/rust-hir-type-check-type.cc: remove hack + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove hack + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): fix + +2024-02-07 Nobel Singh <nobel2073@gmail.com> + + * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers): + Change default ABI to C for extern functions + (ASTLoweringBase::lower_extern_block): Likewise + +2024-02-07 Jakub Dupak <dev@jakubdupak.com> + + * typecheck/rust-tyty.cc (BaseType::BaseType): Store orig ref. + (BaseType::get_orig_ref): Add getter. + * typecheck/rust-tyty.h: Store orig ref. + +2024-02-07 Jakub Dupak <dev@jakubdupak.com> + + * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): + Add region constraints. + (TypeCheckImplItem::visit): Add region constraints. + * typecheck/rust-hir-type-check-implitem.h: Add region constraints. + * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelf): + Add region constraints. + (TypeCheckItem::visit): Add region constraints. + (TypeCheckItem::resolve_impl_item): Add region constraints. + (TypeCheckItem::resolve_impl_block_substitutions): Add region constraints. + * typecheck/rust-hir-type-check-item.h: Add region constraints. + * typecheck/rust-hir-type-check-type.cc (ResolveWhereClauseItem::Resolve): + Add region constraints. + (ResolveWhereClauseItem::visit): Add region constraints. + * typecheck/rust-hir-type-check-type.h (class ResolveWhereClauseItem): + Add region constraints. + * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): + Add region constraints. + * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): + Add region constraints. + * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_region_constraints): + Add region constraints. + * typecheck/rust-tyty-subst.h (class BaseType): Add region constraints. + (struct RegionConstraints): Add region constraints. + * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): Add region constraints. + (ADTType::clone): Add region constraints. + (FnType::clone): Add region constraints. + (ProjectionType::clone): Add region constraints. + * typecheck/rust-tyty.h: Add region constraints. + +2024-02-07 Jakub Dupak <dev@jakubdupak.com> + + * typecheck/rust-hir-trait-resolve.cc: add regions + * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): + add regions, resolve generic lifetimes + * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): add regions + * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): + add regions, resolve lifetimes + (TypeCheckImplItem::visit): add regions, resove lifetimes + * typecheck/rust-hir-type-check-implitem.h: add default value for result + * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): add regions, + resove lifetimes + (TypeCheckItem::resolve_impl_block_substitutions): add regions, resove lifetimes + * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): add regions, + resove lifetimes + (TypeCheckExpr::resolve_root_path): add regions, resove lifetimes + (TypeCheckExpr::resolve_segments): add regions, resove lifetimes + * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): add regions, + resove lifetimes + (TypeCheckType::resolve_root_path): add regions, resove lifetimes + (ResolveWhereClauseItem::Resolve): add regions, resove lifetimes + (ResolveWhereClauseItem::visit): add regions, resove lifetimes + * typecheck/rust-hir-type-check.cc (TypeCheckContext::LifetimeResolver::resolve): + add regions, resolve lifetimes + (TraitItemReference::get_type_from_fn): add regions, resove lifetimes + * typecheck/rust-hir-type-check.h: add regions, resove lifetimes + * typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): add regions, + resove lifetimes + (SubstMapper::Resolve): add regions, resove lifetimes + (SubstMapper::InferSubst): add regions, resove lifetimes + (SubstMapper::visit): add regions, resove lifetimes + * typecheck/rust-substitution-mapper.h: add regions, resove lifetimes + * typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): + lifetime resolution + (TypeCheckContext::regions_from_generic_args): lifetime resolution helper + * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): + add regions, resove lifetimes + (TypeBoundPredicate::operator=): add regions, resove lifetimes + (TypeBoundPredicate::apply_generic_arguments): add regions, resove lifetimes + (TypeBoundPredicateItem::get_tyty_for_receiver): add regions, resove lifetimes + * typecheck/rust-tyty-subst.cc (SubstitutionArgumentMappings::get_regions): + add regions, resove lifetimes + (SubstitutionArgumentMappings::get_mut_regions): getter + (SubstitutionArgumentMappings::error): split error and empty + (SubstitutionArgumentMappings::empty): split error and empty + (SubstitutionArgumentMappings::find_symbol): helper + (SubstitutionRef::get_num_lifetime_params): getter + (SubstitutionRef::get_num_type_params): getter + (SubstitutionRef::needs_substitution): extend to regions + (SubstitutionRef::get_mappings_from_generic_args): helper + (SubstitutionRef::infer_substitions): add regions + * typecheck/rust-tyty-subst.h (class RegionParamList): region param handler + * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): add regions, resove lifetimes + (InferType::default_type): add regions, resove lifetimes + (FnType::clone): add regions, resove lifetimes + (ReferenceType::ReferenceType): add regions + (ReferenceType::get_region): getter + (ReferenceType::clone): add regions + * typecheck/rust-tyty.h: add regions, resove + +2024-02-07 Jakub Dupak <dev@jakubdupak.com> + + * hir/tree/rust-hir-item.h: Add missing getter + +2024-02-07 Jakub Dupak <dev@jakubdupak.com> + + * typecheck/rust-tyty-region.h: New file. + +2024-02-07 Jakub Dupak <dev@jakubdupak.com> + + * typecheck/rust-hir-type-check.h (class Lifetime): add interned lifetime class + * typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): add + resolution tool + (TypeCheckContext::intern_lifetime): add method to intern lifetime from tyctx + (TypeCheckContext::lookup_lifetime): add method to lookup lifetime from tyctx + (TypeCheckContext::intern_and_insert_lifetime): add a helper method + +2024-02-07 Raiki Tamura <tamaron1203@gmail.com> + + * rust-lang.cc (run_rust_tests): Add test. + * rust-system.h: Add <algorithm>. + * util/make-rust-unicode.py: Output NFC_Quick_Check table. + * util/rust-codepoint.h (struct Codepoint): Add is_supplementary + method. + * util/rust-unicode-data.h: Generated. + * util/rust-unicode.cc (binary_search_sorted_array): Removed. + (lookup_cc): Remove namespace. + (is_alphabetic): Use std::binary_search + (nfc_quick_check): New function. + (nfc_normalize): Use nfc_quick_check. + (is_nfc_qc_maybe): New function. + (is_nfc_qc_no): New function. + (rust_nfc_qc_test): New test. + * util/rust-unicode.h (is_nfc_qc_no): New function. + (is_nfc_qc_maybe): New function. + (enum class): New enum class. + (nfc_quick_check): New function. + (rust_nfc_qc_test): New test. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * parse/rust-parse-impl.h (Parser::parse_function): + Skip token if its a COMMA. + 2024-01-30 Owen Avery <powerboat9.gamer@gmail.com> * ast/rust-ast-full-decls.h diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3fb20ec..03e08a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,557 @@ +2024-02-14 Steve Kargl <kargl@gcc.gnu.org> + + PR fortran/105847 + * gfortran.dg/pr105847.f90: New test. + +2024-02-14 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/vect/pr113576.c (dg-additional-options): + Use -march=skylake-avx512 for avx512f effective target. + * gcc.dg/vect/pr98308.c (dg-additional-options): + Use -march=skylake-avx512 for all x86 targets. + * gcc.dg/vect/tree-vect.h (check_vect): Handle __AVX512F__ + and __AVX512VL__. + +2024-02-14 Jakub Jelinek <jakub@redhat.com> + H.J. Lu <hjl.tools@gmail.com> + + PR target/113855 + * gcc.dg/heap-trampoline-1.c: New test. + * lib/target-supports.exp (check_effective_target_heap_trampoline): + New. + +2024-02-14 Uros Bizjak <ubizjak@gmail.com> + + PR target/113871 + * gcc.target/i386/pr113871-1a.c: New test. + * gcc.target/i386/pr113871-1b.c: New test. + * gcc.target/i386/pr113871-2a.c: New test. + * gcc.target/i386/pr113871-2b.c: New test. + * gcc.target/i386/pr113871-3a.c: New test. + * gcc.target/i386/pr113871-3b.c: New test. + * gcc.target/i386/pr113871-4a.c: New test. + +2024-02-14 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/113708 + * g++.dg/debug/dwarf2/inline-var-1.C: Reference 'a' to ensure it + is emitted. + * g++.dg/debug/dwarf2/inline-var-3.C: Likewise. + * g++.dg/modules/init-7_a.H: New test. + * g++.dg/modules/init-7_b.C: New test. + +2024-02-14 Andrew Pinski <quic_apinski@quicinc.com> + + PR testsuite/113861 + * c-c++-common/gomp/pr63328.c: Remove dg-excess-errors. + * gcc.dg/gomp/pr87895-2.c: Likewise. + +2024-02-14 Jan Hubicka <jh@suse.cz> + + PR tree-optimization/111054 + * gcc.c-torture/compile/pr111054.c: New test. + +2024-02-14 Tamar Christina <tamar.christina@arm.com> + + * gcc.dg/vect/vect-novect_gcond.c: New test. + +2024-02-14 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/99210 + * gfortran.dg/pr99210.f90: New test. + +2024-02-14 Jonathan Yong <10walls@gmail.com> + + * c-c++-common/analyzer/coreutils-sum-pr108666.c: Use + __SIZE_TYPE__ instead of long unsigned int for size_t + definition. + +2024-02-14 Patrick Palka <ppalka@redhat.com> + + PR c++/113908 + PR c++/113332 + * g++.dg/cpp0x/lambda/lambda-nsdmi11.C: New test. + * g++.dg/template/non-dependent31.C: New test. + +2024-02-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR d/104739 + * lib/gdc-utils.exp (gdc-convert-test) <UNICODE_NAMES>: Require + ucn support. + +2024-02-14 Andrew Pinski <quic_apinski@quicinc.com> + + PR testsuite/113899 + * gcc.dg/vect/vect-simd-clone-10.c: Add `dg-do run` + * gcc.dg/vect/vect-simd-clone-12.c: Likewise. + +2024-02-14 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/format/gcc_diag-1.c (foo): Add tests for z and t modifiers. + * gcc.dg/format/gcc_gfc-1.c (foo): Add tests for ll, z and t modifiers. + +2024-02-14 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/99573 + * g++.dg/modules/enum-12.C: New test. + +2024-02-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR target/113909 + * gcc.target/i386/pr113689-1.c: Skip on Solaris. + * gcc.target/i386/pr113689-2.c: Likewise. + * gcc.target/i386/pr113689-3.c: Likewise. + +2024-02-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gfortran.dg/fmt_en.f90 (dg-output): Don't xfail on + ?86-*-solaris2.9*. + * gfortran.dg/fmt_en_rd.f90: Likewise. + * gfortran.dg/fmt_en_rn.f90: Likewise. + * gfortran.dg/fmt_en_ru.f90: Likewise. + * gfortran.dg/fmt_en_rz.f90: Likewise. + +2024-02-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR c++/113706 + * c-c++-common/pr103798-2.c (scan-assembler-not): xfail for C++ on + Solaris. + +2024-02-13 Marek Polacek <polacek@redhat.com> + + DR 1693 + PR c++/113760 + * g++.dg/semicolon-fixits.C: Run in C++98 only. + * g++.dg/warn/pedantic2.C: Adjust dg-warning. + * g++.old-deja/g++.jason/parse11.C: Adjust dg-error. + * g++.dg/DRs/dr1693-1.C: New test. + * g++.dg/DRs/dr1693-2.C: New test. + +2024-02-13 H.J. Lu <hjl.tools@gmail.com> + + PR target/113876 + * gcc.target/i386/pr113876.c: New test. + +2024-02-13 Tobias Burnus <tburnus@baylibre.com> + + PR middle-end/113904 + * gfortran.dg/gomp/declare-variant-1.f90: Change 'condition' trait's + argument from integer to a logical expression. + * gfortran.dg/gomp/declare-variant-11.f90: Likewise. + * gfortran.dg/gomp/declare-variant-12.f90: Likewise. + * gfortran.dg/gomp/declare-variant-13.f90: Likewise. + * gfortran.dg/gomp/declare-variant-2.f90: Likewise. + * gfortran.dg/gomp/declare-variant-2a.f90: Likewise. + * gfortran.dg/gomp/declare-variant-3.f90: Likewise. + * gfortran.dg/gomp/declare-variant-4.f90: Likewise. + * gfortran.dg/gomp/declare-variant-6.f90: Likewise. + * gfortran.dg/gomp/declare-variant-8.f90: Likewise. + * gfortran.dg/gomp/declare-variant-20.f90: New test. + +2024-02-13 Patrick Palka <ppalka@redhat.com> + + * g++.dg/modules/friend-6_a.C: New test. + * g++.dg/modules/using-enum-3_a.C: New test. + * g++.dg/modules/using-enum-3_b.C: New test. + +2024-02-13 Harald Anlauf <anlauf@gmx.de> + + PR fortran/113866 + * gfortran.dg/bind_c_optional-2.f90: New test. + +2024-02-13 Jason Merrill <jason@redhat.com> + + PR c++/113612 + * g++.dg/cpp1y/var-templ85.C: New test. + +2024-02-13 Monk Chiang <monk.chiang@sifive.com> + + * gcc.target/riscv/pr113742.c: New test. + +2024-02-13 Marek Polacek <polacek@redhat.com> + + PR c++/112436 + * g++.dg/cpp2a/concepts-pr112436.C: New test. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113896 + * g++.dg/torture/pr113896.C: New testcase. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113895 + * gcc.dg/torture/pr113895-1.c: New testcase. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113902 + * gcc.dg/vect/pr113902.c: New testcase. + +2024-02-13 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113734 + * gcc.dg/vect/vect-early-break_117-pr113734.c: New test. + +2024-02-13 Alex Coplan <alex.coplan@arm.com> + + PR c++/113658 + * g++.dg/ext/has-feature2.C: New test. + +2024-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113898 + * gcc.dg/torture/pr113898.c: New testcase. + +2024-02-13 Steve Kargl <kargl@gcc.gnu.org> + + PR fortran/113883 + * gfortran.dg/allocatable_length.f90: New test. + +2024-02-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * gfortran.dg/pr109358.f90: New test. + +2024-02-12 Marek Polacek <polacek@redhat.com> + + PR c++/113545 + * g++.dg/cpp1y/constexpr-reinterpret3.C: Remove dg-ice. + +2024-02-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113849 + * gcc.dg/torture/bitint-58.c: New test. + +2024-02-12 Jakub Jelinek <jakub@redhat.com> + + PR c++/113674 + * c-c++-common/Wattributes-3.c: New test. + +2024-02-12 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/pr113693.c: Guard _BitInt(837) use with + __BITINT_MAXWIDTH__ >= 837. Use dg-prune-output instead of + dg-message for dbgcnt message. + +2024-02-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/113125 + * gdc.dg/imports/pr113125.d: New test. + * gdc.dg/pr113125.d: New test. + +2024-02-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/113758 + * gdc.dg/torture/pr113758.d: New test. + +2024-02-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113831 + PR tree-optimization/108355 + * gcc.dg/torture/pr113831.c: New testcase. + * gcc.dg/tree-ssa/ssa-fre-104.c: Likewise. + +2024-02-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/base/pr113766-1.c: Adjust the test cases. + +2024-02-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113863 + * gcc.dg/vect/pr113863.c: New testcase. + +2024-02-11 John David Anglin <danglin@gcc.gnu.org> + + * gcc.c-torture/execute/ieee/cdivchkf.c: Use ilogb and + __builtin_fmax instead of ilogbf and __builtin_fmaxf. + +2024-02-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * gcc.target/i386/asm-raw-symbol.c: Adjust asm patterns. + +2024-02-11 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> + + * gcc.target/arm/pr97969.c: Update to comply with GCC14 changes. + +2024-02-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * gcc.target/i386/pr113689-1.c: Skip test on darwin. + * gcc.target/i386/pr113689-2.c: Likewise. + * gcc.target/i386/pr113689-3.c: Likewise. + +2024-02-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * gcc.dg/ssp-2.c: Ignore warning that + -multiply_defined is obsolete + +2024-02-10 Marek Polacek <polacek@redhat.com> + + DR 2237 + PR c++/107126 + PR c++/97202 + * g++.dg/DRs/dr2237.C: Adjust dg-error. + * g++.dg/parse/constructor2.C: Likewise. + * g++.dg/template/error34.C: Likewise. + * g++.old-deja/g++.pt/ctor2.C: Likewise. + * g++.dg/DRs/dr2237-2.C: New test. + * g++.dg/DRs/dr2237-3.C: New test. + * g++.dg/DRs/dr2237-4.C: New test. + * g++.dg/DRs/dr2237-5.C: New test. + * g++.dg/warn/Wtemplate-id-cdtor-1.C: New test. + * g++.dg/warn/Wtemplate-id-cdtor-2.C: New test. + * g++.dg/warn/Wtemplate-id-cdtor-3.C: New test. + * g++.dg/warn/Wtemplate-id-cdtor-4.C: New test. + +2024-02-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * gcc.dg/darwin-ld-2.c: Ignore warning + that -bind_at_load is deprecated. + +2024-02-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/110754 + * gcc.dg/attr-assume-6.c: New test. + * g++.dg/cpp23/attr-assume12.C: New test. + +2024-02-10 Hans-Peter Nilsson <hp@axis.com> + + PR c++/113545 + * g++.dg/cpp1y/constexpr-reinterpret3.C, + g++.dg/cpp1y/constexpr-reinterpret4.C: New tests. + +2024-02-09 Marek Polacek <polacek@redhat.com> + + PR c++/113834 + * g++.dg/ext/type_pack_element4.C: New test. + +2024-02-09 Marek Polacek <polacek@redhat.com> + + PR c++/98388 + * g++.dg/cpp0x/sfinae69.C: New test. + +2024-02-09 Harald Anlauf <anlauf@gmx.de> + + PR fortran/113799 + * gfortran.dg/arithmetic_overflow_2.f90: New test. + +2024-02-09 Patrick Palka <ppalka@redhat.com> + + PR c++/112580 + * g++.dg/modules/anon-3_a.H: New test. + * g++.dg/modules/anon-3_b.C: New test. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113783 + * gcc.dg/bitint-88.c: New test. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/113415 + * gcc.target/i386/pr113415.c: New test. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113818 + * gcc.dg/bitint-89.c: New test. + +2024-02-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113774 + * gcc.dg/torture/bitint-57.c: New test. + +2024-02-09 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> + + * gcc.misc-tests/options.exp: Allow other options before the + -quite option for cc1. + +2024-02-08 Edwin Lu <ewlu@rivosinc.com> + + * gcc.target/riscv/rvv/base/abi-1.c: change selector + * gcc.target/riscv/rvv/base/pragma-2.c: ditto + * gcc.target/riscv/rvv/base/pragma-3.c: ditto + +2024-02-08 Richard Earnshaw <rearnsha@arm.com> + + * lib/target-supports.exp + (check_effective_target_arm_fp16_alternative_ok_nocache): Use + et_arm_fp16_alternative_flags to cache the result. Improve test + for FP16 availability. + (add_options_for_arm_fp16_alternative): Use + et_arm_fp16_alternative_flags. + * g++.dg/ext/arm-fp16/arm-fp16-ops-3.C: Update dg-* flags. + * g++.dg/ext/arm-fp16/arm-fp16-ops-4.C: Likewise. + * gcc.dg/torture/arm-fp16-int-convert-alt.c: Likewise. + * gcc.dg/torture/arm-fp16-ops-3.c: Likewise. + * gcc.dg/torture/arm-fp16-ops-4.c: Likewise. + * gcc.target/arm/fp16-aapcs-3.c: Likewise. + * gcc.target/arm/fp16-aapcs-4.c: Likewise. + * gcc.target/arm/fp16-compile-alt-1.c: Likewise. + * gcc.target/arm/fp16-compile-alt-10.c: Likewise. + * gcc.target/arm/fp16-compile-alt-11.c: Likewise. + * gcc.target/arm/fp16-compile-alt-12.c: Likewise. + * gcc.target/arm/fp16-compile-alt-2.c: Likewise. + * gcc.target/arm/fp16-compile-alt-3.c: Likewise. + * gcc.target/arm/fp16-compile-alt-4.c: Likewise. + * gcc.target/arm/fp16-compile-alt-5.c: Likewise. + * gcc.target/arm/fp16-compile-alt-6.c: Likewise. + * gcc.target/arm/fp16-compile-alt-7.c: Likewise. + * gcc.target/arm/fp16-compile-alt-8.c: Likewise. + * gcc.target/arm/fp16-compile-alt-9.c: Likewise. + * gcc.target/arm/fp16-rounding-alt-1.c: Likewise. + +2024-02-08 Patrick Palka <ppalka@redhat.com> + + PR c++/113649 + * g++.dg/cpp2a/nontype-class65.C: New test. + +2024-02-08 Aldy Hernandez <aldyh@redhat.com> + + PR tree-optimization/113735 + * gcc.dg/tree-ssa/pr113735.c: New test. + +2024-02-08 H.J. Lu <hjl.tools@gmail.com> + + PR target/113711 + PR target/113733 + * gcc.target/i386/apx-ndd-2.c: New test. + * gcc.target/i386/apx-ndd-base-index-1.c: Likewise. + * gcc.target/i386/apx-ndd-no-seg-global-1.c: Likewise. + * gcc.target/i386/apx-ndd-seg-1.c: Likewise. + * gcc.target/i386/apx-ndd-seg-2.c: Likewise. + * gcc.target/i386/apx-ndd-seg-3.c: Likewise. + * gcc.target/i386/apx-ndd-seg-4.c: Likewise. + * gcc.target/i386/apx-ndd-seg-5.c: Likewise. + * gcc.target/i386/apx-ndd-tls-1a.c: Likewise. + * gcc.target/i386/apx-ndd-tls-2.c: Likewise. + * gcc.target/i386/apx-ndd-tls-3.c: Likewise. + * gcc.target/i386/apx-ndd-tls-4.c: Likewise. + * gcc.target/i386/apx-ndd-x32-1.c: Likewise. + +2024-02-08 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113808 + * gfortran.dg/vect/vect-early-break_1-PR113808.f90: Moved to... + * gfortran.dg/vect/vect-early-break_1-pr113808.f90: ...here. + +2024-02-08 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113808 + * gfortran.dg/vect/vect-early-break_1-PR113808.f90: New test. + +2024-02-08 Tamar Christina <tamar.christina@arm.com> + + * gcc.dg/vect/vect-early-break_110-pr113467.c: Change unsigned long * + to uint64_t *. + +2024-02-08 Pan Li <pan2.li@intel.com> + + PR target/113766 + * gcc.target/riscv/rvv/base/pr113766-1.c: Add new cases. + +2024-02-08 Joseph Myers <josmyers@redhat.com> + + PR c/113776 + * gcc.dg/pr113776-1.c, gcc.dg/pr113776-2.c, gcc.dg/pr113776-3.c, + gcc.dg/pr113776-4.c: New tests. + +2024-02-08 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp2a/nontype-class64.C: New test. + +2024-02-07 Richard Biener <rguenther@suse.de> + + PR tree-optimization/113796 + * gcc.dg/torture/pr113796.c: New testcase. + +2024-02-07 Roger Sayle <roger@nextmovesoftware.com> + Uros Bizjak <ubizjak@gmail.com> + + PR target/113690 + * gcc.target/i386/pr113690.c: New test case. + +2024-02-07 Victor Do Nascimento <victor.donascimento@arm.com> + + * gcc.target/aarch64/acle/rwsr-armv8p9.c: New. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * rust/compile/issue-2040.rs: + Enclose 'const' in single quotes. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-2775.rs: New test. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-2782.rs: New test. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-1773.rs: Moved to... + * rust/compile/issue-1773.rs.bak: ...here. + * rust/compile/issue-2723-1.rs: New test. + * rust/compile/issue-2723-2.rs: New test. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-2747.rs: New test. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-2772-1.rs: New test. + * rust/compile/issue-2772-2.rs: New test. + +2024-02-07 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-1483.rs: New test. + +2024-02-07 Kushal Pal <kushalpal109@gmail.com> + + * rust/compile/issue-2812.rs: New test. + +2024-02-07 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113750 + * gcc.dg/vect/vect-early-break_112-pr113750.c: New test. + * gcc.dg/vect/vect-early-break_113-pr113750.c: New test. + * gcc.dg/vect/vect-early-break_114-pr113750.c: New test. + * gcc.dg/vect/vect-early-break_115-pr113750.c: New test. + * gcc.dg/vect/vect-early-break_116-pr113750.c: New test. + +2024-02-07 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113731 + * gcc.dg/vect/vect-early-break_111-pr113731.c: New test. + +2024-02-07 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/113467 + * gcc.dg/vect/vect-early-break_110-pr113467.c: New test. + +2024-02-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113756 + * gcc.dg/pr113756.c: New test. + +2024-02-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.dg/debug/dwarf2/inline5.c: Don't xfail scan-assembler-not on + { aix || solaris2 } && !gas. + +2024-02-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/113753 + * gcc.dg/torture/bitint-56.c: New test. + * gcc.dg/bitint-87.c: New test. + +2024-02-07 Pan Li <pan2.li@intel.com> + + PR target/113766 + * gcc.target/riscv/rvv/base/pr113766-1.c: New test. + * gcc.target/riscv/rvv/base/pr113766-2.c: New test. + 2024-02-06 Jakub Jelinek <jakub@redhat.com> PR c++/113788 diff --git a/gcc/testsuite/c-c++-common/Wattributes-3.c b/gcc/testsuite/c-c++-common/Wattributes-3.c new file mode 100644 index 0000000..a1a6d9a --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wattributes-3.c @@ -0,0 +1,13 @@ +/* PR c++/113674 */ +/* { dg-do compile { target { c || c++11 } } } */ +/* { dg-options "" } */ + +[[____noreturn____]] int foo (int i) /* { dg-warning "'__noreturn__' attribute (directive )?ignored" } */ +{ + return i; +} + +[[____maybe_unused____]] int bar (int i) /* { dg-warning "'__maybe_unused__' attribute (directive )?ignored" } */ +{ + return i; +} diff --git a/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c b/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c index 5684d1b..dadd27e 100644 --- a/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c +++ b/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c @@ -1,6 +1,6 @@ /* Reduced from coreutils's sum.c: bsd_sum_stream */ -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef unsigned char __uint8_t; typedef unsigned long int __uintmax_t; typedef struct _IO_FILE FILE; diff --git a/gcc/testsuite/c-c++-common/gomp/pr63328.c b/gcc/testsuite/c-c++-common/gomp/pr63328.c index 54eface..3958abe 100644 --- a/gcc/testsuite/c-c++-common/gomp/pr63328.c +++ b/gcc/testsuite/c-c++-common/gomp/pr63328.c @@ -3,5 +3,3 @@ /* { dg-options "-O2 -fopenmp-simd -fno-strict-aliasing -fcompare-debug" } */ #include "pr60823-3.c" -/* { dg-excess-errors "partial simd clone support" { target { aarch64*-*-* } } } */ - diff --git a/gcc/testsuite/c-c++-common/pr103798-2.c b/gcc/testsuite/c-c++-common/pr103798-2.c index e7e99c3..bc126c2 100644 --- a/gcc/testsuite/c-c++-common/pr103798-2.c +++ b/gcc/testsuite/c-c++-common/pr103798-2.c @@ -27,4 +27,5 @@ main () return 0; } -/* { dg-final { scan-assembler-not "memchr" } } */ +/* See PR c++/113706 for the xfail. */ +/* { dg-final { scan-assembler-not "memchr" { xfail { c++ && *-*-solaris2* } } } } */ diff --git a/gcc/testsuite/g++.dg/DRs/dr1693-1.C b/gcc/testsuite/g++.dg/DRs/dr1693-1.C new file mode 100644 index 0000000..ed27026 --- /dev/null +++ b/gcc/testsuite/g++.dg/DRs/dr1693-1.C @@ -0,0 +1,9 @@ +// DR 1693, Superfluous semicolons in class definitions +// PR c++/113760 +// { dg-do compile } +// { dg-options "" } + +struct S { + int a; + ; +}; diff --git a/gcc/testsuite/g++.dg/DRs/dr1693-2.C b/gcc/testsuite/g++.dg/DRs/dr1693-2.C new file mode 100644 index 0000000..c52259d --- /dev/null +++ b/gcc/testsuite/g++.dg/DRs/dr1693-2.C @@ -0,0 +1,9 @@ +// DR 1693, Superfluous semicolons in class definitions +// PR c++/113760 +// { dg-do compile } +// { dg-options "-pedantic-errors" } + +struct S { + int a; + ; // { dg-error "extra" "" { target c++98_only } } +}; diff --git a/gcc/testsuite/g++.dg/DRs/dr2237-2.C b/gcc/testsuite/g++.dg/DRs/dr2237-2.C new file mode 100644 index 0000000..1d99347 --- /dev/null +++ b/gcc/testsuite/g++.dg/DRs/dr2237-2.C @@ -0,0 +1,9 @@ +// DR 2237 - Can a template-id name a constructor? +// { dg-options "" } + +template<class T> +struct X { + X<T>(); // { dg-warning "template-id not allowed for constructor" "" { target c++20 } } + X(int); // OK, injected-class-name used + ~X<T>(); // { dg-warning "template-id not allowed for destructor" "" { target c++20 } } +}; diff --git a/gcc/testsuite/g++.dg/DRs/dr2237-3.C b/gcc/testsuite/g++.dg/DRs/dr2237-3.C new file mode 100644 index 0000000..c8ad685 --- /dev/null +++ b/gcc/testsuite/g++.dg/DRs/dr2237-3.C @@ -0,0 +1,16 @@ +// PR c++/107126 +// { dg-options "" } + +template<typename T> +struct C +{ + ~C(); +}; +template<typename T> +C<T>::~C<T>() // { dg-warning "template-id not allowed for destructor" "" { target c++20 } } +{ +} +int main() +{ + C<int> c;; +} diff --git a/gcc/testsuite/g++.dg/DRs/dr2237-4.C b/gcc/testsuite/g++.dg/DRs/dr2237-4.C new file mode 100644 index 0000000..a358dd5 --- /dev/null +++ b/gcc/testsuite/g++.dg/DRs/dr2237-4.C @@ -0,0 +1,11 @@ +// PR c++/97202 +// { dg-options "" } + +template<typename T> +struct F +{ + F<T>(); // { dg-warning "template-id not allowed for constructor" "" { target c++20 } } +}; + +template<typename T> +inline F<T>::F() { } diff --git a/gcc/testsuite/g++.dg/DRs/dr2237-5.C b/gcc/testsuite/g++.dg/DRs/dr2237-5.C new file mode 100644 index 0000000..fd51968 --- /dev/null +++ b/gcc/testsuite/g++.dg/DRs/dr2237-5.C @@ -0,0 +1,7 @@ +// PR c++/97202 +// { dg-options "" } + +template<typename Base> struct S : Base { + inline S<Base>() {} // { dg-warning "template-id not allowed for constructor" "" { target c++20 } } + inline ~S<Base>() {} // { dg-warning "template-id not allowed for destructor" "" { target c++20 } } +}; diff --git a/gcc/testsuite/g++.dg/DRs/dr2237.C b/gcc/testsuite/g++.dg/DRs/dr2237.C index f3d6d11..830c8f5 100644 --- a/gcc/testsuite/g++.dg/DRs/dr2237.C +++ b/gcc/testsuite/g++.dg/DRs/dr2237.C @@ -2,7 +2,7 @@ template<class T> struct X { - X<T>(); // { dg-error "expected" "" { target c++20 } } + X<T>(); // { dg-error "template-id not allowed for constructor" "" { target c++20 } } X(int); // OK, injected-class-name used ~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi11.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi11.C new file mode 100644 index 0000000..246654c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi11.C @@ -0,0 +1,20 @@ +// PR c++/113332 +// { dg-do compile { target c++11 } } + +struct tuple { + template<class _Tp> + static constexpr bool __is_implicitly_default_constructible() { return true; } + + template<class _Tp = void, + bool = __is_implicitly_default_constructible<_Tp>()> + tuple(); +}; + +struct DBusStruct { +private: + tuple data_; +}; + +struct IBusService { + int m = [] { DBusStruct{}; return 42; }(); +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae69.C b/gcc/testsuite/g++.dg/cpp0x/sfinae69.C new file mode 100644 index 0000000..361e0b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae69.C @@ -0,0 +1,21 @@ +// PR c++/98388 +// { dg-do compile { target c++11 } } + +struct moveonly { + moveonly() = default; + moveonly(moveonly&&) = default; +}; + +template<class T> +constexpr auto is_throwable(T t) -> decltype(throw t, true) { + return true; +} +template<class T> +constexpr bool is_throwable(...) { return false; } + +constexpr bool b = is_throwable<moveonly>(moveonly{}); +#if __cplusplus >= 202002L +static_assert (b, "move from the function parameter"); // { dg-bogus "" "PR113853" { xfail c++20 } } +#else +static_assert (!b, "no move from the function parameter"); +#endif diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C new file mode 100644 index 0000000..adc0b41 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C @@ -0,0 +1,54 @@ +// PR c++/113545 +// { dg-do run { target c++14 } } + +char foo; + +// This one caught a call to gcc_unreachable in +// cp/constexpr.cc:label_matches, when passed a convert_expr from the +// cast in the call. +constexpr unsigned char swbar(__UINTPTR_TYPE__ baz) +{ + switch (baz) + { + case 13: + return 11; + case 14: + return 78; + case 2048: + return 13; + default: + return 42; + } +} + +// For reference, the equivalent* if-statements. +constexpr unsigned char ifbar(__UINTPTR_TYPE__ baz) +{ + if (baz == 13) + return 11; + else if (baz == 14) + return 78; + else if (baz == 2048) + return 13; + else + return 42; +} + +__attribute__ ((__noipa__)) +void xyzzy(int x) +{ + if (x != 42) + __builtin_abort (); +} + +int main() +{ + unsigned const char c = swbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); + xyzzy(c); + unsigned const char d = ifbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); + xyzzy(d); + unsigned const char e = swbar((__UINTPTR_TYPE__) &foo); + xyzzy(e); + unsigned const char f = ifbar((__UINTPTR_TYPE__) &foo); + xyzzy(f); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C new file mode 100644 index 0000000..9aaa6e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C @@ -0,0 +1,54 @@ +// PR c++/113545 +// { dg-do compile { target c++14 } } + +char foo; + +// This one caught a call to gcc_unreachable in +// cp/constexpr.cc:label_matches, when passed a convert_expr from the +// cast in the call. +constexpr unsigned char swbar(__UINTPTR_TYPE__ baz) +{ + switch (baz) + { + case 13: + return 11; + case 14: + return 78; + case 2048: + return 13; + default: + return 42; + } +} + +// For reference, the equivalent* if-statements. +constexpr unsigned char ifbar(__UINTPTR_TYPE__ baz) +{ + if (baz == 13) + return 11; + else if (baz == 14) + return 78; + else if (baz == 2048) + return 13; + else + return 42; +} + +__attribute__ ((__noipa__)) +void xyzzy(int x) +{ + if (x != 42) + __builtin_abort (); +} + +int main() +{ + unsigned constexpr char c = swbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); // { dg-error "conversion from pointer type" } + xyzzy(c); + unsigned constexpr char d = ifbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); // { dg-error "conversion from pointer type" } + xyzzy(d); + unsigned constexpr char e = swbar((__UINTPTR_TYPE__) &foo); // { dg-error "conversion from pointer type" } + xyzzy(e); + unsigned constexpr char f = ifbar((__UINTPTR_TYPE__) &foo); // { dg-error "conversion from pointer type" } + xyzzy(f); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ85.C b/gcc/testsuite/g++.dg/cpp1y/var-templ85.C new file mode 100644 index 0000000..33c24e0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ85.C @@ -0,0 +1,6 @@ +// PR c++/113612 +// { dg-do compile { target c++14 } } + +template <typename T> T t; +template <typename T> extern T *t<T *>; +template <typename T> T *t<T *> = t<int>; diff --git a/gcc/testsuite/g++.dg/cpp23/attr-assume12.C b/gcc/testsuite/g++.dg/cpp23/attr-assume12.C new file mode 100644 index 0000000..c955cd1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/attr-assume12.C @@ -0,0 +1,14 @@ +// PR middle-end/110754 +// { dg-do compile { target c++11 } } +// { dg-options "-O2 -fdump-tree-optimized" } +// { dg-final { scan-tree-dump-times "a ={v} x" 1 "optimized" } } +// { dg-final { scan-tree-dump-not "={v} a" "optimized" } } +// { dg-final { scan-tree-dump-times "return 0;" 1 "optimized" } } + +int +foo (int x) +{ + volatile int a = x; + [[gnu::assume (x == (a & 0))]]; + return x; +} diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-pr112436.C b/gcc/testsuite/g++.dg/cpp2a/concepts-pr112436.C new file mode 100644 index 0000000..6b755e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr112436.C @@ -0,0 +1,9 @@ +// PR c++/112436 +// { dg-do compile { target c++20 } } + +template<class T> +concept Throwable = requires { throw T(); }; +struct Incomplete; + +static_assert(!Throwable<Incomplete*>); +static_assert(!Throwable<int(*)[]>); diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class64.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class64.C new file mode 100644 index 0000000..eb64892 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class64.C @@ -0,0 +1,23 @@ +// Testcase from P2308R1 +// { dg-do compile { target c++20 } } + +template<auto n> struct B { /* ... */ }; +B<5> b1; // OK, template parameter type is int +B<'a'> b2; // OK, template parameter type is char +B<2.5> b3; // OK, template parameter type is double +B<void(0)> b4; // { dg-error "void" } + +template<int i> struct C { /* ... */ }; +C<{ 42 }> c1; // OK + +struct J1 { + J1 *self=this; +}; +B<J1{}> j1; // { dg-error "not a constant expression" } + +struct J2 { + J2 *self=this; + constexpr J2() {} + constexpr J2(const J2&) {} +}; +B<J2{}> j2; // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class65.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class65.C new file mode 100644 index 0000000..8397ea5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class65.C @@ -0,0 +1,16 @@ +// PR c++/113649 +// { dg-do compile { target c++20 } } + +template<class... Args> +struct A { + template<class Ret> + struct Fun { constexpr Fun(Ret(*)(Args...)) { } }; + + template<Fun f> + struct B { using type = decltype(f); }; +}; + +bool f(char, long); + +using type = A<char, long>::B<&f>::type; +using type = A<char, long>::Fun<bool>; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C index 85f74a9..7ec20af 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C @@ -8,6 +8,8 @@ // { dg-final { scan-assembler-times " DW_AT_\[^\n\r]*linkage_name" 7 } } inline int a; +int& ar = a; + struct S { static inline double b = 4.0; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C index 6345b5e..bb40a22 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C @@ -11,6 +11,8 @@ // { dg-final { scan-assembler-times " DW_AT_\[^\n\r]*linkage_name" 7 } } inline int a; +int& ar = a; + struct S { static inline double b = 4.0; diff --git a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C index 29080c7..5eceb30 100644 --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C @@ -1,6 +1,6 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C index 4be8883..d86019f 100644 --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C @@ -1,6 +1,7 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative -ffast-math" } */ +/* { dg-options "-ffast-math" } */ +/* { dg-add-options arm_fp16_alternative } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/g++.dg/ext/has-feature2.C b/gcc/testsuite/g++.dg/ext/has-feature2.C new file mode 100644 index 0000000..5f62916 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/has-feature2.C @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-options "" } + +// PR c++/113658: we shouldn't declare support for +// cxx_constexpr_string_builtins as GCC is missing some of the builtins +// that clang implements. + +#if __has_feature (cxx_constexpr_string_builtins) +#error +#endif + +#if __has_extension (cxx_constexpr_string_builtins) +#error +#endif diff --git a/gcc/testsuite/g++.dg/ext/type_pack_element4.C b/gcc/testsuite/g++.dg/ext/type_pack_element4.C new file mode 100644 index 0000000..aa508c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/type_pack_element4.C @@ -0,0 +1,17 @@ +// PR c++/113834 +// { dg-do compile { target c++17 } } + +template <typename... _Elements> class tuple{}; +template <unsigned long __i, typename... _Elements> +__type_pack_element<__i, _Elements...> &get(tuple<_Elements...> &__t) noexcept; // { dg-error "index is out of range" } +tuple<int,int> data; +template <unsigned long Level> +unsigned take_impl(unsigned idx) { + if constexpr (Level != -1){ + return take_impl<Level - 1>(get<Level - 1>(data)); // { dg-error "" } + } + return 0; +} +int main() { + take_impl<2>(0); +} diff --git a/gcc/testsuite/g++.dg/modules/anon-3_a.H b/gcc/testsuite/g++.dg/modules/anon-3_a.H new file mode 100644 index 0000000..64a6aab --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/anon-3_a.H @@ -0,0 +1,21 @@ +// PR c++/112580 +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +template <typename _Out> +struct _Formatting_scanner { + union { + int _M_values = 42; + }; + virtual int _M_format_arg() { return _M_values; } +}; + +template <typename _Tp> +auto __do_vformat_to() { + _Formatting_scanner<int> s; + return s; +} + +inline auto vformat() { + return __do_vformat_to<int>(); +} diff --git a/gcc/testsuite/g++.dg/modules/anon-3_b.C b/gcc/testsuite/g++.dg/modules/anon-3_b.C new file mode 100644 index 0000000..d676fe4 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/anon-3_b.C @@ -0,0 +1,8 @@ +// PR c++/112580 +// { dg-additional-options "-fmodules-ts" } + +import "anon-3_a.H"; + +int main() { + vformat()._M_format_arg(); +} diff --git a/gcc/testsuite/g++.dg/modules/enum-12.C b/gcc/testsuite/g++.dg/modules/enum-12.C new file mode 100644 index 0000000..57eeb85 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/enum-12.C @@ -0,0 +1,10 @@ +// PR c++/99573 +// { dg-additional-options "-fmodules-ts" } +// { dg-module-cmi !foo } + +export module foo; +namespace std { + enum class align_val_t : decltype(sizeof(int)) {}; // { dg-error "different module" } +} + +// { dg-prune-output "not writing module" } diff --git a/gcc/testsuite/g++.dg/modules/friend-6_a.C b/gcc/testsuite/g++.dg/modules/friend-6_a.C new file mode 100644 index 0000000..7493e8f --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/friend-6_a.C @@ -0,0 +1,11 @@ +// { dg-additional-options "-fmodules-ts -Wno-pedantic" } +// { dg-module-cmi friend_6 } + +module; +# 1 "" 1 +template <typename> struct Trans_NS___cxx11_basic_string { + template <typename> friend class basic_stringbuf; +}; +template struct Trans_NS___cxx11_basic_string<char>; +# 6 "" 2 +export module friend_6; diff --git a/gcc/testsuite/g++.dg/modules/init-7_a.H b/gcc/testsuite/g++.dg/modules/init-7_a.H new file mode 100644 index 0000000..7a0bb72 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/init-7_a.H @@ -0,0 +1,6 @@ +// PR c++/113708 +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +inline int f() { return 42; } +inline int a = f(); diff --git a/gcc/testsuite/g++.dg/modules/init-7_b.C b/gcc/testsuite/g++.dg/modules/init-7_b.C new file mode 100644 index 0000000..58bb062 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/init-7_b.C @@ -0,0 +1,6 @@ +// PR c++/113708 +// { dg-module-do link } +// { dg-additional-options "-fmodules-ts" } + +import "init-7_a.H"; +int main() { a; } diff --git a/gcc/testsuite/g++.dg/modules/using-enum-3_a.C b/gcc/testsuite/g++.dg/modules/using-enum-3_a.C new file mode 100644 index 0000000..10671ee --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/using-enum-3_a.C @@ -0,0 +1,11 @@ +// { dg-do compile { target c++20 } } +// { dg-additional-options "-fmodules-ts" } +// { dg-module-cmi using_enum_3 } + +export module using_enum_3; + +export +struct text_encoding { + enum class id { CP50220 }; + using enum id; +}; diff --git a/gcc/testsuite/g++.dg/modules/using-enum-3_b.C b/gcc/testsuite/g++.dg/modules/using-enum-3_b.C new file mode 100644 index 0000000..8ac6e39 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/using-enum-3_b.C @@ -0,0 +1,6 @@ +// { dg-do compile { target c++20 } } +// { dg-additional-options "-fmodules-ts" } + +import using_enum_3; + +static_assert(text_encoding::id::CP50220 == text_encoding::CP50220); diff --git a/gcc/testsuite/g++.dg/parse/constructor2.C b/gcc/testsuite/g++.dg/parse/constructor2.C index d620f41..e4b2ad3 100644 --- a/gcc/testsuite/g++.dg/parse/constructor2.C +++ b/gcc/testsuite/g++.dg/parse/constructor2.C @@ -1,11 +1,11 @@ // PR c++/14260 -template <class TClass> -class T -{ -public: - T(short,short f=0) {} - T<TClass>(int f) {} // { dg-error "expected" "" { target c++20 } } - T<TClass>(int f=0,const char* b=0) {} // { dg-error "expected" "" { target c++20 } } -}; +template <class TClass> +class T +{ +public: + T(short,short f=0) {} + T<TClass>(int f) {} // { dg-error "template-id not allowed for constructor" "" { target c++20 } } + T<TClass>(int f=0,const char* b=0) {} // { dg-error "template-id not allowed for constructor" "" { target c++20 } } +}; diff --git a/gcc/testsuite/g++.dg/semicolon-fixits.C b/gcc/testsuite/g++.dg/semicolon-fixits.C index a9cc783..198e306 100644 --- a/gcc/testsuite/g++.dg/semicolon-fixits.C +++ b/gcc/testsuite/g++.dg/semicolon-fixits.C @@ -1,3 +1,4 @@ +// { dg-do compile { target c++98_only } } /* { dg-options "-fdiagnostics-show-caret -Wpedantic" } */ /* Struct with extra semicolon. */ diff --git a/gcc/testsuite/g++.dg/template/error34.C b/gcc/testsuite/g++.dg/template/error34.C index ab688d9..921cb8f 100644 --- a/gcc/testsuite/g++.dg/template/error34.C +++ b/gcc/testsuite/g++.dg/template/error34.C @@ -3,27 +3,27 @@ template<typename T> struct A { - A<__builtin_offsetof(T, x)>(); // { dg-error "type/value mismatch|offsetof\\(T, x\\)|expected" } + A<__builtin_offsetof(T, x)>(); // { dg-error "type/value mismatch|offsetof\\(T, x\\)|template-id" } }; template<typename T> struct B { - B<__builtin_offsetof(T, x.y)>(); // { dg-error "type/value mismatch|offsetof\\(T, x.y\\)|expected" } + B<__builtin_offsetof(T, x.y)>(); // { dg-error "type/value mismatch|offsetof\\(T, x.y\\)|template-id" } }; template<typename T> struct C { - C<__builtin_offsetof(T, x[6])>(); // { dg-error "type/value mismatch|offsetof\\(T, x\\\[6\\\]\\)|expected" } + C<__builtin_offsetof(T, x[6])>(); // { dg-error "type/value mismatch|offsetof\\(T, x\\\[6\\\]\\)|template-id" } }; template<typename T> struct D { - D<__builtin_offsetof(T, x.y[6].z)>(); // { dg-error "type/value mismatch|offsetof\\(T, x.y\\\[6\\\].z\\)|expected" } + D<__builtin_offsetof(T, x.y[6].z)>(); // { dg-error "type/value mismatch|offsetof\\(T, x.y\\\[6\\\].z\\)|template-id" } }; struct E { int x; }; template<typename T> struct F { - F<__builtin_offsetof(E, x)>(); // { dg-error "type/value mismatch|offsetof\\(E, x\\)|expected" } + F<__builtin_offsetof(E, x)>(); // { dg-error "type/value mismatch|offsetof\\(E, x\\)|template-id" } }; diff --git a/gcc/testsuite/g++.dg/template/non-dependent31.C b/gcc/testsuite/g++.dg/template/non-dependent31.C new file mode 100644 index 0000000..3fa68f4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent31.C @@ -0,0 +1,18 @@ +// PR c++/113908 +// { dg-do compile { target c++11 } } + +struct A { + A(); +private: + A(const A&); +}; + +struct B { + A a; + + template<class T> + static void f() { new B(); } +}; + +template void B::f<int>(); +static_assert(!__is_constructible(B, const B&), ""); diff --git a/gcc/testsuite/g++.dg/torture/pr113896.C b/gcc/testsuite/g++.dg/torture/pr113896.C new file mode 100644 index 0000000..534c1c2 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr113896.C @@ -0,0 +1,35 @@ +// { dg-do run } +// { dg-additional-options "-ffast-math" } + +double a1 = 1.0; +double a2 = 1.0; + +void __attribute__((noipa)) +f(double K[2], bool b) +{ + double A[] = { + b ? a1 : a2, + 0, + 0, + 0 + }; + + double sum{}; + for(double a : A) sum += a; + for(double& a : A) a /= sum; + + if (b) { + K[0] = A[0]; // 1.0 + K[1] = A[1]; // 0.0 + } else { + K[0] = A[0] + A[1]; + } +} + +int main() +{ + double K[2]{}; + f(K, true); + if (K[0] != 1. || K[1] != 0.) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-1.C b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-1.C new file mode 100644 index 0000000..4294907 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-1.C @@ -0,0 +1,9 @@ +// PR c++/107126 +// { dg-do compile } +// { dg-options "-Wc++20-compat" } + +template<class T> +struct X { + X<T>(); // { dg-warning "template-id not allowed for constructor" } + ~X<T>(); // { dg-warning "template-id not allowed for destructor" } +}; diff --git a/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-2.C b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-2.C new file mode 100644 index 0000000..2b1c4ea --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-2.C @@ -0,0 +1,9 @@ +// PR c++/107126 +// { dg-do compile } +// { dg-options "-Wtemplate-id-cdtor" } + +template<class T> +struct X { + X<T>(); // { dg-warning "template-id not allowed for constructor" } + ~X<T>(); // { dg-warning "template-id not allowed for destructor" } +}; diff --git a/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-3.C b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-3.C new file mode 100644 index 0000000..bed96e8 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-3.C @@ -0,0 +1,9 @@ +// PR c++/107126 +// { dg-do compile } +// { dg-options "-Wc++20-compat -Wno-template-id-cdtor" } + +template<class T> +struct X { + X<T>(); // { dg-bogus "template-id not allowed for constructor" } + ~X<T>(); // { dg-bogus "template-id not allowed for destructor" } +}; diff --git a/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-4.C b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-4.C new file mode 100644 index 0000000..706e574 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wtemplate-id-cdtor-4.C @@ -0,0 +1,9 @@ +// PR c++/107126 +// { dg-do compile } +// { dg-options "-Wtemplate-id-cdtor -Wno-c++20-compat" } + +template<class T> +struct X { + X<T>(); // { dg-warning "template-id not allowed for constructor" } + ~X<T>(); // { dg-warning "template-id not allowed for destructor" } +}; diff --git a/gcc/testsuite/g++.dg/warn/pedantic2.C b/gcc/testsuite/g++.dg/warn/pedantic2.C index 6c83416..37d77da 100644 --- a/gcc/testsuite/g++.dg/warn/pedantic2.C +++ b/gcc/testsuite/g++.dg/warn/pedantic2.C @@ -5,6 +5,6 @@ class foo foo() {}; void bar() {}; - foo(int) {};; // { dg-warning "extra" } - void bar(int) {};; // { dg-warning "extra" } + foo(int) {};; // { dg-warning "extra" "" { target c++98_only } } + void bar(int) {};; // { dg-warning "extra" "" { target c++98_only } } }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse11.C b/gcc/testsuite/g++.old-deja/g++.jason/parse11.C index 40864c1..157a9c4 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/parse11.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse11.C @@ -3,7 +3,7 @@ class aClass { - ; // { dg-error "" } missing declaration + ; // { dg-error "" "" { target c++98_only } } missing declaration private: - ; // { dg-error "" } missing declaration + ; // { dg-error "" "" { target c++98_only } } missing declaration }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ctor2.C b/gcc/testsuite/g++.old-deja/g++.pt/ctor2.C index bf418ba..56b4232 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ctor2.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ctor2.C @@ -4,7 +4,7 @@ template <class T> struct A { - A<T>(); // { dg-error "expected" "" { target c++20 } } + A<T>(); // { dg-error "template-id" "" { target c++20 } } }; template <class T> diff --git a/gcc/testsuite/gcc.c-torture/compile/pr111054.c b/gcc/testsuite/gcc.c-torture/compile/pr111054.c new file mode 100644 index 0000000..3c0d6e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr111054.c @@ -0,0 +1,11 @@ +/* { dg-additional-options "-fno-guess-branch-probability" } */ +void *p, *q; +int i, j; + +void +foo (void) +{ + for (i = 0; i < 20; i++) + if (i < j) + p = q; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c index adf1ed9..86ef69f 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c @@ -8,7 +8,7 @@ extern void abort (void); extern void exit (int); -extern int ilogbf (float); +extern int ilogb (double); int match (float _Complex, float _Complex); #define SMALL FLT_MIN @@ -22,7 +22,8 @@ int match (float _Complex, float _Complex); int match (float _Complex c, float _Complex z) { float rz, iz, rc, ic; - float rerr, ierr, rmax; + float rerr, ierr; + double rmax; int biterr; rz = __real__ z; iz = __imag__ z; @@ -54,11 +55,11 @@ int match (float _Complex c, float _Complex z) { ierr = __builtin_fabsf (iz - ic) / SMALL; } - rmax = __builtin_fmaxf(rerr, ierr); + rmax = __builtin_fmax (rerr, ierr); biterr = 0; if ( rmax != 0.0) { - biterr = ilogbf (rmax) + MAXBIT + 1; + biterr = ilogb (rmax) + MAXBIT + 1; } if (biterr >= ERRLIM) diff --git a/gcc/testsuite/gcc.dg/attr-assume-6.c b/gcc/testsuite/gcc.dg/attr-assume-6.c new file mode 100644 index 0000000..346845f --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-assume-6.c @@ -0,0 +1,14 @@ +/* PR middle-end/110754 */ +/* { dg-do compile } */ +/* { dg-options "-std=c23 -O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "a ={v} x" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-not "={v} a" "optimized" } } */ +/* { dg-final { scan-tree-dump-times "return 0;" 1 "optimized" } } */ + +int +foo (int x) +{ + volatile int a = x; + [[gnu::assume (x == (a & 0))]]; + return x; +} diff --git a/gcc/testsuite/gcc.dg/bitint-88.c b/gcc/testsuite/gcc.dg/bitint-88.c new file mode 100644 index 0000000..477e8cd --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-88.c @@ -0,0 +1,38 @@ +/* PR tree-optimization/113783 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-mavx512f" { target i?86-*-* x86_64-*-* } } */ + +int i; + +#if __BITINT_MAXWIDTH__ >= 246 +void +foo (void *p, _BitInt(246) x) +{ + __builtin_memcpy (p, &x, sizeof x); +} + +_BitInt(246) +bar (void *p, _BitInt(246) x) +{ + _BitInt(246) y = x + 1; + __builtin_memcpy (p, &y, sizeof y); + return x; +} +#endif + +#if __BITINT_MAXWIDTH__ >= 502 +void +baz (void *p, _BitInt(502) x) +{ + __builtin_memcpy (p, &x, sizeof x); +} + +_BitInt(502) +qux (void *p, _BitInt(502) x) +{ + _BitInt(502) y = x + 1; + __builtin_memcpy (p, &y, sizeof y); + return x; +} +#endif diff --git a/gcc/testsuite/gcc.dg/bitint-89.c b/gcc/testsuite/gcc.dg/bitint-89.c new file mode 100644 index 0000000..d4468df --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-89.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/113818 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-Os -fnon-call-exceptions -finstrument-functions-once" } */ + +int c, i; +void bar (int *); + +#if __BITINT_MAXWIDTH__ >= 129 +_BitInt(129) *a; +#else +_BitInt(63) *a; +#endif + +void +foo (void) +{ + if (c) + return; + int q; + a[i] = 0; + bar (&q); +} diff --git a/gcc/testsuite/gcc.dg/bitint-90.c b/gcc/testsuite/gcc.dg/bitint-90.c new file mode 100644 index 0000000..22df2a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-90.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/113567 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-O2" } */ + +#if __BITINT_MAXWIDTH__ >= 129 +_BitInt(129) v; + +void +foo (_BitInt(129) a, int i) +{ + __label__ l1, l2; + i &= 1; + void *p[] = { &&l1, &&l2 }; +l1: + a %= 3; + v = a; + i = !i; + goto *(p[i]); +l2:; +} +#else +int i; +#endif diff --git a/gcc/testsuite/gcc.dg/darwin-ld-2.c b/gcc/testsuite/gcc.dg/darwin-ld-2.c index 5de1952..2a6b491 100644 --- a/gcc/testsuite/gcc.dg/darwin-ld-2.c +++ b/gcc/testsuite/gcc.dg/darwin-ld-2.c @@ -3,6 +3,7 @@ /* { dg-options "-bind_at_load" } */ /* { dg-do link { target *-*-darwin* } } */ +/* { dg-prune-output "-bind_at_load is deprecated" } */ int main() { diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c index 4a64d54..5681332 100644 --- a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c @@ -33,7 +33,8 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, ullong ull, unsigned int *un, const int *cn, signed char *ss, unsigned char *us, const signed char *css, unsigned int u1, unsigned int u2, location_t *loc, tree t1, union tree_node *t2, - tree *t3, tree t4[], int *v, unsigned v_len) + tree *t3, tree t4[], int *v, unsigned v_len, size_t sz, ptrdiff_t pd, + ssize_t ssz, unsigned_ptrdiff_t upd) { /* Acceptable C90 specifiers, flags and modifiers. */ diag ("%%"); @@ -66,6 +67,16 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, cdiag ("%wd%wi%wo%wu%wx", ll, ll, ull, ull, ull); cxxdiag ("%wd%wi%wo%wu%wx", ll, ll, ull, ull, ull); dump ("%wd%wi%wo%wu%wx", ll, ll, ull, ull, ull); + diag ("%zd%zi%zo%zu%zx", ssz, ssz, sz, sz, sz); + tdiag ("%zd%zi%zo%zu%zx", ssz, ssz, sz, sz, sz); + cdiag ("%zd%zi%zo%zu%zx", ssz, ssz, sz, sz, sz); + cxxdiag ("%zd%zi%zo%zu%zx", ssz, ssz, sz, sz, sz); + dump ("%zd%zi%zo%zu%zx", ssz, ssz, sz, sz, sz); + diag ("%td%ti%to%tu%tx", pd, pd, upd, upd, upd); + tdiag ("%td%ti%to%tu%tx", pd, pd, upd, upd, upd); + cdiag ("%td%ti%to%tu%tx", pd, pd, upd, upd, upd); + cxxdiag ("%td%ti%to%tu%tx", pd, pd, upd, upd, upd); + dump ("%td%ti%to%tu%tx", pd, pd, upd, upd, upd); diag ("%.*s", i, s); tdiag ("%.*s", i, s); cdiag ("%.*s", i, s); diff --git a/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c b/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c index 7e079b7..ab26dcf 100644 --- a/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c +++ b/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c @@ -12,13 +12,19 @@ extern int gfc_warn (const char *, ...) __attribute__ ((__format__ (__gcc_gfc__, void foo (unsigned int u, int i, char *s, unsigned long int ul, long int l, - llong ll, locus *loc) + llong ll, unsigned long long int ull, locus *loc, size_t sz, + ptrdiff_t pd, ssize_t ssz, unsigned_ptrdiff_t upd) { /* Acceptable C90 specifiers, flags and modifiers. */ gfc_warn ("%%"); gfc_warn ("%u%d%i%c%s%%", u, i, i, i, s); gfc_warn ("%lu%ld%li%%", ul, l, l); + /* Acceptable C99 specifiers, flags and modifiers. */ + gfc_warn ("%llu%lld%lli%%", ull, ll, ll); + gfc_warn ("%zu%zd%zi%%", sz, ssz, ssz); + gfc_warn ("%tu%td%ti%%", upd, pd, pd); + /* Extensions provided in gfc_warn. */ gfc_warn ("%C"); gfc_warn ("%L", loc); diff --git a/gcc/testsuite/gcc.dg/gomp/pr87895-2.c b/gcc/testsuite/gcc.dg/gomp/pr87895-2.c index 26827ac..3d27715 100644 --- a/gcc/testsuite/gcc.dg/gomp/pr87895-2.c +++ b/gcc/testsuite/gcc.dg/gomp/pr87895-2.c @@ -3,4 +3,3 @@ /* { dg-additional-options "-O1" } */ #include "pr87895-1.c" -/* { dg-excess-errors "partial simd clone support" { target { aarch64*-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c b/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c index 9ef4eac..55267c6 100644 --- a/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c +++ b/gcc/testsuite/gcc.dg/guality/ipa-sra-1.c @@ -1,6 +1,10 @@ /* { dg-do run } */ /* { dg-options "-g -fno-ipa-icf" } */ +int __attribute__((noipa)) +get_val1 (void) {return 20;} +int __attribute__((noipa)) +get_val2 (void) {return 7;} void __attribute__((noipa)) use (int x) @@ -12,8 +16,8 @@ static int __attribute__((noinline)) bar (int i, int k) { asm ("" : "+r" (i)); - use (i); /* { dg-final { gdb-test . "k" "3" { xfail { ! { aarch64*-*-* && { any-opts "-O0" "-O1" "-Og" } } } } } } */ - return 6; + use (i); /* { dg-final { gdb-test . "k" "3" { xfail { ! { *-*-*-* && { any-opts "-O0" "-O1" "-Og" } } } } } } */ + return 6 + get_val1(); } volatile int v; @@ -30,11 +34,6 @@ foo (int i, int k) volatile int v; -int __attribute__((noipa)) -get_val1 (void) {return 20;} -int __attribute__((noipa)) -get_val2 (void) {return 7;} - int main (void) { diff --git a/gcc/testsuite/gcc.dg/heap-trampoline-1.c b/gcc/testsuite/gcc.dg/heap-trampoline-1.c new file mode 100644 index 0000000..1aebe00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/heap-trampoline-1.c @@ -0,0 +1,23 @@ +/* { dg-do run { target heap_trampoline } } */ +/* { dg-options "-ftrampoline-impl=heap" } */ + +__attribute__((noipa)) int +bar (int (*fn) (int)) +{ + return fn (42) + 1; +} + +int +main () +{ + int a = 0; + int foo (int x) { if (x != 42) __builtin_abort (); return ++a; } + if (bar (foo) != 2 || a != 1) + __builtin_abort (); + if (bar (foo) != 3 || a != 2) + __builtin_abort (); + a = 42; + if (bar (foo) != 44 || a != 43) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr113693.c b/gcc/testsuite/gcc.dg/pr113693.c index a6f5519..06b4435 100644 --- a/gcc/testsuite/gcc.dg/pr113693.c +++ b/gcc/testsuite/gcc.dg/pr113693.c @@ -1,7 +1,11 @@ /* { dg-do compile { target bitint } } */ /* { dg-options "-O2 -fdbg-cnt=vect_loop:1" } */ +#if __BITINT_MAXWIDTH__ >= 837 _BitInt(837) g, h; +#else +_BitInt(63) g, h; +#endif void fn1(void) @@ -10,4 +14,5 @@ fn1(void) for (; h; h++) ; } -/* { dg-message "dbgcnt" "" { target *-*-* } 0 } */ + +/* { dg-prune-output "dbgcnt:" } */ diff --git a/gcc/testsuite/gcc.dg/pr113776-1.c b/gcc/testsuite/gcc.dg/pr113776-1.c new file mode 100644 index 0000000..36190fb --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr113776-1.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic" } */ + +char d[(_Bool)0.5 == 1 ? 1 : -1]; +char f[(_Bool)0.0 == 0 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.dg/pr113776-2.c b/gcc/testsuite/gcc.dg/pr113776-2.c new file mode 100644 index 0000000..9e88210 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr113776-2.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic" } */ + +enum e { A = (_Bool) 0.0, B = (_Bool) 0.5, C = (_Bool) 1.0 }; diff --git a/gcc/testsuite/gcc.dg/pr113776-3.c b/gcc/testsuite/gcc.dg/pr113776-3.c new file mode 100644 index 0000000..c615994 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr113776-3.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c23 -pedantic" } */ + +enum ebool : bool { BF, BT }; + +char d[(enum ebool)0.5 == 1 ? 1 : -1]; +char f[(enum ebool)0.0 == 0 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.dg/pr113776-4.c b/gcc/testsuite/gcc.dg/pr113776-4.c new file mode 100644 index 0000000..1b57557 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr113776-4.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c23 -pedantic" } */ + +enum ebool : bool { BF, BT }; + +enum e { A = (enum ebool) 0.0, B = (enum ebool) 0.5, C = (enum ebool) 1.0 }; diff --git a/gcc/testsuite/gcc.dg/ssp-2.c b/gcc/testsuite/gcc.dg/ssp-2.c index 752fe53..608ca30 100644 --- a/gcc/testsuite/gcc.dg/ssp-2.c +++ b/gcc/testsuite/gcc.dg/ssp-2.c @@ -1,6 +1,7 @@ /* { dg-do run { target native } } */ /* { dg-options "-fstack-protector" } */ /* { dg-options "-fstack-protector -Wl,-multiply_defined,suppress" { target *-*-darwin* } } */ +/* { dg-prune-output "-multiply_defined is obsolete" } */ /* { dg-require-effective-target fstack_protector } */ #include <stdlib.h> diff --git a/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c b/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c index f013b59..42171d4 100644 --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c @@ -1,7 +1,7 @@ /* Test floating-point conversions. Standard types and __fp16. */ /* { dg-do run { target arm*-*-* } } */ /* { dg-require-effective-target arm_fp16_alternative_ok } -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ #include "fp-int-convert.h" #define FP16_MANT_DIG 11 diff --git a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c index 7716baf..3f0aecf 100644 --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c @@ -1,6 +1,6 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ /* { dg-require-effective-target arm_fp16_alternative_ok } -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c index 1940f43..846515b 100644 --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c @@ -1,6 +1,7 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ /* { dg-require-effective-target arm_fp16_alternative_ok } -/* { dg-options "-mfp16-format=alternative -ffast-math" } */ +/* { dg-options "-ffast-math" } */ +/* { dg-add-options arm_fp16_alternative } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/gcc.dg/torture/bitint-57.c b/gcc/testsuite/gcc.dg/torture/bitint-57.c new file mode 100644 index 0000000..3bc964c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-57.c @@ -0,0 +1,32 @@ +/* PR tree-optimization/113774 */ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +#if __BITINT_MAXWIDTH__ >= 512 +unsigned _BitInt(512) u; +unsigned _BitInt(512) v; + +void +foo (unsigned _BitInt(255) a, unsigned _BitInt(257) b, unsigned _BitInt(512) *r) +{ + b += v; + b |= a - b; + unsigned _BitInt(512) c = b * 6; + unsigned _BitInt(512) h = c >> u; + *r = h; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 512 + unsigned _BitInt(512) x; + foo (0x10000000000000000wb, 0x10000000000000001wb, &x); + if (x != 0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffawb) + __builtin_abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/bitint-58.c b/gcc/testsuite/gcc.dg/torture/bitint-58.c new file mode 100644 index 0000000..bdadd8b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-58.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/113849 */ +/* { dg-do run { target bitint } } */ +/* { dg-options "-std=c23 -pedantic-errors" } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ + +signed char c; +unsigned _BitInt(512) b; + +__attribute__((noipa)) void +foo (unsigned _BitInt(511) a, int *x) +{ + int z = (a << 510) <= b; + *x = z + c; +} + +int +main () +{ + int x; + foo (2, &x); + if (x != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr113796.c b/gcc/testsuite/gcc.dg/torture/pr113796.c new file mode 100644 index 0000000..bdf96d0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr113796.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-loop-if-convert -fno-vect-cost-model" } */ + +signed char a[] = {0x80, 0x80,0x80,0x80}; +int b; +signed char c; + +int main() +{ + for (; b < sizeof(a); b += 1) + c = a[b] < 0 ?: a[b] >> 6; + + if (c != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr113831.c b/gcc/testsuite/gcc.dg/torture/pr113831.c new file mode 100644 index 0000000..12aea7c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr113831.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ + +int a[3]; +int __attribute__((noipa)) +foo(int i, int x) +{ + int tem = 0; + a[2] = x; + if (i < 1) + ++i; + else + { + ++i; + tem = a[i]; + } + tem += a[i]; + return tem; +} + +int +main() +{ + if (foo (0, 7) != 0) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr113895-1.c b/gcc/testsuite/gcc.dg/torture/pr113895-1.c new file mode 100644 index 0000000..e96cb2f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr113895-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +int main_i; +void transparent_crc(int); +#pragma pack(1) +struct { + signed : 17; + signed : 6; + unsigned : 13; + unsigned f6 : 12; +} g_20[1]; +int main() +{ + transparent_crc(g_20[main_i].f6); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr113898.c b/gcc/testsuite/gcc.dg/torture/pr113898.c new file mode 100644 index 0000000..6832a34 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr113898.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +int a, d; +unsigned **b; +long c, f; +long e[2][1]; +void g() { + int h = 0; + for (; h < 2; h++) { + e[h][d + **b + a] = c; + if (f) + for (;;) + ; + } +} +void main() {} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr113735.c b/gcc/testsuite/gcc.dg/tree-ssa/pr113735.c new file mode 100644 index 0000000..7b86499 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr113735.c @@ -0,0 +1,19 @@ +// { dg-do compile { target bitint } } +// { dg-options "-O1" } + +char b; +void bar (void); + +#if __BITINT_MAXWIDTH__ >= 6110 +void +foo (_BitInt(6110) j) +{ + for (;;) + { + _BitInt(10) k = b % j; + for (j = 6; j; --j) + if (k) + bar (); + } +} +#endif diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c new file mode 100644 index 0000000..f0f12ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fre1" } */ + +int a; +int *b = &a; +int **c = &b; +int d; +void bar25_(void); +void foo(void); +int main() { + int e[][1] = {0, 0, 0, 0, 0, 1}; + for (;;) { + bar25_(); + /* We should optimistically treat a == 0 because of the bounds of + the object. */ + if (e[5][a]) + break; + e[a][0] = 0; + foo(); + } + *c = &d; +} + +/* { dg-final { scan-tree-dump-not "foo" "fre1" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr113576.c b/gcc/testsuite/gcc.dg/vect/pr113576.c index decb7ab..b6edde6 100644 --- a/gcc/testsuite/gcc.dg/vect/pr113576.c +++ b/gcc/testsuite/gcc.dg/vect/pr113576.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ -/* { dg-additional-options "-march=skylake-avx512" { target { x86_64-*-* i?86-*-* } } } */ +/* { dg-additional-options "-march=skylake-avx512" { target avx512f } } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/pr113863.c b/gcc/testsuite/gcc.dg/vect/pr113863.c new file mode 100644 index 0000000..ffe7602 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr113863.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-additional-options "-O3" } */ + +void test_sort_helper(int *); +int test_sort_driver_driver_real_last; +void test_sort_driver_driver(int start, int *e, int *f) +{ + for (int *l = e; l > f;) + { + *--l = start; + if (f == l) + test_sort_helper(&test_sort_driver_driver_real_last); + if (start) + test_sort_driver_driver(start - 1, e, f); + } +} diff --git a/gcc/testsuite/gcc.dg/vect/pr113902.c b/gcc/testsuite/gcc.dg/vect/pr113902.c new file mode 100644 index 0000000..a2fe3df --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr113902.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ + +int g_66, g_80_2; +void func_1func_41(int p_43) +{ +lbl_1434: + g_80_2 = 0; + for (; g_80_2 <= 7; g_80_2 += 1) { + g_66 = 0; + for (; g_66 <= 7; g_66 += 1) + if (p_43) + goto lbl_1434; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/pr98308.c b/gcc/testsuite/gcc.dg/vect/pr98308.c index aeec977..d744312 100644 --- a/gcc/testsuite/gcc.dg/vect/pr98308.c +++ b/gcc/testsuite/gcc.dg/vect/pr98308.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-additional-options "-O3" } */ -/* { dg-additional-options "-march=skylake-avx512" { target avx512f } } */ +/* { dg-additional-options "-march=skylake-avx512" { target x86_64-*-* i?86-*-* } } */ /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */ extern unsigned long long int arr_86[]; diff --git a/gcc/testsuite/gcc.dg/vect/tree-vect.h b/gcc/testsuite/gcc.dg/vect/tree-vect.h index c4b8144..1e4b56e 100644 --- a/gcc/testsuite/gcc.dg/vect/tree-vect.h +++ b/gcc/testsuite/gcc.dg/vect/tree-vect.h @@ -38,7 +38,11 @@ check_vect (void) /* Determine what instruction set we've been compiled for, and detect that we're running with it. This allows us to at least do a compile check for, e.g. SSE4.1 when the machine only supports SSE2. */ -# if defined(__AVX2__) +# if defined(__AVX512VL__) + want_level = 7, want_b = bit_AVX512VL; +# elif defined(__AVX512F__) + want_level = 7, want_b = bit_AVX512F; +# elif defined(__AVX2__) want_level = 7, want_b = bit_AVX2; # elif defined(__AVX__) want_level = 1, want_c = bit_AVX; diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c index 1e2c47b..12d0ea1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c @@ -10,7 +10,7 @@ typedef struct gcry_mpi *gcry_mpi_t; struct gcry_mpi { int nlimbs; - unsigned long *d; + uint64_t *d; }; long gcry_mpi_add_ui_up; diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_117-pr113734.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_117-pr113734.c new file mode 100644 index 0000000..36ae094 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_117-pr113734.c @@ -0,0 +1,37 @@ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break_hw } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-O3" } */ + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#include "tree-vect.h" + +#define N 306 +#define NEEDLE 136 + +int table[N]; + +__attribute__ ((noipa)) +int foo (int i, unsigned short parse_tables_n) +{ + parse_tables_n >>= 9; + parse_tables_n += 11; + while (i < N && parse_tables_n--) + table[i++] = 0; + + return table[NEEDLE]; +} + +int main () +{ + check_vect (); + + for (int j = 0; j < N; j++) + table[j] = -1; + + if (foo (0, 0xFFFF) != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-novect_gcond.c b/gcc/testsuite/gcc.dg/vect/vect-novect_gcond.c new file mode 100644 index 0000000..01e69cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-novect_gcond.c @@ -0,0 +1,39 @@ +/* { dg-add-options vect_early_break } */ +/* { dg-require-effective-target vect_early_break_hw } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-O3" } */ + +/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */ + +#include "tree-vect.h" + +#define N 306 +#define NEEDLE 136 + +int table[N]; + +__attribute__ ((noipa)) +int foo (int i, unsigned short parse_tables_n) +{ + parse_tables_n >>= 9; + parse_tables_n += 11; +#pragma GCC novector + while (i < N && parse_tables_n--) + table[i++] = 0; + + return table[NEEDLE]; +} + +int main () +{ + check_vect (); + +#pragma GCC novector + for (int j = 0; j < N; j++) + table[j] = -1; + + if (foo (0, 0xFFFF) != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c index ed63ff5..009c849 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c @@ -1,3 +1,5 @@ +/* Since this uses dg-additional-sources, need to specify `dg-do run` instead of the default. */ +/* { dg-do run } */ /* { dg-require-effective-target vect_simd_clones } */ /* { dg-additional-options "-fopenmp-simd" } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c index c44471e..4699a3f 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c @@ -1,3 +1,5 @@ +/* Since this uses dg-additional-sources, need to specify `dg-do run` instead of the default. */ +/* { dg-do run } */ /* { dg-require-effective-target vect_simd_clones } */ /* { dg-additional-options "-fopenmp-simd" } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/gcc/testsuite/gcc.misc-tests/options.exp b/gcc/testsuite/gcc.misc-tests/options.exp index ec026ec..6e6e40c 100644 --- a/gcc/testsuite/gcc.misc-tests/options.exp +++ b/gcc/testsuite/gcc.misc-tests/options.exp @@ -57,7 +57,7 @@ proc check_for_all_options {language gcc_options compiler_pattern as_pattern ld_ remote_file build delete $dumpfile } - if {![regexp -- "/${compiler}(\\.exe)? -quiet.*$compiler_pattern" $gcc_output]} { + if {![regexp -- "/${compiler}(\\.exe)? \[^\r\n\]*-quiet.*$compiler_pattern" $gcc_output]} { fail "$test (compiler options)" return } diff --git a/gcc/testsuite/gcc.target/aarch64/acle/rwsr-armv8p9.c b/gcc/testsuite/gcc.target/aarch64/acle/rwsr-armv8p9.c new file mode 100644 index 0000000..e2f297b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/acle/rwsr-armv8p9.c @@ -0,0 +1,99 @@ +/* Ensure support is present for all armv8.9-a system registers. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=armv8.9-a" } */ +#include <arm_acle.h> +void +readwrite_armv8p9a_sysregs () +{ + long long int a; + + /* Write-only system registers. */ + __arm_wsr64 ("pmzr_el0", a); /* { dg-final { scan-assembler "msr\ts3_3_c9_c13_4, x0" } } */ + + /* Read/write or write-only system registers. */ + a = __arm_rsr64 ("amair2_el1"); /* { { dg-final { scan-assembler "s3_0_c10_c3_1" } } */ + a = __arm_rsr64 ("amair2_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c10_c3_1" } } */ + a = __arm_rsr64 ("amair2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c10_c3_1" } } */ + a = __arm_rsr64 ("amair2_el3"); /* { { dg-final { scan-assembler "mrs\tx0, s3_6_c10_c3_1" } } */ + a = __arm_rsr64 ("erxgsr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c5_c3_2" } } */ + a = __arm_rsr64 ("hdfgrtr2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c3_c1_0" } } */ + a = __arm_rsr64 ("hdfgwtr2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c3_c1_1" } } */ + a = __arm_rsr64 ("hfgrtr2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c3_c1_2" } } */ + a = __arm_rsr64 ("hfgwtr2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c3_c1_3" } } */ + a = __arm_rsr64 ("id_aa64mmfr3_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c0_c7_3" } } */ + a = __arm_rsr64 ("id_aa64mmfr4_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c0_c7_4" } } */ + a = __arm_rsr64 ("mair2_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c10_c2_1" } } */ + a = __arm_rsr64 ("mair2_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c10_c2_1" } } */ + a = __arm_rsr64 ("mair2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c10_c1_1" } } */ + a = __arm_rsr64 ("mair2_el3"); /* { { dg-final { scan-assembler "mrs\tx0, s3_6_c10_c1_1" } } */ + a = __arm_rsr64 ("mdselr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c0_c4_2" } } */ + a = __arm_rsr64 ("pir_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c10_c2_3" } } */ + a = __arm_rsr64 ("pir_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c10_c2_3" } } */ + a = __arm_rsr64 ("pir_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c10_c2_3" } } */ + a = __arm_rsr64 ("pir_el3"); /* { { dg-final { scan-assembler "mrs\tx0, s3_6_c10_c2_3" } } */ + a = __arm_rsr64 ("pire0_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c10_c2_2" } } */ + a = __arm_rsr64 ("pire0_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c10_c2_2" } } */ + a = __arm_rsr64 ("pire0_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c10_c2_2" } } */ + a = __arm_rsr64 ("pfar_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c6_c0_5" } } */ + a = __arm_rsr64 ("pfar_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c6_c0_5" } } */ + a = __arm_rsr64 ("pfar_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c6_c0_5" } } */ + a = __arm_rsr64 ("pmccntsvr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_7" } } */ + a = __arm_rsr64 ("pmecr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c9_c14_5" } } */ + a = __arm_rsr64 ("pmevcntsvr0_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_0" } } */ + a = __arm_rsr64 ("pmevcntsvr10_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_2" } } */ + a = __arm_rsr64 ("pmevcntsvr11_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_3" } } */ + a = __arm_rsr64 ("pmevcntsvr12_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_4" } } */ + a = __arm_rsr64 ("pmevcntsvr13_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_5" } } */ + a = __arm_rsr64 ("pmevcntsvr14_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_6" } } */ + a = __arm_rsr64 ("pmevcntsvr15_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_7" } } */ + a = __arm_rsr64 ("pmevcntsvr16_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_0" } } */ + a = __arm_rsr64 ("pmevcntsvr17_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_1" } } */ + a = __arm_rsr64 ("pmevcntsvr18_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_2" } } */ + a = __arm_rsr64 ("pmevcntsvr19_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_3" } } */ + a = __arm_rsr64 ("pmevcntsvr1_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_1" } } */ + a = __arm_rsr64 ("pmevcntsvr20_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_4" } } */ + a = __arm_rsr64 ("pmevcntsvr21_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_5" } } */ + a = __arm_rsr64 ("pmevcntsvr22_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_6" } } */ + a = __arm_rsr64 ("pmevcntsvr23_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c10_7" } } */ + a = __arm_rsr64 ("pmevcntsvr24_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_0" } } */ + a = __arm_rsr64 ("pmevcntsvr25_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_1" } } */ + a = __arm_rsr64 ("pmevcntsvr26_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_2" } } */ + a = __arm_rsr64 ("pmevcntsvr27_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_3" } } */ + a = __arm_rsr64 ("pmevcntsvr28_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_4" } } */ + a = __arm_rsr64 ("pmevcntsvr29_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_5" } } */ + a = __arm_rsr64 ("pmevcntsvr2_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_2" } } */ + a = __arm_rsr64 ("pmevcntsvr30_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c11_6" } } */ + a = __arm_rsr64 ("pmevcntsvr3_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_3" } } */ + a = __arm_rsr64 ("pmevcntsvr4_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_4" } } */ + a = __arm_rsr64 ("pmevcntsvr5_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_5" } } */ + a = __arm_rsr64 ("pmevcntsvr6_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_6" } } */ + a = __arm_rsr64 ("pmevcntsvr7_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c8_7" } } */ + a = __arm_rsr64 ("pmevcntsvr8_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_0" } } */ + a = __arm_rsr64 ("pmevcntsvr9_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c9_1" } } */ + a = __arm_rsr64 ("pmiar_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c9_c14_7" } } */ + a = __arm_rsr64 ("pmicfiltr_el0"); /* { { dg-final { scan-assembler "mrs\tx0, s3_3_c9_c6_0" } } */ + a = __arm_rsr64 ("pmicntr_el0"); /* { { dg-final { scan-assembler "mrs\tx0, s3_3_c9_c4_0" } } */ + a = __arm_rsr64 ("pmicntsvr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s2_0_c14_c12_0" } } */ + a = __arm_rsr64 ("pmsdsfr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c9_c10_4" } } */ + a = __arm_rsr64 ("pmsscr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c9_c13_3" } } */ + a = __arm_rsr64 ("pmuacr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c9_c14_4" } } */ + a = __arm_rsr64 ("por_el0"); /* { { dg-final { scan-assembler "mrs\tx0, s3_3_c10_c2_4" } } */ + a = __arm_rsr64 ("por_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c10_c2_4" } } */ + a = __arm_rsr64 ("por_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c10_c2_4" } } */ + a = __arm_rsr64 ("por_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c10_c2_4" } } */ + a = __arm_rsr64 ("por_el3"); /* { { dg-final { scan-assembler "mrs\tx0, s3_6_c10_c2_4" } } */ + a = __arm_rsr64 ("sctlr2_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c1_c0_3" } } */ + a = __arm_rsr64 ("sctlr2_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c1_c0_3" } } */ + a = __arm_rsr64 ("sctlr2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c1_c0_3" } } */ + a = __arm_rsr64 ("sctlr2_el3"); /* { { dg-final { scan-assembler "mrs\tx0, s3_6_c1_c0_3" } } */ + a = __arm_rsr64 ("s2pir_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c10_c2_5" } } */ + a = __arm_rsr64 ("s2por_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c10_c2_5" } } */ + a = __arm_rsr64 ("tcr2_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c2_c0_3" } } */ + a = __arm_rsr64 ("tcr2_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c2_c0_3" } } */ + a = __arm_rsr64 ("tcr2_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c2_c0_3" } } */ + a = __arm_rsr64 ("trcitecr_el1"); /* { { dg-final { scan-assembler "mrs\tx0, s3_0_c1_c2_3" } } */ + a = __arm_rsr64 ("trcitecr_el12"); /* { { dg-final { scan-assembler "mrs\tx0, s3_5_c1_c2_3" } } */ + a = __arm_rsr64 ("trcitecr_el2"); /* { { dg-final { scan-assembler "mrs\tx0, s3_4_c1_c2_3" } } */ + a = __arm_rsr64 ("trciteedcr"); /* { { dg-final { scan-assembler "mrs\tx0, s2_1_c0_c2_1" } } */ +} + diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c b/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c index 858181c..56a3ae2 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c +++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-3.c @@ -1,7 +1,8 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_hard_vfp_ok } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-O2 -mfp16-format=alternative" } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_fp16_alternative } */ /* Test __fp16 arguments and return value in registers (hard-float). */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c b/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c index ae65fb8..daac291 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c +++ b/gcc/testsuite/gcc.target/arm/fp16-aapcs-4.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfloat-abi=softfp -O2 -mfp16-format=alternative" } */ +/* { dg-options "-mfloat-abi=softfp -O2" } */ +/* { dg-add-options arm_fp16_alternative } */ /* { dg-skip-if "incompatible float-abi" { arm*-*-* } { "-mfloat-abi=hard" } } */ /* Test __fp16 arguments and return value in registers (softfp). */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c index 0845e88..ab5e1d5 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ __fp16 xx = 0.0; diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c index a8772a1..985299d 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative -pedantic -std=gnu99" } */ +/* { dg-options "-pedantic -std=gnu99" } */ +/* { dg-add-options arm_fp16_alternative } */ #include <math.h> diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c index 1cb3d2c..7c506e9 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative -pedantic -std=gnu99" } */ +/* { dg-options "-pedantic -std=gnu99" } */ +/* { dg-add-options arm_fp16_alternative } */ #include <math.h> diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c index 3c3bd2f..f7cb3f0 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ float xx __attribute__((mode(HF))) = 0.0; diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c index 8a45f1f..a3eebfe 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ /* 0x3c00 = 15360 */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c index 7221766..c1ae6de 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ /* 0xc000 = 49152 */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c index cfeb61a..e244bd1 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ /* 0x7bff = 31743 */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c index 3b741ae..373a59a 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ /* 0x3555 = 13653 */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c index abffff5..a8503dd 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ /* This number is the maximum value representable in the alternative encoding. */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c index c339f19..0e59234 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative -pedantic" } */ +/* { dg-options "-pedantic" } */ +/* { dg-add-options arm_fp16_alternative } */ /* This number overflows the range of the alternative encoding. Since this encoding doesn't have infinities, we should get a pedantic warning, diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c index deeb5cd..36e71c3 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ /* This is the minimum normalized value. */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c index f9f5654..5a2eef7 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-add-options arm_fp16_alternative } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ /* This is the minimum denormalized value. */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c b/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c index 27bb40d..2ad03af 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c +++ b/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c @@ -3,8 +3,10 @@ __fp16 via float. */ /* { dg-do run } */ +/* { dg-require-effective-target arm_fp16_hw } */ /* { dg-require-effective-target arm_fp16_alternative_ok } */ -/* { dg-options "-mfp16-format=alternative" } */ +/* { dg-options "-std=c99" } */ +/* { dg-add-options arm_fp16_alternative } */ #include <stdlib.h> diff --git a/gcc/testsuite/gcc.target/arm/pr97969.c b/gcc/testsuite/gcc.target/arm/pr97969.c index b8c3a23..af69e47 100644 --- a/gcc/testsuite/gcc.target/arm/pr97969.c +++ b/gcc/testsuite/gcc.target/arm/pr97969.c @@ -3,17 +3,17 @@ /* { dg-options "-std=c99 -fno-omit-frame-pointer -w -Os" } */ /* { dg-add-options arm_arch_v6m } */ -typedef a[23]; +typedef int a[23]; enum { b }; typedef struct { int c; char *e; - char f + char f; } d; typedef enum { g = 1 } h; typedef struct { h i; - int j + int j; } k; typedef struct { a l; @@ -29,9 +29,18 @@ typedef struct { d t; d *u; short v; - int w + int w; } aa; -c(char x, int y, char z, int ab) { + +void ae(short*, int, int); +void af(aa*, int, char, int); +int ag(int); +void ah(aa); +void ai(int); +void aj(aa); +int setjmp(); + +int c(char x, int y, char z, int ab) { aa ac; ac.r.i = 0; d ad; @@ -43,9 +52,9 @@ c(char x, int y, char z, int ab) { if (ag(0)) return 0; if (x) - ac.s = z + ab; + ac.s = (char*)(z + ab); else - ac.s = x + y; + ac.s = (char*)(x + y); ac.o |= g; if (!setjmp()) { ah(ac); diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-2.c b/gcc/testsuite/gcc.target/i386/apx-ndd-2.c new file mode 100644 index 0000000..3a5272d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-2.c @@ -0,0 +1,17 @@ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-options "-mapxf -O3 -w" } */ + +long a; +int b, d, e; +void +g (void) +{ + int c; + _Bool f; + __asm__("" : "=c"(c)); + switch (d) + case 2: + e = f = c & 2; + if (f) + a = b; +} diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-base-index-1.c b/gcc/testsuite/gcc.target/i386/apx-ndd-base-index-1.c new file mode 100644 index 0000000..208acd3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-base-index-1.c @@ -0,0 +1,50 @@ +/* PR target/113711 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-mapxf -O2" } */ + +#include <stdint.h> + +#define FOO(TYPE, OP_NAME, OP, IMM) \ +TYPE \ +foo_##OP_NAME##_##TYPE (TYPE *p, int64_t off) \ +{ \ + TYPE b = p[off] OP IMM; \ + return b; \ +} + +FOO (char, add, +, 0x7) +FOO (short, add, +, 0x2000) +FOO (int, add, +, 0x2000) +FOO (int64_t, add, +, 0x2000) + +FOO (char, sub, -, 0x7) +FOO (short, sub, -, 0x2000) +FOO (int, sub, -, 0x2000) +FOO (int64_t, sub, -, 0x2000) + +FOO (char, and, &, 0x7) +FOO (short, and, &, 0x2000) +FOO (int, and, &, 0x2000) +FOO (int64_t, and, &, 0x2000) + +FOO (char, or, |, 0x7) +FOO (short, or, |, 0x2000) +FOO (int, or, |, 0x2000) +FOO (int64_t, or, |, 0x2000) + +FOO (char, xor, ^, 0x7) +FOO (short, xor, ^, 0x2000) +FOO (int, xor, ^, 0x2000) +FOO (int64_t, xor, ^, 0x2000) + +FOO (char, shl, <<, 0x7) +FOO (short, shl, <<, 0x7) +FOO (int, shl, <<, 0x7) +FOO (int64_t, shl, <<, 0x7) + +FOO (char, sar, >>, 0x7) +FOO (short, sar, >>, 0x7) +FOO (int, sar, >>, 0x7) +FOO (int64_t, sar, >>, 0x7) + +/* { dg-final { scan-assembler-not "mov"} } */ diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-no-seg-global-1.c b/gcc/testsuite/gcc.target/i386/apx-ndd-no-seg-global-1.c new file mode 100644 index 0000000..d2a4040 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-no-seg-global-1.c @@ -0,0 +1,74 @@ +/* PR target/113711 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-mapxf -O2" } */ + +#include <stdint.h> + +#define FOO(TYPE, OP_NAME, OP, IMM) \ +extern TYPE foo_##OP_NAME##_##TYPE##_var; \ +TYPE \ +foo_##OP_NAME##_##TYPE (void) \ +{ \ + TYPE b = foo_##OP_NAME##_##TYPE##_var OP IMM; \ + return b; \ +} + +#define BAR(TYPE, UTYPE, OP_NAME, OP, IMM) \ +extern UTYPE bar_##OP_NAME##_##TYPE##_var; \ +int64_t \ +bar_##OP_NAME##_##TYPE (void) \ +{ \ + int64_t b = bar_##OP_NAME##_##TYPE##_var OP IMM; \ + return b; \ +} + +FOO (char, add, +, 0x7) +FOO (short, add, +, 0x2000) +FOO (int, add, +, 0x2000) +BAR (int, unsigned int, add, +, 0x2000) +FOO (int64_t, add, +, 0x2000) +BAR (int64_t, uint64_t, add, +, 0x2000) + +FOO (char, sub, -, 0x7) +FOO (short, sub, -, 0x2000) +FOO (int, sub, -, 0x2000) +BAR (int, unsigned int, sub, -, 0x2000) +FOO (int64_t, sub, -, 0x2000) +BAR (int64_t, uint64_t, sub, -, 0x2000) + +FOO (char, and, &, 0x7) +FOO (short, and, &, 0x2000) +FOO (int, and, &, 0x2000) +BAR (int, unsigned int, and, &, 0x2000) +FOO (int64_t, and, &, 0x2000) +BAR (int64_t, uint64_t, and, &, 0x2000) + +FOO (char, or, |, 0x7) +FOO (short, or, |, 0x2000) +FOO (int, or, |, 0x2000) +BAR (int, unsigned int, or, |, 0x2000) +FOO (int64_t, or, |, 0x2000) +BAR (int64_t, uint64_t, or, |, 0x2000) + +FOO (char, xor, ^, 0x7) +FOO (short, xor, ^, 0x2000) +FOO (int, xor, ^, 0x2000) +BAR (int, unsigned int, xor, ^, 0x2000) +FOO (int64_t, xor, ^, 0x2000) +BAR (int64_t, uint64_t, xor, ^, 0x2000) + +FOO (char, shl, <<, 0x7) +FOO (short, shl, <<, 0x7) +FOO (int, shl, <<, 0x7) +BAR (int, unsigned int, shl, <<, 0x7) +FOO (int64_t, shl, <<, 0x7) +BAR (int64_t, uint64_t, shl, <<, 0x7) + +FOO (char, sar, >>, 0x7) +FOO (short, sar, >>, 0x7) +FOO (int, sar, >>, 0x7) +BAR (int, unsigned int, sar, >>, 0x7) +FOO (int64_t, sar, >>, 0x7) +BAR (int64_t, uint64_t, sar, >>, 0x7) + +/* { dg-final { scan-assembler-not "mov"} } */ diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-seg-1.c b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-1.c new file mode 100644 index 0000000..d18055a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-1.c @@ -0,0 +1,98 @@ +/* PR target/113711 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-options "-mapxf -O2" } */ + +#include <stdint.h> + +#define FOO(TYPE, OP_NAME, OP, IMM) \ +TYPE \ +foo_##OP_NAME##_##TYPE (void) \ +{ \ + TYPE b = (*(TYPE __seg_fs *) 0) OP IMM; \ + return b; \ +} + +#define BAR(TYPE, UTYPE, OP_NAME, OP, IMM) \ +int64_t \ +bar_##OP_NAME##_##TYPE (void) \ +{ \ + int64_t b = (*(UTYPE __seg_fs *) 0) OP IMM; \ + return b; \ +} + +FOO (char, add, +, 0x7) +BAR (char, unsigned char, add, +, 0x7) +FOO (short, add, +, 0x2000) +BAR (short, unsigned short, add, +, 0x2000) +FOO (int, add, +, 0x2000) +BAR (int, unsigned int, add, +, 0x2000) +FOO (int64_t, add, +, 0x2000) +BAR (int64_t, uint64_t, add, +, 0x2000) +FOO (__int128_t, add, +, 0x2000) +BAR (__int128_t, __uint128_t, add, +, 0x2000) + +FOO (char, sub, -, 0x7) +BAR (char, unsigned char, sub, -, 0x7) +FOO (short, sub, -, 0x2000) +BAR (short, unsigned short, sub, -, 0x2000) +FOO (int, sub, -, 0x2000) +BAR (int, unsigned int, sub, -, 0x2000) +FOO (int64_t, sub, -, 0x2000) +BAR (int64_t, uint64_t, sub, -, 0x2000) +FOO (__int128_t, sub, -, 0x2000) +BAR (__int128_t, __uint128_t, sun, -, 0x2000) + +FOO (char, and, &, 0x7) +BAR (char, unsigned char, and, &, 0x7) +FOO (short, and, &, 0x2000) +BAR (short, unsigned short, and, &, 0x2000) +FOO (int, and, &, 0x2000) +BAR (int, unsigned int, and, &, 0x2000) +FOO (int64_t, and, &, 0x2000) +BAR (int64_t, uint64_t, and, &, 0x2000) +FOO (__int128_t, and, &, 0x2000) +BAR (__int128_t, __uint128_t, and, &, 0x2000) + +FOO (char, or, |, 0x7) +BAR (char, unsigned char, or, |, 0x7) +FOO (short, or, |, 0x2000) +BAR (short, unsigned short, or, |, 0x2000) +FOO (int, or, |, 0x2000) +BAR (int, unsigned int, or, |, 0x2000) +FOO (int64_t, or, |, 0x2000) +BAR (int64_t, uint64_t, or, |, 0x2000) +FOO (__int128_t, or, |, 0x2000) +BAR (__int128_t, __uint128_t, or, |, 0x2000) + +FOO (char, xor, ^, 0x7) +BAR (char, unsigned char, xor, ^, 0x7) +FOO (short, xor, ^, 0x2000) +BAR (short, unsigned short, xor, ^, 0x2000) +FOO (int, xor, ^, 0x2000) +BAR (int, unsigned int, xor, ^, 0x2000) +FOO (int64_t, xor, ^, 0x2000) +BAR (int64_t, uint64_t, xor, ^, 0x2000) +FOO (__int128_t, xor, ^, 0x2000) +BAR (__int128_t, __uint128_t, xor, ^, 0x2000) + +FOO (char, shl, <<, 0x7) +BAR (char, unsigned char, shl, <<, 0x7) +FOO (short, shl, <<, 0x7) +BAR (short, unsigned short, shl, <<, 0x7) +FOO (int, shl, <<, 0x7) +BAR (int, unsigned int, shl, <<, 0x7) +FOO (int64_t, shl, <<, 0x7) +BAR (int64_t, uint64_t, shl, <<, 0x7) +FOO (__int128_t, shl, <<, 0x7) +BAR (__int128_t, __uint128_t, shl, <<, 0x7) + +FOO (char, sar, >>, 0x7) +BAR (char, unsigned char, sar, >>, 0x7) +FOO (short, sar, >>, 0x7) +BAR (short, unsigned short, sar, >>, 0x7) +FOO (int, sar, >>, 0x7) +BAR (int, unsigned int, sar, >>, 0x7) +FOO (int64_t, sar, >>, 0x7) +BAR (int64_t, uint64_t, sar, >>, 0x7) +FOO (__int128_t, sar, >>, 0x7) +BAR (__int128_t, __uint128_t, sar, >>, 0x7) diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-seg-2.c b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-2.c new file mode 100644 index 0000000..5b164ef --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-2.c @@ -0,0 +1,98 @@ +/* PR target/113711 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-mapxf -O2" } */ + +#include <stdint.h> + +#define FOO(TYPE, OP_NAME, OP, IMM) \ +TYPE \ +foo_##OP_NAME##_##TYPE (void) \ +{ \ + TYPE b = (*(TYPE *) 0x20000) OP IMM; \ + return b; \ +} + +#define BAR(TYPE, UTYPE, OP_NAME, OP, IMM) \ +int64_t \ +bar_##OP_NAME##_##TYPE (void) \ +{ \ + int64_t b = (*(UTYPE *) 0x20000) OP IMM; \ + return b; \ +} + +#define SEG(TYPE, OP_NAME, OP, IMM) \ +TYPE \ +seg_##OP_NAME##_##TYPE (void) \ +{ \ + TYPE b = (*(TYPE __seg_fs *) 0) OP IMM; \ + return b; \ +} + +FOO (char, add, +, 0x7) +SEG (char, add, +, 0x7) +FOO (short, add, +, 0x2000) +SEG (short, add, +, 0x2000) +FOO (int, add, +, 0x2000) +BAR (int, unsigned int, add, +, 0x2000) +FOO (int64_t, add, +, 0x2000) +BAR (int64_t, uint64_t, add, +, 0x2000) + +FOO (char, sub, -, 0x7) +SEG (char, sub, -, 0x7) +FOO (short, sub, -, 0x2000) +SEG (short, sub, -, 0x2000) +FOO (int, sub, -, 0x2000) +BAR (int, unsigned int, sub, -, 0x2000) +FOO (int64_t, sub, -, 0x2000) +BAR (int64_t, uint64_t, sub, -, 0x2000) + +FOO (char, and, &, 0x7) +SEG (char, and, &, 0x7) +FOO (short, and, &, 0x2000) +SEG (short, and, &, 0x2000) +FOO (int, and, &, 0x2000) +BAR (int, unsigned int, and, &, 0x2000) +FOO (int64_t, and, &, 0x2000) +BAR (int64_t, uint64_t, and, &, 0x2000) + +FOO (char, or, |, 0x7) +SEG (char, or, |, 0x7) +FOO (short, or, |, 0x2000) +SEG (short, or, |, 0x2000) +FOO (int, or, |, 0x2000) +BAR (int, unsigned int, or, |, 0x2000) +FOO (int64_t, or, |, 0x2000) +BAR (int64_t, uint64_t, or, |, 0x2000) + +FOO (char, xor, ^, 0x7) +SEG (char, xor, ^, 0x7) +FOO (short, xor, ^, 0x2000) +SEG (short, xor, ^, 0x2000) +FOO (int, xor, ^, 0x2000) +BAR (int, unsigned int, xor, ^, 0x2000) +FOO (int64_t, xor, ^, 0x2000) +BAR (int64_t, uint64_t, xor, ^, 0x2000) + +FOO (char, shl, <<, 0x7) +SEG (char, shl, <<, 0x7) +FOO (short, shl, <<, 0x7) +SEG (short, shl, <<, 0x7) +FOO (int, shl, <<, 0x7) +SEG (int, shl, <<, 0x7) +BAR (int, unsigned int, shl, <<, 0x7) +FOO (int64_t, shl, <<, 0x7) +SEG (int64_t, shl, <<, 0x7) +BAR (int64_t, uint64_t, shl, <<, 0x7) + +FOO (char, sar, >>, 0x7) +SEG (char, sar, >>, 0x7) +FOO (short, sar, >>, 0x7) +SEG (short, sar, >>, 0x7) +FOO (int, sar, >>, 0x7) +SEG (int, sar, >>, 0x7) +BAR (int, unsigned int, sar, >>, 0x7) +FOO (int64_t, sar, >>, 0x7) +SEG (int64_t, sar, >>, 0x7) +BAR (int64_t, uint64_t, sar, >>, 0x7) + +/* { dg-final { scan-assembler-not "mov"} } */ diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-seg-3.c b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-3.c new file mode 100644 index 0000000..e7d9c3c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-3.c @@ -0,0 +1,14 @@ +/* PR target/113711 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-options "-mapxf -O2" } */ + +typedef signed __int128 S; +int o; + +S +qux (void) +{ + S z; + o = __builtin_add_overflow (*(S __seg_fs *) 0x1000, 0x200, &z); + return z; +} diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-seg-4.c b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-4.c new file mode 100644 index 0000000..a60c4d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-4.c @@ -0,0 +1,9 @@ +/* PR target/113711 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-options "-mapxf -O2" } */ + +unsigned __int128 +foo (void) +{ + return *((unsigned __int128 __seg_fs *) 0x1000) + 0x2000; +} diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-seg-5.c b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-5.c new file mode 100644 index 0000000..9be4e967 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-seg-5.c @@ -0,0 +1,13 @@ +/* PR target/113711 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-options "-mapxf -O2" } */ + +#include <stdint.h> + +extern int bar __attribute__((__visibility__ ("hidden"))); + +uintptr_t +foo (void) +{ + return (*(uintptr_t __seg_fs *) 0x1000) - (uintptr_t) &bar; +} diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-tls-1a.c b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-1a.c new file mode 100644 index 0000000..5bf57a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-1a.c @@ -0,0 +1,41 @@ +/* PR target/113733 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-require-effective-target tls } */ +/* { dg-options "-mapxf -O3 -w" } */ + +extern __thread int a, j; +enum b +{ + c, + d +}; +struct e +{ + long f; + struct + { + char g[1024]; + }; +} typedef h (); +long i; +int o (char *); +static enum b +k (int *p) +{ + h l; + struct e n; + do + { + l (n, n.f, p); + char **m; + for (; *m; ++m) + if (o (*m)) + i = j; + } + while (d); +} +void +getgrouplist () +{ + k (&a); +} diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-tls-2.c b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-2.c new file mode 100644 index 0000000..db98594 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-2.c @@ -0,0 +1,38 @@ +/* PR target/113711 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-require-effective-target tls } */ +/* { dg-options "-mapxf -O2" } */ + +#include <stdint.h> + +#define DECL(TYPE) \ +__thread TYPE TYPE##_a = 255; \ +TYPE * volatile TYPE##_a_in_other_thread = (TYPE *)12345; + +DECL(uint64_t) +DECL(uint32_t) + +#define FOO(TYPE, name, op, val) \ +void * \ +thread_func##TYPE##name (void *arg) \ +{ \ + TYPE##_a_in_other_thread = &TYPE##_a; \ + TYPE##_a = TYPE##_a op val; \ + *((TYPE *) arg) = TYPE##_a; \ + return (void *)0; \ +} + +FOO(uint64_t, add, +, 0x2000) +FOO(uint32_t, add, +, 0x2000) + +FOO(uint64_t, sub, -, 0x2000) +FOO(uint32_t, sub, -, 0x2000) + +FOO(uint64_t, or, |, 0x2000) +FOO(uint32_t, or, |, 0x2000) + +FOO(uint64_t, and, &, 0x2000) +FOO(uint32_t, and, &, 0x2000) + +FOO(uint64_t, xor, ^, 0x2000) +FOO(uint32_t, xor, ^, 0x2000) diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-tls-3.c b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-3.c new file mode 100644 index 0000000..e7374b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-3.c @@ -0,0 +1,16 @@ +/* PR target/113711 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-require-effective-target tls } */ +/* { dg-options "-mapxf -O2" } */ + +typedef signed __int128 S; +__thread S var; +int o; + +S +qux (void) +{ + S z; + o = __builtin_add_overflow (var, 0x200, &z); + return z; +} diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-tls-4.c b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-4.c new file mode 100644 index 0000000..f3b2eac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-tls-4.c @@ -0,0 +1,31 @@ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-require-effective-target tls } */ +/* { dg-options "-mapxf -O2" } */ + +#define DECL(TYPE) \ +extern __thread TYPE TYPE##_a; + +DECL(__int128_t) +DECL(__uint128_t) + +#define FOO(TYPE, name, op, val) \ +TYPE \ +thread_func##TYPE##name (void) \ +{ \ + return TYPE##_a op val; \ +} + +FOO(__int128_t, add, +, 0x2000) +FOO(__uint128_t, add, +, 0x2000) + +FOO(__int128_t, sub, -, 0x2000) +FOO(__uint128_t, sub, -, 0x2000) + +FOO(__int128_t, or, |, 0x2000) +FOO(__uint128_t, or, |, 0x2000) + +FOO(__int128_t, and, &, 0x2000) +FOO(__uint128_t, and, &, 0x2000) + +FOO(__int128_t, xor, ^, 0x2000) +FOO(__uint128_t, xor, ^, 0x2000) diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd-x32-1.c b/gcc/testsuite/gcc.target/i386/apx-ndd-x32-1.c new file mode 100644 index 0000000..4280d40 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-ndd-x32-1.c @@ -0,0 +1,49 @@ +/* PR target/113711 */ +/* { dg-do assemble { target { apxf && { ! ia32 } } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-mapxf -O2 -mx32" } */ + +#include <stdint.h> + +#define FOO(TYPE, OP_NAME, OP, IMM) \ +TYPE \ +foo_##OP_NAME##_##TYPE (int off, TYPE *ptr) \ +{ \ + TYPE b = ptr[off + 0x100] + IMM; \ + return b; \ +} + +FOO (char, add, +, 0x7) +FOO (short, add, +, 0x2000) +FOO (int, add, +, 0x2000) +FOO (int64_t, add, +, 0x2000) + +FOO (char, sub, -, 0x7) +FOO (short, sub, -, 0x2000) +FOO (int, sub, -, 0x2000) +FOO (int64_t, sub, -, 0x2000) + +FOO (char, and, &, 0x7) +FOO (short, and, &, 0x2000) +FOO (int, and, &, 0x2000) +FOO (long, and, &, 0x2000) + +FOO (char, or, |, 0x7) +FOO (short, or, |, 0x2000) +FOO (int, or, |, 0x2000) +FOO (int64_t, or, |, 0x2000) + +FOO (char, xor, ^, 0x7) +FOO (short, xor, ^, 0x2000) +FOO (int, xor, ^, 0x2000) +FOO (long, xor, ^, 0x2000) + +FOO (char, shl, <<, 0x7) +FOO (short, shl, <<, 0x7) +FOO (int, shl, <<, 0x7) +FOO (int64_t, shl, <<, 0x7) + +FOO (char, sar, >>, 0x7) +FOO (short, sar, >>, 0x7) +FOO (int, sar, >>, 0x7) +FOO (int64_t, sar, >>, 0x7) diff --git a/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c b/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c index b785456..001eb66 100644 --- a/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c +++ b/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c @@ -9,5 +9,5 @@ func (void) __asm__ ("@ %p0" : : "Ws" (&var + 1)); } -/* { dg-final { scan-assembler "@ func" } } */ -/* { dg-final { scan-assembler "@ var\\+4" } } */ +/* { dg-final { scan-assembler "@ _?func" } } */ +/* { dg-final { scan-assembler "@ (_?var\\+4|4\\+_?var)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113415.c b/gcc/testsuite/gcc.target/i386/pr113415.c new file mode 100644 index 0000000..60efa66 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113415.c @@ -0,0 +1,11 @@ +/* PR middle-end/113415 */ +/* { dg-do compile } */ +/* { dg-options "-mstringop-strategy=byte_loop" } */ + +void +foo (void) +{ + unsigned long arr[64]; +lab: + __asm__ goto ("" : "=r" (arr) : : : lab); /* { dg-error "impossible constraint in 'asm'" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/pr113689-1.c b/gcc/testsuite/gcc.target/i386/pr113689-1.c index 8285c0a..9b8474e 100644 --- a/gcc/testsuite/gcc.target/i386/pr113689-1.c +++ b/gcc/testsuite/gcc.target/i386/pr113689-1.c @@ -1,5 +1,7 @@ /* { dg-do run { target { lp64 && fpic } } } */ /* { dg-options "-O2 -fno-pic -fprofile -mcmodel=large" } */ +/* { dg-skip-if "PR90698" { *-*-darwin* } } */ +/* { dg-skip-if "PR113909" { *-*-solaris2* } } */ #include <stdarg.h> diff --git a/gcc/testsuite/gcc.target/i386/pr113689-2.c b/gcc/testsuite/gcc.target/i386/pr113689-2.c index 2e5579a..58688b9 100644 --- a/gcc/testsuite/gcc.target/i386/pr113689-2.c +++ b/gcc/testsuite/gcc.target/i386/pr113689-2.c @@ -1,5 +1,7 @@ /* { dg-do run { target { lp64 && fpic } } } */ /* { dg-options "-O2 -fpic -fprofile -mcmodel=large" } */ +/* { dg-skip-if "PR90698" { *-*-darwin* } } */ +/* { dg-skip-if "PR113909" { *-*-solaris2* } } */ __attribute__((noipa)) void diff --git a/gcc/testsuite/gcc.target/i386/pr113689-3.c b/gcc/testsuite/gcc.target/i386/pr113689-3.c index dab7519..14c9062 100644 --- a/gcc/testsuite/gcc.target/i386/pr113689-3.c +++ b/gcc/testsuite/gcc.target/i386/pr113689-3.c @@ -1,5 +1,7 @@ /* { dg-do run { target { lp64 && fpic } } } */ /* { dg-options "-O2 -fpic -fprofile -mcmodel=large" } */ +/* { dg-skip-if "PR90698" { *-*-darwin* } } */ +/* { dg-skip-if "PR113909" { *-*-solaris2* } } */ #include <stdarg.h> diff --git a/gcc/testsuite/gcc.target/i386/pr113690.c b/gcc/testsuite/gcc.target/i386/pr113690.c new file mode 100644 index 0000000..23a1108 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113690.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -fno-dce -fno-forward-propagate -fno-split-wide-types -funroll-loops" } */ +int i; +__attribute__((__vector_size__(64))) __int128 v; + +void +foo(void) +{ + v <<= 127; + __builtin_mul_overflow(0, i, &v[3]); + v *= 6; +} diff --git a/gcc/testsuite/gcc.target/i386/pr113871-1a.c b/gcc/testsuite/gcc.target/i386/pr113871-1a.c new file mode 100644 index 0000000..f720927 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113871-1a.c @@ -0,0 +1,19 @@ +/* PR target/113871 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef char vect64 __attribute__((vector_size(8))); + +void f (vect64 *a) +{ + *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2, 3, 4, 5, 6, 7, 8); +} + +/* { dg-final { scan-assembler "psrlq" } } */ + +void g(vect64 *a) +{ + *a = __builtin_shufflevector((vect64){0}, *a, 7, 8, 9, 10, 11, 12, 13, 14); +} + +/* { dg-final { scan-assembler "psllq" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113871-1b.c b/gcc/testsuite/gcc.target/i386/pr113871-1b.c new file mode 100644 index 0000000..705cf5c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113871-1b.c @@ -0,0 +1,19 @@ +/* PR target/113871 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef char vect32 __attribute__((vector_size(4))); + +void f (vect32 *a) +{ + *a = __builtin_shufflevector(*a, (vect32){0}, 1, 2, 3, 4); +} + +/* { dg-final { scan-assembler "psrld" } } */ + +void g(vect32 *a) +{ + *a = __builtin_shufflevector((vect32){0}, *a, 3, 4, 5, 6); +} + +/* { dg-final { scan-assembler "pslld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113871-2a.c b/gcc/testsuite/gcc.target/i386/pr113871-2a.c new file mode 100644 index 0000000..5430f69 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113871-2a.c @@ -0,0 +1,19 @@ +/* PR target/113871 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef short vect64 __attribute__((vector_size(8))); + +void f (vect64 *a) +{ + *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2, 3, 4); +} + +/* { dg-final { scan-assembler "psrlq" } } */ + +void g(vect64 *a) +{ + *a = __builtin_shufflevector((vect64){0}, *a, 3, 4, 5, 6); +} + +/* { dg-final { scan-assembler "psllq" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113871-2b.c b/gcc/testsuite/gcc.target/i386/pr113871-2b.c new file mode 100644 index 0000000..06e2a44 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113871-2b.c @@ -0,0 +1,19 @@ +/* PR target/113871 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef short vect32 __attribute__((vector_size(4))); + +void f (vect32 *a) +{ + *a = __builtin_shufflevector(*a, (vect32){0}, 1, 2); +} + +/* { dg-final { scan-assembler "psrld" } } */ + +void g(vect32 *a) +{ + *a = __builtin_shufflevector((vect32){0}, *a, 1, 2); +} + +/* { dg-final { scan-assembler "pslld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113871-3a.c b/gcc/testsuite/gcc.target/i386/pr113871-3a.c new file mode 100644 index 0000000..825d48e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113871-3a.c @@ -0,0 +1,19 @@ +/* PR target/113871 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef _Float16 vect64 __attribute__((vector_size(8))); + +void f (vect64 *a) +{ + *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2, 3, 4); +} + +/* { dg-final { scan-assembler "psrlq" } } */ + +void g(vect64 *a) +{ + *a = __builtin_shufflevector((vect64){0}, *a, 3, 4, 5, 6); +} + +/* { dg-final { scan-assembler "psllq" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113871-3b.c b/gcc/testsuite/gcc.target/i386/pr113871-3b.c new file mode 100644 index 0000000..f8e0299 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113871-3b.c @@ -0,0 +1,19 @@ +/* PR target/113871 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef _Float16 vect32 __attribute__((vector_size(4))); + +void f (vect32 *a) +{ + *a = __builtin_shufflevector(*a, (vect32){0}, 1, 2); +} + +/* { dg-final { scan-assembler "psrld" } } */ + +void g(vect32 *a) +{ + *a = __builtin_shufflevector((vect32){0}, *a, 1, 2); +} + +/* { dg-final { scan-assembler "pslld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113871-4a.c b/gcc/testsuite/gcc.target/i386/pr113871-4a.c new file mode 100644 index 0000000..3887b1f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113871-4a.c @@ -0,0 +1,19 @@ +/* PR target/113871 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef int vect64 __attribute__((vector_size(8))); + +void f (vect64 *a) +{ + *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2); +} + +/* { dg-final { scan-assembler "psrlq" } } */ + +void g(vect64 *a) +{ + *a = __builtin_shufflevector((vect64){0}, *a, 1, 2); +} + +/* { dg-final { scan-assembler "psllq" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr113876.c b/gcc/testsuite/gcc.target/i386/pr113876.c new file mode 100644 index 0000000..fbf26f6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr113876.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target { lp64 } } } */ +/* { dg-options "-O -mapxf -mpreferred-stack-boundary=3 -finstrument-functions -mcmodel=large" } */ + +void +bar (unsigned long *p) +{ + p[0] = 0; + p[1] = 0; + p[2] = 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/pr113742.c b/gcc/testsuite/gcc.target/riscv/pr113742.c new file mode 100644 index 0000000..ab8934c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr113742.c @@ -0,0 +1,4 @@ +//* { dg-do compile } */ +/* { dg-options "-O2 -finstrument-functions -mabi=lp64d -mcpu=sifive-p670" } */ + +void foo(void) {} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-1.c index 2eef9e1..a072bdd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-1.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { ! riscv_xtheadvector } } } */ -/* { dg-skip-if "test rvv intrinsic" { *-*-* } { "*" } { "-march=rv*v*" } } */ +/* { dg-skip-if "test rvv intrinsic" { ! riscv_v } } */ void foo0 () {__rvv_bool64_t t;} void foo1 () {__rvv_bool32_t t;} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr113766-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr113766-1.c index bd4943b..9e911e3 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr113766-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr113766-1.c @@ -6,80 +6,96 @@ void test () { - __riscv_vand (); /* { dg-error {no matching function call to '__riscv_vand' with empty args} } */ - __riscv_vand_tu (); /* { dg-error {no matching function call to '__riscv_vand_tu' with empty args} } */ - __riscv_vand_tumu (); /* { dg-error {no matching function call to '__riscv_vand_tumu' with empty args} } */ + __riscv_vand (); /* { dg-error {no matching function call to '__riscv_vand' with empty arguments} } */ + __riscv_vand_tu (); /* { dg-error {no matching function call to '__riscv_vand_tu' with empty arguments} } */ + __riscv_vand_tumu (); /* { dg-error {no matching function call to '__riscv_vand_tumu' with empty arguments} } */ - __riscv_vcompress (); /* { dg-error {no matching function call to '__riscv_vcompress' with empty args} } */ - __riscv_vcompress_tu (); /* { dg-error {no matching function call to '__riscv_vcompress_tu' with empty args} } */ + __riscv_vcompress (); /* { dg-error {no matching function call to '__riscv_vcompress' with empty arguments} } */ + __riscv_vcompress_tu (); /* { dg-error {no matching function call to '__riscv_vcompress_tu' with empty arguments} } */ - __riscv_vcpop (); /* { dg-error {no matching function call to '__riscv_vcpop' with empty args} } */ + __riscv_vcpop (); /* { dg-error {no matching function call to '__riscv_vcpop' with empty arguments} } */ - __riscv_vdiv (); /* { dg-error {no matching function call to '__riscv_vdiv' with empty args} } */ - __riscv_vdiv_tu (); /* { dg-error {no matching function call to '__riscv_vdiv_tu' with empty args} } */ - __riscv_vdiv_tumu (); /* { dg-error {no matching function call to '__riscv_vdiv_tumu' with empty args} } */ + __riscv_vdiv (); /* { dg-error {no matching function call to '__riscv_vdiv' with empty arguments} } */ + __riscv_vdiv_tu (); /* { dg-error {no matching function call to '__riscv_vdiv_tu' with empty arguments} } */ + __riscv_vdiv_tumu (); /* { dg-error {no matching function call to '__riscv_vdiv_tumu' with empty arguments} } */ - __riscv_vfabs (); /* { dg-error {no matching function call to '__riscv_vfabs' with empty args} } */ - __riscv_vfabs_tu (); /* { dg-error {no matching function call to '__riscv_vfabs_tu' with empty args} } */ - __riscv_vfabs_tumu (); /* { dg-error {no matching function call to '__riscv_vfabs_tumu' with empty args} } */ + __riscv_vfabs (); /* { dg-error {no matching function call to '__riscv_vfabs' with empty arguments} } */ + __riscv_vfabs_tu (); /* { dg-error {no matching function call to '__riscv_vfabs_tu' with empty arguments} } */ + __riscv_vfabs_tumu (); /* { dg-error {no matching function call to '__riscv_vfabs_tumu' with empty arguments} } */ - __riscv_vfadd (); /* { dg-error {no matching function call to '__riscv_vfadd' with empty args} } */ - __riscv_vfadd_tu (); /* { dg-error {no matching function call to '__riscv_vfadd_tu' with empty args} } */ - __riscv_vfadd_tumu (); /* { dg-error {no matching function call to '__riscv_vfadd_tumu' with empty args} } */ + __riscv_vfadd (); /* { dg-error {no matching function call to '__riscv_vfadd' with empty arguments} } */ + __riscv_vfadd_tu (); /* { dg-error {no matching function call to '__riscv_vfadd_tu' with empty arguments} } */ + __riscv_vfadd_tumu (); /* { dg-error {no matching function call to '__riscv_vfadd_tumu' with empty arguments} } */ - __riscv_vfclass (); /* { dg-error {no matching function call to '__riscv_vfclass' with empty args} } */ - __riscv_vfclass_tu (); /* { dg-error {no matching function call to '__riscv_vfclass_tu' with empty args} } */ - __riscv_vfclass_tumu (); /* { dg-error {no matching function call to '__riscv_vfclass_tumu' with empty args} } */ + __riscv_vfclass (); /* { dg-error {no matching function call to '__riscv_vfclass' with empty arguments} } */ + __riscv_vfclass_tu (); /* { dg-error {no matching function call to '__riscv_vfclass_tu' with empty arguments} } */ + __riscv_vfclass_tumu (); /* { dg-error {no matching function call to '__riscv_vfclass_tumu' with empty arguments} } */ - __riscv_vfcvt_x (); /* { dg-error {no matching function call to '__riscv_vfcvt_x' with empty args} } */ - __riscv_vfcvt_x_tu (); /* { dg-error {no matching function call to '__riscv_vfcvt_x_tu' with empty args} } */ - __riscv_vfcvt_x_tumu (); /* { dg-error {no matching function call to '__riscv_vfcvt_x_tumu' with empty args} } */ + __riscv_vfcvt_x (); /* { dg-error {no matching function call to '__riscv_vfcvt_x' with empty arguments} } */ + __riscv_vfcvt_x_tu (); /* { dg-error {no matching function call to '__riscv_vfcvt_x_tu' with empty arguments} } */ + __riscv_vfcvt_x_tumu (); /* { dg-error {no matching function call to '__riscv_vfcvt_x_tumu' with empty arguments} } */ - __riscv_vfirst (); /* { dg-error {no matching function call to '__riscv_vfirst' with empty args} } */ + __riscv_vfirst (); /* { dg-error {no matching function call to '__riscv_vfirst' with empty arguments} } */ - __riscv_vfmadd (); /* { dg-error {no matching function call to '__riscv_vfmadd' with empty args} } */ - __riscv_vfmadd_tu (); /* { dg-error {no matching function call to '__riscv_vfmadd_tu' with empty args} } */ - __riscv_vfmadd_tumu (); /* { dg-error {no matching function call to '__riscv_vfmadd_tumu' with empty args} } */ + __riscv_vfmadd (); /* { dg-error {no matching function call to '__riscv_vfmadd' with empty arguments} } */ + __riscv_vfmadd_tu (); /* { dg-error {no matching function call to '__riscv_vfmadd_tu' with empty arguments} } */ + __riscv_vfmadd_tumu (); /* { dg-error {no matching function call to '__riscv_vfmadd_tumu' with empty arguments} } */ - __riscv_vfmerge (); /* { dg-error {no matching function call to '__riscv_vfmerge' with empty args} } */ - __riscv_vfmerge_tu (); /* { dg-error {no matching function call to '__riscv_vfmerge_tu' with empty args} } */ + __riscv_vfmerge (); /* { dg-error {no matching function call to '__riscv_vfmerge' with empty arguments} } */ + __riscv_vfmerge_tu (); /* { dg-error {no matching function call to '__riscv_vfmerge_tu' with empty arguments} } */ - __riscv_vfncvt_x (); /* { dg-error {no matching function call to '__riscv_vfncvt_x' with empty args} } */ - __riscv_vfncvt_x_tu (); /* { dg-error {no matching function call to '__riscv_vfncvt_x_tu' with empty args} } */ - __riscv_vfncvt_x_tumu (); /* { dg-error {no matching function call to '__riscv_vfncvt_x_tumu' with empty args} } */ + __riscv_vfncvt_x (); /* { dg-error {no matching function call to '__riscv_vfncvt_x' with empty arguments} } */ + __riscv_vfncvt_x_tu (); /* { dg-error {no matching function call to '__riscv_vfncvt_x_tu' with empty arguments} } */ + __riscv_vfncvt_x_tumu (); /* { dg-error {no matching function call to '__riscv_vfncvt_x_tumu' with empty arguments} } */ - __riscv_vfrec7 (); /* { dg-error {no matching function call to '__riscv_vfrec7' with empty args} } */ - __riscv_vfrec7_tu (); /* { dg-error {no matching function call to '__riscv_vfrec7_tu' with empty args} } */ - __riscv_vfrec7_tumu (); /* { dg-error {no matching function call to '__riscv_vfrec7_tumu' with empty args} } */ + __riscv_vfrec7 (); /* { dg-error {no matching function call to '__riscv_vfrec7' with empty arguments} } */ + __riscv_vfrec7_tu (); /* { dg-error {no matching function call to '__riscv_vfrec7_tu' with empty arguments} } */ + __riscv_vfrec7_tumu (); /* { dg-error {no matching function call to '__riscv_vfrec7_tumu' with empty arguments} } */ - __riscv_vfrsqrt7 (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7' with empty args} } */ - __riscv_vfrsqrt7_tu (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7_tu' with empty args} } */ - __riscv_vfrsqrt7_tumu (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7_tumu' with empty args} } */ + __riscv_vfrsqrt7 (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7' with empty arguments} } */ + __riscv_vfrsqrt7_tu (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7_tu' with empty arguments} } */ + __riscv_vfrsqrt7_tumu (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7_tumu' with empty arguments} } */ - __riscv_vfsgnjn (); /* { dg-error {no matching function call to '__riscv_vfsgnjn' with empty args} } */ - __riscv_vfsgnjn_tu (); /* { dg-error {no matching function call to '__riscv_vfsgnjn_tu' with empty args} } */ - __riscv_vfsgnjn_tumu (); /* { dg-error {no matching function call to '__riscv_vfsgnjn_tumu' with empty args} } */ + __riscv_vfsgnjn (); /* { dg-error {no matching function call to '__riscv_vfsgnjn' with empty arguments} } */ + __riscv_vfsgnjn_tu (); /* { dg-error {no matching function call to '__riscv_vfsgnjn_tu' with empty arguments} } */ + __riscv_vfsgnjn_tumu (); /* { dg-error {no matching function call to '__riscv_vfsgnjn_tumu' with empty arguments} } */ - __riscv_vfslide1down (); /* { dg-error {no matching function call to '__riscv_vfslide1down' with empty args} } */ - __riscv_vfslide1down_tu (); /* { dg-error {no matching function call to '__riscv_vfslide1down_tu' with empty args} } */ - __riscv_vfslide1down_tumu (); /* { dg-error {no matching function call to '__riscv_vfslide1down_tumu' with empty args} } */ + __riscv_vfslide1down (); /* { dg-error {no matching function call to '__riscv_vfslide1down' with empty arguments} } */ + __riscv_vfslide1down_tu (); /* { dg-error {no matching function call to '__riscv_vfslide1down_tu' with empty arguments} } */ + __riscv_vfslide1down_tumu (); /* { dg-error {no matching function call to '__riscv_vfslide1down_tumu' with empty arguments} } */ - __riscv_vfwmul (); /* { dg-error {no matching function call to '__riscv_vfwmul' with empty args} } */ - __riscv_vfwmul_tu (); /* { dg-error {no matching function call to '__riscv_vfwmul_tu' with empty args} } */ - __riscv_vfwmul_tumu (); /* { dg-error {no matching function call to '__riscv_vfwmul_tumu' with empty args} } */ + __riscv_vfwmul (); /* { dg-error {no matching function call to '__riscv_vfwmul' with empty arguments} } */ + __riscv_vfwmul_tu (); /* { dg-error {no matching function call to '__riscv_vfwmul_tu' with empty arguments} } */ + __riscv_vfwmul_tumu (); /* { dg-error {no matching function call to '__riscv_vfwmul_tumu' with empty arguments} } */ - __riscv_vle32 (); /* { dg-error {no matching function call to '__riscv_vle32' with empty args} } */ - __riscv_vle32_tu (); /* { dg-error {no matching function call to '__riscv_vle32_tu' with empty args} } */ - __riscv_vle32_tumu (); /* { dg-error {no matching function call to '__riscv_vle32_tumu' with empty args} } */ + __riscv_vle32 (); /* { dg-error {no matching function call to '__riscv_vle32' with empty arguments} } */ + __riscv_vle32_tu (); /* { dg-error {no matching function call to '__riscv_vle32_tu' with empty arguments} } */ + __riscv_vle32_tumu (); /* { dg-error {no matching function call to '__riscv_vle32_tumu' with empty arguments} } */ - __riscv_vlse64 (); /* { dg-error {no matching function call to '__riscv_vlse64' with empty args} } */ - __riscv_vlse64_tu (); /* { dg-error {no matching function call to '__riscv_vlse64_tu' with empty args} } */ - __riscv_vlse64_tumu (); /* { dg-error {no matching function call to '__riscv_vlse64_tumu' with empty args} } */ + __riscv_vlse64 (); /* { dg-error {no matching function call to '__riscv_vlse64' with empty arguments} } */ + __riscv_vlse64_tu (); /* { dg-error {no matching function call to '__riscv_vlse64_tu' with empty arguments} } */ + __riscv_vlse64_tumu (); /* { dg-error {no matching function call to '__riscv_vlse64_tumu' with empty arguments} } */ - __riscv_vmfeq (); /* { dg-error {no matching function call to '__riscv_vmfeq' with empty args} } */ + __riscv_vmfeq (); /* { dg-error {no matching function call to '__riscv_vmfeq' with empty arguments} } */ - __riscv_vreinterpret_u8m1 (); /* { dg-error {no matching function call to '__riscv_vreinterpret_u8m1' with empty args} } */ + __riscv_vreinterpret_u8m1 (); /* { dg-error {no matching function call to '__riscv_vreinterpret_u8m1' with empty arguments} } */ - __riscv_vfredosum (); /* { dg-error {no matching function call to '__riscv_vfredosum' with empty args} } */ - __riscv_vfredosum_tu (); /* { dg-error {no matching function call to '__riscv_vfredosum_tu' with empty args} } */ + __riscv_vfredosum (); /* { dg-error {no matching function call to '__riscv_vfredosum' with empty arguments} } */ + __riscv_vfredosum_tu (); /* { dg-error {no matching function call to '__riscv_vfredosum_tu' with empty arguments} } */ + + __riscv_vaadd (); /* { dg-error {no matching function call to '__riscv_vaadd' with empty arguments} } */ + + __riscv_vaaddu (); /* { dg-error {no matching function call to '__riscv_vaaddu' with empty arguments} } */ + + __riscv_vadc (); /* { dg-error {no matching function call to '__riscv_vadc' with empty arguments} } */ + + __riscv_vnmsac (); /* { dg-error {no matching function call to '__riscv_vnmsac' with empty arguments} } */ + + __riscv_vnsrl (); /* { dg-error {no matching function call to '__riscv_vnsrl' with empty arguments} } */ + + __riscv_vfnmadd (); /* { dg-error {no matching function call to '__riscv_vfnmadd' with empty arguments} } */ + + __riscv_vfwsub_vv (); /* { dg-error {no matching function call to '__riscv_vfwsub_vv' with empty arguments} } */ + + __riscv_vfwredosum (); /* { dg-error {no matching function call to '__riscv_vfwredosum' with empty arguments} } */ } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-2.c index fd2aa30..fc1bb13 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-2.c @@ -1,4 +1,4 @@ /* { dg-do compile } */ -/* { dg-skip-if "test rvv intrinsic" { *-*-* } { "*" } { "-march=rv*v*" } } */ +/* { dg-skip-if "test rvv intrinsic" { ! riscv_v } } */ #pragma riscv intrinsic "vector" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-3.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-3.c index 96a0e05..4957c57 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-3.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pragma-3.c @@ -1,4 +1,4 @@ /* { dg-do compile } */ -/* { dg-skip-if "test rvv intrinsic" { *-*-* } { "*" } { "-march=rv*v*" } } */ +/* { dg-skip-if "test rvv intrinsic" { ! riscv_v } } */ #pragma riscv intrinsic "report-error" /* { dg-error {unknown '#pragma riscv intrinsic' option 'report-error'} } */ diff --git a/gcc/testsuite/gdc.dg/imports/pr113125.d b/gcc/testsuite/gdc.dg/imports/pr113125.d new file mode 100644 index 0000000..761e613 --- /dev/null +++ b/gcc/testsuite/gdc.dg/imports/pr113125.d @@ -0,0 +1,2 @@ +module imports.pr113125; +struct S113125; diff --git a/gcc/testsuite/gdc.dg/pr113125.d b/gcc/testsuite/gdc.dg/pr113125.d new file mode 100644 index 0000000..cb7300b --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr113125.d @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "-I $srcdir/gdc.dg" } +module pr113125; +import imports.pr113125: S113125; diff --git a/gcc/testsuite/gdc.dg/torture/pr113758.d b/gcc/testsuite/gdc.dg/torture/pr113758.d new file mode 100644 index 0000000..dc53883 --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/pr113758.d @@ -0,0 +1,19 @@ +// { dg-do run } +// { dg-skip-if "needs gcc/config.d" { ! d_runtime } } +struct S113758 +{ + int field; + ~this() { field = 0; } +} + +void main() +{ + auto var = S113758(1); + f113758d(var); + assert(var.field == 1); + f113758cxx(var); + assert(var.field == 1); +} + +extern (D) void f113758d(S113758 arg) { } +extern (C++) void f113758cxx(S113758 arg) { } diff --git a/gcc/testsuite/gdc.test/compilable/commontype.d b/gcc/testsuite/gdc.test/compilable/commontype.d index a980ace..c12506f 100644 --- a/gcc/testsuite/gdc.test/compilable/commontype.d +++ b/gcc/testsuite/gdc.test/compilable/commontype.d @@ -413,12 +413,12 @@ static assert(is( X!( C, immutable(B) ) == const(B) )); static assert(is( X!( C, immutable(D) ) == const(B) )); static assert(is( X!( C, immutable(K) ) == const(Object) )); -static assert(Error!( C, immutable(SC) )); // should work -static assert(Error!( C, immutable(SI) )); // should work -static assert(Error!( immutable(SI), C )); // should work -static assert(Error!( C, immutable(SB) )); // should work -static assert(Error!( C, immutable(SD) )); // should work -static assert(Error!( C, immutable(SK) )); // should work +static assert(is( X!( C, immutable(SC)) == const(B) )); +static assert(is( X!( C, immutable(SI) ) == const(I) )); +static assert(is( X!( immutable(SI), C ) == const(I) )); +static assert(is( X!( C, immutable(SB) ) == const(Object) )); +static assert(is( X!( C, immutable(SD) ) == const(B) )); +static assert(is( X!( C, immutable(SK) ) == const(Object) )); static assert(is( X!( const(C), C ) == const(C) )); static assert(is( X!( const(C), I ) == const(I) )); @@ -427,11 +427,11 @@ static assert(is( X!( const(C), D ) == const(B) )); static assert(is( X!( const(C), K ) == const(Object) )); static assert(is( X!( const(C), SC ) == const(C))); -static assert(Error!( const(C), SI )); // should work -static assert(is( X!( const(SI), const(C) ) == const(I) )); // should work -static assert(is( X!( const(C), SB ) == const(B))); +static assert(is( X!( const(C), SI ) == const(I))); +static assert(is( X!( const(SI), const(C) ) == const(I) )); +static assert(is( X!( const(C), SB ) == const(Object))); static assert(is( X!( const(C), SD ) == const(B))); -static assert(is( X!( const(C), SK ) == Object)); // `const` +static assert(is( X!( const(C), SK ) == const(Object))); static assert(is( X!( SiC, SC ) == const(C) )); diff --git a/gcc/testsuite/gdc.test/compilable/test3543.d b/gcc/testsuite/gdc.test/compilable/test3543.d new file mode 100644 index 0000000..9a72ca9 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test3543.d @@ -0,0 +1,80 @@ + +// https://issues.dlang.org/show_bug.cgi?id=3543 + +// merge with commontype.d? + +void testi(bool bla) +{ + interface Root { } + interface A : Root { } + interface B : Root { } + A a; + B b; + Root r = bla ? a : b; + static assert(is(typeof(r) == Root)); + Root[] t = [a, b]; + static assert(is(typeof(t[0]) == Root)); +} + +void testc(bool bla) +{ + class Root { } + class A : Root { } + class B : Root { } + A a; + B b; + Root r = bla ? a : b; + static assert(is(typeof(r) == Root)); + Root[] t = [a, b]; + static assert(is(typeof(t[0]) == Root)); +} + +void teste(bool bla) +{ + interface Root { } + interface Othe { } + interface A : Root, Othe { } + interface B : Root, Othe { } + A a; + B b; + static assert(!__traits(compiles, bla ? a : b)); +} + +void testf(bool bla) +{ + interface Othe { } + interface Root : Othe { } + interface A : Root { } + interface B : Othe { } + A a; + B b; + Othe r = bla ? a : b; +} + +void testg() +{ + interface A{} + interface B{} + + interface C:A{} + interface D:B,C{} + + interface E:B{} + interface F:A,E{} + + D d; + F f; + static assert(!__traits(compiles, true ? d : f)); + static assert(!__traits(compiles, true ? f : d)); +} + +void testh() +{ + interface I {} + class B {} + class C : B, I {} + class D : B {} + C c; + D d; + auto b = true ? c : d; +} diff --git a/gcc/testsuite/gdc.test/runnable/mangle.d b/gcc/testsuite/gdc.test/runnable/mangle.d index 6e8f2b2..53d7648 100644 --- a/gcc/testsuite/gdc.test/runnable/mangle.d +++ b/gcc/testsuite/gdc.test/runnable/mangle.d @@ -1,6 +1,7 @@ // PERMUTE_ARGS: // EXTRA_SOURCES: imports/mangle10077.d // EXTRA_FILES: imports/testmangle.d +// UNICODE_NAMES: /* TEST_OUTPUT: --- diff --git a/gcc/testsuite/gdc.test/runnable/testmodule.d b/gcc/testsuite/gdc.test/runnable/testmodule.d index 45da7d1..4e1068c 100644 --- a/gcc/testsuite/gdc.test/runnable/testmodule.d +++ b/gcc/testsuite/gdc.test/runnable/testmodule.d @@ -1,4 +1,5 @@ // PERMUTE_ARGS: +// UNICODE_NAMES: // $HeadURL$ // $Date$ @@ -11,6 +12,7 @@ module run.unicode_06_哪里; +//UTF-8 chars int 哪里(int ö){ return ö+2; } diff --git a/gcc/testsuite/gdc.test/runnable/ufcs.d b/gcc/testsuite/gdc.test/runnable/ufcs.d index 8fd7bb2..6328a5b 100644 --- a/gcc/testsuite/gdc.test/runnable/ufcs.d +++ b/gcc/testsuite/gdc.test/runnable/ufcs.d @@ -1,4 +1,5 @@ // EXTRA_SOURCES: imports/ufcs5a.d imports/ufcs5b.d imports/ufcs5c.d imports/ufcs5d.d imports/ufcs5e.d +// UNICODE_NAMES: module ufcs; @@ -677,6 +678,7 @@ void test8453() /*******************************************/ // https://issues.dlang.org/show_bug.cgi?id=8503 +//UTF-8 chars void α8503(int i) {} void test8503() diff --git a/gcc/testsuite/gfortran.dg/allocatable_length.f90 b/gcc/testsuite/gfortran.dg/allocatable_length.f90 new file mode 100644 index 0000000..e8b638f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocatable_length.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! { dg-options "-Werror -Wall" } +module foo + contains + subroutine bar + character(len=:), allocatable :: s(:) + call bah(s) + end subroutine bar +end module foo diff --git a/gcc/testsuite/gfortran.dg/arithmetic_overflow_2.f90 b/gcc/testsuite/gfortran.dg/arithmetic_overflow_2.f90 new file mode 100644 index 0000000..6ca27f7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/arithmetic_overflow_2.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-additional-options "-frange-check" } +! +! PR fortran/113799 - handle arithmetic overflow on unary minus + +program p + implicit none + real, parameter :: inf = real(z'7F800000') + real, parameter :: someInf(*) = [inf, 0.] + print *, -someInf ! { dg-error "Arithmetic overflow" } + print *, minval(-someInf) ! { dg-error "Arithmetic overflow" } +end diff --git a/gcc/testsuite/gfortran.dg/bind_c_optional-2.f90 b/gcc/testsuite/gfortran.dg/bind_c_optional-2.f90 new file mode 100644 index 0000000..ceedef7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bind_c_optional-2.f90 @@ -0,0 +1,105 @@ +! { dg-do run } +! PR fortran/113866 +! +! Check interoperability of assumed-length character (optional and +! non-optional) dummies between bind(c) and non-bind(c) procedures + +module bindcchar + implicit none + integer, parameter :: n = 100, l = 10 +contains + subroutine bindc_optional (c2, c4) bind(c) + character(*), optional :: c2, c4(n) +! print *, c2(1:3) +! print *, c4(5)(1:3) + if (.not. present (c2) .or. .not. present (c4)) stop 8 + if (len (c2) /= l .or. len (c4) /= l) stop 81 + if (c2(1:3) /= "a23") stop 1 + if (c4(5)(1:3) /= "bcd") stop 2 + end + + subroutine bindc (c2, c4) bind(c) + character(*) :: c2, c4(n) + if (len (c2) /= l .or. len (c4) /= l) stop 82 + if (c2(1:3) /= "a23") stop 3 + if (c4(5)(1:3) /= "bcd") stop 4 + call bindc_optional (c2, c4) + end + + subroutine not_bindc_optional (c1, c3) + character(*), optional :: c1, c3(n) + if (.not. present (c1) .or. .not. present (c3)) stop 5 + if (len (c1) /= l .or. len (c3) /= l) stop 83 + call bindc_optional (c1, c3) + call bindc (c1, c3) + end + + subroutine not_bindc_optional_deferred (c5, c6) + character(:), allocatable, optional :: c5, c6(:) + if (.not. present (c5) .or. .not. present (c6)) stop 6 + if (len (c5) /= l .or. len (c6) /= l) stop 84 + call not_bindc_optional (c5, c6) + call bindc_optional (c5, c6) + call bindc (c5, c6) + end + + subroutine not_bindc_optional2 (c7, c8) + character(*), optional :: c7, c8(:) + if (.not. present (c7) .or. .not. present (c8)) stop 7 + if (len (c7) /= l .or. len (c8) /= l) stop 85 + call bindc_optional (c7, c8) + call bindc (c7, c8) + end + + subroutine bindc_optional2 (c2, c4) bind(c) + character(*), optional :: c2, c4(n) + if (.not. present (c2) .or. .not. present (c4)) stop 8 + if (len (c2) /= l .or. len (c4) /= l) stop 86 + if (c2(1:3) /= "a23") stop 9 + if (c4(5)(1:3) /= "bcd") stop 10 + call bindc_optional (c2, c4) + call not_bindc_optional (c2, c4) + end + + subroutine bindc_optional_missing (c1, c2, c3, c4, c5) bind(c) + character(*), optional :: c1, c2(n), c3(:), c4(..), c5(*) + if (present (c1)) stop 11 + if (present (c2)) stop 12 + if (present (c3)) stop 13 + if (present (c4)) stop 14 + if (present (c5)) stop 15 + end + + subroutine non_bindc_optional_missing (c1, c2, c3, c4, c5) + character(*), optional :: c1, c2(n), c3(:), c4(..), c5(*) + if (present (c1)) stop 21 + if (present (c2)) stop 22 + if (present (c3)) stop 23 + if (present (c4)) stop 24 + if (present (c5)) stop 25 + end +end module + +program p + use bindcchar + implicit none + character(l) :: a, b(n) + character(:), allocatable :: d, e(:) + a = 'a234567890' + b = 'bcdefghijk' + call not_bindc_optional (a, b) + call bindc_optional (a, b) + call not_bindc_optional2 (a, b) + call bindc_optional2 (a, b) + allocate (d, source=a) + allocate (e, source=b) + call not_bindc_optional (d, e) + call bindc_optional (d, e) + call not_bindc_optional2 (d, e) + call bindc_optional2 (d, e) + ! following test disabled due to pr113911 +! call not_bindc_optional_deferred (d, e) + deallocate (d, e) + call non_bindc_optional_missing () + call bindc_optional_missing () +end diff --git a/gcc/testsuite/gfortran.dg/fmt_en.f90 b/gcc/testsuite/gfortran.dg/fmt_en.f90 index d7e51b3..0b757e9 100644 --- a/gcc/testsuite/gfortran.dg/fmt_en.f90 +++ b/gcc/testsuite/gfortran.dg/fmt_en.f90 @@ -180,4 +180,4 @@ contains end subroutine end program -! { dg-output "All kinds rounded to nearest" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } } +! { dg-output "All kinds rounded to nearest" { xfail hppa*-*-hpux* } } diff --git a/gcc/testsuite/gfortran.dg/fmt_en_rd.f90 b/gcc/testsuite/gfortran.dg/fmt_en_rd.f90 index ea914e0..e1228e6 100644 --- a/gcc/testsuite/gfortran.dg/fmt_en_rd.f90 +++ b/gcc/testsuite/gfortran.dg/fmt_en_rd.f90 @@ -181,5 +181,5 @@ contains end subroutine end program -! { dg-output "All kinds rounded down" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } } +! { dg-output "All kinds rounded down" { xfail hppa*-*-hpux* } } ! { dg-final { cleanup-saved-temps } } diff --git a/gcc/testsuite/gfortran.dg/fmt_en_rn.f90 b/gcc/testsuite/gfortran.dg/fmt_en_rn.f90 index b0ada5c..71d3ef6 100644 --- a/gcc/testsuite/gfortran.dg/fmt_en_rn.f90 +++ b/gcc/testsuite/gfortran.dg/fmt_en_rn.f90 @@ -181,5 +181,5 @@ contains end subroutine end program -! { dg-output "All kinds rounded to nearest" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } } +! { dg-output "All kinds rounded to nearest" { xfail hppa*-*-hpux* } } ! { dg-final { cleanup-saved-temps } } diff --git a/gcc/testsuite/gfortran.dg/fmt_en_ru.f90 b/gcc/testsuite/gfortran.dg/fmt_en_ru.f90 index 7834e28..e9e2785 100644 --- a/gcc/testsuite/gfortran.dg/fmt_en_ru.f90 +++ b/gcc/testsuite/gfortran.dg/fmt_en_ru.f90 @@ -181,5 +181,5 @@ contains end subroutine end program -! { dg-output "All kinds rounded up" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } } +! { dg-output "All kinds rounded up" { xfail hppa*-*-hpux* } } ! { dg-final { cleanup-saved-temps } } diff --git a/gcc/testsuite/gfortran.dg/fmt_en_rz.f90 b/gcc/testsuite/gfortran.dg/fmt_en_rz.f90 index c07847c..7e4db5d 100644 --- a/gcc/testsuite/gfortran.dg/fmt_en_rz.f90 +++ b/gcc/testsuite/gfortran.dg/fmt_en_rz.f90 @@ -181,5 +181,5 @@ contains end subroutine end program -! { dg-output "All kinds rounded to zero" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } } +! { dg-output "All kinds rounded to zero" { xfail hppa*-*-hpux* } } ! { dg-final { cleanup-saved-temps } } diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-1.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-1.f90 index 50d7e41..9b68397 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-1.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-1.f90 @@ -20,11 +20,11 @@ module main !$omp & match (construct={parallel,do}, & !$omp & device={isa(avx512f,avx512vl),kind(host,cpu)}, & !$omp & implementation={vendor(score(0):gnu),unified_shared_memory}, & - !$omp & user={condition(score(0):0)}) + !$omp & user={condition(score(0):.false.)}) !$omp declare variant (bar) & !$omp & match (device={arch(x86_64,powerpc64),isa(avx512f,popcntb)}, & !$omp & implementation={atomic_default_mem_order(seq_cst),made_up_selector("foo", 13, "bar")}, & - !$omp & user={condition(3-3)}) + !$omp & user={condition(.true. .AND. (.not. .true.))}) ! { dg-warning "unknown selector 'made_up_selector'" "" { target *-*-* } .-2 } end function diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-11.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-11.f90 index 3593c9a..15b6901a 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-11.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-11.f90 @@ -49,8 +49,8 @@ contains subroutine f13 () !$omp declare variant (f10) match (device={isa("avx512f")}) - !$omp declare variant (f11) match (user={condition(1)},device={isa(avx512f)},implementation={vendor(gnu)}) - !$omp declare variant (f12) match (user={condition(2 + 1)},device={isa(avx512f)}) + !$omp declare variant (f11) match (user={condition(.true.)},device={isa(avx512f)},implementation={vendor(gnu)}) + !$omp declare variant (f12) match (user={condition(.true. .NEQV. .false.)},device={isa(avx512f)}) end subroutine subroutine f14 () diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-12.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-12.f90 index 2fd8abd..f1b4a22 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-12.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-12.f90 @@ -17,7 +17,7 @@ contains subroutine f04 () !$omp declare variant (f01) match (device={isa("avx512f","avx512vl")}) ! 16 !$omp declare variant (f02) match (implementation={vendor(score(15):gnu)}) - !$omp declare variant (f03) match (user={condition(score(11):1)}) + !$omp declare variant (f03) match (user={condition(score(11):.true.)}) end subroutine subroutine f05 () @@ -32,7 +32,7 @@ contains subroutine f08 () !$omp declare variant (f05) match (device={isa(avx512f,avx512vl)}) ! 16 !$omp declare variant (f06) match (implementation={vendor(score(15):gnu)}) - !$omp declare variant (f07) match (user={condition(score(17):1)}) + !$omp declare variant (f07) match (user={condition(score(17):.true.)}) end subroutine subroutine f09 () @@ -48,7 +48,7 @@ contains end subroutine subroutine f13 () - !$omp declare variant (f09) match (device={arch(x86_64)},user={condition(score(65):1)}) ! 64+65 + !$omp declare variant (f09) match (device={arch(x86_64)},user={condition(score(65):.true.)}) ! 64+65 !$omp declare variant (f10) match (implementation={vendor(score(127):"gnu")}) !$omp declare variant (f11) match (device={isa(ssse3)}) ! 128 !$omp declare variant (f12) match (implementation={atomic_default_mem_order(score(126):seq_cst)}) @@ -65,7 +65,7 @@ contains subroutine f17 () !$omp declare variant (f14) match (construct={teams,parallel,do}) ! 16+8+4 - !$omp declare variant (f15) match (construct={parallel},user={condition(score(19):1)}) ! 8+19 + !$omp declare variant (f15) match (construct={parallel},user={condition(score(19):.true.)}) ! 8+19 !$omp declare variant (f16) match (implementation={atomic_default_mem_order(score(27):seq_cst)}) end subroutine @@ -80,7 +80,7 @@ contains subroutine f21 () !$omp declare variant (f18) match (construct={teams,parallel,do}) ! 16+8+4 - !$omp declare variant (f19) match (construct={do},user={condition(score(25):1)}) ! 4+25 + !$omp declare variant (f19) match (construct={do},user={condition(score(25):.true.)}) ! 4+25 !$omp declare variant (f20) match (implementation={atomic_default_mem_order(score(28):seq_cst)}) end subroutine @@ -110,7 +110,7 @@ contains subroutine f29 () !$omp declare variant (f26) match (construct={parallel,do}) ! 2+1 - !$omp declare variant (f27) match (construct={do},user={condition(1)}) ! 4 + !$omp declare variant (f27) match (construct={do},user={condition(.true.)}) ! 4 !$omp declare variant (f28) match (implementation={atomic_default_mem_order(score(3):seq_cst)}) end subroutine diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-13.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-13.f90 index 91648f9..97484a6 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-13.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-13.f90 @@ -30,7 +30,7 @@ contains !$omp declare variant (f01) match (device={isa("avx512f")}) ! 4 or 8 !$omp declare variant (f02) match (implementation={vendor(score(3):gnu)},device={kind(cpu)}) ! (1 or 2) + 3 - !$omp declare variant (f03) match (user={condition(score(9):1)}) + !$omp declare variant (f03) match (user={condition(score(9):.true.)}) !$omp declare variant (f04) match (implementation={vendor(score(6):gnu)},device={kind(host)}) ! (1 or 2) + 6 f05 = x end function diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-2.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-2.f90 index cbb29f8..7fc5071 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-2.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-2.f90 @@ -15,7 +15,7 @@ contains !$omp declare variant () ! { dg-error "" } end subroutine subroutine f5 () - !$omp declare variant match(user={condition(0)}) ! { dg-error "expected '\\(' at .1." } + !$omp declare variant match(user={condition(.false.)}) ! { dg-error "expected '\\(' at .1." } end subroutine subroutine f6 () !$omp declare variant (f1) ! { dg-error "expected 'match' at .1." } @@ -66,7 +66,7 @@ contains !$omp declare variant (f1) match(user={condition(f1)}) ! { dg-error "expected expression at .1." } end subroutine subroutine f22 () - !$omp declare variant (f1) match(user={condition(1, 2, 3)}) ! { dg-error "expected '\\)' at .1." } + !$omp declare variant (f1) match(user={condition(.false., .true., .false.)}) ! { dg-error "expected '\\)' at .1." } end subroutine subroutine f23 () !$omp declare variant (f1) match(construct={master}) ! { dg-warning "unknown selector 'master' for context selector set 'construct'" } @@ -189,9 +189,9 @@ contains !$omp declare variant (f1) match(implementation={atomic_default_mem_order("relaxed")}) ! { dg-error "expected identifier at .1." } end subroutine subroutine f77 () - !$omp declare variant (f1) match(user={condition(score(f76):1)}) ! { dg-error ".score. argument must be constant integer expression at .1." } + !$omp declare variant (f1) match(user={condition(score(f76):.true.)}) ! { dg-error ".score. argument must be constant integer expression at .1." } end subroutine subroutine f78 () - !$omp declare variant (f1) match(user={condition(score(-130):1)}) ! { dg-error ".score. argument must be non-negative" } + !$omp declare variant (f1) match(user={condition(score(-130):.true.)}) ! { dg-error ".score. argument must be non-negative" } end subroutine end module diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-20.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-20.f90 new file mode 100644 index 0000000..17fdcb7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-20.f90 @@ -0,0 +1,51 @@ +! PR middle-end/113904 + +module m + implicit none (type, external) + logical, parameter :: parameter_true = .false. + logical :: false_flag = .false. + integer :: my_dev_num +contains + integer function variant1() result(res) + res = 1 + end function + + integer function variant2() result(res) + res = 2 + end function + + integer function variant3() result(res) + res = 3 + end function + + integer function variant4() result(res) + res = 4 + end function + + integer function variant5() result(res) + res = 4 + end function + + integer function variant6() result(res) + res = 4 + end function + + integer function foo() result(res) + ! 'condition' + !$omp declare variant(variant1) match(user={condition(parameter_true)},construct={teams}) ! OK + ! Below: OK since OpenMP 5.1 - but not yet supported: PR middle-end/113904 + !$omp declare variant(variant2) match(user={condition(false_flag)},construct={parallel}) ! { dg-error "property must be a constant logical expression" } + !$omp declare variant(variant3) match(user={condition(1)},construct={target}) ! { dg-error "property must be a constant logical expression" } + + ! 'device_num' + !$omp declare variant(variant4) match(target_device={device_num(0)}) ! OK + !$omp declare variant(variant4) match(target_device={device_num(2)}) ! OK - assuming there are two non-host devices. + !$omp declare variant(variant5) match(target_device={device_num(-1)}) ! OK - omp_initial_device + !$omp declare variant(variant5) match(target_device={device_num(-4)}) ! OK - omp_invalid_device (will never match) + ! OK - but not handled -> PR middle-end/113904 + !$omp declare variant(variant5) match(target_device={device_num(my_device)}) ! { dg-error "property must be a constant integer expression" } + !$omp declare variant(variant5) match(target_device={device_num(-2)}) ! { dg-error "property must be a conforming device number" } + + res = 99 + end +end module m diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-2a.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-2a.f90 index edc9b27..b44322a 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-2a.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-2a.f90 @@ -10,10 +10,10 @@ contains !$omp declare variant (f1) match(construct={parallel},construct={parallel}) ! { dg-error "selector set 'construct' specified more than once" } end subroutine subroutine f30 () - !$omp declare variant (f1) match(user={condition(0)},construct={target},user={condition(0)}) ! { dg-error "selector set 'user' specified more than once" } + !$omp declare variant (f1) match(user={condition(.false.)},construct={target},user={condition(.false.)}) ! { dg-error "selector set 'user' specified more than once" } end subroutine subroutine f31 () - !$omp declare variant (f1) match(user={condition(0)},user={condition(1)}) ! { dg-error "selector set 'user' specified more than once" } + !$omp declare variant (f1) match(user={condition(.false.)},user={condition(.true.)}) ! { dg-error "selector set 'user' specified more than once" } end subroutine subroutine f37 () !$omp declare variant (f1) match(device={kind(unknown)}) ! { dg-warning "unknown property 'unknown' of 'kind' selector" } diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-3.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-3.f90 index c62622b..6b23d40 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-3.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-3.f90 @@ -210,13 +210,13 @@ contains !$omp& vendor(score(22):gnu),unified_address,extension(score(22):foobar)}) ! { dg-warning "unknown property 'foobar' of 'extension' selector" "" { target *-*-* } .-1 } end subroutine subroutine f72 () - !$omp declare variant (f13) match (user={condition(0)}) + !$omp declare variant (f13) match (user={condition(.false.)}) end subroutine subroutine f73 () - !$omp declare variant (f13) match (user={condition(272-272*1)}) + !$omp declare variant (f13) match (user={condition(.true..and..not..true.)}) end subroutine subroutine f74 () - !$omp declare variant (f13) match (user={condition(score(25):1)}) + !$omp declare variant (f13) match (user={condition(score(25):.true.)}) end subroutine subroutine f75 () !$omp declare variant (f13) match (device={kind(any,"any")}) @@ -231,7 +231,7 @@ contains !$omp declare variant (f13) match (implementation={vendor(nvidia)}) end subroutine subroutine f79 () - !$omp declare variant (f13) match (user={condition(score(0):0)}) + !$omp declare variant (f13) match (user={condition(score(0):.false.)}) end subroutine end module diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-4.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-4.f90 index bc4f416..5c7fee2 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-4.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-4.f90 @@ -44,10 +44,10 @@ contains end function end interface - !$omp declare variant (f1) match (user={condition(1)}) - !$omp declare variant (f2) match (user={condition(score(1):1)}) - !$omp declare variant (f3) match (user={condition(score(3):1)}) - !$omp declare variant (f4) match (user={condition(score(2):1)}) + !$omp declare variant (f1) match (user={condition(.true.)}) + !$omp declare variant (f2) match (user={condition(score(1):.true.)}) + !$omp declare variant (f3) match (user={condition(score(3):.true.)}) + !$omp declare variant (f4) match (user={condition(score(2):.true.)}) !$omp declare variant (f5) match (implementation={vendor(gnu)}) f6 = z + x + y diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-6.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-6.f90 index 3f33f38..63a8bd8 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-6.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-6.f90 @@ -24,7 +24,7 @@ contains integer, intent(in) :: x integer (kind = 8), intent(in) :: y real :: z - !$omp declare variant (f1) match (user={condition(0)},construct={parallel}) + !$omp declare variant (f1) match (user={condition(.false.)},construct={parallel}) f3 = 0.0 end function @@ -33,7 +33,7 @@ contains integer, intent(in) :: x integer (kind = 8), intent(in) :: y real :: z - !$omp declare variant (f1) match (construct={parallel},user={condition(score(1):1)}) + !$omp declare variant (f1) match (construct={parallel},user={condition(score(1):.true.)}) f4 = 0.0 end function @@ -50,7 +50,7 @@ contains integer, intent(in) :: x integer (kind = 8), intent(in) :: y real :: z - !$omp declare variant (f5) match (user={condition(0)}) ! { dg-error "'f5' used as a variant with incompatible 'construct' selector sets" } + !$omp declare variant (f5) match (user={condition(.false.)}) ! { dg-error "'f5' used as a variant with incompatible 'construct' selector sets" } f6 = 0.0 end function @@ -59,7 +59,7 @@ contains integer, intent(in) :: x integer (kind = 8), intent(in) :: y real :: z - !$omp declare variant (f5) match (construct={parallel},user={condition(score(1):1)}) + !$omp declare variant (f5) match (construct={parallel},user={condition(score(1):.true.)}) f7 = 0.0 end function @@ -76,7 +76,7 @@ contains integer, intent(in) :: x integer (kind = 8), intent(in) :: y real :: z - !$omp declare variant (f8) match (user={condition(0)},construct={do}) ! { dg-error "'f8' used as a variant with incompatible 'construct' selector sets" } + !$omp declare variant (f8) match (user={condition(.false.)},construct={do}) ! { dg-error "'f8' used as a variant with incompatible 'construct' selector sets" } f9 = 0.0 end function @@ -85,7 +85,7 @@ contains integer, intent(in) :: x integer (kind = 8), intent(in) :: y real :: z - !$omp declare variant (f8) match (user={condition(1)}) + !$omp declare variant (f8) match (user={condition(.true.)}) f10 = 0.0 end function @@ -111,7 +111,7 @@ contains integer, intent(in) :: x integer (kind = 8), intent(in) :: y real :: z - !$omp declare variant (f11) match (user={condition(score(1):1)},construct={target,teams,parallel,do}) ! { dg-error "'f11' used as a variant with incompatible 'construct' selector sets" } + !$omp declare variant (f11) match (user={condition(score(1):.true.)},construct={target,teams,parallel,do}) ! { dg-error "'f11' used as a variant with incompatible 'construct' selector sets" } f13 = 0.0 end function diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90 index c751489..d69e552 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90 @@ -23,7 +23,7 @@ contains end subroutine subroutine f06 () - !$omp declare variant (f05) match (user={condition(1)},implementation={atomic_default_mem_order(relaxed)}) + !$omp declare variant (f05) match (user={condition(.true.)},implementation={atomic_default_mem_order(relaxed)}) end subroutine subroutine f07 () diff --git a/gcc/testsuite/gfortran.dg/pr105847.f90 b/gcc/testsuite/gfortran.dg/pr105847.f90 new file mode 100644 index 0000000..9a89d39 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr105847.f90 @@ -0,0 +1,39 @@ +! { dg-do run } +module m + integer :: name_in_module = 123 +end module + +program foo + + use m, name_in_program => name_in_module + namelist /nl/ name_in_program + + if (name_in_program /= 123) stop 1 + + open(unit=10, file='fort.10', status='replace') + write(10,nl) + close(10) + + name_in_program = 42 + if (name_in_program /= 42) stop 2 + + open(unit=10, file='fort.10', status='old') + read(10,nl) + if (name_in_program /= 123) stop 3 + close(10) + + call bar + + contains + + subroutine bar + integer name_in_program + namelist /nl/ name_in_program + name_in_program = 0 + open(unit=10, file='fort.10', status='old') + read(10,nl) + if (name_in_program /= 123) stop 4 + close(10,status='delete') + end subroutine bar + +end diff --git a/gcc/testsuite/gfortran.dg/pr109358.f90 b/gcc/testsuite/gfortran.dg/pr109358.f90 new file mode 100644 index 0000000..5013984 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr109358.f90 @@ -0,0 +1,14 @@ +! { dg-do run } +! PR109358, test that tabs during stream io are correct. +program tabs + implicit none + integer :: fd + character(64) :: line + open(newunit=fd, file="otabs.txt", form="formatted", access="stream") + write(fd, "(i4, t40, i4, t20, i5.5)") 1234, 5555, 67890 + close(fd) + open(newunit=fd, file="otabs.txt", form="formatted") + read(fd,"(a)") line + close(fd, status='delete') + if (line .ne. "1234 67890 5555") stop 10 +end program tabs diff --git a/gcc/testsuite/gfortran.dg/pr99210.f90 b/gcc/testsuite/gfortran.dg/pr99210.f90 new file mode 100644 index 0000000..9fd2fb4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99210.f90 @@ -0,0 +1,29 @@ +! { dg-do run } +! PR99210 X editing for reading file with encoding='utf-8' +program test_bug_format_x + use iso_fortran_env + integer, parameter :: u = selected_char_kind('ISO_10646') + + character(kind=u, len=1) a, b, a1, b1, b2 + + open(unit=10, file='test_bug_format_x.tmp', encoding='UTF-8') + + a = char(int(z'03B1'), u) + b = char(int(z'03B2'), u) + write(10, '(a1, a1)') a, b + + rewind(10) + read(10, '(a1, a1)') a1, b1 + + rewind(10) + read(10, '(1x, a1)') b2 + + close (10, status="delete") + if(a /= a1 .or. b /= b1) then + error stop 1 + end if + + if(b /= b2) then + error stop 2 + end if +end program test_bug_format_x diff --git a/gcc/testsuite/gfortran.dg/vect/vect-early-break_1-pr113808.f90 b/gcc/testsuite/gfortran.dg/vect/vect-early-break_1-pr113808.f90 new file mode 100644 index 0000000..6f92e90 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/vect-early-break_1-pr113808.f90 @@ -0,0 +1,21 @@ +! { dg-add-options vect_early_break } +! { dg-require-effective-target vect_early_break } +! { dg-require-effective-target vect_long_long } +! { dg-additional-options "-fopenmp-simd" } + +! { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } + +program main + integer :: n, i,k + n = 11 + do i = 1, n,2 + !$omp simd + do k = 1, i + 41 + if (k > 11 + 41 .or. k < 1) error stop + end do + end do + if (k /= 53) then + print *, k, 53 + error stop + endif +end diff --git a/gcc/testsuite/gnat.dg/div_zero.adb b/gcc/testsuite/gnat.dg/div_zero.adb index dedf392..fb1c98c 100644 --- a/gcc/testsuite/gnat.dg/div_zero.adb +++ b/gcc/testsuite/gnat.dg/div_zero.adb @@ -1,5 +1,5 @@ -- { dg-do run } --- { dg-skip-if "divide does not trap" { aarch64*-*-* powerpc*-*-* } } +-- { dg-skip-if "divide does not trap" { aarch64*-*-* powerpc*-*-* riscv*-*-* } } -- This test requires architecture- and OS-specific support code for unwinding -- through signal frames (typically located in *-unwind.h) to pass. Feel free diff --git a/gcc/testsuite/lib/gdc-utils.exp b/gcc/testsuite/lib/gdc-utils.exp index 8c7efff..6600ef8 100644 --- a/gcc/testsuite/lib/gdc-utils.exp +++ b/gcc/testsuite/lib/gdc-utils.exp @@ -244,6 +244,7 @@ proc gdc-copy-file { srcdir filename } { # POST_SCRIPT: Not handled. # REQUIRED_ARGS: Arguments to add to the compiler command line. # DISABLED: Not handled. +# UNICODE_NAMES: Requires ucn support. # proc gdc-convert-test { base test } { @@ -365,6 +366,10 @@ proc gdc-convert-test { base test } { # COMPILABLE_MATH_TEST annotates tests that import the std.math # module. Which will need skipping if not available on the target. set needs_phobos 1 + } elseif [regexp -- {UNICODE_NAMES} $copy_line] { + # Require ucn support. + puts $fdout "// { dg-require-effective-target ucn }" + } } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index b1faaf4..8171599 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5247,25 +5247,25 @@ proc add_options_for_aarch64_sve { flags } { # Return 1 if this is an ARM target supporting the FP16 alternative # format. Some multilibs may be incompatible with the options needed. Also -# set et_arm_neon_fp16_flags to the best options to add. +# set et_arm_fp16_alternative_flags to the best options to add. proc check_effective_target_arm_fp16_alternative_ok_nocache { } { if { [istarget *-*-vxworks7*] } { # Not supported by the target system. return 0 } - global et_arm_neon_fp16_flags - set et_arm_neon_fp16_flags "" + global et_arm_fp16_alternative_flags + set et_arm_fp16_alternative_flags "" if { [check_effective_target_arm32] } { foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16" "-mfpu=neon-fp16 -mfloat-abi=softfp"} { if { [check_no_compiler_messages_nocache \ arm_fp16_alternative_ok object { - #if !defined (__ARM_FP16_FORMAT_ALTERNATIVE) + #if !defined (__ARM_FP16_FORMAT_ALTERNATIVE) || ! (__ARM_FP & 2) #error __ARM_FP16_FORMAT_ALTERNATIVE not defined #endif } "$flags -mfp16-format=alternative"] } { - set et_arm_neon_fp16_flags "$flags -mfp16-format=alternative" + set et_arm_fp16_alternative_flags "$flags -mfp16-format=alternative" return 1 } } @@ -5404,11 +5404,11 @@ proc add_options_for_arm_fp16_ieee { flags } { # half-precision support. This is valid for ARM targets. proc add_options_for_arm_fp16_alternative { flags } { - if { ! [check_effective_target_arm_fp16_ok] } { + if { ! [check_effective_target_arm_fp16_alternative_ok] } { return "$flags" } - global et_arm_fp16_flags - return "$flags $et_arm_fp16_flags -mfp16-format=alternative" + global et_arm_fp16_alternative_flags + return "$flags $et_arm_fp16_alternative_flags" } # Return 1 if this is an ARM target that can support a VFP fp16 variant. @@ -13477,3 +13477,15 @@ proc dg-require-python-h { args } { eval lappend extra-tool-flags $python_flags verbose "After appending, extra-tool-flags: ${extra-tool-flags}" 3 } + +# Return 1 if the target supports heap-trampoline, 0 otherwise. +proc check_effective_target_heap_trampoline {} { + if { [istarget aarch64*-*-linux*] + || [istarget i?86-*-darwin*] + || [istarget x86_64-*-darwin*] + || [istarget i?86-*-linux*] + || [istarget x86_64-*-linux*] } { + return 1 + } + return 0 +} diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index cdd439f..bdffc3b 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -320,12 +320,9 @@ replace_loop_annotate (void) for (auto loop : loops_list (cfun, 0)) { - /* First look into the header. */ - replace_loop_annotate_in_block (loop->header, loop); - - /* Then look into the latch, if any. */ - if (loop->latch) - replace_loop_annotate_in_block (loop->latch, loop); + /* Check all exit source blocks for annotations. */ + for (auto e : get_loop_exit_edges (loop)) + replace_loop_annotate_in_block (e->src, loop); /* Push the global flag_finite_loops state down to individual loops. */ loop->finite_p = flag_finite_loops; diff --git a/gcc/tree-dfa.cc b/gcc/tree-dfa.cc index 2acd318..cbd3774 100644 --- a/gcc/tree-dfa.cc +++ b/gcc/tree-dfa.cc @@ -230,9 +230,10 @@ dump_dfa_stats (FILE *file) fprintf (file, "\n"); if (dfa_stats.num_phis) - fprintf (file, "Average number of arguments per PHI node: %.1f (max: %ld)\n", + fprintf (file, "Average number of arguments per PHI node: %.1f (max: " + HOST_SIZE_T_PRINT_DEC ")\n", (float) dfa_stats.num_phi_args / (float) dfa_stats.num_phis, - (long) dfa_stats.max_num_phi_args); + (fmt_size_t) dfa_stats.max_num_phi_args); fprintf (file, "\n"); } diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index 8e79362..db0d0f4 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -2909,6 +2909,29 @@ combine_blocks (class loop *loop, bool loop_versioned) edge e; edge_iterator ei; + /* Reset flow-sensitive info before predicating stmts or PHIs we + might fold. */ + bool *predicated = XNEWVEC (bool, orig_loop_num_nodes); + for (i = 0; i < orig_loop_num_nodes; i++) + { + bb = ifc_bbs[i]; + predicated[i] = is_predicated (bb); + if (predicated[i]) + { + for (auto gsi = gsi_start_phis (bb); + !gsi_end_p (gsi); gsi_next (&gsi)) + reset_flow_sensitive_info (gimple_phi_result (*gsi)); + for (auto gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple *stmt = gsi_stmt (gsi); + ssa_op_iter i; + tree op; + FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_DEF) + reset_flow_sensitive_info (op); + } + } + } + remove_conditions_and_labels (loop); insert_gimplified_predicates (loop); predicate_all_scalar_phis (loop, loop_versioned); @@ -2917,20 +2940,13 @@ combine_blocks (class loop *loop, bool loop_versioned) predicate_statements (loop); /* Merge basic blocks. */ - exit_bb = NULL; - bool *predicated = XNEWVEC (bool, orig_loop_num_nodes); + exit_bb = single_exit (loop)->src; + gcc_assert (exit_bb != loop->latch); for (i = 0; i < orig_loop_num_nodes; i++) { bb = ifc_bbs[i]; - predicated[i] = !is_true_predicate (bb_predicate (bb)); free_bb_predicate (bb); - if (bb_with_exit_edge_p (loop, bb)) - { - gcc_assert (exit_bb == NULL); - exit_bb = bb; - } } - gcc_assert (exit_bb != loop->latch); merge_target_bb = loop->header; @@ -3003,13 +3019,6 @@ combine_blocks (class loop *loop, bool loop_versioned) /* If this is the first load we arrive at update last_vdef so we handle stray PHIs correctly. */ last_vdef = gimple_vuse (stmt); - if (predicated[i]) - { - ssa_op_iter i; - tree op; - FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_DEF) - reset_flow_sensitive_info (op); - } } /* Update stmt list. */ diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc index 242b11b2..d12a4a9 100644 --- a/gcc/tree-into-ssa.cc +++ b/gcc/tree-into-ssa.cc @@ -1707,9 +1707,10 @@ debug_tree_ssa (void) static void htab_statistics (FILE *file, const hash_table<var_info_hasher> &htab) { - fprintf (file, "size %ld, %ld elements, %f collision/search ratio\n", - (long) htab.size (), - (long) htab.elements (), + fprintf (file, "size " HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC + " elements, %f collision/search ratio\n", + (fmt_size_t) htab.size (), + (fmt_size_t) htab.elements (), htab.collisions ()); } diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc index d8f4358..7326485 100644 --- a/gcc/tree-ssa-dom.cc +++ b/gcc/tree-ssa-dom.cc @@ -1482,9 +1482,10 @@ record_equivalences_from_incoming_edge (basic_block bb, static void htab_statistics (FILE *file, const hash_table<expr_elt_hasher> &htab) { - fprintf (file, "size %ld, %ld elements, %f collision/search ratio\n", - (long) htab.size (), - (long) htab.elements (), + fprintf (file, "size " HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC + " elements, %f collision/search ratio\n", + (fmt_size_t) htab.size (), + (fmt_size_t) htab.elements (), htab.collisions ()); } diff --git a/gcc/tree-ssa-loop-split.cc b/gcc/tree-ssa-loop-split.cc index 04215fe..c0bb1b7 100644 --- a/gcc/tree-ssa-loop-split.cc +++ b/gcc/tree-ssa-loop-split.cc @@ -712,7 +712,8 @@ split_loop (class loop *loop1) ? true_edge->probability.to_sreal () : (sreal)1; sreal scale2 = false_edge->probability.reliable_p () ? false_edge->probability.to_sreal () : (sreal)1; - sreal div1 = loop1_prob.to_sreal (); + sreal div1 = loop1_prob.initialized_p () + ? loop1_prob.to_sreal () : (sreal)1/(sreal)2; /* +1 to get header interations rather than latch iterations and then -1 to convert back. */ if (div1 != 0) diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 8792cd0..d6b8c73 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -898,6 +898,8 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) { /* For non-calls, store the information that makes up the address. */ tree orig = ref; + unsigned start = result->length (); + bool seen_variable_array_ref = false; while (ref) { vn_reference_op_s temp; @@ -984,6 +986,12 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) tree eltype = TREE_TYPE (TREE_TYPE (TREE_OPERAND (ref, 0))); /* Record index as operand. */ temp.op0 = TREE_OPERAND (ref, 1); + /* When the index is not constant we have to apply the same + logic as get_ref_base_and_extent which eventually uses + global ranges to refine the overall ref extent. Record + we've seen such a case, fixup below. */ + if (TREE_CODE (temp.op0) == SSA_NAME) + seen_variable_array_ref = true; /* Always record lower bounds and element size. */ temp.op1 = array_ref_low_bound (ref); /* But record element size in units of the type alignment. */ @@ -1076,6 +1084,103 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) else ref = NULL_TREE; } + poly_int64 offset, size, max_size; + tree base; + bool rev; + if (seen_variable_array_ref + && handled_component_p (orig) + && (base = get_ref_base_and_extent (orig, + &offset, &size, &max_size, &rev)) + && known_size_p (max_size) + && known_eq (size, max_size)) + { + poly_int64 orig_offset = offset; + poly_int64 tem; + if (TREE_CODE (base) == MEM_REF + && mem_ref_offset (base).to_shwi (&tem)) + offset += tem * BITS_PER_UNIT; + HOST_WIDE_INT coffset = offset.to_constant (); + /* When get_ref_base_and_extent computes an offset constrained to + a constant position we have to fixup variable array indexes in + the ref to avoid the situation where based on context we'd have + to value-number the same vn_reference ops differently. Make + the vn_reference ops differ by adjusting those indexes to + appropriate constants. */ + poly_int64 off = 0; + for (unsigned i = result->length (); i > start; --i) + { + auto &op = (*result)[i-1]; + if ((op.opcode == ARRAY_REF + || op.opcode == ARRAY_RANGE_REF) + && TREE_CODE (op.op0) == SSA_NAME) + { + /* There's a single constant index that get's 'off' closer + to 'offset'. */ + unsigned HOST_WIDE_INT elsz + = tree_to_uhwi (op.op2) * vn_ref_op_align_unit (&op); + unsigned HOST_WIDE_INT idx + = (coffset - off.to_constant ()) / BITS_PER_UNIT / elsz; + if (idx == 0) + op.op0 = op.op1; + else + op.op0 = wide_int_to_tree (TREE_TYPE (op.op0), + wi::to_poly_wide (op.op1) + idx); + op.off = idx * elsz; + off += op.off * BITS_PER_UNIT; + } + else + { + if (op.opcode == ERROR_MARK) + /* two-ops codes have the offset in the first op. */ + ; + else if (op.opcode == ADDR_EXPR + || op.opcode == SSA_NAME + || op.opcode == CONSTRUCTOR + || TREE_CODE_CLASS (op.opcode) == tcc_declaration + || TREE_CODE_CLASS (op.opcode) == tcc_constant) + /* end-of ref. */ + gcc_assert (i == result->length ()); + else if (op.opcode == COMPONENT_REF) + { + /* op.off is tracked in bytes, re-do it manually + because of bitfields. */ + tree field = op.op0; + /* We do not have a complete COMPONENT_REF tree here so we + cannot use component_ref_field_offset. Do the interesting + parts manually. */ + tree this_offset = DECL_FIELD_OFFSET (field); + if (op.op1 || !poly_int_tree_p (this_offset)) + gcc_unreachable (); + else + { + poly_offset_int woffset + = (wi::to_poly_offset (this_offset) + << LOG2_BITS_PER_UNIT); + woffset += wi::to_offset (DECL_FIELD_BIT_OFFSET (field)); + off += woffset.force_shwi (); + } + } + else + { + gcc_assert (known_ne (op.off, -1)); + off += op.off * BITS_PER_UNIT; + } + } + } + if (flag_checking) + { + ao_ref r; + if (start != 0) + ; + else if (ao_ref_init_from_vn_reference (&r, 0, 0, TREE_TYPE (orig), + *result)) + gcc_assert (known_eq (r.offset, orig_offset) + && known_eq (r.size, size) + && known_eq (r.max_size, max_size)); + else + gcc_unreachable (); + } + } } /* Build a alias-oracle reference abstraction in *REF from the vn_reference @@ -1203,21 +1308,11 @@ ao_ref_init_from_vn_reference (ao_ref *ref, case ARRAY_RANGE_REF: case ARRAY_REF: - /* We recorded the lower bound and the element size. */ - if (!poly_int_tree_p (op->op0) - || !poly_int_tree_p (op->op1) - || TREE_CODE (op->op2) != INTEGER_CST) + /* Use the recorded constant offset. */ + if (maybe_eq (op->off, -1)) max_size = -1; else - { - poly_offset_int woffset - = wi::sext (wi::to_poly_offset (op->op0) - - wi::to_poly_offset (op->op1), - TYPE_PRECISION (sizetype)); - woffset *= wi::to_offset (op->op2) * vn_ref_op_align_unit (op); - woffset <<= LOG2_BITS_PER_UNIT; - offset += woffset; - } + offset += op->off << LOG2_BITS_PER_UNIT; break; case REALPART_EXPR: @@ -1724,7 +1819,8 @@ re_valueize: } /* If it transforms a non-constant ARRAY_REF into a constant one, adjust the constant offset. */ - else if (vro->opcode == ARRAY_REF + else if ((vro->opcode == ARRAY_REF + || vro->opcode == ARRAY_RANGE_REF) && known_eq (vro->off, -1) && poly_int_tree_p (vro->op0) && poly_int_tree_p (vro->op1) diff --git a/gcc/tree-ssa-tail-merge.cc b/gcc/tree-ssa-tail-merge.cc index f4e6ae6..c8b4a79 100644 --- a/gcc/tree-ssa-tail-merge.cc +++ b/gcc/tree-ssa-tail-merge.cc @@ -474,6 +474,9 @@ same_succ_hash (const same_succ *e) !gsi_end_p (gsi); gsi_next_nondebug (&gsi)) { stmt = gsi_stmt (gsi); + if (is_gimple_debug (stmt)) + continue; + stmt_update_dep_bb (stmt); if (stmt_local_def (stmt)) continue; diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index e1679632..c531079 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -772,11 +772,7 @@ vect_analyze_early_break_dependences (loop_vec_info loop_vinfo) the store. */ for (auto dr_read : bases) - /* Note we're not passing the DRs in stmt order here - since the DR dependence checking routine does not - envision we're moving stores down. The read-write - order tricks it to avoid applying TBAA. */ - if (dr_may_alias_p (dr_read, dr_ref, loop_nest)) + if (dr_may_alias_p (dr_ref, dr_read, loop_nest)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, @@ -816,6 +812,10 @@ vect_analyze_early_break_dependences (loop_vec_info loop_vinfo) break; } + /* If we possibly sink through a virtual PHI make sure to elide that. */ + if (gphi *vphi = get_virtual_phi (bb)) + LOOP_VINFO_EARLY_BRK_STORES (loop_vinfo).safe_push (vphi); + /* All earlier blocks need dependence checking. */ check_deps = true; bb = single_pred (bb); diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 190df9e..9e26b09 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -10950,7 +10950,7 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, did. For the live values we want the value at the start of the iteration rather than at the end. */ edge main_e = LOOP_VINFO_IV_EXIT (loop_vinfo); - bool restart_loop = LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo); + bool all_exits_as_early_p = LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo); FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs) if (!is_gimple_debug (use_stmt) && !flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) @@ -10966,8 +10966,7 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, /* For early exit where the exit is not in the BB that leads to the latch then we're restarting the iteration in the scalar loop. So get the first live value. */ - restart_loop = restart_loop || !main_exit_edge; - if (restart_loop + if ((all_exits_as_early_p || !main_exit_edge) && STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def) { tmp_vec_lhs = vec_lhs0; @@ -11788,8 +11787,29 @@ move_early_exit_stmts (loop_vec_info loop_vinfo) basic_block dest_bb = LOOP_VINFO_EARLY_BRK_DEST_BB (loop_vinfo); gimple_stmt_iterator dest_gsi = gsi_after_labels (dest_bb); + tree last_seen_vuse = NULL_TREE; for (gimple *stmt : LOOP_VINFO_EARLY_BRK_STORES (loop_vinfo)) { + /* We have to update crossed degenerate virtual PHIs. Simply + elide them. */ + if (gphi *vphi = dyn_cast <gphi *> (stmt)) + { + tree vdef = gimple_phi_result (vphi); + tree vuse = gimple_phi_arg_def (vphi, 0); + imm_use_iterator iter; + use_operand_p use_p; + gimple *use_stmt; + FOR_EACH_IMM_USE_STMT (use_stmt, iter, vdef) + { + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + SET_USE (use_p, vuse); + } + auto gsi = gsi_for_stmt (stmt); + remove_phi_node (&gsi, true); + last_seen_vuse = vuse; + continue; + } + /* Check to see if statement is still required for vect or has been elided. */ auto stmt_info = loop_vinfo->lookup_stmt (stmt); @@ -11801,17 +11821,17 @@ move_early_exit_stmts (loop_vec_info loop_vinfo) gimple_stmt_iterator stmt_gsi = gsi_for_stmt (stmt); gsi_move_before (&stmt_gsi, &dest_gsi, GSI_NEW_STMT); + last_seen_vuse = gimple_vuse (stmt); } /* Update all the stmts with their new reaching VUSES. */ - tree vuse - = gimple_vuse (LOOP_VINFO_EARLY_BRK_STORES (loop_vinfo).last ()); for (auto p : LOOP_VINFO_EARLY_BRK_VUSES (loop_vinfo)) { if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, - "updating vuse to %T for load %G", vuse, p); - gimple_set_vuse (p, vuse); + "updating vuse to %T for load %G", + last_seen_vuse, p); + gimple_set_vuse (p, last_seen_vuse); update_stmt (p); } @@ -11819,7 +11839,7 @@ move_early_exit_stmts (loop_vec_info loop_vinfo) for (edge e : get_loop_exit_edges (LOOP_VINFO_LOOP (loop_vinfo))) if (!dominated_by_p (CDI_DOMINATORS, e->src, dest_bb)) if (gphi *phi = get_virtual_phi (e->dest)) - SET_PHI_ARG_DEF_ON_EDGE (phi, e, vuse); + SET_PHI_ARG_DEF_ON_EDGE (phi, e, last_seen_vuse); } /* Function vect_transform_loop. @@ -12156,7 +12176,8 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) /* True if the final iteration might not handle a full vector's worth of scalar iterations. */ bool final_iter_may_be_partial - = LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo); + = LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) + || LOOP_VINFO_EARLY_BREAKS (loop_vinfo); /* The minimum number of iterations performed by the epilogue. This is 1 when peeling for gaps because we always need a final scalar iteration. */ diff --git a/gcc/tree.cc b/gcc/tree.cc index 3dff8c5..046a558 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -5882,9 +5882,10 @@ decl_fini_priority_insert (tree decl, priority_type priority) static void print_debug_expr_statistics (void) { - fprintf (stderr, "DECL_DEBUG_EXPR hash: size %ld, %ld elements, %f collisions\n", - (long) debug_expr_for_decl->size (), - (long) debug_expr_for_decl->elements (), + fprintf (stderr, "DECL_DEBUG_EXPR hash: size " HOST_SIZE_T_PRINT_DEC ", " + HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n", + (fmt_size_t) debug_expr_for_decl->size (), + (fmt_size_t) debug_expr_for_decl->elements (), debug_expr_for_decl->collisions ()); } @@ -5893,9 +5894,10 @@ print_debug_expr_statistics (void) static void print_value_expr_statistics (void) { - fprintf (stderr, "DECL_VALUE_EXPR hash: size %ld, %ld elements, %f collisions\n", - (long) value_expr_for_decl->size (), - (long) value_expr_for_decl->elements (), + fprintf (stderr, "DECL_VALUE_EXPR hash: size " HOST_SIZE_T_PRINT_DEC ", " + HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n", + (fmt_size_t) value_expr_for_decl->size (), + (fmt_size_t) value_expr_for_decl->elements (), value_expr_for_decl->collisions ()); } @@ -6287,9 +6289,10 @@ type_hash_canon (unsigned int hashcode, tree type) static void print_type_hash_statistics (void) { - fprintf (stderr, "Type hash: size %ld, %ld elements, %f collisions\n", - (long) type_hash_table->size (), - (long) type_hash_table->elements (), + fprintf (stderr, "Type hash: size " HOST_SIZE_T_PRINT_DEC ", " + HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n", + (fmt_size_t) type_hash_table->size (), + (fmt_size_t) type_hash_table->elements (), type_hash_table->collisions ()); } diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index 27f9ad6..619ee5f 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -718,6 +718,7 @@ equiv_oracle::add_equiv_to_block (basic_block bb, bitmap equiv_set) // Check if this is the first time a block has an equivalence added. // and create a header block. And set the summary for this block. + limit_check (bb); if (!m_equiv[bb->index]) { ptr = (equiv_chain *) obstack_alloc (&m_chain_obstack, diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc index fd3aafb..0817466 100644 --- a/gcc/var-tracking.cc +++ b/gcc/var-tracking.cc @@ -7335,8 +7335,8 @@ dump_var (variable *var) for (i = 0; i < var->n_var_parts; i++) { - fprintf (dump_file, " offset %ld\n", - (long)(var->onepart ? 0 : VAR_PART_OFFSET (var, i))); + fprintf (dump_file, " offset " HOST_WIDE_INT_PRINT_DEC "\n", + var->onepart ? 0 : VAR_PART_OFFSET (var, i)); for (node = var->var_part[i].loc_chain; node; node = node->next) { fprintf (dump_file, " "); diff --git a/gcc/varasm.cc b/gcc/varasm.cc index fa17eff..008d9b1 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -4365,7 +4365,7 @@ output_constant_pool_contents (struct rtx_constant_pool *pool) p = label; if (desc->offset) { - sprintf (buffer, "%s+%ld", p, (long) (desc->offset)); + sprintf (buffer, "%s+" HOST_WIDE_INT_PRINT_DEC, p, desc->offset); p = buffer; } ASM_OUTPUT_DEF (asm_out_file, name, p); |