Currently omp_get_device_num does not work on gcn targets with more than one
offload device. The reason is that GOMP_DEVICE_NUM_VAR is static in
icv-device.c and thus "__gomp_device_num" is not visible in the offload image.
This patch removes "static" such that "__gomp_device_num" is now part of the
offload image and can now be found in GOMP_OFFLOAD_load_image in the plugin.
This is not an issue for nvptx. There, "__gomp_device_num" is in the offload
image even with "static".
libgomp/ChangeLog:
* config/gcn/icv-device.c: Make GOMP_DEVICE_NUM_VAR public (remove
"static") to make the device num available in the offload image.
Use SFINAE magic to support: "It is unspecified whether math_errhandling
is a macro or an identifier with external linkage." [C Standard]
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd.h (__floating_point_flags): Do
not rely on math_errhandling to expand to a constant expression.
Since the x86_64-linux-gnux32 compiler is actually an x32 compiler, set
target_cpu to x32 for x86_64-linux-gnux32.
PR ada/103538
* gcc-interface/Makefile.in (target_cpu): Set to x32 for
x86_64-linux-gnux32.
The tests are C++ code, so use a proper file extension.
gcc/testsuite/ChangeLog:
* g++.dg/ext/boolcomplex-1.c: Moved to...
* g++.dg/ext/boolcomplex-1.C: ...here.
* g++.dg/opt/pr47639.c: Moved to...
* g++.dg/opt/pr47639.C: ...here.
* g++.dg/pr83979.c: Moved to...
* g++.dg/pr83979.C: ...here.
* g++.dg/tm/asm-1.c: Moved to...
* g++.dg/tm/asm-1.C: ...here.
* g++.dg/vect/pr71483.c: Moved to...
* g++.dg/vect/pr71483.cc: ...here.
> On 18/01/2022 22:42, Segher Boessenkool wrote:
> > > + default:
> > > + break;
> > Please don't do that. You can do
> >
> > default:
> > break;
> > break;
> > /* And just to make sure: */
> > break;
> > break;
> >
> > and it will do exactly the same as not having a default at all. Not
> > having such useless code is by far the most readable, so please don't
> > include a default case at all.
>
> I removed the default case. I hope this is what you wanted.
Unfortunately the removal of default: break; breaks bootstrap:
../../gcc/config/rs6000/rs6000.cc: In function ‘const char* rs6000_machine_from_flags()’:
../../gcc/config/rs6000/rs6000.cc:5940:10: error: enumeration value ‘PROCESSOR_PPC601’ not handled in switch [-Werror=switch]
5940 | switch (rs6000_cpu)
| ^
../../gcc/config/rs6000/rs6000.cc:5940:10: error: enumeration value ‘PROCESSOR_PPC603’ not handled in switch [-Werror=switch]
...
default: break; is needed to tell the -Wswitch warning that it is intentional
that not all enumerators are handled in the switch.
2022-01-19 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Add default:.
As reported in the PR or as I've seen since the weekend, asan_test.C fails
because of many warnings like:
gcc/testsuite/g++.dg/asan/asan_test.cc:1157:10: error: using a dangling pointer to an unnamed temporary [-Werror=dangling-pointer=]
gcc/testsuite/g++.dg/asan/asan_test.cc:1157:10: error: using a dangling pointer to an unnamed temporary [-Werror=dangling-pointer=]
gcc/testsuite/g++.dg/asan/asan_test.cc:1162:27: error: using a dangling pointer to an unnamed temporary [-Werror=dangling-pointer=]
...
(lots of them).
There are no dangling pointers though, the warning pass sees:
some_automatic_var ={v} {CLOBBER};
.ASAN_MARK (POISON, &some_automatic_var, 8);
and warns on that (both on user vars and on e.g. TARGET_EXPR temporaries).
There is nothing wrong on that, .ASAN_MARK is compiler instrumentation,
which doesn't even touch the variable in any way nor make it escaped.
What it instead does is change bytes in the shadow memory corresponding
to the variable to reflect that the variable is out of scope and make
sure that access to it would be diagnosed at runtime.
So, for all purposes of the -Wdangling-pointer and -Wuse-after-free
warnings, we should ignore this internal call.
2022-01-19 Jakub Jelinek <jakub@redhat.com>
PR middle-end/104103
* gimple-ssa-warn-access.cc (pass_waccess::check_call): Don't check
.ASAN_MARK calls.
This is a non-C++ related part from the PR89074 address_compare changes.
For "foo" == "foo" we already optimize this from the (cmp @0 @0)
simplification, because we use operand_equal_p in that case
and operand_equal_p also compares the STRING_CSTs bytes rather than
just addresses.
2022-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/89074
* fold-const.cc (address_compare): Consider different STRING_CSTs
with the same lengths that memcmp the same as equal, not different.
* gcc.dg/tree-ssa/pr89074.c: New test.
grep '{[^|}]*}"' *.md
found another spot, though dunno if we have sufficient effective targets
etc. to add an -masm=intel test for it (and my installed binutils doesn't
support it anyway).
Binutils trunk testsuite shows the argument isn't omitted even in the Intel
syntax:
grep aesencwide *.s
keylocker.s: aesencwide128kl 126(%edx)
keylocker.s: aesencwide256kl 126(%edx)
keylocker.s: aesencwide128kl [edx+126]
keylocker.s: aesencwide256kl [edx+126]
property-10.s: aesencwide128kl (%eax)
x86-64-keylocker.s: aesencwide128kl 126(%rdx)
x86-64-keylocker.s: aesencwide256kl 126(%rdx)
x86-64-keylocker.s: aesencwide128kl [rdx+126]
x86-64-keylocker.s: aesencwide256kl [rdx+126]
and doesn't use any WHATEVER PTR.
2022-01-19 Jakub Jelinek <jakub@redhat.com>
* config/i386/sse.md (*aes<aeswideklvariant>u*): Use %0 instead of
{%0}.
The desired transform requires V2SI vector add support, the closest
we have is vect64 so check that which at least fixes the i?86 fail.
2022-01-19 Richard Biener <rguenther@suse.de>
PR testsuite/102833
* gcc.dg/vect/bb-slp-17.c: Require vect64.
For some CPUs, the assembler machine directive cannot be determined by ISA
flags.
gcc/
PR target/104090
* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Use also
rs6000_cpu.
Currently all tsvc tests fail to build on DragonFly BSD because they
assume <malloc.h> and memalign() are available.
gcc/testsuite/ChangeLog:
PR testsuite/104021
* gcc.dg/vect/tsvc/tsvc.h: Do not include malloc.h on dragonfly
and use posix_memalign ().
Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
On DragonFly BSD profiling ends before these DTORs are invoked on dso cleanup.
The -static compilation works as expected.
gcc/testsuite/ChangeLog:
PR testsuite/104022
* g++.dg/gcov/pr16855.C: xfail the count lines for DTORs on dragonfly.
* g++.dg/gcov/pr16855-priority.C: Ditto. Adjust source layout so that
dejagnu xfail expressions work.
Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
As Richard pointed out in PR104015, the test case slp-perm-9.c
can be fragile when vectorizer tries to use different
vectorisation strategies.
As suggested, this patch tries to make the check not sensitive
on the re-trying times by removing the times checking. To still
retain the test coverage on unnecessary re-trying, for example
it exposes this PR104015 on Power9, I added two test cases to
powerpc testsuite.
gcc/testsuite/ChangeLog:
PR tree-optimization/104015
* gcc.dg/vect/slp-perm-9.c: Adjust.
* gcc.target/powerpc/pr104015-1.c: New test.
* gcc.target/powerpc/pr104015-2.c: New test.
Somehow I pushed my earlier patch without it actually fixing the test; we
need input_location to be for the last consumed token, not the next one.
gcc/cp/ChangeLog:
* parser.cc (saved_token_sentinel::rollback): Use
cp_lexer_previous_token.
> > On Sat, Jan 15, 2022 at 5:39 PM Hongyu Wang <wwwhhhyyy333@gmail.com> wrote:
> > > Thanks for the suggestion, here is the updated patch that survived
> > > bootstrap/regtest.
Unfortunately the patch results in assembler failures with -masm=intel.
> > > > + if (TARGET_DEST_FALSE_DEPENDENCY
> > > > + && get_attr_dest_false_dep (insn) ==
> > > > + DEST_FALSE_DEP_TRUE)
> > > > + output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands);
All the vxorps insns were emitted like the above, which means for -masm=sysv
it looks like
vxorps %xmm3, %xmm3, %xmm3
but for -masm=intel like:
vxorps
We want obviously
vxorps xmm3, xmm3, xmm3
so the following patch just drops the errorneous {}s.
2022-01-19 Jakub Jelinek <jakub@redhat.com>
PR target/104104
* config/i386/sse.md
(<avx512>_<complexopname>_<mode><maskc_name><round_name>,
avx512fp16_<complexopname>sh_v8hf<mask_scalarc_name><round_scalarcz_name>,
avx512dq_mul<mode>3<mask_name>, <avx2_avx512>_permvar<mode><mask_name>,
avx2_perm<mode>_1<mask_name>, avx512f_perm<mode>_1<mask_name>,
avx512dq_rangep<mode><mask_name><round_saeonly_name>,
avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>,
<avx512>_getmant<mode><mask_name><round_saeonly_name>,
avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>):
Use vxorps\t%x0, %x0, %x0 instead of vxorps\t{%x0, %x0, %x0}.
* gcc.target/i386/pr104104.c: New test.
This was deprecated in C++17, not C++14.
libstdc++-v3/ChangeLog:
* include/bits/stl_tempbuf.h (get_temporary_buffer): Change
_GLIBCXX14_DEPRECATED to _GLIBCXX17_DEPRECATED.
This function is no longer used since r12-6691 and can be removed.
libstdc++-v3/ChangeLog:
* include/bits/stl_pair.h (_PCC::_DeprConsPair): Remove unused
function.
This fixes an on AIX.
The lock function currently just spins, which should be changed to use
back-off, and maybe then _M_val.wait(__current) when supported.
libstdc++-v3/ChangeLog:
PR libstdc++/104101
* include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count::lock):
Only use __thread_relax if __cpp_lib_atomic_wait is defined.
It was pointed out to me by Jakub, that the comment in front of
the new code which handles warning/error attribute was not really
understandable. This fixes the comment to be understandable; I
don't know why I wrote the original comment that way even.
Committed as obvious after a quick build.
gcc/ChangeLog:
* ipa-split.cc (visit_bb): Fix comment before the
warning/error attribute checking code.
The following testcase is miscompiled. We see the constructor is immediate,
in build_over_call we trigger:
if (obj_arg && is_dummy_object (obj_arg))
{
call = build_cplus_new (DECL_CONTEXT (fndecl), call, complain);
obj_arg = NULL_TREE;
}
which makes call a TARGET_EXPR with the dtor in TARGET_EXPR_CLEANUP,
but then call cxx_constant_value on it. In cxx_eval_outermost_constant_expr
it triggers the:
else if (TREE_CODE (t) != CONSTRUCTOR)
{
r = get_target_expr_sfinae (r, tf_warning_or_error | tf_no_cleanup);
TREE_CONSTANT (r) = true;
}
which wraps the CONSTRUCTOR r into a new TARGET_EXPR, but one without
dtors (I think we need e.g. the TREE_CONSTANT for the callers),
and finally build_over_call uses that.
The following patch fixes that by using get_target_expr instead
of get_target_expr_sfinae + TREE_CONSTANT (r) = true if t is
a TARGET_EXPR with non-NULL TARGET_EXPR_CLEANUP.
2022-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/104055
* constexpr.cc (cxx_eval_outermost_constant_expr): If t is a
TARGET_EXPR with TARGET_EXPR_CLEANUP, use get_target_expr rather
than get_target_expr_sfinae with tf_no_cleanup, and don't set
TREE_CONSTANT.
* g++.dg/cpp2a/consteval27.C: New test.
Debug information was getting confused because input_location was different
depending on whether we had looked ahead to see if the next tokens look like
a template argument list.
I tried resetting input_location in cp_lexer_rollback_tokens itself, but
that caused regressions, so let's just do it here for now.
PR c++/104025
gcc/cp/ChangeLog:
* parser.cc (saved_token_sentinel::rollback): Call
cp_lexer_set_source_position.
(~saved_token_sentinel): Call rollback.
gcc/testsuite/ChangeLog:
* g++.dg/warn/pr104025.C: New test.
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
BPF CO-RE relocations contain offsets to strings buffered in the BTF
string table. These BTF-specific strings are stored in memory in the
CTF auxilliary strtab, which at output time is concatenated onto the end
of the standard strtab.
Previously, these string offsets were computed at the time the
relocations were created. But strings could be added to the standard
strtab after this point, causing the offsets to no longer be correct.
Compute the offsets just before output instead, when they are sure to no
longer change.
gcc/ChangeLog:
* config/bpf/coreout.cc (bpf_core_reloc_add): Do not account
for base strtab offset yet as it may change.
(output_asm_btfext_core_reloc): Do so here instead.
(output_btfext_core_sections): Likewise.
The CO-RE relocation record size should be written only once in the
.BTF.ext section, not once for each section with relocations.
gcc/ChangeLog:
* config/bpf/coreout.cc (output_btfext_header): Account for
4-byte record size in core_relo_len.
(output_btfext_core_sections): Only write record size once.
* config/bpf/coreout.h (btf_ext_section_header): Delete unused
member.
gcc/testsuite/ChangeLog:
* gcc.target/bpf/core-section-1.c: Adjust expected record size
occurrences.
gcc/analyzer/ChangeLog:
PR analyzer/104089
* region-model-manager.cc
(region_model_manager::get_or_create_constant_svalue): Assert that
we have a CONSTANT_CLASS_P.
(region_model_manager::maybe_fold_unaryop): Only fold a constant
when fold_unary's result is a constant or a cast of a constant.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/pr104089.c: New test.
PR analyzer/104089
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/ChangeLog:
PR analyzer/104062
* region-model-manager.cc
(region_model_manager::maybe_fold_sub_svalue): Avoid casting to
NULL type when folding access to repeated svalue.
gcc/testsuite/ChangeLog:
PR analyzer/104062
* gcc.dg/analyzer/pr104062.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
The new deleted constructors added by P2166R1 are a breaking change,
making previously valid code ill-formed in C++23. As a result, they
should only be defined for C++23 and not for C++11 and up.
libstdc++-v3/ChangeLog:
PR libstdc++/104099
* include/bits/basic_string.h (basic_string(nullptr_t)): Only
define for C++23.
(operator=(nullptr_t)): Likewise.
* include/bits/cow_string.h: Likewise.
* include/std/string_view (basic_string_view(nullptr_t)):
Likewise.
* testsuite/21_strings/basic_string/cons/char/nullptr.cc: Adjust
expected error. Add examples that become ill-formed in C++23.
* testsuite/21_strings/basic_string_view/cons/char/nonnull.cc:
Adjust expected errors.
* testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc:
Likewise.
We're incorrectly rejecting the below testcase during template argument
coercion because invalid_nontype_parm_type_p returns true for
DEPENDENT_OPERATOR_TYPE in C++17 mode.
This patch fixes this by partially rewriting invalid_nontype_parm_type_p
in terms of WILDCARD_TYPE_P, for which DEPENDENT_OPERATOR_TYPE is true,
so that the predicate handles wildcard types consistently.
PR c++/104074
gcc/cp/ChangeLog:
* pt.cc (invalid_nontype_parm_type_p): Use WILDCARD_TYPE_P so
that we return false for DEPENDENT_OPERATOR_TYPE too.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/nontype-auto20.C: New test.
Avoid undefined arithmetic involving a pointer to a heap allocation that
has been freed and move a problematic calculation ahead of the following
call to `free' in `riscv_subset_list::parse_multiletter_ext', removing a
compilation error:
.../gcc/common/config/riscv/riscv-common.cc: In member function 'const char* riscv_subset_list::parse_multiletter_ext(const char*, const char*, const char*)':
.../gcc/common/config/riscv/riscv-common.cc:905:27: error: pointer 'subset' used after 'void free(void*)' [-Werror=use-after-free]
905 | p += end_of_version - subset;
| ~~~~~~~~~~~~~~~^~~~~~~~
.../gcc/common/config/riscv/riscv-common.cc:904:12: note: call to 'void free(void*)' here
904 | free (subset);
| ~~~~~^~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:2428: riscv-common.o] Error 1
and a build regression from commit 671a283636 ("Add -Wuse-after-free
[PR80532].").
gcc/
* common/config/riscv/riscv-common.cc
(riscv_subset_list::parse_multiletter_ext): Move pointer
arithmetic ahead of `free'.
For this testcase, the cleanup that is supposed to happen if initialization
throws was wrongly being run on the normal control path as well. This turns
out to be because the EH-only handling in gimple_push_cleanup didn't apply
to conditional cleanups such as we have for nothrow new, since we check
whether the result is non-null before proceeding with the initialization.
PR c++/104007
gcc/ChangeLog:
* gimplify.cc (gimple_push_cleanup): Handle eh_only in conditional
context.
gcc/testsuite/ChangeLog:
* g++.dg/eh/new2.C: New test.
stack_limit_rtx was being initialized before init_reg_modes_target (),
resulting in the REG expression being created incorrectly and an ICE
later in compilation.
2022-01-18 Sandra Loosemore <sandra@codesourcery.com>
PR middle-end/103163
gcc/
* emit-rtl.cc (init_emit_regs): Initialize stack_limit_rtx here...
(init_emit_once): ...not here.
We should not assume that std::iter_value_t etc. are defined
unconditionally for C++20 mode.
libstdc++-v3/ChangeLog:
PR libstdc++/104098
* include/bits/stl_iterator.h (reverse_iterator): Check
__cpp_lib_concepts instead of __cplusplus.
The deprecated non-standard std::pair constructors that allow
constructing std::pair<move-only-type, pointer-type> from an rvalue and
a literal zero where not sufficiently constrained. They were viable when
constructing std::pair<copyable-type, pointer-type>, and that case
should work fine using the standard constructors.
Replace the constraints on the non-standard constructors so they are
only viable in cases that should actually be ill-formed according to the
standard.
Also rename __null_ptr_constant to __zero_as_null_pointer_constant so it
matches the name of the -Wzero-as-null-pointer-constant warning. Also
make the text of the deprecated warning describe the problem in more
detail.
libstdc++-v3/ChangeLog:
PR libstdc++/101124
* include/bits/stl_pair.h (pair): Adjust constraints on
deprecated constructors accepting literal zero as null pointer
constant. Improve wording of deprecated attribute.
* testsuite/20_util/pair/cons/99957.cc: Check that deprecated
constructors do not cause ambiguities for copyable types.
This patch completes implementation of the C++20 proposal P0482R6 [1] by
adding declarations of std::c8rtomb() and std::mbrtoc8() in <cuchar> if
provided by the C library in <uchar.h>.
This patch addresses feedback provided in response to a previous patch
submission [2].
Autoconf changes determine if the C library declares c8rtomb and mbrtoc8
at global scope when uchar.h is included and compiled with either
-fchar8_t or -std=c++20. New _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T
and _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20 configuration macros
reflect the probe results. The <cuchar> header declares these functions
in the std namespace only if available and the _GLIBCXX_USE_CHAR8_T
configuration macro is defined (by default it is defined if the C++20
__cpp_char8_t feature test macro is defined)
Patches to glibc to implement c8rtomb and mbrtoc8 have been submitted [3].
New tests validate the presence of these declarations. The tests pass
trivially if the C library does not provide these functions. Otherwise
they ensure that the functions are declared when <cuchar> is included
and either -fchar8_t or -std=c++20 is enabled.
1]: WG21 P0482R6
"char8_t: A type for UTF-8 characters and strings (Revision 6)"
https://wg21.link/p0482r6
[2]: [PATCH] C++ P0482R6 char8_t: declare std::c8rtomb and std::mbrtoc8
if provided by the C library
https://gcc.gnu.org/pipermail/libstdc++/2021-June/052685.html
[3]: "C++20 P0482R6 and C2X N2653"
[Patch 0/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135061.html
[Patch 1/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135062.html
[Patch 2/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135063.html
[Patch 3/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135064.html
libstdc++-v3/ChangeLog:
* acinclude.m4: Define config macros if uchar.h provides
c8rtomb() and mbrtoc8().
* config.h.in: Regenerate.
* configure: Regenerate.
* include/c_compatibility/uchar.h (c8rtomb, mbrtoc8): Define.
* include/c_global/cuchar (c8rtomb, mbrtoc8): Likewise.
* include/c_std/cuchar (c8rtomb, mbrtoc8): Likewise.
* testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc:
New test.
* testsuite/21_strings/headers/cuchar/functions_std_fchar8_t.cc:
New test.
This adds the C++23 <stdatomic.h> header, as proposed by P0943R6, for
compatibility with C code.
There are still some ABI differences between atomic_xxx in C and C++
std::atomic_xxx in C++, so this only provides source compatibility, not
binary compatibility.
libstdc++-v3/ChangeLog:
* include/Makefile.am: Install new header.
* include/Makefile.in: Regenerate.
* include/c_compatibility/stdatomic.h: New file.
* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: New test.