Commit Graph

186634 Commits

Author SHA1 Message Date
Doug Rupp
63b43535dc [Ada] The Unix Epochalyse of 2038 - OS_Time comparison
gcc/ada/

	* libgnat/s-os_lib.ads: Import OS_Time comparison ops as
	intrinsic.
	* libgnat/s-os_lib.adb: Remove OS_TIme comparison ops
	implementation.
2021-07-05 13:09:14 +00:00
Doug Rupp
cee731748f [Ada] The Unix Epochalypse of 2038 (Warn about time_t in the compiler)
gcc/ada/

	* libgnat/s-os_lib.ads: Add some comments about time_t.
	* libgnat/s-os_lib.adb (GM_Split/To_GM_Time): Rename formal to
	P_OS_Time.
	(GM_Time_Of/To_OS_Time): Likewise.
2021-07-05 13:09:14 +00:00
Ghjuvan Lacambre
2644eaa0b9 [Ada] Fix missing minus sign in literal translation
gcc/ada/

	* sem_res.adb (Resolve): Insert minus sign if needed.
2021-07-05 13:09:13 +00:00
Steve Baird
74895b6354 [Ada] Temporarily disable Ada 2022 Image and Put_Image support for tagged types
gcc/ada/

	* exp_put_image.adb:
	(Enable_Put_Image, Preload_Root_Buffer_Type): Revert to querying
	the -gnatd_z switch, as opposed to testing whether Ada_Version >= Ada_2022.
2021-07-05 13:09:13 +00:00
Justin Squirek
bcb8c3bba7 [Ada] INOX: prototype alternative accessibility model
gcc/ada/

	* checks.adb (Accessibility_Checks_Suppressed): Add check
	against restriction No_Dynamic_Accessibility_Checks.
	(Apply_Accessibility_Check): Add assertion to check restriction
	No_Dynamic_Accessibility_Checks is not active.
	* debug.adb: Add documentation for new debugging switch to
	control which accessibility model gets employed under
	restriction No_Dynamic_Accessibility_Checks.
	* exp_attr.adb (Expand_N_Attribute_Reference): Disable dynamic
	accessibility check generation when
	No_Dynamic_Accessibility_Checks is active.
	* exp_ch4.adb (Apply_Accessibility_Check): Skip check generation
	when restriction No_Dynamic_Accessibility_Checks is active.
	(Expand_N_Allocator): Disable dynamic accessibility checks when
	No_Dynamic_Accessibility_Checks is active.
	(Expand_N_In): Disable dynamic accessibility checks when
	No_Dynamic_Accessibility_Checks is active.
	(Expand_N_Type_Conversion): Disable dynamic accessibility checks
	when No_Dynamic_Accessibility_Checks is active.
	* exp_ch5.adb (Expand_N_Assignment_Statement): Disable
	alternative accessibility model calculations when computing a
	dynamic level for a SAOAAT.
	* exp_ch6.adb (Add_Call_By_Copy_Code): Disable dynamic
	accessibility check generation when
	No_Dynamic_Accessibility_Checks is active.
	(Expand_Branch): Disable alternative accessibility model
	calculations.
	(Expand_Call_Helper): Disable alternative accessibility model
	calculations.
	* restrict.adb, restrict.ads: Add new restriction
	No_Dynamic_Accessibility_Checks.
	(No_Dynamic_Accessibility_Checks_Enabled): Created to test when
	experimental features (which are generally incompatible with
	standard Ada) can be enabled.
	* sem_attr.adb (Safe_Value_Conversions): Add handling of new
	accessibility model under the restriction
	No_Dynamic_Accessibility_Checks.
	* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	Disallow new restriction No_Dynamic_Accessibility_Checks from
	being exclusively specified within a body or subunit without
	being present in a specification.
	* sem_res.adb (Check_Fully_Declared_Prefix): Minor comment
	fixup.
	(Valid_Conversion): Omit implicit conversion checks on anonymous
	access types and perform static checking instead when
	No_Dynamic_Accessibility_Checks is active.
	* sem_util.adb, sem_util.ads (Accessibility_Level): Add special
	handling of anonymous access objects, formal parameters,
	anonymous access components, and function return objects.
	(Deepest_Type_Access_Level): When
	No_Dynamic_Accessibility_Checks is active employ an alternative
	model. Add paramter Allow_Alt_Model to override the new behavior
	in certain cases.
	(Type_Access_Level): When No_Dynamic_Accessibility_Checks is
	active employ an alternative model. Add parameter
	Allow_Alt_Model to override the new behavior in certain cases.
	(Typ_Access_Level): Created within Accessibility_Level for
	convenience.
	* libgnat/s-rident.ads, snames.ads-tmpl: Add handing for
	No_Dynamic_Accessibility_Checks.
