Commit Graph

183368 Commits

Author SHA1 Message Date
Jonathan Wakely
c4ece1d96a libstdc++: XFAIL tests that depends on RTTI
The std::emit_on_flush manipulator depends on dynamic_cast, so fails
without RTTI.

The std::async code can't catch a forced_unwind exception when RTTI is
disabled, so it can't rethrow it either, and the test aborts.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_ostream/emit/1.cc: Expect test to fail
	if -fno-rtti is used.
	* testsuite/30_threads/async/forced_unwind.cc: Expect test
	to abort if -fno-rtti is used.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
0bd242ec5a libstdc++: Make test memory_resource work without exceptions and RTTI
libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_allocator.h (memory_resource):
	Remove requirement for RTTI and exceptions to be enabled.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
e9c3105211 libstdc++: Only use dynamic_cast in tests when RTTI is enabled
libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc: Use
	static_cast when RTTI is disabled.
	* testsuite/27_io/basic_istringstream/rdbuf/wchar_t/2832.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/str/char/2.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/str/wchar_t/2.cc:
	Likewise.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
14b554c462 libstdc++: Fix errors when syncbuf is used without RTTI
libstdc++-v3/ChangeLog:

	* include/std/ostream (__syncbuf_base::_S_get): Mark parameter
	as unused and only use dynamic_cast when RTTI is enabled.
2021-02-12 14:30:12 +00:00
Jonathan Wakely
4591f7e532 libstdc++: Fix bootstrap with -fno-rtti [PR 99077]
When libstdc++ is built without RTTI the __ios_failure type is just an
alias for std::ios_failure, so trying to construct it from an int won't
compile. This changes the RTTI-enabled __ios_failure type to have the
same constructor parameters as std::ios_failure, so that the constructor
takes the same arguments whether RTTI is enabled or not.

The __throw_ios_failure function now constructs the error_code, instead
of the __ios_failure constructor. As a drive-by fix that error_code is
constructed with std::generic_category() not std::system_category(),
because the int comes from errno which corresponds to the generic
category.

libstdc++-v3/ChangeLog:

	PR libstdc++/99077
	* src/c++11/cxx11-ios_failure.cc (__ios_failure(const char*, int)):
	Change int parameter to error_code, to match std::ios_failure.
	(__throw_ios_failure(const char*, int)): Construct error_code
	from int parameter.
2021-02-12 14:30:12 +00:00
Christophe Lyon
71b8ed7c61 testsuite, arm: Add -mthumb to pr98931.c [PR target/98931]
This test forces -march=armv8.1-m.main, which supports only Thumb mode.
However, if the toolchain is not configured --with-thumb, the test
fails with:
error: target CPU does not support ARM mode

Adding -mthumb to dg-options fixes the problem.

2021-02-12  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/98931
	gcc/testsuite/
	* gcc.target/arm/pr98931.c: Add -mthumb
2021-02-12 14:19:24 +00:00
Arnaud Charlet
3fbf81a252 [Ada] Remove unused subprograms (continued)
gcc/ada/

	* repinfo.ads, repinfo.adb (*SO_Ref*): Restore.
2021-02-12 08:53:41 -05:00
Tobias Burnus
f699e0b165 Fortran: Fix rank of assumed-rank array [PR99043]
gcc/fortran/ChangeLog:

	PR fortran/99043
	* trans-expr.c (gfc_conv_procedure_call): Don't reset
	rank of assumed-rank array.

gcc/testsuite/ChangeLog:

	PR fortran/99043
	* gfortran.dg/assumed_rank_20.f90: New test.
2021-02-12 14:43:41 +01:00
Richard Biener
6cc886bf42 middle-end/38474 - fix alias walk budget accounting in IPA analysis
The walk_aliased_vdef calls do not update the walking budget until
it is hit by a single call (and then in one case it resumes with
no limit at all).  The following rectifies this in multiple places.
It also makes the updates more consistend and fixes
determine_known_aggregate_parts to account its own alias queries.

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

	PR middle-end/38474
	* ipa-fnsummary.c (unmodified_parm_1): Only walk when
	fbi->aa_walk_budget is bigger than zero.  Update
	fbi->aa_walk_budget.
	(param_change_prob): Likewise.
	* ipa-prop.c (detect_type_change_from_memory_writes):
	Properly account walk_aliased_vdefs.
	(parm_preserved_before_stmt_p): Canonicalize updates.
	(parm_ref_data_preserved_p): Likewise.
	(parm_ref_data_pass_through_p): Likewise.
	(determine_known_aggregate_parts): Account own alias queries.
