Commit Graph

183353 Commits

Author SHA1 Message Date
Jonathan Wakely
bfdb7b8c6f libstdc++: Clear up directories created by tests
libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/operations/remove_all.cc: Remove
	test directory after making it writable again.
	* testsuite/experimental/filesystem/operations/remove_all.cc:
	Likewise.
2021-02-09 16:54:41 +00:00
Nathan Sidwell
92941cea2f c++: Fix indirect partitions [PR 98944]
The most recent reimplementation of module loading initialization
changed the behaviour of setting an import's location, and broke some
partition handling.

	PR c++/98944
	gcc/cp/
	* module.cc (module_state::is_rooted): Rename to ...
	(module_state::has_location): ... here.  Adjust callers.
	(module_state::read_partitions): Adjust validity check.
	Don't overwrite a known location.
	gcc/testsuite/
	* g++.dg/modules/pr98944_a.C: New.
	* g++.dg/modules/pr98944_b.C: New.
	* g++.dg/modules/pr98944_c.C: New.
	* g++.dg/modules/pr98944_d.C: New.
2021-02-09 08:17:12 -08:00
Jonathan Wakely
26a3f288f1 libstdc++: Make coroutine_handle<_Promise>::from_address() noexcept [PR 99021]
The coroutine_handle<void>::from_address(void*) version is already
noexcept, and they do the same thing. Make them consistent.

libstdc++-v3/ChangeLog:

	PR libstdc++/99021
	* include/std/coroutine (coroutine_handle<P>::from_address): Add
	noexcept.
2021-02-09 12:31:52 +00:00
Vladimir Vishnevsky
adeaa43ad3 libstdc++: Fix build failure for targets without unistd.h
The patch fixes build issues occurring if build parameter
"--enable-cstdio=stdio_pure" is specified and no unistd.h is
present in the environment.

libstdc++-v3/ChangeLog:

	* include/ext/stdio_sync_filebuf.h: Remove unused <unistd.h>.
	* src/c++17/fs_ops.cc (fs::permissions): Qualify mode_t.
2021-02-09 12:31:52 +00:00
Richard Biener
396cc31317 Fix O(region-size) unwind in VN
This fixes the currently O(region-size) unwinding of avail info
to be O(unwind-size) by tracking a linked-list stack of pushed
avails.  This reduces the compile-time spent in complete unrolling
for WRF.

2021-02-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98863
	* tree-ssa-sccvn.h (vn_avail::next_undo): Add.
	* tree-ssa-sccvn.c (last_pushed_avail): New global.
	(rpo_elim::eliminate_push_avail): Chain pushed avails.
	(unwind_state::avail_top): Add.
	(do_unwind): Rewrite unwinding of avail entries.
	(do_rpo_vn): Initialize last_pushed_avail and
	avail_top of the undo state.
2021-02-09 13:06:55 +01:00
Jakub Jelinek
e14ea108fa string: Add a workaround for -Wstringop-overread false positives [PR98465]
In the PR there are several possibilities how to improve _M_disjunct at
least in certain cases so that the compiler can figure out at least in some
cases where __s is provably disjunct from _M_data() ... _M_data() + this->size()
but it is probably GCC 12 material.

The false positive warning is on this particular copy, which is done for
non-disjunct pointers when __len2 > __len1 and the __s >= __p + __len1,
i.e. __s used to point to the characters moved through _S_move a few lines earlier
by __len2 - __len1 characters up to make space.  That is why the
_S_copy source is __s + __len2 - __len1.  Unfortunately, when the compiler
can't prove objects are disjunct, that copying from __s + __len2 - __len1
of __len2 characters can very well mean accessing characters the source
object (if it is not disjunct) provably can't have.

The following patch works around that by making the _S_copy be a __p based
pointer instead of __s based pointer.
__s + __len2 - __len1
and
__p + (__s - __p) + (__len2 - __len1)
have the same value and the latter may seem to be uselessly longer,
but it seems at least currently in GIMPLE we keep it that way and so that is
what the warning code during expansion will see, and only actually
optimize it to __s + __len2 - __len1 during RTL when we lose information
on what is a pointer and what is a mere offset with the same mode.

So, in the end we emit exactly the same assembly, just without the false
positive warning.

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

	PR middle-end/98465
	* include/bits/basic_string.tcc (basic_string::_M_replace): When __s
	points to the characters moved by earlier _S_move, compute the source
	address using expression based on the __p pointer rather than __s
	pointer.

	* g++.dg/warn/Wstringop-overread-1.C: New test.
2021-02-09 12:32:43 +01:00
Jakub Jelinek
e5304598f1 calls: Fix a memory leak in maybe_warn_rdwr_sizes [PR99004]
The print_generic_expr_to_str function ends with
return xstrdup (...); and therefore expects the caller to free
the argument.

The following patch does that after it has been copied.
Instead of doing const_cast to cast away const char * to char *,
because the code uses s0 and s1 in so few places, I chose just
to change the types of the two variables so that const_cast
is not needed.  After all, it is a heap allocated string that
this function owns and so if it wanted, it could change it too.

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

	PR middle-end/99004
	* calls.c (maybe_warn_rdwr_sizes): Change s0 and s1 type from
	const char * to char * and free those pointers after use.