2021-07-05 13:09:13 +00:00
Doug Rupp
35d721c09a [Ada] The Unix Epochalypse of 2038 - Use OS_Time
gcc/ada/

	* adaint.h (__gnat_set_file_time_name): Use OS_Time.
	* adaint.c (__gnat_set_file_time_name): Likewise.
2021-07-05 13:09:12 +00:00
Doug Rupp
a0bdd4b03b [Ada] The Unix Epochalyse of 2038 - OS_Time
gcc/ada/

	* adaint.h (OS_Time): typedef as long long.
	* osint.adb (Underlying_OS_Time): Declare as 64-bit signed type.
	* libgnat/s-os_lib.adb ("<"): Compare OS_Time as
	Long_Long_Integer.
	("<="): Likewise.
	(">"): Likewise.
	(">="): Likewise.
	* libgnat/s-os_lib.ads (OS_Time): Declare as 64-bit signed type.
2021-07-05 13:09:12 +00:00
Ghjuvan Lacambre
e7b17be973 [Ada] Move overriding rename error message from declaration to use
gcc/ada/

	* sem_ch3.adb (Check_Abstract_Overriding): Post error message on
	renaming node.
2021-07-05 13:09:12 +00:00
Yannick Moy
f7b2ce2f53 [Ada] Adapt SPARK checking after change in rules regarding heap modeling
gcc/ada/

	* libgnat/a-uncdea.ads: Add Depends/Post to
	Ada.Unchecked_Deallocation.
	* sem_ch4.adb (Analyze_Allocator): Remove checking of allocator
	placement.
	* sem_res.adb (Flag_Object): Same.
2021-07-05 13:09:11 +00:00
Ghjuvan Lacambre
36d4f97d58 [Ada] Turn GNAT_Annotate into its own pragma
gcc/ada/

	* aspects.ads: Add GNAT_Annotate aspect.
	* gnat1drv.adb (Adjust_Global_Switches): Stop defining
	Name_Gnat_Annotate as an alias of Name_Annotate.
	* snames.ads-tmpl: Define Gnat_Annotate.
	* par-prag.adb, sem_prag.ads: Add Pragma_Gnat_Annotate to list
	of pragmas.
	* lib-writ.adb, sem_ch13.adb, sem_prag.adb: Handle Gnat_Annotate
	like Aspect_Annotate.
2021-07-05 13:09:11 +00:00
Piotr Trojanek
22c0e0cabd [Ada] Fix comment about the debug flag for strict alignment
gcc/ada/

	* ttypes.ads (Target_Strict_Alignment): Fix comment.
2021-07-05 13:09:11 +00:00
Piotr Trojanek
5c3bbe1d98 [Ada] Cleanup checking for compatible alignment
gcc/ada/

	* sem_util.adb (Has_Compatible_Alignment_Internal): Fix
	indentation of ELSIF comments; remove explicit calls to
	UI_To_Int; remove extra parens around the MOD operand.
2021-07-05 13:09:10 +00:00
Ed Schonberg
0b8880428c [Ada] Spurious error in instantiation with aggregate and private ancestor
gcc/ada/

	* sem_aggr.adb (Resolve_Record_Aggregate, Step_5): Do not check
	for the need to use an extension aggregate for a given component
	when within an instance and the type of the component hss a
	private ancestor: the instantiation is legal if the generic
	compiles, and spurious errors may be generated otherwise.
2021-07-05 13:09:10 +00:00
Ghjuvan Lacambre
243573ff08 [Ada] Print JSON continuation messages as separate messages
gcc/ada/

	* errout.adb (Output_JSON_Message): Recursively call
	Output_JSON_Message for continuation messages instead of
	appending their content to the initial message.
