Commit Graph

191118 Commits

Author SHA1 Message Date
Jonathan Wakely
72ce3fd2c7 libstdc++: Remove unused std::pair helper function
This function is no longer used since r12-6691 and can be removed.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h (_PCC::_DeprConsPair): Remove unused
	function.
2022-01-19 00:58:25 +00:00
Jonathan Wakely
c3861f7985 libstdc++: Fix std::atomic<std::shared_ptr<T>> for AIX [PR104101]
This fixes an on AIX.

The lock function currently just spins, which should be changed to use
back-off, and maybe then _M_val.wait(__current) when supported.

libstdc++-v3/ChangeLog:

	PR libstdc++/104101
	* include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count::lock):
	Only use __thread_relax if __cpp_lib_atomic_wait is defined.
2022-01-19 00:58:21 +00:00
GCC Administrator
7a761ae658 Daily bump. 2022-01-19 00:16:32 +00:00
Andrew Pinski
5ce3c003df [COMMITTED] Improve coment for the newly added code in ipa-split.
It was pointed out to me by Jakub, that the comment in front of
the new code which handles warning/error attribute was not really
understandable. This fixes the comment to be understandable; I
don't know why I wrote the original comment that way even.

Committed as obvious after a quick build.

gcc/ChangeLog:

	* ipa-split.cc (visit_bb): Fix comment before the
	warning/error attribute checking code.
2022-01-18 15:45:20 -08:00
Jakub Jelinek
1a5145f1e3 c++: Fix handling of temporaries with consteval ctors and non-trivial dtors [PR104055]
The following testcase is miscompiled.  We see the constructor is immediate,
in build_over_call we trigger:
          if (obj_arg && is_dummy_object (obj_arg))
            {
              call = build_cplus_new (DECL_CONTEXT (fndecl), call, complain);
              obj_arg = NULL_TREE;
            }
which makes call a TARGET_EXPR with the dtor in TARGET_EXPR_CLEANUP,
but then call cxx_constant_value on it.  In cxx_eval_outermost_constant_expr
it triggers the:
      else if (TREE_CODE (t) != CONSTRUCTOR)
        {
          r = get_target_expr_sfinae (r, tf_warning_or_error | tf_no_cleanup);
          TREE_CONSTANT (r) = true;
        }
which wraps the CONSTRUCTOR r into a new TARGET_EXPR, but one without
dtors (I think we need e.g. the TREE_CONSTANT for the callers),
and finally build_over_call uses that.

The following patch fixes that by using get_target_expr instead
of get_target_expr_sfinae + TREE_CONSTANT (r) = true if t is
a TARGET_EXPR with non-NULL TARGET_EXPR_CLEANUP.

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

	PR c++/104055
	* constexpr.cc (cxx_eval_outermost_constant_expr): If t is a
	TARGET_EXPR with TARGET_EXPR_CLEANUP, use get_target_expr rather
	than get_target_expr_sfinae with tf_no_cleanup, and don't set
	TREE_CONSTANT.

	* g++.dg/cpp2a/consteval27.C: New test.
2022-01-19 00:42:18 +01:00
Jason Merrill
fdd6d85bd7 c++: Use -std=c++20 in testsuite default std list
C++20 has been official for a while now.

gcc/testsuite/ChangeLog:

	* lib/g++-dg.exp: Change 2a to 20.
2022-01-18 17:57:04 -05:00
Jason Merrill
2aa184458a c++: input_location and lookahead [PR104025]
Debug information was getting confused because input_location was different
depending on whether we had looked ahead to see if the next tokens look like
a template argument list.

I tried resetting input_location in cp_lexer_rollback_tokens itself, but
that caused regressions, so let's just do it here for now.

	PR c++/104025

gcc/cp/ChangeLog:

	* parser.cc (saved_token_sentinel::rollback): Call
	cp_lexer_set_source_position.
	(~saved_token_sentinel): Call rollback.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/pr104025.C: New test.

