Commit graph

188477 commits

Author SHA1 Message Date
Ghjuvan Lacambre
8279a1125f [Ada] Stub CUDA_Device aspect
gcc/ada/

	* aspects.ads: Add CUDA_Device aspect.
	* gnat_cuda.ads (Add_CUDA_Device_Entity): New subprogram.
	* gnat_cuda.adb:
	(Add_CUDA_Device_Entity): New subprogram.
	(CUDA_Device_Entities_Table): New hashmap for CUDA_Device
	entities.
	(Get_CUDA_Device_Entities): New internal subprogram.
	(Set_CUDA_Device_Entities): New internal subprogram.
	* par-prag.adb (Prag): Handle pragma id Pragma_CUDA_Device.
	* sem_prag.ads (Aspect_Specifying_Pragma): Mark CUDA_Device as
	being both aspect and pragma.
	* sem_prag.adb (Analyze_Pragma): Add CUDA_Device entities to
	list of CUDA_Entities belonging to package N.
	(Sig_Flags): Signal CUDA_Device entities as referenced.
	* snames.ads-tmpl: Create CUDA_Device names and pragmas.
2021-10-01 06:13:37 +00:00
Gary Dismukes
28c49456b2 [Ada] Assert_Failure on derived type with inherited Default_Initial_Condition
gcc/ada/

	* exp_util.adb (Build_DIC_Procedure_Body): Remove inappropriate
	Assert pragma.  Remove unneeded and dead code related to derived
	private types.
2021-10-01 06:13:37 +00:00
Richard Kenner
698425f5cc [Ada] Add more node unions
gcc/ada/

	* gen_il-gen-gen_nodes.adb (N_Alternative, N_Is_Case_Choice):
	Add.
	(N_Is_Exception_Choice, N_Is_Range): Likewise.
	* gen_il-types.ads: Add above names.
	* gen_il-gen.adb (Put_Union_Membership): Write both declarations
	and definitions of union functions.
2021-10-01 06:13:37 +00:00
Ed Schonberg
8b1a5da38e [Ada] Implementation of AI12-0212: iterator specs in array aggregates (II)
gcc/ada/

	* exp_aggr.adb (Expand_Array_Aggregate,
	Two_Pass_Aggregate_Expansion): Increment index for element
	insertion within the loop, only if upper bound has not been
	reached.
