Commit Graph

186060 Commits

Author SHA1 Message Date
Antoni Boucher 93022946df MAINTAINERS: Add myself for write after approval
ChangeLog:

2021-06-18  Antoni Boucher  <bouanto@zoho.com>

	* MAINTAINERS (Write After Approval): Add myself.
2021-06-18 16:52:55 -04:00
Harald Anlauf 6fc5433963 Fortran - fix conversion to result type for the min/max intrinsic
gcc/fortran/ChangeLog:

	PR fortran/100283
	PR fortran/101123
	* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Unconditionally
	convert result of min/max to result type.

gcc/testsuite/ChangeLog:

	PR fortran/100283
	PR fortran/101123
	* gfortran.dg/min0_max0_1.f90: New test.
	* gfortran.dg/min0_max0_2.f90: New test.
2021-06-18 19:34:15 +02:00
David Malcolm 3bb85b8687 analyzer: fix issue with symbolic reads with concrete bindings
gcc/analyzer/ChangeLog:
	* store.cc (binding_cluster::get_any_binding): Make symbolic reads
	from a cluster with concrete bindings return unknown.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/symbolic-7.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-06-18 13:24:19 -04:00
Patrick Palka 83faf7eacd libstdc++: Implement LWG 3557 change to convertible_to
libstdc++-v3/ChangeLog:

	* include/std/concepts (convertible_to): Just use declval as per
	LWG 3557.
2021-06-18 11:51:33 -04:00
David Malcolm 1aff29d426 analyzer: add region_model_manager::get_or_create_int_cst
gcc/analyzer/ChangeLog:
	* region-model-manager.cc
	(region_model_manager::get_or_create_int_cst): New.
	(region_model_manager::maybe_undo_optimize_bit_field_compare): Use
	it to simplify away a local tree.
	* region-model.cc (region_model::on_setjmp): Likewise.
	(region_model::on_longjmp): Likewise.
	* region-model.h (region_model_manager::get_or_create_int_cst):
	New decl.
	* store.cc (binding_cluster::zero_fill_region): Use it to simplify
	away a local tree.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-06-18 11:19:30 -04:00
David Malcolm 86606d2ab7 analyzer: refactor custom_event, introducing precanned_custom_event class
I have followup work where a custom event's description would be better
handled via a vfunc rather that a precanned string, hence this
refactoring to make it easy to add custom_event subclasses.

gcc/analyzer/ChangeLog:
	* checker-path.cc (class custom_event): Make abstract to allow for
	custom vfuncs, splitting existing implementation into...
	(class precanned_custom_event): New subclass.
	(custom_event::get_desc): Move to...
	(precanned_custom_event::get_desc): ...subclass.
	* checker-path.h (class custom_event): Make abstract to allow for
	custom vfuncs, splitting existing implementation into...
	(class precanned_custom_event): New subclass.
	* diagnostic-manager.cc (diagnostic_manager::add_events_for_eedge):
	Use precanned_custom_event.
	* engine.cc
	(stale_jmp_buf::maybe_add_custom_events_for_superedge): Likewise.
	* sm-signal.cc (signal_delivery_edge_info_t::add_events_to_path):
	Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-06-18 11:18:10 -04:00
Jonathan Wakely 0532452dcd libstdc++: Replace incorrect static assertion in std::reduce [PR95833]
The standard does not require the iterator's value type to be
convertible to the result type, it only requires that the result of
dereferencing the iterator can be passed to the binary function.

libstdc++-v3/ChangeLog:

	PR libstdc++/95833
	* include/std/numeric (reduce(Iter, Iter, T, BinaryOp)): Replace
	incorrect static_assert with ones matching the 'Mandates'
	conditions in the standard.
	* testsuite/26_numerics/reduce/95833.cc: New test.
2021-06-18 14:46:58 +01:00
Srinath Parvathaneni f58d03b5df arm: Fix multilib mapping for CDE extensions [PR100856].
On passing +cdecp[0-7] extension to the -march string in command line options,
multilib linking is failing as mentioned in PR100856. This patch fixes this issue by
generating a separate canonical string by removing compiler options which are not
required for multilib linking from march string and assign the new string to mlibarch
option. This mlibarch string is used for multilib comparison.

gcc/ChangeLog:

