Commit Graph

183759 Commits

Author SHA1 Message Date
Jakub Jelinek
5bf998275a testsuite: Fix up pr99305.C test on unsigned_char targets [PR99498]
On unsigned_char targets, the cast stmt to unsigned char is obviously
not needed (and shouldn't be there).  But it doesn't hurt to test
the rest also on targets where char is unsigned.

2021-03-10  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/99305
	PR testsuite/99498
	* g++.dg/opt/pr99305.C: Don't expect cast to unsigned char on
	unsigned_char effective targets.
2021-03-10 17:40:25 +01:00
John David Anglin
71dc5ae574 Add options to link with libatomic in various tests.
libstdc++-v3/ChangeLog:

	* testsuite/29_atomics/atomic/wait_notify/bool.cc: Add options to
	link with libatomic.
	* testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise.
	* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
	* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
	* testsuite/30_threads/barrier/arrive.cc: Likewise.
	* testsuite/30_threads/barrier/arrive_and_drop.cc: Likewise.
	* testsuite/30_threads/barrier/arrive_and_wait.cc: Likewise.
	* testsuite/30_threads/barrier/completion.cc: Likewise.
	* testsuite/30_threads/latch/3.cc: Likewise.
	* testsuite/30_threads/semaphore/try_acquire.cc: Likewise.
	* testsuite/30_threads/semaphore/try_acquire_for.cc: Likewise.
	* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.
2021-03-10 16:01:12 +00:00
Nathan Sidwell
b97af562b5 c++: Propagate assembler name from local-externs [PR 99508]
This is another place where our one-true-decl representation breaks
down.  The fix here propagates the assembly name to the ns-scope
alias.  that fixes the reported problem but changes the behaviour when
the user has explicitly declared the entity in its namespace.
However, we didn't handle that case 'correctly' anyway before.
Previously we'd also ignore the explicitly specified assembler name,
now we propagate it.  It's not clear to me what the desired semantics
would be in decorating just one of the local extern declarations this
way.  I don't think we can really do better without propagating this
aliasing property into the middle end (which is also needed for some
constexpr handling, see PR97306).  I tried that before and it turned
into a rat-hole.

	PR c++/99508
	gcc/cp/
	* decl.c (make_rtl_for_nonlocal_decl): Propagate local-extern's
	assembler name to the ns alias.
	gcc/testsuite/
	* g++.dg/ext/pr99508.C: New.
2021-03-10 07:50:32 -08:00
Jonathan Wakely
47cca0288d libstdc++: Fix headers that can't be used as header units [PR 99413]
This adds missing includes to internal library headers which get
included from more than one other header, so that they can be compiled
as a stand-alone header unit.

For existing use cases these includes are no-ops because they're already
done by the header that includes these files. For compiling them as a
header unit, this ensures that they include what they use.

libstdc++-v3/ChangeLog:

	PR libstdc++/99413
	* include/bits/align.h: Include debug/assertions.h.
	* include/bits/codecvt.h: Include bits/c++config.h.
	* include/bits/enable_special_members.h: Likewise.
	* include/bits/erase_if.h: Likewise.
	* include/bits/functional_hash.h: Include <type_traits>.
	* include/bits/invoke.h: Include bits/move.h.
	* include/bits/ostream_insert.h: Include bits/exception_defines.h.
	* include/bits/parse_numbers.h: Include <type_traits>.
	* include/bits/predefined_ops.h: Include bits/c++config.h.
	* include/bits/range_access.h: Include bits/stl_iterator.h.
	* include/bits/stl_bvector.h: Do not include bits/stl_vector.h.
	* include/bits/stl_iterator.h: Include bits/stl_iterator_base_types.h.
	* include/bits/stl_uninitialized.h: Include bits/stl_algobase.h.
	* include/bits/uniform_int_dist.h: Include bits/concept_check.h.
	* include/bits/unique_lock.h: Include bits/std_mutex.h.
	* include/debug/assertions.h: Include bits/c++config.h.
2021-03-10 15:27:41 +00:00
Jonathan Wakely
dddd011113 libstdc++: Implement LWG 3530 for concept-constrained comparisons
The proposed resolution for this library issue simplifies the
constraints for compare_three_way, ranges::equal_to, ranges::less etc.
so that they do not work with types which are convertible to pointers
but which fail to meet the usual syntactic requirements for the
comparisons.

This affects the example in PR libstdc++/93628 but doesn't fix the
problem described in that report.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_cmp.h (__eq_builtin_ptr_cmp): Remove.
	(ranges::equal_to, ranges::not_equal_to): Do not constrain
	with __eq_builtin_ptr_cmp.
	(ranges::less, ranges::greater, ranges::less_equal)
	(ranges::greater_equal): Do not constrain with
	__less_builtin_ptr_cmp.
	* libsupc++/compare (compare_three_way): Do not constrain with
	__3way_builtin_ptr_cmp.
	* testsuite/18_support/comparisons/object/builtin-ptr-three-way.cc: Moved to...
	* testsuite/18_support/comparisons/object/lwg3530.cc: ...here.
	* testsuite/20_util/function_objects/range.cmp/lwg3530.cc: New test.
2021-03-10 15:27:06 +00:00
Alex Coplan
b6073c9faa aarch64: Fix typo in aarch64.c comment
This fixes a typo in the description of
aarch64_vfp_is_call_or_return_candidate.

gcc/ChangeLog:

	* config/aarch64/aarch64.c (aarch64_vfp_is_call_or_return_candidate):
	Fix typo in comment describing "is_ha" argument.
2021-03-10 15:11:16 +00:00
John David Anglin
cb33c7276a Add LRA target selector.
gcc/ChangeLog:

	* doc/sourcebuild.texi: Document LRA target selector.

gcc/testsuite/ChangeLog:

	PR testsuite/99292
	* lib/target-supports.exp (check_effective_target_lra): New.
	* gcc.c-torture/compile/asmgoto-2.c: Use LRA target selector.
	* gcc.c-torture/compile/asmgoto-5.c: Likewise.
	* gcc.c-torture/compile/pr98096.c: Likewise.
	* gcc.dg/pr97954.c: Likewise.
2021-03-10 14:59:49 +00:00
David Malcolm
46b52b4ae1 analyzer: remove some no-longer-needed -Wno-analyzer-too-complex
A couple of analyzer testcases no longer have state explosions; updating
them accordingly in case they regress.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/pr94047.c: Remove "-Wno-analyzer-too-complex".
	* gcc.dg/analyzer/zlib-2.c: Likewise.
2021-03-10 08:54:02 -05:00
David Malcolm
c4a36bb1e1 docs: add interactive vs batch distinction to UX guidelines
gcc/ChangeLog:
	* doc/ux.texi: Add subsection contrasting interactive versus
	batch usage of GCC.
2021-03-10 08:49:29 -05:00
Joel Hutton
3fbac260fc [testsuite] Fix target selector for pr99102.c
The target selector should explicitly choose 256 bit hardware as
explicit 256 bit compiler options are used to trigger the bug.

gcc/testsuite/ChangeLog:

	* gcc.dg/vect/pr99102.c: Fix target selector.
2021-03-10 13:28:46 +00:00
Joel Hutton
99d5299376 [Vect] Fix mask check on Scatter loads/stores
Previously, IFN_MASK_SCATTER_STORE was used if 'loop_masks' was
non-null, but the mask used is 'final_mask'. This caused a bug where
a 'MASK_STORE' was vectorized into a 'SCATTER_STORE' instead of a
'MASK_SCATTER_STORE'. This fixes PR target/99102.

gcc/ChangeLog:

	PR target/99102
	* tree-vect-stmts.c (vectorizable_store): Fix scatter store mask
	check condition.
	(vectorizable_load): Fix gather load mask check condition.

gcc/testsuite/ChangeLog:

	PR target/99102
	* gcc.dg/vect/pr99102.c: New test.
2021-03-10 12:26:21 +00:00
Richard Biener
6ceb712e26 tree-optimization/99510 - fix type reuse of build_aligned_type
The fix for PR94775 added more strict checking for type reuse
to check_aligned_type, specifically matching TYPE_USER_ALIGN.
But then build_aligned_type sets TYPE_USER_ALIGN on the built
variant so if the type we build an aligned variant for does not
have TYPE_USER_ALIGN we'll never re-use the newly created aligned
variant.  This results in ~35000 identical variants being created
for polyhedron doduc.

The following instead checks that the candidate has TYPE_USER_ALIGN set.

2021-03-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99510
	* tree.c (check_aligned_type): Check that the candidate
	has TYPE_USER_ALIGN set instead of matching with the
	original type.
2021-03-10 13:13:51 +01:00
Eric Botcazou
47403a0eef Do not assume that __float128 exists
The code in build_round_expr implicitly assumes that __float128 exists,
which is *not* the common case among 64-bit architectures since the
"long double" type is generally already 128-bit for them.

gcc/fortran/
	PR fortran/96983
	* trans-intrinsic.c (build_round_expr): Do not implicitly assume
	that __float128 is the 128-bit floating-point type.
2021-03-10 12:32:03 +01:00
Eric Botcazou
1c3c12b0a6 Fix ICE on atomic enumeration type with LTO
This is a strange regression whereby an enumeration type declared as
atomic (or volatile) incorrectly triggers the ODR machinery for its
values in LTO mode.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity): Build a TYPE_STUB_DECL
	for the main variant of an enumeration type declared as volatile.
