Commit Graph

184445 Commits

Author SHA1 Message Date
Jakub Jelinek
d81efb065d Update ChangeLog and version files for release 2021-04-27 09:23:56 +00:00
Jakub Jelinek
1a6ef9a8b0 Update gennews for GCC 10 and GCC 11.
2021-04-27  Jakub Jelinek  <jakub@redhat.com>

	* gennews (files): Add files for GCC 10 and GCC 11.

(cherry picked from commit bbadf83e5a)
2021-04-27 11:05:18 +02:00
GCC Administrator
6ed29a4ed4 Daily bump. 2021-04-27 00:18:24 +00:00
GCC Administrator
d3212299e2 Daily bump. 2021-04-26 00:18:00 +00:00
GCC Administrator
a6f018fcc6 Daily bump. 2021-04-25 00:18:23 +00:00
GCC Administrator
5b2ac9b40c Daily bump. 2021-04-24 00:18:21 +00:00
Tobias Burnus
7a7fc01b9d testsuite/substr_{9,10}.f90: Move to gfortran.dg/
gcc/testsuite/
	* substr_9.f90: Move to ...
	* gfortran.dg/substr_9.f90: ... here.
	* substr_10.f90: Move to ...
	* gfortran.dg/substr_10.f90: ... here.

(cherry picked from commit ac456fd981)
2021-04-23 12:38:53 +02:00
Jonathan Wakely
ee8b08ad88 libstdc++: Fix semaphore to work with system_clock timeouts
The __cond_wait_until_impl function takes a steady_clock timeout, but
then sometimes tries to compare it to a time from the system_clock,
which won't compile.  Additionally, that function gets called with
system_clock timeouts, which also won't compile. This makes the function
accept timeouts for either clock, and compare to the time from the right
clock.

This fixes the compilation error that was causing two tests to fail on
non-futex targets, so we can revert the r12-11 change to disable them.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_timed_wait.h (__cond_wait_until_impl):
	Handle system_clock as well as steady_clock.
	* testsuite/30_threads/semaphore/try_acquire_for.cc: Re-enable.
	* testsuite/30_threads/semaphore/try_acquire_until.cc:
	Re-enable.

(cherry picked from commit 6924588774)
2021-04-23 10:39:16 +01:00
Jonathan Wakely
dcf46d7207 libstdc++: Add options for libatomic to test
This fixes a linker error on AIX:

FAIL: 30_threads/semaphore/try_acquire_posix.cc (test for excess errors)
Excess errors:
ld: 0711-317 ERROR: Undefined symbol: .__atomic_fetch_add_8
ld: 0711-317 ERROR: Undefined symbol: .__atomic_load_8
ld: 0711-317 ERROR: Undefined symbol: .__atomic_fetch_sub_8
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status

libstdc++-v3/ChangeLog:

	* testsuite/30_threads/semaphore/try_acquire_posix.cc: Add
	options for libatomic.

(cherry picked from commit 58871c0331)
2021-04-23 10:39:16 +01:00
GCC Administrator
a750d7d4cf Daily bump. 2021-04-23 00:17:58 +00:00
Thomas Rodgers
c9da070318 libstdc++: Fix "bare" notifications dropped by waiters check
For types that track whether or not there extant waiters (e.g.
semaphore) internally, the __atomic_notify_address_bare() call was
introduced to avoid the overhead of loading the atomic count of
waiters. For platforms that don't have Futex, however, there was
still a check for waiters, and seeing that there are none (because
in the bare case, the count is not incremented), the notification
is dropped. This commit addresses that case.

libstdc++-v3/ChangeLog:
	* include/bits/atomic_wait.h: Always notify waiters in the
	case of 'bare' address notification.

(cherry picked from commit 2d856af6f9f38fd730754e5024aa82aab3948069)
2021-04-22 07:34:37 -07:00
Jonathan Wakely
718fcebe8b libstdc++: Remove #error from <semaphore> implementation [PR 100179]
This removes the #error from <bits/semaphore_base.h> for the case where
neither __atomic_semaphore nor __platform_semaphore is defined.

Also rename the _GLIBCXX_REQUIRE_POSIX_SEMAPHORE macro to
_GLIBCXX_USE_POSIX_SEMAPHORE for consistency with the similar
_GLIBCXX_USE_CXX11_ABI macro that can be used to request an alternative
(ABI-changing) implementation.

libstdc++-v3/ChangeLog:

	PR libstdc++/100179
	* include/bits/semaphore_base.h: Remove #error.
	* include/std/semaphore: Do not define anything unless one of
	the implementations is available.