2021-06-10  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

	PR target/100856
	* common/config/arm/arm-common.c (arm_canon_arch_option_1): New function
	derived from arm_canon_arch.
	(arm_canon_arch_option): Call it.
	(arm_canon_arch_multilib_option): New function.
	* config/arm/arm-cpus.in (IGNORE_FOR_MULTILIB): New fgroup.
	* config/arm/arm.h (arm_canon_arch_multilib_option): New prototype.
	(CANON_ARCH_MULTILIB_SPEC_FUNCTION): New macro.
	(MULTILIB_ARCH_CANONICAL_SPECS): New macro.
	(DRIVER_SELF_SPECS): Add MULTILIB_ARCH_CANONICAL_SPECS.
	* config/arm/arm.opt (mlibarch): New option.
	* config/arm/t-rmprofile (MULTILIB_MATCHES): For armv8*-m, replace use
	of march on RHS with mlibarch.

gcc/testsuite/ChangeLog:

2021-06-10  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

	PR target/100856
	* gcc.target/arm/acle/pr100856.c: New test.
	* gcc.target/arm/multilib.exp: Add tests for cde options.
2021-06-18 13:22:02 +01:00
Marcel Vollweiler cfa1f8226f gcc/configure.ac: fix register issue for global_load assembler functions
gcc/ChangeLog:

	* config.in: Regenerate.
	* config/gcn/gcn.c (print_operand_address): Fix for global_load assembler
	functions.
	* configure: Regenerate.
	* configure.ac: Fix for global_load assembler functions.
2021-06-18 04:57:25 -07:00
Richard Biener 17a4bee01c tree-optimization/101112 - fix pattern stmt def lookup in SLP reassoc
This fixes the lookup of a pattern stmt def operand.

2021-06-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101112
	* tree-vect-slp.c (vect_slp_linearize_chain): Fix condition
	to lookup a pattern stmt def.
2021-06-18 13:43:21 +02:00
Jonathan Wakely 92edc4a768 libstdc++: Suppress -Wstringop-overread warning in test
When compiled with -m32 -O2 -D_GLIBCXX_USE_CXX11_ABI=0 we get a warning
for 21_strings/basic_string/cons/char/1.cc:

bits/char_traits.h:409:56: warning: ‘void* __builtin_memcpy(void*, const void*, unsigned int)’ reading 1073741821 bytes from a region of size 19 [-Wstringop-overread]

The warning is legitimate, even if that line cannot be reached because
we throw std::length_error before getting there. Since the invalid
length is deliberate (and mentioned in a comment) just suppress the
warning, so that the test can verify we get the exception.

Also remove an unused typedef that produces another warning.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string/cons/char/1.cc: Use
	diagnostic pragma to suppress -Wstringop-overread error.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
2021-06-18 11:15:28 +01:00
Jakub Jelinek 76e990fd21 stor-layout: Don't create DECL_BIT_FIELD_REPRESENTATIVE for QUAL_UNION_TYPE [PR101062]
> The following patch does create them, but treats all such bitfields as if
> they were in a structure where the particular bitfield is the only field.

While the patch passed bootstrap/regtest on the trunk, when trying to
backport it to 11 branch the bootstrap failed with
atree.ads:3844:34: size for "Node_Record" too small
errors.  Turns out the error is not about size being too small, but actually
about size being non-constant, and comes from:
 /* In a FIELD_DECL of a RECORD_TYPE, this is a pointer to the storage
    representative FIELD_DECL.  */
 #define DECL_BIT_FIELD_REPRESENTATIVE(NODE) \
   (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)

 /* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which
    if nonzero, indicates that the field occupies the type.  */
  #define DECL_QUALIFIER(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)
so by setting up DECL_BIT_FIELD_REPRESENTATIVE in QUAL_UNION_TYPE we
actually set or modify DECL_QUALIFIER and then construct size as COND_EXPRs
with those bit field representatives (e.g. with array type) as conditions
which doesn't fold into constant.

The following patch fixes it by not creating DECL_BIT_FIELD_REPRESENTATIVEs
for QUAL_UNION_TYPE as there is nowhere to store them,

Shall we change tree.h to document that DECL_BIT_FIELD_REPRESENTATIVE
is valid also on UNION_TYPE?
I see:
tree-ssa-alias.c-  if (TREE_CODE (type1) == RECORD_TYPE
tree-ssa-alias.c:      && DECL_BIT_FIELD_REPRESENTATIVE (field1))
tree-ssa-alias.c:    field1 = DECL_BIT_FIELD_REPRESENTATIVE (field1);
tree-ssa-alias.c-  if (TREE_CODE (type2) == RECORD_TYPE
tree-ssa-alias.c:      && DECL_BIT_FIELD_REPRESENTATIVE (field2))
tree-ssa-alias.c:    field2 = DECL_BIT_FIELD_REPRESENTATIVE (field2);
Shall we change that to || == UNION_TYPE or do we assume all fields
are overlapping in a UNION_TYPE already?
At other spots (asan, ubsan, expr.c) it is unclear what will happen
if they see a QUAL_UNION_TYPE with a DECL_QUALIFIER (or does the Ada FE
lower that somehow)?

