Commit Graph

189376 Commits

Author SHA1 Message Date
Harald Anlauf
bcf3728abe Fortran: fix simplification of array-valued parameter expressions
gcc/fortran/ChangeLog:

	PR fortran/102817
	* expr.c (simplify_parameter_variable): Copy shape of referenced
	subobject when simplifying.

gcc/testsuite/ChangeLog:

	PR fortran/102817
	* gfortran.dg/pr102817.f90: New test.
2021-11-05 23:48:20 +01:00
Jan Hubicka
5f37780372 Fix ice in insert_access
gcc/ChangeLog:

	PR ipa/103073
	* ipa-modref-tree.h (modref_tree::insert): Do nothing for
	paradoxical and zero sized accesses.

gcc/testsuite/ChangeLog:

	PR ipa/103073
	* g++.dg/torture/pr103073.C: New test.
	* gcc.dg/tree-ssa/modref-11.c: New test.
2021-11-05 23:32:55 +01:00
Jan Hubicka
9cc8ca8da9 Avoid left shift of negative value in ipa-modref-tree.h
gcc/ChangeLog:

	PR ipa/103082
	* ipa-modref-tree.h (struct modref_access_node): Avoid left shift
	of negative value
2021-11-05 23:17:50 +01:00
Harald Anlauf
432ed97b99 Fortran: a symbol in a COMMON cannot be a coarray
gcc/fortran/ChangeLog:

	PR fortran/69419
	* match.c (gfc_match_common): Check array spec of a symbol in a
	COMMON object list and reject it if it is a coarray.

gcc/testsuite/ChangeLog:

	PR fortran/69419
	* gfortran.dg/pr69419.f90: New test.
2021-11-05 23:14:57 +01:00
Jonathan Wakely
2b2d97fc54 libstdc++: Fix inconsistent noexcept-specific for valarray begin/end
These declarations should be noexcept after I added it to the
definitions in <valarray>.

libstdc++-v3/ChangeLog:

	* include/bits/range_access.h (begin(valarray), end(valarray)):
	Add noexcept.
2021-11-05 21:44:01 +00:00
Jonathan Wakely
70d6f6e41f libstdc++: Fix pack expansions in tuple_size_v specializations
libstdc++-v3/ChangeLog:

	* include/std/tuple (tuple_size_v): Fix pack expansion.
2021-11-05 21:44:00 +00:00
Bernhard Reutner-Fischer
1727bb533e Fortran: Missing error with IMPLICIT none (external) [PR100972]
gcc/fortran/ChangeLog:

	PR fortran/100972
	* decl.c (gfc_match_implicit_none): Fix typo in warning.
	* resolve.c (resolve_unknown_f): Reject external procedures
	without explicit EXTERNAL attribute whe IMPLICIT none (external)
	is in effect.

gcc/testsuite/ChangeLog:

	PR fortran/100972
	* gfortran.dg/implicit_14.f90: Adjust error.
	* gfortran.dg/external_implicit_none_3.f08: New test.
2021-11-05 22:09:48 +01:00
Bernhard Reutner-Fischer
c64ca0e7bb Fortran: Delete unused decl in gfortran.h
gcc/fortran/ChangeLog:

	* decl.c (gfc_insert_kind_parameter_exprs): Make static.
	* expr.c (gfc_build_init_expr): Make static
	(gfc_build_default_init_expr): Move below its static helper.
	* gfortran.h (gfc_insert_kind_parameter_exprs, gfc_add_saved_common,
	gfc_add_common, gfc_use_derived_tree, gfc_free_charlen,
	gfc_get_ultimate_derived_super_type,
	gfc_resolve_oacc_parallel_loop_blocks, gfc_build_init_expr,
	gfc_iso_c_sub_interface): Delete.
	* symbol.c (gfc_new_charlen, gfc_get_derived_super_type): Make
	static.
2021-11-05 22:09:04 +01:00
Sandra Loosemore
452a0afbac Fortran: Add more documentation for mixed-language programming [PR35276]
2021-11-05  Sandra Loosemore  <sandra@codesourcery.com>

	PR fortran/35276

	gcc/fortran/
	* gfortran.texi (Mixed-Language Programming): Talk about C++,
	and how to link.
2021-11-05 14:08:36 -07:00
Iain Sandoe
8f4860f956 testsuite, Darwin : Fix tsvc test build on Darwin.
Currently all the tsvc tests fail to build on Darwin because
they assume that <malloc.h> and memalign() are available.

For Darwin, <stdlib.h> is sufficient to obtain the declarations
for malloc and the port has posix_memalign () but not memalign.

Fixed as below.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/testsuite/ChangeLog:

	* gcc.dg/vect/tsvc/tsvc.h: Do not try to include malloc.h
	on Darwin also use posix_memalign ().
2021-11-05 21:06:36 +00:00
Iain Sandoe
f1e2879ecf Darwin : Make trampoline templates linker-visible.
For aarch64, the alignment of the LTRAMPn symbols matters.

