Eric Botcazou [Fri, 4 Jun 2021 16:22:17 +0000 (18:22 +0200)]
[Ada] Use GNAT encodings only when -fgnat-encodings=all is specified
gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_entity) <discrete_type>: Add a
parallel type only when -fgnat-encodings=all is specified.
<E_Array_Type>: Use the PAT name and special suffixes only when
-fgnat-encodings=all is specified.
<E_Array_Subtype>: Build a special type for debugging purposes only
when -fgnat-encodings=all is specified. Add a parallel type or use
the PAT name only when -fgnat-encodings=all is specified.
<E_Record_Type>: Generate debug info for the inner record types only
when -fgnat-encodings=all is specified.
<E_Record_Subtype>: Use a debug type for an artificial subtype only
except when -fgnat-encodings=all is specified.
(elaborate_expression_1): Reset need_for_debug when possible only
except when -fgnat-encodings=all is specified.
(components_to_record): Use XV encodings for variable size only
when -fgnat-encodings=all is specified.
(associate_original_type_to_packed_array): Add a parallel type only
when -fgnat-encodings=all is specified.
* gcc-interface/misc.c (gnat_get_array_descr_info): Do not return
full information only when -fgnat-encodings=all is specified.
* gcc-interface/utils.c (make_packable_type): Add a parallel type
only when -fgnat-encodings=all is specified.
(maybe_pad_type): Make the inner type a debug type only except when
-fgnat-encodings=all is specified. Create an XVS type for variable
size only when -fgnat-encodings=all is specified.
(rest_of_record_type_compilation): Add a parallel type only when
-fgnat-encodings=all is specified.
Eric Botcazou [Tue, 27 Apr 2021 19:18:12 +0000 (21:18 +0200)]
[Ada] Implement support for unconstrained array types with FLB
gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Use a
fixed lower bound if the index subtype is marked so, as well as a
more efficient formula for the upper bound if the array cannot be
superflat.
(flb_cannot_be_superflat): New predicate.
(cannot_be_superflat): Rename into...
(range_cannot_be_superfla): ...this. Minor tweak.
Bob Duff [Tue, 15 Jun 2021 13:12:36 +0000 (09:12 -0400)]
[Ada] Clean up Uint fields
gcc/ada/
* uintp.ads, types.h: New subtypes of Uint: Valid_Uint, Unat,
Upos, Nonzero_Uint with predicates. These correspond to new
field types in Gen_IL.
* gen_il-types.ads (Valid_Uint, Unat, Upos, Nonzero_Uint): New
field types.
* einfo-utils.ads, einfo-utils.adb, fe.h (Known_Alignment,
Init_Alignment): Use the initial zero value to represent
"unknown". This will ensure that if Alignment is called before
Set_Alignment, the compiler will blow up (if assertions are
enabled).
* atree.ads, atree.adb, atree.h, gen_il-gen.adb
(Get_Valid_32_Bit_Field): New generic low-level getter for
subtypes of Uint.
(Copy_Alignment): New procedure to copy Alignment field even
when Unknown.
(Init_Object_Size_Align, Init_Size_Align): Do not bypass the
Init_ procedures.
* exp_pakd.adb, freeze.adb, layout.adb, repinfo.adb,
sem_util.adb: Protect calls to Alignment with Known_Alignment.
Use Copy_Alignment when it might be unknown.
* gen_il-gen-gen_entities.adb (Alignment,
String_Literal_Length): Use type Unat instead of Uint, to ensure
that the field is always Set_ before we get it, and that it is
set to a nonnegative value.
(Enumeration_Pos): Unat.
(Enumeration_Rep): Valid_Uint. Can be negative, but must be
valid before fetching.
(Discriminant_Number): Upos.
(Renaming_Map): Remove.
* gen_il-gen-gen_nodes.adb (Char_Literal_Value, Reason): Unat.
(Intval, Corresponding_Integer_Value): Valid_Uint.
* gen_il-internals.ads: New functions for dealing with special
defaults and new subtypes of Uint.
* scans.ads: Correct comments.
* scn.adb (Post_Scan): Do not set Intval to No_Uint; that is no
longer allowed.
* sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Do
not set Enumeration_Rep to No_Uint; that is no longer allowed.
(Offset_Value): Protect calls to Alignment with Known_Alignment.
* sem_prag.adb (Set_Atomic_VFA): Do not use Uint_0 to mean
"unknown"; call Init_Alignment instead.
* sinfo.ads: Minor comment fix.
* treepr.adb: Deal with printing of new field types.
* einfo.ads, gen_il-fields.ads (Renaming_Map): Remove.
* gcc-interface/decl.c (gnat_to_gnu_entity): Use Known_Alignment
before calling Alignment. This preserve some probably buggy
behavior: if the alignment is not set, it previously defaulted
to Uint_0; we now make that explicit. Use Copy_Alignment,
because "Set_Alignment (Y, Alignment (X));" no longer works when
the Alignment of X has not yet been set.
* gcc-interface/trans.c (process_freeze_entity): Use
Copy_Alignment.
Eric Botcazou [Fri, 18 Jun 2021 14:47:48 +0000 (16:47 +0200)]
[Ada] Add DWARF 5 support to System.Dwarf_Line
gcc/ada/
* libgnat/s-dwalin.ads: Adjust a few comments left and right.
(Line_Info_Register): Comment out unused components.
(Line_Info_Header): Add DWARF 5 support.
(Dwarf_Context): Likewise. Rename "prologue" into "header".
* libgnat/s-dwalin.adb: Alphabetize "with" clauses.
(DWARF constants): Add DWARF 5 support and reorder.
(For_Each_Row): Adjust.
(Initialize_Pass): Likewise.
(Initialize_State_Machine): Likewise and fix typo.
(Open): Add DWARF 5 support.
(Parse_Prologue): Rename into...
(Parse_Header): ...this and add DWARF 5 support.
(Read_And_Execute_Isn): Rename into...
(Read_And_Execute_Insn): ...this and adjust.
(To_File_Name): Change parameter name and add DWARF 5 support.
(Read_Entry_Format_Array): New procedure.
(Skip_Form): Add DWARF 5 support and reorder.
(Seek_Abbrev): Do not count entries and add DWARF 5 support.
(Debug_Info_Lookup): Add DWARF 5 support.
(Symbolic_Address.Set_Result): Likewise.
(Symbolic_Address): Adjust.
Bob Duff [Wed, 16 Jun 2021 10:47:57 +0000 (06:47 -0400)]
[Ada] Duplicate Size/Value_Size clause
gcc/ada/
* sem_ch13.adb (Duplicate_Clause): Add a helper routine
Check_One_Attr, with a parameter for the attribute_designator we
are looking for, and one for the attribute_designator of the
current node (which are usually the same). For Size and
Value_Size, call it twice, once for each.
* errout.ads: Fix a typo.
Piotr Trojanek [Thu, 17 Jun 2021 16:49:11 +0000 (18:49 +0200)]
[Ada] Avoid unnecessary work when expanding 'Image into 'Put_Image
gcc/ada/
* exp_imgv.adb (Expand_Image_Attribute): Move rewriting to
attribute Put_Image to the beginning of expansion of attribute
Image.
Richard Biener [Wed, 7 Jul 2021 09:45:43 +0000 (11:45 +0200)]
Display the number of components BB vectorized
This amends the optimization message printed when a basic-block
part is vectorized to mention the number of SLP graph entries.
This helps when debugging vectorization differences and we end up
merging SLP instances for costing purposes.
2021-07-07 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_slp_region): Show the number of
SLP graph entries in the optimization message.
* g++.dg/vect/slp-pr87105.cc: Adjust.
* gcc.dg/vect/bb-slp-pr54400.c: Likewise.
Richard Biener [Mon, 12 Jul 2021 08:49:03 +0000 (10:49 +0200)]
tree-optimization/101394 - fix PRE full redundancy wrt abnormals
This avoids adding a copy from an abnormal picked up from PHI
translation much like we'd avoid inserting the translated
expression on pred edges.
2021-07-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/101394
* tree-ssa-pre.c (do_pre_regular_insertion): Avoid inserting
copies from abnormals for a full redundancy.
* gcc.dg/torture/pr101394.c: New testcase.
Richard Biener [Mon, 12 Jul 2021 08:26:25 +0000 (10:26 +0200)]
middle-end/101423 - internal calls do not trap
This adjusts gimple_could_trap_p to not consider internal function
calls to trap compared to indirect calls or calls to weak functions.
2021-07-12 Richard Biener <rguenther@suse.de>
PR middle-end/101423
* gimple.c (gimple_could_trap_p_1): Internal function calls
do not trap.
* tree-eh.c (tree_could_trap_p): Likewise.
Roger Sayle [Mon, 12 Jul 2021 09:59:08 +0000 (10:59 +0100)]
Tweak testcase for PR tree-optimization/101403.
Initialize unused variable u in compound expression. Committed as obvious.
2021-07-12 Roger Sayle <roger@nextmovesoftware.com>
Jakub Jelinek <jakub@redhat.com>
gcc/testsuite/ChangeLog
PR tree-optimization/101403
* gcc.dg/pr101403.c: Avoid (unimportant) uninitialized variable.
prathamesh.kulkarni [Mon, 12 Jul 2021 09:48:21 +0000 (15:18 +0530)]
arm/66791: Replace builtins for unsigned and fp vmul_n intrinsics.
gcc/ChangeLog:
PR target/66791
* config/arm/arm_neon.h (vmul_n_u32): Replace call to builtin with
__a * __b.
(vmulq_n_u32): Likewise.
(vmul_n_f32): Gate __a * __b on __FAST_MATH__.
(vmulq_n_f32): Likewise.
(vmul_n_f16): Likewise.
(vmulq_n_f16): Likewise.
gcc/testsuite/ChangeLog:
PR target/66791
* gcc.target/arm/armv8_2-fp16-neon-2.c: Adjust.
Martin Liska [Mon, 12 Jul 2021 08:59:06 +0000 (10:59 +0200)]
offloading: fix -foffload hinting
PR sanitizer/101425
gcc/ChangeLog:
* gcc.c (check_offload_target_name): Call
candidates_list_and_hint only if we have a candidate.
prathamesh.kulkarni [Mon, 12 Jul 2021 07:53:06 +0000 (13:23 +0530)]
arm/98435: Missed optimization in expanding vector constructor.
The patch moves vec_init pattern from neon.md to vec-common.md,
and adjusts the mode to VDQX to accomodate binary floats. Also,
the pattern is additionally gated on VALID_MVE_MODE.
gcc/ChangeLog:
PR target/98435
* config/arm/neon.md (vec_init): Move to ...
* config/arm/vec-common.md (vec_init): ... here.
Change the pattern's mode to VDQX and gate it on VALID_MVE_MODE.
gcc/testsuite/ChangeLog:
PR target/98435
* gcc.target/arm/simd/pr98435.c: New test.
Roger Sayle [Mon, 12 Jul 2021 07:24:27 +0000 (08:24 +0100)]
PR tree-optimization/101403: Incorrect folding of ((T)bswap(x))>>C
My sincere apologies for the breakage. My recent patch to fold
bswapN(x)>>C where the constant C was large enough that the result
only contains bits from the low byte, and can therefore avoid
the byte swap contains a minor logic error. The pattern contains
a convert? allowing an extension to occur between the bswap and
the shift. The logic is correct if there's no extension, or the
extension has the same sign as the shift, but I'd mistakenly
convinced myself that these couldn't have different signedness.
(T)bswap16(x)>>12 is (T)((unsigned char)x>>4) or (T)((signed char)x>>4).
The bug is that for zero-extensions to signed type T, we need to use
the unsigned char variant [the signedness of the byte shift is not
(always) the same as the signedness of T and the original shift].
Then because I'm now paranoid, I've also added a clause to handle
the hypothetical (but in practice impossible) sign-extension to an
unsigned type T, which can implemented as (T)(x<<8)>>12.
2021-07-12 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR tree-optimization/101403
* match.pd ((T)bswap(X)>>C): Correctly handle cases where
signedness of the shift is not the same as the signedness of
the type extension.
gcc/testsuite/ChangeLog
PR tree-optimization/101403
* gcc.dg/pr101403.c: New test case.
GCC Administrator [Mon, 12 Jul 2021 00:16:29 +0000 (00:16 +0000)]
Daily bump.
GCC Administrator [Sun, 11 Jul 2021 00:16:35 +0000 (00:16 +0000)]
Daily bump.
John David Anglin [Sat, 10 Jul 2021 16:20:32 +0000 (16:20 +0000)]
Require target lra for tests using asm goto
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr100329.c: Require target lra.
* gcc.dg/torture/pr100519.c: Likewise.
Ian Lance Taylor [Fri, 9 Jul 2021 02:25:55 +0000 (19:25 -0700)]
runtime: remove direct assignments to memory locations
PR bootstrap/101374
They cause a warning with the updated GCC -Warray-bounds option.
Replace them with calls to abort, which for our purposes is fine.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/333409
Patrick Palka [Sat, 10 Jul 2021 02:40:07 +0000 (22:40 -0400)]
c++: 'new T[N]' and SFINAE [PR82110]
Here we're failing to treat 'new T[N]' as erroneous in a SFINAE context
when T isn't default constructible because expand_aggr_init_1 doesn't
communicate to build_aggr_init (its only SFINAE caller) whether the
initialization was actually successful. To fix this, this patch makes
expand_aggr_init_1 and its subroutine expand_default_init return true on
success, false on failure so that build_aggr_init can properly return
error_mark_node on failure.
PR c++/82110
gcc/cp/ChangeLog:
* init.c (build_aggr_init): Return error_mark_node if
expand_aggr_init_1 returns false.
(expand_default_init): Change return type to bool. Return false
on error, true on success.
(expand_aggr_init_1): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/pr78765.C: Expect another conversion failure
diagnostic.
* g++.dg/template/sfinae14.C: Flip incorrect assertion.
* g++.dg/cpp2a/concepts-requires27.C: New test.
GCC Administrator [Sat, 10 Jul 2021 00:16:53 +0000 (00:16 +0000)]
Daily bump.
H.J. Lu [Mon, 5 Jul 2021 21:15:04 +0000 (14:15 -0700)]
libffi/x86: Always check __x86_64__ for x86 hosts
The upstream libffi has
commit
cb8474368cdef3207638d047bd6c707ad8fcb339
Author: hjl-tools <hjl.tools@gmail.com>
Date: Wed Dec 2 12:52:12 2020 -0800
libffi/x86: Always check __x86_64__ for x32 hosts (#601) (#602)
Since for x86_64-*x32 and x86_64-x32-* hosts, -m32 generates ia32 codes.
We should always check __x86_64__ for x32 hosts.
Since for gnux32 hosts, -m32 generates i386 codes, always check __x86_64__
for x86 hosts.
PR libffi/101336
* configure.host: Always check __x86_64__ for x86 hosts.
Jason Merrill [Fri, 9 Jul 2021 17:50:01 +0000 (13:50 -0400)]
c++: concepts TS and explicit specialization [PR101098]
duplicate_decls was not recognizing the explicit specialization as matching
the implicit specialization of g<Y> because
function_requirements_equivalent_p was seeing the C constraint on the
implicit one and not on the explicit.
PR c++/101098
gcc/cp/ChangeLog:
* decl.c (function_requirements_equivalent_p): Only compare
trailing requirements on a specialization.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/explicit-spec1.C: New test.
Iain Sandoe [Wed, 7 Jul 2021 18:56:20 +0000 (19:56 +0100)]
coroutines: Factor code. Match original source location in helpers [NFC].
This is primarily a source code refactoring, the only change is to
ensure that the outlined functions are marked to begin at the same
line as the original. Otherwise, they get the default (which seems
to be input_location, which corresponds to the closing brace at the
point that this is done). Having the source location point to that
confuses some debuggers.
This is a contributory fix to:
PR c++/99215 - coroutines: debugging with gdb
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/ChangeLog:
* coroutines.cc (build_actor_fn): Move common code to
act_des_fn.
(build_destroy_fn): Likewise.
(act_des_fn): Build the void return here. Ensure that the
source location matches the original function.
Roger Sayle [Fri, 9 Jul 2021 16:45:40 +0000 (17:45 +0100)]
Improvement to signed division of integer constant on x86_64.
This patch tweaks the way GCC handles 32-bit integer division on
x86_64, when the numerator is constant. Currently the function
int foo (int x) {
return 100/x;
}
generates the code:
foo: movl $100, %eax
cltd
idivl %edi
ret
where the sign-extension instruction "cltd" creates a long
dependency chain, as it depends on the "mov" before it, and
is depended upon by "idivl" after it.
With this patch, GCC now matches both icc and LLVM and uses
an xor instead, generating:
foo: xorl %edx, %edx
movl $100, %eax
idivl %edi
ret
Microbenchmarking confirms that this is faster on Intel
processors (Kaby lake), and no worse on AMD processors (Zen2),
which agrees with intuition, but oddly disagrees with the
llvm-mca cycle count prediction on godbolt.org.
The tricky bit is that this sign-extension instruction is only
produced by late (postreload) splitting, and unfortunately none
of the subsequent passes (e.g. cprop_hardreg) is able to
propagate and simplify its constant argument. The solution
here is to introduce a define_insn_and_split that allows the
constant numerator operand to be captured (by combine) and
then split into an optimal form after reload.
The above microbenchmarking also shows that eliminating the
sign extension of negative values (using movl $-1,%edx) is also
a performance improvement, as performed by icc but not by LLVM.
Both the xor and movl sign-extensions are larger than cltd,
so this transformation is prevented for -Os.
2021-07-09 Roger Sayle <roger@nextmovesoftware.com>
Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog
* config/i386/i386.md (*divmodsi4_const): Optimize SImode
divmod of a constant numerator with new define_insn_and_split.
gcc/testsuite/ChangeLog
* gcc.target/i386/divmod-9.c: New test case.
Iain Sandoe [Wed, 23 Jun 2021 07:13:22 +0000 (08:13 +0100)]
coroutines: Fix a typo in rewriting the function.
When amending the function re-write code, I made a typo in
the block connections. This has not shown up in any test
fails (as far as can be seen) but is a regression in debug
info.
Fixed thus.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/ChangeLog:
* coroutines.cc
(coro_rewrite_function_body): Connect the replacement
function block to the block nest correctly.
Iain Sandoe [Mon, 3 May 2021 07:22:53 +0000 (08:22 +0100)]
Darwin, X86: Adjust call clobbers to allow for lazy-binding [PR 100152].
We allow public functions defined in a TU to bind locally for PIC
code (the default) on 64bit Mach-O.
If such functions are not inlined, we cannot tell at compile-time if
they might be called via the lazy symbol resolver (this can depend on
options given at link-time). Therefore, we must assume that the lazy
resolver could be used which clobbers R11 and R10.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
PR target/100152
* config/i386/i386-expand.c (ix86_expand_call): If a call is
to a non-local-binding, or local but to a public symbol, then
assume that it might be indirected via the lazy symbol binder.
Mark R10 and R10 as clobbered in that case.
Iain Sandoe [Sat, 3 Jul 2021 14:42:16 +0000 (15:42 +0100)]
Darwin, config: Revise host config fragment.
There were two uses for the Darwin host config fragment:
The first is to arrange for targets that support mdynamic-no-pic
to be built with that enabled (since it makes a significant
difference to the compiler performance). We can be more specific
in the application of this, since it only applies to 32b hosts
plus powerpc64-darwin9.
The second was to work around a tool bug where -fno-PIE was not
propagated to the link stage. This second use is redundant,
since the buggy toolchain cannot bootstrap current GCC sources
anyway.
This makes the host fragment more specific and reduces the number
of toolchains for which it is included which reduces clutter in
configure lines.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
config/ChangeLog:
* mh-darwin: Make this specific to handling the
mdynamic-no-pic case.
ChangeLog:
* configure: Regenerate.
* configure.ac: Adjust cases for which it is necessary to
include the Darwin host config fragment.
Eric Botcazou [Fri, 9 Jul 2021 16:30:54 +0000 (18:30 +0200)]
Missing piece in earlier change
gcc/ada/
* gcc-interface/utils.c (finish_subprog_decl): Remove obsolete line.
Indu Bhagat [Fri, 9 Jul 2021 16:03:08 +0000 (09:03 -0700)]
testsuite/101269: fix testcase when used with -m32
PR testsuite/101269 - new test case gcc.dg/debug/btf/btf-datasec-1.c
fails with its introduction in r12-1852
BTF datasec records for .rodata/.data are expected for now for all targets.
For powerpc based targets, use -msdata=none when ilp32 is enabled.
2021-07-09 Indu Bhagat <indu.bhagat@oracle.com>
gcc/testsuite/ChangeLog:
PR testsuite/101269
* gcc.dg/debug/btf/btf-datasec-1.c: Force -msdata=none with ilp32 for
powerpc based targets.
Patrick Palka [Fri, 9 Jul 2021 14:20:25 +0000 (10:20 -0400)]
c++: requires-expr with dependent extra args [PR101181]
Here we're crashing ultimately because the mechanism for delaying
substitution into a requires-expression (and constexpr if and pack
expansions) doesn't expect to see dependent args. But we end up
capturing dependent args here during substitution into the default
template argument as part of coerce_template_parms for the dependent
specialization p<T>.
This patch enables the commented out code in add_extra_args for handling
this situation. This isn't needed for pack expansions (as the
accompanying comment points out), and it doesn't seem strictly necessary
for constexpr if either, but for requires-expressions delaying even
dependent substitution is important for ensuring we don't evaluate
requirements out of order.
It turns out we also need to make a copy of the arguments when capturing
them so that coerce_template_parms doesn't later add to them and form an
unexpected cycle (REQUIRES_EXPR_EXTRA_ARGS (t) would indirectly point to t).
We also need to make tsubst_template_args handle missing template
arguments, since the arguments we capture from coerce_template_parms
and are incomplete at that point.
PR c++/101181
gcc/cp/ChangeLog:
* constraint.cc (tsubst_requires_expr): Pass complain/in_decl to
add_extra_args.
* cp-tree.h (add_extra_args): Add complain/in_decl parameters.
* pt.c (build_extra_args): Make a copy of args.
(add_extra_args): Add complain/in_decl parameters. Enable the
code for handling the case where the extra arguments are
dependent.
(tsubst_pack_expansion): Pass complain/in_decl to
add_extra_args.
(tsubst_template_args): Handle missing template arguments.
(tsubst_expr) <case IF_STMT>: Pass complain/in_decl to
add_extra_args.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires26.C: New test.
* g++.dg/cpp2a/lambda-uneval16.C: New test.
Patrick Palka [Fri, 9 Jul 2021 14:20:22 +0000 (10:20 -0400)]
c++: find_template_parameters and TEMPLATE_DECLs [PR101247]
r12-1989 fixed the testcase in the PR, but unfortunately the fix is
buggy: it breaks the case where the common template between the
TEMPLATE_DECL t and ctx_parms is the innermost template (as in
concepts-memtmpl5.C below). This can be fixed by instead passing the
TREE_TYPE of ctmpl to common_enclosing_class when ctmpl is a class
template.
But even after that's fixed, the analogous case where the innermost
template is a partial specialization is still broken (as in
concepts-memtmpl5a.C below), because ctmpl is always a primary template.
So this patch instead takes a diferent approach that doesn't rely on
ctx_parms at all: when looking for the template parameters of a
TEMPLATE_DECL that are shared with the current template context, just
walk its DECL_CONTEXT. As long as the template is not overly general
(e.g. we didn't pass it through most_general_template), this should give
us exactly what we want, since if a TEMPLATE_DECL can be referred to
from some template context then the template parameters it uses must all
be in-scope and contained in its DECL_CONTEXT. This effectively makes
us treat TEMPLATE_DECLs more similarly to other _DECLs (whose DECL_CONTEXT
we also walk).
PR c++/101247
gcc/cp/ChangeLog:
* pt.c (any_template_parm_r) <case TEMPLATE_DECL>: Just walk the
DECL_CONTEXT.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-memtmpl4.C: Uncomment the commented out
example, which we now handle correctly.
* g++.dg/cpp2a/concepts-memtmpl5.C: New test.
* g++.dg/cpp2a/concepts-memtmpl5a.C: New test.
Matheus Castanho [Fri, 9 Jul 2021 14:13:38 +0000 (15:13 +0100)]
libstdc++: Only use __gthread_yield if gthreads is available
libstdc++-v3/ChangeLog:
* include/std/mutex (__lock_impl): Check
_GLIBCXX_HAS_GTHREADS before using __gthread_yield.
Piotr Trojanek [Thu, 17 Jun 2021 16:46:21 +0000 (18:46 +0200)]
[Ada] Fix style in expansion of attribute Put_Image
gcc/ada/
* exp_put_image.adb (Make_Put_Image_Name): Fix style.
(Image_Should_Call_Put_Image): Likewise.
(Build_Image_Call): Likewise.
Ghjuvan Lacambre [Thu, 17 Jun 2021 08:01:33 +0000 (10:01 +0200)]
[Ada] par-ch6: do not mark subprogram as missing "is" if imported
gcc/ada/
* par-ch6.adb (Contains_Import_Aspect): New function.
(P_Subprogram): Acknowledge `Import` aspects.
Bob Duff [Tue, 15 Jun 2021 19:36:34 +0000 (15:36 -0400)]
[Ada] Fix crash on type extensions with discriminants
gcc/ada/
* exp_put_image.adb (Make_Component_Attributes): Use
Implementation_Base_Type to get the parent type. Otherwise,
Parent_Type_Decl is actually an internally generated subtype
declaration, so we blow up on
Type_Definition (Parent_Type_Decl).
Dmitriy Anisimkov [Sun, 13 Jun 2021 02:42:54 +0000 (08:42 +0600)]
[Ada] Add missed OS constant values
gcc/ada/
* gsocket.h: Include net/if.h to get IF_NAMESIZE constant.
* s-oscons-tmplt.c: Define IPV6_FLOWINFO for Linux.
Steve Baird [Wed, 9 Jun 2021 14:29:11 +0000 (07:29 -0700)]
[Ada] Improve performance of Ada.Containers.Doubly_Linked_Lists.Generic_Sorting.Sort
gcc/ada/
* libgnat/a-cdlili.adb: Reimplement
Ada.Containers.Doubly_Linked_Lists.Generic_Sorting.Sort using
Mergesort instead of the previous Quicksort variant.
Justin Squirek [Tue, 15 Jun 2021 16:54:12 +0000 (12:54 -0400)]
[Ada] Crash on expansion of BIP construct in -gnatf mode
gcc/ada/
* exp_ch6.adb (Is_Build_In_Place_Function_Call): Add check to
verify the Selector_Name of Exp_Node has been analyzed before
obtaining its entity.
Gary Dismukes [Mon, 14 Jun 2021 19:37:49 +0000 (15:37 -0400)]
[Ada] Typo corrections and minor reformatting
gcc/ada/
* libgnarl/s-osinte__vxworks.ads: Fix typo ("release" =>
"releases") plus comment reformatting.
* libgnat/s-os_lib.ads: In a comment, fix typo ("indended" =>
"intended"), add a hyphen and semicolon, plus reformatting. In
comment for subtype time_t, fix typo ("effect" => "affect"), add
hyphens, plus reformatting.
* libgnat/s-parame.ads, libgnat/s-parame__ae653.ads,
libgnat/s-parame__hpux.ads: Remove period from one-line comment.
Steve Baird [Thu, 10 Jun 2021 18:20:27 +0000 (11:20 -0700)]
[Ada] Add -gnatX support for casing on discriminated values
gcc/ada/
* exp_ch5.adb (Expand_General_Case_Statement): Add new function
Else_Statements to handle the case of invalid data analogously
to how it is handled when casing on a discrete value.
* sem_case.adb (Has_Static_Discriminant_Constraint): A new
Boolean-valued function.
(Composite_Case_Ops.Scalar_Part_Count): Include discriminants
when traversing components.
(Composite_Case_Ops.Choice_Analysis.Traverse_Discrete_Parts):
Include discriminants when traversing components; the component
range for a constrained discriminant is a single value.
(Composite_Case_Ops.Choice_Analysis.Parse_Choice): Eliminate
Done variable and modify how Next_Part is computed so that it is
always correct (as opposed to being incorrect when Done is
True). This includes changes in Update_Result (a local
procedure). Add new local procedure
Update_Result_For_Box_Component and call it not just for box
components but also for "missing" components (components
associated with an inactive variant).
(Check_Choices.Check_Composite_Case_Selector.Check_Component_Subtype):
Instead of disallowing all discriminated component types, allow
those that are unconstrained or statically constrained. Check
discriminant subtypes along with other component subtypes.
* doc/gnat_rm/implementation_defined_pragmas.rst: Update
documentation to reflect current implementation status.
* gnat_rm.texi: Regenerate.
Justin Squirek [Sun, 13 Jun 2021 16:52:18 +0000 (12:52 -0400)]
[Ada] Crash on inlined separate subprogram
gcc/ada/
* sem_ch6.adb (Check_Pragma_Inline): Correctly use
Corresponding_Spec_Of_Stub when dealing subprogram body stubs.
Doug Rupp [Sat, 5 Jun 2021 19:58:35 +0000 (12:58 -0700)]
[Ada] Declare time_t uniformly based on a system parameter
gcc/ada/
* Makefile.rtl: Add translations for s-parame__posix2008.ads
* libgnarl/s-linux.ads: Import System.Parameters.
(time_t): Declare using System.Parameters.time_t_bits.
* libgnarl/s-linux__alpha.ads: Likewise.
* libgnarl/s-linux__android.ads: Likewise.
* libgnarl/s-linux__hppa.ads: Likewise.
* libgnarl/s-linux__mips.ads: Likewise.
* libgnarl/s-linux__riscv.ads: Likewise.
* libgnarl/s-linux__sparc.ads: Likewise.
* libgnarl/s-linux__x32.ads: Likewise.
* libgnarl/s-qnx.ads: Likewise.
* libgnarl/s-osinte__aix.ads: Likewise.
* libgnarl/s-osinte__android.ads: Likewise.
* libgnarl/s-osinte__darwin.ads: Likewise.
* libgnarl/s-osinte__dragonfly.ads: Likewise.
* libgnarl/s-osinte__freebsd.ads: Likewise.
* libgnarl/s-osinte__gnu.ads: Likewise.
* libgnarl/s-osinte__hpux-dce.ads: Likewise.
* libgnarl/s-osinte__hpux.ads: Likewise.
* libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise.
* libgnarl/s-osinte__lynxos178e.ads: Likewise.
* libgnarl/s-osinte__qnx.ads: Likewise.
* libgnarl/s-osinte__rtems.ads: Likewise.
* libgnarl/s-osinte__solaris.ads: Likewise.
* libgnarl/s-osinte__vxworks.ads: Likewise.
* libgnat/g-sothco.ads: Likewise.
* libgnat/s-osprim__darwin.adb: Likewise.
* libgnat/s-osprim__posix.adb: Likewise.
* libgnat/s-osprim__posix2008.adb: Likewise.
* libgnat/s-osprim__rtems.adb: Likewise.
* libgnat/s-osprim__x32.adb: Likewise.
* libgnarl/s-osinte__linux.ads: use type System.Linux.time_t.
* libgnat/s-os_lib.ads (time_t): Declare as subtype of
Long_Long_Integer.
* libgnat/s-parame.ads (time_t_bits): New constant.
* libgnat/s-parame__ae653.ads (time_t_bits): Likewise.
* libgnat/s-parame__hpux.ads (time_t_bits): Likewise.
* libgnat/s-parame__vxworks.ads (time_t_bits): Likewise.
* libgnat/s-parame__posix2008.ads: New file for 64 bit time_t.
Bob Duff [Mon, 14 Jun 2021 13:37:24 +0000 (09:37 -0400)]
[Ada] Add source file name to gnat bug box
gcc/ada/
* comperr.adb (Compiler_Abort): Print source file name.
Joffrey Huguet [Thu, 10 Jun 2021 09:39:01 +0000 (11:39 +0200)]
[Ada] Fix layout of contracts
gcc/ada/
* libgnat/a-strunb.ads, libgnat/a-strunb__shared.ads: Fix layout
in contracts.
Eric Botcazou [Fri, 11 Jun 2021 07:11:13 +0000 (09:11 +0200)]
[Ada] Fix invalid JSON for derived variant record with -gnatRj
gcc/ada/
* repinfo.ads (JSON output format): Document adjusted key name.
* repinfo.adb (List_Record_Layout): Use Original_Record_Component
if the normalized position of the component is not known.
(List_Structural_Record_Layout): Rename Outer_Ent parameter into
Ext_End and add Ext_Level parameter. In an extension, if the parent
subtype has static discriminants, call List_Record_Layout on it.
Output "parent_" prefixes before "variant" according to Ext_Level.
Adjust recursive calls throughout the procedure.
Piotr Trojanek [Fri, 11 Jun 2021 14:01:36 +0000 (16:01 +0200)]
[Ada] Fix typo in comment related to derived discriminated types
gcc/ada/
* exp_util.ads (Map_Types): Fix typo.
Fedor Rybin [Fri, 4 Jun 2021 18:01:27 +0000 (21:01 +0300)]
[Ada] Fix index range violations in krunch
gcc/ada/
* krunch.adb: Add safeguards against index range violations.
Arnaud Charlet [Wed, 9 Jun 2021 15:58:47 +0000 (11:58 -0400)]
[Ada] Code cleanups in a-strfix.adb
gcc/ada/
* libgnat/a-strfix.adb: Take advantage of extended returns.
Eric Botcazou [Thu, 10 Jun 2021 08:21:46 +0000 (10:21 +0200)]
[Ada] Add paragraph about representation changes and Scalar_Storage_Order
gcc/ada/
* doc/gnat_rm/implementation_defined_attributes.rst
(Scalar_Storage_Order): Add paragraph about representation
changes.
* gnat_rm.texi: Regenerate.
Frederic Konrad [Tue, 13 Apr 2021 08:55:52 +0000 (10:55 +0200)]
[Ada] aarch64-rtems6: use wraplf variant for a-nallfl
gcc/ada/
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <aarch64*-*-rtems*>: Use
the wraplf variant of Aux_Long_Long_Float.
Piotr Trojanek [Tue, 8 Jun 2021 23:04:35 +0000 (01:04 +0200)]
[Ada] Initialize local variables related to static expression functions
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Initialize Orig_N
and Typ variables.
Arnaud Charlet [Mon, 10 May 2021 15:29:08 +0000 (11:29 -0400)]
[Ada] Inconsistency between declaration and body of predicate functions
gcc/ada/
* sem_ch13.adb (Resolve_Aspect_Expressions): Use the same
processing for Predicate, Static_Predicate and
Dynamic_Predicate. Do not build the predicate function spec.
Update comments.
(Resolve_Name): Only reset Entity when necessary to avoid
spurious visibility errors.
(Check_Aspect_At_End_Of_Declarations): Handle consistently all
Predicate aspects.
* sem_ch3.adb (Analyze_Subtype_Declaration): Fix handling of
private types with predicates.
Justin Squirek [Thu, 3 Jun 2021 21:15:51 +0000 (17:15 -0400)]
[Ada] Incremental patch for restriction No_Dynamic_Accessibility_Checks
gcc/ada/
* sem_util.ads (Type_Access_Level): Add new optional parameter
Assoc_Ent.
* sem_util.adb (Accessibility_Level): Treat access discriminants
the same as components when the restriction
No_Dynamic_Accessibility_Checks is enabled.
(Deepest_Type_Access_Level): Remove exception for
Debug_Flag_Underscore_B when returning the result of
Type_Access_Level in the case where
No_Dynamic_Accessibility_Checks is active.
(Function_Call_Or_Allocator_Level): Correctly calculate the
level of Expr based on its containing subprogram instead of
using Current_Subprogram.
* sem_res.adb (Valid_Conversion): Add actual for new parameter
Assoc_Ent in call to Type_Access_Level, and add test of
No_Dynamic_Accessibility_Checks_Enabled to ensure that static
accessibility checks are performed for all anonymous access type
conversions.
Eric Botcazou [Tue, 8 Jun 2021 11:24:46 +0000 (13:24 +0200)]
[Ada] Update internal documentation of debugging information
gcc/ada/
* exp_dbug.ads: Update documentation of various items.
Piotr Trojanek [Fri, 28 May 2021 13:32:16 +0000 (15:32 +0200)]
[Ada] Reorder preanalysis of static expression functions
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Reorder code.
Piotr Trojanek [Fri, 28 May 2021 13:11:03 +0000 (15:11 +0200)]
[Ada] Decouple analysis of static expression functions from GNATprove
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Reorder code.
Piotr Trojanek [Fri, 28 May 2021 13:01:18 +0000 (15:01 +0200)]
[Ada] Avoid repeated computing of type of expression functions
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Add variable to
avoid repeated calls to Etype.
Piotr Trojanek [Fri, 28 May 2021 12:56:32 +0000 (14:56 +0200)]
[Ada] Fix comment related to analysis of expression functions
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Fix comment.
Piotr Trojanek [Fri, 28 May 2021 12:53:21 +0000 (14:53 +0200)]
[Ada] Avoid repeated calls in analysis of expression functions
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Use Orig_N variable
instead of repeated calls to Original_Node.
Piotr Trojanek [Fri, 28 May 2021 12:51:43 +0000 (14:51 +0200)]
[Ada] Refine types of local variables in analysis of expression functions
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Change types local
variables from Entity_Id to Node_Id.
Piotr Trojanek [Fri, 28 May 2021 10:53:05 +0000 (12:53 +0200)]
[Ada] Remove an unnecessary local constant
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): A local Expr
constant was shadowing a global constant with the same name and
the same value.
Piotr Trojanek [Fri, 28 May 2021 12:54:01 +0000 (14:54 +0200)]
[Ada] Avoid unnecessary call in preanalysis without freezing
gcc/ada/
* sem_res.adb (Preanalyze_And_Resolve): Only call
Set_Must_Not_Freeze when it is necessary to restore the previous
value.
Eric Botcazou [Fri, 9 Jul 2021 10:08:52 +0000 (12:08 +0200)]
Fix build failure on Windows with older binutils
This is the build failure on Windows with binutils for which GNU as accepts
the --gdwarf-5 switch but GNU ld generates broken binaries with DWARF 5.
We already have the HAVE_LD_BROKEN_PE_DWARF5 kludge to disable DWARF 5 in
this case but it only tames the DWARF version in the compiler, so the
driver still passes --gdwarf-5 when invoked on an assembly file with -g.
gcc/
PR target/101377
* gcc.c (ASM_DEBUG_DWARF_OPTION): Set again to --gdwarf2 in
the case where HAVE_AS_WORKING_DWARF_N_FLAG is not defined
and HAVE_LD_BROKEN_PE_DWARF5 is defined.
Uros Bizjak [Fri, 9 Jul 2021 09:45:54 +0000 (11:45 +0200)]
i386: Fix *udivmodsi4_pow2_zext_? patterns
In addition to the obvious cut-n-pasto where *udivmodsi4_pow2_zext_2
never matches, limit the range of the immediate operand to prevent
out of range immediate operand of AND instruction.
Found by inspection, the patterns rarely match (if at all), since
tree optimizers do the transformation before RTL is generated. But
according to the comment above *udivmod<mode>4_pow2, the constant can
materialize after expansion, so leave these patterns around for now.
2021-07-09 Uroš Bizjak <ubizjak@gmail.com>
gcc/
* config/i386/i386.md (*udivmodsi4_pow2_zext_1): Limit the
log2 range of operands[3] to [1,31].
(*udivmodsi4_pow2_zext_2): Ditto. Correct insn RTX pattern.
Sergei Trofimovich [Fri, 9 Jul 2021 07:26:15 +0000 (08:26 +0100)]
docs: don't split @smallexample in multiple @groups
Noticed multiple groups split in HTML documentation where example
was written in two columns:
""
"
(define_expand "addsi3" {
[(match_operand:SI 0 "register_operand" "") handle_add (...
(match_operand:SI 1 "register_operand" "") DONE;
(match_operand:SI 2 "register_operand" "")] }")
The change uses single @group/@endgroup to prevent such break.
gcc/ChangeLog:
* doc/md.texi: Don't split @smallexample in multiple @groups.
Sergei Trofimovich [Fri, 9 Jul 2021 07:19:37 +0000 (08:19 +0100)]
docs: add missing 'see' word
gcc/ChangeLog:
* doc/md.texi: Add missing 'see' word.
Andrew Pinski [Tue, 6 Jul 2021 03:13:48 +0000 (20:13 -0700)]
Improve early simplify and match for phiopt
Previously the idea was gimple_simplify_phiopt would call
resimplify with a NULL sequence but that sometimes fails
even if there was only one statement produced. The cases
where it fails is when there are two simplifications happen.
In the case of the min/max production, the first simplifcation
produces:
(convert (min @1 @2))
And then the convert is removed by a second one. The Min statement
will be in the sequence while the op will be a SSA name. This was
rejected before as could not produce something in the sequence.
So this patch changes the way resimplify is called to always passing
a pointer to the sequence and then decide based on if op is a
SSA_NAME or not.
OK? Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* tree-ssa-phiopt.c (phiopt_early_allow): Change arguments
to take sequence and gimple_match_op. Accept the case where
op is a SSA_NAME and one statement in the sequence.
Also allow constants.
(gimple_simplify_phiopt): Always pass a sequence to resimplify.
Update call to phiopt_early_allow. Discard the sequence if not
used.
Xi Ruoyao [Tue, 22 Jun 2021 06:15:45 +0000 (14:15 +0800)]
testsuite: mips: use noinline attribute instead of -fno-inline
mips.exp does not support -fno-inline, causing the tests return "ERROR:
Unrecognised option: -fno-inline for dg-options ... ".
Use noinline attribute like other mips target tests, to workaround it.
gcc/testsuite/
* gcc.target/mips/cfgcleanup-jalr2.c: Remove -fno-inline and add
__attribute__((noinline)).
* gcc.target/mips/cfgcleanup-jalr3.c: Likewise.
Xi Ruoyao [Fri, 18 Jun 2021 12:11:42 +0000 (20:11 +0800)]
mips: check MSA support for vector modes [PR100760,PR100761,PR100762]
Check if the vector mode is really supported by MSA in certain cases,
instead of testing ISA_HAS_MSA. Simply testing ISA_HAS_MSA can cause
ICE when MSA is enabled besides other MIPS SIMD extensions (notably,
Loongson MMI).
gcc/
PR target/100760
PR target/100761
PR target/100762
* config/mips/mips.c (mips_const_insns): Use MSA_SUPPORTED_MODE_P
instead of ISA_HAS_MSA.
(mips_expand_vec_unpack): Likewise.
(mips_expand_vector_init): Likewise.
gcc/testsuite/
PR target/100760
PR target/100761
PR target/100762
* gcc.target/mips/pr100760.c: New test.
* gcc.target/mips/pr100761.c: New test.
* gcc.target/mips/pr100762.c: New test.
Kewen Lin [Fri, 9 Jul 2021 03:00:24 +0000 (22:00 -0500)]
rs6000: Support [u]mod<mode>3 for vector modulo insns
This patch is to make Power10 newly introduced vector
modulo instructions exploited in vectorized loops, it
just simply renames existing define_insns as standard
pattern names.
gcc/ChangeLog:
* config/rs6000/vsx.md (mods_<mode>): Rename to...
(mod<mode>3): ... this.
(modu_<mode>): Rename to...
(umod<mode>3): ... this.
* config/rs6000/rs6000-builtin.def (MODS_V2DI, MODS_V4SI, MODU_V2DI,
MODU_V4SI): Adjust.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/mod-vectorize.c: New test.
Kewen Lin [Fri, 9 Jul 2021 03:00:18 +0000 (22:00 -0500)]
test/rs6000: Add case to cover vector division
This patch is to add one test case to check if vectorizer
can exploit vector division instrutions newly introduced
by Power10.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/div-vectorize-1.c: New test.
Kewen Lin [Fri, 9 Jul 2021 02:59:50 +0000 (21:59 -0500)]
test/rs6000: Add cases to cover vector multiply
This patch is to add test cases to check if vectorizer
can exploit vector multiply instrutions on Power, some
of them are supported since Power8, the others are newly
introduced by Power10.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/mul-vectorize-1.c: New test.
* gcc.target/powerpc/mul-vectorize-2.c: New test.
GCC Administrator [Fri, 9 Jul 2021 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Martin Sebor [Thu, 8 Jul 2021 22:36:15 +0000 (16:36 -0600)]
Move warning suppression to the ultimate callee.
Resolves:
PR bootstrap/101372 - -Warray-bounds in gcc/cp/module.cc causing bootstrap failure
gcc/cp/ChangeLog:
PR bootstrap/101372
* module.cc (identifier): Suppress warning.
(module_state::read_macro_maps): Remove warning suppression.
(module_state::install_macros): Ditto.
Martin Sebor [Thu, 8 Jul 2021 22:22:25 +0000 (16:22 -0600)]
testsuite: Remove an xfail.
gcc/testsuite/ChangeLog:
* gcc.dg/Wstringop-overflow-43.c: Remove an xfail.
Martin Sebor [Thu, 8 Jul 2021 22:08:20 +0000 (16:08 -0600)]
Adjust expected output for LP32 [PR100451].
gcc/testsuite/ChangeLog:
PR testsuite/100451
* g++.dg/warn/Warray-bounds-20.C: Adjust expected output for LP32.
Martin Sebor [Thu, 8 Jul 2021 22:02:01 +0000 (16:02 -0600)]
Avoid including <new> to make cross-compiler testing easy.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Warray-bounds-11.C: Avoid including <new>.
* g++.dg/warn/Warray-bounds-13.C: Same.
Marek Polacek [Thu, 8 Jul 2021 00:02:18 +0000 (20:02 -0400)]
c++: Fix noexcept with unevaluated operand [PR101087]
It sounds plausible that this assert
int f();
static_assert(noexcept(sizeof(f())));
should pass: sizeof produces a std::size_t and its operand is not
evaluated, so it can't throw. noexcept should only evaluate to
false for potentially evaluated operands. Therefore I think that
check_noexcept_r shouldn't walk into operands of sizeof/decltype/
alignof/typeof.
PR c++/101087
gcc/cp/ChangeLog:
* cp-tree.h (unevaluated_p): New.
* except.c (check_noexcept_r): Use it. Don't walk into
unevaluated operands.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/noexcept70.C: New test.
Jeff Law [Thu, 8 Jul 2021 21:09:36 +0000 (17:09 -0400)]
Further improvements to H8 variable shift patterns
gcc/
* config/h8300/shiftrotate.md (variable shifts): Expose condition
code handling for the test before the loop.
Martin Jambor [Thu, 8 Jul 2021 17:44:41 +0000 (19:44 +0200)]
ipa-sra: Fix thinko when overriding safe_to_import_accesses (PR 101066)
The "new" IPA-SRA has a more difficult job than the previous
not-truly-IPA version when identifying situations in which a parameter
passed by reference can be passed into a third function and only thee
converted to one passed by value (and possibly "split" at the same
time).
In order to allow this, two conditions must be fulfilled. First the
call to the third function must happen before any modifications of
memory, because it could change the value passed by reference.
Second, in order to make sure we do not introduce new (invalid)
dereferences, the call must postdominate the entry BB.
The second condition is actually not necessary if the caller function
is also certain to dereference the pointer but the first one must
still hold. Unfortunately, the code making this overriding decision
also happen to trigger when the first condition is not fulfilled.
This is fixed in the following patch.
gcc/ChangeLog:
2021-06-16 Martin Jambor <mjambor@suse.cz>
PR ipa/101066
* ipa-sra.c (class isra_call_summary): New member
m_before_any_store, initialize it in the constructor.
(isra_call_summary::dump): Dump the new field.
(ipa_sra_call_summaries::duplicate): Copy it.
(process_scan_results): Set it.
(isra_write_edge_summary): Stream it.
(isra_read_edge_summary): Likewise.
(param_splitting_across_edge): Only override
safe_to_import_accesses if m_before_any_store is set.
gcc/testsuite/ChangeLog:
2021-06-16 Martin Jambor <mjambor@suse.cz>
PR ipa/101066
* gcc.dg/ipa/pr101066.c: New test.
Martin Sebor [Thu, 8 Jul 2021 17:34:27 +0000 (11:34 -0600)]
Use Object Size Type zero for -Warray-bounds [PR101374].
Resolves:
PR bootstrap/101374 - -Warray-bounds accessing a member subobject as derived
gcc/cp/ChangeLog:
PR bootstrap/101374
* module.cc (module_state::read_macro_maps): Temporarily disable
-Warray-bounds.
(module_state::install_macros): Same.
gcc/ChangeLog:
PR bootstrap/101374
* gimple-array-bounds.cc (array_bounds_checker::check_mem_ref):
Use Object Size Type 0 instead of 1.
gcc/testsuite/ChangeLog:
PR bootstrap/101374
* c-c++-common/Warray-bounds-3.c: Xfail assertion.
* c-c++-common/Warray-bounds-4.c: Same.
Christophe Lyon [Wed, 30 Jun 2021 13:47:07 +0000 (13:47 +0000)]
testsuite: Add arm_arch_v7a_ok effective-target to pr57351.c
I've noticed that overriding cpu/arch flags when running the testsuite
can cause this test to fail rather than being skipped because of
incompatible flags combination.
Since the test forces -march=armv7-a, make sure it is accepted in
combination with the current runtestflags.
2021-07-08 Christophe Lyon <christophe.lyon@foss.st.om>
gcc/testsuite/
* gcc.dg/debug/pr57351.c: Require arm_arch_v7a_ok
effective-target.
Piotr Trojanek [Mon, 7 Jun 2021 08:18:29 +0000 (10:18 +0200)]
[Ada] Tune detection of illegal occurrences of target_name
gcc/ada/
* sem_ch5.adb (Analyze_Assignment): Clear Current_Assignment at
exit.
(Analyze_Target_Name): Prevent AST climbing from going too far.
Ed Schonberg [Sun, 6 Jun 2021 00:05:31 +0000 (20:05 -0400)]
[Ada] Diagnose properly illegal uses of Target_Name
gcc/ada/
* sem_ch5.adb (Analyze_Target_Name): Properly reject a
Target_Name when it appears outside of an assignment statement,
or within the left-hand side of one.
Bob Duff [Fri, 4 Jun 2021 12:13:23 +0000 (08:13 -0400)]
[Ada] Remove Unknown_ functions
gcc/ada/
* einfo-utils.ads, einfo-utils.adb (Unknown_Alignment,
Unknown_Component_Bit_Offset, Unknown_Component_Size,
Unknown_Esize, Unknown_Normalized_First_Bit,
Unknown_Normalized_Position, Unknown_Normalized_Position_Max,
Unknown_RM_Size): Remove these functions.
* exp_pakd.adb, exp_util.adb, fe.h, freeze.adb, layout.adb,
repinfo.adb, sem_ch13.adb, sem_ch3.adb, sem_util.adb: Remove
calls to these functions; do "not Known_..." instead.
* gcc-interface/decl.c, gcc-interface/trans.c
(Unknown_Alignment, Unknown_Component_Size, Unknown_Esize,
Unknown_RM_Size): Remove calls to these functions; do
"!Known_..." instead.
Eric Botcazou [Fri, 4 Jun 2021 16:08:49 +0000 (18:08 +0200)]
[Ada] Use encoded names only with -fgnat-encodings=all
gcc/ada/
* exp_dbug.adb (Get_Encoded_Name): Do not encode names of discrete
types with custom bounds, except with -fgnat-encodings=all.
* exp_pakd.adb (Create_Packed_Array_Impl_Type): Adjust comment.
Bob Duff [Thu, 3 Jun 2021 16:10:30 +0000 (12:10 -0400)]
[Ada] Transient scope cleanup
gcc/ada/
* comperr.adb (Compiler_Abort): Call Sinput.Unlock, because if
this is called late, then Source_Dump would crash otherwise.
* debug.adb: Correct documentation of the -gnatd.9 switch.
* exp_ch4.adb (Expand_Allocator_Expression): Add a comment.
* exp_ch6.adb: Minor comment fixes. Add assertion.
* exp_ch6.ads (Is_Build_In_Place_Result_Type): Correct comment.
* exp_ch7.adb, checks.ads: Minor comment fixes.
Doug Rupp [Thu, 3 Jun 2021 16:21:23 +0000 (09:21 -0700)]
[Ada] Rename sigtramp-vxworks-target.inc to sigtramp-vxworks-target.h
gcc/ada/
* sigtramp-vxworks-target.inc: Rename to...
* sigtramp-vxworks-target.h: ... this.
* sigtramp-vxworks.c, Makefile.rtl: Likewise.
Ghjuvan Lacambre [Thu, 27 May 2021 12:54:14 +0000 (14:54 +0200)]
[Ada] Duplicated D lines in ali files
gcc/ada/
* lib-writ.ads: Mention SCOs dependency as reason for duplicates.
* lib.ads (Units): Update documentation to mention duplicated
units.
Ed Schonberg [Sat, 29 May 2021 14:14:46 +0000 (10:14 -0400)]
[Ada] Spurious style message on missing overriding indicator
gcc/ada/
* style.adb (Missing_Overriding): Do not emit message when
parent of subprogram is a full type declaration.
Arnaud Charlet [Mon, 31 May 2021 08:59:01 +0000 (04:59 -0400)]
[Ada] AI12-0156 Use subtype indication in generalized iterators
gcc/ada/
* par-ch5.adb (P_Iterator_Specification): Add support for access
definition in loop parameter.
* sem_ch5.adb (Check_Subtype_Indication): Renamed...
(Check_Subtype_Definition): ... into this and check for conformance
on access definitions, and improve error messages.
(Analyze_Iterator_Specification): Add support for access definition
in loop parameter.
Arnaud Charlet [Fri, 28 May 2021 14:25:39 +0000 (10:25 -0400)]
[Ada] Spurious warning in generic instance
gcc/ada/
* sem_util.ads, sem_util.adb
(Apply_Compile_Time_Constraint_Error): New parameter
Emit_Message.
* sem_ch4.adb (Analyze_Selected_Component): Disable warning
within an instance.
Eric Botcazou [Mon, 31 May 2021 14:32:14 +0000 (16:32 +0200)]
[Ada] Fix violation of No_Implicit_Loops restriction for enumeration type
gcc/ada/
* exp_imgv.adb: Add with and use clause for Restrict and Rident.
(Build_Enumeration_Image_Tables): Do not generate the hash function
if the No_Implicit_Loops restriction is active.
Piotr Trojanek [Thu, 27 May 2021 15:16:34 +0000 (17:16 +0200)]
[Ada] Simplify redundant checks for non-empty lists
gcc/ada/
* sem_ch12.adb, sem_ch6.adb, sem_ch9.adb, sprint.adb: Simplify
checks for non-empty lists.
Piotr Trojanek [Tue, 25 May 2021 18:41:55 +0000 (20:41 +0200)]
[Ada] Remove redundant condition for listing compilation units
gcc/ada/
* par-ch10.adb (Unit_Display): Remove redundant condition; fix
whitespace.
Piotr Trojanek [Tue, 25 May 2021 15:39:26 +0000 (17:39 +0200)]
[Ada] Restore context on failure in loading of renamed child unit
gcc/ada/
* lib-load.adb (Load): Replace early return with goto to properly
restore context on failure.
Piotr Trojanek [Tue, 25 May 2021 15:40:38 +0000 (17:40 +0200)]
[Ada] Replace low-level condition with a high-level call
gcc/ada/
* lib-writ.adb (Ensure_System_Dependency): Simplify condition.
Piotr Trojanek [Wed, 26 May 2021 13:27:02 +0000 (15:27 +0200)]
[Ada] Fix style in comments and code related to compilation units
gcc/ada/
* lib-load.adb (Load_Unit): Fix style in comment.
* par-load.adb (Load): Likewise.
* scng.adb (Initialize_Scanner): Fix whitespace.
Piotr Trojanek [Wed, 26 May 2021 13:05:28 +0000 (15:05 +0200)]
[Ada] Prevent infinite recursion when there is no expected unit
gcc/ada/
* par-load.adb (Load): Don't remove unit, but flag it as
erroneous and return.
Ghjuvan Lacambre [Wed, 26 May 2021 16:02:34 +0000 (18:02 +0200)]
[Ada] Fix use of single question mark in error message
gcc/ada/
* exp_prag.adb (Expand_Pragma_Inspection_Point): Fix error
message.