2021-06-18  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/101062
	* stor-layout.c (finish_bitfield_layout): Don't add bitfield
	representatives in QUAL_UNION_TYPE.
2021-06-18 11:20:40 +02:00
Gary Dismukes ba71587184 [Ada] Additional error checking on index constraints with fixed-lower-bound ranges
gcc/ada/

	* sem_ch3.adb (Constrain_Array): Add error checking for
	fixed-lower-bound and constrained index ranges applied
	inappropriately on subtypes of unconstrained and
	fixed-lower-bound array types.
	(Constrain_Index): Correct and refine comment related to
	fixed-lower-bound index ranges.
2021-06-18 04:36:54 -04:00
Bob Duff 161e220201 [Ada] Minor comment cleanups
gcc/ada/

	* gen_il-gen.adb: Improve comments.
	* snames.ads-tmpl (Convention_Id): Remove "--  Plenty of space
	for expansion", because that's irrelevant now that we are no
	longer laying out node fields by hand.
2021-06-18 04:36:54 -04:00
Piotr Trojanek b3fa853aba [Ada] Fix detection of overlapping slices indexed by characters
gcc/ada/

	* sem_util.adb (Denotes_Same_Object): Handle character literals
	just like integer literals.
2021-06-18 04:36:54 -04:00
Piotr Trojanek cbe87f4582 [Ada] Fix detection of overlapping actuals with renamings
gcc/ada/

	* sem_util.adb (Denotes_Same_Object): Explicitly test for node
	kinds being the same; deal with renamings one-by-one; adjust
	numbers in references to the Ada RM.
2021-06-18 04:36:54 -04:00
Bob Duff ca5cdc9053 [Ada] Make "gcc -gnatDGL" handle unterminated last lines properly
gcc/ada/

	* sprint.adb (Write_Source_Line): Check for EOF in
	Line_Terminator loop.  Note that when a source file is read in,
	an EOF character is added to the end.
2021-06-18 04:36:53 -04:00
Piotr Trojanek f86c2f9c8e [Ada] Reuse Package_Specification in Is_Incomplete_Or_Private_Type
gcc/ada/

	* sem_aux.adb (Package_Specification): Add assertions to confirm
	the kind of the of parameter and returned node.
	* sem_ch12.adb (Remove_Parent): Reorder conditions; this change
	appears to be semantically neutral, but is enough to avoid the
	problematic call to Package_Specification.
	* sem_util.adb (Is_Incomplete_Or_Private_Type): Replace loop
	with a call to Package_Specification.
2021-06-18 04:36:53 -04:00
Bob Duff a34ce7c5df [Ada] Avoid passing Enum_Lit'Size to the back end
gcc/ada/

	* sem_attr.adb (Eval_Attribute): For Enum_Lit'Size, use
	Enum_Type'Object_Size.
2021-06-18 04:36:53 -04:00
Olivier Hainque 548280b996 [Ada] Fix inaccuracies in signal handler trampoline for aarch64-vxworks
gcc/ada/

	* sigtramp-vxworks-target.inc (__aarch64__): Sync
	REGNO_PC_OFFSET with the back-end DWARF_ALT_FRAME_RETURN_COLUMN.
	In CFI_COMMON_REGS, leave r18 alone, VxWorks private.
2021-06-18 04:36:52 -04:00
Javier Miranda c37c13e15e [Ada] Ada2020: AI12-0195 overriding class-wide pre/post conditions
gcc/ada/

	* contracts.adb (Process_Spec_Postconditions): Add missing
	support for aliased subprograms and handle wrappers of
	class-wide pre/post conditions.
	(Process_Inherited_Preconditions): Add missing support for
	aliased subprograms and handle wrappers of class-wide pre/post
	conditions.
	* einfo.ads (Class_Wide_Clone): Fix typo.
	(Is_Class_Wide_Clone): Removed since it is not referenced.
	(Is_Wrapper): Documenting new flag.
	(LSP_Subprogram): Documenting new attribute.
	* exp_ch3.adb (Make_Controlling_Function_Wrappers): Decorate
	wrapper as Is_Wrapper and adjust call to
	Override_Dispatching_Operation.
	* freeze.adb (Build_Inherited_Condition_Pragmas): Fix typo in
	documentation.
	(Check_Inherited_Conditions): Handle LSP wrappers; ensure
	correct decoration of LSP wrappers.
	* gen_il-fields.ads (Is_Class_Wide_Clone): Removed.
	(Is_Wrapper): Added.
	(LSP_Subprogram): Added.
	* gen_il-gen-gen_entities.adb (Is_Class_Wide_Clone): Removed.
	(Is_Wrapper): Added.
	(LSP_Subprogram): Added.
	* gen_il-internals.adb (Image): Adding uppercase image of
	LSP_Subprogram.
	* sem_ch6.adb (New_Overloaded_Entity): Fix decoration of LSP
	wrappers.
	* sem_disp.ads (Override_Dispatching_Operation): Remove
	parameter Is_Wrapper; no longer needed.
	* sem_disp.adb (Check_Dispatching_Operation): Adjust assertion.
	(Override_Dispatching_Operation): Remove parameter Is_Wrapper;
	no longer needed.
	* treepr.adb (Image): Adding uppercase image of LSP_Subprogram.
