Commit Graph

187541 Commits

Author SHA1 Message Date
Jonathan Wakely db853ff78a libstdc++: Install GDB pretty printers for debug library
The additional libraries installed by --enable-libstdcxx-debug are built
without optimization to aid debugging, but the Python pretty printers
are not installed alongside them. This means that you can step through
the unoptimized library code, but at the expense of pretty printing the
library types.

This remedies the situation by installing another copy of the GDB hooks
alongside the debug version of libstdc++.so.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* python/Makefile.am [GLIBCXX_BUILD_DEBUG] (install-data-local):
	Install another copy of the GDB hook.
	* python/Makefile.in: Regenerate.
2021-08-16 17:51:42 +01:00
Sebastian Huber 8cdcea51c0 gcov: Add TARGET_GCOV_TYPE_SIZE target hook
If -fprofile-update=atomic is used, then the target must provide atomic
operations for the counters of the type returned by get_gcov_type().
This is a 64-bit type for targets which have a 64-bit long long type.
On 32-bit targets this could be an issue since they may not provide
64-bit atomic operations.  Allow targets to override the default type
size with the new TARGET_GCOV_TYPE_SIZE target hook.

If a 32-bit gcov type size is used, then there is currently a warning in
libgcov-driver.c in a dead code block due to
sizeof (counter) == sizeof (gcov_unsigned_t):

libgcc/libgcov-driver.c: In function 'dump_counter':
libgcc/libgcov-driver.c:401:46: warning: right shift count >= width of type [-Wshift-count-overflow]
  401 |     dump_unsigned ((gcov_unsigned_t)(counter >> 32), dump_fn, arg);
      |                                              ^~

gcc/c-family/

	* c-cppbuiltin.c (c_cpp_builtins): Define
	__LIBGCC_GCOV_TYPE_SIZE if flag_building_libgcc is true.

gcc/

	* config/sparc/rtemself.h (SPARC_GCOV_TYPE_SIZE): Define.
	* config/sparc/sparc.c (sparc_gcov_type_size): New.
	(TARGET_GCOV_TYPE_SIZE): Redefine if SPARC_GCOV_TYPE_SIZE is defined.
	* coverage.c (get_gcov_type): Use targetm.gcov_type_size().
	* doc/tm.texi (TARGET_GCOV_TYPE_SIZE): Add hook under "Misc".
	* doc/tm.texi.in: Regenerate.
	* target.def (gcov_type_size): New target hook.
	* targhooks.c (default_gcov_type_size): New.
	* targhooks.h (default_gcov_type_size): Declare.
	* tree-profile.c (gimple_gen_edge_profiler): Use precision of
	gcov_type_node.
	(gimple_gen_time_profiler): Likewise.

libgcc/

	* libgcov.h (gcov_type): Define using __LIBGCC_GCOV_TYPE_SIZE.
	(gcov_type_unsigned): Likewise.
2021-08-16 15:34:25 +02:00
Eric Botcazou be024a1285 Fix regression in debug info for Ada with DWARF 5
add_scalar_info can directly generate a reference to an existing DIE for a
scalar attribute, e.g the upper bound of a VLA, but it does so only if this
existing DIE has a location or is a constant:

              if (get_AT (decl_die, DW_AT_location)
                  || get_AT (decl_die, DW_AT_data_member_location)
                  || get_AT (decl_die, DW_AT_const_value))

Now, in DWARF 5, members of a structure that are bitfields no longer have a
DW_AT_data_member_location but a DW_AT_data_bit_offset attribute instead, so
the condition is bypassed.

gcc/
	* dwarf2out.c (add_scalar_info): Deal with DW_AT_data_bit_offset.
2021-08-16 15:27:42 +02:00
Tobias Burnus e660441f94 [OpenMP] Update omp-low.c's omp_runtime_api_call [PR101931]
gcc/ChangeLog:

	PR middle-end/101931
	* omp-low.c (omp_runtime_api_call): Update for routines
	added in the meanwhile.
2021-08-16 14:00:13 +02:00
Martin Liska c517cf2e68 Speed up jump table switch detection.
PR tree-optimization/100393

gcc/ChangeLog:

	* tree-switch-conversion.c (group_cluster::dump): Use
	  get_comparison_count.
	(jump_table_cluster::find_jump_tables): Pre-compute number of
	comparisons and then decrement it. Cache also max_ratio.
	(jump_table_cluster::can_be_handled): Change signature.
	* tree-switch-conversion.h (get_comparison_count): New.
2021-08-16 13:37:49 +02:00
Eric Botcazou 29020d0527 Disable GNAT encodings by default
Given the latest work in the compiler and debugger, we no longer need to use
most GNAT-specific encodings in the debug info generated for an Ada program,
so the attached patch disables them, except with -fgnat-encodings=all.

gcc/
	* dwarf2out.c (add_data_member_location_attribute): Use GNAT
	encodings only when -fgnat-encodings=all is specified.
	(add_bound_info): Likewise.
	(add_byte_size_attribute): Likewise.
	(gen_member_die): Likewise.
2021-08-16 12:16:32 +02:00
Thomas Schwinge a2ab2f0dfb Address '?:' issues in 'libgomp.oacc-c-c++-common/mode-transitions.c'
[...]/libgomp.oacc-c-c++-common/mode-transitions.c: In function ‘t3’:
    [...]/libgomp.oacc-c-c++-common/mode-transitions.c:127:43: warning: ‘?:’ using integer constants in boolean context, the expression will always evaluate to ‘true’ [-Wint-in-bool-context]
      127 |     assert (arr[i] == ((i % 64) < 32) ? 1 : -1);
          |                                           ^

    [...]/libgomp.oacc-c-c++-common/mode-transitions.c: In function ‘t9’:
    [...]/libgomp.oacc-c-c++-common/mode-transitions.c:359:46: warning: ‘?:’ using integer constants in boolean context, the expression will always evaluate to ‘true’ [-Wint-in-bool-context]
      359 |         assert (arr[i] == ((i % 3) == 0) ? 1 : 2);
          |                                              ^