(cherry picked from commit 4b2db80771)
2021-04-22 14:37:23 +01:00
Jakub Jelinek
a21f3b38c3 libstdc++: Add workaround for ia32 floating atomics miscompilations [PR100184]
gcc on ia32 miscompiles various atomics involving floating point,
unfortunately I'm afraid it is too late to fix that for 11.1 and
as I'm quite lost on it, it might take a while for 12 too
(disabling all the 8 peephole2s would be easiest, but then we'd
run into optimization regressions).

While 1.cc just FAILs, with dejagnu 1.6.1 wait_notify.cc hangs the
make check even after the timeout fires.  The following patch therefore
xfails the former and skips the latter.

Tested on x86_64-linux where
make check RUNTESTFLAGS='conformance.exp=atomic_float/*.cc'
is still
                === libstdc++ Summary ===

 # of expected passes            8
and on i686-linux, where it is now
                === libstdc++ Summary ===

 # of expected passes            5
 # of expected failures          1
 # of unsupported tests          1

2021-04-22  Jakub Jelinek  <jakub@redhat.com>

	PR target/100182
	* testsuite/29_atomics/atomic_float/1.cc: Add dg-xfail-run-if for
	ia32.
	* testsuite/29_atomics/atomic_float/wait_notify.cc: Add dg-skip-if for
	ia32.

(cherry picked from commit 0f4588141f)
2021-04-22 15:10:46 +02:00
Tobias Burnus
3d8c8b6146 gfortran.dg/pr68078.f90: Avoid increasing RLIMIT_AS
pr68078.f90 tests out-of-memory handling and calls set_vm_limit to set the
soft limit.  However, setrlimit was then called with hard limit RLIM_INFINITY,
which failed when the current hard limit was lower.

gcc/testsuite/
	* gfortran.dg/set_vm_limit.c (set_vm_limit): Call getrlimit, use
	obtained hard limit, and only call setrlimit if new softlimit is lower.

(cherry picked from commit faf7d413a3)
2021-04-22 12:30:05 +02:00
Richard Biener
42f2d16e72 testsuite/100176 - fix struct-layout-1_generate.c compile
With -Werror=return-type we run into compile fails complaining about
missing return stmts.

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

	PR testsuite/100176
	* objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Add
	missing return.

(cherry picked from commit 5668843346)
2021-04-22 09:52:27 +02:00
Richard Biener
74bd25f9a4 Avoid -latomic for amdgcn offloading
libatomic isn't built for amdgcn but reduction-16.c adds it
via -foffload=-latomic when offloading for nvptx is enabled.
The following avoids linker errors when offloading to amdgcn is enabled
as well.

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

libgomp/
	* testsuite/libgomp.c-c++-common/reduction-16.c: Use -latomic
	only on nvptx-none.

(cherry picked from commit d42088e453)
2021-04-22 08:30:10 +02:00
Thomas Rodgers
c0ffafb343 [libstdc++] Fix test timeout in stop_calback/destroy.cc
A change was made to __atomic_semaphore::_S_do_try_acquire() to
(ideally) let the compare_exchange reload the value of __old rather than
always reloading it twice. This causes _M_acquire to spin indefinitely
if the value of __old is already 0.

libstdc++-v3/ChangeLog:
	* include/bits/semaphore_base.h: Always reload __old in
	__atomic_semaphore::_S_do_try_acquire().
	* testsuite/30_threads/stop_token/stop_callback/destroy.cc:
	re-enable testcase.

(cherry picked from commit 7eeb8c04e5)
2021-04-21 18:32:26 -07:00
GCC Administrator
3a8437df29 Daily bump. 2021-04-22 00:18:07 +00:00
Thomas Rodgers
e826f7355a [libstdc++] Add missing _M_try_acquire() to __platform_semaphore
libstdc++-v3/ChangeLog:
	* include/bits/semaphore_base.h: Add missing _M_try_acquire()
	member to __platform_wait.

(cherry picked from commit 5445da1a94)
2021-04-21 08:24:40 -07:00
Jonathan Wakely
64e1ab67f8 libstdc++: Fix whitespace in license boilerplate
libstdc++-v3/ChangeLog:

	* include/std/latch: Replace tab characters in license text.
	* include/std/semaphore: Likewise.

(cherry picked from commit 88202c883c)
2021-04-21 13:12:41 +01:00
Andreas Schwab
4cdb510fb0 Fix endian bug in rust demangler
libiberty/
	PR demangler/100177
	* rust-demangle.c (demangle_const_char): Properly print the
	character value.
2021-04-21 13:31:08 +02:00
Richard Biener
89ddb58cda testsuite/100176 - fix struct-layout-1_generate.c compile
With -Werror=return-type we run into compile fails complaining about
missing return stmts.

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

	PR testsuite/100176
	* g++.dg/compat/struct-layout-1_generate.c: Add missing return.
	* gcc.dg/compat/struct-layout-1_generate.c: Likewise.