2021-06-18 04:36:52 -04:00
Arnaud Charlet 4edcee5b2b [Ada] Premature freezing of types
gcc/ada/

	* exp_ch4.adb (Expand_N_Quantified_Expression): Ensure the type
	of the name of a "for of" loop is frozen.
	* exp_disp.adb (Check_Premature_Freezing): Complete condition to
	take into account a private type completed by another private
	type now that the freezing rule are better implemented.
	* freeze.adb (Freeze_Entity.Freeze_Profile): Do not perform an
	early freeze on types if not in the proper scope. Special case
	expression functions that requires access to the dispatch table.
	(Should_Freeze_Type): New.
	* sem_ch13.adb (Resolve_Aspect_Expressions): Prevent assert
	failure in case of an invalid tree (previous errors detected).
	* sem_res.adb (Resolve): Remove kludge related to entities
	causing incorrect premature freezing.
	* sem_util.adb (Ensure_Minimum_Decoration): Add protection
	against non base types.
2021-06-18 04:36:52 -04:00
Gary Dismukes 33a3b5f3a5 [Ada] Missing check for assigning too-large array to fixed-lower-bound object
gcc/ada/

	* sem_ch3.adb (Constrain_Index): Set the High_Bound of a
	fixed-lower-bound subtype's range to T (the subtype of the FLB
	index being constrained) rather than Base_Type (T).
2021-06-18 04:36:51 -04:00
Bob Duff 9324e07dbd [Ada] Remove AAMP from compiler sources
gcc/ada/

	* ada_get_targ.adb, aspects.ads, checks.adb, cstand.adb,
	einfo.ads, exp_attr.adb, freeze.adb, get_targ.adb,
	libgnat/a-textio.ads, libgnat/g-memdum.ads,
	libgnat/s-scaval__128.adb, libgnat/s-scaval.adb, make.adb,
	osint.ads, par-prag.adb, sem_ch13.adb, sem_prag.adb,
	sem_prag.ads, set_targ.adb, set_targ.ads, snames.ads-tmpl,
	targparm.ads, types.ads: Remove AAMP-specific code.
	* switch.ads: Minor reformatting.
	* gen_il-fields.ads, gen_il-gen.adb,
	gen_il-gen-gen_entities.adb, gen_il-types.ads, einfo-utils.adb,
	einfo-utils.ads: Package Types now contains "type Float_Rep_Kind
	is (IEEE_Binary);", which used to also have an enumeral AAMP.
	Gen_IL can't handle fields of this type, which would be zero
	sized. Therefore, we move the Float_Rep field into Einfo.Utils
	as a synthesized attribute. (We do not delete the field
	altogether, in case we want new floating-point representations
	in the future.)
	* doc/gnat_rm/implementation_defined_pragmas.rst,
	doc/gnat_rm/implementation_defined_aspects.rst,
	doc/gnat_ugn/building_executable_programs_with_gnat.rst,
	doc/gnat_ugn/the_gnat_compilation_model.rst: Remove
	AAMP-specific documentation.
	* gnat_rm.texi, gnat_ugn.texi: Regenerate.
2021-06-18 04:36:51 -04:00
Gary Dismukes f44441d80f [Ada] Error issued on string literal assigned to fixed-lower-bound array
gcc/ada/

	* exp_util.adb (Expand_Sliding_Conversion): Move test of
	Is_Fixed_Lower_Bound_Subtype to an assertion. Exclude string
	literals from sliding expansion.
2021-06-18 04:36:51 -04:00
Piotr Trojanek 1be46d12a7 [Ada] Warn about overlapping actuals in all versions of Ada
gcc/ada/

	* sem_warn.adb (Warn_On_Overlapping_Actuals): Cleanup conditions
	related to Ada_Version.
2021-06-18 04:36:50 -04:00
Piotr Trojanek d94a2f5f1f [Ada] Reuse First_Actual in Address_Value
gcc/ada/

	* sem_util.adb (Address_Value): Simplify.