2021-02-09 12:29:32 +01:00
Richard Biener
283653f455 tree-optimization/99017 - be more forgiving in BB vect costing
This works around a SLP graph partitioning or cost collecting issue
by being more forgiving in vect_bb_vectorization_profitable_p.

2021-02-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99017
	* tree-vect-slp.c (vect_bb_vectorization_profitable_p): Allow
	zero vector cost entries.
2021-02-09 10:11:35 +01:00
Jason Merrill
57d705da0b c++: consteval and explicit instantiation [PR96905]
Normally, an explicit instantiation means we want to write out the
instantiation.  But not for a consteval function.

gcc/cp/ChangeLog:

	PR c++/96905
	* pt.c (mark_decl_instantiated): Exit early if consteval.

gcc/testsuite/ChangeLog:

	PR c++/96905
	* g++.dg/cpp2a/consteval-expinst1.C: New test.
2021-02-08 20:52:11 -05:00
Jason Merrill
bdbca69e07 c++: generic lambda, fn* conv, empty class [PR98326]
Here, in the thunk returned from the captureless lambda conversion to
pointer-to-function, we try to pass through invisible reference parameters
by reference, without doing a copy.  The empty class copy optimization was
messing that up.

gcc/cp/ChangeLog:

	PR c++/98326
	PR c++/20408
	* cp-gimplify.c (simple_empty_class_p): Don't touch an invisiref
	parm.

gcc/testsuite/ChangeLog:

	PR c++/98326
	* g++.dg/cpp1y/lambda-generic-empty1.C: New test.
2021-02-08 20:51:51 -05:00
Jason Merrill
a8dd2b3e96 c++: constexpr, union, and no_unique_address [PR98994]
My second patch for 97566 omits nested CONSTRUCTORs for empty fields, but we
do want them for empty union members.

gcc/cp/ChangeLog:

	PR c++/98994
	PR c++/97566
	* constexpr.c (cxx_eval_store_expression): Only skip empty fields in
	RECORD_TYPE.

gcc/testsuite/ChangeLog:

	PR c++/98994
	* g++.dg/cpp2a/no_unique_address12.C: New test.
2021-02-08 20:51:24 -05:00
GCC Administrator
2da7ce23cf Daily bump. 2021-02-09 00:16:30 +00:00
Nathan Sidwell
efcd941e86 c++: cleanup function name [PR 98531]
The next piece of 98531 is that in some cases we need to create a
cleanup function to do the work (when the object is an array, or we're
using regular atexit).  We were not pushing that function's decl
anywhere (not giving it a context) so streaming it failed.

This is a partial fix.  You'll notice we're naming these from a per-TU
counter.  I've captured that in PR98893.

	gcc/cp/
	* decl.c (start_cleanup_fn): Push function into
	namespace.
	gcc/testsuite/
	* g++.dg/modules/pr98531-2.h: New.
	* g++.dg/modules/pr98531-2_a.H: New.
	* g++.dg/modules/pr98531-2_b.C: New.
	* g++.dg/modules/pr98531-3.h: New.
	* g++.dg/modules/pr98531-3_a.H: New.
	* g++.dg/modules/pr98531-3_b.C: New.
2021-02-08 09:24:39 -08:00
Nathan Sidwell
57b17858a1 c++: cross-module __cxa_atexit use [PR 98531]
The compiler's use of lazily-declared library functions must insert
said functions into a symbol table, so that they can be correctly
merged across TUs at the module-level.  We have too many different
ways of declaring such library functions.  This fixes __cxa_atexit (or
its system-specific variations), pushing (or merging) the decl into
the appropriate namespace.  Because we're pushing a lazy builtin,
check_redeclaration_exception_specification needed a tweak to allow a
such a builtin's eh spec to differ from what the user may have already
declared. (I suspect no all headers declare atexit as noexcept.)

We can't test the -fno-use-cxa-atexit path with modules, as that
requires a followup patch to a closely related piece (which also
affects cxa_atexit targets in other circumstances).

	PR c++/98531
	gcc/cp/
	* cp-tree.h (push_abi_namespace, pop_abi_namespace): Declare.
	* decl.c (push_abi_namespace, pop_abi_namespace): Moved
	from rtti.c, add default namespace arg.
	(check_redeclaration_exception_specification): Allow a lazy
	builtin's eh spec to differ from an lready-declared user
	declaration.
	(declare_global_var): Use push/pop_abi_namespace.
	(get_atexit_node): Push the fndecl into a namespace.
	* rtti.c (push_abi_namespace, pop_abi_namespace): Moved to
	decl.c.
	gcc/testsuite/
	* g++.dg/modules/pr98531-1.h: New.
	* g++.dg/modules/pr98531-1_a.H: New.
	* g++.dg/modules/pr98531-1_b.C: New.
	* g++.dg/abi/pr98531-1.C: New.
	* g++.dg/abi/pr98531-2.C: New.
	* g++.dg/abi/pr98531-3.C: New.
	* g++.dg/abi/pr98531-4.C: New.
