platform/upstream/gcc.git
2 years agoc-family: Fix up a -Wformat regression [PR104148]
Jakub Jelinek [Fri, 21 Jan 2022 21:44:53 +0000 (22:44 +0100)]
c-family: Fix up a -Wformat regression [PR104148]

As can be seen on the testcase, GCC 11 no longer warns if the format
string is wrapped inside of ()s.
This regressed with r11-2457-gdf5cf47a978, which added
if (TREE_NO_WARNING (param)) return;
to check_function_arguments_recurse.  That function is used with a callback
for two cases, for -Wformat and for -Wnonnull.  For the latter it is
desirable to not warn in parameters or their subexpressions where that
warning is suppressed, but for -Wformat the function is used solely
to discover the string literals if any so that the c-format.cc code can
diagnose them.  I believe no warning suppression should stand in the
way of that, -Wformat* warnings should be decided from warning suppression
on the CALL_EXPR only.
In the PR Martin argued that now that we have specialized
warning_suppressed_p we should use it, so instead of adding a bool
arg to check_function_arguments_recurse I've added opt_code to the
function, but will defer the warning_suppressed_p change to him.
For OPT_Wformat_ we don't want to call it anyway at all (as I said,
I think there should be no suppression for it during the string discovery,
there isn't just one -Wformat= option, there are many and
warning_suppression_p even with no_warnings actually tests the
TREE_NO_WARNING bit).
Initially, I thought I'd restrict also call to fn with format_arg attribute
handling in check_function_arguments_recurse to OPT_Wformat_ only, but
after looking around, it perhaps is intentional that way, most functions
with format_arg attribute don't have nonnull attribute for that arg too,
various gettext implementations handle NULL argument by passing it through,
but when result of gettext (NULL) etc. is passed to non-NULL argument, it
makes sense to warn.

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

PR c++/104148
* c-common.h (check_function_arguments_recurse): Add for_format
arg.
* c-common.cc (check_function_nonnull): Pass false to
check_function_arguments_recurse's last argument.
(check_function_arguments_recurse): Add for_format argument,
if true, don't stop on warning_suppressed_p.
* c-format.cc (check_format_info): Pass true to
check_function_arguments_recurse's last argument.

* c-c++-common/Wformat-pr104148.c: New test.

2 years agoc++: explain failing static_assert
Jason Merrill [Fri, 21 Jan 2022 16:03:26 +0000 (11:03 -0500)]
c++: explain failing static_assert

While looking at another bug I wanted the compiler to tell me what the two
unequal values were.

gcc/cp/ChangeLog:

* semantics.cc (find_failing_clause): Return expr if not
decomposable.
(finish_static_assert): Show constant values in failing
comparison.

gcc/testsuite/ChangeLog:

* g++.dg/template/explicit-args6.C: Add expected message.

2 years agoc++: class array new checking [PR104084]
Jason Merrill [Fri, 21 Jan 2022 17:49:03 +0000 (12:49 -0500)]
c++: class array new checking [PR104084]

My patch for PR20040 made us stop exiting early from build_new_1 in
cases of trivial initialization if there's a class operator delete; as a
result, code later in the function needs to handle this case properly.

PR c++/104084
PR c++/20040

gcc/cp/ChangeLog:

* init.cc (build_new_1): Only pull out TARGET_EXPR_INITIAL if
alloc_expr is a TARGET_EXPR.

gcc/testsuite/ChangeLog:

* g++.dg/init/new50.C: New test.

2 years agoDisable -fsplit-stack support on non-glibc targets
Sören Tempel [Fri, 21 Jan 2022 19:22:46 +0000 (19:22 +0000)]
Disable -fsplit-stack support on non-glibc targets

The -fsplit-stack option requires the pthread_t TCB definition in the
libc to provide certain struct fields at specific hardcoded offsets. As
far as I know, only glibc provides these fields at the required offsets.
Most notably, musl libc does not have these fields. However, since gcc
accesses the fields using a fixed offset, this does not cause a
compile-time error, but instead results in a silent memory corruption at
run-time with musl libc. For example, on s390x libgcc's
__stack_split_initialize CTOR will overwrite the cancel field in the
pthread_t TCB on musl.

The -fsplit-stack option is used within the gcc code base itself by
gcc-go (if available). On musl-based systems with split-stack support
(i.e. s390x or x86) this causes Go programs compiled with gcc-go to
misbehave at run-time.

This patch fixes gcc-go on musl by disabling -fsplit-stack in gcc itself
since it is not supported on non-glibc targets anyhow. This is achieved
by checking if gcc targets a glibc-based system. This check has been
added for x86 and s390x, the rs6000 config already checks for
TARGET_GLIBC_MAJOR. Other architectures do not have split-stack
support. With this patch applied, the gcc-go configure script will
detect that -fsplit-stack support is not available and will not use it.

See https://www.openwall.com/lists/musl/2012/10/16/12

This patch was written under the assumption that glibc is the only libc
implementation which supports the required fields at the required
offsets in the pthread_t TCB. The patch has been tested on Alpine Linux
Edge on the s390x and x86 architectures by bootstrapping Google's Go
implementation with gcc-go.

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
gcc/ChangeLog:

* common/config/s390/s390-common.cc (s390_supports_split_stack):
Only support split-stack on glibc targets.
* config/i386/gnu-user-common.h (STACK_CHECK_STATIC_BUILTIN): Ditto.
* config/i386/gnu.h (defined): Ditto.

2 years agors6000: Support vector float/double for vec_sldw
Bill Schmidt [Fri, 21 Jan 2022 19:13:11 +0000 (13:13 -0600)]
rs6000: Support vector float/double for vec_sldw

2022-01-21  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* config/rs6000/rs6000-overload.def (VEC_SLDW): Add instances for
vector float and vector double.

gcc/testsuite/
* gcc.target/powerpc/builtins-4.c: Add two test variants.  Adjust
assembler counts.

2 years agors6000: Fix bootstrap
Bill Seurer [Fri, 21 Jan 2022 19:04:38 +0000 (13:04 -0600)]
rs6000: Fix bootstrap

Fix a compilation issue in stage2 bootstrap.  Fixed as obvious (re:
discussion with Bill Schmidt).

2022-01-21  Bill Seurer  <seurer@gcc.gnu.org>

gcc/
* config/rs6000/rs6000.cc (rs6000_get_function_versions_dispatcher):
Fix mention of ifunc in string.

2 years agoPR middle-end/104140: bootstrap ICE on riscv.
Roger Sayle [Fri, 21 Jan 2022 18:42:30 +0000 (18:42 +0000)]
PR middle-end/104140: bootstrap ICE on riscv.

This patch resolves the P1 "ice-on-valid-code" regression boostrapping
GCC on risv-unknown-linux-gnu caused by my recent MULT_HIGHPART_EXPR
functionality.  RISC-V differs from x86_64 and many targets by
supporting a usmusidi3 instruction, basically a widening multiply
where one operand is signed and the other is unsigned.  Alas the
final version of my patch to recognize MULT_HIGHPART_EXPR didn't
sufficiently defend against the operands of WIDEN_MULT_EXPR having
different signedness.  This is fixed by the two-line change to
tree-ssa-math-opts.cc's convert_mult_to_highpart in the patch below.

The majority of the rest of the patch is to the documentation
(in tree.def and generic.texi).  It turns out that WIDEN_MULT_EXPR
wasn't previously documented in generic.texi, let alone the slightly
unusual semantics of allowing mismatched (signed vs unsigned) operands.
This also clarifies that MULT_HIGHPART_EXPR currently requires the
signedness of operands to match [but this might change in a future
release of GCC to support targets with usmul<mode>3_highpart].

The one final chunk of this patch (that is hopefully sufficiently
close to obvious for stage 4) is a similar (NULL pointer) sanity
check in riscv_cpu_cpp_builtins.  Currently running cc1 from the
command line (or from gdb) without specifying -march results in a
segmentation fault (ICE).  This is a minor annoyance tracking down
issues (in cross compilers) for riscv, and trivially fixed as below.

2022-01-22  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR middle-end/104140
* tree-ssa-math-opts.cc (convert_mult_to_highpart): Check that the
operands of the widening multiplication are either both signed or
both unsigned, and abort the conversion if mismatched.
* doc/generic.texi (WIDEN_MULT_EXPR): Describe expression node.
(MULT_HIGHPART_EXPR): Clarify that operands must have the same
signedness.
* tree.def (MULT_HIGHPART_EXPR): Document both operands must have
integer types with the same precision and signedness.
(WIDEN_MULT_EXPR): Document that operands must have integer types
with the same precision, but possibly differing signedness.
* config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Defend against
riscv_current_subset_list returning a NULL pointer (empty list).

gcc/testsuite/ChangeLog
PR middle-end/104140
* gcc.target/riscv/pr104140.c: New test case.

2 years ago[PR103676] LRA: Calculate and exclude some start hard registers for reload pseudos
Vladimir N. Makarov [Fri, 21 Jan 2022 18:34:32 +0000 (13:34 -0500)]
[PR103676] LRA: Calculate and exclude some start hard registers for reload pseudos

LRA and old reload pass uses only one register class for reload pseudos even if
operand constraints contain more one register class.  Let us consider
constraint 'lh' for thumb arm which means low and high thumb registers.
Reload pseudo for such constraint will have general reg class (union of
low and high reg classes).  Assigning the last low register to the reload
pseudo is wrong if the pseudo is of DImode as it requires two hard regs.
But it is considered OK if we use general reg class.  The following patch
solves this problem for LRA.

gcc/ChangeLog:

PR target/103676
* ira.h (struct target_ira): Add member
x_ira_exclude_class_mode_regs.
(ira_exclude_class_mode_regs): New macro.
* lra.h (lra_create_new_reg): Add arg exclude_start_hard_regs and
move from here ...
* lra-int.h: ... to here.
(lra_create_new_reg_with_unique_value): Add arg
exclude_start_hard_regs.
(class lra_reg): Add member exclude_start_hard_regs.
* lra-assigns.cc (find_hard_regno_for_1): Setup
impossible_start_hard_regs from exclude_start_hard_regs.
* lra-constraints.cc (get_reload_reg): Add arg exclude_start_hard_regs and pass
it lra_create_new_reg[_with_unique_value].
(match_reload): Ditto.
(check_and_process_move): Pass NULL
exclude_start_hard_regs to lra_create_new_reg_with_unique_value.
(goal_alt_exclude_start_hard_regs): New static variable.
(process_addr_reg, simplify_operand_subreg): Pass NULL
exclude_start_hard_regs to lra_create_new_reg_with_unique_value
and get_reload_reg.
(process_alt_operands): Setup goal_alt_exclude_start_hard_regs.
Use this_alternative_exclude_start_hard_regs additionally to find
winning operand alternative.
(base_to_reg, base_plus_disp_to_reg, index_part_to_reg): Pass NULL
exclude_start_hard_regs to lra_create_new_reg.
(process_address_1, emit_inc): Ditto.
(curr_insn_transform): Pass exclude_start_hard_regs value to
lra_create_new_reg, get_reload_reg, match_reload.
(inherit_reload_reg, split_reg): Pass NULL exclude_start_hard_regs
to lra_create_new_reg.
(process_invariant_for_inheritance): Ditto.
* lra-remat.cc (update_scratch_ops): Ditto.
* lra.cc (lra_create_new_reg_with_unique_value): Add arg
exclude_start_hard_regs.  Setup the corresponding member of
lra reg info.
(lra_create_new_reg): Add arg exclude_start_hard_regs and pass it
to lra_create_new_reg_with_unique_value.
(initialize_lra_reg_info_element): Initialize member
exclude_start_hard_regs.
(get_scratch_reg): Pass NULL to lra_create_new_reg.
* ira.cc (setup_prohibited_class_mode_regs): Rename to
setup_prohibited_and_exclude_class_mode_regs and calculate
ira_exclude_class_mode_regs.

gcc/testsuite/ChangeLog:

PR target/103676
* g++.target/arm/pr103676.C: New.

2 years agoc++: ICE with noexcept and canonical types [PR101715]
Marek Polacek [Fri, 14 Jan 2022 22:41:49 +0000 (17:41 -0500)]
c++: ICE with noexcept and canonical types [PR101715]