..., and PR101862 "[C, C++] Potential '?:' diagnostic for always-true
expressions in boolean context".

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/mode-transitions.c: Address
	'?:' issues.
2021-08-16 12:12:09 +02:00
Thomas Schwinge df98015fb7 Plug 'par' memory leak in 'gcc/omp-oacc-neuter-broadcast.cc:execute_omp_oacc_neuter_broadcast'
Fix-up for recent commit e2a58ed6dc
"openacc: Middle-end worker-partitioning support".

	gcc/
	* omp-oacc-neuter-broadcast.cc
	(execute_omp_oacc_neuter_broadcast): Plug 'par' memory leak.
2021-08-16 12:10:01 +02:00
Thomas Schwinge 7b9d99e615 Clarify memory management for 'prop_set' in 'gcc/omp-oacc-neuter-broadcast.cc'
Clean-up for recent commit e2a58ed6dc
"openacc: Middle-end worker-partitioning support".

	gcc/
	* omp-oacc-neuter-broadcast.cc
	(execute_omp_oacc_neuter_broadcast): Clarify memory management for
	'prop_set'.
2021-08-16 12:09:14 +02:00
Thomas Schwinge 049eda8274 Avoid 'GTY' use for 'gcc/omp-oacc-neuter-broadcast.cc:field_map'
... and further simplify related things a bit.

Fix-up/clean-up for recent commit e2a58ed6dc
"openacc: Middle-end worker-partitioning support".

	gcc/
	* omp-oacc-neuter-broadcast.cc (field_map): Move variable into...
	(execute_omp_oacc_neuter_broadcast): ... here.
	(install_var_field, build_receiver_ref, build_sender_ref): Take
	'field_map_t *' parameter.  Adjust all users.
	(worker_single_copy, neuter_worker_single): Take a
	'record_field_map_t *' parameter.  Adjust all users.
2021-08-16 11:57:27 +02:00
liuhongt 1afcf5705a Fix ICE.
gcc/ChangeLog:

	PR target/101930
	* config/i386/i386.md (ldexp<mode>3): Force operands[1] to
	reg.

gcc/testsuite/ChangeLog:

	PR target/101930
	* gcc.target/i386/pr101930.c: New test.
2021-08-16 17:22:11 +08:00
Martin Liska 91292490d5 ipa: make target_clone default decl local [PR101726]
PR ipa/101726

gcc/ChangeLog:

	* multiple_target.c (create_dispatcher_calls): Make default
	  function local only if it is a definition.
2021-08-16 09:53:41 +02:00
Martin Liska b0de3ad262 ipa: ICF should check SSA_NAME_IS_DEFAULT_DEF
PR ipa/100600

gcc/ChangeLog:

	* ipa-icf-gimple.c (func_checker::compare_ssa_name): Do not
	  consider equal SSA_NAMEs when one is a param.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/pr100600.c: New test.
2021-08-16 09:53:11 +02:00
liuhongt faf2b6bc52 Optimize __builtin_shuffle_vector.
1. Support vpermw/vpermb in ix86_expand_vec_one_operand_perm_avx512.
2. Support 256/128-bits vpermi2b ix86_expand_vec_perm_vpermt2.
3. Add define_insn_and_split to optimize specific vector permutation to opmov{dw,wb,qd}.

gcc/ChangeLog:

	PR target/101846
	* config/i386/i386-expand.c (ix86_expand_vec_perm_vpermt2):
	Support vpermi2b for V32QI/V16QImode.
	(ix86_extract_perm_from_pool_constant): New function.
	(ix86_expand_vec_one_operand_perm_avx512): Support
	vpermw/vpermb under TARGET_AVX512BW/TARGET_AVX512VBMI.
	(expand_vec_perm_1): Adjust comments for upper.
	* config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant):
	New declare.
	* config/i386/predicates.md (permvar_truncate_operand): New predicate.
	(pshufb_truncv4siv4hi_operand): Ditto.
	(pshufb_truncv8hiv8qi_operand): Ditto.
	* config/i386/sse.md (*avx512bw_permvar_truncv16siv16hi_1):
	New pre_reload define_insn_and_split.
	(*avx512f_permvar_truncv8siv8hi_1): Ditto.
	(*avx512f_vpermvar_truncv8div8si_1): Ditto.
	(*avx512f_permvar_truncv32hiv32qi_1): Ditto.
	(*avx512f_permvar_truncv16hiv16qi_1): Ditto.
	(*avx512f_permvar_truncv4div4si_1): Ditto.
	(*avx512f_pshufb_truncv8hiv8qi_1): Ditto.
	(*avx512f_pshufb_truncv4siv4hi_1): Ditto.
	(*avx512f_pshufd_truncv2div2si_1): Ditto.

gcc/testsuite/ChangeLog:

	PR target/101846
	* gcc.target/i386/pr101846-2.c: New test.
	* gcc.target/i386/pr101846-3.c: New test.
	* gcc.target/i386/pr101846-4.c: New test.
2021-08-16 15:29:36 +08:00
Tobias Burnus 53d5b59cb3 Fortran/OpenMP: Add support for OpenMP 5.1 masked construct
Commit r12-2891-gd0befed793b94f3f407be44e6f69f81a02f5f073 added C/C++
support for the masked construct. This patch extends it to
Fortran.