2021-02-08 09:24:39 -08:00
Mike Frysinger
432b9f610d mklog: automatically fill in generated entries
contrib/ChangeLog:

	* mklog.py (generated_files): New set.
	(generate_changelog): Add entries based on generated_files.
2021-02-08 11:52:30 -05:00
Marek Polacek
ec0a9b4e03 c++: Fix typo in CLASSTYPE_TI_TEMPLATE comment.
gcc/cp/ChangeLog:

	* cp-tree.h (CLASSTYPE_TI_TEMPLATE): Fix typo.
2021-02-08 11:35:26 -05:00
Andre Vieira
40c92180df middle-end/98974 - fixup after STMT_VINFO_VEC_STMTS rework
This fixes up the nvectors parameter passed to vect_get_loop_mask in
vectorizable_condition after the STMT_VINFO_VEC_STMTS rework.

gcc/ChangeLog:
2021-02-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	PR middle-end/98974
	* tree-vect-stmts.c (vectorizable_condition): Remove shadow vec_num
	parameter in vectorizable_condition.

gcc/testsuite/ChangeLog:
2021-02-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	PR middle-end/98974
	* gfortran.dg/pr98974.F90: New test.
2021-02-08 16:04:18 +00:00
Richard Biener
d4536e4313 lto/96591 - walk VECTOR_CST elements in walk_tree
This implements walking of VECTOR_CST elements in walk_tree, mimicing
the walk of COMPLEX_CST elements.  Without this free-lang-data fails
to see some types in case they are only refered to via tree constants
used only as VECTOR_CST elements.

2021-02-08  Richard Biener  <rguenther@suse.de>

	PR lto/96591
	* tree.c (walk_tree_1): Walk VECTOR_CST elements.

	* g++.dg/lto/pr96591_0.C: New testcase.
2021-02-08 13:05:44 +01:00
Martin Liska
0d701e3eb8 opts: fix handling of -fpatchable-function-entries option
gcc/ChangeLog:

	PR lto/98971
	* cfgexpand.c (pass_expand::execute): Parse per-function option
	flag_patchable_function_entry and use it.
	* common.opt: Remove function_entry_patch_area_size and
	function_entry_patch_area_start global variables.
	* opts.c (parse_and_check_patch_area): New function.
	(common_handle_option): Use it.
	* opts.h (parse_and_check_patch_area): New function.
	* toplev.c (process_options): Parse and use
	function_entry_patch_area_size.
2021-02-08 12:31:24 +01:00
Martin Sebor
fe2034e9c0 Correct typos in attribute malloc documentation.
gcc/ChangeLog:
	* doc/extend.texi (attribute malloc): Correct typos.
2021-02-07 17:24:23 -07:00
GCC Administrator
ba65576027 Daily bump. 2021-02-08 00:16:25 +00:00
GCC Administrator
3d912941f2 Daily bump. 2021-02-07 00:16:19 +00:00
GCC Administrator
1ed5912764 Daily bump. 2021-02-06 00:16:39 +00:00
Joseph Myers
a1265ee478 Regenerate .pot files.
gcc/po/
	* gcc.pot: Regenerate.

libcpp/po/
	* cpplib.pot: Regenerate.
2021-02-05 21:40:13 +00:00
Iain Buclaw
28c7a463e3 d: Remove the expansion of intrinsic and built-in codes from the DEF_D_INTRINSIC macro
Instead, the full name of these codes are explicitly given in
intrinsics.def, to make it clear what these values map to.

gcc/d/ChangeLog:

	* d-tree.h (DEF_D_INTRINSIC): Don't insert INTRINSIC_ into the
	intrinsic code name.
	* intrinsics.cc (DEF_D_INTRINSIC): Don't insert INTRISIC_ and
	BUILT_IN_ into the intrinsic and built-in code names.
	* intrinsics.def:  Explicitly use full intrinsic and built-in
	codes in all definitions.
2021-02-05 18:27:49 +01:00
Marek Polacek
7a18bc4ae6 c++: Fix bogus -Wvolatile warning in C++20 [PR98947]
Since most of volatile is deprecated in C++20, we are required to warn
for compound assignments to volatile variables and so on.  But here we
have

  volatile int x, y, z;
  (b ? x : y) = 1;

and we shouldn't warn, because simple assignments like x = 24; should
not provoke the warning when they are a discarded-value expression.

We warn here because when ?: is used as an lvalue, we transform it in
cp_build_modify_expr/COND_EXPR from (a ? b : c) = rhs to

  (a ? (b = rhs) : (c = rhs))

and build_conditional_expr then calls mark_lvalue_use for the new
artificial assignments, which then evokes the warning.  The calls
to mark_lvalue_use were added in r160289 to suppress warnings in
Wunused-var-10.c, but looks like they're no longer needed.

To warn on

    (b ? (x = 2) : y) = 1;
    (b ? x : (y = 5)) = 1;