2021-06-18 04:36:50 -04:00
Bob Duff 537f0ce307 [Ada] Correct A'First (N) where N is an object name
gcc/ada/

	* sem_attr.adb (Check_Array_Or_Scalar_Type): Use Expr_Value
	instead of Intval, because the latter only exists in literals.
	Remove Set_Etype on E1; setting the type is done elsewhere.
2021-06-18 04:36:50 -04:00
Piotr Trojanek 7120f08218 [Ada] Fix asymmetries in detection of overlapping actuals
gcc/ada/

	* sem_warn.adb (Warn_On_Overlapping_Actuals): Examine types of
	both formal parameters; refactor a complex detection of
	by-reference types.
2021-06-18 04:36:49 -04:00
Arnaud Charlet cd344e9570 [Ada] Fix handling of gnat check/test commands
gcc/ada/

	* gnatcmd.adb: Fix handling of check and test commands.
2021-06-18 04:36:49 -04:00
Gary Dismukes 94c6d6fd75 [Ada] Add documentation for the array fixed-lower-bound feature
gcc/ada/

	* doc/gnat_rm/implementation_defined_pragmas.rst: Add
	documentation for the array fixed-lower-bound feature.
	* gnat_rm.texi: Regenerate.
2021-06-18 04:36:49 -04:00
Bob Duff 73b670e3b1 [Ada] New debug switch to disable large static aggregates
gcc/ada/

	* debug.adb: Document switch.
	* exp_aggr.adb: If -gnatd_g was given, then do not bump the
	limit to 500_000.
2021-06-18 04:36:49 -04:00
Bob Duff 57841a4311 [Ada] Warn on 'in out' param containing access in private type
gcc/ada/

	* sem_util.ads, sem_util.adb (Has_Access_Values): Remove
	Include_Internal parameter that was added in previous change.
	* sem_warn.adb (Warnings_Off_E1): Back out E_Out_Parameter ==>
	Formal_Kind change made previously. Check Is_Private_Type to
	avoid warnings on private types. Misc cleanup.
	* sem_attr.adb (Attribute_Has_Access_Values): Remove
	Include_Internal parameter.
2021-06-18 04:36:48 -04:00
Piotr Trojanek 9c2886684f [Ada] Remove dead code for overlapping actuals in prefix notation
gcc/ada/

	* sem_warn.adb (Warn_On_Overlapping_Actuals): Remove dead branch
	for overlapping actuals in prefix notation.
2021-06-18 04:36:48 -04:00
Eric Botcazou 2a8dbd6b24 [Ada] Do not clear Is_True_Constant flag on imported constants
gcc/ada/

	* sem_prag.adb (Process_Import_Or_Interface): Do not
	artificially record a possible modification for a constant.
2021-06-18 04:36:48 -04:00
Arnaud Charlet a30647690d [Ada] Code cleanups in exp_ch6.adb
gcc/ada/

	* exp_ch6.adb (Expand_Call_Helper): Code cleanups.
2021-06-18 04:36:47 -04:00
Arnaud Charlet 4463d6eebc [Ada] Update comments related to TBD
gcc/ada/

	* exp_aggr.adb, exp_dist.adb, exp_unst.adb, sa_messages.ads,
	sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_eval.adb,
	sem_util.adb, sem_util.ads, sinfo.ads: Update comments.
2021-06-18 04:36:47 -04:00
Ghjuvan Lacambre 26373979de [Ada] Implement basic support for -fdiagnostics-format=json
gcc/ada/

	* back_end.adb (Scan_Back_End_Switches): Set Opt.JSON_Output to
	True if -fdiagnostics-format=json option is found.
	* back_end.ads (Scan_Compiler_Arguments): Mention
	Opt.JSON_Output.
	* errout.adb (Output_JSON_Message): New procedure.
	(Output_Messages): If Opt.JSON_Output is True, print messages
	with new Output_JSON_Message procedure.
	* opt.ads: Declare JSON_Output variable.
	* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
	Mention new -fdiagnostics-format option.
	* gnat_ugn.texi: Regenerate.
2021-06-18 04:36:47 -04:00
Arnaud Charlet 0becb0faae [Ada] Relax null exclusion mismatch check in Relaxed_RM_Semantics mode
gcc/ada/

	* sem_ch6.adb (Null_Exclusions_Match): Relax null exclusion
	mismatch check when Relaxed_RM_Semantics is set.