This is a "canonical types differ for identical types" ICE, which started
with r11-4682.  It's a bit tricky to explain.  Consider:

  template <typename T> struct S {
    S<T> bar() noexcept(T::value);  // #1
    S<T> foo() noexcept(T::value);  // #2
  };

  template <typename T> S<T> S<T>::foo() noexcept(T::value) {}  // #3

We ICE because #3 and #2 have the same type, but their canonical types
differ: TYPE_CANONICAL (#3) == #2 but TYPE_CANONICAL (#2) == #1.

The member functions #1 and #2 have the same type.  However, since their
noexcept-specifier is deferred, when parsing them, we create a variant for
both of them, because DEFERRED_PARSE cannot be compared.  In other words,
build_cp_fntype_variant's

  tree v = TYPE_MAIN_VARIANT (type);
  for (; v; v = TYPE_NEXT_VARIANT (v))
    if (cp_check_qualified_type (v, type, type_quals, rqual, raises, late))
      return v;

will *not* find an existing variant when creating a method_type for #2, so we
have to create a new one.

But then we perform delayed parsing and call fixup_deferred_exception_variants
for #1 and #2.  f_d_e_v will replace TYPE_RAISES_EXCEPTIONS with the newly
parsed noexcept-specifier.  It also sets TYPE_CANONICAL (#2) to #1.  Both
noexcepts turned out to be the same, so now we have two equivalent variants in
the list!  I.e.,

+-----------------+      +-----------------+      +-----------------+
|      main       |      |      #2         |      |      #1         |
| S S::<T379>(S*) |----->| S S::<T37c>(S*) |----->| S S::<T37a>(S*) |----->NULL
|    -            |      |  noex(T::value) |      |  noex(T::value) |
+-----------------+      +-----------------+      +-----------------+

Then we get to #3.  As for #1 and #2, grokdeclarator calls build_memfn_type,
which ends up calling build_cp_fntype_variant, which will use the loop
above to look for an existing variant.  The first one that matches
cp_check_qualified_type will be used, so we use #2 rather than #1, and the
TYPE_CANONICAL mismatch follows.  Hopefully that makes sense.

As for the fix, I didn't think I could rewrite the method_type #2 with #1
because the type may have escaped via decltype.  So my approach is to
elide #2 from the list, so when looking for a matching variant, we always
find #1 (#2 remains live though, which admittedly sounds sort of dodgy).

PR c++/101715

gcc/cp/ChangeLog:

* tree.cc (fixup_deferred_exception_variants): Remove duplicate
variants after parsing the exception specifications.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept72.C: New test.
* g++.dg/cpp0x/noexcept73.C: New test.

2 years agoStrengthen a few OpenACC test cases
Thomas Schwinge [Fri, 21 Jan 2022 11:48:28 +0000 (12:48 +0100)]
Strengthen a few OpenACC test cases

Rather than rubber-stamp whatever requested vs. actual device kernel launch
configuration happens, actually (again) verify the requested values (modulo
expected variations).

This better highlights that "AMD GCN has an upper limit of 'num_workers(16)'",
and the deficiency that "AMD GCN uses the autovectorizer for the vector
dimension: the use of a function call in vector-partitioned code [...] is not
currently supported".

And, this removes several instances of race conditions, where variables are
concurrently written to in OpenACC gang-redundant mode.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Strengthen.
* testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-v-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c: Likewise.

2 years agoc++: [[no_unique_address]] and virtual base [PR104139]
Jason Merrill [Fri, 21 Jan 2022 16:16:49 +0000 (11:16 -0500)]
c++: [[no_unique_address]] and virtual base [PR104139]

Fixing a thinko in my patch for 103681: when computing the size of a virtual
base, it would help to use its binfo instead of the one for the derived
class.

PR c++/104139
PR c++/103681

gcc/cp/ChangeLog:

* class.cc (end_of_class): Use base_binfo.

gcc/testsuite/ChangeLog:

* g++.dg/abi/no_unique_address2.C: Adjust to detect this on x86-64.

2 years agolibstdc++: Fix typo in comment
Jonathan Wakely [Fri, 21 Jan 2022 15:00:49 +0000 (15:00 +0000)]
libstdc++: Fix typo in comment

libstdc++-v3/ChangeLog:

* testsuite/20_util/shared_ptr/cons/array.cc: Fix comment.

2 years agolibstdc++: Ensure all feature test macros have type long [PR87193]
Jonathan Wakely [Fri, 21 Jan 2022 14:22:23 +0000 (14:22 +0000)]
libstdc++: Ensure all feature test macros have type long [PR87193]

This defines all the __cpp_lib_xxx macros as type long, as required by
the standard. We had an inconsistent mix of int and long, sometimes even
for the same macro name.

The __cpp_lib_experimental_xxx macros are left as type int, because
that's what it says in the relevant TS specs.

libstdc++-v3/ChangeLog:

PR libstdc++/87193
PR libstdc++/104019
* include/bits/alloc_traits.h (__cpp_lib_allocator_traits_is_always_equal):
Define as type long.
* include/bits/allocator.h (__cpp_lib_incomplete_container_elements):
Likewise.
* include/bits/basic_string.h (__cpp_lib_string_udls): Likewise.
* include/bits/chrono.h (__cpp_lib_chrono): Likewise.
(__cpp_lib_chrono_udls): Likewise.
* include/bits/move.h (__cpp_lib_addressof_constexpr): Likewise.
* include/bits/node_handle.h (__cpp_lib_node_extract): Likewise.
* include/bits/range_access.h (__cpp_lib_nonmember_container_access):
Likewise.
* include/bits/shared_ptr.h (__cpp_lib_enable_shared_from_this):
Likewise.
* include/bits/stl_algo.h (__cpp_lib_clamp): Likewise.
(__cpp_lib_sample): Likewise.
* include/bits/stl_algobase.h (__cpp_lib_robust_nonmodifying_seq_ops):
Likewise.
* include/bits/stl_function.h (__cpp_lib_transparent_operators):
Likewise.
* include/bits/stl_iterator.h (__cpp_lib_make_reverse_iterator):
Likewise.
* include/bits/stl_map.h (__cpp_lib_map_try_emplace):
Likewise.
* include/bits/stl_tree.h (__cpp_lib_generic_associative_lookup):
Likewise.
* include/bits/unique_ptr.h (__cpp_lib_make_unique):
Likewise.
* include/bits/unordered_map.h (__cpp_lib_unordered_map_try_emplace):
Likewise.
* include/c_global/cmath (__cpp_lib_hypot): Likewise.
* include/c_global/cstddef (__cpp_lib_byte): Likewise.
* include/std/atomic (__cpp_lib_atomic_is_always_lock_free):
Likewise.
* include/std/complex (__cpp_lib_complex_udls): Likewise.
* include/std/filesystem (__cpp_lib_filesystem): Likewise.
* include/std/functional (__cpp_lib_not_fn): Likewise.
(__cpp_lib_boyer_moore_searcher): Likewise.
* include/std/iomanip (__cpp_lib_quoted_string_io): Likewise.
* include/std/mutex (__cpp_lib_scoped_lock): Likewise.
* include/std/numeric (__cpp_lib_gcd_lcm): Likewise.
(__cpp_lib_gcd, __cpp_lib_lcm): Likewise.
* include/std/tuple (__cpp_lib_apply): Likewise.
(__cpp_lib_make_from_tuple): Likewise.
* include/std/type_traits (__cpp_lib_integral_constant_callable)
(__cpp_lib_bool_constant, __cpp_lib_logical_traits)
(__cpp_lib_is_null_pointer, __cpp_lib_transformation_trait_aliases)
(__cpp_lib_result_of_sfinae, __cpp_lib_void_t)
(__cpp_lib_is_swappable, __cpp_lib_is_invocable)
(__cpp_lib_has_unique_object_representations)
(__cpp_lib_is_aggregate): Likewise.
* include/std/version: Likewise.
* libsupc++/new (__cpp_lib_launder): Likewise.

2 years agolibstdc++: Fix condition for __cpp_lib_shared_ptr_arrays
Jonathan Wakely [Fri, 21 Jan 2022 14:56:08 +0000 (14:56 +0000)]
libstdc++: Fix condition for __cpp_lib_shared_ptr_arrays

I changed the preprocessor condition from <= to < in r12-6574 which
meant the macro was not defined by <version> for C++17.

libstdc++-v3/ChangeLog:

* include/std/version (__cpp_lib_shared_ptr_arrays): Fix
condition for C++17 definition.

2 years agoEnable configure detection of ld.mold.
Martin Liska [Fri, 21 Jan 2022 13:52:55 +0000 (14:52 +0100)]
Enable configure detection of ld.mold.

gcc/ChangeLog:

* configure.ac: Detect ld_is_mold and use it for
comdat_group=yes and gcc_cv_ld_hidden=yes.
* configure: Regenerate.

2 years agotree-optimization/100089 - BB vectorization of if-converted loop bodies
Richard Biener [Fri, 21 Jan 2022 12:29:06 +0000 (13:29 +0100)]
tree-optimization/100089 - BB vectorization of if-converted loop bodies

The PR complains that when we only partially BB vectorize an
if-converted loop body that this can leave unvectorized code
unconditionally executed and thus effectively slow down code.
For -O2 we already mitigated the issue by not doing BB vectorization
when not all if-converted stmts were covered but the issue is
present with -O3 as well.  Thus the following simply extends the
fix to cover all but the unlimited cost models.  It is after all
very likely that we vectorize some stmts, if only a single
paired store.

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

PR tree-optimization/100089
* tree-vect-slp.cc (vect_slp_region): Reject BB vectorization
of if-converted loops with unvectorized COND_EXPRs for
all but the unlimited cost models.

2 years agolibstdc++: Fix constexpr constructor for atomic<shared_ptr<T>>
Jonathan Wakely [Fri, 21 Jan 2022 11:55:22 +0000 (11:55 +0000)]
libstdc++: Fix constexpr constructor for atomic<shared_ptr<T>>

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count):
Add constexpr.
(_Sp_atomic::_M_ptr): Add default member-initializer.
* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
Check constant initialization.
* testsuite/20_util/weak_ptr/atomic_weak_ptr.cc: Likewise.

2 years agosanitizer/99673 - bad -Wstringop-overread diagnostic with asan
Richard Biener [Fri, 21 Jan 2022 12:57:12 +0000 (13:57 +0100)]
sanitizer/99673 - bad -Wstringop-overread diagnostic with asan

The testcase got fixed by lowering of &MEM[ptr + CST] to ptr + CST.

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

PR sanitizer/99673
* gcc.dg/asan/pr99673.c: New testcase.

2 years ago[ARM] Add support for TLS register based stack protector canary access
Ard Biesheuvel [Fri, 21 Jan 2022 12:09:34 +0000 (12:09 +0000)]
[ARM] Add support for TLS register based stack protector canary access

Add support for accessing the stack canary value via the TLS register,
so that multiple threads running in the same address space can use
distinct canary values. This is intended for the Linux kernel running in
SMP mode, where processes entering the kernel are essentially threads
running the same program concurrently: using a global variable for the
canary in that context is problematic because it can never be rotated,
and so the OS is forced to use the same value as long as it remains up.

Using the TLS register to index the stack canary helps with this, as it
allows each CPU to context switch the TLS register along with the rest
of the process, permitting each process to use its own value for the
stack canary.

gcc/ChangeLog:

* config/arm/arm-opts.h (enum stack_protector_guard): New.
* config/arm/arm-protos.h (arm_stack_protect_tls_canary_mem):
New.
* config/arm/arm.cc (TARGET_STACK_PROTECT_GUARD): Define.
(arm_option_override_internal): Handle and put in error checks.
for stack protector guard options.
(arm_option_reconfigure_globals): Likewise.
(arm_stack_protect_tls_canary_mem): New.
(arm_stack_protect_guard): New.
* config/arm/arm.md (stack_protect_set): New.
(stack_protect_set_tls): Likewise.
(stack_protect_test): Likewise.
(stack_protect_test_tls): Likewise.
(reload_tp_hard): Likewise.
* config/arm/arm.opt (-mstack-protector-guard): New
(-mstack-protector-guard-offset): New.
* doc/invoke.texi: Document new options.

gcc/testsuite/ChangeLog:

* gcc.target/arm/stack-protector-7.c: New test.
* gcc.target/arm/stack-protector-8.c: New test.

2 years agoaarch64: Adjust spellcheck tests for recent quotation-mark changes
Richard Earnshaw [Fri, 21 Jan 2022 11:29:40 +0000 (11:29 +0000)]
aarch64: Adjust spellcheck tests for recent quotation-mark changes

Adjust tests for quotation-mark and punctuation changes.

gcc/testsuite:

* gcc.target/aarch64/spellcheck_1.c: Adjust tests for new output.
* gcc.target/aarch64/spellcheck_2.c: Likewise.
* gcc.target/aarch64/spellcheck_3.c: Likewise.
* gcc.target/aarch64/spellcheck_7.c: Likewise.

2 years agotree-optimization/104156 - fix unswitching compare-debug issue
Richard Biener [Fri, 21 Jan 2022 09:19:58 +0000 (10:19 +0100)]
tree-optimization/104156 - fix unswitching compare-debug issue

When hoisting guards the unswitching pass does not properly ignore
debug stmts when looking for uses outside of the loop of defs
produced in the skipped region.  The following rectifies this
by instead collecting them and resetting them after the transform.

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

PR tree-optimization/104156
* tree-ssa-loop-unswitch.cc (tree_unswitch_outer_loop):
Collect and reset debug stmts with out-of-loop uses when
hoisting guards.
(find_loop_guard): Adjust.
(empty_bb_without_guard_p): Likewise.  Ignore debug stmts.
(used_outside_loop_p): Push debug uses to a vector of
debug stmts to reset.
(hoist_guard): Adjust -fopt-info category.

* gcc.dg/loop-unswitch-6.c: New testcase.

2 years agotree-optimization/104152 - add missing check for SLP constant build
Richard Biener [Fri, 21 Jan 2022 08:48:33 +0000 (09:48 +0100)]
tree-optimization/104152 - add missing check for SLP constant build

This adds a missing check to verify we can actually build an
invariant vector from components when SLP vectorizing an associatable
chain.

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

PR tree-optimization/104152
* tree-vect-slp.cc (vect_build_slp_tree_2): Add missing
can_duplicate_and_interleave_p check.

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

2 years agowarn-access: Fix up warning_at arguments
Jakub Jelinek [Fri, 21 Jan 2022 10:18:45 +0000 (11:18 +0100)]
warn-access: Fix up warning_at arguments

A warning regression fix I'm about to post warns (and breaks bootstrap due
to that) on the following spot.  Seems it is a copy and paste from
earlier code that mentions the %qD variable instead of talking about
unnamed temporary.

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

