Commit Graph

178327 Commits

Author SHA1 Message Date
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
Gary Dismukes
7e06a62f5b [Ada] AI12-0042: Type invariant checking rules
gcc/ada/

	* exp_ch4.adb (Expand_N_Type_Conversion): Handle the case of
	applying an invariant check for a conversion to a class-wide
	type whose root type has a type invariant, when the conversion
	appears within the immediate scope of the type and the
	expression is of a specific tagged type.
	* sem_ch3.adb (Is_Private_Primitive): New function to determine
	whether a primitive subprogram is a private operation.
	(Check_Abstract_Overriding): Enforce the restriction imposed by
	AI12-0042 of requiring overriding of an inherited nonabstract
	private operation when the ancestor has a class-wide type
	invariant and the ancestor's private operation is visible.
	(Derive_Subprogram): Set Requires_Overriding on a subprogram
	inherited from a visible private operation of an ancestor to
	which a Type_Invariant'Class expression applies.
2020-07-16 05:17:55 -04:00
Rainer Orth
6805c1c6a6 libsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86
The latest Solaris 11.4/x86 update uncovered a libsanitizer bug that
caused one test to FAIL for 32-bit:

+FAIL: c-c++-common/asan/null-deref-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c -O2 -flto -flto-partition=none
output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -Os  output pattern test

I've identified the problem and the fix has just landed in upstream
llvm-project:

	https://reviews.llvm.org/D83664

Tested on i386-pc-solaris2.11 and x86_64-pc-linux.gnu.

	libsanitizer:
	* sanitizer_common/sanitizer_linux.cpp: Cherry-pick llvm-project
	revision f0e9b76c3500496f8f3ea7abe6f4bf801e3b41e7.
2020-07-16 10:38:48 +02:00
GCC Administrator
fe8185b509 Daily bump. 2020-07-16 00:16:34 +00:00
Uros Bizjak
6c2848ad02 i386: Introduce 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:

        movl    %esi, %eax
        lock cmpxchgl   %edx, (%rdi)
        cmpl    %esi, %eax
        sete    %al

can be optimized by removing the unneeded comparison, since set ZF flag
signals that no update to EAX happened.

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

gcc/ChangeLog:
	PR target/95355
	* config/i386/sync.md
	(peephole2 to remove unneded compare after CMPXCHG): New pattern.

gcc/testsuite/ChangeLog:
	PR target/95355
	* gcc.target/i386/pr96189.c: New test.
2020-07-15 21:29:59 +02:00
Tobias Burnus
51542d9254 libgomp.fortran/alloc-1.F90: Fix testcase for 32bit size_t
libgomp/ChangeLog:

	* testsuite/libgomp.fortran/alloc-1.F90: Use c_size_t to
	avoid conversion on 32bit systems from 32bit to 64bit due
	to -fdefault-integer-8.
2020-07-15 17:23:04 +02:00
Jakub Jelinek
79c12969ec openmp: Fix up loop-21.c
I've missed
+FAIL: libgomp.c/loop-21.c execution test
during testing of the recent patch.  The problem is that while
for the number of iterations computation it doesn't matter if we compute
min_inner_iterations as (m2 * first + n2 + (adjusted step) + m1 * first + n1) / step
or (m2 * last + n2 + (adjusted step) + m1 * last + n1) / step provided that
in the second case we use as factor (m1 - m2) * ostep / step rather than
(m2 - m1) * ostep / step, for the logical to actual iterator values computation
it does matter and in my hand written C implementations of all the cases (outer
vs. inner loop with increasing vs. decreasing iterator) I'm using the same computation
and it worked well for all the pseudo-random iterators testing it was doing.

It also means min_inner_iterations is misnamed, because it is not really
minimum number of inner iterations, whether the first or last outer iteration
results in the smaller or larger value of this can be (sometimes) only
determined at runtime.
So this patch also renames it to first_inner_iterations.

2020-07-15  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/96198
	* omp-general.h (struct omp_for_data): Rename min_inner_iterations
	member to first_inner_iterations, adjust comment.
	* omp-general.c (omp_extract_for_data): Adjust for the above change.
	Always use n1first and n2first to compute it, rather than depending
	on single_nonrect_cond_code.  Similarly, always compute factor
	as (m2 - m1) * outer_step / inner_step rather than sometimes m1 - m2
	depending on single_nonrect_cond_code.
	* omp-expand.c (expand_omp_for_init_vars): Rename min_inner_iterations
	to first_inner_iterations and min_inner_iterationsd to
	first_inner_iterationsd.
