Arnaud Charlet [Thu, 11 Jun 2020 12:49:58 +0000 (08:49 -0400)]
[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.
Ed Schonberg [Thu, 11 Jun 2020 15:34:26 +0000 (11:34 -0400)]
[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.
Doug Rupp [Mon, 8 Jun 2020 19:17:26 +0000 (12:17 -0700)]
[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.
Eric Botcazou [Thu, 11 Jun 2020 13:25:44 +0000 (15:25 +0200)]
[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.
Arnaud Charlet [Wed, 10 Jun 2020 12:26:06 +0000 (08:26 -0400)]
[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.
Bob Duff [Wed, 10 Jun 2020 19:55:32 +0000 (15:55 -0400)]
[Ada] Ada2020: AI12-0117 Restriction No_Tasks_Unassigned_To_CPU
gcc/ada/
* libgnat/s-rident.ads (Restriction_Id): Add
No_Tasks_Unassigned_To_CPU.
Bob Duff [Tue, 9 Jun 2020 23:04:56 +0000 (19:04 -0400)]
[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.
Bob Duff [Tue, 9 Jun 2020 14:53:23 +0000 (10:53 -0400)]
[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.
Gary Dismukes [Sun, 7 Jun 2020 23:41:15 +0000 (19:41 -0400)]
[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.
Arnaud Charlet [Mon, 8 Jun 2020 18:28:52 +0000 (14:28 -0400)]
[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.
Ghjuvan Lacambre [Fri, 5 Jun 2020 16:00:08 +0000 (18:00 +0200)]
[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.
Bob Duff [Mon, 8 Jun 2020 17:54:27 +0000 (13:54 -0400)]
[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.
Justin Squirek [Fri, 5 Jun 2020 19:41:33 +0000 (15:41 -0400)]
[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.
Eric Botcazou [Mon, 8 Jun 2020 19:21:39 +0000 (21:21 +0200)]
[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.
Justin Squirek [Fri, 22 May 2020 20:25:00 +0000 (16:25 -0400)]
[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.
Piotr Trojanek [Mon, 8 Jun 2020 12:33:08 +0000 (14:33 +0200)]
[Ada] Simplify detection of others choice with just one value
gcc/ada/
* sem_case.adb (Build_Choice): Simplify.
Arnaud Charlet [Mon, 8 Jun 2020 08:10:29 +0000 (10:10 +0200)]
[Ada] Disable Initialize_Scalars on runtime files
gcc/ada/
* frontend.adb: Disable Initialize_Scalars on runtime files.
Ghjuvan Lacambre [Fri, 5 Jun 2020 07:46:15 +0000 (09:46 +0200)]
[Ada] Do not perform null exclusion static checks on generated entities
gcc/ada/
* sem_ch3.adb (Analyze_Object_Declaration): Add
Comes_From_Source call.
Javier Miranda [Sat, 6 Jun 2020 15:26:18 +0000 (11:26 -0400)]
[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.
Arnaud Charlet [Fri, 5 Jun 2020 18:45:23 +0000 (14:45 -0400)]
[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.
Javier Miranda [Wed, 3 Jun 2020 18:07:27 +0000 (14:07 -0400)]
[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.
Arnaud Charlet [Fri, 5 Jun 2020 15:50:16 +0000 (11:50 -0400)]
[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.
Arnaud Charlet [Fri, 5 Jun 2020 09:40:55 +0000 (05:40 -0400)]
[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.
Gary Dismukes [Wed, 3 Jun 2020 23:53:33 +0000 (19:53 -0400)]
[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.
Rainer Orth [Thu, 16 Jul 2020 08:38:48 +0000 (10:38 +0200)]
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.
GCC Administrator [Thu, 16 Jul 2020 00:16:34 +0000 (00:16 +0000)]
Daily bump.
Uros Bizjak [Wed, 15 Jul 2020 19:27:00 +0000 (21:27 +0200)]
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.
Tobias Burnus [Wed, 15 Jul 2020 15:23:04 +0000 (17:23 +0200)]
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.
Jakub Jelinek [Wed, 15 Jul 2020 14:34:54 +0000 (16:34 +0200)]
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.
Nathan Sidwell [Wed, 15 Jul 2020 14:38:35 +0000 (07:38 -0700)]
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.
Piotr Trojanek [Fri, 5 Jun 2020 11:30:54 +0000 (13:30 +0200)]
[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.
Eric Botcazou [Fri, 5 Jun 2020 09:35:25 +0000 (11:35 +0200)]
[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.
Arnaud Charlet [Wed, 3 Jun 2020 07:42:19 +0000 (03:42 -0400)]
[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.
Arnaud Charlet [Thu, 4 Jun 2020 18:18:18 +0000 (14:18 -0400)]
[Ada] Fix logic in Allocate_Any_Controlled
gcc/ada/
* libgnat/s-stposu.adb (Allocate_Any_Controlled): Fix logic in
lock/unlock.
Piotr Trojanek [Thu, 28 May 2020 18:28:28 +0000 (20:28 +0200)]
[Ada] Target name is an object reference
gcc/ada/
* sem_util.adb (Is_Object_Reference): Return True on
N_Target_Name.
Arnaud Charlet [Thu, 4 Jun 2020 09:09:59 +0000 (05:09 -0400)]
[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.
Arnaud Charlet [Thu, 4 Jun 2020 08:13:16 +0000 (10:13 +0200)]
[Ada] Mention -gnat2020 in error message
gcc/ada/
* sem_ch13.adb (Check_Aspect_Too_Late): Mention -gnat2020 switch
in error message.
Eric Botcazou [Thu, 4 Jun 2020 08:15:33 +0000 (10:15 +0200)]
[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.
Eric Botcazou [Thu, 4 Jun 2020 07:56:02 +0000 (09:56 +0200)]
[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.
Ghjuvan Lacambre [Wed, 3 Jun 2020 09:09:20 +0000 (11:09 +0200)]
[Ada] Guard against access to wrong fields in Is_Renaming
gcc/ada/
* sem_util.adb (Is_Renaming): Add ekind checks.
Arnaud Charlet [Wed, 3 Jun 2020 20:14:38 +0000 (16:14 -0400)]
[Ada] Remove doc on obsolete tools
gcc/ada/
* doc/gnat_ugn/gnat_utility_programs.rst: Remove doc on obsolete
tools.
* gnat_ugn.texi: Regenerate.
Arnaud Charlet [Wed, 3 Jun 2020 16:27:43 +0000 (12:27 -0400)]
[Ada] Assert failure with -gnatwr
gcc/ada/
* sem_res.adb (Resolve_Type_Conversion): Protect against null
entity. Add proper tag for -gnatwr warning.
Arnaud Charlet [Wed, 3 Jun 2020 07:42:19 +0000 (03:42 -0400)]
[Ada] Missing error on operator call
gcc/ada/
* sem_ch6.adb (Analyze_Procedure_Call): Detect use of operators
in a procedure call.
* sem_util.adb: Minor edit.
Piotr Trojanek [Tue, 2 Jun 2020 22:17:21 +0000 (00:17 +0200)]
[Ada] Fix for possibly null ranges in 'Update and delta_aggregate
gcc/ada/
* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Apply scalar
range checks against the base type of an index type, not against
the index type itself.
Eric Botcazou [Wed, 3 Jun 2020 08:30:09 +0000 (10:30 +0200)]
[Ada] Small addition and tweaks in documentation on freezing
gcc/ada/
* einfo.ads (Delayed Freezing and Elaboration): Minor tweaks.
Document the discrepancy between the aspect and the non-aspect
cases for alignment settings in object declarations.
Arnaud Charlet [Sat, 30 May 2020 18:04:33 +0000 (14:04 -0400)]
[Ada] ACATS 4.1P [BDB4001] - 13.11.4(22-23/3) not enforced
gcc/ada/
* exp_ch3.adb (Freeze_Type): Remove warning in expander,
replaced by a corresponding error in sem_ch13.adb. Replace
RTE_Available by RTU_Loaded to avoid adding unnecessary
dependencies.
* sem_ch13.adb (Associate_Storage_Pool): New procedure.
(Analyze_Attribute_Definition_Clause
[Attribute_Simple_Storage_Pool| Attribute_Storage_Pool]): Call
Associate_Storage_Pool to add proper legality checks on
subpools.
Yannick Moy [Tue, 2 Jun 2020 12:16:25 +0000 (14:16 +0200)]
[Ada] Mark standard containers as not in SPARK
gcc/ada/
* libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads,
libgnat/a-cbhama.adb, libgnat/a-cbhama.ads,
libgnat/a-cbhase.adb, libgnat/a-cbhase.ads,
libgnat/a-cbmutr.adb, libgnat/a-cbmutr.ads,
libgnat/a-cborma.adb, libgnat/a-cborma.ads,
libgnat/a-cborse.adb, libgnat/a-cborse.ads,
libgnat/a-cbprqu.adb, libgnat/a-cbprqu.ads,
libgnat/a-cbsyqu.adb, libgnat/a-cbsyqu.ads,
libgnat/a-cdlili.adb, libgnat/a-cdlili.ads,
libgnat/a-cidlli.adb, libgnat/a-cidlli.ads,
libgnat/a-cihama.adb, libgnat/a-cihama.ads,
libgnat/a-cihase.adb, libgnat/a-cihase.ads,
libgnat/a-cimutr.adb, libgnat/a-cimutr.ads,
libgnat/a-ciorma.adb, libgnat/a-ciorma.ads,
libgnat/a-ciormu.adb, libgnat/a-ciormu.ads,
libgnat/a-ciorse.adb, libgnat/a-ciorse.ads,
libgnat/a-cohama.adb, libgnat/a-cohama.ads,
libgnat/a-cohase.adb, libgnat/a-cohase.ads,
libgnat/a-coinve.adb, libgnat/a-coinve.ads,
libgnat/a-comutr.adb, libgnat/a-comutr.ads,
libgnat/a-convec.adb, libgnat/a-convec.ads,
libgnat/a-coorma.adb, libgnat/a-coorma.ads,
libgnat/a-coormu.adb, libgnat/a-coormu.ads,
libgnat/a-coorse.adb, libgnat/a-coorse.ads: Add SPARK_Mode =>
Off.
Eric Botcazou [Tue, 2 Jun 2020 22:08:17 +0000 (00:08 +0200)]
[Ada] Fix oversight in Delayed_Aspect_Present predicate
gcc/ada/
* sem_ch3.adb (Delayed_Aspect_Present): Fix oversight in loop.
* freeze.adb (Freeze_Object_Declaration): Use Declaration_Node
instead of Parent for the sake of consistency.
Javier Miranda [Tue, 2 Jun 2020 19:46:10 +0000 (15:46 -0400)]
[Ada] Wrong resolution of 'access in protected subprogram
gcc/ada/
* sem_attr.adb (Resolve_Attribute): Resolve overloaded
N_Selected_Component prefix of 'Access. Required to handle
overloaded prefixed view of protected subprograms.
Arnaud Charlet [Tue, 2 Jun 2020 12:40:26 +0000 (08:40 -0400)]
[Ada] Documentation cleanups
gcc/ada/
* doc/gnat_ugn/about_this_guide.rst: Remove old section and
update for Ada 202x.
* doc/gnat_ugn/getting_started_with_gnat.rst: Add a system
requirements section. Remove obsolete section and minimal
rewording on the getting started section.
* gnat_ugn.texi: Regenerate.
Piotr Trojanek [Sat, 30 May 2020 09:56:38 +0000 (11:56 +0200)]
[Ada] Fix slices and qualified expressions being effectively volatile
gcc/ada/
* exp_ch5.adb (Expand_Assign_Array): Use short-circuit operator
(style).
* sem_res.adb (Resolve_Indexed_Component): Fix style in comment.
* sem_util.adb (Is_Effectively_Volatile_Object): Handle slices
just like indexed components; handle qualified expressions and
type conversions lie in Is_OK_Volatile_Context.
(Is_OK_Volatile_Context): Handle qualified expressions just like
type conversions.
Piotr Trojanek [Fri, 29 May 2020 18:57:53 +0000 (20:57 +0200)]
[Ada] Cleanup condition for an effectively volatile array type
gcc/ada/
* sem_prag.adb (Atomic_Components): Simplify with Ekind_In.
(Complex_Representation): Fix type of E_Id, which just like when
for pragma Atomic_Components will hold an N_Identifier node, not
an entity.
* sem_util.adb (Is_Effectively_Volatile): Refactor to avoid
unnecessary computation.
Arnaud Charlet [Wed, 27 May 2020 10:10:35 +0000 (06:10 -0400)]
[Ada] Extend static functions
gcc/ada/
* inline.adb, inline.ads
(Inline_Static_Expression_Function_Call): Renamed
Inline_Static_Function_Call.
* sem_ch13.adb (Analyze_Aspect_Static): Allow static intrinsic
imported functions under -gnatX.
* sem_util.ads, sem_util.adb (Is_Static_Expression_Function):
Renamed Is_Static_Function.
(Is_Static_Expression_Function_Call): Renamed
Is_Static_Function_Call.
* sem_ch6.adb, sem_elab.adb, sem_res.adb: Update calls to
Is_Static_Function*.
* sem_eval.adb (Fold_Dummy, Eval_Intrinsic_Call, Fold_Shift):
New.
(Eval_Call): Add support for intrinsic calls, code refactoring.
(Eval_Entity_Name): Code refactoring.
(Eval_Logical_Op): Update comment.
(Eval_Shift): Call Fold_Shift. Update comments.
* par-prag.adb (Par [Pragma_Extensions_Allowed]): Set
Ada_Version to Ada_Version_Type'Last to handle
Extensions_Allowed (On) consistently.
* opt.ads (Extensions_Allowed): Update documentation.
* sem_attr.adb: Update comment.
* doc/gnat_rm/implementation_defined_pragmas.rst: Update
documentation of Extensions_Allowed.
* gnat_rm.texi: Regenerate.
Arnaud Charlet [Tue, 2 Jun 2020 06:57:11 +0000 (02:57 -0400)]
[Ada] Potential access to uninitialized variable
gcc/ada/
* sem_aggr.adb (Resolve_Iterated_Component_Association): Ensure
Typ is never accessed uninitialized.
Piotr Trojanek [Fri, 8 May 2020 22:06:16 +0000 (00:06 +0200)]
[Ada] Fix typo in "accommodate" in docs and comments
gcc/ada/
* doc/gnat_rm/representation_clauses_and_pragmas.rst: Fix typo.
* gnat_rm.texi: Regenerate.
* libgnat/s-secsta.ads (Memory_Alignment): Likewise.
Gary Dismukes [Mon, 1 Jun 2020 19:22:48 +0000 (15:22 -0400)]
[Ada] Minor reformatting of comments and some code, plus a typo correction
gcc/ada/
* exp_ch6.adb: Add a comma and fix a typo (machinary =>
machinery) in comment.
* exp_aggr.adb: Reformat, fix capitalization, and add a couple
of commas in a comment. Adjust columns in several code
fragments.
* sem_aggr.adb: Reformat and add a comma in a comment.
Eric Botcazou [Mon, 1 Jun 2020 18:49:43 +0000 (20:49 +0200)]
[Ada] Use Sloc of delay statement in timed entry call
gcc/ada/
* exp_ch9.adb (Expand_N_Timed_Entry_Call): Use the Sloc of
the delay statement in the expansion.
Ed Schonberg [Sun, 31 May 2020 20:01:41 +0000 (16:01 -0400)]
[Ada] Ongoing work for unnamed and named container aggregates
gcc/ada/
* sem_aggr.adb (Resolve_Iterated_Component_Association): New
procedure, internal to Resolve_Container_Aggregate, to complete
semantic analysis of Iterated_Component_Associations.
* exp_aggr.adb (Expand_Iterated_Component): New procedure,
internal to Expand_Container_Aggregate, to expand the construct
into an implicit loop that performs individual insertions into
the target aggregate.
Justin Squirek [Fri, 29 May 2020 19:44:50 +0000 (15:44 -0400)]
[Ada] Spurious accessibility error on allocator
gcc/ada/
* exp_ch6.adb (Make_Build_In_Place_Call_Allocator): Normalize
the associated node for internally generated objects to be like
their SOAAT counter-parts.
Arnaud Charlet [Sat, 30 May 2020 18:01:17 +0000 (14:01 -0400)]
[Ada] Fix potentially uninitialized variable flagged by CodePeer
gcc/ada/
* libgnat/g-socket.adb (Wait_On_Socket): Fix potentially
uninitialized variable.
Nathan Sidwell [Wed, 15 Jul 2020 13:00:10 +0000 (06:00 -0700)]
c++: error recovery & pragmas
Parser error recovery can get confused by the tokens within a deferred
pragma, as treats those as regular tokens. This adjusts the recovery
so that the pragma is treated as a unit. Also, the preprocessor now
ensures that we never have an EOF token inside a pragma -- the pragma
is always closed first.
gcc/cp/
* parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
meeting a deferred pragma.
(cp_parser_skip_to_end_of_statement): Likewise.
(cp_parser_skip_to_end_of_block_or_statement): Likewise.
(cp_parser_skip_to_pragma_eol): We should never meet EOF.
(cp_parser_omp_declare_simd): Likewise.
(cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
(pragma_lex): Likewise.
gcc/testsuite/
* g++.dg/parse/pragma-recovery.C: New.
Tobias Burnus [Wed, 15 Jul 2020 10:29:44 +0000 (12:29 +0200)]
libgomp.fortran/struct-elem-map-1.f90: Add char kind=4 tests
As the Fortran PR 95837 has been fixed, the test could be be added.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/struct-elem-map-1.f90: Remove unused
variables; add character(kind=4) tests; update TODO comment.
Jakub Jelinek [Wed, 15 Jul 2020 09:34:44 +0000 (11:34 +0200)]
fix _mm512_{,mask_}cmp*_p[ds]_mask at -O0 [PR96174]
The _mm512_{,mask_}cmp_p[ds]_mask and also _mm_{,mask_}cmp_s[ds]_mask
intrinsics have an argument which must have a constant passed to it
and so use an inline version only for ifdef __OPTIMIZE__ and have
a #define for -O0. But the _mm512_{,mask_}cmp*_p[ds]_mask intrinsics
don't need a constant argument, they are essentially the first
set with the constant added to them implicitly based on the comparison
name, and so there is no #define version for them (correctly).
But their inline versions are defined in between the first and s[ds]
set and so inside of ifdef __OPTIMIZE__, which means that with -O0
they aren't defined at all.
This patch fixes that by moving those after the #ifdef __OPTIMIZE #else
use #define #endif block.
2020-07-15 Jakub Jelinek <jakub@redhat.com>
PR target/96174
* config/i386/avx512fintrin.h (_mm512_cmpeq_pd_mask,
_mm512_mask_cmpeq_pd_mask, _mm512_cmplt_pd_mask,
_mm512_mask_cmplt_pd_mask, _mm512_cmple_pd_mask,
_mm512_mask_cmple_pd_mask, _mm512_cmpunord_pd_mask,
_mm512_mask_cmpunord_pd_mask, _mm512_cmpneq_pd_mask,
_mm512_mask_cmpneq_pd_mask, _mm512_cmpnlt_pd_mask,
_mm512_mask_cmpnlt_pd_mask, _mm512_cmpnle_pd_mask,
_mm512_mask_cmpnle_pd_mask, _mm512_cmpord_pd_mask,
_mm512_mask_cmpord_pd_mask, _mm512_cmpeq_ps_mask,
_mm512_mask_cmpeq_ps_mask, _mm512_cmplt_ps_mask,
_mm512_mask_cmplt_ps_mask, _mm512_cmple_ps_mask,
_mm512_mask_cmple_ps_mask, _mm512_cmpunord_ps_mask,
_mm512_mask_cmpunord_ps_mask, _mm512_cmpneq_ps_mask,
_mm512_mask_cmpneq_ps_mask, _mm512_cmpnlt_ps_mask,
_mm512_mask_cmpnlt_ps_mask, _mm512_cmpnle_ps_mask,
_mm512_mask_cmpnle_ps_mask, _mm512_cmpord_ps_mask,
_mm512_mask_cmpord_ps_mask): Move outside of __OPTIMIZE__ guarded
section.
* gcc.target/i386/avx512f-vcmppd-3.c: New test.
* gcc.target/i386/avx512f-vcmpps-3.c: New test.
Jakub Jelinek [Wed, 15 Jul 2020 09:26:22 +0000 (11:26 +0200)]
builtins: Avoid useless char/short -> int promotions before atomics [PR96176]
As mentioned in the PR, we generate a useless movzbl insn before lock cmpxchg.
The problem is that the builtin for the char/short cases has the arguments
promoted to int and combine gives up, because the instructions have
MEM_VOLATILE_P arguments and recog in that case doesn't recognize anything
when volatile_ok is false, and nothing afterwards optimizes the
(reg:SI a) = (zero_extend:SI (reg:QI a))
... (subreg:QI (reg:SI a) 0) ...
The following patch fixes it at expansion time, we already have a function
that is meant to undo the promotion, so this just adds the very common case
to that.
2020-07-15 Jakub Jelinek <jakub@redhat.com>
PR target/96176
* builtins.c: Include gimple-ssa.h, tree-ssa-live.h and
tree-outof-ssa.h.
(expand_expr_force_mode): If exp is a SSA_NAME with different mode
from MODE and get_gimple_for_ssa_name is a cast from MODE, use the
cast's rhs.
* gcc.target/i386/pr96176.c: New test.
guojiufu [Wed, 15 Jul 2020 08:07:47 +0000 (16:07 +0800)]
rs6000: Refine RTL unroll hook for small loops
For very small loops (< 6 insns), it would be fine to unroll 4
times to run fast with less latency and better cache usage. Like
below loops:
while (i) a[--i] = NULL; while (p < e) *d++ = *p++;
With this patch enhances, we could see some performance improvement
for some workloads(e.g. SPEC2017).
2020-07-13 Jiufu Guo <guojiufu@cn.ibm.com>
* config/rs6000/rs6000.c (rs6000_loop_unroll_adjust): Refine hook.
Tobias Burnus [Wed, 15 Jul 2020 06:33:20 +0000 (08:33 +0200)]
libgomp: Add Fortran routine support for allocators
libgomp/ChangeLog:
* allocator.c: Add ialias for omp_init_allocator and
omp_destroy_allocator.
* configure.ac: Set INTPTR_T_KIND.
* configure: Regenerate.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* fortran.c (omp_init_allocator_, omp_destroy_allocator_,
omp_set_default_allocator_, omp_get_default_allocator_): New
functions and ialias_redirect.
* icv.c: Add ialias for omp_set_default_allocator and
omp_get_default_allocator.
* libgomp.map (OMP_5.0.1): Add omp_init_allocator_,
omp_destroy_allocator_, omp_set_default_allocator_ and
omp_get_default_allocator_.
* omp_lib.f90.in: Add allocator traits parameters, declare
allocator routines and add related kind parameters.
* omp_lib.h.in: Likewise.
* testsuite/libgomp.c-c++-common/alloc-2.c: Fix sizeof.
* testsuite/libgomp.fortran/alloc-1.F90: New test.
* testsuite/libgomp.fortran/alloc-2.F90: New test.
* testsuite/libgomp.fortran/alloc-3.F: New test.
* testsuite/libgomp.fortran/alloc-4.f90: New test.
* testsuite/libgomp.fortran/alloc-5.f90: New test.
GCC Administrator [Wed, 15 Jul 2020 00:16:35 +0000 (00:16 +0000)]
Daily bump.
Marek Polacek [Tue, 14 Jul 2020 21:31:08 +0000 (17:31 -0400)]
c++: Add new test [PR59978]
Fixed in r224162. That came without a test so adding this one.
Previously, we issued a bogus "too few arguments to function" error.
gcc/testsuite/ChangeLog:
PR c++/59978
* g++.dg/cpp0x/vt-59978.C: New test.
H.J. Lu [Tue, 14 Jul 2020 21:01:51 +0000 (14:01 -0700)]
x86: Replace __glibc_unlikely with __builtin_expect
Replace glibc specific __glibc_unlikely with __builtin_expect.
PR target/95443
* gcc.target/i386/pr95443-1.c (simple_strstr): Replace
__glibc_unlikely with __builtin_expect.
Marek Polacek [Tue, 23 Jun 2020 01:26:49 +0000 (21:26 -0400)]
c++: Make convert_like complain about bad ck_ref_bind again [PR95789]
convert_like issues errors about bad_p conversions at the beginning
of the function, but in the ck_ref_bind case, it only issues them
after we've called convert_like on the next conversion.
This doesn't work as expected since r10-7096 because when we see
a conversion from/to class type in a template, we return early, thereby
missing the error, and a bad_p conversion goes by undetected. That
made the attached test to compile even though it should not.
I had thought that I could just move the ck_ref_bind/bad_p errors
above to the rest of them, but that regressed diagnostics because
expr then wasn't converted yet by the nested convert_like_real call.
So, for bad_p conversions, do the normal processing, but still return
the IMPLICIT_CONV_EXPR to avoid introducing trees that the template
processing can't handle well. This I achieved by adding a wrapper
function.
gcc/cp/ChangeLog:
PR c++/95789
PR c++/96104
PR c++/96179
* call.c (convert_like_real_1): Renamed from convert_like_real.
(convert_like_real): New wrapper for convert_like_real_1.
gcc/testsuite/ChangeLog:
PR c++/95789
PR c++/96104
PR c++/96179
* g++.dg/conversion/ref4.C: New test.
* g++.dg/conversion/ref5.C: New test.
* g++.dg/conversion/ref6.C: New test.
David Edelsohn [Tue, 14 Jul 2020 19:31:23 +0000 (15:31 -0400)]
rs6000: Don't call movsi_from_sf in 32 bit mode.
movsi_from_sf uses rldimi instruction, which will cause the compiler to ICE
in 32 bit mode. This patch limits the recently added pattern and call to
TARGET_POWERPC64.
2020-07-14 David Edelsohn <dje.gcc@gmail.com>
gcc/ChangeLog
* config/rs6000/rs6000.md (rotldi3_insert_sf): Add TARGET_POWERPC64
condition.
* config/rs6000/rs6000.c (rs6000_expand_vector_init): Add
TARGET_POWERPC64 requirement to TARGET_P8_VECTOR case.
Nathan Sidwell [Tue, 14 Jul 2020 17:49:03 +0000 (10:49 -0700)]
c++: Parser entry cleanup
The handling of PCH is a little trick, because we have to deal with it before
allocating memory. I found the layering somewhat confusing. This patch
reorganizes that, so that the stopping of PCH is done in exactly one place,
and the ordering of lexer creation relative to that is much clearer.
I also changed the error message about multiple source files as with C++20,
'modules' means something rather specific.
Other than the error message changes, no functional changes.
gcc/cp/
* parser.c (cp_lexer_alloc): Do not deal with PCH here.
(cp_lexer_new_main): Deal with PCH here. Store the tokens directly
into the buffer.
(cp_lexer_new_from_tokens): Assert last token isn't purged either.
(cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
(cp_parser_new): Pass the lexer in, don't create it here.
(cp_parser_translation_unit): Initialize access checks here.
(cp_parser_initial_pragma): First token is provided by caller,
don't deal with PCH stopping here. Adjust error message.
(c_parse_file): Adjust, change error message to avoid C++20 module
confusion.
Kwok Cheung Yeung [Tue, 14 Jul 2020 17:31:35 +0000 (10:31 -0700)]
libgomp: Fix hang when profiling OpenACC programs with CUDA 9.0 nvprof
The version of nvprof in CUDA 9.0 causes a hang when used to profile an
OpenACC program. This is because it calls acc_get_device_type from
a callback called during device initialization, which then attempts
to acquire acc_device_lock while it is already taken, resulting in
deadlock. This works around the issue by returning acc_device_none
from acc_get_device_type without attempting to acquire the lock when
initialization has not completed yet.
2020-07-14 Tom de Vries <tom@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
Kwok Cheung Yeung <kcy@codesourcery.com>
libgomp/
* oacc-init.c (acc_init_state_lock, acc_init_state, acc_init_thread):
New variable.
(acc_init_1): Set acc_init_thread to pthread_self (). Set
acc_init_state to initializing at the start, and to initialized at the
end.
(self_initializing_p): New function.
(acc_get_device_type): Return acc_device_none if called by thread that
is currently executing acc_init_1.
* libgomp.texi (acc_get_device_type): Update documentation.
(Implementation Status and Implementation-Defined Behavior): Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-2.c: New.
Ian Lance Taylor [Fri, 10 Jul 2020 16:34:28 +0000 (09:34 -0700)]
demangler: don't treat lambda as a substitution candidate
libiberty/ChangeLog:
PR demangler/96143
* cp-demangle.c (d_lambda): Don't add substitution candidate.
* testsuite/demangle-expected: Update a few existing test cases
accordingly, and add a new test case.
Lewis Hyatt [Tue, 14 Jul 2020 16:05:56 +0000 (12:05 -0400)]
diagnostics: Support conversion of tabs to spaces [PR49973] [PR86904]
Supports conversion of tabs to spaces when outputting diagnostics. Also
adds -fdiagnostics-column-unit and -fdiagnostics-column-origin options to
control how the column number is output, thereby resolving the two PRs.
gcc/c-family/ChangeLog:
PR other/86904
* c-indentation.c (should_warn_for_misleading_indentation): Get
global tabstop from the new source.
* c-opts.c (c_common_handle_option): Remove handling of -ftabstop, which
is now a common option.
* c.opt: Likewise.
gcc/ChangeLog:
PR preprocessor/49973
PR other/86904
* common.opt: Handle -ftabstop here instead of in c-family
options. Add -fdiagnostics-column-unit= and
-fdiagnostics-column-origin= options.
* opts.c (common_handle_option): Handle the new options.
* diagnostic-format-json.cc (json_from_expanded_location): Add
diagnostic_context argument. Use it to convert column numbers as per
the new options.
(json_from_location_range): Likewise.
(json_from_fixit_hint): Likewise.
(json_end_diagnostic): Pass the new context argument to helper
functions above. Add "column-origin" field to the output.
(test_unknown_location): Add the new context argument to calls to
helper functions.
(test_bad_endpoints): Likewise.
* diagnostic-show-locus.c
(exploc_with_display_col::exploc_with_display_col): Support
tabstop parameter.
(layout_point::layout_point): Make use of class
exploc_with_display_col.
(layout_range::layout_range): Likewise.
(struct line_bounds): Clarify that the units are now always
display columns. Rename members accordingly. Add constructor.
(layout::print_source_line): Add support for tab expansion.
(make_range): Adapt to class layout_range changes.
(layout::maybe_add_location_range): Likewise.
(layout::layout): Adapt to class exploc_with_display_col changes.
(layout::calculate_x_offset_display): Support tabstop parameter.
(layout::print_annotation_line): Adapt to struct line_bounds changes.
(layout::print_line): Likewise.
(line_label::line_label): Add diagnostic_context argument.
(get_affected_range): Likewise.
(get_printed_columns): Likewise.
(layout::print_any_labels): Adapt to struct line_label changes.
(class correction): Add m_tabstop member.
(correction::correction): Add tabstop argument.
(correction::compute_display_cols): Use m_tabstop.
(class line_corrections): Add m_context member.
(line_corrections::line_corrections): Add diagnostic_context argument.
(line_corrections::add_hint): Use m_context to handle tabstops.
(layout::print_trailing_fixits): Adapt to class line_corrections
changes.
(test_layout_x_offset_display_utf8): Support tabstop parameter.
(test_layout_x_offset_display_tab): New selftest.
(test_one_liner_colorized_utf8): Likewise.
(test_tab_expansion): Likewise.
(test_diagnostic_show_locus_one_liner_utf8): Call the new tests.
(diagnostic_show_locus_c_tests): Likewise.
(test_overlapped_fixit_printing): Adapt to helper class and
function changes.
(test_overlapped_fixit_printing_utf8): Likewise.
(test_overlapped_fixit_printing_2): Likewise.
* diagnostic.h (enum diagnostics_column_unit): New enum.
(struct diagnostic_context): Add members for the new options.
(diagnostic_converted_column): Declare.
(json_from_expanded_location): Add new context argument.
* diagnostic.c (diagnostic_initialize): Initialize new members.
(diagnostic_converted_column): New function.
(maybe_line_and_column): Be willing to output a column of 0.
(diagnostic_get_location_text): Convert column number as per the new
options.
(diagnostic_report_current_module): Likewise.
(assert_location_text): Add origin and column_unit arguments for
testing the new functionality.
(test_diagnostic_get_location_text): Test the new functionality.
* doc/invoke.texi: Document the new options and behavior.
* input.h (location_compute_display_column): Add tabstop argument.
* input.c (location_compute_display_column): Likewise.
(test_cpp_utf8): Add selftests for tab expansion.
* tree-diagnostic-path.cc (default_tree_make_json_for_path): Pass the
new context argument to json_from_expanded_location().
libcpp/ChangeLog:
PR preprocessor/49973
PR other/86904
* include/cpplib.h (struct cpp_options): Removed support for -ftabstop,
which is now handled by diagnostic_context.
(class cpp_display_width_computation): New class.
(cpp_byte_column_to_display_column): Add optional tabstop argument.
(cpp_display_width): Likewise.
(cpp_display_column_to_byte_column): Likewise.
* charset.c
(cpp_display_width_computation::cpp_display_width_computation): New
function.
(cpp_display_width_computation::advance_display_cols): Likewise.
(compute_next_display_width): Removed and implemented this
functionality in a new function...
(cpp_display_width_computation::process_next_codepoint): ...here.
(cpp_byte_column_to_display_column): Added tabstop argument.
Reimplemented in terms of class cpp_display_width_computation.
(cpp_display_column_to_byte_column): Likewise.
* init.c (cpp_create_reader): Remove handling of -ftabstop, which is now
handled by diagnostic_context.
gcc/testsuite/ChangeLog:
PR preprocessor/49973
PR other/86904
* c-c++-common/Wmisleading-indentation-3.c: Adjust expected output
for new defaults.
* c-c++-common/Wmisleading-indentation.c: Likewise.
* c-c++-common/diagnostic-format-json-1.c: Likewise.
* c-c++-common/diagnostic-format-json-2.c: Likewise.
* c-c++-common/diagnostic-format-json-3.c: Likewise.
* c-c++-common/diagnostic-format-json-4.c: Likewise.
* c-c++-common/diagnostic-format-json-5.c: Likewise.
* c-c++-common/missing-close-symbol.c: Likewise.
* g++.dg/diagnostic/bad-binary-ops.C: Likewise.
* g++.dg/parse/error4.C: Likewise.
* g++.old-deja/g++.brendan/crash11.C: Likewise.
* g++.old-deja/g++.pt/overload2.C: Likewise.
* g++.old-deja/g++.robertl/eb109.C: Likewise.
* gcc.dg/analyzer/malloc-paths-9.c: Likewise.
* gcc.dg/bad-binary-ops.c: Likewise.
* gcc.dg/format/branch-1.c: Likewise.
* gcc.dg/format/pr79210.c: Likewise.
* gcc.dg/plugin/diagnostic-test-expressions-1.c: Likewise.
* gcc.dg/plugin/diagnostic-test-string-literals-1.c: Likewise.
* gcc.dg/redecl-4.c: Likewise.
* gfortran.dg/diagnostic-format-json-1.F90: Likewise.
* gfortran.dg/diagnostic-format-json-2.F90: Likewise.
* gfortran.dg/diagnostic-format-json-3.F90: Likewise.
* go.dg/arrayclear.go: Add a comment explaining why adding a
comment was necessary to work around a dejagnu bug.
* c-c++-common/diagnostic-units-1.c: New test.
* c-c++-common/diagnostic-units-2.c: New test.
* c-c++-common/diagnostic-units-3.c: New test.
* c-c++-common/diagnostic-units-4.c: New test.
* c-c++-common/diagnostic-units-5.c: New test.
* c-c++-common/diagnostic-units-6.c: New test.
* c-c++-common/diagnostic-units-7.c: New test.
* c-c++-common/diagnostic-units-8.c: New test.
Nathan Sidwell [Tue, 14 Jul 2020 15:19:36 +0000 (08:19 -0700)]
c++: tree dumper
A couple of C++ nodes were unknown to the tree dumper.
gcc/cp/
* ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
Nathan Sidwell [Tue, 14 Jul 2020 15:11:13 +0000 (08:11 -0700)]
c++: Refactor some class fns
Storing CLASSTYPE_AS_BASE in a local variable makes some code clearer
(and textually no longer). For some reason we store a DECL in a variable
called 'value', which is confusing.
gcc/cp/
* class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
(build_self_reference): Rename value -> decl.
(dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
David Edelsohn [Mon, 13 Jul 2020 18:43:39 +0000 (14:43 -0400)]
aix: FAT libraries: test native compiler mode directly
The FAT libraries config fragments need to know which library is native
and which is a multilib to choose the correct multilib from which to
append the additional object file or shared object file. Testing the
top-level archive is fragile because it will fail if rebuilding. This
patch tests the compiler preprocessing macros for the 64 bit AIX specific
__64BIT__ to determine the native mode of the compiler in MULTILIBTOP.
2020-07-14 David Edelsohn <dje.gcc@gmail.com>
libatomic/ChangeLog
* config/t-aix: Set BITS from compiler cpp macro.
libgcc/ChangeLog
* config/rs6000/t-slibgcc-aix: Set BITS from compiler cpp macro.
libgfortran/ChangeLog
* config/t-aix: Set BITS from compiler cpp macro.
libgomp/ChangeLog
* config/t-aix: Set BITS from compiler cpp macro.
libstdc++-v3/ChangeLog
* config/os/aix/t-aix: Set BITS from compiler cpp macro.
Tobias Burnus [Tue, 14 Jul 2020 14:28:37 +0000 (16:28 +0200)]
Fix goacc/finalize-1.f tree dump-scanning for -m32
gcc/testsuite/ChangeLog:
* gfortran.dg/goacc/finalize-1.f: Relax scan-tree-dump-times
pattern to work on 32bit-pointer systems.
David Edelsohn [Sat, 11 Jul 2020 23:42:56 +0000 (19:42 -0400)]
testsuite: adapt g++.dg/ipa/pr83667.C for AIX
The current testsuite regex looks for THUNK0. AIX generates THUNK..0.
This patch expands the regex to allow 0 or more dots between THUNK
and the 0.
gcc/testsuite/ChangeLog
2020-07-14 David Edelsohn <dje.gcc@gmail.com>
* g++.dg/ipa/pr83667.C: Allow 0 or more dots between THUNK and 0.
Jakub Jelinek [Tue, 14 Jul 2020 14:01:11 +0000 (16:01 +0200)]
expr: Unbreak build of mesa [PR96194]
> > The store to the whole of each volatile object was picked apart
> > like there had been an individual assignment to each of the
> > fields. Reads were added as part of that; see PR for details.
> > The reads from volatile memory were a clear bug; individual
> > stores questionable. A separate patch clarifies the docs.
This breaks building of mesa on both the trunk and 10 branch.
The problem is that the middle-end may never create temporaries of non-POD
(TREE_ADDRESSABLE) types, those can be only created when the language says
so and thus only the FE is allowed to create those.
This patch just reverts the behavior to what we used to do before for the
stores to volatile non-PODs. Perhaps we want to do something else, but
definitely we can't create temporaries of the non-POD type. It is up to
discussions on what should happen in those cases.
2020-07-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/96194
* expr.c (expand_constructor): Don't create temporary for store to
volatile MEM if exp has an addressable type.
* g++.dg/opt/pr96194.C: New test.
Marek Polacek [Wed, 24 Jun 2020 21:39:21 +0000 (17:39 -0400)]
c++: Improve checking of decls with trailing return type [PR95820]
This is an ICE-on-invalid but I've been seeing it when reducing
various testcases, so it's more important for me than usually.
splice_late_return_type now checks that if we've seen a late return
type, the function return type was auto. That's a fair assumption
but grokdeclarator/cdk_function wasn't giving errors for function
pointers and similar. So we want to perform various checks not only
when funcdecl_p || inner_declarator == NULL. But only give the
!late_return_type errors when funcdecl_p, to accept e.g.
auto (*fp)() = f;
in C++11. Here's a diff -w to ease the review:
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12102,14 +12102,9 @@ grokdeclarator (const cp_declarator *declarator,
/* Handle a late-specified return type. */
tree late_return_type = declarator->u.function.late_return_type;
- if (funcdecl_p
- /* This is the case e.g. for
- using T = auto () -> int. */
- || inner_declarator == NULL)
- {
if (tree auto_node = type_uses_auto (type))
{
- if (!late_return_type)
+ if (!late_return_type && funcdecl_p)
{
if (current_class_type
&& LAMBDA_TYPE_P (current_class_type))
@@ -12201,7 +12196,6 @@ grokdeclarator (const cp_declarator *declarator,
"type specifier", name);
return error_mark_node;
}
- }
type = splice_late_return_type (type, late_return_type);
if (type == error_mark_node)
return error_mark_node;
gcc/cp/ChangeLog:
PR c++/95820
* decl.c (grokdeclarator) <case cdk_function>: Check also
pointers/references/... to functions.
gcc/testsuite/ChangeLog:
PR c++/95820
* g++.dg/cpp1y/auto-fn58.C: New test.
Nathan Sidwell [Tue, 14 Jul 2020 13:08:44 +0000 (06:08 -0700)]
core: formatting & comment
One of hash_map's getters returns a pointer to T or null, The comment
said it returned T or null. Also an unaligned pair of comments.
gcc/
* hash-map.h (hash_map::get): Note it is a pointer to value.
* incpath.h (incpath_kind): Align comments.
Nathan Sidwell [Tue, 14 Jul 2020 12:57:57 +0000 (05:57 -0700)]
c++: Comments & formatting
I found some bad formatting and misleading or incomplete comments
during my spelunking around the c++FE. May as well clean up trunk and
record what I noted.
gcc/cp/
* cp-tree.h: Correct some tree lang flag comments,
reformat some structure definitions. Note some structure
sizes. Clarify some comments.
(yyungetc): Delete. Not been a thing for some time.
* class.c (copy_fndecl_with_name): Comment.
(check_bases_and_members): Unnecessary {}.
(layout_class_type): Comment.
* cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
* decl.c: Fix some formatting & whitespace issues.
(function_requirements_equivalent_p): Note why
substitutions are needed.
* decl2.c (no_linkage_error): Note that heroics about
'typedef struct { ... };' are no longer needed.
* method.c: Whitespace.
* name-lookup.c: Whitespace.
(add_decl_to_level): Reformat a line.
(print_binding_stack): Mark as DEBUG_FUNCTION.
(has_using_namespace_std_directive_p): Delete comment.
* pt.c: Whitespace
* ptree.c: Whitespace.
* rtti.c: Whitespace & comment.
* tree.c: Comment.
* typeck.c (structural_comptypes): Add comment.
Nathan Sidwell [Mon, 13 Jul 2020 20:52:03 +0000 (13:52 -0700)]
core: add tree-node comments
As we've moved to 64-bit systems, the padding information has become
conditionally inaccurate. I also hit cases where invalid tree codes
did not get flagged as invalid.
gcc/
* tree-core.h (tree_decl_with_vis, tree_function_decl):
Note additional padding on 64-bits
* tree.c (cache_integer_cst): Note why no caching of enum literals.
(get_tree_code_name): Robustify error case.
Nathan Sidwell [Mon, 13 Jul 2020 20:42:52 +0000 (13:42 -0700)]
doc: Fix some typos
gty calls gt_clear*e*_cache not gt_clear_cache. I know not why it is
named so, but at least document it correctly. invoke.texi had a duplicate opindex.
gcc/
* doc/gty.texi: Fic gt_cleare_cache name.
* doc/invoke.texi: Remove duplicate opindex Wabi-tag.
Mark Eggleston [Thu, 11 Jun 2020 10:05:40 +0000 (11:05 +0100)]
Fortran : ICE in gfc_check_pointer_assign PR95612
Output an error if the right hand value is a zero sized array or
does not have a symbol tree otherwise continue checking.
2020-07-14 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95612
* expr.c (gfc_check_pointer_assigb): Output an error if
rvalue is a zero sized array or output an error if rvalue
doesn't have a symbol tree.
2020-07-14 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95612
* gfortran.dg/pr95612.f90: New test.
Tobias Burnus [Tue, 14 Jul 2020 11:39:46 +0000 (13:39 +0200)]
[OpenMP, Fortran] Add structure/derived-type element mapping
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_omp_clauses): Match also derived-type
component refs in OMP_CLAUSE_MAP.
(resolve_omp_clauses): Resolve those.
* trans-openmp.c (gfc_trans_omp_array_section, gfc_trans_omp_clauses):
Handle OpenMP structure-element mapping.
(gfc_trans_oacc_construct, gfc_trans_oacc_executable_directive,
(gfc_trans_oacc_combined_directive, gfc_trans_oacc_declare): Update
add openacc=true in gfc_trans_omp_clauses call.
gcc/testsuite/ChangeLog:
* gfortran.dg/goacc/finalize-1.f: Update dump scan pattern.
* gfortran.dg/gomp/map-1.f90: Update dg-error.
* gfortran.dg/gomp/map-2.f90: New test.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/struct-elem-map-1.f90: New test.
Tobias Burnus [Tue, 14 Jul 2020 10:55:53 +0000 (12:55 +0200)]
[Fortran, OpenMP] Fix allocatable-components check (PR67311)
gcc/fortran/ChangeLog:
PR fortran/67311
* trans-openmp.c (gfc_has_alloc_comps): Return false also for
pointers to arrays.
libgomp/ChangeLog:
PR fortran/67311
* testsuite/libgomp.fortran/target-map-1.f90: New test.
Jakub Jelinek [Tue, 14 Jul 2020 08:31:59 +0000 (10:31 +0200)]
openmp: Adjust outer bounds of non-rect loops
In loops like:
#pragma omp parallel for collapse(2)
for (i = -4; i < 8; i++)
for (j = 3 * i; j > 2 * i; j--)
for some outer loop iterations there are no inner loop iterations at all,
the condition is false. In order to use Summæ Potestate to count number
of iterations or to transform the logical iteration number to actual
iterator values using quadratic non-equation root discovery the outer
iterator range needs to be adjusted, such that the inner loop has at least
one iteration for each of the outer loop iterator value in the reduced
range. Sometimes this adjustment is done at the start of the range,
at other times at the end.
This patch implements it during the compile time number of loop computation
(if all expressions are compile time constants).
2020-07-14 Jakub Jelinek <jakub@redhat.com>
* omp-general.h (struct omp_for_data): Add adjn1 member.
* omp-general.c (omp_extract_for_data): For non-rect loop, punt on
count computing if n1, n2 or step are not INTEGER_CST earlier.
Narrow the outer iterator range if needed so that non-rect loop
has at least one iteration for each outer range iteration. Compute
adjn1.
* omp-expand.c (expand_omp_for_init_vars): Use adjn1 if non-NULL
instead of the outer loop's n1.
* testsuite/libgomp.c/loop-21.c: New test.
Matthias Klose [Tue, 14 Jul 2020 08:12:08 +0000 (10:12 +0200)]
LTO: pick up -fcf-protection flag for the link step
2020-07-14 Matthias Klose <doko@ubuntu.com>
PR lto/95604
* lto-wrapper.c (merge_and_complain): Add decoded options as parameter,
error on different values for -fcf-protection.
(append_compiler_options): Pass -fcf-protection option.
(find_and_merge_options): Add decoded options as parameter,
pass decoded_options to merge_and_complain.
(run_gcc): Pass decoded options to find_and_merge_options.
* lto-opts.c (lto_write_options): Pass -fcf-protection option.
Mark Eggleston [Mon, 6 Jul 2020 06:14:59 +0000 (07:14 +0100)]
Fortran : Implicitly type parameter causes an invalid error PR96038
If a paramter to declared and initialised before its type is
declared a bogus error is output at the type declaration
idicating that initialisation is missing.
2020-07-14 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/96038
* decl.c (add_init_expr_sym): For a symbol that is a
parameter accept an initialisation if it does not have a
value otherwise output a error and reject.
2020-07-14 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/96038
* gfortran.dg/pr96038.f90: New test.
GCC Administrator [Tue, 14 Jul 2020 00:16:30 +0000 (00:16 +0000)]
Daily bump.
Alan Modra [Mon, 13 Jul 2020 23:49:43 +0000 (09:19 +0930)]
Merge sibcall_local32/64
This patch consolidates four insn patterns into two.
* config/rs6000/rs6000.md (sibcall_local): Merge sibcall_local32
and sibcall_local64.
(sibcall_value_local): Similarly.
Aaron Sawdey [Mon, 13 Jul 2020 21:19:33 +0000 (16:19 -0500)]
rs6000: clean up testsuite power10_hw check
Because the check for power10_hw is not called
check_effective_target_power10_hw, it needs to be looked
for by is-effective-target-keyword. Also reorder things
in is-effective-target to put power10_hw with the other
ppc stuff.
gcc/testsuite/
* lib/target-supports.exp (is-effective-target):
Reorder to put powerpc stuff together.
(is-effective-target-keyword): Add power10_hw.
Nathan Sidwell [Mon, 13 Jul 2020 20:37:46 +0000 (13:37 -0700)]
testsuite: scan-lang-dump-times & scan-lang-dump-not
Sigh, last week's success at not breaking things failed with an
incorrect 'fix' this morning. Let's reduce my confusion by making
lib/scanlang.exp the same on trunk as modules.
gcc/testsuite/
* lib/scanlang.exp (scan-lang-dump): Fix breakage.
(scan-lang-dump-times, scan-lang-dump-not): New.
Nathan Sidwell [Mon, 13 Jul 2020 20:17:20 +0000 (13:17 -0700)]
Remove long-gone cxxmain.c from makefiles
I discovered we were attempting to delete some no-longer generated
files.
gcc/
* Makefile.in (distclean): Remove long gone cxxmain.c
gcc/cp/
* Make-lang.in (c++.disclean): Likewise.
Aaron Sawdey [Fri, 10 Jul 2020 22:46:17 +0000 (17:46 -0500)]
rs6000: add effective-target test ppc_mma_hw
Add a test for dejagnu to determine if execution of MMA instructions is
supported in the test environment. Add an execution test to make sure
that __builtin_cpu_supports("mma") is true if we can execute MMA
instructions.
gcc/testsuite/
* lib/target-supports.exp (check_ppc_mma_hw_available):
New function.
(is-effective-target): Add ppc_mma_hw.
(is-effective-target-keyword): Add ppc_mma_hw.
* gcc.target/powerpc/mma-supported.c: New file.
* gcc.target/powerpc/mma-single-test.c: Require ppc_mma_hw.
* gcc.target/powerpc/mma-double-test.c: Require ppc_mma_hw.
H.J. Lu [Mon, 13 Jul 2020 17:33:47 +0000 (10:33 -0700)]
x86: Pass a copy of the string length to cmpstrnqi
cmpstrnsi expander may pass the actual string length directly to cmpstrnqi
patterns. For cmpstrnsi, one of the strings must be a constant and
expand_builtin_strncmp rewrites the length argument to be the minimum of
the const string length and the actual string length. But it is not the
case for cmpmemsi. Pass a copy of the string length to cmpstrnqi patterns
to avoid changing the actual string length by cmpstrnqi patterns.
gcc/
PR target/95443
* config/i386/i386.md (cmpstrnsi): Pass a copy of the string
length to cmpstrnqi patterns.
gcc/testsuite/
PR target/95443
* gcc.target/i386/pr95443-1.c: New test.
* gcc.target/i386/pr95443-2.c: Likewise.
Marek Polacek [Mon, 13 Jul 2020 17:05:06 +0000 (13:05 -0400)]
c++: Add test [PR95288]
Somewhat improved by r11-2064, though we still generate junk that seems
redundant. But at least it says
error: expected ‘}’ before ‘.’ token
PR c++/95288
* g++.dg/diagnostic/enum2.C: New test.