The last change was incomplete, in that it did not evaluate the array
argument in some cases where it had to be evaluated. This reuses the
existing code for checking whether len/cap is constant.
Also clean up the use of _ as the second variable in a for/range,
which was previously inconsistent depending on whether the statement
used = or :=.
Updates golang/go#22313
Reviewed-on: https://go-review.googlesource.com/91715
From-SVN: r257377
This implements a requirement of the language spec.
While we're here fix the value returned by the type method of a
builtin call expression to make, although this doesn't seem to make
any difference anywhere since we lower this to a runtime call before
the determine_types pass anyhow.
There is already a test for this error in the master repository:
test/fixedbugs/issue16949.go. It just hasn't made it into the gccgo
testsuite yet.
Fixesgolang/go#16949
Reviewed-on: https://go-review.googlesource.com/91697
From-SVN: r257376
We should only issue an error for a goto over a var declaration.
The test case for this is already in the master repository, at
test/fixedbugs/issue8042.go. It just hasn't been copied into the
gccgo repository yet.
Fixesgolang/go#19089
Reviewed-on: https://go-review.googlesource.com/91696
From-SVN: r257375
The quoting code that read _cgo_flags, currently only in the gccgo
version of cmd/go, was losing the last flag read from the file.
Fixesgolang/go#23666
Reviewed-on: https://go-review.googlesource.com/91655
From-SVN: r257373
2018-02-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/84115
* trans-decl.c (gfc_get_symbol_decl): Do not finish the decl of
'length' if the symbol charlen backend_decl is an indirect ref.
2018-02-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/84115
* gfortran.dg/associate_34.f90: New test.
* gfortran.dg/associate_35.f90: New test.
From-SVN: r257363
2018-02-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/84141
PR fortran/84155
* trans-array.c (gfc_array_init_size): Instead of gfc_get_dtype
use gfc_get_dtype_rank_type.
2018-02-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/84141
PR fortran/84155
* gfortran.dg/pr84155.f90 : New test.
From-SVN: r257356
PR lto/83954
* lto-symtab.c (warn_type_compatibility_p): Do not recurse into the
component type of array types with non-aliased component.
From-SVN: r257343
* config/i386/i386.c (ix86_output_function_return): Pass
INVALID_REGNUM, instead of -1, as invalid register number to
indirect_thunk_name and output_indirect_thunk.
From-SVN: r257340
* go-gcc.cc (Gcc_backend::type_size): Return 0 for
void_type_node.
(Gcc_backend::convert_expression): Don't convert if the type of
expr_tree is void_type_node.
(Gcc_backend::array_index_expression): Don't index if the type of
the array expression is void_type_node.
(Gcc_backend::init_statement): Don't initialize if the type of the
initializer expression is void_type_node.
(Gcc_backend::assignment_statement): Don't assign if the type of
either the left or right hand side is void_type_node.
(Gcc_backend::temporary_variable): Don't initialize if the type of
the initializer expression is void_type_node.
From-SVN: r257334
The language spec says that in `for i = range x`, in which there is no
second iteration variable, if len(x) is constant, then x is not
evaluated. This only matters when x is an expression that panics but
whose type is an array type; in such a case, we should not evaluate x,
since len of any array type is a constant.
Fixesgolang/go#22313
Reviewed-on: https://go-review.googlesource.com/91555
From-SVN: r257330
x32 is a 64-bit process with 32-bit software pointer and kernel may
place x32 shadow stack above 4GB. We need to save and restore 64-bit
shadow stack register for x32. builtin jmp buf size is 5 pointers. We
have space to save 64-bit shadow stack pointers: 32-bit SP, 32-bit FP,
32-bit IP, 64-bit SSP for x32.
PR target/84066
* gcc/config/i386/i386.md: Replace Pmode with word_mode in
builtin_setjmp_setup and builtin_longjmp to support x32.
* gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c: New test.
* gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c: Likewise.
From-SVN: r257326
They were disabled due to the lack of escape analysis. Now that
we have escape analysis, unskip these tests.
Reviewed-on: https://go-review.googlesource.com/86248
From-SVN: r257324
On ia64, a separate stack is used for saving/restoring register frames,
occupying the other end of the stack mapping. This must also be scanned
for pointers into the heap.
Reviewed-on: https://go-review.googlesource.com/85276
From-SVN: r257323
The escape analysis now runs by default. It can be disabled with
the negative flag, -fno-go-optimize-allocs.
Reviewed-on: https://go-review.googlesource.com/86247
* lang.opt (fgo-optimize): Remove RejectNegative.
* go-c.h (go_enable_optimize): Update declaration to take value
argument.
* go-lang.c (go_langhook_handle_option): Pass value to
go_enable_optimize.
* gccgo.texi (Invoking gccgo): Update -fgo-optimize-allocs doc.
From-SVN: r257319
We were using special compilation flags for the math package, but we
weren't using them when testing. That meant that our tests were not
checking the real code we were providing. Fix that.
Fixing that revealed that we were not using a good set of flags, or at
least were not using flags that let the tests pass. Adjust the flags
to stop using -funsafe-math-optimizations on x86. Instead always use
-ffp-contract=off -fno-math-errno -fno-trapping-math for all targets.
Fixesgolang/go#23647
Reviewed-on: https://go-review.googlesource.com/91355
From-SVN: r257312
When associating a variable of type character, if the length of the
target isn't known at compile time, generate an error. See PR 83344
for more details.
Regtested on x86_64-pc-linux-gnu.
gcc/fortran/ChangeLog:
2018-02-01 Janne Blomqvist <jb@gcc.gnu.org>
PR 83975
PR 83344
* resolve.c (resolve_assoc_var): Generate an error if
target length unknown.
From-SVN: r257310
PR target/56010
PR target/83743
* config/rs6000/driver-rs6000.c: #include "diagnostic.h".
#include "opts.h".
(rs6000_supported_cpu_names): New static variable.
(linux_cpu_translation_table): Likewise.
(elf_platform) <cpu>: Define new static variable and use it.
Translate kernel AT_PLATFORM name to canonical name if needed.
Error if platform name is unknown.
From-SVN: r257305
PR target/84128
* config/i386/i386.c (release_scratch_register_on_entry): Add new
OFFSET and RELEASE_VIA_POP arguments. Use SP+OFFSET to restore
the scratch if RELEASE_VIA_POP is false.
(ix86_adjust_stack_and_probe_stack_clash): Un-constify SIZE.
If we have to save a temporary register, decrement SIZE appropriately.
Pass new arguments to release_scratch_register_on_entry.
(ix86_adjust_stack_and_probe): Likewise.
(ix86_emit_probe_stack_range): Pass new arguments to
release_scratch_register_on_entry.
PR target/84128
* gcc.target/i386/pr84128.c: New test.
From-SVN: r257303
Otherwise on a 64-bit system we will read the 32-bit value as a 64-bit
value. Since getaddrinfo returns negative numbers as error values,
these will be interpreted as numbers like 0xfffffffe rather than -2,
and the comparisons with values like syscall.EAI_NONAME will fail.
Fixesgolang/go#23645
Reviewed-on: https://go-review.googlesource.com/91296
From-SVN: r257299