Eric Botcazou [Thu, 9 Dec 2021 12:34:09 +0000 (13:34 +0100)]
[Ada] Fix regression in freezing code for instantiations
gcc/ada/
* sem_ch12.adb (Insert_Freeze_Node_For_Instance): When going to
the outer level, do not jump over following instantiations in
the list.
Piotr Trojanek [Tue, 7 Dec 2021 19:16:02 +0000 (20:16 +0100)]
[Ada] Remove unreferenced Warn_On_Instance
gcc/ada/
* err_vars.ads (Warn_On_Instance): Remove; it was a relic from
the previous handling of warning in instances that was removed
decades ago.
Piotr Trojanek [Tue, 7 Dec 2021 16:00:01 +0000 (17:00 +0100)]
[Ada] Fix style in comments about warning messages
gcc/ada/
* errout.adb (Error_Msg_Internal): Reorder words.
* erroutc.ads (Is_Warning_Msg): Add closing paren.
* sem_util.adb (Compile_Time_Constraint_Error): Fix casing.
Piotr Trojanek [Tue, 7 Dec 2021 19:13:15 +0000 (20:13 +0100)]
[Ada] Simplify type conversions in source pointer arithmetic
gcc/ada/
* sem_res.adb (Resolve_String_Literal): Simplify pointer
arithmetic.
Piotr Trojanek [Tue, 7 Dec 2021 19:12:49 +0000 (20:12 +0100)]
[Ada] Refactor repeated implicit conversion from Char_Code to Uint
gcc/ada/
* sem_res.adb (Resolve_String_Literal): Avoid unnecessary
conversions inside "<" and ">" bodies.
Piotr Trojanek [Tue, 7 Dec 2021 09:32:53 +0000 (10:32 +0100)]
[Ada] Fix style in calls to Compile_Time_Constraint_Error
gcc/ada/
* checks.adb (Null_Exclusion_Static_Checks,
Selected_Range_Checks): Fix style.
Eric Botcazou [Tue, 7 Dec 2021 21:10:53 +0000 (22:10 +0100)]
[Ada] Fix spurious error on instantiation with Text_IO name
gcc/ada/
* sem_ch8.adb (Analyze_Package_Renaming): Do not check for Text_IO
special units when the name of the renaming is a generic instance,
which is the case for package instantiations in the GNAT model.
Steve Baird [Mon, 6 Dec 2021 21:42:51 +0000 (13:42 -0800)]
[Ada] Avoid building malformed component constraints
gcc/ada/
* sem_util.adb (Build_Discriminant_Reference): In the unexpected
case where we previously would fail an assertion, we instead
revert to the old behavior.
Steve Baird [Fri, 3 Dec 2021 01:04:15 +0000 (17:04 -0800)]
[Ada] Avoid building malformed component constraints
gcc/ada/
* sem_util.adb (Build_Actual_Subtype_Of_Component): Define a new
local function, Build_Discriminant_Reference, and call it in
each of the three cases where Make_Selected_Component was
previously being called to construct a discriminant reference (2
in Build_Actual_Array_Constraint and 1 in
Build_Actual_Record_Constraint). Instead of unconditionally
using the passed-in object name as the prefix for the new
selected component node, this new function checks to see if
perhaps a prefix of that name should be used instead.
Etienne Servais [Fri, 3 Dec 2021 14:13:07 +0000 (15:13 +0100)]
[Ada] Fix typo in comments found running aspell
gcc/ada/
* atree.adb: Fix typo.
* einfo.ads: Likewise.
* exp_aggr.adb: Likewise.
* exp_ch6.adb: Likewise.
* exp_ch7.adb: Likewise.
* exp_ch9.adb: Likewise.
* exp_prag.adb: Likewise.
* exp_unst.adb: Likewise.
* exp_unst.ads: Likewise.
* exp_util.adb: Likewise.
* par-endh.adb: Likewise.
* par.adb: Likewise.
* restrict.adb: Likewise.
* sem.ads: Likewise.
* sem_ch4.adb: Likewise.
* sem_ch5.adb: Likewise.
* sem_ch6.adb: Likewise.
* sem_ch8.adb: Likewise.
* sem_ch12.adb: Likewise.
* sem_ch13.adb: Likewise.
* sem_dim.adb: Likewise.
* sem_elab.adb: Likewise.
* sem_prag.adb: Likewise.
* sem_res.adb: Likewise.
* sem_util.adb: Likewise.
* sem_util.ads: Likewise.
* sinfo.ads: Likewise.
* sprint.adb: Likewise.
* urealp.adb: Likewise.
Justin Squirek [Tue, 30 Nov 2021 23:40:40 +0000 (23:40 +0000)]
[Ada] Spurious error when using current instance of type
gcc/ada/
* exp_ch3.adb (Build_Assignment): Replace current instance of
type with Init_Proc formal.
* sem_attr.adb (OK_Self_Reference): Handle recognition of
Current_Instance to detect certain expansion.
* sem_ch4.adb (Analyze_One_Call): Set actual's type when the
actual in question is a current instance and its corresponding
formal is an incomplete type.
* sem_util.adb (Is_Current_Instance): Add check for incomplete
views and add comment.
Bob Duff [Fri, 3 Dec 2021 17:01:14 +0000 (12:01 -0500)]
[Ada] New restriction No_Tagged_Type_Registration
gcc/ada/
* libgnat/s-rident.ads (No_Tagged_Type_Registration): New
restriction identifier.
* restrict.ads (Implementation_Restriction): Add restriction.
* exp_ch7.adb (Process_Declarations): Suppress
tagged-type-related finalization actions if the restriction is
active. Call RTE_Available last.
* exp_disp.adb (Make_DT): Likewise.
* exp_util.adb (Requires_Cleanup_Actions): Return False for a
tagged type declaration if No_Tagged_Type_Registration is
active.
* sem_attr.adb (Check_Stream_Attribute): Check restriction
No_Tagged_Type_Registration.
* libgnat/a-except.ads (Null_Occurrence): Minor: Initialize, to
avoid stopping at a warning in gdb.
* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
Document new restriction.
* gnat_rm.texi: Regenerate.
Piotr Trojanek [Thu, 2 Dec 2021 14:30:36 +0000 (15:30 +0100)]
[Ada] Remove duplicates of empty strings
gcc/ada/
* par-ch4.adb (P_Simple_Expression): Reuse Null_String_Id.
* prep.adb (Parse_Def_File): Likewise; remove Empty_String.
Eric Botcazou [Fri, 3 Dec 2021 18:43:23 +0000 (19:43 +0100)]
[Ada] Rename Any_Access into Universal_Access
gcc/ada/
* stand.ads (Any_Access): Delete.
(Universal_Access): New entity.
* einfo.ads: Remove obsolete reference to Any_Access.
* gen_il-gen-gen_entities.adb: Likewise.
* cstand.adb (Create_Standard): Do not create Any_Access and create
Universal_Access as a full type instead.
* errout.adb (Set_Msg_Insertion_Type_Reference): Do not deal with
Any_Access and deal with Universal_Access instead.
* sem_ch3.adb (Analyze_Object_Declaration): Replace Any_Access with
Universal_Access.
* sem_ch4.adb (Analyze_Null): Likewise.
(Find_Non_Universal_Interpretations): Likewise.
(Find_Equality_Types.Try_One_Interp): Likewise and avoid shadowing
by renaming a local variable of the same name.
* sem_res.adb (Make_Call_Into_Operato): Likewise.
(Resolve_Equality_Op): Likewise.
* sem_type.adb (Covers): Likewise.
(Specific_Type): Likewise.
Piotr Trojanek [Fri, 3 Dec 2021 14:52:34 +0000 (15:52 +0100)]
[Ada] Suppress spurious CodePeer check on generic actual subprogram
gcc/ada/
* treepr.adb (Destroy): Prevent spurious check from CodePeer.
Yannick Moy [Fri, 3 Dec 2021 15:23:01 +0000 (16:23 +0100)]
[Ada] Justify false positive message from CodePeer analysis of GNAT
gcc/ada/
* libgnat/s-exponu.adb (Exponu): Add annotation.
Justin Squirek [Mon, 22 Nov 2021 12:53:56 +0000 (12:53 +0000)]
[Ada] Removal of technical debt
gcc/ada/
* exp_ch6.adb (Add_Simple_Call_By_Copy_Code): Add comments
regarding special handling of components which depend on
discriminants.
* exp_dist.adb (Build_From_Any_Function): Add Real_Rep actual
for calls to Has_Stream_Attribute_Definition.
(Build_To_Any_Function): Likewise.
(Build_TypeCode_Function): Likewise.
* freeze.adb (Freeze_Entity): Add missing comment for Test_E.
* libgnat/s-utf_32.adb: Remove disabled warning comments and
temporarily inserted pragma warnings. Remove very old (2006 and
2012) comments about bootstrapping older versions.
* par.adb (P_Identifier): Add new parameter Force_Msg.
* par-ch2.adb (P_Identifier): Restructure and clean up function.
* par-ch3.adb (P_Defining_Identifier): Remove code duplication
for parsing identifiers.
* sem_attr.adb (Stream_Attribute_Available): Add missing
comments and add Real_Rep actual for calls to
Has_Stream_Attribute_Definition.
* sem_cat.adb (Has_Read_Write_Attribute): Add Real_Rep actual
for calls to Has_Stream_Attribute_Definition.
(Has_Stream_Attribute_Definition): Remove local Real_Rep and fix
recursive calls. Add default value for Real_Rep.
* sem_cat.ads (Has_Stream_Attribute_Definition): Add new out
parameter "Real_Rep".
* sem_type.adb (Add_Entry): Add condition to avoid passing
non-function calls to Function_Interp_Has_Abstract_Op.
(Function_Interp_Has_Abstract_Op): Add missing comments and
remove check for Is_Overloadable.
* sem_util.adb (Derivation_Too_Early_To_Inherit): Remove
duplicated code.
Javier Miranda [Mon, 29 Nov 2021 18:12:47 +0000 (18:12 +0000)]
[Ada] Crash in class-wide pre/postconditions
gcc/ada/
* contracts.adb (Restore_Original_Selected_Component): New
subprogram that traverses a preanalyzed expression searching for
dispatching calls to functions whose original node was a
selected component, and replacing them with their original node.
This functionality is required because the preanalyis of
dispatching calls using the Object.Operation notation transforms
such calls, and we need the original condition to properly
inherit and extend the condition expression on tagged type
derivations. This functionality was previously provided by the
routine Install_Original_Selected_Component (as part of
inheriting conditions); now it is performed as part of the
preanalysis of the condition, thus avoiding repeatedly
installing and restoring such nodes.
(Install_Original_Selected_Component): Removed.
(Restore_Dispatching_Calls): Removed.
Piotr Trojanek [Fri, 3 Dec 2021 12:23:36 +0000 (13:23 +0100)]
[Ada] Simplify repeated calls in printing of GNAT AST
gcc/ada/
* treepr.adb (Visit_Node): Simplify repeated call to
Next_Entity.
Piotr Trojanek [Thu, 2 Dec 2021 20:49:35 +0000 (21:49 +0100)]
[Ada] Simplify GNAT AST printing with simple GNAT hash table
gcc/ada/
* treepr.ads (Treepr, Print_Tree_List, Print_Tree_Elist): Fix
style in comments.
* treepr.adb (Serial_Numbers): Hash table instance.
(Hash): Hashing routine.
(Print_Field): Fix style.
(Print_Init): Adapt to simple hash table.
(Print_Term): Likewise.
(Serial_Numbers): Likewise.
(Set_Serial_Number): Likewise.
Yannick Moy [Thu, 2 Dec 2021 14:42:32 +0000 (15:42 +0100)]
[Ada] Proof of runtime unit for non-binary modular exponentiation
gcc/ada/
* libgnat/s-expmod.adb: Mark in SPARK. Add ghost code for proof.
* libgnat/s-expmod.ads: Mark in SPARK. Add ghost specifications.
Yannick Moy [Thu, 2 Dec 2021 09:55:04 +0000 (10:55 +0100)]
[Ada] Proof of runtime units for binary modular exponentiation
gcc/ada/
* libgnat/s-explllu.ads: Mark in SPARK.
* libgnat/s-expllu.ads: Mark in SPARK.
* libgnat/s-exponu.adb: Add loop invariants and needed
assertions.
* libgnat/s-exponu.ads: Add functional contract.
* libgnat/s-expuns.ads: Mark in SPARK.
Kito Cheng [Fri, 3 Dec 2021 15:50:54 +0000 (23:50 +0800)]
RISC-V: Minimal support of vector extensions
gcc/ChangeLog:
* common/config/riscv/riscv-common.c (riscv_implied_info): Add
vector extensions.
(riscv_ext_version_table): Add version info for vector extensions.
(riscv_ext_flag_table): Add option mask for vector extensions.
* config/riscv/riscv-opts.h (MASK_VECTOR_EEW_32): New.
(MASK_VECTOR_EEW_64): New.
(MASK_VECTOR_EEW_FP_32): New.
(MASK_VECTOR_EEW_FP_64): New.
(MASK_ZVL32B): New.
(MASK_ZVL64B): New.
(MASK_ZVL128B): New.
(MASK_ZVL256B): New.
(MASK_ZVL512B): New.
(MASK_ZVL1024B): New.
(MASK_ZVL2048B): New.
(MASK_ZVL4096B): New.
(MASK_ZVL8192B): New.
(MASK_ZVL16384B): New.
(MASK_ZVL32768B): New.
(MASK_ZVL65536B): New.
(TARGET_ZVL32B): New.
(TARGET_ZVL64B): New.
(TARGET_ZVL128B): New.
(TARGET_ZVL256B): New.
(TARGET_ZVL512B): New.
(TARGET_ZVL1024B): New.
(TARGET_ZVL2048B): New.
(TARGET_ZVL4096B): New.
(TARGET_ZVL8192B): New.
(TARGET_ZVL16384B): New.
(TARGET_ZVL32768B): New.
(TARGET_ZVL65536B): New.
* config/riscv/riscv.opt (Mask(VECTOR)): New.
(riscv_vector_eew_flags): New.
(riscv_zvl_flags): New.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/predef-14.c: New.
* gcc.target/riscv/predef-15.c: Ditto.
* gcc.target/riscv/predef-16.c: Ditto.
Kito Cheng [Fri, 3 Dec 2021 15:50:53 +0000 (23:50 +0800)]
RISC-V: Allow extension name contain digit
RISC-V spec only allow alphabetical name for extension before, however
vector extension add several extension named with digits, so we try to
extend the naming rule.
Ref:
https://github.com/riscv/riscv-isa-manual/pull/718
gcc/ChangeLog:
* common/config/riscv/riscv-common.c
(riscv_subset_list::parse_multiletter_ext): Allow ext. name has
digit.
Patrick Palka [Thu, 6 Jan 2022 15:42:50 +0000 (10:42 -0500)]
c++: Add testcase for recently fixed PR [PR69681]
Fixed ever since r12-6188.
PR c++/69681
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-compare2.C: New test.
Pavel I. Kryukov [Thu, 6 Jan 2022 12:32:36 +0000 (12:32 +0000)]
libstdc++: Add self-merge check to std::forward_list::merge [PR103853]
This implements the proposed resolution of LWG 3088, so that x.merge(x)
is a no-op, consistent with std::list::merge.
Signed-off-by: Pavel I. Kryukov <pavel.kryukov@phystech.edu>
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/103853
* include/bits/forward_list.tcc (forward_list::merge): Check for
self-merge.
* testsuite/23_containers/forward_list/operations/merge.cc: New test.
Jonathan Wakely [Thu, 6 Jan 2022 11:11:52 +0000 (11:11 +0000)]
libstdc++: Adjust friend declarations to work with Clang
I think this code is valid but it fails with Clang, possibly due to
https://llvm.org/PR38882
Qualifying the names makes it work for all compilers.
libstdc++-v3/ChangeLog:
* include/bits/regex.h (basic_regex, match_results): Qualify
name in friend declaration, to work around Clang bug.
Jonathan Wakely [Thu, 6 Jan 2022 11:10:31 +0000 (11:10 +0000)]
libstdc++: Increase timeout for pthread7-rope.cc test
This test spawns thousands of threads and so times out if the tests are
run with a low timeout value and the machine is busy.
libstdc++-v3/ChangeLog:
* testsuite/ext/rope/pthread7-rope.cc: Add dg-timeout-factor.
Jonathan Wakely [Wed, 5 Jan 2022 16:25:47 +0000 (16:25 +0000)]
libstdc++: Do not use std::isdigit in <charconv> [PR103911]
This avoids a potential race condition if std::setlocale is used
concurrently with std::from_chars.
libstdc++-v3/ChangeLog:
PR libstdc++/103911
* include/std/charconv (__from_chars_alpha_to_num): Return
char instead of unsigned char. Change invalid return value to
127 instead of using numeric trait.
(__from_chars_alnum): Fix comment. Do not use std::isdigit.
Change type of variable to char.
Jakub Jelinek [Thu, 6 Jan 2022 14:32:57 +0000 (15:32 +0100)]
expr: Workaround profiledbootstrap uninit false positive [PR103899]
The threader changes resulted in a false positive warning during
profiledbootstrap:
In file included from ../../gcc/expr.c:26:
../../gcc/tree.h: In function ‘rtx_def* expand_expr_real_1(tree, rtx, machine_mode, expand_modifier, rtx_def**, bool)’:
../../gcc/tree.h:244:56: error: ‘context’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
244 | #define TREE_CODE(NODE) ((enum tree_code) (NODE)->base.code)
| ^~~~
../../gcc/expr.c:10343:8: note: ‘context’ was declared here
10343 | tree context;
| ^~~~~~~
While it will be nice to improve the uninit pass to handle it if possible
(I do not want to close the PR until that is done), doing profiledbootstrap
is a common thing to do, so a workaround is handy, especially as in this
case when the workaround seems to be the right thing to do, as it moves
a variable declaration to the only place where it is set and used and avoids
the weird and for uninit asking
tree context;
...
if (exp)
context = ...;
gcc_assert (!exp
|| use (context)
|| use_some_more (context));
2022-01-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/103899
* expr.c (expand_expr_real_1): Add a workaround for bogus uninit
warning by moving context variable to the only spot where it is used
and moving gcc_assert into if body.
Olivier Hainque [Thu, 16 Dec 2021 13:50:25 +0000 (13:50 +0000)]
Add VxWworks fixincludes hack, don't expect yvals.h from gcc
yvals.h on VxWorks expects the toolchain to provide its own
version of the header, which we don't do. Arrange to fallback
on the common system definitions instead.
2021-12-16 Olivier Hainque <hainque@adacore.com>
fixincludes/
* inclhack.def (vxworks_next_yvals): New hack.
* tests/base/yvals.h: New expected test result.
* fixincl.x: Regenerate.
Jakub Jelinek [Thu, 6 Jan 2022 08:29:34 +0000 (09:29 +0100)]
ifcvt: Check for asm goto at the end of then_bb/else_bb in ifcvt [PR103908]
On the following testcase, RTL ifcvt sees then_bb
(note 7 6 8 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 8 7 9 3 (set (mem/c:SI (symbol_ref:DI ("b") [flags 0x2] <var_decl 0x7fdccf5b0cf0 b>) [1 b+0 S4 A32])
(const_int 1 [0x1])) "pr103908.c":6:7 81 {*movsi_internal}
(nil))
(jump_insn 9 8 13 3 (parallel [
(asm_operands/v ("# insn 1") ("") 0 []
[]
[
(label_ref:DI 21)
] pr103908.c:7)
(clobber (reg:CC 17 flags))
]) "pr103908.c":7:5 -1
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))
-> 21)
and similarly else_bb (just with a different asm_operands template).
It checks that those basic blocks have a single successor and
uses last_active_insn which intentionally skips over JUMP_INSNs, sees
both basic blocks contain the same set and merges them (or if the
sets are different, attempts some other noce optimization).
But we can't assume that the jump, even when it has only a single successor,
has no side-effects.
The following patch fixes it by punting if test_bb ends with a JUMP_INSN
that isn't onlyjump_p.
2022-01-06 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/103908
* ifcvt.c (bb_valid_for_noce_process_p): Punt on bbs ending with
asm goto.
* gcc.target/i386/pr103908.c: New test.
Marek Polacek [Wed, 5 Jan 2022 22:53:30 +0000 (17:53 -0500)]
Avoid more -Wformat-diag warnings [PR103758]
Let's use "%<x>, %<y>, or %<z>" rather than "[x|y|z]" as in the rest of
our codebase.
PR c++/103758
gcc/c-family/ChangeLog:
* c-pragma.c (handle_pragma_scalar_storage_order): Use %< %> in
diagnostic messages.
(handle_pragma_diagnostic): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/sso-6.c: Update dg-warning.
GCC Administrator [Thu, 6 Jan 2022 00:16:32 +0000 (00:16 +0000)]
Daily bump.
Bill Schmidt [Wed, 5 Jan 2022 22:53:29 +0000 (16:53 -0600)]
rs6000: Skip overload instances with uninitialized fntype (PR103622)
2022-01-05 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/103622
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
Skip over instances with undefined function types.
Andrew Pinski [Wed, 5 Jan 2022 22:00:07 +0000 (22:00 +0000)]
Fix target/103910: missing GTY on x86_mfence causing PCH usage to ICE
With -O3 -march=opteron, a mfence builtin is added after the loop
to say the nontemporal stores are no longer needed. This all good
without precompiled headers as the function decl that is referneced
by x86_mfence is referenced in another variable but with precompiled
headers, x86_mfence is all messed up and the decl was GC'ed away.
This fixes the problem by marking x86_mfence as GTY to save/restore
during precompiled headers just like most other variables in
the header file.
Committed as obvious after a bootstrap/test on x86_64-linux-gnu.
gcc/ChangeLog:
PR target/103910
* config/i386/i386.h (x86_mfence): Mark with GTY.
Uros Bizjak [Wed, 5 Jan 2022 22:16:34 +0000 (23:16 +0100)]
i386: Introduce V2QImode minmax, abs and uavgv2hi3_ceil [PR103861]
Add V2QImode minmax, abs and uavxv2qi3_ceil operations with SSE registers.
2022-01-05 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/103861
* config/i386/mmx.md (VI_16_32): New mode iterator.
(VI1_16_32): Ditto.
(mmxvecsize): Handle V2QI mode.
(<smaxmin:code><mode>3): Rename from <smaxmin:code>v4qi3.
Use VI1_16_32 mode iterator.
(<umaxmin:code><mode>3): Rename from <umaxmin:code>v4qi3.
Use VI1_16_32 mode iterator.
(abs<mode>2): Use VI_16_32 mode iterator.
(uavgv2qi3_ceil): New insn pattern.
gcc/testsuite/ChangeLog:
PR target/103861
* gcc.target/i386/pr103861-3.c: New test.
* g++.dg/vect/slp-pr98855.cc (dg-final): Check that
no vectorization using SLP was performed.
François Dumont [Mon, 20 Jan 2020 07:17:09 +0000 (08:17 +0100)]
libstdc++: Optimize operations on small size hashtable [PR 68303]
When hasher is identified as slow and the number of elements is limited in the
container use a brute-force loop on those elements to look for a given key using
the key_equal functor. For the moment the default threshold to consider the
container as small is 20.
libstdc++-v3/ChangeLog:
PR libstdc++/68303
* include/bits/hashtable_policy.h
(_Hashtable_hash_traits<_Hash>): New.
(_Hash_code_base<>::_M_hash_code(const _Hash_node_value<>&)): New.
(_Hashtable_base<>::_M_key_equals): New.
(_Hashtable_base<>::_M_equals): Use latter.
(_Hashtable_base<>::_M_key_equals_tr): New.
(_Hashtable_base<>::_M_equals_tr): Use latter.
* include/bits/hashtable.h
(_Hashtable<>::__small_size_threshold()): New, use _Hashtable_hash_traits.
(_Hashtable<>::find): Loop through elements to look for key if size is lower
than __small_size_threshold().
(_Hashtable<>::_M_emplace(true_type, _Args&&...)): Likewise.
(_Hashtable<>::_M_insert_unique(_Kt&&, _Args&&, const _NodeGenerator&)): Likewise.
(_Hashtable<>::_M_compute_hash_code(const_iterator, const key_type&)): New.
(_Hashtable<>::_M_emplace(const_iterator, false_type, _Args&&...)): Use latter.
(_Hashtable<>::_M_find_before_node(const key_type&)): New.
(_Hashtable<>::_M_erase(true_type, const key_type&)): Use latter.
(_Hashtable<>::_M_erase(false_type, const key_type&)): Likewise.
* src/c++11/hashtable_c++0x.cc: Include <bits/functional_hash.h>.
* testsuite/util/testsuite_performance.h
(report_performance): Use 9 width to display memory.
* testsuite/performance/23_containers/insert_erase/unordered_small_size.cc:
New performance test case.
Martin Sebor [Wed, 5 Jan 2022 20:28:37 +0000 (13:28 -0700)]
Avoid -Wformat-diag.
gcc/ChangeLog:
* gimple-ssa-warn-access.cc (pass_waccess::maybe_warn_memmodel): Use
%qs to avoid -Wformat-diag.
Uros Bizjak [Wed, 5 Jan 2022 19:08:15 +0000 (20:08 +0100)]
i386: Fix type of one_cmplv2qi2 alternatives 1,2 [PR103915]
2022-01-05 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/103915
* config/i386/mmx.md (one_cmplv2qi2): Change
alternatives 1,2 type from sselog to sselog1.
gcc/testsuite/ChangeLog:
PR target/103915
* gcc.target/i386/pr103915.c: New test.
Uros Bizjak [Wed, 5 Jan 2022 19:06:03 +0000 (20:06 +0100)]
i386: Fix expand_vec_perm_pshufb for narrow modes [PR103905]
2022-01-05 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/103905
* config/i386/i386-expand.c (expand_vec_perm_pshufb): Fix number of
narrow mode remapped elements for !one_operand_p case.
gcc/testsuite/ChangeLog:
PR target/103905
* gcc.target/i386/pr103905.c: New test.
Sandra Loosemore [Wed, 5 Jan 2022 02:18:13 +0000 (18:18 -0800)]
Fortran: Fix ICE caused by missing error for untyped symbol [PR103258]
The bit on a symbol to mark that it had already been diagnosed as
lacking a type was getting set even when the error was suppressed or
discarded, specifically when doing early resolution on a character
length expression to see if it can be constant-folded. Explicitly
suppress errors before doing that, then check whether they are
suppressed before setting the bit.
2022-01-04 Sandra Loosemore <sandra@codesourcery.com>
PR fortran/103258
gcc/fortran/
* decl.c (gfc_match_char_spec): Suppress errors around call
to gfc_reduce_init_expr.
* error.c (gfc_query_suppress_errors): New.
* gfortran.h (gfc_query_suppress_errors): Declare.
* symbol.c (gfc_set_default_type): Check gfc_query_suppress_errors.
gcc/testsuite/
* gfortran.dg/pr103258.f90: New.
Jonathan Wakely [Wed, 5 Jan 2022 15:16:33 +0000 (15:16 +0000)]
libstdc++: Fix overconstrained std::string constructor [PR103919]
The C++17 basic_string(const T&, size_t, size_t) constructor is
overconstrained, so it can't be used for a NTBS and a temporary string
gets constructed (potentially allocating memory). There is no
corresponding constructor taking an NTBS, so no need to disambiguate
from it. Accepting an NTBS avoids the temporary (and potential
allocation) and is what the standard requires.
libstdc++-v3/ChangeLog:
PR libstdc++/103919
* include/bits/basic_string.h (basic_string(const T&, size_t, size_t)):
Relax constraints on string_view parameter.
* include/bits/cow_string.h (basic_string(const T&, size_t, size_t)):
Likewise.
* testsuite/21_strings/basic_string/cons/char/103919.cc: New test.
Jonathan Wakely [Wed, 5 Jan 2022 14:25:37 +0000 (14:25 +0000)]
libstdc++: Implement P1328 "Making std::type_info::operator== constexpr"
This feature is present in the C++23 draft.
With Jakub's recent front-end changes we can implement constexpr
equality by comparing the addresses of std::type_info objects. We do not
need string comparisons, because for constant evaluation cases we know
we aren't dealing with std::type_info objects defined in other
translation units.
The ARM EABI requires that the type_info::operator== function can be
defined out-of-line (and suggests that should be the default), but to be
a constexpr function it must be defined inline (at least for C++23
mode). To meet these conflicting requirements we make the inline version
of operator== call a new __equal function when called at runtime. That
is an alias for the non-inline definition of operator== defined in
libsupc++.
libstdc++-v3/ChangeLog:
* config/abi/pre/gnu.ver (GLIBCXX_3.4.30): Export new symbol for
ARM EABI.
* include/bits/c++config (_GLIBCXX23_CONSTEXPR): Define.
* include/std/version (__cpp_lib_constexpr_typeinfo): Define.
* libsupc++/tinfo.cc: Add #error to ensure non-inline definition
is emitted.
(type_info::__equal): Define alias symbol.
* libsupc++/typeinfo (type_info::before): Combine different
implementations into one.
(type_info::operator==): Likewise. Use address equality for
constant evaluation. Call __equal for targets that require the
definition to be non-inline.
* testsuite/18_support/type_info/constexpr.cc: New test.
Jonathan Wakely [Wed, 22 Sep 2021 12:56:21 +0000 (13:56 +0100)]
libstdc++: Improvements to standard error category objects (part deux)
In r12-3860 the error categories in <system_error> were made final and
immortal, but I missed the categories for <future> and <ios>. This makes
the same changes to those.
libstdc++-v3/ChangeLog:
* src/c++11/cxx11-ios_failure.cc (io_error_category): Define
class and virtual functions as 'final'.
(io_category_instance): Use constinit union to make the object
immortal.
* src/c++11/future.cc (future_error_category): Define class and
virtual functions as 'final'.
(future_category_instance): Use constinit union.
Jonathan Wakely [Wed, 5 Jan 2022 14:06:43 +0000 (14:06 +0000)]
libstdc++: Fix std::error_code pretty printer for versioned namespace
libstdc++-v3/ChangeLog:
* python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Strip
versioned namespace from the type name that is printed.
Jonathan Wakely [Wed, 5 Jan 2022 11:16:06 +0000 (11:16 +0000)]
libstdc++: Add pretty printer for std::regex internals
This helps visualize the NFA states in a std::regex. It probably isn't
very useful for users, but helps when working on the implementation.
libstdc++-v3/ChangeLog:
* python/libstdcxx/v6/printers.py (StdRegexStatePrinter): New
printer for std::regex NFA states.
Jonathan Wakely [Wed, 5 Jan 2022 11:14:02 +0000 (11:14 +0000)]
libstdc++: Fix comments in std::forward_list tests
libstdc++-v3/ChangeLog:
* testsuite/23_containers/forward_list/operations/1.cc: Fill in
placeholders in comments.
* testsuite/23_containers/forward_list/operations/2.cc:
Likewise.
* testsuite/23_containers/forward_list/operations/3.cc:
Likewise.
* testsuite/23_containers/forward_list/operations/4.cc:
Likewise.
* testsuite/23_containers/forward_list/operations/5.cc:
Likewise.
* testsuite/23_containers/forward_list/operations/6.cc:
Likewise.
* testsuite/23_containers/forward_list/operations/7.cc:
Likewise.
Jonathan Wakely [Tue, 4 Jan 2022 21:57:16 +0000 (21:57 +0000)]
libstdc++: Avoid -Wzero-as-null-pointer-constant warning [PR103848]
libstdc++-v3/ChangeLog:
PR libstdc++/103848
* include/bits/stl_deque.h (operator-): Do not use 0 as null
pointer constant.
Jonathan Wakely [Tue, 4 Jan 2022 16:39:01 +0000 (16:39 +0000)]
libstdc++: Simplify std::allocator_traits<allocator<void>>::construct
We don't need a preprocessor condition to decide whether to use
placement new or std::construct_at, because std::_Construct already does
that.
libstdc++-v3/ChangeLog:
* include/bits/alloc_traits.h (allocator_traits<allocator<void>>):
Use std::_Construct for construct.
Jonathan Wakely [Tue, 4 Jan 2022 15:54:16 +0000 (15:54 +0000)]
libstdc++: Fix example preprocessor command in FAQ [PR103877]
libstdc++-v3/ChangeLog:
PR libstdc++/103877
* doc/xml/faq.xml: Add '-x c++' to preprocessor command.
* doc/html/faq.html: Regenerate.
Jonathan Wakely [Fri, 17 Dec 2021 18:04:28 +0000 (18:04 +0000)]
libstdc++: Reduce template instantiations in <regex>
This moves the last two template parameters of __regex_algo_impl to be
runtime function parameters instead, so that we don't need four
different instantiations for the possible ways to call it. Most of the
function (and what it instantiates) is the same in all cases, so making
them compile-time choices doesn't really have much benefit.
Use 'if constexpr' for conditions that check template parameters, so
that when we do depend on a compile-time condition we only instantiate
what we need to.
libstdc++-v3/ChangeLog:
* include/bits/regex.h (__regex_algo_impl): Change __policy and
__match_mode template parameters to be function parameters.
(regex_match, regex_search): Pass policy and match mode as
function arguments.
* include/bits/regex.tcc (__regex_algo_impl): Change template
parameters to function parameters.
* include/bits/regex_compiler.h (_RegexTranslatorBase): Use
'if constexpr' for conditions using template parameters.
(_RegexTranslator): Likewise.
* include/bits/regex_executor.tcc (_Executor::_M_handle_accept):
Likewise.
* testsuite/util/testsuite_regex.h (regex_match_debug)
(regex_search_debug): Move template arguments to function
arguments.
Jonathan Wakely [Fri, 17 Dec 2021 17:58:09 +0000 (17:58 +0000)]
libstdc++: Compare match_results for failed regex_match
The regex_match_debug testsuite helper doesn't compare the
std::match_results objects after a failed match, but it should do. The
standard says that the effects of a failed match on the match-results
are unspecified, except that [conditions testable by operator==]. So we
can check that the two sets of results compare equal even if the match
failed.
libstdc++-v3/ChangeLog:
* testsuite/util/testsuite_regex.h (regex_match_debug): Compare
results even if the match failed.
Jonathan Wakely [Thu, 16 Dec 2021 13:39:09 +0000 (13:39 +0000)]
libstdc++: Improve std::regex_error::what() strings
This replaces the vague "regex_error" for std::regex_error::what() with
a string that corresponds to the error_type enum passed to the
constructor. This allows us to remove many of the strings passed to
__throw_regex_error, because the default string is at least as good.
When a string argument to __throw_regex_error is kept it should add some
context-specific detail absent from the default string.
Also remove full stops (periods) from the end of those strings, to make
it easier to include them in logs and other output. I've left them
starting with an upper-case letter, which is consistent with strerror
output for (at least) Glibc, Solaris and BSD. I'm ambivalent whether
that's the right choice.
This also adds the missing noreturn attribute to __throw_regex_error.
libstdc++-v3/ChangeLog:
* include/bits/regex_compiler.tcc: Adjust all calls to
__throw_regex_error.
* include/bits/regex_error.h (__throw_regex_error): Add noreturn
attribute.
* include/bits/regex_scanner.tcc: Likewise.
* src/c++11/regex.cc (desc): New helper function.
(regex_error::regex_error(error_type)): Use desc to get a string
corresponding to the error code.
Nathan Sidwell [Tue, 4 Jan 2022 21:36:44 +0000 (13:36 -0800)]
[c++] Adjust mark used member in instantiated class scope
The fix for PR97966 caused a regression with (non-template) member
functions of template classes. We need to mark them used in the
instantiated class's scope, rather than the scope we were in before
instantiating, as the latter may itself be in template and change the
behaviour of marking a function as used.
gcc/cp/
* pt.c (instantiate_class_template_1): Process attribute((used)) set
in class's context.
gcc/testsuite/
* g++.dg/template/attr-used.C: New.
Nathan Sidwell [Tue, 4 Jan 2022 20:45:36 +0000 (12:45 -0800)]
Fix diagnostic recursion ICE
The [with T = $TYPE] diagnostic machinery must not cause recursion. So let's
not unilaterally warn about new alignment. (template extracted from Open3D.)
gcc/cp/
* init.c (build_new_1): Check complain before alignment warning.
gcc/testsuite/
* g++.dg/diagnostic/recur-align.C: New.
Nathan Sidwell [Tue, 4 Jan 2022 20:41:25 +0000 (12:41 -0800)]
DCO Entry
* MAINTAINERS: Add DCO entry. Sort that list.
Steve Baird [Wed, 1 Dec 2021 19:02:52 +0000 (11:02 -0800)]
[Ada] Improve support for casing on types with controlled parts
gcc/ada/
* exp_ch5.adb (Finish_Binding_Object_Declaration): Fix a bug
that was introduced in the previous commit. The previous
version initialized a Boolean constant Declare_Copy before the
variable Decl had been initialized properly.
Piotr Trojanek [Thu, 2 Dec 2021 14:44:57 +0000 (15:44 +0100)]
[Ada] Simplify detection of alphabetic characters with membership test
gcc/ada/
* sem_prag.adb (Adjust_External_Name_Case): Use membership test.
Piotr Trojanek [Wed, 1 Dec 2021 16:51:13 +0000 (17:51 +0100)]
[Ada] Expand controlling function wrapper into expression function
gcc/ada/
* exp_ch3.adb (Make_Controlling_Function_Wrappers): For
GNATprove build the wrapper as an expression function.
Piotr Trojanek [Wed, 24 Nov 2021 22:21:07 +0000 (23:21 +0100)]
[Ada] Expand controlling functions wrappers in GNATprove mode
gcc/ada/
* exp_ch3.ads (Make_Controlling_Function_Wrappers): Move
declaration from body to spec, so it can be called by
SPARK-specific expansion.
* exp_ch3.adb (Make_Controlling_Function_Wrappers): Likewise.
* exp_spark.adb (SPARK_Freeze_Type): Enable expansion of
wrappers for function with controlling result types.
Piotr Trojanek [Wed, 1 Dec 2021 15:58:47 +0000 (16:58 +0100)]
[Ada] Use Add_Char_To_Name_Buffer for 1-character strings
gcc/ada/
* exp_dbug.adb, sem_dim.adb: Replace Add_Str_To_Name_Buffer with
Add_Char_To_Name_Buffer.
Piotr Trojanek [Wed, 1 Dec 2021 15:54:43 +0000 (16:54 +0100)]
[Ada] Simplify calls to Name_Find with known string parameter
gcc/ada/
* gnatls.adb (Gnatls): Use Name_Find function.
* targparm.adb (Get_Target_Parameters): Likewise.
Bob Duff [Wed, 1 Dec 2021 17:28:00 +0000 (12:28 -0500)]
[Ada] Compiler crash with -gnatR2 and with of child
gcc/ada/
* repinfo.adb (List_Entities): The code was assuming that if we
encounter a package in the current scope, then it must be
a (physically) nested package. That was wrong, because it could
be a child package. Avoid recursing into child packages; they
have not been annotated with representation information, and
-gnatR2 queries that information.
Marc Poulhiès [Tue, 30 Nov 2021 15:48:50 +0000 (16:48 +0100)]
[Ada] Remove obsolete s-sopco* and s-strops units
gcc/ada/
* libgnat/s-sopco3.ads, libgnat/s-sopco3.adb: Remove.
* libgnat/s-sopco4.ads, libgnat/s-sopco4.adb: Remove.
* libgnat/s-sopco5.ads, libgnat/s-sopco5.adb: Remove.
* libgnat/s-strops.ads, libgnat/s-strops.adb: Remove.
* Makefile.rtl (ADA_EXCLUDE_SRCS): Remove occurences of removed
units.
* gcc-interface/Make-lang.in (ada/sdefault.o): Remove
dependencies on removed units.
(GNATBIND_OBJS): Remove occurences of removed units.
Piotr Trojanek [Mon, 29 Nov 2021 14:07:39 +0000 (15:07 +0100)]
[Ada] Remove extra whitespace in declarations and parameters lists
gcc/ada/
* exp_ch3.adb (Build_Dcheck_Function): Remove extra whitespace.
* libgnarl/s-taskin.adb (Initialize_ATCB): Likewise.
Piotr Trojanek [Mon, 29 Nov 2021 14:08:02 +0000 (15:08 +0100)]
[Ada] Remove explicit "in" in internal parameter association
gcc/ada/
* exp_attr.adb (Build_Array_VS_Func): Remove explicit "IN" in
spec of the generated array validation function; it was
redundant, just like it would be in a user-written code.
Piotr Trojanek [Mon, 29 Nov 2021 12:21:51 +0000 (13:21 +0100)]
[Ada] Align arrows in parameter associations
gcc/ada/
* exp_ch4.adb (Expand_N_Op_Ne): Fix whitespace.
* sem_dim.adb (Expand_Put_Call_With_Symbol): Likewise.
(Reduce): Likewise.
Piotr Trojanek [Mon, 29 Nov 2021 12:21:04 +0000 (13:21 +0100)]
[Ada] Remove extra space in parameter associations
gcc/ada/
* exp_aggr.adb (Two_Pass_Aggregate_Expansion): Fix whitespace.
* libgnat/a-cofuve.ads (Add): Likewise.
* sem_ch3.adb (Build_Access_Subprogram_Wrapper): Likewise.
Piotr Trojanek [Mon, 29 Nov 2021 12:14:44 +0000 (13:14 +0100)]
[Ada] Fix layout of parameters in calls to Predef_Spec_Or_Body
gcc/ada/
* exp_ch3.adb (Make_Eq_Body, Make_Neq_Body,
Make_Predefined_Primitive_Eq_Spec,
Make_Predefined_Primitive_Specs): Fix whitespace.
Etienne Servais [Mon, 15 Nov 2021 16:32:40 +0000 (17:32 +0100)]
[Ada] Fix condition to build subtype for discriminated types
gcc/ada/
* sem_ch3.adb (Analyze_Component_Declaration): Rework condition
to build subtypes.
(Analyze_Object_Declaration): Likewise.
(Should_Build_Subtype): New.
Yannick Moy [Tue, 30 Nov 2021 10:43:40 +0000 (11:43 +0100)]
[Ada] Add contracts for the proof of System.Arith_128
gcc/ada/
* libgnat/s-arit128.adb: Mark in SPARK.
* libgnat/s-arit128.ads: Add functional contracts.
Piotr Trojanek [Wed, 1 Dec 2021 14:53:45 +0000 (15:53 +0100)]
[Ada] Simplify handling of user-defined numeric literals
gcc/ada/
* sem_util.adb (String_From_Numeric_Literal): Simplify using
membership tests and ranges; fix whitespace.
Yannick Moy [Tue, 30 Nov 2021 14:11:32 +0000 (15:11 +0100)]
[Ada] Proof of runtime units for integer exponentiation (checks on)
gcc/ada/
* libgnat/s-expint.ads: Mark in SPARK. Adapt to change to
package.
* libgnat/s-explli.ads: Likewise.
* libgnat/s-expllli.ads: Likewise.
* libgnat/s-expont.adb: Add lemmas and ghost code.
* libgnat/s-expont.ads: Add functional contract.
Piotr Trojanek [Wed, 1 Dec 2021 14:30:46 +0000 (15:30 +0100)]
[Ada] Remove unnecessary check for missing parameter specifications
gcc/ada/
* exp_disp.adb (Gen_Parameters_Profile): Remove redundant guard.
Claire Dross [Wed, 1 Dec 2021 13:03:23 +0000 (14:03 +0100)]
[Ada] Introduce expression functions for contract of Scan_Exponent
gcc/ada/
* libgnat/s-valuti.ads (Starts_As_Exponent_Format_Ghost): Ghost
function to determine if a string is recognized as something
which might be an exponent.
(Is_Opt_Exponent_Format_Ghost): Ghost function to determine if a
string has the correct format for an optional exponent.
(Scan_Exponent): Use ghost functions to factorize contracts.
Bob Duff [Tue, 30 Nov 2021 21:00:40 +0000 (16:00 -0500)]
[Ada] Prevent Get_Current_Value_Condition from returning the same node
gcc/ada/
* exp_util.ads (Get_Current_Value_Condition): Belt: Add a
postcondition that Val /= Var.
* sem_util.adb (Known_Null): Suspenders: Raise Program_Error if
Get_Current_Value_Condition returned the same value. This will
be enabled even without assertions, because infinite recursion
is a nuisance -- better to crash if this bug ever occurs.
Piotr Trojanek [Tue, 30 Nov 2021 20:54:51 +0000 (21:54 +0100)]
[Ada] Simplify making of null procedure wrappers
gcc/ada/
* exp_ch3.adb (Make_Null_Procedure_Specs): Simplify by reusing
Copy_Subprogram_Spec.
* sem_util.ads (Copy_Subprogram_Spec): Add New_Sloc parameter.
* sem_util.adb (Copy_Subprogram_Spec): Pass New_Sloc to
New_Copy_Tree.
Yannick Moy [Mon, 29 Nov 2021 15:21:40 +0000 (16:21 +0100)]
[Ada] Proof of runtime units for integer exponentiation (checks off)
gcc/ada/
* libgnat/s-exnint.ads: Mark in SPARK. Adapt to change to
package.
* libgnat/s-exnlli.ads: Likewise.
* libgnat/s-exnllli.ads: Likewise.
* libgnat/s-exponn.adb: Add lemmas and ghost code. Secial case
value zero as Left or Right to simplify proof.
* libgnat/s-exponn.ads: Transform the generic function into a
generic package with a function inside. Add a functional
contract.
Piotr Trojanek [Tue, 30 Nov 2021 17:17:39 +0000 (18:17 +0100)]
[Ada] Remove redundant code related to instances with formal subprograms
gcc/ada/
* sem_ch12.adb (Instantiate_Formal_Subprogram): Remove redundant
call to Set_Defining_Unit_Name; a similar call is done few lines
below.
Piotr Trojanek [Tue, 30 Nov 2021 09:51:13 +0000 (10:51 +0100)]
[Ada] Fix sharing of formal parameters between wrapper spec and body
gcc/ada/
* exp_ch3.adb (Make_Controlling_Function_Wrappers): Create
distinct copies of parameter lists for spec and body with
Copy_Parameter_List; cleanup.
(Make_Null_Procedure_Specs): Fix style in comments; remove a
potentially unnecessary initialization of a local variable.
Bob Duff [Mon, 29 Nov 2021 12:45:00 +0000 (07:45 -0500)]
[Ada] Renamed_Entity should return Entity_Id
gcc/ada/
* einfo-utils.ads, einfo-utils.adb (Renamed_Entity Alias):
Change Node_Id to Entity_Id.
Piotr Trojanek [Mon, 29 Nov 2021 12:25:50 +0000 (13:25 +0100)]
[Ada] Deconstruct dead wrappers added for external axiomatization
gcc/ada/
* sem_ch12.ads (Build_Function_Wrapper, Build_Operator_Wrapper):
Remove unreferenced spec.
* sem_ch12.adb (Build_Function_Wrapper, Build_Operator_Wrapper):
Remove dead bodies.
Yannick Moy [Mon, 29 Nov 2021 16:52:56 +0000 (17:52 +0100)]
[Ada] Rename parameter-dependent constants in generic unit
gcc/ada/
* libgnat/s-aridou.adb: Apply replacement.
Yannick Moy [Mon, 29 Nov 2021 15:15:32 +0000 (16:15 +0100)]
[Ada] Fix lemma in generic unit System.Arith_Double
gcc/ada/
* libgnat/s-aridou.adb (Lemma_Word_Commutation): Fix for
instances with other values of Single_Size.
Marc Poulhiès [Wed, 17 Nov 2021 08:05:40 +0000 (09:05 +0100)]
[Ada] Remove Compiler_Unit[_Warning] pragmas
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst (Compiler_Unit)
(Compiler_Unit_Warning): Remove.
* gnat-style.texi, gnat_rm.texi, gnat_ugn.texi: Regenerate.
* libgnat/g-dynhta.ads: Add comment indicating this unit is
built during stage1.
* libgnat/g-dyntab.ads: Likewise.
* libgnat/g-graphs.ads: Likewise.
* libgnat/g-lists.ads: Likewise.
* libgnat/g-sets.ads: Likewise.
* libgnat/gnat.ads: Likewise.
* libgnat/s-pehage.ads: Likewise.
* libgnat/s-resfil.ads: Likewise.
* libgnat/s-rident.ads: Likewise.
* libgnat/s-utf_32.ads: Likewise.
* errout.ads: Update comment.
* opt.ads (Opt): Remove Compiler_Unit.
* par-ch5.adb (All_Pragmas): Remove call to Check_Compiler_Unit.
* sem_prag.adb (Analyze_Pragma): Likewise.
* sem_ch4.adb (Non_Static_Choice_Error, Analyze_If_Expression)
(Analyze_Set_Membership, Record_Interp): Likewise.
* sem_ch11.adb (Analyze_Raise_Expression): Likewise.
* sem_ch6.adb: Remove Restric package reference.
(Analyze_Extended_Return_Statement): Remove call to
Check_Compiler_Unit.
* par-prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Remove handling of Pragma_Compiler_Unit[_Warning}.
* restrict.adb (Check_Compiler_Unit): Remove both.
* restrict.ads: Likewise.
* snames.ads-tmpl (Pragma_Id): Remove
Pragma_Compiler_Unit[_Warning].
* libgnat/a-assert.ads: Remove pragma Compiler_Unit_Warning.
* libgnat/a-chlat1.ads: Likewise.
* libgnat/a-elchha.adb: Likewise.
* libgnat/a-elchha.ads: Likewise.
* libgnat/a-ioexce.ads: Likewise.
* libgnat/a-strhas.ads: Likewise.
* libgnat/g-byorma.adb: Likewise.
* libgnat/g-byorma.ads: Likewise.
* libgnat/g-dyntab.adb: Likewise.
* libgnat/g-heasor.ads: Likewise.
* libgnat/g-hesora.adb: Likewise.
* libgnat/g-hesora.ads: Likewise.
* libgnat/g-htable.adb: Likewise.
* libgnat/g-htable.ads: Likewise.
* libgnat/g-spchge.adb: Likewise.
* libgnat/g-spchge.ads: Likewise.
* libgnat/g-speche.adb: Likewise.
* libgnat/g-speche.ads: Likewise.
* libgnat/g-table.ads: Likewise.
* libgnat/g-u3spch.adb: Likewise.
* libgnat/g-u3spch.ads: Likewise.
* libgnat/interfac.ads: Likewise.
* libgnat/s-addope.adb: Likewise.
* libgnat/s-addope.ads: Likewise.
* libgnat/s-assert.adb: Likewise.
* libgnat/s-assert.ads: Likewise.
* libgnat/s-bitops.adb: Likewise.
* libgnat/s-bitops.ads: Likewise.
* libgnat/s-carun8.adb: Likewise.
* libgnat/s-carun8.ads: Likewise.
* libgnat/s-casuti.adb: Likewise.
* libgnat/s-casuti.ads: Likewise.
* libgnat/s-conca2.adb: Likewise.
* libgnat/s-conca2.ads: Likewise.
* libgnat/s-conca3.adb: Likewise.
* libgnat/s-conca3.ads: Likewise.
* libgnat/s-conca4.adb: Likewise.
* libgnat/s-conca4.ads: Likewise.
* libgnat/s-conca5.adb: Likewise.
* libgnat/s-conca5.ads: Likewise.
* libgnat/s-conca6.adb: Likewise.
* libgnat/s-conca6.ads: Likewise.
* libgnat/s-conca7.adb: Likewise.
* libgnat/s-conca7.ads: Likewise.
* libgnat/s-conca8.adb: Likewise.
* libgnat/s-conca8.ads: Likewise.
* libgnat/s-conca9.adb: Likewise.
* libgnat/s-conca9.ads: Likewise.
* libgnat/s-crc32.adb: Likewise.
* libgnat/s-crc32.ads: Likewise.
* libgnat/s-crtl.ads: Likewise.
* libgnat/s-excdeb.adb: Likewise.
* libgnat/s-excdeb.ads: Likewise.
* libgnat/s-except.ads: Likewise.
* libgnat/s-exctab.adb: Likewise.
* libgnat/s-exctab.ads: Likewise.
* libgnat/s-finmas.ads: Likewise.
* libgnat/s-htable.adb: Likewise.
* libgnat/s-htable.ads: Likewise.
* libgnat/s-mastop.adb: Likewise.
* libgnat/s-mastop.ads: Likewise.
* libgnat/s-memory.adb: Likewise.
* libgnat/s-memory.ads: Likewise.
* libgnat/s-os_lib.ads: Likewise.
* libgnat/s-parame.adb: Likewise.
* libgnat/s-parame.ads: Likewise.
* libgnat/s-parame__posix2008.ads: Likewise.
* libgnat/s-purexc.ads: Likewise.
* libgnat/s-resfil.adb: Likewise.
* libgnat/s-restri.adb: Likewise.
* libgnat/s-restri.ads: Likewise.
* libgnat/s-secsta.adb: Likewise.
* libgnat/s-secsta.ads: Likewise.
* libgnat/s-soflin.adb: Likewise.
* libgnat/s-soflin.ads: Likewise.
* libgnat/s-sopco3.adb: Likewise.
* libgnat/s-sopco3.ads: Likewise.
* libgnat/s-sopco4.adb: Likewise.
* libgnat/s-sopco4.ads: Likewise.
* libgnat/s-sopco5.adb: Likewise.
* libgnat/s-sopco5.ads: Likewise.
* libgnat/s-spsufi.ads: Likewise.
* libgnat/s-stache.adb: Likewise.
* libgnat/s-stache.ads: Likewise.
* libgnat/s-stalib.adb: Likewise.
* libgnat/s-stalib.ads: Likewise.
* libgnat/s-stoele.adb: Likewise.
* libgnat/s-stoele.ads: Likewise.
* libgnat/s-strcom.adb: Likewise.
* libgnat/s-strcom.ads: Likewise.
* libgnat/s-strhas.adb: Likewise.
* libgnat/s-string.adb: Likewise.
* libgnat/s-string.ads: Likewise.
* libgnat/s-strops.adb: Likewise.
* libgnat/s-strops.ads: Likewise.
* libgnat/s-ststop.adb: Likewise.
* libgnat/s-ststop.ads: Likewise.
* libgnat/s-traceb.adb: Likewise.
* libgnat/s-traceb.ads: Likewise.
* libgnat/s-traent.adb: Likewise.
* libgnat/s-traent.ads: Likewise.
* libgnat/s-utf_32.adb: Likewise.
* libgnat/s-unstyp.ads: Likewise.
* libgnat/s-wchcnv.adb: Likewise.
* libgnat/s-wchcnv.ads: Likewise.
* libgnat/s-wchcon.adb: Likewise.
* libgnat/s-wchcon.ads: Likewise.
* libgnat/s-wchjis.adb: Likewise.
* libgnat/s-wchjis.ads: Likewise.
Arnaud Charlet [Mon, 29 Nov 2021 10:04:36 +0000 (10:04 +0000)]
[Ada] Reduce runtime dependencies on stage1
gcc/ada/
* osint.adb (File_Names_Equal): Declare To_Lower locally.
* osint.ads (Null_FD): New.
* fmap.adb, sinput-l.adb, targparm.adb: Adapt to changes above.
* switch-b.adb (Scan_Debug_Switches): Use Is_Regular_File to
simplify the bootstrap dependencies.
Richard Biener [Wed, 5 Jan 2022 09:14:52 +0000 (10:14 +0100)]
tree-optimization/103816 - detect offset overflow in SLP group analysis
This makes sure to detect overflow when computing DR_GROUP_GAP
and DR_GROUP_SIZE more thoroughly so artificial testcases like the
added one are not fooling the existing check.
2022-01-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/103816
* tree-vect-data-refs.c (vect_analyze_group_access_1): Also
check DR_GROUP_GAP compute for overflow and representability.
* gcc.dg/torture/pr103816.c: New testcase.
Jakub Jelinek [Wed, 5 Jan 2022 09:45:26 +0000 (10:45 +0100)]
gimple-fold: Remove incorrect folding of debug stmts [PR103691]
For ADDR_EXPR gimple_debug_bind_get_value fold_stmt_1 uses
maybe_canonicalize_mem_ref_addr earlier and I think that should
resolve the concerns raised in PR52329. But folding ADDR_EXPR
operand using maybe_fold_reference and then taking address of that
looks like an invalid transformation, it can transform
# DEBUG D.4293 => &a[0]
into
# DEBUG D.4293 => &2.0e+0
etc., all we want to allow are the lhs folding of the operand which
maybe_fold_reference no longer does since r12-21-g0bf8cd9d5e8ac.
2022-01-05 Jakub Jelinek <jakub@redhat.com>
PR fortran/103691
* gimple-fold.c (fold_stmt_1): Don't call maybe_fold_reference
for DEBUG stmts with ADDR_EXPR gimple_debug_bind_get_value,
it can do unwanted rhs folding like &a[0] into &2.0 etc.
* gfortran.dg/pr103691.f90: New test.
Jakub Jelinek [Wed, 5 Jan 2022 09:03:18 +0000 (10:03 +0100)]
testsuite: Fix gcc.target/i386/pr103895.c testcase [PR103895]
The testcase uses SSE and SSE2 intrinsics, so fails on i686-linux
if -msse2 isn't enabled by default. Fixed by adding -msse2 to
dg-options.
2022-01-05 Jakub Jelinek <jakub@redhat.com>
PR target/103895
* gcc.target/i386/pr103895.c: Add -msse2 to dg-options.
Kewen Lin [Wed, 5 Jan 2022 02:27:18 +0000 (20:27 -0600)]
ipa-inline: Add target info into fn summary [PR102059]
Power ISA 2.07 (Power8) introduces transactional memory
feature but ISA3.1 (Power10) removes it. It exposes one
troublesome issue as PR102059 shows. Users define some
function with target pragma cpu=power10 then it calls one
function with attribute always_inline which inherits
command line option -mcpu=power8 which enables HTM
implicitly. The current isa_flags check doesn't allow this
inlining due to "target specific option mismatch" and error
mesasge is emitted.
Normally, the callee function isn't intended to exploit HTM
feature, but the default flag setting make it look it has.
As Richi raised in the PR, we have fp_expressions flag in
function summary, and allow us to check the function
actually contains any floating point expressions to avoid
overkill. So this patch follows the similar idea but is
more target specific, for this rs6000 port specific
requirement on HTM feature check, we would like to check
rs6000 specific HTM built-in functions and inline assembly,
it allows targets to do their own customized checks and
updates.
It introduces two target hooks need_ipa_fn_target_info and
update_ipa_fn_target_info. The former allows target to do
some previous check and decides to collect target specific
information for this function or not. For some special
case, it can predict the analysis result and set it early
without any scannings. The latter allows the
analyze_function_body to pass gimple stmts down just like
fp_expressions handlings, target can do its own tricks.
I put them together as one hook initially with one boolean
to indicate whether it's initial time, but the code looks a
bit ugly, to separate them seems to have better readability.
gcc/ChangeLog:
PR ipa/102059
* config/rs6000/rs6000.c (TARGET_NEED_IPA_FN_TARGET_INFO): New macro.
(TARGET_UPDATE_IPA_FN_TARGET_INFO): Likewise.
(rs6000_need_ipa_fn_target_info): New function.
(rs6000_update_ipa_fn_target_info): Likewise.
(rs6000_can_inline_p): Adjust for ipa function summary target info.
* config/rs6000/rs6000.h (RS6000_FN_TARGET_INFO_HTM): New macro.
* ipa-fnsummary.c (ipa_dump_fn_summary): Adjust for ipa function
summary target info.
(analyze_function_body): Adjust for ipa function summary target info
and call hook rs6000_need_ipa_fn_target_info and
rs6000_update_ipa_fn_target_info.
(ipa_merge_fn_summary_after_inlining): Adjust for ipa function summary
target info.
(inline_read_section): Likewise.
(ipa_fn_summary_write): Likewise.
* ipa-fnsummary.h (ipa_fn_summary::target_info): New member.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (TARGET_UPDATE_IPA_FN_TARGET_INFO): Document new hook.
(TARGET_NEED_IPA_FN_TARGET_INFO): Likewise.
* target.def (update_ipa_fn_target_info): New hook.
(need_ipa_fn_target_info): Likewise.
* targhooks.c (default_need_ipa_fn_target_info): New function.
(default_update_ipa_fn_target_info): Likewise.
* targhooks.h (default_update_ipa_fn_target_info): New declare.
(default_need_ipa_fn_target_info): Likewise.
gcc/testsuite/ChangeLog:
PR ipa/102059
* gcc.dg/lto/pr102059-1_0.c: New test.
* gcc.dg/lto/pr102059-1_1.c: New test.
* gcc.dg/lto/pr102059-1_2.c: New test.
* gcc.dg/lto/pr102059-2_0.c: New test.
* gcc.dg/lto/pr102059-2_1.c: New test.
* gcc.dg/lto/pr102059-2_2.c: New test.
* gcc.target/powerpc/pr102059-1.c: New test.
* gcc.target/powerpc/pr102059-2.c: New test.
* gcc.target/powerpc/pr102059-3.c: New test.
Ian Lance Taylor [Mon, 3 Jan 2022 20:47:50 +0000 (12:47 -0800)]
compiler: remove duplication of Named_object traversal
Adding type parameters was about to add a partial third version.
Remove the duplication to avoid that.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/375234
GCC Administrator [Wed, 5 Jan 2022 00:16:52 +0000 (00:16 +0000)]
Daily bump.
Martin Sebor [Tue, 4 Jan 2022 20:44:23 +0000 (13:44 -0700)]
Eenable -Winvalid-memory-order for C++ [PR99612].
Resolves:
PR middle-end/99612 - Remove "#pragma GCC system_header" from atomic file to warn on incorrect memory order
gcc/ChangeLog:
PR middle-end/99612
* builtins.c (get_memmodel): Move warning code to
gimple-ssa-warn-access.cc.
(expand_builtin_atomic_compare_exchange): Same.
(expand_ifn_atomic_compare_exchange): Same.
(expand_builtin_atomic_load): Same.
(expand_builtin_atomic_store): Same.
(expand_builtin_atomic_clear): Same.
* doc/extend.texi (__atomic_exchange_n): Update valid memory
models.
* gimple-ssa-warn-access.cc (memmodel_to_uhwi): New function.
(struct memmodel_pair): New struct.
(memmodel_name): New function.
(pass_waccess::maybe_warn_memmodel): New function.
(pass_waccess::check_atomic_memmodel): New function.
(pass_waccess::check_atomic_builtin): Handle memory model.
* input.c (expansion_point_location_if_in_system_header): Return
original location if expansion location is in a system header.
gcc/testsuite/ChangeLog:
PR middle-end/99612
* c-c++-common/pr83059.c: Adjust text of expected diagnostics.
* gcc.dg/atomic-invalid-2.c: Same.
* gcc.dg/atomic-invalid.c: Same.
* c-c++-common/Winvalid-memory-model.c: New test.
* g++.dg/warn/Winvalid-memory-model-2.C: New test.
* g++.dg/warn/Winvalid-memory-model.C: New test.
Uros Bizjak [Tue, 4 Jan 2022 18:41:47 +0000 (19:41 +0100)]
i386: Introduce V2QImode vectorized logic [PR103861]
Add V2QImode logic operations with SSE and GP registers and split
them to V4QImode SSE instructions or SImode GP instructions.
The patch also fixes PR target/103900.
2022-01-04 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/103861
* config/i386/mmx.md (one_cmplv2qi3): New insn pattern.
(one_cmplv2qi3 splitters): New post-reload splitters.
(*andnotv2qi3): New insn pattern.
(andnotv2qi3 splitters): New post-reload splitters.
(<any_logic:code>v2qi3): New insn pattern.
(<any_logic:insn>v2qi3 splitters): New post-reload splitters.
gcc/testsuite/ChangeLog:
PR target/103861
* gcc.target/i386/warn-vect-op-2.c: Adjust warnings.
* gcc.target/i386/pr103900.c: New test.
Jason Merrill [Thu, 30 Dec 2021 14:13:44 +0000 (09:13 -0500)]
c++: add begin/end to releasing_vec
So C++11 range-for will work.
gcc/cp/ChangeLog:
* cp-tree.h (class releasing_vec): Add begin/end fns.
Jason Merrill [Mon, 3 Jan 2022 21:49:24 +0000 (16:49 -0500)]
c++: add emacs c++-mode marker
gcc/cp/ChangeLog:
* init.c: Include -*- C++ -*- on first line.
Gaius Mulley [Tue, 4 Jan 2022 17:25:29 +0000 (17:25 +0000)]
MAINTAINERS: Change of email address.
Change email address in both DCO and Write After Approval list.
2022-01-04 Gaius Mulley <gaiusmod2@gmail.com>
ChangeLog:
* MAINTAINERS: Change of email address in both DCO and
Write After Approval list.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Richard Biener [Tue, 4 Jan 2022 14:49:50 +0000 (15:49 +0100)]
tree-optimization/103800 - sanity check more PHI vectorization
Bool pattern detection doesn't really handle PHIs well so we have
to be prepared for mismatched vector types in more cases than
originally thought.
2022-01-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/103800
* tree-vect-loop.c (vectorizable_phi): Remove assert and
expand comment.
* gcc.dg/vect/bb-slp-pr103800.c: New testcase.
Florian Weimer [Tue, 4 Jan 2022 14:47:30 +0000 (15:47 +0100)]
libgcc: Use _dl_find_object in _Unwind_Find_FDE
libgcc/ChangeLog:
* unwind-dw2-fde-dip.c (_Unwind_Find_FDE): Call _dl_find_object
if available.