2021-07-05 13:09:10 +00:00
Steve Baird
b4b023c426 [Ada] Add Ada 2022 Image and Put_Image support for tagged types
gcc/ada/

	* debug.adb: Remove comments about -gnatd_z switch.
	* exp_ch3.adb (Make_Predefined_Primitive_Specs): A one-line fix
	for a subtle bug that took some effort to debug. Append a new
	Put_Image procedure for a type extension even if it seems to
	already have one, just as is done for (for example) the
	streaming-related Read procedure.
	* exp_put_image.adb:
	(Build_Record_Put_Image_Procedure.Make_Component_Attributes): Do
	not treat _Parent component like just another component, for two
	reasons.  1. If the _parent component's type has a
	user-specified Put_Image procedure, then we want to generate a
	call to that procedure and then generate extension aggregate
	syntax.  2. Otherwise, we still don't want to see any mention of
	"_parent" in the generated image text.
	(Build_Record_Put_Image_Procedure.Make_Component_Name): Add
	assertion that we are not generating a reference to an "_parent"
	component.
	(Build_Record_Put_Image_Procedure): Add special treatment for
	null records.  Add call to Duplicate_Subexpr for image attribute
	prefix in order to help with expansion needed in the class-wide
	case (where the prefix is also referenced in the call to
	Wide_Wide_Expanded_Name) if evaluation of the prefix has side
	effects. Add new local helper function, Put_String_Exp.  Add
	support for case where prefix type is class-wide.
	(Enable_Put_Image, Preload_Root_Buffer_Type): Query Ada_Version
	> Ada_2022 instead of (indirectly) querying -gnatd_z switch.
	* freeze.adb (In_Expanded_Body): A one-line change to add
	TSS_Put_Image to the list of subprograms that have
	expander-created bodies.
	* rtsfind.ads: Add support for accessing
	Ada.Tags.Wide_Wide_Expanded_Name.
	* sem_ch3.ads, sem_ch3.adb: Delete Is_Null_Extension function,
	as part of moving it to Sem_Util.
	* sem_ch13.adb
	(Analyze_Put_Image_TSS_Definition.Has_Good_Profile): Improve
	diagnostic messages in cases where the result is going to be
	False and the Report parameter is True. Relax overly-restrictive
	checks in order to implement mode conformance.
	(Analyze_Stream_TSS_Definition.Has_Good_Profile): Add similar
	relaxation of parameter subtype checking for the Stream
	parameter of user-defined streaming subprograms.
	* sem_disp.adb (Check_Dispatching_Operation): A one-line
	change (and an accompanying comment change) to add TSS_Put_Image
	to the list of compiler-generated dispatching primitive
	operations.
	* sem_util.ads, sem_util.adb: Add Ignore_Privacy Boolean
	parameter to Is_Null_Record_Type function (typically the
	parameter will be False when the function is being used in the
	implementation of static semantics and True for dynamic
	semantics; the parameter might make a difference in the case of,
	for example, a private type that is implemented as a null record
	type).  Add related new routines Is_Null_Extension (formerly
	declared in Sem_Ch3), Is_Null_Extension_Of, and
	Is_Null_Record_Definition.
2021-07-05 13:09:09 +00:00
Justin Squirek
b9713be32b [Ada] Fix crash when printing error message
gcc/ada/

	* freeze.adb (Freeze_Profile): Use N's Sloc, F_type's chars.
2021-07-05 13:09:09 +00:00
Bob Duff
7c4f32677b [Ada] Clean up Get_Index_Bounds
gcc/ada/

	* checks.adb, exp_aggr.adb, exp_ch5.adb, freeze.adb,
	sem_util.adb, sem_util.ads: Change L and H to be First and Last,
	to match the attributes in the RM. Change calls from procedure
	to function where appropriate.
2021-07-05 13:09:09 +00:00
Bob Duff
8926c29c5f [Ada] Refactoring related to Returns_By_Ref
gcc/ada/

	* sem_util.ads, sem_util.adb (Compute_Returns_By_Ref): New
	procedure to compute Returns_By_Ref, to avoid some code
	duplication. This will likely change soon, so it's good to have
	the code in one place.
	(CW_Or_Has_Controlled_Part): Move here from Exp_Ch7, because
	it's called by Compute_Returns_By_Ref, and this is a better
	place for it anyway.
	(Needs_Finalization): Fix comment to be vague instead of wrong.
	* exp_ch6.adb (Expand_N_Subprogram_Body, Freeze_Subprogram):
	Call Compute_Returns_By_Ref.
	* sem_ch6.adb (Check_Delayed_Subprogram): Call
	Compute_Returns_By_Ref.
	* exp_ch7.ads, exp_ch7.adb (CW_Or_Has_Controlled_Part): Move to
	Sem_Util.
	(Has_New_Controlled_Component): Remove unused function.
2021-07-05 13:09:08 +00:00
Ghjuvan Lacambre
767f9cb1f8 [Ada] Fix overriding subprogram being incorrectly seen as returning
gcc/ada/

	* sem_ch3.adb (Check_Abstract_Overriding): Check for renamings.
2021-07-05 13:09:08 +00:00
Boris Yakobowski
afe5959e11 [Ada] Do not catch 'N rem -1' in CodePeer_Mode
gcc/ada/

	* exp_ch4.adb (Expand_N_Op_Rem): Remove special case for rem -1
	in CodePeer_Mode.
2021-07-05 13:09:07 +00:00
Christophe Lyon
0ea47850bb testsuite: gcc.dg/debug/btf/btf-bitfields-3.c requires -fno-short-enums PR debug/101321
arm-eabi uses -fshort-enums by default while arm-linux-gnueabi* do not,
like most (all?) other targets, but this test relies -fno-short-enums.
Fix it by forcing -fno-short-enums.