(cherry picked from commit d8f953819e)
2021-04-21 12:51:20 +02:00
Eric Botcazou
53e85b38aa Add stopgap fix for PR ada/99360
gcc/ada/
	PR ada/99360
	* exp_ch6.adb (Might_Have_Tasks): Return False when the type is the
	class-wide type of a predefined iterator type.
2021-04-21 11:19:28 +02:00
Jakub Jelinek
0857fc3820 Fix AIX libstdc++ semaphore support [PR100164]
> > The #error would not be hit if _GLIBCXX_HAVE_POSIX_SEMAPHORE were defined,
> > but it shows up in your error report.

> You now have pinpointed the problem.

> It's not that AIX doesn't have semaphore, but that the code previously
> had a fallback that hid a bug in the macros:

  // Use futex if available and didn't force use of POSIX
  using __fast_semaphore = __atomic_semaphore<__detail::__platform_wait_t>;
  using __fast_semaphore = __platform_semaphore;
  using __fast_semaphore = __atomic_semaphore<ptrdiff_t>;

> The problem is that libstdc++ configure defines
> _GLIBCXX_HAVE_POSIX_SEMAPHORE in config.h.  libstdc++ uses sed to
> rewrite config.h to c++config.h and prepends _GLIBCXX_, so c++config.h
> contains

> And bits/semaphore_base.h is not testing that corrupted macro.  Either
> semaphore_base.h needs to test for the corrupted macro, or libtsdc++
> configure needs to define HAVE_POSIX_SEMAPHORE without itself
> prepending _GLIBCXX_  so that the c++config.h rewriting works
> correctly and defines the correct macro for semaphore_base.h.

The include/Makefile.am sed is:
        sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
            -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
            -e 's/VERSION/_GLIBCXX_VERSION/g' \
            -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
            -e 's/_DARWIN_USE_64_BIT_INODE/_GLIBCXX_DARWIN_USE_64_BIT_INODE/g' \
            -e 's/_FILE_OFFSET_BITS/_GLIBCXX_FILE_OFFSET_BITS/g' \
            -e 's/_LARGE_FILES/_GLIBCXX_LARGE_FILES/g' \
            -e 's/ICONV_CONST/_GLIBCXX_ICONV_CONST/g' \
            -e '/[       ]_GLIBCXX_LONG_DOUBLE_COMPAT[   ]/d' \
            -e '/[       ]_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT[    ]/d' \
            < ${CONFIG_HEADER} >> $@ ;\
so for many macros one needs _GLIBCXX_ prefixes already in configure,
as can be seen in grep AC_DEFINE.*_GLIBCXX configure.ac acinclude.m4
But _GLIBCXX_HAVE_POSIX_SEMAPHORE is the only one that shouldn't have
that prefix because the sed is adding that.
E.g. on i686-linux, I see
grep _GLIBCXX__GLIBCXX c++config.h
that proves it is the only broken one.

So this change fixes the acinclude.m4 side.

2021-04-21  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/100164
	* acinclude.m4: For POSIX semaphores AC_DEFINE HAVE_POSIX_SEMAPHORE
	rather than _GLIBCXX_HAVE_POSIX_SEMAPHORE.
	* configure: Regenerated.
	* config.h.in: Regenerated.