gcc/fortran/ChangeLog:

	* dump-parse-tree.c (show_omp_clauses): Handle 'filter' clause.
	(show_omp_node, show_code_node): Handle (combined) omp masked construct.
	* frontend-passes.c (gfc_code_walker): Likewise.
	* gfortran.h (enum gfc_statement): Add ST_OMP_*_MASKED*.
	(enum gfc_exec_op): Add EXEC_OMP_*_MASKED*.
	* match.h (gfc_match_omp_masked, gfc_match_omp_masked_taskloop,
	gfc_match_omp_masked_taskloop_simd, gfc_match_omp_parallel_masked,
	gfc_match_omp_parallel_masked_taskloop,
	gfc_match_omp_parallel_masked_taskloop_simd): New prototypes.
	* openmp.c (enum omp_mask1): Add OMP_CLAUSE_FILTER.
	(gfc_match_omp_clauses): Match it.
	(OMP_MASKED_CLAUSES, gfc_match_omp_parallel_masked,
	gfc_match_omp_parallel_masked_taskloop,
	gfc_match_omp_parallel_masked_taskloop_simd,
	gfc_match_omp_masked, gfc_match_omp_masked_taskloop,
	gfc_match_omp_masked_taskloop_simd): New.
	(resolve_omp_clauses): Resolve filter clause.
	(gfc_resolve_omp_parallel_blocks, resolve_omp_do,
	omp_code_to_statement, gfc_resolve_omp_directive): Handle
	omp masked constructs.
	* parse.c (decode_omp_directive, case_exec_markers,
	gfc_ascii_statement, parse_omp_do, parse_omp_structured_block,
	parse_executable): Likewise.
	* resolve.c (gfc_resolve_blocks, gfc_resolve_code): Likewise.
	* st.c (gfc_free_statement): Likewise.
	* trans-openmp.c (gfc_trans_omp_clauses): Handle filter clause.
	(GFC_OMP_SPLIT_MASKED, GFC_OMP_MASK_MASKED): New enum values.
	(gfc_trans_omp_masked): New.
	(gfc_split_omp_clauses): Handle combined masked directives.
	(gfc_trans_omp_master_taskloop): Rename to ...
	(gfc_trans_omp_master_masked_taskloop): ... this; handle also
	combined masked directives.
	(gfc_trans_omp_parallel_master): Rename to ...
	(gfc_trans_omp_parallel_master_masked): ... this; handle
	combined masked directives.
	(gfc_trans_omp_directive): Handle EXEC_OMP_*_MASKED*.
	* trans.c (trans_code): Likewise.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/masked-1.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/masked-1.f90: New test.
	* gfortran.dg/gomp/masked-2.f90: New test.
	* gfortran.dg/gomp/masked-3.f90: New test.
	* gfortran.dg/gomp/masked-combined-1.f90: New test.
	* gfortran.dg/gomp/masked-combined-2.f90: New test.
2021-08-16 09:26:26 +02:00
Kito Cheng fdd40498d1 RISC-V: Allow multi-lib build with different code model
--with-multilib-generator was only support for different ISA/ABI
combination, however code model is effect the code gen a lots it
should able to handled in multilib mechanism.

Adding `--cmodel=` option to `--with-multilib-generator` to generating
multilib combination with different code model.

E.g.
--with-multilib-generator="rv64ima-lp64--;--cmodel=medlow,medany"
will generate 3 multi-lib suppport:
1) rv64ima with lp64
2) rv64ima with lp64 and medlow code model
3) rv64ima with lp64 and medany code model

gcc/

	* config/riscv/multilib-generator: Support code model option for
	multi-lib.
	* doc/install.texi: Add document of new option for
	--with-multilib-generator.
2021-08-16 12:31:51 +08:00
GCC Administrator 94974e8b58 Daily bump. 2021-08-16 00:16:32 +00:00
Harald Anlauf bbf19f9c20 Fortran: fix checks for STAT= and ERRMSG= arguments of SYNC ALL/SYNC IMAGES
gcc/fortran/ChangeLog:

	PR fortran/99351
	* match.c (sync_statement): Replace %v code by %e in gfc_match to
	allow for function references as STAT and ERRMSG arguments.
	* resolve.c (resolve_sync): Adjust checks of STAT= and ERRMSG= to
	being definable arguments.  Function references with a data
	pointer result are accepted.
	* trans-stmt.c (gfc_trans_sync): Adjust assertion.

gcc/testsuite/ChangeLog:

	PR fortran/99351
	* gfortran.dg/coarray_sync.f90: New test.
	* gfortran.dg/coarray_3.f90: Adjust error messages.
2021-08-15 20:13:11 +02:00
Clément Chigot 34ce7f7a9a aix: 64 bit AIX TLS libpthread dependency.
64bit XCOFF files will generated TLS access, with local-exec or
global-exec models, by an access to R13. Thus, there isn't
any reference to a TLS symbol.

The problem is that it allows programs with TLS to be compiled and
linked even without -pthread. Most of the time, it will result in
a segfault when trying to access a TLS variable. But sometimes, it
might create a memory corruption.

This patch forces a reference to __tls_get_addr() to ensure link
will fail without -pthread.

gcc/ChangeLog:
2021-08-11  Clément Chigot  <clement.chigot@atos.net>

	* config/rs6000/rs6000.c (xcoff_tls_exec_model_detected): New.
	(rs6000_legitimize_tls_address_aix): Use it.
	(rs6000_xcoff_file_end): Add ".ref __tls_get_addr" when
	xcoff_tls_exec_model_detected is true.
2021-08-15 13:26:27 -04:00
Jeff Law 882f1d58bf Improve many SImode shifts on the H8/300H
As I've mentioned before, the H8/300H can only shift a single bit position at a time.  Naturally this means many shifts are implemented as loops.  There's a variety of special cases that we can do without loops by using rotates, sub-word moves, etc.  The general guidance for the port has been to only use inline or special sequences if they're shorter or just one instruction longer than the loop.

