Martin Liska [Tue, 26 Apr 2022 07:56:37 +0000 (09:56 +0200)]
lto: use diagnostics_context in print_lto_docs_link
Properly parse OPT_fdiagnostics_urls_ and then initialize both urls
and colors for global_dc. Doing that we would follow the configure
option --with-documentation-root-url, -fdiagnostics-urls is respected.
Plus we'll print colored warning and note messages.
PR lto/105364
gcc/ChangeLog:
* lto-wrapper.cc (print_lto_docs_link): Use global_dc.
(run_gcc): Parse OPT_fdiagnostics_urls_.
(main): Initialize global_dc.
Iain Buclaw [Tue, 26 Apr 2022 13:10:09 +0000 (14:10 +0100)]
libphobos: Don't call free on the TLS array in the emutls destroy function.
Fixes a segfault seen on Darwin when a GC scan is ran after a thread has
been destroyed. As the global emutlsArrays hash still has a reference
to the array itself, and tries to iterate all elements.
Setting the length to zero frees all allocated elements in the array,
and ensures that it is skipped when the _d_emutls_scan is called.
libphobos/ChangeLog:
* libdruntime/gcc/emutls.d (emutlsDestroyThread): Clear the per-thread
TLS array, don't call free().
Jonathan Wakely [Mon, 25 Apr 2022 17:25:07 +0000 (18:25 +0100)]
libstdc++: Add std::atomic<shared_ptr>(nullptr_t) constructor (LWG 3661)
This DR was approved at the February 2022 plenary.
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_atomic.h (atomic<shared_ptr>): Add
constructor for constant initialization from nullptr_t.
* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
Check for new constructor.
Jonathan Wakely [Mon, 25 Apr 2022 17:21:57 +0000 (18:21 +0100)]
libstdc++: Define std::hash<std::filesystem::path> (LWG 3657)
This DR was approved at the February 2022 plenary.
libstdc++-v3/ChangeLog:
* include/bits/fs_path.h (hash<filesystem::path>): Define.
* testsuite/27_io/filesystem/path/nonmember/hash_value.cc:
Check std::hash specialization.
Segher Boessenkool [Tue, 26 Apr 2022 11:26:09 +0000 (11:26 +0000)]
rs6000: Make the has_arch target selectors actually work
2022-04-26 Segher Boessenkoool <segher@kernel.crashing.org>
gcc/testsuite/
PR target/105349
* lib/target-supports.exp (check_effective_target_has_arch_pwr5): Use
the specified dg-options.
(check_effective_target_has_arch_pwr6): Ditto.
(check_effective_target_has_arch_pwr7): Ditto.
(check_effective_target_has_arch_pwr8): Ditto.
(check_effective_target_has_arch_pwr9): Ditto.
(check_effective_target_has_arch_pwr10): Ditto.
(check_effective_target_has_arch_ppc64): Ditto.
Jakub Jelinek [Tue, 26 Apr 2022 08:11:58 +0000 (10:11 +0200)]
ifcvt: Improve noce_try_store_flag_mask [PR105314]
The following testcase regressed on riscv due to the splitting of critical
edges in the sink pass, similarly to x86_64 compared to GCC 11 we now swap
the edges, whether true or false edge goes to an empty forwarded bb.
From GIMPLE POV, those 2 forms are equivalent, but as can be seen here, for
some ifcvt opts it matters one way or another.
On this testcase, noce_try_store_flag_mask used to trigger and transformed
if (pseudo2) pseudo1 = 0;
into
pseudo1 &= -(pseudo2 == 0);
But with the swapped edges ifcvt actually sees
if (!pseudo2) pseudo3 = pseudo1; else pseudo3 = 0;
and noce_try_store_flag_mask punts. IMHO there is no reason why it
should punt those, it is equivalent to
pseudo3 = pseudo1 & -(pseudo2 == 0);
and especially if the target has 3 operand AND, it shouldn't be any more
costly (and even with 2 operand AND, it might very well happen that RA
can make it happen without any extra moves).
Initially I've just removed the rtx_equal_p calls from the conditions
and didn't add anything there, but that broke aarch64 bootstrap and
regressed some testcases on x86_64, where if_info->a or if_info->b could be
some larger expression that we can't force into a register.
Furthermore, the case where both if_info->a and if_info->b are constants is
better handled by other ifcvt optimizations like noce_try_store_flag
or noce_try_inverse_constants or noce_try_store_flag_constants.
So, I've restricted it to just a REG (perhaps SUBREG of REG might be ok too)
next to what has been handled previously.
2022-04-26 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/105314
* ifcvt.cc (noce_try_store_flag_mask): Don't require that the non-zero
operand is equal to if_info->x, instead use the non-zero operand
as one of the operands of AND with if_info->x as target.
* gcc.target/riscv/pr105314.c: New test.
Jakub Jelinek [Tue, 26 Apr 2022 07:57:34 +0000 (09:57 +0200)]
reassoc: Don't call fold_convert if !fold_convertible_p [PR105374]
As mentioned in the PR, we ICE because maybe_fold_*_comparisons returns
an expression with V4SImode type and we try to fold_convert it to
V4BImode, which isn't allowed.
IMHO no matter whether we change maybe_fold_*_comparisons we should
play safe on the reassoc side and punt if we can't convert like
we punt for many other reasons. This fixes the testcase on ARM.
Testcase not included, not exactly sure where and what directives it
should have in gcc.target/arm/ testsuite. Christophe, do you think you
could handle that incrementally?
2022-04-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/105374
* tree-ssa-reassoc.cc (eliminate_redundant_comparison): Punt if
!fold_convertible_p rather than assuming fold_convert must succeed.
Jakub Jelinek [Tue, 26 Apr 2022 07:52:22 +0000 (09:52 +0200)]
testsuite: Fix up g++.target/i386/vec-tmpl1.C testcase [PR65211]
This test fails on i686-linux:
Excess errors:
.../gcc/testsuite/g++.target/i386/vec-tmpl1.C:13:27: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
2022-04-26 Jakub Jelinek <jakub@redhat.com>
PR c++/65211
* g++.target/i386/vec-tmpl1.C: Add -Wno-psabi as
dg-additional-options.
Jakub Jelinek [Tue, 26 Apr 2022 07:40:03 +0000 (09:40 +0200)]
i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367]
The following testcase ICEs, because conversion between scalar float types
which have the same mode are useless in GIMPLE, but for mathfn_built_in the
exact type matters (it treats say double and _Float64 or float and _Float32
differently, using different suffixes and for the _Float* sometimes
returning NULL when float/double do have a builtin).
In ix86_veclibabi_{svml,acml} we are using mathfn_built_in just so that
we don't have to translate the combined_fn and SFmode vs. DFmode into
strings ourselfs, and we already earlier punt on anything but SFmode and
DFmode. So, this patch just uses the double or float types depending
on the modes, rather than the types we actually got and which might be
_Float64 or _Float32 etc.
2022-04-26 Jakub Jelinek <jakub@redhat.com>
PR target/105367
* config/i386/i386.cc (ix86_veclibabi_svml, ix86_veclibabi_acml): Pass
el_mode == DFmode ? double_type_node : float_type_node instead of
TREE_TYPE (type_in) as first arguments to mathfn_built_in.
* gcc.target/i386/pr105367.c: New test.
Jakub Jelinek [Tue, 26 Apr 2022 07:17:32 +0000 (09:17 +0200)]
testsuite: Improve unlimited_polymorphic_3.f03 [PR103662]
On Mon, Apr 25, 2022 at 01:38:25PM +0200, Mikael Morin wrote:
> I have just pushed the attached fix for two UNRESOLVED checks at -O0 that I
> hadn’t seen.
I don't like forcing of DSE in -O0 compilation, wouldn't it be better
to just not check the dse dump at -O0 like in the following patch?
Even better would be to check that the z._data = stores are both present
in *.optimized dump, but that doesn't really work at -O2 or above because
we inline the functions and optimize it completely away (both the stores
and corresponding reads).
The first hunk is needed so that __OPTIMIZE__ effective target works in
Fortran testsuite, otherwise one gets a pedantic error and __OPTIMIZE__
is considered not to match at all.
2022-04-26 Jakub Jelinek <jakub@redhat.com>
PR fortran/103662
* lib/target-supports.exp (check_effective_target___OPTIMIZE__): Add
a var definition to avoid pedwarn about empty translation unit.
* gfortran.dg/unlimited_polymorphic_3.f03: Remove -ftree-dse from
dg-additional-options, guard scan-tree-dump-not directives on
__OPTIMIZE__ target.
Jakub Jelinek [Tue, 26 Apr 2022 06:57:17 +0000 (08:57 +0200)]
libgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues [PR105358]
Last fall I've changed struct gomp_work_share, so that it doesn't have
__attribute__((aligned (64))) lock member in the middle unless the target has
non-emulated aligned allocator, otherwise it just makes sure the first and
second halves are 64 bytes appart for cache line reasons, but doesn't make
the struct 64-byte aligned itself and so we can use normal allocators for it.
When the struct isn't 64-byte aligned, the amount of tail padding significantly
decreases, to 0 or 4 bytes or so. The library uses that tail padding when
the ordered_teams_ids array (array of uints) and/or the memory for lastprivate
conditional temporaries (the latter wants to guarantee long long alignment).
The problem with it on ia32 darwin9 is that while the struct contains
long long members, long long is just 4 byte aligned while __alignof__(long long)
is 8. That causes problems in gomp_init_work_share, where we currently rely on
if offsetof (struct gomp_work_share, inline_ordered_team_ids) is long long
aligned, then that tail array will be aligned at runtime and so no extra
memory for dynamic realignment will be needed (that is false when the whole
struct doesn't have long long alignment). And also in the remaining hunks
causes another problem, where we compute INLINE_ORDERED_TEAM_IDS_OFF
as the above offsetof aligned up to long long boundary and subtract
sizeof (struct gomp_work_share) and INLINE_ORDERED_TEAM_IDS_OFF.
When unlucky, the former isn't multiple of 8 and the latter is 4 bigger
than that and as the subtraction is done in size_t, we end up with (size_t) -4,
so the comparison doesn't really work.
The fixes add additional conditions to make it work properly, but all of them
should be evaluated at compile time when optimizing and so shouldn't slow
anything.
2022-04-26 Jakub Jelinek <jakub@redhat.com>
PR libgomp/105358
* work.c (gomp_init_work_share): Don't mask of adjustment for
dynamic long long realignment if struct gomp_work_share has smaller
alignof than long long.
* loop.c (GOMP_loop_start): Don't use inline_ordered_team_ids if
struct gomp_work_share has smaller alignof than long long or if
sizeof (struct gomp_work_share) is smaller than
INLINE_ORDERED_TEAM_IDS_OFF.
* loop_ull.c (GOMP_loop_ull_start): Likewise.
* sections.c (GOMP_sections2_start): Likewise.
Jason Merrill [Thu, 21 Apr 2022 21:24:07 +0000 (17:24 -0400)]
c++: generic lambda fn parm pack [PR104624]
Parameter packs from the enclosing context can be used unexpanded in a
lambda that is itself part of a pack expansion, but not packs that are part
of the lambda itself. We already check for capture packs; we also need to
check for function parameter packs of the lambda call operator.
PR c++/104624
gcc/cp/ChangeLog:
* pt.cc (check_for_bare_parameter_packs): Check for lambda
function parameter pack.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/lambda-generic-variadic22.C: New test.
Patrick Palka [Tue, 26 Apr 2022 01:49:00 +0000 (21:49 -0400)]
c++: ICE with requires-expr and -Wsequence-point [PR105304]
Here we're crashing from verify_sequence_points for this requires-expr
condition because it contains a templated CAST_EXPR with empty operand,
and verify_tree doesn't ignore this empty operand only because the
manual tail recursion that it performs for unary expression trees skips
the NULL test.
PR c++/105304
gcc/c-family/ChangeLog:
* c-common.cc (verify_tree) [restart]: Move up to before the
NULL test.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires30.C: New test.
Patrick Palka [Tue, 26 Apr 2022 01:46:56 +0000 (21:46 -0400)]
c++: partial ordering with dependent NTTP type [PR105289]
Here ever since r11-6483-ge2e2f3f2c9400f we're rejecting and crashing
on (respectively) two testcases that we used to accept in C++17 mode
since r8-1437-g3da557ec145823. Both testcases declare a partial
specialization of a primary template that has an NTTP with dependent
type, and the validity of these partial specializations is unclear and
the subject of PR86193 / CWG 455.
So for now, this minimal patch just aims to fix the crash in the second
testcase. During deduction, when checking whether the type of an NTTP
uses still-undeduced parameters, we were incorrectly substituting into
the previously substituted type instead of into its original type.
In passing this patch also downgrades the "not more specialized"
diagnostic from a permerror to a pedwarn.
PR c++/105289
PR c++/86193
gcc/cp/ChangeLog:
* pt.cc (process_partial_specialization): Downgrade "partial
specialization isn't more specialized" diagnostic from permerror
to an on-by-default pedwarn.
(unify) <case TEMPLATE_PARM_INDEX>: When substituting into the
NTTP type a second time, use the original type not the
substituted type.
gcc/testsuite/ChangeLog:
* g++.dg/template/partial-specialization11.C: New test.
* g++.dg/template/partial-specialization12.C: New test.
GCC Administrator [Tue, 26 Apr 2022 00:16:51 +0000 (00:16 +0000)]
Daily bump.
David Malcolm [Mon, 25 Apr 2022 23:36:37 +0000 (19:36 -0400)]
analyzer: fix ICEs on complex constants [PR105365,105366]
gcc/analyzer/ChangeLog:
PR analyzer/105365
PR analyzer/105366
* svalue.cc
(cmp_cst): Rename to...
(cmp_csts_same_type): ...this. Convert all recursive calls to
calls to...
(cmp_csts_and_types): ....this new function.
(svalue::cmp_ptr): Update for renaming of cmp_cst
gcc/testsuite/ChangeLog:
PR analyzer/105365
PR analyzer/105366
* gcc.dg/analyzer/pr105365.c: New test.
* gcc.dg/analyzer/pr105366.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Mon, 25 Apr 2022 23:34:33 +0000 (19:34 -0400)]
gimple-fold: fix further missing stmt locations [PR104308]
PR analyzer/104308 initially reported about a
-Wanalyzer-use-of-uninitialized-value diagnostic using UNKNOWN_LOCATION
when complaining about certain memmove operations where the source
is uninitialized.
In r12-7856-g875342766d4298 I fixed the missing location for
a stmt generated by gimple_fold_builtin_memory_op, but the reporter
then found another way to generate such a stmt with UNKNOWN_LOCATION.
I've now gone through gimple_fold_builtin_memory_op looking at all
statement creation, and found three places in which a new statement
doesn't have a location set on it (either directly via
gimple_set_location, or indirectly via gsi_replace), one of which is
the new reproducer.
This patch adds a gimple_set_location to these three cases, and adds
test coverage for one of them (the third hunk within the patch), fixing
the new reproducer for PR analyzer/104308.
gcc/ChangeLog:
PR analyzer/104308
* gimple-fold.cc (gimple_fold_builtin_memory_op): Explicitly set
the location of new_stmt in all places that don't already set it,
whether explicitly, or via a call to gsi_replace.
gcc/testsuite/ChangeLog:
PR analyzer/104308
* gcc.dg/analyzer/pr104308.c: Add test coverage.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Jakub Jelinek [Wed, 20 Apr 2022 17:06:17 +0000 (19:06 +0200)]
fortran: Fix up gfc_trans_oacc_construct [PR104717]
So that move_sese_region_to_fn works properly, OpenMP/OpenACC constructs
for which that function is invoked need an extra artificial BIND_EXPR
around their body so that we move all variables of the bodies.
The C/C++ FEs do that both for OpenMP constructs like OMP_PARALLEL, OMP_TASK
or OMP_TARGET and for OpenACC constructs that behave similarly to
OMP_TARGET, but the Fortran FE only does that for OpenMP constructs.
The following patch does that for OpenACC constructs too.
PR fortran/104717
gcc/fortran/
* trans-openmp.cc (gfc_trans_oacc_construct): Wrap construct body
in an extra BIND_EXPR.
gcc/testsuite/
* gfortran.dg/goacc/pr104717.f90: New test.
* gfortran.dg/goacc/privatization-1-compute-loop.f90: Adjust.
libgomp/
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Adjust.
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
Martin Liska [Mon, 25 Apr 2022 20:26:27 +0000 (22:26 +0200)]
contrib: filter out a new Clang warning
Filter out:
libcpp/lex.cc:1289:7: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-attribute-extensions]
contrib/ChangeLog:
* filter-clang-warnings.py: Filter out
-Wc++20-attribute-extensions in lex.cc.
Jonathan Wakely [Mon, 25 Apr 2022 13:24:48 +0000 (14:24 +0100)]
libstdc++: Implement constexpr std::unique_ptr for C++23 (P2273R3)
libstdc++-v3/ChangeLog:
* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define
conditionally.
* include/bits/unique_ptr.h (__cpp_lib_constexpr_memory):
Define for C++23.
(default_delete, default_delete<T[]>, __uniq_ptr_impl)
(unique_ptr, unique_ptr<T[], D>): Add constexpr to all member
functions.
* include/std/version (__cpp_lib_constexpr_memory): Define new
value for C++23.
* testsuite/20_util/unique_ptr/assign/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/comparison/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/cons/constexpr_c++20.cc: New test.
* testsuite/20_util/unique_ptr/creation/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/modifiers/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/specialized_algorithms/constexpr.cc:
New test.
Jonathan Wakely [Mon, 25 Apr 2022 13:22:41 +0000 (14:22 +0100)]
libstdc++: Add deduction guides for std::packaged_task [PR105375]
This change was LWG 3117.
The test is copied from 20_util/function/cons/deduction.cc
libstdc++-v3/ChangeLog:
PR libstdc++/105375
* include/std/future (packaged_task): Add deduction guides.
* testsuite/30_threads/packaged_task/cons/deduction.cc: New test.
Marek Polacek [Fri, 22 Apr 2022 23:40:27 +0000 (19:40 -0400)]
c++: __builtin_shufflevector with value-dep expr [PR105353]
Here we issue an error from c_build_shufflevector while parsing a template
because it got a TEMPLATE_PARM_INDEX, but this function expects INTEGER_CSTs
(except the first two arguments). It checks if any of the arguments are
type-dependent, if so, we leave the processing for later, but it should
also check value-dependency for the 3rd+ arguments, so as to avoid the
problem above.
This is not a regression -- __builtin_shufflevector was introduced in
GCC 12, but it looks safe enough.
PR c++/105353
gcc/cp/ChangeLog:
* typeck.cc (build_x_shufflevector): Use
instantiation_dependent_expression_p except for the first two
arguments.
gcc/testsuite/ChangeLog:
* g++.dg/ext/builtin-shufflevector-3.C: New test.
Paul A. Clarke [Mon, 11 Apr 2022 16:18:28 +0000 (11:18 -0500)]
docs: Fix 'modff' reference in extend.texi
In commit
a2a919aa501e3 (2003), built-ins for modf and modff were added.
In extend.texi, section "Other Builtins", "modf" was added to the paragraph
"There are also built-in versions of the ISO C99 functions [...]" and
"modf" was also added to the paragraph "The ISO C90 functions [...]".
"modff" was not added to either paragraph.
Based on the context clues about where "modfl" and other similar function
pairs like "powf/powl" appear, I believe the reference to "modf" in the
first paragraph (C99) should instead be "modff".
2022-04-25 Paul A. Clarke <pc@us.ibm.com>
gcc
* doc/extend.texi (Other Builtins): Correct reference to 'modff'.
Andrew MacLeod [Mon, 25 Apr 2022 13:56:35 +0000 (09:56 -0400)]
Retain existing range knowledge when prefilling statements.
When range_of_stmt was adjusted to avoid large recursion depth, we need to
intersect the calculated range whth the any known range to avoid losing
info. Range_of_stmt does this, but the new prefill code missed it.
PR tree-optimization/105276
gcc/
* gimple-range.cc (gimple_ranger::prefill_stmt_dependencies): Include
existing global range with calculated value.
gcc/testsuite/
* g++.dg/pr105276.C: New.
Martin Liska [Mon, 25 Apr 2022 13:42:09 +0000 (15:42 +0200)]
contrib: filter out a new Clang warning
contrib/ChangeLog:
* filter-clang-warnings.py: Filter out
-Wbitwise-instead-of-logical.
Philipp Fent [Mon, 25 Apr 2022 12:03:31 +0000 (13:03 +0100)]
libstdc++: Add pretty printer for std::initializer_list
Re-using the std::span printer, this now shows the contents of the
initializer list instead of the pointer and length members.
Signed-off-by: Philipp Fent <fent@in.tum.de>
libstdc++-v3/ChangeLog:
* python/libstdcxx/v6/printers.py (StdSpanPrinter._iterator):
Rename as iterator.
(StdInitializerListPrinter): Define new printer.
(build_libstdcxx_dictionary): Register new printer.
* testsuite/libstdc++-prettyprinters/cxx11.cc: Check printer for
initializer_list.
Mikael Morin [Mon, 25 Apr 2022 11:14:20 +0000 (13:14 +0200)]
testsuite: add additional option to force DSE execution [PR103662]
This fixes a dump tree match check that is UNRESOLVED with the -O0
optimization option, as the optimization pass corresponding to the
dump file is not run at -O0, and the dump is not generated.
PR fortran/103662
gcc/testsuite/ChangeLog:
* gfortran.dg/unlimited_polymorphic_3.f03: Force execution of
the DSE optimization pass.
Richard Biener [Mon, 25 Apr 2022 08:55:21 +0000 (10:55 +0200)]
tree-optimization/105368 - avoid overflow in powi_cost
The following avoids undefined signed overflow when computing
the absolute of the exponent in powi_cost.
2022-04-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/105368
* tree-ssa-math-opts.cc (powi_cost): Use absu_hwi.
Richard Biener [Fri, 1 Apr 2022 09:30:00 +0000 (11:30 +0200)]
tree-optimization/100810 - avoid undefs in IVOPT rewrites
The following attempts to avoid IVOPTs rewriting uses using
IV candidates that involve undefined behavior by using uninitialized
SSA names. First we restrict the set of candidates we produce
for such IVs to the original ones and mark them as not important.
Second we try to only allow expressing uses with such IV if they
originally use them. That is to avoid rewriting all such uses
in terms of other IVs. Since cand->iv and use->iv seem to never
exactly match up we resort to comparing the IV bases.
The approach ends up similar to the one posted by Roger at
https://gcc.gnu.org/pipermail/gcc-patches/2021-August/578441.html
but it marks IV candidates rather than use groups and the cases
we allow in determine_group_iv_cost_generic are slightly different.
2022-01-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/100810
* tree-ssa-loop-ivopts.cc (struct iv_cand): Add involves_undefs flag.
(find_ssa_undef): New function.
(add_candidate_1): Avoid adding derived candidates with
undefined SSA names and mark the original ones.
(determine_group_iv_cost_generic): Reject rewriting
uses with a different IV when that involves undefined SSA names.
* gcc.dg/torture/pr100810.c: New testcase.
* gcc.dg/torture/pr105337.c: Likewise.
Steve Kargl [Mon, 25 Apr 2022 07:23:56 +0000 (09:23 +0200)]
target/89125 - BSD and math functions
Back story: When GCC is configured and built on non-glibc platforms,
it seems very little to no effort is made to enumerate the available
C99 libm functions. It is all or nothing for C99 libm. The patch
introduces a new function, used on only FreeBSD, to inform gcc that
it has C99 libm functions (minus a few which clearly GCC does not check
nor test).
2022-04-15 Steven G. Kargl <kargl@gcc.gnu.org>
PR target/89125
* config/freebsd.h: Define TARGET_LIBC_HAS_FUNCTION to be
bsd_libc_has_function.
* targhooks.cc (bsd_libc_has_function): New function.
Expand the supported math functions to inclue C99 libm.
* targhooks.h (bsd_libc_has_function): New Prototype.
Richard Biener [Thu, 14 Apr 2022 12:06:22 +0000 (14:06 +0200)]
rtl-optimization/105231 - distribute_notes and REG_EH_REGION
The following mitigates a problem in combine distribute_notes which
places an original REG_EH_REGION based on only may_trap_p which is
good to test whether a non-call insn can possibly throw but not if
actually it does or we care. That's something we decided at RTL
expansion time where we possibly still know the insn evaluates
to a constant.
In fact, the REG_EH_REGION note with lp > 0 can only come from the
original i3 and an assert is added to that effect. That means we only
need to retain the note on i3 or, if that cannot trap, drop it but we
should never move it to i2.
The following places constraints on the insns to combine with
non-call exceptions since we cannot handle the case where we
have more than one EH side-effect in the IL. The patch also
makes sure we can accumulate that on i3 and do not split
a possible exception raising part of it to i2. As a special
case we do not place any restriction on all externally
throwing insns when there is no REG_EH_REGION present.
2022-04-22 Richard Biener <rguenther@suse.de>
PR rtl-optimization/105231
* combine.cc (distribute_notes): Assert that a REG_EH_REGION
with landing pad > 0 is from i3. Put any REG_EH_REGION note
on i3 or drop it if the insn can not trap.
(try_combine): Ensure that we can merge REG_EH_REGION notes
with non-call exceptions. Ensure we are not splitting a
trapping part of an insn with non-call exceptions when there
is any REG_EH_REGION note to preserve.
* gcc.dg/torture/pr105231.c: New testcase.
Hongyu Wang [Fri, 22 Apr 2022 06:42:30 +0000 (14:42 +0800)]
AVX512F: Add missing macro for mask(z?)_scalf_s[sd] [PR 105339]
Add missing macro under O0 and adjust macro format for scalf
intrinsics.
gcc/ChangeLog:
PR target/105339
* config/i386/avx512fintrin.h (_mm512_scalef_round_pd):
Add parentheses for parameters and djust format.
(_mm512_mask_scalef_round_pd): Ditto.
(_mm512_maskz_scalef_round_pd): Ditto.
(_mm512_scalef_round_ps): Ditto.
(_mm512_mask_scalef_round_ps): Ditto.
(_mm512_maskz_scalef_round_ps): Ditto.
(_mm_scalef_round_sd): Use _mm_undefined_pd.
(_mm_scalef_round_ss): Use _mm_undefined_ps.
(_mm_mask_scalef_round_sd): New macro.
(_mm_mask_scalef_round_ss): Ditto.
(_mm_maskz_scalef_round_sd): Ditto.
(_mm_maskz_scalef_round_ss): Ditto.
gcc/testsuite/ChangeLog:
PR target/105339
* gcc.target/i386/sse-14.c: Add tests for new macro.
GCC Administrator [Mon, 25 Apr 2022 00:16:21 +0000 (00:16 +0000)]
Daily bump.
Jeff Law [Sun, 24 Apr 2022 17:38:14 +0000 (13:38 -0400)]
[committed] exec-stack warning for test which wants executable stacks
gcc/testsuite
* gcc.dg/lto/pr94157_0.c: Also request executable stack from
the linker.
Mikael Morin [Sun, 24 Apr 2022 13:05:41 +0000 (15:05 +0200)]
fortran: Detect duplicate unlimited polymorphic types [PR103662]
This fixes a type-based alias analysis issue with unlimited polymorphic
class descriptors (types behind class(*)) causing data initialisation to
be removed by optimization.
The fortran front-end may create multiple declarations for types, for
example if a type is redeclared in each program unit it is used in.
To avoid optimization seeing them as non-aliasing, a list of derived
types is created at resolution time, and used at translation to set
the same TYPE_CANONICAL type for each duplicate type declaration.
This mechanism didn’t work for unlimited polymorphic descriptors types,
as there is a short-circuit return skipping all the resolution handling
for them, including the type registration.
This change adds type registration at the short-circuit return, and
updates type comparison to handle specifically unlimited polymorphic
fake symbols, class descriptor types and virtual table types.
The test, which exhibited mismatching dynamic types had to be fixed as
well.
PR fortran/103662
gcc/fortran/ChangeLog:
* interface.cc (gfc_compare_derived_types): Support comparing
unlimited polymorphic fake symbols. Recursively compare class
descriptor types and virtual table types.
* resolve.cc (resolve_fl_derived): Add type to the types list
on unlimited polymorphic short-circuit return.
gcc/testsuite/ChangeLog:
* gfortran.dg/unlimited_polymorphic_3.f03 (foo): Separate
bind(c) and sequence checks to...
(foo_bc, foo_sq): ... two different procedures.
(main, foo*): Change type declarations so that type name,
component name, and either bind(c) or sequence attribute match
between the main type declarations and the procedure type
declarations.
(toplevel): Add optimization dump checks.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
GCC Administrator [Sun, 24 Apr 2022 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Jakub Jelinek [Sat, 23 Apr 2022 08:25:31 +0000 (10:25 +0200)]
i386: Improve ix86_expand_int_movcc [PR105338]
The following testcase regressed on x86_64 on the trunk, due to some GIMPLE
pass changes (r12-7687) we end up an *.optimized dump difference of:
@@ -8,14 +8,14 @@ int foo (int i)
<bb 2> [local count:
1073741824]:
if (i_2(D) != 0)
- goto <bb 4>; [35.00%]
+ goto <bb 3>; [35.00%]
else
- goto <bb 3>; [65.00%]
+ goto <bb 4>; [65.00%]
- <bb 3> [local count:
697932184]:
+ <bb 3> [local count:
375809640]:
<bb 4> [local count:
1073741824]:
- # iftmp.0_1 = PHI <5(2), i_2(D)(3)>
+ # iftmp.0_1 = PHI <5(3), i_2(D)(2)>
return iftmp.0_1;
}
and similarly for the other functions. That is functionally equivalent and
there is no canonical form for those. The reason for i_2(D) in the PHI
argument as opposed to 0 is the uncprop pass, that is in many cases
beneficial for expansion as we don't need to load the value into some pseudo
in one of the if blocks.
Now, for the 11.x ordering we have the pseudo = i insn in the extended basic
block (it comes first) and so forwprop1 undoes what uncprop does by
propagating constant 0 there. But for the 12.x ordering, the extended basic
block contains pseudo = 5 and pseudo = i is in the other bb and so fwprop1
doesn't change it.
During the ce1 pass, we attempt to emit a conditional move and we have very
nice code for the cases where both last operands of ?: are constant, and yet
another for !TARGET_CMOVE if at least one of them is.
The following patch will undo the uncprop behavior during
ix86_expand_int_movcc, but just for those spots that can benefit from both
or at least one operands being constant, leaving the pure cmov case as is
(because then it is useful not to have to load a constant into a pseudo
as it already is in one). We can do that in the
op0 == op1 ? op0 : op3
or
op0 != op1 ? op2 : op0
cases if op1 is a CONST_INT by pretending it is
op0 == op1 ? op1 : op3
or
op0 != op1 ? op2 : op1
2022-04-23 Jakub Jelinek <jakub@redhat.com>
PR target/105338
* config/i386/i386-expand.cc (ix86_expand_int_movcc): Handle
op0 == cst1 ? op0 : op3 like op0 == cst1 ? cst1 : op3 for the non-cmov
cases.
* gcc.target/i386/pr105338.c: New test.
GCC Administrator [Sat, 23 Apr 2022 00:16:24 +0000 (00:16 +0000)]
Daily bump.
Thomas W Rodgers [Fri, 22 Apr 2022 22:46:19 +0000 (15:46 -0700)]
libstdc++: Make atomic notify_one and notify_all non-const
<recording this here for future reference>
PR102994 "atomics: std::atomic<ptr>::wait is not marked const" raises the
issue that the current libstdc++ implementation marks the notify members
const, the implementation strategy used by libstdc++, as well as libc++
and the Microsoft STL, do not require the atomic to be mutable (it is hard
to conceive of a desirable implementation approach that would require it).
The original paper proposing the wait/notify functionality for atomics
(p1185) also had these members marked const for the first three revisions,
but that was changed without explanation in r3 and subsequent revisions of
the paper.
After raising the issue to the authors of p1185 and the author of the
libc++ implementation, the consensus seems to be "meh, it's harmless" so
there seems little appetite for an LWG issue to revisit the subject.
This patch changes the libstdc++ implementation to be in agreement with
the standard by removing const from those notify_one/notify_all members.
libstdc++-v3/ChangeLog:
PR libstdc++/102994
* include/bits/atomic_base.h (atomic_flag::notify_one,
notify_all): Remove const qualification.
(__atomic_base::notify_one, notify_all): Likewise.
* include/std/atomic (atomic<bool>::notify_one, notify_all):
Likewise.
(atomic::notify_one, notify_all): Likewise.
(atomic<T*>::notify_one, notify_all): Likewise.
(atomic_notify_one, atomic_notify_all): Likewise.
* testsuite/29_atomics/atomic/wait_notify/102994.cc: Adjust test
to account for change in notify_one/notify_all signature.
Mikael Morin [Fri, 22 Apr 2022 20:52:50 +0000 (22:52 +0200)]
fortran: Use pointer arithmetic to index arrays [PR102043]
The code generated for array references used to be ARRAY_REF trees as
could be expected. However, the middle-end may conclude from those
trees that the indexes used are non-negative (more precisely not below
the lower bound), which is a wrong assumption in the case of "reversed-
order" arrays.
The problematic arrays are those with a descriptor and having a negative
stride for at least one dimension. The descriptor data points to the
first element in array order (which is not the first in memory order in
that case), and the negative stride(s) makes walking the array backwards
(towards lower memory addresses), and we can access elements with
negative index wrt data pointer.
With this change, pointer arithmetic is generated by default for array
references, unless we are in a case where negative indexes can’t happen
(array descriptor’s dim element, substrings, explicit shape,
allocatable, or assumed shape contiguous). A new flag is added to
choose between array indexing and pointer arithmetic, and it’s set
if the context can tell array indexing is safe (descriptor dim
element, substring, temporary array), or a new method is called
to decide on whether the flag should be set for one given array
expression.
PR fortran/102043
gcc/fortran/ChangeLog:
* trans.h (gfc_build_array_ref): Add non_negative_offset
argument.
* trans.cc (gfc_build_array_ref): Ditto. Use pointer arithmetic
if non_negative_offset is false.
* trans-expr.cc (gfc_conv_substring): Set flag in the call to
gfc_build_array_ref.
* trans-array.cc (gfc_get_cfi_dim_item,
gfc_conv_descriptor_dimension): Same.
(build_array_ref): Decide on whether to set the flag and update
the call.
(gfc_conv_scalarized_array_ref): Same. New argument tmp_array.
(gfc_conv_tmp_array_ref): Update call to
gfc_conv_scalarized_ref.
(non_negative_strides_array_p): New function.
gcc/testsuite/ChangeLog:
* gfortran.dg/array_reference_3.f90: New.
* gfortran.dg/negative_stride_1.f90: New.
* gfortran.dg/vector_subscript_8.f90: New.
* gfortran.dg/vector_subscript_9.f90: New.
* gfortran.dg/c_loc_test_22.f90: Update dump patterns.
* gfortran.dg/finalize_10.f90: Same.
Co-Authored-By: Richard Biener <rguenther@suse.de>
Mikael Morin [Fri, 22 Apr 2022 20:52:38 +0000 (22:52 +0200)]
fortran: Generate an array temporary reference [PR102043]
This avoids regressing on char_cast_1.f90 and char_cast_2.f90 later in
the patch series when the code generation for array references is
changed to use pointer arithmetic.
The regressing testcases match part of an array reference in the
generated tree dump and it’s not clear how the pattern should be
rewritten to match the equivalent with pointer arithmetic.
This change uses a method specific to array temporaries to generate
array-references, so that these array references are flagged as safe
for array indexing and will not be updated to use pointer arithmetic.
PR fortran/102043
gcc/fortran/ChangeLog:
* trans-array.cc (gfc_conv_expr_descriptor): Use
gfc_conv_tmp_array_ref.
Mikael Morin [Fri, 22 Apr 2022 20:52:26 +0000 (22:52 +0200)]
fortran: Update index extraction code. [PR102043]
This avoids a regression on hollerith4.f90 and hollerith6.f90 later in
the patch series when code generation for array references is changed
to use pointer arithmetic.
The problem comes from the extraction of the array index from an
ARRAY_REF tree, which doesn’t work if the tree is not an ARRAY_REF
any more.
This updates the code generated for remaining size evaluation to work
with a source tree that uses either array indexing or pointer
arithmetic.
PR fortran/102043
gcc/fortran/ChangeLog:
* trans-io.cc: Add handling for the case where the array
is referenced using pointer arithmetic.
Mikael Morin [Fri, 22 Apr 2022 20:52:12 +0000 (22:52 +0200)]
fortran: Pre-evaluate string pointers. [PR102043]
This avoids a regression on deferred_character_23.f90 later in the
patch series when array references are rewritten to use pointer
arithmetic.
The problem is a SAVE_EXPR tree as TYPE_SIZE_UNIT of one array element
type, which is used by the pointer arithmetic expressions. As these
expressions appear in both branches of an if-then-else block, the tree
is lowered to a variable in one of the branches but it’s used in both
branches, which is invalid middle-end code.
This change pre-evaluates the array references or pointer arithmetics
to variables before the if-then-else block, so that the SAVE_EXPR are
expanded to variables in the parent scope of the if-then-else block,
and expressions referencing the variables remain valid in both
branches.
PR fortran/102043
gcc/fortran/ChangeLog:
* trans-expr.cc: Pre-evaluate src and dest to variables
before using them.
gcc/testsuite/ChangeLog:
* gfortran.dg/dependency_49.f90: Update variable occurence
count.
Segher Boessenkool [Fri, 22 Apr 2022 15:45:00 +0000 (15:45 +0000)]
rs6000: Fix pack for soft-float (PR105334)
For PR103623 I fixed unpack, but pack is broken as well, as reported in
PR105334. Fixing that is a bit more code, but it is pretty simple code
nonetheless.
2022-04-22 Segher Boessenkool <segher@kernel.crashing.org>
PR target/105334
* config/rs6000/rs6000.md (pack<mode> for FMOVE128): New expander.
(pack<mode> for FMOVE128): Rename and split the insn_and_split to...
(pack<mode>_hard for FMOVE128): ... this...
(pack<mode>_soft for FMOVE128): ... and this.
Paul A. Clarke [Fri, 22 Apr 2022 17:28:30 +0000 (12:28 -0500)]
docs: Correct "This functions" to "These functions"
2022-04-22 Paul A. Clarke <pc@us.ibm.com>
gcc
* doc/extend.texi: Correct "This" to "These".
Jakub Jelinek [Fri, 22 Apr 2022 11:38:11 +0000 (13:38 +0200)]
rtlanal: Fix up replace_rtx [PR105333]
The following testcase FAILs, because replace_rtx replaces a REG with
CONST_WIDE_INT inside of a SUBREG, which is an invalid transformation
because a SUBREG relies on SUBREG_REG having non-VOIDmode but
CONST_WIDE_INT has VOIDmode.
replace_rtx already has code to deal with it, but it was doing
it only for CONST_INTs. The following patch does it also for
VOIDmode CONST_DOUBLE or CONST_WIDE_INT.
2022-04-22 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/105333
* rtlanal.cc (replace_rtx): Use simplify_subreg or
simplify_unary_operation if CONST_SCALAR_INT_P rather than just
CONST_INT_P.
* gcc.dg/pr105333.c: New test.
GCC Administrator [Fri, 22 Apr 2022 00:16:43 +0000 (00:16 +0000)]
Daily bump.
Segher Boessenkool [Thu, 21 Apr 2022 18:35:32 +0000 (18:35 +0000)]
rs6000/testsuite: xfail bswap-brw.c
This testcase does not generate anywhere near optimal code for 32-bit
code. For p10 it actually now fails this testcase, after the previous
patch. Let's xfail it.
2022-04-21 Segher Boessenkool <segher@kernel.crashing.org>
gcc/testsuite/
PR target/103197
PR target/102146
* gcc.target/powerpc/bswap-brw.c: Add xfail on scan-assembler for -m32.
Segher Boessenkool [Sun, 2 Jan 2022 14:08:35 +0000 (14:08 +0000)]
rs6000: Disparage lfiwzx and similar
RA now chooses GEN_OR_VSX_REGS in most cases. This is great in most
cases, but we often (or always?) use {l,st}{f,xs}iwzx now, which is
problematic because the integer load and store insns can use cheaper
addressing modes. We can fix that by putting a small penalty on the
instruction alternatives for those.
2022-04-21 Segher Boessenkool <segher@kernel.crashing.org>
PR target/103197
PR target/102146
* config/rs6000/rs6000.md (zero_extendqi<mode>2 for EXTQI): Disparage
the "Z" alternatives in {l,st}{f,xs}iwzx.
(zero_extendhi<mode>2 for EXTHI): Ditto.
(zero_extendsi<mode>2 for EXTSI): Ditto.
(*movsi_internal1): Ditto.
(*mov<mode>_internal1 for QHI): Ditto.
(movsd_hardfloat): Ditto.
Segher Boessenkool [Thu, 21 Apr 2022 18:32:48 +0000 (18:32 +0000)]
rs6000: Add effective target has_arch_ppc64
This is true if we have -mpowerpc64.
2022-04-21 Segher Boessenkool <segher@kernel.crashing.org>
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_has_arch_ppc64): New.
Iain Buclaw [Thu, 21 Apr 2022 13:25:26 +0000 (14:25 +0100)]
d: Merge upstream dmd
eb7bee331, druntime
27834edb, phobos
ac296f80c.
D front-end changes:
- Import dmd v2.100.0-beta.1.
- Print deprecation messages for scope violations unless
`-frevert=dip1000' is used.
- Fixed a missed case of switch case fallthrough not being caught by
the compiler.
D runtime changes:
- Import druntime v2.100.0-beta.1.
Phobos changes:
- Import phobos v2.100.0-beta.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
eb7bee331.
* dmd/VERSION: Update version to v2.100.0-beta.1.
* d-lang.cc (d_handle_option): Handle OPT_frevert_dip1000.
* lang.opt (frevert=dip1000): New option.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime
27834edb.
* src/MERGE: Merge upstream phobos
ac296f80c.
* src/Makefile.am (PHOBOS_DSOURCES): Add std/int128.d.
* src/Makefile.in: Regenerate.
Patrick Palka [Thu, 21 Apr 2022 16:11:01 +0000 (12:11 -0400)]
libstdc++: Avoid ASCII assumptions in floating_from_chars.cc
In starts_with_ci and in __floating_from_chars_hex's inf/nan handling,
we were assuming that the letters are contiguous and that 'A' + 32 == 'a'
which is true for ASCII but not for other character encodings.
This patch fixes starts_with_ci by using a constexpr lookup table that
maps uppercase letters to lowercase, and fixes __floating_from_chars_hex
by using __from_chars_alnum_to_val.
libstdc++-v3/ChangeLog:
* include/std/charconv (__from_chars_alnum_to_val_table):
Simplify initialization of __lower/__upper_letters.
(__from_chars_alnum_to_val): Default the template parameter to
false.
* src/c++17/floating_from_chars.cc (starts_with_ci): Don't
assume the uppercase and lowercase letters are contiguous.
(__floating_from_chars_hex): Likewise.
Marek Polacek [Thu, 21 Apr 2022 14:27:38 +0000 (10:27 -0400)]
c++: Remove unused parameter
gcc/cp/ChangeLog:
* constexpr.cc (cxx_eval_logical_expression): Remove unused
parameter.
(cxx_eval_constant_expression) <case TRUTH_ANDIF_EXPR>,
<case TRUTH_OR_EXPR>: Adjust calls to cxx_eval_logical_expression.
Marek Polacek [Wed, 20 Apr 2022 20:02:52 +0000 (16:02 -0400)]
c++: wrong error with constexpr COMPOUND_EXPR [PR105321]
Here we issue a bogus error for the first assert in the test. Therein
we have
<retval> = (void) (VIEW_CONVERT_EXPR<bool>(yes) || handle_error ());, VIEW_CONVERT_EXPR<int>(value);
which has a COMPOUND_EXPR, so we get to cxx_eval_constant_expression
<case COMPOUND_EXPR>. The problem here is that we call
7044 /* Check that the LHS is constant and then discard it. */
7045 cxx_eval_constant_expression (ctx, op0,
7046 true, non_constant_p, overflow_p,
7047 jump_target);
where lval is always true, so the PARM_DECL 'yes' is not evaluated into
its value.
Fixed by always passing false for 'lval' in cxx_eval_logical_expression;
there's no case where we actually expect an lvalue from a TRUTH_*.
PR c++/105321
gcc/cp/ChangeLog:
* constexpr.cc (cxx_eval_logical_expression): Always pass false for lval
to cxx_eval_constant_expression.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-105321.C: New test.
Fritz Reese [Tue, 19 Apr 2022 20:45:46 +0000 (16:45 -0400)]
fortran: Fix conv of UNION constructors [PR105310]
This fixes an ICE when a UNION is the (1+8*2^n)-th field in a DEC
STRUCTURE when compiled with -finit-derived -finit-local-zero.
The problem was CONSTRUCTOR_APPEND_ELT from within gfc_conv_union_initializer
modified the vector pointer, but the pointer was passed by-value,
so the old pointer from the caller (gfc_conv_structure) pointed to freed
memory.
PR fortran/105310
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_union_initializer): Pass vec* by reference.
gcc/testsuite/ChangeLog:
* gfortran.dg/dec_union_12.f90: New test.
Patrick Palka [Thu, 21 Apr 2022 12:34:59 +0000 (08:34 -0400)]
libstdc++: Work around modules ICE in <charconv> [PR105297]
This makes the initializer for __table in __from_chars_alnum_to_val
dependent in an artificial way, which works around the reported modules
testsuite ICE by preventing the compiler from evaluating the initializer
parse time.
Compared to the alternative workaround of using a non-local class type
for __table, this workaround has the advantage of slightly speeding up
compilation of <charconv>, since now the table won't get built (via
constexpr evaluation) until the integer std::from_chars overload is
instantiated.
PR c++/105297
PR c++/105322
libstdc++-v3/ChangeLog:
* include/std/charconv (__from_chars_alnum_to_val): Make
initializer for __table dependent in an artificial way.
Jonathan Wakely [Thu, 21 Apr 2022 10:26:49 +0000 (11:26 +0100)]
libstdc++: Remove bogus assertion in std::from_chars [PR105324]
I'm not sure what I was thinking when I added this assertion, maybe it
was supposed to be alignment == 1 (which is what the pmr::string actually
uses). The simplest fix is to just remove the assertion.
The assertion is no longer enabled by default on trunk, but it's still
there for the --enablke-libstdcxx-debug build, and is still wrong. The
fix is needed on the gcc-11 branch.
libstdc++-v3/ChangeLog:
PR libstdc++/105324
* src/c++17/floating_from_chars.cc (buffer_resource::do_allocate):
Remove assertion.
* testsuite/20_util/from_chars/pr105324.cc: New test.
Martin Liska [Thu, 21 Apr 2022 08:17:34 +0000 (10:17 +0200)]
Support --compress-debug-sections for ld.mold.
gcc/ChangeLog:
* configure.ac: Enable compressed debug sections for mold
linker.
* configure: Regenerate.
Jakub Jelinek [Thu, 21 Apr 2022 07:43:30 +0000 (09:43 +0200)]
emit-rtl: Fix -fcompare-debug bug with label references in debug insns [PR105203]
When we compute LABEL_NUSES from scratch, mark_all_labels doesn't call
mark_jump_label on DEBUG_INSNs:
if (NONDEBUG_INSN_P (insn))
mark_jump_label (PATTERN (insn), insn, 0);
and so doesn't increment LABEL_NUSES from references in DEBUG_INSNs.
But, when we call emit_copy_of_insn_after e.g. when duplicating some
DEBUG_INSNs, we call it even on those, which then results in LABEL_NUSES
differences and -fcompare-debug failures.
The following patch makes sure we don't call it on DEBUG_INSNs.
2022-04-21 Jakub Jelinek <jakub@redhat.com>
PR debug/105203
* emit-rtl.cc (emit_copy_of_insn_after): Don't call mark_jump_label
on DEBUG_INSNs.
* gfortran.dg/g77/pr105203.f: New test.
Ian Lance Taylor [Wed, 20 Apr 2022 21:22:41 +0000 (14:22 -0700)]
runtime: use correct field name for PPC32 GLIBC registers
One of these days we will get this right.
Fixes PR go/105315
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401374
GCC Administrator [Thu, 21 Apr 2022 00:16:32 +0000 (00:16 +0000)]
Daily bump.
Ed Catmur [Mon, 18 Apr 2022 22:09:04 +0000 (23:09 +0100)]
c++: Fall through for arrays of T vs T cv [PR104996]
If two arrays do not have the exact same element type including
qualification, this could be e.g. f(int (&&)[]) vs. f(int const (&)[]),
which can still be distinguished by the lvalue-rvalue tiebreaker.
By tightening this branch (in accordance with the letter of the Standard) we
fall through to the next branch, which tests whether they have different
element type ignoring qualification and returns 0 in that case; thus we only
actually fall through in the T[...] vs. T cv[...] case, eventually
considering the lvalue-rvalue tiebreaker at the end of compare_ics.
Signed-off-by: Ed Catmur <ed@catmur.uk>
PR c++/104996
gcc/cp/ChangeLog:
* call.cc (compare_ics): When comparing list-initialization
sequences, do not return early.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist129.C: New test.
Jonathan Wakely [Wed, 20 Apr 2022 12:50:14 +0000 (13:50 +0100)]
libstdc++: Fix macro checked by test
The macro being tested here is wrong, but just happens to have the same
value as the one supposed to be tests.
libstdc++-v3/ChangeLog:
* testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc:
Check correct feature test macro.
Jonathan Wakely [Wed, 13 Apr 2022 13:09:33 +0000 (14:09 +0100)]
libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602]
This fixes missing libiconv symbols when libstdc++ is built on a system
that has libiconv installed. If the libiconv headers are found then
libstdc++ depends on libiconv_open etc instead of libc's iconv_open. But
without this fix libstdc++ is not linked to the libiconv library that
provides the definitions of those symbols.
As discussed in PR 93602 this changed means that libstdc++.so.6 might
have an rpath pointing to the location of the libiconv.so library. If
that is not desired, then GCC must be configured to link to a static
libiconv.a instead, using either --with-libiconv-type=static or an
in-tree build of libiconv.
libstdc++-v3/ChangeLog:
PR libstdc++/93602
* doc/xml/manual/prerequisites.xml: Document libiconv
workarounds.
* doc/html/manual/setup.html: Regenerate.
* src/Makefile.am (CXXLINK): Add $(LTLIBICONV).
* src/Makefile.in: Regenerate.
Richard Biener [Mon, 21 Mar 2022 13:08:25 +0000 (14:08 +0100)]
tree-optimization/104912 - ensure cost model is checked first
The following makes sure that when we build the versioning condition
for vectorization including the cost model check, we check for the
cost model and branch over other versioning checks. That is what
the cost modeling assumes, since the cost model check is the only
one accounted for in the scalar outside cost. Currently we emit
all checks as straight-line code combined with bitwise ops which
can result in surprising ordering of checks in the final assembly.
Since loop_version accepts only a single versioning condition
the splitting is done after the fact.
The result is a 1.5% speedup of 416.gamess on x86_64 when compiling
with -Ofast and tuning for generic or skylake. That's not enough
to recover from the slowdown when vectorizing but it now cuts off
the expensive alias versioning test.
2022-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/104912
* tree-vect-loop-manip.cc (vect_loop_versioning): Split
the cost model check to a separate BB to make sure it is
checked first and not combined with other version checks.
Richard Biener [Wed, 20 Apr 2022 08:17:24 +0000 (10:17 +0200)]
tree-optimization/105312 - fix ISEL VCOND expansion
The following aligns ISEL VEC_COND_EXPR expansion using VCOND
with the optab query done by vector lowering. Instead of only
allowing the signed optab to provide EQ/NE compares we allow both
here though since there seems to be no documented canonicalization.
2022-04-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/105312
* gimple-isel.cc (gimple_expand_vec_cond_expr): Query both
VCOND and VCONDU for EQ and NE.
* gcc.target/arm/pr105312.c: New testcase.
Jan Hubicka [Wed, 20 Apr 2022 09:00:33 +0000 (11:00 +0200)]
Fix overflows in ipa-modref-tree.cc
gcc/ChangeLog:
2022-04-20 Jan Hubicka <hubicka@ucw.cz>
PR ipa/103818
* ipa-modref-tree.cc (modref_access_node::closer_pair_p): Use
poly_offset_int to avoid overflow.
(modref_access_node::update2): likewise.
gcc/testsuite/ChangeLog:
2022-04-20 Jan Hubicka <hubicka@ucw.cz>
* gcc.c-torture/compile/103818.c: New test.
Jakub Jelinek [Wed, 20 Apr 2022 07:24:18 +0000 (09:24 +0200)]
cgraph: Fix up semantic_interposition handling [PR105306]
cgraph_node has a semantic_interposition flag which should mirror
opt_for_fn (decl, flag_semantic_interposition). But it actually is
initialized not from that, but from flag_semantic_interposition in the
explicit symtab_node (symtab_type t)
: type (t), resolution (LDPR_UNKNOWN), definition (false), alias (false),
...
semantic_interposition (flag_semantic_interposition),
...
x_comdat_group (NULL_TREE), x_section (NULL)
{}
ctor. I think that might be fine for varpool nodes, but since
flag_semantic_interposition is now implied from -Ofast it isn't correct
for cgraph nodes, unless we guarantee that cgraph node for a particular
function decl is always created while that function is
current_function_decl. That is often the case, but not always as the
following function shows.
Because symtab_node's ctor doesn't know for which decl the cgraph node
is being created, the following patch keeps that as is, but updates it from
opt_for_fn (decl, flag_semantic_interposition) when we know that, or for
clones copies that flag (often it is then overridden in
set_new_clone_decl_and_node_flags, but not always).
2022-04-20 Jakub Jelinek <jakub@redhat.com>
PR ipa/105306
* cgraph.cc (cgraph_node::create): Set node->semantic_interposition
to opt_for_fn (decl, flag_semantic_interposition).
* cgraphclones.cc (cgraph_node::create_clone): Copy over
semantic_interposition flag.
* g++.dg/opt/pr105306.C: New test.
GCC Administrator [Wed, 20 Apr 2022 00:16:26 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Tue, 19 Apr 2022 13:49:22 +0000 (06:49 -0700)]
libgo: make a couple of sed uses POSIX compliant
Patch from Jonathan Wakely.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401054
Sergei Trofimovich [Fri, 15 Apr 2022 07:35:27 +0000 (08:35 +0100)]
gcov-profile: Allow negative counts of indirect calls [PR105282]
TOPN metrics are histograms that contain overall count and per-bucket
count. Overall count can be negative when two profiles merge and some
of per-bucket metrics are disacarded.
Noticed as an ICE on python PGO build where gcc crashes as:
during IPA pass: modref
a.c:36:1: ICE: in stream_out_histogram_value, at value-prof.cc:340
36 | }
| ^
stream_out_histogram_value(output_block*, histogram_value_t*)
gcc/value-prof.cc:340
gcc/ChangeLog:
PR gcov-profile/105282
* value-prof.cc (stream_out_histogram_value): Allow negative counts
on HIST_TYPE_INDIR_CALL.
Richard Henderson [Tue, 19 Apr 2022 17:28:42 +0000 (10:28 -0700)]
MAINTAINERS: Update my email address.
2022-04-19 Richard Henderson <rth@gcc.gnu.org>
* MAINTAINERS: Update my email address.
Jakub Jelinek [Tue, 19 Apr 2022 16:58:59 +0000 (18:58 +0200)]
sparc: Preserve ORIGINAL_REGNO in epilogue_renumber [PR105257]
The following testcase ICEs, because the pic register is
(reg:DI 24 %i0 [109]) and is used in the delay slot of a return.
We invoke epilogue_renumber and that changes it to
(reg:DI 8 %o0) which no longer satisfies sparc_pic_register_p
predicate, so we don't recognize the insn anymore.
The following patch fixes that by preserving ORIGINAL_REGNO if
specified, so we get (reg:DI 8 %o0 [109]) instead.
2022-04-19 Jakub Jelinek <jakub@redhat.com>
PR target/105257
* config/sparc/sparc.cc (epilogue_renumber): If ORIGINAL_REGNO,
use gen_raw_REG instead of gen_rtx_REG and copy over also
ORIGINAL_REGNO. Use return 0; instead of /* fallthrough */.
* gcc.dg/pr105257.c: New test.
Jakub Jelinek [Tue, 19 Apr 2022 16:27:41 +0000 (18:27 +0200)]
c++: Fix up CONSTRUCTOR_PLACEHOLDER_BOUNDARY handling [PR105256]
The CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit is supposed to separate
PLACEHOLDER_EXPRs that should be replaced by one object or subobjects of it
(variable, TARGET_EXPR slot, ...) from other PLACEHOLDER_EXPRs that should
be replaced by different objects or subobjects.
The bit is set when finding PLACEHOLDER_EXPRs inside of a CONSTRUCTOR, not
looking into nested CONSTRUCTOR_PLACEHOLDER_BOUNDARY ctors, and we prevent
elision of TARGET_EXPRs (through TARGET_EXPR_NO_ELIDE) whose initializer
is a CONSTRUCTOR_PLACEHOLDER_BOUNDARY ctor. The following testcase ICEs
though, we don't replace the placeholders in there at all, because
CONSTRUCTOR_PLACEHOLDER_BOUNDARY isn't set on the TARGET_EXPR_INITIAL
ctor, but on a ctor nested in such a ctor. replace_placeholders should be
run on the whole TARGET_EXPR slot.
So, the following patch fixes it by moving the CONSTRUCTOR_PLACEHOLDER_BOUNDARY
bit from nested CONSTRUCTORs to the CONSTRUCTOR containing those (but only
if it is closely nested, if there is some other tree sandwiched in between,
it doesn't do it).
2022-04-19 Jakub Jelinek <jakub@redhat.com>
PR c++/105256
* typeck2.cc (process_init_constructor_array,
process_init_constructor_record, process_init_constructor_union): Move
CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag from CONSTRUCTOR elements to the
containing CONSTRUCTOR.
* g++.dg/cpp0x/pr105256.C: New test.
Richard Biener [Wed, 13 Apr 2022 11:49:45 +0000 (13:49 +0200)]
tree-optimization/104010 - fix SLP scalar costing with patterns
When doing BB vectorization the scalar cost compute is derailed
by patterns, causing lanes to be considered live and thus not
costed on the scalar side. For the testcase in PR104010 this
prevents vectorization which was done by GCC 11. PR103941
shows similar cases of missed optimizations that are fixed by
this patch.
2022-04-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/104010
PR tree-optimization/103941
* tree-vect-slp.cc (vect_bb_slp_scalar_cost): When
we run into stmts in patterns continue walking those
for uses outside of the vectorized region instead of
marking the lane live.
* gcc.target/i386/pr103941-1.c: New testcase.
* gcc.target/i386/pr103941-2.c: Likewise.
Patrick Palka [Tue, 19 Apr 2022 14:20:04 +0000 (10:20 -0400)]
libstdc++: Stop defining _GLIBCXX_ASSERTIONS in floating_to_chars.cc
Assertions were originally enabled in the compiled-in floating-point
std::to_chars implementation to help shake out any bugs, but they
apparently impose a significant performance penalty, most notably for
the hex formatting which is around 25% slower with assertions enabled.
This seems too high a cost for unconditionally enabling them.
The newly added calls to __builtin_unreachable work around the compiler
no longer knowing that the set of valid values of 'fmt' is limited (which
was previously upheld by an assert).
libstdc++-v3/ChangeLog:
* src/c++17/floating_to_chars.cc (_GLIBCXX_ASSERTIONS): Don't
define.
(__floating_to_chars_shortest): Add __builtin_unreachable calls to
squelch false-positive -Wmaybe-uninitialized and -Wreturn-type
warnings.
(__floating_to_chars_precision): Likewise.
Philipp Fent [Thu, 14 Apr 2022 16:06:02 +0000 (17:06 +0100)]
libstdc++: Add pretty printer for std::span
This improves the debug output for C++20 spans.
Before:
{static extent =
18446744073709551615, _M_ptr = 0x7fffffffb9a8, _M_extent = {_M_extent_value = 2}}
Now with StdSpanPrinter:
std::span of length 2 = {1, 2}
Signed-off-by: Philipp Fent <fent@in.tum.de>
libstdc++-v3/ChangeLog:
* python/libstdcxx/v6/printers.py (StdSpanPrinter): Define.
* testsuite/libstdc++-prettyprinters/cxx20.cc: Test it.
Richard Biener [Tue, 19 Apr 2022 11:48:02 +0000 (13:48 +0200)]
tree-optimization/104880 - move testcase
This renames the testcase to something picked up by the suites regexp.
2022-04-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/104880
* g++.dg/opt/pr104880.cc: Rename to ...
* g++.dg/opt/pr104880.C: ... this.
Jonathan Wakely [Tue, 19 Apr 2022 08:55:30 +0000 (09:55 +0100)]
libstdc++: Fix syntax error in libbacktrace configuration
Using == instead of = causes a configuration error with dash as the
shell:
checking whether to build libbacktrace support... /home/devel/building/work/src/gcc-12-
20220417/libstdc++-v3/configure: 77471: test: auto: unexpected operator
/home/devel/building/work/src/gcc-12-
20220417/libstdc++-v3/configure: 77474: test: auto: unexpected operator
auto
This means we fail to change the value from "auto" to "no" and so this
test passes:
GLIBCXX_CONDITIONAL(ENABLE_BACKTRACE, [test "$enable_libstdcxx_backtrace" != no])
This leads to the libbacktrace directory being included in the build
without being configured properly, and bootstrap fails.
libstdc++-v3/ChangeLog:
* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Fix shell operators.
* configure: Regenerate.
GCC Administrator [Tue, 19 Apr 2022 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Hans-Peter Nilsson [Mon, 18 Apr 2022 22:30:43 +0000 (00:30 +0200)]
doc/install.texi: CRIS: Remove gone websites. Adjust CRIS targets
That is, support for cris-linux-gnu was removed in gcc-11, but
install.texi wasn't adjusted accordingly. Also, unfortunately the
developer-related sites are gone with no replacements. And, CRIS is
used in other chip series as well, but allude rather than list.
The generated manpages, info, pdf and html were sanity-checked.
gcc:
* doc/install.texi <CRIS>: Remove references to removed websites and
adjust for cris-*-elf being the only remaining toolchain.
Hans-Peter Nilsson [Mon, 18 Apr 2022 22:30:24 +0000 (00:30 +0200)]
doc/invoke.texi: CRIS: Remove references to cris-axis-linux-gnu
...and related options. These stale bits were overlooked when support
for "Linux/GNU" and CRIS v32 was removed, before the gcc-11 release.
Resulting pdf, html and info inspected for sanity.
gcc:
* doc/invoke.texi <CRIS>: Remove references to options for removed
subtarget cris-axis-linux-gnu and tweak wording accordingly.
Sören Tempel [Fri, 15 Apr 2022 09:04:15 +0000 (11:04 +0200)]
libgo: only add signum to siglist if it doesn't exist yet
This fixes a build issue on musl libc where the same signal number
is used for SIGIO and SIGPOLL. This causes a compilation error since
the signal numbers must be unique for the signal table.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400595
A. Wilcox [Sun, 30 Aug 2020 15:30:07 +0000 (17:30 +0200)]
runtime: add special handling for signal 34
The musl libc uses signal 34 internally for setgid (similar to how glibc
uses signal 32 and signal 33). For this reason, special handling is
needed for this signal in the runtime. The gc implementation already
handles the signal accordingly. As such, this commit intends to
simply copy the behavior of the Google Go implementation to libgo.
See https://go.dev/issues/39343
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400594
Patrick Palka [Mon, 18 Apr 2022 21:22:55 +0000 (17:22 -0400)]
libstdc++: Micro-optimize __from_chars_pow2_base
In the first iteration of __from_chars_pow2_base's main loop, we need
to remember the value of the leading significant digit for sake of the
overflow check at the end (for base > 2).
This patch manually unrolls this first iteration so as to not encumber
the entire loop with logic that only the first iteration needs. This
seems to significantly improve performance:
Base Before After (seconds, lower is better)
2 9.36 9.37
8 3.66 2.93
16 2.93 1.91
32 2.39 2.24
libstdc++-v3/ChangeLog:
* include/std/charconv (__from_chars_pow2_base): Manually
unroll the first iteration of the main loop and simplify
accordingly.
Kewen Lin [Mon, 18 Apr 2022 02:34:51 +0000 (21:34 -0500)]
testsuite: Skip pr105250.c for powerpc and s390 [PR105266]
This test case pr105250.c is like its related pr105140.c, which
suffers the error with message like "{AltiVec,vector} argument
passed to unprototyped" on powerpc and s390. So like commits
r12-8025 and r12-8039, this fix is to add the dg-skip-if for
powerpc*-*-* and s390*-*-*.
gcc/testsuite/ChangeLog:
PR testsuite/105266
* gcc.dg/pr105250.c: Skip for powerpc*-*-* and s390*-*-*.
GCC Administrator [Mon, 18 Apr 2022 00:16:32 +0000 (00:16 +0000)]
Daily bump.
GCC Administrator [Sun, 17 Apr 2022 00:16:26 +0000 (00:16 +0000)]
Daily bump.
Gerald Pfeifer [Sat, 16 Apr 2022 13:29:34 +0000 (07:29 -0600)]
doc: Adjust mingw-w64 download link
gcc:
* doc/install.texi (Specific): Adjust mingw-w64 download link.
GCC Administrator [Sat, 16 Apr 2022 00:16:31 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Sat, 26 Mar 2022 00:23:50 +0000 (17:23 -0700)]
compiler: revert `for package-scope "a = b; b = x" just set "a = x"`
Revert CL 245098. It caused incorrect initialization ordering.
Adjust the runtime package to work even with the CL reverted.
Original description of CL 245098:
This avoids requiring an init function to initialize the variable.
This can only be done if x is a static initializer.
The go1.15rc1 runtime package relies on this optimization.
The package has a variable "var maxSearchAddr = maxOffAddr".
The maxSearchAddr variable is used by code that runs before package
initialization is complete.
For golang/go#51913
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/395994
Patrick Palka [Fri, 15 Apr 2022 18:41:14 +0000 (14:41 -0400)]
libstdc++: Avoid double-deref of __first in ranges::minmax [PR104858]
PR libstdc++/104858
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__minmax_fn): Avoid dereferencing
__first twice at the start.
* testsuite/25_algorithms/minmax/constrained.cc (test06): New test.
Paul A. Clarke [Mon, 21 Feb 2022 18:24:58 +0000 (12:24 -0600)]
rs6000: Move more g++.dg powerpc tests to g++.target
Also adjust DejaGnu directives, as specifically requiring "powerpc*-*-*" is no
longer required.
2022-04-15 Paul A. Clarke <pc@us.ibm.com>
gcc/testsuite
* g++.dg/debug/dwarf2/const2.C: Move to g++.target/powerpc.
* g++.dg/other/darwin-minversion-1.C: Likewise.
* g++.dg/eh/ppc64-sighandle-cr.C: Likewise.
* g++.dg/eh/simd-5.C: Likewise.
* g++.dg/eh/simd-4.C: Move to g++.target/powerpc, adjust dg directives.
* g++.dg/eh/uncaught3.C: Likewise.
* g++.dg/other/spu2vmx-1.C: Likewise.
Marek Polacek [Thu, 14 Apr 2022 17:48:15 +0000 (13:48 -0400)]
c++: wrong error with variadic concept [PR105268]
Here we issue a wrong error for the
template<typename T = S<C_many<int>>> void g();
line in the testcase. I surmise that's because we mistakenly parse
C_many<int> as a placeholder-type-specifier, and things go wrong from
there. We are in a default argument so we should reject parsing C_many<int>
as a placeholder-type-specifier, which would mean creating a new parameter.
We want C_many<int> to be a concept-id instead.
It's interesting to see why the same problem didn't occur for C_one<int>.
In that case, cp_parser_placeholder_type_specifier -> finish_type_constraints
-> build_type_constraint -> build_concept_check -> build_standard_check ->
coerce_template_parms fails the parse here:
8916 nargs = inner_args ? NUM_TMPL_ARGS (inner_args) : 0;
8917 if ((nargs - variadic_args_p > nparms && !variadic_p)
8918 || (nargs < nparms - variadic_p
8919 && require_all_args
8920 && !variadic_args_p
8921 && (!use_default_args
8922 || (TREE_VEC_ELT (parms, nargs) != error_mark_node
8923 && !TREE_PURPOSE (TREE_VEC_ELT (parms, nargs))))))
8924 {
8925 bad_nargs:
...
8943 return error_mark_node;
because nargs is 2 (the targs are <WILDCARD_DECL, int>) while nparms is
1 (for the one 'typename' in the tparam list of C_one). But for
C_many<int> variadic_p is true so we don't return error_mark_node but
<type_argument_pack>.
This patch does not issue any error for the !tentative case because
I didn't figure out how to trigger that. So it adds an assert instead.
PR c++/105268
gcc/cp/ChangeLog:
* parser.cc (cp_parser_placeholder_type_specifier): Return
error_mark_node when trying to build up a constrained parameter in
a default argument.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/variadic6.C: New test.
Patrick Palka [Fri, 15 Apr 2022 13:34:09 +0000 (09:34 -0400)]
libstdc++: Optimize integer std::from_chars
This applies the following optimizations to the integer std::from_chars
implementation:
1. Use a lookup table for converting an alphanumeric digit to its
base-36 value instead of using a range test (for 0-9) and switch
(for a-z and A-Z). The table is constructed using a C++14
constexpr function which doesn't assume a particular character
encoding or __CHAR_BIT__ value. This new conversion function
__from_chars_alnum_to_val is templated on whether we care
only about the decimal digits, in which case we can perform the
conversion with a single subtraction since the digit characters
are guaranteed to be contiguous (unlike the letters).
2. Generalize __from_chars_binary to handle all power-of-two bases.
This function (now named __from_chars_pow2_base) is also templated
on whether we care only about the decimal digits for the benefit of
faster digit conversion for base 2, 4 and 8.
3. In __from_chars_digit, use
static_cast<unsigned char>(__c - '0') < __base
instead of
'0' <= __c && __c <= ('0' + (__base - 1)).
as the digit recognition test (exhaustively verified that the two
tests are equivalent).
4. In __from_chars_alnum, use a nested loop to consume the rest of the
digits in the overflow case (mirroring __from_chars_digit) so that
the main loop doesn't have to maintain the overflow flag __valid.
At this point, __from_chars_digit is nearly identical to
__from_chars_alnum, so this patch merges the two functions by removing
the former and templatizing the latter according to whether we care only
about the decimal digits. Finally,
5. In __from_chars_alnum, maintain a lower bound on the number of
unused bits in the result and use it to omit the overflow check
when it's safe to do so.
In passing, this patch replaces the non-portable function ascii_to_hexit
used by __floating_from_chars_hex with the new conversion function.
Some runtime measurements for a simple 15-line benchmark that roundtrips
printing/parsing 200 million integers via std::to/from_chars (average of
5 runs):
Base Before After (seconds, lower is better)
2 9.37 9.37
3 15.79 12.13
8 4.15 3.67
10 4.90 3.86
11 6.84 5.03
16 4.14 2.93
32 3.85 2.39
36 5.22 3.26
libstdc++-v3/ChangeLog:
* include/std/charconv (__from_chars_alnum_to_val_table): Define.
(__from_chars_alnum_to_val): Define.
(__from_chars_binary): Rename to ...
(__from_chars_pow2_base): ... this. Generalize to handle any
power-of-two base using __from_chars_alnum_to_val.
(__from_chars_digit): Optimize digit recognition to a single
test instead of two tests. Use [[__unlikely___]] attribute.
(__from_chars_alpha_to_num): Remove.
(__from_chars_alnum): Use __from_chars_alnum_to_val. Use a
nested loop for the overflow case. Maintain a lower bound
on the number of available bits in the result and use it to
omit the overflow check.
(from_chars): Adjust appropriately.
* src/c++17/floating_from_chars.cc (ascii_to_hexit): Remove.
(__floating_from_chars_hex): Use __from_chars_alnum_to_val
to recognize a hex digit instead.
Hongyu Wang [Fri, 15 Apr 2022 02:51:06 +0000 (10:51 +0800)]
i386: Correct target attribute for crc32 intrinsics
Complile _mm_crc32_u8/16/32/64 intrinsics with -mcrc32
would meet target specific option mismatch. Correct target pragma
to fix.
gcc/ChangeLog:
* config/i386/smmintrin.h: Correct target pragma from sse4.1
and sse4.2 to crc32 for crc32 intrinsics.
gcc/testsuite/ChangeLog:
* gcc.target/i386/crc32-6.c: Adjust dg-error message.
* gcc.target/i386/crc32-7.c: New test.
Jason Merrill [Thu, 14 Apr 2022 21:49:47 +0000 (17:49 -0400)]
c++: unsigned int32_t enum promotion [PR102804]
There's been an extension for a long time to allow applying 'unsigned' to an
int typedef, but that was confusing the integer promotion code. Fixed by
forgetting about the typedef in that case.
I'm going to make this an unconditional pedwarn in stage 1.
PR c++/102804
gcc/cp/ChangeLog:
* decl.cc (grokdeclarator): Drop typedef used with 'unsigned'.
gcc/testsuite/ChangeLog:
* g++.dg/ext/unsigned-typedef1.C: New test.
Jason Merrill [Thu, 14 Apr 2022 21:35:35 +0000 (17:35 -0400)]
c++: using in diagnostics [PR102987]
The expression pretty-printing code crashed on a location wrapper with no
type, and didn't know what to do with a USING_DECL.
PR c++/102987
gcc/cp/ChangeLog:
* error.cc (dump_expr): Handle USING_DECL.
[VIEW_CONVERT_EXPR]: Just look through location wrapper.
gcc/testsuite/ChangeLog:
* g++.dg/diagnostic/using1.C: New test.
GCC Administrator [Fri, 15 Apr 2022 00:16:48 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Thu, 14 Apr 2022 22:58:51 +0000 (22:58 +0000)]
Update gcc de.po, fr.po, sv.po
* de.po, fr.po, sv.po: Update.