With submodules and equivalence declarations, name mangling may result in
long internal symbols overflowing internal buffers. We now check that
we do not exceed the enlarged buffer sizes.
gcc/fortran/
PR fortran/95707
* gfortran.h (gfc_common_head): Enlarge buffer.
* trans-common.c (gfc_sym_mangled_common_id): Enlarge temporary
buffers, and add check on length on mangled name to prevent
overflow.
With submodules, name mangling of character pointer declarations produces long
internal symbols that overflowed a static internal buffer. Adjust the buffer
size.
gcc/fortran/
PR fortran/95688
* iresolve.c (gfc_get_string): Enlarge static buffer size.
With submodules and PDTs, name mangling of interfaces may result in long
internal symbols overflowing a previously static internal buffer. We now
set the buffer size dynamically.
gcc/fortran/
PR fortran/95687
* class.c (get_unique_type_string): Return a string with dynamic
length.
(get_unique_hashed_string, gfc_hash_value): Use dynamic result
from get_unique_type_string instead of static buffer.
With submodules, name mangling of interfaces may result in long internal
symbols overflowing an internal buffer. We now check that we do not
exceed the enlarged buffer size.
gcc/fortran/
PR fortran/95689
* interface.c (check_sym_interfaces): Enlarge temporary buffer,
and add check on length on mangled name to prevent overflow.
EQUIVALENCE objects are subject to constraints listed in the Fortran 2018
standard, section 8.10.1.1. These constraints are to be checked
also for CLASS variables.
gcc/fortran/
PR fortran/95587
* match.c (gfc_match_equivalence): Check constraints on
EQUIVALENCE objects also for CLASS variables.
popcount[45]ll require __builtin_popcountll, but the test can succeed
without libcall through expand_doubleword_popcount. However the Tree-SSA
optiization requires recognition of POPCOUNT. This patch limits the test
to lp64 for the targets that fall through the cracks and were not
caught by the dg-require-effective-target popcountll.
gcc/testsuite/ChangeLog
2020-06-19 David Edelsohn <dje.gcc@gmail.com>
* gcc.dg/tree-ssa/popcount4ll.c: Add target lp64.
* gcc.dg/tree-ssa/popcount5ll.c: Same.
Implementing P2085, another refinement to the operator<=> specification from
the Prague meeting. It was deemed desirable to be able to have a non-inline
defaulted definition of a comparison operator just like you can with other
defaulted functions.
gcc/cp/ChangeLog:
* method.c (early_check_defaulted_comparison): Allow defaulting
comparison outside class. Complain if non-member operator isn't a
friend.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-friend1.C: New test.
* g++.dg/cpp2a/spaceship-err4.C: Adjust diagnostic.
Pattern "(x | y) - y" can be optimized to simple "(x & ~y)" andn
pattern.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/ChangeLog:
PR tree-optimization/94880
* match.pd (A | B) - B -> (A & ~B): New simplification.
gcc/testsuite/ChangeLog:
PR tree-optimization/94880
* gcc.dg/tree-ssa/pr94880.c: New Test.
This properly handles a lane permutation in scalar costing.
For the current only use this doesn't matter much but with
permutes that change the number of lanes it will eventually
ICE.
2020-06-19 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_bb_slp_scalar_cost): Adjust
for lane permutations.
A small tweak to the implementation of __includes, which in my
application saves 20% of the running time. I noticed it because using
range-v3 was giving unexpected performance gains.
Some of the gain comes from pulling the 2 calls ++__first1 out of the
condition so there is just one call. And most of the gain comes from
replacing the resulting
if (__comp(__first1, __first2))
;
else
++__first2;
with
if (!__comp(__first1, __first2))
++__first2;
I was very surprised that the code ended up being so different for such
a change, and I still don't really understand where the extra time is
going...
Anyway, while I blame the compiler for not generating very good code
with the current implementation, I believe the change can be seen as a
simplification.
libstdc++-v3/ChangeLog:
* include/bits/stl_algo.h (__includes): Simplify the code.
I missed that indeed SLP permutation code generation can end up
refering to a non-last vectorized stmt in the last SLP_TREE_VEC_STMTS
element as optimization. So walk them all.
2020-06-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/95761
* tree-vect-slp.c (vect_schedule_slp_instance): Walk all
vectorized stmts for finding the last one.
* gcc.dg/torture/pr95761.c: New testcase.
The attached patch changes the code generated for
std::optional<std::array<int,1024>>f(){return{};}
from
movq $0, (%rdi)
movq %rdi, %r8
leaq 8(%rdi), %rdi
xorl %eax, %eax
movq $0, 4084(%rdi)
movq %r8, %rcx
andq $-8, %rdi
subq %rdi, %rcx
addl $4100, %ecx
shrl $3, %ecx
rep stosq
movq %r8, %rax
or with different tuning
subq $8, %rsp
movl $4100, %edx
xorl %esi, %esi
call memset
addq $8, %rsp
to the much shorter
movb $0, 4096(%rdi)
movq %rdi, %rax
i.e. the same as the nullopt constructor.
The constructor was already non-trivial, so we don't lose that. It passes the
testsuite without regression, but there is no new testcase to verify the
better codegen.
libstdc++-v3/ChangeLog:
* include/std/optional (optional()): Explicitly define it.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* gcc-interface/trans.c (lvalue_required_for_attribute_p): Do not deal
with 'Pos or 'Val.
(Attribute_to_gnu): Likewise.
* gcc-interface/utils.c (create_field_decl): Small formatting fix.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* gcc-interface/trans.c (adjust_for_implicit_deref): Delete.
(maybe_implicit_deref): Likewise.
(Attribute_to_gnu): Replace calls to maybe_implicit_deref by calls
to maybe_padded_object.
(Call_to_gnu): Likewise.
(gnat_to_gnu) <N_Indexed_Component>: Likewise.
<N_Slice>: Likewise.
<N_Selected_Component>: Likewise.
<N_Free_Statement>: Remove call to adjust_for_implicit_deref and
manually make sure that the designated type is complete.
* gcc-interface/utils2.c (build_simple_component_ref): Add comment.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_param): Tidy up.
(gnat_to_gnu_subprog_type): For a variadic C function, do not
build unnamed parameters and do not add final void node.
* gcc-interface/misc.c: Include snames.h.
* gcc-interface/trans.c (Attribute_to_gnu): Tidy up.
(Call_to_gnu): Implement support for unnamed parameters in a
variadic C function.
* gcc-interface/utils.c: Include snames.h.
(copy_type): Tidy up.
2020-06-19 Justin Squirek <squirek@adacore.com>
gcc/ada/
* lib.adb (Check_Same_Extended_Unit): Add check to determine if
the body for the subunits exist in the same file as their
specifications.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_aggr.adb (In_Place_Assign_OK): In an allocator context,
check the bounds of an array aggregate against those of the
designated type, except if the latter is unconstrained.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch3.adb (Is_Visible_Component): Reason only on the private
status of the original type in an instance body.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Qualified_Expression): Do not override the
type of the node when it is unconstrained if it is for an allocator.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Allocator): Call Resolve_Qualified_Expression
on the qualified expression, if any, instead of doing an incomplete
type resolution manually.
(Resolve_Qualified_Expression): Apply predicate check to operand.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch4.adb (Analyze_Selected_Component): In an instance body,
also invoke Find_Component_In_Instance on the parent subtype of
a derived tagged type immediately visible. Remove obsolete case.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_attr.adb (Get_Integer_Type): Return the largest supported
unsigned integer type if need be.
2020-06-19 Justin Squirek <squirek@adacore.com>
gcc/ada/
* sem_warn.adb (Warn_On_Known_Condition): Add general sanity
check that asserts the original source node being checked
contains an entity. If not, it could be the result of special
case expansion for type conversions.
2020-06-19 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch6.adb (Analyze_Expression_Function): Do not indicate
that the function has a completion if it appears within a Ghost
generic package.
2020-06-19 Javier Miranda <miranda@adacore.com>
gcc/ada/
* exp_ch3.ads (Ensure_Activation_Chain_And_Master): New
subprogram.
* exp_ch3.adb (Ensure_Activation_Chain_And_Master): New
subprogram that factorizes code.
(Expand_N_Object_Declaration): Call new subprogram.
* sem_ch6.adb (Analyze_Function_Return): Returning a
build-in-place unconstrained array type defer the full analysis
of the returned object to avoid generating the corresponding
constrained subtype; otherwise the bounds would be created in
the stack and a dangling reference would be returned pointing to
the bounds.
2020-06-19 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* checks.ads: Remove excessive whitespace in declarations of
functions for check suppression.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch7.adb (Hide_Public_Entities): Split handling of objects
and subprograms, and do not reject the latter upfront in nested
instance specs if there are no referencer subprograms at all.
(Analyze_Package_Body_Helper): Also call Hide_Public_Entities on
nested generic instances.
2020-06-19 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_aggr.adb (Resolve_Delta_Record_Aggregate): Modify a nested
Get_Component_Type routine to return a component and not just
its type; use this routine to decorate the identifier within the
delta aggregate.
2020-06-19 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_ch4.adb (Find_Equality_Types.Check_Access_Attribute): New.
(Find_Equality_Types): Move universal_access related checks at
the end of the processing and add call to
Check_Access_Attribute.
2020-06-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* checks.ads (Apply_Static_Length_Check): Move up.
(Apply_Range_Check): Add parameter Insert_Node.
* checks.adb (Apply_Selected_Range_Checks): Merge into...
(Apply_Range_Check): ...this. Add parameter Insert_Node,
pass it as Warn_Node to Selected_Range_Checks and use it
as insertion point for the checks.
* sem_ch3.adb (Analyze_Subtype_Declaration): Rewrite block
dealing with the range checks for the subtype indication.
Use local variable and call Apply_Range_Check in both cases.
2020-06-19 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_attr.adb (Expand_N_Attribute_Reference): Call Ensure_Valid
on the expression of an object declaration that captures the
value of 'Old prefix.
2020-06-19 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_attr.adb (Expand_N_Attribute_Reference): Add comment.
* sem_attr.adb (Analyze_Attribute): Add ??? comment.
* sem_util.ads (Valid_Scalars): This routine is only used for
'Valid_Scalars and not for 'Valid.
2020-06-19 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_attr.adb (Expand_N_Attribute_Reference): Do not call
Scalar_Part_Present on the array component's type.
(Build_Array_VS_Func): Remove Comp_Typ parameter, because it can
be easily computed from the Array_Top parameter *and redundant
parameters are confusing and error-prone).
2020-06-19 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_attr.adb (Build_Record_VS_Func): Strip privacy and type
derivation from the root type when 'Valid_Scalars is applied to
a class-wide type.
2020-06-19 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* checks.adb (Apply_Parameter_Validity_Checks): Remove testing
of Check_Validity_Of_Parameters for every formal parameter and
function result.