test_jj.git
2 years agoDaily bump.
GCC Administrator [Thu, 6 Jan 2022 00:16:32 +0000 (00:16 +0000)]
Daily bump.

2 years agors6000: Skip overload instances with uninitialized fntype (PR103622)
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.

2 years agoFix target/103910: missing GTY on x86_mfence causing PCH usage to ICE
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.

2 years agoi386: Introduce V2QImode minmax, abs and uavgv2hi3_ceil [PR103861]
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.

2 years agolibstdc++: Optimize operations on small size hashtable [PR 68303]
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.

2 years agoAvoid -Wformat-diag.
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.

2 years agoi386: Fix type of one_cmplv2qi2 alternatives 1,2 [PR103915]
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.

2 years agoi386: Fix expand_vec_perm_pshufb for narrow modes [PR103905]
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.

2 years agoFortran: Fix ICE caused by missing error for untyped symbol [PR103258]
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.

2 years agolibstdc++: Fix overconstrained std::string constructor [PR103919]
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.

2 years agolibstdc++: Implement P1328 "Making std::type_info::operator== constexpr"
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.

2 years agolibstdc++: Improvements to standard error category objects (part deux)
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.

2 years agolibstdc++: Fix std::error_code pretty printer for versioned namespace
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.

2 years agolibstdc++: Add pretty printer for std::regex internals
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.

2 years agolibstdc++: Fix comments in std::forward_list tests
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.

2 years agolibstdc++: Avoid -Wzero-as-null-pointer-constant warning [PR103848]
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.

2 years agolibstdc++: Simplify std::allocator_traits<allocator<void>>::construct
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.

2 years agolibstdc++: Fix example preprocessor command in FAQ [PR103877]
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.

2 years agolibstdc++: Reduce template instantiations in <regex>
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.

2 years agolibstdc++: Compare match_results for failed regex_match
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.

2 years agolibstdc++: Improve std::regex_error::what() strings
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.

2 years ago[c++] Adjust mark used member in instantiated class scope
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.

2 years agoFix diagnostic recursion ICE
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.

2 years agoDCO Entry
Nathan Sidwell [Tue, 4 Jan 2022 20:41:25 +0000 (12:41 -0800)]
DCO Entry

* MAINTAINERS: Add DCO entry.  Sort that list.

2 years ago[Ada] Improve support for casing on types with controlled parts
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.

2 years ago[Ada] Simplify detection of alphabetic characters with membership test
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.

2 years ago[Ada] Expand controlling function wrapper into expression function
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.

2 years ago[Ada] Expand controlling functions wrappers in GNATprove mode
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.

2 years ago[Ada] Use Add_Char_To_Name_Buffer for 1-character strings
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.

2 years ago[Ada] Simplify calls to Name_Find with known string parameter
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.

2 years ago[Ada] Compiler crash with -gnatR2 and with of child
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.

2 years ago[Ada] Remove obsolete s-sopco* and s-strops units
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.

2 years ago[Ada] Remove extra whitespace in declarations and parameters lists
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.

2 years ago[Ada] Remove explicit "in" in internal parameter association
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.

2 years ago[Ada] Align arrows in parameter associations
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.

2 years ago[Ada] Remove extra space in parameter associations
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.

2 years ago[Ada] Fix layout of parameters in calls to Predef_Spec_Or_Body
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.

2 years ago[Ada] Fix condition to build subtype for discriminated types
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.

2 years ago[Ada] Add contracts for the proof of System.Arith_128
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.

2 years ago[Ada] Simplify handling of user-defined numeric literals
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.

2 years ago[Ada] Proof of runtime units for integer exponentiation (checks on)
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.

2 years ago[Ada] Remove unnecessary check for missing parameter specifications
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.

2 years ago[Ada] Introduce expression functions for contract of Scan_Exponent
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.

2 years ago[Ada] Prevent Get_Current_Value_Condition from returning the same node
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.

2 years ago[Ada] Simplify making of null procedure wrappers
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.

2 years ago[Ada] Proof of runtime units for integer exponentiation (checks off)
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.

2 years ago[Ada] Remove redundant code related to instances with formal subprograms
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.

2 years ago[Ada] Fix sharing of formal parameters between wrapper spec and body
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.

2 years ago[Ada] Renamed_Entity should return Entity_Id
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.

2 years ago[Ada] Deconstruct dead wrappers added for external axiomatization
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.

2 years ago[Ada] Rename parameter-dependent constants in generic unit
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.

2 years ago[Ada] Fix lemma in generic unit System.Arith_Double
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.

2 years ago[Ada] Remove Compiler_Unit[_Warning] pragmas
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.

2 years ago[Ada] Reduce runtime dependencies on stage1
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.

2 years agotree-optimization/103816 - detect offset overflow in SLP group analysis
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.

2 years agogimple-fold: Remove incorrect folding of debug stmts [PR103691]
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.

2 years agotestsuite: Fix gcc.target/i386/pr103895.c testcase [PR103895]
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.

