pr95149 is a false positive static analysis checker. But it
encouranged me to fix raw string lexing, which does contain a
complicated macro and pointers to local variables. The
reimplementation does away with that macro. Part of the complication
is we need to undo some of the fresh line processing -- trigraph notes
and escaped line continuations. But the undone characters need to go
through the raw string processing, as they can legitimately be part of
the prefix marker. however, in this reformulation we only process one
line marker at a time[*], so there's a limited number of undone
characters. We can arrange the buffering to make sure we don't split
such an append sequence, and then simply take the characters from the
append buffer.
The prefix scanner had a switch statement, which I discovered was not
optimized as well as an if of a bunch of explicit comparisons (pr
95208 filed).
Finally I adjusted the failure mode. When we get a bad prefix, we lex
up until the next '"', thus often swallowing the whole raw string.
Previously we'd bail and then the lexer would usually generate stupid
tokens, particularly when meeting the ending '"'.
libcpp/
* lex.c (struct lit_accum): New.
(bufring_append): Replace by lit_accum::append.
(lex_raw_string): Reimplement, using fragments of the old version.
(lex_string): Adjust lex_raw_string call.
gcc/testsuite/
* c-c++-common/raw-string-14.c: Adjust errors.
* c-c++-common/raw-string-16.c: Likewise.
* c-c++-common/raw-string-5.c: Likewise.
This adjusts the testcase for the introduced vector promotion/demotion
support.
2020-05-19 Richard Biener <rguenther@suse.de>
* gcc.target/i386/pr92645-4.c: Adjust expected pattern.
This was another latent case of us losing an EOF token, but succeeding
anyway. Since my patch to make us pay more attention to EOFs it came
to light. We also need to keep the EOF if we fall off the end of the
main file. Forced includes look like regular nested includes at this
point.
PR preprocessor/95182
libcpp/
* macro.c (collect_args): Preserve EOFif we fell out of the main
file.
(cpp_get_token_1): Reformat a couple of short lines.
This patch adds very basic allocator support (omp_{init,destroy}_allocator,
omp_{alloc,free}, omp_[sg]et_default_allocator).
The plan is to use memkind (likely dlopened) for high bandwidth memory, but
that part isn't implemented yet, probably mlock for pinned memory and see
what other options there are for other kinds of memory.
For offloading targets, we need to decide if we want to support the
dynamic allocators (and on which targets), or if e.g. all we do is at compile
time replace omp_alloc/omp_free calls with constexpr predefined allocators
with something special.
And allocate directive and allocator/uses_allocators clauses are future work
too.
2020-05-19 Jakub Jelinek <jakub@redhat.com>
* allocator.c: New file.
BPF considers that every call to a function allocates a fresh set of
registers that are available to the callee, of which the first five
may have bee initialized with the function arguments. This is
implemented by both interpreter and JIT in the Linux kernel.
This is enforced by the kernel BPF verifier, which will reject any
code in which non-initialized registers are accessed before being
written. Consequently, the spill instructions generated in function
prologue were causing the verifier to reject our compiled programs.
This patch makes GCC to not save/restore callee-saved registers in
function prologue/epilogue, unless xBPF mode is enabled.
2020-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
gcc/
* config/bpf/bpf.c (bpf_compute_frame_layout): Include space for
callee saved registers only in xBPF.
(bpf_expand_prologue): Save callee saved registers only in xBPF.
(bpf_expand_epilogue): Likewise for restoring.
* doc/invoke.texi (eBPF Options): Document this is activated by
-mxbpf.
gcc/testsuite/
* gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test.
* gcc.target/bpf/xbpf-callee-saved-regs-2.c: Likewise.
This patch adds support for a new option -mxbpf. This tells GCC to
generate code for an expanded version of BPF that relaxes some of the
restrictions imposed by BPF.
2020-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
gcc/
* config/bpf/bpf.opt (mxbpf): New option.
* doc/invoke.texi (Option Summary): Add -mxbpf.
(eBPF Options): Document -mxbbpf.
contrib/ChangeLog:
2020-05-15 Martin Liska <mliska@suse.cz>
* gcc-git-customization.sh: Add
alias.gcc-mklog new hook.
* mklog.py: New file.
* test_mklog.py: New file.
This patch adds very basic allocator support (omp_{init,destroy}_allocator,
omp_{alloc,free}, omp_[sg]et_default_allocator).
The plan is to use memkind (likely dlopened) for high bandwidth memory, but
that part isn't implemented yet, probably mlock for pinned memory and see
what other options there are for other kinds of memory.
For offloading targets, we need to decide if we want to support the
dynamic allocators (and on which targets), or if e.g. all we do is at compile
time replace omp_alloc/omp_free calls with constexpr predefined allocators
with something special.
And allocate directive and allocator/uses_allocators clauses are future work
too.
2020-05-19 Jakub Jelinek <jakub@redhat.com>
* omp.h.in (omp_uintptr_t): New typedef.
(__GOMP_UINTPTR_T_ENUM): Define.
(omp_memspace_handle_t, omp_allocator_handle_t, omp_alloctrait_key_t,
omp_alloctrait_value_t, omp_alloctrait_t): New typedefs.
(__GOMP_DEFAULT_NULL_ALLOCATOR): Define.
(omp_init_allocator, omp_destroy_allocator, omp_set_default_allocator,
omp_get_default_allocator, omp_alloc, omp_free): Declare.
* libgomp.h (struct gomp_team_state): Add def_allocator field.
(gomp_def_allocator): Declare.
* libgomp.map (OMP_5.0.1): Export omp_set_default_allocator,
omp_get_default_allocator, omp_init_allocator, omp_destroy_allocator,
omp_alloc and omp_free.
* team.c (gomp_team_start): Copy over ts.def_allocator.
* env.c (gomp_def_allocator): New variable.
(parse_wait_policy): Adjust function comment.
(parse_allocator): New function.
(handle_omp_display_env): Print OMP_ALLOCATOR.
(initialize_env): Call parse_allocator.
* Makefile.am (libgomp_la_SOURCES): Add allocator.c.
* allocator.c: New file.
* icv.c (omp_set_default_allocator, omp_get_default_allocator): New
functions.
* testsuite/libgomp.c-c++-common/alloc-1.c: New test.
* testsuite/libgomp.c-c++-common/alloc-2.c: New test.
* testsuite/libgomp.c-c++-common/alloc-3.c: New test.
* Makefile.in: Regenerated.
- Implied rule are introduced into latest RISC-V ISA spec.
- Only implemented D implied F-extension. Zicsr and Zifence are not
implement yet, so the rule not included in this patch.
- Pass preprocessed arch string to arch.
- Verified with binutils 2.30 and 2.34.
gcc/ChangeLog
* common/config/riscv/riscv-common.c (riscv_implied_info_t): New.
(riscv_implied_info): New.
(riscv_subset_list): Add handle_implied_ext.
(riscv_subset_list::to_string): New parameter version_p to
control output format.
(riscv_subset_list::handle_implied_ext): New.
(riscv_subset_list::parse_std_ext): Call handle_implied_ext.
(riscv_arch_str): New parameter version_p to control output format.
(riscv_expand_arch): New.
* config/riscv/riscv-protos.h (riscv_arch_str): New parameter,
version_p.
* config/riscv/riscv.h (riscv_expand_arch): New,
(EXTRA_SPEC_FUNCTIONS): Define.
(ASM_SPEC): Transform -march= via riscv_expand_arch.
gcc/testsuite/ChangeLog
* gcc.target/riscv/arch-6.c: New.
* gcc.target/riscv/attribute-11.c: New.
* gcc.target/riscv/attribute-12.c: New.
- The arch string rule has changed in latest spec, it introduced new
multi-letter extension prefix with 'h' and 'z', and drop `sx`. also
adjust parsing order for 's' and 'x'.
gcc/ChangeLog
* riscv-common.c (parse_sv_or_non_std_ext): Rename to
parse_multiletter_ext.
(parse_multiletter_ext): Add parsing `h` and `z`, drop `sx`,
adjust parsing order for 's' and 'x'.
gcc/testsuite/ChangeLog
* gcc.target/riscv/arch-3.c: Adjust option.
* gcc.target/riscv/arch-5.c: New.
* gcc.target/riscv/attribute-9.c: Adjust option and test
condition.
2020-05-19 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (_slp_tree::vectype): Add field.
(SLP_TREE_VECTYPE): New.
* tree-vect-slp.c (vect_create_new_slp_node): Initialize
SLP_TREE_VECTYPE.
(vect_create_new_slp_node): Likewise.
(vect_prologue_cost_for_slp): Move here from tree-vect-stmts.c
and simplify.
(vect_slp_analyze_node_operations): Walk nodes children for
invariant costing.
(vect_get_constant_vectors): Use local scope op variable.
* tree-vect-stmts.c (vect_prologue_cost_for_slp_op): Remove here.
(vect_model_simple_cost): Adjust.
(vect_model_store_cost): Likewise.
(vectorizable_store): Likewise.
It looks like hash table sanitization is now safe to enable for the
decl_specializations and type_specializations tables, probably ever
since PR94454 was fixed.
gcc/cp/ChangeLog:
PR c++/87847
* pt.c (init_template_processing): Enable sanitization for
decl_specializations and type_specializations.
In fn_type_unifcation, we are passing NULL_TREE as the 'in_decl'
parameter to coerce_template_parms, and this is causing template
type/value mismatch error messages to get suppressed regardless of the
value of 'complain'.
This means that when substitution into a function template fails due to
a type/value mismatch between a template parameter and the provided
template argument, we just say "template argument deduction/substitution
failed:" without a followup explanation of the failure.
Fix this by passing 'fn' instead of NULL_TREE to coerce_template_parms.
gcc/cp/ChangeLog:
PR c++/66439
* pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
the 'in_decl' parameter to coerce_template_parms.
gcc/testsuite/ChangeLog:
PR c++/66439
* g++.dg/cpp2a/concepts-ts4.C: Expect a "type/value mismatch"
diagnostic.
* g++.dg/cpp2a/concepts-ts6.C: Likewise.
* g++.dg/template/error56.C: Likewise.
* g++.dg/template/error59.C: New test.
libstdc++-v3/ChangeLog:
PR c++/66439
* testsuite/20_util/pair/astuple/get_neg.cc: Prune "type/value
mismatch" messages.
* testsuite/20_util/tuple/element_access/get_neg.cc: Likewise.
Since r10-6527 fold_for_warn calls maybe_constant_value, which means it
can fold more than it previously could. In this testcase it means that
cp_build_binary_op/RSHIFT_EXPR set short_shift because now we were able
to fold op1 to an INTEGER_CST. But then when actually performing the
shortening we crashed because cp_fold_rvalue wasn't able to fold as much
as f_f_w and so tree_int_cst_sgn crashed on a NOP_EXPR. Therefore the
calls should probably match.
PR c++/94955
* typeck.c (cp_build_binary_op): Use fold_for_warn instead of
cp_fold_rvalue.
* g++.dg/cpp0x/constexpr-shift2.C: New test.
An ICE arises here because we call cp_get_callee_fndecl_nofold in a
template, and we've got a CALL_EXPR whose CALL_EXPR_FN is a BASELINK.
This tickles the INDIRECT_TYPE_P assert in cp_get_fndecl_from_callee.
Fixed by turning the assert into a condition and returning NULL_TREE
in that case.
PR c++/94937
* cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
type is not INDIRECT_TYPE_P.
* decl.c (omp_declare_variant_finalize_one): Call
cp_get_callee_fndecl_nofold instead of looking for the function decl
manually.
* g++.dg/cpp1z/constexpr-if34.C: New test.
* g++.dg/cpp2a/is-constant-evaluated10.C: New test.
Adjust test to avoid failures in ILP32 mode.
gcc/testsuite/ChangeLog:
PR middle-end/92815
* gcc.dg/builtin-object-size-20.c: Adjust to avoid failures in
ILP32 mode.
Until 92104 is fixed, let's sorry rather than crash.
PR c++/90915
* parser.c (cp_parser_has_attribute_expression): Sorry on a
type-dependent argument.
* g++.dg/ext/builtin-has-attribute.C: New test.
gcc/testsuite/ChangeLog:
PR middle-end/94940
* gcc.dg/Warray-bounds-61.c: New test.
gcc/ChangeLog:
PR middle-end/94940
* tree-vrp.c (vrp_prop::check_mem_ref): Remove unreachable code.
* tree.c (component_ref_size): Correct the handling or array members
of unions.
Drop a pointless test.
Rename a local variable.
This patch resolves DR 1512 (and, by turn, DR 583). This entails:
1) Relational pointer comparisons against null pointer constants have
been made ill-formed:
void f(char *p) {
if (p > 0)
// ...
}
was always invalid in C but was -- accidentally -- allowed in C++.
2) This was ill-formed:
bool foo(int** x, const int** y) {
return x < y;
}
because 'int**' couldn't be converted to 'const int**'. This was
fixed by re-defining a generic composite pointer type. The composite
type of these two pointers will be 'const int *const *', to which
both pointers can be converted.
3) The overload descriptions for built-in operators were adjusted,
because objects of type std::nullptr_t cannot be used with relational
operators any more.
I fixed 1) by adjusting cp_build_binary_op; we already had a warning
for it so made it a hard error now.
Then 2) required tweaking composite_pointer_type_r. [expr.type] defines
the composite pointer type by using the "cv-combined type." We didn't
implement the [conv.qual]/3.3 part; previously the composite type of
'int**' and 'const int**' was 'const int**', so this didn't compile:
void f(const int **p, int **q) {
true ? p : q;
}
I wrote a more extensive test for this which uses decltype and some
template magic to check the composite type, see composite-ptr-type.C.
We still don't handle everything that [expr.type] requires us to,
but it's pretty close.
And finally 3) was handled in add_builtin_candidate. Turned out we
weren't creating built-in operator candidates when the type was
std::nullptr_t at all. We should, for == and !=. Tested in builtin4.C.
In passing, I'm fixing some of the comments too.
DR 1512
PR c++/87699
* call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
operator functions when type is std::nullptr_t for ==/!=.
* typeck.c (composite_pointer_type_r): Add bool a * parameter. Use it
to maybe add "const" to the pointer type.
(composite_pointer_type): Update the call to composite_pointer_type_r.
(cp_build_binary_op): Turn two warning_at into error_at. Print the
types.
* g++.dg/cpp0x/constexpr-array-ptr10.C: Change dg-warning to dg-error
and adjust the expected messages in dg-error.
* g++.dg/expr/composite-ptr-type.C: New test.
* g++.dg/expr/ptr-comp1.C: New test.
* g++.dg/expr/ptr-comp2.C: New test.
* g++.dg/expr/ptr-comp3.C: New test.
* g++.dg/overload/builtin4.C: New test.
* g++.dg/warn/Wextra-3.C: Change dg-warning to dg-error.
In a couple of places in build_over_call we were calling
cp_stabilize_reference but only using the result once, so it isn't needed.
gcc/cp/ChangeLog
2020-05-18 Jason Merrill <jason@redhat.com>
* call.c (build_over_call): Remove unnecessary
cp_stabilize_reference.
This feels extremely obscure but at least it's an opportunity to fix the
comments. P0002R1 removed deprecated operator++(bool) in C++17 so let's
avoid adding a builtin overload candidate for ++ when the type is bool.
* call.c (add_builtin_candidate): Don't create a builtin overload
candidate for ++ when type is bool in C++17.
* g++.dg/overload/builtin5.C: New test.
Current cfns.h includes register-qualified variables and that wouldn't
play well when bootstrapping with GCC that uses the C++17 dialect,
because 'register' was removed in C++17. Regenerating it using the
command specified in cfns.h luckily cleaned this up.
* cfns.h: Regenerated.
We're getting an error when running this test on PowerPC VxWorks 7,
due to an unexpected warning:
| Excess errors:
| cc1: warning: '-mvsx' and '-mno-altivec' are incompatible
The warning comes from a combination of factors:
- The test itself uses -mvsx explicitly via the following directive:
// { dg-options "-O1 -mvsx" }
- Our toolchain was configured so as to make -mno-altivec
the default;
- These two options are mutually exclusive.
This commit adds a powerpc_vsx_ok dg-require-effective-target directive
to that test, and thus making it UNSUPPORTED instead.
Tested on PowerPC VxWorks 7. Also tested on PowerPC ELF as well,
a platform where we do not make -mno-altivec the default, to verify
that the test continues to run as usual in that case.
gcc/testsuite/
* gcc.target/powerpc/pr71763.c: Require powerpc_vsx_ok.
There was general agreement last November that we would move to allowing
C++11 features to be used in GCC 11; this patch implements that direction.
ChangeLog
2020-05-18 Jason Merrill <jason@redhat.com>
* configure.ac: Update bootstrap dialect to -std=c++11.
config/ChangeLog
2020-05-18 Jason Merrill <jason@redhat.com>
* ax_cxx_compile_stdcxx.m4: Import from autoconf archive with
an adjustment to try the default mode.
gcc/ChangeLog
2020-05-18 Jason Merrill <jason@redhat.com>
* aclocal.m4: Add ax_cxx_compile_stdcxx.m4.
* configure.ac: Use AX_CXX_COMPILE_STDCXX(11).
Partially revert the fix for PR93499. Replace by checks for valid
expressions in the declaration of array shape and PDT KIND and LEN
expressions at a later stage.
gcc/fortran/
2020-05-18 Harald Anlauf <anlauf@gmx.de>
PR fortran/95053
* arith.c (gfc_divide): Revert hunk introduced by patch for
PR93499.
* decl.c (variable_decl): Generate error for array shape not being
an INTEGER constant.
(gfc_get_pdt_instance): Generate error if KIND or LEN expressions
in declaration of a PDT instance do not simplify to INTEGER
constants.
gcc/testsuite/
2020-05-18 Harald Anlauf <anlauf@gmx.de>
PR fortran/95053
* gfortran.dg/dec_structure_23.f90: Adjust to new error messages.
* gfortran.dg/pr93499.f90: Adjust to new error messages.
* gfortran.dg/pr95053_2.f90: New test.
* gfortran.dg/pr95053_3.f90: New test.
While bootstrapping GCC on S/390 with --enable-checking=release several
warnings about use of uninitialized variables bitpos, bitregion_start, and
bitregion_end of function pass_store_merging::process_store are raised.
According to PR94952 these seem to be false positives which are silenced by
initialising the mentioned variables.
Bootstrapped on S/390. Ok for master and releases/gcc-10 assuming that
regtest succeeds (still running but I don't see a reason why it
should fail)?
gcc/ChangeLog:
2020-05-18 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
PR tree-optimization/94952
* gimple-ssa-store-merging.c (pass_store_merging::process_store):
Initialize variables bitpos, bitregion_start, and bitregion_end in
order to silence warnings about use of uninitialized variables.
gcc/ChangeLog
2020-04-30 Carl Love <cel@us.ibm.com>
PR target/94833
* config/rs6000/vsx.md (define_expand): Fix instruction generation for
first_match_index_<mode>.
* testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c (main): Add
additional test cases with zero vector elements.
This fixes a bug in the arm backend where GCC generates invalid LDRD
instructions. The LDRD instruction requires the first transfer register to be
even, but GCC attempts to use odd registers here. For example, with the
following C code:
struct c {
double a;
} __attribute((aligned)) __attribute((packed));
struct c d;
struct c f(struct c);
void e() { f(d); }
The struct d is passed in registers r1 and r2 to the function f, and GCC
attempted to do this with a LDRD instruction when compiling with -march=armv7-a
on a soft float toolchain.
The fix is analogous to the corresponding one for STRD in the same function:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=52057dc4ac5295caebf83147f688d769c93cbc8d
2020-05-18 Alex Coplan <alex.coplan@arm.com>
gcc/:
* config/arm/arm.c (output_move_double): Fix codegen when loading into
a register pair with an odd base register.
gcc/testsuite/:
* gcc.c-torture/compile/packed-aligned-1.c: New test.
* gcc.c-torture/execute/packed-aligned.c: New test.
gcc/ChangeLog:
2020-05-18 Uroš Bizjak <ubizjak@gmail.com>
* config/i386/i386-expand.c (ix86_expand_fp_absneg_operator):
Do not emit FLAGS_REG clobber for TFmode.
* config/i386/i386.md (*<code>tf2_1): Rewrite as
define_insn_and_split. Mark operands 1 and 2 commutative.
(*nabstf2_1): Ditto.
(absneg SSE splitter): Use MODEF mode iterator instead of SSEMODEF.
Do not swap memory operands. Simplify RTX generation.
(neg abs SSE splitter): Ditto.
* config/i386/sse.md (*<code><mode>2): Mark operands 1 and 2
commutative. Do not swap operands. Simplify RTX generation.
(*nabs<mode>2): Ditto.
This adjusts the way we compute the stmt insert location for
invariants in BB vectorization context to deal with eventually
sharing invariant SLP nodes for multiple uses. We can no longer
use a single use stmt location then but there's a simple way out.
2020-05-18 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_slp_bb): Start after labels.
(vect_get_constant_vectors): Really place init stmt after scalar defs.
* tree-vect-stmts.c (vect_init_vector_1): Insert before
region begin.
Add cpu model numbers for Intel Airmont, Tremont, Comet Lake, Ice Lake
and Tiger Lake processor families.
* config/i386/driver-i386.c (host_detect_local_cpu): Support
Intel Airmont, Tremont, Comet Lake, Ice Lake and Tiger Lake
processor families.
This fixes always-inlining across -fnon-call-exception boundaries
for conditions which we do not allow to throw.
2020-05-18 Richard Biener <rguenther@suse.de>
PR middle-end/95171
* tree-inline.c (remap_gimple_stmt): Split out trapping compares
when inlining into a non-call EH function.
* gcc.dg/pr95171.c: New testcase.