(cherry picked from commit 2d4c3af94f)
2021-04-21 11:15:18 +02:00
Iain Buclaw
3756d99dab libphobos: Fix build fails for powerpc-linux
As register names are required for darwin, but not accepted by gas
unless you use `-mregnames', they have been conditionally removed on
non-darwin targets.

To avoid duplicating large blocks of almost identical code, the inline
assembly is now statically generated.

libphobos/ChangeLog:

	* libdruntime/core/thread/osthread.d (callWithStackShell): Statically
	generate PPC and PPC64 asm implementations, and conditionally remove
	PPC register names on non-Darwin targets.

(cherry picked from commit ea7b1cf534)
2021-04-21 02:29:43 +02:00
GCC Administrator
fbb7739892 Daily bump. 2021-04-21 00:18:00 +00:00
Joseph Myers
8580fafcca Regenerate gcc.pot.
* gcc.pot: Regenerate.
2021-04-20 18:21:02 +00:00
Jonathan Wakely
27350b77a9 libstdc++: Disable tests that fail after atomic wait/notify rewrite
These tests are currently failing, but should be analyzed and
re-enabled.

libstdc++-v3/ChangeLog:

	* testsuite/30_threads/semaphore/try_acquire_for.cc: Disable
	test for targets not using futexes for semaphores.
	* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.
	* testsuite/30_threads/stop_token/stop_callback/destroy.cc:
	Disable for all targets.

(cherry picked from commit 54995d98cc)
2021-04-20 15:27:09 +01:00
Thomas Rodgers
246abba01f libstdc++: Refactor/cleanup of C++20 atomic wait implementation
This is a substantial rewrite of the atomic wait/notify (and timed wait
counterparts) implementation.

The previous __platform_wait looped on EINTR however this behavior is
not required by the standard. A new _GLIBCXX_HAVE_PLATFORM_WAIT macro
now controls whether wait/notify are implemented using a platform
specific primitive or with a platform agnostic mutex/condvar. This
patch only supplies a definition for linux futexes. A future update
could add support __ulock_wait/wake on Darwin, for instance.

The members of __waiters were lifted to a new base class. The members
are now arranged such that overall sizeof(__waiter_pool_base) fits in
two cache lines (on platforms with at least 64 byte cache lines). The
definition will also use destructive_interference_size for this if it is
available.

The __waiters type is now specific to untimed waits, and is renamed to
__waiter_pool. Timed waits have a corresponding __timed_waiter_pool
type.  Much of the code has been moved from the previous __atomic_wait()
free function to the __waiter_base template and a __waiter derived type
is provided to implement the un-timed wait operations. A similar change
has been made to the timed wait implementation.

The __atomic_spin code has been extended to take a spin policy which is
invoked after the initial busy wait loop. The default policy is to
return from the spin. The timed wait code adds a timed backoff spinning
policy. The code from <thread> which implements this_thread::sleep_for,
sleep_until has been moved to a new <bits/std_thread_sleep.h> header
which allows the thread sleep code to be consumed without pulling in the
whole of <thread>.

The entry points into the wait/notify code have been restructured to
support either -
   * Testing the current value of the atomic stored at the given address
     and waiting on a notification.
   * Applying a predicate to determine if the wait was satisfied.
The entry points were renamed to make it clear that the wait and wake
operations operate on addresses. The first variant takes the expected
value and a function which returns the current value that should be used
in comparison operations, these operations are named with a _v suffix
(e.g. 'value'). All atomic<_Tp> wait/notify operations use the first
variant. Barriers, latches and semaphores use the predicate variant.

This change also centralizes what it means to compare values for the
purposes of atomic<T>::wait rather than scattering through individual
predicates.

This change also centralizes the repetitive code which adjusts for
different user supplied clocks (this should be moved elsewhere
and all such adjustments should use a common implementation).

This change also removes the hashing of the pointer and uses
the pointer value directly for indexing into the waiters table.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add new <bits/this_thread_sleep.h> header.
	* include/Makefile.in: Regenerate.
	* include/bits/this_thread_sleep.h: New file.
	* include/bits/atomic_base.h: Adjust all calls
	to __atomic_wait/__atomic_notify for new call signatures.
	* include/bits/atomic_timed_wait.h: Extensive rewrite.
	* include/bits/atomic_wait.h: Likewise.
	* include/bits/semaphore_base.h: Adjust all calls
	to __atomic_wait/__atomic_notify for new call signatures.
	* include/std/atomic: Likewise.
	* include/std/barrier: Likewise.
	* include/std/latch: Likewise.
	* include/std/semaphore: Likewise.
	* include/std/thread (this_thread::sleep_for)
	(this_thread::sleep_until): Move to new header.
	* testsuite/29_atomics/atomic/wait_notify/bool.cc: Simplify
	test.
	* testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise.
	* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
	* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
	* testsuite/29_atomics/atomic_float/wait_notify.cc: Likewise.
	* testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.

(cherry picked from commit b52aef3a8c)
2021-04-20 15:27:02 +01:00
Segher Boessenkool
8bd3b0c11c rs6000: Fix cpu selection w/ isel (PR100108)
There are various non-IBM CPUs with isel as well, so it is easiest if we
just don't consider that flag here (it is not needed).

2021-04-20  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/100108
	* config/rs6000/rs6000.c (rs6000_machine_from_flags): Do not consider
	OPTION_MASK_ISEL.

(cherry picked from commit 6156df483f)
2021-04-20 13:55:04 +00:00
Martin Liska
432a5b8744 It seems we bumped LTO_major_version last time 2 years ago.
Right now, the following is seen when one links a GCC 10.2.x LTO object file:
$ gcc a.o

lto1: fatal error: bytecode stream in file 'a.o' generated with LTO version 9.2 instead of the expected 9.0

I suggest bumping LTO_major_version for releases/gcc-11 branch.
Can we please align it with a GCC release (version 11)? For the future, if e.g. GCC 12 consumes LTO
bytecode from GCC 11, we can leave LTO_major_version. Once e.g. GCC 13 needs bumping,
I would then change it to 13.

gcc/ChangeLog:

	* lto-streamer.h (LTO_major_version): Bump to 11.
2021-04-20 15:53:09 +02:00
Patrick Palka
eecefcb78c libstdc++: Implement P2259R1 changes [PR95983]
This implements the wording changes of P2259R1 "Repairing input range
adaptors and counted_iterator", which resolves LWG 3283, 3289 and 3408.

The wording changes are relatively straightforward, but they require
some boilerplate to implement: the changes to make a type alias
"conditionally present" in some iterator class are realized by defining
a base class template and an appropriately constrained partial
specialization thereof that contains the type alias, and having the
iterator class derive from this base class.  Sometimes the relevant
condition depend on members from the iterator class, but because a
class is incomplete when instantiating its bases, the constraints on
the partial specialization can't use anything from the iterator class.
This patch works around this by hoisting these members out to the
enclosing scope (e.g. transform_view::_Iterator::_Base is hoisted out
to transform_view::_Base so that transform_view::__iter_cat can use it).

This patch also implements the proposed resolution of LWG 3291 to rename
iota_view::iterator_category to iota_view::iterator_concept, which was
previously problematic due to LWG 3408.

libstdc++-v3/ChangeLog:

	PR libstdc++/95983
	* include/bits/stl_iterator.h (__detail::__move_iter_cat):
	Define.
	(move_iterator): Derive from the above in C++20 in order to
	conditionally define iterator_category as per P2259.
	(move_iterator::__base_cat): No longer used, so remove.
	(move_iterator::iterator_category): Remove in C++20.
	(__detail::__common_iter_use_postfix_proxy): Define.
	(common_iterator::_Proxy): Rename to ...
	(common_iterator:__arrow_proxy): ... this.
	(common_iterator::__postfix_proxy): Define as per P2259.
	(common_iterator::operator->): Adjust.
	(common_iterator::operator++): Adjust as per P2259.
	(iterator_traits<common_iterator>::_S_iter_cat): Define.
	(iterator_traits<common_iterator>::iterator_category): Change as
	per P2259.
	(__detail::__counted_iter_value_type): Define.
	(__detail::__counted_iter_concept): Define.
	(__detail::__counted_iter_cat): Define.
	(counted_iterator): Derive from the above three classes in order
	to conditionally define value_type, iterator_concept and
	iterator category respectively as per P2259.
	(counted_iterator::operator->): Define as per P2259.
	(incrementable_traits<counted_iterator>): Remove as per P2259.
	(iterator_traits<counted_iterator>): Adjust as per P2259.
	* include/std/ranges (__detail::__iota_view_iter_cat): Define.
	(iota_view::_Iterator): Derive from the above in order to
	conditionally define iterator_category as per P2259.
	(iota_view::_S_iter_cat): Rename to ...
	(iota_view::_S_iter_concept): ... this.
	(iota_view::iterator_concept): Use it to apply LWG 3291 changes.
	(iota_view::iterator_category): Remove.
	(__detail::__filter_view_iter_cat): Define.
	(filter_view::_Iterator): Derive from the above in order to
	conditionally define iterator_category as per P2259.
	(filter_view::_Iterator): Move to struct __filter_view_iter_cat.
	(filter_view::_Iterator::iterator_category): Remove.
	(transform_view::_Base): Define.
	(transform_view::__iter_cat): Define.
	(transform_view::_Iterator): Derive from the above in order to
	conditionally define iterator_category as per P2259.
	(transform_view::_Iterator::_Base): Just alias
	transform_view::_Base.
	(transform_view::_Iterator::_S_iter_cat): Move to struct
	transform_view::__iter_cat.
	(transform_view::_Iterator::iterator_category): Remove.
	(transform_view::_Sentinel::_Base): Just alias
	transform_view::_Base.
	(join_view::_Base): Define.
	(join_view::_Outer_iter): Define.
	(join_view::_Inner_iter): Define.
	(join_view::_S_ref_is_glvalue): Define.
	(join_view::__iter_cat): Define.
	(join_view::_Iterator): Derive from it in order to conditionally
	define iterator_category as per P2259.
	(join_view::_Iterator::_Base): Just alias join_view::_Base.
	(join_view::_Iterator::_S_ref_is_glvalue): Just alias
	join_view::_S_ref_is_glvalue.
	(join_view::_Iterator::_S_iter_cat): Move to struct
	transform_view::__iter_cat.
	(join_view::_Iterator::_Outer_iter): Just alias
	join_view::_Outer_iter.
	(join_view::_Iterator::_Inner_iter): Just alias
	join_view::_Inner_iter.
	(join_view::_Iterator::iterator_category): Remove.
	(join_view::_Sentinel::_Base): Just alias join_view::_Base.
	(__detail::__split_view_outer_iter_cat): Define.
	(__detail::__split_view_inner_iter_cat): Define.
	(split_view::_Base): Define.
	(split_view::_Outer_iter): Derive from __split_view_outer_iter_cat
	in order to conditionally define iterator_category as per P2259.
	(split_view::_Outer_iter::iterator_category): Remove.
	(split_view::_Inner_iter): Derive from __split_view_inner_iter_cat
	in order to conditionally define iterator_category as per P2259.
	(split_view::_Inner_iter::_S_iter_cat): Move to
	__split_view_inner_iter_cat.
	(split_view::_Inner_iter::iterator_category): Remove.
	(elements_view::_Base): Define.
	(elements_view::__iter_cat): Define.
	(elements_view::_Iterator): Derive from the above in order to
	conditionall define iterator_category as per P2259.
	(elements_view::_Iterator::_Base): Just alias
	elements_view::_Base.
	(elements_view::_Iterator::_S_iter_concept)
	(elements_view::_Iterator::iterator_concept): Define as per
	P2259.
	(elements_view::_Iterator::iterator_category): Remove.
	(elements_view::_Sentinel::_Base): Just alias
	elements_view::_Base.
	* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
	Adjust constraints on iterator_traits<counted_iterator>.
	* testsuite/std/ranges/p2259.cc: New test.

(cherry picked from commit 902b40c797)
2021-04-20 09:19:33 -04:00
Jonathan Wakely
73ac2cfc69 libstdc++: Define __cpp_lib_to_chars for C++20 [PR 100146]
This defines the feature test macro when uselocale is available, because
the floating-point std::from_chars support currently depends on that.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/100146
	* include/std/charconv (__cpp_lib_to_chars): Define
	conditionally.
	* include/std/version (__cpp_lib_to_chars): Likewise..
	* testsuite/20_util/from_chars/4.cc: Only check feature test
	macro, not _GLIBCXX_HAVE_USELOCALE.
	* testsuite/20_util/from_chars/5.cc: Likewise.
	* testsuite/20_util/from_chars/6.cc: Likewise.
	* testsuite/20_util/to_chars/long_double.cc: Likewise.

(cherry picked from commit f1a68574b1)
2021-04-20 12:53:30 +01:00
Jakub Jelinek
62dfbfd490 libstdc++: Update ppc64le baseline_symbols.txt
> Tested on powerpc64{,le}-linux now (-m32/-m64 on be) and while the first
> patch works fine, the second one unfortunately doesn't on either be or le,
> so more work is needed there.

Here are the needed changes to make it work.
For symbols with _LDBL_ substring in version name we already have code to
ignore those if no such symbols appear (but it is slightly incorrect, see
below).
So, this patch does the same thing for symbol versions with _IEEE128_
substring.
The previously incorrectly handled case is that in addition to
FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
or
OBJECT:12:_ZTSu9__ieee128@@CXXABI_IEEE128_1.3.13
cases we also have the
OBJECT:0:CXXABI_IEEE128_1.3.13
OBJECT:0:GLIBCXX_IEEE128_3.4.29
cases, which have empty version_name and the name is in that case the
symbol version.  Those need to be ignored too.

2021-04-20  Jakub Jelinek  <jakub@redhat.com>

	* testsuite/util/testsuite_abi.cc (compare_symbols): If any symbol
	versions with _IEEE128_ substring are found, set ieee_version_found
	to true.  Ignore missing symbols with _IEEE128_ in version name if
	!ieee_version_found.  Use i->first as version_name instead of
	i->second.version_name if the latter is empty.
	* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.

(cherry picked from commit 96de14f46f)
2021-04-20 12:50:41 +02:00
Martin Liska
14298862c9 Fix typo in param description.
gcc/ChangeLog:

	* doc/invoke.texi: Fix typo.
	* params.opt: Likewise.

(cherry picked from commit e265278a3b)
2021-04-20 12:11:39 +02:00
Martin Liska
b8708709f7 Document ranger-logical-depth in invoke.texi
gcc/ChangeLog:

	* doc/invoke.texi: Document new param.

(cherry picked from commit a8d90d0992)
2021-04-20 11:02:47 +02:00
Jakub Jelinek
faf4651a55 Set DEV-PHASE to prerelease.
2021-04-20  Jakub Jelinek  <jakub@redhat.com>

	* DEV-PHASE: Set to prerelease.
2021-04-20 10:38:22 +02:00
Stefan Schulze Frielinghaus
250f234988 testsuite: Fix up gcc.target/s390/zero-scratch-regs-1.c
Depending on whether GCC is configured using --with-mode=zarch or not,
for the 31bit target instructions are generated either for ESA or
z/Architecture.  For the sake of simplicity and robustness test only for
the latter by adding manually option -mzarch.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/zero-scratch-regs-1.c: Force test to run for
	z/Architecture only.
2021-04-20 09:51:16 +02:00
Paul Thomas
67378cd63d Fortran: Fix host associated PDT entity initialization [PR99307].
2021-04-20  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/100110
	* trans-decl.c (gfc_get_symbol_decl): Replace test for host
	association with a check that the current and symbol namespaces
	are the same.

gcc/testsuite/
	PR fortran/100110
	* gfortran.dg/pdt_31.f03: New test.
	* gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9
	to 8.
2021-04-20 07:30:45 +01:00
Iain Buclaw
30b11d8d1b libphobos: Fix SIGBUS in read_encoded_value_with_base on sparc-sun-solaris (PR98584)
Instead of unsafe pointer dereferencing, use memcpy() to read encoded
values from memory.  The function `read_encoded_value' has been updated
to accept a ref parameter, this simplifies handling of the pointer to
memory needing to be read.