2021-07-05  Christophe Lyon  <christophe.lyon@foss.st.com>

	PR debug/101321
	gcc/testsuite/
	* gcc.dg/debug/btf/btf-bitfields-3.c: Add -fno-short-enums.
2021-07-05 11:41:21 +00:00
Richard Biener
88ada5c051 Do not set both LOOP_C_INFINITE and LOOP_C_FINITE on vectorized loop
The setting is likely a typo and was meant to affect the scalar version
but even there LOOP_C_INFINITE is at most an optimization to the
niter analysis.  Clearly setting it on the vectorized loop which we
just versioned to be _not_ infinite is bogus so the following change
removes this.

2021-07-05  Richard Biener  <rguenther@suse.de>

	* tree-vect-loop-manip.c (vect_loop_versioning): Do not
	set LOOP_C_INFINITE on the vectorized loop.
2021-07-05 13:38:42 +02:00
Richard Biener
38872c6c0d middle-end/101291 - set loop copy of versioned loop
This fixes the vectorizer loop versioning code failing to clear
niter related info on the scalar loop as it assumed get_loop_copy
would work even for the outermost loop.  The patch makes that
assumption hold by adjusting the loop versioning code.

2021-07-05  Richard Biener  <rguenther@suse.de>

	PR middle-end/101291
	* cfgloopmanip.c (loop_version): Set the loop copy of the
	versioned loop to the new loop.
2021-07-05 12:51:52 +02:00
Richard Biener
ccb4e0774b testsuite/101299 - add missing vect_double requires to bb-slp-74.c
This should fix the FAIL of gcc.dg/vect/bb-slp-74.c on arm.

2021-07-05  Richard Biener  <rguenther@suse.de>

	PR testsuite/101299
	* gcc.dg/vect/bb-slp-74.c: Add vect_double requires.
2021-07-05 08:41:08 +02:00
liuhongt
9c6ce6b04c Remove xfail for pr92658-avx512vl.c
Typo of standard pattern name has been fixed by r12-1970, remove those
xfails.

gcc/testsuite/ChangeLog

	* gcc.target/i386/pr92658-avx512vl.c: Refine testcase.
2021-07-05 13:05:51 +08:00
GCC Administrator
65b8273cc0 Daily bump. 2021-07-05 00:16:28 +00:00
Iain Sandoe
d07092a61d Darwin, config : Adjust X86 biarch definitions ordering [PR100269].
This reorganises the biarch definitions to cater for the
macro changes and removals at r12-36.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

PR target/100269 - [12 Regression] i686 biarch compiler fails for Darwin after r12-36.

        PR target/100269

gcc/ChangeLog:

	PR target/100269
	* config.gcc: Ensure that Darwin biarch definitions are
	added before i386.h.
	* config/i386/darwin.h (TARGET_64BIT): Remove.
	(PR80556_WORKAROUND): New.
	(REAL_LIBGCC_SPEC): Amend to use PR80556_WORKAROUND.
	(DARWIN_SUBARCH_SPEC): New.
	* config/i386/darwin32-biarch.h (TARGET_64BIT_DEFAULT,
	TARGET_BI_ARCH, PR80556_WORKAROUND): New.
	(REAL_LIBGCC_SPEC): Remove.
	* config/i386/darwin64-biarch.h (TARGET_64BIT_DEFAULT,
	TARGET_BI_ARCH, PR80556_WORKAROUND): New.
	(REAL_LIBGCC_SPEC): Remove.
2021-07-04 20:39:10 +01:00
GCC Administrator
e6f3adc899 Daily bump. 2021-07-04 00:16:25 +00:00
David Edelsohn
981351e87b testsuite: Disable BTF and CTF testsuite on AIX.
CTF utilizes DWARF sections, but it is a distinct debugging
	format.  The CTF support in GCC is not implemented as a
	separate debugging format.  AIX supports DWARF but not CTF
	section.

	The GCC testsuite test for target support of a debugging format
	checks if GCC itself emits an error message, not if the
	debugging output compiles correctly.  Because CTF is not
	a distinct debugging format, GCC does not distinguish support
	for targets and does not have the ability to produce an error
	message.

	This patch skips the CTF and BTF debug directories, and
	explicitly reports that AIX doesn't support CTF.  Currently the
        dejagnu code to skip multiple debugging levels for CTF does
        not ensure that CTF is a supported debugging format. The patch
	also shifts the CTF options logic to within the test that CTF
	debug format is supported.

Bootstrapped on powerpc-ibm-aix7.2.3.0 and powerpc64le-linux.

gcc/testsuite/ChangeLog:

	* gcc.dg/debug/btf/btf.exp: Skip on AIX.
	* gcc.dg/debug/ctf/ctf.exp: Skip on AIX.
	* lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): AIX
	doesn't support CTF.
	(gcc-dg-debug-runtest): Move CTF support within
	target support format test.