2021-06-18 04:36:46 -04:00
Arnaud Charlet 5ddd01d6d4 [Ada] Replace Opt.Extensions_Allowed by Ada_Version
gcc/ada/

	* fe.h, opt.adb, opt.ads, par-prag.adb, sem_prag.adb,
	switch-c.adb (Extensions_Allowed): Replace by a function.
	(Ada_Version_Type): Add new value Ada_With_Extensions, to
	replace setting of Extensions_Allowed.  Update setting of
	Extensions_Allowed.
2021-06-18 04:36:46 -04:00
Arnaud Charlet 4153c75471 [Ada] GNAT.Compiler_Version and LTO
gcc/ada/

	* bindgen.adb (Gen_Output_File_Ada): Generate a new constant
	GNAT_Version_Address.
	* libgnat/g-comver.adb (GNAT_Version_Address): New;
	(GNAT_Version): Use GNAT_Version_Address to disable LTO warning.
2021-06-18 04:36:46 -04:00
Javier Miranda 07537fe632 [Ada] Ada2020: Special handling of types derived from runtime
gcc/ada/

	* einfo.ads (Is_Ada_2022_Only): Adding documentation.
	* gen_il-fields.ads (Is_Ada_2022_Only): New flag.
	* gen_il-gen-gen_entities.adb (Is_Ada_2022_Only): New flag.
	* itypes.adb (Create_Null_Excluding_Itype): Inherit
	Is_Ada_2022_Only.
	* sem_ch3.adb (Check_Abstract_Overriding): Skip reporting error
	on Ada 2022 only subprograms that require overriding if we are
	not in Ada 2022 mode.
	(Derive_Subprogram): Inherit Is_Ada_2022_Only.
	* sem_ch6.adb (Check_Overriding_Indicator): Inherit
	Is_Ada_2022_Only.
	(New_Overloaded_Entity): Inherit Is_Ada_2022_Only.
	* sem_ch7.adb (Declare_Inherited_Private_Subprograms): Inherit
	Is_Ada_2022_Only.
	(Preserve_Full_Attributes): Inherit Is_Ada_2022_Only.
	* sem_disp.adb (Find_Hidden_Overridden_Primitive): Inherit
	Is_Ada_2022_Only.
	(Override_Dispatching_Operation): Inherit Is_Ada_2022_Only.
	* sem_prag.adb (Analyze_Pragma): Allow form with argument for
	Ada 2022.
	* sem_type.adb: (Disambiguate): Deal with Is_Ada_2022_Only
	* lib-xref.adb (Generate_Reference): Error on static and
	dispatching calls to Ada 2022 subprograms that require
	overriding if we are not in Ada 2022 mode; warn on other
	references to Ada 2022 entities when not in Ada 2022 mode.
	* sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): Inherit
	Ada_2020_Only.
	* libgnat/a-cdlili.ads (Empty): Adding pragma Ada_2022.
	* libgnat/a-cidlli.ads (Empty): Adding pragma Ada_2022.
	* libgnat/a-ciorma.ads (Empty): Adding pragma Ada_2022.
	* libgnat/a-cobove.ads (Empty): Adding pragma Ada_2022.
	* libgnat/a-coorma.ads (Empty): Adding pragma Ada_2022.
	(New_Vector): Adding pragma Ada_2022.
	(Insert_Vector): Adding pragma Ada_2022.
	(Prepend_Vector): Adding pragma Ada_2022.
	(Append_Vector): Adding pragma Ada_2022.
2021-06-18 04:36:46 -04:00
Andrew Pinski 64b5da8f97 Add statistics counting to PHI-OPT
This should have been done before I started to work on connecting
PHI-OPT to match-and-simplify to see quickly if we miss anything
but it is better late than never.
Anyways there was no statistics counting in PHI-OPT before so adding
it is the right thing to do.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

	* tree-ssa-phiopt.c (replace_phi_edge_with_variable):
	Add counting of how many times it is done.
	(factor_out_conditional_conversion): Likewise.
	(match_simplify_replacement): Likewise.
	(value_replacement): Likewise.
	(spaceship_replacement): Likewise.
	(cond_store_replacement): Likewise.
	(cond_if_else_store_replacement_1): Likewise.
	(hoist_adjacent_loads): Likewise.
2021-06-18 00:58:18 -07:00
Andrew Pinski 2f1686ff70 Disallow pointer and offset types on some gimple
While debugging PR 100925, I found that the gimple verifiers
don't reject NEGATE on pointer or offset type.
This patch adds the check on some unary and binary gimple which
should not have operated on pointer/offset types.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