I've tweaked a check in mark_use/MODIFY_EXPR.

I'd argue this is a regression because GCC 9 doesn't warn.

gcc/cp/ChangeLog:

	PR c++/98947
	* call.c (build_conditional_expr_1): Don't call mark_lvalue_use
	on arg2/arg3.
	* expr.c (mark_use) <case MODIFY_EXPR>: Don't check read_p when
	issuing the -Wvolatile warning.  Only set TREE_THIS_VOLATILE if
	a warning was emitted.

gcc/testsuite/ChangeLog:

	PR c++/98947
	* g++.dg/cpp2a/volatile5.C: New test.
2021-02-05 11:11:04 -05:00
Marek Polacek
1cbc10d894 c++: Fix ICE with invalid using enum [PR96462]
Here we ICE in finish_nonmember_using_decl -> lookup_using_decl ->
... -> find_namespace_slot because "name" is not an IDENTIFIER_NODE.
It is a BIT_NOT_EXPR because this broken test uses

  using E::~E; // SCOPE::NAME

A using-decl can't refer to a destructor, and lookup_using_decl already
checks that in the class member case.  But in C++17, we do the "enum
scope is the enclosing scope" block, and so scope gets set to ::, and
we go into the NAMESPACE_DECL block.  In C++20 we don't do it, we go
to the ENUMERAL_TYPE block.

I resorted to hoisting the check along with a diagnostic tweak: we
don't want to print "::::~E names destructor".

gcc/cp/ChangeLog:

	PR c++/96462
	* name-lookup.c (lookup_using_decl): Hoist the destructor check.

gcc/testsuite/ChangeLog:

	PR c++/96462
	* g++.dg/cpp2a/using-enum-8.C: New test.
2021-02-05 10:43:51 -05:00
Nathan Sidwell
6606b852bf driver: error for nonexistent linker inputs [PR 98943]
We used to check all unknown input files, even when passing them to a
compiler.  But that caused problems.  However, not erroring out on
non-existent would-be-linker inputs confuses configure machinery that
probes the compiler to see if it accepts various inputs.  This
restores the access check for things that are thought to be linker
input files, when we're not linking.  (If we are linking, we presume
the linker will error out on its own accord.)

	PR driver/98943
	gcc/
	* gcc.c (driver::maybe_run_linker): Check for input file
	accessibility if not linking.
	gcc/testsuite/
	* c-c++-common/pr98943.c: New.
2021-02-05 05:32:34 -08:00
Richard Biener
63538886d1 tree-optimization/98855 - redo BB vectorization costing
The following attempts to account for the fact that BB vectorization
regions now can span multiple loop levels and that an unprofitable
inner loop vectorization shouldn't be offsetted by a profitable
outer loop vectorization to make it overall profitable.

For now I've implemented a heuristic based on the premise that
vectorization should be profitable even if loops may not be entered
or if they iterate any number of times.  Especially the first
assumption then requires that stmts directly belonging to loop A
need to be costed separately from stmts belonging to another loop
which also simplifies the implementation.

On x86 the added testcase has in the outer loop

t.c:38:20: note: Cost model analysis for part in loop 1:
  Vector cost: 56
  Scalar cost: 192

and the inner loop

t.c:38:20: note: Cost model analysis for part in loop 2:
  Vector cost: 132
  Scalar cost: 48

and thus the vectorization is considered not profitable
(note the same would happen in case the 2nd cost were for
a loop outer to the 1st costing).

Future enhancements may consider static knowledge of whether
a loop is always entered which would allow some inefficiency
in the vectorization of its loop header.  Likewise stmts only
reachable from a loop exit can be treated this way.

2021-02-05  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98855
	* tree-vectorizer.h (add_stmt_cost): New overload.
	* tree-vect-slp.c (li_cost_vec_cmp): New.
	(vect_bb_slp_scalar_cost): Cost individual loop regions
	separately.  Account for the scalar instance root stmt.

	* g++.dg/vect/slp-pr98855.cc: New testcase.
2021-02-05 14:03:00 +01:00
Tom de Vries
4ede02a5f2 debug: fix switch lowering debug info
gcc/ChangeLog:

	PR debug/98656
	* tree-switch-conversion.c (jump_table_cluster::emit): Add loc
	argument.
	(bit_test_cluster::emit): Reuse location_t for newly created
	gswitch statement.
	(switch_decision_tree::try_switch_expansion): Preserve
	location_t.
	* tree-switch-conversion.h: Change function signatures.
2021-02-05 13:26:00 +01:00
Jakub Jelinek
37876976b0 i386: Fix up TARGET_QIMODE_MATH for many AMD CPU tunings [PR98957]
As written in the PR, TARGET_QIMODE_MATH was meant to be set for all
tunings and it was the case for GCC <= 7, but as the number of
PROCESSOR_* enumerators grew, some AMD tunings (which are at the end
of the list) over time got enumerators with values >= 32 and
TARGET_QIMODE_MATH became disabled for them, in GCC 8 for 2
tunings, in GCC 9 for 7 tunings, in GCC 10 for 8 tunings, and
on the trunk for 11 tunings.