libphobos/ChangeLog:

	PR d/98584
	* libdruntime/gcc/deh.d (scanLSDA): Update calls to read_uleb128 and
	read_encoded_value.
	(actionTableLookup): Update calls to read_sleb128 and
	read_encoded_value_with_base.
	* libdruntime/gcc/unwind/pe.d (read_uleb128): Update signature.
	(read_sleb128): Update signature.
	(read_unaligned): New function.
	(read_encoded_value_with_base): Update signature.  Call read_unaligned
	instead of unsafe pointer dereferencing.
	(read_encoded_value): Update signature.
2021-04-20 02:28:12 +02:00
GCC Administrator
6e81e015d9 Daily bump. 2021-04-20 00:16:27 +00:00
Marek Polacek
29d8838c5e c++: ICE with concept defined in function [PR97536]
This is an ICE-on-invalid, but I keep seeing it when reducing code so
I'd like to fix it.  We crash on

  template <typename> void forward() {
    concept C = true;
  }

which breaks two requirements:
[temp.concept]/1: A concept is a template ...
[temp.concept]/3: A concept-definition shall inhabit a namespace scope.

This patch adds a test that exercises broken code and fixes the ICE
by checking that a concept-definition is defined at namespace scope.

gcc/cp/ChangeLog:

	PR c++/97536
	* decl.c (grokvardecl): Given an error when a concept is not defined
	at namespace scope.

