Commit Graph

178595 Commits

Author SHA1 Message Date
Andrew Stubbs 42b47dae49 amdgcn: Fix elf.h build issue
Allow building on systems with elf.h that includes AMDGPU definitions,
partially or completely.

gcc/ChangeLog:

	* config/gcn/mkoffload.c (EM_AMDGPU): Undefine before defining.
	(ELFOSABI_AMDGPU_HSA): Likewise.
	(ELFABIVERSION_AMDGPU_HSA): Likewise.
	(EF_AMDGPU_MACH_AMDGCN_GFX803): Likewise.
	(EF_AMDGPU_MACH_AMDGCN_GFX900): Likewise.
	(EF_AMDGPU_MACH_AMDGCN_GFX906): Likewise.
	(reserved): Delete.
2020-07-17 11:51:26 +01:00
Dmitrij Pochepko c9c87e6f9c vector creation from two parts of two vectors produces TBL rather than ins (PR 93720)
The following patch enables vector permutations optimization by trying
to use ins instruction instead of slow and generic tbl.

example:

vector float f0(vector float a, vector float b)
{
  return __builtin_shuffle (a, a, (vector int){3, 1, 2, 3});
}

was compiled into:
...
	adrp    x0, .LC0
	ldr     q1, [x0, #:lo12:.LC0]
	tbl     v0.16b, {v0.16b}, v1.16b
...

and after patch:
...
	ins     v0.s[0], v0.s[3]
...

bootstrapped and tested on aarch64-linux-gnu with no regressions

gcc/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/93720
	* config/aarch64/aarch64.c (aarch64_evpc_ins): New function.
	(aarch64_expand_vec_perm_const_1): Call it.
	* config/aarch64/aarch64-simd.md (aarch64_simd_vec_copy_lane): Make
	public, and add a "@" prefix.

gcc/testsuite/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/93720
	* gcc.target/aarch64/vins-1.c: New test.
	* gcc.target/aarch64/vins-2.c: New test.
	* gcc.target/aarch64/vins-3.c: New test.

Co-Authored-By: Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
2020-07-17 10:24:46 +01:00
Dmitrij Pochepko 7efc03fd2c __builtin_shuffle sometimes should produce zip1 rather than TBL (PR82199)
The following patch enables vector permutations optimization by using
another vector element size when applicable.  It allows usage of simpler
instructions in applicable cases.

example:

vector float f(vector float a, vector float b)
{
  return __builtin_shuffle  (a, b, (vector int){0, 1, 4,5});
}

was compiled into:
...
	adrp    x0, .LC0
	ldr     q2, [x0, #:lo12:.LC0]
	tbl     v0.16b, {v0.16b - v1.16b}, v2.16b
...

and after patch:
...
	zip1    v0.2d, v0.2d, v1.2d
...

bootstrapped and tested on aarch64-linux-gnu with no regressions

gcc/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/82199
	* config/aarch64/aarch64.c (aarch64_evpc_reencode): New function.
	(aarch64_expand_vec_perm_const_1): Call it.

gcc/testsuite/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/82199
	* gcc.target/aarch64/vdup_n_3.c: New test.
	* gcc.target/aarch64/vzip_1.c: New test.
	* gcc.target/aarch64/vzip_2.c: New test.
	* gcc.target/aarch64/vzip_3.c: New test.
	* gcc.target/aarch64/vzip_4.c: New test.

Co-Authored-By: Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
2020-07-17 10:20:12 +01:00
xiezhiheng bf592b2ff7 AArch64: Add flags in built-in functions [PR94442]
2020-07-17  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c (enum aarch64_type_qualifiers):
	Add new field flags.
	(VAR1): Add new field FLAG in macro.
	(VAR2): Likewise.
	(VAR3): Likewise.
	(VAR4): Likewise.
	(VAR5): Likewise.
	(VAR6): Likewise.
	(VAR7): Likewise.
	(VAR8): Likewise.
	(VAR9): Likewise.
	(VAR10): Likewise.
	(VAR11): Likewise.
	(VAR12): Likewise.
	(VAR13): Likewise.
	(VAR14): Likewise.
	(VAR15): Likewise.
	(VAR16): Likewise.
	(aarch64_general_fold_builtin): Likewise.
	(aarch64_general_gimple_fold_builtin): Likewise.
	* config/aarch64/aarch64-simd-builtins.def: Add default flag for
	each built-in function.
	* config/aarch64/geniterators.sh: Add new field in BUILTIN macro.
2020-07-17 10:00:37 +01:00
Jonathan Wakely 0c1d1c0103 gcc-changelog: Fix typo in output
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Fix typo.
2020-07-17 09:53:19 +01:00
Andreas Krebbel 8002956182 Fix PR96127
In s390_expand_insv the movstrict patterns are always generated with a
CC clobber although only movstricthi actually needs one.  The patch
invokes the expanders instead of constructing the pattern by hand.

Bootstrapped and regression tested on s390x.

gcc/ChangeLog:

	PR target/96127
	* config/s390/s390.c (s390_expand_insv): Invoke the movstrict
	expanders to generate the pattern.
	* config/s390/s390.md ("*movstricthi", "*movstrictqi"): Remove the
	'*' to have callable expanders.

gcc/testsuite/ChangeLog:

	PR target/96127
	* gcc.target/s390/pr96127.c: New test.
2020-07-17 09:26:49 +02:00
Kewen Lin 0757d3660c rs6000/test: Add -fno-vect-cost-model to conv-vectorize-[12].c
In my testing with cost tweaking for vector with length, I found
two cases below didn't get the expected output.  Since the expected
instructions reply on the vectorization occurrence, we don't expect
vectorization gets disabled by cost model.

To make it not fragile, the fix is to force it without vect cost model.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/conv-vectorize-1.c: Add option
	-fno-vect-cost-model.
	* gcc.target/powerpc/conv-vectorize-2.c: Likewise.
2020-07-17 00:31:03 -05:00
GCC Administrator 96686b3fcd Daily bump. 2020-07-17 00:16:27 +00:00
Segher Boessenkool 84c5396d4b combine: Use single_set for is_just_move
Since we now only call is_just_move on the original instructions, we
always have an rtx_insn* (not just a pattern), so we can use single_set
on it.  This makes no detectable difference at all on all thirty Linux
targets I test, but it does help cris, and it is simpler, cleaner code
anyway.

2020-07-16  Hans-Peter Nilsson  <hp@axis.com>
	    Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/93372
	* combine.c (is_just_move): Take an rtx_insn* as argument.  Use
	single_set on it.
2020-07-16 23:52:19 +00:00
Julian Brown 39dda00208 openacc: Fix standalone attach for Fortran assumed-shape array pointers
This patch makes it so that an "attach" operation for a Fortran pointer
with an array descriptor copies that array descriptor to the target,
and similarly that detach operations release the array descriptor.

2020-07-16  Julian Brown  <julian@codesourcery.com>
	    Thomas Schwinge  <thomas@codesourcery.com>

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Rework OpenACC
	attach/detach handling for arrays with descriptors.

gcc/testsuite/
	* gfortran.dg/goacc/attach-descriptor.f90: New test.

libgomp/
	* testsuite/libgomp.oacc-fortran/attach-descriptor-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/attach-descriptor-2.f90: New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
2020-07-16 14:12:53 -07:00
Iain Sandoe 0f66b8486c coroutines: Correct frame capture of compiler temps [PR95591+4].
When a full expression contains a co_await (or co_yield), this means
that it might be suspended; which would destroy temporary variables
(on a stack for example).  However the language guarantees that such
temporaries are live until the end of the expression.

In order to preserve this, we 'promote' temporaries where necessary
so that they are saved in the coroutine frame (which allows them to
remain live potentially until the frame is destroyed).  In addition,
sub-expressions that produce control flow (such as TRUTH_AND/OR_IF
or COND_EXPR) must be handled specifically to ensure that await
expressions are properly expanded.

This patch corrects two mistakes in which we were (a) failing to
promote some temporaries and (b) we we failing to sequence DTORs for
the captures properly. This manifests in a number of related (but not
exact duplicate) PRs.

The revised code collects the actions into one place and maps all the
control flow into one form - a benefit of this is that co_returns are
now expanded earlier (which provides an opportunity to address PR95517
in some future patch).

We replace a statement that contains await expression(s) with a bind
scope that has a variable list describing the temporaries that have
been 'promoted' and a statement list that contains a series of cleanup
expressions for each of those.  Where we encounter nested conditional
expressions, these are wrapped in a try-finally block with a guard var
for each sub-expression variable that needs a DTOR.  The guards are all
declared and initialized to false before the first conditional sub-
expression.  The 'finally' block contains a series of if blocks (one
per guard variable) enclosing the relevant DTOR.

Variables listed in a bind scope in this manner are automatically moved
to a coroutine frame version by existing code (so we re-use that rather
than having a separate mechanism).

gcc/cp/ChangeLog:

	PR c++/95591
	PR c++/95599
	PR c++/95823
	PR c++/95824
	PR c++/95895
	* coroutines.cc (struct coro_ret_data): Delete.
	(coro_maybe_expand_co_return): Delete.
	(co_return_expander): Delete.
	(expand_co_returns): Delete.
	(co_await_find_in_subtree): Remove unused name.
	(build_actor_fn): Remove unused parm, remove handling
	for co_return expansion.
	(register_await_info): Demote duplicate info message to a
	warning.
	(coro_make_frame_entry): Move closer to use site.
	(struct susp_frame_data): Add fields for final suspend label
	and a flag to indicate await expressions with initializers.
	(captures_temporary): Delete.
	(register_awaits): Remove unused code, update comments.
	(find_any_await): New.
	(tmp_target_expr_p): New.
	(struct interesting): New.
	(find_interesting_subtree): New.
	(struct var_nest_node): New.
	(flatten_await_stmt): New.
	(handle_nested_conditionals): New.
	(process_conditional): New.
	(replace_statement_captures): Rename to...
	(maybe_promote_temps): ... this.
	(maybe_promote_captured_temps): Delete.
	(analyze_expression_awaits): Check for await expressions with
	initializers.  Simplify handling for truth-and/or-if.
	(expand_one_truth_if): Simplify (map cases that need expansion
	to COND_EXPR).
	(await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
	handling for truth-and/or-if expressions.
	(register_local_var_uses): Ensure that we create names in the
	implementation namespace.
	(morph_fn_to_coro): Add final suspend label to suspend frame
	callback data and remove it from the build_actor_fn call.

gcc/testsuite/ChangeLog:

	PR c++/95591
	PR c++/95599
	PR c++/95823
	PR c++/95824
	PR c++/95895
	* g++.dg/coroutines/pr95591.C: New test.
	* g++.dg/coroutines/pr95599.C: New test.
	* g++.dg/coroutines/pr95823.C: New test.
	* g++.dg/coroutines/pr95824.C: New test.
2020-07-16 22:01:52 +01:00
Jonathan Wakely 75edc31f9e analyzer: Use noexcept instead of throw() for C++11 and later (PR 96014)
gcc/testsuite/ChangeLog:

	PR testsuite/96014
	* g++.dg/analyzer/pr94028.C: Replace dynamic exception
	specification with noexcept-specifier for C++11 and later.
2020-07-16 21:24:24 +01:00
Uros Bizjak cc1ef413a8 i386: Additional peephole2 to use flags from CMPXCHG more [PR96189]
CMPXCHG instruction sets ZF flag if the values in the destination operand
and EAX register are equal; otherwise the ZF flag is cleared and value
from destination operand is loaded to EAX. Following assembly:

        xorl    %eax, %eax
        lock cmpxchgl   %edx, (%rdi)
        testl   %eax, %eax
        sete    %al

can be optimized by removing the unneeded comparison, since set ZF flag
signals that no update to EAX happened.  This patch adds peephole2
pattern to also handle XOR zeroing and load of -1 by OR.

2020-07-16  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	PR target/96189
	* config/i386/sync.md
	(peephole2 to remove unneded compare after CMPXCHG):
	New pattern, also handle XOR zeroing and load of -1 by OR.

gcc/testsuite/ChangeLog:
	PR target/96189
	* gcc.target/i386/pr96189-1.c: New test.
2020-07-16 20:13:06 +02:00
Eric Botcazou f569026aa3 Reunify x86 stack checking implementation
The stack clash protection mechanism in the x86 back-end was implemented
by largely duplicating the existing stack checking implementation.  Now
the only significant difference between them is the probing window, which
is shifted by 1 probing interval (not 2 as documented in explow.c), but we
can certainly do 1 more probe for stack checking even if it is redundant
in almost all cases.

gcc/ChangeLog:
	* config/i386/i386.c (ix86_compute_frame_layout): Minor tweak.
	(ix86_adjust_stack_and_probe): Delete.
	(ix86_adjust_stack_and_probe_stack_clash): Rename to above and add
	PROTECTION_AREA parameter.  If it is true, probe PROBE_INTERVAL plus
	a small dope beyond SIZE bytes.
	(ix86_emit_probe_stack_range): Use local variable.
	(ix86_expand_prologue): Adjust calls to ix86_adjust_stack_and_probe
	and tidy up the stack checking code.
	* explow.c (get_stack_check_protect): Fix head comment.
	(anti_adjust_stack_and_probe_stack_clash): Likewise.
	(allocate_dynamic_stack_space): Add comment.

	* tree-nested.c (lookup_field_for_decl): Set the DECL_IGNORED_P and
	TREE_NO_WARNING but not TREE_ADDRESSABLE flags on the field.
2020-07-16 18:13:56 +02:00
Marek Polacek a54d71cb66 c++: Add test for DR 188.
gcc/testsuite/ChangeLog:

	DR 188
	* g++.dg/DRs/dr188.C: New test.
2020-07-16 12:11:42 -04:00
Andrew Stubbs a4f49061b6 amdgcn: Handle early debug info in mkoffload
Forward the early debug information from the input LTO file to the output
HSACO file, in the same way lto-wrapper does.  This is a little more
complicated, however, because the ELF file containing the debug needs to be
converted from x86_64 to amdgcn, and because the offloaded code will have less
content than the host program the debug info describes.

gcc/ChangeLog:

	* config/gcn/mkoffload.c: Include simple-object.h and elf.h.
	(EM_AMDGPU): New macro.
	(ELFOSABI_AMDGPU_HSA): New macro.
	(ELFABIVERSION_AMDGPU_HSA): New macro.
	(EF_AMDGPU_MACH_AMDGCN_GFX803): New macro.
	(EF_AMDGPU_MACH_AMDGCN_GFX900): New macro.
	(EF_AMDGPU_MACH_AMDGCN_GFX906): New macro.
	(R_AMDGPU_NONE): New macro.
	(R_AMDGPU_ABS32_LO): New macro.
	(R_AMDGPU_ABS32_HI): New macro.
	(R_AMDGPU_ABS64): New macro.
	(R_AMDGPU_REL32): New macro.
	(R_AMDGPU_REL64): New macro.
	(R_AMDGPU_ABS32): New macro.
	(R_AMDGPU_GOTPCREL): New macro.
	(R_AMDGPU_GOTPCREL32_LO): New macro.
	(R_AMDGPU_GOTPCREL32_HI): New macro.
	(R_AMDGPU_REL32_LO): New macro.
	(R_AMDGPU_REL32_HI): New macro.
	(reserved): New macro.
	(R_AMDGPU_RELATIVE64): New macro.
	(gcn_s1_name): Delete global variable.
	(gcn_s2_name): Delete global variable.
	(gcn_o_name): Delete global variable.
	(gcn_cfile_name): Delete global variable.
	(files_to_cleanup): New global variable.
	(offload_abi): New global variable.
	(tool_cleanup): Use files_to_cleanup, not explicit list.
	(copy_early_debug_info): New function.
	(main): New local variables gcn_s1_name, gcn_s2_name, gcn_o_name,
	gcn_cfile_name.
	Create files_to_cleanup obstack.
	Recognize -march options.
	Copy early debug info from input .o files.
2020-07-16 16:05:45 +01:00
Uros Bizjak 866c5bfd9c Fix ChangeLog PR number. 2020-07-16 16:37:04 +02:00
Marek Polacek 3594ef5521 c++: Get rid of convert_like* macros.
The convert_like* macros were introduced in

  2000-03-05  Nathan Sidwell  <nathan@codesourcery.com>

        * call.c (convert_like): Macrofy.
        (convert_like_with_context): New macro.

but now we can use overloading so we can do away with the macros.
I've also taken this chance to rename _real to _internal to make it
clear that it should not be called directly.

No functional change intended.

gcc/cp/ChangeLog:

	* call.c (convert_like): Remove macro and introduce a new
	wrapper instead.
	(convert_like_with_context): Likewise.
	(convert_like_real): Rename to convert_like.
	(convert_like_real_1): Rename to convert_like_internal.  Call
	convert_like instead of convert_like_real therein.
	(perform_direct_initialization_if_possible): Call convert_like
	instead of convert_like_real.
2020-07-16 09:29:38 -04:00
Iain Sandoe a2086f986e coroutines: Spelling corrections in comments [NFC].
Correct some typos.

gcc/cp/ChangeLog:

	* coroutines.cc: Correct some spelling errors
	in comments.
2020-07-16 13:57:17 +01:00
Andrea Corallo 53a1cb8e74 build: Fix TAGS target in gcc/Makefile.in
gcc/ChangeLog:

2020-07-16  Andrea Corallo  <andrea.corallo@arm.com>

	* Makefile.in (TAGS): Remove 'params.def'.
2020-07-16 14:44:45 +02:00
Roger Sayle 5abe0d81db doc: Document TARGET_TRULY_NOOP_TRUNCATION requires trunc?i?i2 patterns.
2020-07-16  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog:
	* target.def (TARGET_TRULY_NOOP_TRUNCATION): Clarify that
	targets that return false, indicating SUBREGs shouldn't be
	used, also need to provide a trunc?i?i2 optab that performs this
	truncation.
	* doc/tm.texi: Regenerate.
2020-07-16 11:47:47 +01:00
Javier Miranda 135c02769b [Ada] Misplace of internal master renaming declaration
gcc/ada/

	* exp_ch3.adb (Expand_N_Full_Type_Declaration): Ensure a _master
	declaration on limited types that might have tasks.
	* exp_ch9.adb (Build_Master_Renaming): For private types, if we
	are processing declarations in the private part, ensure that
	master is inserted before its full declaration; otherwise the
	master renaming may be inserted in the public part of the
	package (and hence before the declaration of its _master
	variable).
2020-07-16 05:18:20 -04:00
Arnaud Charlet ca320dabf0 [Ada] AI12-0132 Freezing of renames_as_body
gcc/ada/

	* sem_ch8.adb (Analyze_Subprogram_Renaming): A renames-as-body
	freezes the expression of any expression function that it
	renames.
2020-07-16 05:18:19 -04:00
Ed Schonberg 7a21651f33 [Ada] Ongoing work for AI12-0212 : container aggregates
gcc/ada/

	* sem_aggr.adb (Resolve_Container_Aggregate): Add semantic
	checks for indexed aggregates, including component associations
	and iterated component associations.
	* exp_aggr.adb (Expand_Iterated_Component): New subprogram,
	subsidiary of Expand_Container_Aggreggate, used for positional,
	named, and indexed aggregates.
	(Aggregate_Size): New subprogram to precompute the size of an
	indexed aggregate prior to call to allocate it.
	(Expand_Range_Component): New subprogram so generate loop for a
	component association given by a range or a subtype name in an
	indexed aggregate.
2020-07-16 05:18:18 -04:00
Bob Duff 81fcf43389 [Ada] gnatbind: Fix No_Entry_Calls_In_Elaboration_Code message
gcc/ada/

	* bindo-diagnostics.adb (Output_Invocation_Related_Suggestions):
	Use Cumulative_Restrictions.Set, because Restriction_Active only
	works at compile time.
2020-07-16 05:18:18 -04:00
Bob Duff 47484baae5 [Ada] Ada2020: AI12-0117 Restriction No_Tasks_Unassigned_To_CPU
gcc/ada/

	* gnatbind.adb (Gnatbind): For No_Tasks_Unassigned_To_CPU, check
	that CPU has been set on the main subprogram.
	(Restriction_Could_Be_Set): Don't print
	No_Tasks_Unassigned_To_CPU if it would violate the
	above-mentioned rule. Up to now, all restrictions were checked
	by the compiler, with the binder just checking for consistency.
	But the compiler can't know which subprogram is the main, so
	it's impossible to check this one at compile time.
	* restrict.ads, restrict.adb: Misc refactoring. Change Warning
	to Warn, for consistency, since most already use Warn.
	(Set_Restriction): New convenience routine.
	* sem_ch13.adb (Attribute_CPU): Check
	No_Tasks_Unassigned_To_CPU.
	* sem_prag.adb (Pragma_CPU): Check No_Tasks_Unassigned_To_CPU.
	Misc refactoring.
	* tbuild.ads, tbuild.adb (Sel_Comp): New functions for building
	selected components.
2020-07-16 05:18:17 -04:00
Eric Botcazou 22157c64fc [Ada] Remove duplicated line
gcc/ada/

	* impunit.adb (Non_Imp_File_Names_95): Remove duplicate entry.
2020-07-16 05:18:16 -04:00
Arnaud Charlet 0b043c8fea [Ada] Wrong execution of Tan on large argument
gcc/ada/

	* Makefile.rtl: replace a-numaux__x86.ads by
	a-numaux__libc-x86.ads and a-numaux__x86.adb by
	a-numaux__dummy.adb.
	* libgnat/a-numaux__x86.ads, libgnat/a-numaux__x86.adb: Removed.
	* libgnat/a-numaux__dummy.adb: New.
2020-07-16 05:18:15 -04:00
Ed Schonberg 875a00faca [Ada] Spurious error in instance nested in formal package
gcc/ada/

	* sem_ch12.adb (Load_Parent_Of_Generic): If an ancestor is an
	instance whose source appears within a formal package of the
	current unit, there is no body of the ancestor needed to
	complete the current generic compilation.
2020-07-16 05:18:14 -04:00
Doug Rupp 4c81868d07 [Ada] v7r2cert: minor refactoring
gcc/ada/

	* libgnat/s-thread__ae653.adb (taskVarAdd): Defunct, so remove.
	(Current_ATSD):  Make it a TLS variable.
	(OK): Move to package scope.
	(System.Storage_Elements): Import and Use.
2020-07-16 05:18:13 -04:00
Eric Botcazou 340375cae9 [Ada] Set missing Parent field of block entity
gcc/ada/

	* exp_ch9.adb (Expand_N_Accept_Statement): Set Parent of the
	created block entity to the created block statement.
2020-07-16 05:18:13 -04:00
Arnaud Charlet 8e640a5f32 [Ada] AI12-0004 Normalization and allowed characters
gcc/ada/

	* scng.adb (Scan): Detect wide characters not in NFKC.
	* libgnat/a-chahan.adb, libgnat/a-chahan.ads,
	libgnat/a-wichha.adb, libgnat/a-wichha.ads,
	libgnat/a-wichun.adb, libgnat/a-wichun.ads,
	libgnat/a-zchhan.adb, libgnat/a-zchhan.ads,
	libgnat/a-zchuni.adb, libgnat/a-zchuni.ads (Is_NFKC): New.
	* libgnat/s-utf_32.ads, libgnat/s-utf_32.adb (Is_UTF_32_NFKC):
	New.
2020-07-16 05:18:12 -04:00
Bob Duff 504dc34720 [Ada] Ada2020: AI12-0117 Restriction No_Tasks_Unassigned_To_CPU
gcc/ada/

	* libgnat/s-rident.ads (Restriction_Id): Add
	No_Tasks_Unassigned_To_CPU.
2020-07-16 05:18:11 -04:00
Bob Duff eaf6e63a64 [Ada] Adjust heuristics about size of static aggregates
gcc/ada/

	* exp_aggr.adb (Max_Aggregate_Size): Use the small size of 64
	when copying is needed (for example, for the initialization of a
	local variable, and for assignment statements). Use the larger
	size when static allocation can be done without copying.
2020-07-16 05:18:10 -04:00
Bob Duff f7a8be8a19 [Ada] Ada2020: AI12-0055 No_Dynamic_CPU_Assignment restriction
gcc/ada/

	* libgnat/s-rident.ads (No_Dynamic_CPU_Assignment): New
	restriction. Add it to all relevant profiles.
	* sem_ch13.adb (Attribute_CPU): Check No_Dynamic_CPU_Assignment
	restriction.
	(Attribute_CPU, Attribute_Dispatching_Domain,
	Attribute_Interrupt_Priority): Remove error checks -- these are
	checked in the parser.
	* sem_prag.adb (Pragma_CPU): Check No_Dynamic_CPU_Assignment
	restriction.  We've got a little violation of DRY here.
	* sem.ads, sem_ch3.ads: Minor comment fix.
2020-07-16 05:18:09 -04:00
Gary Dismukes ebc2b117e4 [Ada] Implicit dereferencing in container indexing
gcc/ada/

	* sem_ch4.adb (Try_Container_Indexing): When the prefix type is
	an access type, change it to the designated type, change the
	prefix to an explicit dereference, and emit a ?d? warning for
	the implicit dereference. Include a ??? comment questioning
	whether this is the right context in which to perform the
	implicit dereferencing.
2020-07-16 05:18:08 -04:00
Arnaud Charlet c6801105e1 [Ada] AI12-0373 Additional check on Integer_Literal function
gcc/ada/

	* sem_ch13.adb (Validate_Literal_Aspect): Ensure that the
	parameter is not aliased. Minor reformatting.
	* sem_util.adb (Statically_Names_Object): Update comment.
2020-07-16 05:18:07 -04:00
Ghjuvan Lacambre 0e35dea645 [Ada] Handle N_Others_Choice case in range-building function
gcc/ada/

	* sem_case.adb (Build_Choice): Set Is_Static_Expression flag.
	(Lit_Of): Update specification to mention Is_Static_Expression
	flag.
	* sem_ch13.adb (Membership_Entry): Check for N_Others_Choice.
2020-07-16 05:18:06 -04:00
Bob Duff ad323bbf94 [Ada] Ada2020: AI12-0289 Implicitly null excluding anon access
gcc/ada/

	* sem_ch6.adb (Null_Exclusions_Match): New function to check
	that the null exclusions match, including in the case addressed
	by this AI.
	(Check_Conformance): Remove calls to Comes_From_Source
	when calling Null_Exclusions_Match. These are not
	needed, as indicated by an ancient "???" comment.
2020-07-16 05:18:05 -04:00
Justin Squirek 1a0d29099a [Ada] Spurious accessibility error on allocator in generic instance
gcc/ada/

	* exp_ch4.adb (Expand_N_Type_Conversion): Remove flawed test for
	whether "statically deeper" accessibility rules apply to a given
	target type and instead use the new routine
	Statically_Deeper_Relation_Applies.
	(Statically_Deeper_Relation_Applies): Created to centralize the
	calculation of whether a target type within a conversion must
	have static accessibility checks.
	* sem_ch13.adb (Check_One_Function): Minor comment revision.
2020-07-16 05:18:05 -04:00
Eric Botcazou 0429212682 [Ada] Small cleanup in interface with GCC back-end
gcc/ada/

	* fe.h (Is_OK_Static_Expression): Delete.
	* sem_eval.ads (Is_OK_Static_Expression): Remove WARNING note.
2020-07-16 05:18:04 -04:00
Justin Squirek 25b4c873d1 [Ada] Incorrect static accessibility error in return aggregate
gcc/ada/

	* einfo.adb, einfo.ads (Is_Named_Access_Type): Created for
	readability.
	* sem_ch6.adb (Check_Return_Construct_Accessibility): Add
	special cases for formals.
	* sem_util.adb (Object_Access_Level): Add handling of access
	attributes and named access types in the general case.
2020-07-16 05:18:03 -04:00
Piotr Trojanek e31f60f31d [Ada] Simplify detection of others choice with just one value
gcc/ada/

	* sem_case.adb (Build_Choice): Simplify.
2020-07-16 05:18:02 -04:00
Arnaud Charlet 4211ccbbae [Ada] Disable Initialize_Scalars on runtime files
gcc/ada/

	* frontend.adb: Disable Initialize_Scalars on runtime files.
2020-07-16 05:18:01 -04:00
Ghjuvan Lacambre b5a05dc501 [Ada] Do not perform null exclusion static checks on generated entities
gcc/ada/

	* sem_ch3.adb (Analyze_Object_Declaration): Add
	Comes_From_Source call.
2020-07-16 05:18:00 -04:00
Javier Miranda aab8cf8ba4 [Ada] Avoid false positive reported by CodePeer
gcc/ada/

	* exp_attr.adb (Expand_Access_To_Protected_Op): Initialize
	variable Sub to Empty to avoid false positive reported by
	Codepeer.
2020-07-16 05:18:00 -04:00
Arnaud Charlet c7641c228a [Ada] Spurious redundant use clause warning
gcc/ada/

	* sem_ch8.adb (Note_Redundant_Use): Add missing warning tag.
	Do not check for redundant use clauses in predefined units to avoid
	misleading warnings that may occur as part of a rtsfind load.
2020-07-16 05:17:59 -04:00
Javier Miranda d9206abba7 [Ada] Ada2020: AI12-0107 convention of By_Protected_Procedure
gcc/ada/

	* exp_attr.adb (Has_By_Protected_Procedure_Prefixed_View): New
	subprogram.
	(Expand_Access_To_Protected_Op): Adding support for prefixed
	class-wide view with By_Protected_Procedure convention.
	* sem_attr.adb (Get_Convention): New subprogram.
	(Get_Kind): Adapted to use Get_Convention.
	* sem_ch4.adb (Try_By_Protected_Procedure_Prefixed_View): New
	subprogram.
	(Analyze_Selected_Component): Invoke
	Try_By_Protected_Procedure_Prefixed_View.
	* sem_util.ads (Is_By_Protected_Procedure): New subprogram.
	* sem_util.adb (Is_By_Protected_Procedure): New subprogram.
2020-07-16 05:17:58 -04:00
Arnaud Charlet e4a99831f4 [Ada] Overflow in string streaming
gcc/ada/

	* libgnat/s-ststop.ads: Fix typo.
	* libgnat/s-ststop.adb (Read, Write): Fix block number
	computation to avoid overflows in case of large strings.
2020-07-16 05:17:57 -04:00
Arnaud Charlet 0f6898f9d8 [Ada] Add centralized capacity check in Generic_Bignums
gcc/ada/

	* libgnat/s-genbig.adb ("**"): Remove capacity limit check.
	Improve code by using an extended return.
	(Normalize): Perform capacity limit check here instead which is
	the centralized place where (potentially large) big integers are
	allocated.
2020-07-16 05:17:56 -04:00