2021-02-12 12:34:28 +01:00
Martin Liska
bc6087c575 Fix producer string memory leaks
gcc/ChangeLog:

	* opts-common.c (decode_cmdline_option): Release werror_arg.
	* opts.c (gen_producer_string): Release output of
	gen_command_line_string.
2021-02-12 10:25:06 +01:00
Jakub Jelinek
cf059e1c09 c++: Fix endless errors on invalid requirement seq [PR97742]
As the testcase shows, if we reach CPP_EOF during parsing of requirement
sequence, we end up with endless loop where we always report invalid
requirement expression, don't consume any token (as we are at eof) and
repeat.

This patch stops the loop when we reach CPP_EOF.

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

	PR c++/97742
	* parser.c (cp_parser_requirement_seq): Stop iterating after reaching
	CPP_EOF.

	* g++.dg/cpp2a/concepts-requires24.C: New test.
2021-02-12 09:58:25 +01:00
Richard Biener
95d94b52ea tree-optimization/38474 - fix store-merging compile-time regression
The following puts a limit on the number of alias tests we do in
terminate_all_aliasing_chains which is quadratic in the number of
overall stores currentrly tracked.  There is already a limit in
place on the maximum number of stores in a single chain so the
following adds a limit on the number of chains tracked.  The
worst number of overall stores tracked from the defaults (64 and 64)
is then 4096 which when imposed as the sole limit for the testcase
still causes

 store merging                      :  71.65 ( 56%)

because the testcase is somewhat degenerate with most chains
consisting only of a single store (and 25% of exactly three stores).
The single stores are all CLOBBERs at the point variables go out of
scope.  Note unpatched we have

 store merging                      : 308.60 ( 84%)

Limiting the number of chains to 64 brings this down to

 store merging                      :   1.52 (  3%)

which is more reasonable.  There are ideas on how to make
terminate_all_aliasing_chains cheaper but for this degenerate case
they would not have any effect so I'll defer for GCC 12 for those.

I'm not sure we want to have both --params, just keeping the
more to-the-point max-stores-to-track works but makes the
degenerate case above slower.
I made the current default 1024 which for the testcasse
(without limiting chains) results in 25% compile time and 20s
putting it in the same ballpart as the next offender (which is PTA).

This is a regression on trunk and the GCC 10 branch btw.

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

	PR tree-optimization/38474
	* params.opt (-param=max-store-chains-to-track=): New param.
	(-param=max-stores-to-track=): Likewise.
	* doc/invoke.texi (max-store-chains-to-track): Document.
	(max-stores-to-track): Likewise.
	* gimple-ssa-store-merging.c (pass_store_merging::m_n_chains):
	New.
	(pass_store_merging::m_n_stores): Likewise.
	(pass_store_merging::terminate_and_process_chain): Update
	m_n_stores and m_n_chains.
	(pass_store_merging::process_store): Likewise.   Terminate
	oldest chains if the number of stores or chains get too large.
	(imm_store_chain_info::terminate_and_process_chain): Dump
	chain length.
2021-02-12 09:38:52 +01:00
Jason Merrill
ac001ddd0c c++: variadic lambda template and empty pack [PR97246]
In get<0>, Is is empty, so the first parameter pack of the lambda is empty,
but after the fix for PR94546 we were wrongly associating it with the
partial instantiation of 'v'.

gcc/cp/ChangeLog:

	PR c++/97246
	PR c++/94546
	* pt.c (extract_fnparm_pack): Check DECL_PACK_P here.
	(register_parameter_specializations): Not here.

gcc/testsuite/ChangeLog:

	PR c++/97246
	* g++.dg/cpp2a/lambda-generic-variadic21.C: New test.
2021-02-11 21:30:24 -05:00
Ian Lance Taylor
3e2f329e94 libbacktrace: check for objcopy --add-gnu-debuglink using --help
* configure.ac: Check for objcopy --add-gnu-debuglink by using
	objcopy --help.
	* configure: Regenerate
2021-02-11 18:10:25 -08:00
David Malcolm
467a482052 analyzer: fix ICE in print_mem_ref [PR98969]
PR analyzer/98969 and PR analyzer/99064 describes ICEs, in both cases
within print_mem_ref, when falsely reporting memory leaks - though it
is possible to generate the ICE on other diagnostics (which I added
in one of the test cases).

This patch fixes the ICE, leaving the fix for the leak false positives
as followup work.

The analyzer uses region_model::get_representative_path_var and
region_model::get_representative_tree to map back from its svalue
and region classes to the tree type used by the rest of the compiler,
and, in particular, for diagnostics.

The root cause of the ICE is sloppiness about types within those
functions; specifically when casts were stripped off svalues.  To
track these down I added wrapper functions that verify that the
types of the results are correct, and in doing so found various
other type-safety issues, which the patch also fixes.