gcc/testsuite/ChangeLog:

	PR c++/97536
	* g++.dg/concepts/diagnostic16.C: New test.
2021-04-19 16:35:00 -04:00
Andrew MacLeod
329d2f0df7 tree-optimization/100081 - Limit depth of logical expression windback.
Limit how many logical expressions GORI will look back through when
evaluating outgoing edge range.

	PR tree-optimization/100081
	* gimple-range-cache.h (ranger_cache): Inherit from gori_compute
	rather than gori_compute_cache.
	* gimple-range-gori.cc (is_gimple_logical_p): Move to top of file.
	(range_def_chain::m_logical_depth): New member.
	(range_def_chain::range_def_chain): Initialize m_logical_depth.
	(range_def_chain::get_def_chain): Don't build defchains through more
	than LOGICAL_LIMIT logical expressions.
	* params.opt (param_ranger_logical_depth): New.
2021-04-19 15:49:04 -04:00
Iain Buclaw
dc7d1c74ff d: Fix ICE in when formating a string with '%' or '`' characters (PR98457)
The percentage character was being confused for a format specifier in
pp_format(), whilst the backtick character was confused for the
beginning of a quoted string in expand_d_format().

Both are now properly escaped to avoid the ICE.

gcc/d/ChangeLog:

	PR d/98457
	* d-diagnostic.cc (expand_d_format): Handle escaped backticks.
	(escape_d_format): New funtion.
	(verror): Call escape_d_format on prefixing strings.
	(vdeprecation): Likewise.