Actually, the LTRAMPn  symbols _are_ 8 byte aligned, but because
they are Local, the linker doesn't know that this guarantee can be met.
It assumes that they are not necessarily more aligned than the
containing section (ld64 atoms strike again).

The fix is to publish the trampoline symbol for the linker to access
directly - it can then see that the atom is suitably aligned.

Fixes issue #11 on the development branch.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin.h (ASM_GENERATE_INTERNAL_LABEL): Add LTRAMP
	to the list of symbol prefixes that must be made linker-
	visible.
2021-11-05 21:00:53 +00:00
Iain Sandoe
f8a1e06993 Darwin, aarch64 : Ada fixes for hosted tools.
This will allow someone (with an existing Ada compiler on the
platform - which can be provided by the experimental aarch64-darwin
branch) - to build the host tools (gnatmake and friends) for a
non-native cross.

The existing provisions for iOS are OK for cross-compilation from
an x86-64-darwin platform, but we need some adjustments so that these
host tools can be built to run on aarch64-darwin.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ada/

	* gcc-interface/Make-lang.in: Use iOS signal trampoline code
	for hosted Ada tools.
	* sigtramp-ios.c: Wrap the declarations in extern "C" when
	the code is built by a C++ compiler.
2021-11-05 20:58:36 +00:00
Iain Sandoe
834c8749ce Darwin, aarch64 : Initial support for the self-host driver.
At present, there is no special action needed for aarch64-darwin
this just pulls in generic Darwin code.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config.host: Add support for aarch64-*-darwin.
	* config/aarch64/host-aarch64-darwin.c: New file.
	* config/aarch64/x-darwin: New file.
2021-11-05 20:52:42 +00:00
Iain Sandoe
7a300b413a Darwin, crts: Fix a build warning.
We have a shim crt for Darwin10 that implements functionality
missing in libSystem. Provide this with a prototype to silence the
warning about this.

libgcc/ChangeLog:

	* config/darwin10-unwind-find-enc-func.c: Include libgcc_tm.h.
	* config/i386/darwin-lib.h: Declare Darwin10 crt function.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2021-11-05 20:48:05 +00:00
Jonathan Wakely
2627e3b7fd libstdc++: Add [[unlikely]] attributes to std::random_device routines
libstdc++-v3/ChangeLog:

	* src/c++11/random.cc (__x86_rdrand, __x86_rdseed): Add
	[[unlikely]] attribute.
2021-11-05 18:14:41 +00:00
Jonathan Wakely
5997e6a6ec libstdc++: Add support for POWER9 DARN instruction to std::random_device
The ISA-3.0 instruction set includes DARN ("deliver a random number")
which can be used similarly to the existing support for RDRAND and RDSEED.

libstdc++-v3/ChangeLog:

	* src/c++11/random.cc [__powerpc__] (USE_DARN): Define.
	(__ppc_darn): New function to use POWER9 DARN instruction.
	(Which): Add 'darn' enumerator.
	(which_source): Check for __ppc_darn.
	(random_device::_M_init): Support "darn" and "hw" tokens.
	(random_device::_M_getentropy): Add darn to switch.
	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Check "darn" token.
	* testsuite/26_numerics/random/random_device/entropy.cc:
	Likewise.
2021-11-05 18:14:40 +00:00
Martin Liska
bdb9d47218 libsanitizer: update LOCAL_PATCHES. 2021-11-05 18:21:42 +01:00
H.J. Lu
5f0a3fb08c libsanitizer: Apply local patches 2021-11-05 18:21:29 +01:00
Martin Liska
2afc8f0b91 libsanitizer: merge from master (78d3e0a4f1406b17cdecc77540e09210670fe9a9). 2021-11-05 18:21:27 +01:00
Andrew MacLeod
1f6dd5de33 Remove def chain import assert from GORI.
When the IL has changed, any new ssa-names import calculations may not jive
with existing ssa-names, so just remove the assert.

	gcc/
	PR tree-optimization/103093
	* gimple-range-gori.cc (range_def_chain::get_imports): Remove assert.

	gcc/testsuite/
	* gcc.dg/pr103093.c: New.
2021-11-05 13:15:19 -04:00
Andrew MacLeod
98244c68e7 Abstract ranger cache update list.
Make it more efficient by removing the call to vec::contains.

	PR tree-optimization/102943
	* gimple-range-cache.cc (class update_list): New.
	(update_list::add): Replace add_to_update.
	(update_list::pop): New.
	(ranger_cache::ranger_cache): Adjust.
	(ranger_cache::~ranger_cache): Adjust.
	(ranger_cache::add_to_update): Delete.
	(ranger_cache::propagate_cache): Adjust to new class.
	(ranger_cache::propagate_updated_value): Ditto.
	(ranger_cache::fill_block_cache): Ditto.
	* gimple-range-cache.h (class ranger_cache): Adjust to update class.
2021-11-05 13:15:19 -04:00
Richard Biener
a79fe53d6c Amend split vector loop analysis into main and epilogue analysis
I forgot to commit the changes done as response to Richards review
before committing.