gcc/testsuite/
	* gnat.dg/specs/lto25.ads: New test.
2021-03-10 12:32:03 +01:00
Eric Botcazou
da7343a6f4 Fix miscompilation of Ada runtime on 64-bit SPARC
Returning a REGMODE_NATURAL_SIZE of 4 for DFmode in 64-bit mode is
just asking for trouble because sub-word SUBREGs are always treated
differently than the others, in particular by the register allocator.

gcc/
	* config/sparc/sparc.c (sparc_regmode_natural_size): Return 4 for
	float and vector integer modes only if the mode is not larger.
2021-03-10 12:32:03 +01:00
Jonathan Wakely
e7afb82c35 libstdc++: Uncomment more parts of <chrono> synopsis test
libstdc++-v3/ChangeLog:

	* testsuite/std/time/syn_c++20.cc: Enable synopsis checks for
	C++20 calendar types.
2021-03-10 11:14:27 +00:00
Hans-Peter Nilsson
5987d8a79c cris: define DWARF_FRAME_REGISTERS
When DWARF_FRAME_REGISTERS isn't defined, the default is
FIRST_PSEUDO_REGISTER which means that if you add faked
registers to the port, used for frame-context related
elimination, room is allocated for them in the register
context used for frame-unwinding, which is wasteful because
they're eliminated before the final form of the code that is
emitted.