* gimple-ssa-warn-access.cc (pass_waccess::warn_invalid_pointer):
Avoid passing var to warning_at when the format string doesn't
refer to it.

2 years agoReset relations when crossing backedges.
Aldy Hernandez [Thu, 20 Jan 2022 09:28:26 +0000 (10:28 +0100)]
Reset relations when crossing backedges.

As discussed in PR103721, the problem here is that we are crossing a
backedge and causing us to use relations from a previous iteration of a
loop.

This handles the testcases in both PR103721 and PR104067 which are variants
of the same thing.

Tested on x86-64 Linux with the usual regstrap as well as verifying the
thread count before and after the patch.  The number of threads is
reduced by a miniscule amount.

gcc/ChangeLog:

PR tree-optimization/103721
* gimple-range-path.cc
(path_range_query::relations_may_be_invalidated): New.
(path_range_query::compute_ranges_in_block): Reset relations if
they may be invalidated.
(path_range_query::maybe_register_phi_relation): Exit if relations
may be invalidated on incoming edge.
(path_range_query::compute_phi_relations): Pass incoming PHI edge
to maybe_register_phi_relation.
* gimple-range-path.h (relations_may_be_invalidated): New.
(maybe_register_phi_relation): Pass edge instead of tree.
* tree-ssa-threadbackward.cc (back_threader::back_threader):
Mark DFS edges.
* value-relation.cc (path_oracle::path_oracle): Call
mark_dfs_back_edges.
(path_oracle::register_relation): Add SSA names to m_registered
bitmap.
(path_oracle::reset_path): Clear m_registered bitmap.
* value-relation.h (path_oracle::set_root_oracle): New.

gcc/testsuite/ChangeLog:

* gcc.dg/pr103721-2.c: New test.
* gcc.dg/pr103721.c: New test.

2 years agooptabs: Don't create pseudos in prepare_cmp_insn when not allowed [PR102478]
Jakub Jelinek [Fri, 21 Jan 2022 10:16:50 +0000 (11:16 +0100)]
optabs: Don't create pseudos in prepare_cmp_insn when not allowed [PR102478]

cond traps can be created during ce3 after reload (and e.g. PR103028
recently fixed some ce3 cond trap related bug, so I think often that
works fine and we shouldn't disable cond traps after RA altogether),
but it calls prepare_cmp_insn.  This function can fail, so I don't
see why we couldn't make it work after RA (in most cases it already
just works).  The first hunk is just an optimization which doesn't
make sense after RA, so I've guarded it with can_create_pseudo_p.
The second hunk is just a theoretical case, I don't have a testcase for it.
prepare_cmp_insn has some other spots that can create pseudos, like when
both operands have VOIDmode, or when it is BLKmode comparison, or
not OPTAB_DIRECT, but I think none of that applies to ce3, we punt on
BLKmode earlier, use OPTAB_DIRECT and shouldn't be comparing two
VOIDmode CONST_INTs.

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

PR rtl-optimization/102478
* optabs.cc (prepare_cmp_insn): If !can_create_pseudo_p (), don't
force_reg constants and for -fnon-call-exceptions fail if copy_to_reg
would be needed.

* gcc.dg/pr102478.c: New test.

2 years ago[committed] Fix expected output for various MIPS multiplication tests
Jeff Law [Fri, 21 Jan 2022 04:48:03 +0000 (23:48 -0500)]
[committed] Fix expected output for various MIPS multiplication tests

The recent multiply-highpart work twiddled code generation on the MIPS targets
and is causing mips.exp failures.

The resultant code is actually better and matches a comment in the test files
which indicates that it would be better to generate a mult-highpart.  So I'm
pretty confident in removing the undesired mflo & changing the name of the
target pattern we expect to see.

This fixes the mips64 and mips64el failures in my tester.  I suspect it'll
also fix the failures on mipsisa32, but that target is bootstrapped with qemu --
which takes forever so it only runs once a week ;-)

gcc/testsuite
* gcc.target/mips/fix-r4000-2.c: Update expected output.
* gcc.target/mips/fix-r4000-3.c: Update expected output.  Add
-fexpensive-optimizations for consistency in output.
* gcc.target/mips/fix-r4000-7.c: Update expected output.
* gcc.target/mips/fix-r4000-8.c: Update expected output.

2 years agoruntime: build panic32.go on amd64p32
Ian Lance Taylor [Fri, 21 Jan 2022 02:27:27 +0000 (18:27 -0800)]
runtime: build panic32.go on amd64p32

Fixes https://gcc.gnu.org/PR104149

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/380054

2 years agoDaily bump.
GCC Administrator [Fri, 21 Jan 2022 00:16:28 +0000 (00:16 +0000)]
Daily bump.

2 years agoanalyzer: reject ((i + 1 > 0) && (i < 0)) for integers [PR94362]
David Malcolm [Thu, 20 Jan 2022 14:51:50 +0000 (09:51 -0500)]
analyzer: reject ((i + 1 > 0) && (i < 0)) for integers [PR94362]

PR analyzer/94362 reports a false positive from
-Wanalyzer-null-dereference seen when analyzing OpenSSL.

The root cause is that the analyzer's path feasibility checker
erroneously considers this to be feasible:
  (R + 1 > 0) && (R < 0)
for int R (the return value from sk_EVP_PKEY_ASN1_METHOD_num),
whereas it's not satisfiable for any int R.

This patch makes the constraint manager try harder to reject
such combinations of conditions, fixing the false positive;
perhaps in the longer term we ought to use an SMT solver.

gcc/analyzer/ChangeLog:
PR analyzer/94362
* constraint-manager.cc (bound::ensure_closed): Convert param to
enum bound_kind.
(range::constrained_to_single_element): Likewise.
(range::add_bound): New.
(constraint_manager::add_constraint): Handle SVAL + OFFSET
compared to a constant.
(constraint_manager::get_ec_bounds): Rewrite in terms of
range::add_bound.
(constraint_manager::eval_condition): Reject if range::add_bound
fails.
(selftest::test_constant_comparisons): Add test coverage for
various impossible combinations of integer comparisons.
* constraint-manager.h (enum bound_kind): New.
(struct bound): Likewise.
(bound::ensure_closed): Convert to param to enum bound_kind.
(struct range): Convert to...
(class range): ...this, making fields private.
(range::add_bound): New decls.
* region-model.cc (region_model::add_constraint): Fail if
constraint_manager::add_constraint fails.

gcc/testsuite/ChangeLog:
PR analyzer/94362
* gcc.dg/analyzer/pr94362-1.c: New test.
* gcc.dg/analyzer/pr94362-2.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agoanalyzer: add regression test [PR103685]
David Malcolm [Wed, 19 Jan 2022 17:09:09 +0000 (12:09 -0500)]
analyzer: add regression test [PR103685]

PR analyzer/103685 reports a false positive from -Wanalyzer-null-dereference
seen at -O2 with GCC 11.  I can reproduce it with GCC 11, but not with
trunk; this patch adds a reduced test case that reproduces it with
GCC 11 as a regression test for GCC 12 onwards.

gcc/testsuite/ChangeLog:
PR analyzer/103685
* gcc.dg/analyzer/torture/pr103685.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agoFortran: Fix scope for OMP AFFINITY clause iterator variables [PR103695]
Sandra Loosemore [Thu, 20 Jan 2022 21:29:48 +0000 (13:29 -0800)]
Fortran: Fix scope for OMP AFFINITY clause iterator variables [PR103695]

gfc_finish_var_decl was confused by the undocumented overloading of
the proc_name field in struct gfc_namespace to contain iterator
variables for the OpenMP AFFINITY clause, causing it to insert the
decls in the wrong scope.  This patch adds a new distinct field to
hold these variables.

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

PR fortran/103695
PR fortran/102621

gcc/fortran
* gfortran.h (struct gfc_namespace) Add omp_affinity_iterator
field.
* dump-parse-tree.cc (show_iterator): Use it.
* openmp.cc (gfc_match_iterator): Likewise.
(resolve_omp_clauses): Likewise.
* trans-decl.cc (gfc_finish_var_decl): Likewise.
* trans-openmp.cc (handle_iterator): Likewise.

gcc/testsuite/
* gfortran.dg/gomp/affinity-clause-3.f90: Adjust pattern.
* gfortran.dg/gomp/pr102621.f90: New.
* gfortran.dg/gomp/pr103695.f90: New.

2 years agoc++: designator for base class member [PR101405]
Jason Merrill [Thu, 20 Jan 2022 14:18:45 +0000 (09:18 -0500)]
c++: designator for base class member [PR101405]

A C++20 designator must name a direct non-static member of the class; in
this case it names a member of a base class, and we should give an error
instead of crashing.

PR c++/101405

gcc/cp/ChangeLog:

* decl.cc (reshape_init_class): Reject designator for a member of
another class.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/desig20.C: New test.

2 years agoc++: Add test for fixed PR [PR102338]
Marek Polacek [Thu, 20 Jan 2022 20:00:11 +0000 (15:00 -0500)]
c++: Add test for fixed PR [PR102338]

This was fixed by r12-6025 and is sufficiently different from
noexcept71.C that I think we should add it.

PR c++/102338

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/noexcept2.C: New test.

2 years agoc++: add testcase for recently fixed PR [PR103631]
Patrick Palka [Thu, 20 Jan 2022 18:12:16 +0000 (13:12 -0500)]
c++: add testcase for recently fixed PR [PR103631]

We accept this testcase after r12-6773.

PR c++/103631

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class51.C: New test.