gcc/testsuite/ChangeLog:

	PR d/98457
	* gdc.dg/pr98457.d: New test.
2021-04-19 19:28:09 +02:00
Iain Buclaw
e19c638996 libphobos: Merge upstream druntime 89f870b7, phobos e6907ff3e
Phobos changes:

 - Synchronize C bindings with the latest port fixes in upstream
   druntime.

 - Add Config.stderrPassThrough to std.process (PR98494).

Reviewed-on: https://github.com/dlang/druntime/pull/3448
	     https://github.com/dlang/phobos/pull/7984

libphobos/ChangeLog:

	PR d/98494
	* libdruntime/MERGE: Merge upstream druntime 89f870b7.
	* src/MERGE: Merge upstream phobos e6907ff3e.
2021-04-19 19:27:41 +02:00
Iain Buclaw
6eae7549b8 libphobos: Add Thread/Fiber support code for Darwin (PR98058)
libphobos/ChangeLog:

	PR d/98058
	* configure: Regenerate.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add
	core/sys/darwin/config.d
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/config/powerpc/switchcontext.S: Implement
	fiber_switchContext for __MACH__.
	* libdruntime/config/x86/switchcontext.S: Likewise.
	* libdruntime/core/sys/darwin/config.d: New file.
	* libdruntime/core/thread/fiber.d (Fiber.getThis): Mark noinline.
	(UnsafeFiberMigration): Define for OSX/X86 and OSX/X86_64.
	* libdruntime/core/thread/osthread.d (callWithStackShell): Add inline
	assembler implementation for X86, X86_64, PPC, and PPC64.
	* libdruntime/core/thread/threadbase.d (ThreadBase.getThis): Mark
	noinline.
	* libdruntime/gcc/deh.d (FuncTable): Remove definition.
	* m4/druntime/os.m4 (DRUNTIME_OS_MINFO_BRACKETING): Check for right
	bracket symbol on darwin* targets.
	* testsuite/libphobos.thread/fiber_guard_page.d: Update test to
	support ucontext-based Fibers.