2021-10-01 06:13:37 +00:00
Javier Miranda
475e1d2400 [Ada] Ada2022: AI12-0195 overriding class-wide pre/postconditions
gcc/ada/

	* contracts.ads (Make_Class_Precondition_Subps): New subprogram.
	(Merge_Class_Conditions): New subprogram.
	(Process_Class_Conditions_At_Freeze_Point): New subprogram.

	* contracts.adb (Check_Class_Condition): New subprogram.
	(Set_Class_Condition): New subprogram.
	(Analyze_Contracts): Remove code analyzing class-wide-clone
	subprogram since it is no longer built.
	(Process_Spec_Postconditions): Avoid processing twice seen
	subprograms.
	(Process_Preconditions): Simplify its functionality to
	non-class-wide preconditions.
	(Process_Preconditions_For): No action needed for wrappers and
	helpers.
	(Make_Class_Precondition_Subps): New subprogram.
	(Process_Class_Conditions_At_Freeze_Point): New subprogram.
	(Merge_Class_Conditions): New subprogram.
	* exp_ch6.ads (Install_Class_Preconditions_Check): New
	subprogram.
	* exp_ch6.adb (Expand_Call_Helper): Install class-wide
	preconditions check on dispatching primitives that have or
	inherit class-wide preconditions.
	(Freeze_Subprogram): Remove code for null procedures with
	preconditions.
	(Install_Class_Preconditions_Check): New subprogram.
	* exp_util.ads (Build_Class_Wide_Expression): Lower the
	complexity of this subprogram; out-mode formal Needs_Wrapper
	since this functionality is now provided by a new subprogram.
	(Get_Mapped_Entity): New subprogram.
	(Map_Formals): New subprogram.
	* exp_util.adb (Build_Class_Wide_Expression): Lower the
	complexity of this subprogram. Its previous functionality is now
	provided by subprograms Needs_Wrapper and Check_Class_Condition.
	(Add_Parent_DICs): Map the overridden primitive to the
	overriding one.
	(Get_Mapped_Entity): New subprogram.
	(Map_Formals): New subprogram.
	(Update_Primitives_Mapping): Adding assertion.
	* freeze.ads (Check_Inherited_Conditions): Subprogram made
	public with added formal to support late overriding.
	* freeze.adb (Check_Inherited_Conditions): New implementation;
	builds the dispatch table wrapper required for class-wide
	pre/postconditions; added support for late overriding.
	(Needs_Wrapper): New subprogram.
	* sem.ads (Inside_Class_Condition_Preanalysis): New global
	variable.
	* sem_disp.ads (Covered_Interface_Primitives): New subprogram.
	* sem_disp.adb (Covered_Interface_Primitives): New subprogram.
	(Check_Dispatching_Context): Skip checking context of
	dispatching calls during preanalysis of class-wide conditions
	since at that stage the expression is not installed yet on its
	definite context.
	(Check_Dispatching_Call): Skip checking 6.1.1(18.2/5) by
	AI12-0412 on helpers and wrappers internally built for
	supporting class-wide conditions; for late-overriding
	subprograms call Check_Inherited_Conditions to build the
	dispatch-table wrapper (if required).
	(Propagate_Tag): Adding call to
	Install_Class_Preconditions_Check.
	* sem_util.ads (Build_Class_Wide_Clone_Body): Removed.
	(Build_Class_Wide_Clone_Call): Removed.
	(Build_Class_Wide_Clone_Decl): Removed.
	(Class_Condition): New subprogram.
	(Nearest_Class_Condition_Subprogram): New subprogram.
	* sem_util.adb (Build_Class_Wide_Clone_Body): Removed.
	(Build_Class_Wide_Clone_Call): Removed.
	(Build_Class_Wide_Clone_Decl): Removed.
	(Class_Condition): New subprogram.
	(Nearest_Class_Condition_Subprogram): New subprogram.
	(Eligible_For_Conditional_Evaluation): No need to evaluate
	class-wide conditions during preanalysis since the expression is
	not installed on its definite context.
	* einfo.ads (Class_Wide_Clone): Removed.
	(Class_Postconditions): New attribute.
	(Class_Preconditions): New attribute.
	(Class_Preconditions_Subprogram): New attribute.
	(Dynamic_Call_Helper): New attribute.
	(Ignored_Class_Postconditions): New attribute.
	(Ignored_Class_Preconditions): New attribute.
	(Indirect_Call_Wrapper): New attribute.
	(Is_Dispatch_Table_Wrapper): New attribute.
	(Static_Call_Helper): New attribute.
	* exp_attr.adb (Expand_N_Attribute_Reference): When the prefix
	is of an access-to-subprogram type that has class-wide
	preconditions and an indirect-call wrapper of such subprogram is
	available, replace the prefix by the wrapper.
	* exp_ch3.adb (Build_Class_Condition_Subprograms): New
	subprogram.
	(Register_Dispatch_Table_Wrappers): New subprogram.
	* exp_disp.adb (Build_Class_Wide_Check): Removed; class-wide
	precondition checks now rely on internally built helpers.
	* sem_ch13.adb (Analyze_Aspect_Specifications): Set initial
	value of attributes Class_Preconditions, Class_Postconditions,
	Ignored_Class_Preconditions and Ignored_Class_Postconditions.
	These values are later updated with the full pre/postcondition
	by Merge_Class_Conditions.
	(Freeze_Entity_Checks): Call
	Process_Class_Conditions_At_Freeze_Point.
	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove code
	building the body of the class-wide clone subprogram since it is
	no longer required.
	(Install_Entity): Adding assertion.
	* sem_prag.adb (Analyze_Pre_Post_Condition_In_Decl_Part): Remove
	code building and analyzing the class-wide clone subprogram; no
	longer required.
	(Build_Pragma_Check_Equivalent): Adjust call to
	Build_Class_Wide_Expression since the formal named Needs_Wrapper
	has been removed.
	* sem_attr.adb (Analyze_Attribute_Old_Result): Skip processing
	these attributes during preanalysis of class-wide conditions
	since at that stage the expression is not installed yet on its
	definite context.
	* sem_res.adb (Resolve_Actuals): Skip applying RM 3.9.2(9/1) and
	SPARK RM 6.1.7(3) on actuals of internal helpers and wrappers
	built to support class-wide preconditions.
	* sem_ch5.adb (Process_Bounds): Do not generate a constant
	declaration for the bounds when we are preanalyzing a class-wide
	condition.
	(Analyze_Loop_Parameter_Specification): Handle preanalysis of
	quantified expression placed in the outermost expression of a
	class-wide condition.
	* ghost.adb (Check_Ghost_Context): No check required during
	preanalysis of class-wide conditions.
	* gen_il-fields.ads (Opt_Field_Enum): Adding
	Class_Postconditions, Class_Preconditions,
	Class_Preconditions_Subprogram, Dynamic_Call_Helper,
	Ignored_Class_Postconditions, Ignored_Class_Preconditions,
	Indirect_Call_Wrapper, Is_Dispatch_Table_Wrapper,
	Static_Call_Helper.
	* gen_il-gen-gen_entities.adb (Is_Dispatch_Table_Wrapper):
	Adding semantic flag Is_Dispatch_Table_Wrapper; removing
	semantic field Class_Wide_Clone; adding semantic fields for
	Class_Postconditions, Class_Preconditions,
	Class_Preconditions_Subprogram, Dynamic_Call_Helper,
	Ignored_Class_Postconditions, Indirect_Call_Wrapper,
	Ignored_Class_Preconditions, and Static_Call_Helper.