gcc/ChangeLog:

	* tree-cfg.c (verify_gimple_assign_unary): Reject point and offset
	types on NEGATE_EXPR, ABS_EXPR, BIT_NOT_EXPR, PAREN_EXPR and CNONJ_EXPR.
	(verify_gimple_assign_binary): Reject point and offset types on
	MULT_EXPR, MULT_HIGHPART_EXPR, TRUNC_DIV_EXPR, CEIL_DIV_EXPR,
	FLOOR_DIV_EXPR, ROUND_DIV_EXPR, TRUNC_MOD_EXPR, CEIL_MOD_EXPR,
	FLOOR_MOD_EXPR, ROUND_MOD_EXPR, RDIV_EXPR, and EXACT_DIV_EXPR.
2021-06-18 00:58:18 -07:00
Patrick Palka 2786064d91 libstdc++: Move ranges algos used by <ranges> into ranges_util.h
The <ranges> header defines simplified copies of some ranges algorithms
in order to avoid including the entirety of ranges_algo.h.  A subsequent
patch is going to want to use ranges::search in <ranges> as well, and
that algorithm is more complicated compared to the other copied ones.

So rather than additionally copying ranges::search into <ranges>, this
patch splits out all the ranges algos used by <ranges> (including
ranges::search) from ranges_algo.h to ranges_util.h, and deletes the
simplified copies in <ranges>.  This seems like the best place to
put these algorithms, as ranges_util.h is currently included only from
<ranges> and ranges_algo.h.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_algo.h (__find_fn, find, __find_if_fn)
	(find_if, __find_if_not_fn, find_if_not, _in_in_result)
	(__mismatch_fn, mismatch, __search_fn, search): Move to ...
	* include/bits/ranges_util.h: ... here.
	* include/std/ranges (__detail::find, __detail::find_if)
	(__detail::find_if_not, __detail::mismatch): Remove.
	(filter_view): Use ranges::find_if instead.
	(drop_while_view): Use ranges::find_if_not instead.
	(split_view): Use ranges::find and ranges::mismatch instead.
2021-06-17 22:44:41 -04:00
Patrick Palka 4b4f5666b4 libstdc++: Implement P2325 changes to default-constructibility of views
This implements the wording changes of P2325R3 "Views should not be
required to be default constructible".  Changes are relatively
straightforward, besides perhaps those to __box (which now stands
for copyable-box instead of semiregular-box) and __non_propagating_cache.

For __box, this patch implements the recommended practice to also avoid
std::optional when the boxed type is nothrow_move/copy_constructible.

For __non_propagating_cache, now that it's used by split_view::_M_current,
we need to add assignment from a value of the underlying type to the
subset of the std::optional API implemented for the cache (needed by
split_view::begin()).  Hence the new __non_propagating_cache::operator=
overload.

In passing, this fixes the undesirable list-init in the constructors of
the partial specialization of __box as reported in PR100475 comment #7.

libstdc++-v3/ChangeLog:

	* include/bits/iterator_concepts.h (weakly_incrementable): Remove
	default_initializable requirement.
	* include/bits/ranges_base.h (ranges::view): Likewise.
	* include/bits/ranges_util.h (subrange): Constrain the default
	ctor.
	* include/bits/stl_iterator.h (back_insert_iterator): Remove the
	default ctor.
	(front_insert_iterator): Likewise.
	(insert_iterator): Likewise.  Remove NSDMIs.
	(common_iterator): Constrain the default ctor.
	(counted_iterator): Likewise.
	* include/bits/stream_iterator.h (ostream_iterator): Remove the
	default ctor.
	* include/std/ranges (__detail::__box::operator=): Handle
	self-assignment in the primary template.
	(__detail::__box): In the partial specialization: adjust
	constraints as per P2325.  Add specialized operator= for the
	case when the wrapped type is not copyable.  Constrain the
	default ctor.  Avoid list-initialization.
	(single_view): Constraint the default ctor.
	(iota_view): Relax semiregular constraint to copyable.
	Constrain the default ctor.
	(iota_view::_Iterator): Constraint the default ctor.
	(basic_istream_view): Remove the default ctor.  Remove NSDMIs.
	Remove redundant checks for empty _M_stream.
	(basic_istream_view::_Iterator): Likewise.
	(ref_view): Remove the default ctor.  Remove NSDMIs.
	(ref_view::_Iterator): Constrain the default ctor.
	(__detail::__non_propagating_cache::operator=): Define overload
	for assigning from a value of the underlying type.
	(filter_view): Likewise.
	(filter_view::_Iterator): Likewise.
	(transform_view): Likewise.
	(transform_view::_Iterator): Likewise.
	(take_view): Likewise.
	(take_view::_Iterator): Likewise.
	(take_while_view): Likewise.
	(take_while_view::_Iterator): Likewise.
	(drop_while_view): Likewise.
	(drop_while_view::_Iterator): Likewise.
	(join_view): Likewise.
	(split_view::_OuterIter::__current): Adjust after changing the
	type of _M_current.
	(split_view::_M_current): Wrap it in a __non_propagating_cache.
	(split_view::split_view): Constrain the default ctor.
	(common_view): Constrain the default ctor.
	(reverse_view): Likewise.
	(elements_view): Likewise.
	* include/std/span (enable_view<span<_ElementType, _Extent>>):
	Define this partial specialization to true unconditionally.
	* include/std/version (__cpp_lib_ranges): Adjust value.
	* testsuite/24_iterators/back_insert_iterator/constexpr.cc:
	Don't attempt to default construct a back_insert_iterator.
	* testsuite/24_iterators/front_insert_iterator/constexpr.cc:
	Don't attempt to default construct a front_insert_iterator.
	* testsuite/24_iterators/insert_iterator/constexpr.cc:
	Don't attempt to default construct an insert_iterator.
	* testsuite/24_iterators/ostream_iterator/requirements/constexpr.cc:
	Remove this test for default constructibility of ostream_iterator.
	* testsuite/std/ranges/97600.cc: Don't attempt to default
	construct a basic_istream_view.
	* testsuite/std/ranges/adaptors/detail/semiregular_box.cc:
	Rename to ...
	* testsuite/std/ranges/adaptors/detail/copyable_box.cc: ... this.
	(test02): Adjust now that __box is copyable-box not
	semiregular-box.
	(test03): New test.
	* testsuite/std/ranges/p2325.cc: New test.
	* testsuite/std/ranges/single_view.cc (test06): New test.
	* testsuite/std/ranges/view.cc: Adjust now that view doesn't
	require default_initializable.