Doing so led to various changes in diagnostics messages due to
more accurate types, but I felt that these changes weren't
desirable.
For example, the warning at CVE-2005-1689-minimal.c line 48
which expects:
  double-'free' of 'inbuf.data'
changed fo
  double-'free' of '(char *)inbuf.data'

So I added stripping of top-level casts where necessary to avoid
cluttering diagnostics.

Finally, the more accurate types led to worse results from
readability_comparator, where e.g. the event message at line 50
of sensitive-1.c regressed from the precise:
  passing sensitive value 'password' in call to 'called_by_test_5' from 'test_5'
to the vaguer:
  calling 'called_by_test_5' from 'test_5'
This was due to erroneously picking the initial value of "password"
in the caller frame as the best value within the *callee* frame, due to
"char *" vs "const char *", which confuses the logic for tracking values
that pass along callgraph edges.  The patch fixes this by combining the
readability tests for tree and stack depth, rather than performing
them in sequence, so that it favors the value in the deepest frame.

As noted above, the patch fixes the ICEs, but does not fix the
leak false positives.

gcc/analyzer/ChangeLog:
	PR analyzer/98969
	* engine.cc (readability): Add names for the various arbitrary
	values.  Handle NOP_EXPR and INTEGER_CST.
	(readability_comparator): Combine the readability tests for
	tree and stack depth, rather than performing them sequentially.
	(impl_region_model_context::on_state_leak): Strip off top-level
	casts.
	* region-model.cc (region_model::get_representative_path_var): Add
	type-checking, moving the bulk of the implementation to...
	(region_model::get_representative_path_var_1): ...here.  Respect
	types in casts by recursing and re-adding the cast, rather than
	merely stripping them off.  Use the correct type when handling
	region_svalue.
	(region_model::get_representative_tree): Strip off any top-level
	cast.
	(region_model::get_representative_path_var): Add type-checking,
	moving the bulk of the implementation to...
	(region_model::get_representative_path_var_1): ...here.
	* region-model.h (region_model::get_representative_path_var_1):
	New decl
	(region_model::get_representative_path_var_1): New decl.
	* store.cc (append_pathvar_with_type): New.
	(binding_cluster::get_representative_path_vars): Cast path_vars
	to the correct type when adding them to *OUT_PVS.

gcc/testsuite/ChangeLog:
	PR analyzer/98969
	* g++.dg/analyzer/pr99064.C: New test.
	* gcc.dg/analyzer/pr98969.c: New test.
2021-02-11 20:32:10 -05:00
GCC Administrator
0c5cdb31bd Daily bump. 2021-02-12 00:16:25 +00:00
Eric Botcazou
85cefe2256 Fix -freorder-blocks-and-partition glitch with Windows SEH
Since GCC 8, the -freorder-blocks-and-partition pass can split a function
into hot and cold parts, thus generating 2 CIEs for a single function in
DWARF for exception purposes and doing an equivalent trick for Windows SEH.

Now the Windows system unwinder is picky when it comes to the boundary
between an active EH region and the end of the function and, therefore,
a nop may need to be added in specific cases.

gcc/
	* config/i386/winnt.c (i386_pe_seh_unwind_emit): When switching to
	the cold section, emit a nop before the directive if the previous
	active instruction can throw.
2021-02-12 00:19:21 +01:00
Uros Bizjak
5e40542f87 libgomp/i386: Revert the type of syscall wrappers output back to long.
Linux man-pages 5.07 wrongly declares syscall output type as int.  This error
was fixed in release 5.10, so this patch reverts my recent change.

2021-02-11  Uroš Bizjak  <ubizjak@gmail.com>

libgomp/
	* config/linux/x86/futex.h (__futex_wait):
	Revert output type back to long.
	(__futex_wake): Ditto.
	(futex_wait): Update for revert.
	(futex_wake): Ditto.
2021-02-12 00:07:56 +01:00
Uros Bizjak
c36ad24e8a libgomp/i386: Move syscall asms to static inline wrapper.
Move syscall asms to static inline wrapper functions to improve #ifdeffery.
Also correct output type to int and timeout type to void *.

2021-02-11  Uroš Bizjak  <ubizjak@gmail.com>

libgomp/
	* config/linux/x86/futex.h (__futex_wait): New static inline
	wrapper function.  Correct output type to int and
	timeout type to void *.
	(__futex_wake): New static inline wrapper function.
	Correct output type to int.
	(futex_wait): Use __futex_wait.
	(futex_wake): Use __futex_wake.
