aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog49
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog272
-rw-r--r--gcc/config.gcc5
-rw-r--r--gcc/config/aarch64/aarch64.cc1
-rw-r--r--gcc/config/riscv/generic-vector-ooo.md85
-rw-r--r--gcc/config/xtensa/xtensa.cc44
-rw-r--r--gcc/config/xtensa/xtensa.md16
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.cc4
-rw-r--r--gcc/cp/constexpr.cc13
-rw-r--r--gcc/cp/method.cc3
-rw-r--r--gcc/cp/tree.cc3
-rw-r--r--gcc/expr.cc2
-rw-r--r--gcc/genpreds.cc7
-rw-r--r--gcc/m2/gm2-compiler/P1SymBuild.mod45
-rw-r--r--gcc/m2/gm2-compiler/P2SymBuild.mod26
-rw-r--r--gcc/m2/gm2-compiler/P3SymBuild.mod2
-rw-r--r--gcc/m2/gm2-compiler/PCSymBuild.mod6
-rw-r--r--gcc/m2/gm2-compiler/SymbolTable.def6
-rw-r--r--gcc/m2/gm2-compiler/SymbolTable.mod87
-rw-r--r--gcc/m2/gm2-libs/M2EXCEPTION.mod5
-rw-r--r--gcc/testsuite/ChangeLog35
-rw-r--r--gcc/testsuite/g++.dg/cpp26/constexpr-new4.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-union6.C4
-rw-r--r--gcc/testsuite/g++.dg/ext/is_invocable5.C15
-rw-r--r--gcc/testsuite/g++.dg/lookup/operator-8.C9
-rw-r--r--gcc/testsuite/g++.dg/missing-return.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C2
-rw-r--r--gcc/testsuite/gcc.dg/pr109267-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr109267-2.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr121202.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr121216.c9
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr119085.c37
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr81627.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-23.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr116125.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/mask_load_2.c23
-rw-r--r--gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.def12
-rw-r--r--gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.mod30
-rw-r--r--gcc/testsuite/lib/gcc-defs.exp16
-rw-r--r--gcc/testsuite/lib/target-supports.exp12
-rw-r--r--gcc/tree-cfgcleanup.cc24
-rw-r--r--gcc/tree-sra.cc6
-rw-r--r--gcc/tree-ssa-sink.cc73
-rw-r--r--gcc/tree-vect-data-refs.cc26
-rw-r--r--gcc/tree-vect-slp.cc6
47 files changed, 906 insertions, 215 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f3e4ba1..6276e83 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,52 @@
+2025-07-22 Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR middle-end/109267
+ * tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing): If the first
+ non debug statement in the first (and only) basic block is a call
+ to __builtin_unreachable change it to a call to __builtin_trap or an
+ infinite loop.
+
+2025-07-22 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * config/xtensa/xtensa.cc (xtensa_is_insn_L32R_p):
+ Rewrite to capture insns that could be L32R machine instructions
+ wherever possible.
+ (xtensa_rtx_costs): Fix to consider that moves larger than a
+ natural word can take multiple L32R machine instructions.
+ (constantpool_address_p): Cosmetics.
+ * config/xtensa/xtensa.md (movdi_internal, movdf_internal):
+ Add missing insn attributes.
+
+2025-07-22 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * config/xtensa/xtensa.md
+ (movsi_internal, movhi_internal, movsf_internal):
+ Change the value of the "type" attribute from "move" to "load"
+ when the source operand constraint is "Y".
+
+2025-07-22 Karl Meakin <karl.meakin@arm.com>
+
+ * tree-vect-data-refs.cc (vect_check_gather_scatter): Swap
+ `base` and `off` in more scenarios. Also assert at the end of
+ the function that `base` and `off` are loop-invariant and not
+ loop-invariant respectively.
+
+2025-07-22 Jeff Law <jlaw@ventanamicro.com>
+
+ * config/riscv/generic-vector-ooo.md: Restrict insn reservations to
+ generic_ooo and generic tuning models.
+
+2025-07-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121202
+ * tree-vect-slp.cc (vect_schedule_slp_node): Do not take
+ an out-of-region stmt as "last".
+
+2025-07-22 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
+
+ * genpreds.cc (write_insn_constraint_len): Replace rawmemchr by
+ a loop.
+
2025-07-21 Jeff Law <jlaw@ventanamicro.com>
* config/riscv/mips-p8700.md: Add support for "ghost" insn types.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 7578d89..bd609e4 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250722
+20250723
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d1b78d4..fda0dd5 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,275 @@
+2025-07-22 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch8.adb (End_Use_Type): Add a test for there not being an earlier
+ use_type_clause for the same type as an additional criterion for turning
+ off In_Use and Current_Use_Clause.
+
+2025-07-22 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_attr.adb (Eval_Attribute): Only fold array attributes when prefix
+ is static or at least safe to evaluate
+
+2025-07-22 Ronan Desplanques <desplanques@adacore.com>
+
+ * einfo.ads (Is_Controlled_Active): Fix pasto in comment.
+ * sem_util.ads (Propagate_Controlled_Flags): Update comment for
+ Destructor aspect.
+
+2025-07-22 Ronan Desplanques <desplanques@adacore.com>
+
+ * doc/gnat_rm/gnat_language_extensions.rst: Document new extension.
+ * snames.ads-tmpl: Add name for new aspect.
+ * gen_il-fields.ads (Has_Destructor, Is_Destructor): Add new fields.
+ * gen_il-gen-gen_entities.adb (E_Procedure, Type_Kind): Add new fields.
+ * einfo.ads (Has_Destructor, Is_Destructor): Document new fields.
+ * aspects.ads: Add new aspect.
+ * sem_ch13.adb (Analyze_Aspect_Specifications,
+ Check_Aspect_At_Freeze_Point, Check_Aspect_At_End_Of_Declarations):
+ Add semantic analysis for new aspect.
+ (Resolve_Finalization_Procedure): New function.
+ (Resolve_Finalizable_Argument): Use new function above.
+ * sem_util.adb (Propagate_Controlled_Flags): Extend for new field.
+ * freeze.adb (Freeze_Entity): Add legality check for new aspect.
+ * exp_ch3.adb (Expand_Freeze_Record_Type, Predefined_Primitive_Bodies):
+ Use new field.
+ * exp_ch7.adb (Build_Finalize_Statements): Add expansion for
+ destructors.
+ (Make_Final_Call, Build_Record_Deep_Procs): Adapt to new Has_Destructor
+ field.
+ (Build_Adjust_Statements): Tweak to handle cases of empty lists.
+ * gnat_rm.texi: Regenerate.
+
+2025-07-22 Denis Mazzucato <mazzucato@adacore.com>
+
+ * sem_ch6.adb (Might_Need_BIP_Task_Actuals): Before retrieving the original corresponding
+ operation we retrieve first the root of the aliased chain.
+
+2025-07-22 Ronan Desplanques <desplanques@adacore.com>
+
+ * gen_il-fields.ads (Is_Implicit_Full_View): New field.
+ * gen_il-gen-gen_entities.adb (Type_Kind): Use new field.
+ * einfo.ads (Is_Implicit_Full_View): Document new field.
+ * exp_ch7.adb (Make_Adjust_Call, Make_Init_Call, Make_Final_Call): Use
+ new field.
+ * exp_util.adb (Finalize_Address): Likewise.
+ * sem_ch3.adb (Copy_And_Build): Set new field.
+
+2025-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_util.ads (May_Generate_Large_Temp): Delete.
+ * exp_util.adb (May_Generate_Large_Temp): Likewise.
+ (Safe_Unchecked_Type_Conversion): Do not take stack checking into
+ account to compute the result.
+
+2025-07-22 Javier Miranda <miranda@adacore.com>
+
+ * sinfo.ads (Is_Expanded_Dispatching_Call): New flag.
+ (Tag_Propagated): New flag.
+ * exp_ch6.adb (Expand_Call_Helper): Propagate the tag when
+ the dispatching call is placed in conditionl expressions or
+ case-expressions.
+ * sem_ch5.adb (Analyze_Assignment): For assignment of tag-
+ indeterminate expression, do not propagate the tag if
+ previously done.
+ * sem_disp.adb (Is_Tag_Indeterminate): Add missing support
+ for conditional expression and case expression.
+ * exp_disp.ads (Is_Expanded_Dispatching_Call): Removed. Function
+ replaced by a new flag in the nodes.
+ * exp_disp.adb (Expand_Dispatching_Call): Set a flag in the
+ call node to remember that the call has been expanded.
+ (Is_Expanded_Dispatching_Call): Function removed.
+ * gen_il-fields.ads (Tag_Propagated): New flag.
+ (Is_Expanded_Dispatching_Call): New flag.
+ * gen_il-gen-gen_nodes.adb (Tag_Propagated): New flag.
+ (Is_Expanded_Dispatching_Call): New flag.
+
+2025-07-22 Gary Dismukes <dismukes@adacore.com>
+
+ * libgnat/a-cbhama.ads (Empty): Add missing default to Capacity formal.
+ * libgnat/a-cbhama.adb (Empty): Add missing default to Capacity formal.
+ * exp_aggr.adb (Build_Size_Expr): Test for presence of Capacity
+ discriminant as additional criterion for generating the call to
+ the Length function. Update comments.
+
+2025-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_util.adb (Safe_Unchecked_Type_Conversion): Always return True
+ if the expression is the prefix of an N_Selected_Component.
+
+2025-07-22 Denis Mazzucato <mazzucato@adacore.com>
+
+ * sem_ch6.adb (Might_Need_BIP_Task_Actuals): Check whether No_Task_Parts is enabled in any
+ of the derived types, or interfaces, from the user-defined primitive return type.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): Add No_Task_Parts and No_Controlled_Parts to
+ the representation chain to be visible in the full view of private types.
+ * aspects.ads (Nonoverridable_Aspect_Id): As per GNAT RM, No_Task_Parts is nonoverridable.
+ * sem_util.adb (Check_Inherited_Nonoverridable_Aspects): Likewise.
+ * sem_util.ads: Fix typo and style.
+ * sem_disp.adb: Missing comment.
+
+2025-07-22 Javier Miranda <miranda@adacore.com>
+
+ * einfo.ads (Extra_Formals): Complete documentation.
+ (Has_First_Controlling_Parameter_Aspect): Place it in alphabetical order.
+ (Has_Frozen_Extra_Formals): New attribute.
+ * gen_il-fields.ads (Has_Frozen_Extra_Formals): New entity field.
+ * gen_il-gen-gen_entities.adb (Has_Frozen_Extra_Formals): Adding new
+ entity flag to subprograms, subprogram types, and and entries.
+ * gen_il-internals.adb (Image): Adding Has_Frozen_Extra_Formals.
+ * exp_ch3.adb (Build_Array_Init_Proc): Freeze its extra formals.
+ (Build_Init_Procedure): Freeze its extra formals.
+ (Expand_Freeze_Record_Type): For tagged types with foreign convention
+ create the extra formals of primitives with convention Ada.
+ * exp_ch6.ads (Create_Extra_Actuals): New subprogram.
+ * exp_ch6.adb (Check_BIP_Actuals): Adding assertions.
+ (Create_Extra_Actuals): New subprogram that factorizes code from
+ Expand_Call_Helper.
+ (Expand_Call_Helper): Adding support to defer the addition of extra
+ actuals. Move the code that adds the extra actuals to a new subprogram.
+ (Is_Unchecked_Union_Equality): Renamed as Is_Unchecked_Union_Predefined_
+ Equality_Call.
+ * exp_ch7.adb (Create_Finalizer): Freeze its extra formals.
+ (Wrap_Transient_Expression): Link the temporary with its relocated
+ expression to facilitate locating the expression in the expanded code.
+ * exp_ch9.ads (Expand_N_Entry_Declaration): Adding one formal.
+ * exp_ch9.adb (Expand_N_Entry_Declaration): Defer the expansion of
+ the entry if the extra formals are not available; analyze the built
+ declarations for the record type that holds all the parameters if
+ the expansion of the entry declaration was deferred.
+ * exp_disp.adb (Expand_Dispatching_Call): Handle deferred extra formals.
+ (Set_CPP_Constructors): Freeze its extra formals.
+ * freeze.adb (Freeze_Entity): Create the extra actuals of acccess to
+ subprograms whose designated type is a subprogram type.
+ (Freeze_Subprogram): Adjust assertion to support deferred extra formals,
+ and freeze extra formals of non-dispatching subprograms with foreign
+ convention. Added assertion to check matching of formals in thunks.
+ * sem_aux.adb (Get_Called_Entity): Adding documentation.
+ * sem_ch3.adb (Analyze_Full_Type_Declaration): Create the extra formals
+ of deferred subprograms, subprogram types and entries; create also the
+ extra actuals of deferred calls.
+ * sem_ch6.ads (Freeze_Extra_Formals): New subprogram.
+ (Deferred_Extra_Formals_Support): New package.
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Create the extra formals
+ of subprograms without separate spec.
+ (Add_Extra_Formal): Add documentation.
+ (Has_Extra_Formals): Removed.
+ (Parent_Subprogram): Adding documentation.
+ (Create_Extra_Formals): Defer adding extra formals if the underlying_type
+ of some formal type or return type is not available.
+ (Extra_Formals_Match_OK): Add missing check on the extra formals of
+ unchecked unions.
+ (Freeze_Extra_Formals): New subprogram.
+ (Deferred_Extra_Formals_Support): New package.
+ * sem_ch9.adb (Analyze_Entry_Declaration): Freeze its extra formals.
+ * sem_ch13.adb (New_Put_Image_Subprogram): ditto.
+ * sem_util.ads (Is_Unchecked_Union_Equality): New subprogram.
+ * sem_util.adb (Is_Unchecked_Union_Equality): ditto.
+
+2025-07-22 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_util.adb (Get_Actual_Subtype): Do the same for GCC and GNATprove
+ backends.
+
+2025-07-22 Martin Clochard <clochard@adacore.com>
+
+ * exp_spark.adb (Expand_SPARK): Add expansion of continue statements.
+ (Expand_SPARK_N_Continue_Statement): Expand continue statements resolved
+ as procedure calls into said procedure calls.
+
+2025-07-22 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_res.adb (Resolve_Call): Look at the base type of actual parameter
+ when checking call to Set_Handler.
+
+2025-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_util.adb (Get_Actual_Subtype): Only create a new subtype when
+ the expander is active. Remove a useless test of type inequality,
+ as well as a useless call to Set_Has_Delayed_Freeze on the subtype.
+
+2025-07-22 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_aggr.adb (Build_Size_Expr): Change test of "not Present (...)"
+ to "No (...)".
+
+2025-07-22 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_aggr.adb (Build_Size_Expr): Determine the length of a container
+ aggregate association in the case where it's an iteration over an
+ object of a container type coming from an instantiation of a predefined
+ container generic. Minor updates to existing comments.
+
+2025-07-22 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * exp_util.adb (Finalize_Address): Prevent infinite loop
+
+2025-07-22 Steve Baird <baird@adacore.com>
+
+ * sem_aux.ads: Declare new function Unique_Component_Name.
+ * sem_aux.adb: Implement new function Unique_Component_Name.
+
+2025-07-22 Viljar Indus <indus@adacore.com>
+
+ * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations):
+ Ensure the Expression_Copy always has a parent before
+ calling any analyze.
+
+2025-07-22 Steve Baird <baird@adacore.com>
+
+ * exp_aggr.adb (Build_Record_Aggr_Code.Gen_Assign): In the case of
+ an aggregate component where the component type is mutably tagged
+ and the component value is provided by a qualified aggregate (and
+ qualified with a specific type), avoid incorrectly rejecting the
+ inner aggregate for violating the rule that the type of an
+ aggregate shall not be class-wide.
+ * exp_attr.adb: For a predefined streaming operation (i.e., Read,
+ Write, Input, or Output) of a class-wide type, the external name
+ of the tag of the value is normally written out by Output and read
+ in by Input. In the case of a mutably tagged type, this is instead
+ done in Write and Read.
+ * exp_ch4.adb (Expand_Composite_Equality): In the case of an
+ equality comparison for a type having a mutably tagged component,
+ we want the component comparison to compare two values of the
+ mutably tagged type, not two values of the corresponding
+ array-of-bytes-ish representation type. Even if there are no
+ user-defined equality functions anywhere in sight, comparing the
+ array values still doesn't work because undefined bits may end up
+ participating in the comparison (resulting in an incorrect result
+ of False).
+ * exp_put_image.adb: In the case of a class-wide type, the
+ predefined Image attribute includes the name of the specific type
+ (and a "'" character, to follow qualified expression syntax) to
+ indicate the tag of the value. With the introduction of mutably
+ tagged types, this case can now arise in the case of a component
+ (of either an enclosing array or an enclosing record), not just
+ for a top-level object. So we factor the code to do this into a
+ new procedure, Put_Specific_Type_Name_Qualifier, so that it can be
+ called from more than one place. This reorganization also involves
+ replacing the procedure Put_String_Exp with a new procedure,
+ Put_String_Exp_To_Buffer, declared in a less nested scope. For
+ mutably tagged components (at the source level) the component type
+ (at the GNAT tree level) is an array of bytes (actually a two
+ field record containing an array of bytes, but that's a detail).
+ Appropriate conversions need to be generated so that we don't end
+ up generating an image for an array of bytes; this is done at the
+ same places where Put_Specific_Type_Name_Qualifier is called
+ (for components) by calling Make_Mutably_Tagged_Conversion.
+ * exp_strm.adb (Make_Field_Attribute): Add
+ Make_Mutably_Tagged_Conversion call where we construct a
+ Selected_Component node and the corresponding component type is
+ the internal representation type for a mutably tagged type.
+ (Stream_Base_Type): Return the mutably
+ tagged type if given the corresponding internal representation type.
+ * sem_ch3.adb (Array_Type_Declaration): In the case where the
+ source-level component type of an array type is mutably tagged,
+ set the Component_Type field of the base type of the declared
+ array type (as opposed to that of the first subtype of the array
+ type) to the corresponding internal representation type.
+ * sem_ch4.adb (Analyze_Selected_Component): In the case of a
+ selected component name which references a component whose type is
+ the internal representation type of a mutably tagged type,
+ generate a conversion to the mutably tagged type.
+
2025-07-21 Eric Botcazou <ebotcazou@gcc.gnu.org>
PR ada/121184
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8ed1113..0d8dbc4 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3504,10 +3504,9 @@ sparc*-*-solaris2*)
sparc64-*-* | sparcv9-*-*)
tm_file="sparc/default64.h ${tm_file}"
;;
- *)
- test x$with_cpu != x || with_cpu=v9
- ;;
esac
+ # Match Studio 12.6 cc.
+ with_cpu=${with_cpu:-ultrasparc3}
tmake_file="${tmake_file} sparc/t-sparc sparc/t-sol2"
;;
sparc-wrs-vxworks)
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 72a691b..9e4a37b 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -17976,6 +17976,7 @@ aarch64_vector_costs::add_stmt_cost (int count, vect_cost_for_stmt kind,
/* Check if we've seen an SVE gather/scatter operation and which size. */
if (kind == scalar_load
+ && vectype
&& aarch64_sve_mode_p (TYPE_MODE (vectype))
&& vect_mem_access_type (stmt_info, node) == VMAT_GATHER_SCATTER)
{
diff --git a/gcc/config/riscv/generic-vector-ooo.md b/gcc/config/riscv/generic-vector-ooo.md
index ab9e57f..773003b 100644
--- a/gcc/config/riscv/generic-vector-ooo.md
+++ b/gcc/config/riscv/generic-vector-ooo.md
@@ -17,6 +17,9 @@
;; <http://www.gnu.org/licenses/>.
;; Vector load/store
+;; The insn reservations include "generic" as we won't have a in-order
+;; generic definition for vector instructions.
+
(define_automaton "vector_ooo")
;; Separate issue queue for vector instructions.
@@ -29,119 +32,141 @@
(define_cpu_unit "vxu_ooo_multicycle" "vector_ooo")
(define_insn_reservation "vec_load" 6
- (eq_attr "type" "vlde,vldm,vlds,vldux,vldox,vldff,vldr")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vlde,vldm,vlds,vldux,vldox,vldff,vldr"))
"vxu_ooo_issue,vxu_ooo_alu")
(define_insn_reservation "vec_store" 6
- (eq_attr "type" "vste,vstm,vsts,vstux,vstox,vstr")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vste,vstm,vsts,vstux,vstox,vstr"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector segment loads/stores.
(define_insn_reservation "vec_loadstore_seg" 10
- (eq_attr "type" "vlsegde,vlsegds,vlsegdux,vlsegdox,vlsegdff,\
- vssegte,vssegts,vssegtux,vssegtox")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vlsegde,vlsegds,vlsegdux,vlsegdox,vlsegdff,\
+ vssegte,vssegts,vssegtux,vssegtox"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Regular vector operations and integer comparisons.
(define_insn_reservation "vec_alu" 3
- (eq_attr "type" "vialu,viwalu,vext,vicalu,vshift,vnshift,viminmax,vicmp,\
- vimov,vsalu,vaalu,vsshift,vnclip,vmov,vfmov,vector,\
- vandn,vbrev,vbrev8,vrev8,vclz,vctz,vrol,vror,vwsll")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vialu,viwalu,vext,vicalu,vshift,vnshift,viminmax,vicmp,\
+ vimov,vsalu,vaalu,vsshift,vnclip,vmov,vfmov,vector,\
+ vandn,vbrev,vbrev8,vrev8,vclz,vctz,vrol,vror,vwsll"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector float comparison, conversion etc.
(define_insn_reservation "vec_fcmp" 3
- (eq_attr "type" "vfrecp,vfminmax,vfcmp,vfsgnj,vfclass,vfcvtitof,\
- vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,vfncvtitof,\
- vfncvtftoi,vfncvtftof,vfncvtbf16,vfwcvtbf16")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vfrecp,vfminmax,vfcmp,vfsgnj,vfclass,vfcvtitof,\
+ vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,vfncvtitof,\
+ vfncvtftoi,vfncvtftof,vfncvtbf16,vfwcvtbf16"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector integer multiplication.
(define_insn_reservation "vec_imul" 4
- (eq_attr "type" "vimul,viwmul,vimuladd,viwmuladd,vsmul,vclmul,vclmulh,\
- vghsh,vgmul")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vimul,viwmul,vimuladd,viwmuladd,vsmul,vclmul,vclmulh,\
+ vghsh,vgmul"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector float addition.
(define_insn_reservation "vec_fadd" 4
- (eq_attr "type" "vfalu,vfwalu")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vfalu,vfwalu"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector float multiplication and FMA.
(define_insn_reservation "vec_fmul" 6
- (eq_attr "type" "vfmul,vfwmul,vfmuladd,vfwmuladd,vfwmaccbf16,sf_vqmacc,sf_vfnrclip")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vfmul,vfwmul,vfmuladd,vfwmuladd,vfwmaccbf16,sf_vqmacc,sf_vfnrclip"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector crypto, assumed to be a generic operation for now.
(define_insn_reservation "vec_crypto" 4
- (eq_attr "type" "crypto,vclz,vctz,vcpop")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "crypto,vclz,vctz,vcpop"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector crypto, AES
(define_insn_reservation "vec_crypto_aes" 4
- (eq_attr "type" "vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,vaesz")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,vaesz"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector crypto, sha
(define_insn_reservation "vec_crypto_sha" 4
- (eq_attr "type" "vsha2ms,vsha2ch,vsha2cl")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vsha2ms,vsha2ch,vsha2cl"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector crypto, SM3/4
(define_insn_reservation "vec_crypto_sm" 4
- (eq_attr "type" "vsm4k,vsm4r,vsm3me,vsm3c")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vsm4k,vsm4r,vsm3me,vsm3c"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector permute.
(define_insn_reservation "vec_perm" 3
- (eq_attr "type" "vimerge,vfmerge,vslideup,vslidedown,vislide1up,\
- vislide1down,vfslide1up,vfslide1down,vgather,vcompress")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vimerge,vfmerge,vslideup,vslidedown,vislide1up,\
+ vislide1down,vfslide1up,vfslide1down,vgather,vcompress"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector reduction.
(define_insn_reservation "vec_reduction" 8
- (eq_attr "type" "vired,viwred,vfredu,vfwredu")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vired,viwred,vfredu,vfwredu"))
"vxu_ooo_issue,vxu_ooo_multicycle")
;; Vector ordered reduction, assume the latency number is for
;; a 128-bit vector. It is scaled in riscv_sched_adjust_cost
;; for larger vectors.
(define_insn_reservation "vec_ordered_reduction" 10
- (eq_attr "type" "vfredo,vfwredo")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vfredo,vfwredo"))
"vxu_ooo_issue,vxu_ooo_multicycle*3")
;; Vector integer division, assume not pipelined.
(define_insn_reservation "vec_idiv" 16
- (eq_attr "type" "vidiv")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vidiv"))
"vxu_ooo_issue,vxu_ooo_multicycle*3")
;; Vector float divisions and sqrt, assume not pipelined.
(define_insn_reservation "vec_float_divsqrt" 16
- (eq_attr "type" "vfdiv,vfsqrt")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vfdiv,vfsqrt"))
"vxu_ooo_issue,vxu_ooo_multicycle*3")
;; Vector mask operations.
(define_insn_reservation "vec_mask" 2
- (eq_attr "type" "vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovvx,vimovxv,\
- vfmovvf,vfmovfv")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovvx,vimovxv,\
+ vfmovvf,vfmovfv"))
"vxu_ooo_issue,vxu_ooo_alu")
;; Vector vsetvl.
(define_insn_reservation "vec_vesetvl" 1
- (eq_attr "type" "vsetvl,vsetvl_pre")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "vsetvl,vsetvl_pre"))
"vxu_ooo_issue")
;; Vector rounding mode setters, assume pipeline barrier.
(define_insn_reservation "vec_setrm" 20
- (eq_attr "type" "wrvxrm,wrfrm")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "wrvxrm,wrfrm"))
"vxu_ooo_issue,vxu_ooo_issue*3")
;; Vector read vlen/vlenb.
(define_insn_reservation "vec_readlen" 4
- (eq_attr "type" "rdvlenb,rdvl")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "rdvlenb,rdvl"))
"vxu_ooo_issue,vxu_ooo_issue")
;; Vector sf_vcp.
(define_insn_reservation "vec_sf_vcp" 2
- (eq_attr "type" "sf_vc,sf_vc_se")
+ (and (eq_attr "tune" "generic_ooo,generic")
+ (eq_attr "type" "sf_vc,sf_vc_se"))
"vxu_ooo_issue")
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index b75cec1..02554c5 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -601,8 +601,8 @@ constantpool_address_p (const_rtx addr)
/* Make sure the address is word aligned. */
offset = XEXP (addr, 1);
- if ((!CONST_INT_P (offset))
- || ((INTVAL (offset) & 3) != 0))
+ if (! CONST_INT_P (offset)
+ || (INTVAL (offset) & 3) != 0)
return false;
sym = XEXP (addr, 0);
@@ -611,6 +611,7 @@ constantpool_address_p (const_rtx addr)
if (SYMBOL_REF_P (sym)
&& CONSTANT_POOL_ADDRESS_P (sym))
return true;
+
return false;
}
@@ -4694,29 +4695,32 @@ xtensa_rtx_costs (rtx x, machine_mode mode, int outer_code,
}
}
+/* Return TRUE if the specified insn corresponds to one or more L32R machine
+ instructions. */
+
static bool
xtensa_is_insn_L32R_p (const rtx_insn *insn)
{
- rtx x = PATTERN (insn);
+ rtx pat, dest, src;
- if (GET_CODE (x) != SET)
+ /* "PATTERN (insn)" can be used without checking, see insn_cost()
+ in gcc/rtlanal.cc. */
+ if (GET_CODE (pat = PATTERN (insn)) != SET
+ || ! register_operand (dest = SET_DEST (pat), VOIDmode))
return false;
- x = XEXP (x, 1);
- if (MEM_P (x))
- {
- x = XEXP (x, 0);
- return (SYMBOL_REF_P (x) || CONST_INT_P (x))
- && CONSTANT_POOL_ADDRESS_P (x);
- }
-
- /* relaxed MOVI instructions, that will be converted to L32R by the
- assembler. */
- if (CONST_INT_P (x)
- && ! xtensa_simm12b (INTVAL (x)))
+ if (constantpool_mem_p (src = SET_SRC (pat)))
return true;
- return false;
+ /* Return true if:
+ - CONST16 instruction is not configured, and
+ - the source is some constant, and also
+ - negation of "the source is integer and fits into the immediate
+ field". */
+ return (!TARGET_CONST16
+ && CONSTANT_P (src)
+ && ! ((GET_MODE (dest) == SImode || GET_MODE (dest) == HImode)
+ && CONST_INT_P (src) && xtensa_simm12b (INTVAL (src))));
}
/* Compute a relative costs of RTL insns. This is necessary in order to
@@ -4725,7 +4729,7 @@ xtensa_is_insn_L32R_p (const rtx_insn *insn)
static int
xtensa_insn_cost (rtx_insn *insn, bool speed)
{
- if (!(recog_memoized (insn) < 0))
+ if (! (recog_memoized (insn) < 0))
{
int len = get_attr_length (insn);
@@ -4738,7 +4742,7 @@ xtensa_insn_cost (rtx_insn *insn, bool speed)
/* "L32R" may be particular slow (implementation-dependent). */
if (xtensa_is_insn_L32R_p (insn))
- return COSTS_N_INSNS (1 + xtensa_extra_l32r_costs);
+ return COSTS_N_INSNS ((1 + xtensa_extra_l32r_costs) * n);
/* Cost based on the pipeline model. */
switch (get_attr_type (insn))
@@ -4783,7 +4787,7 @@ xtensa_insn_cost (rtx_insn *insn, bool speed)
{
/* "L32R" itself plus constant in litpool. */
if (xtensa_is_insn_L32R_p (insn))
- len = 3 + 4;
+ len += (len / 3) * 4;
/* Consider fractional instruction length (for example, ".n"
short instructions or "L32R" litpool constants. */
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 029be99..629dfdd 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -1297,7 +1297,10 @@
std::swap (operands[0], operands[1]);
std::swap (operands[2], operands[3]);
}
-})
+}
+ [(set_attr "type" "move,move,load,load,store")
+ (set_attr "mode" "DI")
+ (set_attr "length" "6,12,6,6,6")])
(define_split
[(set (match_operand:DI 0 "register_operand")
@@ -1344,7 +1347,7 @@
%v0s32i\t%1, %0
rsr\t%0, ACCLO
wsr\t%1, ACCLO"
- [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,move,load,load,store,rsr,wsr")
+ [(set_attr "type" "move,move,move,load,store,store,move,move,move,load,move,load,load,store,rsr,wsr")
(set_attr "mode" "SI")
(set_attr "length" "2,2,2,2,2,2,3,3,3,3,6,3,3,3,3,3")])
@@ -1410,7 +1413,7 @@
%v0s16i\t%1, %0
rsr\t%0, ACCLO
wsr\t%1, ACCLO"
- [(set_attr "type" "move,move,move,move,move,load,load,store,rsr,wsr")
+ [(set_attr "type" "move,move,move,move,load,load,load,store,rsr,wsr")
(set_attr "mode" "HI")
(set_attr "length" "2,2,3,3,3,3,3,3,3,3")])
@@ -1519,7 +1522,7 @@
const16\t%0, %t1\;const16\t%0, %b1
%v1l32i\t%0, %1
%v0s32i\t%1, %0"
- [(set_attr "type" "farith,fload,fstore,move,load,load,store,move,farith,farith,move,move,load,store")
+ [(set_attr "type" "farith,fload,fstore,move,load,load,store,move,farith,farith,load,move,load,store")
(set_attr "mode" "SF")
(set_attr "length" "3,3,3,2,3,2,2,3,3,3,3,6,3,3")])
@@ -1643,7 +1646,10 @@
std::swap (operands[0], operands[1]);
std::swap (operands[2], operands[3]);
}
-})
+}
+ [(set_attr "type" "move,load,move,load,load,store")
+ (set_attr "mode" "DF")
+ (set_attr "length" "6,6,12,6,6,6")])
;; Block moves
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a2c1271..76d21f1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2025-07-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/121068
+ * constexpr.cc (cxx_eval_store_expression): Allow ARRAY_REFs
+ when activating an array member of a union.
+
2025-07-21 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
* semantics.cc (finish_asm_stmt): Pass null pointer to
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index 37ad0a9..c925dd1 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -7536,7 +7536,9 @@ build_new_op (const op_location_t &loc, enum tree_code code, int flags,
if (cand->rewritten ())
{
/* FIXME build_min_non_dep_op_overload can't handle rewrites. */
- if (overload)
+ if (code == NE_EXPR && !cand->reversed ())
+ /* It can handle != rewritten to == though. */;
+ else if (overload)
*overload = NULL_TREE;
switch (code)
{
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index ee06858..1a77954 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -7736,13 +7736,24 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (*valp), first, NULL_TREE);
/* Check for implicit change of active member for a union. */
+
+ /* LWG3436, CWG2675, c++/121068: The array object model is confused. For
+ now allow initializing an array element to activate the array. */
+ auto only_array_refs = [](const releasing_vec &refs)
+ {
+ for (unsigned i = 1; i < refs->length(); i += 3)
+ if (TREE_CODE ((*refs)[i]) != INTEGER_CST)
+ return false;
+ return true;
+ };
+
if (code == UNION_TYPE
&& (CONSTRUCTOR_NELTS (*valp) == 0
|| CONSTRUCTOR_ELT (*valp, 0)->index != index)
/* An INIT_EXPR of the last member in an access chain is always OK,
but still check implicit change of members earlier on; see
cpp2a/constexpr-union6.C. */
- && !(TREE_CODE (t) == INIT_EXPR && refs->is_empty ()))
+ && !(TREE_CODE (t) == INIT_EXPR && only_array_refs (refs)))
{
bool has_active_member = CONSTRUCTOR_NELTS (*valp) != 0;
tree inner = strip_array_types (reftype);
diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc
index a4089c5..334c325 100644
--- a/gcc/cp/method.cc
+++ b/gcc/cp/method.cc
@@ -2036,10 +2036,11 @@ build_invoke (tree fn_type, const_tree arg_types, tsubst_flags_t complain)
const_tree name = DECL_NAME (datum_decl);
if (name && (id_equal (name, "reference_wrapper")))
{
- /* 1.2 & 1.5: Retrieve T from std::reference_wrapper<T>,
+ /* 1.2 & 1.5: Retrieve T& from std::reference_wrapper<T>,
i.e., decltype(datum.get()). */
datum_type =
TREE_VEC_ELT (TYPE_TI_ARGS (non_ref_datum_type), 0);
+ datum_type = cp_build_reference_type (datum_type, false);
datum_is_refwrap = true;
}
}
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index a7b8908..c260efb 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -3696,6 +3696,7 @@ build_min_non_dep_op_overload (enum tree_code op,
int nargs, expected_nargs;
tree fn, call, obj = NULL_TREE;
+ bool negated = (TREE_CODE (non_dep) == TRUTH_NOT_EXPR);
non_dep = extract_call_expr (non_dep);
nargs = call_expr_nargs (non_dep);
@@ -3753,6 +3754,8 @@ build_min_non_dep_op_overload (enum tree_code op,
CALL_EXPR_ORDERED_ARGS (call_expr) = CALL_EXPR_ORDERED_ARGS (non_dep);
CALL_EXPR_REVERSE_ARGS (call_expr) = CALL_EXPR_REVERSE_ARGS (non_dep);
+ if (negated)
+ call = build_min (TRUTH_NOT_EXPR, boolean_type_node, call);
if (obj)
return keep_unused_object_arg (call, obj, overload);
return call;
diff --git a/gcc/expr.cc b/gcc/expr.cc
index ac4fdfa..3f2b121 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -13206,6 +13206,8 @@ constant_byte_string (tree arg, tree *ptr_offset, tree *mem_size, tree *decl,
of the expected type and size. */
if (!initsize)
initsize = integer_zero_node;
+ else if (!tree_fits_uhwi_p (initsize))
+ return NULL_TREE;
unsigned HOST_WIDE_INT size = tree_to_uhwi (initsize);
if (size > (unsigned HOST_WIDE_INT) INT_MAX)
diff --git a/gcc/genpreds.cc b/gcc/genpreds.cc
index c6a2983..4f8beeb 100644
--- a/gcc/genpreds.cc
+++ b/gcc/genpreds.cc
@@ -1184,7 +1184,12 @@ write_insn_constraint_len (void)
puts (" default: break;\n"
" }\n"
" if (str[0] == '{')\n"
- " return ((const char *) rawmemchr (str + 1, '}') - str) + 1;\n"
+ " {\n"
+ " size_t len = 1;\n"
+ " while (str[len] != '}' && str[len] != '\\0')\n"
+ " ++len;\n"
+ " return len + 1;\n"
+ " }\n"
" return 1;\n"
"}\n");
}
diff --git a/gcc/m2/gm2-compiler/P1SymBuild.mod b/gcc/m2/gm2-compiler/P1SymBuild.mod
index 02d4ac7..08a0fc3 100644
--- a/gcc/m2/gm2-compiler/P1SymBuild.mod
+++ b/gcc/m2/gm2-compiler/P1SymBuild.mod
@@ -79,7 +79,6 @@ FROM SymbolTable IMPORT NulSym,
MakeSubscript, PutSubscript,
PutArray, GetType, IsArray,
IsProcType, MakeProcType,
- PutProcTypeVarParam, PutProcTypeParam,
PutProcedureBuiltin, PutProcedureInline,
GetSymName,
ResolveImports, PutDeclared,
@@ -109,42 +108,6 @@ VAR
(*
- CheckFileName - checks to see that the module name matches the file name.
-*)
-
-(*
-PROCEDURE CheckFileName (tok: CARDINAL; name: Name; ModuleType: ARRAY OF CHAR) ;
-VAR
- ext,
- basename: INTEGER ;
- s,
- FileName: String ;
-BEGIN
- FileName := GetFileName() ;
- basename := RIndex(FileName, '/', 0) ;
- IF basename=-1
- THEN
- basename := 0
- END ;
- ext := RIndex(FileName, '.', 0) ;
- IF ext=-1
- THEN
- ext := 0
- END ;
- FileName := Slice(FileName, basename, ext) ;
- IF EqualCharStar(FileName, KeyToCharStar(name))
- THEN
- FileName := KillString(FileName)
- ELSE
- s := ConCat (InitString (ModuleType),
- Mark (InitString (" module name {%1Ea} is inconsistant with the filename {%F{%2a}}"))) ;
- MetaErrorString2 (s, MakeError (tok, name), MakeErrorS (tok, FileName))
- END
-END CheckFileName ;
-*)
-
-
-(*
StartBuildDefinitionModule - Creates a definition module and starts
a new scope.
@@ -227,7 +190,7 @@ BEGIN
END ;
IF NameStart#NameEnd
THEN
- MetaError1 ('inconsistant definition module name {%1Wa}', MakeError (start, NameStart))
+ MetaError1 ('inconsistent definition module name {%1Wa}', MakeError (start, NameStart))
END ;
LeaveBlock
END P1EndBuildDefinitionModule ;
@@ -301,7 +264,7 @@ BEGIN
IF NameStart#NameEnd
THEN
MetaErrorT1 (end,
- 'inconsistant implementation module name {%1Wa}', MakeError (start, NameStart))
+ 'inconsistent implementation module name {%1Wa}', MakeError (start, NameStart))
END ;
LeaveBlock
END P1EndBuildImplementationModule ;
@@ -381,7 +344,7 @@ BEGIN
IF NameStart#NameEnd
THEN
MetaErrorT1 (end,
- 'inconsistant program module name {%1Wa}', MakeError (start, NameStart))
+ 'inconsistent program module name {%1Wa}', MakeError (start, NameStart))
END ;
LeaveBlock
END P1EndBuildProgramModule ;
@@ -446,7 +409,7 @@ BEGIN
IF NameStart#NameEnd
THEN
MetaErrorT1 (end,
- 'inconsistant inner module name {%1Wa}', MakeError (start, NameStart))
+ 'inconsistent inner module name {%1Wa}', MakeError (start, NameStart))
END ;
LeaveBlock
END EndBuildInnerModule ;
diff --git a/gcc/m2/gm2-compiler/P2SymBuild.mod b/gcc/m2/gm2-compiler/P2SymBuild.mod
index 5c82ec8..3bb3e47 100644
--- a/gcc/m2/gm2-compiler/P2SymBuild.mod
+++ b/gcc/m2/gm2-compiler/P2SymBuild.mod
@@ -356,7 +356,7 @@ BEGIN
END ;
IF NameStart#NameEnd
THEN
- WriteFormat2('inconsistant definition module name, module began as (%a) and ended with (%a)', NameStart, NameEnd)
+ WriteFormat2('inconsistent definition module name, module began as (%a) and ended with (%a)', NameStart, NameEnd)
END ;
M2Error.LeaveErrorScope
END P2EndBuildDefModule ;
@@ -425,7 +425,7 @@ BEGIN
PopT (NameEnd) ;
IF NameStart#NameEnd
THEN
- WriteFormat1('inconsistant implementation module name %a', NameStart)
+ WriteFormat1('inconsistent implementation module name %a', NameStart)
END ;
M2Error.LeaveErrorScope
END P2EndBuildImplementationModule ;
@@ -499,7 +499,7 @@ BEGIN
END ;
IF NameStart#NameEnd
THEN
- WriteFormat2('inconsistant program module name %a does not match %a', NameStart, NameEnd)
+ WriteFormat2('inconsistent program module name %a does not match %a', NameStart, NameEnd)
END ;
M2Error.LeaveErrorScope
END P2EndBuildProgramModule ;
@@ -564,7 +564,7 @@ BEGIN
PopT(NameEnd) ;
IF NameStart#NameEnd
THEN
- WriteFormat2('inconsistant inner module name %a does not match %a',
+ WriteFormat2('inconsistent inner module name %a does not match %a',
NameStart, NameEnd)
END ;
M2Error.LeaveErrorScope
@@ -1835,13 +1835,13 @@ BEGIN
(* WarnStringAt (InitString ('parampos?'), OperandTok (pi)) ; *)
IF Unbounded AND (NOT IsUnboundedParam (ProcSym, prevkind, ParamTotal+i))
THEN
- ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistant, %s',
+ ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistent, %s',
'the parameter {%3EHa} was not declared as an ARRAY OF type',
'the parameter {%3EVa} was declared as an ARRAY OF type',
ParamTotal+i, ProcSym, curkind, prevkind)
ELSIF (NOT Unbounded) AND IsUnboundedParam (ProcSym, prevkind, ParamTotal+i)
THEN
- ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistant, %s',
+ ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistent, %s',
'the parameter {%3EHa} was declared as an ARRAY OF type',
'the parameter {%3EVa} was not declared as an ARRAY OF type',
ParamTotal+i, ProcSym, curkind, prevkind)
@@ -1850,7 +1850,7 @@ BEGIN
THEN
IF GetDimension (GetNthParam (ProcSym, prevkind, ParamTotal+1)) # ndim
THEN
- ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistant, %s',
+ ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistent, %s',
'the dynamic array parameter {%3EHa} was declared with a different of dimensions',
'the dynamic array parameter {%3EVa} was declared with a different of dimensions',
ParamTotal+i, ProcSym, curkind, prevkind)
@@ -1859,14 +1859,14 @@ BEGIN
IF isVarParam AND (NOT IsVarParam (ProcSym, prevkind, ParamTotal+i))
THEN
(* Expecting non VAR parameter. *)
- ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistant, %s',
+ ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistent, %s',
'{%3EHa} was not declared as a {%kVAR} parameter',
'{%3EVa} was declared as a {%kVAR} parameter',
ParamTotal+i, ProcSym, curkind, prevkind)
ELSIF (NOT isVarParam) AND IsVarParam (ProcSym, prevkind, ParamTotal+i)
THEN
(* Expecting VAR pamarater. *)
- ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistant, %s',
+ ParameterError ('declaration of procedure {%%1a} in the %s differs from the %s, {%%2N} parameter is inconsistent, %s',
'{%3EHa} was declared as a {%kVAR} parameter',
'{%3EVa} was not declared as a {%kVAR} parameter',
ParamTotal+i, ProcSym, curkind, prevkind)
@@ -1877,7 +1877,7 @@ BEGIN
IF GetSymName (ParamI) # OperandT (pi)
THEN
(* Different parameter names. *)
- ParameterError ('procedure {%%1a} in the %s differs from the %s, {%%2N} parameter name is inconsistant, %s',
+ ParameterError ('procedure {%%1a} in the %s differs from the %s, {%%2N} parameter name is inconsistent, %s',
'named as {%3EVa}',
'named as {%3EVa}',
ParamTotal+i, ProcSym, curkind, prevkind)
@@ -1897,7 +1897,7 @@ BEGIN
(NOT IsUnknown(SkipType(ParamIType)))
THEN
(* Different parameter types. *)
- ParameterError ('declaration in the %s differs from the %s, {%%2N} parameter is inconsistant, %s',
+ ParameterError ('declaration in the %s differs from the %s, {%%2N} parameter is inconsistent, %s',
'the parameter {%3EHa} was declared with a different type',
'the parameter {%3EVa} was declared with a different type',
ParamTotal+i, ProcSym, curkind, prevkind)
@@ -3072,10 +3072,10 @@ BEGIN
IF Var=VarTok
THEN
(* VAR parameter *)
- PutProcTypeVarParam(ProcTypeSym, TypeSym, IsUnbounded(TypeSym))
+ PutProcTypeVarParam (tok, ProcTypeSym, TypeSym, IsUnbounded (TypeSym))
ELSE
(* Non VAR parameter *)
- PutProcTypeParam(ProcTypeSym, TypeSym, IsUnbounded(TypeSym))
+ PutProcTypeParam (tok, ProcTypeSym, TypeSym, IsUnbounded (TypeSym))
END ;
PushT(ProcTypeSym) ;
Annotate("%1s(%1d)||proc type")
diff --git a/gcc/m2/gm2-compiler/P3SymBuild.mod b/gcc/m2/gm2-compiler/P3SymBuild.mod
index c4877f7..096057e 100644
--- a/gcc/m2/gm2-compiler/P3SymBuild.mod
+++ b/gcc/m2/gm2-compiler/P3SymBuild.mod
@@ -126,7 +126,7 @@ BEGIN
PopT(NameStart) ;
IF NameStart#NameEnd
THEN
- WriteFormat2('inconsistant definition module was named (%a) and concluded as (%a)',
+ WriteFormat2('inconsistent definition module was named (%a) and concluded as (%a)',
NameStart, NameEnd)
END ;
M2Error.LeaveErrorScope
diff --git a/gcc/m2/gm2-compiler/PCSymBuild.mod b/gcc/m2/gm2-compiler/PCSymBuild.mod
index 3bffe86..4db2730 100644
--- a/gcc/m2/gm2-compiler/PCSymBuild.mod
+++ b/gcc/m2/gm2-compiler/PCSymBuild.mod
@@ -269,7 +269,7 @@ BEGIN
PopT(NameStart) ;
IF NameStart#NameEnd
THEN
- WriteFormat2('inconsistant definition module was named (%a) and concluded as (%a)',
+ WriteFormat2('inconsistent definition module was named (%a) and concluded as (%a)',
NameStart, NameEnd)
END ;
M2Error.LeaveErrorScope
@@ -1168,9 +1168,9 @@ BEGIN
par := GetParam (p, i) ;
IF IsParameterVar (par)
THEN
- PutProcTypeVarParam (t, GetType (par), IsParameterUnbounded (par))
+ PutProcTypeVarParam (tok, t, GetType (par), IsParameterUnbounded (par))
ELSE
- PutProcTypeParam (t, GetType (par), IsParameterUnbounded (par))
+ PutProcTypeParam (tok, t, GetType (par), IsParameterUnbounded (par))
END ;
INC(i)
END ;
diff --git a/gcc/m2/gm2-compiler/SymbolTable.def b/gcc/m2/gm2-compiler/SymbolTable.def
index 2a9865a..5b93f29 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.def
+++ b/gcc/m2/gm2-compiler/SymbolTable.def
@@ -2650,7 +2650,8 @@ PROCEDURE MakeProcType (tok: CARDINAL; ProcTypeName: Name) : CARDINAL ;
ParamType into ProcType Sym.
*)
-PROCEDURE PutProcTypeParam (Sym: CARDINAL;
+PROCEDURE PutProcTypeParam (tok: CARDINAL;
+ Sym: CARDINAL;
ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
@@ -2659,7 +2660,8 @@ PROCEDURE PutProcTypeParam (Sym: CARDINAL;
ParamType into ProcType Sym.
*)
-PROCEDURE PutProcTypeVarParam (Sym: CARDINAL;
+PROCEDURE PutProcTypeVarParam (tok: CARDINAL;
+ Sym: CARDINAL;
ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod b/gcc/m2/gm2-compiler/SymbolTable.mod
index ff661dc..00946e5 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.mod
+++ b/gcc/m2/gm2-compiler/SymbolTable.mod
@@ -463,9 +463,11 @@ TYPE
(* of param. *)
Type : CARDINAL ; (* Index to the type of param. *)
IsUnbounded : BOOLEAN ; (* Is it an ARRAY OF Type? *)
+ Scope : CARDINAL ; (* Procedure declaration. *)
ShadowVar : CARDINAL ; (* The local variable used to *)
(* shadow this parameter. *)
- At : Where ; (* Where was sym declared/used *)
+ FullTok, (* name: type virtual token. *)
+ At : CARDINAL ; (* Where was sym declared. *)
END ;
SymVarParam = RECORD
@@ -476,9 +478,11 @@ TYPE
HeapVar : CARDINAL ;(* The pointer value on heap. *)
(* Only used by static *)
(* analysis. *)
+ Scope : CARDINAL ;(* Procedure declaration. *)
ShadowVar : CARDINAL ;(* The local variable used to *)
(* shadow this parameter. *)
- At : Where ; (* Where was sym declared/used *)
+ FullTok, (* name: type virtual token. *)
+ At : CARDINAL ;(* Where was sym declared. *)
END ;
ConstStringVariant = (m2str, cstr, m2nulstr, cnulstr) ;
@@ -4456,9 +4460,19 @@ BEGIN
pSym := GetPsym (sym) ;
IF IsParameterVar (sym)
THEN
- RETURN GetVarDeclTok (pSym^.VarParam.ShadowVar)
+ IF pSym^.VarParam.ShadowVar = NulSym
+ THEN
+ RETURN pSym^.VarParam.At
+ ELSE
+ RETURN GetVarDeclTok (pSym^.VarParam.ShadowVar)
+ END
ELSE
- RETURN GetVarDeclTok (pSym^.Param.ShadowVar)
+ IF pSym^.Param.ShadowVar = NulSym
+ THEN
+ RETURN pSym^.Param.At
+ ELSE
+ RETURN GetVarDeclTok (pSym^.Param.ShadowVar)
+ END
END
ELSIF IsVar (sym)
THEN
@@ -4549,9 +4563,9 @@ BEGIN
THEN
IF IsParameterVar (sym)
THEN
- RETURN GetVarDeclFullTok (pSym^.VarParam.ShadowVar)
+ RETURN pSym^.VarParam.FullTok
ELSE
- RETURN GetVarDeclFullTok (pSym^.Param.ShadowVar)
+ RETURN pSym^.Param.FullTok
END
ELSIF IsVar (sym)
THEN
@@ -10651,8 +10665,10 @@ BEGIN
name := ParamName ;
Type := ParamType ;
IsUnbounded := isUnbounded ;
+ Scope := Sym ;
ShadowVar := NulSym ;
- InitWhereDeclaredTok(tok, At)
+ FullTok := MakeVirtual2Tok (tok, typetok) ;
+ At := tok
END
END ;
AddParameter (Sym, kind, ParSym) ;
@@ -10671,7 +10687,7 @@ BEGIN
pSym^.Param.ShadowVar := VariableSym
END
END ;
- AddProcedureProcTypeParam (Sym, ParamType, isUnbounded, FALSE)
+ AddProcedureProcTypeParam (tok, Sym, ParamType, isUnbounded, FALSE)
END ;
RETURN( TRUE )
END PutParam ;
@@ -10708,9 +10724,11 @@ BEGIN
name := ParamName ;
Type := ParamType ;
IsUnbounded := isUnbounded ;
+ Scope := Sym ;
ShadowVar := NulSym ;
HeapVar := NulSym ; (* Will contain a pointer value. *)
- InitWhereDeclaredTok(tok, At)
+ FullTok := MakeVirtual2Tok (tok, typetok) ;
+ At := tok
END
END ;
AddParameter (Sym, kind, ParSym) ;
@@ -10729,7 +10747,7 @@ BEGIN
pSym^.VarParam.ShadowVar := VariableSym
END
END ;
- AddProcedureProcTypeParam (Sym, ParamType, isUnbounded, TRUE)
+ AddProcedureProcTypeParam (tok, Sym, ParamType, isUnbounded, TRUE)
END ;
RETURN( TRUE )
END PutVarParam ;
@@ -10816,7 +10834,8 @@ END AddParameter ;
associated with procedure Sym.
*)
-PROCEDURE AddProcedureProcTypeParam (Sym, ParamType: CARDINAL;
+PROCEDURE AddProcedureProcTypeParam (tok: CARDINAL;
+ Sym, ParamType: CARDINAL;
isUnbounded, isVarParam: BOOLEAN) ;
VAR
pSym: PtrToSymbol ;
@@ -10829,10 +10848,12 @@ BEGIN
THEN
IF isVarParam
THEN
- PutProcTypeVarParam (Procedure.ProcedureType,
+ PutProcTypeVarParam (tok,
+ Procedure.ProcedureType,
ParamType, isUnbounded)
ELSE
- PutProcTypeParam (Procedure.ProcedureType,
+ PutProcTypeParam (tok,
+ Procedure.ProcedureType,
ParamType, isUnbounded)
END
END
@@ -13027,18 +13048,8 @@ BEGIN
ConstLitSym : RETURN( ConstLit.Scope ) |
ConstStringSym : RETURN( ConstString.Scope ) |
ConstVarSym : RETURN( ConstVar.Scope ) |
- ParamSym : IF Param.ShadowVar = NulSym
- THEN
- RETURN NulSym
- ELSE
- RETURN( GetScope (Param.ShadowVar) )
- END |
- VarParamSym : IF VarParam.ShadowVar = NulSym
- THEN
- RETURN NulSym
- ELSE
- RETURN( GetScope (VarParam.ShadowVar) )
- END |
+ ParamSym : RETURN( Param.Scope ) |
+ VarParamSym : RETURN( VarParam.Scope ) |
UndefinedSym : RETURN( NulSym ) |
PartialUnboundedSym: InternalError ('should not be requesting the scope of a PartialUnbounded symbol')
@@ -13186,7 +13197,8 @@ END MakeProcType ;
ParamType into ProcType Sym.
*)
-PROCEDURE PutProcTypeParam (Sym: CARDINAL;
+PROCEDURE PutProcTypeParam (tok: CARDINAL;
+ Sym: CARDINAL;
ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
VAR
pSym : PtrToSymbol ;
@@ -13201,7 +13213,8 @@ BEGIN
Type := ParamType ;
IsUnbounded := isUnbounded ;
ShadowVar := NulSym ;
- InitWhereDeclared(At)
+ FullTok := tok ;
+ At := tok
END
END ;
AddParameter (Sym, ProperProcedure, ParSym)
@@ -13213,7 +13226,8 @@ END PutProcTypeParam ;
ParamType into ProcType Sym.
*)
-PROCEDURE PutProcTypeVarParam (Sym: CARDINAL;
+PROCEDURE PutProcTypeVarParam (tok: CARDINAL;
+ Sym: CARDINAL;
ParamType: CARDINAL; isUnbounded: BOOLEAN) ;
VAR
pSym : PtrToSymbol ;
@@ -13228,7 +13242,8 @@ BEGIN
Type := ParamType ;
IsUnbounded := isUnbounded ;
ShadowVar := NulSym ;
- InitWhereDeclared(At)
+ FullTok := tok ;
+ At := tok
END
END ;
AddParameter (Sym, ProperProcedure, ParSym)
@@ -13918,8 +13933,8 @@ BEGIN
UnboundedSym : RETURN( Unbounded.At.DefDeclared ) |
ProcedureSym : RETURN( Procedure.At.DefDeclared ) |
ProcTypeSym : RETURN( ProcType.At.DefDeclared ) |
- ParamSym : RETURN( Param.At.DefDeclared ) |
- VarParamSym : RETURN( VarParam.At.DefDeclared ) |
+ ParamSym : RETURN( Param.At ) |
+ VarParamSym : RETURN( VarParam.At ) |
ConstStringSym : RETURN( ConstString.At.DefDeclared ) |
ConstLitSym : RETURN( ConstLit.At.DefDeclared ) |
ConstVarSym : RETURN( ConstVar.At.DefDeclared ) |
@@ -13968,8 +13983,8 @@ BEGIN
UnboundedSym : RETURN( Unbounded.At.ModDeclared ) |
ProcedureSym : RETURN( Procedure.At.ModDeclared ) |
ProcTypeSym : RETURN( ProcType.At.ModDeclared ) |
- ParamSym : RETURN( Param.At.ModDeclared ) |
- VarParamSym : RETURN( VarParam.At.ModDeclared ) |
+ ParamSym : RETURN( Param.At ) |
+ VarParamSym : RETURN( VarParam.At ) |
ConstStringSym : RETURN( ConstString.At.ModDeclared ) |
ConstLitSym : RETURN( ConstLit.At.ModDeclared ) |
ConstVarSym : RETURN( ConstVar.At.ModDeclared ) |
@@ -14019,8 +14034,6 @@ BEGIN
UnboundedSym : Unbounded.At.DefDeclared := tok |
ProcedureSym : Procedure.At.DefDeclared := tok |
ProcTypeSym : ProcType.At.DefDeclared := tok |
- ParamSym : Param.At.DefDeclared := tok |
- VarParamSym : VarParam.At.DefDeclared := tok |
ConstStringSym : ConstString.At.DefDeclared := tok |
ConstLitSym : ConstLit.At.DefDeclared := tok |
ConstVarSym : ConstVar.At.DefDeclared := tok |
@@ -14067,8 +14080,6 @@ BEGIN
UnboundedSym : Unbounded.At.ModDeclared := tok |
ProcedureSym : Procedure.At.ModDeclared := tok |
ProcTypeSym : ProcType.At.ModDeclared := tok |
- ParamSym : Param.At.ModDeclared := tok |
- VarParamSym : VarParam.At.ModDeclared := tok |
ConstStringSym : ConstString.At.ModDeclared := tok |
ConstLitSym : ConstLit.At.ModDeclared := tok |
ConstVarSym : ConstVar.At.ModDeclared := tok |
@@ -14323,8 +14334,10 @@ BEGIN
UnboundedSym : RETURN( Unbounded.At.FirstUsed ) |
ProcedureSym : RETURN( Procedure.At.FirstUsed ) |
ProcTypeSym : RETURN( ProcType.At.FirstUsed ) |
+ (*
ParamSym : RETURN( Param.At.FirstUsed ) |
VarParamSym : RETURN( VarParam.At.FirstUsed ) |
+ *)
ConstStringSym : RETURN( ConstString.At.FirstUsed ) |
ConstLitSym : RETURN( ConstLit.At.FirstUsed ) |
ConstVarSym : RETURN( ConstVar.At.FirstUsed ) |
diff --git a/gcc/m2/gm2-libs/M2EXCEPTION.mod b/gcc/m2/gm2-libs/M2EXCEPTION.mod
index a17310f..e92b16d 100644
--- a/gcc/m2/gm2-libs/M2EXCEPTION.mod
+++ b/gcc/m2/gm2-libs/M2EXCEPTION.mod
@@ -33,7 +33,7 @@ FROM RTExceptions IMPORT EHBlock, GetExceptionBlock, GetNumber, Raise,
(* If the program or coroutine is in the exception state then return the enumeration
value representing the exception cause. If it is not in the exception state then
- raises and exception (exException). *)
+ raises an exException exception. *)
PROCEDURE M2Exception () : M2Exceptions;
VAR
@@ -45,7 +45,8 @@ BEGIN
IF n = MAX (CARDINAL)
THEN
Raise (ORD (exException), ADR (__FILE__), __LINE__, __COLUMN__, ADR (__FUNCTION__),
- ADR ('current coroutine is not in the exceptional execution state'))
+ ADR ('current coroutine is not in the exceptional execution state')) ;
+ RETURN exException
ELSE
RETURN VAL (M2Exceptions, n)
END
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d74b461..0a07d46 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,38 @@
+2025-07-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/121068
+ * g++.dg/cpp2a/constexpr-union6.C: Expect x5 to work.
+ * g++.dg/cpp26/constexpr-new4.C: New test.
+
+2025-07-22 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/warn/Wmismatched-new-delete-5.C: Fix allocation.
+
+2025-07-22 Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR middle-end/109267
+ * lib/target-supports.exp (check_effective_target_trap): New proc.
+ * g++.dg/missing-return.C: Update testcase for the !trap case.
+ * gcc.dg/pr109267-1.c: New test.
+ * gcc.dg/pr109267-2.c: New test.
+
+2025-07-22 Karl Meakin <karl.meakin@arm.com>
+
+ * gcc.target/aarch64/sve/mask_load_2.c: Update tests.
+
+2025-07-22 Karl Meakin <karl.meakin@arm.com>
+
+ * gcc.target/aarch64/sve/mask_load_2.c: New test.
+
+2025-07-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121202
+ * gcc.dg/pr121202.c: New testcase.
+
+2025-07-22 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/slp-28.c: Adjust.
+
2025-07-21 Andrew Pinski <quic_apinski@quicinc.com>
PR tree-optimization/110949
diff --git a/gcc/testsuite/g++.dg/cpp26/constexpr-new4.C b/gcc/testsuite/g++.dg/cpp26/constexpr-new4.C
new file mode 100644
index 0000000..12d8a46
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/constexpr-new4.C
@@ -0,0 +1,21 @@
+// PR c++/121068
+// { dg-do compile { target c++26 } }
+
+constexpr void *operator new (__SIZE_TYPE__, void *p) { return p; }
+constexpr void *operator new[] (__SIZE_TYPE__, void *p) { return p; }
+
+consteval int
+foo()
+{
+ using T = int;
+ union { T arr[3]; };
+ new(arr) T[3]; // makes arr active
+ for (int i = 0; i < 3; ++i)
+ arr[i].~T();
+
+ new (arr + 2) T{10}; // A
+
+ return 1;
+};
+
+constexpr int g = foo();
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-union6.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-union6.C
index 00bda53..ab8c979 100644
--- a/gcc/testsuite/g++.dg/cpp2a/constexpr-union6.C
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-union6.C
@@ -45,9 +45,9 @@ constexpr int test5() {
union {
int data[1];
} u;
- std::construct_at(u.data, 0); // { dg-message "in .constexpr. expansion" }
+ std::construct_at(u.data, 0); // { dg-bogus "in .constexpr. expansion" }
return 0;
}
-constexpr int x5 = test5(); // { dg-message "in .constexpr. expansion" }
+constexpr int x5 = test5(); // { dg-bogus "in .constexpr. expansion" }
// { dg-error "accessing (uninitialized member|.* member instead of)" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/g++.dg/ext/is_invocable5.C b/gcc/testsuite/g++.dg/ext/is_invocable5.C
new file mode 100644
index 0000000..460eed5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_invocable5.C
@@ -0,0 +1,15 @@
+// PR c++/121055
+// { dg-do compile { target c++11 } }
+// { dg-skip-if "requires hosted libstdc++ for functional function" { ! hostedlib } }
+
+#include <functional>
+
+#define SA(X) static_assert((X),#X)
+
+struct F;
+
+SA( __is_invocable(void (F::*)() &, std::reference_wrapper<F>) );
+SA( ! __is_invocable(void (F::*)() &&, std::reference_wrapper<F>) );
+
+SA( __is_invocable(void (F::*)(int) &, std::reference_wrapper<F>, int) );
+SA( ! __is_invocable(void (F::*)(int) &&, std::reference_wrapper<F>, int) );
diff --git a/gcc/testsuite/g++.dg/lookup/operator-8.C b/gcc/testsuite/g++.dg/lookup/operator-8.C
index 64d8a97..7fe6a57 100644
--- a/gcc/testsuite/g++.dg/lookup/operator-8.C
+++ b/gcc/testsuite/g++.dg/lookup/operator-8.C
@@ -16,7 +16,8 @@ struct A {
template<class T>
void f() {
A a;
- (void)(a != 0, 0 != a); // { dg-bogus "deleted" "" { xfail *-*-* } }
+ (void)(a != 0); // We only handle this simple case, after PR121179
+ (void)(0 != a); // { dg-bogus "deleted" "" { xfail *-*-* } }
(void)(a < 0, 0 < a); // { dg-bogus "deleted" "" { xfail *-*-* } }
(void)(a <= 0, 0 <= a); // { dg-bogus "deleted" "" { xfail *-*-* } }
(void)(a > 0, 0 > a); // { dg-bogus "deleted" "" { xfail *-*-* } }
@@ -31,4 +32,10 @@ bool operator<=(A, int) = delete;
bool operator>(A, int) = delete;
bool operator>=(A, int) = delete;
+bool operator!=(int, A) = delete;
+bool operator<(int, A) = delete;
+bool operator<=(int, A) = delete;
+bool operator>(int, A) = delete;
+bool operator>=(int, A) = delete;
+
template void f<int>();
diff --git a/gcc/testsuite/g++.dg/missing-return.C b/gcc/testsuite/g++.dg/missing-return.C
index 5f8e2cc..f6934b0 100644
--- a/gcc/testsuite/g++.dg/missing-return.C
+++ b/gcc/testsuite/g++.dg/missing-return.C
@@ -5,4 +5,6 @@ int foo(int a)
{
} /* { dg-warning "no return statement" } */
-/* { dg-final { scan-tree-dump "__builtin_unreachable" "optimized" } } */
+/* For targets without traps, it will be an infinite loop */
+/* { dg-final { scan-tree-dump "__builtin_unreachable" "optimized" { target trap } } } */
+/* { dg-final { scan-tree-dump "goto <" "optimized" { target { ! trap } } } } */
diff --git a/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C
index bac2b68..a21e864 100644
--- a/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C
+++ b/gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C
@@ -31,7 +31,7 @@ void warn_placement_new ()
void warn_placement_array_new ()
{
- void *p = malloc (sizeof (int));
+ void *p = malloc (sizeof (int) * 2);
int *q = new (p) int[2];
delete q; // { dg-warning "-Wmismatched-new-delete" }
}
diff --git a/gcc/testsuite/gcc.dg/pr109267-1.c b/gcc/testsuite/gcc.dg/pr109267-1.c
new file mode 100644
index 0000000..e762e59
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr109267-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+/* PR middle-end/109267 */
+
+int f(void)
+{
+ __builtin_unreachable();
+}
+
+/* This unreachable should be changed to be a trap. */
+
+/* { dg-final { scan-tree-dump-times "__builtin_unreachable trap \\\(" 1 "optimized" { target trap } } } */
+/* { dg-final { scan-tree-dump-times "goto <" 1 "optimized" { target { ! trap } } } } */
+/* { dg-final { scan-tree-dump-not "__builtin_unreachable \\\(" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/pr109267-2.c b/gcc/testsuite/gcc.dg/pr109267-2.c
new file mode 100644
index 0000000..6cd1419
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr109267-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+/* PR middle-end/109267 */
+void g(void);
+int f(int *t)
+{
+ g();
+ __builtin_unreachable();
+}
+
+/* The unreachable should stay a unreachable. */
+/* { dg-final { scan-tree-dump-not "__builtin_unreachable trap \\\(" "optimized"} } */
+/* { dg-final { scan-tree-dump-times "__builtin_unreachable \\\(" 1 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/pr121202.c b/gcc/testsuite/gcc.dg/pr121202.c
new file mode 100644
index 0000000..30ecf4a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr121202.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-copy-prop" } */
+
+int a, b, c;
+int e(int f, int g) { return f >> g; }
+int h(int f) { return a > 1 ? 0 : f << a; }
+int main() {
+ while (c--)
+ b = e(h(1), a);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr121216.c b/gcc/testsuite/gcc.dg/pr121216.c
new file mode 100644
index 0000000..a695b40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr121216.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int foo (void)
+{
+ const char *key = "obscurelevelofabstraction";
+ const char reverse_key[__builtin_strlen(key)] = {'\0'}; /* { dg-error "variable-sized object may not be initialized except with an empty initializer" } */
+ return __builtin_strlen(reverse_key);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr119085.c b/gcc/testsuite/gcc.dg/tree-ssa/pr119085.c
new file mode 100644
index 0000000..e9811ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr119085.c
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+
+struct with_hole {
+ int x;
+ long y;
+};
+struct without_hole {
+ int x;
+ int y;
+};
+union u {
+ struct with_hole with_hole;
+ struct without_hole without_hole;
+};
+
+void __attribute__((noinline))
+test (union u *up, union u u)
+{
+ union u u2;
+ volatile int f = 0;
+ u2 = u;
+ if (f)
+ u2.with_hole = u.with_hole;
+ *up = u2;
+}
+
+int main(void)
+{
+ union u u;
+ union u u2;
+ u2.without_hole.y = -1;
+ test (&u, u2);
+ if (u.without_hole.y != -1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c
index 9ba43be..ef35b29 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c
@@ -4,6 +4,7 @@
int a, b, c, d[6], e = 3, f;
void abort (void);
+void fn1 () __attribute__((noinline));
void fn1 ()
{
for (b = 1; b < 5; b++)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-23.c
new file mode 100644
index 0000000..f632dc8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-23.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-sink1-details" } */
+
+struct S {
+ int* x;
+ int* y;
+};
+
+void __attribute__((noreturn)) bar(const struct S* s);
+
+void foo(int a, int b) {
+ struct S s;
+ s.x = &a;
+ s.y = &b;
+ if (a < b) {
+ bar(&s);
+ }
+}
+
+/* { dg-final { scan-tree-dump "Sinking.*s.y" "sink1" } } */
+/* { dg-final { scan-tree-dump "Sinking.*s.x" "sink1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr116125.c b/gcc/testsuite/gcc.dg/vect/pr116125.c
index eab9efd..1b882ec 100644
--- a/gcc/testsuite/gcc.dg/vect/pr116125.c
+++ b/gcc/testsuite/gcc.dg/vect/pr116125.c
@@ -17,12 +17,12 @@ main (void)
{
check_vect ();
- struct st a[9] = {};
+ struct st a[10] = {};
- // input a = 0, 0, 0, 0, 0, 0, 0, 0, 0
+ // input a = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
mem_overlap (&a[1], a);
- // output a = 0, 1, 2, 3, 4, 5, 6, 7, 8
+ // output a = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
if (a[2].num == 2)
return 0;
else
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_load_2.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_load_2.c
new file mode 100644
index 0000000..66d9510
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_load_2.c
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-march=armv8-a+sve -msve-vector-bits=128 -O3" }
+
+typedef struct Array {
+ int elems[3];
+} Array;
+
+int loop(Array **pp, int len, int idx) {
+ int nRet = 0;
+
+ #pragma GCC unroll 0
+ for (int i = 0; i < len; i++) {
+ Array *p = pp[i];
+ if (p) {
+ nRet += p->elems[idx];
+ }
+ }
+
+ return nRet;
+}
+
+// { dg-final { scan-assembler-times {ld1w\tz[0-9]+\.d, p[0-7]/z} 1 } }
+// { dg-final { scan-assembler-times {add\tz[0-9]+\.s, p[0-7]/m} 1 } }
diff --git a/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.def b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.def
new file mode 100644
index 0000000..a24f7d3
--- /dev/null
+++ b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.def
@@ -0,0 +1,12 @@
+DEFINITION MODULE arrayofchar ;
+
+FROM FIO IMPORT File ;
+
+(*
+ Description: provides write procedures for ARRAY OF CHAR.
+*)
+
+PROCEDURE Write (f: File; str: ARRAY OF CHAR) ;
+PROCEDURE WriteLn (f: File) ;
+
+END arrayofchar.
diff --git a/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.mod b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.mod
new file mode 100644
index 0000000..4e630a9
--- /dev/null
+++ b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.mod
@@ -0,0 +1,30 @@
+IMPLEMENTATION MODULE arrayofchar ;
+
+FROM FIO IMPORT WriteChar, WriteLine ;
+IMPORT StrLib ;
+
+
+(*
+ Write - writes a string to file f.
+*)
+
+PROCEDURE Write (f: File; a: ARRAY OF CHAR) ;
+VAR
+ len, i: CARDINAL ;
+BEGIN
+ len := StrLib.StrLen (a) ;
+ i := 0 ;
+ WHILE i < len DO
+ WriteChar (f, a[i]) ;
+ INC (i)
+ END
+END Write ;
+
+
+PROCEDURE WriteLn (f: File) ;
+BEGIN
+ WriteLine (f)
+END WriteLn ;
+
+
+END arrayofchar.
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index 2f8b7d4..d66c833 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -599,15 +599,16 @@ proc aarch64-arch-dg-options { args } {
set add_arch 1
set add_tune 1
+ set add_override 1
set checks_output [string equal [lindex $do_what 0] "compile"]
set options [lindex $args 1]
foreach option [split $options] {
switch -glob -- $option {
-march=* { set add_arch 0 }
- -mcpu=* { set add_arch 0; set add_tune 0 }
- -mtune=* { set add_tune 0 }
- -moverride=* { set add_tune 0 }
+ -mcpu=* { set add_arch 0; set add_tune 0; set add_override 0}
+ -mtune=* { set add_tune 0; set add_override 0 }
+ -moverride=* { set add_override 0 }
-save-temps { set checks_output 1 }
--save-temps { set checks_output 1 }
-fdump* { set checks_output 1 }
@@ -619,9 +620,14 @@ proc aarch64-arch-dg-options { args } {
append options " $aarch64_default_testing_arch"
}
- if { $add_tune && $checks_output } {
+ if { $checks_output } {
# Turn off any default tuning and codegen tweaks.
- append options " -mtune=generic -moverride=tune=none"
+ if { $add_tune } {
+ append options " -mtune=generic"
+ }
+ if { $add_override } {
+ append options " -moverride=tune=none"
+ }
}
uplevel 1 aarch64-old-dg-options [lreplace $args 1 1 $options]
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 65d2e67..30d12a9 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1017,6 +1017,18 @@ proc check_effective_target_label_values {} {
return 1
}
+
+# Return 1 if builtin_trap expands not into a call but an instruction,
+# 0 otherwise.
+proc check_effective_target_trap { } {
+ return [check_no_messages_and_pattern trap "!\\(call" rtl-expand {
+ void foo ()
+ {
+ return __builtin_trap ();
+ }
+ } "" ]
+}
+
# Return 1 if builtin_return_address and builtin_frame_address are
# supported, 0 otherwise.
diff --git a/gcc/tree-cfgcleanup.cc b/gcc/tree-cfgcleanup.cc
index a34a51e..5aaa18d 100644
--- a/gcc/tree-cfgcleanup.cc
+++ b/gcc/tree-cfgcleanup.cc
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-into-ssa.h"
#include "tree-cfgcleanup.h"
#include "gimple-pretty-print.h"
+#include "target.h"
/* The set of blocks in that at least one of the following changes happened:
@@ -1569,6 +1570,29 @@ execute_cleanup_cfg_post_optimizing (void)
cleanup_dead_labels ();
if (group_case_labels ())
todo |= TODO_cleanup_cfg;
+
+ basic_block bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
+ gimple_stmt_iterator gsi = gsi_start_nondebug_after_labels_bb (bb);
+ /* If the first (and only) bb and the only non debug
+ statement is __builtin_unreachable call, then replace it with a trap
+ so the function is at least one instruction in size. */
+ if (!gsi_end_p (gsi)
+ && gimple_call_builtin_p (gsi_stmt (gsi), BUILT_IN_UNREACHABLE))
+ {
+ if (targetm.have_trap ())
+ {
+ gimple_call_set_fndecl (gsi_stmt (gsi), builtin_decl_implicit (BUILT_IN_UNREACHABLE_TRAP));
+ update_stmt (gsi_stmt (gsi));
+ }
+ /* If the target does not have a trap, convert it into an infinite loop. */
+ else
+ {
+ gsi_remove (&gsi, true);
+ make_single_succ_edge (bb, bb, EDGE_FALLTHRU);
+ fix_loop_structure (NULL);
+ }
+ }
+
if ((flag_compare_debug_opt || flag_compare_debug)
&& flag_dump_final_insns)
{
diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
index 240af67..032f277 100644
--- a/gcc/tree-sra.cc
+++ b/gcc/tree-sra.cc
@@ -2504,6 +2504,12 @@ sort_and_splice_var_accesses (tree var)
}
unscalarizable_region = true;
}
+ /* If there the same place is accessed with two incompatible
+ aggregate types, trying to base total scalarization on either of
+ them can be wrong. */
+ if (!first_scalar && !types_compatible_p (access->type, ac2->type))
+ bitmap_set_bit (cannot_scalarize_away_bitmap,
+ DECL_UID (access->base));
if (grp_same_access_path
&& (!ac2->grp_same_access_path
diff --git a/gcc/tree-ssa-sink.cc b/gcc/tree-ssa-sink.cc
index 959e0d5..2244e89f 100644
--- a/gcc/tree-ssa-sink.cc
+++ b/gcc/tree-ssa-sink.cc
@@ -356,37 +356,54 @@ statement_sink_location (gimple *stmt, basic_block frombb,
use = NULL;
- /* If stmt is a store the one and only use needs to be the VOP
- merging PHI node. */
+ /* If stmt is a store the one and only use needs to be a VUSE on
+ the live path. */
if (virtual_operand_p (DEF_FROM_PTR (def_p)))
{
+ tree lhs = gimple_get_lhs (stmt);
+ ao_ref ref;
+ ao_ref_init (&ref, lhs);
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, DEF_FROM_PTR (def_p))
{
gimple *use_stmt = USE_STMT (use_p);
/* A killing definition is not a use. */
- if ((gimple_has_lhs (use_stmt)
- && operand_equal_p (gimple_get_lhs (stmt),
- gimple_get_lhs (use_stmt), 0))
- || stmt_kills_ref_p (use_stmt, gimple_get_lhs (stmt)))
+ if (gimple_vdef (use_stmt)
+ && ((gimple_has_lhs (use_stmt)
+ && operand_equal_p (lhs,
+ gimple_get_lhs (use_stmt), 0))
+ || stmt_kills_ref_p (use_stmt, &ref)))
{
/* If use_stmt is or might be a nop assignment then USE_STMT
acts as a use as well as definition. */
if (stmt != use_stmt
- && ref_maybe_used_by_stmt_p (use_stmt,
- gimple_get_lhs (stmt)))
- return false;
+ && ref_maybe_used_by_stmt_p (use_stmt, &ref))
+ {
+ if (use && use != use_stmt)
+ return false;
+ use = use_stmt;
+ }
continue;
}
- if (gimple_code (use_stmt) != GIMPLE_PHI)
- return false;
-
- if (use
- && use != use_stmt)
- return false;
+ if (is_a <gphi *> (use_stmt)
+ || ref_maybe_used_by_stmt_p (use_stmt, &ref))
+ {
+ if (use && use != use_stmt)
+ return false;
+ use = use_stmt;
+ continue;
+ }
- use = use_stmt;
+ if (gimple_vdef (use_stmt))
+ {
+ if (stmt_may_clobber_ref_p_1 (use_stmt, &ref, false))
+ return false;
+ /* We do not look past VDEFs, so treat them as sink location. */
+ if (use && use != use_stmt)
+ return false;
+ use = use_stmt;
+ }
}
if (!use)
return false;
@@ -448,18 +465,26 @@ statement_sink_location (gimple *stmt, basic_block frombb,
break;
}
use = USE_STMT (one_use);
+ }
- if (gimple_code (use) != GIMPLE_PHI)
- {
- sinkbb = select_best_block (frombb, gimple_bb (use), stmt);
+ if (gimple_code (use) != GIMPLE_PHI)
+ {
+ sinkbb = select_best_block (frombb, gimple_bb (use), stmt);
- if (sinkbb == frombb)
- return false;
+ if (sinkbb == frombb)
+ return false;
- *togsi = gsi_after_labels (sinkbb);
+ /* The SSA update for sinking of stores cannot insert PHIs, the
+ sink location has to lead to exit without crossing any CFG
+ merge points to paths not dominated by the sink location. */
+ if (gimple_vdef (stmt)
+ && (!single_succ_p (sinkbb)
+ || single_succ (sinkbb)->index != EXIT_BLOCK))
+ return false;
- return true;
- }
+ *togsi = gsi_after_labels (sinkbb);
+
+ return true;
}
sinkbb = find_bb_for_arg (as_a <gphi *> (use), DEF_FROM_PTR (def_p));
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index a24ddfb..460a48d 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -4667,26 +4667,19 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
if (off == NULL_TREE)
off = size_zero_node;
- /* If base is not loop invariant, either off is 0, then we start with just
- the constant offset in the loop invariant BASE and continue with base
- as OFF, otherwise give up.
- We could handle that case by gimplifying the addition of base + off
- into some SSA_NAME and use that as off, but for now punt. */
+ /* BASE must be loop invariant. If it is not invariant, but OFF is, then we
+ * can fix that by swapping BASE and OFF. */
if (!expr_invariant_in_loop_p (loop, base))
{
- if (!integer_zerop (off))
+ if (!expr_invariant_in_loop_p (loop, off))
return false;
- off = base;
- base = size_int (pbytepos);
- }
- /* Otherwise put base + constant offset into the loop invariant BASE
- and continue with OFF. */
- else
- {
- base = fold_convert (sizetype, base);
- base = size_binop (PLUS_EXPR, base, size_int (pbytepos));
+
+ std::swap (base, off);
}
+ base = fold_convert (sizetype, base);
+ base = size_binop (PLUS_EXPR, base, size_int (pbytepos));
+
/* OFF at this point may be either a SSA_NAME or some tree expression
from get_inner_reference. Try to peel off loop invariants from it
into BASE as long as possible. */
@@ -4864,6 +4857,9 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
offset_vectype = NULL_TREE;
}
+ gcc_checking_assert (expr_invariant_in_loop_p (loop, base));
+ gcc_checking_assert (!expr_invariant_in_loop_p (loop, off));
+
info->ifn = ifn;
info->decl = decl;
info->base = base;
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 7ad56b9..7776b2f 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -11370,7 +11370,11 @@ vect_schedule_slp_node (vec_info *vinfo,
&& !SSA_NAME_IS_DEFAULT_DEF (def))
{
gimple *stmt = SSA_NAME_DEF_STMT (def);
- if (!last_stmt)
+ if (gimple_uid (stmt) == -1u)
+ /* If the stmt is not inside the region do not
+ use it as possible insertion point. */
+ ;
+ else if (!last_stmt)
last_stmt = stmt;
else if (vect_stmt_dominates_stmt_p (last_stmt, stmt))
last_stmt = stmt;