2 years agoipa-inline: Add target info into fn summary [PR102059]
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.

2 years agocompiler: remove duplication of Named_object traversal
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

2 years agoDaily bump.
GCC Administrator [Wed, 5 Jan 2022 00:16:52 +0000 (00:16 +0000)]
Daily bump.

2 years agoEenable -Winvalid-memory-order for C++ [PR99612].
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.

2 years agoi386: Introduce V2QImode vectorized logic [PR103861]
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.

2 years agoc++: add begin/end to releasing_vec
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.

2 years agoc++: add emacs c++-mode marker
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.

2 years agoMAINTAINERS: Change of email address.
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>
2 years agotree-optimization/103800 - sanity check more PHI vectorization
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.

2 years agolibgcc: Use _dl_find_object in _Unwind_Find_FDE
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.

2 years agolibgomp/testsuite: Improve omp_get_device_num() tests
Tobias Burnus [Tue, 4 Jan 2022 13:58:06 +0000 (14:58 +0100)]
libgomp/testsuite: Improve omp_get_device_num() tests

Related to r12-6208-gebc853deb7cc0487de9ef6e891a007ba853d1933
"libgomp: Fix GOMP_DEVICE_NUM_VAR stringification during offload image load"

That commit fixed an issue with omp_get_device_num() on gcn/nvptx that
resulted in having always the value 0.
This commit modifies the tests to iterate over all devices such that on a
multi-nonhost-device system it had detected that always-zero issue.

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/target-45.c: Iterate over all devices.
* testsuite/libgomp.fortran/target10.f90: Likewise.

2 years agotree-optimization/103690 - not up-to-date SSA and PRE DCE
Richard Biener [Tue, 4 Jan 2022 10:59:35 +0000 (11:59 +0100)]
tree-optimization/103690 - not up-to-date SSA and PRE DCE

This avoids running simple_dce_from_worklist on partially not up-to-date
SSA form (in unreachable code regions) by scheduling CFG cleanup
manually as is done anyway when tail-merging runs.

2022-01-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/103690
* tree-pass.h (tail_merge_optimize): Adjust.
* tree-ssa-tail-merge.c (tail_merge_optimize): Pass in whether
to re-split critical edges, move CFG cleanup ...
* tree-ssa-pre.c (pass_pre::execute): ... here, before
simple_dce_from_worklist and delay freeing inserted_exprs from
...
(fini_pre): .. here.

2 years agonvptx: Transition nvptx backend to STORE_FLAG_VALUE = 1
Roger Sayle [Wed, 15 Dec 2021 14:09:48 +0000 (15:09 +0100)]
nvptx: Transition nvptx backend to STORE_FLAG_VALUE = 1

This patch to the nvptx backend changes the backend's STORE_FLAG_VALUE
from -1 to 1, by using BImode predicates and selp instructions, instead
of set instructions (almost always followed by integer negation).

Historically, it was reasonable (through rare) for backends to use -1
for representing true during the RTL passes.  However with tree-ssa,
GCC now emits lots of code that reads and writes _Bool values, requiring
STORE_FLAG_VALUE=-1 targets to frequently convert 0/-1 pseudos to 0/1
pseudos using integer negation.  Unfortunately, this process prevents
or complicates many optimizations (negate isn't associative with logical
AND, OR and XOR, and interferes with range/vrp/nonzerobits bounds etc.).

The impact of this is that for a relatively simple logical expression
like "return (x==21) && (y==69);", the nvptx backend currently generates:

                mov.u32 %r26, %ar0;
                mov.u32 %r27, %ar1;
                set.u32.eq.u32  %r30, %r26, 21;
                neg.s32 %r31, %r30;
                mov.u32 %r29, %r31;
                set.u32.eq.u32  %r33, %r27, 69;
                neg.s32 %r34, %r33;
                mov.u32 %r32, %r34;
                cvt.u16.u8      %r39, %r29;
                mov.u16 %r36, %r39;
                cvt.u16.u8      %r39, %r32;
                mov.u16 %r37, %r39;
                and.b16 %r35, %r36, %r37;
                cvt.u32.u16     %r38, %r35;
                cvt.u32.u8      %value, %r38;

This patch tweaks nvptx to generate 0/1 values instead, requiring the
same number of instructions, using (BImode) predicate registers and selp
instructions so as to now generate the almost identical:

                mov.u32 %r26, %ar0;
                mov.u32 %r27, %ar1;
                setp.eq.u32     %r31, %r26, 21;
                selp.u32        %r30, 1, 0, %r31;
                mov.u32 %r29, %r30;
                setp.eq.u32     %r34, %r27, 69;
                selp.u32        %r33, 1, 0, %r34;
                mov.u32 %r32, %r33;
                cvt.u16.u8      %r39, %r29;
                mov.u16 %r36, %r39;
                cvt.u16.u8      %r39, %r32;
                mov.u16 %r37, %r39;
                and.b16 %r35, %r36, %r37;
                cvt.u32.u16     %r38, %r35;
                cvt.u32.u8      %value, %r38;