2021-02-11 22:49:41 +01:00
Marek Polacek
88cfd531c6 c++: Endless loop with targ deduction in member tmpl [PR95888]
My r10-7007 patch tweaked tsubst not to reduce the template level of
template parameters when tf_partial.  That caused infinite looping in
is_specialization_of: we ended up with a class template specialization
whose TREE_TYPE (CLASSTYPE_TI_TEMPLATE (t)) == t, so the second for
loop in is_specialization_of never finished.

There's a lot going on in this test, but essentially: the template fn
here has two template parameters, we call it with one explicitly
provided, the other one has to be deduced.  So we'll find ourselves
in fn_type_unification which uses tf_partial when tsubsting the
*explicit* template arguments into the function type.  That leads to
tsubstituting the return type, C<T>.  C is a member template; its
most general template is

  template<class U> template<class V> struct B<U>::C

we figure out (tsubst_template_args) that the template argument list
is <int, int>.  They come from different levels, one comes from B<int>,
the other one from fn<int>.

So now we lookup_template_class to see if we have C<int, int>.  We
do the
  /* This is a full instantiation of a member template.  Find
     the partial instantiation of which this is an instance.  */
  TREE_VEC_LENGTH (arglist)--;
  // arglist is now <int>, not <int, int>
  found = tsubst (gen_tmpl, arglist, complain, NULL_TREE);
  TREE_VEC_LENGTH (arglist)++;

magic which is looking for the partial instantiation, in this case,
that would be template<class V> struct B<int>::C.  Note we're still
in a tf_partial context!  So the tsubst_template_args in the tsubst
(which tries to substitute <int> into <U, V>) returns <int, V>, but
V's template level hasn't been reduced!  After tsubst_template_args,
tsubst_template_decl looks to see if we already have this specialization:

  // t = template_decl C
  // full_args = <int, V>
  spec = retrieve_specialization (t, full_args, hash);

but doesn't find the one we created a while ago, when processing
B<int> b; in the test, because V's levels don't match.  Whereupon
tsubst_template_decl creates a new TEMPLATE_DECL, one that leads to
the infinite looping problem.

Fixed by using tf_none when looking for an existing partial instantiation.

It also occurred to me that I should be able to trigger a similar
problem with 'auto', since r10-7007 removed an is_auto check.  And lo,
I constructed deduce10.C which exhibits the same issue with pre-r10-7007
compilers.  This patch fixes that problem as well.  I'm ecstatic.

gcc/cp/ChangeLog:

	PR c++/95888
	* pt.c (lookup_template_class_1): Pass tf_none to tsubst when looking
	for the partial instantiation.

gcc/testsuite/ChangeLog:

	PR c++/95888
	* g++.dg/template/deduce10.C: New test.
	* g++.dg/template/deduce9.C: New test.
2021-02-11 15:56:04 -05:00
Peter Bergner
2432c47970 rs6000: Fix invalid address used in MMA built-in function
The mma_assemble_input_operand predicate is too lenient on the memory
operands it will accept, leading to an ICE when illegitimate addresses
are passed in.  The solution is to only accept memory operands with
addresses that are valid for quad word memory accesses.  The test case
is a minimized test case from the Eigen library.  The creduced test case
is very noisy with respect to warnings, so the test case has added -w to
silence them.

2021-02-11  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	PR target/99041
	* config/rs6000/predicates.md (mma_assemble_input_operand): Restrict
	memory addresses that are legal for quad word accesses.

gcc/testsuite/
	PR target/99041
	* g++.target/powerpc/pr99041.C: New test.
2021-02-11 14:16:05 -06:00
Jonathan Wakely
bc0f7db7eb libstdc++: Fix versioned namespace build
The recent changes to define various std::exception_ptr functions inline
included a change so that the definitions of those functions would be
omitted for the ABI unstable gnu-versioned-namespace configuration. That
change was incorrect, because the existing functions that are gated by
the _GLIBCXX_EH_PTR_COMPAT macro are always needed even for the
versioned namespace.

This change introduces a new macro to control whether operator== is
defined as deleted or not, distinct from the existing macro. The new
macro is not defined for versioned namespace builds, but the old macro
still is.

libstdc++-v3/ChangeLog:

	* libsupc++/eh_ptr.cc (_GLIBCXX_EH_PTR_RELOPS_COMPAT): Define
	new macro.
	* libsupc++/exception_ptr.h (_GLIBCXX_EH_PTR_USED): Check new
	macro instead of _GLIBCXX_EH_PTR_COMPAT.
	(operator==): Likewise.
2021-02-11 17:28:16 +00:00
Jonathan Wakely
ce43c90604 libstdc++: Document when C++11/14/17 support became stable [PR 99058]
libstdc++-v3/ChangeLog:

	PR libstdc++/99058
	* doc/xml/manual/status_cxx2011.xml: Document when support
	became stable.
	* doc/xml/manual/status_cxx2014.xml: Likewise.
	* doc/xml/manual/status_cxx2017.xml: Likewise.
	* doc/html/manual/status.html: Regenerate.
