Yeting Kuo [Thu, 17 Sep 2020 21:29:27 +0000 (15:29 -0600)]
RISC-V: fix a typo in riscv.h
gcc/ChangeLog:
* config/riscv/riscv.h (CSW_MAX_OFFSET): Fix typo.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/shorten-memrefs-8.c: New test.
Dimitrij Mojoski [Thu, 17 Sep 2020 21:22:33 +0000 (15:22 -0600)]
Autodetect C++ dialect in use for clang-format
PR other//97076
* clang-format: Autodetect C++ standard in use rather than
forcing C++03.
Marek Polacek [Thu, 17 Sep 2020 19:31:50 +0000 (15:31 -0400)]
c++: Add tests for fixed PRs.
Bugzilla inspection turned up a bunch of old(er) PRs that have been
fixed. Let's include them not to regress in the future.
gcc/testsuite/ChangeLog:
PR c++/87530
PR c++/58156
PR c++/68828
PR c++/86002
PR c++/91525
PR c++/96223
PR c++/87032
PR c++/35098
* g++.dg/cpp0x/move-return4.C: New test.
* g++.dg/cpp0x/vt-58156.C: New test.
* g++.dg/cpp2a/concepts-pr68828.C: New test.
* g++.dg/cpp2a/concepts-pr86002.C: New test.
* g++.dg/cpp2a/concepts-pr91525.C: New test.
* g++.dg/cpp2a/constexpr-indeterminate1.C: New test.
* g++.dg/cpp2a/desig17.C: New test.
* g++.dg/ext/attrib62.C: New test.
Paul E. Murphy [Tue, 15 Sep 2020 19:18:28 +0000 (14:18 -0500)]
libgo: fix ptrace syscall hooks into glibc
ptrace is actually declared as a variadic function. On ppc64le
the ABI requires to the caller to allocate space for the parameters
and allows the caller to modify them.
On ppc64le, depending on how and what version of GCC is used,
it will save to parameter save area. This happened to clobber
a saved LR, and caused syscall.TestExecPtrace to fail with a timeout
when the tracee segfaults, and waits for the parent process to inspect.
Wrap this function to avoid directly calling glibc's ptrace from go.
Fixes golang/go#36698
Fixes go/92567
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254755
Patrick Palka [Thu, 17 Sep 2020 18:27:22 +0000 (14:27 -0400)]
c-family: Macro support in -Wmisleading-indentation [PR80076]
Currently the -Wmisleading-indentation warning doesn't do any analysis
when the guarded statement or the statement after it is produced by a
macro. This means we warn for:
if (flag)
foo ();
bar ();
but not for:
#define BAR bar
if (flag)
foo ();
BAR ();
This patch extends the -Wmisleading-indentation implementation to
support analyzing such statements and their tokens. This is done in the
"natural" way by resolving the location of each of the three tokens to
the token's macro expansion point. (Additionally, if the tokens all
resolve to the same macro expansion point then we instead use their
locations within the macro definition.) When these resolved locations
are all different, then we can proceed with applying the warning
heuristics to them as if no macros were involved.
gcc/c-family/ChangeLog:
PR c/80076
* c-indentation.c (should_warn_for_misleading_indentation): Move
declarations of local variables closer to their first use.
Handle virtual token locations by resolving them to their
respective macro expansion points. If all three tokens are
produced from the same macro expansion, then instead use their
loci within the macro definition.
gcc/objc/ChangeLog:
PR c/80076
* objc-gnu-runtime-abi-01.c
(gnu_runtime_abi_01_get_class_super_ref): Reduce indentation of
misleadingly indented return statements.
* objc-next-runtime-abi-01.c
(next_runtime_abi_01_get_class_super_ref): Likewise.
gcc/ChangeLog:
PR c/80076
* gensupport.c (alter_attrs_for_subst_insn) <case SET_ATTR>:
Reduce indentation of misleadingly indented code fragment.
* lra-constraints.c (multi_block_pseudo_p): Likewise.
* sel-sched-ir.c (merge_fences): Likewise.
libcpp/ChangeLog:
PR c/80076
* include/line-map.h (first_map_in_common): Declare.
* line-map.c (first_map_in_common): Remove static.
gcc/testsuite/ChangeLog:
PR c/80076
* c-c++-common/Wmisleading-indentation-5.c: New test.
Mark Wielaard [Sun, 23 Aug 2020 14:21:08 +0000 (16:21 +0200)]
Add DWARF5 variants of assembly scan tests that use DW_FORM_implicit_const
Some DWARF tests scan the assembly output looking for constant values.
When using DWARF5 those constants might use DW_FORM_implicit_const,
which are output (in the comments) after the attribute instead of
before. To make sure these tests work introduce a -gdwarf-5 variant
of these tests and explicitly use -gdwarf-2 for the original.
gcc/testsuite/ChangeLog:
* gcc.dg/debug/dwarf2/inline2.c: Add -gdwarf-2.
* g++.dg/debug/dwarf2/inline-var-1.C: Likewise.
* gcc.dg/debug/dwarf2/pr41445-5.c: Likewise.
* gcc.dg/debug/dwarf2/pr41445-6.c: Likewise.
* gcc.dg/debug/dwarf2/inline6.c: New variant with -gdwarf-5.
* g++.dg/debug/dwarf2/inline-var-3.C: Likewise.
* gcc.dg/debug/dwarf2/pr41445-7.c: Likewise.
* gcc.dg/debug/dwarf2/pr41445-8.c: Likewise.
Andrea Corallo [Thu, 17 Sep 2020 13:36:22 +0000 (15:36 +0200)]
aarch64: Fix dejaGNU directive in clastb_8.c testcase
gcc/testsuite/ChangeLog
2020-09-17 Andre Corallo <andrea.corallo@arm.com>
* gcc.target/aarch64/sve/clastb_8.c: Fix a dg-final scan
directive.
Martin Sebor [Thu, 17 Sep 2020 15:07:09 +0000 (09:07 -0600)]
Document -Wuninitialized for allocated objects.
gcc/ChangeLog:
* doc/invoke.texi (-Wuninitialized): Document -Wuninitialized for
allocated objects.
(-Wmaybe-uninitialized): Same.
David Edelsohn [Wed, 16 Sep 2020 18:56:00 +0000 (18:56 +0000)]
aix: apply socket.h extern "C++" more narrowly.
Recent Technology Levels of AIX 7.2 have made sys/socket.h more C++-aware,
which causes the fix to be applied in too many locations. This patch adds
more context for the selection to apply the fix more narrowly.
fixincludes/ChangeLog:
2020-09-17 David Edelsohn <dje.gcc@gmail.com>
* inclhack.def (aix_externcpp1): Add more context to select.
(aix_externcpp2): Same.
* fixincl.x: Regenerate.
* tests/base/sys/socket.h: Update expected results.
Patrick Palka [Thu, 17 Sep 2020 13:16:02 +0000 (09:16 -0400)]
c++: requires-expressions and partial instantiation [PR96410]
This patch makes tsubst_requires_expr avoid substituting into a
requires-expression when partially instantiating a generic lambda.
This is necessary in general to ensure that we always check requirements
in lexical order (as in the first testcase below). A mechanism similar
to PACK_EXPANSION_EXTRA_ARGS is added to remember template arguments and
defer substitution of requires-expressions.
Incidentally, this change also fixes the two mentioned PRs -- the
problem there is that tsubst_requires_expr was performing semantic
checks on template trees, and some of the checks are not prepared to
handle such trees. With this patch, tsubst_requires_expr no longer
does any semantic checking at all when processing_template_decl.
gcc/cp/ChangeLog:
PR c++/96409
PR c++/96410
* constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
add_extra_args and build_extra_args to defer substitution until
we have all the template arguments.
(finish_requires_expr): Adjust the call to build_min so that
REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
* cp-tree.def (REQUIRES_EXPR): Give it a third operand.
* cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
REQUIRES_EXPR_EXTRA_ARGS): Define.
(add_extra_args, build_extra_args): Declare.
gcc/testsuite/ChangeLog:
PR c++/96409
PR c++/96410
* g++.dg/cpp2a/concepts-lambda13.C: New test.
* g++.dg/cpp2a/concepts-lambda14.C: New test.
Christophe Lyon [Fri, 11 Sep 2020 11:43:56 +0000 (11:43 +0000)]
libgcc/config/arm/fp16.c: Make _internal functions static inline
This patch makes the *_internal functions 'static inline' to avoid these warnings during the build:
/libgcc/config/arm/fp16.c:169:1: warning: no previous prototype for '__gnu_h2f_internal' [-Wmissing-prototypes]
/libgcc/config/arm/fp16.c:194:1: warning: no previous prototype for '__gnu_f2h_ieee' [-Wmissing-prototypes]
/libgcc/config/arm/fp16.c:200:1: warning: no previous prototype for '__gnu_h2f_ieee' [-Wmissing-prototypes]
/libgcc/config/arm/fp16.c:206:1: warning: no previous prototype for '__gnu_f2h_alternative' [-Wmissing-prototypes]
/libgcc/config/arm/fp16.c:212:1: warning: no previous prototype for '__gnu_h2f_alternative' [-Wmissing-prototypes]
/libgcc/config/arm/fp16.c:218:1: warning: no previous prototype for '__gnu_d2h_ieee' [-Wmissing-prototypes]
/libgcc/config/arm/fp16.c:224:1: warning: no previous prototype for '__gnu_d2h_alternative' [-Wmissing-prototypes]
2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
Christophe Lyon <christophe.lyon@linaro.org>
libgcc/
* config/arm/fp16.c (__gnu_h2f_internal): Add 'static inline'
qualifier.
(__gnu_f2h_ieee, __gnu_h2f_ieee, __gnu_f2h_alternative)
(__gnu_h2f_alternative,__gnu_d2h_ieee, __gnu_d2h_alternative): Add
missing prototypes.
Tobias Burnus [Thu, 17 Sep 2020 12:01:09 +0000 (14:01 +0200)]
Fortran: Avoid double-free with parse error (PR96041, PR93423)
gcc/fortran/
PR fortran/96041
PR fortran/93423
* decl.c (gfc_match_submod_proc): Avoid later double-free
in the error case.
Richard Biener [Thu, 17 Sep 2020 09:48:36 +0000 (11:48 +0200)]
CSE negated multiplications and divisions
This adds the capability to look for available negated multiplications
and divisions, replacing them with cheaper negates.
2020-09-17 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.c (visit_nary_op): Value-number multiplications
and divisions to negates of available negated forms.
* gcc.dg/tree-ssa/ssa-fre-88.c: New testcase.
Eric Botcazou [Thu, 17 Sep 2020 10:58:02 +0000 (12:58 +0200)]
Fix assertion checking failure with tail call
gcc/ChangeLog:
PR middle-end/97078
* function.c (use_register_for_decl): Test cfun->tail_call_marked
for a parameter here instead of...
(assign_parm_setup_reg): ...here.
gcc/testsuite/ChangeLog:
* gcc.dg/pr97078.c: New test.
Aldy Hernandez [Tue, 15 Sep 2020 15:33:48 +0000 (17:33 +0200)]
Allow copying of symbolic ranges to an irange.
This fixes an ICE when trying to copy a legacy value_range containing
a symbolic to a multi-range:
min = make_ssa_name (type);
max = build_int_cst (type, 55);
value_range vv (min, max);
int_range<2> vr = vv;
gcc/ChangeLog:
* range-op.cc (multi_precision_range_tests): Normalize symbolics when copying to a
multi-range.
* value-range.cc (irange::copy_legacy_range): Add test.
Jan Hubicka [Thu, 17 Sep 2020 10:41:07 +0000 (12:41 +0200)]
Fix availability of functions in other partitions
* cgraph.c (cgraph_node::get_availability): Fix availability of
functions in other partitions
* varpool.c (varpool_node::get_availability): Likewise.
Wei Wentao [Thu, 17 Sep 2020 09:40:23 +0000 (10:40 +0100)]
aarch64: Fixed unused variable warning in aarch64-unwind.h
libgcc/
* config/aarch64/aarch64-unwind.h (aarch64_demangle_return_addr): Fix
unused variable warning.
Christophe Lyon [Fri, 11 Sep 2020 11:58:59 +0000 (11:58 +0000)]
fixincludes/fixfixes.c: Fix 'set but not used' warning.
pz_tmp_base and pz_tmp_dot are always set, but used only when
_PC_NAME_MAX is defined.
This patch moves their declaration and definition undef #ifdef
_PC_NAME_MAX to avoid this warning.
2020-09-11 Torbjörn SVENSSON <torbjorn.svensson@st.com>
Christophe Lyon <christophe.lyon@linaro.org>
fixincludes/
* fixfixes.c (pz_tmp_base, pz_tmp_dot): Define only with
_PC_NAME_MAX.
Jojo R [Wed, 16 Sep 2020 11:47:41 +0000 (19:47 +0800)]
C-SKY: Add -msim option
gcc/ChangeLog:
* config/csky/csky.opt (msim): New.
* doc/invoke.texi (C-SKY Options): Document -msim.
* config/csky/csky-elf.h (LIB_SPEC): Add simulator runtime.
Sergei Trofimovich [Fri, 11 Sep 2020 22:33:01 +0000 (23:33 +0100)]
doc: use @code{} instead of @samp{@command{}} around 'date %s'
Before the change 'man gcc' rendered "SOURCE_DATE_EPOCH" section as:
... the output of @command{date +%s} on GNU/Linux ...
After the change it renders as:
... the output of "date +%s" on GNU/Linux ...
gcc/ChangeLog:
* doc/cppenv.texi: Use @code{} instead of @samp{@command{}}
around 'date %s'.
liuhongt [Wed, 16 Sep 2020 05:56:30 +0000 (13:56 +0800)]
If -mavx implies -mxsave, then -mno-xsave should imply -mno-avx.
Current status is -mno-avx implies -mno-xsave which should be wrong.
gcc/ChangeLog
* common/config/i386/i386-common.c
(OPTION_MASK_ISA_AVX_UNSET): Remove OPTION_MASK_ISA_XSAVE_UNSET.
(OPTION_MASK_ISA_XSAVE_UNSET): Add OPTION_MASK_ISA_AVX_UNSET.
gcc/testsuite/ChangeLog
* gcc.target/i386/xsave-avx-1.c: New test.
GCC Administrator [Thu, 17 Sep 2020 00:16:31 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Thu, 17 Sep 2020 00:03:52 +0000 (17:03 -0700)]
libbacktrace: use ELF symbol table if no debug info available
PR libbacktrace/97080
* fileline.c (backtrace_syminfo_to_full_callback): New function.
(backtrace_syminfo_to_full_error_callback): New function.
* elf.c (elf_nodebug): Call syminfo_fn if possible.
* internal.h (struct backtrace_call_full): Define.
(backtrace_syminfo_to_full_callback): Declare.
(backtrace_syminfo_to_full_error_callback): Declare.
* mtest.c (f3): Only check all[i] if data.index permits.
David Malcolm [Wed, 16 Sep 2020 13:22:06 +0000 (09:22 -0400)]
analyzer: fix state explosions due to SCC bug
Debugging the state explosion of the very large switch statement in
gcc.dg/analyzer/pr96653.c showed that the worklist was failing to
order the exploded nodes correctly; the in-edges at the join point
after the switch were not getting processed together, but were instead
being rocessed in smaller batches, bloating the exploded graph until the
per-point limit was reached.
The root cause turned out to be a bug in creating the strongly-connected
components for the supergraph: the code was considering interprocedural
edges as well as intraprocedural edges, leading to unpredictable
misorderings of the SCC and worklist, leading to bloating of the
exploded graph.
This patch fixes the SCC creation so it only considers intraprocedural
edges within the supergraph. It also tweaks worklist::key_t::cmp to
give higher precedence to call_string over differences within a
supernode, since enodes with different call_strings can't be merges.
In practise, none of my test cases were affected by this latter change,
though it seems to be the right thing to do.
With this patch, the very large switch statement in
gcc.dg/analyzer/pr96653.c is handled in a single call to
exploded_graph::maybe_process_run_of_before_supernode_enodes:
merged 358 in-enodes into 2 out-enode(s) at SN: 402
and that testcase no longer hits the per-program-point limits.
gcc/analyzer/ChangeLog:
* engine.cc (strongly_connected_components::strong_connect): Only
consider intraprocedural edges when creating SCCs.
(worklist::key_t::cmp): Add comment. Treat call_string
differences as more important than differences of program_point
within a supernode.
gcc/testsuite/ChangeLog:
PR analyzer/96653
* gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c: Update
expected number of exploded nodes.
* gcc.dg/analyzer/malloc-vs-local-1a.c: Update expected number
of exploded nodes.
* gcc.dg/analyzer/pr96653.c: Remove -Wno-analyzer-too-complex.
David Malcolm [Wed, 16 Sep 2020 13:12:45 +0000 (09:12 -0400)]
analyzer: show SCC ids in .dot dumps
gcc/analyzer/ChangeLog:
* engine.cc (supernode_cluster::dump_dot): Show the SCC id
in the per-supernode clusters in FILENAME.eg.dot output.
(exploded_graph_annotator::add_node_annotations):
Show the SCC of the supernode in FILENAME.supernode.eg.dot output.
* exploded-graph.h (worklist::scc_id): New.
(exploded_graph::get_scc_id): New.
David Malcolm [Tue, 18 Aug 2020 22:52:17 +0000 (18:52 -0400)]
analyzer: bulk merger/processing of runs of nodes at CFG join points
Prior to this patch the analyzer worklist considered only one node or
two nodes at a time, processing and/or merging state individually or
pairwise.
This could lead to explosions of merger nodes at CFG join points,
especially after switch statements, which could have large numbers
of in-edges, and thus large numbers of merger exploded_nodes could
be created, exceeding the per-point limit and thus stopping analysis
with -Wanalyzer-too-complex.
This patch special-cases the handling for runs of consecutive
nodes in the worklist at a CFG join point, processing and merging
them all together.
The patch fixes a state explosion seen in bzip2.c seen when attempting
to reproduce PR analyzer/95188, in a switch statement in a loop for
argument parsing. With this patch, the analyzer successfully
consolidates the state after the argument parsing to a single exploded
node.
In gcc.dg/analyzer/pr96653.c there is a switch statement with over 300
cases which leads to hitting the per-point limit. With this patch
the consolidation code doesn't manage to merge all of them due to other
worklist-ordering bugs, and it still hits the per-point limits, but it
does manage some very long consolidations:
merged 2 in-enodes into 2 out-enode(s) at SN: 403
merged 2 in-enodes into 2 out-enode(s) at SN: 403
merged 2 in-enodes into 1 out-enode(s) at SN: 11
merged 29 in-enodes into 1 out-enode(s) at SN: 35
merged 6 in-enodes into 1 out-enode(s) at SN: 41
merged 31 in-enodes into 1 out-enode(s) at SN: 35
and with a followup patch to fix an SCC issue it manages:
merged 358 in-enodes into 2 out-enode(s) at SN: 402
The patch appears to fix the failure on non-x86_64 of:
gcc.dg/analyzer/pr93032-mztools.c (test for excess errors)
which is PR analyzer/96616.
Unfortunately, the patch introduces a memory leak false positive in
gcc.dg/analyzer/pr94851-1.c, but this appears to be a pre-existing bug
that was hidden by state-merging failures.
gcc/analyzer/ChangeLog:
* engine.cc (exploded_node::dump_dot): Show STATUS_BULK_MERGED.
(exploded_graph::process_worklist): Call
maybe_process_run_of_before_supernode_enodes.
(exploded_graph::maybe_process_run_of_before_supernode_enodes):
New.
(exploded_graph_annotator::print_enode): Show STATUS_BULK_MERGED.
* exploded-graph.h (enum exploded_node::status): Add
STATUS_BULK_MERGED.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/bzip2-arg-parse-1.c: New test.
* gcc.dg/analyzer/loop-n-down-to-1-by-1.c: Remove xfail.
* gcc.dg/analyzer/pr94851-1.c: Add xfail.
David Malcolm [Tue, 15 Sep 2020 18:25:52 +0000 (14:25 -0400)]
analyzer: add program_point::get_next
Avoid some future copy-and-paste by introducing a function.
gcc/analyzer/ChangeLog:
* engine.cc
(exploded_graph::process_node) <case PK_BEFORE_SUPERNODE>:
Simplify by using program_point::get_next.
* program-point.cc (program_point::get_next): New.
* program-point.h (program_point::get_next): New decl.
David Malcolm [Tue, 15 Sep 2020 13:57:36 +0000 (09:57 -0400)]
analyzer: show program point in -Wanalyzer-too-complex
I found this useful when debugging.
gcc/analyzer/ChangeLog:
* engine.cc (exploded_graph::get_or_create_node): Show the
program point when issuing -Wanalyzer-too-complex due to hitting
the per-program-point limit.
David Malcolm [Wed, 16 Sep 2020 17:12:39 +0000 (13:12 -0400)]
analyzer: getchar has no side-effects
Seen whilst debugging another issue, where the analyzer was assuming
conservatively that a call to getchar could clobber a global.
This is handled for most of the other stdio functions by the list
in sm-file.cc
gcc/analyzer/ChangeLog:
* region-model.cc (region_model::on_call_pre): Treat getchar as
having no side-effects.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/getchar-1.c: New test.
Alexandre Oliva [Wed, 16 Sep 2020 21:15:01 +0000 (18:15 -0300)]
use E_*mode instead of just *mode
g++ 4.8.5 rejected cases with SFmode and DFmode, presumably due to
some bug in the constexpr implementation.
for gcc/ChangeLog
* config/rs6000/rs6000.c (have_compare_and_set_mask): Use
E_*mode in cases.
Bill Schmidt [Wed, 16 Sep 2020 21:12:35 +0000 (16:12 -0500)]
rs6000: Add rs6000_cfun_pcrel_p
Most uses of rs6000_pcrel_p are called for the current function.
A specialized version for cfun is more efficient for these uses.
2020-09-16 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/predicates.md (current_file_function_operand):
Remove argument from rs6000_pcrel_p call.
* config/rs6000/rs6000-logue.c (rs6000_decl_ok_for_sibcall):
Likewise.
(rs6000_global_entry_point_prologue_needed_p): Likewise.
(rs6000_output_function_prologue): Likewise.
* config/rs6000/rs6000-protos.h (rs6000_function_pcrel_p): New
prototype.
(rs6000_pcrel_p): Remove argument.
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Remove
argument from rs6000_pcrel_p call.
(rs6000_call_template_1): Likewise.
(rs6000_indirect_call_template_1): Likewise.
(rs6000_longcall_ref): Likewise.
(rs6000_call_aix): Likewise.
(rs6000_sibcall_aix): Likewise.
(rs6000_function_pcrel_p): Rename from rs6000_pcrel_p.
(rs6000_pcrel_p): Rewrite.
* config/rs6000/rs6000.md (*pltseq_plt_pcrel<mode>): Remove
argument from rs6000_pcrel_p call.
(*call_local<mode>): Likewise.
(*call_value_local<mode>): Likewise.
(*call_nonlocal_aix<mode>): Likewise.
(*call_value_nonlocal_aix<mode>): Likewise.
(*call_indirect_pcrel<mode>): Likewise.
(*call_value_indirect_pcrel<mode>): Likewise.
Martin Sebor [Wed, 16 Sep 2020 20:04:01 +0000 (14:04 -0600)]
Detect conflicts between incompatible uses of the same attribute (PR c/78666).
Resolves:
PR c/78666 - conflicting attribute alloc_size accepted
PR c/96126 - conflicting attribute section accepted on redeclaration
gcc/c-family/ChangeLog:
PR c/78666
PR c/96126
* c-attribs.c (validate_attr_args): New function.
(validate_attr_arg): Same.
(handle_section_attribute): Call it. Introduce a local variable.
(handle_alloc_size_attribute): Same.
(handle_alloc_align_attribute): Same.
gcc/testsuite/ChangeLog:
PR c/78666
PR c/96126
* gcc.dg/attr-alloc_align-5.c: New test.
* gcc.dg/attr-alloc_size-13.c: New test.
* gcc.dg/attr-section.c: New test.
* c-c++-common/builtin-has-attribute-3.c: Add xfails due to expected
warnings to be cleaned up.
Marek Polacek [Wed, 16 Sep 2020 13:27:29 +0000 (09:27 -0400)]
preprocessor: Fix ICE with too long line in fmtwarn [PR96935]
Here we ICE in char_span::subspan because the offset it gets is -1.
It's -1 because get_substring_ranges_for_loc gets a location whose
column was 0. That only happens in testcases like the attached where
we're dealing with extremely long lines (at least 4065 chars it seems).
This does happen in practice, though, so it's not just a theoretical
problem (e.g. when building the SU2 suite).
Fixed by checking that the column get_substring_ranges_for_loc gets is
sane, akin to other checks in that function.
gcc/ChangeLog:
PR preprocessor/96935
* input.c (get_substring_ranges_for_loc): Return if start.column
is less than 1.
gcc/testsuite/ChangeLog:
PR preprocessor/96935
* gcc.dg/format/pr96935.c: New test.
Martin Sebor [Wed, 16 Sep 2020 19:23:31 +0000 (13:23 -0600)]
Work harder to avoid -Wuninitialized for objects of empty structs (PR middle-end/96295).
Resolves:
PR middle-end/96295 - -Wmaybe-uninitialized warning for range operator with
reference to an empty struct
gcc/ChangeLog:
PR middle-end/96295
* tree-ssa-uninit.c (maybe_warn_operand): Work harder to avoid
warning for objects of empty structs
gcc/testsuite/ChangeLog:
PR middle-end/96295
* g++.dg/warn/Wuninitialized-11.C: New test.
Nathan Sidwell [Wed, 16 Sep 2020 18:04:19 +0000 (11:04 -0700)]
c++: local-scope OMP UDR reductions have no template head
This corrects the earlier problems with removing the template header
from local omp reductions. And it uncovered a latent bug. When we
tsubst such a decl, we immediately tsubst its body.
cp_check_omp_declare_reduction gets a success return value to gate
that instantiation.
udr-2.C got a further error, as the omp checking machinery doesn't
appear to turn the reduction into an error mark when failing. I
didn't dig into that further. udr-3.C appears to have been invalid
and accidentally worked.
gcc/cp/
* cp-tree.h (cp_check_omp_declare_reduction): Return bool.
* semantics.c (cp_check_omp_declare_reduction): Return true on for
success.
* pt.c (push_template_decl_real): OMP reductions do not get a
template header.
(tsubst_function_decl): Remove special casing for local decl omp
reductions.
(tsubst_expr): Call instantiate_body for a local omp reduction.
(instantiate_body): Add nested_p parm, and deal with such
instantiations.
(instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
instantiate_body call.
gcc/testsuite/
* g++.dg/gomp/udr-2.C: Add additional expected error.
libgomp/
* testsuite/libgomp.c++/udr-3.C: Add missing ctor.
Iain Sandoe [Wed, 16 Sep 2020 07:03:05 +0000 (08:03 +0100)]
libbacktrace, Mach-O : Support PowerPC archs.
This adds the PPC architecture variants for Mach-O libbacktrace.
With this (as for X86 and Arm) when dsymutil is run on the binary
we get a basic usable backtrace.
Testsuite results on powerpc-apple-darwin9 are the same as for X86:
* btest fails (TBC why)
* dwarf5 tests fail because dsymutil does not handle that so far.
libbacktrace/ChangeLog:
* macho.c (MACH_O_CPU_TYPE_PPC): New.
(MACH_O_CPU_TYPE_PPC64): New.
Add compile-tests for powerpc to the Mach-O variants.
Eric Botcazou [Wed, 16 Sep 2020 11:06:34 +0000 (13:06 +0200)]
Fix pessimization in EH cleanup pass
This restores the post-order traversal done by cleanup_all_empty_eh in
order to eliminate empty landing pads and also contains a small tweak
to the line debug info to avoid a problematic inheritance for coverage
measurement.
gcc/ChangeLog:
* tree-eh.c (lower_try_finally_dup_block): Backward propagate slocs
to stack restore builtin calls.
(cleanup_all_empty_eh): Do again a post-order traversal of the EH
region tree.
gcc/testsuite/ChangeLog:
* gnat.dg/concat4.adb: New test.
Nathan Sidwell [Wed, 16 Sep 2020 15:05:26 +0000 (08:05 -0700)]
c++: Avoid confusing 'nested' name
instantiate_body has a local var call 'nested', which indicates that
this instantiation was caused during the body of some function -- not
necessarily its containing scope. That's confusing, let's just use
'current_function_decl' directly. Then we can also simplify the
push_to_top_level logic, which /does/ indicate whether this is an
actual nested function. (C++ does not have nested functions, but OMP
ODRs fall into that category. A follow up patch will use that more
usual meaning of 'nested' wrt to functions.)
gcc/cp/
* pt.c (instantiate_body): Remove 'nested' var, simplify
push_to_top logic.
Tobias Burnus [Wed, 16 Sep 2020 14:23:13 +0000 (16:23 +0200)]
Fortran: OpenMP - fix simd with (last)private (PR97061)
gcc/fortran/ChangeLog:
PR fortran/97061
* trans-openmp.c (gfc_trans_omp_do): Handle simd with (last)private.
gcc/testsuite/ChangeLog:
PR fortran/97061
* gfortran.dg/gomp/openmp-simd-6.f90: New test.
Nathan Sidwell [Wed, 16 Sep 2020 14:14:14 +0000 (07:14 -0700)]
c++: Break out actual instantiation from instantiate_decl
This refactors instantiate_decl, breaking out the actual instantiation
work to instantiate_body. That'll allow me to address the OMP UDR
issue, but it also means we have slightly neater code in
instantiate_decl anyway.
gcc/cp/
* pt.c (instantiate_body): New, broken out of ..
(instantiate_decl): ... here. Call it.
Andrea Corallo [Fri, 28 Aug 2020 15:01:15 +0000 (16:01 +0100)]
vec: don't select partial vectors when unnecessary
gcc/ChangeLog
2020-09-09 Andrea Corallo <andrea.corallo@arm.com>
* tree-vect-loop.c (vect_need_peeling_or_partial_vectors_p): New
function.
(vect_analyze_loop_2): Make use of it not to select partial
vectors if no peel is required.
(determine_peel_for_niter): Move out some logic into
'vect_need_peeling_or_partial_vectors_p'.
gcc/testsuite/ChangeLog
2020-09-09 Andrea Corallo <andrea.corallo@arm.com>
* gcc.target/aarch64/sve/cost_model_10.c: New test.
* gcc.target/aarch64/sve/clastb_8.c: Update test for new
vectorization strategy.
* gcc.target/aarch64/sve/cost_model_5.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_14.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_15.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_16.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_17.c: Likewise.
H.J. Lu [Mon, 14 Sep 2020 15:52:27 +0000 (08:52 -0700)]
rtl_data: Add sp_is_clobbered_by_asm
Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack
pointer is clobbered by asm statement.
gcc/
PR target/97032
* cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm
to true if the stack pointer is clobbered by asm statement.
* emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm.
* config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true
if the stack pointer is clobbered by asm statement.
gcc/testsuite/
PR target/97032
* gcc.target/i386/pr97032.c: New test.
Feng Xue [Wed, 16 Sep 2020 08:21:14 +0000 (16:21 +0800)]
testsuite/97066 - minor change to bypass plusminus-with-convert rule
The following testcases will be simplified by the new rule
(T)(A) +- (T)(B) -> (T)(A +- B), so could not keep code pattern
expected by test-check. Adjust test code to suppress simplification.
2020-09-16 Feng Xue <fxue@os.amperecomputing.com>
gcc/testsuite/
PR testsuite/97066
* gcc.dg/ifcvt-3.c: Modified to suppress simplification.
* gcc.dg/tree-ssa/
20030807-10.c: Likewise.
Ilya Leoshkevich [Wed, 2 Sep 2020 16:00:35 +0000 (18:00 +0200)]
IBM Z: Fix *vec_tf_to_v1tf constraints
Certain alternatives of *vec_tf_to_v1tf use "v" constraint for its
TFmode source operand. Therefore it is assigned to VEC_REGS class,
and when it is reloaded using *movtf_64, whose relevant alternatives
need FP_REGS, LRA loops and ICE happens. The reason is that register
class mismatch causes LRA to emit another reload, which triggers this
issue again.
Fix by using "f" constraint, which is more appropriate for FP register
pairs anyway.
gcc/ChangeLog:
2020-09-02 Ilya Leoshkevich <iii@linux.ibm.com>
* config/s390/vector.md(*vec_tf_to_v1tf): Use "f" instead of "v"
for the source operand.
Jojo R [Wed, 16 Sep 2020 10:34:43 +0000 (18:34 +0800)]
C-SKY: Refine target name for elf target test
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_profiling_available): Refine name of elf target.
Jojo R [Wed, 16 Sep 2020 10:34:42 +0000 (18:34 +0800)]
C-SKY: Set use_gcc_stdint=wrap for elf target
gcc/ChangeLog:
* config.gcc (C-SKY): Set use_gcc_stdint=wrap for elf target.
Jojo R [Wed, 16 Sep 2020 10:34:41 +0000 (18:34 +0800)]
C-SKY: Enable crtbegin/crtend.o of libgcc for elf target
libgcc/ChangeLog:
* config.host (C-SKY): Enable crtbegin/crtend.o of libgcc for elf target.
Richard Biener [Wed, 16 Sep 2020 09:24:23 +0000 (11:24 +0200)]
remove STMT_VINFO_NUM_SLP_USES
This removes STMT_VINFO_NUM_SLP_USES by pushing the setting of
the shared stmt_vec_info vector type to where we actually need it
which is alignment analysis and vectorizable_* analysis (where
we could eventually elide it for non-load/store operations).
In particular "uses" in the cache and in disqualified SLP
subgraphs should no longer provide conflicting vector types
this way.
2020-09-16 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (_stmt_vec_info::num_slp_uses): Remove.
(STMT_VINFO_NUM_SLP_USES): Likewise.
(vect_free_slp_instance): Adjust.
(vect_update_shared_vectype): Declare.
* tree-vectorizer.c (vec_info::~vec_info): Adjust.
* tree-vect-loop.c (vect_analyze_loop_2): Likewise.
(vectorizable_live_operation): Use vector type from
SLP_TREE_REPRESENTATIVE.
(vect_transform_loop): Adjust.
* tree-vect-data-refs.c (vect_slp_analyze_node_alignment):
Set the shared vector type.
* tree-vect-slp.c (vect_free_slp_tree): Remove final_p
parameter, remove STMT_VINFO_NUM_SLP_USES updating.
(vect_free_slp_instance): Adjust.
(vect_create_new_slp_node): Remove STMT_VINFO_NUM_SLP_USES
updating.
(vect_update_shared_vectype): Always compare with the
present vector type, update if NULL.
(vect_build_slp_tree_1): Do not update the shared vector
type here.
(vect_build_slp_tree_2): Adjust.
(slp_copy_subtree): Likewise.
(vect_attempt_slp_rearrange_stmts): Likewise.
(vect_analyze_slp_instance): Likewise.
(vect_analyze_slp): Likewise.
(vect_slp_analyze_node_operations_1): Update the shared
vector type.
(vect_slp_analyze_operations): Adjust.
(vect_slp_analyze_bb_1): Likewise.
Jojo R [Wed, 16 Sep 2020 07:29:18 +0000 (15:29 +0800)]
C-SKY: Support multilib for mfloat-abi=.
gcc/ChangeLog:
* config/csky/t-csky-linux (CSKY_MULTILIB_OSDIRNAMES): Use mfloat-abi.
(MULTILIB_OPTIONS): Likewise.
* config/csky/t-csky-elf (MULTILIB_OPTIONS): Likewise.
(MULTILIB_EXCEPTIONS): Likewise.
Jakub Jelinek [Wed, 16 Sep 2020 08:11:53 +0000 (10:11 +0200)]
arm: Avoid unused parameter warning
2020-09-16 Jakub Jelinek <jakub@redhat.com>
* config/arm/arm.c (arm_option_restore): Comment out opts argument
name to avoid unused parameter warnings.
Jakub Jelinek [Wed, 16 Sep 2020 08:04:32 +0000 (10:04 +0200)]
options, lto: Optimize streaming of optimization nodes
When working on the previous patch, I've noticed that all cl_optimization
fields appart from strings are streamed with bp_pack_value (..., 64); so we
waste quite a lot of space, given that many of the options are just booleans
or char options and there are 450-ish of them.
Fixed by streaming the number of bits the corresponding fields have.
While for char fields we have also range information, except for 3
it is either -128, 127 or 0, 255, so it didn't seem worth it to bother
with using range-ish packing.
2020-09-16 Jakub Jelinek <jakub@redhat.com>
* optc-save-gen.awk: In cl_optimization_stream_out use
bp_pack_var_len_{int,unsigned} instead of bp_pack_value. In
cl_optimization_stream_in use bp_unpack_var_len_{int,unsigned}
instead of bp_unpack_value. Formatting fix.
Jakub Jelinek [Wed, 16 Sep 2020 07:42:33 +0000 (09:42 +0200)]
store-merging: Consider also overlapping stores earlier in the by bitpos sorting [PR97053]
As the testcases show, if we have something like:
MEM <char[12]> [&b + 8B] = {};
MEM[(short *) &b] = 5;
_5 = *x_4(D);
MEM <long long unsigned int> [&b + 2B] = _5;
MEM[(char *)&b + 16B] = 88;
MEM[(int *)&b + 20B] = 1;
then in sort_by_bitpos the stores are almost like in the given order,
except the first store is after the = _5; store.
We can't coalesce the = 5; store with = _5;, because the latter is MEM_REF,
while the former INTEGER_CST, and we can't coalesce the = _5 store with
the = {} store because the former is MEM_REF, the latter INTEGER_CST.
But we happily coalesce the remaining 3 stores, which is wrong, because the
= _5; store overlaps those and is in between them in the program order.
We already have code to deal with similar cases in check_no_overlap, but we
deal only with the following stores in sort_by_bitpos order, not the earlier
ones.
The following patch checks also the earlier ones. In coalesce_immediate_stores
it computes the first one that needs to be checked (all the ones whose
bitpos + bitsize is smaller or equal to merged_store->start don't need to be
checked and don't need to be checked even for any following attempts because
of the sort_by_bitpos sorting) and the end of that (that is the first store
in the merged_store).
2020-09-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/97053
* gimple-ssa-store-merging.c (check_no_overlap): Add FIRST_ORDER,
START, FIRST_EARLIER and LAST_EARLIER arguments. Return false if
any stores between FIRST_EARLIER inclusive and LAST_EARLIER exclusive
has order in between FIRST_ORDER and LAST_ORDER and overlaps the to
be merged store.
(imm_store_chain_info::try_coalesce_bswap): Add FIRST_EARLIER argument.
Adjust check_no_overlap caller.
(imm_store_chain_info::coalesce_immediate_stores): Add first_earlier
and last_earlier variables, adjust them during iterations. Adjust
check_no_overlap callers, call check_no_overlap even when extending
overlapping stores by extra INTEGER_CST stores.
* gcc.dg/store_merging_31.c: New test.
* gcc.dg/store_merging_32.c: New test.
Jojo R [Wed, 16 Sep 2020 03:28:30 +0000 (11:28 +0800)]
C-SKY: Fix wrong ld name with option -mfloat-abi=hard.
gcc/ChangeLog:
* config/csky/csky-linux-elf.h (GLIBC_DYNAMIC_LINKER): Use mfloat-abi.
Kewen Lin [Wed, 16 Sep 2020 03:32:55 +0000 (22:32 -0500)]
rs6000: Remove useless insns fed into lvx/stvx [PR97019]
This patch is to extend the existing function find_alignment_op to
check all defintions of base_reg are AND operations with mask -16B
to force the alignment. If all are satifised, it passes all AND
operations and instructions to function recombine_lvx_pattern
and recombine_stvx_pattern, they can remove all useless ANDs
further.
Bootstrapped/regtested on powerpc64le-linux-gnu P8.
gcc/ChangeLog:
PR target/97019
* config/rs6000/rs6000-p8swap.c (find_alignment_op): Adjust to
support multiple defintions which are all AND operations with
the mask -16B.
(recombine_lvx_pattern): Adjust to handle multiple AND operations
from find_alignment_op.
(recombine_stvx_pattern): Likewise.
gcc/testsuite/ChangeLog:
PR target/97019
* gcc.target/powerpc/pr97019.c: New test.
Jojo R [Tue, 15 Sep 2020 08:08:01 +0000 (16:08 +0800)]
C-SKY: Support -mfloat-abi=hard.
gcc/ChangeLog:
* config/csky/csky.md (CSKY_NPARM_FREGS): New.
(call_value_internal_vs/d): New.
(untyped_call): New.
* config/csky/csky.h (TARGET_SINGLE_FPU): New.
(TARGET_DOUBLE_FPU): New.
(FUNCTION_VARG_REGNO_P): New.
(CSKY_VREG_MODE_P): New.
(FUNCTION_VARG_MODE_P): New.
(CUMULATIVE_ARGS): Add extra regs info.
(INIT_CUMULATIVE_ARGS): Use csky_init_cumulative_args.
(FUNCTION_ARG_REGNO_P): Use FUNCTION_VARG_REGNO_P.
* config/csky/csky-protos.h (csky_init_cumulative_args): Extern.
* config/csky/csky.c (csky_cpu_cpp_builtins): Support TARGET_HARD_FLOAT_ABI.
(csky_function_arg): Likewise.
(csky_num_arg_regs): Likewise.
(csky_function_arg_advance): Likewise.
(csky_function_value): Likewise.
(csky_libcall_value): Likewise.
(csky_function_value_regno_p): Likewise.
(csky_arg_partial_bytes): Likewise.
(csky_setup_incoming_varargs): Likewise.
(csky_init_cumulative_args): New.
gcc/testsuite/ChangeLog:
* gcc.dg/builtin-apply2.c : Skip if CSKY.
* gcc.dg/torture/stackalign/builtin-apply-2.c : Likewise.
Bill Schmidt [Wed, 16 Sep 2020 01:34:22 +0000 (20:34 -0500)]
rs6000: Fix misnamed built-in
The description in rs6000-builtin.def provides for a builtin named
__builtin_altivec_xst_len_r. However, it is hand-defined in
altivec_init_builtins as __builtin_xst_len_r, against the usual naming
practice. Fix that.
2020-09-15 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-call.c (altivec_init_builtins): Fix name
of __builtin_altivec_xst_len_r.
Than McIntosh [Tue, 15 Sep 2020 12:31:30 +0000 (08:31 -0400)]
libgo: additional type/const references in sysinfo.c
Add a few more explicit references to enumeration constants
(RUSAGE_SELF, DT_UNKNOWN) in sysinfo.c to insure that their hosting enums
are emitted into DWARF, when using a clang host compiler during
the gollvm build.
Updates golang/go#41382.
Updates golang/go#41404.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254941
GCC Administrator [Wed, 16 Sep 2020 00:16:37 +0000 (00:16 +0000)]
Daily bump.
David Malcolm [Tue, 15 Sep 2020 09:51:04 +0000 (05:51 -0400)]
analyzer: fix ICE when merging constraints w/o transitivity [PR96650]
PR analyzer/96650 reports an assertion failure when merging the
intersection of two sets of constraints, due to the resulting
constraints being infeasible.
It turns out that the two input sets were each infeasible if
transitivity were considered, but -fanalyzer-transitivity was off.
However for this case, the merging code was "discovering" the
transitive infeasibility of the intersection of the constraints even
when -fanalyzer-transitivity is off, triggering an assertion failure.
I attempted various fixes for this, but each of them would have
introduced O(N^2) logic into the constraint-handling code into the
-fno-analyzer-transitivity case (with N == the number of constraints).
This patch fixes the ICE by tweaking the assertion, so that we
silently drop such constraints if -fanalyzer-transitivity is off.
gcc/analyzer/ChangeLog:
PR analyzer/96650
* constraint-manager.cc (merger_fact_visitor::on_fact): Replace
assertion that add_constraint succeeded with an assertion that
if it fails, -fanalyzer-transitivity is off.
gcc/testsuite/ChangeLog:
PR analyzer/96650
* gcc.dg/analyzer/pr96650-1-notrans.c: New test.
* gcc.dg/analyzer/pr96650-1-trans.c: New test.
* gcc.dg/analyzer/pr96650-2-notrans.c: New test.
* gcc.dg/analyzer/pr96650-2-trans.c: New test.
Tobias Burnus [Tue, 15 Sep 2020 19:28:40 +0000 (21:28 +0200)]
libgomp/target.c: Silence -Wuninitialized warning
libgomp/ChangeLog:
PR fortran/96668
* target.c (gomp_map_vars_internal): Initialize has_nullptr.
Ilya Leoshkevich [Tue, 8 Sep 2020 23:23:51 +0000 (01:23 +0200)]
rtlanal: fix subreg handling in set_noop_p ()
The following s390 rtx is errneously considered a no-op:
(set (subreg:DF (reg:TF %f0) 8) (subreg:DF (reg:V1TF %f0) 8))
Here, SET_DEST is a second register in a floating-point register pair,
and SET_SRC is the second half of a vector register, so they refer to
different bits.
Fix by treating subregs of registers in different modes conservatively.
gcc/ChangeLog:
2020-09-11 Ilya Leoshkevich <iii@linux.ibm.com>
* rtlanal.c (set_noop_p): Treat subregs of registers in
different modes conservatively.
Richard Biener [Tue, 15 Sep 2020 14:12:53 +0000 (16:12 +0200)]
make swap argument of vect_get_and_check_slp_defs readonly
Since some time we're only using this argument to communicate from
vect_build_slp_tree_1 to vect_get_and_check_slp_defs. This makes
the direction of information flow clear.
2020-09-15 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_get_and_check_slp_defs): Make swap
argument by-value and do not change it.
(vect_build_slp_tree_2): Adjust, set swap to NULL after last
use.
Nathan Sidwell [Tue, 15 Sep 2020 14:55:18 +0000 (07:55 -0700)]
c++: Partially revert: local externs in templates do not get template head
Turns out I didn't get OMP reductions correct. To address those I
need to do some reorganization, so this patch just reverts the
OMP-specific pieces of the local decl changes.
gcc/cp/
* pt.c (push_template_decl_real): OMP reductions retain a template
header.
(tsubst_function_decl): Likewise.
Feng Xue [Mon, 17 Aug 2020 15:00:35 +0000 (23:00 +0800)]
tree-optimization/94234 - add plusminus-with-convert pattern
Add a rule (T)(A) +- (T)(B) -> (T)(A +- B), which works only when (A +- B)
could be folded to a simple value. By this rule, a plusminus-mult-with-convert
expression could be handed over to the rule (A * C) +- (B * C) -> (A +- B).
2020-09-15 Feng Xue <fxue@os.amperecomputing.com>
gcc/
PR tree-optimization/94234
* match.pd (T)(A) +- (T)(B) -> (T)(A +- B): New simplification.
gcc/testsuite/
PR tree-optimization/94234
* gcc.dg/pr94234-3.c: New test.
H.J. Lu [Tue, 15 Sep 2020 14:21:58 +0000 (07:21 -0700)]
gcc.target/i386/pr78904-4a.c: Compile with -mtune=generic
commit
e95395926a84a2406faefe0995295d199d595440
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Thu Jun 18 20:12:48 2020 +0200
i386: Fix mode of ZERO_EXTRACT RTXes, remove ext_register_operand predicate.
caused
FAIL: gcc.target/i386/pr78904-4a.c scan-assembler [ \t]movb[\t ]+%.h, t
when compiled with --target_board='unix{-m32\ -march=cascadelake}'. With
-mtune=generic:
movzwl 4(%esp), %edx
movl 8(%esp), %eax
movb %dh, t(%eax)
ret
With -mtune=cascadelake:
movzbl 5(%esp), %edx
movl 8(%esp), %eax
movb %dl, t(%eax)
ret
Add -mtune=generic for --target_board='unix{-m32\ -march=cascadelake}'.
* gcc.target/i386/pr78904-4a.c: Compile with -mtune=generic.
Segher Boessenkool [Mon, 14 Sep 2020 18:19:47 +0000 (18:19 +0000)]
bb-reorder: Fix for ICEs caused by
69ca5f3a9882
After the previous patch we are left with an unreachable BB. This will
ICE if either we have -fschedule-fusion, or we do not have peephole2.
2020-09-15 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/96475
* bb-reorder.c (duplicate_computed_gotos): If we did anything, run
cleanup_cfg.
Richard Biener [Tue, 15 Sep 2020 12:35:40 +0000 (14:35 +0200)]
Allow more BB vectorization
The following allows more BB vectorization by generally building leafs
from scalars rather than giving up. Note this is only a first step
towards this and as can be seen with the exception for node splitting
it is generally hard to get this heuristic sound. I've added variants
of the bb-slp-48.c testcase to make sure we still try permuting for
example.
2020-09-15 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_build_slp_tree_2): Also consider
building an operand from scalars when building it did not
fail fatally but avoid messing with the upcall splitting
of groups.
* gcc.dg/vect/bb-slp-48.c: New testcase.
* gcc.dg/vect/bb-slp-7.c: Adjust.
Andre Vieira [Mon, 14 Sep 2020 08:03:08 +0000 (09:03 +0100)]
arm: Fix testisms introduced with fix for pr target/95646
This patch changes the test to use the effective-target machinery disables the
error message "ARMv8-M Security Extensions incompatible with selected FPU" when
-mfloat-abi=soft.
Further changes 'asm' to '__asm__' to avoid failures with '-std=' options.
gcc/ChangeLog:
2020-07-06 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/arm/arm.c (arm_options_perform_arch_sanity_checks): Do not
check +D32 for CMSE if -mfloat-abi=soft
gcc/testsuite/ChangeLog:
2020-07-06 Andre Vieira <andre.simoesdiasvieira@arm.com>
* gcc.target/arm/pr95646.c: Fix testism.
liuhongt [Mon, 24 Aug 2020 12:36:52 +0000 (20:36 +0800)]
Retune mask <->integer cost for non-AVX512 micro-architecture.
gcc/ChangeLog:
PR target/96744
* config/i386/x86-tune-costs.h (struct processor_costs):
Increase mask <-> integer cost for non AVX512 target to avoid
spill gpr to mask. Also retune mask <-> integer and
mask_load/store for skylake_cost.
Jakub Jelinek [Tue, 15 Sep 2020 07:37:48 +0000 (09:37 +0200)]
i386: Fix up vector mul and div with broadcasts in -masm=intel mode
These patterns printed bogus <>s around the {1to16} and similar strings.
2020-09-15 Jakub Jelinek <jakub@redhat.com>
PR target/97028
* config/i386/sse.md (mul<mode>3<mask_name>_bcs,
<avx512>_div<mode>3<mask_name>_bcst): Use <avx512bcst> instead of
<<avx512bcst>>.
* gcc.target/i386/avx512f-pr97028.c: Untested fix.
Tobias Burnus [Tue, 15 Sep 2020 07:24:47 +0000 (09:24 +0200)]
OpenMP/Fortran: Fix (re)mapping of allocatable/pointer arrays [PR96668]
gcc/cp/ChangeLog:
PR fortran/96668
* cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
* cp-tree.h (cxx_omp_finish_clause): Likewise
* semantics.c (handle_omp_for_class_iterator): Update call.
gcc/fortran/ChangeLog:
PR fortran/96668
* trans.h (gfc_omp_finish_clause): Add bool openacc arg.
* trans-openmp.c (gfc_omp_finish_clause): Ditto. Use
GOMP_MAP_ALWAYS_POINTER with PSET for pointers.
(gfc_trans_omp_clauses): Like the latter and also if the always
modifier is used.
gcc/ChangeLog:
PR fortran/96668
* gimplify.c (gimplify_omp_for): Add 'bool openacc' argument;
update omp_finish_clause calls.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses,
gimplify_expr, gimplify_omp_loop): Update omp_finish_clause
and/or gimplify_for calls.
* langhooks-def.h (lhd_omp_finish_clause): Add bool openacc arg.
* langhooks.c (lhd_omp_finish_clause): Likewise.
* langhooks.h (lhd_omp_finish_clause): Likewise.
* omp-low.c (scan_sharing_clauses): Keep GOMP_MAP_TO_PSET cause for
'declare target' vars.
include/ChangeLog:
PR fortran/96668
* gomp-constants.h (GOMP_MAP_ALWAYS_POINTER_P): Define.
libgomp/ChangeLog:
PR fortran/96668
* libgomp.h (struct target_var_desc): Add has_null_ptr_assoc member.
* target.c (gomp_map_vars_existing): Add always_to_flag flag.
(gomp_map_vars_existing): Update call to it.
(gomp_map_fields_existing): Likewise
(gomp_map_vars_internal): Update PSET handling such that if a nullptr is
now allocated or if GOMP_MAP_POINTER is used PSET is updated and pointer
remapped.
(GOMP_target_enter_exit_data): Hanlde GOMP_MAP_ALWAYS_POINTER like
GOMP_MAP_POINTER.
* testsuite/libgomp.fortran/map-alloc-ptr-1.f90: New test.
* testsuite/libgomp.fortran/map-alloc-ptr-2.f90: New test.
Feng Xue [Tue, 1 Sep 2020 09:17:58 +0000 (17:17 +0800)]
tree-optimization/94234 - Fold plusminus_mult expr with multi-use operands
2020-09-03 Feng Xue <fxue@os.amperecomputing.com>
gcc/
PR tree-optimization/94234
* genmatch.c (dt_simplify::gen_1): Emit check on final simplification
result when "!" is specified on toplevel output expr.
* match.pd ((A * C) +- (B * C) -> (A +- B) * C): Allow folding on expr
with multi-use operands if final result is a simple gimple value.
gcc/testsuite/
PR tree-optimization/94234
* gcc.dg/pr94234-2.c: New test.
GCC Administrator [Tue, 15 Sep 2020 00:16:37 +0000 (00:16 +0000)]
Daily bump.
Sergei Trofimovich [Fri, 11 Sep 2020 14:31:35 +0000 (15:31 +0100)]
doc: fix spelling of -fprofile-reproducibility
gcc/ChangeLog:
* doc/invoke.texi: fix '-fprofile-reproducibility' option
spelling in manual.
Ian Lance Taylor [Mon, 14 Sep 2020 21:01:56 +0000 (14:01 -0700)]
libbacktrace: support MiniDebugInfo
libbacktrace/ChangeLog:
PR libbacktrace/93608
Add support for MiniDebugInfo.
* elf.c (struct elf_view): Define. Replace most uses of
backtrace_view with elf_view.
(elf_get_view): New static functions. Replace most calls of
backtrace_get_view with elf_get_view.
(elf_release_view): New static functions. Replace most calls of
backtrace_release_view with elf_release_view.
(elf_uncompress_failed): Rename from elf_zlib_failed. Change all
callers.
(LZMA_STATES, LZMA_POS_STATES, LZMA_DIST_STATES): Define.
(LZMA_DIST_SLOTS, LZMA_DIST_MODEL_START): Define.
(LZMA_DIST_MODEL_END, LZMA_FULL_DISTANCES): Define.
(LZMA_ALIGN_SIZE, LZMA_LEN_LOW_SYMBOLS): Define.
(LZMA_LEN_MID_SYMBOLS, LZMA_LEN_HIGH_SYMBOLS): Define.
(LZMA_LITERAL_CODERS_MAX, LZMA_LITERAL_CODER_SIZE): Define.
(LZMA_PROB_IS_MATCH_LEN, LZMA_PROB_IS_REP_LEN): Define.
(LZMA_PROB_IS_REP0_LEN, LZMA_PROB_IS_REP1_LEN): Define.
(LZMA_PROB_IS_REP2_LEN, LZMA_PROB_IS_REP0_LONG_LEN): Define.
(LZMA_PROB_DIST_SLOT_LEN, LZMA_PROB_DIST_SPECIAL_LEN): Define.
(LZMA_PROB_DIST_ALIGN_LEN): Define.
(LZMA_PROB_MATCH_LEN_CHOICE_LEN): Define.
(LZMA_PROB_MATCH_LEN_CHOICE2_LEN): Define.
(LZMA_PROB_MATCH_LEN_LOW_LEN): Define.
(LZMA_PROB_MATCH_LEN_MID_LEN): Define.
(LZMA_PROB_MATCH_LEN_HIGH_LEN): Define.
(LZMA_PROB_REP_LEN_CHOICE_LEN): Define.
(LZMA_PROB_REP_LEN_CHOICE2_LEN): Define.
(LZMA_PROB_REP_LEN_LOW_LEN): Define.
(LZMA_PROB_REP_LEN_MID_LEN): Define.
(LZMA_PROB_REP_LEN_HIGH_LEN): Define.
(LZMA_PROB_LITERAL_LEN): Define.
(LZMA_PROB_IS_MATCH_OFFSET, LZMA_PROB_IS_REP_OFFSET): Define.
(LZMA_PROB_IS_REP0_OFFSET, LZMA_PROB_IS_REP1_OFFSET): Define.
(LZMA_PROB_IS_REP2_OFFSET): Define.
(LZMA_PROB_IS_REP0_LONG_OFFSET): Define.
(LZMA_PROB_DIST_SLOT_OFFSET): Define.
(LZMA_PROB_DIST_SPECIAL_OFFSET): Define.
(LZMA_PROB_DIST_ALIGN_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_CHOICE_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_CHOICE2_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_LOW_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_MID_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_HIGH_OFFSET): Define.
(LZMA_PROB_REP_LEN_CHOICE_OFFSET): Define.
(LZMA_PROB_REP_LEN_CHOICE2_OFFSET): Define.
(LZMA_PROB_REP_LEN_LOW_OFFSET): Define.
(LZMA_PROB_REP_LEN_MID_OFFSET): Define.
(LZMA_PROB_REP_LEN_HIGH_OFFSET): Define.
(LZMA_PROB_LITERAL_OFFSET): Define.
(LZMA_PROB_TOTAL_COUNT): Define.
(LZMA_IS_MATCH, LZMA_IS_REP, LZMA_IS_REP0): Define.
(LZMA_IS_REP1, LZMA_IS_REP2, LZMA_IS_REP0_LONG): Define.
(LZMA_DIST_SLOT, LZMA_DIST_SPECIAL, LZMA_DIST_ALIGN): Define.
(LZMA_MATCH_LEN_CHOICE, LZMA_MATCH_LEN_CHOICE2): Define.
(LZMA_MATCH_LEN_LOW, LZMA_MATCH_LEN_MID): Define.
(LZMA_MATCH_LEN_HIGH, LZMA_REP_LEN_CHOICE): Define.
(LZMA_REP_LEN_CHOICE2, LZMA_REP_LEN_LOW): Define.
(LZMA_REP_LEN_MID, LZMA_REP_LEN_HIGH, LZMA_LITERAL): Define.
(elf_lzma_varint): New static function.
(elf_lzma_range_normalize): New static function.
(elf_lzma_bit, elf_lzma_integer): New static functions.
(elf_lzma_reverse_integer): New static function.
(elf_lzma_len, elf_uncompress_lzma_block): New static functions.
(elf_uncompress_lzma): New static function.
(backtrace_uncompress_lzma): New function.
(elf_add): Add memory and memory_size parameters. Change all
callers. Look for .gnu_debugdata section, and, if found,
decompress it and use it for symbols and debug info. Permit the
descriptor parameter to be -1.
* internal.h (backtrace_uncompress_lzma): Declare.
* mtest.c: New file.
* xztest.c: New file.
* configure.ac: Check for nm, xz, and comm programs. Check for
liblzma library.
(HAVE_MINIDEBUG): Define.
* Makefile.am (mtest_SOURCES): Define.
(mtest_CFLAGS, mtest_LDADD): Define.
(TESTS): Add mtest_minidebug if HAVE_MINIDEBUG.
(%_minidebug): New pattern rule, if HAVE_MINIDEBUG.
(xztest_SOURCES, xztest_CFLAGS, xztest_LDADD): Define.
(xztest_alloc_SOURCES, xztest_alloc_CFLAGS): Define
(xztest_alloc_LDADD): Define.
(BUILDTESTS): Add mtest, xztest, xztest_alloc.
(CLEANFILES): Add files created by minidebug pattern.
(btest.lo): Correct INCDIR reference.
(mtest.lo, xztest.lo, ztest.lo): New targets.
* configure: Regenerate.
* config.h.in: Regenerate.
* Makefile.in: Regenerate.
Marek Polacek [Mon, 14 Sep 2020 18:49:31 +0000 (14:49 -0400)]
c++: Use VAR_OR_FUNCTION_DECL_P.
gcc/cp/ChangeLog:
* pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
Jose E. Marchesi [Mon, 14 Sep 2020 18:35:22 +0000 (20:35 +0200)]
bpf: use the expected instruction for NOPs
The BPF ISA doesn't have a no-operation instruction, but in practice
the Linux kernel verifier performs some optimizations that rely on
these instructions to be encoded in a particular way. As it turns
out, we were using the "wrong" instruction in GCC.
This patch makes GCC to generate the expected instruction for NOP (a
`ja 0') and also adds a test to make sure this is the case.
Tested in bpf-unknown-none targets.
2020-09-14 Jose E. Marchesi <jose.marchesi@oracle.com>
gcc/
* config/bpf/bpf.md ("nop"): Re-define as `ja 0'.
gcc/testsuite/
* gcc.target/bpf/nop-1.c: New test.
Iain Sandoe [Mon, 14 Sep 2020 18:37:30 +0000 (19:37 +0100)]
Darwin, X86, testsuite: Fix pr87767 tests for Darwin.
The tests assume non-PIC for m32 (which means that they fail on default
PIC targets, like Darwin). There is also a missing space before the
closing '}' on one of the dg-require-effective-target which means that
test fails on machines without avx512f.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512f-broadcast-pr87767-1.c: Make the test
run as non-dynamic for m32 Darwin.
* gcc.target/i386/avx512f-broadcast-pr87767-3.c: Likewise.
* gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/avx512f-broadcast-pr87767-7.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-3.c: Likewise.
* gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
* gcc.target/i386/avx512f-broadcast-pr87767-6.c: Adjust dg-requires
clause.
Nathan Sidwell [Mon, 14 Sep 2020 16:42:29 +0000 (09:42 -0700)]
c++: local externs in templates do not get template head
Now we consistently mark local externs with DECL_LOCAL_DECL_P, we can
teach the template machinery not to give them a TEMPLATE_DECL head,
and the instantiation machinery treat them as the local specialiations
they are. (openmp UDRs also fall into this category, and are dealt
with similarly.)
gcc/cp/
* pt.c (push_template_decl_real): Don't attach a template head to
local externs.
(tsubst_function_decl): Add support for headless local extern
decls.
(tsubst_decl): Add support for headless local extern decls.
David Malcolm [Sun, 13 Sep 2020 23:35:28 +0000 (19:35 -0400)]
analyzer: add -param=analyzer-max-constraints=
On attempting to run the full test suite with -fanalyzer via
make check RUNTESTFLAGS="-v -v --target_board=unix/-fanalyzer"
I saw it get stuck on:
gcc.c-torture/compile/
20001226-1.c
It turns out this was on a debug build, rather than a release build;
but a release build with -fanalyzer took:
real 1m33.689s
user 1m30.239s
sys 0m2.727s
as compared to:
real 0m2.361s
user 0m2.107s
sys 0m0.214s
without -fanalyzer.
This torture test performs 64 * 64 uniqely-coded comparisons between
elements of a pair of arrays until it finds an element that's different,
leading to an accumulation of 4096 constraints along the path where
no difference is found.
"perf" shows most of the time is spent in canonicalizing and copying
constraint_manager instances, presumably as it copies and merges states
with increasingly more complex sets of constraints as it analyzes
further along the "no differences yet" path.
This patch crudely works around this by adding a
-param=analyzer-max-constraints=
limit, defaulting to 20, above which constraints will be silently
dropped. With this -fanalyzer takes:
real 0m6.935s
user 0m6.413s
sys 0m0.396s
on the above case.
gcc/analyzer/ChangeLog:
* analyzer.opt (-param=analyzer-max-constraints=): New param.
* constraint-manager.cc
(constraint_manager::add_constraint_internal): Silently reject
attempts to add constraints when the above limit is reached.
David Malcolm [Fri, 11 Sep 2020 01:23:38 +0000 (21:23 -0400)]
analyzer: fix constraint explosion on many-cased switch [PR96653]
PR analyzer/96653 reports a CPU-time and memory explosion in -fanalyzer
seen in Linux 5.9-rc1:drivers/media/v4l2-core/v4l2-ctrls.c on a switch
statement with many cases.
The issue is some old code in constraint_manager::get_or_add_equiv_class
for ensuring that comparisons between equivalence classes containing
constants work correctly. The old code added constraints for every
pair of ECs containing constants, leading to O(N^2) constraints (for
N constants). Given that get_or_add_equiv_class also involves O(N)
comparisons, this led to at least O(N^3) CPU time, and O(N^2) memory
consumption when handling the "default" case, where N is the number of
other cases in the switch statement.
The state rewrite of r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d
added checking for comparisons between constants, making these explicit
constraints redundant, but failed to remove the code mentioned above.
This patch removes it, fixing the blow-up of constraints in the default
case.
gcc/analyzer/ChangeLog:
PR analyzer/96653
* constraint-manager.cc
(constraint_manager::get_or_add_equiv_class): Don't accumulate
transitive closure of all constraints on constants.
gcc/testsuite/ChangeLog:
PR analyzer/96653
* gcc.dg/analyzer/pr96653.c: New test.
David Malcolm [Mon, 14 Sep 2020 13:05:50 +0000 (09:05 -0400)]
analyzer: add regression test for leak false positive
Downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1878600
describes a false positive from -Wanalyzer-file-leak seen with
gcc 10.2, but which has been fixed in gcc 11.
This patch adds the reproducer as a regression test.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/rhbz1878600.c: New test.
David Malcolm [Sat, 12 Sep 2020 13:28:05 +0000 (09:28 -0400)]
analyzer: fix ICE on setjmp with non-pointer-type [PR97029]
gcc/analyzer/ChangeLog:
PR analyzer/97029
* analyzer.cc (is_setjmp_call_p): Require the initial arg to be a
pointer.
* region-model.cc (region_model::deref_rvalue): Assert that the
svalue is of pointer type.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/pr97029.c: New test.
Eric Botcazou [Mon, 14 Sep 2020 15:24:32 +0000 (17:24 +0200)]
Fix dangling references in thunks at -O0
When a thunk cannot be emitted in assembly directly, expand_thunk
generates regular GIMPLE code but unconditionally forces a tail
call to the target of the thunk. That's theoretically OK because
the thunk essentially forwards its parameters to the target, but
in practice the RTL expander can spill parameters passed by reference
on the stack in assign_parm_setup_reg.
gcc/ChangeLog:
* cgraphunit.c (cgraph_node::expand_thunk): Make sure to set
cfun->tail_call_marked when forcing a tail call.
* function.c (assign_parm_setup_reg): Always use a register to
load a parameter passed by reference if cfun->tail_call_marked.
gcc/testsuite/ChangeLog:
* gnat.dg/thunk1.adb: New test.
* gnat.dg/thunk1_pkg1.ads: New helper.
* gnat.dg/thunk1_pkg2.ads: Likewise.
* gnat.dg/thunk1_pkg2.adb: Likewise.
Pat Haugen [Mon, 14 Sep 2020 14:37:34 +0000 (09:37 -0500)]
Rename mffgpr/mftgpr insn types and remove Power6 references.
The following is mostly a mechanical change to rename the mffgpr/mftgpr
insn types to mtvsr/mfvsr to be more clear. It also removes Power6
references to those insn types since we no longer generate those
instructions.
2020-09-14 Pat Haugen <pthaugen@linux.ibm.com>
gcc/
* config/rs6000/power10.md (power10-mffgpr, power10-mftgpr): Rename to
power10-mtvsr/power10-mfvsr.
* config/rs6000/power6.md (X2F_power6, power6-mftgpr, power6-mffgpr):
Remove.
* config/rs6000/power8.md (power8-mffgpr, power8-mftgpr): Rename to
power8-mtvsr/power8-mfvsr.
* config/rs6000/power9.md (power9-mffgpr, power9-mftgpr): Rename to
power9-mtvsr/power9-mfvsr.
* config/rs6000/rs6000.c (rs6000_adjust_cost): Remove Power6
TYPE_MFFGPR cases.
* config/rs6000/rs6000.md (mffgpr, mftgpr, zero_extendsi<mode>2,
extendsi<mode>2, @signbit<mode>2_dm, lfiwax, lfiwzx, *movsi_internal1,
movsi_from_sf, *movdi_from_sf_zero_ext, *mov<mode>_internal,
movsd_hardfloat, movsf_from_si, *mov<mode>_hardfloat64, p8_mtvsrwz,
p8_mtvsrd_df, p8_mtvsrd_sf, p8_mfvsrd_3_<mode>, *movdi_internal64,
unpack<mode>_dm): Rename mffgpr/mftgpr to mtvsr/mfvsr.
* config/rs6000/vsx.md (vsx_mov<mode>_64bit, vsx_extract_<mode>,
vsx_extract_si, *vsx_extract_<mode>_p8): Likewise.
Jakub Jelinek [Mon, 14 Sep 2020 08:53:50 +0000 (10:53 +0200)]
arm: Fix up gcc.target/arm/lto/pr96939_* FAIL
The following patch on top of the
https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553801.html
patch fixes the gcc.target/arm/lto/pr96939_* test in certain ARM
configurations.
As said in the above mentioned patch, the generic code takes care of
saving/restoring TargetVariables or Target Save options, so this just
arranges for the generic code to save those instead of needing the
arm backend to do it manually.
2020-09-14 Jakub Jelinek <jakub@redhat.com>
* config/arm/arm.opt (x_arm_arch_string, x_arm_cpu_string,
x_arm_tune_string): Remove TargetSave entries.
(march=, mcpu=, mtune=): Add Save keyword.
* config/arm/arm.c (arm_option_save): Remove.
(TARGET_OPTION_SAVE): Don't redefine.
(arm_option_restore): Don't restore x_arm_*_string here.
Andrea Corallo [Mon, 14 Sep 2020 07:01:18 +0000 (09:01 +0200)]
libgccjit: Regenerate documentation for new entry point.
Fix missing doc regeneration that should have been done by
4ecc0061c4 "libgccjit: Add new gcc_jit_global_set_initializer entry
point"
<https://gcc.gnu.org/onlinedocs/jit/internals/index.html#submitting-patches>.
gcc/jit/ChangeLog
2020-09-14 Andrea Corallo <andrea.corallo@arm.com>
* docs/_build/texinfo/libgccjit.texi: Regenerate.
Jakub Jelinek [Mon, 14 Sep 2020 07:04:45 +0000 (09:04 +0200)]
options: Save and restore opts_set for Optimization and Target options
> Seems a latent issue.
> Neither cl_optimization_{save,restore} nor cl_target_option_{save,restore}
> (nor any of the target hooks they call) saves or restores any opts_set
> values, so I think opts_set can be trusted only during option processing (if
> at all), but not later.
> So, short term a fix would be IMHO just stop using opts_set altogether in
> arm_configure_build_target, it doesn't make much sense to me, it should test
> if those strings are non-NULL instead, or at least do that when it is
> invoked from arm_option_restore (e.g. could be done by calling it with
> opts instead of &global_options_set ).
> Longer term, the question is if cl_optimization_{save,restore} and
> cl_target_option_{save,restore} shouldn't be changed not to only
> save/restore the options, but also save the opts_set flags.
> It could be done e.g. by adding a bool array or set of bool members
> to struct cl_optimization and struct cl_target_option , or even more compact
> by using bitmasks, pack each 64 adjacent option flags into a UHWI element
> of an array.
So, I've tried under debugger how it behaves and seems global_options_set
is really an or of whether an option has been ever seen as explicit, either
on the command line or in any of the option pragmas or optimize/target
attributes seen so far, so it isn't something that can be relied on.
The following patch implements the saving/restoring of the opts_set bits
(though only for the options/variables saved by the generic options-save.c
code, for the target specific stuff that isn't handled by the generic code
the opts_set argument is now passed to the hook and the backends can choose
e.g. to use a TargetSave variable to save the flags either individually or
together in some bitmask (or ignore it if they never need opts_set for the
options).
This patch itself doesn't fix the testcase failing on arm, but a follow up
patch will.
2020-09-14 Jakub Jelinek <jakub@redhat.com>
gcc/
* opt-read.awk: Also initialize extra_target_var_types array.
* opth-gen.awk: Emit explicit_mask arrays to struct cl_optimization
and cl_target_option. Adjust cl_optimization_save,
cl_optimization_restore, cl_target_option_save and
cl_target_option_restore declarations.
* optc-save-gen.awk: Add opts_set argument to cl_optimization_save,
cl_optimization_restore, cl_target_option_save and
cl_target_option_restore functions and save or restore opts_set
next to the opts values into or from explicit_mask arrays.
In cl_target_option_eq and cl_optimization_option_eq compare
explicit_mask arrays, in cl_target_option_hash and cl_optimization_hash
hash them and in cl_target_option_stream_out,
cl_target_option_stream_in, cl_optimization_stream_out and
cl_optimization_stream_in stream them.
* tree.h (build_optimization_node, build_target_option_node): Add
opts_set argument.
* tree.c (build_optimization_node): Add opts_set argument, pass it
to cl_optimization_save.
(build_target_option_node): Add opts_set argument, pass it to
cl_target_option_save.
* function.c (invoke_set_current_function_hook): Adjust
cl_optimization_restore caller.
* ipa-inline-transform.c (inline_call): Adjust cl_optimization_restore
and build_optimization_node callers.
* target.def (TARGET_OPTION_SAVE, TARGET_OPTION_RESTORE): Add opts_set
argument.
* target-globals.c (save_target_globals_default_opts): Adjust
cl_optimization_restore callers.
* toplev.c (process_options): Adjust build_optimization_node and
cl_optimization_restore callers.
(target_reinit): Adjust cl_optimization_restore caller.
* tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers):
Adjust build_optimization_node and cl_optimization_restore callers.
* doc/tm.texi: Updated.
* config/aarch64/aarch64.c (aarch64_override_options): Adjust
build_target_option_node caller.
(aarch64_option_save, aarch64_option_restore): Add opts_set argument.
(aarch64_set_current_function): Adjust cl_target_option_restore
caller.
(aarch64_option_valid_attribute_p): Adjust cl_target_option_save,
cl_target_option_restore, cl_optimization_restore,
build_optimization_node and build_target_option_node callers.
* config/aarch64/aarch64-c.c (aarch64_pragma_target_parse): Adjust
cl_target_option_restore and build_target_option_node callers.
* config/arm/arm.c (arm_option_save, arm_option_restore): Add
opts_set argument.
(arm_option_override): Adjust cl_target_option_save,
build_optimization_node and build_target_option_node callers.
(arm_set_current_function): Adjust cl_target_option_restore caller.
(arm_valid_target_attribute_tree): Adjust build_target_option_node
caller.
(add_attribute): Formatting fix.
(arm_valid_target_attribute_p): Adjust cl_optimization_restore,
cl_target_option_restore, arm_valid_target_attribute_tree and
build_optimization_node callers.
* config/arm/arm-c.c (arm_pragma_target_parse): Adjust
cl_target_option_restore callers.
* config/csky/csky.c (csky_option_override): Adjust
build_target_option_node and cl_target_option_save callers.
* config/gcn/gcn.c (gcn_fixup_accel_lto_options): Adjust
build_optimization_node and cl_optimization_restore callers.
* config/i386/i386-builtins.c (get_builtin_code_for_version):
Adjust cl_target_option_save and cl_target_option_restore
callers.
* config/i386/i386-c.c (ix86_pragma_target_parse): Adjust
build_target_option_node and cl_target_option_restore callers.
* config/i386/i386-options.c (ix86_function_specific_save,
ix86_function_specific_restore): Add opts_set arguments.
(ix86_valid_target_attribute_tree): Adjust build_target_option_node
caller.
(ix86_valid_target_attribute_p): Adjust build_optimization_node,
cl_optimization_restore, cl_target_option_restore,
ix86_valid_target_attribute_tree and build_optimization_node callers.
(ix86_option_override_internal): Adjust build_target_option_node
caller.
(ix86_reset_previous_fndecl, ix86_set_current_function): Adjust
cl_target_option_restore callers.
* config/i386/i386-options.h (ix86_function_specific_save,
ix86_function_specific_restore): Add opts_set argument.
* config/nios2/nios2.c (nios2_option_override): Adjust
build_target_option_node caller.
(nios2_option_save, nios2_option_restore): Add opts_set argument.
(nios2_valid_target_attribute_tree): Adjust build_target_option_node
caller.
(nios2_valid_target_attribute_p): Adjust build_optimization_node,
cl_optimization_restore, cl_target_option_save and
cl_target_option_restore callers.
(nios2_set_current_function, nios2_pragma_target_parse): Adjust
cl_target_option_restore callers.
* config/pru/pru.c (pru_option_override): Adjust
build_target_option_node caller.
(pru_set_current_function): Adjust cl_target_option_restore
callers.
* config/rs6000/rs6000.c (rs6000_debug_reg_global): Adjust
cl_target_option_save caller.
(rs6000_option_override_internal): Adjust build_target_option_node
caller.
(rs6000_valid_attribute_p): Adjust build_optimization_node,
cl_optimization_restore, cl_target_option_save,
cl_target_option_restore and build_target_option_node callers.
(rs6000_pragma_target_parse): Adjust cl_target_option_restore and
build_target_option_node callers.
(rs6000_activate_target_options): Adjust cl_target_option_restore
callers.
(rs6000_function_specific_save, rs6000_function_specific_restore):
Add opts_set argument.
* config/s390/s390.c (s390_function_specific_restore): Likewise.
(s390_option_override_internal): Adjust s390_function_specific_restore
caller.
(s390_option_override, s390_valid_target_attribute_tree): Adjust
build_target_option_node caller.
(s390_valid_target_attribute_p): Adjust build_optimization_node,
cl_optimization_restore and cl_target_option_restore callers.
(s390_activate_target_options): Adjust cl_target_option_restore
caller.
* config/s390/s390-c.c (s390_cpu_cpp_builtins): Adjust
cl_target_option_save caller.
(s390_pragma_target_parse): Adjust build_target_option_node and
cl_target_option_restore callers.
gcc/c-family/
* c-attribs.c (handle_optimize_attribute): Adjust
cl_optimization_save, cl_optimization_restore and
build_optimization_node callers.
* c-pragma.c (handle_pragma_optimize): Adjust
build_optimization_node caller.
(handle_pragma_push_options): Adjust
build_optimization_node and build_target_option_node callers.
(handle_pragma_pop_options, handle_pragma_reset_options):
Adjust cl_optimization_restore callers.
gcc/go/
* go-gcc.cc (Gcc_backend::function): Adjust
cl_optimization_save, cl_optimization_restore and
build_optimization_node callers.
gcc/ada/
* gcc-interface/trans.c (gigi): Adjust build_optimization_node
caller.
Tom de Vries [Sat, 5 Sep 2020 10:45:07 +0000 (12:45 +0200)]
[libgomp, nvptx] Add __sync_compare_and_swap_16
As reported here
( https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553070.html ),
when running test-case libgomp.c-c++-common/reduction-16.c for powerpc host
with nvptx accelerator, we run into:
...
unresolved symbol __sync_val_compare_and_swap_16
...
I can reproduce the problem on x86_64 with a trigger patch that:
- initializes ix86_isa_flags2 to TARGET_ISA2_CX16
- enables define_expand "atomic_load<mode>" in gcc/config/i386/sync.md
for TImode
The problem is that omp-expand.c generates atomic builtin calls based on
checks whether those are supported on the host, which forces the target to
support these, even though those checks fail for the accelerator target.
Fix this by:
- adding a __sync_val_compare_and_swap_16 in libgomp for nvptx,
which falls back onto libatomic's __atomic_compare_and_swap_16
- adding -foffload=-latomic in the test-case
Tested libgomp on x86_64-linux with nvptx accelerator.
Tested libgomp with trigger patch on x86_64-linux with nvptx accelerator.
libgomp/ChangeLog:
* config/nvptx/atomic.c: New file. Add
__sync_val_compare_and_swap_16.
* testsuite/libgomp.c-c++-common/reduction-16.c: Add -latomic for
target offload_target_nvptx.
GCC Administrator [Mon, 14 Sep 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.
John David Anglin [Sun, 13 Sep 2020 18:47:59 +0000 (18:47 +0000)]
Improve costs for DImode shifts of interger constants.
2020-09-13 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]:
Provide accurate costs for DImode shifts of integer constants.
GCC Administrator [Sun, 13 Sep 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Iain Buclaw [Sat, 12 Sep 2020 14:48:58 +0000 (16:48 +0200)]
d: Return promoted types in d_type_promotes_to when linkage is not D
This enables warnings to be shown when a bad type is passed to va_arg
inside an extern(C) or extern(C++) function.
gcc/d/ChangeLog:
PR d/97002
* d-codegen.cc (d_build_call): Set input_location on CALL_EXPR.
* d-lang.cc: Include function.h.
(d_type_promotes_to): Do default conversions for C and C++ functions.
* intrinsics.cc (expand_intrinsic_vaarg): Use build1_loc to build
VA_ARG_EXPR.
gcc/testsuite/ChangeLog:
PR d/97002
* gdc.dg/pr97002.d: New test.
Iain Buclaw [Sat, 12 Sep 2020 14:26:58 +0000 (16:26 +0200)]
d: Build TYPE_DECLs for non-numeric enum types.
This is done so that the DWARF pass will emit a DW_TAG_typedef where the
member type of an enum can't be represented in an ENUMERAL_TYPE.
gcc/d/ChangeLog:
* d-builtins.cc (d_build_d_type_nodes): Call build_ctype() on all
basic front-end types.
* decl.cc (DeclVisitor::visit (EnumDeclaration *)): Always add decl to
current binding level.
(build_type_decl): Build TYPE_DECL as a typedef if not for an enum or
record type.
* types.cc (TypeVisitor::visit (TypeEnum *)): Set underlying type for
ENUMERAL_TYPEs. Build TYPE_DECL for non-numeric enums.
John David Anglin [Sat, 12 Sep 2020 14:38:51 +0000 (14:38 +0000)]
Add new shrpsi instruction variands to gcc/config/pa/pa.md.
2020-09-12 Roger Sayle <roger@nextmovesoftware.com>
John David Anglin <danglin@gcc.gnu.org>
gcc/ChangeLog
* config/pa/pa.md (shrpsi4_1, shrpsi4_2): New define_insns split
out from previous shrpsi4 providing two commutitive variants using
plus_xor_ior_operator as a predicate.
(shrpdi4_1, shrpdi4_2, shrpdi_3, shrpdi_4): Likewise DImode versions
where _1 and _2 take register shifts, and _3 and _4 for integers.
(rotlsi3_internal): Name this anonymous instruction.
(rotrdi3): New DImode insn copied from rotrsi3.
(rotldi3): New DImode expander copied from rotlsi3.
(rotldi4_internal): New DImode insn copied from rotsi3_internal.
Eric Botcazou [Sat, 12 Sep 2020 10:59:09 +0000 (12:59 +0200)]
Add preliminary support for 128-bit integer types
This is only the gigi part, in preparation for the bulk of the
implementation.
gcc/ada/ChangeLog:
* fe.h: Fix pilot error in previous change.
* gcc-interface/gigi.h (enum standard_datatypes): Add ADT_mulv128_decl.
(mulv128_decl): New macro.
(get_target_long_long_long_size): Declare.
* gcc-interface/decl.c (gnat_to_gnu_entity): Use a maximum size of
128 bits for discrete types if Enable_128bit_Types is true.
* gcc-interface/targtyps.c: Include target.h.
(get_target_long_long_long_size): New function.
* gcc-interface/trans.c (gigi): Initialize mulv128_decl if need be.
(build_binary_op_trapv): Call it for 128-bit multiplication.
* gcc-interface/utils.c (make_type_from_size): Enforce a maximum
size of 128 bits if Enable_128bit_Types is true.
Eric Botcazou [Sat, 12 Sep 2020 10:47:39 +0000 (12:47 +0200)]
Fix small inconsistency in new predicate
This can result on the mainline in a segfault when an object declared
at library level is used in the declaration of another, local object.
gcc/ada/ChangeLog:
* gcc-interface/trans.c (lvalue_for_aggr_p) <N_Object_Declaration>:
Return false unconditionally.
Eric Botcazou [Sat, 12 Sep 2020 10:42:06 +0000 (12:42 +0200)]
Minor tweak to line debug info
This prevents the SLOC of the expression for a tag from being present
in the line debug info every time it is referenced for coverage purposes.
gcc/ada/ChangeLog:
* gcc-interface/trans.c (gnat_to_gnu) <N_Object_Declaration>: Clear
the SLOC of the expression of a tag.
Eric Botcazou [Sat, 12 Sep 2020 10:36:30 +0000 (12:36 +0200)]
Accept absolute address clause for array of UNC nominal subtype
This changes the compiler to accept again absolute address clause for
aliased array of unconstrained nominal subtype, instead of erroring
out in this case.
gcc/ada/ChangeLog:
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Only give
a warning for the overlay of an aliased array with an unconstrained
nominal subtype if the address is absolute.
GCC Administrator [Sat, 12 Sep 2020 00:16:30 +0000 (00:16 +0000)]
Daily bump.