2 years agomiddle-end/100786 - constant folding from incompatible alias
Richard Biener [Thu, 20 Jan 2022 13:25:51 +0000 (14:25 +0100)]
middle-end/100786 - constant folding from incompatible alias

The following avoids us ICEing doing constant folding from variables
with aliases of different types.  The issue appears both in
folding and CCP and FRE can do more fancy stuff to still constant
fold cases where the load is smaller than the initializer so
defer it to there.

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

PR middle-end/100786
* gimple-fold.cc (get_symbol_constant_value): Only return
values of compatible type to the symbol.

* gcc.dg/torture/pr100786.c: New testcase.

2 years ago aarch64: allow ld1/stq in test output [PR102517]
Richard Earnshaw [Thu, 20 Jan 2022 15:41:37 +0000 (15:41 +0000)]
 aarch64: allow ld1/stq in test output [PR102517]

Following the changes to the inline memcpy operations get expanded, we
now generate ld1/st1 using a 128-bit vector register rather than ldp
with Q registers.  The behaviour is equivalent, so relax the tests to
permit either variant.

gcc/testsuite/ChangeLog:

PR target/102517
* gcc.target/aarch64/cpymem-q-reg_1.c: Allow ld1 and st1 for the
memcpy expansion.

2 years agoOnly add equivalencies that are still valid.
Andrew MacLeod [Tue, 18 Jan 2022 17:42:02 +0000 (12:42 -0500)]
Only add equivalencies that are still valid.

When equivalencies sets are merged, each member of the set should be queried
to ensure its still valid rather than a bulk union.

* value-relation.cc (relation_oracle::valid_equivs): Query and add
if valid members of a set.
(equiv_oracle::register_equiv): Call valid_equivs rather than
bitmap direct operations.
(path_oracle::register_equiv): Ditto.
* value-relation.h (relation_oracle::valid_equivs): New prototype.

2 years agoc++: CTAD inside alias template [PR91911, PR103672]
Patrick Palka [Thu, 20 Jan 2022 14:25:49 +0000 (09:25 -0500)]
c++: CTAD inside alias template [PR91911, PR103672]

In the first testcase below, when processing the alias template
ConstSpanType, transparency of alias template specializations means we
replace SpanType<T> with its instantiated definition.  But this
instantiation lowers the level of the CTAD placeholder for span{T()} from
2 to 1, and so the later instantiation of ConstSpanType<int> erroneously
substitutes this CTAD placeholder with the template argument at level 1
index 0, i.e. with int, before we get a chance to perform the CTAD.

Although we represent CTAD placeholders as template parameters, we never
actually want to replace them via tsubst.  So this patch adjusts tsubst
to handle CTAD placeholders by simply substituting the template and
returning a new CTAD placeholder.  Moreover, this means that the level
of a CTAD placeholder doesn't matter, so we may as well give them all
the same level.  This patch gives them the special level 0.

The change in tsubst_decl removes a likely dead !CHECKING_P safeguard
added in 2017, which would otherwise now get triggered for variables
with CTAD placeholder types (since their level is 0).

PR c++/91911
PR c++/103672

gcc/cp/ChangeLog:

* pt.cc (keep_template_parm): Punt on a level 0 template parm.
(tsubst_decl) <case VAR_DECL>: Remove !CHECKING_P safeguard.
(tsubst) <case TEMPLATE_TYPE_PARM>: Handle CTAD placeholders
specially.
(make_auto_1): Add defaulted 'level' parameter.
(make_template_placeholder): Pass 0 as 'level' to make_auto_1.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/class-deduction101.C: New test.
* g++.dg/cpp1z/class-deduction101a.C: New test.
* g++.dg/cpp1z/class-deduction101b.C: New test.
* g++.dg/cpp1z/class-deduction102.C: New test.
* g++.dg/cpp1z/class-deduction102a.C: New test.
* g++.dg/cpp1z/class-deduction102b.C: New test.
* g++.dg/cpp1z/class-deduction103.C: New test.

2 years agoc++: consistently diagnose bare CTAD placeholder in fn return type
Patrick Palka [Thu, 20 Jan 2022 14:22:27 +0000 (09:22 -0500)]
c++: consistently diagnose bare CTAD placeholder in fn return type

Relax slightly the existing check for diagnosing a bare CTAD placeholder
as the return type of a function declarator to also handle the abstract
declarator case.

gcc/cp/ChangeLog:

* decl.cc (grokdeclarator): Diagnose a CTAD placeholder as
function return type even when !funcdecl_p.

gcc/testsuite/ChangeLog:

* g++.dg/other/pr88187.C: Adjust expected C++17 diagnostic.

2 years agotarget/100784 - avoid ICE with folding __builtin_ia32_shufpd
Richard Biener [Thu, 20 Jan 2022 13:34:33 +0000 (14:34 +0100)]
target/100784 - avoid ICE with folding __builtin_ia32_shufpd

This avoids ICEing when there is no LHS on the call by following
what foldings of other builtins do in , namely not folding.

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

PR target/100784
* config/i386/i386.cc (ix86_gimple_fold_builtin): Check for
LHS before folding __builtin_ia32_shufpd and friends.

2 years agoMAINTAINERS: adjust requested email address
Martin Liska [Thu, 20 Jan 2022 12:40:42 +0000 (13:40 +0100)]
MAINTAINERS: adjust requested email address

ChangeLog:

* MAINTAINERS: Adjust email address based on IRC request.

2 years agolibstdc++: Use Clang attribute instead of __constinit
Jonathan Wakely [Thu, 20 Jan 2022 11:18:34 +0000 (11:18 +0000)]
libstdc++: Use Clang attribute instead of __constinit

Clang doesn't support the __constinit extension that we use pre-C++20,
but it does have its own equivalent attribute that can be used instead.

