We're going to use the fast_float library[1] in our (compiled-in)
floating-point std::from_chars implementation for faster and more
portable parsing of binary32/64 decimal strings.
The single file fast_float.h is an amalgamation of the entire library,
which can be (re)generated with the amalgamate.py script (from the
fast_float repository) via the command
python3 ./script/amalgamate.py --license=MIT \
> $GCC_SRC/libstdc++-v3/c++17/fast_float/fast_float.h
The code has a GPL-compatible license.
[1]: https://github.com/fastfloat/fast_float
libstdc++-v3/ChangeLog:
* src/c++17/fast_float/LOCAL_PATCHES: New file.
* src/c++17/fast_float/MERGE: New file.
* src/c++17/fast_float/README.md: New file, copied from the
fast_float repository.
* src/c++17/fast_float/fast_float.h: New file, an amalgamation
of the fast_float library.
Signed-off-by: Patrick Palka <ppalka@redhat.com>
libstdc++-v3/ChangeLog:
* src/c++17/floating_from_chars.cc: Include <bit>.
(ascii_to_hexit, starts_with_ci): Conditionally define.
(__floating_from_chars_hex): Conditionally define.
(from_chars): Use __floating_from_chars_hex for
chars_format::hex parsing of binary32/64 float/double.
(testsuite/20_util/from_chars/7.cc): New test.
With -ftrivial-auto-var-init, the address taken auto variable is replaced with
a temporary variable during gimplification, and the original auto variable might
be eliminated by compiler optimization completely. As a result, the current
uninitialized warning analysis cannot get enough information from the IR,
therefore the uninitialized warnings for address taken variable cannot be
issued based on the current implemenation of -ftrival-auto-var-init.
For more info please refer to:
https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577431.html
In order to improve this situation, we can improve uninitialized analysis
for address taken auto variables with -ftrivial-auto-var-init as following:
for the following stmt:
_1 = .DEFERRED_INIT (4, 2, &"alt_reloc"[0]);
if (_1 != 0)
The original variable DECL has been eliminated from the IR, all the necessary
information that is needed for reporting the warnings for DECL can be acquired
from the call to .DEFERRED_INIT.
A. the name string of DECL from the 3rd parameter of the call;
B. the location of the DECL from the location of the call;
C. the call can also be used to hold the information on whether the warning
has been issued or not to suppress warning messages when needed;
The current testing cases for uninitialized warnings + -ftrivial-auto-var-init
are adjusted to reflect the fact that we can issue warnings for address taken
variables.
gcc/ChangeLog:
2022-01-17 qing zhao <qing.zhao@oracle.com>
* tree-ssa-uninit.c (warn_uninit): Delete the 4th parameter. Handle
.DEFERRED_INIT call with an anonymous SSA_NAME specially.
(check_defs): Handle .DEFERRED_INIT call with an anonymous SSA_NAME
specially.
(warn_uninit_phi_uses): Delete the 4th actual when call warn_uninit.
(warn_uninitialized_vars): Likewise.
(warn_uninitialized_phi): Likewise.
gcc/testsuite/ChangeLog:
2022-01-17 qing zhao <qing.zhao@oracle.com>
* gcc.dg/auto-init-uninit-16.c (testfunc): Delete xfail to reflect
the fact that address taken variable can be warned.
* gcc.dg/auto-init-uninit-34.c (warn_scalar_1): Likewise.
(warn_scalar_2): Likewise.
* gcc.dg/auto-init-uninit-37.c (T1): Likewise.
(T2): Likewise.
* gcc.dg/auto-init-uninit-B.c (baz): Likewise.
The following patch is miscompiled, cp_genericize_target_expr expects
that for the constant part split_nonconstant_init will emit an INIT_EXPR
that will initialize it, but that doesn't happen and instead we get
DECL_INITIAL on the TARGET_EXPR_SLOT that isn't initialized anywhere
in the IL.
The problem is that the TARGET_EXPR has been created while
current_function_decl was NULL, it is inside a global var initializer.
That means the build_local_temp created VAR_DECL has NULL DECL_CONTEXT.
Later on when genericizing the ssdf (current_function_decl is already
non-NULL), the new cp_genericize_target_expr is called and during
split_nonconstant_init it checks is_local_temp, but that due to the NULL
DECL_CONTEXT returns false. DECL_CONTEXT is set only later on during
gimplification.
The following patch fixes it by setting DECL_CONTEXT also inside of
cp_genericize_target_expr, which fixes the testcase. But if there are
better spots to do that, please let me know...
2022-01-17 Jakub Jelinek <jakub@redhat.com>
PR c++/104031
* cp-gimplify.c (cp_genericize_target_expr): Set DECL_CONTEXT of
TARGET_EXPR_SLOT to current_function_decl if it was NULL.
* g++.dg/cpp1y/pr104031.C: New test.
When a sequence of diagnostic messages bounces back and forth repeatedly
between two includes, as with
#include <map>
std::map<const char*, const char*> m ("123", "456");
The output is quite a bit longer than necessary because we dump the include
path each time it changes. I'd think we could print the include path once
for each header file, and then expect that the user can look earlier in the
output if they're wondering.
gcc/ChangeLog:
* diagnostic.h (struct diagnostic_context): Add includes_seen.
* diagnostic.c (diagnostic_initialize): Initialize it.
(diagnostic_finish): Clean it up.
(includes_seen): New function.
(diagnostic_report_current_module): Use it.
gcc/testsuite/ChangeLog:
* c-c++-common/cpp/line-2.c: Only expect includes once.
* c-c++-common/cpp/line-3.c: Likewise.
There's no need to reject the dynamic_allocators requires directive because
we actually do support the feature, and it doesn't have to actually "do"
anything.
gcc/c/ChangeLog:
* c-parser.c (c_parser_omp_requires): Don't "sorry" dynamic_allocators.
gcc/cp/ChangeLog:
* parser.c (cp_parser_omp_requires): Don't "sorry" dynamic_allocators.
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_omp_requires): Don't "sorry" dynamic_allocators.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/requires-8.f90: Reinstate dynamic allocators
requirement.
The warning control falls into the C++ trap of using a reference
to old hashtable contents for a put operation which can end up
re-allocating that before reading from the old freed referenced to
source. Fixed by introducing a temporary.
2022-01-17 Richard Biener <rguenther@suse.de>
PR middle-end/101292
* diagnostic-spec.c (copy_warning): Make sure to not
reference old hashtable content on possible resize.
* warning-control.cc (copy_warning): Likewise.
As Thomas reported in
https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588448.html
a test added in my recent allocate clause patch fails on m32. It was due
to default kind for integer matching c_intptr_t for m32. I have now
changed it to 0_1 so that always integer with kind=1 is used.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/allocate-2.f90: Change 0 to 0_1.
C++20:
#include <compare>
auto cmp4way(double a, double b)
{
return a <=> b;
}
expands to:
ucomisd %xmm1, %xmm0
jp .L8
movl $0, %eax
jne .L8
.L2:
ret
.p2align 4,,10
.p2align 3
.L8:
comisd %xmm0, %xmm1
movl $-1, %eax
ja .L2
ucomisd %xmm1, %xmm0
setbe %al
addl $1, %eax
ret
That is 3 comparisons of the same operands.
The following patch improves it to just one comparison:
comisd %xmm1, %xmm0
jp .L4
seta %al
movl $0, %edx
leal -1(%rax,%rax), %eax
cmove %edx, %eax
ret
.L4:
movl $2, %eax
ret
While a <=> b expands to a == b ? 0 : a < b ? -1 : a > b ? 1 : 2
where the first comparison is equality and this shouldn't raise
exceptions on qNaN operands, if the operands aren't equal (which
includes unordered cases), then it immediately performs < or >
comparison and that raises exceptions even on qNaNs, so we can just
perform a single comparison that raises exceptions on qNaN.
As the 4 different cases are encoded as
ZF CF PF
1 1 1 a unordered b
0 0 0 a > b
0 1 0 a < b
1 0 0 a == b
we can emit optimal sequence of comparions, first jp
for the unordered case, then je for the == case and finally jb
for the < case.
The patch pattern recognizes spaceship-like comparisons during
widening_mul if the spaceship optab is implemented, and replaces
those comparisons with comparisons of .SPACESHIP ifn which returns
-1/0/1/2 based on the comparison. This seems to work well both for the
case of just returning the -1/0/1/2 (when we have just a common
successor with a PHI) or when the different cases are handled with
various other basic blocks. The testcases cover both of those cases,
the latter with different function calls in those.
2022-01-17 Jakub Jelinek <jakub@redhat.com>
PR target/103973
* tree-cfg.h (cond_only_block_p): Declare.
* tree-ssa-phiopt.c (cond_only_block_p): Move function to ...
* tree-cfg.c (cond_only_block_p): ... here. No longer static.
* optabs.def (spaceship_optab): New optab.
* internal-fn.def (SPACESHIP): New internal function.
* internal-fn.h (expand_SPACESHIP): Declare.
* internal-fn.c (expand_PHI): Formatting fix.
(expand_SPACESHIP): New function.
* tree-ssa-math-opts.c (optimize_spaceship): New function.
(math_opts_dom_walker::after_dom_children): Use it.
* config/i386/i386.md (spaceship<mode>3): New define_expand.
* config/i386/i386-protos.h (ix86_expand_fp_spaceship): Declare.
* config/i386/i386-expand.c (ix86_expand_fp_spaceship): New function.
* doc/md.texi (spaceship@var{m}3): Document.
* gcc.target/i386/pr103973-1.c: New test.
* gcc.target/i386/pr103973-2.c: New test.
* gcc.target/i386/pr103973-3.c: New test.
* gcc.target/i386/pr103973-4.c: New test.
* gcc.target/i386/pr103973-5.c: New test.
* gcc.target/i386/pr103973-6.c: New test.
* gcc.target/i386/pr103973-7.c: New test.
* gcc.target/i386/pr103973-8.c: New test.
* gcc.target/i386/pr103973-9.c: New test.
* gcc.target/i386/pr103973-10.c: New test.
* gcc.target/i386/pr103973-11.c: New test.
* gcc.target/i386/pr103973-12.c: New test.
* gcc.target/i386/pr103973-13.c: New test.
* gcc.target/i386/pr103973-14.c: New test.
* gcc.target/i386/pr103973-15.c: New test.
* gcc.target/i386/pr103973-16.c: New test.
* gcc.target/i386/pr103973-17.c: New test.
* gcc.target/i386/pr103973-18.c: New test.
* gcc.target/i386/pr103973-19.c: New test.
* gcc.target/i386/pr103973-20.c: New test.
* g++.target/i386/pr103973-1.C: New test.
* g++.target/i386/pr103973-2.C: New test.
* g++.target/i386/pr103973-3.C: New test.
* g++.target/i386/pr103973-4.C: New test.
* g++.target/i386/pr103973-5.C: New test.
* g++.target/i386/pr103973-6.C: New test.
* g++.target/i386/pr103973-7.C: New test.
* g++.target/i386/pr103973-8.C: New test.
* g++.target/i386/pr103973-9.C: New test.
* g++.target/i386/pr103973-10.C: New test.
* g++.target/i386/pr103973-11.C: New test.
* g++.target/i386/pr103973-12.C: New test.
* g++.target/i386/pr103973-13.C: New test.
* g++.target/i386/pr103973-14.C: New test.
* g++.target/i386/pr103973-15.C: New test.
* g++.target/i386/pr103973-16.C: New test.
* g++.target/i386/pr103973-17.C: New test.
* g++.target/i386/pr103973-18.C: New test.
* g++.target/i386/pr103973-19.C: New test.
* g++.target/i386/pr103973-20.C: New test.
Add the <stacktrace> header and a new libstdc++_libbacktrace.a library
that provides the implementation. For now, the new library is only built
if --enable-libstdcxx-backtrace=yes is used. As with the Filesystem TS,
the new library is only provided as a static archive.
libstdc++-v3/ChangeLog:
* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): New macro.
* configure.ac: Use GLIBCXX_ENABLE_BACKTRACE.
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/std/stacktrace: New header.
* include/std/version (__cpp_lib_stacktrace): Define.
* Makefile.in: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
* libsupc++/Makefile.in: Regenerate.
* po/Makefile.in: Regenerate.
* python/Makefile.in: Regenerate.
* src/Makefile.am: Regenerate.
* src/Makefile.in: Regenerate.
* src/c++11/Makefile.in: Regenerate.
* src/c++17/Makefile.in: Regenerate.
* src/c++20/Makefile.in: Regenerate.
* src/c++98/Makefile.in: Regenerate.
* src/filesystem/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* src/libbacktrace/Makefile.am: New file.
* src/libbacktrace/Makefile.in: New file.
* src/libbacktrace/backtrace-rename.h: New file.
* src/libbacktrace/backtrace-supported.h.in: New file.
* src/libbacktrace/config.h.in: New file.
* testsuite/lib/libstdc++.exp (check_effective_target_stacktrace):
New proc.
* testsuite/20_util/stacktrace/entry.cc: New test.
* testsuite/20_util/stacktrace/synopsis.cc: New test.
* testsuite/20_util/stacktrace/version.cc: New test.
These two files were introduced by mistake in
86e3b476d5
gcc/testsuite/ChangeLog:
* gfortran.dg/ieee/signaling_3.f90: Remove file.
libgfortran/ChangeLog:
* ieee/issignaling_fallback.h: Remove file.
Older glibc does not define math_errhandling with -ffast-math, in which
case floating-point exceptions are not used.
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd.h (__floating_point_flags): Do
not rely on the presence of the math_errhandling macro.
libgomp/
* testsuite/libgomp.oacc-fortran/privatized-ref-1.f95: New test.
* testsuite/libgomp.oacc-c++/privatized-ref-2.C: New test.
* testsuite/libgomp.oacc-c++/privatized-ref-3.C: New test.
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
With this patch, it is possible to specify multiple defaults inthe
GFORTRAN_CONVERT_UNIT environment variable so that, for example, R16_IEEE
and BIG_ENDIAN can be specified together.
libgfortran/ChangeLog:
* runtime/environ.c: Allow for multiple default values so that
separate default specifications for IBM long double format and
endianness are possible.
This patch is to clean up some codes with GET_MODE_UNIT_SIZE or
GET_MODE_NUNITS, which can use known constants or just be removed.
Note that Carl Love helped to confirm altivec_vreveti2 introduced
in r12-1341 is useless and can be removed.
gcc/ChangeLog:
* config/rs6000/altivec.md (altivec_vreveti2): Remove.
* config/rs6000/vsx.md (*vsx_extract_si, *vsx_extract_si_<uns>float_df,
*vsx_extract_si_<uns>float_<mode>, *vsx_insert_extract_v4sf_p9): Use
known constant values to simplify code.
This patch defines a new split pattern for TI to V1TI move. The pattern concatenates two subreg:DI of a TI to a V2DI. With the pattern, the subreg pass can do register split for TI when there is a TI to V1TI move.
gcc/
PR target/103124
* config/rs6000/vsx.md (split pattern for TI to V1TI move): Defined.
gcc/testsuite/
PR target/103124
* gcc.target/powerpc/pr103124.c: New testcase.
This adds another piece of C++20, the std::atomic specializations for
std::shared_ptr and std::weak_ptr.
The new _Sp_atomic type mimics the structure of shared_ptr<T> and
weak_ptr<T>, holding a T* pointer (the one returned by get() on a
shared_ptr/weak ptr) and a _Sp_counted_base<>* pointer to the
ref-counted control block. For _Sp_atomic the low bit of the control
block pointer is used as a lock bit, to ensure only one thread will
access the object at a time. The pointer is actually stored as a
uintptr_t to avoid accidental dereferences of the pointer when unlocked
(which would be a race) or when locked (which would dereference the
wrong pointer value due to the low bit being set). To get a raw pointer
to the control block, the lock must be acquired. Converting between a
_Sp_atomic and a shared_ptr or weak_ptr requires manually adjusting the
T* and _Sp_counted_base<>* members of the shared/weak ptr, instead of
going through the public API. This must be done carefully to ensure that
any change in the number of owners is reflected in a ref-count update.
Co-authored-by: Thomas Rodgers <trodgers@redhat.com>
Signed-off-by: Thomas Rodgers <trodgers@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_atomic.h (__cpp_lib_atomic_shared_ptr):
New macro.
(_Sp_atomic): New class template.
(atomic<shared_ptr<T>>, atomic<weak_ptr<T>>): New partial
specializations.
* include/bits/shared_ptr_base.h (__shared_count, __weak_count)
(__shared_ptr, __weak_ptr): Declare _Sp_atomic as a friend.
* include/std/version (__cpp_lib_atomic_shared_ptr): New macro.
* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc: New
test.
* testsuite/20_util/weak_ptr/atomic_weak_ptr.cc: New test.
The ABI for x87 and x86-32 is not suitable for passing around
signaling NaNs in the way IEEE expects. See for example discussion
in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57484
gcc/testsuite/ChangeLog:
* gfortran.dg/ieee/signaling_1.f90: xfail on x87.
* gfortran.dg/ieee/signaling_2.f90: xfail on x87.
I moved the library implementation of IEEE_VALUE in libgfortran from
Fortran to C code, which gives us access to GCC's built-ins for NaN generation
(both quiet and signalling). It will be perform better than the current
Fortran implementation.
libgfortran/ChangeLog:
PR fortran/82207
* mk-kinds-h.sh: Add values for TINY.
* ieee/ieee_arithmetic.F90: Call C helper functions for
IEEE_VALUE.
* ieee/ieee_helper.c: New functions ieee_value_helper_N for each
floating-point type.
gcc/testsuite/ChangeLog:
PR fortran/82207
* gfortran.dg/ieee/ieee_10.f90: Do not create signaling NaNs.
* gfortran.dg/ieee/signaling_2.f90: New test.
* gfortran.dg/ieee/signaling_2_c.c: New file.
The std::pointer_to_binary_function utility was deprecated in C++11 and
removed in C++17. Libstdc++ has started to warn about using it, so
suppress the warnings for this test.
gcc/testsuite/ChangeLog:
PR testsuite/104037
* g++.old-deja/g++.robertl/eb43.C: Ad -Wno-deprecated.
Backporting the fix for pr103789 on the 11 branch revealed a lack of test
coverage for the tests provided with that fix. Indeed, the tests use the KIND
argument of the respective intrinsics only with keyword arguments.
This adds variants with non-keyword arguments.
The tests enriched this way fail on the branch if the fix is cherry-picked
straightforwardly. The fix will have to be tweaked slightly there.
PR fortran/103789
PR fortran/87711
PR fortran/97896
gcc/testsuite/ChangeLog:
* gfortran.dg/index_5.f90: Enrich test with usages of INDEX with
a non-keyword KIND argument.
* gfortran.dg/len_trim.f90: Same for LEN_TRIM.
* gfortran.dg/maskl_1.f90: Same for MASKL.
* gfortran.dg/maskr_1.f90: Same for MASKR.
* gfortran.dg/scan_3.f90: Same for SCAN.
* gfortran.dg/verify_3.f90: Same for VERIFY.
libgomp/
* plugin/plugin-gcn.c (parse_target_attributes): Automatically set
the number of teams and threads if necessary.
(gcn_exec): Automatically set the number of gangs and workers if
necessary.
Co-Authored-By: Andrew Stubbs <ams@codesourcery.com>
When system headers expose a strict "open" prototype with
3 args, arrange to expose a C++ overload with only two.
2021-01-10 Olivier Hainque <hainque@adacore.com>
* inclhack.def (vxworks_math_h_fp_c99): New hack.
* tests/base/fcntl.h: Update.
* fixincl.x: Regenerate.
Make sure there is a visible prototype of sysClkRateGet() when
CLOCKS_PER_SEC is #defined to that in time.h for VxWorks. This
would typically be provided by sysLib.h.
2021-01-10 Olivier Hainque <hainque@adacore.com>
* inclhack.def (vxworks_time_h_syslib): New hack.
* tests/base/time.h: Update.
* fixincl.x: Regenerate.
Arrange to provide missing defs for C99 FP classification functions
and constants queried by libstdc++ configure checks (C99 support for C++98)
2021-01-10 Olivier Hainque <hainque@adacore.com>
* inclhack.def (vxworks_math_h_fp_c99): New hack.
* tests/base/math.h: Update.
* fixincl.x: Regenerate.
For GoldenCove micro-architecture, force insert zero-idiom in asm
template to break false dependency of dest register for several insns.
The related insns are:
VPERM/D/Q/PS/PD
VRANGEPD/PS/SD/SS
VGETMANTSS/SD/SH
VGETMANDPS/PD - mem version only
VPMULLQ
VFMULCSH/PH
VFCMULCSH/PH
gcc/ChangeLog:
* config/i386/i386.h (TARGET_DEST_FALSE_DEP_FOR_GLC): New macro.
* config/i386/sse.md (<avx512>_<complexopname>_<mode><maskc_name><round_name>):
Insert zero-idiom in output template when attr enabled, set new attribute to
true for non-mask/maskz insn.
(avx512fp16_<complexopname>sh_v8hf<mask_scalarc_name><round_scalarcz_name>):
Likewise.
(avx512dq_mul<mode>3<mask_name>): Likewise.
(<avx2_avx512>_permvar<mode><mask_name>): Likewise.
(avx2_perm<mode>_1<mask_name>): Likewise.
(avx512f_perm<mode>_1<mask_name>): Likewise.
(avx512dq_rangep<mode><mask_name><round_saeonly_name>): Likewise.
(avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>):
Likewise.
(<avx512>_getmant<mode><mask_name><round_saeonly_name>): Likewise.
(avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>):
Likewise.
* config/i386/subst.md (mask3_dest_false_dep_for_glc_cond): New
subst_attr.
(mask4_dest_false_dep_for_glc_cond): Likewise.
(mask6_dest_false_dep_for_glc_cond): Likewise.
(mask10_dest_false_dep_for_glc_cond): Likewise.
(maskc_dest_false_dep_for_glc_cond): Likewise.
(mask_scalar4_dest_false_dep_for_glc_cond): Likewise.
(mask_scalarc_dest_false_dep_for_glc_cond): Likewise.
* config/i386/x86-tune.def (X86_TUNE_DEST_FALSE_DEP_FOR_GLC): New
DEF_TUNE enabled for m_SAPPHIRERAPIDS and m_ALDERLAKE
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx2-dest-false-dep-for-glc.c: New test.
* gcc.target/i386/avx512dq-dest-false-dep-for-glc.c: Ditto.
* gcc.target/i386/avx512f-dest-false-dep-for-glc.c: Ditto.
* gcc.target/i386/avx512fp16-dest-false-dep-for-glc.c: Ditto.
* gcc.target/i386/avx512fp16vl-dest-false-dep-for-glc.c: Ditto.
* gcc.target/i386/avx512vl-dest-false-dep-for-glc.c: Ditto.
Resolves:
PR c/63272 - GCC should warn when using pointer to dead scoped variable with
in the same function
gcc/c-family/ChangeLog:
PR c/63272
* c.opt (-Wdangling-pointer): New option.
gcc/ChangeLog:
PR c/63272
* diagnostic-spec.c (nowarn_spec_t::nowarn_spec_t): Handle
-Wdangling-pointer.
* doc/invoke.texi (-Wdangling-pointer): Document new option.
* gimple-ssa-warn-access.cc (pass_waccess::clone): Set new member.
(pass_waccess::check_pointer_uses): New function.
(pass_waccess::gimple_call_return_arg): New function.
(pass_waccess::gimple_call_return_arg_ref): New function.
(pass_waccess::check_call_dangling): New function.
(pass_waccess::check_dangling_uses): New function overloads.
(pass_waccess::check_dangling_stores): New function.
(pass_waccess::check_dangling_stores): New function.
(pass_waccess::m_clobbers): New data member.
(pass_waccess::m_func): New data member.
(pass_waccess::m_run_number): New data member.
(pass_waccess::m_check_dangling_p): New data member.
(pass_waccess::check_alloca): Check m_early_checks_p.
(pass_waccess::check_alloc_size_call): Same.
(pass_waccess::check_strcat): Same.
(pass_waccess::check_strncat): Same.
(pass_waccess::check_stxcpy): Same.
(pass_waccess::check_stxncpy): Same.
(pass_waccess::check_strncmp): Same.
(pass_waccess::check_memop_access): Same.
(pass_waccess::check_read_access): Same.
(pass_waccess::check_builtin): Call check_pointer_uses.
(pass_waccess::warn_invalid_pointer): Add arguments.
(is_auto_decl): New function.
(pass_waccess::check_stmt): New function.
(pass_waccess::check_block): Call check_stmt.
(pass_waccess::execute): Call check_dangling_uses,
check_dangling_stores. Empty m_clobbers.
* passes.def (pass_warn_access): Invoke pass two more times.
gcc/testsuite/ChangeLog:
PR c/63272
* g++.dg/warn/Wfree-nonheap-object-6.C: Disable valid warnings.
* g++.dg/warn/ref-temp1.C: Prune expected warning.
* gcc.dg/uninit-pr50476.c: Expect a new warning.
* c-c++-common/Wdangling-pointer-2.c: New test.
* c-c++-common/Wdangling-pointer-3.c: New test.
* c-c++-common/Wdangling-pointer-4.c: New test.
* c-c++-common/Wdangling-pointer-5.c: New test.
* c-c++-common/Wdangling-pointer-6.c: New test.
* c-c++-common/Wdangling-pointer.c: New test.
* g++.dg/warn/Wdangling-pointer-2.C: New test.
* g++.dg/warn/Wdangling-pointer.C: New test.
* gcc.dg/Wdangling-pointer-2.c: New test.
* gcc.dg/Wdangling-pointer.c: New test.
gcc/fortran/ChangeLog:
PR fortran/83079
* target-memory.c (gfc_interpret_character): Result length is
in bytes and thus depends on the character kind.
* trans-intrinsic.c (gfc_conv_intrinsic_transfer): Compute correct
string length for the result of the TRANSFER intrinsic and for
temporaries for the different character kinds.
gcc/testsuite/ChangeLog:
PR fortran/83079
* gfortran.dg/transfer_char_kind4.f90: New test.
Explicitly support use of the stdx::simd implementation in situations
where the user links TUs that were compiled with different -m flags. In
general, this is always a (quasi) ODR violation for inline functions
because at least codegen may differ in important ways. However, in the
resulting executable only one (unspecified which one) of them might be
used. For simd we want to support users to compile code multiple times,
with different -m flags and have a runtime dispatch to the TU matching
the target CPU. But if internal functions are not inlined this may lead
to unexpected performance loss or execution of illegal instructions.
Therefore, inline functions that are not marked as always_inline must
use an additional template parameter somewhere in their name, to
disambiguate between the different -m translations.
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd.h: Move feature detection bools
and add __have_avx512bitalg, __have_avx512vbmi2,
__have_avx512vbmi, __have_avx512ifma, __have_avx512cd,
__have_avx512vnni, __have_avx512vpopcntdq.
(__detail::__machine_flags): New function which returns a unique
uint64 depending on relevant -m and -f flags.
(__detail::__odr_helper): New type alias for either an anonymous
type or a type specialized with the __machine_flags number.
(_SimdIntOperators): Change template parameters from _Impl to
_Tp, _Abi because _Impl now has an __odr_helper parameter which
may be _OdrEnforcer from the anonymous namespace, which makes
for a bad base class.
(many): Either add __odr_helper template parameter or mark as
always_inline.
* include/experimental/bits/simd_detail.h: Add defines for
AVX512BITALG, AVX512VBMI2, AVX512VBMI, AVX512IFMA, AVX512CD,
AVX512VNNI, AVX512VPOPCNTDQ, and AVX512VP2INTERSECT.
* include/experimental/bits/simd_builtin.h: Add __odr_helper
template parameter or mark as always_inline.
* include/experimental/bits/simd_fixed_size.h: Ditto.
* include/experimental/bits/simd_math.h: Ditto.
* include/experimental/bits/simd_scalar.h: Ditto.
* include/experimental/bits/simd_neon.h: Add __odr_helper
template parameter.
* include/experimental/bits/simd_ppc.h: Ditto.
* include/experimental/bits/simd_x86.h: Ditto.
Modernize ix86_expand_sse_movcc to use expand_simple_{unop,binop}
infrastructure to avoid manual twiddling with output registers.
Also fix a couple of inconsistent vector_all_ones_operand usages,
break a couple of unnecessary else-if chains, eliminate common
subexpressions and do some general code simplifications.
2022-01-15 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_expand_sse_movcc): Use
expand_simple_unop and expand_simple_binop instead of manually
constructing NOT, AND and IOR RTXes. Use vector_all_ones_operand
consistently. Eliminate common subexpressions and simplify code.
* config/i386/sse.md (<any_logic:code><MODEF:mode>3): New expander.
(<any_logic:code><MODEF:mode>3): Make public.
2022-01-14 David <gccbugzilla@limegreensocks.com>
libgcc/
* config/i386/gthr-win32.c (__gthr_i486_lock_cmp_xchg):
Remove inlined version, Windows 95 is no longer relevant.
* config/i386/gthr-win32.h
(__GTHREAD_I486_INLINE_LOCK_PRIMITIVES): unset.
As reported, libgnat-12.so gets PT_GNU_STACK RWE, which means it doesn't
work in some SELinux configurations.
This is caused by the a-nbnbig.o file, which is a ghost unit and since
r12-5670 the FE emits an object file for it, but exits before compile_file
has a chance to finalize it e.g. with targetm.asm_out.file_end ()
that emits the .note.GNU-stack section on various linux targets.
Fixed by not existing but instead returning early to the caller.
2022-01-14 Andrew Pinski <apinski@marvell.com>
PR ada/104027
* gnat1drv.adb (Gnat1drv): After Back_End.Gen_Or_Update_Object_File
goto End_Of_Program.
gcc/analyzer/ChangeLog:
* sm-taint.cc (taint_state_machine::combine_states): Handle combination
of has_ub and has_lb.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/taint-merger.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/ChangeLog:
PR analyzer/104029
* sm-taint.cc (taint_state_machine::alt_get_inherited_state):
Remove gcc_unreachable from default case for unary ops.
gcc/testsuite/ChangeLog:
PR analyzer/104029
* gcc.dg/analyzer/pr104029.c: New test.
* gcc.dg/analyzer/taint-ops.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>