2021-02-11 17:28:16 +00:00
Jakub Jelinek
2dcdd15d0b c++: Fix zero initialization of flexible array members [PR99033]
array_type_nelts returns error_mark_node for type of flexible array members
and build_zero_init_1 was placing an error_mark_node into the CONSTRUCTOR,
on which e.g. varasm ICEs.  I think there is nothing erroneous on zero
initialization of flexible array members though, such arrays should simply
get no elements, like they do if such classes are constructed (everything
except when some larger initializer comes from an explicit initializer).

So, this patch handles [] arrays in zero initialization like [0] arrays
and fixes handling of the [0] arrays - the
tree_int_cst_equal (max_index, integer_minus_one_node) check
didn't do what it thought it would do, max_index is typically unsigned
integer (sizetype) and so it is never equal to a -1.

What the patch doesn't do and maybe would be desirable is if it returns
error_mark_node for other reasons let the recursive callers not stick that
into CONSTRUCTOR but return error_mark_node instead.  But I don't have a
testcase where that would be needed right now.

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

	PR c++/99033
	* init.c (build_zero_init_1): Handle zero initialiation of
	flexible array members like initialization of [0] arrays.
	Use integer_minus_onep instead of comparison to integer_minus_one_node
	and integer_zerop instead of comparison against size_zero_node.
	Formatting fixes.

	* g++.dg/ext/flexary38.C: New test.
2021-02-11 17:24:17 +01:00
Marek Polacek
f0da1c0cb7 c++: ICE with unexpanded pack in do-while [PR99063]
Here an unexpanded parameter pack snuck into prep_operand which doesn't
expect to see an operand without a type, and since r247842
NONTYPE_ARGUMENT_PACK doesn't have a type anymore.

This only happens with the do-while loop whose condition may not
contain a declaration so we never called finish_cond which checks
for unexpanded parameter packs.  So use check_for_bare_parameter_packs
to remedy that.

gcc/cp/ChangeLog:

	PR c++/99063
	* semantics.c (finish_do_stmt): Check for unexpanded parameter packs.

gcc/testsuite/ChangeLog:

	PR c++/99063
	* g++.dg/cpp0x/variadic-crash6.C: New test.
2021-02-11 11:12:49 -05:00
Patrick Palka
cb168f779c c++: Fix ICE from op_unqualified_lookup [PR97582]
In this testcase, we're crashing because the lookup of operator+ from
within the generic lambda via lookup_name finds multiple bindings
(C1::operator+ and C2::operator+) and returns a TREE_LIST thereof,
something which op_unqualified_lookup (and push_operator_bindings) isn't
prepared to handle.

This patch extends op_unqualified_lookup and push_operator_bindings
to handle such an ambiguous lookup result in the natural way.

gcc/cp/ChangeLog:

	PR c++/97582
	* name-lookup.c (op_unqualified_lookup): Handle an ambiguous
	lookup result by discarding it if the first element is a
	class-scope declaration, otherwise return it.
	(push_operator_bindings): Handle an ambiguous lookup result by
	doing push_local_binding on each element in the list.

gcc/testsuite/ChangeLog:

	PR c++/97582
	* g++.dg/cpp0x/lambda/lambda-template17.C: New test.
2021-02-11 10:59:54 -05:00
Andrea Corallo
38c5703449 arm: Low overhead loop handle long range branches [PR98931]
gcc/
	PR target/98931
	* config/arm/thumb2.md (*doloop_end_internal): Generate
	alternative sequence to handle long range branches.

gcc/testsuite/
	PR target/98931
	* gcc.target/arm/pr98931.c: New testcase.
2021-02-11 16:20:59 +01:00
Joel Hutton
4af29981ab [aarch64][vect] Support V8QI->V8HI WIDEN_ patterns
In the case where 8 out of every 16 elements are widened using a
widening pattern and the next 8 are skipped, the patterns are not
recognized. This is because they are normally used in a pair, such  as
VEC_WIDEN_MINUS_HI/LO, to achieve a v16qi->v16hi conversion for example.
This patch adds support for V8QI->V8HI patterns.

gcc/ChangeLog:

	PR tree-optimization/98772
	* optabs-tree.c (supportable_half_widening_operation): New function
	to check for supportable V8QI->V8HI widening patterns.
	* optabs-tree.h (supportable_half_widening_operation): New function.
	* tree-vect-stmts.c (vect_create_half_widening_stmts): New function
	to create promotion stmts for V8QI->V8HI widening patterns.
	(vectorizable_conversion): Add case for V8QI->V8HI.