The following patch fixes it by using uhwis rather than uints
and gives them also symbolic names.

2021-02-05  Jakub Jelinek  <jakub@redhat.com>

	PR target/98957
	* config/i386/i386-options.c (m_NONE, m_ALL): Define.
	* config/i386/x86-tune.def (X86_TUNE_BRANCH_PREDICTION_HINTS,
	X86_TUNE_PROMOTE_QI_REGS): Use m_NONE instead of 0U.
	(X86_TUNE_QIMODE_MATH): Use m_ALL instead of ~0U.
2021-02-05 10:39:03 +01:00
Jakub Jelinek
b229baa75c c++: Fix ICE with structured binding initialized to incomplete array [PR97878]
We ICE on the following testcase, for incomplete array a on auto [b] { a }; without
giving any kind of diagnostics, with auto [c] = a; during error-recovery.
The problem is that we get too far through check_initializer and e.g.
store_init_value -> constexpr stuff can't deal with incomplete array types.

As the type of the structured binding artificial variable is always deduced,
I think it is easiest to diagnose this early, even if they have array types
we'll need their deduced type to be complete rather than just its element
type.

2021-02-05  Jakub Jelinek  <jakub@redhat.com>

	PR c++/97878
	* decl.c (check_array_initializer): For structured bindings, require
	the array type to be complete.

	* g++.dg/cpp1z/decomp54.C: New test.
2021-02-05 10:22:07 +01:00
Kyrylo Tkachov
d9bb52150d aarch64: Reimplement vget_high* intrinsics
Similar to the vget_low* intrinsics we should just use a proper vec_select rather than
going through V2DI subregs.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (get_high): Define builtin.
	* config/aarch64/aarch64-simd.md (aarch64_get_high<mode>): Define.
	* config/aarch64/arm_neon.h (__GET_HIGH): Delete.
	(vget_high_f16): Reimplement using new builtin.
	(vget_high_f32): Likewise.
	(vget_high_f64): Likewise.
	(vget_high_p8): Likewise.
	(vget_high_p16): Likewise.
	(vget_high_p64): Likewise.
	(vget_high_s8): Likewise.
	(vget_high_s16): Likewise.
	(vget_high_s32): Likewise.
	(vget_high_s64): Likewise.
	(vget_high_u8): Likewise.
	(vget_high_u16): Likewise.
	(vget_high_u32): Likewise.
	(vget_high_u64): Likewise.
2021-02-05 09:17:57 +00:00
Kyrylo Tkachov
b6e7a74987 aarch64: Reimplement vget_low* intrinsics
We can do better on the vget_low* intrinsics.
Currently they reinterpret their argument into a V2DI vector and extract the low "lane",
reinterpreting that back into the shorter vector.
This is functionally correct and generates a sequence of subregs and a vec_select that, by itself,
gets optimised away eventually.
However it's bad when we want to use the result in a other SIMD operations.
Then the subreg-vec_select-subreg combo blocks many combine patterns.

This patch reimplements them to emit a proper low vec_select from the start.
It generates much cleaner RTL and allows for more aggressive combinations, particularly
with the patterns that Jonathan has been pushing lately.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (get_low): Define builtin.
	* config/aarch64/aarch64-simd.md (aarch64_get_low<mode>): Define.
	* config/aarch64/arm_neon.h (__GET_LOW): Delete.
	(vget_low_f16): Reimplement using new builtin.
	(vget_low_f32): Likewise.
	(vget_low_f64): Likewise.
	(vget_low_p8): Likewise.
	(vget_low_p16): Likewise.
	(vget_low_p64): Likewise.
	(vget_low_s8): Likewise.
	(vget_low_s16): Likewise.
	(vget_low_s32): Likewise.
	(vget_low_s64): Likewise.
	(vget_low_u8): Likewise.
	(vget_low_u16): Likewise.
	(vget_low_u32): Likewise.
	(vget_low_u64): Likewise.
2021-02-05 08:14:07 +00:00
Kito Cheng
072f20c555 PR target/98878 - Incorrect multilib list for riscv*-rtems
- Multi-lib only check the default argument is appeared in the multilib
   flag list, but we didn't check the case that the flag is required but
   default argument didn't provide.

 - For example riscv*-rtems has a multilib set:

     rv32imafd/ilp32d;@march=rv32imafd@mabi=ilp32d

   And when we set the default argument of arch to rv32imafdc and ABI to
   ilp32d, gcc will check the ilp32d is matched, but it didn't check
   rv32imafd is not provided by default arguments, so it should not
   reuse default library.

 - The side effcet of this patch is csky-elf target will increase the
   number of multilib from 54 to 59, but it's because genmultilib didn't
   know the default argument for multilib, so I think it could be
   improved in future.

gcc/ChangeLog:

	* gcc.c (print_multilib_info): Check all required argument is provided
	by default arg.