Stopping after MOF saves two register slots in the unwind
contest, compared to the current default.  For regular C
programming this is uninteresting, but defining
DWARF_FRAME_REGISTERS now also avoids the need to remember
to define it later, when twiddling with additional faked
registers (alternatively suffering churn from comparing
differences in unwind context).  As expected, no effect on
test-results, coremark or local (C-specific)
microbenchmarks.

gcc:
	* config/cris/cris.h (DWARF_FRAME_REGISTERS): Define.
2021-03-10 04:01:30 +01:00
GCC Administrator
8dc225d311 Daily bump. 2021-03-10 00:16:43 +00:00
Vladimir N. Makarov
63d74fed45 IRA: Process digital constraints containing more one digit
gcc/ChangeLog:

	* ira.c (ira_setup_alts, ira_get_dup_out_num): Process digital
	constraints > 9.
	* ira-lives.c (single_reg_class): Ditto.
2021-03-09 17:19:52 -05:00
Sebastian Huber
0455cd76b6 RTEMS: Fix -Werror builds
Fix build errors due to warnings such as:

gcc/config/v850/rtems.h:43: error: "RTEMS_STARTFILE_SPEC" redefined [-Werror]
   43 | #define RTEMS_STARTFILE_SPEC ""

The problem was that "gcc/config/rtems.h" was included before the
architecture-specific "gcc/config/*/rtems.h" header file on some
architectures.