This was pretty reasonable guidance for QI/HI mode.  It was relaxed a bit about 10 years ago for HImode in particular where the kpit team realized they could save 50-100 cycles for some shifts by allowing 2 instructions of code growth over the loop implementation.

But they only re-tuned HImode shifts.  There's even bigger benefits for re-tuning SImode shifts.  There's cases where we can save close to 200 cycles by allowing 2 additional instructions.

This patch re-tunes SImode shifts on the H8/300H primarily by inlining more often or using a special sequence + inlining for residuals.  Both cases were already supported and this just uses those existing capabilities more often, so it was trivial to implement.  I think there's some cases were entirely new special sequences could be used, but I haven't tried those yet.

gcc/

	* config/h8300/h8300.c (shift_alg_si): Retune H8/300H shifts
	to allow a bit more code growth, saving many dozens of cycles.
	(h8300_option_override): Adjus shift_alg_si if optimizing for
	code size.
	(get_shift_alg): Use special + inline shifts for residuals
	in more cases.
2021-08-15 00:15:32 -04:00
Ian Lance Taylor 829931ec93 libgo: various fixes for Solaris support
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/342189
2021-08-14 17:34:52 -07:00
GCC Administrator 7dd8f1982c Daily bump. 2021-08-15 00:16:27 +00:00
Stafford Horne da8a9d695b or1k: Use cmodel=large when building crtstuff
When linking gcc runtime objects into large binaries the link may fail
with the below errors.  This will happen even if we are building with
-mcmodel=large.

    /home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `deregister_tm_clones':
    crtstuff.c:(.text+0x3c): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_deregisterTMCloneTable'
    /home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `register_tm_clones':
    crtstuff.c:(.text+0xc0): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_registerTMCloneTable'

This patch builds the gcc crtstuff binaries always with the
-mcmodel=large option to ensure they can be linked into large binaries.

libgcc/ChangeLog:

	PR target/99783
	* config.host (or1k-*, tmake_file): Add or1k/t-crtstuff.
	* config/or1k/t-crtstuff: New file.
2021-08-15 07:23:12 +09:00
Stafford Horne eff8110674 or1k: Add mcmodel option to handle large GOTs
When building libgeos we get an error with:

    linux-uclibc/9.3.0/crtbeginS.o: in function `__do_global_dtors_aux':
    crtstuff.c:(.text+0x118): relocation truncated to fit: R_OR1K_GOT16 against symbol `__cxa_finalize' defined in .text section in
    /home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/or1k-buildroot-linux-uclibc/sysroot/lib/libc.so.

This is caused by GOT code having a limit of 64k.  In OpenRISC this
looks to be the only relocation code pattern to be limited to 64k.

This patch allows specifying a new option -mcmodel=large which can be
used to generate 2 more instructions to construct 32-bit addresses for
up to 4G GOTs.

gcc/ChangeLog:

	PR target/99783
	* config/or1k/or1k-opts.h: New file.
	* config/or1k/or1k.c (or1k_legitimize_address_1, print_reloc):
	Support generating gotha relocations if -mcmodel=large is
	specified.
	* config/or1k/or1k.h (TARGET_CMODEL_SMALL, TARGET_CMODEL_LARGE):
	New macros.
	* config/or1k/or1k.opt (mcmodel=): New option.
	* doc/invoke.texi (OpenRISC Options): Document mcmodel.
2021-08-15 07:22:58 +09:00
Martin Sebor 96194a07bd Diagnose mismatches between array and scalar new and delete [PR101791].
Resolves:
PR middle-end/101791 - missing warning on a mismatch between scalar and array forms of new and delete

gcc/ChangeLog:

	PR middle-end/101791
	* gimple-ssa-warn-access.cc (new_delete_mismatch_p): Use new argument
	to valid_new_delete_pair_p.
	* tree.c (valid_new_delete_pair_p): Add argument.
	* tree.h (valid_new_delete_pair_p): Same.

gcc/testsuite/ChangeLog:

	PR middle-end/101791
	* g++.dg/warn/Wmismatched-new-delete-6.C: New test.
	* g++.dg/warn/Wmismatched-new-delete-7.C: New test.
2021-08-14 13:25:41 -06:00
Jakub Jelinek 240f07805d i386: Fix ICE with V64QImode broadcast permutation with -mavx512f -mno-avx512bw
The testcase shows another problem, for TARGET_AVX512BW we have a single insn
doing broadcast from the first element, but don't have one for broadcast
of 2nd+ element (so for d->perm[0] we must return false), but for
TARGET_AVX512F && !TARGET_AVX512BW we don't even have support for that other
broadcast.  V64QImode case was just added to the AVX2 cases which had
gcc_assert (!TARGET_AVX2 || d->perm[0]);
but for V64QImode we actually need
gcc_assert (!TARGET_AVX512BW || d->perm[0]);

2021-08-14  Jakub Jelinek  <jakub@redhat.com>

	PR target/101896
	* config/i386/i386-expand.c (expand_vec_perm_broadcast_1)
	<case E_V64QImode>: For this mode assert
	!TARGET_AVX512BW || d->perm[0] rather than !TARGET_AVX2 || d->perm[0].

	* gcc.target/i386/avx512f-pr101896.c: New test.
2021-08-14 11:44:46 +02:00
GCC Administrator 261512fa6d Daily bump. 2021-08-14 00:16:29 +00:00
Michael Meissner 58eec9908c Fix xxeval predicates (PR 99921).
I noticed that the xxeval built-in function used the altivec_register_operand
predicate.  Since it takes vsx registers, this might force the register
allocate to issue a move when it could use a traditional floating point
register.  This patch fixes that.