2021-11-05  Richard Biener  <rguenther@suse.de>

	* tree-vect-loop.c (vect_analyze_loop): Remove obsolete
	comment and expand on another one.  Combine nested if.
2021-11-05 17:38:22 +01:00
John David Anglin
db89d474ad Support TI mode and soft float on PA64
This change implements TI mode on PA64.  Various new patterns are
added to pa.md.  The libgcc build needed modification to build both
DI and TI routines.  We also need various softfp routines to
convert to and from TImode.

I added full softfp for the -msoft-float option.  At the moment,
this doesn't completely eliminate all use of the floating-point
co-processor.  For this, libgcc needs to be built with -msoft-mult.
The floating-point exception support also needs a soft option.

2021-11-05  John David Anglin  <danglin@gcc.gnu.org>

	PR libgomp/96661

gcc/ChangeLog:

	* config/pa/pa-modes.def: Add OImode integer type.
	* config/pa/pa.c (pa_scalar_mode_supported_p): Allow TImode
	for TARGET_64BIT.
	* config/pa/pa.h (MIN_UNITS_PER_WORD) Define to MIN_UNITS_PER_WORD
	to UNITS_PER_WORD if IN_LIBGCC2.
	* config/pa/pa.md (addti3, addvti3, subti3, subvti3, negti2,
	negvti2, ashlti3, shrpd_internal): New patterns.
	Change some multi instruction types to multi.

libgcc/ChangeLog:

	* config.host (hppa*64*-*-linux*): Revise tmake_file.
	(hppa*64*-*-hpux11*): Likewise.
	* config/pa/sfp-exceptions.c: New.
	* config/pa/sfp-machine.h: New.
	* config/pa/t-dimode: New.
	* config/pa/t-softfp-sfdftf: New.
2021-11-05 16:07:35 +00:00
Jakub Jelinek
858d7ee1a0 x86: Make stringop_algs::stringop_strategy ctor constexpr [PR100246]
> Several older compilers fail to build modern GCC because of missing
> or incomplete C++11 support.
>
>       * config/i386/i386.h (struct stringop_algs): Define a CTOR for
>       this type.

Unfortunately, as mentioned in my
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583289.html
mail, without the new dyninit pass this causes dynamic initialization of
many variables, 6.5KB _GLOBAL__sub_I_* on x86_64 and 12.5KB on i686.

The following patch makes the ctor constexpr so that already the FE
is able to statically initialize all those.

I have tested on godbolt a reduced testcase without a constructor,
with constructor and with constexpr constructor.
clang before 3.3 is unhappy about all the 3 cases, clang 3.3 and 3.4
is ok with ctor and ctor with constexpr and optimizes it into static
initialization, clang 3.5+ is ok with all 3 versions and optimizes,
gcc 4.8 and 5+ is ok with all 3 versions and no ctor and ctor with constexpr
is optimized, gcc 4.9 is unhappy about the no ctor case and happy with the
other two.

2021-11-05  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/100246
	* config/i386/i386.h
	(stringop_algs::stringop_strategy::stringop_strategy): Make the ctor
	constexpr.
2021-11-05 16:59:28 +01:00
Bernhard Reutner-Fischer
b58c12f3cf contrib: testsuite-management: Update to be python3 compatible
contrib/ChangeLog:

	* testsuite-management/validate_failures.py: 2to3
2021-11-05 16:38:03 +01:00
Wilco Dijkstra
b33b267834 AArch64: Fix PR103085
The stack protector implementation hides symbols in a const unspec, which means
movdi/movsi patterns must always support const on symbol operands and
explicitly strip away the unspec. Do this for the recently added GOT
alternatives. Add a test to ensure stack-protector tests GOT accesses as well.

2021-11-05  Wilco Dijkstra  <wdijkstr@arm.com>

	PR target/103085
	* config/aarch64/aarch64.c (aarch64_mov_operand_p): Strip the salt
	first.
	* config/aarch64/constraints.md: Support const in Usw.

gcc/testsuite/
	PR target/103085
	* gcc.target/aarch64/pr103085.c: New test
2021-11-05 15:36:32 +00:00
John David Anglin
a505e1fae4 Move PREFERRED_DEBUGGING_TYPE define in pa64-hpux.h to pa.h
This fixes D language build on hppa64-hpux11.

2021-11-05  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa.h (PREFERRED_DEBUGGING_TYPE): Define to DWARF2_DEBUG.
	* config/pa/pa64-hpux.h (PREFERRED_DEBUGGING_TYPE): Remove define.
2021-11-05 15:05:15 +00:00
Martin Liska
d8a62882b8 gcov-profile: Filter test only for some targets [PR102945]
PR gcov-profile/102945

gcc/testsuite/ChangeLog:

	* gcc.dg/gcov-info-to-gcda.c: Filter supported targets.
