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.
2021-04-22 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/100119
* config/i386/i386-expand.c (ix86_expand_convert_uns_sidf_sse):
Remove the sign with FE_DOWNWARD, where x - x = -0.0.
gcc/testsuite/
PR target/100119
* gcc.target/i386/pr100119.c: New test.
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.
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.
The new test fails with -mabi=ilp32:
sorry, unimplemented: return address signing is only supported for '-mabi=lp64'
2021-04-22 Christophe Lyon <christophe.lyon@linaro.org>
gcc/testsuite/
PR target/99988
* gcc.target/aarch64/pr99988.c: Skip if not lp64 target.
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.
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.
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.
I was looking at Fortran PR 96983, which fails on the PowerPC when trying to
run the test PR96711.F90. The compiler ICEs because the PowerPC does not have
a floating point type with a type precision of 128. The reason is that the
PowerPC has 3 different 128 bit floating point types (__float128/_Float128,
__ibm128, and long double). Currently long double uses the IBM extended double
type, but we would like to switch to using IEEE 128-bit long doubles in the
future.
In order to prevent the compiler from converting explicit __ibm128 types to
long double when long double uses the IEEE 128-bit representation, we have set
up the precision for __ibm128 to be 128, long double to be 127, and
__float128/_Float128 to be 126.
Originally, I was trying to see if for Fortran, I could change the precision of
long double to be 128 (Fortran doesn't access __ibm128), but it quickly became
hard to get the changes to work.
I looked at the Fortran code in build_round_expr, and I came to the conclusion
that there is no reason to promote the floating point type. If you just do a
normal round of the value using the current floating point format and then
convert it to the integer type. We don't have an appropriate built-in function
that provides the equivalent of llround for 128-bit integer types.
This patch fixes the compiler crash.
However, while with this patch, the PowerPC compiler will not crash when
building the test case, it will not run on the current default installation.
The failure is because the test is explicitly expecting 128-bit floating point
to handle 10384593717069655257060992658440192_16 (i.e. 2**113).
By default, the PowerPC uses IBM extended double used for 128-bit floating
point. The IBM extended double format is a pair of doubles that provides more
mantissa bits but does not grow the expoenent range. The value in the test is
fine for IEEE 128-bit floating point, but it is too large for the PowerPC
extended double setup.
I have built the following tests with this patch:
* I have built a bootstrap compiler on a little endian power9 Linux system
with the default long double format (IBM extended double). The
pr96711.f90 test builds, but it does not run due to the range of the
real*16 exponent. There were no other regressions in the C/C++/Fortran
tests.
* I have built a bootstrap compiler on a little endian power9 Linux system
with the default long double format set to IEEE 128-bit. I used the
Advance Toolchain 14.0-2 to provide the IEEE 128-bits. The compiler was
configured to build power9 code by default, so the test generated native
power9 IEEE 128-bit instructions. The pr96711.f90 test builds and runs
correctly in this setup.
* I have built a bootstrap compiler on a big endian power8 Linux system with
the default long double format (IBM extended double). Like the first
case, the pr96711.f90 test does not crash the compiler, but the test fails
due to the range of the real*16 exponent. There were no other
regressions in the C/C++/Fortran tests.
* I built a bootstrap compiler on my x86_64 laptop. There were no
regressions in the tests.
gcc/fortran/
2021-04-21 Michael Meissner <meissner@linux.ibm.com>
PR fortran/96983
* trans-intrinsic.c (build_round_expr): If int type is larger than
long long, do the round and convert to the integer type. Do not
try to find a floating point type the exact size of the integer
type.
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.
The changes from r12-36-g1751bec027f030515889fcf4baa9c91501aafc85
did not remove the uses of TARGET_ISA_* from i386/darwin.h.
Fixed thus.
gcc/ChangeLog:
* config/i386/darwin.h (TARGET_64BIT): Remove definition
based on TARGET_ISA_64BIT.
(TARGET_64BIT_P): Remove definition based on
TARGET_ISA_64BIT_P().
For the tests modified below, the effective target line has to be effective
when compiling for an offload target, except that variable-not-offloaded.c
would compile with unified-share memory and pr86416-*.c if long double/float128
is supported.
The previous check used a run-time device ability check. This new variant
now enables those dg- lines when _compiling_ for nvptx or gcn.
libgomp/ChangeLog:
* testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
New, based on check_effective_target_offload_target_nvptx.
(check_effective_target_offload_target_nvptx): Call it.
(check_effective_target_offload_target_amdgcn): New.
* testsuite/libgomp.c-c++-common/function-not-offloaded.c:
Require target offload_target_nvptx || offload_target_amdgcn.
* testsuite/libgomp.c-c++-common/variable-not-offloaded.c: Likewise.
* testsuite/libgomp.c/pr86416-1.c: Likewise.
* testsuite/libgomp.c/pr86416-2.c: Likewise.
In order for GDB to auto-load the pretty printers, they must be installed
as "libstdc++.$ext-gdb.py", where 'libstdc++.$ext' is the name of the
object file that is loaded by GDB [1], i.e. the libstdc++ shared library.
The approach taken in libstdc++-v3/python/Makefile.am is to loop over
files matching 'libstdc++*' in $(DESTDIR)$(toolexeclibdir) and choose
the last file matching that glob that is not a symlink, the Libtool
'*.la' file or a Python file.
That works fine for ELF targets where the matching names are:
libstdc++.a
libstdc++.so
libstdc++.so.6
libstdc++.so.6.0.29
But not for macOS with:
libstdc++.6.dylib
libstdc++.a
Or MinGW with:
libstdc++-6.dll
libstdc++.dll.a
Try to make a better job at installing the pretty printers with the
correct name by copying the approach taken by isl [2], that is, using
a sed invocation on the Libtool-generated 'libstdc++.la' to read the
correct name for the current platform.
[1] https://sourceware.org/gdb/onlinedocs/gdb/objfile_002dgdbdotext-file.html
[2] https://repo.or.cz/isl.git/blob/HEAD:/Makefile.am#l611
libstdc++-v3/ChangeLog:
PR libstdc++/99453
* python/Makefile.am: Install libstdc++*-gdb.py more robustly.
* python/Makefile.in: Regenerate.
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
In r11-2064 I made cp_parser_enum_specifier commit to tentative parse
when seeing a '{'. That still looks like the correct thing to do, but
it caused an ICE-on-invalid as well as accepts-invalid.
When we have something sneaky like this, which is broken in multiple
ways:
template <class>
enum struct c : union enum struct c { e = b, f = a };
we parse the "enum struct c" part (that's OK) and then we see that
we have an enum-base, so we consume ':' and then parse the type-specifier
that follows the :. "union enum" is clearly invalid, but we're still
parsing tentatively and we parse everything up to the ;, and then
throw away the underlying type. We parsed everything because we were
tricked into parsing an enum-specifier in an enum-base of another
enum-specifier! Not good.
Since the grammar for enum-base doesn't allow a defining-type-specifier,
only a type-specifier, we should set type_definition_forbidden_message
which fixes all the problems in this PR.
gcc/cp/ChangeLog:
PR c++/96380
* parser.c (cp_parser_enum_specifier): Don't allow defining
types in enum-base.
gcc/testsuite/ChangeLog:
PR c++/96380
* g++.dg/cpp0x/enum_base4.C: New test.
* g++.dg/cpp0x/enum_base5.C: New test.
This fixes:
lto-plugin.c:642:7: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
lto-plugin/ChangeLog:
* lto-plugin.c (exec_lto_wrapper): Make a temp variable.
I was wondering why the (now fixed) c-c++-common/attr-retain-[78].c
failures were showing up in the native results for aarch64-linux-gnu
but not in the posted cross results. It turns out that .init/
.fini_array support is disabled by default for cross builds,
which in turn stops those tests from running.
The test for .init/fini_array support has two parts: one that builds
something with the assembler and linker, and another that compiles
C code and uses preprocessor macros to test the glibc version.
The first test would work with build=host but the second is only
safe for build=target.
However, AArch64 postdates glibc and binutils support for
.init/fini_array by some distance, so it's safe to hard-code the
result to "yes" for cross compilers.
This fixes the only material difference in auto-host.h between
a native and a cross build.
gcc/
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): When cross-compiling,
default to yes for aarch64-linux-gnu.
* configure: Regenerate.
gcc/ChangeLog:
* config/i386/i386.c: Remove superfluous || TARGET_MACHO
which remains to be '(... || 0)' and clang complains about it.
* dwarf2out.c (AT_vms_delta): Declare conditionally.
(add_AT_vms_delta): Likewise.
* tree.c (fld_simplified_type): Use rather more common pattern
for disabling of something (#if 0).
(get_tree_code_name): Likewise.
(verify_type_variant): Likewise.
This patch fixes PR99988 which shows us generating large (> 250)
sequences of back-to-back bti j instructions.
The fix is simply to avoid inserting bti j instructions at the target of
a jump table if we've already inserted one for a given label.
gcc/ChangeLog:
PR target/99988
* config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New.
(rest_of_insert_bti): Avoid inserting duplicate bti j insns for
jump table targets.
gcc/testsuite/ChangeLog:
PR target/99988
* gcc.target/aarch64/pr99988.c: New test.
Add -mmwait so that the MWAIT and MONITOR intrinsics can be used with
-mgeneral-regs-only and make -msse3 to imply -mmwait.
gcc/
* config.gcc: Install mwaitintrin.h for i[34567]86-*-* and
x86_64-*-* targets.
* common/config/i386/i386-common.c (OPTION_MASK_ISA2_MWAIT_SET):
New.
(OPTION_MASK_ISA2_MWAIT_UNSET): Likewise.
(ix86_handle_option): Handle -mmwait.
* config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins):
Replace OPTION_MASK_ISA_SSE3 with OPTION_MASK_ISA2_MWAIT on
__builtin_ia32_monitor and __builtin_ia32_mwait.
* config/i386/i386-options.c (isa2_opts): Add -mmwait.
(ix86_valid_target_attribute_inner_p): Likewise.
(ix86_option_override_internal): Enable mwait/monitor
instructions for -msse3.
* config/i386/i386.h (TARGET_MWAIT): New.
(TARGET_MWAIT_P): Likewise.
* config/i386/i386.opt: Add -mmwait.
* config/i386/mwaitintrin.h: New file.
* config/i386/pmmintrin.h: Include <mwaitintrin.h>.
* config/i386/sse.md (sse3_mwait): Replace TARGET_SSE3 with
TARGET_MWAIT.
(@sse3_monitor_<mode>): Likewise.
* config/i386/x86gprintrin.h: Include <mwaitintrin.h>.
* doc/extend.texi: Document mwait target attribute.
* doc/invoke.texi: Document -mmwait.
gcc/testsuite/
* gcc.target/i386/monitor-2.c: New test.
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.
The following testcase shows different behavior between -g and -g0
in constprop_register, if a flags register setter is separated
from a conditional jump using those flags with -g by a DEBUG_INSN.
As it uses just NEXT_INSN, for -g it will look at the DEBUG_INSN which is
not a conditional jump, while otherwise it would look at the conditional
jump and call cprop_jump.
2021-04-21 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/100148
* cprop.c (constprop_register): Use next_nondebug_insn instead of
NEXT_INSN.
* g++.dg/opt/pr100148.C: New test.
> > 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.
This simplifies the maybe_fold_reference API reflecting that it
no longer canonicalizes refs (that's done with another function)
but only performs constant folding and thus does nothing for is_lhs.
This in turn allows to rip out quite some dead code and one user
of valid_gimple_rhs_p.
2021-04-16 Richard Biener <rguenther@suse.de>
* gimple-fold.c (maybe_fold_reference): Remove is_lhs
parameter (and assume it to be false).
(fold_gimple_assign): Adjust, remove all callers of
maybe_fold_reference calling it with is_lhs true.
(gimple_fold_call): Likewise.
(fold_stmt_1): Likewise.
The test fails for targets with V4QImode support which is the case for
IBM Z.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/pr71264.c: Xfail on IBM Z due to V4QImode support.
This removes pedantic_non_lvalue_loc which doesn't do what it says
since quite some time in favor of what it actually does and where
that's not a duplicate (protected_set_expr_location_unshare).
2021-04-19 Richard Biener <rguenther@suse.de>
* fold-const.c (pedantic_non_lvalue_loc): Remove.
(fold_binary_loc): Adjust.
(fold_ternary_loc): Likewise.
switch_to_section warns if we try to output a retain decl in a
section without a retain flag, or if we try to output a non-retain
decl in a section with a retain flag. However, the warning only
applied if we were trying to “switch” to the current section.
This works if all decls that use a section are generated consecutively,
but not if there is an unrelated decl in between.
This patch makes the check unconditional, but suppresses the warning
if we're writing the section's named.decl (i.e. the decl from which
the section name and original flags were derived).
Also, the warning didn't fire for -fsection-anchors, for two reasons:
we allowed retain and non-retain decls to be put into the same block,
and we didn't pass a decl to switch_to_section.
Although these are arguably separate bugs, it isn't easy to fix them
independently without temporarily regressing -fsection-anchor targets.
gcc/
PR middle-end/100130
* varasm.c (get_block_for_decl): Make sure that any use of the
retain attribute matches the section's retain flag.
(switch_to_section): Check for retain mismatches even when
changing sections, but do not warn if the given decl is the
section's named.decl.
(output_object_block): Pass the first decl in the block (if any)
to switch_to_section.
gcc/testsuite/
PR middle-end/100130
* c-c++-common/attr-retain-10.c: New test.
* c-c++-common/attr-retain-11.c: Likewise.
On IBM Z the aliasing stores are realized through one element vector
instructions, if no cost model for vectorization is used which is the
default according to vect.exp. Fixed by changing the number of times
the pattern must be found in the dump.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/bb-slp-39.c: Change number of times the pattern
must match for target IBM Z only.
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.