2021-06-17 22:29:03 -04:00
Michael Meissner 7d08043da9 Add IEEE 128-bit min/max support on PowerPC.
This patch adds the support for the IEEE 128-bit floating point C minimum and
maximum instructions.  The next patch will add the support for using the
compare and set mask instruction to implement conditional moves.

This patch does not try to re-use the code used for SF/DF min/max
support.  It defines a separate insn for the IEEE 128-bit support.  It
uses the code iterator <minmax> to simplify adding both operations.

GCC will not convert ternary operations into using min/max instructions
provided in this patch unless the user uses -Ofast.  The next patch that adds
conditional move instructions will enable the ternary conversion in many cases.

gcc/
2021-06-17  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000.c (rs6000_emit_minmax): Add support for ISA
	3.1 IEEE 128-bit floating point xsmaxcqp/xsmincqp instructions.
	* config/rs6000/rs6000.md (s<minmax><mode>3, IEEE128 iterator):
	New insns.

gcc/testsuite/
2021-06-17  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/float128-minmax-2.c: New test.
2021-06-17 22:05:16 -04:00
GCC Administrator 688359a27d Daily bump. 2021-06-18 00:16:58 +00:00
Jonathan Wakely b376b1ef38 libstdc++: Simplify constexpr checks in std::char_traits [PR 91488]
This removes the helper functions added by r8-1294 to detect whether the
char_traits member functions can be evaluated at compile time. Instead,
we can just use __builtin_constant_evaluated directly, which is well
supported by non-GCC compilers by now.

As a result, there is a chance that those members will no longer be
usable in constant expressions when using old versions of non-GCC
compilers. Make the relevant feature test macros depend on the
availability of __builtin_constant_evaluated, so they are defined only
when the feature is actualyl available.

The new testcase from the PR is added to the libitm testsuite, because
that's where we can be sure it's OK to use the -fgnu-tm option.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

	PR libstdc++/91488

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (__cpp_lib_constexpr_string): Only
	define when is_constant_evaluated is available.
	* include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
	Likewise.
	(__constant_string_p, __constant_array_p): Remove.
	(char_traits): Use is_constant_evaluated directly.
	* include/std/version (__cpp_lib_constexpr_char_traits)
	(__cpp_lib_constexpr_string): Only define when
	is_constant_evaluated is available.

libitm/ChangeLog:

	* testsuite/libitm.c++/libstdc++-pr91488.C: New test.
2021-06-17 22:00:58 +01:00
Jason Merrill 331e20a69b c++: deleted after first declaration [PR101106]
An explicitly deleted function must be deleted on its first declaration.  We
were diagnosing this error only with -Wpedantic, but always giving the
"previous declaration" note.  This patch removes the -Wpedantic dependency
and also makes the note depend on the previous diagnostic.

	PR c++/101106

gcc/cp/ChangeLog:

	* decl.c (duplicate_decls): Make 'deleted after first declaration'
	pedwarn on by default.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/deleted15.C: New test.
2021-06-17 15:48:07 -04:00