Andrew Benson [Wed, 22 Aug 2018 17:40:55 +0000 (17:40 +0000)]
Update write after approval list
2018-08-22 Andrew Benson <abensonca@gmail.com>
* MAINTAINERS: Add self to write after approval list.
From-SVN: r263783
Janus Weil [Wed, 22 Aug 2018 17:10:00 +0000 (19:10 +0200)]
re PR fortran/86888 ([F08] allocatable components of indirectly recursive type)
fix PR 86888
2018-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/86888
* decl.c (gfc_match_data_decl): Allow allocatable components of
indirectly recursive type.
* resolve.c (resolve_component): Remove two errors messages ...
(resolve_fl_derived): ... and replace them by a new one.
2018-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/86888
* gfortran.dg/alloc_comp_basics_6.f90: Update an error message and add
an additional case.
* gfortran.dg/alloc_comp_basics_7.f90: New test case.
* gfortran.dg/class_17.f03: Update error message.
* gfortran.dg/class_55.f90: Ditto.
* gfortran.dg/dtio_11.f90: Update error messages.
* gfortran.dg/implicit_actual.f90: Add an error message.
* gfortran.dg/typebound_proc_12.f90: Update error message.
From-SVN: r263782
Martin Sebor [Wed, 22 Aug 2018 16:42:56 +0000 (16:42 +0000)]
PR middle-end/87052 - STRING_CST printing incomplete in Gimple dumps
gcc/testsuite/ChangeLog:
PR middle-end/87052
* gcc.dg/pr87052.c: New test.
* gcc.dg/tree-ssa/dump-3.c: Adjust.
gcc/ChangeLog:
PR middle-end/87052
* tree-pretty-print.c (pretty_print_string): Add argument.
(dump_generic_node): Call to pretty_print_string with string size.
From-SVN: r263781
Segher Boessenkool [Wed, 22 Aug 2018 16:04:09 +0000 (18:04 +0200)]
[ fix changelog ]
2018-08-22 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/86771
* combine.c (try_combine): Do not allow splitting a resulting PARALLEL
of two SETs into those two SETs, one to be placed at i2, if that SETs
destination is modified between i2 and i3.
From-SVN: r263780
Szabolcs Nagy [Wed, 22 Aug 2018 15:12:05 +0000 (15:12 +0000)]
Change AArch64 specific FMAX/FMIN tests into generic MAX_EXPR/MIN_EXPR tests
gfortran now always uses MAX_EXPR/MIN_EXPR for MAX/MIN intrinsics, so the
AArch64 specific FMAX/FMIN tests are no longer valid.
2018-08-22 Szabolcs Nagy <szabolcs.nagy@arm.com>
* gfortran.dg/max_fmax_aarch64.f90: Rename to...
* gfortran.dg/max_expr.f90: ...this.
* gfortran.dg/min_fmin_aarch64.f90: Rename to...
* gfortran.dg/min_expr.f90: ...this.
From-SVN: r263778
Segher Boessenkool [Wed, 22 Aug 2018 13:41:05 +0000 (15:41 +0200)]
combine: Do another check before splitting a parallel (PR86771)
When combine splits a resulting parallel into its two SETs, it has to
place one at i2, and the other stays at i3. This does not work if the
destination of the SET that will be placed at i2 is modified between
i2 and i3. This patch fixes it.
* combine.c (try_combine): Do not allow splitting a resulting PARALLEL
of two SETs into those two SETs, one to be placed at i2, if that SETs
destination is modified between i2 and i3.
From-SVN: r263776
Richard Sandiford [Wed, 22 Aug 2018 13:02:48 +0000 (13:02 +0000)]
[2/2] Fix bogus inner induction (PR 86725)
This patch is the second part of the fix for PR 86725. The problem
in the original test is that for:
outer1:
x_1 = PHI <x_4(outer2), ...>;
...
inner:
x_2 = PHI <x_1(outer1), x_3(...)>;
...
x_3 = ...;
...
outer2:
x_4 = PHI <x_3(inner)>;
...
there are corner cases in which it is possible to classify the
inner phi as an induction but not the outer phi. The -4.c test
is a more direct example.
After failing to classify x_1 as an induction, we go on to
classify it as a double reduction (which is basically true).
But we still classified the inner phi as an induction rather
than as part of a reduction, leading to an ICE when trying
to vectorise the outer phi.
We analyse the phis for outer loops first, so the simplest
fix is not to classify the phi as an induction if outer loop
analysis said that it should be a reduction.
The -2.c test is from the original PR. The -3.c test is a
version in which "wo" really is used a reduction; this was
already correctly rejected, but for the wrong reason ("inner-loop
induction only used outside of the outer vectorized loop").
The -4.c test is another way of tickling the original problem
without relying on the undefinedness of signed overflow.
The -5.c test shows an (uninteresting) example in which the
patch prevents a spurious failure to vectorise the outer loop.
2018-08-22 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR tree-optimization/86725
* tree-vect-loop.c (vect_inner_phi_in_double_reduction_p): New
function.
(vect_analyze_scalar_cycles_1): Check it.
gcc/testsuite/
PR tree-optimization/86725
* gcc.dg/vect/no-scevccp-pr86725-2.c: New test.
* gcc.dg/vect/no-scevccp-pr86725-3.c: Likewise.
* gcc.dg/vect/no-scevccp-pr86725-4.c: Likewise.
* gcc.dg/vect/no-scevccp-pr86725-5.c: Likewise.
From-SVN: r263774
Richard Sandiford [Wed, 22 Aug 2018 13:02:39 +0000 (13:02 +0000)]
[1/2] Fix bogus double reduction (PR 86725)
This patch is the first part of the fix for PR 86725. We would
treat x_1 in:
outer1:
x_1 = PHI <x_4(outer2), ...>;
...
inner:
x_2 = ...x_1...;
...
x_3 = ...;
...
outer2:
x_4 = PHI <x_3(inner)>;
...
as a double reduction without checking what kind of statement x_2 is.
In practice it has to be a phi, since for other x_2, x_1 would simply
be a loop invariant that gets used for every inner loop iteration.
The idea with doing this patch first is that, by checking x_2 really
is a phi, we can hand off the validation of the rest of the reduction
to the phi analysis in the inner loop.
The test case is a variant of the one in the PR.
2018-08-22 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR tree-optimization/86725
* tree-vect-loop.c (vect_is_simple_reduction): When treating
an outer loop phi as a double reduction, make sure that the
single user of the phi result is an inner loop phi.
gcc/testsuite/
PR tree-optimization/86725
* gcc.dg/vect/no-scevccp-pr86725-1.c: New test.
From-SVN: r263773
Richard Sandiford [Wed, 22 Aug 2018 12:59:08 +0000 (12:59 +0000)]
Make the vectoriser drop to strided accesses for stores with gaps
We could vectorise:
for (...)
{
a[0] = ...;
a[1] = ...;
a[2] = ...;
a[3] = ...;
a += stride;
}
(including the case when stride == 8) but not:
for (...)
{
a[0] = ...;
a[1] = ...;
a[2] = ...;
a[3] = ...;
a += 8;
}
(where the stride is always 8). The former was treated as a "grouped
and strided" store, while the latter was treated as a grouped store
with gaps, which we don't support.
This patch makes us treat groups of stores with gaps at the end as
strided groups too. I tried to go through all uses of STMT_VINFO_STRIDED_P
and all vector uses of DR_STEP to see whether there were any hard-baked
assumptions, but couldn't see any. I wondered whether we should relax:
/* We do not have to consider dependences between accesses that belong
to the same group, unless the stride could be smaller than the
group size. */
if (DR_GROUP_FIRST_ELEMENT (stmtinfo_a)
&& (DR_GROUP_FIRST_ELEMENT (stmtinfo_a)
== DR_GROUP_FIRST_ELEMENT (stmtinfo_b))
&& !STMT_VINFO_STRIDED_P (stmtinfo_a))
return false;
for cases in which the step is constant and the absolute step is known
to be greater than the group size, but data dependence analysis should
already return chrec_known for those cases.
The new test is a version of vect-avg-15.c with the variable step
replaced by a constant one.
A natural follow-on would be to do the same for groups with gaps in
the middle:
/* Check that the distance between two accesses is equal to the type
size. Otherwise, we have gaps. */
diff = (TREE_INT_CST_LOW (DR_INIT (data_ref))
- TREE_INT_CST_LOW (prev_init)) / type_size;
if (diff != 1)
{
[...]
if (DR_IS_WRITE (data_ref))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"interleaved store with gaps\n");
return false;
}
But I think we should do that separately and see what the fallout
from this change is first.
2018-08-22 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-data-refs.c (vect_analyze_group_access_1): Convert
grouped stores with gaps to a strided group.
gcc/testsuite/
* gcc.dg/vect/vect-avg-16.c: New test.
* gcc.dg/vect/slp-37.c: Expect the loop to be vectorized.
* gcc.dg/vect/vect-strided-u8-i8-gap4.c,
* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Likewise for
the second loop in main1.
From-SVN: r263772
Richard Sandiford [Wed, 22 Aug 2018 12:58:53 +0000 (12:58 +0000)]
Only test STMT_VINFO_STRIDED_P for the first statement in a group
get_load_store_type & co were testing STMT_VINFO_STRIDED_P on individual
statements in a group instead of the first. This has no effect on
its own, but is needed by a later patch.
2018-08-22 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-stmts.c (get_group_load_store_type)
(get_load_store_type): Only test STMT_VINFO_STRIDED_P for the
first statement in a group.
From-SVN: r263771
Iain Sandoe [Wed, 22 Aug 2018 12:31:23 +0000 (12:31 +0000)]
Udate Darwin's LTO specs to match what's in gcc/gcc.c
gcc/
* config/darwin.h (LINK_COMMAND_SPEC_A): Sync LTO options with
the sequence used in gcc/gcc.c.
From-SVN: r263770
Iain Sandoe [Wed, 22 Aug 2018 12:22:07 +0000 (12:22 +0000)]
stringify __USER_LABEL_PREFIX__ in pr85248 testcase.
gcc/testsuite
* gcc.dg/lto/pr85248_0.c (test_alias):
Stringify __USER_LABEL_PREFIX__.
(test_noreturn): Likewise.
From-SVN: r263769
Iain Sandoe [Wed, 22 Aug 2018 12:12:46 +0000 (12:12 +0000)]
Make the gcc-ar,nm, strip tools respond correctly to --help and --version
when there's no plugin built.
gcc/
PR other/704
* gcc-ar.c (main): Don’t try to invoke the plug-in if we’re not
building it.
From-SVN: r263768
Jonathan Wakely [Wed, 22 Aug 2018 12:11:17 +0000 (13:11 +0100)]
PR libstdc++/77854 document size_type for containers
PR libstdc++/77854
* doc/xml/manual/status_cxx1998.xml: Document size_type and
difference_type for containers.
* doc/html/*: Regenerate.
From-SVN: r263767
Iain Sandoe [Wed, 22 Aug 2018 12:05:45 +0000 (12:05 +0000)]
commit missed change from r263764
From-SVN: r263766
Iain Sandoe [Wed, 22 Aug 2018 11:58:43 +0000 (11:58 +0000)]
Move Darwin10 unwinder fix to a crt shim.
gcc/
* config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Adjust to use the
Darwin10-specific unwinder-shim.
* config/darwin12.h (LINK_GCC_C_SEQUENCE_SPEC): Remove.
* config/rs6000/darwin.h (DARWIN_CRT1_SPEC, DARWIN_DYLIB1_SPEC):
New to cater for Darwin10 Rosetta.
libgcc/
* config/unwind-dw2-fde-darwin.c
(_darwin10_Unwind_FindEnclosingFunction): move from here ...
* config/darwin10-unwind-find-enc-func.c: … to here.
* config/t-darwin: Build Darwin10 unwinder shim crt.
* libgcc/config.host: Add the Darwin10 unwinder shim.
From-SVN: r263765
Iain Sandoe [Wed, 22 Aug 2018 11:42:53 +0000 (11:42 +0000)]
Allw for Darwin to operate with an assembler supporting gotoff in data.
gcc/
* config/i386/i386.c (ix86_output_addr_diff_elt): Move the MACH-O
specific test before the one for HAVE_AS_GOTOFF_IN_DATA.
From-SVN: r263764
Iain Sandoe [Wed, 22 Aug 2018 11:37:02 +0000 (11:37 +0000)]
Fix FDE labels for Darwin
gcc/
PR bootstrap/81033
PR target/81733
PR target/52795
* gcc/dwarf2out.c (FUNC_SECOND_SECT_LABEL): New.
(dwarf2out_switch_text_section): Generate a local label for the second
function sub-section and apply it as the second FDE start label.
* gcc/final.c (final_scan_insn_1): Emit second FDE label after the second
sub-section start.
From-SVN: r263763
Richard Biener [Wed, 22 Aug 2018 11:01:58 +0000 (11:01 +0000)]
re PR tree-optimization/86988 (ICE: tree check: expected integer_cst, have var_decl in get_len, at tree.h:5563)
2018-08-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/86988
* tree-vrp.c (vrp_prop::check_mem_ref): Bail out on VLAs.
* g++.dg/pr86988.C: New testcase.
From-SVN: r263762
Richard Biener [Wed, 22 Aug 2018 08:07:36 +0000 (08:07 +0000)]
re PR tree-optimization/86945 (BUG with optimisation of select case statement in gfortran)
2018-08-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/86945
* tree-cfg.c (generate_range_test): Use unsigned arithmetic.
* gcc.dg/torture/pr86945.c: New testcase.
From-SVN: r263761
Alexandre Oliva [Wed, 22 Aug 2018 03:48:00 +0000 (03:48 +0000)]
rs6000 small data: add note on sdata2/r2
for gcc/ChangeLog
* config/rs6000/rs6000.c (SMALL_DATA_RELOC, SMALL_DATA_REG): Add
a comment about how uses of r2 for .sdata2 come about.
From-SVN: r263760
Alexandre Oliva [Wed, 22 Aug 2018 03:47:48 +0000 (03:47 +0000)]
fix reassoc cut&pasto
for gcc/ChangeLog
* tree-ssa-reassoc.c (is_reassociable_op): Fix cut&pasto.
From-SVN: r263759
GCC Administrator [Wed, 22 Aug 2018 00:16:29 +0000 (00:16 +0000)]
Daily bump.
From-SVN: r263758
François Dumont [Tue, 21 Aug 2018 19:44:41 +0000 (19:44 +0000)]
P0646R1 Improving the Return Value of Erase-Like Algorithms I
2018-08-21 François Dumont <fdumont@gcc.gnu.org>
P0646R1 Improving the Return Value of Erase-Like Algorithms I
* include/debug/forward_list (forward_list::__remove_return_type):
Define typedef as size_type or void, according to __cplusplus value.
(_GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
empty, according to __cplusplus value.
(_GLIBCXX20_ONLY): Define macro.
(forward_list::remove, forward_list::unique): Use typedef and macro
to change return type and add abi-tag for C++2a. Return number of
removed elements for C++2a.
(forward_list::remove_if<Pred>, forward_list::unique<BinPred>): Use
typedef to change return type for C++2a. Return number of removed
elements for C++2a.
* include/debug/list (list::__remove_return_type): Define typedef as
size_type or void, according to __cplusplus value.
(_GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
empty, according to __cplusplus value.
(_GLIBCXX20_ONLY): Define macro.
(list::remove, list::unique): Use typedef and macro to change return
type and add abi-tag for C++2a. Return number of removed elements for
C++2a.
(list::remove_if<Predicate>, list::unique<BinaryPredicate>): Use typedef
to change return type for C++2a. Return number of removed elements for
C++2a.
From-SVN: r263752
Janne Blomqvist [Tue, 21 Aug 2018 19:36:13 +0000 (22:36 +0300)]
Unconditionally use MAX_EXPR/MIN_EXPR for MAX/MIN intrinsics
For floating point types, the question is what MAX(a, NaN) or MIN(a,
NaN) should return (where "a" is a normal number). There are valid
usecases for returning either one, but the Fortran standard doesn't
specify which one should be chosen. Also, there is no consensus among
other tested compilers. In short, it's a mess. So lets just do
whatever is fastest, which is using MAX_EXPR/MIN_EXPR which are not
defined to do anything in particular if one of the operands is a NaN.
gcc/fortran/ChangeLog:
2018-08-21 Janne Blomqvist <jb@gcc.gnu.org>
* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Use
MAX_EXPR/MIN_EXPR unconditionally for real arguments.
* gfortran.texi (Compiler Characteristics): Document MAX/MIN
behavior wrt NaN.
gcc/testsuite/ChangeLog:
2018-08-21 Janne Blomqvist <jb@gcc.gnu.org>
* gfortran.dg/nan_1.f90: Remove tests that test MAX/MIN with NaNs.
From-SVN: r263751
Nicolas Koenig [Tue, 21 Aug 2018 18:48:59 +0000 (18:48 +0000)]
re PR fortran/25829 ([F03] Asynchronous IO support)
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.texi: Add description of asynchronous I/O.
* trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables
as volatile.
* trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to
st_wait_async and change argument spec from ".X" to ".w".
(gfc_trans_wait): Pass ID argument via reference.
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* gfortran.dg/f2003_inquire_1.f03: Add write statement.
* gfortran.dg/f2003_io_1.f03: Add wait statement.
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* Makefile.am: Add async.c to gfor_io_src.
Add async.h to gfor_io_headers.
* Makefile.in: Regenerated.
* gfortran.map: Add _gfortran_st_wait_async.
* io/async.c: New file.
* io/async.h: New file.
* io/close.c: Include async.h.
(st_close): Call async_wait for an asynchronous unit.
* io/file_pos.c (st_backspace): Likewise.
(st_endfile): Likewise.
(st_rewind): Likewise.
(st_flush): Likewise.
* io/inquire.c: Add handling for asynchronous PENDING
and ID arguments.
* io/io.h (st_parameter_dt): Add async bit.
(st_parameter_wait): Correct.
(gfc_unit): Add au pointer.
(st_wait_async): Add prototype.
(transfer_array_inner): Likewise.
(st_write_done_worker): Likewise.
* io/open.c: Include async.h.
(new_unit): Initialize asynchronous unit.
* io/transfer.c (async_opt): New struct.
(wrap_scalar_transfer): New function.
(transfer_integer): Call wrap_scalar_transfer to do the work.
(transfer_real): Likewise.
(transfer_real_write): Likewise.
(transfer_character): Likewise.
(transfer_character_wide): Likewise.
(transfer_complex): Likewise.
(transfer_array_inner): New function.
(transfer_array): Call transfer_array_inner.
(transfer_derived): Call wrap_scalar_transfer.
(data_transfer_init): Check for asynchronous I/O.
Perform a wait operation on any pending asynchronous I/O
if the data transfer is synchronous. Copy PDT and enqueue
thread for data transfer.
(st_read_done_worker): New function.
(st_read_done): Enqueue transfer or call st_read_done_worker.
(st_write_done_worker): New function.
(st_write_done): Enqueue transfer or call st_read_done_worker.
(st_wait): Document as no-op for compatibility reasons.
(st_wait_async): New function.
* io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK;
add NOTE where necessary.
(get_gfc_unit): Likewise.
(init_units): Likewise.
(close_unit_1): Likewise. Call async_close if asynchronous.
(close_unit): Use macros LOCK and UNLOCK.
(finish_last_advance_record): Likewise.
(newunit_alloc): Likewise.
* io/unix.c (find_file): Likewise.
(flush_all_units_1): Likewise.
(flush_all_units): Likewise.
* libgfortran.h (generate_error_common): Add prototype.
* runtime/error.c: Include io.h and async.h.
(generate_error_common): New function.
2018-08-21 Nicolas Koenig <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/25829
* testsuite/libgomp.fortran/async_io_1.f90: New test.
* testsuite/libgomp.fortran/async_io_2.f90: New test.
* testsuite/libgomp.fortran/async_io_3.f90: New test.
* testsuite/libgomp.fortran/async_io_4.f90: New test.
* testsuite/libgomp.fortran/async_io_5.f90: New test.
* testsuite/libgomp.fortran/async_io_6.f90: New test.
* testsuite/libgomp.fortran/async_io_7.f90: New test.
Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>
From-SVN: r263750
Marek Polacek [Tue, 21 Aug 2018 18:37:23 +0000 (18:37 +0000)]
re PR c++/86499 (lambda-expressions with capture-default are allowed at namespace scope)
PR c++/86499
* parser.c (cp_parser_lambda_introducer): Give error if a non-local
lambda has a capture-default.
* g++.dg/cpp0x/lambda/lambda-non-local.C: New test.
* g++.dg/cpp0x/lambda/lambda-this10.C: Adjust dg-error.
From-SVN: r263749
Paolo Carlini [Tue, 21 Aug 2018 15:49:58 +0000 (15:49 +0000)]
decl.c (check_static_variable_definition): Change to return void.
2018-08-21 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (check_static_variable_definition): Change to return void.
From-SVN: r263742
Marek Polacek [Tue, 21 Aug 2018 15:38:36 +0000 (15:38 +0000)]
PR c++/86981, Implement -Wpessimizing-move.
* c.opt (Wpessimizing-move): New option.
* typeck.c (decl_in_std_namespace_p): New.
(is_std_move_p): New.
(maybe_warn_pessimizing_move): New.
(can_do_nrvo_p): New, factored out of ...
(check_return_expr): ... here. Warn about potentially harmful
std::move in a return statement.
* doc/invoke.texi: Document -Wpessimizing-move.
* g++.dg/cpp0x/Wpessimizing-move1.C: New test.
* g++.dg/cpp0x/Wpessimizing-move2.C: New test.
* g++.dg/cpp0x/Wpessimizing-move3.C: New test.
* g++.dg/cpp0x/Wpessimizing-move4.C: New test.
* g++.dg/cpp1z/Wpessimizing-move1.C: New test.
From-SVN: r263741
Marek Polacek [Tue, 21 Aug 2018 15:25:17 +0000 (15:25 +0000)]
re PR c++/65043 (Expected narrowing conversion during list initialization of bool from double)
PR c++/65043
* call.c (standard_conversion): Set check_narrowing.
* typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
than comparing with INTEGER_TYPE.
* g++.dg/concepts/pr67595.C: Add dg-warning.
* g++.dg/cpp0x/Wnarrowing11.C: New test.
* g++.dg/cpp0x/Wnarrowing12.C: New test.
* g++.dg/cpp0x/rv-cast5.C: Add static_cast.
From-SVN: r263739
Marek Polacek [Tue, 21 Aug 2018 15:10:51 +0000 (15:10 +0000)]
* cp-tree.h: Fix typo.
From-SVN: r263738
Hristian Kirtchev [Tue, 21 Aug 2018 14:50:03 +0000 (14:50 +0000)]
[Ada] Minor reformattings
2018-08-21 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* checks.adb, contracts.adb, exp_aggr.adb, exp_attr.adb,
exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, exp_unst.adb,
exp_util.adb, freeze.adb, gnatlink.adb, layout.adb,
lib-writ.adb, lib-xref-spark_specific.adb, sem_ch13.adb,
sem_ch3.adb, sem_ch6.adb, sem_res.adb, sem_util.adb, sinfo.ads,
sprint.adb: Minor reformatting.
From-SVN: r263737
Jerome Lambourg [Tue, 21 Aug 2018 14:49:49 +0000 (14:49 +0000)]
[Ada] Add a new gnat tool vxlink
VxLink is a helper tool used as a wrapper around g++/gcc to build
VxWorks DKM (Downloadable Kernel Modules).
Such DKM is a partially linked object that includes entry points for
constructors and destructors.
This tool thus uses g++ to generate an intermediate partially linked
object, retrieves the list of constructors and destructors in it and
produces a C file that lists those ctors/dtors in a way that is
understood be VxWorks kernel. It then links this file with the
intermediate object to produce a valid DKM.
2018-08-21 Jerome Lambourg <lambourg@adacore.com>
gcc/ada/
* vxlink-bind.adb, vxlink-bind.ads, vxlink-link.adb,
vxlink-link.ads, vxlink-main.adb, vxlink.adb, vxlink.ads: Add a
new tool vxlink to handle VxWorks constructors in DKMs.
* gcc-interface/Makefile.in: add rules to build vxlink
From-SVN: r263736
Ed Schonberg [Tue, 21 Aug 2018 14:49:42 +0000 (14:49 +0000)]
[Ada] Crash on expression function and tagged types
This patch fixes a compiler abort on an expression function whose
expression includes tagged types that have not been frozen before the
generated body of the function is analyzed, even though that body is
inserted at the end of the current declarative part.
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch6.adb (Analyze_Subprogram_Body_Helper, Mask_Type):
Refine the handling of freezing types for expression functions
that are not completions, when analyzing the generated body for
the function: the body is inserted at the end of the enclosing
declarative part, and its analysis may freeze types declared in
the same scope that have not been frozen yet.
gcc/testsuite/
* gnat.dg/expr_func7.adb, gnat.dg/expr_func7.ads: New testcase.
From-SVN: r263735
Ed Schonberg [Tue, 21 Aug 2018 14:49:34 +0000 (14:49 +0000)]
[Ada] Spurious crash on expression function as completion with contracts
This patch fixes a compiler abort on an expression function that is a
completion of a subprogram with preconditions. The problem is caused by
the presence of types in the precondition that are not frozen when the
subprogram body constructed for the expression function receives the
code that enforces the precondition. These types must be frozen before
the contract is expanded, so the freeze nodes for these types appear in
the proper scope. This is analogous to what is done with type references
that appear in the original expression of the expression function.
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch6.adb: Remove Freeze_Expr_Types.
* freeze.ads, freeze.adb (Freeze_Expr_Types): Moved from
sem_ch6.adb, and extended to handle other expressions that may
contain unfrozen types that must be frozen in their proper
scopes.
* contracts.adb (Analyze_Entry_Or_Subprogram_Contract): If the
contract is for the generated body of an expression function
that is a completion, traverse the expressions for pre- and
postconditions to freeze all types before adding the contract
code within the subprogram body.
gcc/testsuite/
* gnat.dg/expr_func6.adb, gnat.dg/expr_func6.ads: New testcase.
From-SVN: r263734
Hristian Kirtchev [Tue, 21 Aug 2018 14:49:26 +0000 (14:49 +0000)]
[Ada] Retention of with clauses for ignored Ghost units
This patch ensures that with clauses that mention ignored Ghost units are
retained in the tree. The retention is necessary for several reasons:
* The with clauses allow the new elaboration order mechanism to
produce the same library edges regardless of whether the Ghost unit
is checked or ignored. This ensures that the elaboration order
remains consistent.
* The with clauses allow the unnesting mechanism to properly
recognize that all units have been examined for unnesing purposes.
No observable impact, no test needed.
2018-08-21 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* sem_ch10.adb: Remove the with and use clause for unit Ghost.
(Analyze_With_Clause): Do not mark a with clause which mentions
an ignored Ghost code for elimination.
From-SVN: r263733
Javier Miranda [Tue, 21 Aug 2018 14:48:35 +0000 (14:48 +0000)]
[Ada] Crash processing SPARK annotate aspect
The compiler blows up writing the ALI file of a package that has a ghost
subprogram with an annotate contract.
2018-08-21 Javier Miranda <miranda@adacore.com>
gcc/ada/
* lib-writ.adb (Write_Unit_Information): Handle pragmas removed
by the expander.
gcc/testsuite/
* gnat.dg/spark2.adb, gnat.dg/spark2.ads: New testcase.
From-SVN: r263732
Ed Schonberg [Tue, 21 Aug 2018 14:48:03 +0000 (14:48 +0000)]
[Ada] Spurious error on overriding protected function in instance
The conformance between an overriding protected operation with
progenitors and the overridden interface operation requires subtype
conformance; requiring equality of return types in the case of a
function is too restrictive and leads to spurious errors when the return
type is a generic actual.
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch6.adb (Check_Synchronized_Overriding): The conformance
between an overriding protected operation and the overridden
abstract progenitor operation requires subtype conformance;
requiring equality of return types in the case of a function is
too restrictive and leads to spurious errors when the return
type is a generic actual.
gcc/testsuite/
* gnat.dg/prot6.adb, gnat.dg/prot6.ads: New testcase.
From-SVN: r263731
Ed Schonberg [Tue, 21 Aug 2018 14:47:56 +0000 (14:47 +0000)]
[Ada] Properly set scope of artificial entities in blocks
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch9.adb (Expand_N_Timed_Entry_Call,
Expand_Conditional_Entry_Call): Use Reset_Scopes_Of to set
properly the scope of all entities created in blocks generated
by the expansion of these constructs.
From-SVN: r263730
Ed Schonberg [Tue, 21 Aug 2018 14:47:50 +0000 (14:47 +0000)]
[Ada] Fix scope computation for loop statements
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch13.adb (Build_Predicate_Functioss): Apply
Reset_Quantified_Variables_Scope after predicate function has
been analyzed, so that the scope can be reset on the generated
loop statements that have replaced the quantified expressions.
From-SVN: r263729
Bob Duff [Tue, 21 Aug 2018 14:47:44 +0000 (14:47 +0000)]
[Ada] Einfo: remove obsolete code
2018-08-21 Bob Duff <duff@adacore.com>
gcc/ada
* einfo.ads, einfo.adb (Private_View, Shadow_Entities): Remove
obsolete code.
From-SVN: r263728
Maroua Maalej [Tue, 21 Aug 2018 14:47:38 +0000 (14:47 +0000)]
[Ada] Update for Ownership rules for access types according to AI12-0240
The implementation of these Ownership rules for safe pointers and
automatic memory management is still a prototype at an experimental
stage.
To activate the checks, the code should be compiled with the debug flag
-gnatdF and the flag -gnatd.F for setting the context for formal
verification of SPARK.
These changes do not affect compilation.
2018-08-21 Maroua Maalej <maalej@adacore.com>
gcc/ada/
* sem_spark.adb (Check_Call_Statement): Check global and formal
parameter permissions at call sites.
(Check_Callable_Body): Assume permissions on globals and
parameters depending on their modes then analyse the body
operations.
(Check_Declaration): Consider both deep (including elementary
access) object declarations and normal variables. First check
whether the deep object is of Ownership Aspec True or not, then,
depending on its initialization, assign the appropriate state.
Check related to non access type variables deal with
initialization value permissions.
(Check_Expression): Check nodes used in the expression being
analyzed.
(Check_Globals): Call by Check_Call_Statement to perform the
check on globals.
(Check_List): Call Check_Node on each element of the list.
(Check_Loop_Statement): Check the Iteration_Scheme and loop
statements.
(Check_Node): Main traversal procedure to check safe pointer usage.
(Check_Package_Body): Check subprogram's body.
(Check_Param_In): Take a formal and an actual parameter and
Check the permission of every in-mode parameter.
(Check_Param_Out): Take a formal and an actual parameter and
check the state of out-mode and in out-mode parameters.
(Check_Statement): Check statements other than procedure call.
(Get_Perm, Get_Perm_Or_Tree, Get_Perm_Tree): Find out the state
related to the given name.
(Is_Deep): Return True if an object is of access type or has
subfields of access type.
(Perm_Error, Perm_Error_Subprogram_End): Add an error message
whenever the found state on the given name is different from the
one expected (in the statement being analyzed).
(Process_Path): Given an operation and a current state, call
Perm_Error if there is any mismatch.
(Return_Declarations, Return_Globals, Return_The_Global): Check
the state of a given name at the end of the subprogram. These
procedures may change depending on how we shall finally deal
with globals and the rhs state in a move operation.
(Set_Perm_Extensions, Set_Perm_Prefixes_Borrow,
Set_Perm_Prefixes, Setup_Globals, Setup_Parameter_Or_Global,
Setup_Parameters): Set up the new states to the given node and
up and down the tree after an operation.
(Has_Ownership_Aspect_True): This function may disappear later
when the Ownership Aspect will be implemented in the FE.
From-SVN: r263727
Ed Schonberg [Tue, 21 Aug 2018 14:47:32 +0000 (14:47 +0000)]
[Ada] Spurious ambiguity error on call returning an access type
If F is a function with a single defaulted parameter that returns an
access_to_array type, then F (I) may designate either the return type or
an indexing of the result of the call, after implicit dereferencing. If
the component type C of the array type AR is accces AR this is ambiguous
in a context whose expected type is C. If F is parameterless the call is
not ambiguous.
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Call): Resolve correctly a parameterless
call that returns an access type whose designated type is the
component type of an array, when the function has no defaulted
parameters.
gcc/testsuite/
* gnat.dg/access5.adb, gnat.dg/access5.ads: New testcase.
From-SVN: r263726
Yannick Moy [Tue, 21 Aug 2018 14:47:25 +0000 (14:47 +0000)]
[Ada] Document entries of the target parametrization file
2018-08-21 Yannick Moy <moy@adacore.com>
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Document entries of the target parametrization file.
* gnat_ugn.texi: Regenerate.
From-SVN: r263725
Ed Schonberg [Tue, 21 Aug 2018 14:47:18 +0000 (14:47 +0000)]
[Ada] Set scope of elaboration flag for 'Access
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_attr.adb: Set scope of elaboration flag for 'Access.
From-SVN: r263724
Ed Schonberg [Tue, 21 Aug 2018 14:47:12 +0000 (14:47 +0000)]
[Ada] Sprint: add guard on printing aspects
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sprint.adb: Add guard on printing aspects.
From-SVN: r263723
Javier Miranda [Tue, 21 Aug 2018 14:47:05 +0000 (14:47 +0000)]
[Ada] Crash compiling SPARK ghost functions with callgraph info
The compiler blows up generating the callgraph output of SPARK ghost
subprograms whose contracts invoke ghost functions.
2018-08-21 Javier Miranda <miranda@adacore.com>
gcc/ada/
* exp_cg.adb (Generate_CG_Output): Handle calls removed by the
expander.
From-SVN: r263722
Ed Schonberg [Tue, 21 Aug 2018 14:46:59 +0000 (14:46 +0000)]
[Ada] Unnesting: do not set size of access subprograms
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* layout.adb: Do not set size of access subprogram if unnesting.
From-SVN: r263721
Ed Schonberg [Tue, 21 Aug 2018 14:46:54 +0000 (14:46 +0000)]
[Ada] Unnesting: do not emit warnings for access to subprograms
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* freeze.adb: Remove warnings for access to subprograms when
unnesting is active.
From-SVN: r263720
Ed Schonberg [Tue, 21 Aug 2018 14:46:49 +0000 (14:46 +0000)]
[Ada] Improper copying of limited arrays with default initialization
This patch fixes an improper expansion of aggregates for limited array
types in an object declaration. Prior to this patch, The presence of the
aggregate (which can only consist of box initializations) would create a
temporary that was then assigned to the object in the declaration.
Apart from a violation of the semantics of build-in-place limited
objects, this can also lead to out-of-scope access in LLVM.
Executing the following;
gcc -c -gnatDG nocopy.adb
grep quintet nocopy.adb.dg | wc -l
must yield:
5
----
procedure NoCopy is
-- Task used in this example to test that the limited component
-- is properly initialized.
task type T_Task (Disc : Natural);
task body T_Task is
begin
null;
end T_Task;
type My_Rec (D : Natural := 9999) is record
-- Components initialized by means of the current value
-- of the record discriminant
T : T_Task (D);
end record;
type TR is array (1 .. 5) of My_Rec;
Quintet : TR := (others => (others => <>));
begin
null;
end NoCopy;
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_aggr.adb (Expand_Array_Aggregate): If the component type
is limited, the array must be constructed in place, so set flag
In_Place_Assign_OK_For_Declaration accordingly. This prevents
improper copying of an array of tasks during initialization.
From-SVN: r263719
Eric Botcazou [Tue, 21 Aug 2018 14:46:45 +0000 (14:46 +0000)]
[Ada] Fix spurious error on unchecked conversion on VFA record type
2018-08-21 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* gcc-interface/trans.c (Call_to_gnu): Always suppress an
unchecked conversion around the actual for an In parameter
passed by copy.
From-SVN: r263718
Eric Botcazou [Tue, 21 Aug 2018 14:46:40 +0000 (14:46 +0000)]
[Ada] Fix internal error on extension of record with representation clause
This fixes a long-standing issue present for extensions of tagged record
types with a representation clause: the clause is correctly inherited
for components inherited in the extension but the position and size are
not, which fools the logic of Is_Possibly_Unaligned_Object.
This can result in an attempt to take the address of a component not
aligned on a byte boundary, which is then flagged as an internal error.
2018-08-21 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_util.adb (Is_Possibly_Unaligned_Object): For the case of a
selected component inherited in a record extension and subject
to a representation clause, retrieve the position and size from
the original record component.
gcc/testsuite/
* gnat.dg/rep_clause7.adb: New testcase.
From-SVN: r263717
Ed Schonberg [Tue, 21 Aug 2018 14:46:34 +0000 (14:46 +0000)]
[Ada] Spurious "Duplicated symbol" error with discriminated tasks
This patch fixes a spurious error in a program that contains a
discriminated task type and several of its subtype in the same
declarative part, when the corresponding discriminant constraints are
expressions.
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_util.ads, sem_util.adb (New_External_Entity): Type of
Suffix_Index must be Int, not Nat, so that a negative value can
be used to generate a unique name for an external object, as
specified in Tbuild.New_External_Name.
(Scope_Within): Handle private type whose completion is a
synchronized type (For unnesting).
* itypes.ads, itypes.adb (Create_Itype): Ditto
* sem_ch3.adb (Constrain_Corresponding_Record): Generate a
unique name for the created subtype, because there may be
several discriminated tasks present in the same scope, and each
needs its distinct corresponding record subtype.
gcc/testsuite/
* gnat.dg/task1.adb, gnat.dg/task1.ads, gnat.dg/task1_pkg.adb,
gnat.dg/task1_pkg.ads: New testcase.
From-SVN: r263716
Yannick Moy [Tue, 21 Aug 2018 14:46:07 +0000 (14:46 +0000)]
[Ada] Define versions of dimension system for Float and Long_Float
The dimension system in System.Dim.Mks is based on Long_Long_Float,
which may not be convenient to people who want to use Float or
Long_Float as basis. These new files provide units that define the
dimension system based on Float in System.Dim.Float_Mks and on
Long_Float in System.Dim.Long_Mks.
Child packages Other_Prefixes and Mks_IO are also defined appropriately,
with new instantiations for the various sizes of floating-point types.
2018-08-21 Yannick Moy <moy@adacore.com>
gcc/ada/
* doc/gnat_ugn/gnat_and_program_execution.rst: Update
documentation of dimensionality analysis.
* gnat_ugn.texi: Regenerate.
* Makefile.rtl, impunit.adb: Consider the new units.
* libgnat/s-dfmkio.ads, libgnat/s-dfmopr.ads,
libgnat/s-diflmk.ads: New units based on Float.
* libgnat/s-dilomk.ads, libgnat/s-dlmkio.ads,
libgnat/s-dlmopr.ads: New units based on Long_Float.
* libgnat/s-dmotpr.ads: Rename to libgnat/s-dgmgop.ads and turn
into an instance of
System.Dim.Generic_Mks.Generic_Other_Prefixes.
* libgnat/s-dimmks.ads: Rename to libgnat/s-digemk.ads and turn
into an instance of System.Dim.Generic_Mks.
From-SVN: r263715
Hristian Kirtchev [Tue, 21 Aug 2018 14:45:49 +0000 (14:45 +0000)]
[Ada] General purpose doubly linked list for compiler and tool use
This patch adds unit GNAT.Lists which currently contains the
implementation of a general purpose doubly linked list intended for use
by the compiler and the tools around it.
2018-08-21 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* impunit.adb: Add g-lists to the set of non-implementation
units.
* libgnat/g-lists.adb, libgnat/g-lists.ads: New unit.
* Makefile.rtl: Add g-lists to the set of non-tasking units.
* gcc-interface/Make-lang.in: Add g-lists to the set of files
used by gnat1.
gcc/testsuite/
* gnat.dg/linkedlist.adb: New testcase.
From-SVN: r263714
Ed Schonberg [Tue, 21 Aug 2018 14:45:04 +0000 (14:45 +0000)]
[Ada] Fix scope computation for entry bodies and accept alternatives
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch9.adb (Reset_Scopes): Do not recurse into type
declarations when resetting the scope of entities declared the
procedures generated for entry bodies and accept alternatives.
Use the entity of the procedure declaration, not its body, as
the new scope.
From-SVN: r263713
Hristian Kirtchev [Tue, 21 Aug 2018 14:44:56 +0000 (14:44 +0000)]
[Ada] Crash on entry in generic with dynamic elaboration checks
This patch modifies the set of attributes that applies to entries and
entry families to include elaboration entities used by the
access-before-elaboration mechanism.
2018-08-21 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* einfo.adb (Elaboration_Entity): Include entries and entry
families in the set of legal entities.
(Elaboration_Entity_Required): Include entries and entry
families in the set of legal entities.
(Set_Elaboration_Entity): Include entries and entry families in
the set of legal entities.
(Set_Elaboration_Entity_Required): Include entries and entry
families in the set of legal entities.
(Write_Field13_Name): Update the output of attribute
Elaboration_Entity.
* einfo.ads: Attributes Elaboration_Entity and
Elaboration_Entity_Required now apply to entries and entry
families.
gcc/testsuite/
* gnat.dg/elab6.adb, gnat.dg/elab6.ads, gnat.dg/elab6_pkg.adb,
gnat.dg/elab6_pkg.ads: New testcase.
From-SVN: r263712
Arnaud Charlet [Tue, 21 Aug 2018 14:44:51 +0000 (14:44 +0000)]
[Ada] Set_Targ: add a CodePeer annotation
2018-08-21 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* set_targ.adb: Mark some CodePeer message as Intentional.
From-SVN: r263711
Ed Schonberg [Tue, 21 Aug 2018 14:44:46 +0000 (14:44 +0000)]
[Ada] Compiler abort on call to expr. function for default discriminant
If a discriminant specification has a default that is a call to an
expression function, that function has to be frozen at the point of a
call to the initialization procedure for an object of the record type,
even though the call does not appear to come from source.
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Call): Force the freezing of an
expression function that is called to provide a default value
for a defaulted discriminant in an object initialization.
gcc/testsuite/
* gnat.dg/expr_func5.adb: New testcase.
From-SVN: r263710
Hristian Kirtchev [Tue, 21 Aug 2018 14:44:41 +0000 (14:44 +0000)]
[Ada] Dynamically resizable, load factor-based hash table
This patch introduces a dynamically resizable, load factor-based hash
table in unit GNAT.Dynamic_HTables.
2018-08-21 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* libgnat/g-dynhta.adb, libgnat/g-dynhta.ads: New package
Dynamic_HTable.
gcc/testsuite/
* gnat.dg/dynhash.adb: New testcase.
From-SVN: r263709
Javier Miranda [Tue, 21 Aug 2018 14:44:35 +0000 (14:44 +0000)]
[Ada] Enumeration types with non-standard representation
The compiler may report errors on enumeration types with non-standard
representation (i.e. at least one literal has a representation value
different from its 'Pos value) processing attribute 'Enum_Rep.
It may also generate wrong code for the evaluation of 'Enum_Rep raising
Constraint_Error at runtime.
2018-08-21 Javier Miranda <miranda@adacore.com>
gcc/ada/
* checks.ads (Determine_Range): Adding documentation.
* checks.adb (Determine_Range): Don't deal with enumerated types
with non-standard representation.
(Convert_And_Check_Range): For conversion of enumeration types
with non standard representation to an integer type perform a
direct conversion to the target integer type.
gcc/testsuite/
* gnat.dg/enum4.adb: New testcase.
From-SVN: r263708
Piotr Trojanek [Tue, 21 Aug 2018 14:44:30 +0000 (14:44 +0000)]
[Ada] Handle pragmas that come from aspects for GNATprove
In GNATprove we appear to abuse a routine related to cross-references and
expect it to deliver exact results, which is not what it was designed for.
This patch is a temporary solution to avoid crashes in GNATprove; it doesn't
affect the frontend or other backends, because this code is used exclusively
by GNATprove (it is located in the frontend for technical reasons). No tests
provided.
2018-08-21 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* lib-xref.ads, lib-xref-spark_specific.adb
(Enclosing_Subprogram_Or_Library_Package): Now roughtly works
for pragmas that come from aspect specifications.
From-SVN: r263707
Pierre-Marie de Rodat [Tue, 21 Aug 2018 14:44:25 +0000 (14:44 +0000)]
[Ada] Add sa_messages.ad[sb] for SPARK 2014
These new source files will make it possible to build SPARK 2014 from
a snapshot of GCC FSF sources.
2018-08-21 Pierre-Marie de Rodat <derodat@adacore.com>
gcc/ada/
* sa_messages.ads, sa_messages.adb: New source files.
From-SVN: r263706
David Edelsohn [Tue, 21 Aug 2018 14:03:16 +0000 (14:03 +0000)]
* testsuite/18_support/new_nothrow.cc: XFAIL on AIX.
From-SVN: r263703
Richard Sandiford [Tue, 21 Aug 2018 13:49:30 +0000 (13:49 +0000)]
Update global reviewers list
2018-08-21 Richard Sandiford <richard.sandiford@arm.com>
* MAINTAINERS: Add self to global reviewers list.
From-SVN: r263702
Jan Hubicka [Tue, 21 Aug 2018 12:32:53 +0000 (14:32 +0200)]
tree.c (find_decls_types_r): Do not check for redundant typedefs.
* tree.c (find_decls_types_r): Do not check for redundant typedefs.
* tree.h (is_redundant_typedef): Remove.
* dwarf2out.c (is_redundant_typedef): Turn into static function.
From-SVN: r263699
Pierre-Marie de Rodat [Tue, 21 Aug 2018 11:59:28 +0000 (11:59 +0000)]
[Ada] Bump copyright notices to 2018
2018-08-21 Pierre-Marie de Rodat <derodat@adacore.com>
gcc/ada/
* libgnarl/a-intnam__dragonfly.ads,
libgnarl/s-osinte__dragonfly.adb,
libgnarl/s-osinte__dragonfly.ads, libgnarl/s-osinte__gnu.adb,
libgnarl/s-osinte__gnu.ads, libgnarl/s-osinte__hpux-dce.adb,
libgnarl/s-osinte__hpux-dce.ads,
libgnarl/s-taprop__hpux-dce.adb,
libgnarl/s-taspri__hpux-dce.ads: Bump copyright notices to 2018.
From-SVN: r263698
Jan Hubicka [Tue, 21 Aug 2018 10:36:37 +0000 (12:36 +0200)]
tree.c (free_lang_data_in_decl): Remove types from DECL_CONTEXT when possible.
* tree.c (free_lang_data_in_decl): Remove types from DECL_CONTEXT
when possible.
From-SVN: r263697
Tamar Christina [Tue, 21 Aug 2018 09:55:07 +0000 (09:55 +0000)]
Fix DSE big-endian subreg crash on AArch64.
This patch fixes an ICE that would happen when extract_low_bits
is called with modes for which you can't extract a valid subreg.
e.g. taking a 32 bytes subreg from a 48 byte mode.
The ICE happens because convert_modes which eventually calls
simplify_gen_subreg does not expect the convertion to fail.
The assert in gen_lowpart_general would then be hit. The patch
changes it to validate the subreg before trying to convert the
modes. If the subreg is not possible we return NULL_RTX and bail
out early.
gcc/ChangeLog:
2018-08-21 Tamar Christina <tamar.christina@arm.com>
* expmed.c (extract_low_bits): Reject invalid subregs early.
gcc/testsuite/ChangeLog:
2018-08-21 Tamar Christina <tamar.christina@arm.com>
* gcc.target/aarch64/large_struct_copy.c: New test.
From-SVN: r263696
Jonathan Wakely [Tue, 21 Aug 2018 09:34:26 +0000 (10:34 +0100)]
Remove redundant { dg-do run } directives in tests
These tests accidentally had two dg-do directives. Only the second one
is needed.
* testsuite/26_numerics/bit/bitops.count/countl_one.cc: Remove
redundant dg-do directive.
* testsuite/26_numerics/bit/bitops.count/countl_zero.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/countr_one.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/countr_zero.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/popcount.cc: Likewise.
From-SVN: r263695
Szabolcs Nagy [Tue, 21 Aug 2018 09:22:14 +0000 (09:22 +0000)]
Restrict the pr86763 test to *-*-linux* targets
clock_gettime is not available on some baremetal targets
and may require -lrt on some non-linux targets.
gcc/testsuite/ChangeLog:
* g++.dg/torture/pr86763.C: Restrict to *-*-linux*.
From-SVN: r263694
Bernd Edlinger [Tue, 21 Aug 2018 08:56:11 +0000 (08:56 +0000)]
re PR middle-end/86121 (missing -Wstringop-overflow on strcpy followed by strcat)
2018-08-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR middle-end/86121
* tree-ssa-strlen.c (adjust_last_stmt): Avoid folding away undefined
behaviour.
testsuite:
2018-08-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR middle-end/86121
* gcc.dg/Wstringop-overflow-6.c: Remove xfail.
From-SVN: r263693
Rasmus Villemoes [Tue, 21 Aug 2018 08:52:40 +0000 (10:52 +0200)]
vxworks: don't define vxworks_asm_out_constructor when using .init_array
When the compiler is configured with --enable-initfini-array,
config/initfini-array.h gets included after config/vxworks.h by tm.h, so
the definitions of TARGET_ASM_CONSTRUTOR/TARGET_ASM_DESTRUCTOR in
vxworks.h get undone in initfini-array.h. Hence, we might as well not
define the vxworks_asm_out_* functions.
From-SVN: r263692
Rasmus Villemoes [Tue, 21 Aug 2018 08:50:27 +0000 (10:50 +0200)]
vxworks: enable use of .init_array/.fini_array for cdtors
The target OS actually runs all function pointers found in the _ctors
array when the module is loaded. So it is not that hard to make use of
the "modern" .init_array/.fini_array mechanism - it mostly just requires
a linker script adding the _ctors and _dtors symbols and terminating
LONG(0) entries.
Assume that if the user passed --enable-initfini-array when building
gcc, the rest of the toolchain (including the link spec and linker
script) is set up appropriately.
Note that configuring with --enable-initfini-array may prevent the -mrtp
mode from working, due to the (unconditional) use of .init_array.*
sections instead of .ctors.* - however, that is the case regardless of this
patch.
From-SVN: r263691
Rasmus Villemoes [Tue, 21 Aug 2018 08:49:15 +0000 (10:49 +0200)]
libgcc: add crt{begin,end} for powerpc-wrs-vxworks target
In order to allow ZCX on VxWorks, we need the frame_dummy function to do
the register_frame_info(). So make sure crtbegin.o and crtend.o are
available for use with a custom spec file.
From-SVN: r263690
Rasmus Villemoes [Tue, 21 Aug 2018 08:47:41 +0000 (10:47 +0200)]
vxworks: add target/h/wrn/coreip to the set of system include paths
In order to build crtstuff.c, I need to ensure the headers in
target/h/wrn/coreip are also searched. Of course, that can be done
similar to how wrn/coreip gets manually added for libgcc, e.g. by adding
CRTSTUFF_T_CFLAGS += -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip
But without target/h/wrn/coreip in the default search path, all
user-code that include <unistd.h> (crtstuff.c just being one such
example) will have to manually add an -isystem
flag adding the wrn/coreip directory: unistd.h include ioLib.h, which
has
#include "net/uio.h"
and that header is found in target/h/wrn/coreip. In other words, the
VxWorks system headers (at least for VxWorks 5.5) are written in a way
that assumes wrn/coreip is in the search path, so I think it makes sense
to have that by default.
It will change the search order for existing setups that pass
-I.../target/h/wrn/coreip (without -nostdinc), since that flag will now
be ignored. I can't know whether that will break anything, but I do
believe it makes sense to have the defaults actually usable without
expecting all invocations to add -I/-isystem flags.
From-SVN: r263689
Bernd Edlinger [Tue, 21 Aug 2018 08:16:19 +0000 (08:16 +0000)]
gimple-ssa-sprintf.c (decl_constant_value): Remove.
2018-08-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gimple-ssa-sprintf.c (decl_constant_value): Remove.
(get_format_string): Refer to c_getstr.
From-SVN: r263688
Tom de Vries [Tue, 21 Aug 2018 07:39:29 +0000 (07:39 +0000)]
[debug] Add debug and earlydebug dumps
With the introduction of early debug, we've added a phase in the compiler which
produces information which is not visible, unless we run the compiler in the
debugger and call debug_dwarf from dwarf2out_early_finish or some such.
This patch adds dumping of "early" and "final" debug info, into .earlydebug
and .debug dump files, enabled by -fdump-earlydebug and -fdumpdebug, such that
we can follow f.i. the upper bound of a vla type from early debug:
...
DW_AT_upper_bound: location descriptor:
(0x7f0d645b7550) DW_OP_GNU_variable_value , 0
...
to final debug:
...
DW_AT_upper_bound: location descriptor:
(0x7f0d645b7550) DW_OP_fbreg
18446744073709551592, 0
(0x7f0d645b7a00) DW_OP_deref 8, 0
...
to -dA annotated assembly file:
...
.uleb128 0x3 # DW_AT_upper_bound
.byte 0x91 # DW_OP_fbreg
.sleb128 -24
.byte 0x6 # DW_OP_deref
...
The .debug file shows the same information as the annotated assembly, but in
the same format as the "early" debug info.
Bootstrapped and reg-tested on x86_64.
2018-08-21 Tom de Vries <tdevries@suse.de>
* cgraph.h (debuginfo_early_init, debuginfo_init, debuginfo_fini)
(debuginfo_start, debuginfo_stop, debuginfo_early_start)
(debuginfo_early_stop): Declare.
* cgraphunit.c (debuginfo_early_init, debuginfo_init, debuginfo_fini)
(debuginfo_start, debuginfo_stop, debuginfo_early_start)
(debuginfo_early_stop): New function.
(symbol_table::finalize_compilation_unit): Call debuginfo_early_start
and debuginfo_early_stop.
* dwarf2out.c (dwarf2out_finish, dwarf2out_early_finish): Dump dwarf.
* toplev.c (compile_file): Call debuginfo_start and debuginfo_stop.
(general_init): Call debuginfo_early_init.
(finalize): Call debuginfo_fini.
(do_compile): Call debuginfo_init.
* doc/invoke.texi (@gccoptlist): Add -fdump-debug and
-fdump-early-debug.
(@item -fdump-debug, @item -fdump-earlydebug): Add.
* lto.c (lto_main): Call debuginfo_early_start and
debuginfo_early_stop.
* gcc.c-torture/unsorted/dump-noaddr.x: Use -gno-record-gcc-switches
to avoid mismatch in .debug and .earlydebug dump files.
From-SVN: r263687
Tom de Vries [Tue, 21 Aug 2018 07:39:17 +0000 (07:39 +0000)]
[debug] Respect fdump-noaddr and fdump-unnumbered in print_die
2018-08-21 Tom de Vries <tdevries@suse.de>
* dwarf2out.c (print_dw_val, print_loc_descr, print_die): Handle
flag_dump_noaddr and flag_dump_unnumbered.
From-SVN: r263686
Aldy Hernandez [Tue, 21 Aug 2018 06:27:14 +0000 (06:27 +0000)]
wide-int-range.cc (wide_int_range_abs): New.
* wide-int-range.cc (wide_int_range_abs): New.
(wide_int_range_order_set): Rename from wide_int_range_min_max.
* wide-int-range.h (wide_int_range_abs): New.
(wide_int_range_min_max): New.
* tree-vrp.c (extract_range_from_unary_expr): Rewrite ABS_EXPR
case to call wide_int_range_abs.
Rewrite MIN/MAX_EXPR to call wide_int_range_min_max.
(extract_range_from_abs_expr): Delete.
From-SVN: r263685
GCC Administrator [Tue, 21 Aug 2018 00:16:17 +0000 (00:16 +0000)]
Daily bump.
From-SVN: r263683
Nathan Sidwell [Tue, 21 Aug 2018 00:01:50 +0000 (00:01 +0000)]
[libiberty patch] PEX-unix forking
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01170.html
* pex-unix.c (pex_child_error): Delete.
(pex_unix_exec_child): Commonize error paths to single message &
exit.
From-SVN: r263679
Michael Meissner [Mon, 20 Aug 2018 23:46:37 +0000 (23:46 +0000)]
re PR target/87033 (The compiler does not generate the LWAX instruction)
[gcc]
2018-08-20 Michael Meissner <meissner@linux.ibm.com>
PR target/87033
* config/rs6000/rs6000.md (extendsi<mode>2): Change constraints
from 'Y' to 'YZ' to enable the LWAX instruction to be generated
for indexed loads.
[gcc/testsuite]
2018-08-20 Michael Meissner <meissner@linux.ibm.com>
PR target/87033
* gcc.target/powerpc/pr87033.c: New test.
From-SVN: r263678
Nathan Sidwell [Mon, 20 Aug 2018 23:31:18 +0000 (23:31 +0000)]
[PATCH] fix some build breakage
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01214.html
* config/s390/s390-c (s390_macro_to_expand): Use cpp_macro_p.
* config/spu/spu-c.c (spu_macro_to_expand): Likewise.
Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r263677
Martin Sebor [Mon, 20 Aug 2018 23:03:55 +0000 (23:03 +0000)]
PR tree-optimization/87034 - missing -Wformat-overflow on a sprintf %s with a wide string
gcc/testsuite/ChangeLog:
* gcc.dg/builtin-sprintf-warn-20.c: New test.
From-SVN: r263676
David Malcolm [Mon, 20 Aug 2018 21:06:46 +0000 (21:06 +0000)]
Add support for grouping of related diagnostics (PR other/84889)
We often emit logically-related groups of diagnostics.
A relatively simple case is this:
if (warning_at (body_loc, OPT_Wmultistatement_macros,
"macro expands to multiple statements"))
inform (guard_loc, "some parts of macro expansion are not guarded by "
"this %qs clause", guard_tinfo_to_string (keyword));
where the "note" diagnostic issued by the "inform" call
is guarded by the -Wmultistatement_macros warning.
More complicated examples can be seen in the C++ frontend,
where e.g. print_z_candidates can lead to numerous "note"
diagnostics being emitted.
I'm looking at various ways to improve how we handle such related
diagnostics, but, prior to this patch, there was no explicit
relationship between these diagnostics: the diagnostics subsystem
had no way of "knowing" that these were related.
This patch introduces a simple way to group the diagnostics:
an auto_diagnostic_group class: all diagnostics emitted within
the lifetime of an auto_diagnostic_group instance are logically
grouped.
Hence in the above example, the two diagnostics can be grouped
by simply adding an auto_diagnostic_group instance:
auto_diagnostic_group d;
if (warning_at (body_loc, OPT_Wmultistatement_macros,
"macro expands to multiple statements"))
inform (guard_loc, "some parts of macro expansion are not guarded by "
"this %qs clause", guard_tinfo_to_string (keyword));
Some more awkard cases are of the form:
if (some_condition
&& warning_at (...)
&& more_conditions)
inform (...);
which thus need restructuring to:
if (some_condition)
{
auto_diagnostic_group d;
warning_at (...);
if (more_conditions)
inform (...);
}
so that the lifetime of the auto_diagnostic_group groups the
warning_at and the inform call.
Nesting is handled by simply tracking a nesting depth within the
diagnostic_context.: all diagnostics are treated as grouped until the
final auto_diagnostic_group is popped.
diagnostic.c uses this internally, so that all diagnostics are part of
a group - those that are "by themselves" are treated as being part of
a group with one element.
The diagnostic_context gains optional callbacks for displaying the
start of a group (when the first diagnostic is emitted within it), and
the end of a group (for when the group was non-empty); these callbacks
are unused by default, but a test plugin demonstrates them (and verifies
that the machinery is working).
As noted above, I'm looking at various ways to use the grouping to
improve how we output the diagnostics.
FWIW, I experimented with a more involved implementation, of the form:
diagnostic_group d;
if (d.warning_at (body_loc, OPT_Wmultistatement_macros,
"macro expands to multiple statements"))
d.inform (guard_loc, "some parts of macro expansion are not guarded by "
"this %qs clause", guard_tinfo_to_string (keyword));
which had the advantage of allowing auto-detection of the places where
groups were needed (by converting ::warning_at's return type to bool),
but it was a much more invasive patch, especially when dealing with
the places in the C++ frontend that can emit numerous notes after
an error or warning (and thus having to pass the group around)
Hence I went with this simpler approach.
gcc/c-family/ChangeLog:
PR other/84889
* c-attribs.c (common_handle_aligned_attribute): Add
auto_diagnostic_group instance.
* c-indentation.c (warn_for_misleading_indentation): Likewise.
* c-opts.c (c_common_post_options): Likewise.
* c-warn.c (warn_logical_not_parentheses): Likewise.
(warn_duplicated_cond_add_or_warn): Likewise.
(warn_for_multistatement_macros): Likewise.
gcc/c/ChangeLog:
PR other/84889
* c-decl.c (pushtag): Add auto_diagnostic_group instance.
(diagnose_mismatched_decls): Likewise, in various places.
(warn_if_shadowing): Likewise.
(implicit_decl_warning): Likewise.
(implicitly_declare): Likewise.
(undeclared_variable): Likewise.
(declare_label): Likewise.
(grokdeclarator): Likewise.
(start_function): Likewise.
* c-parser.c (c_parser_declaration_or_fndef): Likewise.
(c_parser_parameter_declaration): Likewise.
(c_parser_binary_expression): Likewise.
* c-typeck.c (c_expr_sizeof_expr): Likewise.
(parser_build_binary_op): Likewise.
(build_unary_op): Likewise.
(error_init): Likewise.
(pedwarn_init): Likewise.
(warning_init): Likewise.
(convert_for_assignment): Likewise.
gcc/cp/ChangeLog:
PR other/84889
* call.c (build_user_type_conversion_1): Add auto_diagnostic_group
instance(s).
(print_error_for_call_failure): Likewise.
(build_op_call_1): Likewise.
(build_conditional_expr_1): Likewise.
(build_new_op_1): Likewise.
(build_op_delete_call): Likewise.
(convert_like_real): Likewise.
(build_over_call): Likewise.
(build_new_method_call_1): Likewise.
(joust): Likewise.
* class.c (check_tag): Likewise.
(finish_struct_anon_r): Likewise.
(one_inherited_ctor): Likewise.
(finalize_literal_type_property): Likewise.
(explain_non_literal_class): Likewise.
(find_flexarrays): Likewise.
(resolve_address_of_overloaded_function): Likewise.
* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
(is_valid_constexpr_fn): Likewise.
(cx_check_missing_mem_inits): Likewise.
* cp-gimplify.c (cp_genericize_r): Likewise.
* cvt.c (maybe_warn_nodiscard): Likewise.
* decl.c (warn_extern_redeclared_static): Likewise.
(check_redeclaration_exception_specification): Likewise.
(check_no_redeclaration_friend_default_args): Likewise.
(duplicate_decls): Likewise.
(redeclaration_error_message): Likewise.
(warn_misplaced_attr_for_class_type): Likewise.
* decl2.c (finish_static_data_member_decl): Likewise.
(no_linkage_error): Likewise.
(cp_warn_deprecated_use): Likewise.
* error.c (qualified_name_lookup_error): Likewise.
* friend.c (make_friend_class): Likewise.
(do_friend): Likewise.
* init.c (perform_member_init): Likewise.
(build_new_1): Likewise.
(build_vec_delete_1): Likewise.
(build_delete): Likewise.
* lex.c (unqualified_name_lookup_error): Likewise.
* name-lookup.c (check_extern_c_conflict): Likewise.
(inform_shadowed): New function.
(check_local_shadow): Add auto_diagnostic_group instances,
replacing goto "inform_shadowed" label with call to subroutine.
(set_local_extern_decl_linkage): Add auto_diagnostic_group
instance(s).
* parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
(cp_parser_namespace_name): Likewise.
* pt.c (check_specialization_namespace): Likewise.
(check_template_variable): Likewise.
(warn_spec_missing_attributes): Likewise.
(check_explicit_specialization): Likewise.
(process_partial_specialization): Likewise.
(lookup_template_class_1): Likewise.
(finish_template_variable): Likewise.
(do_auto_deduction): Likewise.
* search.c (check_final_overrider): Likewise.
(look_for_overrides_r): Likewise.
* tree.c (maybe_warn_parm_abi): Likewise.
* typeck.c (cxx_sizeof_expr): Likewise.
(cp_build_function_call_vec): Likewise.
(cp_build_binary_op): Likewise.
(convert_for_assignment): Likewise.
(maybe_warn_about_returning_address_of_local): Likewise.
* typeck2.c (abstract_virtuals_error_sfinae): Likewise.
(check_narrowing): Likewise.
gcc/ChangeLog:
PR other/84889
* attribs.c (diag_attr_exclusions): Add auto_diagnostic_group instance.
(decl_attributes): Likewise.
* calls.c (maybe_warn_nonstring_arg): Add auto_diagnostic_group
instance.
* cgraphunit.c (maybe_diag_incompatible_alias): Likewise.
* diagnostic-core.h (class auto_diagnostic_group): New class.
* diagnostic.c (diagnostic_initialize): Initialize the new fields.
(diagnostic_report_diagnostic): Handle the first diagnostics within
a group.
(emit_diagnostic): Add auto_diagnostic_group instance.
(inform): Likewise.
(inform_n): Likewise.
(warning): Likewise.
(warning_at): Likewise.
(warning_n): Likewise.
(pedwarn): Likewise.
(permerror): Likewise.
(error): Likewise.
(error_n): Likewise.
(error_at): Likewise.
(sorry): Likewise.
(fatal_error): Likewise.
(internal_error): Likewise.
(internal_error_no_backtrace): Likewise.
(auto_diagnostic_group::auto_diagnostic_group): New ctor.
(auto_diagnostic_group::~auto_diagnostic_group): New dtor.
* diagnostic.h (struct diagnostic_context): Add fields
"diagnostic_group_nesting_depth",
"diagnostic_group_emission_count", "begin_group_cb",
"end_group_cb".
* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior):
Add auto_diagnostic_group instance(s).
(find_explicit_erroneous_behavior): Likewise.
* gimple-ssa-warn-alloca.c (pass_walloca::execute): Likewise.
* gimple-ssa-warn-restrict.c (maybe_diag_offset_bounds): Likewise.
* gimplify.c (warn_implicit_fallthrough_r): Likewise.
(gimplify_va_arg_expr): Likewise.
* hsa-gen.c (HSA_SORRY_ATV): Likewise.
(HSA_SORRY_AT): Likewise.
* ipa-devirt.c (compare_virtual_tables): Likewise.
(warn_odr): Likewise.
* multiple_target.c (expand_target_clones): Likewise.
* opts-common.c (cmdline_handle_error): Likewise.
* reginfo.c (globalize_reg): Likewise.
* substring-locations.c (format_warning_n_va): Likewise.
* tree-inline.c (expand_call_inline): Likewise.
* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise.
* tree-ssa-loop-niter.c
(do_warn_aggressive_loop_optimizations): Likewise.
* tree-ssa-uninit.c (warn_uninit): Likewise.
* tree.c (warn_deprecated_use): Likewise.
gcc/testsuite/ChangeLog:
PR other/84889
* gcc.dg/plugin/diagnostic-group-test-1.c: New test.
* gcc.dg/plugin/diagnostic_group_plugin.c: New test.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new tests.
From-SVN: r263675
H.J. Lu [Mon, 20 Aug 2018 19:14:04 +0000 (19:14 +0000)]
x86: Always update EH return address in word_mode
On x86, return address is always popped in word_mode. eh_return needs
to put EH return address in word_mode on stack.
gcc/
PR target/87014
* config/i386/i386.md (eh_return): Always update EH return
address in word_mode.
gcc/testsuite/
PR target/87014
* g++.dg/torture/pr87014.C: New file.
From-SVN: r263672
Chung-Lin Tang [Mon, 20 Aug 2018 18:32:06 +0000 (18:32 +0000)]
targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when TARGET_SPLIT_COMPLEX_ARG is defined.
* targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when
TARGET_SPLIT_COMPLEX_ARG is defined.
From-SVN: r263671
Nathan Sidwell [Mon, 20 Aug 2018 17:45:42 +0000 (17:45 +0000)]
[CPP PATCH] node field bits
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01171.html
* include/cpplib.h: Fixup some whitespace.
(cpp_hashnode): Reduce type to 2 bit & flags to 8.
From-SVN: r263669
Nathan Sidwell [Mon, 20 Aug 2018 16:32:29 +0000 (16:32 +0000)]
[CPP PATCH] node type
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01164.html
* include/cpplib.h (NODE_BUILTIN, NODE_MACRO_ARG): Delete.
Renumber others.
(enum node_type): Replace NT_MACRO with NT_USER_MACRO,
NT_BUILTIN_MACRO, NT_MACRO_ARG. Delete NT_ASSERTION.
(NTV_MACRO, NTV_ANSWER, NTV_BUILTIN, NTV_ARGUMENT, NTV_NONE):
Delete.
(CPP_HASHNODE_VALUE_IDX): Delete.
(union _cpp_hashnode_value): GTY tag from enum node_type directly.
(struct cpp_hashnode): Adjust GTY desc for value field.
(cpp_user_macro_p, cpp_builtin_macro_p, cpp_macro_p): Adjust.
* directives.c (undefine_macros): Clear value.anwers, adjust flag
clearing.
(_cpp_test_assertion): No need to check NT_ASSERTION.
(do_assert, do_unassert): Likewise.
* init.c (cpp_init_special_builtins): Set type not flags.
* macro.c (struct macro_arg_saved_data): Add type field.
(cpp_get_token_1): Check type not NT_VOID.
(_cpp_free_definition): Adjust flag clearing. Nullify
value.answers.
(_cpp_save_parameter, _cpp_unsave_parameters): Save and restore
type.
(lex_expansion_token): Check type not flags.
(_cpp_create_definition): Set type to NT_USER_MACRO.
(_cpp_notify_macro_use): Adjust type checking.
* pch.c (write_macdef, count_defs, write_defs, cpp_valid_state)
(save_macros): Adjust node type/flag handling.
* traditional.c (_cpp_scan_out_logical_line): Check type not flags.
From-SVN: r263667
Nathan Sidwell [Mon, 20 Aug 2018 15:28:15 +0000 (15:28 +0000)]
[CPP PATCH] Fix warning & other cleanups.
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01162.html
* directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
* include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
(cpp_fun_like_macro_p): Make inline, define.
* macro.c (cpp_define_lazily): Use UCHAR_MAX.
(cpp_fun_like_macro_p): Delete.
From-SVN: r263666
Bernd Edlinger [Mon, 20 Aug 2018 15:01:04 +0000 (15:01 +0000)]
expr.c (store_field): Change gcc_assert to gcc_checking_assert.
2018-08-20 Bernd Edlinger <bernd.edlinger@hotmail.de>
* expr.c (store_field): Change gcc_assert to gcc_checking_assert.
From-SVN: r263665
Bernd Edlinger [Mon, 20 Aug 2018 14:20:59 +0000 (14:20 +0000)]
re PR target/86984 (invalid relocation accessing a const char array)
PR target/86984
* expr.c (expand_assignment): Assert that bitpos is positive.
(store_field): Likewise
(expand_expr_real_1): Make sure that bitpos is positive.
* config/alpha/alpha.h (CONSTANT_ADDRESS_P): Avoid signed
integer overflow.
PR target/86984
* gcc.target/alpha/pr86984.c: New test.
From-SVN: r263664
Nathan Sidwell [Mon, 20 Aug 2018 14:20:04 +0000 (14:20 +0000)]
[PATCH] Kill cpp-id-data.h
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01149.html
libcpp/
* Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h.
* include/cpp-id-data.h: Delete.
* internal.h: Include cpplib.h not cpp-id-data.h.
gcc/
* Makefile.in (CPP_ID_DATA_H): Delete.
(CPP_INTERNAL_H): Don't add it.
(GTFILES): Replace CPP_ID_DATA_H with CPPLIB_H.
* gengtype.c (open_base_files): Replace cpp-id-data.h with cpplib.h
From-SVN: r263663
Richard Biener [Mon, 20 Aug 2018 14:01:05 +0000 (14:01 +0000)]
re PR c++/78655 (gcc doesn't exploit the fact that the result of pointer addition can not be nullptr)
2018-08-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/78655
* tree-vrp.c (extract_range_from_binary_expr_1): Make
pointer + offset nonnull if either operand is nonnull work.
* gcc.dg/tree-ssa/evrp11.c: New testcase.
From-SVN: r263662
Jonathan Wakely [Mon, 20 Aug 2018 13:53:56 +0000 (14:53 +0100)]
PR libstdc++/86963 Remove use of __tuple_base in std::tuple
The _Tuple_impl base class can be used to disable copy/move assignment,
without requiring an extra base class.
Exception specifications on std::tuple assignment and swap functions can
be defined directly using is_nothrow_swappable, instead of querying the
base classes.
PR libstdc++/86963
* include/std/tuple (_Tuple_impl::operator=): Define as deleted.
(_Tuple_impl::_M_assign): New functions to perform assignment instead
of assignment operators.
(_Tuple_impl::_M_swap): Remove exception specification.
(_Tuple_impl<_Idx, _Head>): Likewise.
(_TC::_NonNestedTuple, _TC::_NotSameTuple): Use __remove_cvref_t.
(__tuple_base): Remove.
(tuple, tuple<_T1, _T2>): Remove inheritance from __tuple_base.
(tuple::operator=, tuple<_T1, _T2>::operator=): Call _M_assign.
(tuple::swap, tuple<_T1, _T2>::swap): Define exception specification
using __is_nothrow_swappable.
(tuple<_T1, _T2>::tuple(_U1&&, _U2&&)): Use __remove_cvref_t.
From-SVN: r263661
Tom de Vries [Mon, 20 Aug 2018 13:52:29 +0000 (13:52 +0000)]
[debug] Fix handling of vlas in lto
Atm, when running vla-1.c with -O0 -flto, we have:
...
FAIL: gcc.dg/guality/vla-1.c -O0 -flto -fuse-linker-plugin \
-fno-fat-lto-objects line 17 sizeof (a) == 6
...
The vla a[i + 1] in f1 is gimplified into:
...
f1 (int i)
{
char a[0:D.1922] [value-expr: *a.0];
char[0:D.1922] * a.0;
D.1921 = i + 1;
D.1926 = (sizetype) D.1921;
a.0 = __builtin_alloca_with_align (D.1926, 8);
...
The early debug info for the upper bound of the type of vla a that we stream
out is:
...
DIE 0: DW_TAG_subrange_type (0x7f85029a90f0)
DW_AT_upper_bound: location descriptor:
(0x7f85029a9230) DW_OP_GNU_variable_value die -> 0 (0x7f85029a94b0), 0
DIE 0: DW_TAG_variable (0x7f85029a94b0)
DW_AT_name: "D.1922"
DW_AT_type: die -> 0 (0x7f85029a3d70)
DW_AT_artificial: 1
...
and in ltrans we have for that same upper bound:
...
DIE 0: DW_TAG_subrange_type (0x7f5183b57d70)
DW_AT_upper_bound: die -> 0 (0x7f5183b576e0)
DIE 0: DW_TAG_variable (0x7f5183b576e0)
DW_AT_name: "D.4278"
DW_AT_abstract_origin: die -> label: vla_1.c.
6719312a + 193 (0x7f5183b57730)
...
where D.4278 has abstract origin D.1922.
The D.4278 die has no DW_AT_location, so when evaluting "sizeof (a)" in the
debugger, we can't find the information to get the value of D.4278, and the
debugger prints "<optimized out>".
This patch fixes that by either:
- adding DW_AT_location to the referenced variable die, or
- instead of using a ref for the upper bound, using an exprloc.
When changing gcc.dg/guality/guality.exp to run the usual flto flavours
"-fno-use-linker-plugin -flto-partition=none" and "-fuse-linker-plugin
-fno-fat-lto-objects" in combination with O0, Og, O1, O2, O3 and Os, this patch
fixes all (20) failures in vla-1.c, leaving only:
...
No symbol "i" in current context.
UNSUPPORTED: gcc.dg/guality/vla-1.c -O3 -flto -fno-use-linker-plugin \
-flto-partition=none line 17 i == 5
'a' has unknown type; cast it to its declared type
UNSUPPORTED: gcc.dg/guality/vla-1.c -O3 -flto -fno-use-linker-plugin \
-flto-partition=none line 17 sizeof (a) == 6
...
Bootstrapped and reg-tested on x86_64.
2018-08-20 Tom de Vries <tdevries@suse.de>
* dwarf2out.c (add_scalar_info): Don't add reference to existing die
unless the referenced die describes the added property using
DW_AT_location or DW_AT_const_value. Fall back to exprloc case.
Otherwise, add a DW_AT_location to the referenced die.
From-SVN: r263660
Nathan Sidwell [Mon, 20 Aug 2018 12:39:36 +0000 (12:39 +0000)]
[PATCH] #assert becomes macro-like
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01140.html
libcpp/
* include/cpp-id-data.h (struct answer): Delete.
* include/cpplib.h (struct answer): Don't forward-declare.
(enum cpp_macro_kind): Add cmk_assert.
(struct cpp_macro): Union parms and next assert chain.
(union _cpp_hashnode_value): 'answer' field is cpp_macro.
* directives.c (parse_answer): Convert to use cpp_macro. Return
true on success.
(parse_assertion, find_answer, _cpp_test_assertion, cpp_do_assert)
(cpp_do_unassert): Convert to use cpp_macro.
* macro.c (warn_of_redefinition, _cpp_new_macro)
(check_trad_stringification, cpp_macro_definition): Adjust macro
parm access.
* traditional.c (_cpp_replacement_text_len)
(_cpp_copy_replacement_text, _cpp_create_trad_definition): Likewise.
gcc/c-family/
* c-ada-spec.c (macro_length, dump_ada_macros): Adjust macro parm
access.
From-SVN: r263658
Jonathan Wakely [Mon, 20 Aug 2018 12:13:25 +0000 (13:13 +0100)]
Refactor std::optional SFINAE constraints
* include/std/optional (_Optional_payload): Use variable templates
for conditions in default template arguments and exception
specifications.
(optional): Likewise. Adjust indentation.
(optional::__not_self, optional::__not_tag, optional::_Requires): New
SFINAE helpers.
(optional::optional): Use new helpers in constructor constraints.
* include/std/type_traits (__or_v, __and_v): New variable templates.
* testsuite/20_util/optional/cons/value_neg.cc: Change dg-error to
dg-prune-output. Remove unused header.
From-SVN: r263657
GCC Administrator [Mon, 20 Aug 2018 00:16:26 +0000 (00:16 +0000)]
Daily bump.
From-SVN: r263656