2021-02-05 14:26:16 +08:00
liuhongt
8d0737d8f4 Fix ICE: Don't generate integer mask comparision for 128/256-bits vector when op_true/op_false are NULL or constm1_rtx/const0_rtx [PR98537]
avx512vl-pr92686-vpcmp-{1,2,intelasm-1}.c are used to guard code
generation of integer mask comparison, but for vector comparison to
vector dest, integer mask comparison is disliked, so delete these
useless tests.

gcc/ChangeLog:

	PR target/98537
	* config/i386/i386-expand.c (ix86_expand_sse_cmp): Don't
	generate integer mask comparison for 128/256-bits vector when
	op_true/op_false is NULL_RTX or CONSTM1_RTX/CONST0_RTX. Also
	delete redundant !maskcmp condition.
	(ix86_expand_int_vec_cmp): Ditto but no redundant deletion
	here.
	(ix86_expand_sse_movcc): Delete definition of maskcmp, add the
	condition directly to if (maskcmp), add extra check for
	cmpmode, it should be MODE_INT.
	(ix86_expand_fp_vec_cmp): Pass NULL to ix86_expand_sse_cmp's
	parameters op_true/op_false.
	(ix86_use_mask_cmp_p): New.

gcc/testsuite/ChangeLog:

	PR target/98537
	* g++.target/i386/avx512bw-pr98537-1.C: New test.
	* g++.target/i386/avx512vl-pr98537-1.C: New test.
	* g++.target/i386/avx512vl-pr98537-2.C: New test.
	* gcc.target/i386/avx512vl-pr88547-1.c: Adjust testcase,
	integer mask comparison should not be generated.
	* gcc.target/i386/avx512vl-pr92686-vpcmp-1.c: Remove.
	* gcc.target/i386/avx512vl-pr92686-vpcmp-2.c: Ditto.
	* gcc.target/i386/avx512vl-pr92686-vpcmp-intelasm-1.c: Ditto.
2021-02-05 09:59:36 +08:00
liuhongt
b80fefd626 Enable X86_TUNE_AVX256_UNALIGNED_{LOAD,STORE}_OPTIMAL in generic tune.
gcc/ChangeLog:

	PR target/98172
	* config/i386/x86-tune.def (X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL):
	Remove m_GENERIC from ~list.
	(X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL): Ditto.
2021-02-05 09:56:49 +08:00
GCC Administrator
a19dd5e644 Daily bump. 2021-02-05 00:16:23 +00:00
Julian Brown
b2d84e9f9c openacc: Tests for character types in derived-type mappings
This patch adds some tests for character types that are components of
derived types used in OpenACC data-movement clauses.

gcc/testsuite/
	* gfortran.dg/goacc/derived-chartypes-1.f90: New test.
	* gfortran.dg/goacc/derived-chartypes-2.f90: Likewise.
	* gfortran.dg/goacc/derived-chartypes-3.f90: Likewise.
	* gfortran.dg/goacc/derived-chartypes-4.f90: Likewise.
2021-02-04 15:06:56 -08:00
Julian Brown
9a4d32f85c openacc: Allow strided arrays in update directives
OpenACC 3.0 ("2.14.4. Update Directive") states:

  Noncontiguous subarrays may appear. It is implementation-specific
  whether noncontiguous regions are updated by using one transfer for
  each contiguous subregion, or whether the non-contiguous data is
  packed, transferred once, and unpacked, or whether one or more larger
  subarrays (no larger than the smallest contiguous region that contains
  the specified subarray) are updated.

This patch relaxes some conditions in the Fortran front-end so that
strided accesses are permitted for update directives.

gcc/fortran/
	* openmp.c (resolve_omp_clauses): Omit OpenACC update in
	contiguity check and stride-specified error.

gcc/testsuite/
	* gfortran.dg/goacc/array-with-dt-2.f90: New test.

libgomp/
	* testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: New test.
2021-02-04 15:06:22 -08:00
Julian Brown
f743fe2316 openacc: Use class_pointer instead of pointer attribute for class types
Elsewhere in the Fortran front-end, the class_pointer attribute is
used for BT_CLASS entities instead of the pointer attribute. This patch
follows suit for OpenACC. I couldn't actually come up with a test case
where this makes a difference (i.e., where "class_pointer" and "pointer"
have different values at this point in the code), but this may nonetheless
fix a latent bug.

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Use class_pointer attribute
	for BT_CLASS.
2021-02-04 15:05:50 -08:00
Julian Brown
cff6e8db88 openacc: Dereference BT_CLASS data pointers but not BT_DERIVED pointers
The stanza in gfc_trans_omp_clauses that handles derived type members
that are themselves derived type pointers or class pointers now adds
an explicit dereference only for the latter. The former is already
dereferenced transparently in gfc_conv_component_ref.

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Fix dereferencing for
	BT_DERIVED members.

gcc/testsuite/
	* gfortran.dg/goacc/derived-classtypes-1.f95: New test.