This makes it a little easier to use Clang to build libstdc++ (which
isn't supported. but is sometimes attempted for esoteric targets).

libstdc++-v3/ChangeLog:

* src/c++11/cxx11-ios_failure.cc (__constinit): Define as
equivalent attribute for Clang.
* src/c++11/future.cc (__constinit): Likewise.
* src/c++11/system_error.cc (__constinit): Likewise.
* src/c++17/memory_resource.cc (__constinit): Likewise.

2 years agolibstdc++: Only add valid -L paths to testsuite linker options
Jonathan Wakely [Thu, 20 Jan 2022 11:15:27 +0000 (11:15 +0000)]
libstdc++: Only add valid -L paths to testsuite linker options

The MacOS linker warns about -L arguments that don't exist, which causes
all tests to fail for the defauly configuration (because libbacktrace
isn't built).

libstdc++-v3/ChangeLog:

* scripts/testsuite_flags.in: Only add src/filesystem/.libs and
src/libbacktrace/.libs to LDFLAGS if those directories exist.

2 years agoarm: Add test for AES erratum mitigation
Richard Earnshaw [Mon, 17 Jan 2022 13:57:37 +0000 (13:57 +0000)]
arm: Add test for AES erratum mitigation

Add a testcase for the erratum mitigation.  To improve coverage
use -dp on the assembler output and match the pattern names (and where
needed the alternative number).

gcc/testsuite/ChangeLog:

* gcc.target/arm/crypto-vaese-erratum1.c: New test.

2 years agoarm: elide some cases where the AES erratum workaround is not required.
Richard Earnshaw [Fri, 14 Jan 2022 11:38:33 +0000 (11:38 +0000)]
arm: elide some cases where the AES erratum workaround is not required.

Some common cases where the AES erratum workaround are not required
are when there are 64- or 128-bit loads from memory, moving a 128-bit
value from core registers, and where a 128-bit constant is being
loaded from a literal pool.  The loads may also be misaligned or
generated via a neon intrinsic function.

gcc/ChangeLog:

* config/arm/crypto.md (aes_op_protect): Allow moves from core
registers and from memory.
(aes_op_protect_misalign_load): New pattern.
(aes_op_protect_neon_vld1v16qi): New pattern.

2 years agoarm: suppress aes erratum when forwarding from aes
Richard Earnshaw [Mon, 1 Nov 2021 13:23:26 +0000 (13:23 +0000)]
arm: suppress aes erratum when forwarding from aes

AES operations are commonly chained and since the result of one AES
operation is never a 32-bit value, they do not need an additional
mitigation instruction for the forwarded result.  We handle this
common case by adding additional patterns that allow for this.

gcc/ChangeLog:

* config/arm/crypto.md (crypto_<CRYPTO_AESMC:crypto_pattern>_protected):
New pattern.
(aarch32_crypto_aese_fused_protected): Likewise.
(aarch32_crypto_aesd_fused_protected): Likewise.

2 years agoarm: add basic mitigation for Cortex-A AES errata
Richard Earnshaw [Thu, 21 Oct 2021 16:29:41 +0000 (17:29 +0100)]
arm: add basic mitigation for Cortex-A AES errata

This patch adds the basic patterns for mitigation of the erratum, but no
attempt is made at this point to optimize the results for the cases where
the erratum mitigation is not needed.

The mitigation is done by guaranteeing that the input operands are fed
from a full-width operation by using an identity operation on the input
values.

gcc/ChangeLog:

* config/arm/crypto.md (crypto_<CRYPTO_AES:crypto_pattern>): Convert
to define_expand.  Add mitigation for the Cortex-A AES erratum
when enabled.
(*crypto_<CRYPTO_AES:crypto_pattern>_insn): New pattern, based
on original crypto_<CRYPTO_AES:crypto_pattern> insn.
(aes_op_protect): New pattern.
* config/arm/unspecs.md (unspec): Add UNSPEC_AES_PROTECT.

2 years agoarm: Add option for mitigating against Cortex-A CPU erratum for AES
Richard Earnshaw [Thu, 21 Oct 2021 15:20:49 +0000 (16:20 +0100)]
arm: Add option for mitigating against Cortex-A CPU erratum for AES

Add a new option -mfix-cortex-a-aes for enabling the Cortex-A AES
erratum work-around and enable it automatically for the affected
products (Cortex-A57 and Cortex-A72).

gcc/ChangeLog:

* config/arm/arm-cpus.in (quirk_aes_1742098): New quirk feature
(ALL_QUIRKS): Add it.
(cortex-a57, cortex-a72): Enable it.
(cortex-a57.cortex-a53, cortex-a72.cortex-a53): Likewise.
* config/arm/arm.opt (mfix-cortex-a57-aes-1742098): New command-line
option.
(mfix-cortex-a72-aes-1655431): New option alias.
* config/arm/arm.cc (arm_option_override): Handle default settings
for AES erratum switch.
* doc/invoke.texi (Arm Options): Document new options.

2 years agoarm: Consistently use crypto_mode attribute in crypto patterns
Richard Earnshaw [Thu, 21 Oct 2021 11:19:32 +0000 (12:19 +0100)]
arm: Consistently use crypto_mode attribute in crypto patterns

A couple of patterns in the crypto support code were hard-coding the
mode rather than using the iterators.  While not incorrect, it was
slightly confusing, so adapt those patterns to the style of the rest
of the file.

Also fix some white space issues.

gcc/ChangeLog:

* config/arm/crypto.md (crypto_<CYRPTO_AES:crypto_pattern>): Use
<crypto_mode> rather than hard-coding the mode.
(crypto_<CRYPTO_AESMC:crypto_pattern>): Fix white space.
(crypto_<CRYPTO_AES:crypto_pattern>): Likewise.
(*aarch32_crypto_aese_fused): Likewise.
(*aarch32_crypto_aesd_fused): Likewise.
(crypto_<CRYPTO_BINARY:crypto_pattern>): Likewise.
(crypto_<CRYPTO_TERNARY:crypto_pattern>): Likewise.
(crypto_sha1h_lb): Likewise.
(crypto_vmullp64): Likewise.
(crypto_<CRYPTO_SELECTING:crypto_pattern>): Likewise.
(crypto_<CRYPTO_SELECTING:crypto_pattern>_lb): Likewise.

2 years agoarm: Disambiguate multiple crypto patterns with the same name.
Richard Earnshaw [Thu, 21 Oct 2021 11:30:21 +0000 (12:30 +0100)]
arm: Disambiguate multiple crypto patterns with the same name.

No functional change, but arm/crypto.md has multiple pattenrs all
called crypto_<crypto_pattern>, which makes references to them
ambiguous, so add the iterator base to the pattern name so that it is
distinct in the commit logs.

gcc/ChangeLog:

* config/arm/crypto.md (crypto_<CRYPTO_AESMC:crypto_pattern>): Add
iterator to pattern name to disambiguate.
(crypto_<CRYPTO_AES:crypto_pattern>): Likewise.
(crypto_<CRYPTO_BINARY:crypto_pattern>): Likewise.
(crypto_<CRYPTO_TERNARY:crypto_pattern>): Likewise.
(crypto_<CRYPTO_SELECTING:crypto_pattern>): Likewise.
(crypto_<CRYPTO_SELECTING:crypto_pattern>_lb): Likewise.

2 years agoFix Werror=format-diag with --disable-nls.
Martin Liska [Thu, 20 Jan 2022 08:30:01 +0000 (09:30 +0100)]
Fix Werror=format-diag with --disable-nls.

PR c++/104134

gcc/cp/ChangeLog:

* error.cc (dump_aggr_type): Partially disable the warning.

2 years agoFix -Werror=format-diag with RTL checking
Martin Liska [Thu, 20 Jan 2022 08:28:42 +0000 (09:28 +0100)]
Fix -Werror=format-diag with RTL checking

PR bootstrap/104135

gcc/ChangeLog:

* emit-rtl.cc (make_insn_raw): Fix -Wformat-diag warnings.
* rtl.cc: Partially disable -Wformat-diag for RTL checking
error messages.

2 years agodwarf2out: Fix -gsplit-dwarf on riscv [PR103874]
Jakub Jelinek [Thu, 20 Jan 2022 10:58:20 +0000 (11:58 +0100)]
dwarf2out: Fix -gsplit-dwarf on riscv [PR103874]

riscv*-*-* are the only modern targets that !HAVE_AS_LEB128 (apparently
due to some aggressive linker optimizations).
As the following testcase shows, we mishandle in index_rnglists the
!HAVE_AS_LEB128 && !have_multiple_function_sections case.

output_rnglists does roughly:
  FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r)
    {
...
      if (block_num > 0)
        {
...
          if (HAVE_AS_LEB128)
            {
              if (!have_multiple_function_sections)
                {
                  // code not using r->*_entry
                  continue;
                }
              // code that sometimes doesn't use r->*_entry,
              // sometimes r->begin_entry
            }
          else if (dwarf_split_debug_info)
            {
              // code that uses both r->begin_entry and r->end_entry
            }
          else
            {
              // code not using r->*_entry
            }
        }
      else if (block_num < 0)
        {
          if (!have_multiple_function_sections)
            gcc_unreachable ();
...
        }
    }
and index_rnglists is what sets up those r->{begin,end}_entry members.
The code did an early if (!have_multiple_function_sections) continue;
which is fine for the HAVE_AS_LEB128 case, because r->*_entry is not
used in that case, but not for !HAVE_AS_LEB128 that uses it anyway.

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

PR debug/103874
* dwarf2out.cc (index_rnglists): For !HAVE_AS_LEB128 and
block_num > 0, index entry even if !have_multiple_function_sections.

* gcc.dg/debug/dwarf2/pr103874.c: New test.

2 years agotestsuite: Add -Wno-psabi to pr47639.C testcase
Jakub Jelinek [Thu, 20 Jan 2022 10:32:29 +0000 (11:32 +0100)]
testsuite: Add -Wno-psabi to pr47639.C testcase

This patch fixes
gcc/testsuite/g++.dg/opt/pr47639.C:6:24: warning: MMX vector return without MMX enabled changes the ABI [-Wpsabi]
gcc/testsuite/g++.dg/opt/pr47639.C:6:5: warning: MMX vector argument without MMX enabled changes the ABI [-Wpsabi]
FAILs on i686-linux.

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

* g++.dg/opt/pr47639.C: Add -Wno-psabi to dg-options.

2 years agoEnhance vec_pack_trunc for integral mode mask.
liuhongt [Mon, 17 Jan 2022 02:47:46 +0000 (10:47 +0800)]
Enhance vec_pack_trunc for integral mode mask.

For testcase in PR, the patch supports QI:4 -> HI:16 pack with
multi steps(first pack QI:4 -> QI:8 through vec_pack_sbool_trunc_qi,
then pack QI:8 -> HI:16 through vec_pack_trunc_hi).
Similar for QI:2 -> HI:16 which is test4 in mask-pack-prefer-128.c.

gcc/ChangeLog:

PR target/103771
* tree-vect-stmts.cc (supportable_narrowing_operation): Enhance
integral mode mask pack by multi steps which takes
vec_pack_sbool_trunc_optab as start when elements number is
less than BITS_PER_UNITS.

gcc/testsuite/ChangeLog:

* gcc.target/i386/mask-pack-prefer128.c: New test.
* gcc.target/i386/mask-pack-prefer256.c: New test.
* gcc.target/i386/pr103771.c: New test.

2 years agotree-optimization/104114 - avoid diagnosing V1mode lowering
Richard Biener [Wed, 19 Jan 2022 12:59:21 +0000 (13:59 +0100)]
tree-optimization/104114 - avoid diagnosing V1mode lowering

Currently we diagnose vector lowering of V1mode operations that
are not natively supported into V_C_E, scalar op plus CTOR with
-Wvector-operation-performance but that's hardly useful behavior
even though the way we lower things can be improved.

The following disables the diagnostics for the cases the vect.exp
testsuite runs into, on x86 that are vect-cond-11.c and
vect-singleton_1.c.

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

PR tree-optimization/104114
* tree-vect-generic.cc (expand_vector_piecewise): Do not diagnose
single element vector decomposition.

2 years agoc++: template-id with current inst qualifier [PR102300]
Jason Merrill [Tue, 18 Jan 2022 23:28:22 +0000 (18:28 -0500)]
c++: template-id with current inst qualifier [PR102300]

The patch for PR41723 properly changed one place to look into the current
instantiation; now we need to fix this place as well.

PR c++/102300

gcc/cp/ChangeLog:

* parser.cc (cp_parser_template_name): Use dependent_scope_p.

gcc/testsuite/ChangeLog:

* g++.dg/parse/no-typename1.C: Remove expected error.
* g++.dg/template/nested7.C: New test.

2 years agotestsuite: sldoi requires VSX.
David Edelsohn [Wed, 19 Jan 2022 17:40:23 +0000 (12:40 -0500)]
testsuite: sldoi requires VSX.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/sldoi_to_mov.c: Require VSX.

2 years agoDaily bump.
GCC Administrator [Thu, 20 Jan 2022 00:16:54 +0000 (00:16 +0000)]
Daily bump.

2 years agolibstdc++: Remove -gdwarf-4 from flags for debug library
Jonathan Wakely [Wed, 19 Jan 2022 19:29:42 +0000 (19:29 +0000)]
libstdc++: Remove -gdwarf-4 from flags for debug library

The default is -gdwarf-5 now, so this is hurting rather than improving
things.

libstdc++-v3/ChangeLog:

* configure.ac (GLIBCXX_ENABLE_DEBUG_FLAGS): Remove -gdwarf-4
from default flags.
* configure: Regenerate.

2 years agolibstdc++: Include <stddef.h> for size_t and ptrdiff_t [PR104123]
Jonathan Wakely [Wed, 19 Jan 2022 17:39:00 +0000 (17:39 +0000)]
libstdc++: Include <stddef.h> for size_t and ptrdiff_t [PR104123]

libstdc++-v3/ChangeLog:

PR libstdc++/104123
* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Include
<stddef.h>.

2 years agoifcvt: Run second pass if it is possible to omit a temporary.
Robin Dapp [Wed, 19 Jan 2022 16:36:45 +0000 (17:36 +0100)]
ifcvt: Run second pass if it is possible to omit a temporary.

If one of the to-be-converted SETs requires the original comparison
(i.e. in order to generate a min/max insn) but no other insn after it
does, we can omit creating temporaries, thus facilitating costing.

gcc/ChangeLog:

* ifcvt.cc (noce_convert_multiple_sets_1): New function.
(noce_convert_multiple_sets): Call function a second time if we can
improve the first try.

2 years agotestsuite/s390: Add tests for noce_convert_multiple.
Robin Dapp [Thu, 28 Nov 2019 12:26:56 +0000 (13:26 +0100)]
testsuite/s390: Add tests for noce_convert_multiple.

Add new s390-specific tests that check if we convert two SETs into two
loads on condition.  Remove the s390-specific target-check in
gcc.dg/ifcvt-4.c.

gcc/testsuite/ChangeLog:

* gcc.dg/ifcvt-4.c: Remove s390-specific check.
* gcc.target/s390/ifcvt-two-insns-bool.c: New test.
* gcc.target/s390/ifcvt-two-insns-int.c: New test.
* gcc.target/s390/ifcvt-two-insns-long.c: New test.

2 years agoifcvt: Try re-using CC for conditional moves.
Robin Dapp [Wed, 19 Jan 2022 16:36:36 +0000 (17:36 +0100)]
ifcvt: Try re-using CC for conditional moves.

Following up on the previous patch, this patch makes
noce_convert_multiple emit two cmov sequences:  The same one as before
and a second one that tries to re-use the existing CC.  Then their costs
are compared and the cheaper one is selected.

gcc/ChangeLog:

* ifcvt.cc (cond_exec_get_condition): New parameter to allow getting the
reversed comparison.
(try_emit_cmove_seq): New function to facilitate creating a cmov
sequence.
(noce_convert_multiple_sets): Create two sequences and use the less
expensive one.

2 years agoifcvt/optabs: Allow using a CC comparison for emit_conditional_move.
Robin Dapp [Wed, 27 Nov 2019 12:53:40 +0000 (13:53 +0100)]
ifcvt/optabs: Allow using a CC comparison for emit_conditional_move.

Currently we only ever call emit_conditional_move with the comparison
(as well as its comparands) we got from the jump.  Thus, backends are
going to emit a CC comparison for every conditional move that is being
generated instead of re-using the existing CC.
This, combined with emitting temporaries for each conditional move,
causes sky-high costs for conditional moves.

This patch allows to re-use a CC so the costing situation is improved a
bit.

gcc/ChangeLog:

* rtl.h (struct rtx_comparison): New struct that holds an rtx
comparison.
* config/rs6000/rs6000.cc (rs6000_emit_minmax): Use struct instead of
single parameters.
(rs6000_emit_swsqrt): Likewise.
* expmed.cc (expand_sdiv_pow2): Likewise.
(emit_store_flag): Likewise.
* expr.cc (expand_cond_expr_using_cmove): Likewise.
(expand_expr_real_2): Likewise.
* ifcvt.cc (noce_emit_cmove): Add compare and reversed compare
parameters.
* optabs.cc (emit_conditional_move_1): New function.
(expand_doubleword_shift_condmove): Use struct.
(emit_conditional_move): Use struct and allow to call directly
without going through preparation steps.
* optabs.h (emit_conditional_move): Use struct.

2 years agoifcvt: Improve costs handling for noce_convert_multiple.
Robin Dapp [Wed, 27 Nov 2019 12:46:17 +0000 (13:46 +0100)]
ifcvt: Improve costs handling for noce_convert_multiple.

When noce_convert_multiple is called the original costs are not yet
initialized.  Therefore, up to now, costs were only ever unfairly
compared against COSTS_N_INSNS (2).  This would lead to
default_noce_conversion_profitable_p () rejecting all but the most
contrived of sequences.

This patch temporarily initializes the original costs by counting
adding costs for all sets inside the then_bb.

gcc/ChangeLog:

* ifcvt.cc (bb_ok_for_noce_convert_multiple_sets): Estimate insns costs.
(noce_process_if_block): Use potential costs.

2 years agoifcvt: Allow constants for noce_convert_multiple.
Robin Dapp [Wed, 27 Nov 2019 12:45:41 +0000 (13:45 +0100)]
ifcvt: Allow constants for noce_convert_multiple.

This lifts the restriction of not allowing constants for
noce_convert_multiple.  The code later checks if a valid sequence
is produced anyway.

gcc/ChangeLog:

* ifcvt.cc (noce_convert_multiple_sets): Allow constants.
(bb_ok_for_noce_convert_multiple_sets): Likewise.

2 years agoifcvt: Check if cmovs are needed.
Robin Dapp [Wed, 19 Jan 2022 16:36:27 +0000 (17:36 +0100)]
ifcvt: Check if cmovs are needed.

When if-converting multiple SETs and we encounter a swap-style idiom

  if (a > b)
    {
      tmp = c;   // [1]
      c = d;
      d = tmp;
    }

ifcvt should not generate a conditional move for the instruction at
[1].

In order to achieve that, this patch goes through all relevant SETs
and marks the relevant instructions.  This helps to evaluate costs.

On top, only generate temporaries if the current cmov is going to
overwrite one of the comparands of the initial compare.

gcc/ChangeLog:

* ifcvt.cc (need_cmov_or_rewire): New function.
(noce_convert_multiple_sets): Call it.

2 years agoUpdate per-file selftest and finalization hooks for .c to .cc renaming
David Malcolm [Tue, 18 Jan 2022 19:36:27 +0000 (14:36 -0500)]
Update per-file selftest and finalization hooks for .c to .cc renaming

This is mostly a mechanical change, apart from:
- fix the name of attribute_c_tests to match its filename (attribs.cc)
- fix the name of opt_proposer_c to match its filename (opt-suggestions.cc)
- delete a bogus "modref_c_tests" decl from ipa-modref-tree.h that's been
  present since the initial commit of that file
  (d119f34c952f8718fdbabc63e2f369a16e92fa07)

gcc/ChangeLog:
* attribs.cc (attribute_c_tests): Rename to...
(attribs_cc_tests): ...this.
* bitmap.cc (bitmap_c_tests): Rename to...
(bitmap_cc_tests): ...this.
* cgraph.cc (cgraph_c_finalize): Rename to...
(cgraph_cc_finalize): ...this.
(cgraph_c_tests): Rename to...
(cgraph_cc_tests): ...this.
* cgraph.h (cgraph_c_finalize): Rename to...
(cgraph_cc_finalize): ...this.
(cgraphunit_c_finalize): Rename to...
(cgraphunit_cc_finalize): ...this.
* cgraphunit.cc (cgraphunit_c_finalize): Rename to...
(cgraphunit_cc_finalize): ...this.
* convert.cc (convert_c_tests): Rename to...
(convert_cc_tests): ...this.
* dbgcnt.cc (dbgcnt_c_tests): Rename to...
(dbgcnt_cc_tests): ...this.
* diagnostic-show-locus.cc (diagnostic_show_locus_c_tests): Rename to...
(diagnostic_show_locus_cc_tests): ...this.
* diagnostic.cc (diagnostic_c_tests): Rename to...
(diagnostic_cc_tests): ...this.
* dumpfile.cc (dumpfile_c_tests): Rename to...
(dumpfile_cc_tests): ...this.
* dwarf2out.cc (dwarf2out_c_finalize): Rename to...
(dwarf2out_cc_finalize): ...this.
* dwarf2out.h (dwarf2out_c_finalize): Rename to...
(dwarf2out_cc_finalize): ...this.
* edit-context.cc (edit_context_c_tests): Rename to...
(edit_context_cc_tests): ...this.
* et-forest.cc (et_forest_c_tests): Rename to...
(et_forest_cc_tests): ...this.
* fibonacci_heap.cc (fibonacci_heap_c_tests): Rename to...
(fibonacci_heap_cc_tests): ...this.
* fold-const.cc (fold_const_c_tests): Rename to...
(fold_const_cc_tests): ...this.
* function-tests.cc (function_tests_c_tests): Rename to...
(function_tests_cc_tests): ...this.
* gcse.cc (gcse_c_finalize): Rename to...
(gcse_cc_finalize): ...this.
* gcse.h (gcse_c_finalize): Rename to...
(gcse_cc_finalize): ...this.
* ggc-tests.cc (ggc_tests_c_tests): Rename to...
(ggc_tests_cc_tests): ...this.
* gimple-ssa-store-merging.cc (store_merging_c_tests): Rename to...
(store_merging_cc_tests): ...this.
* gimple.cc (gimple_c_tests): Rename to...
(gimple_cc_tests): ...this.
* hash-map-tests.cc (hash_map_tests_c_tests): Rename to...
(hash_map_tests_cc_tests): ...this.
* hash-set-tests.cc (hash_set_tests_c_tests): Rename to...
(hash_set_tests_cc_tests): ...this.
* input.cc (input_c_tests): Rename to...
(input_cc_tests): ...this.
* ipa-cp.cc (ipa_cp_c_finalize): Rename to...
(ipa_cp_cc_finalize): ...this.
* ipa-fnsummary.cc (ipa_fnsummary_c_finalize): Rename to...
(ipa_fnsummary_cc_finalize): ...this.
* ipa-fnsummary.h (ipa_fnsummary_c_finalize): Rename to...
(ipa_fnsummary_cc_finalize): ...this.
* ipa-modref-tree.cc (ipa_modref_tree_c_tests): Rename to...
(ipa_modref_tree_cc_tests): ...this.
* ipa-modref-tree.h (modref_c_tests): Delete bogus decl.
* ipa-modref.cc (ipa_modref_c_finalize): Rename to...
(ipa_modref_cc_finalize): ...this.
* ipa-modref.h (ipa_modref_c_finalize): Rename to...
(ipa_modref_cc_finalize): ...this.
* ipa-prop.h (ipa_cp_c_finalize): Rename to...
(ipa_cp_cc_finalize): ...this.
* ipa-reference.cc (ipa_reference_c_finalize): Rename to...
(ipa_reference_cc_finalize): ...this.
* ipa-reference.h (ipa_reference_c_finalize): Rename to...
(ipa_reference_cc_finalize): ...this.
* ira-costs.cc (ira_costs_c_finalize): Rename to...
(ira_costs_cc_finalize): ...this.
* ira.h (ira_costs_c_finalize): Rename to...
(ira_costs_cc_finalize): ...this.
* opt-suggestions.cc (opt_proposer_c_tests): Rename to...
(opt_suggestions_cc_tests): ...this.
* opts.cc (opts_c_tests): Rename to...
(opts_cc_tests): ...this.
* predict.cc (predict_c_tests): Rename to...
(predict_cc_tests): ...this.
* pretty-print.cc (pretty_print_c_tests): Rename to...
(pretty_print_cc_tests): ...this.
* read-rtl-function.cc (read_rtl_function_c_tests): Rename to...
(read_rtl_function_cc_tests): ...this.
* rtl-tests.cc (rtl_tests_c_tests): Rename to...
(rtl_tests_cc_tests): ...this.
* sbitmap.cc (sbitmap_c_tests): Rename to...
(sbitmap_cc_tests): ...this.
* selftest-run-tests.cc (selftest::run_tests): Update calls for
_c_ to _cc_ function renamings; fix names of attribs and
opt-suggestions tests.
* selftest.cc (selftest_c_tests): Rename to...
(selftest_cc_tests): ...this.
* selftest.h (attribute_c_tests): Rename to...
(attribs_cc_tests): ...this.
(bitmap_c_tests): Rename to...
(bitmap_cc_tests): ...this.
(cgraph_c_tests): Rename to...
(cgraph_cc_tests): ...this.
(convert_c_tests): Rename to...
(convert_cc_tests): ...this.
(diagnostic_c_tests): Rename to...
(diagnostic_cc_tests): ...this.
(diagnostic_show_locus_c_tests): Rename to...
(diagnostic_show_locus_cc_tests): ...this.
(dumpfile_c_tests): Rename to...
(dumpfile_cc_tests): ...this.
(edit_context_c_tests): Rename to...
(edit_context_cc_tests): ...this.
(et_forest_c_tests): Rename to...
(et_forest_cc_tests): ...this.
(fibonacci_heap_c_tests): Rename to...
(fibonacci_heap_cc_tests): ...this.
(fold_const_c_tests): Rename to...
(fold_const_cc_tests): ...this.
(function_tests_c_tests): Rename to...
(function_tests_cc_tests): ...this.
(ggc_tests_c_tests): Rename to...
(ggc_tests_cc_tests): ...this.
(gimple_c_tests): Rename to...
(gimple_cc_tests): ...this.
(hash_map_tests_c_tests): Rename to...
(hash_map_tests_cc_tests): ...this.
(hash_set_tests_c_tests): Rename to...
(hash_set_tests_cc_tests): ...this.
(input_c_tests): Rename to...
(input_cc_tests): ...this.
(opts_c_tests): Rename to...
(opts_cc_tests): ...this.
(predict_c_tests): Rename to...
(predict_cc_tests): ...this.
(pretty_print_c_tests): Rename to...
(pretty_print_cc_tests): ...this.
(read_rtl_function_c_tests): Rename to...
(read_rtl_function_cc_tests): ...this.
(rtl_tests_c_tests): Rename to...
(rtl_tests_cc_tests): ...this.
(sbitmap_c_tests): Rename to...
(sbitmap_cc_tests): ...this.
(selftest_c_tests): Rename to...
(selftest_cc_tests): ...this.
(simplify_rtx_c_tests): Rename to...
(simplify_rtx_cc_tests): ...this.
(spellcheck_c_tests): Rename to...
(spellcheck_cc_tests): ...this.
(spellcheck_tree_c_tests): Rename to...
(spellcheck_tree_cc_tests): ...this.
(sreal_c_tests): Rename to...
(sreal_cc_tests): ...this.
(store_merging_c_tests): Rename to...
(store_merging_cc_tests): ...this.
(tree_c_tests): Rename to...
(tree_cc_tests): ...this.
(tree_cfg_c_tests): Rename to...
(tree_cfg_cc_tests): ...this.
(typed_splay_tree_c_tests): Rename to...
(typed_splay_tree_cc_tests): ...this.
(vec_c_tests): Rename to...
(vec_cc_tests): ...this.
(vec_perm_indices_c_tests): Rename to...
(vec_perm_indices_cc_tests): ..this.
(opt_proposer_c_tests): Rename to...
(opt_suggestions_cc_tests): ...this.
(dbgcnt_c_tests): Rename to...
(dbgcnt_cc_tests): ...this.
(ipa_modref_tree_c_tests): Rename to...
(ipa_modref_tree_cc_tests): ...this.
* simplify-rtx.cc (simplify_rtx_c_tests): Rename to...
(simplify_rtx_cc_tests): ...this.
* spellcheck-tree.cc (spellcheck_tree_c_tests): Rename to...
(spellcheck_tree_cc_tests): ...this.
* spellcheck.cc (spellcheck_c_tests): Rename to...
(spellcheck_cc_tests): ...this.
* sreal.cc (sreal_c_tests): Rename to...
(sreal_cc_tests): ...this.
* toplev.cc (toplev::finalize): Update calls for _c_ to _cc_
function renamings.
* tree-cfg.cc (tree_cfg_c_tests): Rename to...
(tree_cfg_cc_tests): ...this.
* tree.cc (tree_c_tests): Rename to...
(tree_cc_tests): ...this.
* typed-splay-tree.cc (typed_splay_tree_c_tests): Rename to...
(typed_splay_tree_cc_tests): ...this.
* vec-perm-indices.cc (vec_perm_indices_c_tests): Rename to...
(vec_perm_indices_cc_tests): ...this.
* vec.cc (vec_c_tests): Rename to...
(vec_cc_tests): ...this.

gcc/c-family/ChangeLog:
* c-common.cc (c_common_c_tests): Rename to...
(c_common_cc_tests): ...this.
(c_family_tests): Update calls for .c to .cc renaming.
* c-common.h (c_format_c_tests): Rename to...
(c_format_cc_tests): ...this.
(c_indentation_c_tests): Rename to...
(c_indentation_cc_tests): ...this.
(c_pretty_print_c_tests): Rename to...
(c_pretty_print_cc_tests): ...this.
* c-format.cc (c_format_c_tests): Rename to...
(c_format_cc_tests): ...this.
* c-indentation.cc (c_indentation_c_tests): Rename to...
(c_indentation_cc_tests): ...this.
* c-pretty-print.cc (c_pretty_print_c_tests): Rename to...
(c_pretty_print_cc_tests): ...this.

gcc/cp/ChangeLog:
* cp-lang.cc (selftest::run_cp_tests): Update calls for .c to .cc
renaming.
* cp-tree.h (cp_pt_c_tests): Rename to...
(cp_pt_cc_tests): ...this.
(cp_tree_c_tests): Rename to...
(cp_tree_cc_tests): ...this.
* pt.cc (cp_pt_c_tests): Rename to...
(cp_pt_cc_tests): ...this.
* tree.cc (cp_tree_c_tests): Rename to...
(cp_tree_cc_tests): ...this.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agolibstdc++: Fix libbacktrace build files
Jonathan Wakely [Wed, 19 Jan 2022 14:20:52 +0000 (14:20 +0000)]
libstdc++: Fix libbacktrace build files

This makes it possible to combine --enable-libstdcxx-debug with
--enable-libstdcxx-backtrace, by adding a rule to src/Makefile to copy
the backtrace-supported.h header into the src/debug/libbacktrace
directory.

Add libbacktrace path to testsuite flags so the tests can link without
having the library installed.

Also fix some warnings when running automake for the libbacktrace
makefile.

Use a per-library CPPFLAGS variable to fix:

src/libbacktrace/Makefile.am:38: warning: AM_CPPFLAGS multiply defined in condition TRUE ...
fragment.am:43: ... 'AM_CPPFLAGS' previously defined here
src/libbacktrace/Makefile.am:32:   'fragment.am' included from here

Create symlinks to the libbacktrace sources to fix:

src/libbacktrace/Makefile.am:55: warning: source file '../../../libbacktrace/atomic.c' is in a subdirectory,
src/libbacktrace/Makefile.am:55: but option 'subdir-objects' is disabled

libstdc++-v3/ChangeLog:

* scripts/testsuite_flags.in: Add src/libbacktrace/.libs to
linker search paths.
* src/Makefile.am: Fix src/debug/libbacktrace build.
* src/Makefile.in: Regenerate.
* src/libbacktrace/Makefile.am: Use per-library CPPFLAGS
variable. Use symlinks for the source files.
* src/libbacktrace/Makefile.in: Regenerate.

2 years agovect: Fix epilogue mode skipping
Andre Vieira [Wed, 19 Jan 2022 14:11:32 +0000 (14:11 +0000)]
vect: Fix epilogue mode skipping

gcc/ChangeLog:

PR tree-optimization/103997
* tree-vect-loop.cc (vect_analyze_loop): Fix mode skipping for epilogue
vectorization.

2 years agomatch.pd, optabs: Avoid vectorization of {FLOOR,CEIL,ROUND}_{DIV,MOD}_EXPR [PR102860]
Jakub Jelinek [Wed, 19 Jan 2022 14:03:45 +0000 (15:03 +0100)]
match.pd, optabs: Avoid vectorization of {FLOOR,CEIL,ROUND}_{DIV,MOD}_EXPR [PR102860]

power10 has modv4si3 expander and so vectorizes the following testcase
where Fortran modulo is FLOOR_MOD_EXPR.
optabs_for_tree_code indicates that the optab for all the *_MOD_EXPR
variants is umod_optab or smod_optab, but that isn't true, that optab
actually expands just TRUNC_MOD_EXPR.  For the other tree codes expmed.cc
has code how to adjust the TRUNC_MOD_EXPR into those by emitting some
extra comparisons and conditional updates.  Similarly for *_DIV_EXPR,
except in that case it actually needs both division and modulo.

While it would be possible to handle it in expmed.cc for vectors as well,
we'd need to be sure all the vector operations we need for that are
available, and furthermore we wouldn't account for that in the costing.

So, IMHO it is better to stop pretending those non-truncating (and
non-exact) div/mod operations have an optab.  For GCC 13, we should
IMHO pattern match these in tree-vect-patterns.cc and transform them
to truncating div/mod with follow-up adjustments and let the vectorizer
vectorize that.  As written in the PR, for signed operands:
r = x %[fl] y;
is
r = x % y; if (r && (x ^ y) < 0) r += y;
and
d = x /[fl] y;
is
r = x % y; d = x / y; if (r && (x ^ y) < 0) --d;
and
r = x %[cl] y;
is
r = x % y; if (r && (x ^ y) >= 0) r -= y;
and
d = /[cl] y;
is
r = x % y; d = x / y; if (r && (x ^ y) >= 0) ++d;
(too lazy to figure out rounding div/mod now).  I'll create a PR
for that.
The patch also extends a match.pd optimization that floor_mod on
unsigned operands is actually trunc_mod.

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

PR middle-end/102860
* match.pd (x %[fl] y -> x % y): New simplification for
unsigned integral types.
* optabs-tree.cc (optab_for_tree_code): Return unknown_optab
for {CEIL,FLOOR,ROUND}_{DIV,MOD}_EXPR with VECTOR_TYPE.

* gfortran.dg/pr102860.f90: New test.

2 years agotestsuite: Test evrp-trans.c also with unsigned types [PR104115]
Jakub Jelinek [Wed, 19 Jan 2022 14:02:31 +0000 (15:02 +0100)]
testsuite: Test evrp-trans.c also with unsigned types [PR104115]

The testcase from the PR got fixed with r12-3119-g675a3e40567e1d
and looks quite similar to the evrp-trans.c test, except evrp-trans.c
is tested on signed integer types.
I think it would be useful to test it for unsigned comparisons too.

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

PR c/104115
* gcc.dg/tree-ssa/evrp-trans2.c: New test.

2 years agotree-optimization/104112 - add check for vect epilogue reduc reuse
Richard Biener [Wed, 19 Jan 2022 11:31:30 +0000 (12:31 +0100)]
tree-optimization/104112 - add check for vect epilogue reduc reuse

This adds a missing check for the availability of intermediate vector
types required to re-use the accumulator of a vectorized reduction
in the vectorized epilogue.  For SVE and VNx2DF vs V2DF with
-msve-vector-bits=512 for example V4DF is not available.

In addition to that we have to verify the reduction operation is
supported, otherwise we for example on i?86 get vector code that's
later decomposed again by vector lowering when trying to use
a V2HI epilogue for a V8HI reduction with a target without
TARGET_MMX_WITH_SSE.

It might be we want -Wvector-operation-performance for all vect.exp
tests but that seems to have existing regressions.

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

PR tree-optimization/104112
* tree-vect-loop.cc (vect_find_reusable_accumulator): Check
for required intermediate vector types.

* gcc.dg/vect/pr104112-1.c: New testcase.
* gcc.dg/vect/pr104112-2.c: New testcase.

2 years agocheck_GNU_style_lib: skip .py files (one should use flake8).
Martin Liska [Wed, 19 Jan 2022 13:53:43 +0000 (14:53 +0100)]
check_GNU_style_lib: skip .py files (one should use flake8).

contrib/ChangeLog:

* check_GNU_style_lib.py: Skip Python files.

2 years agolibgomp, OpenMP: Fix issue for omp_get_device_num on gcn targets.
Marcel Vollweiler [Wed, 19 Jan 2022 13:03:54 +0000 (05:03 -0800)]
libgomp, OpenMP: Fix issue for omp_get_device_num on gcn targets.

Currently omp_get_device_num does not work on gcn targets with more than one
offload device. The reason is that GOMP_DEVICE_NUM_VAR is static in
icv-device.c and thus "__gomp_device_num" is not visible in the offload image.

This patch removes "static" such that "__gomp_device_num" is now part of the
offload image and can now be found in GOMP_OFFLOAD_load_image in the plugin.

This is not an issue for nvptx. There, "__gomp_device_num" is in the offload
image even with "static".

libgomp/ChangeLog:

* config/gcn/icv-device.c: Make GOMP_DEVICE_NUM_VAR public (remove
"static") to make the device num available in the offload image.

2 years agolibstdc++: Fix for non-constexpr math_errhandling
Matthias Kretz [Tue, 18 Jan 2022 16:04:06 +0000 (17:04 +0100)]
libstdc++: Fix for non-constexpr math_errhandling

Use SFINAE magic to support: "It is unspecified whether math_errhandling
is a macro or an identifier with external linkage." [C Standard]

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd.h (__floating_point_flags): Do
not rely on math_errhandling to expand to a constant expression.

2 years ago[Ada] Set target_cpu to x32 for x86_64-linux-gnux32
H.J. Lu [Tue, 18 Jan 2022 23:54:35 +0000 (15:54 -0800)]
[Ada] Set target_cpu to x32 for x86_64-linux-gnux32

Since the x86_64-linux-gnux32 compiler is actually an x32 compiler, set
target_cpu to x32 for x86_64-linux-gnux32.

PR ada/103538
* gcc-interface/Makefile.in (target_cpu): Set to x32 for
x86_64-linux-gnux32.

2 years ago[Ada] Compile s-mmap and 128bit on x86_64-linux-gnux32
H.J. Lu [Tue, 18 Jan 2022 16:57:37 +0000 (08:57 -0800)]
[Ada] Compile s-mmap and 128bit on x86_64-linux-gnux32

PR ada/103538
* Makefile.rtl (LIBGNAT_TARGET_PAIRS): Add
$(TRASYM_DWARF_UNIX_PAIRS),
s-tsmona.adb<libgnat/s-tsmona__linux.adb,
$(GNATRTL_128BIT_PAIRS).
(EXTRA_GNATRTL_NONTASKING_OBJS): Add $(TRASYM_DWARF_UNIX_OBJS)
and $(GNATRTL_128BIT_OBJS).

2 years agotestsuite: Rename a few C++ to .C or .cc.
Martin Liska [Wed, 19 Jan 2022 11:41:42 +0000 (12:41 +0100)]
testsuite: Rename a few C++ to .C or .cc.

The tests are C++ code, so use a proper file extension.

gcc/testsuite/ChangeLog:

* g++.dg/ext/boolcomplex-1.c: Moved to...
* g++.dg/ext/boolcomplex-1.C: ...here.
* g++.dg/opt/pr47639.c: Moved to...
* g++.dg/opt/pr47639.C: ...here.
* g++.dg/pr83979.c: Moved to...
* g++.dg/pr83979.C: ...here.
* g++.dg/tm/asm-1.c: Moved to...
* g++.dg/tm/asm-1.C: ...here.
* g++.dg/vect/pr71483.c: Moved to...
* g++.dg/vect/pr71483.cc: ...here.

2 years agors6000: Fix bootstrap
Jakub Jelinek [Wed, 19 Jan 2022 11:22:02 +0000 (12:22 +0100)]
rs6000: Fix bootstrap

> On 18/01/2022 22:42, Segher Boessenkool wrote:
> > > +    default:
> > > +      break;
> > Please don't do that.  You can do
> >
> >    default:
> >      break;
> >      break;
> >      /* And just to make sure:  */
> >      break;
> >      break;
> >
> > and it will do exactly the same as not having a default at all.  Not
> > having such useless code is by far the most readable, so please don't
> > include a default case at all.
>
> I removed the default case. I hope this is what you wanted.

Unfortunately the removal of default: break; breaks bootstrap:
../../gcc/config/rs6000/rs6000.cc: In function ‘const char* rs6000_machine_from_flags()’:
../../gcc/config/rs6000/rs6000.cc:5940:10: error: enumeration value ‘PROCESSOR_PPC601’ not handled in switch [-Werror=switch]
 5940 |   switch (rs6000_cpu)
      |          ^
../../gcc/config/rs6000/rs6000.cc:5940:10: error: enumeration value ‘PROCESSOR_PPC603’ not handled in switch [-Werror=switch]
...
default: break; is needed to tell the -Wswitch warning that it is intentional
that not all enumerators are handled in the switch.

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

* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Add default:.

2 years agoEnable -Werror=format-diag during bootstrap.
Martin Liska [Wed, 19 Jan 2022 10:54:59 +0000 (11:54 +0100)]
Enable -Werror=format-diag during bootstrap.

gcc/ChangeLog:

* configure.ac: Remove -Wno-error=format-diag.
* configure: Regenerate.

2 years agoUpdate on riscv -Wformat-diag string.
Martin Liska [Wed, 19 Jan 2022 09:32:13 +0000 (10:32 +0100)]
Update on riscv -Wformat-diag string.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_handle_type_attribute):
Update one -Wformat-diag string in warning message.