The hidden benefit is that this sequence can (in theory) be optimized
by the RTL passes to eventually generate a much shorter sequence using
an and.pred instruction (just like Nvidia's nvcc compiler).

This patch has been tested nvptx-none with a "make" and "make -k check"
(including newlib) hosted on x86_64-pc-linux-gnu with no new failures.

gcc/ChangeLog:

* config/nvptx/nvptx.h (STORE_FLAG_VALUE): Change to 1.
* config/nvptx/nvptx.md (movbi): Use P1 constraint for true.
(setcc_from_bi): Remove SImode specific pattern.
(setcc<mode>_from_bi): Provide more general HSDIM pattern.
(extendbi<mode>2, zeroextendbi<mode>2): Provide instructions
for sign- and zero-extending BImode predicates to integers.
(setcc_int<mode>): Remove previous (-1-based) instructions.
(cstorebi4): Remove BImode to SImode specific expander.
(cstore<mode>4): Fix indentation.  Expand using setccsi_from_bi.
(cstore<mode>4): For both integer and floating point modes.

2 years agoAdjust VxWorks fixincludes hack for mkdir to work for C++
Olivier Hainque [Tue, 14 Jan 2020 10:25:35 +0000 (10:25 +0000)]
Adjust VxWorks fixincludes hack for mkdir to work for C++

For VxWorks, replace an attempt at providing a posix API for
mkdir via macro by a varargs prototype, which works better for
C++ references like std::mkdir(arg1, arg2).

2021-12-16  Olivier Hainque  <hainque@adacore.com>

fixincludes/
* inclhack.def (vxworks_posix_mkdir): Refine to expose a
varargs interface.
* tests/base/sys/stat.h: Update expected results.
* fixincl.x: Regenerate.

2 years agoRegister --sysroot in the driver switches table
Olivier Hainque [Mon, 20 Dec 2021 17:47:24 +0000 (17:47 +0000)]
Register --sysroot in the driver switches table

This change adjusts the processing of --sysroot to save the option in the
internal "switches" array, which lets self-specs test for it and provide a
default value possibly dependent on environment variables, as in

  --with-specs=%{!-sysroot*:--sysroot=%:getenv("WIND_BASE" /target)}

2021-12-20  Olivier Hainque  <hainque@adacore.com>

gcc/
* gcc.c (driver_handle_option): do_save --sysroot.

2 years agolibgomp: Fix GOMP_DEVICE_NUM_VAR stringification during offload image load
Chung-Lin Tang [Tue, 4 Jan 2022 09:26:23 +0000 (17:26 +0800)]
libgomp: Fix GOMP_DEVICE_NUM_VAR stringification during offload image load

In the patch that implemented omp_get_device_num(), there was an error where
the stringification of GOMP_DEVICE_NUM_VAR, which is the macro expanding to
the actual symbol used, was erroneously using the STRINGX() macro in the
libgomp offload image symbol search, and expansion of the variable name
string through the additional layer of preprocessor symbol was not properly
achieved.

This patch fixes this by changing to properly use XSTRING(), also from
include/symcat.h.

libgomp/ChangeLog:

* plugin/plugin-gcn.c (GOMP_OFFLOAD_load_image): Change uses of STRINGX
into XSTRING when looking for GOMP_DEVICE_NUM_VAR in offload image.
* plugin/plugin-nvptx.c (GOMP_OFFLOAD_load_image): Likewise.

2 years agotree-optimization/103864 - SLP reduction of reductions with conversions
Richard Biener [Tue, 4 Jan 2022 09:12:47 +0000 (10:12 +0100)]
tree-optimization/103864 - SLP reduction of reductions with conversions

This generalizes the fix for PR103544 to also cover reductions that
are not reduction chains and does not consider reductions wrapped in
sign conversions for SLP reduction handling.

2022-01-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/103864
PR tree-optimization/103544
* tree-vect-slp.c (vect_analyze_slp_instance): Exclude
reductions wrapped in conversions from SLP handling.
(vect_analyze_slp): Revert PR103544 change.

* gcc.dg/vect/pr103864.c: New testcase.

2 years agoshrink-wrapping: Don't call can_get_prologue unnecessarily [PR103860]
Jakub Jelinek [Tue, 4 Jan 2022 09:12:17 +0000 (10:12 +0100)]
shrink-wrapping: Don't call can_get_prologue unnecessarily [PR103860]

On Thu, Dec 30, 2021 at 04:08:25AM -0600, Segher Boessenkool wrote:
> > The following simple patch makes sure we call can_get_prologue even after
> > the last former iteration when vec is already empty and only break from
> > the loop afterwards (and only if the updating of pro done because of
> > !can_get_prologue didn't push anything into vec again).

During the development of the above patch I've noticed that in many cases
we call can_get_prologue often on the same pro again and again and again,
we can have many basic blocks pushed into vec and if most of those don't
require pro updates, i.e.
      basic_block bb = vec.pop ();
      if (!can_dup_for_shrink_wrapping (bb, pro, max_grow_size))
        while (!dominated_by_p (CDI_DOMINATORS, bb, pro))
isn't true, then pro is can_get_prologue checked for each bb in the vec.

The following simple patch just remembers which bb we've verified already
and verifies again only when pro changes.  Most of the patch is just
reindentation.

2022-01-04  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/103860
* shrink-wrap.c (try_shrink_wrapping): Don't call can_get_prologue
uselessly for blocks for which it has been called already.

2 years agox86: Update model value for Alderlake and Rocketlake
Cui,Lili [Tue, 4 Jan 2022 01:44:37 +0000 (09:44 +0800)]
x86: Update model value for Alderlake and Rocketlake

gcc/ChangeLog

* common/config/i386/cpuinfo.h (get_intel_cpu): Add new model values
to Alderlake and Rocketlake.

2 years agoopenmp: Fix ICE in gimplify_omp_affinity [PR103643]
Chung-Lin Tang [Tue, 4 Jan 2022 07:37:15 +0000 (15:37 +0800)]
openmp: Fix ICE in gimplify_omp_affinity [PR103643]

After the PR90030 patch, which removes the universal casting of all Fortran
array pointers to 'c_char*', a Fortran descriptor based array passed into an
affinity() clause now looks like:

-     #pragma omp task private(i) shared(b) affinity(*(c_char *) a.data)
+     #pragma omp task private(i) shared(b) affinity(*(integer(kind=4)[0:] * restrict) a.data)

The 'integer(kind=4)[0:]' incomplete type appears to be causing ICE during
gimplify_expr() due to 'is_gimple_val, fb_rvalue'. The ICE appears to be fixed
just by adjusting to 'is_gimple_lvalue, fb_lvalue'. Considering the use of the
affinity() clause, which should be specifying the location of a particular
object in memory, this probably makes sense.

gcc/ChangeLog:

PR middle-end/103643

* gimplify.c (gimplify_omp_affinity): Adjust gimplify_expr of entire
OMP_CLAUSE_DECL to use 'is_gimple_lvalue, fb_lvalue'

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/pr103643.f90: New test.

2 years agoForce_reg operand 1.
liuhongt [Tue, 4 Jan 2022 01:57:23 +0000 (09:57 +0800)]
Force_reg operand 1.

Avoid ICE of move pattern from memory to memory.

gcc/ChangeLog:

PR target/103895
* config/i386/sse.md (*bit_and_float_vector_all_ones):
Force_reg operand 1 to avoid ICE.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr103895.c: New test.

2 years ago[COMMITTED] c++: [PR90782] Add testcase
Andrew Pinski [Tue, 4 Jan 2022 02:53:47 +0000 (02:53 +0000)]
[COMMITTED] c++: [PR90782] Add testcase

This testcase was fixed by r12-1744-g3eecc1 as it make
sense it fixed a few other class deduction issues.
So I thought I would add a testcase for this PR and close
it as fixed.

Committed after a quick test of the testcase.

PR c++/90782

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/class-deduction100.C: New test.

2 years agotree-pretty-print: still indent unhandled codes
Jason Merrill [Wed, 29 Dec 2021 22:50:28 +0000 (17:50 -0500)]
tree-pretty-print: still indent unhandled codes

It would be nice to handle language-specific codes in the tree
pretty-printer, but until then we can at least indent them appropriately.

gcc/ChangeLog:

* tree-pretty-print.c (do_niy): Add spc parameter.
(NIY): Pass it.
(print_call_name): Add spc local variable.

2 years agoDaily bump.
GCC Administrator [Tue, 4 Jan 2022 00:16:40 +0000 (00:16 +0000)]
Daily bump.

2 years agoc-family: Have -Wformat-diag accept "decl-specifier" [PR103758]
Marek Polacek [Fri, 17 Dec 2021 19:34:12 +0000 (14:34 -0500)]
c-family: Have -Wformat-diag accept "decl-specifier" [PR103758]

I'm tired of seeing

cp/parser.c:15923:55: warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]
cp/parser.c:15925:57: warning: misspelled term 'decl' in format; use 'declaration' instead [-Wformat-diag]

every time I compile cp/parser.c, which happens...a lot.  I'd like my
compilation to be free of warnings, otherwise I'm going to miss some
important ones.

"decl-specifiers" is a C++ grammar term; it is not actual code, so
should not be wrapped with %< %>.  I hope we can accept it as an exception
in check_tokens.

It was surrounded by %< %> in cp_parser_decl_specifier_seq, so fix that.

In passing, fix a misspelling in missspellings.

PR c++/103758

gcc/c-family/ChangeLog:

* c-format.c (check_tokens): Accept "decl-specifier*".

gcc/cp/ChangeLog:

* parser.c (cp_parser_decl_specifier_seq): Replace %<decl-specifier%>
with %qD.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-condition.C: Adjust dg-error.

2 years agoi386: Always enable mov<V_32:mode> patterns [PR103894]
Uros Bizjak [Mon, 3 Jan 2022 19:58:16 +0000 (20:58 +0100)]
i386: Always enable mov<V_32:mode> patterns [PR103894]

Middle end tries to generate V4QImode moves to implement V2QImode inserts
and calls emit_move_multi_word when V4QImode moves are unavailable, as is
the case with 32-bit vector moves, constrainted with TARGET_SSE2.

However, this triggers

  gcc_assert (mode_size >= UNITS_PER_WORD);

in emit_move_multi_word, since mode_size of V4QImode operand is less than
UNITS_PER_WORD of 64-bit targets.

The patch unconditionally enables 32-bit vector moves to match 16-bit
vector moves.  This also enables implementation of 32-bit vector logic
operations with GPR in a follow-up patch.

2022-01-03  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

PR target/103894
* config/i386/mmx.md (mov<V_32:mode>): Remove TARGET_SSE2 constraint.
(mov<V_32:mode>_internal): Ditto.
(*push<V_32:mode>_rex64): Ditto.
(movmisalign<V_32:mode>): Ditto.
(*push<V_32:mode>_rex64 splitter): Enable for
TARGET_64BIT && TARGET_SSE.
(*push<V_32:mode>2): Remove insn pattern.

gcc/testsuite/ChangeLog:

PR target/103894
* gcc.target/i386/pr103894.c: New test.

2 years agoc++: Avoid narrowing in make_char_string_pack
Marek Polacek [Fri, 17 Dec 2021 19:52:38 +0000 (14:52 -0500)]
c++: Avoid narrowing in make_char_string_pack

This fixes

gcc/cp/parser.c:4618:41: warning: narrowing conversion of '(char)(*(str + ((sizetype)i)))' from 'char' to 'unsigned char' [-Wnarrowing]
 4618 |       unsigned char s[3] = { '\'', str[i], '\'' };
      |                                    ~~~~~^

gcc/cp/ChangeLog:

* parser.c (make_char_string_pack): Add a cast to const unsigned
char *.

2 years agoRevamp documentation for _Complex types extension
Andrew Pinski [Mon, 3 Jan 2022 01:40:34 +0000 (01:40 +0000)]
Revamp documentation for _Complex types extension

While cleaning up the bug database, I noticed there was a request
to improve the documentation of the _Complex type extensions.
So I rewrote part of the documentation to make things clearer on
__real/__imag and even added documentation about casts between
the scalar and the complex type.
I moved the documentation of __builtin_complex under this section
too because it makes more sense than having it in the other
built-in section and reference it.

OK? Built make info and make html and checked out the results to
make sure the tables look decent.

gcc/ChangeLog:

PR c/33193
* doc/extend.texi: Extend the documentation about Complex
types for casting and also rewrite the __real__/__imag__
expression portion to use tables.
Move __builtin_complex to the Complex type section.

2 years agoFortran: Fix array copy-in/copy-out for BIND(C) functions [PR103390]
Sandra Loosemore [Mon, 3 Jan 2022 16:47:38 +0000 (08:47 -0800)]
Fortran: Fix array copy-in/copy-out for BIND(C) functions [PR103390]

The Fortran front end was generating invalid code for the array
copy-out after a call to a BIND(C) function for a dummy with the
CONTIGUOUS attribute when the actual argument was a call to the SHAPE
intrinsic or other array expressions that are not lvalues.  It was
also generating code to evaluate the argument expression multiple
times on copy-in.  This patch teaches it to recognize that a copy is
not needed in these cases.

2022-01-03  Sandra Loosemore  <sandra@codesourcery.com>

PR fortran/103390

gcc/fortran/
* expr.c (gfc_is_simply_contiguous): Make it smarter about
function calls.
* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Do not generate
copy loops for array expressions that are not "variables" (lvalues).

gcc/testsuite/
* gfortran.dg/c-interop/pr103390-1.f90: New.
* gfortran.dg/c-interop/pr103390-2.f90: New.
* gfortran.dg/c-interop/pr103390-3.f90: New.
* gfortran.dg/c-interop/pr103390-4.f90: New.
* gfortran.dg/c-interop/pr103390-6.f90: New.
* gfortran.dg/c-interop/pr103390-7.f90: New.
* gfortran.dg/c-interop/pr103390-8.f90: New.
* gfortran.dg/c-interop/pr103390-9.f90: New.

2 years agoi386, fab: Optimize __atomic_{add,sub,and,or,xor}_fetch (x, y, z) {==,!=,<,<=,>,...
Jakub Jelinek [Mon, 3 Jan 2022 13:02:23 +0000 (14:02 +0100)]
i386, fab: Optimize __atomic_{add,sub,and,or,xor}_fetch (x, y, z) {==,!=,<,<=,>,>=} 0 [PR98737]

On Wed, Jan 27, 2021 at 12:27:13PM +0100, Ulrich Drepper via Gcc-patches wrote:
> On 1/27/21 11:37 AM, Jakub Jelinek wrote:
> > Would equality comparison against 0 handle the most common cases.
> >
> > The user can write it as
> > __atomic_sub_fetch (x, y, z) == 0
> > or
> > __atomic_fetch_sub (x, y, z) - y == 0
> > thouch, so the expansion code would need to be able to cope with both.
>
> Please also keep !=0, <0, <=0, >0, and >=0 in mind.  They all can be
> useful and can be handled with the flags.

<= 0 and > 0 don't really work well with lock {add,sub,inc,dec}, x86 doesn't
have comparisons that would look solely at both SF and ZF and not at other
flags (and emitting two separate conditional jumps or two setcc insns and
oring them together looks awful).

But the rest can work.

Here is a patch that adds internal functions and optabs for these,
recognizes them at the same spot as e.g. .ATOMIC_BIT_TEST_AND* internal
functions (fold all builtins pass) and expands them appropriately (or for
the <= 0 and > 0 cases of +/- FAILs and let's middle-end fall back).

So far I have handled just the op_fetch builtins, IMHO instead of handling
also __atomic_fetch_sub (x, y, z) - y == 0 etc. we should canonicalize
__atomic_fetch_sub (x, y, z) - y to __atomic_sub_fetch (x, y, z) (and vice
versa).

2022-01-03  Jakub Jelinek  <jakub@redhat.com>

PR target/98737
* internal-fn.def (ATOMIC_ADD_FETCH_CMP_0, ATOMIC_SUB_FETCH_CMP_0,
ATOMIC_AND_FETCH_CMP_0, ATOMIC_OR_FETCH_CMP_0, ATOMIC_XOR_FETCH_CMP_0):
New internal fns.
* internal-fn.h (ATOMIC_OP_FETCH_CMP_0_EQ, ATOMIC_OP_FETCH_CMP_0_NE,
ATOMIC_OP_FETCH_CMP_0_LT, ATOMIC_OP_FETCH_CMP_0_LE,
ATOMIC_OP_FETCH_CMP_0_GT, ATOMIC_OP_FETCH_CMP_0_GE): New enumerators.
* internal-fn.c (expand_ATOMIC_ADD_FETCH_CMP_0,
expand_ATOMIC_SUB_FETCH_CMP_0, expand_ATOMIC_AND_FETCH_CMP_0,
expand_ATOMIC_OR_FETCH_CMP_0, expand_ATOMIC_XOR_FETCH_CMP_0): New
functions.
* optabs.def (atomic_add_fetch_cmp_0_optab,
atomic_sub_fetch_cmp_0_optab, atomic_and_fetch_cmp_0_optab,
atomic_or_fetch_cmp_0_optab, atomic_xor_fetch_cmp_0_optab): New
direct optabs.
* builtins.h (expand_ifn_atomic_op_fetch_cmp_0): Declare.
* builtins.c (expand_ifn_atomic_op_fetch_cmp_0): New function.
* tree-ssa-ccp.c: Include internal-fn.h.
(optimize_atomic_bit_test_and): Add . before internal fn call
in function comment.  Change return type from void to bool and
return true only if successfully replaced.
(optimize_atomic_op_fetch_cmp_0): New function.
(pass_fold_builtins::execute): Use optimize_atomic_op_fetch_cmp_0
for BUILT_IN_ATOMIC_{ADD,SUB,AND,OR,XOR}_FETCH_{1,2,4,8,16} and
BUILT_IN_SYNC_{ADD,SUB,AND,OR,XOR}_AND_FETCH_{1,2,4,8,16},
for *XOR* ones only if optimize_atomic_bit_test_and failed.
* config/i386/sync.md (atomic_<plusminus_mnemonic>_fetch_cmp_0<mode>,
atomic_<logic>_fetch_cmp_0<mode>): New define_expand patterns.
(atomic_add_fetch_cmp_0<mode>_1, atomic_sub_fetch_cmp_0<mode>_1,
atomic_<logic>_fetch_cmp_0<mode>_1): New define_insn patterns.
* doc/md.texi (atomic_add_fetch_cmp_0<mode>,
atomic_sub_fetch_cmp_0<mode>, atomic_and_fetch_cmp_0<mode>,
atomic_or_fetch_cmp_0<mode>, atomic_xor_fetch_cmp_0<mode>): Document
new named patterns.

* gcc.target/i386/pr98737-1.c: New test.
* gcc.target/i386/pr98737-2.c: New test.
* gcc.target/i386/pr98737-3.c: New test.
* gcc.target/i386/pr98737-4.c: New test.
* gcc.target/i386/pr98737-5.c: New test.
* gcc.target/i386/pr98737-6.c: New test.
* gcc.target/i386/pr98737-7.c: New test.

2 years agomiddle-end/103851 - ensure SSA names are released during OMP lowering
Richard Biener [Mon, 3 Jan 2022 11:55:45 +0000 (12:55 +0100)]
middle-end/103851 - ensure SSA names are released during OMP lowering

This makes sure to release moved & remapped SSA names during OMP
outlining which happens before going into SSA but with SSA names
created by gimplification around.

2022-01-03  Richard Biener  <rguenther@suse.de>

PR middle-end/103851
* tree-cfg.c (move_sese_region_to_fn): Always release SSA names.

* g++.dg/gomp/pr103851.C: New testcase.

2 years agosymtab: Fold &a == &b to 0 if folding_initializer [PR94716]
Jakub Jelinek [Mon, 3 Jan 2022 12:47:53 +0000 (13:47 +0100)]
symtab: Fold &a == &b to 0 if folding_initializer [PR94716]

On Thu, Dec 09, 2021 at 06:09:12PM -0500, Jason Merrill wrote:
> For the more general comparison of decls like your a != b example above I
> think clang is in the right; in manifestly constant-evaluated context
> (folding_initializer) we should return that they are unequal and prevent a
> later alias declaration, like we do for comparison to 0 in
> maybe_nonzero_address.  It's possible that this gives a wrong answer based
> on something in another translation unit, but that's unlikely, and taking
> that chance seems better than rejecting code that needs a constant answer.

I agree.  This is an incremental patch to do that.

2022-01-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/94716
gcc/
* symtab.c: Include fold-const.h.
(symtab_node::equal_address_to): If folding_initializer is true,
handle it like memory_accessed.  Simplify.
gcc/testsuite/
* gcc.dg/init-compare-1.c: New test.
* g++.dg/cpp0x/constexpr-compare1.C: New test.
* g++.dg/cpp1y/constexpr-94716.C: New test.
* g++.dg/cpp1z/constexpr-compare1.C: New test.

2 years agotestsuite: fix ASAN errors in i386.exp tests
Martin Liska [Tue, 14 Dec 2021 15:22:25 +0000 (16:22 +0100)]
testsuite: fix ASAN errors in i386.exp tests

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx2-i32gatherpd256-4.c: Fix ASAN errors.
* gcc.target/i386/avx2-i32gatherq256-4.c: Likewise.
* gcc.target/i386/avx2-i64gatherpd256-4.c: Likewise.
* gcc.target/i386/avx2-i64gatherq256-4.c: Likewise.
* gcc.target/i386/avx2-vpabsb256-2.c: Likewise.
* gcc.target/i386/avx2-vpabsd256-2.c: Likewise.
* gcc.target/i386/avx2-vpabsw256-2.c: Likewise.
* gcc.target/i386/avx256-unaligned-load-7.c: Likewise.
* gcc.target/i386/avx256-unaligned-store-7.c: Likewise.
* gcc.target/i386/pr64291-1.c: Likewise.

2 years agotestsuite: fix vect.exp ASAN errors
Martin Liska [Wed, 15 Dec 2021 12:41:00 +0000 (13:41 +0100)]
testsuite: fix vect.exp ASAN errors

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-simd-18.c: Fix ASAN error.
* gcc.dg/vect/vect-simd-19.c: Likewise.

2 years agod: Merge upstream dmd 001bfd97b, druntime 759e6023, phobos 468788323.
Iain Buclaw [Sun, 2 Jan 2022 12:36:51 +0000 (13:36 +0100)]
d: Merge upstream dmd 001bfd97b, druntime 759e6023, phobos 468788323.

D front-end changes:

    - Import latest changes to mainline.
    - Fix bad format specifiers in front-end errors (PR103840).
    - Refactoring of some leaf modules to the dmd/root package.
    - Updating copyright notice dates and urls.

Phobos changes:

    - Import latest changes to mainline.

gcc/d/ChangeLog:

PR d/103840
* dmd/MERGE: Merge upstream dmd 001bfd97b.
* Make-lang.in (D_FRONTEND_OBJS): Rename d/complex.o to
d/root-complex.o, and d/utf.o to d/root/utf.o.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 759e6023.
* src/MERGE: Merge upstream phobos 468788323.

2 years agodocs: Use ; for function declarations.
Martin Liska [Mon, 3 Jan 2022 10:57:07 +0000 (11:57 +0100)]
docs: Use ; for function declarations.

gcc/ChangeLog:

* doc/extend.texi: Use ; for function declarations.

2 years agoc++: Support &typeid(x) == &typeid(y) and typeid(x) == typeid(y) in constant evaluati...
Jakub Jelinek [Mon, 3 Jan 2022 10:21:00 +0000 (11:21 +0100)]
c++: Support &typeid(x) == &typeid(y) and typeid(x) == typeid(y) in constant evaluation [PR103600]

If the tinfo vars are emitted in the current TU, they are emitted at the end
of the compilation, and for some types they are exported from
libstdc++/libsupc++ and not emitted in the current TU at all.

The following patch allows constant folding of comparisons of typeid
addresses and makes it possible to implement P1328R1 - making type_info
operator== constexpr (Jonathan has a patch for that).

As mentioned in the PR, the varpool/middle-end code is trying to be
conservative with address comparisons of different vars if those vars
don't bind locally, because of possible aliases in other TUs etc.
and so while match.pd folds &typeid(int) == &typeid(int) because
it is equality comparison with the same operands, for different typeids
it doesn't fold it.

On Wed, Dec 08, 2021 at 08:53:03AM -0500, Jason Merrill wrote:
> Would it make sense to assume that DECL_ARTIFICIAL variables can't be
> aliases?  If not, could we have some way of marking a variable as
> non-aliasing, perhaps an attribute?

I think DECL_ARTIFICIAL vars generally can overlap.

The following patch adds a GCC internal attribute "non overlapping"
and uses it in symtab_node::equal_address_to.
Not sure what plans has Honza in that area and whether it would be useful
to make the attribute public and let users assert that some variable will
never overlap with other variables, won't have aliases etc.

> During constant evaluation, the operator== could compare the type_info
> address instead of the __name address, reducing this to the previous
> problem.

Ah, indeed, good idea.  FYI, clang++ seems to constant fold
&typeid(x) != &typeid(y) already, so Jonathan could use it even for
clang++ in the constexpr operator==.  But it folds even
extern int &a, &b;
constexpr bool c = &a != &b;
regardless of whether some other TU has
int a;
int b __attribute__((alias (a));
or not.

2022-01-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/103600
gcc/
* symtab.c (symtab_node::equal_address_to): Return 0 if one of
VAR_DECLs has "non overlapping" attribute and rs1 != rs2.
gcc/c-family/
* c-attribs.c (handle_non_overlapping_attribute): New function.
(c_common_attribute_table): Add "non overlapping" attribute.
gcc/cp/
* rtti.c (get_tinfo_decl_direct): Add "non overlapping" attribute
to DECL_TINFO_P VAR_DECLs.
gcc/testsuite/
* g++.dg/cpp0x/constexpr-typeid2.C: New test.

2 years agotree-optimization/66502 - add testcase
Richard Biener [Mon, 3 Jan 2022 09:48:57 +0000 (10:48 +0100)]
tree-optimization/66502 - add testcase

This adds the second testcase which we now also handle eliminating
a redundant PHI node.

2022-01-03  Richard Biener  <rguenther@suse.de>

PR tree-optimization/66502
* gcc.dg/tree-ssa/ssa-fre-98.c: New testcase.

2 years agoUpdate copyright years.
Jakub Jelinek [Mon, 3 Jan 2022 09:42:10 +0000 (10:42 +0100)]
Update copyright years.

2 years agoAdd University of Illinois as external author
Jakub Jelinek [Mon, 3 Jan 2022 09:39:25 +0000 (10:39 +0100)]
Add University of Illinois as external author

* update-copyright.py: Add University of Illinois as external author.

2 years agoUpdate Copyright in ChangeLog files
Jakub Jelinek [Mon, 3 Jan 2022 09:31:39 +0000 (10:31 +0100)]
Update Copyright in ChangeLog files

Do this separately from all other Copyright updates, as ChangeLog files
can be modified only separately.

2 years agoUpdate copyright dates.
Jakub Jelinek [Mon, 3 Jan 2022 09:27:43 +0000 (10:27 +0100)]
Update copyright dates.

Manual part of copyright year updates.

2022-01-03  Jakub Jelinek  <jakub@redhat.com>

gcc/
* gcc.c (process_command): Update copyright notice dates.
* gcov-dump.c (print_version): Ditto.
* gcov.c (print_version): Ditto.
* gcov-tool.c (print_version): Ditto.
* gengtype.c (create_file): Ditto.
* doc/cpp.texi: Bump @copying's copyright year.
* doc/cppinternals.texi: Ditto.
* doc/gcc.texi: Ditto.
* doc/gccint.texi: Ditto.
* doc/gcov.texi: Ditto.
* doc/install.texi: Ditto.
* doc/invoke.texi: Ditto.
gcc/ada/
* gnat_ugn.texi: Bump @copying's copyright year.
* gnat_rm.texi: Likewise.
gcc/d/
* gdc.texi: Bump @copyrights-d year.
gcc/fortran/
* gfortranspec.c (lang_specific_driver): Update copyright notice
dates.
* gfc-internals.texi: Bump @copying's copyright year.
* gfortran.texi: Ditto.
* intrinsic.texi: Ditto.
* invoke.texi: Ditto.
gcc/go/
* gccgo.texi: Bump @copyrights-go year.
libgomp/
* libgomp.texi: Bump @copying's copyright year.
libitm/
* libitm.texi: Bump @copying's copyright year.
libquadmath/
* libquadmath.texi: Bump @copying's copyright year.

2 years agoRotate ChangeLog files - step 2 - remove 2021 entries from ChangeLog files.
Jakub Jelinek [Mon, 3 Jan 2022 09:23:34 +0000 (10:23 +0100)]
Rotate ChangeLog files - step 2 - remove 2021 entries from ChangeLog files.

Can't be committed together with the previous one due to the ChangeLog vs.
other files restrictions.