2020-07-15 16:45:02 +02:00
Nathan Sidwell
765fbbf9bb c++: refactor some parser code
cp_parser_declaration copies tokens to local variables, before inspecting
(some of) their fields.  There's no need.  Just point at them in the token
buffer -- they don't move.  Also, we never look at the second token if the
first is EOF, so no need for some kind of dummy value in that case.

	gcc/cp/
	* parser.c (cp_parser_declaration): Avoid copying tokens.
	(cp_parser_block_declaration): RAII token pointer.
2020-07-15 07:41:30 -07:00
Piotr Trojanek
790b1f6415 [Ada] Cleanup code related to object overlays
gcc/ada/

	* sem_util.adb (Find_Overlaid_Entity): Fix style in comment.
	(Note_Possible_Modification): Simplify repeated calls to Ekind.
2020-07-15 09:43:01 -04:00
Eric Botcazou
c2ba82add6 [Ada] Cleanup in Convert_To_Positional after previous work
gcc/ada/

	* exp_aggr.adb (Flatten): Adjust description.
	(Convert_To_Positional): Remove obsolete ??? comment and use
	Compile_Time_Known_Value in the final test.
2020-07-15 09:43:01 -04:00
Arnaud Charlet
8092c19930 [Ada] Ongoing work for AI12-0212: container aggregates
gcc/ada/

	* par-ch4.adb (P_Iterated_Component_Association): Extended to
	recognzize the similar Iterated_Element_Association. This node
	is only generated when an explicit Key_Expression is given.
	Otherwise the distinction between the two iterated forms is done
	during semantic analysis.
	* sinfo.ads: New node N_Iterated_Element_Association, for
	Ada202x container aggregates.  New field Key_Expression.
	* sinfo.adb: Subprograms for new node and newn field.
	* sem_aggr.adb (Resolve_Iterated_Component_Association): Handle
	the case where the Iteration_Scheme is an
	Iterator_Specification.
	* exp_aggr.adb (Wxpand_Iterated_Component): Handle a component
	with an Iterated_Component_Association, generate proper loop
	using given Iterator_Specification.
	* exp_util.adb (Insert_Axtions): Handle new node as other
	aggregate components.
	* sem.adb, sprint.adb: Handle new node.
	* tbuild.adb (Make_Implicit_Loop_Statement): Handle properly a
	loop with an Iterator_ specification.
2020-07-15 09:43:00 -04:00
Arnaud Charlet
1c5f82019a [Ada] Fix logic in Allocate_Any_Controlled
gcc/ada/

	* libgnat/s-stposu.adb (Allocate_Any_Controlled): Fix logic in
	lock/unlock.
2020-07-15 09:42:59 -04:00
Piotr Trojanek
b2410a1f02 [Ada] Target name is an object reference
gcc/ada/

	* sem_util.adb (Is_Object_Reference): Return True on
	N_Target_Name.
2020-07-15 09:42:58 -04:00
Arnaud Charlet
5849018425 [Ada] Spurious error on Predicate_Failure aspect
gcc/ada/

	* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Add proper
	handling of Aspect_Predicate_Failure, consistent with
	Check_Aspect_At_Freeze_Point.
2020-07-15 09:42:57 -04:00
Arnaud Charlet
580fe036c8 [Ada] Mention -gnat2020 in error message
gcc/ada/

	* sem_ch13.adb (Check_Aspect_Too_Late): Mention -gnat2020 switch
	in error message.
2020-07-15 09:42:56 -04:00
Eric Botcazou
4c1e539511 [Ada] Do not generate elaboration code for alignment aspect
gcc/ada/

	* einfo.ads (Delayed Freezing and Elaboration): Adjust description.
	* freeze.adb (Freeze_Object_Declaration): Likewise.
	* sem_ch3.adb (Delayed_Aspect_Present): Likewise.  Do not return
	true for Alignment.
	* sem_ch13.adb (Analyze_Aspect_Specifications): Do not always delay
	for Alignment.  Moreover, for Alignment and various Size aspects,
	do not delay if the expression is an attribute whose prefix is the
	Standard package.
2020-07-15 09:42:55 -04:00
Eric Botcazou
ae6fec84da [Ada] Do not generate extra copies inside initialization procedures
gcc/ada/

	* exp_ch6.adb (Requires_Atomic_Or_Volatile_Copy): Return false
	inside an initialization procedure.
2020-07-15 09:42:54 -04:00
Ghjuvan Lacambre
fbaadba246 [Ada] Guard against access to wrong fields in Is_Renaming
gcc/ada/

	* sem_util.adb (Is_Renaming): Add ekind checks.
2020-07-15 09:42:53 -04:00
Arnaud Charlet
ae265cdd5b [Ada] Remove doc on obsolete tools
gcc/ada/

	* doc/gnat_ugn/gnat_utility_programs.rst: Remove doc on obsolete
	tools.
	* gnat_ugn.texi: Regenerate.
2020-07-15 09:42:52 -04:00