2021-10-01 06:13:37 +00:00
Piotr Trojanek
fa465c1b60 [Ada] Fix deleting CodePeer files for non-ordinary units
gcc/ada/

	* comperr.adb (Delete_SCIL_Files): Handle generic subprogram
	declarations and renaming just like generic package declarations
	and renamings, respectively; handle
	N_Subprogram_Renaming_Declaration.
2021-10-01 06:13:36 +00:00
Steve Baird
19ab5a56d6 [Ada] Improve error message for .ali file version mismatch
gcc/ada/

	* bcheck.adb (Check_Versions): Add support for the case where
	the .ali file contains both a primary and a secondary version
	number, as in "GNAT Lib v22.20210809".
2021-10-01 06:13:36 +00:00
Steve Baird
aa4648eef4 [Ada] Fix bug in inherited user-defined-literal aspects for tagged types
gcc/ada/

	* sem_res.adb (Resolve): Two separate fixes. In the case where
	Find_Aspect for a literal aspect returns the aspect for a
	different (ancestor) type, call Corresponding_Primitive_Op to
	get the right callee. In the case where a downward tagged type
	conversion appears to be needed, generate a null extension
	aggregate instead, as per Ada RM 3.4(27).
	* sem_util.ads, sem_util.adb: Add new Corresponding_Primitive_Op
	function. It maps a primitive op of a tagged type and a
	descendant type of that tagged type to the corresponding
	primitive op of the descendant type. The body of this function
	was written by Javier Miranda.
2021-10-01 06:13:36 +00:00
Bob Duff
a6fe12b0a9 [Ada] Info. gathering in preparation for more efficiency improvements
gcc/ada/

	* atree.adb: Gather and print statistics about frequency of
	getter and setter calls.
	* atree.ads (Print_Statistics): New procedure for printing
	statistics.
	* debug.adb: Document -gnatd.A switch.
	* gen_il-gen.adb: Generate code for statistics gathering.
	Choose the offset of Homonym early.  Misc cleanup.  Put more
	comments in the generated code.
	* gen_il-internals.ads (Unknown_Offset): New value to indicate
	that the offset has not yet been chosen.
	* gnat1drv.adb: Call Print_Statistics.
	* libgnat/s-imglli.ads: Minor comment fix.
	* output.ads (Write_Int_64): New procedure to write a 64-bit
	value.  Needed for new statistics, and could come in handy
	elsewhere.
	* output.adb (Write_Int_64): Likewise.
	* sinfo.ads: Remove obsolete comment. The xtreeprs program no
	longer exists.
	* types.ads: New 64-bit types needed for new statistics.