2021-11-05 15:40:47 +01:00
Richard Biener
bcf4065c90 Split vector loop analysis into main and epilogue analysis
As discussed this splits the analysis loop into two, first settling
on a vector mode used for the main loop and only then analyzing
the epilogue of that for possible vectorization.  That makes it
easier to put in support for unrolled main loops.

On the way I've realized some cleanup opportunities, namely caching
n_stmts in vec_info_shared (it's computed by dataref analysis)
avoiding to pass that around and setting/clearing loop->aux
during analysis - try_vectorize_loop_1 will ultimatively set it
on those we vectorize.

This also gets rid of the previously introduced callback in
vect_analyze_loop_1 in favor of making that advance the mode iterator.
I'm now pushing VOIDmode explicitely into the vector_modes array
which makes the re-start on the epilogue side a bit more
straight-forward.  Note that will now use auto-detection of the
vector mode in case the main loop used it and we want to try
LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P and the first mode from
the target array if not.  I've added a comment that says we may
want to make sure we don't try vectorizing the epilogue with a
bigger vector size than the main loop but the situation isn't
very likely to appear in practice I guess (and it was also present
before this change).

In principle this change should not change vectorization decisions
but the way we handled re-analyzing epilogues as main loops makes
me only 99% sure that it does.

2021-11-05  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (vec_info_shared::n_stmts): Add.
	(LOOP_VINFO_N_STMTS): Likewise.
	(vec_info_for_bb): Remove unused function.
	* tree-vectorizer.c (vec_info_shared::vec_info_shared):
	Initialize n_stmts member.
	* tree-vect-loop.c: Remove INCLUDE_FUNCTIONAL.
	(vect_create_loop_vinfo): Do not set loop->aux.
	(vect_analyze_loop_2): Do not get n_stmts as argument,
	instead use LOOP_VINFO_N_STMTS.  Set LOOP_VINFO_VECTORIZABLE_P
	here.
	(vect_analyze_loop_1): Remove callback, get the mode iterator
	and autodetected_vector_mode as argument, advancing the
	iterator and initializing autodetected_vector_mode here.
	(vect_analyze_loop): Split analysis loop into two, first
	processing main loops only and then epilogues.
2021-11-05 14:34:42 +01:00
Martin Jambor
ea42c80585
ipa: Do not require RECORD_TYPE for ancestor jump functions
The check this patch removes has remained from times when ancestor
jump functions have been only used for devirtualization and also
contained BINFOs.  It is not necessary now and should have been
removed long time ago.

gcc/ChangeLog:

2021-11-04  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.c (compute_complex_assign_jump_func): Remove
	unnecessary check for RECORD_TYPE.
2021-11-05 14:29:31 +01:00
Jonathan Wakely
30b8ec68e2 libstdc++: Add xfail to pretty printer tests that fail in C++20
For some reason the type printer for std::string doesn't work in C++20
mode, so std::basic_string<char, char_traits<char>, allocator<char> is
printed out in full rather than being shown as std::string. It's
probably related to the fact that the extern template declarations are
disabled for C++20, but I don't know why that affects GDB.

For now I'm just marking the relevant tests as XFAIL. That requires
adding support for target selectors to individual GDB directives such as
note-test and whatis-regexp-test.

libstdc++-v3/ChangeLog:

	* testsuite/lib/gdb-test.exp: Add target selector support to the
	dg-final directives.
	* testsuite/libstdc++-prettyprinters/80276.cc: Add xfail for
	C++20.
	* testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/prettyprinters.exp: Tweak
	comment.
2021-11-05 12:22:31 +00:00
Gerald Pfeifer
44d9d55c6d include: Allow for our md5.h to defer to the system header
This came up in the context of libsanitizer, where platform-specific
support for FreeBSD relies on aspects provided by FreeBSD's own md5.h.

Address this by allowing GCC's md5.h to pull in the system header
instead, controlled by a new macro USE_SYSTEM_MD5.

2021-11-05  Gerald Pfeifer  <gerald@pfeifer.com>
	    Jakub Jelinek  <jakub@redhat.com>

include/
	* md5.h (USE_SYSTEM_MD5): Introduce.
2021-11-05 13:06:34 +01:00
Gerald Pfeifer
84cbbb0a16 doc: No longer generate old.html
Commit 431d26e1dd removed
doc/install-old.texi, alas we still tried to generate the
associated web page old.html - which then turned out empty.

Simplify remove this from the list of pages to be generated.

gcc:
	* doc/install.texi2html: Do not generate old.html any longer.
2021-11-05 13:06:03 +01:00
Martin Liska
14c7041a1f Reset when -gtoggle is used in gcc_options.
PR debug/102955

gcc/ChangeLog:

	* opts.c (finish_options): Reset flag_gtoggle when it is used.

gcc/testsuite/ChangeLog:

	* g++.dg/pr102955.C: New test.
2021-11-05 13:01:01 +01:00
Jakub Jelinek
155f6b2be4 dwarf2out: Fix up CONST_WIDE_INT handling once more [PR103046]
My last change to CONST_WIDE_INT handling in add_const_value_attribute broke
handling of CONST_WIDE_INT constants like ((__uint128_t) 1 << 120).
wi::min_precision (w1, UNSIGNED) in that case 121, but wide_int::from
creates a wide_int that has 0 and 0xff00000000000000ULL in its elts and
precision 121.  When we output that, we output both elements and thus emit
0, 0xff00000000000000 instead of the desired 0, 0x0100000000000000.

IMHO we should actually pass machine_mode to add_const_value_attribute from
callers, so that we know exactly what precision we want.  Because
hypothetically, if say mode is OImode and the CONST_WIDE_INT value fits into
128 bits or 192 bits, we'd emit just those 128 or 192 bits but debug info
users would expect 256 bits.

On
typedef unsigned __int128 U;

int
main ()
{
  U a = (U) 1 << 120;
  U b = 0xffffffffffffffffULL;
  U c = ((U) 0xffffffff00000000ULL) << 64;
  return 0;
}
vanilla gcc incorrectly emits 0, 0xff00000000000000 for a,
0xffffffffffffffff alone (DW_FORM_data8) for b and 0, 0xffffffff00000000
for c.  gcc with the previously posted PR103046 patch emits
0, 0x0100000000000000 for a, 0xffffffffffffffff alone for b and
0, 0xffffffff00000000 for c.  And with this patch we emit
0, 0x0100000000000000 for a, 0xffffffffffffffff, 0 for b and
0, 0xffffffff00000000 for c.
So, the patch below certainly causes larger debug info (well, 128-bit
integers are pretty rare), but in this case the question is if it isn't
more correct, as debug info consumers generally will not know if they
should sign or zero extend the value in DW_AT_const_value.
The previous code assumes they will always zero extend it...

2021-11-05  Jakub Jelinek  <jakub@redhat.com>

	PR debug/103046
	* dwarf2out.c (add_const_value_attribute): Add MODE argument, use it
	in CONST_WIDE_INT handling.  Adjust recursive calls.
	(add_location_or_const_value_attribute): Pass DECL_MODE (decl) to
	new add_const_value_attribute argument.
	(tree_add_const_value_attribute): Pass TYPE_MODE (type) to new
	add_const_value_attribute argument.
2021-11-05 10:20:10 +01:00
Rasmus Villemoes
44d0243a24 gcc: vx-common.h: fix test for VxWorks7
The macro TARGET_VXWORKS7 is always defined (see vxworks-dummy.h).
Thus we need to test its value, not its definedness.

Fixes aca124df (define NO_DOT_IN_LABEL only in vxworks6).

gcc/ChangeLog:

	* config/vx-common.h: Test value of TARGET_VXWORKS7 rather
	than definedness.
2021-11-05 09:42:21 +01:00
Richard Biener
33f1d03870 First refactor of vect_analyze_loop
This refactors the main loop analysis part in vect_analyze_loop,
re-purposing the existing vect_reanalyze_as_main_loop for this
to reduce code duplication.  Failure flow is a bit tricky since
we want to extract info from the analyzed loop but I wanted to
share the destruction part.  Thus I add some std::function and
lambda to funnel post-analysis for the case we want that
(when analyzing from the main iteration but not when re-analyzing
an epilogue as main).

In addition I split vect_analyze_loop_form into analysis and
vinfo creation so we can do the analysis only once, simplifying
the new vect_analyze_loop_1.

As discussed we probably want to change the loop over vector
modes to first only analyze things as the main loop, picking
the best (or simd VF) mode for the main loop and then analyze
for a vectorized epilogue.  The unroll would then integrate
with the main loop vectorization.  I think that currently
we may fail to analyze the epilogue with the same mode as
the main loop when using partial vectors since we increment
mode_i before doing that.

2021-11-04  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (struct vect_loop_form_info): New.
	(vect_analyze_loop_form): Adjust.
	(vect_create_loop_vinfo): New.
	* tree-parloops.c (gather_scalar_reductions): Adjust for
	vect_analyze_loop_form API change.
	* tree-vect-loop.c: Include <functional>.
	(vect_analyze_loop_form_1): Rename to vect_analyze_loop_form,
	take struct vect_loop_form_info as output parameter and adjust.
	(vect_analyze_loop_form): Rename to vect_create_loop_vinfo and
	split out call to the original vect_analyze_loop_form_1.
	(vect_reanalyze_as_main_loop): Rename to...
	(vect_analyze_loop_1): ... this, factor out the call to
	vect_analyze_loop_form and generalize to be able to use it twice ...
	(vect_analyze_loop): ... here.  Perform vect_analyze_loop_form
	once only and here.
2021-11-05 09:03:11 +01:00
Xionghu Luo
614b39757b rs6000: Fix incorrect fusion constraint [PR102991]
gcc/ChangeLog:

2021-11-05  Xionghu Luo  <luoxhu@linux.ibm.com>

	PR target/102991
	* config/rs6000/fusion.md: Regenerate.
	* config/rs6000/genfusion.pl: Fix incorrect clobber constraint.
2021-11-04 20:19:59 -05:00
GCC Administrator
29a1af24ef Daily bump. 2021-11-05 00:16:36 +00:00
Jonathan Wakely
a634928f5c libstdc++: Fix pretty printing of std::unique_ptr [PR103086]
Since std::tuple started using [[no_unique_address]] the tuple<T*, D>
member of std::unique_ptr<T, D> has two _M_head_impl subobjects, in
different base classes. That means this printer code is ambiguous:

    tuple_head_type = tuple_impl_type.fields()[1].type   # _Head_base
    head_field = tuple_head_type.fields()[0]
    if head_field.name == '_M_head_impl':
        self.pointer = tuple_member['_M_head_impl']

In older versions of GDB it happened to work by chance, because GDB
returned the last _M_head_impl member and std::tuple's base classes are
stored in reverse order, so the last one was the T* element of the
tuple. Since GDB 11 it returns the first _M_head_impl, which is the
deleter element.

The fix is for the printer to stop using an ambiguous field name and
cast the tuple to the correct base class before accessing the
_M_head_impl member.

Instead of fixing this in both UniquePointerPrinter and StdPathPrinter a
new unique_ptr_get function is defined to do it correctly. That is
defined in terms of new tuple_get and _tuple_impl_get functions.

It would be possible to reuse _tuple_impl_get to access each element in
StdTuplePrinter._iterator.__next__, but that already does the correct
casting, and wouldn't be much simpler anyway.

libstdc++-v3/ChangeLog:

	PR libstdc++/103086
	* python/libstdcxx/v6/printers.py (_tuple_impl_get): New helper
	for accessing the tuple element stored in a _Tuple_impl node.
	(tuple_get): New function for accessing a tuple element.
	(unique_ptr_get): New function for accessing a unique_ptr.
	(UniquePointerPrinter, StdPathPrinter): Use unique_ptr_get.
	* python/libstdcxx/v6/xmethods.py (UniquePtrGetWorker): Cast
	tuple to its base class before accessing _M_head_impl.
2021-11-04 22:50:02 +00:00
Jonathan Wakely
f4130a3eb5 libstdc++: Deprecate std::unexpected and handler functions
These functions have been deprecated since C++11, and were removed in
C++17. The proposal P0323 wants to reuse the name std::unexpected for a
class template, so we will need to stop defining the current function
for C++23 anyway.

This marks them as deprecated for C++11 and up, to warn users they won't
continue to be available. It disables them for C++17 and up, unless the
_GLIBCXX_USE_DEPRECATED macro is defined.

The <unwind-cxx.h> header uses std::unexpected_handler in the public
API, but since that type is the same as std::terminate_handler we can
just use that instead, to avoid warnings about it being deprecated.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/evolution.xml: Document deprecations.
	* doc/html/*: Regenerate.
	* libsupc++/exception (unexpected_handler, unexpected)
	(get_unexpected, set_unexpected): Add deprecated attribute.
	Do not define without _GLIBCXX_USE_DEPRECATED for C++17 and up.
	* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Disable
	deprecated warnings.
	* libsupc++/eh_ptr.cc (std::rethrow_exception): Likewise.
	* libsupc++/eh_terminate.cc: Likewise.
	* libsupc++/eh_throw.cc (__cxa_init_primary_exception):
	Likewise.
	* libsupc++/unwind-cxx.h (struct __cxa_exception): Use
	terminate_handler instead of unexpected_handler.
	(struct __cxa_dependent_exception): Likewise.
	(__unexpected): Likewise.
	* testsuite/18_support/headers/exception/synopsis.cc: Add
	dg-warning for deprecated warning.
	* testsuite/18_support/exception_ptr/60612-unexpected.cc:
	Disable deprecated warnings.
	* testsuite/18_support/set_unexpected.cc: Likewise.
	* testsuite/18_support/unexpected_handler.cc: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/lambda/lambda-eh2.C: Add dg-warning for new
	deprecation warnings.
	* g++.dg/cpp0x/noexcept06.C: Likewise.
	* g++.dg/cpp0x/noexcept07.C: Likewise.
	* g++.dg/eh/forced3.C: Likewise.
	* g++.dg/eh/unexpected1.C: Likewise.
	* g++.old-deja/g++.eh/spec1.C: Likewise.
	* g++.old-deja/g++.eh/spec2.C: Likewise.
	* g++.old-deja/g++.eh/spec3.C: Likewise.
	* g++.old-deja/g++.eh/spec4.C: Likewise.
	* g++.old-deja/g++.mike/eh33.C: Likewise.
	* g++.old-deja/g++.mike/eh34.C: Likewise.
	* g++.old-deja/g++.mike/eh50.C: Likewise.
	* g++.old-deja/g++.mike/eh51.C: Likewise.
2021-11-04 20:53:29 +00:00
Andreas Krebbel
79fe28d2c4 IBM Z: Define STACK_CHECK_MOVING_SP
With -fstack-check the stack probes emitted access memory below the
stack pointer.

gcc/ChangeLog:

	* config/s390/s390.h (STACK_CHECK_MOVING_SP): New macro
	definition.
2021-11-04 19:40:33 +01:00
Jonathan Wakely
b57899f30f libstdc++: Consolidate duplicate metaprogramming utilities
Currently std::variant uses __index_of<T, Types...> to find the first
occurence of a type in a pack, and __exactly_once<T, Types...> to check
that there is no other occurrence.

We can reuse the __find_uniq_type_in_pack<T, Types...>() function for
both tasks, and remove the recursive templates used to implement
__index_of and __exactly_once.

libstdc++-v3/ChangeLog:

	* include/bits/utility.h (__find_uniq_type_in_pack): Move
	definition to here, ...
	* include/std/tuple (__find_uniq_type_in_pack): ... from here.
	* include/std/variant (__detail__variant::__index_of): Remove.
	(__detail::__variant::__exactly_once): Define using
	__find_uniq_type_in_pack instead of __index_of.
	(get<T>, get_if<T>, variant::__index_of): Likewise.
2021-11-04 18:14:50 +00:00
Jonathan Wakely
09aab7e699 libstdc++: Optimize std::tuple_element and std::tuple_size_v
This reduces the number of class template instantiations needed for code
using tuples, by reusing _Nth_type in tuple_element and specializing
tuple_size_v for tuple, pair and array (and const-qualified versions of
them).

Also define the _Nth_type primary template as a complete type (but with
no nested 'type' member).  This avoids "invalid use of incomplete type"
errors for out-of-range specializations of tuple_element. Those errors
would probably be confusing and unhelpful for users. We already have
a user-friendly static assert in tuple_element itself.

Also ensure that tuple_size_v is available whenever tuple_size is (as
proposed by LWG 3387). We already do that for tuple_element_t.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h (tuple_size_v): Define partial
	specializations for std::pair.
	* include/bits/utility.h (_Nth_type): Move definition here
	and define primary template.
	(tuple_size_v): Move definition here.
	* include/std/array (tuple_size_v): Define partial
	specializations for std::array.
	* include/std/tuple (tuple_size_v): Move primary template to
	<bits/utility.h>.  Define partial specializations for
	std::tuple.
	(tuple_element): Change definition to use _Nth_type.
	* include/std/variant (_Nth_type): Move to <bits/utility.h>.
	(variant_alternative, variant): Adjust qualification of
	_Nth_type.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Prune
	additional errors from _Nth_type.
2021-11-04 18:14:50 +00:00
Tamar Christina
1b4a63593b AArch64: Lower intrinsics shift to GIMPLE when possible.
This lowers shifts to GIMPLE when the C interpretations of the shift operations
matches that of AArch64.

In C shifting right by BITSIZE is undefined, but the behavior is defined in
AArch64.  Additionally negative shifts lefts are undefined for the register
variant of the instruction (SSHL, USHL) as being right shifts.

Since we have a right shift by immediate I rewrite those cases into right shifts

So:

int64x1_t foo3 (int64x1_t a)
{
  return vshl_s64 (a, vdup_n_s64(-6));
}

produces:

foo3:
        sshr    d0, d0, 6
        ret

instead of:

foo3:
        mov     x0, -6
        fmov    d1, x0
        sshl    d0, d0, d1
        ret

This behavior isn't specifically mentioned for a left shift by immediate, but I
believe that only the case because we do have a right shift by immediate but not
a right shift by register.  As such I do the same for left shift by immediate.

gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c
	(aarch64_general_gimple_fold_builtin): Add ashl, sshl, ushl, ashr,
	ashr_simd, lshr, lshr_simd.
	* config/aarch64/aarch64-simd-builtins.def (lshr): Use USHIFTIMM.
	* config/aarch64/arm_neon.h (vshr_n_u8, vshr_n_u16, vshr_n_u32,
	vshrq_n_u8, vshrq_n_u16, vshrq_n_u32, vshrq_n_u64): Fix type hack.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-1.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-2.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-3.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-4.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-5.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-6.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-7.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/vshl-opt-8.c: New test.
	* gcc.target/aarch64/signbit-2.c: New test.
2021-11-04 17:36:08 +00:00
Tamar Christina
d70720c238 middle-end: convert negate + right shift into compare greater.
This turns an inversion of the sign bit + arithmetic right shift into a
comparison with 0.

i.e.

void fun1(int32_t *x, int n)
{
    for (int i = 0; i < (n & -16); i++)
      x[i] = (-x[i]) >> 31;
}

now generates:

.L3:
        ldr     q0, [x0]
        cmgt    v0.4s, v0.4s, #0
        str     q0, [x0], 16
        cmp     x0, x1
        bne     .L3

instead of:

.L3:
        ldr     q0, [x0]
        neg     v0.4s, v0.4s
        sshr    v0.4s, v0.4s, 31
        str     q0, [x0], 16
        cmp     x0, x1
        bne     .L3

gcc/ChangeLog:

	* match.pd: New negate+shift pattern.

gcc/testsuite/ChangeLog:

	* gcc.dg/signbit-2.c: New test.
	* gcc.dg/signbit-3.c: New test.
	* gcc.dg/signbit-4.c: New test.
	* gcc.dg/signbit-5.c: New test.
	* gcc.dg/signbit-6.c: New test.
	* gcc.target/aarch64/signbit-1.c: New test.
2021-11-04 17:32:09 +00:00
Andrew MacLeod
004afb984b Treat undefined operands as varying in GORI.
If the LHS is UNDEFINED simply stop calculating.  Treat op1 and op2
as VARYING if they are UNDEFINED.

	PR tree-optimization/103079
	gcc/
	* gimple-range-gori.cc (gimple_range_calc_op1): Treat undefined as
	varying.
	(gimple_range_calc_op2): Ditto.

	gcc/testsuite/
	* gcc.dg/pr103079.c: New.
2021-11-04 13:15:36 -04:00
Martin Jambor
1ece90ffa9
ipa-sra: Improve debug info for removed parameters (PR 93385)
In spring I added code eliminating any statements using parameters
removed by IPA passes (to fix PR 93385).  That patch fixed issues such
as divisions by zero that such code could perform but it only reset
all affected debug bind statements, this one updates them with
expressions which can allow the debugger to print the removed value -
see the added test-case for an example.

Even though I originally did not want to create DEBUG_EXPR_DECLs for
intermediate values, I ended up doing so, because otherwise the code
started creating statements like

   # DEBUG __aD.198693 => &MEM[(const struct _Alloc_nodeD.171110 *)D#195]._M_tD.184726->_M_implD.171154

which not only is a bit scary but also gimple-fold ICEs on
it. Therefore I decided they are probably quite necessary.

The patch simply notes each removed SSA name present in a debug
statement and then works from it backwards, looking if it can
reconstruct the expression it represents (which can fail if a
non-degenerate PHI node is in the way).  If it can, it populates two
hash maps with those expressions so that 1) removed assignments are
replaced with a debug bind defining a new intermediate debug_decl_expr
and 2) existing debug binds that refer to SSA names that are bing
removed now refer to corresponding debug_decl_exprs.

If a removed parameter is passed to another function, the debugging
information still cannot describe its value there - see the xfailed
test in the testcase.  I sort of know what needs to be done but that
needs a little bit more of IPA infrastructure on top of this patch and
so I would like to get this patch reviewed first.

Bootstrapped and tested on x86_64-linux, i686-linux and (long time
ago) on aarch64-linux.  Also LTO-bootstrapped and on x86_64-linux.

Perhaps it is good to go to trunk?

Thanks,

Martin

gcc/ChangeLog:

2021-03-29  Martin Jambor  <mjambor@suse.cz>

	PR ipa/93385
	* ipa-param-manipulation.h (class ipa_param_body_adjustments): New
	members remap_with_debug_expressions, m_dead_ssa_debug_equiv,
	m_dead_stmt_debug_equiv and prepare_debug_expressions.  Added
	parameter to mark_dead_statements.
	* ipa-param-manipulation.c: Include tree-phinodes.h and cfgexpand.h.
	(ipa_param_body_adjustments::mark_dead_statements): New parameter
	debugstack, push into it all SSA names used in debug statements,
	produce m_dead_ssa_debug_equiv mapping for the removed param.
	(replace_with_mapped_expr): New function.
	(ipa_param_body_adjustments::remap_with_debug_expressions): Likewise.
	(ipa_param_body_adjustments::prepare_debug_expressions): Likewise.
	(ipa_param_body_adjustments::common_initialization): Gather and
	procecc SSA which will be removed but are in debug statements. Simplify.
	(ipa_param_body_adjustments::ipa_param_body_adjustments): Initialize
	new members.
	* tree-inline.c (remap_gimple_stmt): Create a debug bind when possible
	when avoiding a copy of an unnecessary statement.  Remap removed SSA
	names in existing debug statements.
	(tree_function_versioning): Do not create DEBUG_EXPR_DECL for removed
	parameters if we have already done so.

gcc/testsuite/ChangeLog:

2021-03-29  Martin Jambor  <mjambor@suse.cz>

	PR ipa/93385
	* gcc.dg/guality/ipa-sra-1.c: New test.
2021-11-04 18:08:29 +01:00
Sandra Loosemore
7237c5b698 Fortran manual: Remove old docs for never-implemented extensions.
2021-11-01  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/fortran/
	* gfortran.texi (Projects): Add bullet for helping with
	incomplete standards compliance.
	(Proposed Extensions): Delete section.
2021-11-04 09:53:02 -07:00
Sandra Loosemore
b96fdc0fca Fortran manual: Update miscellaneous references to old standard versions.
2021-11-01  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/fortran/
	* intrinsic.texi (Introduction to Intrinsics): Genericize
	references to standard versions.
	* invoke.texi (-fall-intrinsics): Likewise.
	(-fmax-identifier-length=): Likewise.
2021-11-04 09:53:02 -07:00