2021-07-03 17:49:54 -04:00
H.J. Lu
52c3fdf3e4 Don't use vec_duplicate on vector in CTOR expansion
Since vec_duplicate only works on scalar, don't use it on vector in
store constructor expansion.

gcc/

	PR middle-end/101294
	* expr.c (store_constructor): Don't use vec_duplicate on vector.

gcc/testsuite/

	PR middle-end/101294
	* gcc.dg/pr101294.c: New test.
2021-07-03 04:39:12 -07:00
Iain Buclaw
152f4d0e4d d: Missed RVO optimization with non-POD structs
The D front-end semantic pass sometimes declares a temporary inside a
return expression.  This is now detected with the RESULT_DECL replacing
the temporary, allowing for RVO to be done.

	PR d/101273

gcc/d/ChangeLog:

	* toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returns that
	use a temporary, and replace with return value.

gcc/testsuite/ChangeLog:

	* gdc.dg/torture/pr101273.d: New test.
2021-07-03 13:00:56 +02:00
GCC Administrator
7a60a6e8b3 Daily bump. 2021-07-03 00:16:31 +00:00
Iain Buclaw
c77230856e d: RHS value lost when a target_expr modifies LHS in a cond_expr
To prevent the RHS of an assignment modifying the LHS before the
assignment proper, a target_expr is forced so that function calls that
return with slot optimization modify the temporary instead.  This did
not work for conditional expressions however, to give one example.  So
now the RHS is always forced to a temporary.

	PR d/101282

gcc/d/ChangeLog:

	* d-codegen.cc (build_assign): Force target_expr on RHS for non-POD
	assignment expressions.

gcc/testsuite/ChangeLog:

	* gdc.dg/torture/pr101282.d: New test.
2021-07-03 00:43:57 +02:00
Martin Sebor
6feb628a70 Improve warning suppression for inlined functions [PR98512].
Resolves:
PR middle-end/98871 - Cannot silence -Wmaybe-uninitialized at declaration site
PR middle-end/98512 - #pragma GCC diagnostic ignored ineffective in conjunction with alias attribute

gcc/ChangeLog:

	PR middle-end/98871
	PR middle-end/98512
	* diagnostic.c (get_any_inlining_info): New.
	(update_effective_level_from_pragmas): Handle inlining context.
	(diagnostic_enabled): Same.
	(diagnostic_report_diagnostic): Same.
	* diagnostic.h (struct diagnostic_info): Add ctor.
	(struct diagnostic_context): Add new member.
	* tree-diagnostic.c (set_inlining_locations): New.
	(tree_diagnostics_defaults): Set new callback pointer.
2021-07-02 16:19:35 -06:00
Jakub Jelinek
9984f63aab openmp: Initial support for OpenMP directives expressed as C++11 attributes
This is an OpenMP 5.1 feature, but I think it is something very useful for
OpenMP users, so I'm committing it now instead of waiting until all 5.0
work is done.

The support is incomplete, only attributes on statements (or block local
declarations) are supported right now, while for non-executable directives
they should be also supported at namespace scope and at class scope, and
for declarations in all places that appertain to the declarations rather
than e.g. types.

I need to also fix up handling of C++11 non-OpenMP attributes mixed with
OpenMP attributes before block local declarations (currently it throws
them away), probably reject if the directives appertain to labels etc.

In order not to complicate all the OpenMP directive parsing, it is done
by remembering the tokens from the attribute, slightly adjusting them and
feeding them through a temporary new lexer to cp_parse_pragma.

2021-07-02  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
	* c-common.h (enum c_omp_directive_kind): New enum.
	(struct c_omp_directive): New type.
	(c_omp_categorize_directive): Declare.
	* c-omp.c (omp_directives): New variable.
	(c_omp_categorize_directive): New function.