gcc/testsuite/ChangeLog:

	PR tree-optimization/98772
	* gcc.target/aarch64/pr98772.c: New test.
2021-02-11 15:04:59 +00:00
Paul Thomas
ff6903288d Fortran: Fix calls to associate name typebound subroutines [PR98897].
2021-02-11  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/98897
	* match.c (gfc_match_call): Include associate names as possible
	entities with typebound subroutines. The target needs to be
	resolved for the type.

gcc/testsuite/
	PR fortran/98897
	* gfortran.dg/typebound_call_32.f90: New test.
2021-02-11 13:25:04 +00:00
Richard Biener
22a6d99d0a reduce sparseset memory requirement
Currently we use HOST_WIDEST_FAST_INT for the sparseset element
type which maps to a 64bit type on 64bit hosts.  That's excessive
for the only current sparseset users which are LRA and IRA and
which store register numbers in it which are unsigned int.  The
following changes the sparseset element type to unsigned int.

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

	* sparseset.h (SPARSESET_ELT_BITS): Remove.
	(SPARSESET_ELT_TYPE): Use unsigned int.
	* fwprop.c: Do not include sparseset.h.
2021-02-11 12:46:34 +01:00
Paul Thomas
5ee5415af8 Fortran: Fix ICE after error regression [PR99060].
2021-02-11  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/99060
	* primary.c (gfc_match_varspec): Test for non-null 'previous'
	before using its name in the error message.

gcc/testsuite/
	PR fortran/99060
	* gfortran.dg/pr99060.f90: New test.
2021-02-11 10:38:23 +00:00
Tobias Burnus
2e9dfa4bff Fortran: intrinsic.texi add missing arg to FINDLOC
gcc/fortran/ChangeLog:

	* intrinsic.texi (FINDLOC): Add 'MASK' to argument table.
	(MAXLOC, MAXVAL, MINLOC, MINVAL): For 'MASK', remove 'an
	array' as scalars are also permitted.
2021-02-11 09:36:23 +01:00
Alexandre Oliva
a5c4f5562a use -mfpu=auto for arm/simd/vmmla_1.c
On some of our arm targets, we get various -mfpu flags implicitly or
explicitly passed to the compiler during test runs.  The target
options pushed in arm_neon.h that affect vmmlaq_s32 set isa_bit_neon,
but the caller doesn't have that bit set, so arm_can_inline_p rejects
the attempt to inline it, and the test fails.

An explicit -mfpu=neon would address the compile problem, but cause
the assembler to reject the generated code.

So this patch adds -mfpu=auto to the test, overriding any implicit
flags with the fpu implied by the arch.


for  gcc/testsuite/ChangeLog

	* gcc.target/arm/simd/vmmla_1.c: Pass -mfpu=auto.
2021-02-11 02:08:06 -03:00
Jerry DeLisle
19c0232410 libgfortran: Fix unwanted end-of-record by checking if seen_dollar.
libgfortran/ChangeLog:

	PR libfortran/98825
	* io/transfer.c (next_record_w): Insert check for seen_dollar and if
	so, skip issueing next record.

gcc/testsuite/ChangeLog:

	PR libfortran/98825
	* gfortran.dg/dollar_edit_descriptor_4.f: New test.
2021-02-10 19:37:52 -08:00
Marek Polacek
27a804bc62 c, c++: Plug -Wduplicated-cond memory leaks [PR99057]
Freeing the condition chain needs to use vec_free which does ->release,
or we leak memory.

gcc/c/ChangeLog:

	* c-parser.c (c_parser_if_statement): Use vec_free.

gcc/cp/ChangeLog:

	* parser.c (cp_parser_selection_statement): Use vec_free.
2021-02-10 22:17:43 -05:00
GCC Administrator
4b37c3ea8a Daily bump. 2021-02-11 00:16:33 +00:00
Martin Sebor
21c6ad7a12 Add test for PR tree-optimization/92879.
gcc/testsuite/ChangeLog:

	PR tree-optimization/92879
	* g++.dg/warn/Warray-bounds-16.C: New test.
2021-02-10 14:43:24 -07:00
David Malcolm
1f5c80883e libcpp: fix ICE comparing macro locations without column info [PR96391]
PR preprocessor/96391 describes an ICE in the C++ frontend on:

  #define CONST const
  #define VOID void
  typedef CONST VOID *PCVOID;

where the typedef line occurs after enough code has been compiled
that location_t values are beyond LINE_MAP_MAX_LOCATION_WITH_COLS,
and hence no column numbers are available.

The issue occurs in linemap_compare_locations when comparing the
locations of the "const" and "void" tokens.
Upon resolving the LRK_MACRO_EXPANSION_POINT, both have the same
location_t, the line of the "typedef" (with no column), and so
the l0 == l1 clause is triggered, but they are not from the
same macro expansion, leading first_map_in_common to return NULL
and triggering the "abort" condition.