gcc/

	* config.gcc (aarch64-*-rtems*): Include general rtems.h after
	the architecture-specific rtems.h.
	(aarch64-*-rtems*): Likewise.
	(arm*-*-rtems*): Likewise.
	(epiphany-*-rtems*): Likewise.
	(riscv*-*-rtems*): Likewise.
2021-03-09 19:44:06 +01:00
Jakub Jelinek
b610c30453 phiopt: Fix up conditional_replacement [PR99305]
Before my PR97690 changes, conditional_replacement would not set neg
when the nonzero arg was boolean true.
I've simplified the testing, so that it first finds the zero argument
and then checks the other argument for all the handled cases
(1, -1 and 1 << X, where the last case is what the patch added support for).
But, unfortunately I've placed the integer_all_onesp test first.
For unsigned precision 1 types such as bool integer_all_onesp, integer_onep
and integer_pow2p can all be true and the code set neg to true in that case,
which is undesirable.

The following patch tests integer_pow2p first (which is trivially true
for integer_onep too and tree_log2 in that case gives shift == 0)
and only if that isn't the case, integer_all_onesp.

2021-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/99305
	* tree-ssa-phiopt.c (conditional_replacement): Test integer_pow2p
	before integer_all_onesp instead of vice versa.

	* g++.dg/opt/pr99305.C: New test.
2021-03-09 19:13:11 +01:00
Segher Boessenkool
c60ad1c5fe rs6000: Fix check_effective_target_sqrt_insn (PR99352)
The previous version returned true for all PowerPC.  This is incorrect.
We only support floating point square root instructions if a) we support
floating point instructions at all, and b) we have _ARCH_PPCSQ defined.

2020-03-09  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/
	* lib/target-supports.exp (check_effective_target_powerpc_sqrt): New.
	(check_effective_target_sqrt_insn): Use it.
2021-03-09 17:10:33 +00:00
Richard Earnshaw
a1e4fc19d9 arm: fix bootstrap failure following automatic mode selection patch
Fix a signed vs unsigned comparison in last change.

gcc:
	* common/config/arm/arm-common.c (arm_config_default): Change type
	of 'i' to unsigned.
2021-03-09 17:02:53 +00:00
Vladimir N. Makarov
fb5d9e8361 [PR99454] LRA: Process separately 'g' and digital constraints > 9 in process_address_1
gcc/ChangeLog:

	PR target/99454
	* lra-constraints.c (process_address_1): Process constraint 'g'
	separately and digital constraints containing more one digit.

gcc/testsuite/ChangeLog:

	PR target/99454
	* gcc.target/i386/pr99454.c: New.
2021-03-09 11:10:29 -05:00
Mikael Pettersson
9f8be03500 Re: [PATCH v2] fix Ada bootstrap on Cygwin64 (PR bootstrap/94918)
gcc/ada/
	* raise-gcc.c: On Cygwin include mingw32.h to prevent
	windows.h from including x86intrin.h or emmintrin.h.
2021-03-09 08:59:55 -07:00
Jakub Jelinek
4e252e23d3 c++: Fix coroutines on targetm.cxx.cdtor_return_this targets [PR99459]
The r11-7528 build_co_await changes broke coroutines on arm*-linux-gnuabi,
2780 ^FAIL.*coroutines/ in total.
The problem is that arm is targetm.cxx.cdtor_return_this target where
both ctors and dtors in the ABI return this pointer rather than
void, and build_new_method_call_1 does:
              else if (call != error_mark_node
                       && DECL_DESTRUCTOR_P (cand->fn)
                       && !VOID_TYPE_P (TREE_TYPE (call)))
                /* An explicit call of the form "x->~X()" has type
                   "void".  However, on platforms where destructors
                   return "this" (i.e., those where
                   targetm.cxx.cdtor_returns_this is true), such calls
                   will appear to have a return value of pointer type
                   to the low-level call machinery.  We do not want to
                   change the low-level machinery, since we want to be
                   able to optimize "delete f()" on such platforms as
                   "operator delete(~X(f()))" (rather than generating
                   "t = f(), ~X(t), operator delete (t)").  */
                call = build_nop (void_type_node, call);
