Eric Botcazou [Fri, 11 Oct 2019 08:57:37 +0000 (08:57 +0000)]
decl.c (annotate_value): Really test the sign of the value when deciding to build a NEGATE_EXPR.
* gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the
sign of the value when deciding to build a NEGATE_EXPR.
<PLUS_EXPR>: Remove redundant line.
<BIT_AND_EXPR>: Do the negation here.
Oleg Endo [Thu, 10 Oct 2019 15:24:05 +0000 (15:24 +0000)]
backport: re PR target/88630 (Incorrect float negating together with convertion to int on ST-40)
gcc/
Backport from mainline
2019-10-10 Oleg Endo <olegendo@gcc.gnu.org>
PR target/88630
* config/sh/sh.h (TARGET_FPU_SH4_300): New macro.
* config/sh/sh.c (sh_option_override): Enable fsca and fsrra insns
also for TARGET_FPU_SH4_300.
(sh_emit_mode_set): Check for TARGET_FPU_SH4_300 instead of
TARGET_SH4_300.
* config/sh/sh.md (toggle_pr): Add TARGET_FPU_SH4_300 condition.
(negsf2): Expand to either negsf2_fpscr or negsf2_no_fpscr.
(*negsf2_i): Split into ...
(negsf2_fpscr, negsf2_no_fpscr): ... these new patterns.
(abssf2): Expand to either abssf2_fpsc or abssf2_no_fpsc.
(**abssf2_i): Split into ...
(abssf2_fpscr, abssf2_no_fpscr): ... these new patterns.
(negdf2): Expand to either negdf2_fpscr or negdf2_no_fpscr.
(*negdf2_i): Split into ...
(negdf2_fpscr, negdf2_no_fpscr): ... these new patterns.
(absdf2): Expand to either absdf2_fpscr or absdf2_no_fpsc.
(**abssf2_i): Split into ...
(absdf2_fpscr, absdf2_no_fpscr): ... these new patterns.
Steven G. Kargl [Sat, 5 Oct 2019 04:05:05 +0000 (04:05 +0000)]
re PR fortran/91942 (ICE in match_vtag, at fortran/io.c:1485)
2019-10-04 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91942
* io.c (match_vtag): Check for non-NULL result->symtree.
(match_out_tag): Check for invalid constant due to inquiry parameter.
(match_filepos): Instead of a syntax error, go to cleanup to get better
error messages.
Steven G. Kargl [Tue, 1 Oct 2019 19:21:05 +0000 (19:21 +0000)]
[multiple changes]
2019-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91864
* gcc/fortran/io.c (match_io_element): An inquiry parameter cannot be
read into.
* gcc/fortran/match.c (gfc_match_allocate): An inquiry parameter
can be neither an allocate-object nor stat variable.
(gfc_match_deallocate): An inquiry parameter cannot be deallocated.
Oleg Endo [Tue, 1 Oct 2019 14:58:10 +0000 (14:58 +0000)]
backport: re PR c++/88562 (Incorrect pointer incrementing on SH4)
gcc/
2019-10-01 Oleg Endo <olegendo@gcc.gnu.org>
Backport from mainline
2019-10-01 Oleg Endo <olegendo@gcc.gnu.org>
PR target/88562
* config/sh/sh.c (sh_extending_set_of_reg::use_as_extended_reg): Use
sh_check_add_incdec_notes to preserve REG_INC notes when replacing
a memory access insn.
Eric Botcazou [Mon, 23 Sep 2019 08:08:45 +0000 (08:08 +0000)]
trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep on the underlying type of the node.
* gcc-interface/trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep
on the underlying type of the node.
(Call_to_gnu): Likewise with the type of the prefix.
Max Filippov [Mon, 23 Sep 2019 07:47:14 +0000 (07:47 +0000)]
xtensa: backport fix for PR target/90922
Stack pointer adjustment code in prologue missed a case of no
callee-saved registers and a stack frame size bigger than 128 bytes.
Handle that case.
This fixes the following gcc tests with call0 ABI:
gcc.c-torture/execute/stdarg-2.c
gcc.dg/torture/pr55882.c
gcc.dg/torture/pr57569.c
gcc/
2019-09-23 Max Filippov <jcmvbkbc@gmail.com>
Backport from mainline
2019-06-18 Max Filippov <jcmvbkbc@gmail.com>
* config/xtensa/xtensa.c (xtensa_expand_prologue): Add stack
pointer adjustment for the case of no callee-saved registers and
stack frame bigger than 128 bytes.
[Darwin, opts processing] Fix missing RejectNegative etc.
This adds RejectNegative in a number of places it was needed,
reorders the opts into two groups (one general and one driver-only).
We also add a minimal description to each opt, and note some that
are now obsolete. The only functional change is to permit
-mtarget-linker= as an alias of -mtarget-linker.
This fixes the Darwin part of PR89327
2019-09-22 Iain Sandoe <iain@sandoe.co.uk>
Backport from mainline
2019-06-16 Iain Sandoe <iain@sandoe.co.uk>
Paul Thomas [Sat, 21 Sep 2019 08:35:17 +0000 (08:35 +0000)]
backport: re PR fortran/91588 (ICE in check_inquiry, at fortran/expr.c:2673)
2019-09-21 Paul Thomas <pault@gcc.gnu.org>
Backport from mainline
PR fortran/91588
* expr.c (check_inquiry): Remove extended component refs by
using symbol pointers. If a function argument is an associate
variable with a constant target, copy the target expression in
place of the argument expression. Check that the charlen is not
NULL before using the string length.
2019-09-21 Paul Thomas <pault@gcc.gnu.org>
Backport from mainline
PR fortran/91588
* gfortran.dg/associate_49.f90 : New test.
Kito Cheng [Fri, 20 Sep 2019 10:41:51 +0000 (10:41 +0000)]
RISC-V: Fix more splitters accidentally calling gen_reg_rtx.
PR target/91683
* config/riscv/riscv-protos.h (riscv_split_symbol): New bool parameter.
(riscv_move_integer): Likewise.
* config/riscv/riscv.c (riscv_split_integer): Pass FALSE for new
riscv_move_integer arg.
(riscv_legitimize_move): Likewise.
(riscv_force_temporary): New parameter in_splitter. Don't call
force_reg if true.
(riscv_unspec_offset_high): Pass FALSE for new riscv_force_temporary
arg.
(riscv_add_offset): Likewise.
(riscv_split_symbol): New parameter in_splitter. Pass to
riscv_force_temporary.
(riscv_legitimize_address): Pass FALSE for new riscv_split_symbol
arg.
(riscv_move_integer): New parameter in_splitter. New local
can_create_psuedo. Don't call riscv_split_integer or force_reg when
in_splitter TRUE.
(riscv_legitimize_const_move): Pass FALSE for new riscv_move_integer,
riscv_split_symbol, and riscv_force_temporary args.
* config/riscv/riscv.md (low<mode>+1): Pass TRUE for new
riscv_move_integer arg.
(low<mode>+2): Pass TRUE for new riscv_split_symbol arg.
Steven G. Kargl [Thu, 19 Sep 2019 17:54:53 +0000 (17:54 +0000)]
re PR fortran/91727 (ICE in conformable_arrays, at fortran/resolve.c:7490)
2019-09-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91727
* resolve.c (conformable_arrays): If array-spec is NULL, then
allocate-object is a scalar. a conformability check only occurs
for an array source-expr.
2019-09-19 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91727
* gfortran.dg/pr91727.f90: New test.
Kito Cheng [Thu, 19 Sep 2019 06:38:23 +0000 (06:38 +0000)]
RISC-V: Fix bad insn splits with paradoxical subregs.
Shifting by more than the size of a SUBREG_REG doesn't work, so we either
need to disable splits if an input is paradoxical, or else we need to
generate a clean temporary for intermediate results.
Jakub wrote the first version of this patch, so gets primary credit for it.
gcc/
PR target/91635
* config/riscv/riscv.md (zero_extendsidi2, zero_extendhi<GPR:mode>2,
extend<SHORT:mode><SUPERQI:mode>2): Don't split if
paradoxical_subreg_p (operands[0]).
(*lshrsi3_zero_extend_3+1, *lshrsi3_zero_extend_3+2): Add clobber and
use as intermediate value.
gcc/testsuite/
PR target/91635
* gcc.c-torture/execute/pr91635.c: New test.
* gcc.target/riscv/shift-shift-4.c: New test.
* gcc.target/riscv/shift-shift-5.c: New test.
Thomas Koenig [Wed, 18 Sep 2019 17:32:08 +0000 (17:32 +0000)]
backport: re PR fortran/91550 (ICE in do_subscript, at fortran/frontend-passes.c:2652)
2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/91550
* frontend-passes.c (do_subscript): If step equals
zero, a previuos error has been reported; do nothing
in this case.
* resolve.c (gfc_resolve_iterator): Move error checking
after type conversion.
2019-09-18 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/91550
* gfortran.dg/do_subscript_6.f90: New test.
Thomas Koenig [Sun, 15 Sep 2019 19:48:41 +0000 (19:48 +0000)]
backport: re PR fortran/91557 (Bogus warning about unused dummy argument _formal_*)
2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/91557
* trans-decl.c (generate_local_decl): Do not warn if the symbol
is artificial.
* trans-types.c (get_formal_from_actual_arglist): Set artificial
attribute on dummy arguments.
2019-09-15 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/91557
* gfortran.dg/warn_unused_dummy_argument_5.f90: New test.
Jonathan Wakely [Thu, 12 Sep 2019 10:51:58 +0000 (11:51 +0100)]
PR libstdc++/91748 fix std::for_each_n for random access iterators
PR libstdc++/91748
* include/bits/stl_algo.h (for_each_n): Fix random access iterator
case.
* testsuite/25_algorithms/for_each/for_each_n.cc: Test with random
access iterators.
Eric Botcazou [Wed, 11 Sep 2019 10:42:31 +0000 (10:42 +0000)]
re PR rtl-optimization/89795 (wrong code with -O2 -fno-dce -fno-forward-propagate -fno-sched-pressure)
PR rtl-optimization/89795
* rtlanal.c (nonzero_bits1) <SUBREG>: Do not propagate results from
inner REGs to paradoxical SUBREGs if WORD_REGISTER_OPERATIONS is set.
Ian Lance Taylor [Tue, 10 Sep 2019 20:26:11 +0000 (20:26 +0000)]
go/internal/gccgoimporter: support embedded field in pointer loop
Backport of https://golang.org/cl/194440. Original description:
If an embedded field refers to a type via a pointer, the parser needs
to know the name of the embedded field. It is possible that the
pointer type is not yet resolved. This CL fixes the parser to handle
that case by setting the pointer element type to the unresolved named
type while the pointer is being resolved.
Jakub Jelinek [Mon, 9 Sep 2019 10:51:04 +0000 (12:51 +0200)]
re PR target/91704 ([X86] Codegen for _mm256_cmpgt_epi8 is affected by -funsigned-char)
PR target/91704
* config/i386/avxintrin.h (__v32qs): New typedef.
* config/i386/avx2intrin.h (_mm256_cmpgt_epi8): Use casts to __v32qs
instead of __v32qi.
PR81800 is about the lrint inline giving spurious FE_INEXACT exceptions.
The previous change for PR81800 didn't fix this: when lrint is disabled
in the backend, the midend will simply use llrint. This actually makes
things worse since llrint now also ignores FE_INVALID exceptions!
The fix is to disable lrint/llrint on double if the size of a long is
smaller (ie. ilp32).
gcc/
PR target/81800
* gcc/config/aarch64/aarch64.md (lrint): Disable lrint pattern if GPF
operand is larger than a long int.
testsuite/
PR target/81800
* gcc.target/aarch64/no-inline-lrint_3.c: New test.
Jakub Jelinek [Tue, 3 Sep 2019 16:55:31 +0000 (18:55 +0200)]
re PR tree-optimization/91597 (GCC miscompiles a branch depending on a pointer tag)
PR tree-optimization/91597
* tree-vrp.c (extract_range_from_binary_expr): Remove unsafe
BIT_AND_EXPR optimization for pointers, even if both operand
ranges don't include NULL, the result can be NULL.
Martin Liska [Mon, 2 Sep 2019 08:58:39 +0000 (10:58 +0200)]
Backport r275292
2019-09-02 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-09-02 Martin Liska <mliska@suse.cz>
PR c++/91155
* c-common.c (fname_as_string): Use cxx_printable_name for
__PRETTY_FUNCTION__ same as was used before r265711.
2019-09-02 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-09-02 Martin Liska <mliska@suse.cz>
PR c++/91155
* g++.dg/torture/pr91155.C: New test.
Martin Liska [Mon, 2 Sep 2019 08:58:17 +0000 (10:58 +0200)]
Backport r275291
2019-09-02 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-09-02 Martin Liska <mliska@suse.cz>
PR gcov-profile/91601
* gcov.c (path_contains_zero_cycle_arc): Rename to ...
(path_contains_zero_or_negative_cycle_arc): ... this and handle
also negative edges.
(circuit): Handle also negative edges as they can happen
in some situations.