This patch fixes the issue by checking when the two macro expansion
point location_t values are equal that the value
<= LINE_MAP_MAX_LOCATION_WITH_COLS and thus has column information,
fixing the issue.

gcc/testsuite/ChangeLog:
	PR preprocessor/96391
	* g++.dg/plugin/location-overflow-test-pr96391.c: New test.
	* g++.dg/plugin/plugin.exp (plugin_test_list): Add it,
	using the location_overflow_plugin.c from gcc.dg/plugin.

libcpp/ChangeLog:
	PR preprocessor/96391
	* line-map.c (linemap_compare_locations): Require that
	the location be <= LINE_MAP_MAX_LOCATION_WITH_COLS when
	treating locations as coming from the same macro expansion.
2021-02-10 14:33:10 -05:00
Jakub Jelinek
0f39fb7b00 varasm: Fix ICE with -fsyntax-only [PR99035]
My FE change from 2 years ago uses TREE_ASM_WRITTEN in -fsyntax-only
mode more aggressively to avoid "expanding" functions multiple times.
With -fsyntax-only nothing is really expanded, so I think it is acceptable
to adjust the assert and allow declare_weak at any time, with -fsyntax-only
we know it is during parsing only anyway.

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

	PR c++/99035
	* varasm.c (declare_weak): For -fsyntax-only, allow even
	TREE_ASM_WRITTEN function decls.

	* g++.dg/ext/weak6.C: New test.
2021-02-10 19:52:37 +01:00
Jakub Jelinek
20482cfcc1 i386: Fix ICEs due to simplify_gen_subreg returning NULL [PR99025]
In these patterns, we call simplify_gen_subreg on the input operand
to create paradoxical subregs that have 2x, 4x or 8x elements as the input
operand.  That works fine if the input operand is a REG, but when it is a
SUBREG, RTL doesn't allow SUBREG of SUBREG and so relies on simplify_subreg
actually simplifying it.  And e.g. if the input operand is a SUBREG that
changes the element mode (floating vs. non-floating) and then combined with
a paradoxical subreg (i.e. different size) this can easily fail, then
simplify_gen_subreg returns NULL but we still use it in instructions.

Fixed by forcing the operands into REG.

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

	PR target/99025
	* config/i386/sse.md (fix<fixunssuffix>_truncv2sfv2di2,
	<insn>v8qiv8hi2, <insn>v8qiv8si2, <insn>v4qiv4si2, <insn>v4hiv4si2,
	<insn>v8qiv8di2, <insn>v4qiv4di2, <insn>v2qiv2di2, <insn>v4hiv4di2,
	<insn>v2hiv2di2, <insn>v2siv2di2): Force operands[1] into REG before
	calling simplify_gen_subreg on it.

	* gcc.target/i386/pr99025.c: New test.
2021-02-10 19:50:11 +01:00
Jakub Jelinek
a8db7887df c++: Consider addresses of heap artificial vars always non-NULL [PR98988, PR99031]
With -fno-delete-null-pointer-checks which is e.g. implied by
-fsanitize=undefined or default on some embedded targets, the middle-end
folder doesn't consider addresses of global VAR_DECLs to be non-NULL, as one
of them could have address 0.  Still, I think malloc/operator new (at least
the nonthrowing) relies on NULL returns meaning allocation failure rather
than success.  Furthermore, the artificial VAR_DECLs we create for
constexpr new never actually live in the address space of the program,
so we can pretend they will never be NULL too.