Co-authored-by: Jakub Jelinek  <jakub@redhat.com>
2022-01-18 17:57:04 -05:00
David Faust
7db42268ce bpf: ensure correct string offsets in BTF.ext
BPF CO-RE relocations contain offsets to strings buffered in the BTF
string table. These BTF-specific strings are stored in memory in the
CTF auxilliary strtab, which at output time is concatenated onto the end
of the standard strtab.

Previously, these string offsets were computed at the time the
relocations were created. But strings could be added to the standard
strtab after this point, causing the offsets to no longer be correct.

Compute the offsets just before output instead, when they are sure to no
longer change.

gcc/ChangeLog:

	* config/bpf/coreout.cc (bpf_core_reloc_add): Do not account
	for base strtab offset yet as it may change.
	(output_asm_btfext_core_reloc): Do so here instead.
	(output_btfext_core_sections): Likewise.
2022-01-18 13:20:49 -08:00
David Faust
43ec265213 bpf: write CO-RE relocation record size only once
The CO-RE relocation record size should be written only once in the
.BTF.ext section, not once for each section with relocations.

gcc/ChangeLog:

	* config/bpf/coreout.cc (output_btfext_header): Account for
	4-byte record size in core_relo_len.
	(output_btfext_core_sections): Only write record size once.
	* config/bpf/coreout.h (btf_ext_section_header): Delete unused
	member.

gcc/testsuite/ChangeLog:

	* gcc.target/bpf/core-section-1.c: Adjust expected record size
	occurrences.
2022-01-18 13:20:49 -08:00
David Malcolm
2aefe248aa analyzer: fix ICE on unary ops folding to casts of constants [PR104089]
gcc/analyzer/ChangeLog:
	PR analyzer/104089
	* region-model-manager.cc
	(region_model_manager::get_or_create_constant_svalue): Assert that
	we have a CONSTANT_CLASS_P.
	(region_model_manager::maybe_fold_unaryop): Only fold a constant
	when fold_unary's result is a constant or a cast of a constant.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/pr104089.c: New test.
	PR analyzer/104089

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-01-18 15:56:23 -05:00
David Malcolm
79e746bb05 analyzer: fix ICE on realloc of zeroed memory [PR104062]
gcc/analyzer/ChangeLog:
	PR analyzer/104062
	* region-model-manager.cc
	(region_model_manager::maybe_fold_sub_svalue): Avoid casting to
	NULL type when folding access to repeated svalue.

gcc/testsuite/ChangeLog:
	PR analyzer/104062
	* gcc.dg/analyzer/pr104062.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-01-18 15:55:12 -05:00
Jonathan Wakely
fe3ed885cd libstdc++: Limit new basic_string(nullptr_t) constructor to C++23 [PR104099]
The new deleted constructors added by P2166R1 are a breaking change,
making previously valid code ill-formed in C++23. As a result, they
should only be defined for C++23 and not for C++11 and up.

libstdc++-v3/ChangeLog:

	PR libstdc++/104099
	* include/bits/basic_string.h (basic_string(nullptr_t)): Only
	define for C++23.
	(operator=(nullptr_t)): Likewise.
	* include/bits/cow_string.h: Likewise.
	* include/std/string_view (basic_string_view(nullptr_t)):
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/nullptr.cc: Adjust
	expected error. Add examples that become ill-formed in C++23.
	* testsuite/21_strings/basic_string_view/cons/char/nonnull.cc:
	Adjust expected errors.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc:
	Likewise.
2022-01-18 20:41:46 +00:00
Patrick Palka
3c4a54adb2 c++: DEPENDENT_OPERATOR_TYPE as type of NTTP [PR104074]
We're incorrectly rejecting the below testcase during template argument
coercion because invalid_nontype_parm_type_p returns true for
DEPENDENT_OPERATOR_TYPE in C++17 mode.

This patch fixes this by partially rewriting invalid_nontype_parm_type_p
in terms of WILDCARD_TYPE_P, for which DEPENDENT_OPERATOR_TYPE is true,
so that the predicate handles wildcard types consistently.

	PR c++/104074

