Alex Coplan [Fri, 21 Aug 2020 13:26:11 +0000 (14:26 +0100)]
driver: Fix several memory leaks [PR63854]
This patch fixes several memory leaks in the driver, all of which relate
to the handling of static specs. We introduce functions
set_static_spec_{shared,owned}() which are used to enforce proper memory
management when updating the strings in the static_specs table.
This is achieved by making use of the alloc_p field in the table
entries. Similarly to set_spec(), each time we update an entry, we check
whether alloc_p is set, and free the old value if so. We then set
alloc_p correctly based on whether we "own" this memory or whether we're
just taking a pointer to a shared string which we shouldn't free.
The following table shows the number of leaks found by AddressSanitizer
when running a minimal libgccjit program on AArch64. The test program
does the whole libgccjit compilation cycle in a loop (including acquiring
and releasing the context), and the table below shows the number of leaks
for different iterations of that loop.
+--------------+-----+-----+------+---------------+
| # of runs > | 1 | 2 | 3 | Leaks per run |
+--------------+-----+-----+------+---------------+
| Before patch | 463 | 940 | 1417 | 477 |
+--------------+-----+-----+------+---------------+
| After patch | 416 | 846 | 1276 | 430 |
+--------------+-----+-----+------+---------------+
gcc/ChangeLog:
PR jit/63854
* gcc.c (set_static_spec): New.
(set_static_spec_owned): New.
(set_static_spec_shared): New.
(driver::maybe_putenv_COLLECT_LTO_WRAPPER): Use
set_static_spec_owned() to take ownership of lto_wrapper_file
such that it gets freed in driver::finalize.
(driver::maybe_run_linker): Use set_static_spec_shared() to
ensure that we don't try and free() the static string "ld",
also ensuring that any previously-allocated string in
linker_name_spec is freed. Likewise with argv0.
(driver::finalize): Use set_static_spec_shared() when resetting
specs that previously had allocated strings; remove if(0)
around call to free().
Senthil Kumar Selvaraj [Thu, 13 Aug 2020 07:49:26 +0000 (13:19 +0530)]
Allow try_split to split RTX_FRAME_RELATED_P insns
Instead of rejecting RTX_FRAME_RELATED_P insns, allow try_split to split
such insns, provided the split is after reload, and the result of the split
is a single insn.
recog.c:peep2_attempt already splits an RTX_FRAME_RELATED_P insn splitting
to a single insn. This patch refactors existing code copying frame related
info to a separate function (copy_frame_info_to_split_insn) and calls it
from both peep2_attempt and try_split.
2020-08-21 Senthil Kumar Selvaraj <saaadhu@gcc.gnu.org>
gcc/ChangeLog:
* emit-rtl.c (try_split): Call copy_frame_info_to_split_insn
to split certain RTX_FRAME_RELATED_P insns.
* recog.c (copy_frame_info_to_split_insn): New function.
(peep2_attempt): Split copying of frame related info of
RTX_FRAME_RELATED_P insns into above function and call it.
* recog.h (copy_frame_info_to_split_insn): Declare it.
Jonathan Wakely [Fri, 21 Aug 2020 11:01:05 +0000 (12:01 +0100)]
libstdc++: Skip PSTL tests when installed TBB is too old [PR 96718]
These tests do not actually require TBB, because they only inspect the
feature test macros present in the headers. However, if TBB is installed
then its headers will be included, and the version will be checked. If
the version is too old, compilation fails due to a #error directive.
This change disables the tests if TBB is not present, so that we skip
them instead of failing.
libstdc++-v3/ChangeLog:
PR libstdc++/96718
* testsuite/25_algorithms/pstl/feature_test-2.cc: Require
tbb-backend effective target.
* testsuite/25_algorithms/pstl/feature_test-3.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test-5.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test.cc: Likewise.
liuhongt [Thu, 13 Aug 2020 06:20:43 +0000 (14:20 +0800)]
Enable bitwise operation for type mask.
Enable operator or/xor/and/andn/not for mask register, kxnor is not
enabled since there's no corresponding instruction for general
registers.
gcc/
PR target/88808
* config/i386/i386.c (ix86_preferred_reload_class): Allow
QImode data go into mask registers.
* config/i386/i386.md: (*movhi_internal): Adjust constraints
for mask registers.
(*movqi_internal): Ditto.
(*anddi_1): Support mask register operations
(*and<mode>_1): Ditto.
(*andqi_1): Ditto.
(*andn<mode>_1): Ditto.
(*<code><mode>_1): Ditto.
(*<code>qi_1): Ditto.
(*one_cmpl<mode>2_1): Ditto.
(*one_cmplsi2_1_zext): Ditto.
(*one_cmplqi2_1): Ditto.
(define_peephole2): Move constant 0/-1 directly into mask
registers.
* config/i386/predicates.md (mask_reg_operand): New predicate.
* config/i386/sse.md (define_split): Add post-reload splitters
that would convert "generic" patterns to mask patterns.
(*knotsi_1_zext): New define_insn.
gcc/testsuite/
* gcc.target/i386/bitwise_mask_op-1.c: New test.
* gcc.target/i386/bitwise_mask_op-2.c: New test.
* gcc.target/i386/bitwise_mask_op-3.c: New test.
* gcc.target/i386/avx512bw-pr88465.c: New testcase.
* gcc.target/i386/avx512bw-kunpckwd-1.c: Adjust testcase.
* gcc.target/i386/avx512bw-kunpckwd-3.c: Ditto.
* gcc.target/i386/avx512dq-kmovb-5.c: Ditto.
* gcc.target/i386/avx512f-kmovw-5.c: Ditto.
* gcc.target/i386/pr55342.c: Ditto.
liuhongt [Thu, 24 Oct 2019 03:13:00 +0000 (11:13 +0800)]
According to instruction_tables.pdf
1. Set cost of movement inside mask registers a bit higher than gpr's.
2. Set cost of movement between mask register and gpr much higher than movement
inside gpr, but still less equal than load/store.
3. Set cost of mask register load/store a bit higher than gpr load/store.
gcc/
* config/i386/x86-tune-costs.h (skylake_cost): Adjust cost
model.
liuhongt [Thu, 6 Aug 2020 05:48:38 +0000 (13:48 +0800)]
Enable direct movement between gpr and mask registers in pass_reload.
Changelog
gcc/
* config/i386/i386.c (inline_secondary_memory_needed):
No memory is needed between mask regs and gpr.
(ix86_hard_regno_mode_ok): Add condition TARGET_AVX512F for
mask regno.
* config/i386/i386.h (enum reg_class): Add INT_MASK_REGS.
(REG_CLASS_NAMES): Ditto.
(REG_CLASS_CONTENTS): Ditto.
* config/i386/i386.md: Exclude mask register in
define_peephole2 which is avaiable only for gpr.
gcc/testsuite/
* gcc.target/i386/spill_to_mask-1.c: New tests.
* gcc.target/i386/spill_to_mask-2.c: New tests.
* gcc.target/i386/spill_to_mask-3.c: New tests.
* gcc.target/i386/spill_to_mask-4.c: New tests.
H.J. Lu [Tue, 3 Sep 2019 21:41:02 +0000 (14:41 -0700)]
x86: Add cost model for operation of mask registers.
gcc/
PR target/71453
* config/i386/i386.h (struct processor_costs): Add member
mask_to_integer, integer_to_mask, mask_load[3], mask_store[3],
mask_move.
* config/i386/x86-tune-costs.h (ix86_size_cost, i386_cost,
i386_cost, pentium_cost, lakemont_cost, pentiumpro_cost,
geode_cost, k6_cost, athlon_cost, k8_cost, amdfam10_cost,
bdver_cost, znver1_cost, znver2_cost, skylake_cost,
btver1_cost, btver2_cost, pentium4_cost, nocona_cost,
atom_cost, slm_cost, intel_cost, generic_cost, core_cost):
Initialize mask_load[3], mask_store[3], mask_move,
integer_to_mask, mask_to_integer for all target costs.
* config/i386/i386.c (ix86_register_move_cost): Using cost
model of mask registers.
(inline_memory_move_cost): Ditto.
(ix86_register_move_cost): Ditto.
David Malcolm [Thu, 20 Aug 2020 21:50:14 +0000 (17:50 -0400)]
analyzer: add regression tests [PR95152]
PR analyzer/95152 reports various ICEs in
region_model::get_or_create_mem_ref.
I removed this function as part of the state rewrite in
r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d.
I've verified that these two test cases reproduce the issue with 10.2
and don't ICE with trunk; adding them as regression tests.
gcc/testsuite/ChangeLog:
PR analyzer/95152
* gcc.dg/analyzer/pr95152-4.c: New test.
* gcc.dg/analyzer/pr95152-5.c: New test.
GCC Administrator [Fri, 21 Aug 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Iain Buclaw [Thu, 20 Aug 2020 16:18:40 +0000 (18:18 +0200)]
d: Merge upstream dmd
1b5a53d01.
Fixes an ICE in setValue at dmd/dinterpret.c:7046
This was originally seen when running the testsuite for a 16-bit target,
however, it could be reproduced on 32-bit using long[] as well.
Reviewed-on: https://github.com/dlang/dmd/pull/11547
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
1b5a53d01.
David Malcolm [Thu, 20 Aug 2020 14:00:49 +0000 (10:00 -0400)]
analyzer: fix infinite recursion ICE on unions [PR96723]
Attempts to store sm-state into a union in C++ triggered an infinite
recursion when trying to generate a representative tree, due to
erroneously trying to use the dtor of the union as a field.
Fix it by filtering out non-FIELD_DECLs when walking TYPE_FIELDs
in region::get_subregions_for_binding.
gcc/analyzer/ChangeLog:
PR analyzer/96723
* region-model-manager.cc
(region_model_manager::get_field_region): Assert that field is a
FIELD_DECL.
* region.cc (region::get_subregions_for_binding): In
union-handling, filter the TYPE_FIELDS traversal to just FIELD_DECLs.
gcc/testsuite/ChangeLog:
PR analyzer/96723
* g++.dg/analyzer/pr96723.C: New test.
Jonathan Wakely [Thu, 20 Aug 2020 20:56:43 +0000 (21:56 +0100)]
libstdc++: Fix typo in ChangeLog
Tobias Burnus [Thu, 20 Aug 2020 19:59:00 +0000 (21:59 +0200)]
configure: Also check C++11 (flags) for ${build} compiler not only for ${host}
config/ChangeLog:
PR bootstrap/96612
* ax_cxx_compile_stdcxx.m4: Add fourth argument to check also
the CXX_FOR_BUILD compiler.
ChangeLog:
PR bootstrap/96612
* configure.ac: Run AX_CXX_COMPILE_STDCXX also for ${build} compiler,
if not the same as ${host}.
* configure: Regenerate.
Jonathan Wakely [Thu, 20 Aug 2020 18:41:15 +0000 (19:41 +0100)]
libstdc++: Make incrementable<__int128> satisfied in strict mode
This adds specializations of std::incrementable_traits so that 128-bit
integers are always considered incrementable (and therefore usable with
std::ranges::iota_view) even when they don't satisfy std::integral.
libstdc++-v3/ChangeLog:
* include/bits/iterator_concepts.h [__STRICT_ANSI__]
(incrementable_traits<__int128>): Define specialization.
(incrementable_traits<unsigned __int128>): Likewise.
* testsuite/std/ranges/iota/96042.cc: Test iota_view with
__int128.
Paul Thomas [Thu, 20 Aug 2020 17:17:59 +0000 (18:17 +0100)]
This patch fixes PRs 96100 and 96101.
2020-08-20 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/96100
PR fortran/96101
* trans-array.c (get_array_charlen): Tidy up the evaluation of
the string length for array constructors. Avoid trailing array
references. Ensure string lengths of deferred length components
are set. For parentheses operator apply string length to both
the primary expression and the enclosed expression.
gcc/testsuite/
PR fortran/96100
PR fortran/96101
* gfortran.dg/char_length_23.f90: New test.
Iain Buclaw [Thu, 20 Aug 2020 16:02:58 +0000 (18:02 +0200)]
vxworks: Fix GCC selftests for *-wrs-vxworks7-* targets
Currently when building a cross-compiler targeting arm-wrs-vxworks7, the
self-tests fail unless the VSB_DIR environment variable is set.
This prevents attempts at designating the location of runtime header
files, libraries or startfiles, which would fail on unset environment
variables and aren't needed for such tests.
gcc/ChangeLog:
* config/vxworks.h (VXWORKS_ADDITIONAL_CPP_SPEC): Don't include
VxWorks header files if -fself-test is used.
(STARTFILE_PREFIX_SPEC): Avoid using VSB_DIR if -fself-test is used.
Andre Vehreschild [Thu, 20 Aug 2020 15:50:16 +0000 (17:50 +0200)]
Fix obvious typo were errmsg_len was assigned to errmsg.
gcc/fortran/ChangeLog:
2020-08-20 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/94958
* trans-array.c (gfc_bcast_alloc_comp): Use the correct variable.
Joe Ramsay [Wed, 19 Aug 2020 12:34:06 +0000 (12:34 +0000)]
arm: Require MVE memory operand for destination of vst1q intrinsic
Previously, the machine description patterns for vst1q accepted a generic memory
operand for the destination, which could lead to an unrecognised builtin when
expanding vst1q* intrinsics. This change fixes the pattern to only accept MVE
memory operands.
gcc/ChangeLog:
PR target/96683
* config/arm/mve.md (mve_vst1q_f<mode>): Require MVE memory operand for
destination.
(mve_vst1q_<supf><mode>): Likewise.
gcc/testsuite/ChangeLog:
PR target/96683
* gcc.target/arm/mve/intrinsics/vst1q_f16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_s16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_s8.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_u16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_u8.c: New test.
Chung-Lin Tang [Thu, 20 Aug 2020 14:18:51 +0000 (07:18 -0700)]
libgomp: adjust nvptx_free callback context checking
Change test for CUDA callback context in nvptx_free() from using
GOMP_PLUGIN_acc_thread () into checking for CUDA_ERROR_NOT_PERMITTED,
for the former only works for OpenACC, but not OpenMP offloading.
2020-08-20 Chung-Lin Tang <cltang@codesourcery.com>
libgomp/
* plugin/plugin-nvptx.c (nvptx_free):
Change "GOMP_PLUGIN_acc_thread () == NULL" test into check of
CUDA_ERROR_NOT_PERMITTED status for cuMemGetAddressRange. Adjust
comments.
Tobias Burnus [Thu, 20 Aug 2020 11:33:21 +0000 (13:33 +0200)]
Fortran: Fix OpenMP's 'if(simd:' etc. conditions
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_omp_clauses): Re-order 'if' clause pasing
to avoid creating spurious symbols.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/lastprivate-conditional-10.f90: New test.
Christophe Lyon [Thu, 20 Aug 2020 09:03:10 +0000 (09:03 +0000)]
testsuite: Remove test for arm32 in arm_soft_ok
There is no reason to check for arm32 when checking for
-mfloat=abi-soft support. Instead this implies skipping some tests
when targetting a thumb-1 cpu, while they pass.
This patch removes the arm32 check, and uses the same skeleton as
arm_softfp_ok and arm_hard_ok.
2020-08-20 Christophe Lyon <christophe.lyon@linaro.org>
gcc/testsuite/
* lib/target-supports.exp (arm_soft_ok): Remove arm32 check.
Christophe Lyon [Thu, 20 Aug 2020 08:51:01 +0000 (08:51 +0000)]
testsuite: Skip arm/pure-code tests for arm*-*-uclinuxfdpiceabi
FDPIC it uses PIC code, which is incompatible with -mpure-code, so we
want to skip these tests for arm*-*-uclinuxfdpiceabi.
This patch also fixes a typo where the final closing bracket was
commented out.
2020-08-20 Christophe Lyon <christophe.lyon@linaro.org>
gcc/testsuite/
* gcc.target/arm/pure-code/pure-code.exp: Skip for
arm*-*-uclinuxfdpiceabi. Fix missing closing bracket.
Mark Eggleston [Tue, 4 Aug 2020 13:10:08 +0000 (14:10 +0100)]
Fortran : rejected f0.d edit descriptor PR96436
Zero length f format descriptors are valid for Fortran 95 and
later. For g format descriptors from Fortran 2008 and later.
Finally for D, E, EN and ES for Fortran 2018 and later.
2020-08-20 Mark Eggleston <markeggleston@gcc.gnu.org>
libgfortran/
PR fortran/96436
* io/format.c (parse_format_list): Add new local variable
"standard" to hold the required standard to check. If the
format width is zero select standard depending on descriptor.
Call notification_std using the new standard variable.
2020-08-20 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/96436
* gfortran.dg/pr96436_1.f90: New test.
* gfortran.dg/pr96436_2.f90: New test.
* gfortran.dg/pr96436_3.f90: New test.
* gfortran.dg/pr96436_4.f90: New test.
* gfortran.dg/pr96436_5.f90: New test.
* gfortran.dg/pr96436_6.f90: New test.
* gfortran.dg/pr96436_7.f90: New test.
* gfortran.dg/pr96436_8.f90: New test.
* gfortran.dg/pr96436_9.f90
* gfortran.dg/pr96436_10.f90
David Malcolm [Wed, 19 Aug 2020 21:36:53 +0000 (17:36 -0400)]
analyzer: fix ICE on vector comparisons [PR96713]
gcc/analyzer/ChangeLog:
PR analyzer/96713
* region-model.cc (region_model::get_gassign_result): For
comparisons, only use eval_condition when the lhs has boolean
type, and use get_or_create_constant_svalue on the boolean
constants directly rather than via get_rvalue.
gcc/testsuite/ChangeLog:
PR analyzer/96713
* gcc.dg/analyzer/pr96713.c: New test.
GCC Administrator [Thu, 20 Aug 2020 00:16:34 +0000 (00:16 +0000)]
Daily bump.
Jason Merrill [Mon, 17 Aug 2020 20:36:33 +0000 (16:36 -0400)]
c++: Check satisfaction before non-dep convs. [CWG2369]
It's very hard to use concepts to protect a template from hard errors due to
unwanted instantiation if constraints aren't checked until after doing all
substitution and checking of non-dependent conversions.
It was pretty straightforward to insert the satisfaction check into the
logic, but I needed to make the 3-parameter version of
satisfy_declaration_constraints call push_tinst_level like the 2-parameter
version already does. For simplicity, I also made it add any needed outer
template arguments from the TEMPLATE_DECL to the args.
The testsuite changes are mostly because this change causes unsatisfaction
to cause deduction to fail rather than reject the candidate later in
overload resolution.
gcc/cp/ChangeLog:
DR 2369
* cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
* constraint.cc (satisfy_declaration_constraints):
Use add_outermost_template_args and push_tinst_level.
* pt.c (add_outermost_template_args): Handle getting
a TEMPLATE_DECL as the first argument.
(push_tinst_level, push_tinst_level_loc): No longer static.
(fn_type_unification): Check satisfaction before non-dependent
conversions.
gcc/testsuite/ChangeLog:
DR 2369
* g++.dg/concepts/diagnostic10.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic13.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic2.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic3.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic4.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic5.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic9.C: Adjust expexcted errors.
* g++.dg/concepts/expression2.C: Adjust expexcted errors.
* g++.dg/concepts/fn5.C: Adjust expexcted errors.
* g++.dg/concepts/placeholder5.C: Adjust expexcted errors.
* g++.dg/concepts/pr67595.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-pr78752-2.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-pr84140.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-recursive-sat3.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-requires18.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-requires19.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts3.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-nondep1.C: New test.
* g++.dg/cpp2a/concepts-nondep1a.C: New test.
Jonathan Wakely [Wed, 19 Aug 2020 19:36:10 +0000 (20:36 +0100)]
libstdc++: Make make-unsigned-like-t<__int128> work [PR 96042]
As well as ensuring that numeric_limits<__int128> is defined, we need to
ensure that make-unsigned-like-t and to-unsigned-like work correctly for
128-bit integers in strict mode. This ensures that a subrange created
from an iota_view's iterator and sentinel can represent its size.
Co-authored-by: Patrick Palka <ppalka@redhat.com>
libstdc++-v3/ChangeLog:
2020-08-19 Jonathan Wakely <jwakely@redhat.com>
Patrick Palka <ppalka@redhat.com>
PR libstdc++/96042
* include/bits/range_access.h (__detail::__to_unsigned_like):
Do not use make_unsigned_t<T> in the return type, as it can
result in an error before the integral<T> constraint is checked.
[__STRICT_ANSI__]: Add overloads for 128-bit integer types.
(__detail::__make_unsigned_like_t): Define as the return type
of __to_unsigned_like.
* testsuite/std/ranges/subrange/96042.cc: New test.
David Malcolm [Wed, 19 Aug 2020 17:21:47 +0000 (13:21 -0400)]
analyzer: fix ICE on deref_rvalue on SK_COMPOUND [PR96643]
gcc/analyzer/ChangeLog:
PR analyzer/96643
* region-model.cc (region_model::deref_rvalue): Rather than
attempting to handle all svalue kinds in the switch, only cover
the special cases, and move symbolic-region handling to after
the switch, thus implicitly handling the missing case SK_COMPOUND.
gcc/testsuite/ChangeLog:
PR analyzer/96643
* g++.dg/analyzer/pr96643.C: New test.
David Malcolm [Wed, 19 Aug 2020 13:27:16 +0000 (09:27 -0400)]
analyzer: fix ICE on folding vector 0 [PR96705]
gcc/analyzer/ChangeLog:
* region-model-manager.cc
PR analyzer/96705
(region_model_manager::maybe_fold_binop): Check that we have an
integral type before calling build_int_cst.
gcc/testsuite/ChangeLog:
PR analyzer/96705
* gcc.dg/analyzer/pr96705.c: New test.
David Malcolm [Wed, 19 Aug 2020 09:00:52 +0000 (05:00 -0400)]
analyzer: fix ICE converting float to int [PR96699]
gcc/analyzer/ChangeLog:
PR analyzer/96699
* region-model-manager.cc
(region_model_manager::get_or_create_cast): Use FIX_TRUNC_EXPR for
casting from REAL_TYPE to INTEGER_TYPE.
gcc/testsuite/ChangeLog:
PR analyzer/96699
* gcc.dg/analyzer/pr96699.c: New test.
Carl Love [Tue, 11 Aug 2020 00:37:41 +0000 (19:37 -0500)]
rs6000, restrict bfloat convert intrinsic to Power 10. Fix BU_P10V macro definitions.
gcc/ChangeLog
2020-08-19 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-builtin.def (BU_P10V_0, BU_P10V_1,
BU_P10V_2, BU_P10V_3): Rename BU_P10V_VSX_0, BU_P10V_VSX_1,
BU_P10V_VSX_2, BU_P10V_VSX_3 respectively.
(BU_P10V_4): Remove.
(BU_P10V_AV_0, BU_P10V_AV_1, BU_P10V_AV_2, BU_P10V_AV_3, BU_P10V_AV_4):
New definitions for Power 10 Altivec macros.
(VSTRIBR, VSTRIHR, VSTRIBL, VSTRIHL, VSTRIBR_P, VSTRIHR_P,
VSTRIBL_P, VSTRIHL_P, MTVSRBM, MTVSRHM, MTVSRWM, MTVSRDM, MTVSRQM,
VEXPANDMB, VEXPANDMH, VEXPANDMW, VEXPANDMD, VEXPANDMQ, VEXTRACTMB,
VEXTRACTMH, VEXTRACTMW, VEXTRACTMD, VEXTRACTMQ): Replace macro
expansion BU_P10V_1 with BU_P10V_AV_1.
(VCLRLB, VCLRRB, VCFUGED, VCLZDM, VCTZDM, VPDEPD, VPEXTD, VGNB,
VCNTMBB, VCNTMBH, VCNTMBW, VCNTMBD): Replace macro expansion
BU_P10V_2 with BU_P10V_AV_2.
(VEXTRACTBL, VEXTRACTHL, VEXTRACTWL, VEXTRACTDL, VEXTRACTBR, VEXTRACTHR,
VEXTRACTWR, VEXTRACTDR, VINSERTGPRBL, VINSERTGPRHL, VINSERTGPRWL,
VINSERTGPRDL, VINSERTVPRBL, VINSERTVPRHL, VINSERTVPRWL, VINSERTGPRBR,
VINSERTGPRHR, VINSERTGPRWR, VINSERTGPRDR, VINSERTVPRBR, VINSERTVPRHR,
VINSERTVPRWR, VREPLACE_ELT_V4SI, VREPLACE_ELT_UV4SI, VREPLACE_ELT_V2DF,
VREPLACE_ELT_V4SF, VREPLACE_ELT_V2DI, VREPLACE_ELT_UV2DI, VREPLACE_UN_V4SI,
VREPLACE_UN_UV4SI, VREPLACE_UN_V4SF, VREPLACE_UN_V2DI, VREPLACE_UN_UV2DI,
VREPLACE_UN_V2DF, VSLDB_V16QI, VSLDB_V8HI, VSLDB_V4SI, VSLDB_V2DI,
VSRDB_V16QI, VSRDB_V8HI, VSRDB_V4SI, VSRDB_V2DI): Replace macro expansion
BU_P10V_3 with BU_P10V_AV_3.
(VXXSPLTIW_V4SI, VXXSPLTIW_V4SF, VXXSPLTID): Replace macro expansion
BU_P10V_1 with BU_P10V_AV_1.
(XXGENPCVM_V16QI, XXGENPCVM_V8HI, XXGENPCVM_V4SI, XXGENPCVM_V2DI):
Replace macro expansion BU_P10V_2 with BU_P10V_VSX_2.
(VXXSPLTI32DX_V4SI, VXXSPLTI32DX_V4SF, VXXBLEND_V16QI, VXXBLEND_V8HI,
VXXBLEND_V4SI, VXXBLEND_V2DI, VXXBLEND_V4SF, VXXBLEND_V2DF): Replace macor
expansion BU_P10V_3 with BU_P10V_VSX_3.
(XXEVAL, VXXPERMX): Replace macro expansion BU_P10V_4 with BU_P10V_VSX_4.
(XVCVBF16SP, XVCVSPBF16): Replace macro expansion BU_VSX_1 with
BU_P10V_VSX_1. Also change MISC to CONST.
* config/rs6000/rs6000-c.c: (P10_BUILTIN_VXXPERMX): Replace with
P10V_BUILTIN_VXXPERMX.
(P10_BUILTIN_VCLRLB, P10_BUILTIN_VCLRLB, P10_BUILTIN_VCLRRB,
P10_BUILTIN_VGNB, P10_BUILTIN_XXEVAL, P10_BUILTIN_VXXPERMX,
P10_BUILTIN_VEXTRACTBL, P10_BUILTIN_VEXTRACTHL, P10_BUILTIN_VEXTRACTWL,
P10_BUILTIN_VEXTRACTDL, P10_BUILTIN_VINSERTGPRHL,
P10_BUILTIN_VINSERTGPRWL, P10_BUILTIN_VINSERTGPRDL,
P10_BUILTIN_VINSERTVPRBL, P10_BUILTIN_VINSERTVPRHL,
P10_BUILTIN_VEXTRACTBR, P10_BUILTIN_VEXTRACTHR,
P10_BUILTIN_VEXTRACTWR, P10_BUILTIN_VEXTRACTDR,
P10_BUILTIN_VINSERTGPRBR, P10_BUILTIN_VINSERTGPRHR,
P10_BUILTIN_VINSERTGPRWR, P10_BUILTIN_VINSERTGPRDR,
P10_BUILTIN_VINSERTVPRBR, P10_BUILTIN_VINSERTVPRHR,
P10_BUILTIN_VINSERTVPRWR, P10_BUILTIN_VREPLACE_ELT_UV4SI,
P10_BUILTIN_VREPLACE_ELT_V4SI, P10_BUILTIN_VREPLACE_ELT_UV2DI,
P10_BUILTIN_VREPLACE_ELT_V2DI, P10_BUILTIN_VREPLACE_ELT_V2DF,
P10_BUILTIN_VREPLACE_UN_UV4SI, P10_BUILTIN_VREPLACE_UN_V4SI,
P10_BUILTIN_VREPLACE_UN_V4SF, P10_BUILTIN_VREPLACE_UN_UV2DI,
P10_BUILTIN_VREPLACE_UN_V2DI, P10_BUILTIN_VREPLACE_UN_V2DF,
P10_BUILTIN_VSLDB_V16QI, P10_BUILTIN_VSLDB_V16QI,
P10_BUILTIN_VSLDB_V8HI, P10_BUILTIN_VSLDB_V4SI,
P10_BUILTIN_VSLDB_V2DI, P10_BUILTIN_VXXSPLTIW_V4SI,
P10_BUILTIN_VXXSPLTIW_V4SF, P10_BUILTIN_VXXSPLTID,
P10_BUILTIN_VXXSPLTI32DX_V4SI, P10_BUILTIN_VXXSPLTI32DX_V4SF,
P10_BUILTIN_VXXBLEND_V16QI, P10_BUILTIN_VXXBLEND_V8HI,
P10_BUILTIN_VXXBLEND_V4SI, P10_BUILTIN_VXXBLEND_V2DI,
P10_BUILTIN_VXXBLEND_V4SF, P10_BUILTIN_VXXBLEND_V2DF,
P10_BUILTIN_VSRDB_V16QI, P10_BUILTIN_VSRDB_V8HI,
P10_BUILTIN_VSRDB_V4SI, P10_BUILTIN_VSRDB_V2DI,
P10_BUILTIN_VSTRIBL, P10_BUILTIN_VSTRIHL,
P10_BUILTIN_VSTRIBL_P, P10_BUILTIN_VSTRIHL_P,
P10_BUILTIN_VSTRIBR, P10_BUILTIN_VSTRIHR,
P10_BUILTIN_VSTRIBR_P, P10_BUILTIN_VSTRIHR_P,
P10_BUILTIN_MTVSRBM, P10_BUILTIN_MTVSRHM,
P10_BUILTIN_MTVSRWM, P10_BUILTIN_MTVSRDM,
P10_BUILTIN_MTVSRQM, P10_BUILTIN_VCNTMBB,
P10_BUILTIN_VCNTMBH, P10_BUILTIN_VCNTMBW,
P10_BUILTIN_VCNTMBD, P10_BUILTIN_VEXPANDMB,
P10_BUILTIN_VEXPANDMH, P10_BUILTIN_VEXPANDMW,
P10_BUILTIN_VEXPANDMD, P10_BUILTIN_VEXPANDMQ,
P10_BUILTIN_VEXTRACTMB, P10_BUILTIN_VEXTRACTMH,
P10_BUILTIN_VEXTRACTMW, P10_BUILTIN_VEXTRACTMD,
P10_BUILTIN_VEXTRACTMQ, P10_BUILTIN_XVTLSBB_ZEROS,
P10_BUILTIN_XVTLSBB_ONES): Replace with
P10V_BUILTIN_VCLRLB, P10V_BUILTIN_VCLRLB, P10V_BUILTIN_VCLRRB,
P10V_BUILTIN_VGNB, P10V_BUILTIN_XXEVAL, P10V_BUILTIN_VXXPERMX,
P10V_BUILTIN_VEXTRACTBL, P10V_BUILTIN_VEXTRACTHL, P10V_BUILTIN_VEXTRACTWL,
P10V_BUILTIN_VEXTRACTDL, P10V_BUILTIN_VINSERTGPRHL,
P10V_BUILTIN_VINSERTGPRWL, P10V_BUILTIN_VINSERTGPRDL,
P10V_BUILTIN_VINSERTVPRBL,P10V_BUILTIN_VINSERTVPRHL,
P10V_BUILTIN_VEXTRACTBR, P10V_BUILTIN_VEXTRACTHR
P10V_BUILTIN_VEXTRACTWR, P10V_BUILTIN_VEXTRACTDR,
P10V_BUILTIN_VINSERTGPRBR, P10V_BUILTIN_VINSERTGPRHR,
P10V_BUILTIN_VINSERTGPRWR, P10V_BUILTIN_VINSERTGPRDR,
P10V_BUILTIN_VINSERTVPRBR, P10V_BUILTIN_VINSERTVPRHR,
P10V_BUILTIN_VINSERTVPRWR, P10V_BUILTIN_VREPLACE_ELT_UV4SI,
P10V_BUILTIN_VREPLACE_ELT_V4SI, P10V_BUILTIN_VREPLACE_ELT_UV2DI,
P10V_BUILTIN_VREPLACE_ELT_V2DI, P10V_BUILTIN_VREPLACE_ELT_V2DF,
P10V_BUILTIN_VREPLACE_UN_UV4SI, P10V_BUILTIN_VREPLACE_UN_V4SI,
P10V_BUILTIN_VREPLACE_UN_V4SF, P10V_BUILTIN_VREPLACE_UN_UV2DI,
P10V_BUILTIN_VREPLACE_UN_V2DI, P10V_BUILTIN_VREPLACE_UN_V2DF,
P10V_BUILTIN_VSLDB_V16QI, P10V_BUILTIN_VSLDB_V16QI,
P10V_BUILTIN_VSLDB_V8HI, P10V_BUILTIN_VSLDB_V4SI,
P10V_BUILTIN_VSLDB_V2DI, P10V_BUILTIN_VXXSPLTIW_V4SI,
P10V_BUILTIN_VXXSPLTIW_V4SF, P10V_BUILTIN_VXXSPLTID,
P10V_BUILTIN_VXXSPLTI32DX_V4SI, P10V_BUILTIN_VXXSPLTI32DX_V4SF,
P10V_BUILTIN_VXXBLEND_V16QI, P10V_BUILTIN_VXXBLEND_V8HI,
P10V_BUILTIN_VXXBLEND_V4SI, P10V_BUILTIN_VXXBLEND_V2DI,
P10V_BUILTIN_VXXBLEND_V4SF, P10V_BUILTIN_VXXBLEND_V2DF,
P10V_BUILTIN_VSRDB_V16QI, P10V_BUILTIN_VSRDB_V8HI,
P10V_BUILTIN_VSRDB_V4SI, P10V_BUILTIN_VSRDB_V2DI,
P10V_BUILTIN_VSTRIBL, P10V_BUILTIN_VSTRIHL,
P10V_BUILTIN_VSTRIBL_P, P10V_BUILTIN_VSTRIHL_P,
P10V_BUILTIN_VSTRIBR, P10V_BUILTIN_VSTRIHR,
P10V_BUILTIN_VSTRIBR_P, P10V_BUILTIN_VSTRIHR_P,
P10V_BUILTIN_MTVSRBM, P10V_BUILTIN_MTVSRHM,
P10V_BUILTIN_MTVSRWM, P10V_BUILTIN_MTVSRDM,
P10V_BUILTIN_MTVSRQM, P10V_BUILTIN_VCNTMBB,
P10V_BUILTIN_VCNTMBH, P10V_BUILTIN_VCNTMBW,
P10V_BUILTIN_VCNTMBD, P10V_BUILTIN_VEXPANDMB,
P10V_BUILTIN_VEXPANDMH, P10V_BUILTIN_VEXPANDMW,
P10V_BUILTIN_VEXPANDMD, P10V_BUILTIN_VEXPANDMQ,
P10V_BUILTIN_VEXTRACTMB, P10V_BUILTIN_VEXTRACTMH,
P10V_BUILTIN_VEXTRACTMW, P10V_BUILTIN_VEXTRACTMD,
P10V_BUILTIN_VEXTRACTMQ, P10V_BUILTIN_XVTLSBB_ZEROS,
P10V_BUILTIN_XVTLSBB_ONES respectively.
* config/rs6000/rs6000-call.c: Ditto above, change P10_BUILTIN_name to
P10V_BUILTIN_name.
(P10_BUILTIN_XVCVSPBF16, P10_BUILTIN_XVCVBF16SP): Change to
P10V_BUILTIN_XVCVSPBF16, P10V_BUILTIN_XVCVBF16SP respectively.
Bill Schmidt [Wed, 19 Aug 2020 18:43:55 +0000 (13:43 -0500)]
rs6000: Enable more sibcalls when TOC is not preserved
A function compiled with the PC-relative addressing model does not
require r2 to contain a TOC pointer, and does not guarantee that r2
will be preserved for its caller. Such a function can make sibcalls
without restriction based on TOC preservation rules. However, a
caller that does preserve r2 cannot make a sibcall to a callee that
does not.
2020-08-19 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-logue.c (rs6000_decl_ok_for_sibcall):
Sibcalls are always legal when the caller doesn't preserve r2.
gcc/testsuite/
* gcc.target/powerpc/pcrel-sibcall-1.c: Adjust.
Jonathan Wakely [Wed, 19 Aug 2020 16:04:49 +0000 (17:04 +0100)]
libstdc++: Remove deprecated comparison operators for RB trees
These functions were deprecated in GCC 9.1.0 because they are never used
by the library. This patch removes them for GCC 11.
libstdc++-v3/ChangeLog:
* include/bits/stl_tree.h (operator!=, operator>, operator<=)
(operator>=): Remove deprecated functions.
Jonathan Wakely [Wed, 19 Aug 2020 15:27:25 +0000 (16:27 +0100)]
libstdc++: Make __int128 meet integer-class requirements [PR 96042]
Because __int128 can be used as the difference type for iota_view, we
need to ensure that it meets the requirements of an integer-class type.
The requirements in [iterator.concept.winc] p10 include numeric_limits
being specialized and giving meaningful answers. Currently we only
specialize numeric_limits for non-standard integer types in non-strict
modes. However, nothing prevents us from defining an explicit
specialization for any implementation-defined type, so it doesn't matter
whether std::is_integral<__int128> is true or not.
This patch ensures that the numeric_limits specializations for signed
and unsigned __int128 are defined whenever __int128 is available. It
also makes the __numeric_traits and __int_limits helpers work for
__int128, via a new __gnu_cxx::__is_integer_nonstrict trait.
libstdc++-v3/ChangeLog:
PR libstdc++/96042
* include/ext/numeric_traits.h (__is_integer_nonstrict): New
trait which is true for 128-bit integers even in strict modes.
(__numeric_traits_integer, __numeric_traits): Use
__is_integer_nonstrict instead of __is_integer.
* include/std/limits [__STRICT_ANSI__ && __SIZEOF_INT128__]
(numeric_limits<__int128>, (numeric_limits<unsigned __int128>):
Define.
* testsuite/std/ranges/iota/96042.cc: New test.
Uros Bizjak [Wed, 19 Aug 2020 15:14:13 +0000 (17:14 +0200)]
i386: Use code_for_ instead of gen_ for parameterized names more.
Some builtins are better expanded to patterns with
parametrized names via code_for_ than gen_ helpers.
No functional changes.
2020-08-19 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_expand_builtin)
[case IX86_BUILTIN_ENQCMD, case IX86_BUILTIN_ENQCMDS]:
Rewrite expansion to use code_for_enqcmd.
[case IX86_BUILTIN_WRSSD, case IX86_BUILTIN_WRSSQ]:
Rewrite expansion to use code_for_wrss.
[case IX86_BUILTIN_WRUSSD, case IX86_BUILTIN_WRUSSD]:
Rewrite expansion to use code_for_wrss.
Feng Xue [Mon, 1 Jun 2020 03:57:35 +0000 (11:57 +0800)]
tree-optimization/94234 - add pattern for ptr-diff on addresses with same offset
2020-08-19 Feng Xue <fxue@os.amperecomputing.com>
gcc/
PR tree-optimization/94234
* match.pd ((PTR_A + OFF) - (PTR_B + OFF)) -> (PTR_A - PTR_B): New
simplification.
gcc/testsuite/
PR tree-optimization/94234
* gcc.dg/pr94234-1.c: New test.
Jonathan Wakely [Wed, 19 Aug 2020 11:42:02 +0000 (12:42 +0100)]
libstdc++: Mention new macros in comments
libstdc++-v3/ChangeLog:
* include/bits/c++config (_GLIBCXX_DEPRECATED_SUGGEST)
(_GLIBCXX11_DEPRECATED, _GLIBCXX11_DEPRECATED_SUGGEST)
(_GLIBCXX17_DEPRECATED_SUGGEST, _GLIBCXX20_DEPRECATED_SUGGEST):
Add new macros to comment.
Patrick Palka [Wed, 19 Aug 2020 13:12:55 +0000 (09:12 -0400)]
libstdc++: integer-class types as per [iterator.concept.winc]
This implements signed and unsigned integer-class types, whose width is
one bit larger than the widest supported signed and unsigned integral
type respectively. In our case this is either __int128 and unsigned
__int128, or long long and unsigned long long.
Internally, the two integer-class types are represented as a largest
supported unsigned integral type plus one extra bit. The signed
integer-class type is represented in two's complement form with the
extra bit acting as the sign bit.
libstdc++-v3/ChangeLog:
* include/Makefile.am (bits_headers): Add new header
<bits/max_size_type.h>.
* include/Makefile.in: Regenerate.
* include/bits/iterator_concepts.h
(ranges::__detail::__max_diff_type): Remove definition, replace
with forward declaration of class __max_diff_type.
(__detail::__max_size_type): Remove definition, replace with
forward declaration of class __max_size_type.
(__detail::__is_unsigned_int128, __is_signed_int128)
(__is_int128): New concepts.
(__detail::__is_integer_like): Accept __int128 and unsigned
__int128.
(__detail::__is_signed_integer_like): Accept __int128.
* include/bits/max_size_type.h: New header.
* include/bits/range_access.h: Include <bits/max_size_type.h>.
(__detail::__to_unsigned_like): Two new overloads.
* testsuite/std/ranges/iota/difference_type.cc: New test.
* testsuite/std/ranges/iota/max_size_type.cc: New test.
H.J. Lu [Sun, 16 Aug 2020 13:14:25 +0000 (06:14 -0700)]
x86: Detect Rocket Lake and Alder Lake
From arch/x86/include/asm/intel-family.h on Linux kernel master branch:
#define INTEL_FAM6_ROCKETLAKE 0xA7
#define INTEL_FAM6_ALDERLAKE 0x97
* common/config/i386/cpuinfo.h (get_intel_cpu): Detect Rocket
Lake and Alder Lake.
Jonathan Wakely [Wed, 19 Aug 2020 11:13:03 +0000 (12:13 +0100)]
libstdc++: Add deprecated attributes to old iostream members
Back in 2017 I removed these prehistoric members (which were deprecated
since C++98) for C++17 mode. But I didn't add deprecated attributes to
most of them, so users didn't get any warning they would be going away.
Apparently some poor souls do actually use some of these names, and so
now that GCC 11 defaults to -std=gnu++17 some code has stopped
compiling.
This adds deprecated attributes to them, so that C++98/03/11/14 code
will get a warning if it uses them. I'll also backport this to the
release branches so that users can find out about the deprecation before
they start using C++17.
In order to give deprecated warnings even in C++98 mode this patch makes
_GLIBCXX_DEPRECATED work even for C++98, adds _GLIBCXX11_DEPRECATED for
the old meaning of _GLIBCXX_DEPRECATED, and adds new macros such as
_GLIBCXX_DEPRECATED_SUGGEST for suggesting alternatives to deprecated
features.
libstdc++-v3/ChangeLog:
* include/bits/c++config (_GLIBCXX_DEPRECATED): Define for all
standard modes.
(_GLIBCXX_DEPRECATED_SUGGEST): New macro for "use 'foo' instead"
message in deprecated warnings.
(_GLIBCXX11_DEPRECATED, _GLIBCXX11_DEPRECATED_SUGGEST): New
macros for marking features derpecated in C++11.
(_GLIBCXX17_DEPRECATED_SUGGEST, _GLIBCXX20_DEPRECATED_SUGGEST):
New macros.
* include/backward/auto_ptr.h (auto_ptr_ref, auto_ptr<void>):
Use _GLIBCXX11_DEPRECATED instead of _GLIBCXX_DEPRECATED.
(auto_ptr): Use _GLIBCXX11_DEPRECATED_SUGGEST.
* include/backward/binders.h (binder1st, binder2nd): Likewise.
* include/bits/ios_base.h (io_state, open_mode, seek_dir)
(streampos, streamoff): Use _GLIBCXX_DEPRECATED_SUGGEST.
* include/std/streambuf (stossc): Replace C++11 attribute
with _GLIBCXX_DEPRECATED_SUGGEST.
* include/std/type_traits (__is_nullptr_t): Use
_GLIBCXX_DEPRECATED_SUGGEST instead of _GLIBCXX_DEPRECATED.
* testsuite/27_io/types/1.cc: Check for deprecated warnings.
Also check for io_state, open_mode and seek_dir typedefs.
Antony Polukhin [Wed, 19 Aug 2020 11:10:57 +0000 (12:10 +0100)]
libstdc++: assert that type traits are not misused with incomplete types [PR 71579]
libstdc++-v3/ChangeLog:
2020-08-19 Antony Polukhin <antoshkka@gmail.com>
PR libstdc++/71579
* include/std/type_traits (invoke_result, is_nothrow_invocable_r)
Add static_asserts to make sure that the argument of the type
trait is not misused with incomplete types.
(is_swappable_with, is_nothrow_swappable_with): Add static_asserts
to make sure that the first and second arguments of the type trait
are not misused with incomplete types.
* testsuite/20_util/invoke_result/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_swappable/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_swappable_with/incomplete_neg.cc: New
test.
* testsuite/20_util/is_swappable_with/incomplete_neg.cc: New test.
Peixin Qiao [Wed, 19 Aug 2020 09:55:19 +0000 (10:55 +0100)]
AArch64: Remove "fndecl && TREE_PUBLIC (fndecl)" in aarch64_init_cumulative_args
This check will prevent the function type check of static funtion or calling
via a funtion pointer. The function type should be checked no matter if the
function has external linkage.
gcc/ChangeLog:
* config/aarch64/aarch64.c (aarch64_init_cumulative_args): Remove
"fndecl && TREE_PUBLIC (fndecl)" check since it prevents the funtion
type check when calling via a function pointer or when calling a static
function.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/mgeneral-regs_7.c: New test.
Pat Bernardi [Wed, 19 Aug 2020 09:05:21 +0000 (10:05 +0100)]
testsuite: require c99 runtime for trigonometric optimisation tests
A number of optimisation that simplify trigonometric expressions are only
performed when the compiler knows the target has a C99 libm available.
Since targets like *-elf may not have such a libm, a C99 runtime requirement
is added to these tests.
2020-08-19 Pat Bernardi <bernardi@adacore.com>
gcc/testsuite/ChangeLog
* gcc.dg/sinatan-2.c: Add dg-require-effective-target c99_runtime.
* gcc.dg/sinhovercosh-1.c: Likewise.
* gcc.dg/tanhbysinh.c: Likewise.
Tom de Vries [Mon, 10 Aug 2020 13:42:38 +0000 (15:42 +0200)]
[testsuite, nvptx] Add effective target sync_int_long_stack
The nvptx target currently doesn't support effective target sync_int_long,
although it has support for 32-bit and 64-bit atomic.
When enabling sync_int_long for nvptx, we run into a failure in
gcc.dg/pr86314.c:
...
nvptx-run: error getting kernel result: operation not supported on \
global/shared address space
...
due to a ptx restriction: accesses to local memory are illegal, and the
test-case does an atomic operation on a stack address, which is mapped to
local memory.
Fix this by adding a target sync_int_long_stack, wich returns false for nvptx,
which can be used to mark test-cases that require sync_int_long support for
stack addresses.
Build on nvptx and tested with make check-gcc.
gcc/testsuite/ChangeLog:
PR target/96494
* lib/target-supports.exp (check_effective_target_sync_int_long):
Return 1 for nvptx.
(check_effective_target_sync_int_long_stack): New proc.
* gcc.dg/pr86314.c: Require effective target sync_int_long_stack.
Kewen Lin [Wed, 19 Aug 2020 02:37:39 +0000 (21:37 -0500)]
options: Make --help= see overridden values
Options "-Q --help=params" don't show the final values after
target option overriding, instead it emits the default values
in params.opt (without any explicit param settings).
This patch makes it see overridden values.
gcc/ChangeLog:
* opts-global.c (decode_options): Call target_option_override_hook
before it prints for --help=*.
David Malcolm [Mon, 17 Aug 2020 20:35:10 +0000 (16:35 -0400)]
analyzer: consider initializers for globals [PR96651]
PR analyzer/96651 reports a false positive in which a global
that can't have been touched yet is checked in "main". The analyzer
fails to reject code paths in which the initial value of the global
makes the path condition impossible.
This patch detects cases where the code path begins at the entrypoint
of "main", and extracts values from initializers for globals that
can't have been touched yet, rather than using a symbolic
"INIT_VAL(REG)", fixing the false positive.
gcc/analyzer/ChangeLog:
PR analyzer/96651
* region-model.cc (region_model::called_from_main_p): New.
(region_model::get_store_value): Move handling for globals into...
(region_model::get_initial_value_for_global): ...this new
function, and add logic for extracting values from decl
initializers.
* region-model.h (decl_region::get_svalue_for_constructor): New
decl.
(decl_region::get_svalue_for_initializer): New decl.
(region_model::called_from_main_p): New decl.
(region_model::get_initial_value_for_global): New.
* region.cc (decl_region::maybe_get_constant_value): Move logic
for getting an svalue from a CONSTRUCTOR node to...
(decl_region::get_svalue_for_constructor): ...this new function.
(decl_region::get_svalue_for_initializer): New.
* store.cc (get_svalue_for_ctor_val): Rewrite in terms of
region_model::get_rvalue.
* store.h (binding_cluster::get_map): New accessor.
gcc/testsuite/ChangeLog:
PR analyzer/96651
* gcc.dg/analyzer/pr96651-1.c: New test.
* gcc.dg/analyzer/pr96651-2.c: New test.
David Malcolm [Tue, 18 Aug 2020 01:12:35 +0000 (21:12 -0400)]
analyzer: fix ICE with negative bit offsets [PR96648]
PR analyzer/96648 reports an ICE within get_field_at_bit_offset due
to a negative bit offset, arising due to pointer arithmetic.
This patch replaces an assertion with handling for this case, fixing the
ICE.
gcc/analyzer/ChangeLog:
PR analyzer/96648
* region.cc (get_field_at_bit_offset): Gracefully handle negative
values for bit_offset.
gcc/testsuite/ChangeLog:
PR analyzer/96648
* gcc.dg/analyzer/pr96648.c: New test.
GCC Administrator [Wed, 19 Aug 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Nathan Sidwell [Tue, 18 Aug 2020 21:48:58 +0000 (14:48 -0700)]
c++: alias template template_info setting
During the construction of alias templates we can alter its
template_info. This is really weird, because that's morally immutable
data. In this case it's ok, but let's not create a duplicate
template_info, and add asserts to make sure it is changing in exactly
the way we expect.
gcc/cp/
* cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
* pt.c (lookup_template_class_1): Special-case alias template
template_info setting.
Peter Bergner [Tue, 18 Aug 2020 21:16:11 +0000 (16:16 -0500)]
rs6000: Rename instruction xvcvbf16sp to xvcvbf16spn
The xvcvbf16sp mnemonic, which was just added in ISA 3.1 has been renamed
to xvcvbf16spn, to make it consistent with the other non-signaling conversion
instructions which all end with "n". The only use of this instruction is in
an MMA conversion built-in function, so there is little to no compatibility
issue.
gcc/
* config/rs6000/rs6000-builtin.def (BU_VSX_1): Rename xvcvbf16sp to
xvcvbf16spn.
* config/rs6000/rs6000-call.c (builtin_function_type): Likewise.
* config/rs6000/vsx.md: Likewise.
* doc/extend.texi: Likewise.
gcc/testsuite/
* gcc.target/powerpc/mma-builtin-3.c: Rename xvcvbf16sp to xvcvbf16spn.
David Edelsohn [Tue, 18 Aug 2020 00:19:38 +0000 (20:19 -0400)]
aix: Support libsupc++ as a FAT library
Build libstdc++++ static library libsupc++.a as a FAT 32/64 bit library.
libstdc++-v3/ChangeLog:
2020-08-18 David Edelsohn <dje.gcc@gmail.com>
Clement Chigot <clement.chigot@atos.net>
* config/os/aix/t-aix: Add complementary mode object files to
libsupc++.a
Jason Merrill [Fri, 14 Aug 2020 22:01:27 +0000 (18:01 -0400)]
c++: Rewrite members for all deduction guides. [PR96199]
After the last patch, it occurred to me that we could run into the
specialization issue with non-alias deduction guides as well, so this patch
extends the rewriting to C++17 mode.
Doing this revealed that we weren't properly pushing into class scope for
normalization.
gcc/cp/ChangeLog:
PR c++/96199
* pt.c (tsubst_aggr_type): Rewrite in C++17, too.
(maybe_dependent_member_ref): Likewise.
(build_deduction_guide): Re-substitute template parms.
* cp-tree.h (struct push_nested_class_guard): New.
* constraint.cc (get_normalized_constraints_from_decl): Use it.
gcc/testsuite/ChangeLog:
PR c++/96199
* g++.dg/cpp1z/class-deduction-spec1.C: New test.
Jason Merrill [Thu, 6 Aug 2020 06:40:10 +0000 (02:40 -0400)]
c++: Handle enumerator in C++20 alias CTAD. [PR96199]
To form a deduction guide for an alias template, we substitute the template
arguments from the pattern into the deduction guide for the underlying
class. In the case of B(A1<X>), that produces B(A1<B<T,1>::X>) -> B<T,1>.
But since an enumerator doesn't have its own template info, and B<T,1> is a
dependent scope, trying to look up B<T,1>::X fails and we crash. So we need
to produce a SCOPE_REF instead.
And trying to use the members of the template class is wrong for other
members, as well, as it gives a nonsensical result if the class is
specialized.
gcc/cp/ChangeLog:
PR c++/96199
* pt.c (maybe_dependent_member_ref): New.
(tsubst_copy) [CONST_DECL]: Use it.
[VAR_DECL]: Likewise.
(tsubst_aggr_type): Handle nested type.
gcc/testsuite/ChangeLog:
PR c++/96199
* g++.dg/cpp2a/class-deduction-alias4.C: New test.
Harald Anlauf [Tue, 18 Aug 2020 19:48:56 +0000 (21:48 +0200)]
PR fortran/96613,96686 - Fix type/kind issues, temporaries evaluating MIN/MAX
When evaluating functions of the MIN/MAX variety inline, use a temporary
of appropriate type and kind, and convert to the result type at the end.
In the case of allowing for the GNU extensions to MIN/MAX, derive the
result kind consistently during simplificaton.
Furthermore, the Fortran standard requires type and kind of arguments to
the MIN/MAX intrinsics to all have the same type and kind. While a GNU
extension accepts kind differences for integer and real arguments which
seems to have been used in legacy code, there is no reason to allow
different character kinds. We now reject the latter unconditionally.
gcc/fortran/ChangeLog:
* check.c (check_rest): Reject MIN/MAX character arguments of
different kind.
* simplify.c (min_max_choose): The simplification result shall
have the highest kind value of the arguments.
* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Choose type and
kind of intermediate by looking at all arguments, not the result.
gcc/testsuite/ChangeLog:
* gfortran.dg/minmax_char_3.f90: New test.
* gfortran.dg/min_max_kind.f90: New test.
* gfortran.dg/pr96613.f90: New test.
Aaron Sawdey [Sat, 8 Aug 2020 00:02:20 +0000 (19:02 -0500)]
rs6000: unaligned VSX in memcpy/memmove expansion
This patch adds a few new instructions to inline expansion of
memcpy/memmove. Generation of all these are controlled by
the option -mblock-ops-unaligned-vsx which is set on by default if the
target has TARGET_EFFICIENT_UNALIGNED_VSX.
* unaligned vsx load/store (V2DImode)
* unaligned vsx pair load/store (POImode) which is also controlled
by -mblock-ops-vector-pair in case it is not wanted at some point.
The default for -mblock-ops-vector-pair is for it to be on if the
target has TARGET_MMA and TARGET_EFFICIENT_UNALIGNED_VSX. This is
redundant, but nice for the future to clearly specify what is
required.
* unaligned vsx lxvl/stxvl but generally only to do the remainder
of a copy/move we stated with some vsx loads/stores, and also prefer
to use lb/lh/lw/ld if the remainder is 1/2/4/8 bytes.
Testing of this is actually accomplished by gcc.dg/memcmp-1.c which does
two memcpy() for each memcmp(). If the memcpy() calls don't do the right
thing then the memcmp() will fail unexpectedly.
gcc/ChangeLog:
* config/rs6000/rs6000-string.c (gen_lxvl_stxvl_move):
Helper function.
(expand_block_move): Add lxvl/stxvl, vector pair, and
unaligned VSX.
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Default value for -mblock-ops-vector-pair.
* config/rs6000/rs6000.opt: Add -mblock-ops-vector-pair.
Aldy Hernandez [Tue, 4 Aug 2020 10:31:23 +0000 (12:31 +0200)]
Decouple adjust_range_from_scev from vr_values and value_range_equiv.
gcc/ChangeLog:
* vr-values.c (check_for_binary_op_overflow): Change type of store
to range_query.
(vr_values::adjust_range_with_scev): Abstract most of the code...
(range_of_var_in_loop): ...here. Remove value_range_equiv uses.
(simplify_using_ranges::simplify_using_ranges): Change type of store
to range_query.
* vr-values.h (class range_query): New.
(class simplify_using_ranges): Use range_query.
(class vr_values): Add OVERRIDE to get_value_range.
(range_of_var_in_loop): New.
Martin Sebor [Tue, 18 Aug 2020 18:57:18 +0000 (12:57 -0600)]
PR middle-end/96665 - memcmp of a constant string not folded
Related:
PR middle-end/78257 - missing memcmp optimization with constant arrays
gcc/ChangeLog:
PR middle-end/96665
PR middle-end/78257
* expr.c (convert_to_bytes): Replace statically allocated buffer with
a dynamically allocated one of sufficient size.
gcc/testsuite/ChangeLog:
PR middle-end/96665
PR middle-end/78257
* gcc.dg/memcmp-5.c: New test.
Martin Sebor [Tue, 18 Aug 2020 18:49:35 +0000 (12:49 -0600)]
Fix PR tree-optimization/96670 - ICE on memchr with an empty initializer.
gcc/ChangeLog:
PR tree-optimization/96670
PR middle-end/78257
* gimple-fold.c (gimple_fold_builtin_memchr): Call byte_representation
to get it, not string_constant.
gcc/testsuite/ChangeLog:
PR tree-optimization/96670
* gcc.dg/memchr-2.c: New test.
* gcc.dg/memcmp-6.c: New test.
Hu Jiangping [Tue, 18 Aug 2020 16:47:08 +0000 (17:47 +0100)]
doc: add return type for functions in gimple.texi
gcc/
* doc/gimple.texi (gimple_debug_begin_stmt_p): Add return type.
(gimple_debug_inline_entry_p, gimple_debug_nonbind_marker_p): Likewise.
Martin Sebor [Tue, 18 Aug 2020 15:49:01 +0000 (09:49 -0600)]
Update native_encode_expr description.
gcc/ChangeLog:
* fold-const.c (native_encode_expr): Update comment.
Uros Bizjak [Tue, 18 Aug 2020 15:31:49 +0000 (17:31 +0200)]
i386: Rewrite restore_stack_nonlocal expander [PR96536].
-fcf-protection code in restore_stack_nonlocal uses a branch based on
a clobber result. The patch adds missing compare and completely
rewrites the expander to use high-level functions in RTL construction.
2020-08-18 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/96536
* config/i386/i386.md (restore_stack_nonlocal): Add missing compare
RTX. Rewrite expander to use high-level functions in RTL construction.
Jonathan Wakely [Tue, 18 Aug 2020 14:37:14 +0000 (15:37 +0100)]
libstdc++: Add "cold" to tests for reserved attribute names
libstdc++-v3/ChangeLog:
* testsuite/17_intro/headers/c++1998/all_attributes.cc: Check
"cold" isn't used in the library. Also check <cxxabi.h>.
* testsuite/17_intro/headers/c++2011/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2014/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2020/all_attributes.cc:
Likewise.
Roger Sayle [Tue, 18 Aug 2020 13:45:52 +0000 (14:45 +0100)]
New tests for PR rtl-optimization/96298.
Tests to confirm PR rtl-optimization is now fixed, remains so.
2020-08-18 Roger Sayle <roger@nextmovesoftware.com>
Zdenek Sojka <zsojka@seznam.cz>
gcc/testsuite/ChangeLog
PR rtl-optimization/96298
* gcc.dg/pr96298.c: New test.
* gcc.target/i386/pr96298.c: New test.
Jonathan Wakely [Tue, 18 Aug 2020 13:23:19 +0000 (14:23 +0100)]
libstdc++: Remove redundant copying of std::async arguments [PR 69724]
As was previously done for std::thread, this removes an unnecessary copy
of an rvalue of type thread::_Invoker. Instead of creating the rvalue
and then moving that into the shared state, the member of the shared
state is initialized directly from the forwarded callable and bound
arguments.
This also slightly simplifies std::thread creation to remove the
_S_make_state helper function.
libstdc++-v3/ChangeLog:
PR libstdc++/69724
* include/std/future (__future_base::_S_make_deferred_state)
(__future_base::_S_make_async_state): Remove.
(__future_base::_Deferred_state): Change constructor to accept a
parameter pack of arguments and forward them to the call
wrapper.
(__future_base::_Async_state_impl): Likewise. Replace lambda
expression with a named member function.
(async): Construct state object directly from the arguments,
instead of using thread::__make_invoker, _S_make_deferred_state
and _S_make_async_state. Move shared state into the returned
future.
* include/std/thread (thread::_Call_wrapper): New alias
template for use by constructor and std::async.
(thread::thread(Callable&&, Args&&...)): Create state object
directly instead of using _S_make_state.
(thread::__make_invoker, thread::__decayed_tuple)
(thread::_S_make_state): Remove.
* testsuite/30_threads/async/69724.cc: New test.
Nathan Sidwell [Tue, 18 Aug 2020 13:02:37 +0000 (06:02 -0700)]
c++: Move hidden-lambda entity lookup checking
Hidden lambda entities only occur in block and class scopes. There's
no need to check for them on every lookup. So moving that particular
piece of validation to lookup_name_1, which cares. Also reordered the
namespace and type checking, as that is also simpler.
gcc/cp/
* name-lookup.c (qualify_lookup): Drop lambda checking here.
Reorder namespace & type checking.
(lookup_name_1): Do hidden lambda checking here.
Iain Buclaw [Fri, 24 Jul 2020 11:49:37 +0000 (13:49 +0200)]
d: Fix ICE Segmentation fault during RTL pass: expand on armhf/armel/s390x
gcc/d/ChangeLog:
PR d/96301
* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Only return
non-trivial structs by invisible reference.
gcc/testsuite/ChangeLog:
PR d/96301
* gdc.dg/pr96301a.d: New test.
* gdc.dg/pr96301b.d: New test.
* gdc.dg/pr96301c.d: New test.
liuhongt [Wed, 12 Aug 2020 02:48:17 +0000 (10:48 +0800)]
Don't use pinsr/pextr for struct initialization/extraction.
gcc/
PR target/96562
PR target/93897
* config/i386/i386-expand.c (ix86_expand_pinsr): Don't use
pinsr for TImode.
(ix86_expand_pextr): Don't use pextr for TImode.
gcc/testsuite/
* gcc.target/i386/pr96562-1.c: New test.
Jakub Jelinek [Tue, 18 Aug 2020 05:51:58 +0000 (07:51 +0200)]
c: Fix -Wunused-but-set-* warning with _Generic [PR96571]
The following testcase shows various problems with -Wunused-but-set*
warnings and _Generic construct. I think it is best to treat the selector
and the ignored expressions as (potentially) read, because when they are
parsed, the vars in there are already marked as TREE_USED.
2020-08-18 Jakub Jelinek <jakub@redhat.com>
PR c/96571
* c-parser.c (c_parser_generic_selection): Change match_found from bool
to int, holding index of the match. Call mark_exp_read on the selector
expression and on expressions other than the selected one.
* gcc.dg/Wunused-var-4.c: New test.
liuhongt [Tue, 18 Aug 2020 05:18:03 +0000 (13:18 +0800)]
Adjust testcase.
Since This testcase is used to check generation of AVX512 vector
comparison, scan-assembler for vmov instruction could be deleted, also
-mprefer-vector-width=512 is added to avoid impact of different
default arch/tune of GCC.
gcc/testsuite
PR target/96574
* gcc.target/i386/pr92865-1.c: Adjust testcase.
David Malcolm [Fri, 14 Aug 2020 19:32:01 +0000 (15:32 -0400)]
analyzer: fix name of local in region_model::get_rvalue_1
gcc/analyzer/ChangeLog:
* region-model.cc (region_model::get_rvalue_1): Fix name of local.
David Malcolm [Mon, 17 Aug 2020 22:18:00 +0000 (18:18 -0400)]
analyzer: fix ICE on unhandled tree codes in get_rvalue_1 [PR96641]
The old implementation of region_model::get_rvalue_1 gracefully handled
tree codes it didn't understand, returning "UNKNOWN", whereas the new
implementation (
r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d) had
an assertion left over from development, leading to ICEs.
This patch restores the old behavior for these cases.
gcc/analyzer/ChangeLog:
PR analyzer/96641
* region-model.cc (region_model::get_rvalue_1): Handle
unrecognized tree codes by returning "UNKNOWN.
gcc/testsuite/ChangeLog:
PR analyzer/96641
* g++.dg/analyzer/pr96641.C: New test.
David Malcolm [Mon, 17 Aug 2020 15:53:45 +0000 (11:53 -0400)]
analyzer: fix ICE on unhandled tree codes in gassign [PR96640]
PR analyzer/96640 reports a ICE within region_model::on_assignment when
failing to handle a WIDEN_MULT_EVEN_EXPR, and various other tree codes.
The old implementation of region_model::on_assignment gracefully handled
tree codes it didn't understand, returning "UNKNOWN", whereas the new
implementation (
r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d) had
a "sorry_at" and an assertion left over from development, leading to ICEs.
This patch restores the old behavior for these cases, and marks various
vector operations as leading to unknown results.
gcc/analyzer/ChangeLog:
PR analyzer/96640
* region-model.cc (region_model::get_gassign_result): Handle various
VEC_* tree codes by returning UNKNOWN.
(region_model::on_assignment): Handle unrecognized tree codes by
setting lhs to an unknown value, rather than issuing a "sorry" and
asserting.
GCC Administrator [Tue, 18 Aug 2020 00:16:26 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Fri, 14 Aug 2020 22:27:15 +0000 (15:27 -0700)]
compiler: export thunks referenced by inline functions
The test case is https://golang.org/cl/248637.
Fixes golang/go#40252
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/248638
David Malcolm [Mon, 17 Aug 2020 16:30:56 +0000 (12:30 -0400)]
analyzer: fix ICE on NULL dereference [PR96644]
gcc/analyzer/ChangeLog:
PR analyzer/96644
* region-model-manager.cc (get_region_for_unexpected_tree_code):
Handle ctxt being NULL.
gcc/testsuite/ChangeLog:
PR analyzer/96644
* gcc.dg/analyzer/pr96644.c: New test.
David Malcolm [Mon, 17 Aug 2020 15:40:44 +0000 (11:40 -0400)]
analyzer: fix ICE due to NULL type [PR96639]
gcc/analyzer/ChangeLog:
PR analyzer/96639
* region.cc (region::get_subregions_for_binding): Check for "type"
being NULL.
gcc/testsuite/ChangeLog:
PR analyzer/96639
* gcc.dg/analyzer/pr96639.c: New test.
David Malcolm [Sat, 15 Aug 2020 19:34:21 +0000 (15:34 -0400)]
analyzer: handle &STRING_CST in constant pool initializers [PR96642]
In
r11-2708-g2867118ddda9b56d991c16022f7d3d634ed08313 I added support to
the analyzer for initialization from var_decls in the global constant
pool. However, that commit didn't support initialization from
ADDR_EXPR of a STRING_CST leading to an ICE seen in data-model-1.c and
pr94639.c on arm and powerpc64 at least, and as PR analyzer/96642 on
x86_64 at least.
This patch adds support for such initializers, fixing the ICE.
gcc/analyzer/ChangeLog:
PR analyzer/96642
* store.cc (get_svalue_for_ctor_val): New.
(binding_map::apply_ctor_to_region): Call it.
gcc/testsuite/ChangeLog:
PR analyzer/96642
* gcc.dg/analyzer/pr96642.c: New test.
Uros Bizjak [Mon, 17 Aug 2020 18:39:08 +0000 (20:39 +0200)]
i386: Use parametrized pattern names some more.
Use parameterized pattern names to simplify calling of named patterns.
2020-08-15 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/i386-builtin.def (__builtin_ia32_bextri_u32)
(__builtin_ia32_bextri_u64): Use CODE_FOR_nothing.
* config/i386/i386.md (@tbm_bextri_<mode>):
Implement as parametrized name pattern.
(@rdrand<mode>): Ditto.
(@rdseed<mode>): Ditto.
* config/i386/i386-expand.c (ix86_expand_builtin)
[case IX86_BUILTIN_BEXTRI32, case IX86_BUILTIN_BEXTRI64]:
Update for parameterized name patterns.
[case IX86_BUILTIN_RDRAND16_STEP, case IX86_BUILTIN_RDRAND32_STEP]
[case IX86_BUILTIN_RDRAND64_STEP]: Ditto.
[case IX86_BUILTIN_RDSEED16_STEP, case IX86_BUILTIN_RDSEED32_STEP]
[case IX86_BUILTIN_RDSEED64_STEP]: Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/i386/rdrand-1.c (dg-final): Update scan string.
* gcc.target/i386/rdrand-2.c (dg-final): Ditto.
* gcc.target/i386/rdrand-3.c (dg-final): Ditto.
David Edelsohn [Mon, 17 Aug 2020 00:10:47 +0000 (20:10 -0400)]
aix: Support libgfortran libcaf_single.a as a FAT library
Build libgfortran static library libcaf_single.a as a FAT 32/64 bit library.
libgfortran/ChangeLog:
2020-08-17 David Edelsohn <dje.gcc@gmail.com>
Clement Chigot <clement.chigot@atos.net>
* config/t-aix: Add complementary mode object file to libcaf_single.a.
Jonathan Wakely [Fri, 7 Aug 2020 16:13:56 +0000 (17:13 +0100)]
libstdc++: Remove inheritance from elements in std::tuple
This fixes a number of std::tuple bugs by no longer making use of the
empty base-class optimization. By using the C++20 [[no_unique_address]]
attribute we can always store the element as a data member, while still
compressing the layout of tuples containing empty types.
Since we no longer use inheritance we could also apply the compression
optimization for final types and for tuples of tuples, but doing so
would be an ABI break.
Using [[no_unique_address]] more liberally for the unstable std::__8
configuration is left for a later date. There may be reasons not to
apply the attribute unconditionally, e.g. see the discussion about
guaranteed elision in PR 94062.
libstdc++-v3/ChangeLog:
PR libstdc++/55713
PR libstdc++/71096
PR libstdc++/93147
* include/std/tuple [__has_cpp_attribute(no_unique_address)]
(_Head_base<Idx, Head, true>): New definition of the partial
specialization, using [[no_unique_address]] instead of
inheritance.
* testsuite/libstdc++-prettyprinters/48362.cc: Adjust expected
output.
* testsuite/20_util/tuple/comparison_operators/93147.cc: New test.
* testsuite/20_util/tuple/creation_functions/55713.cc: New test.
* testsuite/20_util/tuple/element_access/71096.cc: New test.
Martin Liska [Mon, 17 Aug 2020 09:14:13 +0000 (11:14 +0200)]
opnemp: add static assert for clause_names.
gcc/fortran/ChangeLog:
* openmp.c (resolve_omp_clauses): Add static assert
for OMP_LIST_NUM and size of clause_names array.
Remove check that is always true.
Aldy Hernandez [Tue, 4 Aug 2020 10:18:21 +0000 (12:18 +0200)]
Add statement context to get_value_range.
This is in line with the statement context that we have for get_value()
in the substitute_and_fold_engine class.
gcc/ChangeLog:
* vr-values.c (vr_values::get_value_range): Add stmt param.
(vr_values::extract_range_from_comparison): Same.
(vr_values::extract_range_from_assignment): Pass stmt to
extract_range_from_comparison.
(vr_values::adjust_range_with_scev): Pass stmt to get_value_range.
(simplify_using_ranges::vrp_evaluate_conditional): Add stmt param.
Pass stmt to get_value_range.
(simplify_using_ranges::vrp_visit_cond_stmt): Pass stmt to
get_value_range.
(simplify_using_ranges::simplify_abs_using_ranges): Same.
(simplify_using_ranges::simplify_div_or_mod_using_ranges): Same.
(simplify_using_ranges::simplify_bit_ops_using_ranges): Same.
(simplify_using_ranges::simplify_cond_using_ranges_1): Same.
(simplify_using_ranges::simplify_switch_using_ranges): Same.
(simplify_using_ranges::simplify_float_conversion_using_ranges): Same.
* vr-values.h (class vr_values): Add stmt arg to
vrp_evaluate_conditional_warnv_with_ops.
Add stmt arg to extract_range_from_comparison and get_value_range.
(simplify_using_ranges::get_value_range): Add stmt arg.
Martin Liska [Mon, 17 Aug 2020 08:37:24 +0000 (10:37 +0200)]
openmp: fix UBSAN error at gcc/fortran/openmp.c:4737
Since
21cfe724cbdc30612bf1ef59b26f19ada2210832 there's a new
OMP_LIST_NONTEMPORAL value, but it was missing in
resolve_omp_clauses static array that is defined at the function
beginning:
./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/gomp/nontemporal-1.f90 -fopenmp -c
../../gcc/fortran/openmp.c:4737:28: runtime error: index 21 out of bounds for type 'char *[21]'
#0 0xbdb956 in resolve_omp_clauses ../../gcc/fortran/openmp.c:4737
#1 0xbeb076 in resolve_omp_do ../../gcc/fortran/openmp.c:6139
#2 0xbf029a in gfc_resolve_omp_directive(gfc_code*, gfc_namespace*) ../../gcc/fortran/openmp.c:6792
#3 0xcb6363 in gfc_resolve_code(gfc_code*, gfc_namespace*) ../../gcc/fortran/resolve.c:12185
#4 0xcef8cf in resolve_codes ../../gcc/fortran/resolve.c:17303
gcc/fortran/ChangeLog:
* openmp.c (resolve_omp_clauses): Add NONTEMPORAL to clause
names.
liuhongt [Tue, 4 Aug 2020 02:00:13 +0000 (10:00 +0800)]
Force ENDBR immediate into memory.
gcc/
PR target/96350
* config/i386/i386.c (ix86_legitimate_constant_p): Return
false for ENDBR immediate.
(ix86_legitimate_address_p): Ditto.
* config/i386/predicates.md
(x86_64_immediate_operand): Exclude ENDBR immediate.
(x86_64_zext_immediate_operand): Ditto.
(x86_64_dwzext_immediate_operand): Ditto.
(ix86_endbr_immediate_operand): New predicate.
gcc/testsuite
* gcc.target/i386/endbr_immediate.c: New test.
GCC Administrator [Mon, 17 Aug 2020 00:16:19 +0000 (00:16 +0000)]
Daily bump.
Roger Sayle [Sun, 16 Aug 2020 18:20:27 +0000 (19:20 +0100)]
middle-end: Simplify (sign_extend:HI (truncate:QI (ashiftrt:HI X 8)))
The combination of several my recent nvptx patches has revealed an
interesting RTL optimization opportunity. This patch to simplify-rtx.c
simplifies (sign_extend:HI (truncate:QI (?shiftrt:HI x 8))) to just
(ashiftrt:HI x 8), as the inner shift already sets the high bits
appropriately. The equivalent zero_extend variant appears to already
be implemented in simplify_unary_operation_1.
These result from RTL expansion generating a reasonable arithmetic right
shift and truncation to char, only to then discover the backend doesn't
support QImode comparisons, so the next optab widens this result/operand
back to HImode. In this sequence the truncate and sign extend are
redundant as the original arithmetic shift has already set the high
bits appropriately. The one oddity of the patch is that it tests for
LSHIFTRT as inner shift, as simplify/combine has already canonicalized
this to a logical shift, assuming that the distinction is unimportant
following the truncatation.
2020-08-16 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* simplify-rtx.c (simplify_unary_operation_1) [SIGN_EXTEND]:
Simplify (sign_extend:M (truncate:N (lshiftrt:M x C))) to
(ashiftrt:M x C) when the shift sets the high bits appropriately.
Sergei Trofimovich [Sun, 16 Aug 2020 08:24:38 +0000 (09:24 +0100)]
MAINTAINERS: Add myself for write after approval
2020-08-16 Sergei Trofimovich <slyfox@gcc.gnu.org>
* MAINTAINERS (Write After Approval): Add myself.
GCC Administrator [Sun, 16 Aug 2020 00:16:21 +0000 (00:16 +0000)]
Daily bump.
GCC Administrator [Sat, 15 Aug 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.
Nathan Sidwell [Fri, 14 Aug 2020 23:53:43 +0000 (16:53 -0700)]
c++: Final bit of name-lookup api simplification
We no longer need to give name_lookup_real not name_lookup_nonclass
different names to the name_lookup functions. This renames the lookup
functions thusly.
gcc/cp/
* name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
to ...
(lookup_name): ... these new overloads.
* name-lookup.c (identifier_type_value_1): Rename lookup_name_real
call.
(lookup_name_real_1): Rename to ...
(lookup_name_1): ... here.
(lookup_name_real): Rename to ...
(lookup_name): ... here. Rename lookup_name_real_1 call.
(lookup_name_nonclass): Delete.
* call.c (build_operator_new_call): Rename lookup_name_real call.
(add_operator_candidates): Likewise.
(build_op_delete_call): Rename lookup_name_nonclass call.
* parser.c (cp_parser_lookup_name): Likewise.
* pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
(tsubst_expr): Likewise.
* semantics.c (capture_decltype): Likewise.
libcc1/
* libcp1plugin.cc (plugin_build_dependent_expr): Rename
lookup_name_real call.
Martin Sebor [Fri, 14 Aug 2020 23:11:53 +0000 (17:11 -0600)]
PR tree-optimization/78257 - missing memcmp optimization with constant arrays
gcc/ChangeLog:
PR middle-end/78257
* builtins.c (expand_builtin_memory_copy_args): Rename called function.
(expand_builtin_stpcpy_1): Remove argument from call.
(expand_builtin_memcmp): Rename called function.
(inline_expand_builtin_bytecmp): Same.
* expr.c (convert_to_bytes): New function.
(constant_byte_string): New function (formerly string_constant).
(string_constant): Call constant_byte_string.
(byte_representation): New function.
* expr.h (byte_representation): Declare.
* fold-const-call.c (fold_const_call): Rename called function.
* fold-const.c (c_getstr): Remove an argument.
(getbyterep): Define a new function.
* fold-const.h (c_getstr): Remove an argument.
(getbyterep): Declare a new function.
* gimple-fold.c (gimple_fold_builtin_memory_op): Rename callee.
(gimple_fold_builtin_string_compare): Same.
(gimple_fold_builtin_memchr): Same.
gcc/testsuite/ChangeLog:
PR middle-end/78257
* gcc.dg/memchr.c: New test.
* gcc.dg/memcmp-2.c: New test.
* gcc.dg/memcmp-3.c: New test.
* gcc.dg/memcmp-4.c: New test.
David Malcolm [Fri, 14 Aug 2020 19:49:52 +0000 (15:49 -0400)]
analyzer: fix initialization from constant pool [PR96609,PR96616]
PR testsuite/96609 and PR analyzer/96616 report various testsuite
failures seen on powerpc64, aarch64, and arm in new tests added by
r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d.
Some of these failures (in gcc.dg/analyzer/init.c, and on arm
in gcc.dg/analyzer/casts-1.c) relate to initializations from var_decls
in the constant pool. I wrote the tests assuming that the gimplified
stmts would initialize the locals via a gassign of code CONSTRUCTOR,
whereas on these targets some of the initializations are gassign from
a VAR_DECL e.g.:
c = *.LC0;
where "*.LC0" is a var_decl with DECL_IN_CONSTANT_POOL set.
For example, in test_7:
struct coord c[2] = {{3, 4}, {5, 6}};
__analyzer_eval (c[0].x == 3); /* { dg-warning "TRUE" } */
after the initialization, the store was simply recording:
cluster for: c: INIT_VAL(*.LC0)
when I was expecting the cluster for c to have:
cluster for: c
key: {kind: direct, start: 0, size: 32, next: 32}
value: 'int' {(int)3}
key: {kind: direct, start: 32, size: 32, next: 64}
value: 'int' {(int)4}
key: {kind: direct, start: 64, size: 32, next: 96}
value: 'int' {(int)5}
key: {kind: direct, start: 96, size: 32, next: 128}
value: 'int' {(int)6}
The test for c[0].x == 3 would then generate:
cluster for: _2: (SUB(SUB(INIT_VAL(*.LC0), c[(int)0]), c[(int)0].x)==(int)3)
which is UNKNOWN, leading to the test failing.
This patch fixes the init.c and casts-1.c failures by special-casing
reads from a var_decl with DECL_IN_CONSTANT_POOL set, so that they build
a compound_svalue containing the bindings implied by the CONSTRUCTOR
node for DECL_INITIAL.
gcc/analyzer/ChangeLog:
PR testsuite/96609
PR analyzer/96616
* region-model.cc (region_model::get_store_value): Call
maybe_get_constant_value on decl_regions first.
* region-model.h (decl_region::maybe_get_constant_value): New decl.
* region.cc (decl_region::get_stack_depth): Likewise.
(decl_region::maybe_get_constant_value): New.
* store.cc (get_subregion_within_ctor): New.
(binding_map::apply_ctor_to_region): New.
* store.h (binding_map::apply_ctor_to_region): New decl.
David Malcolm [Fri, 14 Aug 2020 14:48:30 +0000 (10:48 -0400)]
analyzer: fix ICE on escaped unknown pointers [PR96611]
PR analyzer/96611 reports an ICE within the handling for unknown
functions, when passing a pointer to something accessed via a
global pointer, after an unknown function has already been called.
The first unknown function leads to the store being flagged, so
the access to the global pointer leads to (*unknown_svalue) for
the base region of the argument to the 2nd function, and thus
*unknown_svalue being reachable by the 2nd unknown function,
triggering an assertion failure.
Handle this case by rejecting attempts to get a cluster for
the unknown pointer, fixing the ICE.
gcc/analyzer/ChangeLog:
PR analyzer/96611
* store.cc (store::mark_as_escaped): Reject attempts to
get a cluster for an unknown pointer.
gcc/testsuite/ChangeLog:
PR analyzer/96611
* gcc.dg/analyzer/pr96611.c: New test.
David Malcolm [Fri, 14 Aug 2020 14:48:48 +0000 (10:48 -0400)]
analyzer: document how to get gimple dump from an ICE
gcc/ChangeLog:
* doc/analyzer.texi (Overview): Add tip about how to get a
gimple dump if the analyzer ICEs.
Nathan Sidwell [Fri, 14 Aug 2020 16:55:33 +0000 (09:55 -0700)]
c++: Yet more name-lookup api simplification
This patch deals with LOOKUP_HIDDEN, which originally meant 'find
hidden friends', but it's being pressed into service for not ignoring
lambda-relevant internals. However these two functions are different.
(a) hidden friends can occur in block scope (very uncommon) and (b) it
had the semantics of stopping after the innermost enclosing
namepspace. That's really suspect for the lambda case, but not
relevant there because we never get to namespace scope (I think).
Anyway, I've split the flag into two and adjusted the lambda callers
to just search block scope. These two flags are added to the
LOOK_want enum class, which allows dropping another parameter from the
name lookup routines.
The remaining LOOKUP_$FOO flags in cp-tree.h are, I think, now all
related to features of overload resolution, conversion operators and
reference binding. Nothing to do with /name/ lookup.
gcc/cp/
* cp-tree.h (LOOKUP_HIDDEN): Delete.
(LOOKUP_PREFER_RVALUE): Adjust initializer.
* name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
HIDDEN_LAMBDA flags.
(lookup_name_real): Drop flags parm.
(lookup_qualified_name): Drop find_hidden parm.
* name-lookup.c (class name_lookup): Drop hidden field, adjust
ctors.
(name_lookup::add_overload): Check want for hiddenness.
(name_lookup::process_binding): Likewise.
(name_lookup::search_unqualified): Likewise.
(identifier_type_value_1): Adjust lookup_name_real call.
(set_decl_namespace): Adjust name_lookup ctor.
(qualify_lookup): Drop flags parm, use want for hiddenness.
(lookup_qualified_name): Drop find_hidden parm.
(lookup_name_real_1): Drop flags parm, adjust qualify_lookup
calls.
(lookup_name_real): Drop flags parm.
(lookup_name_nonclass, lookup_name): Adjust lookup_name_real
calls.
(lookup_type_scope_1): Adjust qualify_lookup calls.
* call.c (build_operator_new_call): Adjust lookup_name_real call.
(add_operator_candidates): Likewise.
* coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
call.
* parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
* pt.c (check_explicit_specialization): Adjust
lookup_qualified_name call.
(deduction_guides_for): Likewise.
(tsubst_friend_class): Adjust lookup_name_real call.
(lookup_init_capture_pack): Likewise.
(tsubst_expr): Likewise, don't look in namespaces.
* semantics.c (capture_decltype): Adjust lookup_name_real. Don't
look in namespaces.
libcc1/
* libcp1plugin.cc (plugin_build_dependent_exp): Adjust
lookup_name_real call.
Jason Merrill [Wed, 12 Aug 2020 09:45:02 +0000 (05:45 -0400)]
c++: Copy elision and [[no_unique_address]]. [PR93711]
We don't elide a copy from a function returning a class by value into a base
because that can overwrite data laid out in the tail padding of the base
class; we need to handle [[no_unique_address]] fields the same way, or we
ICE when the middle-end wants to create a temporary object of a
TYPE_NEEDS_CONSTRUCTING type.
This means that we can't always express initialization of a field with
INIT_EXPR from a TARGET_EXPR the way we usually do, so I needed
to change several places that were assuming that was sufficient.
This also fixes 90254, the same problem with C++17 aggregate initialization
of a base.
gcc/cp/ChangeLog:
PR c++/90254
PR c++/93711
* cp-tree.h (unsafe_return_slot_p): Declare.
* call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
(build_over_call): Check unsafe_return_slot_p.
(build_special_member_call): Likewise.
* init.c (expand_default_init): Likewise.
* typeck2.c (split_nonconstant_init_1): Likewise.
gcc/testsuite/ChangeLog:
PR c++/90254
PR c++/93711
* g++.dg/cpp1z/aggr-base10.C: New test.
* g++.dg/cpp2a/no_unique_address7.C: New test.
* g++.dg/cpp2a/no_unique_address7a.C: New test.
Nathan Sidwell [Fri, 14 Aug 2020 13:04:51 +0000 (06:04 -0700)]
c++: More simplification of name_lookup api
Continuing fixing name lookup's API we have two parameters saying what
we'd like to find 'prefer_type', which is a tri-valued boolan with
meaning 'don't care', 'type or namespace', 'type or death'. And we
have a second parameter 'namespaces_only', which means 'namespace or
death'. There are only 4 states, because the latter one has priority.
Firstly 'prefer_type' isn't really the right name -- it's not a preference,
it's a requirement. Name lookup maps those two parameters into 2 LOOKUP_
bits. We can simply have callers express that desire directly.
So this adds another enum class, LOOK_want, which expresses all
those options in 2 bits. Most of this patch is then the expected fallout
from such a change. The parser was mapping its internal state into
a prefer_type value, which was then mapped into the LOOKUP_ bits. So this
saves a conversion there. Also the parser's conversion routine had an
'is_template' flag, which was only ever true in one place, where the parser
also had to deal with other nuances of the flags to pass. So just drop
that parm and deal with it at the call site too.
I've left LOOKUP_HIDDEN alone for the moment. That'll be next.
gcc/cp/
* cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
(LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
(LOOKUP_QUALIFIERS_ONL): Delete.
(LOOKUP_HIDDEN): Adjust.
* name-lookup.h (enum class LOOK_want): New.
(operator|, operator&): Overloads for it.
(lookup_name_real): Replace prefer_type & namespaces_only with
LOOK_want parm.
(lookup_qualified_name): Replace prefer_type with LOOK_want.
(lookup_name_prefer_type): Replace with ...
(lookup_name): ... this. New overload with LOOK_want parm.
* name-lookup.c (struct name_lookup): Replace flags with want and
hidden fields. Adjust constructors.
(name_lookyp::add_overload): Correct hidden stripping test. Update
for new LOOK_want type.
(name_lookup::process_binding): Likewise.
(name_lookup::search_unqualified): Use hidden flag.
(identifier_type_value_1): Adjust lookup_name_real call.
(set_decl_namespace): Adjust name_lookup ctor.
(lookup_flags): Delete.
(qualify_lookup): Add LOOK_want parm, adjust.
(lookup_qualified_name): Replace prefer_type parm with LOOK_want.
(lookup_name_real_1): Replace prefer_type and namespaces_only with
LOOK_want parm.
(lookup_name_real): Likewise.
(lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
(lookup_name_prefer_type): Rename to ...
(lookup_name): ... here. New overload with LOOK_want parm.
(lookup_type_scope_1): Adjust qualify_lookup calls.
* call.c (build_operator_new_call)
(add_operator_candidates): Adjust lookup_name_real calls.
* coroutines.cc (find_coro_traits_template_decl)
(find_coro_handle_template_decl, morph_fn_to_coro): Adjust
lookup_qualified_name calls.
* cp-objcp-common.c (identifier_global_tag): Likewise.
* decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
(lookup_and_check_tag): Use lookup_name overload.
* parser.c (cp_parser_userdef_numeric_literal): Adjust
lookup_qualified_name call.
(prefer_arg_type): Drop template_mem_access parm, return LOOK_want
value.
(cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
calls.
* pt.c (check_explicit_specialization): Adjust lookup_qualified_name
call.
(tsubst_copy_and_build, tsubst_qualified_name): Likewise
(deduction_guides_for): Likewise.
(tsubst_friend_class): Adjust lookup_name_real call.
(lookup_init_capture, tsubst_expr): Likewise.
* rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
* semantics.c (omp_reduction_lookup): Likewise.
(capture_decltype): Adjust lookup_name_real call.
libcc1/
* libcp1plugin.cc (plugin_build_dependent_expr): Adjust
lookup_name_real & lookup_qualified_name calls.
Uros Bizjak [Fri, 14 Aug 2020 14:40:56 +0000 (16:40 +0200)]
i386: Improve LWP builtin expanders.
Use parameterized pattern names to simplify calling of named patterns.
2020-08-14 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/i386-builtin.def (__builtin_ia32_llwpcb)
(__builtin_ia32_slwpcb, __builtin_ia32_lwpval32)
(__builtin_ia32_lwpval64, __builtin_ia32_lwpins32)
(__builtin_ia32_lwpins64): Use CODE_FOR_nothing.
* config/i386/i386.md (@lwp_llwpcb<mode>):
Implement as parametrized name pattern.
(@lwp_slwpcb<mode>): Ditto.
(@lwp_lwpval<mode>): Ditto.
(@lwp_lwpins<mode>): Ditto.
* config/i386/i386-expand.c (ix86_expand_special_args_builtin)
[case VOID_FTYPE_UINT_UINT_UINT, case VOID_FTYPE_UINT64_UINT_UINT]
[case UCHAR_FTYPE_UINT_UINT_UINT, case UCHAR_FTYPE_UINT64_UINT_UINT]:
Remove.
(ix86_expand_builtin)
[ case IX86_BUILTIN_LLWPCB, case IX86_BUILTIN_LLWPCB]:
Update for parameterized name patterns.
[case IX86_BUILTIN_LWPVAL32, case IX86_BUILTIN_LWPVAL64]
[case IX86_BUILTIN_LWPINS32, case IX86_BUILTIN_LWPINS64]: Expand here.
Lewis Hyatt [Thu, 13 Aug 2020 17:05:46 +0000 (13:05 -0400)]
diagnostics: Add new option -fdiagnostics-plain-output
Adds the new option -fdiagnostics-plain-output, which is an alias for
several others:
-fno-diagnostics-show-caret
-fno-diagnostics-show-line-numbers
-fdiagnostics-color=never
-fdiagnostics-urls=never
The idea is that in the future, if the default behavior of diagnostics is
changed to add some fancy feature or other, then the
-fdiagnostics-plain-output option will also be changed accordingly so that
the old behavior is preserved in the presence of this option. This allows
us to use -fdiagnostics-plain-output in in the testsuite, such that the
testsuite (specifically the setting of TEST_ALWAYS_FLAGS in prune.exp)
does not need to be touched whenever diagnostics get a new look. This also
removes the need to add workarounds to compat.exp for every new option
that may be needed in a newer version of the compiler, but is not
supported in older versions.
gcc/ChangeLog:
* common.opt: Add new option -fdiagnostics-plain-output.
* doc/invoke.texi: Document it.
* opts-common.c (decode_cmdline_options_to_array): Implement it.
(decode_cmdline_option): Add missing const qualifier to argv.
libstdc++-v3/ChangeLog:
* testsuite/lib/libstdc++.exp: Use the new option
-fdiagnostics-plain-output.
gcc/testsuite/ChangeLog:
* lib/prune.exp: Change TEST_ALWAYS_FLAGS to use -fdiagnostics-plain-output.
* lib/c-compat.exp: Adapt to the prune.exp change.
Jakub Jelinek [Fri, 14 Aug 2020 07:29:47 +0000 (09:29 +0200)]
vec: Fix bootstrap on i686-linux, 32-bit darwin and AIX
As mentioned earlier, embedded_size is broken on vecs of long long, double
etc. on some platforms, which breaks bootstrap.
E.g. on i686-linux, the problem is mostly with older GCC versions being used
as stage1 compiler (GCC 4.8 to 7.* in particular), because alignas (long long)
makes U 64-bit aligned, while when long long m_vecdata[1]; is in vec, it is
only 32-bit aligned. We've tried various ways and the following one seems
to work, use the old way (offsetof (vec, m_vecdata)) for non-class types
as well as standard layout class types, i.e. whenever offsetof is guaranteed
to work, and for others use the new day (in that case we don't run into
problems with long long or other scalar types and for the structure layout
there is just a struct with a given alignment.
2020-08-14 Jakub Jelinek <jakub@redhat.com>
Jonathan Wakely <jwakely@redhat.com>
* system.h: Include type_traits.
* vec.h (vec<T, A, vl_embed>::embedded_size): Use offsetof and asserts
on vec_stdlayout, which is conditionally a vec (for standard layout T)
and otherwise vec_embedded.
Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>