2021-10-01 06:13:36 +00:00
Dmitriy Anisimkov
e0ab200357 [Ada] Support gmem.out longer than 2G on 32 bit platforms
gcc/ada/

	* libgnat/memtrack.adb (Putc): New routine wrapped around fputc
	with error check.
	(Write): New routine wrapped around fwrite with error check.
	Remove bound functions fopen, fwrite, fputs, fclose, OS_Exit.
	Use the similar routines from System.CRTL and System.OS_Lib.
2021-10-01 06:13:36 +00:00
Ed Schonberg
6732c4035d [Ada] Spurious range checks on aggregate with non-static bounds
gcc/ada/

	* exp_aggr.adb (Must_Slide): If the aggregate only contains an
	others_clause no sliding id involved. Otherwise sliding is
	required if any bound of the aggregate or the context subtype is
	non-static.
2021-10-01 06:13:36 +00:00
Richard Kenner
3e20570d90 [Ada] Add N_Is_Decl
gcc/ada/

	* gen_il-gen-gen_nodes.adb (N_Is_Decl): Add.
	* gen_il-types.ads (N_Is_Decl): Likewise.
2021-10-01 06:13:35 +00:00
Richard Kenner
7916838b66 [Ada] Add N_Entity_Name
gcc/ada/

	* gen_il-gen-gen_nodes.adb (N_Entity_Name): Add.
	* gen_il-types.ads (N_Entity_Name): Likewise.
2021-10-01 06:13:35 +00:00
Steve Baird
cafd1c1a71 [Ada] Improve error message for .ali file version mismatch
gcc/ada/

	* bcheck.adb (Check_Versions): In the case of an ali file
	version mismatch, if distinct integer values can be extracted
	from the two version strings then include those values in the
	generated error message.
2021-10-01 06:13:35 +00:00
Steve Baird
8e35980ff8 [Ada] No ABE check needed for an expression function call.
gcc/ada/

	* sem_elab.adb (Is_Safe_Call): Return True in the case of a
	(possibly rewritten) call to an expression function.
2021-10-01 06:13:35 +00:00
Ghjuvan Lacambre
1b482832d5 [Ada] Fix CodePeer warnings
gcc/ada/

	* sem_aggr.adb (Resolve_Iterated_Component_Association):
	Initialize Id_Typ to Any_Type by default.
2021-10-01 06:13:35 +00:00
Eric Botcazou
c4f826d933 [Ada] Document that gnatmem requires fixed-position executables
gcc/ada/

	* doc/gnat_ugn/gnat_and_program_execution.rst (gnatmem): Document
	that it works only with fixed-position executables.
2021-10-01 06:13:35 +00:00
Doug Rupp
2e0782a9fa [Ada] Switch to SR0660
gcc/ada/

	* libgnat/s-parame__vxworks.ads (time_t_bits): Change to
	Long_Long_Integer'Size.
2021-10-01 06:13:34 +00:00
GCC Administrator
2467998373 Daily bump. 2021-10-01 00:16:27 +00:00
David Edelsohn
f1408388f2 testsuite: Fix cf-descriptor-5.f90
gcc/testsuite/ChangeLog

	* gfortran.dg/c-interop/cf-descriptor-5-c.c: Include alloca.h.
2021-09-30 18:36:06 -04:00
Przemyslaw Wirkus
cd08eae26e arm: Enable Cortex-R52+ CPU
Patch is adding Cortex-R52+ as 'cortex-r52plus' command line
flag for -mcpu option.

gcc/ChangeLog:

	* config/arm/arm-cpus.in: Add Cortex-R52+ CPU.
	* config/arm/arm-tables.opt: Regenerate.
	* config/arm/arm-tune.md: Regenerate.
	* doc/invoke.texi: Update docs.