gcc/cp/
	* parser.h (struct cp_lexer): Add in_omp_attribute_pragma member.
	(struct cp_omp_declare_simd_data): Likewise.
	* cp-tree.h (enum cp_tree_index): Add CPTI_OMP_IDENTIFIER.
	(omp_identifier): Define.
	* parser.c (cp_parser_skip_to_pragma_eol): Handle
	in_omp_attribute_pragma CPP_PRAGMA_EOL followed by CPP_EOF.
	(cp_parser_require_pragma_eol): Likewise.
	(struct cp_omp_attribute_data): New type.
	(cp_parser_handle_statement_omp_attributes): New function.
	(cp_parser_statement): Handle OpenMP directives in statement's
	attribute-specifier-seq.
	(cp_parser_omp_directive_args, cp_parser_omp_sequence_args): New
	functions.
	(cp_parser_std_attribute): Handle omp::directive and omp::sequence
	attributes.
	(cp_parser_omp_all_clauses): If in_omp_attribute_pragma, allow
	a comma also before the first clause.
	(cp_parser_omp_allocate): Likewise.
	(cp_parser_omp_atomic): Likewise.
	(cp_parser_omp_depobj): Likewise.
	(cp_parser_omp_flush): Likewise.
	(cp_parser_omp_ordered): Likewise.
	(cp_parser_omp_declare_simd): Save in_omp_attribute_pragma
	into struct cp_omp_declare_simd_data.
	(cp_finish_omp_declare_variant): Add in_omp_attribute_pragma
	argument.  If set, allow a comma also before match clause.
	(cp_parser_late_parsing_omp_declare_simd): If in_omp_attribute_pragma,
	allow a comma also before the first clause.  Adjust
	cp_finish_omp_declare_variant caller.
	(cp_parser_omp_declare_target): If in_omp_attribute_pragma, allow
	a comma also before the first clause.
	(cp_parser_omp_declare_reduction_exprs): Likewise.
	(cp_parser_omp_requires): Likewise.
	* decl.c (initialize_predefined_identifiers): Initialize
	omp_identifier.
	* decl2.c (cplus_decl_attributes): Reject omp::directive and
	omp::sequence attributes.
gcc/testsuite/
	* g++.dg/gomp/attrs-1.C: New test.
	* g++.dg/gomp/attrs-2.C: New test.
	* g++.dg/gomp/attrs-3.C: New test.
2021-07-02 21:59:21 +02:00
Jakub Jelinek
2ca8939428 openmp: Reject #pragma omp atomic update, [PR101297]
I've noticed that we allow a trailing comma on OpenMP atomic construct
if there is at least one clause.  Commas should be only allowed to
separate the clauses (or in OpenMP 5.1 to separate directive name
from the clauses).

2021-07-02  Jakub Jelinek  <jakub@redhat.com>

	PR c/101297
	* c-parser.c (c_parser_omp_atomic): Consume comma only if it
	appears before a CPP_NAME.

	* parser.c (cp_parser_omp_atomic): Consume comma only if it
	appears before a CPP_NAME.

	* c-c++-common/gomp/atomic-24.c: New test.
2021-07-02 21:57:24 +02:00
Patrick Palka
e3528ce197 c++: unqualified member template in constraint [PR101247]
Here any_template_parm_r is failing to mark the template parameters
implicitly used by the unqualified use of 'd' inside the constraint
because the code to do so assumes each level of a template parameter
list points to the corresponding primary template, but here the
parameter level for A in the out-of-line definition of A::B does not
(nor do the parameter levels for A and C in the definition of A::C),
which causes us to overlook the sharing.

So it seems we can't in general depend on the TREE_TYPE of a template
parameter level being non-empty here.  This patch partially fixes this
by rewriting the relevant part of any_template_parm_r to not depend on
the TREE_TYPE of outer levels.  We still depend on the innermost level
to point to the innermost primary template, so we still crash on the
commented out line in the below testcase.

	PR c++/101247

gcc/cp/ChangeLog:

	* pt.c (any_template_parm_r) <case TEMPLATE_DECL>: Rewrite to
	use common_enclosing_class and to not depend on the TREE_TYPE
	of outer levels pointing to the corresponding primary template.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-memtmpl4.C: New test.
2021-07-02 13:54:57 -04:00
Peter Bergner
42a9e4e138 rs6000: Add MMA __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
Add support for the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
to keep in sync with LLVM which added these earlier.

2021-07-02  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin.def (BU_MMA_PAIR_LD, BU_MMA_PAIR_ST):
	New macros.
	(__builtin_vsx_lxvp, __builtin_vsx_stxvp): New built-ins.
	* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Expand
	lxvp and stxvp built-ins.
	(mma_init_builtins): Handle lxvp and stxvp built-ins.
	(builtin_function_type): Likewise.
	* doc/extend.texi (__builtin_vsx_lxvp, __builtin_mma_stxvp): Document.

gcc/testsuite/
	* gcc.target/powerpc/mma-builtin-7.c: New test.
	* gcc.target/powerpc/mma-builtin-8.c: New test.
2021-07-02 11:28:45 -05:00
Jeff Law
7aa5fb17a3 Use shift instructions to eliminate redundant compare/test instructions on the H8
gcc/ChangeLog

	* config/h8300/h8300-protos.h (compute_a_shift_cc): Accept
	additional argument for the code.
	* config/h8300/h8300.c (compute_a_shift_cc): Accept additional
	argument for the code.  Just return if the ZN bits are useful or
	not rather than the old style CC_* enums.
	* config/h8300/shiftrotate.md (shiftqi_noscratch): Move before
	more generic shiftqi patterns.
	(shifthi_noscratch, shiftsi_noscratch): Similarly.
	(shiftqi_noscratch_set_flags): New pattern.
	(shifthi_noscratch_set_flags, shiftsi_noscratch_set_flags): Likewise.