2021-04-19 19:27:27 +02:00
Iain Buclaw
b66e72b43e libphobos: Add D runtime support code for MinGW (PR99794)
libphobos/ChangeLog:

	PR d/99794
	* libdruntime/Makefile.am (DRUNTIME_SOURCES_CONFIGURED): Add
	config/mingw/msvc.c on DRUNTIME_OS_MINGW.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/config/mingw/msvc.c: New file.
	* libdruntime/config/mingw/switchcontext.S (fiber_switchContext): Fix
	function definition.
	* libdruntime/gcc/deh.d (__gdc_personality_seh0): Fix call to
	_GCC_specific_handler.
	* libdruntime/gcc/gthread.d (__gthread_once_t): Fix definition.
	* libdruntime/gcc/unwind/generic.d (_GCC_specific_handler): Fix
	declaration.
	* libdruntime/rt/dmain2.d (rt_loadLibrary): Remove function.
	(rt_loadLibraryW): Remove function.
	(initLibrary): Remove function.
	(rt_unloadLibrary): Remove function.
2021-04-19 19:27:13 +02:00
Iain Buclaw
d86e60855f libphobos: Add section support code for OpenBSD (PR99691)
libphobos/ChangeLog:

	PR d/99691
	* configure: Regenerate.
	* libdruntime/config/common/threadasm.S: Add __OpenBSD__.
	* libdruntime/gcc/backtrace.d: Import core.sys.openbsd.dlfcn on
	OpenBSD platforms.
	* libdruntime/gcc/sections/elf.d (SharedElf): Define on OpenBSD.
	(linkMapForHandle): Implement for OpenBSD.
	(exeLinkMap): Remove.
	(getDependencies): Adjust dlpi_addr on OpenBSD.
	(handleForName): Implement for OpenBSD.
	(IterateManually): Define on OpenBSD.
	* libdruntime/gcc/sections/package.d (SectionsElf): Define on OpenBSD.
	* m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_ATOMIC): Test for
	enable_libatomic.
	(DRUNTIME_LIBRARIES_BACKTRACE): Test for enable_libbacktrace.
2021-04-19 19:26:43 +02:00
Richard Earnshaw
3bffc4b37e arm: partial revert of r11-8168 [PR100067]
This is a partial revert of r11-8168.  The overall purpose of the
commit is retained (to fix a bogus warning when -mfpu=<not-auto> is
used in combination with eg -mcpu=neoverse-v1), but it removes the
hunk that changed the subsequent feature bits for features of a
simd/fp unit that cannot be described by -mfpu.  While I still think
that is the correct direction of travel, it's somewhat disruptive and
not appropriate for late stage4.  I'll revisit for gcc-12.

gcc:
	PR target/100067
	* config/arm/arm.c (arm_configure_build_target): Do not strip
	extended FPU/SIMD feature bits from the target ISA when -mfpu
	is specified (partial revert of r11-8168).
2021-04-19 16:56:31 +01:00
Christophe Lyon
714bdc31b6 aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]
The testcase is endianness dependent and works only on little-endian.

2021-04-19  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/100075
	gcc/testsuite/
	* gcc.target/aarch64/pr100075.c: Add aarch64_little_endian
	effective target.
2021-04-19 13:27:18 +00:00