> I'm surprised that nonzero_address has such a limited set of things it will
> actually believe have non-zero addresses with
> -fno-delete-null-pointer-checks.  But it seems that we should be able to
> arrange to satisfy
>
> >   if (definition && !DECL_EXTERNAL (decl)
>
> since these "variables" are indeed defined within the current translation
> unit.

Doing that seems to work and as added benefit it fixes another PR that has
been filed recently.  I need to create the varpool node explicitly and call
a method that sets the definition member in there, but I can also unregister
those varpool nodes at the end of constexpr processing, as the processing
ensured they don't leak outside of the processing.

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

	PR c++/98988
	PR c++/99031
	* constexpr.c: Include cgraph.h.
	(cxx_eval_call_expression): Call varpool_node::finalize_decl on
	heap artificial vars.
	(cxx_eval_outermost_constant_expr): Remove varpool nodes for
	heap artificial vars.

	* g++.dg/cpp2a/constexpr-new16.C: New test.
	* g++.dg/cpp2a/constexpr-new17.C: New test.
2021-02-10 19:31:15 +01:00
Martin Liska
5874d15666 nvptx: properly use flag_patchable_function_entry
gcc/ChangeLog:

	* config/nvptx/nvptx.c (nvptx_option_override): Use
	flag_patchable_function_entry instead of the removed
	function_entry_patch_area_size.
2021-02-10 18:52:45 +01:00
Jonathan Wakely
3df5b249b3 libstdc++: Re-enable workaround for _wstat64 bug [PR 88881]
This wasn't fixed upstream for mingw-w64 so we still need the
workaround.

libstdc++-v3/ChangeLog:

	PR libstdc++/88881
	* src/c++17/fs_ops.cc (fs::status): Re-enable workaround.
2021-02-10 16:51:34 +00:00
Jonathan Wakely
313e2dc377 libstdc++: Use correct error category for Windows error codes
When the result of GetLastError() is stored in a std::error_code it
should use std::system_category(), not std::generic_category() that is
used for POSIX errno values.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_ops.cc (fs::create_hard_link, fs::equivalent)
	(fs::remove): Use std::system_category() for error codes from
	GetLastError().
	* src/filesystem/ops.cc (fs::create_hard_link, fs::remove):
	Likewise.
2021-02-10 16:45:38 +00:00
Jonathan Wakely
6a6f74be9d libstdc++: Fix spelling of __MINGW32__ macros
libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/operations/proximate.cc: Fix typo
	in __MINGW32__ macro name.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
	* testsuite/27_io/filesystem/path/generation/proximate.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/generation/relative.cc:
	Likewise.
	* testsuite/util/testsuite_fs.h: Likewise.
2021-02-10 16:40:29 +00:00
Richard Biener
e4985357e5 fix memory leak in optimize pragma parsing
The optimize pragma/attribute parsing calls decode_cmdline_options_to_array
but doesn't free the array.  The following fixes that.

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

gcc/c-family/
	* c-common.c (parse_optimize_options): Free decoded_options.
2021-02-10 14:51:58 +01:00
Nathan Sidwell
f8fac476b5 c++: generic lambdas and local-externs from outer scopes [PR 99030]
Lambdas can refer to local externs from their enclosing scope.  When
the lambda's generic but the containing function is not a temploid,
we'll never have tsubsted the declaring decl so won't have a local
specialization.  But in that case we can just use the decl we
tsubsting directly -- it's not dependent.

	PR c++/99030
	gcc/cp
	* pt.c (tsubst_copy) [VAR_DECL]: For a DECL_LOCAL_DECL_P T is the
	answer if there's no local specialization.
	gcc/testsuite/
	* g++.dg/lookup/pr99030.C: New.
2021-02-10 05:34:42 -08:00
Martin Liska
57d1b68d65 if-to-switch: fix memory leak in case merging
gcc/ChangeLog:

	PR tree-optimization/99002
	PR tree-optimization/99026
	* gimple-if-to-switch.cc (if_chain::is_beneficial): Fix memory
	leak when adjacent cases are merged.
	* tree-switch-conversion.c (switch_decision_tree::analyze_switch_statement): Use
	release_clusters.
	(make_pass_lower_switch): Remove trailing whitespace.
	* tree-switch-conversion.h (release_clusters): New.
2021-02-10 13:20:51 +01:00
Richard Biener
7293251105 rtl-optimization/99054 - fix leak in fixup_partitions
This fixes a leak of the vector retured by find_partition_fixes
by turning it into an auto_vec.

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

	PR rtl-optimization/99054
	* cfgrtl.c (rtl-optimization/99054): Return an auto_vec.
	(fixup_partitions): Adjust.
	(rtl_verify_edges): Likewise.
2021-02-10 11:31:13 +01:00
Jakub Jelinek
bd0e37f68a openmp: Temporarily disable into_ssa when gimplifying OpenMP reduction clauses [PR99007]
gimplify_scan_omp_clauses was already calling gimplify_expr with false as
last argument to make sure it is not an SSA_NAME, but as the testcases show,
that is not enough, SSA_NAME temporaries created during that gimplification
can be reused too and we can't allow SSA_NAMEs to be used across OpenMP
region boundaries, as we can only firstprivatize decls.

Fixed by temporarily disabling into_ssa.

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

	PR middle-end/99007
	* gimplify.c (gimplify_scan_omp_clauses): For MEM_REF on reductions,
	temporarily disable gimplify_ctxp->into_ssa around gimplify_expr
	calls.

	* g++.dg/gomp/pr99007.C: New test.
	* gcc.dg/gomp/pr99007-1.c: New test.
	* gcc.dg/gomp/pr99007-2.c: New test.
	* gcc.dg/gomp/pr99007-3.c: New test.
2021-02-10 10:42:35 +01:00