2021-07-02 12:02:31 -04:00
Andrew MacLeod
84f7bab892 Fix build_gt and build_lt for signed 1 bit values.
Signed 1 bit values have a range of [-1, 0] but neither (0 - 1) nor (-1 + 1)
can be represented.  For signed values, add or subtract -1 as appropriate.

	PR tree-optimization/101223
	gcc/
	* range-op.cc (build_lt): Add -1 for signed values.
	(built_gt): Subtract -1 for signed values.

	gcc/testsuite/
	* gcc.dg/pr101223.c: New.
2021-07-02 11:34:53 -04:00
David Faust
18d0fad77b BTF: Support for BTF_KIND_FLOAT
Add BTF_KIND_FLOAT, a new BTF type kind which has recently stabilized in
the linux kernel [1]. This kind is used for encoding floating point
types, and is of particular use when generating BTF for some s390
arch-specific kernel headers.

Also update some BTF tests which previously used floating point types to
check correct behavior for types with no BTF representation.

[1]: b1828f0b04

include/ChangeLog:

	* btf.h (struct btf_type): Update bit usage comment.
	(BTF_INFO_KIND): Update bit mask.
	(BTF_KIND_FLOAT): New define.
	(BTF_KIND_MAX): Update.

gcc/ChangeLog:

	* btfout.c (get_btf_kind): Support BTF_KIND_FLOAT.
	(btf_asm_type): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.dg/debug/btf/btf-float-1.c: New test.
	* gcc.dg/debug/btf/btf-function-3.c: Use different unrepresentable type.
	* gcc.dg/debug/btf/btf-struct-2.c: Likewise.
	* gcc.dg/debug/btf/btf-variables-2.c: Likewise.
2021-07-02 08:32:44 -07:00
Jeff Law
b60761baa6 Preparing to use shifts to eliminate redundant test/compare insns on H8
* config/h8300/h8300-protos.h (output_a_shift): Make first argument
	an array of rtx rather than a pointer to rtx.  Add code argument.
	(compute_a_shift_length): Similarly.
	* config/h8300/h8300.c (h8300_shift_costs): Adjust now that the
	shift itself isn't an operand.  Create dummy operand[0] to carry
	a mode and pass a suitable rtx code to compute_a_shift_length.
	(get_shift_alg): Adjust operand number of clobber in output templates.
	(output_a_shift): Make first argument an array of rtx rather than
	a pointer to rtx.  Add code argument for the type of shift.
	Adjust now that the shift itself is no longer an operand.
	(compute_a_shift_length): Similarly.
	* config/h8300/shiftrotate.md (shiftqi, shifthi, shiftsi): Use an
	iterator rather than nshift_operator.
	(shiftqi_noscratch, shifthi_noscratch, shiftsi_noscratch): Likewise.
	(shiftqi_clobber_flags): Adjust to API changes in output_a_shift
	and compute_a_shift_length.
	(shiftqi_noscratch_clobber_flags): Likewise.
	(shifthi_noscratch_clobber_flags): Likewise.
	(shiftsi_noscratch_clobber_flags): Likewise.
2021-07-02 11:18:49 -04:00
Iain Sandoe
8501743106 Darwin, CTF, BTF: Do not run the DWARF debug link for BTF/CTF [PR101283].
Darwin uses an efficient two-stage process for debug linking.
The static linker (ld64) notes the inputs required but does not
link the debug.  When required / on demand the debug is linked
into a separate package by the debug linker (dsymutil).  At
present none of the Darwin tools consume or understand BTF/CTF.
The static linker silently accepts the sections (but will not
act on them as containing anything to be processed).

However, the debug linker produces a warning that it has been
presented with input with no [DWARF] debug content:
warning: no debug symbols in executable (-arch x86_64).

This causes several testsuite fails with excess errors.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf

	PR debug/101283

gcc/ChangeLog:

	* config/darwin.h (DSYMUTIL_SPEC): Do not try to run
	dsymutil for BTF/CTF.
2021-07-02 15:50:16 +01:00
Iain Sandoe
eb817f27e8 Darwin, BTF: Provide a suitable section name for BTF [PR101283].
In a similar manner to r12-1960-gcc8453012f75d, this provides a
placeholder section name for BTF data.  This change groups BTF
and CTF debug formats in the same segment, but keeps them in
separate sections.

As per the CTF section designation, this should be agreed or
amended to an agreed form before GCC 12 ships.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf

	PR debug/101283

gcc/ChangeLog:

	* config/darwin.h (CTF_INFO_SECTION_NAME): Update the
	segment to include BTF.
	(BTF_INFO_SECTION_NAME): New.