2021-08-13  Michael Meissner  <meissner@linux.ibm.com>

gcc/
	PR target/99921
	* config/rs6000/altivec.md (xxeval): Use register_predicate
	instead of altivec_register_predicate.
2021-08-13 19:43:27 -04:00
Thomas Schwinge 2cc65fcbd4 Adjust 'libgomp.oacc-c-c++-common/static-variable-1.c'
... for 'gcc/gimplify.c:gimplify_scan_omp_clauses' changes in recent
commit d0befed793 "openmp: Add support
for OpenMP 5.1 masked construct".

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: Adjust.
2021-08-13 22:53:58 +02:00
Martin Sebor fb85d6eb6c Warn for reads from write-only arguments [PR101734].
Resolves:
PR middle-end/101734 - missing warning reading from a write-only object

gcc/ChangeLog:

	PR middle-end/101734
	* tree-ssa-uninit.c (maybe_warn_read_write_only): New function.
	(maybe_warn_operand): Call it.

gcc/testsuite/ChangeLog:

	PR middle-end/101734
	* gcc.dg/uninit-42.c: New test.
2021-08-13 12:23:58 -06:00
Ian Lance Taylor e5c00544cc runtime: use C cast syntax in stack.c
Didn't notice earlier because this code is only used on systems that
do not support -fsplit-stack.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/342051
2021-08-13 10:38:36 -07:00
Martin Liska 4998404915 ipa: "naked" attribute implies "noipa" attribute
PR ipa/101354

gcc/ChangeLog:

	* attribs.c (decl_attributes): Make naked functions "noipa"
	  functions.
2021-08-13 16:04:26 +02:00
Martin Liska fa28520fad ipa: do not make localaliases for target_clones [PR101261]
PR ipa/101261

gcc/ChangeLog:

	* symtab.c (symtab_node::noninterposable_alias): Do not create
	  local aliases for target_clone functions as the clonning pass
	  rejects aliases.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr101261.c: New test.
2021-08-13 15:44:11 +02:00
Martin Liska 5eb304a3e5 opts: do not repeat a string in errors
gcc/ChangeLog:

	* opts.c (LIVE_PATCHING_OPTION): Define.
	(control_options_for_live_patching): Use it in error messages.
2021-08-13 15:43:36 +02:00
Jan Hubicka 4341b1b165 Introduce EAF_NOREAD and cleanup EAF_UNUSED + ipa-modref
this patch add EAF_NOREAD (as disucssed on IRC already) and fixes meaning
of EAF_UNUSED to be really unused and not "does not escape, is not clobbered,
read or returned" since we have separate flags for each of the properties
now.

Since number of flags has grown I refactored the code a bit to avoid
repeated uses of complex flag combinations and also simplified the logic of
merging.

Merging is bit tricky since we have flags that implies other flags
(like NOESCAPE implies NODIRECTESCAPE) but code that sets only NOESCAPE.
Perhaps it would make sense to update fnspecs to always set flag along with
all the implications, but for now I am handlingit in merge.

I made only trivial update to tree-ssa-structalias to handle EAF_NORETURN in
normal function handling, but not in pure functions.  The problem is that the
way constraints are generated for pure functions makes this difficult.
I think logical step is to track whether function reads/stores global memory
and rewrite the constraint generation so we can handle normal, pure and const
in unified manner.

Bootstrapped/regtested x86_64-linux, plan to commit it after furhter testing.

The patch improves alias oracle stats for cc1plus somewhat.

From:

Alias oracle query stats:
  refs_may_alias_p: 72380497 disambiguations, 82649832 queries
  ref_maybe_used_by_call_p: 495184 disambiguations, 73366950 queries
  call_may_clobber_ref_p: 259312 disambiguations, 263253 queries
  nonoverlapping_component_refs_p: 0 disambiguations, 38006 queries
  nonoverlapping_refs_since_match_p: 21157 disambiguations, 65698 must overlaps, 87756 queries
  aliasing_component_refs_p: 63141 disambiguations, 2164695 queries
  TBAA oracle: 25975753 disambiguations 61449632 queries
               12138220 are in alias set 0
               11316663 queries asked about the same object
               144 queries asked about the same alias set
               0 access volatile
               10472885 are dependent in the DAG
               1545967 are aritificially in conflict with void *

Modref stats:
  modref use: 23857 disambiguations, 754515 queries
  modref clobber: 1392162 disambiguations, 17753512 queries
  3450241 tbaa queries (0.194341 per modref query)
  534816 base compares (0.030125 per modref query)

PTA query stats:
  pt_solution_includes: 12394915 disambiguations, 20235925 queries
  pt_solutions_intersect: 1365299 disambiguations, 14638068 queries

To:

Alias oracle query stats:
  refs_may_alias_p: 72629640 disambiguations, 82903333 queries
  ref_maybe_used_by_call_p: 502474 disambiguations, 73612186 queries
  call_may_clobber_ref_p: 261806 disambiguations, 265659 queries
  nonoverlapping_component_refs_p: 0 disambiguations, 38007 queries
  nonoverlapping_refs_since_match_p: 21139 disambiguations, 65772 must overlaps, 87816 queries
  aliasing_component_refs_p: 63144 disambiguations, 2164330 queries
  TBAA oracle: 26059018 disambiguations 61571714 queries
               12158033 are in alias set 0
               11326115 queries asked about the same object
               144 queries asked about the same alias set
               0 access volatile
               10484493 are dependent in the DAG
               1543911 are aritificially in conflict with void *

Modref stats:
  modref use: 24008 disambiguations, 712712 queries
  modref clobber: 1395917 disambiguations, 17163694 queries
  3465657 tbaa queries (0.201918 per modref query)
  537591 base compares (0.031321 per modref query)

