diff options
Diffstat (limited to 'gcc')
39 files changed, 1194 insertions, 44 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1eb1ada..ed720db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,114 @@ +2025-12-06 Alexandre Oliva <oliva@adacore.com> + + PR rtl-optimization/122947 + * calls.cc (expand_call): Add stack function usage in + non-ACCUMULATE_OUTGOING_ARGS configurations. + +2025-12-06 Alexandre Oliva <oliva@adacore.com> + + PR target/91420 + * config/riscv/riscv.cc (riscv_symbolic_constant_p): Require + offsets smaller than +/- 1GiB for PCREL symbols. + +2025-12-06 Jakub Jelinek <jakub@redhat.com> + + * attribs.cc (decl_attributes): Use attribute_value_equal to + compare attribute values instead of simple_cst_equal. + +2025-12-06 Dimitar Dimitrov <dimitar@dinux.eu> + + PR rtl-optimization/122675 + * bb-reorder.cc (edge_order): Fix BB edge ordering to be + descending. + +2025-12-05 Vladimir N. Makarov <vmakarov@redhat.com> + + PR rtl-optimization/122215 + * ira-color.cc (improve_allocation): Use register filter for all + loop on hard regs. + +2025-12-05 Richard Earnshaw <rearnsha@arm.com> + + PR target/122999 + * config/arm/arm.cc (arm_canonicalize_comparison): Defer + initializing maxval until we know we are dealing with an + integer mode. + +2025-12-05 Richard Biener <rguenther@suse.de> + + * tree-vect-loop.cc (vect_need_peeling_or_partial_vectors_p): + When peeling for gaps we always need an epilog. + +2025-12-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120939 + * tree-vect-loop.cc (vect_need_peeling_or_partial_vectors_p): + Remove eliding an epilogue based on not computed + LOOP_VINFO_COST_MODEL_THRESHOLD and estimated max stmt executions. + +2025-12-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/123002 + * tree-vectorizer.h (supportable_widening_operation): Remove + vinfo and stmt_info parameters, add flag to indicate whether + the context would allow OP_{EVEN,ODD}. + * tree-vect-patterns.cc (vect_recog_abd_pattern): Adjust + and pass false. + (vect_recog_widen_op_pattern): Likewise. + (vect_recog_widen_abd_pattern): Likewise. + * tree-vect-stmts.cc (vectorizable_conversion): Move + even/odd validity check here, from supportable_widening_operation. + Adjust it to be conservative. + (supportable_widening_operation): Get flag whether even/odd + is OK to use and remove then unused parameters and code. + +2025-12-05 Richard Biener <rguenther@suse.de> + + * tree-pretty-print.cc (dump_mem_ref): Dump clique : base + specifier for MEM_REF and TARGET_MEM_REF when dumping + GIMPLE format. + +2025-12-05 Tobias Burnus <tburnus@baylibre.com> + + * gimplify.cc (gimplify_scan_omp_clauses): Handle + OMP_CLAUSE_DYN_GROUPPRIVATE by printing 'sorry, unimplemented'. + * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_DYN_GROUPPRIVATE. + (enum omp_clause_fallback_kind): New. + (struct tree_omp_clause): Add fallback_kind union member. + * tree-nested.cc (convert_nonlocal_omp_clauses, + convert_local_omp_clauses): Handle OMP_CLAUSE_DYN_GROUPPRIVATE. + * tree.cc (omp_clause_num_ops, omp_clause_code_name): Add + OMP_CLAUSE_DYN_GROUPPRIVATE. + * tree-pretty-print.cc (dump_omp_clause): Handle + OMP_CLAUSE_DYN_GROUPPRIVATE. + * tree.h (OMP_CLAUSE_DYN_GROUPPRIVATE_EXPR, + OMP_CLAUSE_DYN_GROUPPRIVATE_KIND): New #define. + +2025-12-05 Andrew Pinski <andrew.pinski@oss.qualcomm.com> + + PR middle-end/99782 + * config/i386/i386-expand.cc (ix86_gen_ccmp_next): Move the check + for mode earlier before expand_operands. + * config/aarch64/aarch64.cc (aarch64_gen_ccmp_next): Likewise. + +2025-12-05 Daniel Barboza <dbarboza@ventanamicro.com> + Jeff Law <jlaw@ventanamicro.com> + + * match.pd (`x & c ? (x - c) | (x | c)`): New pattern. + (`x & c ? (x & ~c) | (x | c)`): Likewise. + +2025-12-05 Pan Li <pan2.li@intel.com> + + * config/riscv/autovec-opt.md (*pred_cmp_swapped<mode>_scalar): + Add new pattern to match vec_dup > vec for vmsltu. + * config/riscv/predicates.md (comparison_swappable_operator): + Add new iterator for above pattern + * config/riscv/riscv-protos.h (expand_vx_cmp_vec_dup_vec): Add + new func to emit vmsltu.vx. + * config/riscv/riscv-v.cc (get_swapped_cmp_rtx_code): Add new + func to convert cmp code to swapped, like gtu to ltu. + (expand_vx_cmp_vec_dup_vec): Add new func decl. + 2025-12-04 Jakub Jelinek <jakub@redhat.com> PR target/122991 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 59fc39b..47f4b89 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20251205 +20251207 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d918524..fca1a9e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,124 @@ +2025-12-06 Denis Mazzucato <mazzucato@adacore.com> + + * sem_attr.adb (Resolve_Attribute): Check if the reducer is a + procedure before giving the warning. + +2025-12-05 Javier Miranda <miranda@adacore.com> + + * einfo.ads (Has_Unsigned_Base_Range_Aspect): Update documentation. + (Has_Modular_Operations): New synthesized predicate. + (Has_Overflow_Operations): New synthesized predicate. + * einfo-utils.ads (Has_Modular_Operations): New function. + (Has_Overflow_Operations): New function. + * einfo-utils.adb (Is_Modular_Integer_Type): Undo previous patch. + (Is_Signed_Integer_Type): Undo previous patch. + (Has_Modular_Operations): New function. + (Has_Overflow_Operations): New function. + * checks.adb (Determine_Range): Replace selected occurrences of calls to + Is_Modular_Integer_Type by calls to Has_Modular_Operations, and calls to + Is_Signed_Integer_Type by calls to Has Overflow_Operations. + (Enable_Range_Check): Ditto. + (Insert_Valid_Check): Ditto. + * exp_aggr.adb (Others_Check): Ditto. + * exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Pred, + Attribute_Succ]): Ditto. + * exp_ch4.adb (Expand_Compare_Minimize_Eliminate_Overflow): Ditto. + (Size_In_Storage_Elements): Ditto. + (Expand_N_Op_Abs): Ditto. + (Expand_N_Op_Expon): Ditto. + (Expand_N_Op_Minus): Ditto. + (Expand_N_Op_Multiply): Ditto. + (Expand_N_Op_Subtract): Ditto. + * freeze.adb (Freeze_Entity): Ditto. + * sem_aggr.adb (Report_Null_Array_Constraint_Error): Ditto plus + report specific error for index with unsigned_base_range aspect. + * sem_attr.adb (Check_Modular_Integer_Type): Ditto. + (Analyze_Attribute [Attribute_Pred, Attribute_Succ, Attribute_ + Range_Length, Attribute_Small, Attribute_Reduce]): Ditto. + * sem_ch12.adb (Instantiate_Type): Ditto. + (Validate_Formal_Type_Default): Ditto. + * sem_ch13.adb (Valid_Empty): Ditto. + * sem_ch2.adb (Analyze_Integer_Literal): Ditto. + * sem_ch3.adb (Unsigned_Base_Range_Type_Declaration): Set attribute + Has_Unsigned_Base_Range_Aspect on the implicit base, and set Etype + of its first subtype E_Modular_Integer_Subtype. + * sem_ch4.adb (Analyze_Call): Ditto. + * sem_eval.adb (Check_Non_Static_Context_For_Overflow): Ditto. + (Eval_Arithmetic_Op): Ditto. + (Eval_Integer_Literal): Ditto. + (Eval_Logical_Op): Ditto. + (Eval_Op_Expon): Ditto. + (Eval_Op_Not): Ditto. + (Eval_Unary_Op): Ditto. + (Fold_Shift): Ditto. + (Test_Expression_Is_Foldable): Ditto. + * sem_intr.adb (Check_Shift): Ditto. + * sem_prag.adb (Analyze_Pragma [Pragma_Unsigned_Base_Range]): Add + assertion. + * sem_res.adb (Resolve_Logical_Op): Ditto. + (Resolve_Unary_Op): Ditto. + (Set_String_Literal_Subtype): Ditto. + * sem_type.adb (Covers): Ditto. + (Specific_Type): Ditto. + (Valid_Boolean_Arg): Ditto. + * sem_util.adb (Wrong_Type): Ditto + * style.adb (Check_Boolean_Operator): Ditto. + +2025-12-05 Ronan Desplanques <desplanques@adacore.com> + + * doc/gnat_rm/representation_clauses_and_pragmas.rst: Improve table. + * gnat_rm.texi: Regenerate. + * gnat_ugn.texi: Regenerate. + +2025-12-05 Viljar Indus <indus@adacore.com> + + * sem_util.adb (Get_Cursor_Type): use the + specific type for classwide container checks. + +2025-12-05 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch12.adb (Remove_Parent): Only set the Is_Transient component + of the local scope stack entry. + +2025-12-05 Marc Poulhiès <poulhies@adacore.com> + + * doc/gnat_ugn/building_executable_programs_with_gnat.rst + (-gnato??): Remove redundant/confusing doc on floating-point + overflow. + * gnat_ugn.texi: Regenerate. + +2025-12-05 Tonu Naks <naks@adacore.com> + + * adaint.c: use the _tsopen macro when opening RO file + +2025-12-05 Denis Mazzucato <mazzucato@adacore.com> + + * sem_attr.adb + (Analyze_Attribute): Set the type of the attribute expression only when + not ambiguous (it will later be resolved correctly). Emit an error in + case the type is limited. + (Resolve_Attribute): Emit an error if the reducer has no entity. + (Get_Value_Subtype): Try to resolve the Value_Subtype of the aggregate + expression, and if it succeeds, set the candidate reducer subprogram. + (Is_Reducer_Subprogram): Check whether the selected candidate has a + proper reducer profile. + (Make_Array_Type): Return simple array type to resolve the array + aggregate against it. + (Resolve_Attribute): Reimplement the resolution of Reduce attribute, + including its prefix. + * sem_res.adb (Resolve_Declare_Expression): Save and restore variables + that may be hidden by the local declaration. Only setting the new + entities is problematic when dealing with copied trees where the ref is + lost (eg. when resolving array aggregates). + * exp_attr.adb (Expand_N_Attribute_Reference): Remove tricks to resolve + the reducer in case of faulty resolution as not needed anymore. + +2025-12-05 Iain Sandoe <iain@sandoe.co.uk> + + PR ada/115305 + * Makefile.rtl: Use s-oslock__darwin instead of the Posix version. + * libgnat/s-oslock__darwin.ads: New file. + 2025-12-03 Eric Botcazou <ebotcazou@adacore.com> PR ada/122960 diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index d38e71a..ca19cad 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -13204,32 +13204,6 @@ package body Sem_Attr is return; end if; - -- If the Accum_Typ is an unconstrained array then a - -- Constraint_Error will be raised at runtime as most - -- computations will change its length type during the - -- reduction execution, RM 4.5.10(25/5). For instance, this is - -- the case with: [...]'Reduce ("&", ...). When the expression - -- yields non-empty strings, the reduction repeatedly executes - -- the following assignment: - -- Acc := Expr (I) & Acc; - -- which will raise a Constraint_Error since the number of - -- elements is increasing. - - if not Is_Numeric_Type (Base_Type (Accum_Typ)) - and then not Is_Constrained (Accum_Typ) - then - declare - Discard : Node_Id; - pragma Unreferenced (Discard); - begin - Discard := Compile_Time_Constraint_Error - (Reducer_N, - "potential length mismatch!!??", - Accum_Typ); - return; - end; - end if; - -- If no error has been posted and the accumulation type is -- constrained, then the resolution of the reducer can start. @@ -13311,6 +13285,33 @@ package body Sem_Attr is if Is_Limited_Type (Accum_Typ) then Error_Msg_N ("accumulated subtype of Reduce must be nonlimited", N); + + -- If the Accum_Typ is an unconstrained array and the reducer + -- subprogram is a function then a Constraint_Error will be + -- raised at runtime as most computations will change its + -- length type during the reduction execution, RM 4.5.10(25/5). + -- For instance, this is the case with: + -- [...]'Reduce ("&", ...) + -- When the expression yields non-empty strings, the reduction + -- repeatedly executes the following assignment: + -- Acc := Expr (I) & Acc; + -- which will raise a Constraint_Error since the number of + -- elements is increasing. + + elsif Nkind (Reducer_E) /= N_Attribute_Reference + and then Ekind (Reducer_E) = E_Function + and then not Is_Numeric_Type (Base_Type (Accum_Typ)) + and then not Is_Constrained (Accum_Typ) + then + declare + Discard : Node_Id; + pragma Unreferenced (Discard); + begin + Discard := Compile_Time_Constraint_Error + (Reducer_N, + "potential length mismatch!!??", + Accum_Typ); + end; end if; -- Complete the resolution of the reduction expression by diff --git a/gcc/algol68/ChangeLog b/gcc/algol68/ChangeLog index eeb8ff5..b55a123 100644 --- a/gcc/algol68/ChangeLog +++ b/gcc/algol68/ChangeLog @@ -1,3 +1,8 @@ +2025-12-06 Jose E. Marchesi <jose.marchesi@oracle.com> + + PR algol68/123007 + * a68-lang.cc (a68_type_for_size): Handle intTI_type_node. + 2025-12-03 Jose E. Marchesi <jose.marchesi@oracle.com> PR algol68/122954 diff --git a/gcc/algol68/a68-lang.cc b/gcc/algol68/a68-lang.cc index 8ba0259..f5f316a 100644 --- a/gcc/algol68/a68-lang.cc +++ b/gcc/algol68/a68-lang.cc @@ -336,6 +336,11 @@ a68_type_for_size (unsigned int bits, int unsignedp) } else { + /* Handle TImode as a special case because it is used by some backends + (e.g. ARM) even though it is not available for normal use. */ + if (bits == TYPE_PRECISION (intTI_type_node)) + return intTI_type_node; + if (bits <= TYPE_PRECISION (a68_short_short_int_type)) return a68_short_short_int_type; if (bits <= TYPE_PRECISION (a68_short_int_type)) diff --git a/gcc/attribs.cc b/gcc/attribs.cc index 7d7f8f3..51c7f46 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -967,10 +967,8 @@ decl_attributes (tree *node, tree attributes, int flags, for (a = find_same_attribute (attr, old_attrs); a != NULL_TREE; a = find_same_attribute (attr, TREE_CHAIN (a))) - { - if (simple_cst_equal (TREE_VALUE (a), args) == 1) - break; - } + if (attribute_value_equal (a, attr)) + break; if (a == NULL_TREE) { diff --git a/gcc/bb-reorder.cc b/gcc/bb-reorder.cc index e4efdee..0bcd0e5 100644 --- a/gcc/bb-reorder.cc +++ b/gcc/bb-reorder.cc @@ -2377,7 +2377,11 @@ reorder_basic_blocks_software_trace_cache (void) FREE (bbd); } -/* Order edges by execution frequency, higher first. */ +/* Order edges by execution frequency, higher first. + Return: + 1 iff frequency (VE1) < frequency (VE2) + 0 iff frequency (VE1) == frequency (VE2) + -1 iff frequency (VE1) > frequency (VE2) */ static int edge_order (const void *ve1, const void *ve2) @@ -2392,7 +2396,12 @@ edge_order (const void *ve1, const void *ve2) gcov_type gc1 = c1.initialized_p () ? c1.to_gcov_type () : 0; gcov_type gc2 = c2.initialized_p () ? c2.to_gcov_type () : 0; gcov_type m = MAX (gc1, gc2); - return (m == gc1) - (m == gc2); + int low_to_high_cmp = (m == gc1) - (m == gc2); + /* gcc_stablesort sorts values in low-to-high order. But edges should + be sorted in the opposite order - with highest execution frequency first. + So return an inverted comparison to trick gcc_stablesort into + performing a reversed sorting order. */ + return -1 * low_to_high_cmp; } /* Reorder basic blocks using the "simple" algorithm. This tries to diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 46d0d30..87c06f6 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2025-12-05 Tobias Burnus <tburnus@baylibre.com> + + * c-omp.cc (c_omp_split_clauses): Handle + OMP_CLAUSE_DYN_GROUPPRIVATE, sort target clauses + alphabetically. + * c-pragma.h (enum pragma_omp_clause): Add + PRAGMA_OMP_CLAUSE_DYN_GROUPPRIVATE. + 2025-11-30 Andrew Pinski <andrew.pinski@oss.qualcomm.com> * c.opt.urls: Regenerate. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 974dd6d..5589389 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,17 @@ +2025-12-05 Richard Biener <rguenther@suse.de> + + * gimple-parser.cc (c_parser_gimple_postfix_expression): + Parse optional clique : base specifier on __MEM. + +2025-12-05 Tobias Burnus <tburnus@baylibre.com> + + * c-parser.cc (c_parser_omp_clause_dyn_groupprivate): New. + (OMP_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DYN_GROUPPRIVATE; + sort clauses alphabetically. + (c_parser_omp_clause_name, c_parser_omp_all_clauses): + Handle 'dyn_groupprivate' clause. + * c-typeck.cc (c_finish_omp_clauses): Likewise. + 2025-11-27 Jakub Jelinek <jakub@redhat.com> PR c/121506 diff --git a/gcc/calls.cc b/gcc/calls.cc index bb8a6d0..85d6ea4 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -3579,7 +3579,8 @@ expand_call (tree exp, rtx target, int ignore) && check_sibcall_argument_overlap (before_arg, &args[i], true))) sibcall_failure = true; - } + gcc_checking_assert (!args[i].stack || argblock); + } if (args[i].stack) call_fusage @@ -3676,6 +3677,32 @@ expand_call (tree exp, rtx target, int ignore) && !must_preallocate && reg_parm_stack_space > 0) anti_adjust_stack (GEN_INT (reg_parm_stack_space)); + /* Cover pushed arguments with call usage, so that cselib knows to + invalidate the stores in them at the call insn. */ + if (pass == 1 && !argblock + && (maybe_ne (adjusted_args_size.constant, 0) + || adjusted_args_size.var)) + { + rtx addr = virtual_outgoing_args_rtx; + poly_int64 size = adjusted_args_size.constant; + if (!STACK_GROWS_DOWNWARD) + { + if (adjusted_args_size.var) + /* ??? We can't compute the exact base address. */ + addr = gen_rtx_PLUS (GET_MODE (addr), addr, + gen_rtx_SCRATCH (GET_MODE (addr))); + else + addr = plus_constant (GET_MODE (addr), addr, -size); + } + rtx fu = gen_rtx_MEM (BLKmode, addr); + if (adjusted_args_size.var == 0) + set_mem_size (fu, size); + call_fusage + = gen_rtx_EXPR_LIST (BLKmode, + gen_rtx_USE (VOIDmode, fu), + call_fusage); + } + /* Pass the function the address in which to return a structure value. */ if (pass != 0 && structure_value_addr && ! structure_value_addr_parm) diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 20d3f1f..1f413b6 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -5700,8 +5700,6 @@ arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1, if (mode == VOIDmode) mode = GET_MODE (*op1); - maxval = (HOST_WIDE_INT_1U << (GET_MODE_BITSIZE (mode) - 1)) - 1; - /* For floating-point comparisons, prefer >= and > over <= and < since the former are supported by VSEL on some architectures. Only do this if both operands are registers. */ @@ -5718,6 +5716,13 @@ arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1, return; } + /* Everything below assumes an integer mode. */ + if (GET_MODE_CLASS (mode) != MODE_INT + || GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT) + return; + + maxval = (HOST_WIDE_INT_1U << (GET_MODE_BITSIZE (mode) - 1)) - 1; + /* For DImode, we have GE/LT/GEU/LTU comparisons (with cmp/sbc). In ARM mode we can also use cmp/cmpeq for GTU/LEU. GT/LE must be either reversed or (for constant OP1) adjusted to GE/LT. diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 1804d5a..7b6a29d 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -1840,8 +1840,19 @@ riscv_symbolic_constant_p (rtx x, enum riscv_symbol_type *symbol_type) /* Nonzero offsets are only valid for references that don't use the GOT. */ switch (*symbol_type) { - case SYMBOL_ABSOLUTE: case SYMBOL_PCREL: + /* In 64-bit mode, PC-relative offsets with ranges beyond +/-1GiB are + more likely than not to end up out of range for an auipc instruction + randomly-placed within the 2GB range usable by medany, and such + offsets are quite unlikely to come up by chance, so be conservative + and separate the offset for them when in 64-bit mode, where they don't + wrap around. */ + if (TARGET_64BIT) + return sext_hwi (INTVAL (offset), 30) == INTVAL (offset); + + /* Fall through. */ + + case SYMBOL_ABSOLUTE: case SYMBOL_TLS_LE: /* GAS rejects offsets outside the range [-2^31, 2^31-1]. */ return sext_hwi (INTVAL (offset), 32) == INTVAL (offset); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5239592..3ad8d16 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,22 @@ +2025-12-06 Jakub Jelinek <jakub@redhat.com> + + * decl2.cc (is_late_template_attribute): Call lookup_attribute_spec + on TREE_PURPOSE (attr) rather than name. Only call + attribute_takes_identifier_p if get_attribute_namespace (attr) is + gnu_identifier. + * pt.cc (tsubst_attribute): Only call attribute_takes_identifier_p + if get_attribute_namespace (t) is gnu_identifier. + +2025-12-05 Tobias Burnus <tburnus@baylibre.com> + + * pt.cc (tsubst_omp_clauses): Handle OMP_CLAUSE_DYN_GROUPPRIVATE. + * semantics.cc (finish_omp_clauses): Likewise. + * parser.cc (cp_parser_omp_clause_dyn_groupprivate): New. + (cp_parser_omp_clause_name, cp_parser_omp_all_clauses): + Handle 'dyn_groupprivate' clause. + (OMP_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DYN_GROUPPRIVATE; + sort clauses alphabetically. + 2025-12-03 Jason Merrill <jason@redhat.com> * pt.cc (dependent_implict_conv_p): Rename to... diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 9e135af..8ec9740 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -1468,7 +1468,8 @@ is_late_template_attribute (tree attr, tree decl) { tree name = get_attribute_name (attr); tree args = TREE_VALUE (attr); - const struct attribute_spec *spec = lookup_attribute_spec (name); + const struct attribute_spec *spec + = lookup_attribute_spec (TREE_PURPOSE (attr)); tree arg; if (!spec) @@ -1512,7 +1513,9 @@ is_late_template_attribute (tree attr, tree decl) second and following arguments. Attributes like mode, format, cleanup and several target specific attributes aren't late just because they have an IDENTIFIER_NODE as first argument. */ - if (arg == args && attribute_takes_identifier_p (name) + if (arg == args + && get_attribute_namespace (attr) == gnu_identifier + && attribute_takes_identifier_p (name) && identifier_p (t)) continue; diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 7a019d3..8498730 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -12386,7 +12386,8 @@ tsubst_attribute (tree t, tree *decl_p, tree args, pass it through tsubst. Attributes like mode, format, cleanup and several target specific attributes expect it unmodified. */ - else if (attribute_takes_identifier_p (get_attribute_name (t))) + else if (get_attribute_namespace (t) == gnu_identifier + && attribute_takes_identifier_p (get_attribute_name (t))) { tree chain = tsubst_expr (TREE_CHAIN (val), args, complain, in_decl); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c221955..724da5b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,49 @@ +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122693 + * array.cc (gfc_match_array_constructor): Stash and restore + gfc_current_ns after the call to 'gfc_match_type_spec'. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122670 + * decl.cc (gfc_get_pdt_instance): Ensure that, in an interface + body, PDT instances imported implicitly if the template has + been explicitly imported. + * module.cc (read_module): If a PDT template appears in a use + only statement, implicitly add the instances as well. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122669 + * resolve.cc (resolve_allocate_deallocate): Mold expressions + with an array reference and a constant size must be resolved + for each allocate object. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122578 + * primary.cc (gfc_match_varspec): Try to resolve a typebound + generic procedure selector expression to provide the associate + name with a type. Also, resolve component calls. In both cases, + make a copy of the selector expression to guard against changes + made by gfc_resolve_expr. + +2025-12-05 Harald Anlauf <anlauf@gmx.de> + + PR fortran/122977 + * expr.cc (gfc_is_simply_contiguous): For an associate variable + check whether the associate target is contiguous. + * resolve.cc (resolve_symbol): Skip array type check for an + associate variable when the target has the contiguous attribute. + +2025-12-05 Tobias Burnus <tburnus@baylibre.com> + + * openmp.cc (resolve_omp_clauses): Permit zero with + DYN_GROUPPRIVATE clause. + * trans-openmp.cc (fallback): Generate TREE code + for DYN_GROUPPRIVATE and remove 'sorry'. + 2025-12-03 Paul Thomas <pault@gcc.gnu.org> PR fortran/103371 diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc index 359d743..471f0cb 100644 --- a/gcc/fortran/array.cc +++ b/gcc/fortran/array.cc @@ -1344,6 +1344,7 @@ gfc_match_array_constructor (gfc_expr **result) match m; const char *end_delim; bool seen_ts; + gfc_namespace *old_ns = gfc_current_ns; head = NULL; seen_ts = false; @@ -1368,6 +1369,8 @@ gfc_match_array_constructor (gfc_expr **result) /* Try to match an optional "type-spec ::" */ gfc_clear_ts (&ts); m = gfc_match_type_spec (&ts); + gfc_current_ns = old_ns; + if (m == MATCH_YES) { seen_ts = (gfc_match (" ::") == MATCH_YES); diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index 20260ec..dfedb96 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -3969,6 +3969,7 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, gfc_expr *kind_expr; gfc_component *c1, *c2; match m; + gfc_symtree *s = NULL; type_param_spec_list = NULL; @@ -4178,10 +4179,29 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, goto error_return; } + /* If we are in an interface body, the instance will not have been imported. + Make sure that it is imported implicitly. */ + s = gfc_find_symtree (gfc_current_ns->sym_root, pdt->name); + if (gfc_current_ns->proc_name + && gfc_current_ns->proc_name->attr.if_source == IFSRC_IFBODY + && s && s->import_only && pdt->attr.imported) + { + s = gfc_find_symtree (gfc_current_ns->sym_root, instance->name); + if (!s) + { + gfc_get_sym_tree (instance->name, gfc_current_ns, &s, false, + &gfc_current_locus); + s->n.sym = instance; + } + s->n.sym->attr.imported = 1; + s->import_only = 1; + } + m = MATCH_YES; if (instance->attr.flavor == FL_DERIVED - && instance->attr.pdt_type) + && instance->attr.pdt_type + && instance->components) { instance->refs++; if (ext_param_list) diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index 00abd9e..054276e 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -6406,6 +6406,14 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict, bool permit_element) || (sym->as && sym->as->type == AS_ASSUMED_SHAPE)))) return false; + /* An associate variable may point to a non-contiguous target. */ + if (ar && ar->type == AR_FULL + && sym->attr.associate_var && !sym->attr.contiguous + && sym->assoc + && sym->assoc->target) + return gfc_is_simply_contiguous (sym->assoc->target, strict, + permit_element); + if (!ar || ar->type == AR_FULL) return true; diff --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc index 262f72b..9b845b5 100644 --- a/gcc/fortran/module.cc +++ b/gcc/fortran/module.cc @@ -5842,6 +5842,20 @@ read_module (void) || startswith (name, "__vtype_"))) p = name; + /* Include pdt_types if their associated pdt_template is in a + USE, ONLY list. */ + if (p == NULL && name[0] == 'P' + && startswith (name, "Pdt") + && module_list) + { + gfc_use_list *ml = module_list; + for (; ml; ml = ml->next) + if (ml->rename + && !strncmp (&name[3], ml->rename->use_name, + strlen (ml->rename->use_name))) + p = name; + } + /* Skip symtree nodes not in an ONLY clause, unless there is an existing symtree loaded from another USE statement. */ if (p == NULL) diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc index 729e3b5..e5e84e8 100644 --- a/gcc/fortran/primary.cc +++ b/gcc/fortran/primary.cc @@ -2261,6 +2261,32 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, && !sym->attr.select_rank_temporary) inferred_type = true; + /* Try to resolve a typebound generic procedure so that the associate name + has a chance to get a type before being used in a second, nested associate + statement. Note that a copy is used for resolution so that failure does + not result in a mutilated selector expression further down the line. */ + if (tgt_expr && !sym->assoc->dangling + && tgt_expr->ts.type == BT_UNKNOWN + && tgt_expr->symtree + && tgt_expr->symtree->n.sym + && gfc_expr_attr (tgt_expr).generic + && ((sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.pdt_template) + || (sym->ts.type == BT_CLASS + && CLASS_DATA (sym)->ts.u.derived->attr.pdt_template))) + { + gfc_expr *cpy = gfc_copy_expr (tgt_expr); + if (gfc_resolve_expr (cpy) + && cpy->ts.type != BT_UNKNOWN) + { + gfc_replace_expr (tgt_expr, cpy); + sym->ts = tgt_expr->ts; + } + else + gfc_free_expr (cpy); + if (gfc_expr_attr (tgt_expr).generic) + inferred_type = true; + } + /* For associate names, we may not yet know whether they are arrays or not. If the selector expression is unambiguously an array; eg. a full array or an array section, then the associate name must be an array and we can @@ -2493,6 +2519,20 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, && !gfc_find_derived_types (sym, gfc_current_ns, name)) primary->ts.type = BT_UNKNOWN; + /* Otherwise try resolving a copy of a component call. If it succeeds, + use that for the selector expression. */ + else if (tgt_expr && tgt_expr->expr_type == EXPR_COMPCALL) + { + gfc_expr *cpy = gfc_copy_expr (tgt_expr); + if (gfc_resolve_expr (cpy)) + { + gfc_replace_expr (tgt_expr, cpy); + sym->ts = tgt_expr->ts; + } + else + gfc_free_expr (cpy); + } + /* An inquiry reference might determine the type, otherwise we have an error. */ if (sym->ts.type == BT_UNKNOWN && !inquiry) diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 9f3ce1d..db6b52f 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -9799,8 +9799,10 @@ done_errmsg: /* Resolving the expr3 in the loop over all objects to allocate would execute loop invariant code for each loop item. Therefore do it just once here. */ + mpz_t nelem; if (code->expr3 && code->expr3->mold - && code->expr3->ts.type == BT_DERIVED) + && code->expr3->ts.type == BT_DERIVED + && !(code->expr3->ref && gfc_array_size (code->expr3, &nelem))) { /* Default initialization via MOLD (non-polymorphic). */ gfc_expr *rhs = gfc_default_initializer (&code->expr3->ts); @@ -18143,6 +18145,7 @@ skip_interfaces: /* F2008, C530. */ if (sym->attr.contiguous + && !sym->attr.associate_var && (!class_attr.dimension || (as->type != AS_ASSUMED_SHAPE && as->type != AS_ASSUMED_RANK && !class_attr.pointer))) diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc index 4ee2a65..a051db2 100644 --- a/gcc/ira-color.cc +++ b/gcc/ira-color.cc @@ -3369,6 +3369,9 @@ improve_allocation (void) for (j = 0; j < class_size; j++) { hregno = ira_class_hard_regs[aclass][j]; + if (NUM_REGISTER_FILTERS + && !test_register_filters (ALLOCNO_REGISTER_FILTERS (a), hregno)) + continue; if (check_hard_reg_p (a, hregno, conflicting_regs, profitable_hard_regs) && min_cost > costs[hregno]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a8b45e7..8f13d2c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,148 @@ +2025-12-06 Alexandre Oliva <oliva@adacore.com> + + PR rtl-optimization/122947 + * gcc.dg/pr122947.c: New. + +2025-12-06 Alexandre Oliva <oliva@adacore.com> + + PR target/91420 + * gcc.target/riscv/pr91420.c: New. + +2025-12-06 Jeff Law <jlaw@ventanamicro.com> + + PR rtl-optimization/122675 + * gcc.target/riscv/pr122675-1.c: Adjust expected output. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/103414 + * gfortran.dg/pdt_76.f03: New test. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122693 + * gfortran.dg/pdt_75.f03: New test. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122670 + * gfortran.dg/pdt_74.f03: New test. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122669 + * gfortran.dg/pdt_73.f03: New test. + +2025-12-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122578 + * gfortran.dg/pdt_72.f03: New test. + +2025-12-06 Dimitar Dimitrov <dimitar@dinux.eu> + + PR rtl-optimization/122675 + * gcc.target/aarch64/pr122675-1.c: New test. + * gcc.target/i386/pr122675-1.c: New test. + * gcc.target/riscv/pr122675-1.c: New test. + +2025-12-06 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99782 + * gcc.dg/torture/pr99782-1.c: Fix typo, dg-compile -> dg-do compile. + Use int128 effective target directly on that directive. Move PR + comment first. + +2025-12-05 Andrew Pinski <andrew.pinski@oss.qualcomm.com> + + * gcc.dg/torture/pr99782-1.c: Require intt128 target. + +2025-12-05 Vladimir N. Makarov <vmakarov@redhat.com> + + PR rtl-optimization/122215 + * gcc.target/riscv/pr122215.c: New. + * lib/target-supports.exp (check_effective_target_valgrind): New. + +2025-12-05 Harald Anlauf <anlauf@gmx.de> + + PR fortran/122977 + * gfortran.dg/contiguous_16.f90: New test. + +2025-12-05 Tobias Burnus <tburnus@baylibre.com> + + * gfortran.dg/gomp/dyn_groupprivate-1.f90: Fix + scan-tree-dump-times regexp to avoid hard-coded 'D.4680'. + +2025-12-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120939 + * gcc.dg/torture/pr113026-1.c: Skip when -ftracer. + +2025-12-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/123002 + * gcc.dg/vect/vect-pr123002.c: Make global data non-const + and non-static. + +2025-12-05 Denis Mazzucato <mazzucato@adacore.com> + + * gnat.dg/reduce1.adb: Adjust expected error message. + +2025-12-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/123002 + * gcc.dg/vect/vect-pr123002.c: New testcase. + +2025-12-05 Richard Biener <rguenther@suse.de> + + * gcc.dg/gimplefe-58.c: New testcase. + +2025-12-05 Tobias Burnus <tburnus@baylibre.com> + + * gfortran.dg/gomp/dyn_groupprivate-1.f90: Add scan-dump test. + * gfortran.dg/gomp/dyn_groupprivate-2.f90: Extend and update. + * c-c++-common/gomp/dyn_groupprivate-1.c: New test. + * c-c++-common/gomp/dyn_groupprivate-2.c: New test. + +2025-12-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/122776 + * gcc.dg/vect/vect-simd-clone-24.c: Add -mprefer-vector-width=512. + +2025-12-05 Andrew Pinski <andrew.pinski@oss.qualcomm.com> + + PR middle-end/99782 + * gcc.dg/torture/pr99782-1.c: New test. + +2025-12-05 Daniel Barboza <dbarboza@ventanamicro.com> + Jeff Law <jlaw@ventanamicro.com> + + * gcc.dg/torture/pr122615.c: New test. + * gcc.dg/torture/pr122616.c: Likewise. + +2025-12-05 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c: Add asm check + for vmsltu.vx. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test + helper macros. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test + data for run test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmsltu-run-1-u16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmsltu-run-1-u32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmsltu-run-1-u64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmsltu-run-1-u8.c: New test. + 2025-12-04 Richard Biener <rguenther@suse.de> PR tree-optimization/122776 diff --git a/gcc/testsuite/gcc.dg/pr122947.c b/gcc/testsuite/gcc.dg/pr122947.c new file mode 100644 index 0000000..945a61a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr122947.c @@ -0,0 +1,45 @@ +/* PR rtl-optimization/122947 based on PR 117239 */ +/* { dg-do run } */ +/* { dg-options "-fno-inline -O2" } */ +/* { dg-additional-options "-fschedule-insns -mno-accumulate-outgoing-args" { target x86 } } */ + +int c = 1; + +struct A { + int e, f, g, h; + short i; + int j; +}; + +void +bar (int x, struct A y) +{ + if (y.j == 1) + c = 0; +} + +/* Simplest pure way to force baz's x.j back to memory. + So simple that IPA "inlines" it, so we disable IPA and mark as pure. */ +int __attribute__ ((noipa, pure)) +bad (struct A const *x) +{ + return x->j; +} + +int +baz (struct A x) +{ + x.j = 0; + return bad (&x); +} + +int +main () +{ + struct A k = { 0, 0, 0, 0, 0, 1 }; + int d = baz (k); + bar (0, k); + if (c + d != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr99782-1.c b/gcc/testsuite/gcc.dg/torture/pr99782-1.c index 76aab18..45fb93e 100644 --- a/gcc/testsuite/gcc.dg/torture/pr99782-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr99782-1.c @@ -1,6 +1,6 @@ -/* { dg-compile } */ -/* { dg-additional-options "-mapxf" { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */ /* PR middle-end/99782 */ +/* { dg-do compile { target int128 } } */ +/* { dg-additional-options "-mapxf" { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */ int hb; diff --git a/gcc/testsuite/gcc.target/aarch64/pr122675-1.c b/gcc/testsuite/gcc.target/aarch64/pr122675-1.c new file mode 100644 index 0000000..8d2982a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr122675-1.c @@ -0,0 +1,31 @@ +/* Verify that the most likely BB edges are optimized as fallthroughs. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-pic -mtune=generic -march=armv8-a" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ + +/* +**test: +**.LFB[0-9]+: +** .cfi_startproc +**... +** cbz w0, .L[0-9]* +**... +** bl f1 +**... +** ret +**.L[0-9]+: +**... +** ret +**... +*/ + +int f1(void); + +int test(int a) +{ + if (__builtin_expect(!!a, 1)) { + return f1(); + } + return a; +} diff --git a/gcc/testsuite/gcc.target/i386/pr122675-1.c b/gcc/testsuite/gcc.target/i386/pr122675-1.c new file mode 100644 index 0000000..fb41f5b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr122675-1.c @@ -0,0 +1,33 @@ +/* Verify that the most likely BB edges are optimized as fallthroughs. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-pic -march=x86-64 -mtune=generic -mgeneral-regs-only" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target lp64 } {^\t?\.} } } */ + +/* +**test: +**.LFB[0-9]+: +** .cfi_startproc +** testl %edi, %edi +** je .L[0-9]* +** subq \$[0-9]*, %rsp +** .cfi_def_cfa_offset [0-9]* +** call f1 +** addq \$[0-9]*, %rsp +** .cfi_def_cfa_offset [0-9]* +** ret +**.L[0-9]+: +** movl %edi, %eax +** ret +**... +*/ + +int f1(void); + +int test(int a) +{ + if (__builtin_expect(!!a, 1)) { + return f1(); + } + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/pr122215.c b/gcc/testsuite/gcc.target/riscv/pr122215.c new file mode 100644 index 0000000..cdc1ed7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr122215.c @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target valgrind } */ +/* { dg-additional-files "sparseset.supp" } */ +/* { dg-options "-wrapper valgrind,-q,--exit-on-first-error=yes,--error-exitcode=1,--suppressions=${srcdir}/sparseset.supp" } */ + +typedef signed int int32_t; +typedef signed long int int64_t; + +int64_t dual_reg_insn(int64_t x) { + int64_t res; + int64_t zero = 0; + asm ("some_custom_insn %0,%1,%2" : "=R" (res) : "R" (x), "R" (zero)); + return res; +} + +int32_t single_reg_insn(int32_t x) { + int32_t res; + int32_t zero = 0; + asm ("some_custom_insn %0,%1,%2" : "=r" (res) : "r" (x), "r" (zero)); + return res; +} + +int32_t single_reg_insn_explicit_zero(int32_t x) { + int32_t res; + asm ("some_custom_insn %0,%1,%2" : "=r" (res) : "r" (x), "r" (0)); + return res; +} + +int64_t dual_reg_insn2(int64_t x) { + int64_t res; + int64_t zero = 0; + asm ("some_custom_insn %0,%1,%2" : "=R" (res) : "R" (x), "R" (zero)); + return res; + /* This function is IDENTICAL to dual_reg_insn, + * but for some obscure reason (alignment?) + * it decides to use sX registers instead of aX to store zero, + * resulting in a much larger code since it needs to use the stack. + * THIS ONLY HAPPENS SOMETIMES! + */ +} + +int64_t dual_reg_insn_explicit_zero(int64_t x) { + int64_t res; + asm ("some_custom_insn %0,%1,%2" : "=R" (res) : "R" (x), "R" (0LL)); + return res; +} diff --git a/gcc/testsuite/gcc.target/riscv/pr122675-1.c b/gcc/testsuite/gcc.target/riscv/pr122675-1.c new file mode 100644 index 0000000..3187b10 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr122675-1.c @@ -0,0 +1,38 @@ +/* Verify that the most likely BB edges are optimized as fallthroughs. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-pic -march=rv64gc -mabi=lp64d" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ + +/* +**test: +**... +** beq a0,zero,.L[0-9]* +**... +** call f1 +**... +** ( +** jr ra +** | +** ret +** ) +**... +**.L[0-9]+: +**... +** ( +** jr ra +** | +** ret +** ) +**... +*/ + +int f1(void); + +int test(int a) +{ + if (__builtin_expect(!!a, 1)) { + return f1(); + } + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/pr91420.c b/gcc/testsuite/gcc.target/riscv/pr91420.c new file mode 100644 index 0000000..936d998 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr91420.c @@ -0,0 +1,46 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -mcmodel=medany -save-temps" } */ + +int a[1]; + +__UINTPTR_TYPE__ +foo(void) +{ + return (__UINTPTR_TYPE__)a + 0x7fffffff; +} + +__UINTPTR_TYPE__ +bfoo(void) +{ + return (__UINTPTR_TYPE__)a + 0x40000000; +} + +__UINTPTR_TYPE__ +sfoo(void) +{ + return (__UINTPTR_TYPE__)a + 0x3fffffff; +} + +__UINTPTR_TYPE__ +bar(void) +{ + return (__UINTPTR_TYPE__)a - 0x80000000; +} + +__UINTPTR_TYPE__ +bbar(void) +{ + return (__UINTPTR_TYPE__)a - 0x40000000; +} + +__UINTPTR_TYPE__ +sbar(void) +{ + return (__UINTPTR_TYPE__)a - 0x3fffffff; +} + +/* /* dg-final { scan-assembler-times "lla\ta[0-9]*, a$" 4 { target riscv64-*-* } } } */ +/* /* dg-final { scan-assembler-times "lla\ta[0-9]*, a[-+]" 2 { target riscv64-*-* } } } */ + +/* /* dg-final { scan-assembler-times "lla\ta[0-9]*, a[-+]$" 6 { target riscv32-*-* } } } */ +/* /* dg-final { scan-assembler-not "lla\ta[0-9]*, a$" { target riscv32-*-* } } } */ diff --git a/gcc/testsuite/gfortran.dg/contiguous_16.f90 b/gcc/testsuite/gfortran.dg/contiguous_16.f90 new file mode 100644 index 0000000..ae1ba26 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/contiguous_16.f90 @@ -0,0 +1,51 @@ +! { dg-do run } +! { dg-options "-O2 -fdump-tree-original" } +! +! PR fortran/122977 - associate to a contiguous pointer + +program foo + integer, dimension(:), pointer, contiguous :: a + integer, dimension(:), allocatable :: u + allocate (a(4), u(4)) + if (.not. is_contiguous(a)) error stop 1 ! optimized + if (.not. is_contiguous(u)) error stop 2 ! optimized + + associate (b => a) + if (.not. is_contiguous(b)) error stop 3 ! optimized + associate (c => b) + if (.not. is_contiguous(c)) error stop 4 ! optimized + end associate + associate (c => b(1::2)) + if (is_contiguous(c)) stop 11 ! runtime check + end associate + end associate + + associate (v => u) + if (.not. is_contiguous(v)) error stop 5 ! optimized + associate (w => v) + if (.not. is_contiguous(w)) error stop 6 ! optimized + end associate + associate (w => v(1::2)) + if (is_contiguous(w)) stop 12 ! runtime check + end associate + end associate + + associate (b => a(1::2)) + if (is_contiguous(b)) stop 13 ! runtime check + associate (c => b) + if (is_contiguous(c)) stop 14 ! runtime check + end associate + end associate + + associate (v => u(1::2)) + if (is_contiguous(v)) stop 15 ! runtime check + associate (w => v) + if (is_contiguous(w)) stop 16 ! runtime check + end associate + end associate + + deallocate (a, u) +end program foo + +! { dg-final { scan-tree-dump-not "_gfortran_error_stop_numeric" "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_stop_numeric" 6 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pdt_72.f03 b/gcc/testsuite/gfortran.dg/pdt_72.f03 new file mode 100644 index 0000000..57640bd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_72.f03 @@ -0,0 +1,110 @@ +! { dg-do compile } +! +! Tests the fix for pr122578, which failed in compilation with the errors +! shown below. +! +! Contributed by Damian Rouson <damian@archaeologic.codes> +! +module tensor_map_m + use iso_c_binding, only : c_int + implicit none + + type tensor_t(k) + integer, kind :: k = kind(1.) + real(k), allocatable :: values_(:) ! Error: Cannot convert REAL(0) to REAL(4) at (1) + contains + generic :: values => default_real_values + procedure default_real_values + end type + + interface + pure module function default_real_values(self) result(tensor_values) + implicit none + class(tensor_t), intent(in) :: self + real, allocatable :: tensor_values(:) + end function + end interface + + type tensor_map_t(k) + integer, kind :: k = kind(1.) + real(k), dimension(:), allocatable :: intercept_, slope_ + contains + generic :: map_to_training_range => default_real_map_to_training_range + procedure :: default_real_map_to_training_range + generic :: map_from_training_range => default_real_map_from_training_range + procedure :: default_real_map_from_training_range + end type + + interface + elemental module function default_real_map_to_training_range(self, tensor) result(normalized_tensor) + implicit none + class(tensor_map_t), intent(in) :: self + type(tensor_t), intent(in) :: tensor + type(tensor_t) normalized_tensor + end function + + elemental module function default_real_map_from_training_range(self, tensor) result(unnormalized_tensor) + implicit none + class(tensor_map_t), intent(in) :: self + type(tensor_t), intent(in) :: tensor + type(tensor_t) unnormalized_tensor + end function + end interface + + type activation_t + integer(c_int) :: selection_ + contains + generic :: evaluate => default_real_evaluate + procedure default_real_evaluate + end type + + interface + elemental module function default_real_evaluate(self, x) result(y) + implicit none + class(activation_t), intent(in) :: self + real, intent(in) :: x + real y + end function + end interface + + type neural_network_t(k) + integer, kind :: k = kind(1.) + type(tensor_map_t(k)) input_map_, output_map_ + real(k), allocatable :: weights_(:,:,:), biases_(:,:) + integer, allocatable :: nodes_(:) + type(activation_t) :: activation_ + contains + generic :: infer => default_real_infer + procedure default_real_infer + end type + + integer, parameter :: input_layer = 0 +contains + elemental function default_real_infer(self, inputs) result(outputs) + class(neural_network_t), intent(in) :: self + type(tensor_t), intent(in) :: inputs + type(tensor_t) outputs + real, allocatable :: a(:,:) + integer l + associate(w => self%weights_, b => self%biases_, n => self%nodes_, output_layer => ubound(self%nodes_,1)) + allocate(a(maxval(n), input_layer:output_layer)) + associate(normalized_inputs => self%input_map_%map_to_training_range(inputs)) + a(1:n(input_layer),input_layer) = normalized_inputs%values() ! Error: Symbol ‘normalized_inputs’ + ! at (1) has no IMPLICIT type + + end associate + feed_forward: & + do l = input_layer+1, output_layer + associate(z => matmul(w(1:n(l),1:n(l-1),l), a(1:n(l-1),l-1)) + b(1:n(l),l)) + a(1:n(l),l) = self%activation_%evaluate(z) + end associate + end do feed_forward + associate(normalized_outputs => tensor_t(a(1:n(output_layer), output_layer))) + outputs = self%output_map_%map_from_training_range(normalized_outputs) ! Error: Found no matching specific + ! binding for the call to the GENERIC + ! ‘map_from_training_range’ at (1) + + end associate + end associate + end function +end module diff --git a/gcc/testsuite/gfortran.dg/pdt_73.f03 b/gcc/testsuite/gfortran.dg/pdt_73.f03 new file mode 100644 index 0000000..63a9234 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_73.f03 @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! Tests the fix for pr122669, which falied with the error below. +! +! Contributed by Damian Rouson <damian@archaeologic.codes> +! + implicit none + type tensor_t + real, allocatable :: values_ + end type + type(tensor_t) :: random_inputs(1) + type(tensor_t), allocatable :: outputs(:) + + random_inputs = [tensor_t(1.0)] + allocate(outputs, mold=random_inputs) ! Error: Array specification or array-valued + ! SOURCE= expression required in ALLOCATE statement at (1) + print *, size(outputs) +end diff --git a/gcc/testsuite/gfortran.dg/pdt_74.f03 b/gcc/testsuite/gfortran.dg/pdt_74.f03 new file mode 100644 index 0000000..c12db79 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_74.f03 @@ -0,0 +1,48 @@ +! { dg-do compile } +! +! Tests the fix for pr122670, where use only did not compile for PDTs. Also, it +! was found in the course of developing the fix that import only did not work +! either. +! +! Contributed by Damian Rouson <damian@archaeologic.codes> +! +module tensor_m + implicit none + + type tensor_t(k) + integer, kind :: k = kind(0.) + real(k), allocatable :: value_ + end type + + interface + function myfunc (arg) + import tensor_t + implicit none + type (tensor_t) myfunc + type (tensor_t), intent(in) :: arg + end function + end interface + +contains + function y(x) + type(tensor_t) x, y + y = tensor_t(x%value_) + end function +end module + +function myfunc (arg) + use tensor_m, only : tensor_t + implicit none + type (tensor_t) myfunc + type (tensor_t), intent(in) :: arg + myfunc = arg + myfunc%value_ = myfunc%value_ * 2.0 +end function + + use tensor_m, only : tensor_t, y, myfunc + implicit none + type(tensor_t) desired_output + desired_output = y(tensor_t(42.)) + desired_output = myfunc (desired_output) + print *, desired_output%value_ +end diff --git a/gcc/testsuite/gfortran.dg/pdt_75.f03 b/gcc/testsuite/gfortran.dg/pdt_75.f03 new file mode 100644 index 0000000..f700871 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_75.f03 @@ -0,0 +1,35 @@ +! { dg-do compile } +! +! Tests the fix for pr122693, which failed in compilation with the errors +! shown below. +! +! Contributed by Damian Rouson <damian@archaeologic.codes> +! +module tensor_m + implicit none + + type tensor_t(k) + integer, kind :: k = kind(0.) + end type + + interface tensor_t + module function tensor(unused_stuff) + implicit none + real unused_stuff + type(tensor_t) tensor + end function + end interface + +end module + + use tensor_m + implicit none +contains + function test_passed() + logical test_passed + type(tensor_t), allocatable :: tensor_array(:) + real, parameter :: junk = 0. + tensor_array = [tensor_t(junk)] !Error: Symbol ‘junk’ at (1) has no IMPLICIT type + test_passed = .false. !Error: ‘test_passed’ at (1) is not a variable + end function +end diff --git a/gcc/testsuite/gfortran.dg/pdt_76.f03 b/gcc/testsuite/gfortran.dg/pdt_76.f03 new file mode 100644 index 0000000..22c0a3e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_76.f03 @@ -0,0 +1,21 @@ +! { dg-do compile } + +! Make sure that pr103414 is fixed. +! +! Contributed by Gerhard Steinmetz <gscfq@t-online.de> +! +function p () + type t(n) + integer, kind :: n + character(n) :: c = '' + end type + type(t(3)) :: x = t(z'1') ! { dg-error "Expected an initialization expression" } +end + +function q () + type t(n) + integer, kind :: n + character(n) :: c = '' + end type + type(t(3)) :: x(1) = [t(z'1')] ! { dg-error "Syntax error in array constructor" } +end diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 1df80d4..6251f4e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -14762,3 +14762,11 @@ proc check_effective_target_fentry { } { } }] } + +# Check if valgrind executable exists in PATH on host +proc check_effective_target_valgrind { } { + if { [which valgrind] != 0 } { + return 1 + } + return 0 +} |