2 years agogimple-ssa-warn-access: Fix up asan_test.C -Wdangling-pointer regression [PR104103]
Jakub Jelinek [Wed, 19 Jan 2022 08:28:25 +0000 (09:28 +0100)]
gimple-ssa-warn-access: Fix up asan_test.C -Wdangling-pointer regression [PR104103]

As reported in the PR or as I've seen since the weekend, asan_test.C fails
because of many warnings like:
gcc/testsuite/g++.dg/asan/asan_test.cc:1157:10: error: using a dangling pointer to an unnamed temporary [-Werror=dangling-pointer=]
gcc/testsuite/g++.dg/asan/asan_test.cc:1157:10: error: using a dangling pointer to an unnamed temporary [-Werror=dangling-pointer=]
gcc/testsuite/g++.dg/asan/asan_test.cc:1162:27: error: using a dangling pointer to an unnamed temporary [-Werror=dangling-pointer=]
...
(lots of them).
There are no dangling pointers though, the warning pass sees:
  some_automatic_var ={v} {CLOBBER};
  .ASAN_MARK (POISON, &some_automatic_var, 8);
and warns on that (both on user vars and on e.g. TARGET_EXPR temporaries).
There is nothing wrong on that, .ASAN_MARK is compiler instrumentation,
which doesn't even touch the variable in any way nor make it escaped.
What it instead does is change bytes in the shadow memory corresponding
to the variable to reflect that the variable is out of scope and make
sure that access to it would be diagnosed at runtime.
So, for all purposes of the -Wdangling-pointer and -Wuse-after-free
warnings, we should ignore this internal call.

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