2021-02-04 15:05:14 -08:00
Jakub Jelinek
0b34dbc0a2 testsuite: Fix up pr25376.c on powerpc64-linux and array-quals-1.c on powerpc-linux [PR98325]
The following patch fixes the pr25376.c testcase on powerpc64-linux
and array-quals-1.c on powerpc-linux.
Previously it failed like:
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?a1\$ (found a1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?b1\$ (found b1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?c1\$ (found c1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?d1\$ (found d1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?p\$ (found p) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?p1\$ (found p1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?q\$ (found q) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?q1\$ (found q1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?r\$ (found r) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?r1\$ (found r1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?s\$ (found s) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?s1\$ (found s1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?t\$ (found t) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?t1\$ (found t1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/pr25376.c scan-assembler-symbol-section symbol simple\$ (found .L.simple) has section ^\\\\.?my_named_section|simple\\\\[DS\\\\]|^\\\\"\\\\.opd\\\\" (found .opd)
FAIL: gcc.dg/pr25376.c scan-assembler-symbol-section symbol simple\$ (found simple) has section ^\\\\.?my_named_section|simple\\\\[DS\\\\]|^\\\\"\\\\.opd\\\\" (found .opd)

The problem with pr25376.c testcase are the ELFv1 function descriptors,
        .section        my_named_section,"ax",@progbits
        .align 2
        .globl simple
        .section        ".opd","aw"
        .align 3
simple:
        .quad   .L.simple,.TOC.@tocbase,0
        .previous
        .type   simple, @function
.L.simple:

so the simple symbol is found in the .opd section rather than in the
my_named_section the test attempts to verify for that symbol.
This patch deals it with two changes, the last two hunks in scanasm.exp
teach it about the behavior of .previous directive and the first hunk
for powerpc if symbol is in .opd section will try section in which the
.L.symbol label is instead.

The array-quals-1.c test fails because on powerpc-linux the symbols
are emitted into .sdata section rather than one of the expected ones.

2021-02-04  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/98325
	* lib/scanasm.exp (dg-scan-symbol-section): For powerpc*-*-* targets if
	$section is .opd, look at .L.$symbol_name's section.
	(parse_section_section_of_symbols): Handle .previous directive.
	* gcc.dg/array-quals-1.c: Allow .sdata section.
2021-02-04 23:42:09 +01:00
Iain Buclaw
c1d56e6a73 d: Merge upstream dmd 46133f761, druntime 0fd4364c
D front-end changes:

 - Backported built-in function handling from upstream.

 - Added new intrinsic `byteswap(ushort)`.

Druntime changes:

 - Update intrinsic modules core.bitop, core.checkedint, core.simd,
   core.vararg, and core.volatile.

 - Backport platform-specific fixes for runtime modules core.cpuid,
   core.internal.traits, and rt.lifetime.

 - Backport openbsd fixes for core.stdc.stdio.

 - Backport solaris fixes for core.sys.posix.locale, and
   core.thread.osthread (PR98910).

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 46133f761.
	* d-builtins.cc (d_build_builtins_module): Set builtins as BUILTINgcc.
	(maybe_set_builtin_1): Likewise.
	* d-frontend.cc (eval_builtin): Adjust condition for early return.
	* intrinsics.cc (maybe_set_intrinsic): Set intrinsics as BUILTINgcc.
	(maybe_expand_intrinsic): Add case for INTRINSIC_BSWAP16.
	* intrinsics.def (INTRINSIC_BT): Update signature.
	(INTRINSIC_BT64): Likewise.
	(INTRINSIC_BSWAP16): New intrinsic.
	(INTRINSIC_VLOAD8): Update module.
	(INTRINSIC_VLOAD16): Likewise.
	(INTRINSIC_VLOAD32): Likewise.
	(INTRINSIC_VLOAD64): Likewise.
	(INTRINSIC_VSTORE8): Likewise.
	(INTRINSIC_VSTORE16): Likewise.
	(INTRINSIC_VSTORE32): Likewise.
	(INTRINSIC_VSTORE64): Likewise.
	(INTRINSIC_ADDS): Update signature.
	(INTRINSIC_ADDSL): Likewise.
	(INTRINSIC_ADDU): Likewise.
	(INTRINSIC_ADDUL): Likewise.
	(INTRINSIC_SUBS): Likewise.
	(INTRINSIC_SUBSL): Likewise.
	(INTRINSIC_SUBU): Likewise.
	(INTRINSIC_SUBUL): Likewise.
	(INTRINSIC_MULS): Likewise.
	(INTRINSIC_MULSL): Likewise.
	(INTRINSIC_MULU): Likewise.
	(INTRINSIC_MULUI): Likewise.
	(INTRINSIC_MULUL): Likewise.
	(INTRINSIC_NEGS): Likewise.
	(INTRINSIC_NEGSL): Likewise.

libphobos/ChangeLog:

	PR d/98910
	* libdruntime/MERGE: Merge upstream druntime 0fd4364c.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/volatile.d.
	* libdruntime/Makefile.in: Regenerate.
	* testsuite/libphobos.allocations/tls_gc_integration.d: Update test.

gcc/testsuite/ChangeLog:

	* gdc.dg/intrinsics.d: Update test.
2021-02-04 23:04:48 +01:00
Martin Sebor
ce5720447c PR c/97882 - Segmentation Fault on improper redeclaration of function
gcc/c/ChangeLog:

	PR c/97882
	* c-decl.c (locate_old_decl): Add type to diagnostic output.
	(diagnose_mismatched_decls): Same.
	(start_function): Introduce temporaries for better readability.
	* c-typeck.c (comptypes_internal): Only consider complete enum
	types in comparisons with integers.

gcc/testsuite/ChangeLog:

	PR c/97882
	* gcc.dg/decl-8.c: Adjust text of expected diagnostic.
	* gcc.dg/label-decl-4.c: Same.
	* gcc.dg/mismatch-decl-1.c: Same.
	* gcc.dg/old-style-then-proto-1.c: Same.
	* gcc.dg/parm-mismatch-1.c: Same.
	* gcc.dg/pr35445.c: Same.
	* gcc.dg/redecl-11.c: Same.
	* gcc.dg/redecl-12.c: Same.
	* gcc.dg/redecl-13.c: Same.
	* gcc.dg/redecl-15.c: Same.
	* gcc.dg/tls/thr-init-1.c: Same.
	* objc.dg/id-1.m: Same.
	* objc.dg/tls/diag-3.m: Same.
	* gcc.dg/pr97882.c: New test.
	* gcc.dg/qual-return-7.c: New test.
	* gcc.dg/qual-return-8.c: New test.
2021-02-04 14:53:38 -07:00
Jason Merrill
4e7c24d97d c++: Empty args for variadic concept [PR98717]
Nice when fixing a bug is as easy as removing incorrect checks.

gcc/cp/ChangeLog:

	PR c++/98717
	* constraint.cc (build_concept_check_arguments): Remove assert.
	(build_concept_check): Allow empty args.

gcc/testsuite/ChangeLog:

	PR c++/98717
	* g++.dg/cpp2a/concepts-variadic3.C: New test.
2021-02-04 15:43:43 -05:00
David Malcolm
65c1cb3589 diagnostics: fix excessive range-printing involving macros [PR97932]
PR c/97932 describes a bug in which diagnostic_show_locus prints most
of a source file.

The issue is that it prints a range in which the start and end locations
are part of the same macro map, but the start location is for a token in
the definition of the macro, whereas the end location is for a token in
an argument of the macro.

This patch extends compatible_locations_p to require that range-printing
of macro maps requires the location to either be both for the definition
of the macro, or both for the arguments of the macro (not one of each),
fixing the issue.

gcc/ChangeLog:
	PR c/97932
	* diagnostic-show-locus.c (compatible_locations_p): Require
	locations in the same macro map to be either both from the
	macro definition, or both from the macro arguments.

gcc/testsuite/ChangeLog:
	PR c/97932
	* gcc.dg/pr97932.c: New test.
2021-02-04 15:20:59 -05:00
emsr
26fd3bf75b Correct date value of the __cpp_size_t_suffix macro.
The value of __cpp_size_t_suffix is 202011 not 202006.

gcc/c-family/ChangeLog:

	* c-cppbuiltin.c (c_cpp_builtins): __cpp_size_t_suffix=202011L.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/feat-cxx2b.C: __cpp_size_t_suffix == 202011.
2021-02-04 14:10:18 -05:00
Jakub Jelinek
e91f9da579 c++, libcpp: Use make_signed_t<size_t> in the 1z diagnostics
The following patch uses make_signed_t<size_t> instead of
make_signed<size_t>::type in the diagnostics, because the former is shorter.
It is true that one can't use make_signed<size_t>::type in C++11 code (which
is why I haven't changed it in the testcase which is c++11 effective
target), but the message talks about C++23 and make_signed_t is a C++14 and
later feature, so I think it is fine.

2021-02-04  Jakub Jelinek  <jakub@redhat.com>

	* expr.c (cpp_classify_number): Use make_signed_t<size_t> instead of
	make_signed<size_t>::type in the diagnostics.

	* g++.dg/warn/Wsize_t-literals.C: Expect make_signed_t<size_t> instead
	of make_signed<size_t>::type in the diagnostics.
2021-02-04 18:30:45 +01:00
Tom Greenslade (thomgree)
e6cc142ad9 c++: fix string literal member initializer bug [PR90926]
build_aggr_conv did not correctly handle string literal member initializers.
Extended can_convert_array to handle this case. For the additional check of
compatibility of character types, factored out code from digest_init_r into
a new function.

gcc/cp/ChangeLog:

	PR c++/90926
	* call.c (can_convert_array): Extend to handle all valid aggregate
	initializers of an array; including by string literals, not just by
	brace-init-list.
	(build_aggr_conv): Call can_convert_array more often, not just in
	brace-init-list case.
	* typeck2.c (array_string_literal_compatible_p): New function.
	(digest_init_r): call array_string_literal_compatible_p
	* cp-tree.h: (array_string_literal_compatible_p): Declare.

gcc/testsuite/ChangeLog:

	PR c++/90926
	* g++.dg/cpp1y/nsdmi-aggr12.C: New test.
2021-02-04 10:46:39 -05:00