PTA query stats:
  pt_solution_includes: 12468934 disambiguations, 20295402 queries
  pt_solutions_intersect: 1391917 disambiguations, 14665265 queries

I think it is mostly due to better heandling of EAF_NODIRECTESCAPE.

Honza

gcc/ChangeLog:

2021-08-12  Jan Hubicka  <hubicka@ucw.cz>

	* ipa-modref.c (dump_eaf_flags): Dump EAF_NOREAD.
	(implicit_const_eaf_flags, implicit_pure_eaf_flags,
	 ignore_stores_eaf_flags): New constants.
	(remove_useless_eaf_flags): New function.
	(eaf_flags_useful_p): Use it.
	(deref_flags): Add EAF_NOT_RETURNED if flag is unused;
	handle EAF_NOREAD.
	(modref_lattice::init): Add EAF_NOREAD.
	(modref_lattice::add_escape_point): Do not reacord escape point if
	result is unused.
	(modref_lattice::merge): EAF_NOESCAPE implies EAF_NODIRECTESCAPE;
	use remove_useless_eaf_flags.
	(modref_lattice::merge_deref): Use ignore_stores_eaf_flags.
	(modref_lattice::merge_direct_load): Add EAF_NOREAD
	(analyze_ssa_name_flags): Fix handling EAF_NOT_RETURNED
	(analyze_parms): Use remove_useless_eaf_flags.
	(ipa_merge_modref_summary_after_inlining): Use ignore_stores_eaf_flags.
	(modref_merge_call_site_flags): Add caller and ecf_flags parameter;
	use remove_useless_eaf_flags.
	(modref_propagate_flags_in_scc): Update.
	* ipa-modref.h: Turn eaf_flags_t back to char.
	* tree-core.h (EAF_NOT_RETURNED): Fix.
	(EAF_NOREAD): New constant
	* tree-ssa-alias.c: (ref_maybe_used_by_call_p_1): Check for
	EAF_NOREAD.
	* tree-ssa-structalias.c (handle_rhs_call): Handle new flags.
	(handle_pure_call): Likewise.

gcc/testsuite/ChangeLog:

2021-08-12  Jan Hubicka  <hubicka@ucw.cz>

	* gcc.dg/tree-ssa/modref-6.c: Update.
2021-08-13 10:04:52 +02:00
prathamesh.kulkarni e37ddb91a8 arm: Add check for arm_softfp_ok in pr98435.c.
gcc/testsuite/ChangeLog:
	* gcc.target/arm/simd/pr98435.c: Add dg-require-effective-target
	arm_softfp_ok.
2021-08-13 12:29:46 +05:30
Sergei Trofimovich 62e420293a libbacktrace: fix b2test_buildid test on non-english locales
On LANG=ru_RU.UTF-8 'b2test_buildid' test fails due to localized readelf
output:

$ LANG=ru_RU.UTF-8 readelf -n b2test | fgrep 4e37e8f
    ID сборки: 4e37e8fead8d6e8b0a9dc95ea25cd784dff3a393
$ LANG=C readelf -n b2test | fgrep 4e37e8f
    Build ID: 4e37e8fead8d6e8b0a9dc95ea25cd784dff3a393

libbacktrace/

	* install-debuginfo-for-buildid.sh.in: Force non-localized readelf
	output with LANG=C.
2021-08-13 07:29:12 +01:00
Ian Lance Taylor c5b21c3f4c libgo: update to Go1.17rc2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/341629
2021-08-12 20:23:07 -07:00
GCC Administrator 72be20e202 Daily bump. 2021-08-13 00:16:43 +00:00
Ian Lance Taylor 0ace3d4d0a runtime: run gofmt on testdata/testwinsignal/main.go 2021-08-12 17:15:16 -07:00
Ian Lance Taylor 1196b60f8f compiler: store pointers to go:notinheap types indirectly
This is the gofrontend version of https://golang.org/cl/264480.

For golang/go#42076

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/340609
2021-08-12 16:33:10 -07:00
Jakub Jelinek d0befed793 openmp: Add support for OpenMP 5.1 masked construct
This construct has been introduced as a replacement for master
construct, but unlike that construct is slightly more general,
has an optional clause which allows to choose which thread
will be the one running the region, it can be some other thread
than the master (primary) thread with number 0, or it could be no
threads or multiple threads (then of course one needs to be careful
about data races).

It is way too early to deprecate the master construct though, we don't
even have OpenMP 5.0 fully implemented, it has been deprecated in 5.1,
will be also in 5.2 and removed in 6.0.  But even then it will likely
be a good idea to just -Wdeprecated warn about it and still accept it.

The patch also contains something I should have done much earlier,
for clauses that accept some integral expression where we only care
about the value, forces during gimplification that value into
either a min invariant (as before), SSA_NAME or a fresh temporary,
but never e.g. a user VAR_DECL, so that for those clauses we don't
need to worry about adjusting it.