2021-09-30 23:14:20 +01:00
Patrick Palka
9845c52db3 c++: __is_trivially_xible and multi-arg aggr paren init [PR102535]
is_xible_helper assumes only 0- and 1-argument ctors can be trivial, but
C++20 aggregate paren init means multi-arg ctors can now be trivial too.
This patch relaxes the relevant early exit check accordingly.

	PR c++/102535

gcc/cp/ChangeLog:

	* method.c (is_xible_helper): Don't exit early for multi-arg
	ctors in C++20.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/is_trivially_constructible7.C: New test.
2021-09-30 17:34:23 -04:00
Patrick Palka
fdf8d5bc5b c++: argument order in a variadic type trait intrinsic
When parsing a variadic type trait intrinsic, we build up the list of
trailing arguments in reverse, but we neglect to reverse the list to
the true order afterwards.  This causes us to confuse the meaning of
e.g. __is_xible(x, y, z) vs __is_xible(x, z, y).

Note that this bug doesn't affect the library traits because they pass a
pack expansion as the single trailing argument to __is_xible, which gets
expanded in the correct order by tsubst_tree_list.

gcc/cp/ChangeLog:

	* parser.c (cp_parser_trait_expr): Call nreverse on the reversed
	list of trailing arguments.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/is_constructible6.C: New test.
2021-09-30 17:29:18 -04:00
Patrick Palka
b6bca2e631 c++: defaulted comparisons and vptr fields [PR95567]
We need to explicitly skip over vptr fields when synthesizing a
defaulted comparison operator, because next_initializable_field
doesn't do so for us.

	PR c++/95567

gcc/cp/ChangeLog:

	* method.c (build_comparison_op): Skip DECL_VIRTUAL_P fields.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/spaceship-virtual1.C: New test.
2021-09-30 17:29:05 -04:00
Ian Lance Taylor
bffb580d6f compiler: avoid calling Expression::type before lowering
This is a minor cleanup to ensure that the various Expression::do_type
methods don't have to worry about the possibility that the Expression
has not been lowered.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/353140
2021-09-30 11:47:11 -07:00
Harald Anlauf
b19bbfb148 Fortran: resolve expressions during SIZE simplification
gcc/fortran/ChangeLog:

	PR fortran/102458
	* simplify.c (simplify_size): Resolve expressions used in array
	specifications so that SIZE can be simplified.

gcc/testsuite/ChangeLog:

	PR fortran/102458
	* gfortran.dg/pr102458b.f90: New test.
2021-09-30 20:29:31 +02:00
Harald Anlauf
8a0861ef29 Fortran: fix reference to Fortran standard in comment
gcc/fortran/
	* expr.c: The correct reference to Fortran standard is: F2018:10.1.12.
2021-09-30 20:28:39 +02:00
Uros Bizjak
6f4459c478 i386: Eliminate sign extension after logic operation [PR89954]
Convert (sign_extend:WIDE (any_logic:NARROW (memory, immediate)))
to (any_logic:WIDE (sign_extend (memory)), (sign_extend (immediate))).
This eliminates sign extension after logic operation.

2021-09-30  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/89954
	* config/i386/i386.md
	(sign_extend:WIDE (any_logic:NARROW (memory, immediate)) splitters):
	New splitters.

gcc/testsuite/
	PR target/89954
	* gcc.target/i386/pr89954.c: New test.
2021-09-30 19:35:13 +02:00
Tobias Burnus
643e8f4ee3 Fortran: Fix same_type_as
A test for CLASS(*) + assumed rank was missing; adding a test to
unlimited_polymorphic_1.f03 showed an ICE as backend_decl wasn't
set. While gfc_get_symbol_decl would fix it, the code also assumed
that the class(*) was a variable and could not be a subobject of
a derived type.

	PR fortran/71703
	PR fortran/84007

gcc/fortran/ChangeLog:

	* trans-intrinsic.c (gfc_conv_same_type_as): Fix handling
	of UNLIMITED_POLY.
	* trans.h (gfc_vtpr_hash_get): Renamed prototype to ...
	(gfc_vptr_hash_get): ... this to match function name.

gcc/testsuite/ChangeLog:

	* gfortran.dg/c-interop/c535b-1.f90: Remove wrong comment.
	* gfortran.dg/unlimited_polymorphic_1.f03: Extend.
	* gfortran.dg/unlimited_polymorphic_32.f90: New test.