gcc/cp/ChangeLog:

	* pt.cc (invalid_nontype_parm_type_p): Use WILDCARD_TYPE_P so
	that we return false for DEPENDENT_OPERATOR_TYPE too.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/nontype-auto20.C: New test.
2022-01-18 14:50:06 -05:00
Maciej W. Rozycki
dad495e301 RISC-V: Fix use-after-free error in `parse_multiletter_ext'
Avoid undefined arithmetic involving a pointer to a heap allocation that
has been freed and move a problematic calculation ahead of the following
call to `free' in `riscv_subset_list::parse_multiletter_ext', removing a
compilation error:

.../gcc/common/config/riscv/riscv-common.cc: In member function 'const char* riscv_subset_list::parse_multiletter_ext(const char*, const char*, const char*)':
.../gcc/common/config/riscv/riscv-common.cc:905:27: error: pointer 'subset' used after 'void free(void*)' [-Werror=use-after-free]
  905 |       p += end_of_version - subset;
      |            ~~~~~~~~~~~~~~~^~~~~~~~
.../gcc/common/config/riscv/riscv-common.cc:904:12: note: call to 'void free(void*)' here
  904 |       free (subset);
      |       ~~~~~^~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:2428: riscv-common.o] Error 1

and a build regression from commit 671a283636 ("Add -Wuse-after-free
[PR80532].").

	gcc/
	* common/config/riscv/riscv-common.cc
	(riscv_subset_list::parse_multiletter_ext): Move pointer
	arithmetic ahead of `free'.
2022-01-18 19:39:13 +00:00
Harald Anlauf
0d01a27226 Fortran: handle expansion of zero-sized array constructors
gcc/fortran/ChangeLog:

	PR fortran/103692
	* array.cc (gfc_expand_constructor): Handle zero-sized array
	constructors.

gcc/testsuite/ChangeLog:

	PR fortran/103692
	* gfortran.dg/pr102520.f90: Adjust error messages.
	* gfortran.dg/pr103692.f90: New test.
2022-01-18 20:02:11 +01:00
Jason Merrill
7ca2160170 c++: new (nothrow) array cleanup [PR104007]
For this testcase, the cleanup that is supposed to happen if initialization
throws was wrongly being run on the normal control path as well.  This turns
out to be because the EH-only handling in gimple_push_cleanup didn't apply
to conditional cleanups such as we have for nothrow new, since we check
whether the result is non-null before proceeding with the initialization.

	PR c++/104007

gcc/ChangeLog:

	* gimplify.cc (gimple_push_cleanup): Handle eh_only in conditional
	context.

gcc/testsuite/ChangeLog:

	* g++.dg/eh/new2.C: New test.
2022-01-18 12:42:52 -05:00
Sandra Loosemore
3a0837b8fb middle-end: move initialization of stack_limit_rtx [PR103163]
stack_limit_rtx was being initialized before init_reg_modes_target (),
resulting in the REG expression being created incorrectly and an ICE
later in compilation.

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

	PR middle-end/103163

	gcc/
	* emit-rtl.cc (init_emit_regs): Initialize stack_limit_rtx here...
	(init_emit_once): ...not here.
2022-01-18 09:27:36 -08:00
Jonathan Wakely
e13e95bd27 libstdc++: Use __cpp_lib_concepts in std::reverse_iterator [PR104098]
We should not assume that std::iter_value_t etc. are defined
unconditionally for C++20 mode.

libstdc++-v3/ChangeLog:

	PR libstdc++/104098
	* include/bits/stl_iterator.h (reverse_iterator): Check
	__cpp_lib_concepts instead of __cplusplus.
2022-01-18 16:31:03 +00:00
Jonathan Wakely
302343d8dd libstdc++: Fix ambiguous std::pair constructors [PR101124]
The deprecated non-standard std::pair constructors that allow
constructing std::pair<move-only-type, pointer-type> from an rvalue and
a literal zero where not sufficiently constrained. They were viable when
constructing std::pair<copyable-type, pointer-type>, and that case
should work fine using the standard constructors.

Replace the constraints on the non-standard constructors so they are
only viable in cases that should actually be ill-formed according to the
standard.

Also rename __null_ptr_constant to __zero_as_null_pointer_constant so it
matches the name of the -Wzero-as-null-pointer-constant warning. Also
make the text of the deprecated warning describe the problem in more
detail.

libstdc++-v3/ChangeLog:

	PR libstdc++/101124
	* include/bits/stl_pair.h (pair): Adjust constraints on
	deprecated constructors accepting literal zero as null pointer
	constant. Improve wording of deprecated attribute.
	* testsuite/20_util/pair/cons/99957.cc: Check that deprecated
	constructors do not cause ambiguities for copyable types.
2022-01-18 16:31:03 +00:00
Jonathan Wakely
50bc6e463b libstdc++: Fix suggested alternative to std::ptr_fun
libstdc++-v3/ChangeLog:

	* include/bits/stl_function.h (ptr_fun): Fix suggestion for
	non-deprecated alternative.
2022-01-18 16:31:02 +00:00
Tom Honermann
0e4e4b37d9 libstdc++: Declare std::c8rtomb and std::mbrtoc8 if provided by the C library
This patch completes implementation of the C++20 proposal P0482R6 [1] by
adding declarations of std::c8rtomb() and std::mbrtoc8() in <cuchar> if
provided by the C library in <uchar.h>.

This patch addresses feedback provided in response to a previous patch
submission [2].

Autoconf changes determine if the C library declares c8rtomb and mbrtoc8
at global scope when uchar.h is included and compiled with either
-fchar8_t or -std=c++20. New _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T
and _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20 configuration macros
reflect the probe results. The <cuchar> header declares these functions
in the std namespace only if available and the _GLIBCXX_USE_CHAR8_T
configuration macro is defined (by default it is defined if the C++20
__cpp_char8_t feature test macro is defined)

Patches to glibc to implement c8rtomb and mbrtoc8 have been submitted [3].

New tests validate the presence of these declarations. The tests pass
trivially if the C library does not provide these functions. Otherwise
they ensure that the functions are declared when <cuchar> is included
and either -fchar8_t or -std=c++20 is enabled.

1]: WG21 P0482R6
      "char8_t: A type for UTF-8 characters and strings (Revision 6)"
      https://wg21.link/p0482r6

[2]: [PATCH] C++ P0482R6 char8_t: declare std::c8rtomb and std::mbrtoc8
if provided by the C library
      https://gcc.gnu.org/pipermail/libstdc++/2021-June/052685.html

[3]: "C++20 P0482R6 and C2X N2653"
      [Patch 0/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135061.html
      [Patch 1/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135062.html
      [Patch 2/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135063.html
      [Patch 3/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135064.html

libstdc++-v3/ChangeLog:

	* acinclude.m4: Define config macros if uchar.h provides
	c8rtomb() and mbrtoc8().
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/c_compatibility/uchar.h (c8rtomb, mbrtoc8): Define.
	* include/c_global/cuchar (c8rtomb, mbrtoc8): Likewise.
	* include/c_std/cuchar (c8rtomb, mbrtoc8): Likewise.
	* testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc:
	New test.
	* testsuite/21_strings/headers/cuchar/functions_std_fchar8_t.cc:
	New test.
2022-01-18 16:31:02 +00:00
Jonathan Wakely
d7f2a09e98 libstdc++: Define <stdatomic.h> for C++23
This adds the C++23 <stdatomic.h> header, as proposed by P0943R6, for
compatibility with C code.

There are still some ABI differences between atomic_xxx in C and C++
std::atomic_xxx in C++, so this only provides source compatibility, not
binary compatibility.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Install new header.
	* include/Makefile.in: Regenerate.
	* include/c_compatibility/stdatomic.h: New file.
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: New test.
2022-01-18 16:31:02 +00:00
Martin Liska
58385f6ace Fix -Wformat-diag in various targets.
gcc/ChangeLog:

	* collect2.cc (scan_libraries): Fix -Wformat-diag issues.
	* config/aarch64/aarch64-builtins.cc (aarch64_simd_expand_builtin): Likewise.
	* config/arc/arc.md: Likewise.
	* config/avr/avr.cc (avr_section_type_flags): Likewise.
	* config/bfin/bfin.cc (bfin_option_override): Likewise.
	(bfin_handle_longcall_attribute): Likewise.
	* config/cris/cris.h (FUNCTION_PROFILER): Likewise.
	* config/frv/frv.cc (frv_expand_builtin): Likewise.
	* config/ia64/ia64-c.cc (ia64_hpux_handle_builtin_pragma): Likewise.
	* config/iq2000/iq2000.cc (save_restore_insns): Likewise.
	(iq2000_print_operand_address): Likewise.
	(iq2000_print_operand): Likewise.
	* config/m32c/m32c-pragma.cc (m32c_pragma_memregs): Likewise.
	(m32c_pragma_address): Likewise.
	* config/m68k/m68k.cc (m68k_handle_fndecl_attribute): Likewise.
	* config/mips/mips.cc (mips_handle_interrupt_attr): Likewise.
	(mips_set_compression_mode): Likewise.
	* config/mmix/mmix.cc (mmix_function_profiler): Likewise.
	(mmix_print_operand): Likewise.
	(mmix_output_shiftvalue_op_from_str): Likewise.
	(mmix_output_shifted_value): Likewise.
	* config/msp430/driver-msp430.cc (msp430_select_hwmult_lib): Likewise.
	* config/msp430/msp430.cc (msp430_option_override): Likewise.
	(msp430_attr): Likewise.
	(msp430_expand_delay_cycles): Likewise.
	(msp430_expand_builtin): Likewise.
	* config/rs6000/aix73.h: Likewise.
	* config/rs6000/rtems.h (INVALID_64BIT): Likewise.
	* config/rx/rx.cc (rx_expand_builtin_mvtc): Likewise.
	(valid_psw_flag): Likewise.
	* config/sh/sh.cc (parse_validate_atomic_model_option): Likewise.
	* config/stormy16/stormy16.cc (xstormy16_function_profiler): Likewise.
	(xstormy16_expand_builtin_va_start): Likewise.
	(xstormy16_handle_below100_attribute): Likewise.
2022-01-18 17:25:37 +01:00
Martin Liska
88619b5b4c vms: fix -Wformat-diag warnings.
gcc/ChangeLog:

	* config/vms/vms-c.cc (vms_pragma_nostandard): Fix -Wformat-diag
	warning.
	(vms_pragma_standard): Likewise.
	(vms_pragma_extern_prefix): Likewise.
2022-01-18 17:25:37 +01:00
Martin Liska
7e5baa7e6f xtensa: fix -Wformat-diag warnings.
gcc/ChangeLog:

	* config/xtensa/xtensa.cc (print_operand): Fix warnings.
	(print_operand_address): Likewise.
	(xtensa_multibss_section_type_flags): Likewise.
2022-01-18 17:25:37 +01:00
Martin Liska
67d5e395b9 rs6000: fix last -Wformat-diag
gcc/ChangeLog:

	* config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Change
	wording of an error message.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/bfp/scalar-extract-exp-5.c: Update scanned
	pattern.
	* gcc.target/powerpc/bfp/scalar-extract-sig-5.c: Likewise.
	* gcc.target/powerpc/bfp/scalar-insert-exp-11.c: Likewise.
2022-01-18 17:25:37 +01:00
Martin Liska
62fcdefba1 v850: fix -Wformat-diag warnings.
gcc/ChangeLog:

	* config/v850/v850-c.cc (pop_data_area): Fix -Wformat-diag
	warning.
	(ghs_pragma_section): Likewise.
	(ghs_pragma_interrupt): Likewise.
	(ghs_pragma_starttda): Likewise.
	(ghs_pragma_startsda): Likewise.
	(ghs_pragma_startzda): Likewise.
	(ghs_pragma_endtda): Likewise.
	(ghs_pragma_endsda): Likewise.
	(ghs_pragma_endzda): Likewise.
2022-01-18 17:25:37 +01:00
Martin Liska
67f84a803f nds32: fix -Wformat-diag warning.
gcc/ChangeLog:

	* config/nds32/nds32-intrinsic.cc (nds32_expand_builtin_impl):
	Fix warnings.
	* config/nds32/nds32-intrinsic.md: Likewise.
	* config/nds32/nds32-isr.cc (nds32_check_isr_attrs_conflict): Likewise.
	* config/nds32/nds32.cc (nds32_print_operand): Likewise.
	(nds32_insert_attributes): Likewise.
2022-01-18 17:25:36 +01:00
Martin Liska
b1f3640912 nvptx: fix -Wformat-diag warnings
gcc/ChangeLog:

	* config/nvptx/nvptx.cc (nvptx_goacc_validate_dims_1): Wrap
	keyword.
	* config/nvptx/nvptx.md: Remove trailing dot.

libgomp/ChangeLog:

	* testsuite/libgomp.oacc-c++/privatized-ref-2.C: Update keyword
	in dg-warning.
	* 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.
2022-01-18 17:25:36 +01:00
Martin Liska
591b6e00d1 riscv: fix -Wformat-diag errors.
gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc (riscv_subset_list::add):
	Wrap keywords with quotes and remove trailing dots.
	(riscv_subset_list::parsing_subset_version): Likewise.
	(riscv_subset_list::parse_std_ext): Likewise.
	(riscv_subset_list::parse_multiletter_ext): Likewise.
	* config/riscv/riscv.cc (riscv_handle_type_attribute): Likewise.
2022-01-18 17:25:36 +01:00
Andre Vieira
7ca1582ca6 [vect] Add main vectorized loop unrolling
gcc/ChangeLog:

	* tree-vect-loop.cc (vect_estimate_min_profitable_iters): Pass new
	argument suggested_unroll_factor.
	(vect_analyze_loop_costing): Likewise.
	(_loop_vec_info::_loop_vec_info): Initialize new member
	suggested_unroll_factor.
	(vect_determine_partial_vectors_and_peeling): Make epilogue of unrolled
	main loop use partial vectors.
	(vect_analyze_loop_2): Pass and use new argument
	suggested_unroll_factor.
	(vect_analyze_loop_1): Change to intialize local
	suggested_unroll_factor and use it.
	(vectorizable_reduction): Don't use single_defuse_cycle when unrolling.
	* tree-vectorizer.h (_loop_vec_info::_loop_vec_info): Add new member
	suggested_unroll_factor.
	(vector_costs::vector_costs): Add new member m_suggested_unroll_factor.
	(vector_costs::suggested_unroll_factor): New getter function.
	(finish_cost): Set return argument suggested_unroll_factor.
2022-01-18 16:23:23 +00:00
Andrew MacLeod
254ada46ae Limit the number of relations registered per basic block.
In pathological cases, the number of transitive relations being added is
potentially quadratic.  Lookups for relations in a block is linear in
nature, so simply limit the number of relations to some reasonable number.

	PR tree-optimization/104038
	* doc/invoke.texi (relation-block-limit): New.
	* params.opt (relation-block-limit): New.
	* value-relation.cc (dom_oracle::register_relation): Check for NULL
	record before invoking transitive registery.
	(dom_oracle::set_one_relation): Check limit before creating record.
	(dom_oracle::register_transitives): Stop when no record created.
	* value-relation.h (relation_chain_head::m_num_relations): New.
2022-01-18 10:02:02 -05:00
Richard Biener
c952126870 ipa/103989 - avoid IPA inlining of small functions with -Og
The following change avoids doing IPA inlining of small functions
into functions compiled with -Og - those functions will see almost no
followup scalar cleanups so that the benefit anticipated by the
inliner will not be realized and instead the late diagnostic code
will be confused by dead code that is left around.

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

	PR ipa/103989
	* ipa-inline.cc (inline_small_functions): Do not enqueue call
	edges originating in functions compiled with -Og.

	* g++.dg/opt/pr103989.C: New testcase.
2022-01-18 15:43:04 +01:00
Richard Biener
e89b2a270d ipa/103989 - tame IPA optimizations at -Og
With -Og we are not prepared to do cleanup after IPA optimizations
and dead code exposed by those confuses late diagnostic passes.
This is a first patch removing unwanted IPA optimizations, namely
both late modref and pure-const analysis.

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

	PR ipa/103989
	* passes.def (pass_all_optimizations_g): Remove pass_modref
	and pass_local_pure_const.
2022-01-18 15:43:04 +01:00
Martin Liska
7402e40a2e Fix -Wformat-diag for s390x-ibm-tpf.
gcc/ChangeLog:

	* config/s390/s390.cc: Fix -Wformat-diag warnings.
2022-01-18 14:45:21 +01:00
Martin Liska
6a18f7751b Fix -Wformat-diag for s390x target.
gcc/ChangeLog:

	* config/s390/s390-c.cc (s390_expand_overloaded_builtin): Wrap
	keyword in quotes.
	(s390_resolve_overloaded_builtin): Remove trailing dot.
	* config/s390/s390.cc (s390_const_operand_ok): Use - for range.
	(s390_expand_builtin): Remove trailing dot.
	(s390_emit_prologue): Likewise, use semicolon.
	(s390_option_override_internal): Update keyword.
	* varasm.cc (do_assemble_alias): Wrap keyword in quotes.
2022-01-18 14:45:11 +01:00
Martin Liska
8355f3188b Fix -Wformat-diag for rs6000 target (part 1).
gcc/ChangeLog:

	* config/rs6000/rs6000-call.cc (rs6000_expand_builtin): Wrap
	keywords and use %qs instead of %<%s%>.
2022-01-18 14:38:04 +01:00
Richard Biener
3ed40db0f1 tree-optimization/103987 - guard DSE modref query
This adds a missing guard for a pointer to the DSE modref query,
otherwise we can end up invoking APIs desired to only work on
pointers on non-pointers when there are mismatches between declared
and actual arguments of functions in the program.

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

	PR tree-optimization/103987
	* tree-ssa-dse.cc (dse_optimize_call): Properly guard modref
	query with a pointer check.

	* gcc.dg/torture/pr103987.c: New testcase.
2022-01-18 14:33:01 +01:00
Richard Biener
4288b57aff pack fields in line-map data structures
As pointed out by pahole.

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

libcpp/
	* include/line-map.h (class line_maps): Re-arrange fields
	to minimize padding.
	(class rich_location): Likewise.
	* line-map.cc (rich_location::rich_location): Adjust.
2022-01-18 14:33:01 +01:00
Xionghu Luo
0efc551e59 Update email address
ChangeLog:

	* MAINTAINERS: Update my email address.
2022-01-18 07:20:51 -06:00
Richard Sandiford
38ec23fafb aarch64: Fix overly optimistic LDP/STP matching [PR104005]
In g:526e1639aa76b0a8496b0dc3a3ff2c450229544e I'd added support
for finding more consecutive MEMs.  However, the check was too
eager, in that it matched MEM_REFs with the same base address
even if that base address was an arbitrary SSA name.  This can
give wrong results if a MEM_REF from one loop iteration is
compared with a MEM_REF from another (e.g. after rtl unrolling).

In principle, we could still accept MEM_REFs based on the same
incoming SSA name, but there seems to be no out-of-the-box API
for doing that.  Adding a new one at this stage in GCC 12 doesn't
feel like a good risk/reward trade-off.

This patch therefore restricts the MEM_EXPR comparison to base decls
only, excluding all MEM_REFs.  It means we lose all the new STPs in
the PR testcase but keep the ones in the original stp_1.c testcase.

gcc/
	PR target/104005
	* config/aarch64/aarch64.cc (aarch64_check_consecutive_mems):
	When using MEM_EXPR, require the base to be a decl.

gcc/testsuite/
	PR target/104005
	* gcc.target/aarch64/pr104005.c: New test.
2022-01-18 12:20:00 +00:00
Richard Biener
d21db05b6f pack fields in cgraph_simd_clone_arg and struct function
As pointed out by pahole.

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

	* cgraph.h (struct cgraph_simd_clone_arg): Re-arrange fields to
	avoid padding.
	* function.h (struct function): Likewise.
2022-01-18 12:19:49 +01:00
Arnaud Charlet
abb748aaf3 Update prerequisites for GNAT
* doc/install.texi: Update prerequisites for GNAT
2022-01-18 05:46:09 -05:00
Andrew Pinski
76fe494230 Fix tree-optimization/101941: IPA splitting out function with error attribute
The Linux kernel started to fail compile when the jump threader was improved
(r12-2591-g2e96b5f14e4025691). This failure was due to the IPA splitting code
decided now to split off the basic block which contained two functions,
one of those functions included the error attribute on them.  This patch fixes
the problem by disallowing basic blocks from being split which contain functions
that have either the error or warning attribute on them.

The two new testcases are to make sure we still split the function for other
places if we reject the one case.

Committed as approved after Bootstrapped and tested on x86_64-linux-gnu with no regressions.

	PR tree-optimization/101941

gcc/ChangeLog:

	* ipa-split.cc (visit_bb): Disallow function calls where
	the function has either error or warning attribute.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/compile/pr101941-1.c: New test.
	* gcc.dg/tree-ssa/pr101941-1.c: New test.
2022-01-18 02:35:48 -08:00
Jonathan Wakely
8f6b62e0f0 libstdc++: Use GCC's predefined macro for endianness [PR104080]
Instead of hardcoded preprocessor conditionals with explicit target
checks, just rely on the fact that __BYTE_ORDER__ is always defined by
GCC.

libstdc++-v3/ChangeLog:

	PR libstdc++/104080
	* src/c++17/fast_float/LOCAL_PATCHES: Update.
	* src/c++17/fast_float/fast_float.h (FASTFLOAT_IS_BIG_ENDIAN):
	Define in terms of __BYTE_ORDER__.
2022-01-18 10:03:16 +00:00
Jonathan Wakely
97b9236976 libstdc++: Fix deduction failure for std::min call [PR104080]
libstdc++-v3/ChangeLog:

	PR libstdc++/104080
	* src/c++17/fast_float/LOCAL_PATCHES: UPDATE.
	* src/c++17/fast_float/fast_float.h (round): Use explicit
	template argument list for std::min.
2022-01-18 09:53:30 +00:00
Jonathan Wakely
ac358eef7a libstdc++: Update status tables in manual
libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2017.xml: Update C++17 status.
	* doc/xml/manual/status_cxx2020.xml: Use 12.1 instead of 12 for
	upcoming release.
	* doc/html/manual/status.html: Regenerate.
2022-01-18 09:51:02 +00:00
Jonathan Wakely
5f3c0ee908 libstdc++: Improve comments describing --enable-fully-dynamic-string
libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING): Improve
	comments.
	* configure: Regenerate.
2022-01-18 09:51:02 +00:00
Martin Liska
e8feb059ca Add check_effective_target_python3_module.
gcc/testsuite/ChangeLog:

	* gcc.src/maintainers.exp: Use
	check_effective_target_python3_module for checking of unicode
	module.
	* lib/target-supports.exp: Add
	check_effective_target_python3_module.
2022-01-18 10:32:39 +01:00
Richard Biener
00dc7877ee tree-optimization/104064 - UBSAN issue in vect dataref analysis
Since we order DRs after DR_INIT we know the difference will be
positive and thus can avoid signed overflow issues by using
unsigned arithmetic to produce the known unsigned result.

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

	PR tree-optimization/104064
	* tree-vect-data-refs.cc (vect_analyze_data_ref_accesses): Check
	DR_INIT fits in a signed HWI, represent the difference from the
	first DR in unsigned.
2022-01-18 10:27:56 +01:00