PR middle-end/104103
* gimple-ssa-warn-access.cc (pass_waccess::check_call): Don't check
.ASAN_MARK calls.

2 years agofold-const: Optimize &"foo"[0] == "foo" [PR89074]
Jakub Jelinek [Wed, 19 Jan 2022 08:26:13 +0000 (09:26 +0100)]
fold-const: Optimize &"foo"[0] == "foo" [PR89074]

This is a non-C++ related part from the PR89074 address_compare changes.
For "foo" == "foo" we already optimize this from the (cmp @0 @0)
simplification, because we use operand_equal_p in that case
and operand_equal_p also compares the STRING_CSTs bytes rather than
just addresses.

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

PR c++/89074
* fold-const.cc (address_compare): Consider different STRING_CSTs
with the same lengths that memcmp the same as equal, not different.

* gcc.dg/tree-ssa/pr89074.c: New test.

2 years agoi386: Fix *aes<aeswideklvariant>u8
Jakub Jelinek [Wed, 19 Jan 2022 08:17:54 +0000 (09:17 +0100)]
i386: Fix *aes<aeswideklvariant>u8

grep '{[^|}]*}"' *.md

found another spot, though dunno if we have sufficient effective targets
etc. to add an -masm=intel test for it (and my installed binutils doesn't
support it anyway).
Binutils trunk testsuite shows the argument isn't omitted even in the Intel
syntax:
grep aesencwide *.s
keylocker.s:    aesencwide128kl 126(%edx)
keylocker.s:    aesencwide256kl 126(%edx)
keylocker.s:    aesencwide128kl [edx+126]
keylocker.s:    aesencwide256kl [edx+126]
property-10.s:   aesencwide128kl (%eax)
x86-64-keylocker.s:     aesencwide128kl 126(%rdx)
x86-64-keylocker.s:     aesencwide256kl 126(%rdx)
x86-64-keylocker.s:     aesencwide128kl [rdx+126]
x86-64-keylocker.s:     aesencwide256kl [rdx+126]
and doesn't use any WHATEVER PTR.

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