2021-09-30 19:08:25 +02:00
Iain Buclaw
8088a33df5 libphobos: Select the appropriate exception handler in getClassInfo
This is analogous to __gdc_personality, which ignores in-flight
exceptions that we haven't collided with yet.

libphobos/ChangeLog:

	* libdruntime/gcc/deh.d (ExceptionHeader.getClassInfo): Move to...
	(getClassInfo): ...here as free function.  Add lsda parameter.
	(scanLSDA): Pass lsda to actionTableLookup.
	(actionTableLookup): Add lsda parameter, pass to getClassInfo.
	(__gdc_personality): Remove currentCfa variable.
2021-09-30 15:07:19 +02:00
Iain Buclaw
ed3ec7343b libphobos: Print stacktrace before terminating program due to uncaught exception.
By default, D run-time has a top level exception handler to catch
anything that was uncaught by user code.  However when the
`rt_trapExceptions' flag is cleared, this handler would not be enabled,
and this termination would occur, aborting the program, but without any
information about the exception.

libphobos/ChangeLog:

	* libdruntime/gcc/deh.d (_d_print_throwable): Declare.
	(_d_throw): Print stacktrace before terminating program due to
	uncaught exception.
2021-09-30 15:07:19 +02:00
Iain Buclaw
0111153234 libphobos: Remove unused variables in gcc.backtrace.
The core.runtime module always overrides the default parameter value for
constructor calls.  MaxAlignment is not required because a class can be
created on the stack with the `scope' keyword.

libphobos/ChangeLog:

	* libdruntime/core/runtime.d (runModuleUnitTests): Use scope to new
	LibBacktrace on the stack.
	* libdruntime/gcc/backtrace.d (FIRSTFRAME): Remove.
	(LibBacktrace.MaxAlignment): Remove.
	(LibBacktrace.this): Remove default initialization of firstFrame.
	(UnwindBacktrace.this): Likewise.
2021-09-30 15:07:19 +02:00
Iain Buclaw
efa5449a09 libphobos: Give _Unwind_Exception an alignment that best resembles __attribute__((aligned))
For interoperability with C++ EH, the alignment should match, otherwise
D may not be able to intercept exceptions thrown from C++.

libphobos/ChangeLog:

	* libdruntime/gcc/unwind/generic.d (__aligned__): Define.
	(_Unwind_Exception): Align struct to __aligned__.
2021-09-30 15:07:19 +02:00
Iain Buclaw
d46a29d919 libphobos: Define main function as extern(C) when compiling without D runtime (PR102476)
The default supplied main function as read when compiling with `-fmain'
has extern(D) linkage.  However this does not work when mixing this
option together with `-fno-druntime'.

	PR d/102476

gcc/testsuite/ChangeLog:

	* gdc.dg/pr102476.d: New test.

libphobos/ChangeLog:

	* libdruntime/__main.di: Define main function as extern(C) when
	compiling without D runtime.
2021-09-30 15:07:19 +02:00
Tobias Burnus
ef37ddf477 libgomp.fortran/alloc-*.f90: Add missing dg-prune-output
libgomp/
	* testsuite/libgomp.fortran/alloc-7.f90: Add dg-prune-output
	for -fintrinsic-modules-path= warning of the C compiler.
	* testsuite/libgomp.fortran/alloc-9.f90: Likewise.
	* testsuite/libgomp.fortran/alloc-10.f90: Likewise.
2021-09-30 14:44:06 +02:00
Tobias Burnus
70de20db23 openmp: Add omp_aligned_{,c}alloc and omp_{c,re}alloc for Fortran
gcc/ChangeLog:

	* omp-low.c (omp_runtime_api_call): Add omp_aligned_{,c}alloc and
	omp_{c,re}alloc, fix omp_alloc/omp_free.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.1): Set implementation status to Y for
	omp_aligned_{,c}alloc and omp_{c,re}alloc routines.
	* omp_lib.f90.in (omp_aligned_alloc, omp_aligned_calloc, omp_calloc,
	omp_realloc): Add.
	* omp_lib.h.in (omp_aligned_alloc, omp_aligned_calloc, omp_calloc,
	omp_realloc): Add.
	* testsuite/libgomp.fortran/alloc-10.f90: New test.
	* testsuite/libgomp.fortran/alloc-6.f90: New test.
	* testsuite/libgomp.fortran/alloc-7.c: New test.
	* testsuite/libgomp.fortran/alloc-7.f90: New test.
	* testsuite/libgomp.fortran/alloc-8.f90: New test.
	* testsuite/libgomp.fortran/alloc-9.f90: New test.