The new code in build_co_await relies on build_special_member_call
returned expression being a CALL_EXPR, but due to the build_nop
in there it is a NOP_EXPR around the CALL_EXPR.  It can't be stripped
with STRIP_NOPS because void has different mode from the pointer mode.

2021-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR c++/99459
	* coroutines.cc (build_co_await): Look through NOP_EXPRs in
	build_special_member_call return value to find the CALL_EXPR.
	Simplify.
2021-03-09 16:44:27 +01:00
Nick Clifton
01d0ba06f7 Fix building the RX port of gcc.
* config/rx/rx.h (DBX_DEBUGGING_INFO): Define.
	(DWARF"_DEBUGGING_INFO): Define.
2021-03-09 15:29:23 +00:00
Eric Botcazou
9f05c276ce Assorted testsuite fixes
First, gcc.dg/array-quals-1.c does not pass if the compiler is configured
with --enable-default-pie because the sections change, so force -fno-pie.
Second, replace *-*-solaris* with sparc*-*-* for gfortran.dg/pr95690.f90
because this depends on the architecture rather than the OS.  Third force
SRA to trigger on Aarch64 (like PowerPC) for gnat.dg/opt39.adb.

gcc/testsuite/
	* gcc.dg/array-quals-1.c: Pass -fno-pie if supported.
	* gcc.dg/loop-9.c: Likewise.
	* gfortran.dg/pr95690.f90: Replace *-*-solaris* with sparc*-*-*.
	* gnat.dg/opt39.adb: Pass --param option for Aarch64 too.
2021-03-09 16:22:55 +01:00
Eric Botcazou
defafb78cb Fix internal error on lambda function
This boils down to the RTL expander trying to take the address of a DECL
whose RTX is a register.

gcc/
	PR c++/90448
	* calls.c (initialize_argument_information): When the argument
	is passed by reference, do not make a copy in a thunk only if
	the argument is already in memory.  Remove redundant test for
	the case of callee copy.
2021-03-09 16:22:55 +01:00
Vladimir N. Makarov
9725df0233 [PR99454] LRA: Process 0..9 constraints in process_address_1
We need to process 0..9 constraints to fetch the right op constraint in
the function.  Also 0..9 constraints gives unknown class constraint
class which can result in skipping address normalization for memory in asm.

gcc/ChangeLog:

	PR target/99454
	* lra-constraints.c (process_address_1): Process 0..9 constraints
	in process_address_1.
2021-03-09 09:06:17 -05:00
Andreas Krebbel
43c66b1606 IBM Z: arch14 fix option string used for Binutils
gcc/ChangeLog:

	* config/s390/s390.c (struct s390_processor processor_table):
	Binutils name string must not be empty.
2021-03-09 14:51:50 +01:00
Jakub Jelinek
ea7fff4c43 testsuite: Fix up pr98920.c on non-glibc or old glibc targets [PR98920]
Not all OSes have regex.h and not all OSes that do have REG_STARTEND macro support.
Conditionalize the test on that.

2021-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/98920
	* c-c++-common/asan/pr98920.c: Only include regex.h if the header
	exists.  If REG_STARTEND macro isn't defined, just return 0 from main
	instead of the actual test.
2021-03-09 14:15:26 +01:00
Nathan Sidwell
4b3d86a776 c++: Clarify note about -fmodules-ts [PR 99472]
This clarifies that c++2[03] intentionally does not enable
c++20 modules.

	PR c++/99472
	gcc/cp/
	* parser.c (cp_parser_diagnose_invalid_type_name): Clarify
	that C++20 does not yet imply modules.
2021-03-09 05:11:47 -08:00
Claudiu Zissulescu
08ce558985 arc: Remove orphan function.
Remove unused function.

gcc/
2021-03-09  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (arc_attr_type): Remove function.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2021-03-09 12:32:20 +02:00
Martin Liska
eb5e1998e2 i386: Properly set ix86_isa_flags
gcc/ChangeLog:

	PR target/99464
	* config/i386/i386-options.c (ix86_option_override_internal):
	Set isa_flags for OPTS argument and not for the global
	global_options.

gcc/testsuite/ChangeLog:

	PR target/99464
	* gcc.target/i386/pr99464.c: New test.
2021-03-09 09:26:55 +01:00
Aaron Sawdey
e5cdf6968b Checked in non-final version of patch in commit 9433c844c8
Not sure what I did but this corrects it to the version that I tested
and that Segher approved.

gcc/ChangeLog
	* config/rs6000/predicates.md (ds_form_mem_operand): Check
	in correct code.
2021-03-08 22:18:03 -06:00
Joel Brobecker
7eef9a6601 add powerpc_vsx_ok requirement to undef-bool tests
These tests use -mvsx in their dg-options lists, so they are only
applicable if the -mvsx option is supported by the compiler.

for  gcc/testsuite/ChangeLog

	* gcc.target/powerpc/undef-bool-2.c: Add
	dg-require-effective-target powerpc_vsx_ok directive.
	* g++.dg/ext/undef-bool-1.C: Add dg-require-effective-target
	powerpc_vsx_ok directive.
2021-03-08 23:59:37 -03:00
Aaron Sawdey
9433c844c8 Tighten predicates for p10 ld/cmpi fusion
PR99070 is caused by a fusion pattern matching that the individual
instructions do not match when it is split later. In this case the
ld+cmpi patterns were allowing a d-form load address, which the split
condition would rightly split, however that left us with something that
could not be matched by a ds-form ld instruction, hence the ICE. This
only happened if the target cpu was not power10 -- if we were targeting
power10 then a prefixed pld instruction would get generated because that
can handle d-form. However this is not optimal code either.

So the solution is a new predicate (ds_form_mem_operand) that only
accepts what we can take as for a ds-form load. Then a small
modification of the genfusion.pl script changes the relevant
ld+cmpi patterns to use the new predicate.

gcc/ChangeLog

	PR target/99070
	* config/rs6000/predicates.md (ds_form_mem_operand) New
	predicate.
	* config/rs6000/genfusion.pl (gen_ld_cmpi_p10) Use
	ds_form_mem_operand in ld/lwa patterns.
	* config/rs6000/fusion.md: Regenerate file.
2021-03-08 20:49:47 -06:00
Ian Lance Taylor
d5d3f15a0e runtime: cast SIGSTKSZ to uintptr
In newer versions of glibc it is long, which causes a signed
comparison warning.

Fixes PR go/99458
2021-03-08 16:23:31 -08:00
GCC Administrator
6405b40f4a Daily bump. 2021-03-09 00:16:57 +00:00
Joseph Myers
ee73fb5713 Update cpplib eo.po.
* eo.po: Update.
2021-03-08 23:48:05 +00:00
Joseph Myers
ff73350578 Update gcc de.po, sv.po.
* de.po, sv.po: Update.
2021-03-08 23:47:01 +00:00
Jeff Law
75897e3d78 Adjust my email address to a personal one
* MAINTAINERS: Update my email address
2021-03-08 15:33:29 -07:00
Harald Anlauf
bd85b4dd2d PR fortran/49278 - ICE when combining DATA with default initialization
A variable with the PARAMETER attribute may not appear in a DATA statement.

gcc/fortran/ChangeLog:

	PR fortran/49278
	* data.c (gfc_assign_data_value): Reject variable with PARAMETER
	attribute in DATA statement.

gcc/testsuite/ChangeLog:

	PR fortran/49278
	* gfortran.dg/parameter_data.f90: New test.
2021-03-08 21:59:20 +01:00
Martin Sebor
f3daa6c0fd PR middle-end/98266 - bogus array subscript is partly outside array bounds on virtual inheritance
gcc/ChangeLog:

	PR middle-end/98266
	* gimple-array-bounds.cc (inbounds_vbase_memaccess_p): New function.
	(array_bounds_checker::check_array_bounds): Call it.

gcc/testsuite/ChangeLog:

	PR middle-end/98266
	* g++.dg/warn/Warray-bounds-15.C: New test.
	* g++.dg/warn/Warray-bounds-18.C: New test.
	* g++.dg/warn/Warray-bounds-19.C: New test.
	* g++.dg/warn/Warray-bounds-20.C: New test.
	* g++.dg/warn/Warray-bounds-21.C: New test.
2021-03-08 13:37:21 -07:00
Martin Sebor
7f5ff78ff3 PR middle-end/97631 - bogus "writing one too many bytes" warning for memcpy with strlen argument
gcc/ChangeLog:

	PR middle-end/97631
	* tree-ssa-strlen.c (maybe_warn_overflow): Test rawmem.
	(handle_builtin_stxncpy_strncat): Rename locals.  Determine
	destination size from allocation calls.  Issue a more appropriate
	kind of warning.
	(handle_builtin_memcpy): Pass true as rawmem to maybe_warn_overflow.
	(handle_builtin_memset): Same.

gcc/testsuite/ChangeLog:

	PR middle-end/97631
	* c-c++-common/Wstringop-overflow.c: Remove unexpected warnings.
	Add an xfail.
	* c-c++-common/Wstringop-truncation.c: Add expected warnings.
	* gcc.dg/Wstringop-overflow-10.c: Also enable -Wstringop-truncation.
	* gcc.dg/Wstringop-overflow-66.c: New test.
	* gcc.dg/tree-ssa/strncpy-2.c: Adjust expected warning.
2021-03-08 13:28:52 -07:00
Marek Polacek
b64551af51 c++: Add test for PR96268.
This works since the recent r11-7102, but we didn't have a test for
a template-argument context.

gcc/testsuite/ChangeLog:

	PR c++/96268
	* g++.dg/cpp2a/nontype-class41.C: New test.
2021-03-08 15:27:20 -05:00
Nathan Sidwell
bc56d27de9 C++: Enable c++2b module mode [PR 99436]
This adds support for c++23 mode to modules, and enables such testing.

	PR c++/99436
	gcc/cp/
	* name-lookup.c (get_cxx_dialect_name): Add cxx23.
	gcc/testsuite/
	* g++.dg/modules/modules.exp (MOD_STD_LIST): Add 2b.
2021-03-08 11:58:00 -08:00
Nathan Sidwell
504450c708 c++: Poor diagnostic in header-unit [PR 99468]
We didn't specifically check for a module-decl inside a header unit.
That leads to a confusing diagostic.  Fixed thusly.

	gcc/cp/
	* lex.c (module_token_filter::resume): Ignore module-decls inside
	header-unit.
	* parser.c (cp_parser_module_declaration): Reject in header-unit.
	gcc/testsuite/
	* g++.dg/modules/pr99468.H: New.
2021-03-08 10:40:09 -08:00
Peter Bergner
cb25dea3ef rs6000: Fix invalid splits when using Altivec style addresses [PR98959]
The rs6000_emit_le_vsx_* functions assume they are not passed an Altivec
style "& ~16" address.  However, some of our expanders and splitters do
not verify we do not have an Altivec style address before calling those
functions, leading to an ICE.  The solution here is to guard the expanders
and splitters to ensure we do not call them if we're given an Altivec style
address.

2021-03-08  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	PR target/98959
	* config/rs6000/rs6000.c (rs6000_emit_le_vsx_permute): Add an assert
	to ensure we do not have an Altivec style address.
	* config/rs6000/vsx.md (*vsx_le_perm_load_<mode>): Disable if passed
	an Altivec style address.
	(*vsx_le_perm_store_<mode>): Likewise.
	(splitters after *vsx_le_perm_store_<mode>): Likewise.
	(vsx_load_<mode>): Disable special expander if passed an Altivec
	style address.
	(vsx_store_<mode>): Likewise.

gcc/testsuite/
	PR target/98959
	* gcc.target/powerpc/pr98959.c: New test.
2021-03-08 12:21:39 -06:00