Edit the C++14 library warning header to not indicate experimental.
Since the default is C++14 it seems apropos to *not* treat that C++ version thusly in the warning in libstdc++. Ed OK for trunk? And maybe some 6 branch later? 2016-04-17 Edward Smith-Rowland <3dw...@verizon.net> * include/bits/c++14_warning.h: Do not refer C++14 as experimental. Index: include/bits/c++14_warning.h === --- include/bits/c++14_warning.h(revision 235086) +++ include/bits/c++14_warning.h(working copy) @@ -29,9 +29,9 @@ #define _CXX14_WARNING_H 1 #if __cplusplus <= 201103L -#error This file requires compiler and library support for the forthcoming \ -ISO C++ 2014 standard. This support is currently experimental, and must be \ -enabled with the -std=c++1y or -std=gnu++1y compiler options. +#error This file requires compiler and library support \ +for the ISO C++ 2014 standard. This support must be enabled \ +with the -std=c++14 or -std=gnu++14 compiler options. #endif #endif
Re: [PATCH] Reuse the saved_scope structures allocated by push_to_top_level
On Thu, Mar 3, 2016 at 9:16 AM, Patrick Palka wrote: > push_to_top_level gets called fairly frequently in template-heavy code > that performs a lot of instantiations, and we currently "leak" a lot of > GC memory when compiling such code since [push|pop]_to_top_level() do > not bother reusing or even freeing each saved_scope structure it > allocates. > > This patch makes push_to_top_level() reuse the saved_scope structures it > allocates. This is similar to how begin_scope() reuses the > cp_binding_level structures it allocates. > > This patch reduces the maximum memory usage of the compiler by 4.5%, > from 525MB to 500MB, when compiling the Boost::Fusion test file > libs/fusion/test/compile_time/transform.cpp from the Boost 1.60 testsuite. > > Bootstrapped and tested on x86_64-pc-linux-gnu, OK for > trunk or for GCC 7? > > gcc/cp/ChangeLog: > > * name-lookup.c (free_saved_scope): New free list of saved_scope > structures. > (push_to_top_level): Attempt to reuse a saved_scope struct > from free_saved_scope instead of allocating a new one each time. > (pop_from_top_level_1): Chain the now-unused saved_scope structure > onto free_saved_scope. > --- > gcc/cp/name-lookup.c | 25 - > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c > index 89d84d7..3478b6a 100644 > --- a/gcc/cp/name-lookup.c > +++ b/gcc/cp/name-lookup.c > @@ -6134,6 +6134,10 @@ store_class_bindings (vec > *names, >timevar_cond_stop (TV_NAME_LOOKUP, subtime); > } > > +/* A chain of saved_scope structures awaiting reuse. */ > + > +static GTY((deletable)) struct saved_scope *free_saved_scope; > + > void > push_to_top_level (void) > { > @@ -6144,7 +6148,21 @@ push_to_top_level (void) >bool need_pop; > >bool subtime = timevar_cond_start (TV_NAME_LOOKUP); > - s = ggc_cleared_alloc (); > + > + /* Reuse or create a new structure for this saved scope. */ > + if (free_saved_scope != NULL) > +{ > + s = free_saved_scope; > + free_saved_scope = s->prev; > + > + vec *old_bindings = s->old_bindings; > + memset (s, 0, sizeof (*s)); > + /* Also reuse the structure's old_bindings vector. */ > + vec_safe_truncate (old_bindings, 0); > + s->old_bindings = old_bindings; > +} > + else > +s = ggc_cleared_alloc (); > >b = scope_chain ? current_binding_level : 0; > > @@ -6237,6 +6255,11 @@ pop_from_top_level_1 (void) >current_function_decl = s->function_decl; >cp_unevaluated_operand = s->unevaluated_operand; >c_inhibit_evaluation_warnings = s->inhibit_evaluation_warnings; > + > + /* Make this saved_scope structure available for reuse by > + push_to_top_level. */ > + s->prev = free_saved_scope; > + free_saved_scope = s; > } > > /* Wrapper for pop_from_top_level_1. */ > -- > 2.8.0.rc0.11.g9bfbc33 > Ping.
Re: [PATCH][combine] Check WORD_REGISTER_OPERATIONS normally rather than through preprocessor
On 12/15/2015 10:07 AM, Kyrill Tkachov wrote: Hi all, As part of the war on conditional compilation here's an #if check on WORD_REGISTER_OPERATIONS that seems to have been missed out. Bootstrapped and tested on arm, aarch64, x86_64. Is it still ok to commit these kinds of conditional compilation conversions? Thanks, Kyrill 2015-12-15 Kyrylo Tkachov * combine.c (simplify_comparison): Convert preprocessor check of WORD_REGISTER_OPERATIONS into runtime check. This patch, and others like it are fine for the trunk (gcc-7) again. I'll channel the release managers' request that we don't make large scale changes that would make backporting patches exceedingly difficult. So just keep that in mind if you find more conditionally compiled code to kill. jeff
Re: [PATCH 3/5] Fix NOTE_INSN_PROLOGUE_END after unconditional jump.
On 01/02/2016 12:16 PM, Marcin Kościelnicki wrote: With the new s390 split-stack support, when optimization is enabled, the cold path of calling __morestack is likely to be moved to the end of the function. This will result in the function ending in split_stack_call_esa, which is an unconditional jump instruction and part of the function prologue. reposition_prologue_and_epilogue_notes will insert NOTE_INSN_PROLOGUE_END right after it (and before the following barrier), causing a verification error. Insert it after the barrier instead (and outside of basic block). gcc/ChangeLog: * function.c (reposition_prologue_and_epilogue_notes): Avoid verification error if the last insn of prologue is an unconditional jump. --- gcc/ChangeLog | 6 ++ gcc/function.c | 6 ++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6aef3f9..56e31f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-01-02 Marcin Kościelnicki + * function.c (reposition_prologue_and_epilogue_notes): Avoid + verification error if the last insn of prologue is an unconditional + jump. I'm guessing the BARRIER is actually in the hash table of prologue insns? Oh how I wish we didn't express barriers rtl. Can this leave NOTEs with no associated basic block in the chain? reorder_blocks only fixes the block boundaries, it doesn't fix BLOCK_FOR_INSN. Jeff
Re: [PING] genattrab.c generate switch
On 03/04/2016 08:13 AM, Bernd Schmidt wrote: On 03/04/2016 03:27 PM, Patrick Palka wrote: I still suggest to try making write_test_expr() avoid emitting redundant parentheses for chains of || or &&, which would fix the original issue all the same. Previously you claimed that such a change would not be simpler than your current patch, but I gave it a quick try and ended up with a much smaller patch: This looks like a reasonable stopgap if a release manager thinks this is important enough to fix for gcc-6. Some comments below for that case. Longer term I'm not sure - in theory maybe the switch would allow us to generate better code, but I tried it and code size actually seems to go up (could be jump tables however). I also noticed that in the version with the switch we still have cases of switch (cached_type) { default: switch (cached_type) { } } so that might be a point where the patch could be improved to see if we can get better code generation by collapsing these switches. Might also be worth trying to optimize this pattern in gcc. There's probably a good number of things we could do for this and related scenarios. Essentially DOM and threading are unlikely to do anything with this because the path from the outer case into the inner switch is going to have multiple values associated with cached_type. The backwards threader, if it was presented with SSI rather than SSA could probably untangle it, but I'm not sure we're ready to make the jump to SSI (though it would simplify VRP & DOM). Jeff
Re: Goodbye REG_LIVE_LENGTH
On 03/29/2016 05:36 AM, Bernd Schmidt wrote: On 03/25/2016 11:00 PM, Alan Modra wrote: I'll also prepare a patch to delete REG_LIVE_LENGTH everywhere. Like this. Bootstrapped and regression tested x86_64-linux. OK for stage1? Oh wow that's a lot of stuff removed. Ok for this and the FREQ_CALLS_CROSSED patch. Sweet. I suspect much of this stuff went dead with the IRA merge or at least fainted at that point and died with LRA merge and/or regmove removal. Good to see the cleanups. jeff
Re: Enabling -frename-registers?
On 01/29/2016 10:34 AM, Bernd Schmidt wrote: So PR57193 has an example of sub-optimal code generation, with some unnecessary register moves left after LRA. These seem to be difficult to prevent, but last year Robert Suchanek made some modifications to regrename that allow it to clean up such cases. Enabling -frename-registers removes one of the two unnecessary copies, and I'm pretty sure I could make it eliminate the other one as well with a bit more work. Hence, this patch. The renamer has seen a lot of fixes over the years and should be in pretty good shape IMO. Still, I won't deny that this is a bit riskier than the usual bugfix patch at this stage. Bootstrapped and tested on x86_64-linux, with my earlier patch to fix some i386 tests. Thoughts? Should we do this for gcc-7 at least? invoke.texi has an independent list (probably incomplete! ;( of all the things that -O2 enables. Make sure to add -frename-registers to that list and this is Ok for the trunk (gcc-7). jeff
Re: [PATCH 4/5] Don't mark targets of unconditional jumps with side effects as FALLTHRU.
On 01/02/2016 12:16 PM, Marcin Kościelnicki wrote: When an unconditional jump with side effects targets an immediately following label, rtl_tidy_fallthru_edge is called. Since it has side effects, it doesn't remove the jump, but the label is still marked as fallthru. This later causes a verification error. Do nothing in this case instead. gcc/ChangeLog: * cfgrtl.c (rtl_tidy_fallthru_edge): Bail for unconditional jumps with side effects. OK for the trunk (gcc-7) It may not matter in practice, but you could try ripping out the other wide effects into individual insns and recognizing them. And if that works, then you can proceed to eliminate the jump, marking the fallthru label, etc. I think combine has some code to do similar things. jeff
Fix nothrow discovery WRT interposition
Hi, this patch fixes symmetric bug to pure-const discovery but with nothrow flag when -fnon-call-exceptions is used. In this case we probably can not detect function as nothrow just based on the fact we see no throwing statements because they were possibly optimized out as can be seen in the attached testcase. At least I believe so, but I also tend to recall that in Java it is not valid to optimize out exception or change order of exceptions and I do not know what Ada says here. With C++ this is GNU extensions, so I am not 100% sure this is needed. The testcase attached however behave as expected - the memory access is optimized out and hypothetical other compiler may keep it and throw an exception. In this case I do not think I can reproduce it with clang because as far as I can remember it doesn't support non call exceptions. Again analysys could be improved if we had a way to figure out if the completely unoptimized function body had something that can throw in it. Eric, since Ada is one of main users of non-call exceptions, does this make sense to you? PR ipa/70018 * cgraph.c (cgraph_set_nothrow_flag_1): Rename to ... (set_nothrow_flag_1): ... this; handle interposition correctly; recurse on aliases and thunks. (cgraph_node::set_nothrow_flag): New. * ipa-pure-const.c (ignore_edge_for_nothrow): Ignore calls to functions compiled with non-call exceptions that binds to current def. (propagate_nothrow): Be safe WRT interposition. * cgraph.h (set_nothrow_flag): Update prototype. * g++.dg/ipa/nothrow-1.C: New testcase. Index: cgraph.c === --- cgraph.c(revision 235081) @@ -2358,27 +2363,65 @@ cgraph_node::make_local (void) /* Worker to set nothrow flag. */ -static bool -cgraph_set_nothrow_flag_1 (cgraph_node *node, void *data) +static void +set_nothrow_flag_1 (cgraph_node *node, bool nothrow, bool non_call, + bool *changed) { cgraph_edge *e; - TREE_NOTHROW (node->decl) = data != NULL; - - if (data != NULL) -for (e = node->callers; e; e = e->next_caller) - e->can_throw_external = false; - return false; + if (nothrow && !TREE_NOTHROW (node->decl)) +{ + /* With non-call exceptions we can't say for sure if other function body +was not possibly optimized to stil throw. */ + if (!non_call || node->binds_to_current_def_p ()) + { + TREE_NOTHROW (node->decl) = true; + *changed = true; + for (e = node->callers; e; e = e->next_caller) + e->can_throw_external = false; + } +} + else if (!nothrow && TREE_NOTHROW (node->decl)) +{ + TREE_NOTHROW (node->decl) = false; + *changed = true; +} + ipa_ref *ref; + FOR_EACH_ALIAS (node, ref) +{ + cgraph_node *alias = dyn_cast (ref->referring); + if (!nothrow || alias->get_availability () > AVAIL_INTERPOSABLE) + set_nothrow_flag_1 (alias, nothrow, non_call, changed); +} + for (cgraph_edge *e = node->callers; e; e = e->next_caller) +if (e->caller->thunk.thunk_p + && (!nothrow || e->caller->get_availability () > AVAIL_INTERPOSABLE)) + set_nothrow_flag_1 (e->caller, nothrow, non_call, changed); } /* Set TREE_NOTHROW on NODE's decl and on aliases of NODE if any to NOTHROW. */ -void +bool cgraph_node::set_nothrow_flag (bool nothrow) { - call_for_symbol_thunks_and_aliases (cgraph_set_nothrow_flag_1, - (void *)(size_t)nothrow, nothrow == true); + bool changed = false; + bool non_call = opt_for_fn (decl, flag_non_call_exceptions); + + if (!nothrow || get_availability () > AVAIL_INTERPOSABLE) +set_nothrow_flag_1 (this, nothrow, non_call, &changed); + else +{ + ipa_ref *ref; + + FOR_EACH_ALIAS (this, ref) + { + cgraph_node *alias = dyn_cast (ref->referring); + if (!nothrow || alias->get_availability () > AVAIL_INTERPOSABLE) + set_nothrow_flag_1 (alias, nothrow, non_call, &changed); + } +} + return changed; } /* Worker to set_const_flag. */ @@ -2517,8 +2560,7 @@ cgraph_node::set_const_flag (bool set_co /* Info used by set_pure_flag_1. */ -struct -set_pure_flag_info +struct set_pure_flag_info { bool pure; bool looping; Index: ipa-pure-const.c === --- ipa-pure-const.c(revision 235065) +++ ipa-pure-const.c(working copy) @@ -1163,7 +1161,10 @@ ignore_edge_for_nothrow (struct cgraph_e enum availability avail; cgraph_node *n = e->callee->function_or_virtual_thunk_symbol (&avail, e->caller); - return (avail <= AVAIL_INTERPOSABLE || TREE_NOTHROW (n->decl)); + if (avail <= AVAIL_INTERPOSABLE || TREE_NOTHROW (n->decl)) +return true; + return opt_for_fn (e->callee->decl, flag_non_call_exceptio
Re: [Bug bootstrap/70706] New: [7 Regression] r235082 caused bootstrap failure
> libbackend.a(graphite.o): In function `graphite_finalize(bool)': > /export/gnu/import/git/gcc-test-profiled/bld/gcc/../../src-trunk/gcc/graphite.c:259: > undefined reference to `tree_estimate_probability()' > collect2: error: ld returned 1 exit status > ../../src-trunk/gcc/lto/Make-lang.in:71: recipe for target 'lto1' failed > make[6]: *** [lto1] Error 1 I have comitted the following as obvious. It is not clear to me what graphite is trying to reach here and it will definitly leat to random results with profile feedback (we will likely end up with guessed profile but non-zero counts) but we can deal with that incrementally. PR bootstrap/70706 * graphite.c (graphite_finalize): Update call to tree_estimate_probability. Index: graphite.c === --- graphite.c (revision 235064) +++ graphite.c (working copy) @@ -256,7 +256,7 @@ graphite_finalize (bool need_cfg_cleanup cleanup_tree_cfg (); profile_status_for_fn (cfun) = PROFILE_ABSENT; release_recorded_exits (cfun); - tree_estimate_probability (); + tree_estimate_probability (false); } free_original_copy_tables ();
[PATCH] Fix PR c++/70241 (inconsistent access with in-class enumeration)
When an in-class unscoped enumeration is defined out-of-line its enumerators currently don't inherit the access of the enumeration. This patch makes the access of the enumerations defined out-of-line match the access of the enumerator. Also, we currently don't check that redeclarations of in-class enumerations have the same access, which this patch fixes as well. Bootstrapped + regtested on x86_64-pc-linux-gnu, does this look OK to commit? gcc/cp/ChangeLog: PR c++/70241 * decl.c (build_enumerator): Set current_access_specifier when declaring an enumerator belonging to an in-class enumeration. * parser.c (cp_parser_check_access_in_redecleration): Also consider in-class enumerations. gcc/testsite/ChangeLog: PR c++/70241 * g++.dg/cpp0x/enum32.C: New test. * g++.dg/cpp0x/enum33.C: New test. --- gcc/cp/decl.c | 28 gcc/cp/parser.c | 8 +--- gcc/testsuite/g++.dg/cpp0x/enum32.C | 25 + gcc/testsuite/g++.dg/cpp0x/enum33.C | 11 +++ 4 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum32.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum33.C diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f9f12a7..0f217a5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13694,10 +13694,30 @@ incremented enumerator value is too large for %"); cplus_decl_attributes (&decl, attributes, 0); if (context && context == current_class_type && !SCOPED_ENUM_P (enumtype)) -/* In something like `struct S { enum E { i = 7 }; };' we put `i' - on the TYPE_FIELDS list for `S'. (That's so that you can say - things like `S::i' later.) */ -finish_member_declaration (decl); +{ + /* In something like `struct S { enum E { i = 7 }; };' we put `i' +on the TYPE_FIELDS list for `S'. (That's so that you can say +things like `S::i' later.) */ + + /* The enumerator may be getting declared outside of its enclosing +class, like so: + + class S { public: enum E : int; }; enum S::E : int { i = 7; }; + +For which case we need to make sure that the access of `S::i' +matches the access of `S::E'. */ + tree saved_cas = current_access_specifier; + if (TREE_PRIVATE (TYPE_NAME (enumtype))) + current_access_specifier = access_private_node; + else if (TREE_PROTECTED (TYPE_NAME (enumtype))) + current_access_specifier = access_protected_node; + else + current_access_specifier = access_public_node; + + finish_member_declaration (decl); + + current_access_specifier = saved_cas; +} else pushdecl (decl); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5486129..f782d70 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -27228,13 +27228,15 @@ cp_parser_check_class_key (enum tag_types class_key, tree type) /* Issue an error message if DECL is redeclared with different access than its original declaration [class.access.spec/3]. - This applies to nested classes and nested class templates. - [class.mem/1]. */ + This applies to nested classes, nested class templates and + enumerations [class.mem/1]. */ static void cp_parser_check_access_in_redeclaration (tree decl, location_t location) { - if (!decl || !CLASS_TYPE_P (TREE_TYPE (decl))) + if (!decl + || (!CLASS_TYPE_P (TREE_TYPE (decl)) + && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE)) return; if ((TREE_PRIVATE (decl) diff --git a/gcc/testsuite/g++.dg/cpp0x/enum32.C b/gcc/testsuite/g++.dg/cpp0x/enum32.C new file mode 100644 index 000..9d7a7b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum32.C @@ -0,0 +1,25 @@ +// PR c++/70241 +// { dg-do compile { target c++11 } } + +class A { +public: + enum B : int; +}; + +enum A::B : int { + x +}; + +struct C { +private: +enum D : int; +}; + +enum C::D : int { + y +}; + +int main() { + A::x; + C::y; // { dg-error "private" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum33.C b/gcc/testsuite/g++.dg/cpp0x/enum33.C new file mode 100644 index 000..ac39741 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum33.C @@ -0,0 +1,11 @@ +// PR c++/70241 +// { dg-do compile { target c++11 } } + +class A { +public: + enum B : int; + enum class C : int; +private: + enum B : int { }; // { dg-error "different access" } + enum class C : int { }; // { dg-error "different access" } +}; -- 2.8.1.231.g95ac767
Re: Fix dumping of branch predictor hitrates
On Sun, Apr 17, 2016 at 9:13 AM, Jan Hubicka wrote: > Hi, > this patch fixes infrastructure used by branch prediction code to collect > information about prediction hitrates that is needed to verify their > performance. > > We used to read profile first and then do profile estimation, nowdays passes > are run in the opposite order. Because dumping happens during estimation, we > no longer get the information. This patch simply re-runs the branch > prediction > w/o modifying the profile when -fdump-ipa-profile is used. > > Profile estimation and maintenance code was not very actively developed > in recent years and there are some dead ends. This stage 1 I would like to fix > them, update the APIs to be more robust and use sreals instaed of fixedpoint > arithmetics. > > Bootstrapped/regtested x86_64-linux, comitted. > > Honza > > * predict.c (combine_predictions_for_bb): Add dry_run parmaeter. > (tree_estimate_probability): Likewise. > (pass_profile::execute): Update. > (report_predictor_hitrates): New function. > * profile.c (compute_branch_probabilities): Use it. > * predict.h (report_predictor_hitrates): Declare. > > * analyze_brprob: Update comment. This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70706 -- H.J.
[c-family] Handle qualified pointer parameters with -fdump-ada-spec
This makes the handling of qualified pointer parameters with -fdump-ada-spec more robust and also cleans up a bit the relevant machinery. Tested on x86_64-suse-linux, applied on the mainline. 2016-04-17 Eric Botcazou * c-ada-spec.c (get_underlying_decl): Return the typedef, if any. (dump_generic_ada_node) : Clean up handling of access to incomplete types. (dump_nested_type): Remove redundant tests and tidy up. (print_ada_declaration): Also set TREE_VISITED on the declaration of a type which is the typedef of an original type. 2016-04-17 Eric Botcazou * c-c++-common/dump-ada-spec-3.c: New test. * c-c++-common/dump-ada-spec-4.c: Likewise. -- Eric BotcazouIndex: c-ada-spec.c === --- c-ada-spec.c (revision 235044) +++ c-ada-spec.c (working copy) @@ -892,25 +892,22 @@ static const char *c_duplicates[] = { static tree get_underlying_decl (tree type) { - tree decl = NULL_TREE; - - if (type == NULL_TREE) + if (!type) return NULL_TREE; /* type is a declaration. */ if (DECL_P (type)) -decl = type; +return type; /* type is a typedef. */ if (TYPE_P (type) && TYPE_NAME (type) && DECL_P (TYPE_NAME (type))) -decl = TYPE_NAME (type); +return TYPE_NAME (type); /* TYPE_STUB_DECL has been set for type. */ - if (TYPE_P (type) && TYPE_STUB_DECL (type) && - DECL_P (TYPE_STUB_DECL (type))) -decl = TYPE_STUB_DECL (type); + if (TYPE_P (type) && TYPE_STUB_DECL (type)) +return TYPE_STUB_DECL (type); - return decl; + return NULL_TREE; } /* Return whether TYPE has static fields. */ @@ -2083,37 +2080,25 @@ dump_generic_ada_node (pretty_printer *buffer, tre } else { - /* For now, handle all access-to-access or - access-to-unknown-structs as opaque system.address. */ - tree type_name = TYPE_NAME (TREE_TYPE (node)); - const_tree typ2 = !type || - DECL_P (type) ? type : TYPE_NAME (type); - const_tree underlying_type = - get_underlying_decl (TREE_TYPE (node)); + tree decl = get_underlying_decl (TREE_TYPE (node)); + tree enclosing_decl = get_underlying_decl (type); + /* For now, handle access-to-access, access-to-empty-struct + or access-to-incomplete as opaque system.address. */ if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE - /* Pointer to pointer. */ - || (RECORD_OR_UNION_TYPE_P (TREE_TYPE (node)) - && (!underlying_type - || !TYPE_FIELDS (TREE_TYPE (underlying_type - /* Pointer to opaque structure. */ - - || underlying_type == NULL_TREE - || (!typ2 - && !TREE_VISITED (underlying_type) - && !TREE_VISITED (type_name) - && !is_tagged_type (TREE_TYPE (node)) - && DECL_SOURCE_FILE (underlying_type) - == source_file_base) - || (type_name && typ2 - && DECL_P (underlying_type) - && DECL_P (typ2) - && decl_sloc (underlying_type, true) - > decl_sloc (typ2, true) - && DECL_SOURCE_FILE (underlying_type) - == DECL_SOURCE_FILE (typ2))) + && !TYPE_FIELDS (TREE_TYPE (node))) + || !decl + || (!enclosing_decl + && !TREE_VISITED (decl) + && DECL_SOURCE_FILE (decl) == source_file_base) + || (enclosing_decl + && !TREE_VISITED (decl) + && DECL_SOURCE_FILE (decl) + == DECL_SOURCE_FILE (enclosing_decl) + && decl_sloc (decl, true) + > decl_sloc (enclosing_decl, true))) { if (package_prefix) { @@ -2160,13 +2145,11 @@ dump_generic_ada_node (pretty_printer *buffer, tre } if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (node)) && type_name) - dump_generic_ada_node - (buffer, type_name, - TREE_TYPE (node), spc, is_access, true); + dump_generic_ada_node (buffer, type_name, TREE_TYPE (node), + spc, is_access, true); else - dump_generic_ada_node - (buffer, TREE_TYPE (node), TREE_TYPE (node), - spc, 0, true); + dump_generic_ada_node (buffer, TREE_TYPE (node), + TREE_TYPE (node), spc, 0, true); } } } @@ -2507,13 +2490,12 @@ dump_nested_type (pretty_printer *buffer, tree fie decl = get_underlying_decl (tmp); if (decl - && DECL_P (decl) - && decl_sloc (decl, true) > decl_sloc (t, true) - && DECL_SOURCE_FILE (decl) == DECL_SOURCE_FILE (t) - && !TREE_VISITED (decl) && !DECL_IS_BUILTIN (decl) && (!RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)) - || TYPE_FIELDS (TREE_TYPE (decl + || TYPE_FIELDS (TREE_TYPE (decl))) + && !TREE_VISITED (decl) + && DECL_SOURCE_FILE (decl) == DECL_SOURCE_FILE (t) + && decl_sloc (decl, true) > decl_sloc (t, true)) { /* Generate forward declaration. */ pp_string (buffer, "type "); @@ -2529,10 +2511,7 @@ dump_nested_type (pretty_printer *buffer, tree fie while (TREE_CODE (tmp) == ARRAY_TYPE) tmp = TREE_TYPE (tmp);
New Swedish PO file for 'gcc' (version 6.1-b20160131)
Hello, gentle maintainer. This is a message from the Translation Project robot. A revised PO file for textual domain 'gcc' has been submitted by the Swedish team of translators. The file is available at: http://translationproject.org/latest/gcc/sv.po (This file, 'gcc-6.1-b20160131.sv.po', has just now been sent to you in a separate email.) All other PO files for your package are available in: http://translationproject.org/latest/gcc/ Please consider including all of these in your next release, whether official or a pretest. Whenever you have a new distribution with a new version number ready, containing a newer POT file, please send the URL of that distribution tarball to the address below. The tarball may be just a pretest or a snapshot, it does not even have to compile. It is just used by the translators when they need some extra translation context. The following HTML page has been updated: http://translationproject.org/domain/gcc.html If any question arises, please contact the translation coordinator. Thank you for all your work, The Translation Project robot, in the name of your translation coordinator.
Fix dumping of branch predictor hitrates
Hi, this patch fixes infrastructure used by branch prediction code to collect information about prediction hitrates that is needed to verify their performance. We used to read profile first and then do profile estimation, nowdays passes are run in the opposite order. Because dumping happens during estimation, we no longer get the information. This patch simply re-runs the branch prediction w/o modifying the profile when -fdump-ipa-profile is used. Profile estimation and maintenance code was not very actively developed in recent years and there are some dead ends. This stage 1 I would like to fix them, update the APIs to be more robust and use sreals instaed of fixedpoint arithmetics. Bootstrapped/regtested x86_64-linux, comitted. Honza * predict.c (combine_predictions_for_bb): Add dry_run parmaeter. (tree_estimate_probability): Likewise. (pass_profile::execute): Update. (report_predictor_hitrates): New function. * profile.c (compute_branch_probabilities): Use it. * predict.h (report_predictor_hitrates): Declare. * analyze_brprob: Update comment. Index: predict.c === --- predict.c (revision 234877) +++ predict.c (working copy) @@ -842,10 +842,11 @@ combine_predictions_for_insn (rtx_insn * } /* Combine predictions into single probability and store them into CFG. - Remove now useless prediction entries. */ + Remove now useless prediction entries. + If DRY_RUN is set, only produce dumps and do not modify profile. */ static void -combine_predictions_for_bb (basic_block bb) +combine_predictions_for_bb (basic_block bb, bool dry_run) { int best_probability = PROB_EVEN; enum br_predictor best_predictor = END_PREDICTORS; @@ -876,7 +877,7 @@ combine_predictions_for_bb (basic_block this later. */ if (nedges != 2) { - if (!bb->count) + if (!bb->count && !dry_run) set_even_probabilities (bb); clear_bb_predictions (bb); if (dump_file) @@ -982,7 +983,7 @@ combine_predictions_for_bb (basic_block } clear_bb_predictions (bb); - if (!bb->count) + if (!bb->count && !dry_run) { first->probability = combined_probability; second->probability = REG_BR_PROB_BASE - combined_probability; @@ -2327,10 +2328,11 @@ tree_estimate_probability_bb (basic_bloc /* Predict branch probabilities and estimate profile of the tree CFG. This function can be called from the loop optimizers to recompute - the profile information. */ + the profile information. + If DRY_RUN is set, do not modify CFG and only produce dump files. */ void -tree_estimate_probability (void) +tree_estimate_probability (bool dry_run) { basic_block bb; @@ -2352,7 +2354,7 @@ tree_estimate_probability (void) tree_estimate_probability_bb (bb); FOR_EACH_BB_FN (bb, cfun) -combine_predictions_for_bb (bb); +combine_predictions_for_bb (bb, dry_run); if (flag_checking) bb_predictions->traverse (NULL); @@ -2360,7 +2362,8 @@ tree_estimate_probability (void) delete bb_predictions; bb_predictions = NULL; - estimate_bb_frequencies (false); + if (!dry_run) +estimate_bb_frequencies (false); free_dominance_info (CDI_POST_DOMINATORS); remove_fake_exit_edges (); } @@ -3040,7 +3043,7 @@ pass_profile::execute (function *fun) if (nb_loops > 1) scev_initialize (); - tree_estimate_probability (); + tree_estimate_probability (false); if (nb_loops > 1) scev_finalize (); @@ -3191,3 +3194,30 @@ rebuild_frequencies (void) gcc_unreachable (); timevar_pop (TV_REBUILD_FREQUENCIES); } + +/* Perform a dry run of the branch prediction pass and report comparsion of + the predicted and real profile into the dump file. */ + +void +report_predictor_hitrates (void) +{ + unsigned nb_loops; + + loop_optimizer_init (LOOPS_NORMAL); + if (dump_file && (dump_flags & TDF_DETAILS)) +flow_loops_dump (dump_file, NULL, 0); + + mark_irreducible_loops (); + + nb_loops = number_of_loops (cfun); + if (nb_loops > 1) +scev_initialize (); + + tree_estimate_probability (true); + + if (nb_loops > 1) +scev_finalize (); + + loop_optimizer_finalize (); +} + Index: profile.c === --- profile.c (revision 234877) +++ profile.c (working copy) @@ -845,6 +845,8 @@ compute_branch_probabilities (unsigned c fputc ('\n', dump_file); fputc ('\n', dump_file); } + if (dump_file && (dump_flags & TDF_DETAILS)) +report_predictor_hitrates (); free_aux_for_blocks (); } Index: predict.h === --- predict.h (revision 234877) +++ predict.h (working copy) @@ -90,5 +90,6 @@ extern void compute_function_frequency ( extern tree build_predict_expr (enum br_predictor, enum prediction); extern const char *predictor_name (enum br_predictor); extern void
[wwwdocs,Java] Remove java/status.html
On Sun, 17 Apr 2016, Andrew Haley wrote: >> Somewhat related, any concerns if I were to remove >> https://gcc.gnu.org/java/status.html now? >> >> ("Status of GCJ as of GCC 3.2" _really_ is rather old.) > It's so old that I don't think it's of any use. However, I wonder > if it might make more sense to at least have a page saying that GCJ > is gone. My recommendation is to handle that via java/index, which is the main page, and redirect other GCJ pages to that one as we remove them. Like in the following, for java/status.html. Are you fine with that? Gerald Index: .htaccess === RCS file: /cvs/gcc/wwwdocs/htdocs/.htaccess,v retrieving revision 1.36 diff -u -r1.36 .htaccess --- .htaccess 29 Oct 2015 10:13:08 - 1.36 +++ .htaccess 17 Apr 2016 16:00:58 - @@ -51,6 +51,7 @@ Redirect permanent /java/gcj.html https://gcc.gnu.org/java/ Redirect permanent /java/libgcj.html https://gcc.gnu.org/java/ Redirect permanent /java/about.htmlhttps://gcc.gnu.org/about.html +Redirect permanent /java/status.html https://gcc.gnu.org/java/ Redirect permanent /bugs.html https://gcc.gnu.org/bugs/ Redirect permanent /c9xstatus.html https://gcc.gnu.org/c99status.html Index: style.mhtml === RCS file: /cvs/gcc/wwwdocs/htdocs/style.mhtml,v retrieving revision 1.128 diff -u -r1.128 style.mhtml --- style.mhtml 16 Apr 2016 21:57:06 - 1.128 +++ style.mhtml 17 Apr 2016 16:00:58 - @@ -124,7 +124,6 @@ GCJ Home GCC Home -Status FAQ Documentation Contributing 2016-04-17 Gerald Pfeifer * status.html: Remove. Index: java/status.html === RCS file: java/status.html diff -N java/status.html --- java/status.html2 Jul 2014 15:40:11 - 1.33 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -1,154 +0,0 @@ - - - -GCJ - Status - - -dt.package { font-weight: bold; font-family: monospace } -dt.target { font-weight: bold } - - - - - - -GCJ Status - -Status of GCJ as of GCC 3.2. Improvements that are only -in current development versions are marked as "in CVS". - -Core Features - - -Compile Java source code ("ahead-of-time") to native (machine) code, -Compile Java bytecode (.class files) to native (machine) code, -Compile Java source code to .class files (javac replacement). -A byte-code interpreter, allowing support for ClassLoaders, -and dynamically loaded classes. Corresponds to JDK's java command. -Support for JNI, as well as CNI, a more efficient and easier-to-use -(though non-standard) API for writing Java methods in C++. - Verification, both at compile time (compiling classes to -native) and run-time (loading classes). Both miss some tests, and -you should not (yet) rely on their correctness for security. -A "conservative" garbage collector. -Replacements for the jar, javah, -rmic, and rmiregistry programs. -An extensive class library - see below. - - - -Implemented Packages - - -java.applet -Believed to be complete, but note that without a functional AWT -it isn't very useful. -java.awt -A lot of code exists, but not enough for use in real applications. -java.beans -Believed to be functional and complete, should be compatible with JDK 1.4. -java.io -Ok. -java.lang -Ok. -java.lang.ref -Ok. -java.lang.reflect -Ok. Does not check access permissions. -java.math -Ok. -java.net -Ok. -java.nio -The public interface is ready, but the implementation is not working yet. -java.rmi -Ok. -java.security -Code exist; completeness unknown. -java.sql -Ok, should be compatible with JDK 1.4. -java.util -Ok. -java.util.jar -Ok. -java.util.regex -Ok. -java.util.zip -Ok. -java.text -Ok, but most localization data not available. -javax.accessibility -Some code; status unknown. -javax.crypto -We recommend using http://www.gnu.org/software/gnu-crypto/";>GNU Crypto. -javax.naming -Complete, but no providers written. -javax.sql -Some code; status unknown. -javax.swing -Some code, but not enough for real applications. -javax.transaction -Complete, but no providers written. - - -You can also see a -comparison of our classes with Classpath's. Differences here are -merged from time to time. You can also see - -a comparison of the GUI branch with Classpath. - - - -Supported Targets - - -GNU/Linux on the Pentium-compatible PCs - (i[56]86-pc-linux-gnu) -Ok. -FreeBSD on the Pentium-compatible PCs - (i[56]86-pc-freebsd*) -Ok. -GNU/Linux on Alpha - (alpha*-*-linux-gnu) -Ok. -GNU/Linux on the Itanium (ia64) architecture - (ia64-*-linux-gnu) -Ok. -GNU/Linux on PowerPC -Ok. -GNU/Linux on AMD x86-64 ("Hammer") architecture -(x86_64-*-linux-gnu) -Ok, in CVS (but building with multilibs enabled needs libtool patch). -Solaris 2.5.1, 2.6, 2.7, 2.8 on SPARC - (sparc*-sun-solaris2.[5678]) -Ok for 32- and 64-bit ABIs. By
Re: [PATCH] [AArch64] support -mfentry feature for arm64
On Fri, 15 Apr 2016, Alexander Monakov wrote: > On Fri, 15 Apr 2016, Michael Matz wrote: > > Replace first nop with a breakpoint, handle rest of patching in breakpoint > > handler, patch breakpoint insn last, no need to atomically patch multiple > > instructions. > > Alternatively: replace first nop with a short forward branch that jumps over > the rest of the pad, patch rest of the pad, patch the initial forward branch. I've noticed an issue in my (and probably Michael's) solution: if there's a thread that made it past the first nop, but is still executing the nop pad, it's unsafe to replace the nops. To solve that, it suffices to have a forward branch in place of the first nop to begin with (i.e. have the compiler emit it). But if Szabolcs' two-instruction sequence in the adjacent subthread is sufficient, this is moot. Alexander
Fix pure/const discovery WRT interposition part 3
Hi while working on the previous flag I noticed latent bug in set_pure_flag and set_const_flag. Both functions are used for setting the flag (from pure-const pass) as well as clearing the flag (from profiling). When setting the flag one needs to watch for interposition, while when clearning one wants to clear everything. This patch also updates set_const_flag to do the right thing on virtual thunks and fixed set_nothrow_flag in similar way (thunk -fnon-call-exceptions is still not conservatively correct, I will deal with it in the followup patch). Similarly local_pure_const is wrong about noreturns. With these changes ipa-pure-const pass may report some functions to be turned to const/pure while they are not (because of interposition). FOr this reason I added code tracking if any change was done after all. Bootstrapped/regtested x86_64-linux, will commit it shortly. Honza PR ipa/70018 * cgraph.h (cgraph_node::set_const_flag, cgraph_node::set_pure_flag): Update prototype to return bool; update comment. * cgraph.c (cgraph_node::call_for_symbol_thunks_and_aliases): Thunks of interposable symbol are interposable, too. (cgraph_set_const_flag_1): Rename to ... (set_const_flag_1): ... this one; change to self recursive function instead of call_for_symbol_thunks_and_aliases. Handle correctly clearnig the flag in all variants and also virtual thunks of const functions are pure; track if any change was done. (cgraph_node::set_const_flag): Update. (struct set_pure_flag_info): New struct. (cgraph_set_pure_flag_1): Rename to ... (set_pure_flag_1): ... this one; take set_pure_flag_info parameter rather than pointer encoded flags; track if any changes was done; handle correctly clearning flag and setting flag of aliases already declared const. (cgraph_node::set_pure_flag): Update. (cgraph_node::set_nothrow_flag): Handle correctly clearning the flag. Index: cgraph.h === --- cgraph.h(revision 235064) +++ cgraph.h(working copy) @@ -1113,13 +1113,24 @@ public: if any to NOTHROW. */ void set_nothrow_flag (bool nothrow); - /* Set TREE_READONLY on cgraph_node's decl and on aliases of the node - if any to READONLY. */ - void set_const_flag (bool readonly, bool looping); + /* If SET_CONST is true, mark function, aliases and thunks to be ECF_CONST. +If SET_CONST if false, clear the flag. + +When setting the flag be careful about possible interposition and +do not set the flag for functions that can be interposet and set pure +flag for functions that can bind to other definition. + +Return true if any change was done. */ + + bool set_const_flag (bool set_const, bool looping); /* Set DECL_PURE_P on cgraph_node's decl and on aliases of the node - if any to PURE. */ - void set_pure_flag (bool pure, bool looping); + if any to PURE. + + When setting the flag, be careful about possible interposition. + Return true if any change was done. */ + + bool set_pure_flag (bool pure, bool looping); /* Call callback on function and aliases associated to the function. When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are Index: cgraph.c === --- cgraph.c(revision 235065) +++ cgraph.c(working copy) @@ -2308,6 +2313,8 @@ cgraph_node::call_for_symbol_thunks_and_ exclude_virtual_thunks)) return true; } + if (avail <= AVAIL_INTERPOSABLE) +return false; for (e = callers; e; e = e->next_caller) if (e->caller->thunk.thunk_p && (include_overwritable @@ -2376,95 +2383,214 @@ void cgraph_node::set_nothrow_flag (bool nothrow) { call_for_symbol_thunks_and_aliases (cgraph_set_nothrow_flag_1, - (void *)(size_t)nothrow, false); + (void *)(size_t)nothrow, nothrow == true); } -/* Worker to set const flag. */ +/* Worker to set_const_flag. */ -static bool -cgraph_set_const_flag_1 (cgraph_node *node, void *data) +static void +set_const_flag_1 (cgraph_node *node, bool set_const, bool looping, + bool *changed) { /* Static constructors and destructors without a side effect can be optimized out. */ - if (data && !((size_t)data & 2)) + if (set_const && !looping) { if (DECL_STATIC_CONSTRUCTOR (node->decl)) - DECL_STATIC_CONSTRUCTOR (node->decl) = 0; + { + DECL_STATIC_CONSTRUCTOR (node->decl) = 0; + *changed = true; + } if (DECL_STATIC_DESTRUCTOR (node->decl)) - DECL_STATIC_DESTRUCTOR (node->decl) = 0; + { + DECL_STATIC_DESTRUCTOR (node->decl) = 0; + *changed = true; + } +} + if (!set_const) +
Re: [PATCH] Fix missed DSE opportunity with operator delete.
On Sun, 17 Apr 2016, Mikhail Maltsev wrote: Currently GCC can optimize away the following dead store: void test(char *x) { *x = 1; free(x); } but not this one (Clang handles both cases): void test(char *x) { *x = 1; delete x; } The attached patch fixes this by introducing a new __attribute__((free)). I first tried to add new built-ins for each version of operator delete (there are four of them), but it looked a little clumsy, and would require some special handling for warning about taking address of built-in function. This sounds nice. Mingw* may want to use that attribute for _aligned_free. I am concerned about what happens when a user replaces a global operator delete. Does the replacement function have to satisfy the properties for this attribute? -- Marc Glisse
Re: [wwwdocs,Java] java/index.html -- fix formatting on gcc.gnu.org
On 16/04/16 21:31, Gerald Pfeifer wrote: > On Sun, 10 Apr 2016, Andrew Hughes wrote: >>> That said, looking at the page, and how since 2005 nearly all changes >>> have been maintainance ones from me, is it really worthwhile keeping >>> this (short of historic reasons)? >> I guess the next news will be the removal of GCJ during the >> GCC 7 development period, so its remaining shelf life should >> be limited anyway. > > Soo, GCC 6 has branched -- would it make sense for you guys to > start this removal? Sounds good. OTOH, I don't think there's any great hurry. > Somewhat related, any concerns if I were to remove > https://gcc.gnu.org/java/status.html now? > > ("Status of GCJ as of GCC 3.2" _really_ is rather old.) It's so old that I don't think it's of any use. However, I wonder if it might make more sense to at least have a page saying that GCJ is gone. Andrew.
[wwwdocs] Reduce use of MetaHTML for navigation
When I initially created this in the early 2000s, CSS did barely exist and was hardly used. Now in 2016 it makes sense to use it fully (a first phase of conversation happened a few years ago) and reduce our dependency on MetaHTML even further. And it even simplifies things, once again. Applied. Gerald Instead of emulating CSS via MetaHTML, use real CSS for the navigation bar on the left of the main, java, and libstdc++ pages. Index: gcc.css === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc.css,v retrieving revision 1.40 diff -u -r1.40 gcc.css --- gcc.css 10 Apr 2016 08:42:40 - 1.40 +++ gcc.css 16 Apr 2016 21:55:31 - @@ -32,7 +32,7 @@ td.status .regress { font-size: 80%; } td.status dd { margin-left:3ex; } -.td_title { +table.navitem tr:nth-child(1) { border-color: #3366cc; border-style: solid; border-width: thin; @@ -40,8 +40,7 @@ background-color: #0066dd; font-weight: bold; } - -.td_con { +table.navitem tr:nth-child(2) { padding-top: 3px; padding-left: 8px; padding-bottom: 3px; Index: style.mhtml === RCS file: /cvs/gcc/wwwdocs/htdocs/style.mhtml,v retrieving revision 1.127 diff -u -r1.127 style.mhtml --- style.mhtml 14 Feb 2016 14:22:18 - 1.127 +++ style.mhtml 16 Apr 2016 21:55:31 - @@ -116,11 +116,11 @@ "java/[^/]*.html"> - > + + - > + GCJ Home GCC Home @@ -137,9 +137,9 @@ "libstdc../[^/]*.html"> - >libstdc++ v3 - > + +libstdc++ v3 + libstdc++ Home GCC Home https://gcc.gnu.org/onlinedocs/libstdc++/faq.html";>FAQ @@ -149,9 +149,9 @@ > > - - >About GCC - > + + About GCC + Mission Statement Releases Snapshots @@ -171,9 +171,9 @@ - - >Documentation - > + + Documentation + https://gcc.gnu.org/install/";>Installation · https://gcc.gnu.org/install/specific.html";>Platforms Manual @@ -183,17 +183,17 @@ - - >Download - > + + Download + Mirrors https://gcc.gnu.org/install/binaries.html";>Binaries - - >Sources - > + + Sources + SVN read access SVN write access https://gcc.gnu.org/wiki/GitMirror";>Git read access @@ -201,9 +201,9 @@ - - >Development - > + + Development + Development Plan · Timeline Contributing @@ -218,9 +218,9 @@ - - >Bugs - > + + Bugs + Known bugs How to report https://gcc.gnu.org/bugzilla/";>Bug tracker