2021-09-30 14:26:46 +02:00
Martin Liska
c3d11a1e95 testsuite: Skip a test-case when LTO is used [PR102509]
PR testsuite/102509

gcc/testsuite/ChangeLog:

	* gcc.c-torture/compile/attr-complex-method.c: Skip if LTO is
	  used.
	* gcc.c-torture/compile/attr-complex-method-2.c: Likewise.
2021-09-30 14:15:33 +02:00
Martin Liska
32bd81eba4 Do not hide asm_out_file in ASM_OUTPUT_ASCII.
gcc/ChangeLog:

	* defaults.h (ASM_OUTPUT_ASCII): Do not hide global variable
	asm_out_file and stream directly to MYFILE.
2021-09-30 13:45:57 +02:00
Richard Biener
09f032c220 Refine alingment peeling fix
This refines the previous fix further by reverting to the original
code since the API is a bit of a mess.  It also fixes the vector type
used to query the misalignment - that was what triggered the original
bogus change.

2021-09-30  Richard Biener  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_update_misalignment_for_peel):
	Restore and fix condition under which we apply npeel to
	the DRs misalignment value.
2021-09-30 13:08:16 +02:00
Richard Biener
c2dc29c4a5 Fix thinko in previous alignment peeling change
I was mistaken in that npeel is -1 for variable peeling - it is 0.

2021-09-30  Richard Biener  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_update_misalignment_for_peel):
	Fix npeel check for variable amount of peeling.
2021-09-30 11:23:51 +02:00
Jonathan Wakely
c5369961fa libstdc++: Fix preprocessor check for C++17
libstdc++-v3/ChangeLog:

	* include/bits/regex.h (basic_regex::multiline): Fix #if
	condition.
2021-09-30 09:00:22 +01:00
Aldy Hernandez
f5440ac7ad Plug possible snprintf overflow in lto-wrapper.
My upcoming improvements to the DOM threader triggered a warning in
this code.  It looks like the format string is ".ltrans%u.ltrans", but
we're only writing a max of ".ltrans" + whatever the MAX_INT is here.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* lto-wrapper.c (run_gcc): Plug snprintf overflow.
2021-09-30 09:54:16 +02:00
Jakub Jelinek
b38a4bd102 openmp: Add omp_aligned_{,c}alloc and omp_{c,re}alloc
This patch adds new OpenMP 5.1 allocator entrypoints and in addition to that
fixes an omp_alloc bug which is hard to test for - if the first allocator
fails but has a larger alignment trait and has a fallback allocator, either
the default behavior or a user fallback, then the extra alignment will be used
even in the fallback allocation, rather than just starting with whatever
alignment has been requested (in GOMP_alloc or the minimum one in omp_alloc).

Jonathan's comment on IRC this morning made me realize that I should add
alloc_align attributes to 2 of the prototypes and I still need to add testsuite
coverage for omp_realloc, will do that in a follow-up.

