When determining the most specialized partial specialization of a
primary template that is nested inside a class template, we first
tsubst the outer template arguments into the TEMPLATE_DECL of each
partial specialization, and then check for satisfaction of each of the
new TEMPLATE_DECL's constraints.
But tsubst_template_decl does not currently guarantee that constraints
from the original DECL_TEMPLATE_RESULT get reattached to the new
DECL_TEMPLATE_RESULT. In the testcase below, this leads to the
constraints_satisfied_p check in most_specialized_partial_spec to
trivially return true for each of the partial specializations.
I'm not sure if such a guarantee would be desirable, but in this case we
can just check constraints_satisfied_p on the original TEMPLATE_DECL
instead of on the tsubsted TEMPLATE_DECL here, which is what this patch
does (alongside some reorganizing).
gcc/cp/ChangeLog:
PR c++/92103
* pt.c (most_specialized_partial_spec): Reorganize the loop over
DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
the original template declaration, not on the tsubsted one.
gcc/testsuite/ChangeLog:
PR c++/92103
* g++.dg/cpp2a/concepts-partial-spec7.C: New test.
Jan Hubicka [Wed, 3 Jun 2020 19:16:43 +0000 (21:16 +0200)]
Optimize ODR enum streaming
it turns out that half of the global decl stream of cc1 LTO build consits
TREE_LISTS, identifiers and integer cosntats representing TYPE_VALUES of enums.
Those are streamed only to produce ODR warning and used otherwise, so this
patch moves the info to a separate section that is represented and streamed
more effectively.
This also adds place for more info that may be used for ODR diagnostics
(i.e. at the moment we do not warn when the declarations differs i.e. by the
associated member functions and their types) and the type inheritance graph
rather then poluting the global stream.
I was bit unsure what enums we want to store into the section. All parsed
enums is probably too expensive, only those enums streamed to represent IL is
bit hard to get, so I went for those seen by free lang data.
As a plus we now get bit more precise warning because also the location of
mismatched enum CONST_DECL is streamed.
It changes:
[WPA] read 4608466 unshared trees
[WPA] read 2942094 mergeable SCCs of average size 1.365328
[WPA] 8625389 tree bodies read in total
[WPA] tree SCC table: size 524287, 247652 elements, collision ratio: 0.383702
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 2694442 SCCs, 228 collisions (0.000085)
[WPA] Merged 2694419 SCCs
[WPA] Merged 3731982 tree bodies
[WPA] Merged 633335 types
[WPA] 122077 types prevailed (155548 associated trees)
...
[WPA] Compression: 110593119 input bytes, 287696614 uncompressed bytes (ratio: 2.601397)
[WPA] Size of mmap'd section decls: 85628556 bytes
[WPA] Size of mmap'd section function_body: 13842928 bytes
[WPA] read 1720989 unshared trees
[WPA] read 1252217 mergeable SCCs of average size 1.858507
[WPA] 4048243 tree bodies read in total
[WPA] tree SCC table: size 524287, 226524 elements, collision ratio: 0.491759
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 1025693 SCCs, 196 collisions (0.000191)
[WPA] Merged 1025670 SCCs
[WPA] Merged 2063373 tree bodies
[WPA] Merged 633497 types
[WPA] 122299 types prevailed (155827 associated trees)
...
[WPA] Compression: 103428770 input bytes, 281151423 uncompressed bytes (ratio: 2.718310)
[WPA] Size of mmap'd section decls: 49390917 bytes
[WPA] Size of mmap'd section function_body: 13858258 bytes
...
[WPA] Size of mmap'd section odr_types: 29054816 bytes
So number of SCCs streamed drops to 38% and the number of unshared trees (that
are bit misnamed since it is mostly integer_cst) to 37%.
Things speeds up correspondingly, but I did not save time report from previous
build.
The enum values are still quite surprisingly large. I may take a look into
ways getting it smaller incrementally, but it streams reasonably fast:
Jason Merrill [Tue, 2 Jun 2020 20:23:02 +0000 (16:23 -0400)]
c++: Fix VLA in template [PR95232]
In a non-template, grokdeclarator notices when we build a pointer to a
variably-modified type, and inserts a TYPE_DECL to make sure that type gets
gimplified. But in a template we can't always recognize a variably-modified
type, so we need to deal with it at instantiation time.
gcc/cp/ChangeLog:
PR c++/95232
* cp-tree.h (predeclare_vla): Declare.
* cp-gimplify.c (predeclare_vla): Handle getting a decl.
* pt.c (tsubst_expr) [DECL_EXPR]: Use it.
Simple patch only add assumed-rank to the list of possible attributes.
gcc/fortran/ChangeLog:
2020-06-03 José Rui Faustino de Sousa <jrfsousa@gmail.com>
PR fortran/95214
PR fortran/66833
PR fortran/67938
* trans-expr.c (gfc_maybe_dereference_var): Add assumed-rank to
character dummy arguments list of possible attributes.
gcc/testsuite/ChangeLog:
2020-06-03 José Rui Faustino de Sousa <jrfsousa@gmail.com>
PR fortran/95214
PR fortran/66833
PR fortran/67938
* gfortran.dg/PR95214.f90: New test.
Tom Tromey [Fri, 29 May 2020 16:46:57 +0000 (10:46 -0600)]
Prefer simple case changes in spelling suggestions
I got this error message when editing gcc and recompiling:
../../gcc/gcc/ada/gcc-interface/decl.c:7714:39: error: ‘DWARF_GNAT_ENCODINGS_all’ was not declared in this scope; did you mean ‘DWARF_GNAT_ENCODINGS_GDB’?
7714 | = debug_info && gnat_encodings == DWARF_GNAT_ENCODINGS_all;
| ^~~~~~~~~~~~~~~~~~~~~~~~
| DWARF_GNAT_ENCODINGS_GDB
This suggestion could be improved -- what happened here is that I
failed to upper-case the word, and DWARF_GNAT_ENCODINGS_ALL was the
correct spelling.
This patch changes gcc's spell checker to prefer simple case changes
when possible.
I tested this using the self-tests. A new self-test is also included.
gcc/ChangeLog:
* spellcheck.c (CASE_COST): New define.
(BASE_COST): New define.
(get_edit_distance): Recognize case changes.
(get_edit_distance_cutoff): Update.
(test_edit_distances): Update.
(get_old_cutoff): Update.
(test_find_closest_string): Add case sensitivity test.
Jan Hubicka [Wed, 3 Jun 2020 10:03:40 +0000 (12:03 +0200)]
Cleanup LTO tag streaming.
this patch cleanups a bit the way LTO tags are assigned (so we do not use magic
numbers of 2) and reorders them approximately by their frequency so the stream
gets little bit smaller because of uleb coding.
Eric Botcazou [Fri, 17 Jan 2020 18:37:39 +0000 (19:37 +0100)]
[Ada] Fix for missing calls to Adjust primitive with nested generics
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch12.adb (Denotes_Previous_Actual): Delete.
(Check_Generic_Actuals): Do not special case array types whose
component type denotes a previous actual. Do not special case
access types whose base type is private.
(Check_Private_View): Remove code dealing with secondary types.
Do not switch the views of an array because of its component.
(Copy_Generic_Node): Add special handling for a comparison
operator on array types.
(Instantiate_Type): Do not special case access types whose
designated type is private.
(Set_Global_Type): Do not special case array types whose
component type is private.
Justin Squirek [Fri, 17 Jan 2020 14:10:43 +0000 (09:10 -0500)]
[Ada] Spurious ineffective with clause warnings on use type clause
2020-06-03 Justin Squirek <squirek@adacore.com>
gcc/ada/
* sem_ch10.adb (Process_Body_Clauses): Add loop to interate
through all prefixes in a use_type clause so that all packages
in the expanded name get examined for effectiveness.
Arnaud Charlet [Wed, 15 Jan 2020 10:05:52 +0000 (05:05 -0500)]
[Ada] Remove more cases of empty loops
2020-06-03 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_util.ads, sem_util.adb (Side_Effect_Free_Statements,
Side_Effect_Free_Loop): New functions.
(Has_Non_Null_Statements): Consider N_Call_Marker as a null
statement.
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Call
Set_Is_Null_Loop even inside a generic instantiation.
(Analyze_Loop_Statement): Mark for removal loops with no side
effects.
Eric Botcazou [Wed, 15 Jan 2020 10:03:14 +0000 (11:03 +0100)]
[Ada] Support pragma Allow_Integer_Address on 64-bit targets
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* opt.ads (Allow_Integer_Address): Fix typo in comment.
* stand.ads (Standard_Address): New entity.
* cstand.adb (Create_Standard): Create it.
* sem_ch4.adb (Operator_Check): Convert the operands of an
operation with addresses and integers to Standard_Address
if pragma Allow_Integer_Address is in effect.
Yannick Moy [Fri, 10 Jan 2020 13:46:25 +0000 (14:46 +0100)]
[Ada] Improve handling of SPARK_Mode in generic instances
2020-06-03 Yannick Moy <moy@adacore.com>
gcc/ada/
* rtsfind.adb (Load_RTU): Correctly set/reset global variable to
ignore SPARK_Mode in instances around loading.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Accept Off
without prior On.
* sem_ch7.adb (Analyze_Package_Body_Helper): Likewise.
* sem_prag.adb (Analyze_Pragma): Always take into account
SPARK_Mode Off.
Arnaud Charlet [Thu, 9 Jan 2020 16:04:35 +0000 (11:04 -0500)]
[Ada] Initial infrastructure for adding a tree checker
2020-06-03 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* frontend.adb (Frontend): Call (dummy for now) tree checker.
* debug.adb: Reserve -gnatd_V for the tree checker.
* vast.ads, vast.adb: New files.
* gcc-interface/Make-lang.in: Add vast.o.
Justin Squirek [Wed, 8 Jan 2020 03:57:19 +0000 (22:57 -0500)]
[Ada] Incorrect accessibility checking on aliased formals
2020-06-03 Justin Squirek <squirek@adacore.com>
gcc/ada/
* libgnat/a-cborse.adb, libgnat/a-cihase.adb,
libgnat/a-ciorse.adb, libgnat/a-coorse.adb: Modified to use
'Unrestricted_Access in certain cases where static accessibility
errors were triggered.
* exp_ch6.adb (Expand_Simple_Return_Statement): Add generation
of dynamic accessibility checks as determined by
Is_Special_Aliased_Formal_Access.
* sem_attr.adb (Resolve_Attribute): Add call to
Is_Special_Aliased_Formal_Access to avoid performing static
checks where dynamic ones are required.
* sem_ch6.adb (Check_Return_Obj_Accessibility): Handle renamed
objects within component associations requiring special
accessibility checks.
* sem_util.adb, sem_util.ads (Is_Special_Aliased_Formal_Access):
Created to detect the special case where an aliased formal is
being compared against the level of an anonymous access return
object.
(Object_Access_Level): Remove incorrect condition leading to
overly permissive accessibility levels being returned on
explicitly aliased parameters.
Eric Botcazou [Thu, 9 Jan 2020 15:25:39 +0000 (16:25 +0100)]
[Ada] Improve 'Val implementation for some enumeration types
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* einfo.ads (Enum_Pos_To_Rep): Adjust description.
* exp_attr.adb (Expand_N_Attribute_Reference) <Pred>:
Reimplement in the case of an enumeration type with non-standard
but contiguous representation.
<Succ>: Likewise.
<Val>: Likewise.
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Count the
literals in the first loop. If the representation is
contiguous, just build the index type of the array type and set
Enum_Pos_To_Rep to it.
Gary Dismukes [Wed, 8 Jan 2020 22:36:43 +0000 (17:36 -0500)]
[Ada] Unnesting problems with expansion of Loop_Entry attribute
2020-06-03 Gary Dismukes <dismukes@adacore.com>
gcc/ada/
* exp_attr.adb (Expand_Loop_Entry_Attribute): Revise loop that
resets the scopes of entities associated with Loop_Id to the
scope of the new function, so the resetting is not restricted to
itypes, but excludes loop parameters and the function entity
itself. However, this fix is believed to be incomplete and a ???
comment is added to indicate that.
Eric Botcazou [Wed, 8 Jan 2020 23:04:34 +0000 (00:04 +0100)]
[Ada] Get rid of more references to Universal_Integer in expanded code
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_attr.adb (Expand_N_Attribute_Reference) <Enum_Rep>:
In the case of an enumeration type, do an intermediate
conversion to a small integer type. Remove useless stuff.
<Finalization_Size>: Do not hardcode Universal_Integer and
fix a type mismatch in the assignment to the variable.
<Max_Size_In_Storage_Elements>: Likewise.
<From_Any>: Do not redefine the Ptyp local variable.
<To_Any>: Likewise.
<TypeCode>: Likewise.
<Pos>: Small tweaks.
<Val>: For an enumeration type with standard representation,
apply the range check to the expression of a convertion to
Universal_Integer, if any. For an integer type, expand to
a mere conversion.
Eric Botcazou [Tue, 7 Jan 2020 22:04:13 +0000 (23:04 +0100)]
[Ada] More efficient System.Random_Numbers.Random_Discrete for 32-bit types
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* libgnat/s-rannum.adb (Random_Discrete): In the 32-bit case,
use the same linear implementation as in the 64-bit case when
the type has a contiguous representation.
Eric Botcazou [Mon, 6 Jan 2020 12:14:58 +0000 (13:14 +0100)]
[Ada] Get rid of more references to Universal_Integer in expanded code
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_attr.adb (Attribute_Valid): Use Standard_Long_Long_Integer
in lieu of Universal_Integer as large integer type.
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Likewise.
Eric Botcazou [Fri, 3 Jan 2020 14:31:08 +0000 (15:31 +0100)]
[Ada] Avoid creating temporaries in Universal_Integer for range checks
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* checks.adb (Is_Single_Attribute_Reference): New predicate.
(Generate_Range_Check): Do not force the evaluation if the
node is a single attribute reference.
* exp_util.adb (Side_Effect_Free_Attribute): New predicate.
(Side_Effect_Free) <N_Attribute_Reference>: Call it.
(Remove_Side_Effects): Remove the side effects of the prefix
for an attribute reference whose prefix is not a name.
David Malcolm [Sun, 31 May 2020 17:28:41 +0000 (13:28 -0400)]
jit: fix __builtin_unreachable [PR 95426]
PR jit/95426 reports a crash deep inside "expand" when using
__builtin_unreachable via gcc_jit_context_get_builtin_function,
due to BLOCK_FOR_INSN being erroneously used on a barrier within
rtl_verify_bb_pointers.
The root cause turns out to be that I didn't implement
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE and LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
for the jit "frontend". When building a decl for the builtin, the
libgccjit frontend generates a chain of attributes names, but when
this is passed to decl_attributes and the attributes are looked up by
namespace and name within lookup_scoped_attribute_spec, attributes_table
is empty. Hence no attributes were being associated with the fndecl,
and so ECF_NORETURN was not set on the gimple_call (along with various
other flags missing on the decl, etc), and so the call is treated as
not terminating its BB, and so the CFG rapidly diverges from the
equivalent created by the C frontend.
This patch fixes things by implementing these langhooks, copying the
minimal attribute-handling code from LTO. I stepped through the
creation of the fndecl and verified that with this fix it has the same
attributes as the equivalent created by the C frontend.
Jason Merrill [Mon, 1 Jun 2020 21:58:57 +0000 (17:58 -0400)]
c++: *this capture in const member fn [PR95193].
Here, the capture proxy for *this is const, but its DECL_VALUE_EXPR is not.
Don't ICE on this; it's a reasonable difference, since in C++ an rvalue of
scalar type does not have cv-qualifiers.
gcc/cp/ChangeLog:
PR c++/95193
* pt.c (tsubst_decl): Relax assert.
gcc/testsuite/ChangeLog:
PR c++/95193
* g++.dg/cpp1z/lambda-this7.C: New test.
Iain Sandoe [Tue, 2 Jun 2020 15:47:54 +0000 (16:47 +0100)]
coroutines: Wrap co_await in a target expr where needed [PR95050]
Since the co_await expression is mostly opaque to the existing
machinery, we were hiding the details of the await_resume return
value. If that needs to be wrapped in a target expression, then
emulate this with the whole co_await. Similarly, if the await
expression we build in response to co_await p.yield_value (e)
is wrapped in a target expression, then we need to transfer that
wrapper to the resultant CO_YIELD_EXPR (which is, itself, just
a proxy for the underlying co_await).
gcc/cp/ChangeLog:
PR c++/95050
* coroutines.cc (build_co_await): Wrap the co_await expression
in a TARGET_EXPR, where needed.
(finish_co_yield_expr): Likewise.
gcc/testsuite/ChangeLog:
PR c++/95050
* g++.dg/coroutines/pr95050.C: New test.
Alexandre Oliva [Tue, 2 Jun 2020 17:33:38 +0000 (14:33 -0300)]
spell ldscript correctly in outputs.exp et al
In my recent changes to outputs.exp and gcc-defs.exp, I misreferenced
dejagnu board property ldscript, singular, as ldscripts, plural.
This probably didn't have much impact on gcc-defs.exp: the code there
would just prefix with -Wl, any options that amounted to file names,
and linker scripts probably wouldn't be named without a -T or even an
-Wl,-T, prefix.
The visible effects were in outputs.exp, that also intended to add the
ldscript, if present, to the set of options to be passed to the
compiler driver for linking. Using the wrong option name, that
wouldn't work.
Fei Yang [Tue, 2 Jun 2020 17:17:34 +0000 (18:17 +0100)]
aarch64: Fix an ICE in aarch64_short_vector_p [PR95459]
In aarch64_short_vector_p, we are simply checking whether a type (and a mode)
is a 64/128-bit short vector or not. This should not be affected by the value
of TARGET_SVE. Simply leave later code to report an error if SVE is disabled.
2020-06-02 Felix Yang <felix.yang@huawei.com>
gcc/
PR target/95459
* config/aarch64/aarch64.c (aarch64_short_vector_p):
Leave later code to report an error if SVE is disabled.
gcc/testsuite/
PR target/95459
* gcc.target/aarch64/mgeneral-regs_6.c: New test.
Jonathan Wakely [Tue, 2 Jun 2020 17:13:08 +0000 (18:13 +0100)]
libstdc++: Make debug containers prefer copy ctor to base ctor (PR 90102)
When given a type which can convert to any container-like type, the
C(const C&) copy constructor and C(const C::_Base&) converting
constructor are ambiguous. This change replaces the converting
constructor's parameter with a reference_wrapper-like type so that
calling that constructor requires an additional user-defined conversion.
This gives it a lower rank than the copy constructor, avoiding the
ambiguity.
While testing this change I discovered that __gnu_debug::forward_list
doesn't have a convering constructor from the std::forward_list base, so
this adds it.
We should probably consider whether the converting constructors should
be 'explicit' but I'm not changing that now.
libstdc++-v3/ChangeLog:
PR libstdc++/90102
* include/debug/deque (deque(const _Base&)): Replace parameter
with a struct that wraps a const _Base&.
* include/debug/forward_list (forward_list(_Base_ref)): New
constructor.
* include/debug/list (list(const _Base&)): Replace parameter
with a struct that wraps a const _Base&.
* include/debug/map.h (map(const _Base&)): Likewise.
* include/debug/multimap.h (multimap(const _Base&)): Likewise.
* include/debug/multiset.h (multiset(const _Base&)): Likewise.
* include/debug/set.h (set(const _Base&)): Likewise.
* include/debug/unordered_map (unordered_map(const _Base&))
(unordered_multimap(const _Base&)): Likewise.
* include/debug/unordered_set (unordered_set(const _Base&))
(unordered_multiset(const _Base&)): Likewise.
* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
Adjust dg-error line number.
* include/debug/vector (vector(const _Base&)): Likewise.
* testsuite/23_containers/deque/debug/90102.cc: New test.
* testsuite/23_containers/forward_list/debug/90102.cc: New test.
* testsuite/23_containers/list/debug/90102.cc: New test.
* testsuite/23_containers/map/debug/90102.cc: New test.
* testsuite/23_containers/multimap/debug/90102.cc: New test.
* testsuite/23_containers/multiset/debug/90102.cc: New test.
* testsuite/23_containers/set/debug/90102.cc: New test.
* testsuite/23_containers/unordered_map/debug/90102.cc: New test.
* testsuite/23_containers/unordered_multimap/debug/90102.cc: New test.
* testsuite/23_containers/unordered_multiset/debug/90102.cc: New test.
* testsuite/23_containers/unordered_set/debug/90102.cc: New test.
* testsuite/23_containers/vector/debug/90102.cc: New test.
Aaron Sawdey [Fri, 29 May 2020 21:19:10 +0000 (16:19 -0500)]
Correctly identify stfs if prefixed
Because reg_to_non_prefixed() only looks at the register being used, it
doesn't get the right answer for stfs, which leads to us not seeing
that it has a PCREL symbol ref. This patch works around this by
introducing a helper function that inspects the insn to see if it is in
fact a stfs. Then if we use NON_PREFIXED_DEFAULT, address_to_insn_form()
can see that it has the PCREL symbol ref.
gcc/ChangeLog:
PR target/95347
* config/rs6000/rs6000.c (prefixed_store_p): Add special case
for stfs.
(is_stfs_insn): New helper function.
Andrew Stubbs [Tue, 2 Jun 2020 13:41:21 +0000 (14:41 +0100)]
amdgcn: Remove -mlocal-symbol-id option
This patch removes the obsolete -mlocal-symbol-id option. This was used to
control mangling of local symbol names in order to work around a ROCm runtime
bug, but that has not been needed in some time, and the mangling was removed
already.
Martin Liska [Tue, 2 Jun 2020 13:13:22 +0000 (15:13 +0200)]
gcc-changelog: support patterns
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Support foo/bar/*: patterns in
wildcard_prefixes locations.
* gcc-changelog/test_email.py: Test it.
* gcc-changelog/test_patches.txt: Add 3 new patches.
Iain Buclaw [Tue, 2 Jun 2020 09:21:22 +0000 (11:21 +0200)]
d: Set up input_location before lowering Dsymbol AST
Like a similarly named function in the visitor class for statements,
this ensures that the current input_location is set to the correct
source file location of the decl.
It is likely that there are a number of cases where declarations have
ended up with no location without this.
Jonathan Wakely [Tue, 2 Jun 2020 10:18:21 +0000 (11:18 +0100)]
contrib: Make prepare-commit-msg hook safe for older branches
If a user installs this script as .git/hooks/prepare-commit-msg and then
works on an old branch which doesn't have the mklog.py script, trying to
commit will fail with an error like:
environment: /.../gcc/contrib/mklog.py: No such file or directory
This makes it exit cleanly so it's possible to commit.
contrib/ChangeLog:
* prepare-commit-msg: Do nothing if the mklog.py script isn't
present.
Martin Liska [Fri, 31 Jan 2020 12:10:14 +0000 (13:10 +0100)]
Make TOPN counter dynamically allocated.
gcc/ChangeLog:
* coverage.c (get_coverage_counts): Skip sanity check for TOP N counters
as they have variable number of counters.
* gcov-dump.c (main): Add new option -r.
(print_usage): Likewise.
(tag_counters): All new raw format.
* gcov-io.h (struct gcov_kvp): New.
(GCOV_TOPN_VALUES): Remove.
(GCOV_TOPN_VALUES_COUNTERS): Likewise.
(GCOV_TOPN_MEM_COUNTERS): New.
(GCOV_TOPN_DISK_COUNTERS): Likewise.
(GCOV_TOPN_MAXIMUM_TRACKED_VALUES): Likewise.
* ipa-profile.c (ipa_profile_generate_summary): Use
GCOV_TOPN_MAXIMUM_TRACKED_VALUES.
(ipa_profile_write_edge_summary): Likewise.
(ipa_profile_read_edge_summary): Likewise.
(ipa_profile): Remove usage of GCOV_TOPN_VALUES.
* profile.c (sort_hist_values): Sort variable number
of counters.
(compute_value_histograms): Special case for TOP N counters
that have dynamic number of key-value pairs.
* value-prof.c (dump_histogram_value): Dump variable number
of key-value pairs.
(stream_in_histogram_value): Stream in variable number
of key-value pairs for TOP N counter.
(get_nth_most_common_value): Deal with variable number
of key-value pairs.
(dump_ic_profile): Use GCOV_TOPN_MAXIMUM_TRACKED_VALUES
for loop iteration.
(gimple_find_values_to_profile): Set GCOV_TOPN_MEM_COUNTERS
to n_counters.
* doc/gcov-dump.texi: Document new -r option.
libgcc/ChangeLog:
* libgcov-driver.c (prune_topn_counter): Remove.
(prune_counters): Likewise.
(merge_one_data): Special case TOP N counters
as they have variable length.
(write_top_counters): New.
(write_one_data): Special case TOP N.
(dump_one_gcov): Do not prune TOP N counters.
* libgcov-merge.c (merge_topn_values_set): Remove.
(__gcov_merge_topn): Use gcov_topn_add_value.
* libgcov-profiler.c (__gcov_topn_values_profiler_body):
Likewise here.
* libgcov.h (gcov_counter_add): New.
(gcov_counter_set_if_null): Likewise.
(gcov_topn_add_value): New.
* exp_ch4.adb (Generate_Temporary): New subprogram of
Discrete_Range_Check that generates a temporary to facilitate
the C backend the code generation of the unchecked conversion
since the size of the source type may differ from the size of
the target type.
Javier Miranda [Thu, 26 Dec 2019 20:29:24 +0000 (15:29 -0500)]
[Ada] Improved support for aspect alignment in CCG
2020-06-02 Javier Miranda <miranda@adacore.com>
gcc/ada/
* sem_ch3.adb (Analyze_Object_Declaration): Set attribute
Expansion_Delayed on aggregates that initialize an object that
has aspect alignment or address clause. Done to allow ther
initialization by means of multiple assignments.
* exp_ch3.adb (Expand_N_Object_Declaration): Resolve delayed
aggregates. This patch complements the patch applied to
sem_ch3.adb
Javier Miranda [Fri, 27 Dec 2019 20:01:33 +0000 (15:01 -0500)]
[Ada] Compiler crash processing controlled type primitive
2020-06-02 Javier Miranda <miranda@adacore.com>
gcc/ada/
* sem_util.adb (Ensure_Minimum_Decoration): New subprogram that
ensures the minimum decoration required by
Requires_Transient_Scope() to provide its functionality when the
entity is not frozen.
* exp_ch4.adb (Expand_N_Op_Divide): Remove code dealing with
the Treat_Fixed_As_Integer flag.
(Expand_N_Op_Multiply): Likewise.
* exp_fixd.adb (Build_Divide): Do the division in an integer
type long enough to hold both operands and convert the result
to the type of the LHS. Do not set Treat_Fixed_As_Integer.
(Build_Multiply): Do not set Treat_Fixed_As_Integer.
(Build_Rem): Likewise.
* sem_ch4.adb (Analyze_Arithmetic_Op): Remove code dealing with
the Treat_Fixed_As_Integer flag.
(Check_Arithmetic_Pair): Likewise.
* sinfo.ads (Treat_Fixed_As_Integer): Delete.
(N_Has_Treat_Fixed_As_Integer): Likewise.
(Set_Treat_Fixed_As_Integer): Likewise.
* sinfo.adb (Treat_Fixed_As_Integer): Likewise.
(Set_Treat_Fixed_As_Integer): Likewise.
* sprint.ads (Syntax Extensions): Remove '#' special character.
* sprint.adb (Process_TFAI_RR_Flags): Delete.
(Sprint_Node_Actual) <N_Op_Divide>: Print '@' manually.
<N_Op_Multiply>: Likewise.
<N_Op_Mod>: Do not print '#'.
<N_Op_Rem>: Likewise.
Eric Botcazou [Sun, 22 Dec 2019 18:37:20 +0000 (19:37 +0100)]
[Ada] Get rid of more references to Universal_Integer in expanded code
2020-06-02 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_aggr.adb (Others_Check): In the positional case, use the
general expression for the comparison only when needed.
* exp_attr.adb (Expand_Fpt_Attribute;): Use a simple conversion
to the target type instead of an unchecked conversion to the
base type to do the range check, as in the other cases.
(Expand_N_Attribute_Reference) <Attribute_Storage_Size>: Do the
Max operation in the type of the storage size variable, and use
Convert_To as in the other cases.
* tbuild.adb (Convert_To): Do not get rid of an intermediate
conversion to Universal_Integer here...
* sem_res.adb (Simplify_Type_Conversion): ...but here instead.
Eric Botcazou [Fri, 20 Dec 2019 15:57:50 +0000 (16:57 +0100)]
[Ada] Get rid of more references to Universal_Integer in expanded code
2020-06-02 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_aggr.adb (Build_Array_Aggr_Code): Set the type of the PAT
on the zero used to clear the array.
* exp_attr.adb (Expand_N_Attribute_Reference)
<Attribute_Alignment>: In the CW case, directly convert from the
alignment's type to the target type if the parent is an
unchecked conversion.
* sem_res.adb (Set_String_Literal_Subtype): In the dynamic case,
use the general expression for the upper bound only when needed.
Set the base type of the index as the type of the low bound.
(Simplify_Type_Conversion): Do an intermediate conversion to the
root type of the target type if the operand is an integer
literal.
* tbuild.adb (Convert_To): Get rid of an intermediate conversion
to Universal_Integer if the inner expression has integer tyoe.
* libgnat/a-sequio.adb (Byte_Swap): Make use of an equivalent
static expression in the case statement.
Gary Dismukes [Thu, 19 Dec 2019 22:00:27 +0000 (17:00 -0500)]
[Ada] ICE during unnesting when nested subprograms have address taken
2020-06-02 Gary Dismukes <dismukes@adacore.com>
gcc/ada/
* exp_unst.adb (Register_Subprogram): Test for Address_Taken (in
addition to the existing test for In_Synchonized_Unit) when
deciding whether to reset the Reachable flag on all subprograms
enclosing the subprogram being registered.
Gary Dismukes [Mon, 16 Dec 2019 23:43:32 +0000 (18:43 -0500)]
[Ada] Unnesting bugs with array renamings generated for quantified expr
2020-06-02 Gary Dismukes <dismukes@adacore.com>
gcc/ada/
* exp_unst.adb (Visit_Node): When visiting array attribute
nodes, apply Get_Referenced_Object to the attribute prefix, to
handle prefixes denoting renamed objects by picking up the Etype
of the renamed object rather than the possibly unconstrained
nominal subtype of the renaming declaration's Entity.
* sem_util.ads (Get_Referenced_Object): Update comment to
clearly indicate that any kind of node can be passed to this
function.
* sem_util.adb (Get_Referenced_Object): Add test of Is_Object to
the condition, to allow for passing names that denote types and
subtypes.
Piotr Trojanek [Thu, 31 Oct 2019 12:38:17 +0000 (13:38 +0100)]
[Ada] Accept objects from nested packages in Initializes contract
2020-06-02 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_prag.adb (Collect_States_And_Objects): Call itself on
declaration of nested packages; append abstract states
one-by-one, so that in recursive call we do not overwrite the
ones that have been already collected.
Eric Botcazou [Sun, 15 Dec 2019 17:26:24 +0000 (18:26 +0100)]
[Ada] Use Standard.Natural on indices in support routines for Ada.Tags
2020-06-02 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_atag.ads (Build_Inherit_Predefined_Prims): Change type
of Num_Predef_Prim parameter from Int to Nat.
* exp_atag.adb (Build_Range): New procedure.
(Build_Val): Likewise.
(Build_CW_Membership): Call Build_Val.
(Build_Get_Predefined_Prim_Op_Address): Likewise.
(Build_Inherit_CPP_Prims): Likewise.
(Build_Get_Prim_Op_Address): Likewise.
(Build_Set_Predefined_Prim_Op_Address): Likewise.
(Build_Inherit_Prims): Call Build_Range.
(Build_Inherit_Predefined_Prims): Likewise. Change type of
Num_Predef_Prim parameter from Int to Nat.
Piotr Trojanek [Thu, 12 Dec 2019 10:45:24 +0000 (11:45 +0100)]
[Ada] Reuse Is_Package_Or_Generic_Package where possible
2020-06-02 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* contracts.adb, einfo.adb, exp_ch9.adb, sem_ch12.adb,
sem_ch4.adb, sem_ch7.adb, sem_ch8.adb, sem_elab.adb,
sem_type.adb, sem_util.adb: Reuse Is_Package_Or_Generic_Package
where possible (similarly, reuse Is_Concurrent_Type if it was
possible in the same expressions).
Iain Buclaw [Sun, 31 May 2020 22:18:44 +0000 (00:18 +0200)]
Fix unrecognised -mcpu target 'armv7-a' on arm-wrs-vxworks7
In the removal of arm-wrs-vxworks, the default cpu was updated from arm8
to armv7-a, but this is not recognized as a valid -mcpu target. There
is however generic-armv7-a, which was likely the intended cpu that
should have been used instead.
gcc/ChangeLog:
PR target/95420
* config.gcc (arm-wrs-vxworks7*): Set default cpu to generic-armv7-a.
Iain Buclaw [Mon, 1 Jun 2020 11:27:06 +0000 (13:27 +0200)]
d: Fix segfault in build_frontend_type on alpha-*-*
The va_list type for Alpha includes a nameless dummy field for alignment
purposes. To transpose this into D, a field named "__pad%d" is inserted
into the struct definition.
It was also noticed that in the D front-end AST copy of the backend
type, all offsets for fields generated by build_frontend_type were set
to zero due to a wrong assumption that DECL_FIELD_OFFSET would have a
non-zero value. This has been fixed to use byte_position instead.
gcc/d/ChangeLog:
* d-builtins.cc (build_frontend_type): Handle struct fields with NULL
DECL_NAME. Use byte_position to get the real field offset.