2021-07-02 15:50:15 +01:00
Jeff Law
f6aa1c34e4 Fix m32r target specific fallout from recent int->bool changes
gcc/ChangeLog

	* config/m32r/m32r-protos.h (call_operand): Adjust return type.
	(small_data_operand, memreg_operand, small_insn_p): Likewise.
	* config/m32r/m32r.c (call_operand): Adjust return type.
	(small_data_operand, memreg_operand): Likewise.
2021-07-02 10:48:26 -04:00
Jeff Law
ef9cc434a4 Fix frv target specific fallout from recent int->bool changes
gcc/ChangeLog

	* config/frv/frv-protos.h  (integer_register_operand): Adjust return
	type.
	(frv_load_operand, gpr_or_fpr_operand, gpr_no_subreg_operand): Likewise.
	(fpr_or_int6_operand, gpr_or_int_operand); Likewise.
	(gpr_or_int12_operand, gpr_or_int10_operand); Likewise.
	(move_source_operand, move_destination_operand): Likewise.
	(condexec_source_operand, condexec_dest_operand): Likewise.
	(lr_operand, gpr_or_memory_operand, fpr_or_memory_operand): Likewise.
	(reg_or_0_operand, fcc_operand, icc_operand, cc_operand): Likewise.
	(fcr_operand, icr_operand, cr_operand, call_operand): Likewise.
	(fpr_operand, even_reg_operand, odd_reg_operand): Likewise.
	(even_gpr_operand, odd_gpr_operand, quad_fpr_operand): Likewise.
	(even_fpr_operand, odd_fpr_operand): Likewise.
	(dbl_memory_one_insn_operand, dbl_memory_two_insn_operand): Likewise.
	(int12_operand, int6_operand, int5_operand, uint5_operand): Likewise.
	(uint4_operand, uint1_operand, int_2word_operand): Likewise
	(upper_int16_operand, uint16_operand, symbolic_operand): Likewise.
	(relational_operator, float_relational_operator): Likewise.
	(ccr_eqne_operator, minmax_operator): Likewise.
	(condexec_si_binary_operator, condexec_si_media_operator): Likewise.
	(condexec_si_divide_operator, condexec_si_unary_operator): Likewise.
	(condexec_sf_conv_operator, condexec_sf_add_operator): Likewise.
	(intop_compare_operator, acc_operand, even_acc_operand): Likewise.
	(quad_acc_operand, accg_operand): Likewise.
2021-07-02 10:45:12 -04:00
Maxim Kuvyrkov
021d6d5425 Add description of how testsuite parallelization works
... for the benefit of the next poor soul who will need to debug it.

	gcc/testsuite/
	* lib/gcc-defs.exp: Add a comment.
2021-07-02 14:41:21 +00:00
Jeff Law
a6fef2e1b6 Fix xstormy16 target specific fallout from recent int->bool changes
gcc/
	* config/stormy16/stormy16-protos.h (xstormy16_below_100_symbol): Change
	return type to a bool.
	(nonimmediate_nonstack_operand): Likewise.
	(xstormy16_splittable_below100_operand): Likewise.
	* config/stormy16/stormy16.c (xstormy16_below_100_symbol): Fix
	return type.
	(xstormy16_splittable_below100_operand): Likewise.
2021-07-02 10:35:26 -04:00
Richard Biener
4546f423ec tree-optimization/101293 - further enhance LIMs ref canonicalization
This makes sure to handle MEM[p + 4] and MEM[p].j with j at offset 4
as the same ref in store motion.  For hashing we need to be
more restrictive in what we handle since there's no poly-int
handlers for inchash.  For comparison we can compare poly_offsets directly.

2021-07-02  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101293
	* tree-ssa-loop-im.c (mem_ref_hasher::equal): Compare MEM_REF bases
	with combined offsets.
	(gather_mem_refs_stmt): Hash MEM_REFs as if their offset were
	combined with the rest of the offset.

	* gcc.dg/tree-ssa/ssa-lim-15.c: New testcase.
2021-07-02 13:54:30 +02:00
Jonathan Wakely
bc8f0ed704 libstdc++: Revert changes to std::unique_ptr<T[]>::operator[] [PR 101271]
This reverts the changes in r12-1778 which added a noexcept-specifier to
std::unique_ptr<T[]>::operator[], and the changes in r12-1844 which
tried to make it work with incomplete types (for PR 101236).

The noexcept-specifier is not required by the standard, and is causing
regressions, so just remove it.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/101271
	* include/bits/unique_ptr.h (unique_ptr<T[],D>::operator[]):
	Remove noexcept-specifier.
	(unique_ptr<T[],D>::_S_nothrow_deref): Remove.
	* testsuite/20_util/unique_ptr/lwg2762.cc: Remove checks for
	operator[].
2021-07-02 12:15:28 +01:00