* config/i386/sse.md (*aes<aeswideklvariant>u*): Use %0 instead of
{%0}.

2 years agoCome up with git-fix-changelog.py script.
Martin Liska [Wed, 19 Jan 2022 06:57:05 +0000 (07:57 +0100)]
Come up with git-fix-changelog.py script.

contrib/ChangeLog:

* git-backport.py: Use it.
* git-fix-changelog.py: New file.
* gcc-git-customization.sh: Add new alias git gcc-fix-changelog.

2 years agonvptx: update fix for -Wformat-diag
Martin Liska [Tue, 18 Jan 2022 16:50:02 +0000 (17:50 +0100)]
nvptx: update fix for -Wformat-diag

gcc/ChangeLog:

* config/nvptx/nvptx.cc (nvptx_goacc_validate_dims_1): Update
warning messages.

libgomp/ChangeLog:

* testsuite/libgomp.oacc-c++/privatized-ref-2.C: Update scanning
patterns.
* testsuite/libgomp.oacc-c++/privatized-ref-3.C: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/pr85486.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/pr95270-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-nohost-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/struct-copyout-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/struct-copyout-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/vector-length-64-1.c:
Likewise.
* testsuite/libgomp.oacc-fortran/attach-descriptor-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/derivedtypes-arrays-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop-2.f95: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-1.f95: Likewise.

Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
2 years agotestsuite/102833 - fix gcc.dg/vect/bb-slp-17.c dump scanning
Richard Biener [Wed, 19 Jan 2022 07:17:10 +0000 (08:17 +0100)]
testsuite/102833 - fix gcc.dg/vect/bb-slp-17.c dump scanning

The desired transform requires V2SI vector add support, the closest
we have is vect64 so check that which at least fixes the i?86 fail.

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

PR testsuite/102833
* gcc.dg/vect/bb-slp-17.c: Require vect64.

2 years agopowerc: Fix asm machine directive for some CPUs
Sebastian Huber [Tue, 18 Jan 2022 11:44:53 +0000 (12:44 +0100)]
powerc: Fix asm machine directive for some CPUs

For some CPUs, the assembler machine directive cannot be determined by ISA
flags.

gcc/

PR target/104090
* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Use also
rs6000_cpu.

2 years agoFix tsvc test build on DragonFly.
Rimvydas Jasinskas [Tue, 18 Jan 2022 06:27:17 +0000 (06:27 +0000)]
Fix tsvc test build on DragonFly.

Currently all tsvc tests fail to build on DragonFly BSD because they
assume <malloc.h> and memalign() are available.

gcc/testsuite/ChangeLog:

PR testsuite/104021
* gcc.dg/vect/tsvc/tsvc.h: Do not include malloc.h on dragonfly
and use posix_memalign ().

Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
2 years agoAdd XFAIL parts of pr16855.C for dragonfly.
Rimvydas Jasinskas [Tue, 18 Jan 2022 06:12:45 +0000 (06:12 +0000)]
Add XFAIL parts of pr16855.C for dragonfly.

On DragonFly BSD profiling ends before these DTORs are invoked on dso cleanup.
The -static compilation works as expected.

gcc/testsuite/ChangeLog:

PR testsuite/104022
* g++.dg/gcov/pr16855.C: xfail the count lines for DTORs on dragonfly.
* g++.dg/gcov/pr16855-priority.C: Ditto.  Adjust source layout so that
dejagnu xfail expressions work.

Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
2 years agotestsuite: fix pytest detection unsupported message.
Martin Liska [Wed, 19 Jan 2022 06:37:42 +0000 (07:37 +0100)]
testsuite: fix pytest detection unsupported message.

PR testsuite/104109

gcc/testsuite/ChangeLog:

* lib/gcov.exp: Fix pytest detection unsupported message.

2 years agotestsuite: Adjust possibly fragile slp-perm-9.c [PR104015]
Kewen Lin [Wed, 19 Jan 2022 02:31:46 +0000 (20:31 -0600)]
testsuite: Adjust possibly fragile slp-perm-9.c [PR104015]

As Richard pointed out in PR104015, the test case slp-perm-9.c
can be fragile when vectorizer tries to use different
vectorisation strategies.

As suggested, this patch tries to make the check not sensitive
on the re-trying times by removing the times checking.  To still
retain the test coverage on unnecessary re-trying, for example
it exposes this PR104015 on Power9, I added two test cases to
powerpc testsuite.

gcc/testsuite/ChangeLog:

PR tree-optimization/104015
* gcc.dg/vect/slp-perm-9.c: Adjust.
* gcc.target/powerpc/pr104015-1.c: New test.
* gcc.target/powerpc/pr104015-2.c: New test.

2 years agoc++: fix PR104025 change
Jason Merrill [Wed, 19 Jan 2022 03:11:56 +0000 (22:11 -0500)]
c++: fix PR104025 change

Somehow I pushed my earlier patch without it actually fixing the test; we
need input_location to be for the last consumed token, not the next one.

gcc/cp/ChangeLog:

* parser.cc (saved_token_sentinel::rollback): Use
cp_lexer_previous_token.

2 years agoi386: Fix GLC tuning with -masm=intel [PR104104]
Jakub Jelinek [Wed, 19 Jan 2022 01:24:06 +0000 (02:24 +0100)]
i386: Fix GLC tuning with -masm=intel [PR104104]

> > On Sat, Jan 15, 2022 at 5:39 PM Hongyu Wang <wwwhhhyyy333@gmail.com> wrote:
> > > Thanks for the suggestion, here is the updated patch that survived
> > > bootstrap/regtest.

Unfortunately the patch results in assembler failures with -masm=intel.

> > > > +  if (TARGET_DEST_FALSE_DEPENDENCY
> > > > +      && get_attr_dest_false_dep (insn) ==
> > > > +        DEST_FALSE_DEP_TRUE)
> > > > +    output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands);

All the vxorps insns were emitted like the above, which means for -masm=sysv
it looks like
        vxorps  %xmm3, %xmm3, %xmm3
but for -masm=intel like:
        vxorps
We want obviously
        vxorps  xmm3, xmm3, xmm3
so the following patch just drops the errorneous {}s.

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

PR target/104104
* config/i386/sse.md
(<avx512>_<complexopname>_<mode><maskc_name><round_name>,
avx512fp16_<complexopname>sh_v8hf<mask_scalarc_name><round_scalarcz_name>,
avx512dq_mul<mode>3<mask_name>, <avx2_avx512>_permvar<mode><mask_name>,
avx2_perm<mode>_1<mask_name>, avx512f_perm<mode>_1<mask_name>,
avx512dq_rangep<mode><mask_name><round_saeonly_name>,
avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>,
<avx512>_getmant<mode><mask_name><round_saeonly_name>,
avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>):
Use vxorps\t%x0, %x0, %x0 instead of vxorps\t{%x0, %x0, %x0}.

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

2 years agoAdd test for bogus warning [PR104076].
Martin Sebor [Wed, 19 Jan 2022 00:56:20 +0000 (17:56 -0700)]
Add test for bogus warning [PR104076].

Related:
PR middle-end/104076 - bogus -Wdangling-pointer on a conditional

gcc/testsuite/ChangeLog:
PR middle-end/104076
* g++.dg/warn/Wdangling-pointer-3.C: New test.

2 years agoSuppress valid warning [PR104103].
Martin Sebor [Wed, 19 Jan 2022 00:53:20 +0000 (17:53 -0700)]
Suppress valid warning [PR104103].

gcc/testsuite/ChangeLog:
PR middle-end/104103
* gcc.dg/torture/pr57147-2.c: Prune out expected warning.

2 years agoHandle failure to determine pointer provenance conservatively [PR104069].
Martin Sebor [Wed, 19 Jan 2022 00:52:01 +0000 (17:52 -0700)]
Handle failure to determine pointer provenance conservatively [PR104069].

Partly resolves:
PR middle-end/104069 - -Werror=use-after-free false positive on elfutils-0.186

gcc/ChangeLog:
PR middle-end/104069
* gimple-ssa-warn-access.cc (pointers_related_p): Return false for
an unknown result as documented.

gcc/testsuite/ChangeLog:
PR middle-end/104069
* gcc.dg/Wuse-after-free.c: New test.

2 years agolibstdc++: Update documentation for C++17 deprecations
Jonathan Wakely [Tue, 18 Jan 2022 22:31:49 +0000 (22:31 +0000)]
libstdc++: Update documentation for C++17 deprecations

libstdc++-v3/ChangeLog:

* doc/xml/manual/evolution.xml: Document deprecations.
* doc/xml/manual/status_cxx2017.xml: Update status.
* doc/html/*: Regenerate.