Richard Biener [Fri, 7 Oct 2016 10:06:24 +0000 (10:06 +0000)]
bitmap.c (bitmap_elem_to_freelist): Set indx to -1.
2016-10-07 Richard Biener <rguenther@suse.de>
* bitmap.c (bitmap_elem_to_freelist): Set indx to -1.
* bitmap.h (bmp_iter_set): When advancing to the next element
check that we didn't remove the current one.
(bmp_iter_and): Likewise.
(bmp_iter_and_compl): Likewise.
* tree-ssa.c (release_defs_bitset): Do not remove worklist bit
we currently iterate on but keep a one-level queue.
* sched-deps.c (remove_from_deps): Do not clear current bit
but keep a one-level queue.
Jakub Jelinek [Fri, 7 Oct 2016 09:33:47 +0000 (11:33 +0200)]
re PR tree-optimization/77664 (Missed optimization: signed int >= 0 && < unsigned short)
PR tree-optimization/77664
* tree-ssa-reassoc.c (update_range_test): Also clear low and high
for the other ranges.
(optimize_range_tests_diff): Fix up formatting.
(optimize_range_tests_var_bound): New function.
(optimize_range_tests): Use it.
* gcc.dg/tree-ssa/pr77664.c: New test.
* gcc.dg/pr77664.c: New test.
During the lowering phase, the variable arguments to a varargs call are
packaged up into a temporary slice object; the storage for this slice
was being unconditionally allocated on the heap. Heap allocation is not
necessary, however, if the varargs call correspond to an "append", since
the append runtime routine only reads the slice storage (as opposed to
stashing away the storage pointer). Enhance the lowering code to keep
the slice storage on the stack for append() calls, to improve
performance.
Jason Merrill [Thu, 6 Oct 2016 21:24:40 +0000 (17:24 -0400)]
C++17 copy elision improvements.
* call.c (build_temp, convert_like_real): Don't re-copy
TARGET_EXPR. Handle packed fields.
(build_x_va_arg): Wrap it in a TARGET_EXPR.
(build_over_call): Add sanity check.
* cvt.c (early_elide_copy): New.
(ocp_convert): Use it.
* except.c (build_throw): Use it.
* init.c (get_nsdmi): Put back the TARGET_EXPR.
(expand_default_init): Call early_elide_copy.
* typeck.c (cp_build_modify_expr): Call early_elide_copy.
Jonathan Wakely [Thu, 6 Oct 2016 21:22:35 +0000 (22:22 +0100)]
Make std::scoped_allocator_adaptor's OUTERMOST recursive
* doc/xml/manual/status_cxx2011.xml: Update status.
* include/std/scoped_allocator (__outer_allocator_t, __outermost_type):
New helpers for recursive OUTERMOST.
(__outermost): Use __outermost_type::_S_outermost.
(__do_outermost, scoped_allocator_adaptor::__outermost_type): Remove.
(scoped_allocator_adaptor::__outermost_alloc_traits): Use new
__outermost_type helper.
* testsuite/20_util/scoped_allocator/outermost.cc: New test.
Richard Biener [Thu, 6 Oct 2016 12:17:53 +0000 (12:17 +0000)]
re PR tree-optimization/77855 (wrong code at -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes))
2016-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77855
* tree-ssa-pre.c (prune_clobbered_mems): Queue exprs to remove
instead of removing the current item while iterating over the set
which is not safe.
James Clarke [Thu, 6 Oct 2016 10:28:23 +0000 (10:28 +0000)]
re PR target/77759 (ICE in function_arg_record_value on nested empty class)
PR target/77759
* config/sparc/sparc.c (classify_data_t): Remove int_regs field.
(classify_registers): Don't set it
(function_arg_slotno): Don't initialize and test it. Tidy up.
Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>
From-SVN: r240830
Martin Liska [Thu, 6 Oct 2016 07:34:23 +0000 (09:34 +0200)]
Add -fprofile-update option juggling
* gcc.c: Set -fprofile-update=atomic when profiling is
enabled and -pthread is set. Warn when one combines
-pthread and -fprofile-update=single for an app using
profiling code.
There was a bug in the escape analysis that would cause
the slice implicitly created to hold varargs parameters to always
escape, as well as the appended to slice argument. The intended
behavior was that the elements of the appendee and appended to
slice would escape to the heap. Alongside of these issues,
the varargs slice would also have a chance to be initialized to an
invalid memory location if it were stack-allocated. This has been
fixed as well.
Steven G. Kargl [Wed, 5 Oct 2016 21:14:14 +0000 (21:14 +0000)]
re PR fortran/58991 (ICE with associate and character string constant)
2016-10-05 Steven G. Kargl <kargls@gcc.gnu.org>
PR fortran/58991
PR fortran/58992
* resolve.c (resolve_assoc_var): Fix CHARACTER type-spec for a
selector in ASSOCIATE.
(resolve_fl_variable): Skip checks for an ASSOCIATE variable.
2016-10-05 Steven G. Kargl <kargls@gcc.gnu.org>
PR fortran/58991
PR fortran/58992
* gfortran.dg/associate_22.f90: New test.
Jakub Jelinek [Wed, 5 Oct 2016 19:03:28 +0000 (21:03 +0200)]
re PR sanitizer/66343 ("Error: .Lubsan_type3 already defined" with UBSan and precompiled headers)
PR sanitizer/66343
* ubsan.c (ubsan_ids): New GTY(()) array.
(ubsan_type_descriptor, ubsan_create_data): Use ubsan_ids
instead of static local counters.
* gcc.dg/pch/pr66343-1.c: New test.
* gcc.dg/pch/pr66343-1.hs: New file.
* gcc.dg/pch/pr66343-2.c: New test.
* gcc.dg/pch/pr66343-2.hs: New file.
Marek Polacek [Wed, 5 Oct 2016 18:02:06 +0000 (18:02 +0000)]
Implement P0305R1, Selection statements with initializer.
* cp-array-notation.c (create_an_loop): Call finish_init_stmt
instead of finish_for_init_stmt.
* cp-tree.h (finish_for_init_stmt): Rename to finish_init_stmt.
* decl.c (poplevel): Adjust a comment.
* init.c (build_vec_init): Call finish_init_stmt instead of
finish_for_init_stmt.
* name-lookup.c (pushdecl_maybe_friend_1): Adjust a comment.
* name-lookup.h (enum scope_kind): Likewise.
* parser.c (cp_parser_statement): Update commentary.
(cp_parser_init_statement_p): New function.
(cp_parser_selection_statement): Parse the optional init-statement.
(cp_parser_for): Call finish_init_stmt instead of finish_for_init_stmt.
(cp_parser_c_for): Likewise.
(cp_convert_range_for): Call finish_init_stmt instead of finish_for_init_stmt.
(cp_parser_range_for_member_function): Update commentary.
(cp_parser_iteration_statement):
(cp_parser_for_init_statement): Rename to cp_parser_init_statement.
* pt.c (tsubst_omp_for_iterator): Update commentary.
(tsubst_expr): Call finish_init_stmt instead of finish_for_init_stmt.
* semantics.c (finish_for_init_stmt): Rename to finish_init_stmt.
Update commentary.
* g++.dg/cpp1z/init-statement1.C: New test.
* g++.dg/cpp1z/init-statement2.C: New test.
* g++.dg/cpp1z/init-statement3.C: New test.
* g++.dg/cpp1z/init-statement4.C: New test.
* g++.dg/cpp1z/init-statement5.C: New test.
* g++.dg/cpp1z/init-statement6.C: New test.
* g++.dg/cpp1z/init-statement7.C: New test.
* g++.dg/cpp1z/init-statement8.C: New test.
The test assumes ints are atleast 32 bits wide. For the avr
target, ints are 16 bits wide. This leads VRP to conclude
that a right shift by 9 followed by an equality comparison
to 0x74 can never be true. VRP eliminates the conditional, and
the code ends up unconditionally calling __builtin_abort.
Fixed the testcase to use __INT32_TYPE__ for targets with less
than 32 bit wide integers, wherever the size happens to be
significant.
Kelvin Nilsen [Wed, 5 Oct 2016 12:36:48 +0000 (12:36 +0000)]
re PR target/77847 (PowerPC big endian power7/power8 do not bootstrap due to fall through error)
libcpp/ChangeLog:
2016-10-04 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR target/77847
* lex.c (search_line_fast): Add a FALLTHROUGH comment to correct
compiler error in the version of this function that is
conditionally compiled when GCC_VERSION >= 4005 and both
__ALTIVEC__ and __BIG_ENDIAN__ symbols are defined.
Jonathan Wakely [Wed, 5 Oct 2016 12:01:36 +0000 (13:01 +0100)]
PR 70564 disambiguate constructors for not_fn call wrapper
PR libstdc++/70564
* include/experimental/functional (_Not_fn): Remove.
(not_fn): Use std::_Not_fn.
* include/std/functional (_Not_fn): Add second parameter to
disambiguate copying from initialization by not_fn. Define for C++14.
(not_fn): Add second argument to initialization.
* testsuite/20_util/not_fn/1.cc: Copy call wrapper using
direct-initialization.
Richard Biener [Wed, 5 Oct 2016 11:38:59 +0000 (11:38 +0000)]
re PR target/77826 (ICE in decompose, at wide-int.h:928 w/ -m64 -O2 and above)
2016-10-05 Richard Biener <rguenther@suse.de>
PR middle-end/77826
* genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p
with types_match for GIMPLE code gen to handle type mismatched
constants properly.
(dt_operand::gen): Adjust.
* match.pd ((X /[ex] A) * A -> X): Properly handle converted
and constant A.
DWARF: move pessimistic DWARF version checks for imported entities
A check in dwarf2out_imported_module_or_decl prevents
DW_TAG_imported_module from being emitted as it was introduced in the
DWARFv3 standard. However, this also prevents valid strict DWARFv2
constructs such as DW_TAG_imported_declaration from being emitted in
dwarf2out_imported_module_or_decl_1.
The latter already protects the emission of newer DWARF tags with
appropriate checks, so the one in the former is redundant and
pessimistic. This function is already called from places like
process_scope_var, which are not protected anyway.
This patch moves the check in dwarf2out_imported_module_or_decl so that
in strict DWARFv2 mode, tags like DW_TAG_imported_declaration are
emitted while DW_TAG_imported_module are not.
gcc/
* dwarf2out.c (dwarf2out_imported_module_or_decl): Move DWARF
version check to protect only DW_TAG_imported_module generation.
gcc/testsuite/
* gnat.dg/debug7.adb, gnat.dg/debug7.ads: New testcase.
Martin Sebor [Tue, 4 Oct 2016 23:00:42 +0000 (23:00 +0000)]
builtin-sprintf-warn-1.c: Cast int argument to %lc directive to wint_t to silence -Wformat warnings on...
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Cast int argument to
%lc directive to wint_t to silence -Wformat warnings on targets
where the latter is a distinct type such as long.
Jason Merrill [Tue, 4 Oct 2016 20:42:58 +0000 (16:42 -0400)]
Implement P0091R2, Template argument deduction for class templates.
* parser.c (cp_parser_simple_type_specifier): Parse class placeholder.
Use the location of the beginning of the type-specifier.
(cp_parser_init_declarator): Parse deduction guide.
(cp_parser_diagnose_invalid_type_name): Mention class deduction.
(cp_parser_type_id_1): Don't accept class placeholder as template arg.
* cp-tree.h (CLASS_PLACEHOLDER_TEMPLATE): New.
* decl.c (grokdeclarator): Check for uninitialized auto here.
(start_decl_1): Not here.
(cp_finish_decl): Or here. Don't collapse a list when doing
class deduction.
(grokfndecl): Check deduction guide scope and body.
* error.c (dump_decl, dump_function_decl, dump_function_name):
Handle deduction guides.
* pt.c (make_template_placeholder, do_class_deduction): New.
(build_deduction_guide, rewrite_template_parm): New.
(dguide_name, dguide_name_p, deduction_guide_p): New.
(do_auto_deduction): Call do_class_deduction.
(splice_late_return_type, is_auto): Handle class placeholders.
(template_parms_level_to_args): Split from template_parms_to_args.
(tsubst_template_parms_level): Split from tsubst_template_parms.
* typeck2.c (build_functional_cast): Handle class placeholder.
Jakub Jelinek [Tue, 4 Oct 2016 15:34:16 +0000 (17:34 +0200)]
re PR c++/77791 (ICE on invalid C++11 code with redefined function parameter: tree check: expected tree that contains ‘decl minimal’ structure, have ‘error_mark’ in cp_parser_lambda_declarator_opt, at cp/parser.c:1011)
PR c++/77791
* parser.c (cp_parser_lambda_declarator_opt): Only pedwarn
for C++11 on decls in the param_list. Test cxx_dialect < cxx14 before
the loop just once.
Doug Gilmore [Tue, 4 Oct 2016 15:28:23 +0000 (15:28 +0000)]
re PR tree-optimization/77808 (ICE in duplicate_ssa_name_ptr_info, at tree-ssanames.c:630 starting with r240439)
Fix PR tree-optimization/77808
gcc/
PR tree-optimization/77808
* tree-ssa-loop-prefetch.c (issue_prefetch_ref): Check base_addr
and addr are different before copying points-to information.
gcc/testsuite/
PR tree-optimization/77808
* gcc.dg/tree-ssa/pr77808.c: New testcase.
Jeff Law [Mon, 3 Oct 2016 19:28:24 +0000 (13:28 -0600)]
re PR tree-optimization/71550 (wrong code at -O3 on x86_64-linux-gnu)
PR tree-optimization/71550
PR tree-optimization/71403
* tree-ssa-threadbackward.c: Include tree-vectorizer.h
(profitable_jump_thread_path): Also return boolean indicating if
the realized path will create an irreducible loop.
Remove loop depth tests from 71403.
(fsm_find_control_statement_thread_paths): Remove loop depth tests
from 71403. If threading will create an irreducible loop, then
throw away loop iteration and related information.
PR tree-optimization/71550
PR tree-optimization/71403
* gcc.c-torture/execute/pr71550.c: New test.
The Go runtime package is picking up C macros from runtime_sysinfo.go
and then re-exporting them to runtime.inc. This can cause name
conflicts. Change the Makefile so that we only put the macros we need
into runtime.inc. These are the constants that are actually defined by
Go code, not runtime_sysinfo.go. There are only a few, so we can
pattern match.
This is an additional hack on runtime.inc. The long term goal is to
convert the runtime package to Go and eliminate runtime.inc entirely, so
a few hacks seem acceptable.