2021-08-12  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree.def (OMP_MASKED): New tree code.
	* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_FILTER.
	* tree.h (OMP_MASKED_BODY, OMP_MASKED_CLAUSES, OMP_MASKED_COMBINED,
	OMP_CLAUSE_FILTER_EXPR): Define.
	* tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FILTER entry.
	(omp_clause_code_name): Likewise.
	(walk_tree_1): Handle OMP_CLAUSE_FILTER.
	* tree-nested.c (convert_nonlocal_omp_clauses,
	convert_local_omp_clauses): Handle OMP_CLAUSE_FILTER.
	(convert_nonlocal_reference_stmt, convert_local_reference_stmt,
	convert_gimple_call): Handle GIMPLE_OMP_MASTER.
	* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FILTER.
	(dump_generic_node): Handle OMP_MASTER.
	* gimple.def (GIMPLE_OMP_MASKED): New gimple code.
	* gimple.c (gimple_build_omp_masked): New function.
	(gimple_copy): Handle GIMPLE_OMP_MASKED.
	* gimple.h (gimple_build_omp_masked): Declare.
	(gimple_has_substatements): Handle GIMPLE_OMP_MASKED.
	(gimple_omp_masked_clauses, gimple_omp_masked_clauses_ptr,
	gimple_omp_masked_set_clauses): New inline functions.
	(CASE_GIMPLE_OMP): Add GIMPLE_OMP_MASKED.
	* gimple-pretty-print.c (dump_gimple_omp_masked): New function.
	(pp_gimple_stmt_1): Handle GIMPLE_OMP_MASKED.
	* gimple-walk.c (walk_gimple_stmt): Likewise.
	* gimple-low.c (lower_stmt): Likewise.
	* gimplify.c (is_gimple_stmt): Handle OMP_MASTER.
	(gimplify_scan_omp_clauses): Handle OMP_CLAUSE_FILTER.  For clauses
	that take one expression rather than decl or constant, force
	gimplification of that into a SSA_NAME or temporary unless min
	invariant.
	(gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FILTER.
	(gimplify_expr): Handle OMP_MASKED.
	* tree-inline.c (remap_gimple_stmt): Handle GIMPLE_OMP_MASKED.
	(estimate_num_insns): Likewise.
	* omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FILTER.
	(check_omp_nesting_restrictions): Handle GIMPLE_OMP_MASKED.  Adjust
	diagnostics for existence of masked construct.
	(scan_omp_1_stmt, lower_omp_master, lower_omp_1, diagnose_sb_1,
	diagnose_sb_2): Handle GIMPLE_OMP_MASKED.
	* omp-expand.c (expand_omp_synch, expand_omp, omp_make_gimple_edges):
	Likewise.
gcc/c-family/
	* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_MASKED.
	(enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FILTER.
	* c-pragma.c (omp_pragmas_simd): Add masked construct.
	* c-common.h (enum c_omp_clause_split): Add C_OMP_CLAUSE_SPLIT_MASKED
	enumerator.
	(c_finish_omp_masked): Declare.
	* c-omp.c (c_finish_omp_masked): New function.
	(c_omp_split_clauses): Handle combined masked constructs.
gcc/c/
	* c-parser.c (c_parser_omp_clause_name): Parse filter clause name.
	(c_parser_omp_clause_filter): New function.
	(c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FILTER.
	(OMP_MASKED_CLAUSE_MASK): Define.
	(c_parser_omp_masked): New function.
	(c_parser_omp_parallel): Handle parallel masked.
	(c_parser_omp_construct): Handle PRAGMA_OMP_MASKED.
	* c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_FILTER.
gcc/cp/
	* parser.c (cp_parser_omp_clause_name): Parse filter clause name.
	(cp_parser_omp_clause_filter): New function.
	(cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FILTER.
	(OMP_MASKED_CLAUSE_MASK): Define.
	(cp_parser_omp_masked): New function.
	(cp_parser_omp_parallel): Handle parallel masked.
	(cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OMP_MASKED.
	* semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_FILTER.
	* pt.c (tsubst_omp_clauses): Likewise.
	(tsubst_expr): Handle OMP_MASKED.
gcc/testsuite/
	* c-c++-common/gomp/clauses-1.c (bar): Add tests for combined masked
	constructs with clauses.
	* c-c++-common/gomp/clauses-5.c (foo): Add testcase for filter clause.
	* c-c++-common/gomp/clause-dups-1.c (f1): Likewise.
	* c-c++-common/gomp/masked-1.c: New test.
	* c-c++-common/gomp/masked-2.c: New test.
	* c-c++-common/gomp/masked-combined-1.c: New test.
	* c-c++-common/gomp/masked-combined-2.c: New test.
	* c-c++-common/goacc/uninit-if-clause.c: Remove xfails.
	* g++.dg/gomp/block-11.C: New test.
	* g++.dg/gomp/tpl-masked-1.C: New test.
	* g++.dg/gomp/attrs-1.C (bar): Add tests for masked construct and
	combined masked constructs with clauses in attribute syntax.
	* g++.dg/gomp/attrs-2.C (bar): Likewise.
	* gcc.dg/gomp/nesting-1.c (f1, f2): Add tests for masked construct
	nesting.
	* gfortran.dg/goacc/host_data-tree.f95: Allow also SSA_NAMEs in if
	clause.
	* gfortran.dg/goacc/kernels-tree.f95: Likewise.
libgomp/
	* testsuite/libgomp.c-c++-common/masked-1.c: New test.
2021-08-12 22:41:17 +02:00
Jakub Jelinek 408d88af60 libcpp: Fix ICE with -Wtraditional preprocessing [PR101638]
The following testcase ICEs in cpp_sys_macro_p, because cpp_sys_macro_p
is called for a builtin macro which doesn't use node->value.macro union
member but a different one and so dereferencing it ICEs.
As the testcase is distilled from contemporary glibc headers, it means
basically -Wtraditional now ICEs on almost everything.

The fix can be either the patch below, return true for builtin macros,
or we could instead return false for builtin macros, or the fix could
be also (untested):
--- libcpp/expr.c       2021-05-07 10:34:46.345122608 +0200
+++ libcpp/expr.c       2021-08-12 09:54:01.837556365 +0200
@@ -783,13 +783,13 @@ cpp_classify_number (cpp_reader *pfile,

       /* Traditional C only accepted the 'L' suffix.
          Suppress warning about 'LL' with -Wno-long-long.  */
-      if (CPP_WTRADITIONAL (pfile) && ! cpp_sys_macro_p (pfile))
+      if (CPP_WTRADITIONAL (pfile))
        {
          int u_or_i = (result & (CPP_N_UNSIGNED|CPP_N_IMAGINARY));
          int large = (result & CPP_N_WIDTH) == CPP_N_LARGE
                       && CPP_OPTION (pfile, cpp_warn_long_long);

-         if (u_or_i || large)
+         if ((u_or_i || large) && ! cpp_sys_macro_p (pfile))
            cpp_warning_with_line (pfile, large ? CPP_W_LONG_LONG : CPP_W_TRADITIONAL,
                                   virtual_location, 0,
                                   "traditional C rejects the \"%.*s\" suffix",
The builtin macros at least currently don't add any suffixes
or numbers -Wtraditional would like to warn about.  For floating
point suffixes, -Wtraditional calls cpp_sys_macro_p only right
away before emitting the warning, but in the above case the ICE
is because cpp_sys_macro_p is called even if the number doesn't
have any suffixes (that is I think always for builtin macros
right now).

2021-08-12  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/101638
	* macro.c (cpp_sys_macro_p): Return true instead of
	crashing on builtin macros.

	* gcc.dg/cpp/pr101638.c: New test.
2021-08-12 22:40:11 +02:00
Michael Meissner 8464894c86 Fix typo in fold-vec-load-builtin_vec_xl-* tests.
When I checked in the fix for running tests on power10 systems with
power10 code generation, I had a typo in the
fold-vec-load-builtin_vec_xl-* tests, swapping 'x' and 'v' in the p?lxv
pattern.

gcc/testsuite/
2021-08-12  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/fold-vec-load-builtin_vec_xl-char.c: Fix
	typo in regular expression.
	* gcc.target/powerpc/fold-vec-load-builtin_vec_xl-double.c:
	Likewise.
	* gcc.target/powerpc/fold-vec-load-builtin_vec_xl-float.c:
	Likewise.
	* gcc.target/powerpc/fold-vec-load-builtin_vec_xl-int.c:
	Likewise.
	* gcc.target/powerpc/fold-vec-load-builtin_vec_xl-longlong.c:
	Likewise.
	* gcc.target/powerpc/fold-vec-load-builtin_vec_xl-short.c:
	Likewise.
2021-08-12 16:36:49 -04:00
Uros Bizjak 8c8df06e46 [i386] Introduce scalar version of avx512f_vmscalef.
2021-08-12  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/98309
	* config/i386/i386.md (avx512f_scalef<mode>2): New insn pattern.
	(ldexp<mode>3): Use avx512f_scalef<mode>2.
	(UNSPEC_SCALEF): Move from ...
	* config/i386/sse.md (UNSPEC_SCALEF): ... here.
2021-08-12 21:19:46 +02:00
Jan Hubicka a6da2cddcf Fix condition testing void functions in ipa-split.
gcc/ChangeLog:

2021-08-12  Jan Hubicka  <hubicka@ucw.cz>

	* ipa-split.c (consider_split): Fix condition testing void functions.
2021-08-12 20:52:54 +02:00
Jonathan Wakely 9017326e19 libstdc++: Add additional overload of std::lerp [PR101870]
The [cmath.syn] p1 wording about additional overloads sufficient to
handle any arithmetic types also applies to std::lerp. This adds a new
overload of std::lerp that does the required promotions to support
arguments of arbitrary arithmetic types.

A new __promoted_t alias template is added, which the C++17 function
templates std::hypot and std::lerp can use to avoid instantiating the
__promote_3 class template.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101870
	* include/c_global/cmath (hypot): Use __promoted_t.
	(lerp): Add new overload accepting any arithmetic types.
	* include/ext/type_traits.h (__promoted_t): New alias template.
	* testsuite/26_numerics/lerp.cc: Moved to...
	* testsuite/26_numerics/lerp/1.cc: ...here.
	* testsuite/26_numerics/lerp/constexpr.cc: New test.
	* testsuite/26_numerics/lerp/version.cc: New test.
2021-08-12 19:46:16 +01:00
Jonathan Wakely b1c0e8599a libstdc++: Make some #error strings consistent with other tests
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/lerp.cc: Add header name to #error.
	* testsuite/26_numerics/midpoint/integral.cc: Likewise.
	* testsuite/26_numerics/midpoint/version.cc: New test.
2021-08-12 19:46:16 +01:00
Jonathan Wakely 20ce14c799 libstdc++: Add [[nodiscard]] to experimental::randint
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/experimental/random (experimental::randint): Add
	nodiscard attribute.
2021-08-12 19:46:16 +01:00
Sergei Trofimovich 27a1fb385b c++: fix ptrmemfunc template instantiation [PR101219]
r12-1804 ("cp: add support for per-location warning groups.") among other
things removed warning suppression from a few places including ptrmemfuncs.

This exposed a bug in warning detection code as a reference to missing
BINFO (it's intentionally missing for ptrmemfunc types):

    crash_signal
        gcc/toplev.c:328
    perform_or_defer_access_check(tree_node*, tree_node*, tree_node*, int, access_failure_info*)
        gcc/cp/semantics.c:490
    finish_non_static_data_member(tree_node*, tree_node*, tree_node*)
        gcc/cp/semantics.c:2208
    ...

The change special cases ptrmemfuncs in templace substitution by using
build_ptrmemfunc_access_expr() instead of finish_non_static_data_member().

gcc/cp/ChangeLog:

	PR c++/101219
	* pt.c (tsubst_copy_and_build): Use build_ptrmemfunc_access_expr
	to construct ptrmemfunc expression instantiation.

gcc/testsuite/ChangeLog:

	PR c++/101219
	* g++.dg/warn/pr101219.C: New test.
2021-08-12 19:43:07 +01:00