2021-09-30  Jakub Jelinek  <jakub@redhat.com>

	* omp.h.in (omp_aligned_alloc, omp_calloc, omp_aligned_calloc,
	omp_realloc): New prototypes.
	(omp_alloc): Move after omp_free prototype, add __malloc__ (omp_free)
	attribute.
	* allocator.c: Include string.h.
	(omp_aligned_alloc): No longer static, add ialias.  Add new_alignment
	variable and use it instead of alignment so that when retrying the old
	alignment is used again.  Don't retry if new alignment is the same
	as old alignment, unless allocator had pool size.
	(omp_alloc, GOMP_alloc, GOMP_free): Use ialias_call.
	(omp_aligned_calloc, omp_calloc, omp_realloc): New functions.
	* libgomp.map (OMP_5.0.2): Export omp_aligned_alloc, omp_calloc,
	omp_aligned_calloc and omp_realloc.
	* testsuite/libgomp.c-c++-common/alloc-4.c (main): Add
	omp_aligned_alloc, omp_calloc and omp_aligned_calloc tests.
	* testsuite/libgomp.c-c++-common/alloc-5.c: New test.
	* testsuite/libgomp.c-c++-common/alloc-6.c: New test.
	* testsuite/libgomp.c-c++-common/alloc-7.c: New test.
	* testsuite/libgomp.c-c++-common/alloc-8.c: New test.
2021-09-30 09:30:18 +02:00
Aldy Hernandez
257fd0333f Add gimple_ranger::debug.
I'm trying to add one debug() for each dump() to the dumping aids.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range.cc (gimple_ranger::debug): New.
	* gimple-range.h (class gimple_ranger): Add debug.
2021-09-30 08:08:50 +02:00
Aldy Hernandez
64dd46dbc6 Plug memory leak in hybrid_threader.
Tested on x86-64 Linux.

gcc/ChangeLog:

	PR middle-end/102519
	* tree-vrp.c (hybrid_threader::~hybrid_threader): Free m_query.
2021-09-30 08:08:50 +02:00
GCC Administrator
d238146e41 Daily bump. 2021-09-30 00:16:20 +00:00
Indu Bhagat
d6a87d96d7 debug/102507: ICE in btf_finalize when compiling with -gbtf
Fix the free up of btf_var_ids hash_map in btf_finalize ().

gcc/ChangeLog:

	PR debug/102507
	* btfout.c (GTY): Add GTY (()) albeit for cosmetic only purpose.
	(btf_finalize): Empty the hash_map btf_var_ids.
2021-09-29 13:27:19 -07:00
Jonathan Wakely
cd5448f6c5 MAINTAINERS: Add myself to DCO section
ChangeLog:

	* MAINTAINERS: Add myself to DCO section.
2021-09-29 21:02:30 +01:00
Aldy Hernandez
24e30f485b [PR102501] Adjust jump threading testcases for ppc64* and others.
I really don't know what to do here.  This is a bit of whack-o-mole.
The IL is sufficiently different for various architectures that any
tweak can cause the number of jump threads to vary.

For the pr7745-2.c testcase, we have less threading candidates because 2
of them now cross loop boundaries.  Interestingly, this test matches
"Jumps threaded", not threads registered, so the block copier can
drop threads at copying time adding further confusion.

For example, we can register N threads, but the old copier can cancel
N-M threads while updating the CFG for a variety of different reasons
(removed edges, threading through loop exits, etc).  This makes the
"Registering jump threads" not to match the total number of threads this
test checks for with "Jumps threaded".

The pr66752-3.c test OTOH, is just a matter of thread4 eliminating the
"if".  I had erroneously thought it would always be eliminated by
thread3, but we really don't care where it gets cleaned up.  All we know
is that DCE can't depend on the early threaders doing this work, because
it may cross loop boundaries.  I've chosen thread4 arbitrarily, but we
could just as easily pick the ".optimized" dump.

Sorry, I'm really at my wits end here.  I don't see any clean path
forward, except rewrite these tests as gimple IL.  They're close to useless
as they sit.

gcc/testsuite/ChangeLog:

	PR testsuite/102501
	* gcc.dg/tree-ssa/pr66752-3.c: Adjust.
	* gcc.dg/tree-ssa/pr77445-2.c: Adjust.
2021-09-29 20:27:53 +02:00
Aldy Hernandez
77731cb8f3 Avoid CFG updates in VRP threader if nothing changed.
There is no need to update the CFG or SSAs if nothing has changed in VRP
threading.

gcc/ChangeLog:

	* tree-vrp.c (thread_through_all_blocks): Return bool.
	(execute_vrp_threader): Return TODO_* flags.
	(pass_data_vrp_threader): Set todo_flags_finish to 0.
2021-09-29 20:27:53 +02:00