Re: [patch] PR bootstrap/25672: Avoid CFLAGS in CFLAGS_FOR_TARGETS if cross-compiling
On 03/09/15 16:22, Aldy Hernandez wrote: Hello gentlemen. The problem here is that we pick up the system's CFLAGS and pass it down to the target libraries. This causes havoc when, for instance, CFLAGS is -march=x86-64 and the target is powerpc-linux. I don't see in what scenario the toplevel shell's CFLAGS would be of any use in the target libraries, so I've just avoided that code path altogether. Tested by doing a cross-build from x86-64 to ppc64-linux-gnu in a combined tree, and seeing if libgcc starts to build. Previously we would fail while configuring GCC. Now, gcc builds fine, and the target libraries start to build. OK for mainline? Aldy curr commit f2d130b93f334c5c680761553624964f87594adf Author: Aldy Hernandez Date: Mon Mar 9 15:12:33 2015 -0700 PR bootstrap/25672 * configure.ac: Do not initialize CFLAGS_FOR_TARGET from CFLAGS if cross-compiling. Similarly for CXX_FOR_TARGET. * configure: Regenerate. I was wondering when someone would come across this oldie-but-goodie... I'm sure someone, somewhere will complain that make CFLAGS="whatever" isn't being passed down to the crossses as it has been for the last two decades. And they'll be right. But in the cross compiler case, I think it's reasonable to expect to have to use CFLAGS_FOR_TARGET so that we have separation between the host and target flags. One could easily want to compile the host with one set of arguments and the target libraries with something completely different. And note that the various .mt files already use the _FOR_TARGET macros to pass down additional flags rather than just CFLAGS or CXXFLAGS. Are there any docs that need to change? I don't recall any offhand, but if you could look prior to committing, it'd be appreciated. OK for the trunk. jeff
Re: [PATCH] target/65286 - Disable multilib for ppc64le
On 2015.03.09 at 14:00 -0400, David Edelsohn wrote: > On Thu, Mar 5, 2015 at 6:14 PM, Alan Modra wrote: > > This arranges to build a powerpc64le-linux compiler without -m32 > > support by default. Bootstrapped and regression tested on Ubuntu > > powerpc64le-linux without --disable-multilib, and on powerpc64-linux > > and powerpc-linux. OK for mainline and branches? > > > > This part of the config.gcc patch does most of the work > > - case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in > > - always:* | yes:*powerpc64* | yes:all:* | yes:*:yes) > > + case ${target}:${enable_targets}:${maybe_biarch} in > > + powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \ > > + | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \ > > + | powerpcle-*:*powerpc64le*:yes) > > > > always:* becomes powerpc64-*, ie. exclude powerpc64le > > yes:*powerpc64* becomes *:*powerpc64-*:yes, excluding powerpc64le so > > that --target=powerpc64le-linux --enable-targets=powerpc64le-linux > > doesn't accidentally get you a biarch compiler. > > yes:all:* becomes *:all:yes, more or less unchanged. > > yes:*:yes becomes powerpc-*:*:yes allowing --target=powerpc-linux > > --with-cpu= to continue to build a biarch ppc64 > > compiler. > > > > Some other notes: > > t-fprules setting of MULTILIB variables is in every case overridden by > > a following t-file, except for the commented out powerpc-*-openbsd*. > > Since the aim of this patch is to build powerpc64le without multilibs, > > the default setting of these vars needs to go. t-ppcos needs to be > > removed from powerpc64le configurations for the same reason. Oh, and > > adding t-fprules and t-ppcos before previous additions to tmake_file > > is no longer necessary. I checked all the other t-files that might be > > added for interactions. > > > > The linux64.h change is so that passing -m32 results in > > error: -m32 not supported in the configuration > > rather than the confusing > > error: -m64 requires a PowerPC64 cpu > > (Yes, I know using TARGET_64BIT_P would be nicer, but it's probably > > better left to a cleanup patch.) > > > > PR target/65286 > > * config.gcc (powerpc*-*-linux*): Arrange for powerpc64le-linux > > to be single-arch by default. Set cpu_is_64bit for powerpc64 > > given --with-cpu=native. > > * config/rs6000/t-fprules: Do not set default MULTILIB vars. > > * config/rs6000/t-linux (MULTIARCH_DIRNAME): Support powerpc64 > > and powerpc64le. > > * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Test > > rs6000_isa_flags rather than TARGET_64BIT. > > Okay. > > The number of name variations is annoying, but I guess there's no choice now. This patch breaks the build on ppc64le: trippels@gcc2-power8 gcc_build_dir % ../gcc/configure --with-cpu=power8 --disable-libsanitizer --disable-bootstrap --disable-libstdcxx-pch --disable-libvtv --disable-libitm --disable-libcilkrts --disable-libssp --disable-libgomp --disable-werror --disable-multilib --enable-languages=c,c++ ... ranlib libgcc.a # @multilib_flags@ is still needed because this may use # /home/trippels/gcc_build_dir/./gcc/xgcc -B/home/trippels/gcc_build_dir/./gcc/ -B/usr/local/powerpc64le-unknown-linux-gnu/bin/ -B/usr/local/powerpc64le-unknown-linux-gnu/lib/ -isystem /usr/local/powerpc64le-unknown-linux-gnu/include -isystem /usr/local/powerpc64le-unknown-linux-gnu/sys-includeand -O2 -g -O2 -DIN_GCC-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -mlong-double-128 -mno-minimal-toc -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector directly. # @multilib_dir@ is not really necessary, but sometimes it has # more uses than just a directory name. /bin/sh ../../../gcc/libgcc/../mkinstalldirs . /home/trippels/gcc_build_dir/./gcc/xgcc -B/home/trippels/gcc_build_dir/./gcc/ -B/usr/local/powerpc64le-unknown-linux-gnu/bin/ -B/usr/local/powerpc64le-unknown-linux-gnu/lib/ -isystem /usr/local/powerpc64le-unknown-linux-gnu/include -isystem /usr/local/powerpc64le-unknown-linux-gnu/sys-include-O2 -g -O2 -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -mlong-double-128 -mno-minimal-toc -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popco
Re: [PATCH] Improve PR44563
> > This reduces the time spent in cgraph call-site hash by providing > inline version of htab_hash_pointer. > > Bootstrap / regtest on x86_64-unknown-linux-gnu in progress. > > Ok? > > Thanks, > Richard. > > 2015-03-09 Richard Biener > > PR middle-end/44563 > * cgraph.h (struct cgraph_edge_hasher): Add hash overload > for compare_type. > * cgraph.c (cgraph_edge_hasher::hash): Inline htab_hash_pointer. > (cgraph_update_edge_in_call_site_hash): Use cgraph_edge_hasher::hash. > (cgraph_add_edge_to_call_site_hash): Likewise. > (cgraph_node::get_edge): Likewise. > (cgraph_edge::set_call_stmt): Likewise. > (cgraph_edge::remove_caller): Likewise. Seems reosnable to me and patch is OK. Since hash-map is now GGC safe, won't it be faster to use it instead? The hash is really mapping stmts to edges, so hash-map seems most fitting datastructure in our grand new C++ world. Honza
Speedup ICF 1/3
Hi, this is part of my last week experiments on ICF performance work that seems simple&effective enough even at this stage. This patch moves checks of DECL itself from equals_private (that happens after reading function body) to equals_wpa (that happens before) and organizes them in a sequence from cheap to expensive. A common reason to fail is mismatch of inline flags. Perhaps it is bit too strict: my original idea was that if one declares a function inline he wants it inlined even if it is wrapped by something else. One test I did not move is comparsion of decl attributes. Have a separate patch for this as current way attributes are compared is bit weird (relying on gimple_op matching to match attribute parameters) Bootstrapped/regtested x86_64-linux and tested with building chromium. Will commit it tomorrow. * ipa-icf.c (sem_function::equals_wpa): Move here some checks from ... (sem_function::equals_wpa): ... here. Index: ipa-icf.c === --- ipa-icf.c (revision 221296) +++ ipa-icf.c (working copy) @@ -406,6 +406,66 @@ sem_function::equals_wpa (sem_item *item if (arg_types.length () != m_compared_func->arg_types.length ()) return return_false_with_msg ("different number of arguments"); + /* Compare special function DECL attributes. */ + if (DECL_FUNCTION_PERSONALITY (decl) + != DECL_FUNCTION_PERSONALITY (item->decl)) +return return_false_with_msg ("function personalities are different"); + + if (DECL_DISREGARD_INLINE_LIMITS (decl) + != DECL_DISREGARD_INLINE_LIMITS (item->decl)) +return return_false_with_msg ("DECL_DISREGARD_INLINE_LIMITS are different"); + + if (DECL_DECLARED_INLINE_P (decl) != DECL_DECLARED_INLINE_P (item->decl)) +return return_false_with_msg ("inline attributes are different"); + + if (DECL_IS_OPERATOR_NEW (decl) != DECL_IS_OPERATOR_NEW (item->decl)) +return return_false_with_msg ("operator new flags are different"); + + if (DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) + != DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (item->decl)) +return return_false_with_msg ("intrument function entry exit " + "attributes are different"); + + if (DECL_NO_LIMIT_STACK (decl) != DECL_NO_LIMIT_STACK (item->decl)) +return return_false_with_msg ("no stack limit attributes are different"); + + if (flags_from_decl_or_type (decl) != flags_from_decl_or_type (item->decl)) +return return_false_with_msg ("decl_or_type flags are different"); + + /* Checking function TARGET and OPTIMIZATION flags. */ + cl_target_option *tar1 = target_opts_for_fn (decl); + cl_target_option *tar2 = target_opts_for_fn (item->decl); + + if (tar1 != tar2 && !cl_target_option_eq (tar1, tar2)) +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "target flags difference"); + cl_target_option_print_diff (dump_file, 2, tar1, tar2); + } + + return return_false_with_msg ("Target flags are different"); +} + + cl_optimization *opt1 = opts_for_fn (decl); + cl_optimization *opt2 = opts_for_fn (item->decl); + + if (opt1 != opt2 && memcmp (opt1, opt2, sizeof(cl_optimization))) +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "optimization flags difference"); + cl_optimization_print_diff (dump_file, 2, opt1, opt2); + } + + return return_false_with_msg ("optimization flags are different"); +} + + /* Result type checking. */ + if (!func_checker::compatible_types_p (result_type, +m_compared_func->result_type)) +return return_false_with_msg ("result types are different"); + /* Checking types of arguments. */ for (unsigned i = 0; i < arg_types.length (); i++) { @@ -427,11 +487,6 @@ sem_function::equals_wpa (sem_item *item return return_false_with_msg ("argument restrict flag mismatch"); } - /* Result type checking. */ - if (!func_checker::compatible_types_p (result_type, -m_compared_func->result_type)) -return return_false_with_msg ("result types are different"); - if (node->num_references () != item->node->num_references ()) return return_false_with_msg ("different number of references"); @@ -520,45 +575,6 @@ sem_function::equals_private (sem_item * if (!equals_wpa (item, ignored_nodes)) return false; - /* Checking function TARGET and OPTIMIZATION flags. */ - cl_target_option *tar1 = target_opts_for_fn (decl); - cl_target_option *tar2 = target_opts_for_fn (m_compared_func->decl); - - if (tar1 != NULL && tar2 != NULL) -{ - if (!cl_target_option_eq (tar1, tar2)) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "target flags difference"); - cl_target_option_print_diff (dump_file, 2, tar1, tar2); -
Re: [PATCH, Fortran] Sync memory action delegated to OpenCoarrays
Thanks for the quick response. Patch built and regtested on x86_64-unknown-linux-gnu. Currently the stub for sync memory in single.c invokes "asm volatile ("" : : : "memory")" but _gfortran_caf_sync_memory is not called when the code is compiled with -fcoarray=single. Please let me know if I have to change the patch for -fcoarray=single. 2015-03-06 11:20 GMT-08:00 Tobias Burnus : > Dear Alessandro, > > Alessandro Fanfarillo wrote: > > so far a "sync memory" statement is translated into a local > "__sync_synchronize ()". > The attached draft patch delegates the action for sync memory (when > -fcoarray=lib is used) to the external function > _gfortran_caf_sync_memory() implemented in the OpenCoarrays library. > > > Looks good to me. However, you should add a test case with 'dg-options > "-fdump-tree-original -fcoarray=lib"' to check that this works; cf. > gcc/testsuite/gfortran.dg/coarray*.f90 for examples. > > And you have to provide a stub implementation in > libgfortran/caf/{libcaf.h,single.c}. > > Tobias > > PS: I wonder whether it makes sense to remove the __sync_synchronize for > -fcoarray=single and replace it by the equivalent to "asm volatile ("" : : : > "memory")". It almost certainly does. 2015-03-09 Alessandro Fanfarillo fanfarillo@gmail.com trans-decl.c: Add function declaration caf_sync_memory trans.h: Ditto trans-stmt.c: Add caf_sync_memory invocation coarray_38.f90: Test case single.c: caf_sync_memory implementation libcaf.h: caf_sync_memory prototype diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 3664824..a66c25c 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -153,6 +153,7 @@ tree gfor_fndecl_caf_get; tree gfor_fndecl_caf_send; tree gfor_fndecl_caf_sendget; tree gfor_fndecl_caf_sync_all; +tree gfor_fndecl_caf_sync_memory; tree gfor_fndecl_caf_sync_images; tree gfor_fndecl_caf_error_stop; tree gfor_fndecl_caf_error_stop_str; @@ -3451,6 +3452,10 @@ gfc_build_builtin_function_decls (void) get_identifier (PREFIX("caf_sync_all")), ".WW", void_type_node, 3, pint_type, pchar_type_node, integer_type_node); + gfor_fndecl_caf_sync_memory = gfc_build_library_function_decl_with_spec ( + get_identifier (PREFIX("caf_sync_memory")), ".WW", void_type_node, + 3, pint_type, pchar_type_node, integer_type_node); + gfor_fndecl_caf_sync_images = gfc_build_library_function_decl_with_spec ( get_identifier (PREFIX("caf_sync_images")), ".RRWW", void_type_node, 5, integer_type_node, pint_type, pint_type, diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 505f905..dce0e87 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -768,8 +768,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) else stat = null_pointer_node; - if (code->expr3 && flag_coarray == GFC_FCOARRAY_LIB - && type != EXEC_SYNC_MEMORY) + if (code->expr3 && flag_coarray == GFC_FCOARRAY_LIB) { gcc_assert (code->expr3->expr_type == EXPR_VARIABLE); gfc_init_se (&argse, NULL); @@ -778,7 +777,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) errmsg = gfc_build_addr_expr (NULL, argse.expr); errmsglen = argse.string_length; } - else if (flag_coarray == GFC_FCOARRAY_LIB && type != EXEC_SYNC_MEMORY) + else if (flag_coarray == GFC_FCOARRAY_LIB) { errmsg = null_pointer_node; errmsglen = build_int_cst (integer_type_node, 0); @@ -822,13 +821,13 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) gfc_add_expr_to_block (&se.pre, tmp); } - if (flag_coarray != GFC_FCOARRAY_LIB || type == EXEC_SYNC_MEMORY) + if (flag_coarray != GFC_FCOARRAY_LIB) { /* Set STAT to zero. */ if (code->expr2) gfc_add_modify (&se.pre, stat, build_int_cst (TREE_TYPE (stat), 0)); } - else if (type == EXEC_SYNC_ALL) + else if (type == EXEC_SYNC_ALL || type == EXEC_SYNC_MEMORY) { /* SYNC ALL => stat == null_pointer_node SYNC ALL(stat=s) => stat has an integer type @@ -840,8 +839,13 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) if (TREE_TYPE (stat) == integer_type_node) stat = gfc_build_addr_expr (NULL, stat); - tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_sync_all, -3, stat, errmsg, errmsglen); + if(type == EXEC_SYNC_MEMORY) + tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_sync_memory, + 3, stat, errmsg, errmsglen); + else + tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_sync_all, + 3, stat, errmsg, errmsglen); + gfc_add_expr_to_block (&se.pre, tmp); } else diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index bd1520a..3ba2f88 100
Re: [patch] Optimize empty class copies within a C++ return statement
On 03/09/2015 02:33 PM, Aldy Hernandez wrote: On 03/06/2015 02:01 PM, Jason Merrill wrote: On 03/06/2015 05:01 PM, Jason Merrill wrote: On 03/06/2015 04:54 PM, Aldy Hernandez wrote: But doesn't this still involve a MODIFY_EXPR, i.e. return retval = D.2349? If I understand you correct, no. gimplify_return_expr creates a new temporary and uses that instead of : else if (gimplify_ctxp->return_temp) result = gimplify_ctxp->return_temp; else { result = create_tmp_reg (TREE_TYPE (result_decl)); ... } ... ... /* Smash the lhs of the MODIFY_EXPR to the temporary we plan to use. Then gimplify the whole thing. */ if (result != result_decl) TREE_OPERAND (ret_expr, 0) = result; Sounds like ret_expr is a MODIFY_EXPR. Oh, but with the wrong lhs, I see. I know you want to reuse the MODIFY_EXPR case in cp_gimplify_expr, but after playing around with it, I think it requires too much special casing to make it clean. For instance, the MODIFY_EXPR case returns the RHS of expression which is the opposite of what we want. For this: return retval = ...the MODIFY_EXPR case would build a COMPOUND_EXPR with "return <<>>>", which would return , not retval. And what we probably want is a statement list with: return retval Agreed, we want (op1, op0) in this case. I think this demonstrates that the existing code is wrong to sometimes return (op0, op1), since we might be using the result as an lvalue. Better would be to always gimplify op0 to an lvalue, gimplify_and_add the rhs, and finally return the gimplified lhs, rather than mess with building up a COMPOUND_EXPR (or STATEMENT_LIST, as in your patch). Also, the actual case we're dealing with here is a bit more complicated, as it involves a COMPOUND_EXPR in the RHS, which we'd have to adapt MODIFY_EXPR to handle: return retval = <<> IMHO, adding a special case for all this is a lot messier than what I originally suggested. I would expect the current code to handle this fine. Jason
Re: [C++ PATCH, RFC] PR c++/63959, continued
On 03/06/2015 06:03 PM, Ville Voutilainen wrote: So.. just to clarify that we're on the same page.. making volatile-qualified types non-trivially copyable is ok, but making wrappers of volatile-qualified types non-trivially copyable is not ok? That's easily doable implementation-wise, but it makes me question the overall approach and its consistency. Indeed. This is a question for CWG; we may want to reconsider the first point as well. Is there a way to indicate that from the point of C++ a type is not trivially copyable without changing the "complexness" of a copy operation, ultimately without changing ABI? There are various hacks I can imagine, but I think I'd prefer to resolve the standard issue before trying to implement it. Jason
Re: [PATCH] Fix ICE during LTO odr reporting (PR lto/65361)
> Hi! > > BINFO_BASE_BINFO always gives a TREE_BINFO, so using DECL_CONTEXT on it > is wrong. The following patch fixes it to use BINFO_TYPE instead. > > Bootstrapped/regtested on x86_64-linux and i686-linux, tested also on the > testcase in the PR. Ok for trunk? > > We don't seem to have infrastructure for testing errors during LTO linking, > so no testcase included. OK, thanks! Yep, we should get testsuite support for this... Honza > > 2015-03-09 Jakub Jelinek > > PR lto/65361 > * ipa-devirt.c (add_type_duplicate): Don't use DECL_CONTEXT > on a TREE_BINFO, instead use BINFO_TYPE. > > --- gcc/ipa-devirt.c.jj 2015-03-09 08:05:13.0 +0100 > +++ gcc/ipa-devirt.c 2015-03-09 16:23:42.277861689 +0100 > @@ -1505,9 +1505,9 @@ add_type_duplicate (odr_type val, tree t > extra_base = BINFO_BASE_BINFO >(TYPE_BINFO (val->type), > BINFO_N_BASE_BINFOS (TYPE_BINFO (type))); > - inform (DECL_SOURCE_LOCATION > - (TYPE_NAME (DECL_CONTEXT (extra_base))), > - "the extra base is defined here "); > + tree extra_base_type = BINFO_TYPE (extra_base); > + inform (DECL_SOURCE_LOCATION (TYPE_NAME (extra_base_type)), > + "the extra base is defined here"); > } > base_mismatch = true; > } > > Jakub
Re: [PATCH] Make sure shift amount in RTL is not wider than shift mode (PR rtl-optimization/65321)
On 03/09/15 15:23, Jakub Jelinek wrote: Hi! As mentioned in the PR, e.g. wide-int is very unhappy if the shift second operand doesn't fit into the shift mode. Generally, the backend shift patterns ensure that, but in debug insns nothing enforces that. This patch fixes that by making sure e.g. QImode shifts have always at QImode shift amount, HImode shifts have QImode or HImode shift amount etc. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2015-03-09 Jakub Jelinek PR rtl-optimization/65321 * cfgexpand.c (expand_debug_expr): Ensure shift amount isn't wider than shift mode. * var-tracking.c (use_narrower_mode): Likewise. * gcc.dg/pr65321.c: New test. OK. jeff
Re: [C/C++ PATCH] Further -Wlogical-not-parentheses improvement (PR c/65120)
On 03/09/15 15:26, Jakub Jelinek wrote: Hi! As mentioned by richi, !x == 0 is actually equivalent to !(x == 0) and x != 0 and !x != 0 is equivalent to !(x != 0) and x == 0, so this patch adjusts the warning not to warn in that case, as adding parens doesn't change anything. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2015-03-09 Jakub Jelinek PR c/65120 * c-common.c (warn_logical_not_parentheses): Don't warn for !x == 0 or !x != 0. * c-typeck.c (parser_build_binary_op): Check for tcc_comparison before preparing arguments to warn_logical_not_parentheses. * parser.c (cp_parser_binary_expression): Check for tcc_comparison before preparing arguments to warn_logical_not_parentheses. Use maybe_constant_value on rhs. * c-c++-common/pr49706.c (fn2): Don't expect warning if enumerator on rhs is 0. (fn4): New test. * c-c++-common/pr65120.c: New test. C++ and testsuite bits are fine too. jeff
libgo patch committed: Add all gccgo GOARCH values to cgo size maps
This patch to libgo adds all the current gccgo GOARCH values to the size maps used by the cgo program. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 3a7299f45092 libgo/go/cmd/cgo/main.go --- a/libgo/go/cmd/cgo/main.go Mon Mar 09 16:42:06 2015 -0700 +++ b/libgo/go/cmd/cgo/main.go Mon Mar 09 17:12:29 2015 -0700 @@ -130,21 +130,43 @@ } var ptrSizeMap = map[string]int64{ - "386": 4, - "amd64": 8, - "arm": 4, - "ppc64": 8, + "386": 4, + "alpha": 8, + "amd64": 8, + "arm": 4, + "arm64": 8, + "m68k":4, + "mipso32": 4, + "mipsn32": 4, + "mipso64": 8, + "mipsn64": 8, + "ppc": 4, + "ppc64": 8, "ppc64le": 8, - "s390x": 8, + "s390":4, + "s390x": 8, + "sparc": 4, + "sparc64": 8, } var intSizeMap = map[string]int64{ - "386": 4, - "amd64": 8, - "arm": 4, - "ppc64": 8, + "386": 4, + "alpha": 8, + "amd64": 8, + "arm": 4, + "arm64": 8, + "m68k":4, + "mipso32": 4, + "mipsn32": 4, + "mipso64": 8, + "mipsn64": 8, + "ppc": 4, + "ppc64": 8, "ppc64le": 8, - "s390x": 8, + "s390":4, + "s390x": 8, + "sparc": 4, + "sparc64": 8, } var cPrefix string
libgo patch committed: Don't crash if freeing small map
This libgo patch fixes a crash when explicitly freeing a small map. This is PR 65349. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r cf89d7a7f372 libgo/runtime/go-map-index.c --- a/libgo/runtime/go-map-index.c Mon Mar 09 16:36:59 2015 -0700 +++ b/libgo/runtime/go-map-index.c Mon Mar 09 16:41:25 2015 -0700 @@ -8,6 +8,7 @@ #include #include "runtime.h" +#include "malloc.h" #include "go-alloc.h" #include "go-assert.h" #include "map.h" @@ -63,7 +64,8 @@ } } - __go_free (old_buckets); + if (old_bucket_count * sizeof (void *) >= TinySize) +__go_free (old_buckets); map->__bucket_count = new_bucket_count; map->__buckets = new_buckets;
libgo patch committed: Don't crash if crashing on signal due to heap corruption
Previously, if a Go program was crashing due to a signal due to heap corruption, it could in some cases invoke the Go malloc function while the Go malloc lock was held, leading to a recursive crash. This patch fixes the problem by making __go_file_line simply assume that libbacktrace keeps strings in memory, as runtime.Callers already does. This error showed in PR 65349. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 2169f7d99472 libgo/runtime/go-caller.c --- a/libgo/runtime/go-caller.c Fri Mar 06 08:17:57 2015 -0800 +++ b/libgo/runtime/go-caller.c Mon Mar 09 16:21:20 2015 -0700 @@ -37,36 +37,12 @@ { struct caller *c = (struct caller *) data; - if (function == NULL) -{ - c->fn.str = NULL; - c->fn.len = 0; -} - else -{ - byte *s; - - c->fn.len = __builtin_strlen (function); - s = runtime_malloc (c->fn.len); - __builtin_memcpy (s, function, c->fn.len); - c->fn.str = s; -} - - if (filename == NULL) -{ - c->file.str = NULL; - c->file.len = 0; -} - else -{ - byte *s; - - c->file.len = __builtin_strlen (filename); - s = runtime_malloc (c->file.len); - __builtin_memcpy (s, filename, c->file.len); - c->file.str = s; -} - + /* The libbacktrace library says that these strings might disappear, + but with the current implementation they won't. We can't easily + allocate memory here, so for now assume that we can save a + pointer to the strings. */ + c->fn = runtime_gostringnocopy ((const byte *) function); + c->file = runtime_gostringnocopy ((const byte *) filename); c->line = lineno; return 0;
[PATCH] PR target/65242, Fix powerpc abort in gen_add2_insn
This bug was one I unfortunately introduced with the -mupper-regs support. If the reload pass needed to reload a PLUS operation (for example, due to using odd address with the LD/STD instructions), it would go through all of the registers you could load DImode into, and see if it is a preferred register class. This lead the compiler to believe it could do integer arithmetic in the floating point registers. This patch fixes the problem, by not allowing PLUS to be reloaded into FPR registers. I have done bootstraps and make checks on both a big endian Power7 and a little endian Power8 system, and there were no regressions. Is the patch ok to apply? I do not believe it needs to be back ported to GCC 4.9 since the -mupper-regs changes are not installed currently on that branch. [gcc] 2015-03-09 Michael Meissner PR target/65242 * config/rs6000/rs6000.c (rs6000_preferred_reload_class): Do not allow reloads of PLUS in floating point/VSX registers. [gcc/testsuite] 2015-03-09 Michael Meissner PR target/65242 * g++.dg/pr65242.C: New test. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Re: sh-*-linux build failure
Yoshinori Sato wrote: >> * config/sh/t-linux (MULTILIB_EXCEPTIONS): Define for m2a cases. [snip] > It works fine. Thanks for checking. I've committed it on trunk as revision 221287. Regards, kaz
Re: [C/C++ PATCH] Further -Wlogical-not-parentheses improvement (PR c/65120)
On Mon, 9 Mar 2015, Jakub Jelinek wrote: > Hi! > > As mentioned by richi, !x == 0 is actually equivalent to !(x == 0) > and x != 0 and !x != 0 is equivalent to !(x != 0) and x == 0, so this > patch adjusts the warning not to warn in that case, as adding parens > doesn't change anything. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2015-03-09 Jakub Jelinek > > PR c/65120 > * c-common.c (warn_logical_not_parentheses): Don't warn for > !x == 0 or !x != 0. > > * c-typeck.c (parser_build_binary_op): Check for tcc_comparison > before preparing arguments to warn_logical_not_parentheses. The C front-end changes are OK. -- Joseph S. Myers jos...@codesourcery.com
[patch] PR bootstrap/25672: Avoid CFLAGS in CFLAGS_FOR_TARGETS if cross-compiling
Hello gentlemen. The problem here is that we pick up the system's CFLAGS and pass it down to the target libraries. This causes havoc when, for instance, CFLAGS is -march=x86-64 and the target is powerpc-linux. I don't see in what scenario the toplevel shell's CFLAGS would be of any use in the target libraries, so I've just avoided that code path altogether. Tested by doing a cross-build from x86-64 to ppc64-linux-gnu in a combined tree, and seeing if libgcc starts to build. Previously we would fail while configuring GCC. Now, gcc builds fine, and the target libraries start to build. OK for mainline? Aldy commit f2d130b93f334c5c680761553624964f87594adf Author: Aldy Hernandez Date: Mon Mar 9 15:12:33 2015 -0700 PR bootstrap/25672 * configure.ac: Do not initialize CFLAGS_FOR_TARGET from CFLAGS if cross-compiling. Similarly for CXX_FOR_TARGET. * configure: Regenerate. diff --git a/configure.ac b/configure.ac index 00f7452..2a14c35 100644 --- a/configure.ac +++ b/configure.ac @@ -2319,28 +2319,36 @@ AC_SUBST(DEBUG_PREFIX_CFLAGS_FOR_TARGET) # gcc) are built with "-O2 -g", so include those options when setting # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET. if test "x$CFLAGS_FOR_TARGET" = x; then - CFLAGS_FOR_TARGET=$CFLAGS - case " $CFLAGS " in -*" -O2 "*) ;; -*) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;; - esac - case " $CFLAGS " in -*" -g "* | *" -g3 "*) ;; -*) CFLAGS_FOR_TARGET="-g $CFLAGS_FOR_TARGET" ;; - esac + if test "x${is_cross_compiler}" = xyes; then +CFLAGS_FOR_TARGET="-g -O2" + else +CFLAGS_FOR_TARGET=$CFLAGS +case " $CFLAGS " in + *" -O2 "*) ;; + *) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;; +esac +case " $CFLAGS " in + *" -g "* | *" -g3 "*) ;; + *) CFLAGS_FOR_TARGET="-g $CFLAGS_FOR_TARGET" ;; +esac + fi fi AC_SUBST(CFLAGS_FOR_TARGET) if test "x$CXXFLAGS_FOR_TARGET" = x; then - CXXFLAGS_FOR_TARGET=$CXXFLAGS - case " $CXXFLAGS " in -*" -O2 "*) ;; -*) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;; - esac - case " $CXXFLAGS " in -*" -g "* | *" -g3 "*) ;; -*) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS_FOR_TARGET" ;; - esac + if test "x${is_cross_compiler}" = xyes; then +CXXFLAGS_FOR_TARGET="-g -O2" + else +CXXFLAGS_FOR_TARGET=$CXXFLAGS +case " $CXXFLAGS " in + *" -O2 "*) ;; + *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;; +esac +case " $CXXFLAGS " in + *" -g "* | *" -g3 "*) ;; + *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS_FOR_TARGET" ;; +esac + fi fi AC_SUBST(CXXFLAGS_FOR_TARGET)
Mention go and gofmt tools in GCC 5 changes files
I committed this patch to gcc-5/changes.html to mention the new go and gofmt programs. Ian Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v retrieving revision 1.86 diff -u -r1.86 changes.html --- changes.html6 Mar 2015 16:20:12 - 1.86 +++ changes.html9 Mar 2015 22:20:18 - @@ -458,6 +458,9 @@ GCC 5 provides a complete implementation of the Go 1.4.2 release. +Building GCC 5 with Go enabled will install two new + programs: http://golang.org/cmd/go";>go + and http://golang.org/cmd/gofmt";>gofmt.
[PATCH] Speed-up def_builtin_const (ix86_valid_target_attribute)
Hello. During compilation of Chromium project, I noticed (perf top) that ix86_valid_target_attribute is utilized by about 0.8-1.9%. Following patch introduces simple optimization that reduces the utilization to ~0.05%. Tests have been running on x86_64-linux-pc. Ready for trunk? Martin >From d20232455993882e4b7f769725a0c1589747b8a3 Mon Sep 17 00:00:00 2001 From: marxin Date: Sun, 8 Mar 2015 19:39:55 -0500 Subject: [PATCH] def_builtin_const: speed-up. gcc/ChangeLog: 2015-03-09 Martin Liska * config/i386/i386.c (def_builtin): Collect union of all possible masks. (ix86_add_new_builtins): Do not iterate over all builtins in cases that isa value has no intersection with possible masks and(or) last passed value is equal to the provided. --- gcc/config/i386/i386.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index ab8f03a..5f180b6 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -30592,6 +30592,8 @@ struct builtin_isa { static struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX]; +/* Union of all masks that are part of builtin_isa structures. */ +static HOST_WIDE_INT defined_isa_values = 0; /* Add an ix86 target builtin function with CODE, NAME and TYPE. Save the MASK of which isa_flags to use in the ix86_builtins_isa array. Stores the @@ -30619,6 +30621,7 @@ def_builtin (HOST_WIDE_INT mask, const char *name, if (!(mask & OPTION_MASK_ISA_64BIT) || TARGET_64BIT) { ix86_builtins_isa[(int) code].isa = mask; + defined_isa_values |= mask; mask &= ~OPTION_MASK_ISA_64BIT; if (mask == 0 @@ -30670,6 +30673,14 @@ def_builtin_const (HOST_WIDE_INT mask, const char *name, static void ix86_add_new_builtins (HOST_WIDE_INT isa) { + /* Last cached isa value. */ + static HOST_WIDE_INT last_tested_isa_value = 0; + + if ((isa & defined_isa_values) == 0 || isa == last_tested_isa_value) +return; + + last_tested_isa_value = isa; + int i; tree saved_current_target_pragma = current_target_pragma; current_target_pragma = NULL_TREE; -- 2.1.2
[patch] PR other/65366: Fix gdbhooks.py for GDB with Python3
Hi, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65366 GDB Python support upstream has always been compatible with Python3. Fedora since F-22 builds GDB with Python3 by default (<=F-21 GDB used Python2). gdbhooks.py in GCC trunk is compatible with Python2 but not Python3. gdb-7.9-10.fc23.x86_64 (gdb) source /home/jkratoch/redhat/gcchead/gcc/c/../gdbhooks.py File "/home/jkratoch/redhat/gcchead/gcc/c/../gdbhooks.py", line 372 print format_[i] ^ SyntaxError: Missing parentheses in call to 'print' Additionally after fixing the 'print' incompatibility one gets randomly: dependence_info = {clique = 257, Python Exception name 'long' is not defined: base = 1}}}, type = }, OK for check-in? The long()->int() change I have followed from: https://stackoverflow.com/questions/14904814/nameerror-global-name-long-is-not-defined/14904834 Thanks, Jan 2015-03-09 Jan Kratochvil PR other/65366 * gdbhooks.py: Use int(...) instead of long(...). Use print(...) instead of print ... . Index: gcc/gdbhooks.py === --- gcc/gdbhooks.py (revision 221277) +++ gcc/gdbhooks.py (working copy) @@ -158,7 +158,7 @@ class Tree: self.gdbval = gdbval def is_nonnull(self): -return long(self.gdbval) +return int(self.gdbval) def TREE_CODE(self): """ @@ -197,7 +197,7 @@ class TreePrinter: # like gcc/print-tree.c:print_node_brief # #define TREE_CODE(NODE) ((enum tree_code) (NODE)->base.code) # tree_code_name[(int) TREE_CODE (node)]) -if long(self.gdbval) == 0: +if int(self.gdbval) == 0: return '' val_TREE_CODE = self.node.TREE_CODE() @@ -209,17 +209,17 @@ class TreePrinter: val_tclass = val_tree_code_type[val_TREE_CODE] val_tree_code_name = gdb.parse_and_eval('tree_code_name') -val_code_name = val_tree_code_name[long(val_TREE_CODE)] -#print val_code_name.string() +val_code_name = val_tree_code_name[int(val_TREE_CODE)] +#print(val_code_name.string()) -result = '<%s 0x%x' % (val_code_name.string(), long(self.gdbval)) -if long(val_tclass) == tcc_declaration: +result = '<%s 0x%x' % (val_code_name.string(), int(self.gdbval)) +if int(val_tclass) == tcc_declaration: tree_DECL_NAME = self.node.DECL_NAME() if tree_DECL_NAME.is_nonnull(): result += ' %s' % tree_DECL_NAME.IDENTIFIER_POINTER() else: pass # TODO: labels etc -elif long(val_tclass) == tcc_type: +elif int(val_tclass) == tcc_type: tree_TYPE_NAME = Tree(self.gdbval['type_common']['name']) if tree_TYPE_NAME.is_nonnull(): if tree_TYPE_NAME.TREE_CODE() == IDENTIFIER_NODE: @@ -242,8 +242,8 @@ class CGraphNodePrinter: self.gdbval = gdbval def to_string (self): -result = '' -result = '' val_gimple_code = self.gdbval['code'] val_gimple_code_name = gdb.parse_and_eval('gimple_code_name') -val_code_name = val_gimple_code_name[long(val_gimple_code)] +val_code_name = val_gimple_code_name[int(val_gimple_code)] result = '<%s 0x%x' % (val_code_name.string(), - long(self.gdbval)) + int(self.gdbval)) result += '>' return result @@ -306,9 +306,9 @@ class BasicBlockPrinter: self.gdbval = gdbval def to_string (self): -result = '
[PATCH] Make sure shift amount in RTL is not wider than shift mode (PR rtl-optimization/65321)
Hi! As mentioned in the PR, e.g. wide-int is very unhappy if the shift second operand doesn't fit into the shift mode. Generally, the backend shift patterns ensure that, but in debug insns nothing enforces that. This patch fixes that by making sure e.g. QImode shifts have always at QImode shift amount, HImode shifts have QImode or HImode shift amount etc. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2015-03-09 Jakub Jelinek PR rtl-optimization/65321 * cfgexpand.c (expand_debug_expr): Ensure shift amount isn't wider than shift mode. * var-tracking.c (use_narrower_mode): Likewise. * gcc.dg/pr65321.c: New test. --- gcc/cfgexpand.c.jj 2015-03-09 08:05:13.0 +0100 +++ gcc/cfgexpand.c 2015-03-09 09:15:38.139652882 +0100 @@ -3921,6 +3921,31 @@ expand_debug_expr (tree exp) op1 = expand_debug_expr (TREE_OPERAND (exp, 1)); if (!op1) return NULL_RTX; + switch (TREE_CODE (exp)) + { + case LSHIFT_EXPR: + case RSHIFT_EXPR: + case LROTATE_EXPR: + case RROTATE_EXPR: + case WIDEN_LSHIFT_EXPR: + /* Ensure second operand isn't wider than the first one. */ + inner_mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1))); + if (SCALAR_INT_MODE_P (inner_mode)) + { + machine_mode opmode = mode; + if (VECTOR_MODE_P (mode)) + opmode = GET_MODE_INNER (mode); + if (SCALAR_INT_MODE_P (opmode) + && (GET_MODE_PRECISION (opmode) + < GET_MODE_PRECISION (inner_mode))) + op1 = simplify_gen_subreg (opmode, op1, inner_mode, + subreg_lowpart_offset (opmode, + inner_mode)); + } + break; + default: + break; + } /* Fall through. */ unary: --- gcc/var-tracking.c.jj 2015-01-15 20:25:40.0 +0100 +++ gcc/var-tracking.c 2015-03-09 09:07:00.042127704 +0100 @@ -1011,7 +1011,13 @@ use_narrower_mode (rtx x, machine_mode m return simplify_gen_binary (GET_CODE (x), mode, op0, op1); case ASHIFT: op0 = use_narrower_mode (XEXP (x, 0), mode, wmode); - return simplify_gen_binary (ASHIFT, mode, op0, XEXP (x, 1)); + op1 = XEXP (x, 1); + /* Ensure shift amount is not wider than mode. */ + if (GET_MODE (op1) == VOIDmode) + op1 = lowpart_subreg (mode, op1, wmode); + else if (GET_MODE_PRECISION (mode) < GET_MODE_PRECISION (GET_MODE (op1))) + op1 = lowpart_subreg (mode, op1, GET_MODE (op1)); + return simplify_gen_binary (ASHIFT, mode, op0, op1); default: gcc_unreachable (); } --- gcc/testsuite/gcc.dg/pr65321.c.jj 2015-03-09 09:10:32.110658776 +0100 +++ gcc/testsuite/gcc.dg/pr65321.c 2015-03-09 09:10:19.0 +0100 @@ -0,0 +1,31 @@ +/* PR rtl-optimization/65321 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -g" } */ + +int a, b, c, d, e; + +int +foo (void) +{ + int h; + char i; + for (; c > 0;) +{ + for (d = 0; d < 2; d++) + { + i = 1 << d; + if (i - a) + { + e = b = 0; + for (; c; c--) + d = 127; + } + } + h = ~d; + if (h > c) + for (;;) + ; + return 0; +} + return 0; +} Jakub
[C/C++ PATCH] Further -Wlogical-not-parentheses improvement (PR c/65120)
Hi! As mentioned by richi, !x == 0 is actually equivalent to !(x == 0) and x != 0 and !x != 0 is equivalent to !(x != 0) and x == 0, so this patch adjusts the warning not to warn in that case, as adding parens doesn't change anything. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2015-03-09 Jakub Jelinek PR c/65120 * c-common.c (warn_logical_not_parentheses): Don't warn for !x == 0 or !x != 0. * c-typeck.c (parser_build_binary_op): Check for tcc_comparison before preparing arguments to warn_logical_not_parentheses. * parser.c (cp_parser_binary_expression): Check for tcc_comparison before preparing arguments to warn_logical_not_parentheses. Use maybe_constant_value on rhs. * c-c++-common/pr49706.c (fn2): Don't expect warning if enumerator on rhs is 0. (fn4): New test. * c-c++-common/pr65120.c: New test. --- gcc/c-family/c-common.c.jj 2015-02-25 07:40:46.0 +0100 +++ gcc/c-family/c-common.c 2015-03-09 19:45:27.861896547 +0100 @@ -1800,6 +1800,12 @@ warn_logical_not_parentheses (location_t || TREE_CODE (TREE_TYPE (rhs)) == BOOLEAN_TYPE) return; + /* Don't warn for !x == 0 or !y != 0, those are equivalent to + !(x == 0) or !(y != 0). */ + if ((code == EQ_EXPR || code == NE_EXPR) + && integer_zerop (rhs)) +return; + warning_at (location, OPT_Wlogical_not_parentheses, "logical not is only applied to the left hand side of " "comparison"); --- gcc/c/c-typeck.c.jj 2015-03-09 19:26:00.0 +0100 +++ gcc/c/c-typeck.c2015-03-09 20:03:42.181300577 +0100 @@ -3459,6 +3459,7 @@ parser_build_binary_op (location_t locat code1, arg1.value, code2, arg2.value); if (warn_logical_not_paren + && TREE_CODE_CLASS (code) == tcc_comparison && code1 == TRUTH_NOT_EXPR && code2 != TRUTH_NOT_EXPR /* Avoid warning for !!x == y. */ --- gcc/cp/parser.c.jj 2015-03-09 19:26:00.0 +0100 +++ gcc/cp/parser.c 2015-03-09 20:03:10.120815774 +0100 @@ -8270,6 +8270,7 @@ cp_parser_binary_expression (cp_parser* c_inhibit_evaluation_warnings -= current.lhs == truthvalue_true_node; if (warn_logical_not_paren + && TREE_CODE_CLASS (current.tree_type) == tcc_comparison && current.lhs_type == TRUTH_NOT_EXPR /* Avoid warning for !!x == y. */ && (TREE_CODE (current.lhs) != NE_EXPR @@ -8284,7 +8285,8 @@ cp_parser_binary_expression (cp_parser* && (!DECL_P (current.lhs) || TREE_TYPE (current.lhs) == NULL_TREE || TREE_CODE (TREE_TYPE (current.lhs)) != BOOLEAN_TYPE)) - warn_logical_not_parentheses (current.loc, current.tree_type, rhs); + warn_logical_not_parentheses (current.loc, current.tree_type, + maybe_constant_value (rhs)); overload = NULL; /* ??? Currently we pass lhs_type == ERROR_MARK and rhs_type == --- gcc/testsuite/c-c++-common/pr49706.c.jj 2015-03-09 19:26:00.0 +0100 +++ gcc/testsuite/c-c++-common/pr49706.c2015-03-09 19:52:31.240086911 +0100 @@ -107,9 +107,9 @@ fn2 (enum E e) b = foo_e () == A; b = foo_e () == foo_e (); - b = !e == A; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + b = !e == A; b = !e == foo_e (); /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ - b = !foo_e () == A; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + b = !foo_e () == A; b = !foo_e () == foo_e (); /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ b = !(e == A); @@ -163,3 +163,27 @@ fn3 (int i1, float f2) b = !!i1 <= f2; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ b = !!i1 >= f2; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ } + +void +fn4 (enum E e) +{ + b = e == A; + b = e == foo_e (); + b = foo_e () == B; + b = foo_e () == foo_e (); + + b = !e == B; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + b = !e == foo_e (); /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + b = !foo_e () == B; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + b = !foo_e () == foo_e (); /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + + b = !(e == B); + b = !(e == foo_e ()); + b = !(foo_e () == B); + b = !(foo_e () == foo_e ()); + + b = (!e) == B; + b = (!e) == foo_e (); + b = (!foo_e ()) == B; + b = (!foo_e ()) == foo_e (); +} --- gcc/testsuite/c-c++-common/pr65120.c.jj 2015-03-09 20:09:01.368171390 +0100 +++ gcc/testsuite/c-c++-common/pr65120.c2015-03-09 20:17:09.994324151 +0100 @@ -0
Re: [PATCH] PR63175 - [4.9/5 regression] FAIL: gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c scan-tree-dump-times slp2" basic block vectorized using SLP" 1
I backported the fix to the 4.9 branch already, so it would be nice to get the test cases fixes there as well. Martin -- that's your cue ;-) Sure. It's on my list of things to do. Martin
Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
2015-03-09 19:02 GMT+03:00 Georg-Johann Lay : > Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj: >> >> On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote: >>> >>> The new specs file generation introduces several problems. This patch >>> >>> - Fix build warnings >>> >>> - Clean up unused code and the old, now dead specs definitions. >>> >>> - Removes unused files and adjust build scripts / rules. >>> >>> - Issues with avr-libc awareness: >>> >>> -- Makes specs-generation aware of avr-libc (include tm.h in build script >>> and depend on WITH_AVRLIBC). >>> >>> -- avr-libc implements functions in libm.a which usually live in libgcc, >>> hence add -lm to libgcc_spec, cf. PR54461. >>> >>> -- The new libdev.a is a feature of avr-libc and not available with, >>> e.g., >>> newlib. Hence remove it from lib_spec if the compiler is not configured >>> for >>> avr-libc (--with-avrlibc=no). >>> >>> - Many minor issues with option propagation. >>> >>> - -march had been added to multilib generation some time ago, but >>> driver_self_spec was not aware of that option. >>> >>> >>> Ok for trunk? >>> >>> >>> BTW, anyone knows what -march= is good for? It allows all kinds of silly >>> option combinations like "-march=avrtiny -mmcu=atmega8" without any >>> complaints. >> >> >> IIRC, -march was added because replacing -mmcu= to >> -mmcu= in the driver's self specs broke multilib selection - the >> driver always acted as if no -mmcu was specified. Adding > > > For me both multilib selection and multilib generation are working as > expected with -mmcu= and without that -march=. > > Attached is a 2nd part of improvements for the specs file generation: > > - Remove -arch= and use -mmcu= again. > > - Wrap specs file selection into a new specs function so that a > comprehensible error message can be issued if no specs file is found. It > also informs about a link to spec file documentation of gcc inline docs. > > - Remove genopt.sh and avr-tables.opt. These files are no more used because > -mmcu= is a vanilla string option now. Using Enum option for -mmcu= does > not allow to specify unknown devices, and target_handle_option cannot > letgigimize unknown strings of Enum options. > > - Resurrect driver-avr.c but with new content: The new specs function. > > - New file specs.h with specs known to gcc and which can be overridden by > avrlibc.h, rtems.h, etc. > > - New device-specs files mostly repeat spec definitions, e.g. > > fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC); > fprintf (f, "*endfile:\n\t%s\n\n", ENDFILE_SPEC); > > - Device feature are expressed as subspecs now, e.g. avrlibc_startfile spec. > > - Clean up code from "current device" stuff, adjust diagnostics, avr-arch.h, > etc. > > - Use INSTALL_DATA to install spec files, not INSTALL_PROGRAM. > > > > Ok to install this, too? > > > Johann > > PR target/65296 > * config.gcc (extra_options) [avr]: Remove. > (extra_gcc_objs) [avr]: Use driver-avr.o, avr-devices.o. > (tm_file) [avr]: Add avr/specs.h after avr/avr.h. > (tm_defines) [avr, rtems]: Add WITH_RTEMS. > > * config/avr/genmultilib.awk: Use -mmcu= instead of -march=. > * config/avr/t-multilib: Regenerate. > * config/avr/specs.h: New file. > * config/avr/driver-avr.c: New file. > * config/avr/genopt.sh: Remove file. > * config/avr/avr-tables.opt: Remove file. > * config/avr/predicates.md (avr_current_arch): Rename to avr_arch. > * config/avr/avr-c.c: Same. > * avr-arch.h: Same. > (avr_current_device): Remove proto. > * config/avr/avr.c (avr_current_arch): Rename to avr_arch. > (avr_current_device): Remove definition and usage. > (avr_set_core_architecture): New static function. > (avr_option_override): Use it. > * config/avr/avr.h (avr_current_arch): Rename to avr_arch. > (AVR_HAVE_8BIT_SP): Don't depend on avr_current_device. > (EXTRA_SPEC_FUNCTIONS): Define. > (avr_devicespecs_file): New specs function proto. > (DRIVER_SELF_SPECS): Use device-specs-file spec function. > * config/avr/avr-devices.c (diagnostic.h, avr-arch.h): Include them. > (mcu_name): New static array. > (comparator, avr_archs_str, avr_mcus_str): New static functions. > (avr_inform_devices, avr_inform_core_architectures): New functions. > * config/avr/gen-avr-mmcu-specs.c (avr-arch.h, specs.h): Include. > (avrlibc.h) [WITH_AVRLIBC]: Include. > (../rtems.h, rtems.h) [WITH_RTEMS]: Include. > (print_mcu): Rewrite from scratch. > * config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC, STARTFILE_SPEC): > Forward to avr-specific specs defined in device-specs file. > * config/avr/avr.opt (config/avr/avr-arch.h): Remove include. > (-mmcu=): Add Var and MissingArgError properties. > (-march=): Remove. > * config/avr/t-avr (driver-avr
C++ PATCH for c++/65339 (ICE with lambda)
In this testcase we were crashing while trying to build up a copy constructor call within the thunk for the function pointer conversion operator, because we try to resolve 'this' and there is no 'this' in a static member function. Fixed by avoiding that resolution when we're calling a constructor, which never implicitly uses 'this'. Tested x86_64-pc-linux-gnu, applying to trunk. commit 63ca18a58a5fab2281872955d71bbeb44956a835 Author: Jason Merrill Date: Fri Mar 6 14:45:55 2015 -0500 PR c++/65339 * call.c: Don't call maybe_resolve_dummy when calling a constructor. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 2b15185..fdd8436 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -8020,7 +8020,11 @@ build_new_method_call_1 (tree instance, tree fns, vec **args, that would be captured if the call turns out to be to a non-static member function. Do not actually capture it at this point. */ - first_mem_arg = maybe_resolve_dummy (instance, false); + if (DECL_CONSTRUCTOR_P (fn)) +/* Constructors don't use the enclosing 'this'. */ +first_mem_arg = instance; + else +first_mem_arg = maybe_resolve_dummy (instance, false); /* Get the high-water mark for the CONVERSION_OBSTACK. */ p = conversion_obstack_alloc (0); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv9.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv9.C new file mode 100644 index 000..d7955fd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv9.C @@ -0,0 +1,27 @@ +// PR c++/65339 +// { dg-do compile { target c++11 } } + +class FuncWrapper { +public: + template void callfunc(Func f) + { + f(); + } +}; + +class Object { + int field; +public: + void Method(); + Object() { field = 555; } + Object(const Object&) { __builtin_abort(); } +}; + +void Object::Method () +{ + FuncWrapper wrap; + wrap.callfunc(*[]() + { + return Object(); + }); +}
Re: PR c++/64626 - C++14 single quote should not always be a digit separator
OK, thanks. Jason
Re: [patch, doc] don't document old gcc behavior in current manual
On Mar 8, 2015, at 5:26 PM, Sandra Loosemore wrote: > In general, the GCC manual documents the version of the compiler that it goes > with. New features are being added all the time, and it's not terribly > useful to users to document that such-and-such a feature isn't supported in > ancient GCC versions, or to suggest workarounds for old GCC versions that > lack the feature, or to write the documentation for a new feature in terms of > what has changed from some previous behavior of GCC instead of what the > current behavior is, or to describe a change using words like "recently" or > "newer" or "previous version" that are guaranteed to become bit-rotten over > time. I read through the change, and I like the change. :-) > This patch deletes a bunch of such material from the manual; it's probably > not exhaustive, but it's a step in the right direction, at least. One such > "recently" reference I found referred to a change that was made in 2002, > another place described behavior that was removed in version 2.6, etc. > > I'll commit this in a few days unless I hear complaints My recommendation would be, if people want information like this, they can populate the wiki with this type of information.
Re: [PATCH][RFC] Fix PR63155
On 03/09/15 07:01, Richard Biener wrote: Ok, like the following which adds a verify_ssa_coalescing () function (which could in theory be called from IL verification like verify_ssa) and calls it when ENABLE_CHECKING is defined. Bootstrap & regtest running on x86_64-unknown-linux-gnu. It didn't look appropriate for this stage to implement virtual operand verification. Ok this way? Thanks, Richard. 2015-03-06 Richard Biener PR middle-end/63155 * tree-ssa-coalesce.h (verify_ssa_coalescing): Declare. * tree-ssa-coalesce.c (attempt_coalesce): Handle graph being NULL. (coalesce_partitions): Call verify_ssa_coalescing if ENABLE_CHECKING. Split out abnormal coalescing to ... (perform_abnormal_coalescing): ... this function. (coalesce_ssa_name): Perform abnormal coalescing without computing live/conflict. (verify_ssa_coalescing_worker): New function. (verify_ssa_coalescing): Likewise. Looks good to me. jeff
Re: [PATCH] PR63175 - [4.9/5 regression] FAIL: gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c scan-tree-dump-times slp2" basic block vectorized using SLP" 1
On 03/08/15 03:14, Richard Biener wrote: On March 7, 2015 5:20:08 PM CET, Jeff Law wrote: On 03/07/15 01:34, Richard Biener wrote: On March 6, 2015 9:22:05 PM CET, Martin Sebor wrote: On 03/06/2015 10:28 AM, Jeff Law wrote: On 03/02/15 09:28, Martin Sebor wrote: On 03/02/2015 06:58 AM, Richard Biener wrote: On Fri, 27 Feb 2015, Martin Sebor wrote: Given that Martin's fix to the testcase allowed it to succeed without Richi's fix for the underlying problem, is there a modification to the testcase or a new testcase that would really test the optimization? Let me work on it. Below is a patch with a couple of minor tweaks to the existing test first to update the search string and second to better exercise the vectorization not only when the source address isn't aligned on the expected boundary but also when the destination address isn't. This enhancement revealed an outstanding aspect of the regression (not fixed by Richard's already committed patch). Besides this change, the patch also adds a number of other tests to better exercise the vectorization by verifying it takes place for arrays of elements of other sizes besides word: byte, half word, and double word. Those tests reveal both another regression WRT 4.8 and further vectorization opportunities not exploited even in 4.8. I marked the latter XFAIL in the tests so that when the regression is fully resolved, the tests should pass with no unexpected failures. I have a hard time applying the patch because of line-wrapping issues or my patch tool not groking the git diffs. Can you please either commit the patch or extract the testcase that still regresses and paste it into PR63175? I pasted a couple of such test cases to the bug. The full patch is also attached to this email in case there was a problem with line wrapping. So for the unaligned case, is that really a regression when compared to earlier compilers? If not, then it seems that we ought to at least be at a point where the regression marker for that BZ can be removed, right? ie, Richi's patch fixed the actual code quality regression and your patch fixes the testsuite aspects, right? My interpretation of the bug report is that it points out two problems: 1) a failure in the costmodel-bb-slp-9a.c test 2) a quality regression observed by inspecting the assembly emitted for the test The two are unrelated in that (2) didn't cause (1). Since Richi's patch fixed (2) and my latest patch fixes (1) I would be inclined to consider the bug resolved. While GCC 5 doesn't vectorize some code that 4.8 does with the same options, it's apparently by accident (or due to a bug in 4.8). Since 5.0 does vectorize the same code when the right set of options is specified, I agree with others that none of my additional tests has exposed any other regressions than the one that's already been addressed. Yes. Once the test cases have been fixed we should close the bug as fixed. Trunk regression marker removed. Not sure if it is worth backporting to 4.9, but I left the 4.9 regression marker and the BZ open just in case. I backported the fix to the 4.9 branch already, so it would be nice to get the test cases fixes there as well. Martin -- that's your cue ;-) jeff
Re: [PATCH] Fix ICE during LTO odr reporting (PR lto/65361)
On 03/09/15 12:31, Jakub Jelinek wrote: Hi! BINFO_BASE_BINFO always gives a TREE_BINFO, so using DECL_CONTEXT on it is wrong. The following patch fixes it to use BINFO_TYPE instead. Bootstrapped/regtested on x86_64-linux and i686-linux, tested also on the testcase in the PR. Ok for trunk? We don't seem to have infrastructure for testing errors during LTO linking, so no testcase included. 2015-03-09 Jakub Jelinek PR lto/65361 * ipa-devirt.c (add_type_duplicate): Don't use DECL_CONTEXT on a TREE_BINFO, instead use BINFO_TYPE. OK. jeff
Re: [PATCH][RFC] Fix PR63155
On 03/09/15 03:42, Richard Biener wrote: On Fri, 6 Mar 2015, Jeff Law wrote: On 03/06/15 06:16, Richard Biener wrote: This fixes PR63155 and reduces the memory usage at -O0 from reported 10GB (couldn't verify/update on my small box) to 350MB (still worse compared to 4.8 which needs only 50MB). It fixes this by no longer computing live info or building a conflict graph for coalescing of SSA names flowing over abnormal edges (which needs to succeed). Of course this also removes verification that this coalescing is valid (but computing this has quadratic cost). With this it turns ICEs into miscompiles. We could restrict verifying that we can perform abnormal coalescing to ENABLE_CHECKING (and I've wanted a verifier pass that can verify this multiple times to be able to catch what breaks it and not having to work back from out-of-SSA ICEing...). So any opinion on this patch welcome. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Ok for trunk? ;) Thanks, Richard. 2015-03-06 Richard Biener PR middle-end/63155 * tree-ssa-coalesce.c (attempt_coalesce): Handle graph being NULL. (coalesce_partitions): Split out abnormal coalescing to ... (perform_abnormal_coalescing): ... this function. (coalesce_ssa_name): Perform abnormal coalescing without computing live/conflict. I'd personally like to keep the checking when ENABLE_CHECKING. I haven't followed this discussion real closely, but I wonder if some kind of blocking approach would work without blowing up the memory consumption. There's no inherent reason why we have to coalesce everything at the same time. We can use a blocking factor and do coalescing on some N number of SSA_NAMEs at a time. Yes, that's possible at (quite?) some compile-time cost. Note that we can't really guarantee that the resulting live/conflict problems shrink significantly enough without sorting the coalesces in a different way (not after important coalesces but after their basevars). Yea, it's a class time/space tradeoff. I guess it comes down to how much compile-time pain we'll take for reducing memory usage. It may also be the case that some blocking factors are actually faster than doing everything at once, even for more common input graph sizes. I actually ran into this when looking at the liveness computations for into-ssa eons ago. We were computing liveness in parallel, but a blocking of 1 object is actually best: https://gcc.gnu.org/ml/gcc-patches/2003-10/msg01301.html Jeff
Re: [patch, build] Restore bootstrap in building libcc1 on darwin
On Mar 8, 2015, at 10:38 AM, Iain Sandoe wrote: > +Ian > + ping So, all the darwinness of the patch looks fine to me. One maintainer down, just need libiberty approval. If the work becomes too bothersome, the comment out the line and say, # does’t work with libcc1 approach for the config fragment I’ll pre-approve if you want to punt at any point.
Re: [patch] Optimize empty class copies within a C++ return statement
On 03/06/2015 02:01 PM, Jason Merrill wrote: On 03/06/2015 05:01 PM, Jason Merrill wrote: On 03/06/2015 04:54 PM, Aldy Hernandez wrote: But doesn't this still involve a MODIFY_EXPR, i.e. return retval = D.2349? If I understand you correct, no. gimplify_return_expr creates a new temporary and uses that instead of : else if (gimplify_ctxp->return_temp) result = gimplify_ctxp->return_temp; else { result = create_tmp_reg (TREE_TYPE (result_decl)); ... } ... ... /* Smash the lhs of the MODIFY_EXPR to the temporary we plan to use. Then gimplify the whole thing. */ if (result != result_decl) TREE_OPERAND (ret_expr, 0) = result; Sounds like ret_expr is a MODIFY_EXPR. Oh, but with the wrong lhs, I see. I know you want to reuse the MODIFY_EXPR case in cp_gimplify_expr, but after playing around with it, I think it requires too much special casing to make it clean. For instance, the MODIFY_EXPR case returns the RHS of expression which is the opposite of what we want. For this: return retval = ...the MODIFY_EXPR case would build a COMPOUND_EXPR with "return <<>>>", which would return , not retval. And what we probably want is a statement list with: return retval Also, the actual case we're dealing with here is a bit more complicated, as it involves a COMPOUND_EXPR in the RHS, which we'd have to adapt MODIFY_EXPR to handle: return retval = <<> IMHO, adding a special case for all this is a lot messier than what I originally suggested. What do you think? Aldy
[PATCH] Fix ICE during LTO odr reporting (PR lto/65361)
Hi! BINFO_BASE_BINFO always gives a TREE_BINFO, so using DECL_CONTEXT on it is wrong. The following patch fixes it to use BINFO_TYPE instead. Bootstrapped/regtested on x86_64-linux and i686-linux, tested also on the testcase in the PR. Ok for trunk? We don't seem to have infrastructure for testing errors during LTO linking, so no testcase included. 2015-03-09 Jakub Jelinek PR lto/65361 * ipa-devirt.c (add_type_duplicate): Don't use DECL_CONTEXT on a TREE_BINFO, instead use BINFO_TYPE. --- gcc/ipa-devirt.c.jj 2015-03-09 08:05:13.0 +0100 +++ gcc/ipa-devirt.c2015-03-09 16:23:42.277861689 +0100 @@ -1505,9 +1505,9 @@ add_type_duplicate (odr_type val, tree t extra_base = BINFO_BASE_BINFO (TYPE_BINFO (val->type), BINFO_N_BASE_BINFOS (TYPE_BINFO (type))); - inform (DECL_SOURCE_LOCATION - (TYPE_NAME (DECL_CONTEXT (extra_base))), - "the extra base is defined here "); + tree extra_base_type = BINFO_TYPE (extra_base); + inform (DECL_SOURCE_LOCATION (TYPE_NAME (extra_base_type)), + "the extra base is defined here"); } base_mismatch = true; } Jakub
[PATCH] Reapply David's libsanitizer fix (PR sanitizer/63958)
Hi! I've reapplied David's fix to trunk after Matthias tested it on sparc* and I've regtested it on x86_64-linux and i686-linux. 2015-03-09 Jakub Jelinek PR sanitizer/63958 Reapply: 2014-10-14 David S. Miller * sanitizer_common/sanitizer_platform_limits_linux.cc (time_t): Define at __kernel_time_t, as needed for sparc. (struct __old_kernel_stat): Don't check if __sparc__ is defined. * libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h (__sanitizer): Define struct___old_kernel_stat_sz, struct_kernel_stat_sz, and struct_kernel_stat64_sz for sparc. (__sanitizer_ipc_perm): Adjust for sparc targets. (__sanitizer_shmid_ds): Likewsie. (__sanitizer_sigaction): Likewise. (IOC_SIZE): Likewsie. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h (revision 216223) +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h (revision 216224) @@ -72,6 +72,14 @@ namespace __sanitizer { const unsigned struct_kernel_stat_sz = 144; #endif const unsigned struct_kernel_stat64_sz = 104; +#elif defined(__sparc__) && defined(__arch64__) + const unsigned struct___old_kernel_stat_sz = 0; + const unsigned struct_kernel_stat_sz = 104; + const unsigned struct_kernel_stat64_sz = 144; +#elif defined(__sparc__) && !defined(__arch64__) + const unsigned struct___old_kernel_stat_sz = 0; + const unsigned struct_kernel_stat_sz = 64; + const unsigned struct_kernel_stat64_sz = 104; #endif struct __sanitizer_perf_event_attr { unsigned type; @@ -94,7 +102,7 @@ namespace __sanitizer { #if defined(__powerpc64__) const unsigned struct___old_kernel_stat_sz = 0; -#else +#elif !defined(__sparc__) const unsigned struct___old_kernel_stat_sz = 32; #endif @@ -173,6 +181,18 @@ namespace __sanitizer { unsigned short __pad1; unsigned long __unused1; unsigned long __unused2; +#elif defined(__sparc__) +# if defined(__arch64__) +unsigned mode; +unsigned short __pad1; +# else +unsigned short __pad1; +unsigned short mode; +unsigned short __pad2; +# endif +unsigned short __seq; +unsigned long long __unused1; +unsigned long long __unused2; #else unsigned short mode; unsigned short __pad1; @@ -190,6 +210,26 @@ namespace __sanitizer { struct __sanitizer_shmid_ds { __sanitizer_ipc_perm shm_perm; + #if defined(__sparc__) + # if !defined(__arch64__) +u32 __pad1; + # endif +long shm_atime; + # if !defined(__arch64__) +u32 __pad2; + # endif +long shm_dtime; + # if !defined(__arch64__) +u32 __pad3; + # endif +long shm_ctime; +uptr shm_segsz; +int shm_cpid; +int shm_lpid; +unsigned long shm_nattch; +unsigned long __glibc_reserved1; +unsigned long __glibc_reserved2; + #else #ifndef __powerpc__ uptr shm_segsz; #elif !defined(__powerpc64__) @@ -227,6 +267,7 @@ namespace __sanitizer { uptr __unused4; uptr __unused5; #endif +#endif }; #elif SANITIZER_FREEBSD struct __sanitizer_ipc_perm { @@ -523,9 +564,13 @@ namespace __sanitizer { #else __sanitizer_sigset_t sa_mask; #ifndef __mips__ +#if defined(__sparc__) +unsigned long sa_flags; +#else int sa_flags; #endif #endif +#endif #if SANITIZER_LINUX void (*sa_restorer)(); #endif @@ -745,7 +790,7 @@ struct __sanitizer_obstack { #define IOC_NRBITS 8 #define IOC_TYPEBITS 8 -#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) +#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || defined(__sparc__) #define IOC_SIZEBITS 13 #define IOC_DIRBITS 3 #define IOC_NONE 1U @@ -775,7 +820,17 @@ struct __sanitizer_obstack { #define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK) #define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK) #define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK) + +#if defined(__sparc__) +// In sparc the 14 bits SIZE field overlaps with the +// least significant bit of DIR, so either IOC_READ or +// IOC_WRITE shall be 1 in order to get a non-zero SIZE. +# define IOC_SIZE(nr) \ + ((nr) >> 29) & 0x7) & (4U|2U)) == 0)? \ + 0 : (((nr) >> 16) & 0x3fff)) +#else #define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK) +#endif extern unsigned struct_arpreq_sz; extern unsigned struct_ifreq_sz; --- libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc (revision 216223) +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc (revision 216224) @@ -36,6 +36,7 @@ #define uid_t __kernel_uid_t #define gid_t __kernel_gid_t #define off_t __kernel_off_t +#define time_t __kernel_time_t // This header seems to contain the definitions of _kernel_ stat* structs. #include #undef ino_t @@ -60,7 +61,7 @@ namespace __sanitizer { } // namespace __sanitizer #if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__aarch64__)
Re: [PATCH] target/65286 - Disable multilib for ppc64le
On Thu, Mar 5, 2015 at 6:14 PM, Alan Modra wrote: > This arranges to build a powerpc64le-linux compiler without -m32 > support by default. Bootstrapped and regression tested on Ubuntu > powerpc64le-linux without --disable-multilib, and on powerpc64-linux > and powerpc-linux. OK for mainline and branches? > > This part of the config.gcc patch does most of the work > - case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in > - always:* | yes:*powerpc64* | yes:all:* | yes:*:yes) > + case ${target}:${enable_targets}:${maybe_biarch} in > + powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \ > + | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \ > + | powerpcle-*:*powerpc64le*:yes) > > always:* becomes powerpc64-*, ie. exclude powerpc64le > yes:*powerpc64* becomes *:*powerpc64-*:yes, excluding powerpc64le so > that --target=powerpc64le-linux --enable-targets=powerpc64le-linux > doesn't accidentally get you a biarch compiler. > yes:all:* becomes *:all:yes, more or less unchanged. > yes:*:yes becomes powerpc-*:*:yes allowing --target=powerpc-linux > --with-cpu= to continue to build a biarch ppc64 > compiler. > > Some other notes: > t-fprules setting of MULTILIB variables is in every case overridden by > a following t-file, except for the commented out powerpc-*-openbsd*. > Since the aim of this patch is to build powerpc64le without multilibs, > the default setting of these vars needs to go. t-ppcos needs to be > removed from powerpc64le configurations for the same reason. Oh, and > adding t-fprules and t-ppcos before previous additions to tmake_file > is no longer necessary. I checked all the other t-files that might be > added for interactions. > > The linux64.h change is so that passing -m32 results in > error: -m32 not supported in the configuration > rather than the confusing > error: -m64 requires a PowerPC64 cpu > (Yes, I know using TARGET_64BIT_P would be nicer, but it's probably > better left to a cleanup patch.) > > PR target/65286 > * config.gcc (powerpc*-*-linux*): Arrange for powerpc64le-linux > to be single-arch by default. Set cpu_is_64bit for powerpc64 > given --with-cpu=native. > * config/rs6000/t-fprules: Do not set default MULTILIB vars. > * config/rs6000/t-linux (MULTIARCH_DIRNAME): Support powerpc64 > and powerpc64le. > * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Test > rs6000_isa_flags rather than TARGET_64BIT. Okay. The number of name variations is annoying, but I guess there's no choice now. Thanks, David
Re: [PATCH] [RTL] Relax CSE check to set REG_EQUAL notes.
On 03/09/15 03:53, Steven Bosscher wrote: On Wed, Mar 4, 2015 at 12:09 PM, Alex Velenko wrote: For example, in arm testcase pr43920-2.c, CSE previously decided not to put an "obvious" note on insn 9, as set value was the same as note value. At the same time, other insns set up as -1 were set up through a register and did get a note: ...which is the point of the REG_EQUAL notes. In insn 8 there is a REG_EQUAL note to show that the value of r111 is known. In insn 9 the known value is, well, known from SET_SRC so there is no need for a REG_EQUAL note. Adding REG_EQUAL notes in such cases is just wasteful. RIght. I'd rather look into why later passes aren't discovering whatever equivalences are important rather than adding the redundant notes. Regardless, I think this is a gcc-6 issue, so I'm not likely to look at it in the immediate future. jeff
Re: Fix vectorizer alignment update wrt section anchors
> make_decl_rtl only calls this for: > if (TREE_CODE (decl) == FUNCTION_DECL > && cgraph_node::get (decl) > && cgraph_node::get (decl)->instrumentation_clone) > Is it intentional you are doing it unconditionally? Yes, ultimate_transparent_alias_target is either called in make_decl_rtl or in assemble_name. I do not think there is way the symbol can land into .s file untranslated. I must admit I am surprised instrumentation_clones need any special handling here. instrumentation clones have special cases all over symbol table/cgrap code. I need to get familiar with these. > > > + *t = ggc_strdup (targetm.strip_name_encoding (IDENTIFIER_POINTER > > (id))); > > Otherwise it looks reasonable. Another option would be to just create the > RTL for notice_global_symbol purposes using make_decl_rtl_for_debug. Hmm, did not know about this one, but I think avoiding RTL here is best. Thanks for comments! Honza > > Jakub
Re: [PR58315] reset inlined debug vars at return-to point
On 03/09/15 08:38, Richard Biener wrote: On Fri, Mar 6, 2015 at 7:04 PM, Alexandre Oliva wrote: On Feb 26, 2015, Alexandre Oliva wrote: So far, all the differences I looked at were caused by padding at the end of BBs, and by jump stmts without line numbers at the end of BBs, both right after the debug reset stmts the proposed patch introduces. Further investigation showed there were other sources of spurious differences: - copies arising from the expansion of PHI nodes; source code information associated with these copies points at the source of the copy, which is hardly useful and sensible. Care to explain? We spend quite some resources to maintain them (locations on PHI args, that is). I almost responded to that claim as well, but then thought better of it as that patch (AFAICT) wasn't proposed for inclusion, but was being used for testing purposes. Expansion of the PHI into copies should have locations which point to the source of the various PHI args. Those are quite meaningful. Jeff
Re: Fix vectorizer alignment update wrt section anchors
On Mon, Mar 09, 2015 at 04:38:57AM +0100, Jan Hubicka wrote: > --- varasm.c (revision 221269) > +++ varasm.c (working copy) > @@ -1630,35 +1630,30 @@ default_ctor_section_asm_out_constructor > void > notice_global_symbol (tree decl) > { > - const char **type = &first_global_object_name; > + const char **t = &first_global_object_name; > >if (first_global_object_name >|| !TREE_PUBLIC (decl) >|| DECL_EXTERNAL (decl) >|| !DECL_NAME (decl) > + || (TREE_CODE (decl) == VAR_DECL && DECL_HARD_REGISTER (decl)) >|| (TREE_CODE (decl) != FUNCTION_DECL > && (TREE_CODE (decl) != VAR_DECL > || (DECL_COMMON (decl) > && (DECL_INITIAL (decl) == 0 > - || DECL_INITIAL (decl) == error_mark_node > - || !MEM_P (DECL_RTL (decl))) > + || DECL_INITIAL (decl) == error_mark_node) > return; > >/* We win when global object is found, but it is useful to know about weak > symbol as well so we can produce nicer unique names. */ >if (DECL_WEAK (decl) || DECL_ONE_ONLY (decl) || flag_shlib) > -type = &weak_global_object_name; > +t = &weak_global_object_name; > > - if (!*type) > + if (!*t) > { > - const char *p; > - const char *name; > - rtx decl_rtl = DECL_RTL (decl); > - > - p = targetm.strip_name_encoding (XSTR (XEXP (decl_rtl, 0), 0)); > - name = ggc_strdup (p); > - > - *type = name; > + tree id = DECL_ASSEMBLER_NAME (decl); > + ultimate_transparent_alias_target (&id); make_decl_rtl only calls this for: if (TREE_CODE (decl) == FUNCTION_DECL && cgraph_node::get (decl) && cgraph_node::get (decl)->instrumentation_clone) Is it intentional you are doing it unconditionally? > + *t = ggc_strdup (targetm.strip_name_encoding (IDENTIFIER_POINTER > (id))); Otherwise it looks reasonable. Another option would be to just create the RTL for notice_global_symbol purposes using make_decl_rtl_for_debug. Jakub
Re: PR c++/64626 - C++14 single quote should not always be a digit separator
Forget this last patch. The syntax of my dg lines was wrong and I'm seeing errors I'm not sure I like. I need to look at this further. I'm sorry for the noise.
Re: [patch,avr]: Fix various problems with specs and specs file generation.
Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj: On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote: BTW, anyone knows what -march= is good for? It allows all kinds of silly option combinations like "-march=avrtiny -mmcu=atmega8" without any complaints. IIRC, -march was added because replacing -mmcu= to -mmcu= in the driver's self specs broke multilib selection - the driver always acted as if no -mmcu was specified. Adding a new option (-march), translating mmcu= to march= and then basing t-multilib on that worked ok. Okay. For me it works with -mmcu=, cf. the follow-up patch https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00477.html Two more questions 1) What is the new macro __AVR_DEV_LIB_NAME__ for? It uses avr_mcu_t.library_name. This field contained a part of the crt.o file name like "m8" for atmega8's crtm8.o. The new naming convention is that device libs are located in dev/atmega8/libdev.a and startup in dev/atmega8/crt1.o. The current definition of __AVR_DEV_LIB_NAME__ should be "atmega8" and not "m8", hence always that same as __AVR_DEVICE_NAME__. This macro is not documented in the documentation and useless. If it is not needed and the .library_name field is dead, I'd propose to clean up both. 2) What about -mpmem-wrap-around resp. ld's --pmem-wrap-around= ? The wrap around moduli are currently hard coded in specs and just cover a few, very old devices. Presumably that is option-rot? Does relaxation still need that option to operate correctly? If not, I'd clean that up, too Johann
Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)
On 03/09/2015 10:34 AM, Jakub Jelinek wrote: On Fri, Feb 27, 2015 at 05:29:47PM -0500, Jason Merrill wrote: On 02/19/2015 07:03 PM, Jakub Jelinek wrote: + /* Avoid warning for !!b == y where b is boolean. */ + && (!DECL_P (current.lhs) + || TREE_TYPE (current.lhs) == NULL_TREE + || TREE_CODE (TREE_TYPE (current.lhs)) != BOOLEAN_TYPE)) There's something wrong here. If the type is null, trying to check its TREE_CODE will SEGV. If the type is NULL, then it will just call warn_logical_not_parentheses and won't check TREE_CODE. Only when it is non-NULL, it will check TREE_CODE and if it is not BOOLEAN_TYPE, will call warn_logical_not_parentheses. You're right, of course. I guess I was reading the || as an &&. The patch is OK. Jason
Re: [PATCH] Fix thunk expansion (PR ipa/64896)
Hi, As added in the PR, this issue is also present on 4.9 branch and affects at least arm-linux-gnueabihf target (as reported in PR61207). I've backported it in the 4.9 branch with the attached patch. The difference with the trunk code is due the code introduced by PR63587 fix (I didn't checked on power7, on which the PR was initially reported, but I didn't managed to reproduce the issue for arm targets on 4.9 branch). Boostrapped on x86_64, and tested on arm/aarch64 targets (regression testing is ongoing). is ok for 4.9 branch when validation is done ? Thanks Yvan gcc/ 2015-03-09 Yvan Roux Backport from trunk r220489. 2015-02-06 Jakub Jelinek PR ipa/64896 * cgraphunit.c (cgraph_node::expand_thunk): If restype is not is_gimple_reg_type nor the thunk_fndecl returns aggregate_value_p, set restmp to a temporary variable instead of resdecl. gcc/testsuite/ 2015-03-09 Yvan Roux Backport from trunk r220489. 2015-02-06 Jakub Jelinek PR ipa/64896 * g++.dg/ipa/pr64896.C: New test. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 8f57607..130fc0d 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1572,9 +1572,14 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks) restmp = gimple_fold_indirect_ref (resdecl); else if (!is_gimple_reg_type (restype)) { - restmp = resdecl; - add_local_decl (cfun, restmp); - BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; + if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))) + { + restmp = resdecl; + add_local_decl (cfun, restmp); + BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; + } + else + restmp = create_tmp_var (restype, "retval"); } else restmp = create_tmp_reg (restype, "retval"); diff --git a/gcc/testsuite/g++.dg/ipa/pr64896.C b/gcc/testsuite/g++.dg/ipa/pr64896.C new file mode 100644 index 000..0a78220 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr64896.C @@ -0,0 +1,29 @@ +// PR ipa/64896 +// { dg-do compile } +// { dg-options "-O2" } + +struct A { int a, b; }; +struct B { A c; int d; }; +struct C { virtual B fn1 () const; }; +struct D { B fn2 () const; int fn3 () const; C *fn4 () const; }; + +int +D::fn3 () const +{ + fn4 ()->fn1 (); +} + +B +D::fn2 () const +{ + return B (); +} + +class F : C +{ + B + fn1 () const + { +return B (); + } +};
Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj: On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote: The new specs file generation introduces several problems. This patch - Fix build warnings - Clean up unused code and the old, now dead specs definitions. - Removes unused files and adjust build scripts / rules. - Issues with avr-libc awareness: -- Makes specs-generation aware of avr-libc (include tm.h in build script and depend on WITH_AVRLIBC). -- avr-libc implements functions in libm.a which usually live in libgcc, hence add -lm to libgcc_spec, cf. PR54461. -- The new libdev.a is a feature of avr-libc and not available with, e.g., newlib. Hence remove it from lib_spec if the compiler is not configured for avr-libc (--with-avrlibc=no). - Many minor issues with option propagation. - -march had been added to multilib generation some time ago, but driver_self_spec was not aware of that option. Ok for trunk? BTW, anyone knows what -march= is good for? It allows all kinds of silly option combinations like "-march=avrtiny -mmcu=atmega8" without any complaints. IIRC, -march was added because replacing -mmcu= to -mmcu= in the driver's self specs broke multilib selection - the driver always acted as if no -mmcu was specified. Adding For me both multilib selection and multilib generation are working as expected with -mmcu= and without that -march=. Attached is a 2nd part of improvements for the specs file generation: - Remove -arch= and use -mmcu= again. - Wrap specs file selection into a new specs function so that a comprehensible error message can be issued if no specs file is found. It also informs about a link to spec file documentation of gcc inline docs. - Remove genopt.sh and avr-tables.opt. These files are no more used because -mmcu= is a vanilla string option now. Using Enum option for -mmcu= does not allow to specify unknown devices, and target_handle_option cannot letgigimize unknown strings of Enum options. - Resurrect driver-avr.c but with new content: The new specs function. - New file specs.h with specs known to gcc and which can be overridden by avrlibc.h, rtems.h, etc. - New device-specs files mostly repeat spec definitions, e.g. fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC); fprintf (f, "*endfile:\n\t%s\n\n", ENDFILE_SPEC); - Device feature are expressed as subspecs now, e.g. avrlibc_startfile spec. - Clean up code from "current device" stuff, adjust diagnostics, avr-arch.h, etc. - Use INSTALL_DATA to install spec files, not INSTALL_PROGRAM. Ok to install this, too? Johann PR target/65296 * config.gcc (extra_options) [avr]: Remove. (extra_gcc_objs) [avr]: Use driver-avr.o, avr-devices.o. (tm_file) [avr]: Add avr/specs.h after avr/avr.h. (tm_defines) [avr, rtems]: Add WITH_RTEMS. * config/avr/genmultilib.awk: Use -mmcu= instead of -march=. * config/avr/t-multilib: Regenerate. * config/avr/specs.h: New file. * config/avr/driver-avr.c: New file. * config/avr/genopt.sh: Remove file. * config/avr/avr-tables.opt: Remove file. * config/avr/predicates.md (avr_current_arch): Rename to avr_arch. * config/avr/avr-c.c: Same. * avr-arch.h: Same. (avr_current_device): Remove proto. * config/avr/avr.c (avr_current_arch): Rename to avr_arch. (avr_current_device): Remove definition and usage. (avr_set_core_architecture): New static function. (avr_option_override): Use it. * config/avr/avr.h (avr_current_arch): Rename to avr_arch. (AVR_HAVE_8BIT_SP): Don't depend on avr_current_device. (EXTRA_SPEC_FUNCTIONS): Define. (avr_devicespecs_file): New specs function proto. (DRIVER_SELF_SPECS): Use device-specs-file spec function. * config/avr/avr-devices.c (diagnostic.h, avr-arch.h): Include them. (mcu_name): New static array. (comparator, avr_archs_str, avr_mcus_str): New static functions. (avr_inform_devices, avr_inform_core_architectures): New functions. * config/avr/gen-avr-mmcu-specs.c (avr-arch.h, specs.h): Include. (avrlibc.h) [WITH_AVRLIBC]: Include. (../rtems.h, rtems.h) [WITH_RTEMS]: Include. (print_mcu): Rewrite from scratch. * config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC, STARTFILE_SPEC): Forward to avr-specific specs defined in device-specs file. * config/avr/avr.opt (config/avr/avr-arch.h): Remove include. (-mmcu=): Add Var and MissingArgError properties. (-march=): Remove. * config/avr/t-avr (driver-avr.o): New rule. (avr-devices.o): Depend on avr-arch.h. (avr-mcus): No more depend on avr-tables.opt. (avr-tables.opt): Remove rule. (install-device-specs): Use INSTALL_DATA, not INSTALL_PROGRAM. a new option (-march), translating mmcu= to march= and then basing t-multilib on that worked
Re: [PATCH] PR target/65240, Fix Power{7,8} insn constraint issue with -O3 -ffast-math
On Fri, Mar 06, 2015 at 01:05:31PM +0100, Richard Biener wrote: > On Thu, Mar 5, 2015 at 9:06 PM, Michael Meissner > wrote: > > This patch fixes PR 65240, which was a latent bug that was introduced when I > > added the -mupper-regs support to the PowerPC compiler. In the PowerPC > > compiler, if you use -ffast-math, the compiler allows floating point > > constants > > in move RTLs until register allocation time, in order to allow the > > optimizations that replace division by a constant with multiplication by the > > reciprocal. > > Don't we perform this optimization on the GIMPLE/tree level already? > > Richard. I've suspected that the code is a hold over from the days when the multiply by the reciprocal was done in RTL. I didn't want to change the logic right now, but it something that should be investigated when GCC 6.0 opens up. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Re: [PATCH] Improve PR44563
On Mon, Mar 9, 2015 at 4:12 PM, Richard Biener wrote: > ! /* This is a really poor hash function, but it is what the current code > uses, > ! so I am reusing it to avoid an additional axis in testing. */ This is a bit silly as a comment, because after your patch the "current" code is the patched code. Better to reference the htab_hash_pointer function. But can't we add an inline version in hashtab.h instead? Ciao! Steven
Re: PR c++/64626 - C++14 single quote should not always be a digit separator
On 03/08/2015 02:52 PM, Jakub Jelinek wrote: On Sun, Mar 08, 2015 at 02:33:03PM -0400, Ed Smith-Rowland wrote: I just look to see if a lexed number in libcpp ends in a '. If so, back up one character and let string processing handle it. I get one warning and one error for each instance but I'd rather not error when it should pass. Built and tests clean on x86_64-linux. OK? libcpp/ 2015-03-09 Edward Smith-Rowland <3dw...@verizon.net> PR c++/64626 * expr.c (parse_has_attribute): New function; (eval_token): Look for __has_attribute__ and route to parse_has_attribute. This ChangeLog entry doesn't match the patch, you've changed lex.c (lex_number) instead... --- libcpp/lex.c(revision 221218) +++ libcpp/lex.c(working copy) @@ -1400,6 +1400,9 @@ NORMALIZE_STATE_UPDATE_IDNUM (nst, *cur); cur++; } + /* A number can't end with a digit separator. */ + if (DIGIT_SEP (cur[-1])) + --cur; pfile->buffer->cur = cur; } Jakub Sigh. A paste-o from another CL entry. Also, I decided I should treat the following: 0''; 123'; It won't hurt and it's easy. Here is a new patch and CL. Ed Index: libcpp/lex.c === --- libcpp/lex.c(revision 221218) +++ libcpp/lex.c(working copy) @@ -1400,6 +1400,9 @@ NORMALIZE_STATE_UPDATE_IDNUM (nst, *cur); cur++; } + /* A number can't end with a digit separator. */ + while (cur > pfile->buffer->cur && DIGIT_SEP (cur[-1])) + --cur; pfile->buffer->cur = cur; } Index: gcc/testsuite/g++.dg/cpp1y/pr64626-1.C === --- gcc/testsuite/g++.dg/cpp1y/pr64626-1.C (revision 0) +++ gcc/testsuite/g++.dg/cpp1y/pr64626-1.C (working copy) @@ -0,0 +1,20 @@ +// PR c++/64626 +// { dg-do compile { target c++14 } } + +#define STR(s) #s +int +main() +{ + int i = 1'2; + const char *s[3] + { +STR(1' '), +STR(..), +STR(%:%), + }; +} +#if 0 +1' ' +.. +%:% +#endif Index: gcc/testsuite/g++.dg/cpp1y/pr64626-2.C === --- gcc/testsuite/g++.dg/cpp1y/pr64626-2.C (revision 0) +++ gcc/testsuite/g++.dg/cpp1y/pr64626-2.C (working copy) @@ -0,0 +1,12 @@ +// PR c++/64626 +// { dg-do compile { target c++14 } } + +0''; // { dg-error "empty character constant" } + +123'''; // { dg-error "empty character constant" } + +// { dg-error "expected unqualified-id before numeric constant" { target *-*-* } 4 } + +// { dg-warning "missing terminating" { target *-*-* } 6 } +// { dg-error "missing terminating" { target *-*-* } 6 } +// { dg-error "expected unqualified-id before numeric constant" { target *-*-* } 6 } Index: gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C === --- gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C (revision 221218) +++ gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C (working copy) @@ -10,7 +10,7 @@ i = 0004''000'000; // { dg-error "adjacent digit separators" } i = 0B1'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0; // OK i = 0b'0001'''''; // { dg-error "digit separator after base indicator" } - i = 0b0001''''''; // { dg-error "digit separator outside digit sequence" } + i = 0b0001''''''; // { dg-error "missing terminating" } unsigned u = 0b0001''''''U; // { dg-error "digit separator outside digit sequence" } double d = 0.0; @@ -18,9 +18,15 @@ d = 1.'602'176'565e-19; // { dg-error "digit separator adjacent to decimal point" } d = 1.602''176'565e-19; // { dg-error "adjacent digit separators" } d = 1.602'176'565'e-19; // { dg-error "digit separator adjacent to exponent" } - d = 1.602'176'565e'-19; // { dg-error "digit separator adjacent to exponent" } + d = 1.602'176'565e'-19; // { dg-error "missing terminating" } d = 1.602'176'565e-'19; // { dg-error "digit separator adjacent to exponent" } d = 1.602'176'565e-1'9; // OK - d = 1.602'176'565e-19'; // { dg-error "digit separator outside digit sequence" } + d = 1.602'176'565e-19'; // { dg-error "missing terminating" } float f = 1.602'176'565e-19'F; // { dg-error "digit separator outside digit sequence" } } + +// { dg-warning "missing terminating" { target *-*-* } 13 } + +// { dg-warning "missing terminating" { target *-*-* } 21 } + +// { dg-warning "missing terminating" { target *-*-* } 24 } libcpp/ 2015-03-09 Edward Smith-Rowland <3dw...@verizon.net> PR c++/64626 * lex.c (lex_number): If a number ends with digit-seps (') skip back and let lex_string take them. gcc/testsuite/ 2015-03-09 Edward Smith-Rowland <3dw...@verizon.net> PR c++/64626 g++.dg/cpp1y/pr64626-1.C: New. g++.dg/cpp1y/pr64626-2.C: New. g++.dg/cpp1y
[PATCH] Improve PR44563
This reduces the time spent in cgraph call-site hash by providing inline version of htab_hash_pointer. Bootstrap / regtest on x86_64-unknown-linux-gnu in progress. Ok? Thanks, Richard. 2015-03-09 Richard Biener PR middle-end/44563 * cgraph.h (struct cgraph_edge_hasher): Add hash overload for compare_type. * cgraph.c (cgraph_edge_hasher::hash): Inline htab_hash_pointer. (cgraph_update_edge_in_call_site_hash): Use cgraph_edge_hasher::hash. (cgraph_add_edge_to_call_site_hash): Likewise. (cgraph_node::get_edge): Likewise. (cgraph_edge::set_call_stmt): Likewise. (cgraph_edge::remove_caller): Likewise. Index: gcc/cgraph.c === *** gcc/cgraph.c(revision 221277) --- gcc/cgraph.c(working copy) *** cgraph_node::get_for_asmname (tree asmna *** 663,669 hashval_t cgraph_edge_hasher::hash (cgraph_edge *e) { ! return htab_hash_pointer (e->call_stmt); } /* Return nonzero if the call_stmt of of cgraph_edge X is stmt *Y. */ --- 663,681 hashval_t cgraph_edge_hasher::hash (cgraph_edge *e) { ! /* This is a really poor hash function, but it is what the current code uses, ! so I am reusing it to avoid an additional axis in testing. */ ! return (hashval_t) ((intptr_t)e->call_stmt >> 3); ! } ! ! /* Returns a hash value for X (which really is a cgraph_edge). */ ! ! hashval_t ! cgraph_edge_hasher::hash (gimple call_stmt) ! { ! /* This is a really poor hash function, but it is what the current code uses, ! so I am reusing it to avoid an additional axis in testing. */ ! return (hashval_t) ((intptr_t)call_stmt >> 3); } /* Return nonzero if the call_stmt of of cgraph_edge X is stmt *Y. */ *** static inline void *** 680,688 cgraph_update_edge_in_call_site_hash (cgraph_edge *e) { gimple call = e->call_stmt; ! *e->caller->call_site_hash->find_slot_with_hash (call, ! htab_hash_pointer (call), ! INSERT) = e; } /* Add call graph edge E to call site hash of its caller. */ --- 692,699 cgraph_update_edge_in_call_site_hash (cgraph_edge *e) { gimple call = e->call_stmt; ! *e->caller->call_site_hash->find_slot_with_hash ! (call, cgraph_edge_hasher::hash (call), INSERT) = e; } /* Add call graph edge E to call site hash of its caller. */ *** cgraph_add_edge_to_call_site_hash (cgrap *** 695,702 if (e->speculative && e->indirect_unknown_callee) return; cgraph_edge **slot = e->caller->call_site_hash->find_slot_with_hash ! (e->call_stmt, ! htab_hash_pointer (e->call_stmt), INSERT); if (*slot) { gcc_assert (((cgraph_edge *)*slot)->speculative); --- 706,712 if (e->speculative && e->indirect_unknown_callee) return; cgraph_edge **slot = e->caller->call_site_hash->find_slot_with_hash ! (e->call_stmt, cgraph_edge_hasher::hash (e->call_stmt), INSERT); if (*slot) { gcc_assert (((cgraph_edge *)*slot)->speculative); *** cgraph_node::get_edge (gimple call_stmt) *** 718,725 int n = 0; if (call_site_hash) ! return call_site_hash->find_with_hash (call_stmt, ! htab_hash_pointer (call_stmt)); /* This loop may turn out to be performance problem. In such case adding hashtables into call nodes with very many edges is probably best --- 728,735 int n = 0; if (call_site_hash) ! return call_site_hash->find_with_hash ! (call_stmt, cgraph_edge_hasher::hash (call_stmt)); /* This loop may turn out to be performance problem. In such case adding hashtables into call nodes with very many edges is probably best *** cgraph_edge::set_call_stmt (gcall *new_s *** 782,788 && (!speculative || !indirect_unknown_callee)) { caller->call_site_hash->remove_elt_with_hash ! (call_stmt, htab_hash_pointer (call_stmt)); } cgraph_edge *e = this; --- 792,798 && (!speculative || !indirect_unknown_callee)) { caller->call_site_hash->remove_elt_with_hash ! (call_stmt, cgraph_edge_hasher::hash (call_stmt)); } cgraph_edge *e = this; *** cgraph_edge::remove_caller (void) *** 987,994 caller->callees = next_callee; } if (caller->call_site_hash) ! caller->call_site_hash->remove_elt_with_hash (call_stmt, ! htab_hash_pointer (call_stmt)); } /* Put the edge onto the free list. */ --- 997,1004 caller->callees = next_callee; } if (caller->call_site_hash) ! caller->call_site_hash->remove_elt_with_hash ! (call_stmt,
Re: [PATCH, CHKP, PR target/65044] Restrict pointer bounds checker with Sanitizer
On Mon, Mar 02, 2015 at 01:25:43PM +0300, Ilya Enkovich wrote: > > --- a/gcc/toplev.c > > +++ b/gcc/toplev.c > > @@ -1376,6 +1376,11 @@ process_options (void) > > { > >if (targetm.chkp_bound_mode () == VOIDmode) > > error ("-fcheck-pointer-bounds is not supported for this target"); > > + > > + if (flag_sanitize & SANITIZE_ADDRESS) > > + error ("-fcheck-pointer-bounds is not supported with Address > > Sanitizer"); > > + > > + flag_check_pointer_bounds = 0; > > } Doesn't this disable -fcheck-pointer-bounds always? I'd expect you want to clear flag_check_pointer_bounds only if you issued one of the two errors... Jakub
Re: [PATCH] Fix intelmic-mkoffload (was: [PATCH 1/4] Add mkoffload for Intel MIC)
On Fri, Mar 06, 2015 at 04:55:07PM +0300, Ilya Verbin wrote: > Hi, > > I've found a bug in intelmic-mkoffload, it works only when the path to gcc is > absolute or relative, but doesn't work when it's specified in the PATH env > var. > Here is the fix, I've got a piece of code from gcc/config/nvptx/mkoffload.c. > Regtested on x86_64-linux and i686-linux. Ok for trunk? > > > gcc/ > * config/i386/intelmic-mkoffload.c: Include intelmic-offload.h instead > of libgomp-plugin.h. > (find_target_compiler): Support a case when the path to gcc is specified > in the PATH env var, so COLLECT_GCC doesn't contain a path. > (generate_host_descr_file): Use GOMP_DEVICE_INTEL_MIC from > intelmic-offload.h instead of OFFLOAD_TARGET_TYPE_INTEL_MIC from > libgomp-plugin.h. > (main): Use GCC_INSTALL_NAME as target_driver_name. > * config/i386/t-intelmic (CFLAGS-mkoffload.o): Add GCC_INSTALL_NAME > define. > (mkoffload.o): Remove obsolete include path and defines. > (mkoffload$(exeext)): Use $(LINKER) instead of $(COMPILER). Ok, thanks. Jakub
Re: [PATCH] optionally disable global check
On Fri, Mar 06, 2015 at 06:41:38PM +0300, Yury Gribov wrote: > On 03/06/2015 05:23 PM, Marat Zakirov wrote: > >Hi all! > > > >Currently !ASAN_GLOBALS disables red-zones for global variables but > >keeps their checks. This simple patch disables these checks too. > > > >--Marat > > Jakub, > > Given that this may be considered a bugfix for --param asan-globals, perhaps > this is ok for 5.0? > > > > 2015-01-22 Marat Zakirov > > I think you'll want to update dates here. > > > * asan.c (instrument_derefs): asan-globals=0 disable instrumentation. > > s/asan-globals=0 disable instrumentation/Disable instrumentation on > asan-globals=0./g Ok with those changes. Jakub
Re: libgomp nvptx plugin: rework initialisation and support the proposed load/unload hooks (was: Merge current set of OpenACC changes from gomp-4_0-branch)
On Fri, 6 Mar 2015 17:01:13 +0300 Ilya Verbin wrote: > On Thu, Feb 26, 2015 at 20:25:11 +0300, Ilya Verbin wrote: > > On Wed, Feb 25, 2015 at 10:36:08 +0100, Thomas Schwinge wrote: > > > > Julian Brown wrote: > > > > This is a version of the previously-posted patch to rework > > > > initialisation and support the proposed load/unload hooks, > > > > merged to gomp4 branch and tested alongside the two patches > > > > (from > > > > Currently the 'struct gomp_memory_mapping' contains 'lock' and > > 'is_initialized'. Do you still need them? Or we can use > > gomp_device_descr::lock and is_initialized instead? If yes, then > > we can replace the gomp_memory_mapping structure with a splay_tree, > > as it was before the OpenACC merge. > > Ping? Apologies, I've been distracted with travel and other things. I suspect, as you suggest, that the gomp_memory_mapping lock/is_initialized fields may no longer be required. I haven't yet had time to address that nor all of Thomas's comments on the patch (mostly breakage with multiple devices), and I'm unlikely to have time this week either due to vacation... Thanks, Julian
Re: [PR58315] reset inlined debug vars at return-to point
On Fri, Mar 6, 2015 at 7:04 PM, Alexandre Oliva wrote: > On Feb 26, 2015, Alexandre Oliva wrote: > >> So far, all the differences I looked at were caused by padding at the >> end of BBs, and by jump stmts without line numbers at the end of BBs, >> both right after the debug reset stmts the proposed patch introduces. > > Further investigation showed there were other sources of spurious > differences: > > - copies arising from the expansion of PHI nodes; source code > information associated with these copies points at the source of the > copy, which is hardly useful and sensible. Care to explain? We spend quite some resources to maintain them (locations on PHI args, that is). Btw, I'd expect tree-ssa-copyrename.c to be a source of bogus base variables still. Richard. > - "optimization" of single-range location lists to a location expression > covering the entire function, which extends, often incorrectly, the > range of the expression, and thus the coverage of the function. > > By patching GCC so as to eliminate these differences (patches attached > for reference), I managed to reduce the coverage differences in > libgcc_s.so to a manageable size (about a dozen variables in 3 functions > in 2 object files), so I could manually investigate each one of them. > > All remaining differences amounted to single insns, originally before > the reset debug stmt introduced by the patch, computing subexpressions > of expressions expanded after the return point of the inlined function. > Because of TER, this often causes stmts to be moved past corresponding > debug stmts. This is a long-standing and long-known issue to me, thus > nothing particularly new brought about or worsened by the proposed > patch, and that would be fixed with stmt frontiers. > > Ultimately, the issue is not so much that the insn gets emitted at a > different spot, but rather the possibility that no insn will remain at > the point where it was expected, which might make it impossible (with > current compiler and debugger) to inspect the results of that > computation. The worst the reset debug stmts introduced by this patch > could do is to make those effects not visible at other points of the > computation, where they are not guaranteed or expected to be visible to > begin with. > > That said, it might be nice if we emitted partial of full expansions of > subexpressions at their original location, relative to debug stmts > expanded to debug insns, rather than all at the point of the full > expression. I recall having started something along these lines years > ago, but that project never got to a working state. > > > The differences in libstdc++.so, even after the patches intended to > minimize differences, are too many to investigate in depth, but from > what I can tell from a quick glance at the diff in dwlocstat > per-variable per-range coverage dumps, nearly all of the differences > amount to one insn in the final range, which likely means TER-introduced > differences. > > > > > -- > Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/ > You must be the change you wish to see in the world. -- Gandhi > Be Free! -- http://FSFLA.org/ FSF Latin America board member > Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer >
Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)
On Fri, Feb 27, 2015 at 05:29:47PM -0500, Jason Merrill wrote: > On 02/19/2015 07:03 PM, Jakub Jelinek wrote: > >+ /* Avoid warning for !!b == y where b is boolean. */ > >+ && (!DECL_P (current.lhs) > >+ || TREE_TYPE (current.lhs) == NULL_TREE > >+ || TREE_CODE (TREE_TYPE (current.lhs)) != BOOLEAN_TYPE)) > > There's something wrong here. If the type is null, trying to check its > TREE_CODE will SEGV. If the type is NULL, then it will just call warn_logical_not_parentheses and won't check TREE_CODE. Only when it is non-NULL, it will check TREE_CODE and if it is not BOOLEAN_TYPE, will call warn_logical_not_parentheses. Jakub
Re: [PATCH] Fix another wrong-code bug with -fstrict-volatile-bitfields
On Fri, Mar 6, 2015 at 12:48 PM, Bernd Edlinger wrote: > Hi Richard, > > here is my new proposal, it addresses your objections and generates > "better" code for this test case: > > main: > .LFB0: > .cfi_startproc > pushq%rbp > .cfi_def_cfa_offset 16 > .cfi_offset 6, -16 > movq%rsp, %rbp > .cfi_def_cfa_register 6 > movlglobal+1(%rip), %eax > orl$2147483647, %eax > movl%eax, global+1(%rip) > movlglobal+1(%rip), %eax > andl$2147483647, %eax > cmpl$2147483647, %eax > je.L2 > callabort > .L2: > movl$0, %eax > popq%rbp > .cfi_def_cfa 7, 8 > ret > .cfi_endproc > > > I also tried to fix the comments. > > Reg-tested on x86_64 successfully and ARM is still running. > > Is it OK for trunk? Looks ok to me apart from /* Check for cases of unaligned fields that must be split. */ - if (bitnum % BITS_PER_UNIT + bitsize > modesize - || (STRICT_ALIGNMENT - && bitnum % GET_MODE_ALIGNMENT (fieldmode) + bitsize > modesize)) + if (bitnum % (STRICT_ALIGNMENT ? modesize : BITS_PER_UNIT) + + bitsize > modesize + || (STRICT_ALIGNMENT && MEM_ALIGN (op0) < modesize)) return false; where I'd use GET_MODE_ALIGNMENT (fieldmode) rather than modesize (in both places). Please leave Eric the chance to comment. Thanks, Richard. > > > Thanks > Bernd. >
[PATCH] Fix PR65270
This fixes tail-merging and folding related wrong-code regressions caused by ignoring alignment of memory references. It introduces OEP_ADDRESS_OF (in addition to OEP_CONSTANT_ADDRESS_OF) to not hurt the cases where we are only interested in addresses. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2015-03-09 Richard Biener PR middle-end/65270 * tree-core.h (enum operand_equal_flag): Add OEP_ADDRESS_OF. * fold-const.c (operand_equal_p): When recursing for ADDR_EXPRs operand set OEP_ADDRESS_OF. Clear it when recursing to non-bases of that. When comparing dereferences compare alignment. When comparing MEM_REFs or TARGET_MEM_REFs compare dependence info. * gcc.dg/torture/pr65270-1.c: New testcase. * gcc.dg/torture/pr65270-2.c: Likewise. Index: gcc/tree-core.h === *** gcc/tree-core.h (revision 221277) --- gcc/tree-core.h (working copy) *** enum size_type_kind { *** 700,706 enum operand_equal_flag { OEP_ONLY_CONST = 1, OEP_PURE_SAME = 2, ! OEP_CONSTANT_ADDRESS_OF = 4 }; /* Enum and arrays used for tree allocation stats. --- 700,707 enum operand_equal_flag { OEP_ONLY_CONST = 1, OEP_PURE_SAME = 2, ! OEP_CONSTANT_ADDRESS_OF = 4, ! OEP_ADDRESS_OF = 8 }; /* Enum and arrays used for tree allocation stats. Index: gcc/fold-const.c === *** gcc/fold-const.c(revision 221277) --- gcc/fold-const.c(working copy) *** operand_equal_p (const_tree arg0, const_ *** 2860,2866 case ADDR_EXPR: return operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0), TREE_CONSTANT (arg0) && TREE_CONSTANT (arg1) ! ? OEP_CONSTANT_ADDRESS_OF : 0); default: break; } --- 2867,2873 case ADDR_EXPR: return operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0), TREE_CONSTANT (arg0) && TREE_CONSTANT (arg1) ! ? OEP_CONSTANT_ADDRESS_OF | OEP_ADDRESS_OF : 0); default: break; } *** operand_equal_p (const_tree arg0, const_ *** 2922,2928 switch (TREE_CODE (arg0)) { case INDIRECT_REF: ! flags &= ~OEP_CONSTANT_ADDRESS_OF; return OP_SAME (0); case REALPART_EXPR: --- 2929,2939 switch (TREE_CODE (arg0)) { case INDIRECT_REF: ! if (!(flags & OEP_ADDRESS_OF) ! && (TYPE_ALIGN (TREE_TYPE (arg0)) ! != TYPE_ALIGN (TREE_TYPE (arg1 ! return 0; ! flags &= ~(OEP_CONSTANT_ADDRESS_OF|OEP_ADDRESS_OF); return OP_SAME (0); case REALPART_EXPR: *** operand_equal_p (const_tree arg0, const_ *** 2930,2936 return OP_SAME (0); case TARGET_MEM_REF: ! flags &= ~OEP_CONSTANT_ADDRESS_OF; /* Require equal extra operands and then fall through to MEM_REF handling of the two common operands. */ if (!OP_SAME_WITH_NULL (2) --- 2941,2947 return OP_SAME (0); case TARGET_MEM_REF: ! flags &= ~(OEP_CONSTANT_ADDRESS_OF|OEP_ADDRESS_OF); /* Require equal extra operands and then fall through to MEM_REF handling of the two common operands. */ if (!OP_SAME_WITH_NULL (2) *** operand_equal_p (const_tree arg0, const_ *** 2939,2945 return 0; /* Fallthru. */ case MEM_REF: ! flags &= ~OEP_CONSTANT_ADDRESS_OF; /* Require equal access sizes, and similar pointer types. We can have incomplete types for array references of variable-sized arrays from the Fortran frontend --- 2950,2956 return 0; /* Fallthru. */ case MEM_REF: ! flags &= ~(OEP_CONSTANT_ADDRESS_OF|OEP_ADDRESS_OF); /* Require equal access sizes, and similar pointer types. We can have incomplete types for array references of variable-sized arrays from the Fortran frontend *** operand_equal_p (const_tree arg0, const_ *** 2950,2958 && operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)), TYPE_SIZE (TREE_TYPE (arg1)), flags))) && types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1)) ! && alias_ptr_types_compatible_p ! (TREE_TYPE (TREE_OPERAND (arg0, 1)), ! TREE_TYPE (TREE_OPERAND (arg1, 1))) && OP_SAME (0) && OP_SAME (1)); case ARRAY_REF: --- 2961,2976 && operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)),
Re: [PATCH][RFC] Fix PR63155
On Mon, 9 Mar 2015, Richard Biener wrote: > On Fri, 6 Mar 2015, Jeff Law wrote: > > > On 03/06/15 06:16, Richard Biener wrote: > > > > > > This fixes PR63155 and reduces the memory usage at -O0 from reported > > > 10GB (couldn't verify/update on my small box) to 350MB (still worse > > > compared to 4.8 which needs only 50MB). > > > > > > It fixes this by no longer computing live info or building a conflict > > > graph for coalescing of SSA names flowing over abnormal edges > > > (which needs to succeed). > > > > > > Of course this also removes verification that this coalescing is valid > > > (but computing this has quadratic cost). With this it turns > > > ICEs into miscompiles. > > > > > > We could restrict verifying that we can perform abnormal coalescing > > > to ENABLE_CHECKING (and I've wanted a verifier pass that can verify > > > this multiple times to be able to catch what breaks it and not having > > > to work back from out-of-SSA ICEing...). > > > > > > So any opinion on this patch welcome. > > > > > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. > > > > > > Ok for trunk? ;) > > > > > > Thanks, > > > Richard. > > > > > > 2015-03-06 Richard Biener > > > > > > PR middle-end/63155 > > > * tree-ssa-coalesce.c (attempt_coalesce): Handle graph being NULL. > > > (coalesce_partitions): Split out abnormal coalescing to ... > > > (perform_abnormal_coalescing): ... this function. > > > (coalesce_ssa_name): Perform abnormal coalescing without computing > > > live/conflict. > > I'd personally like to keep the checking when ENABLE_CHECKING. > > > > I haven't followed this discussion real closely, but I wonder if some kind > > of > > blocking approach would work without blowing up the memory consumption. > > There's no inherent reason why we have to coalesce everything at the same > > time. We can use a blocking factor and do coalescing on some N number of > > SSA_NAMEs at a time. > > Yes, that's possible at (quite?) some compile-time cost. Note that we > can't really guarantee that the resulting live/conflict problems shrink > significantly enough without sorting the coalesces in a different way > (not after important coalesces but after their basevars). > > > I suspect we can select an N that ultimately degenerates into the current > > "do > > everything together" for the common case and only has to iterate over blocks > > of SSA_NAMEs in extreme cases. > > I've attached a patch to the PR that adds such a number N after which we > simply stop coalescing. Of course that doesn't work for abnormals where > we _must_ coalesce. Thus this patch ... > > As said, it's simple to keep the checking with ENABLE_CHECKING (I wonder > if we should make some of the checking we do a runtime choice rather > than a compile-time one...). I'll update the patch. Ok, like the following which adds a verify_ssa_coalescing () function (which could in theory be called from IL verification like verify_ssa) and calls it when ENABLE_CHECKING is defined. Bootstrap & regtest running on x86_64-unknown-linux-gnu. It didn't look appropriate for this stage to implement virtual operand verification. Ok this way? Thanks, Richard. 2015-03-06 Richard Biener PR middle-end/63155 * tree-ssa-coalesce.h (verify_ssa_coalescing): Declare. * tree-ssa-coalesce.c (attempt_coalesce): Handle graph being NULL. (coalesce_partitions): Call verify_ssa_coalescing if ENABLE_CHECKING. Split out abnormal coalescing to ... (perform_abnormal_coalescing): ... this function. (coalesce_ssa_name): Perform abnormal coalescing without computing live/conflict. (verify_ssa_coalescing_worker): New function. (verify_ssa_coalescing): Likewise. Index: gcc/tree-ssa-coalesce.c === *** gcc/tree-ssa-coalesce.c (revision 221278) --- gcc/tree-ssa-coalesce.c (working copy) *** create_outofssa_var_map (coalesce_list_p *** 1121,1128 /* Attempt to coalesce ssa versions X and Y together using the partition !mapping in MAP and checking conflicts in GRAPH. Output any debug info to !DEBUG, if it is nun-NULL. */ static inline bool attempt_coalesce (var_map map, ssa_conflicts_p graph, int x, int y, --- 1121,1128 /* Attempt to coalesce ssa versions X and Y together using the partition !mapping in MAP and checking conflicts in GRAPH if not NULL. !Output any debug info to DEBUG, if it is nun-NULL. */ static inline bool attempt_coalesce (var_map map, ssa_conflicts_p graph, int x, int y, *** attempt_coalesce (var_map map, ssa_confl *** 1154,1160 fprintf (debug, " [map: %d, %d] ", p1, p2); ! if (!ssa_conflicts_test_p (graph, p1, p2)) { var1 = partition_to_var (map, p1); var2 = partition_to_var (map, p2); --- 1154,1161 fprintf (debug, " [map: %d, %d] ", p1, p
Re: [PATCH][libstdc++][Testsuite] isctype test fails for newlib.
On 13/02/15 13:48 +, Matthew Wahab wrote: On 11/02/15 15:43, Jonathan Wakely wrote: On 11/02/15 11:14 +, Matthew Wahab wrote: Attached the fixed patch. Tested by running check-target-libstdc++-v3, with the modified tests, for arm-none-eabi and aarch64-none-linux-gnu. Ok to commit? OK, thanks. Some DOS line endings were introduced into the char/isctype.cc file when I committed this change These aren't visible in a terminal or with svn diff but do show up in emacs. This is causing the test to fail in local runs. The wchar_t/isctype.cc file isn't affected. I've committed the attached patch as obvious, it just removes the DOS line endings from the file. That patch still left DOS line-endings in the file. The test also now fails for newlib targets not using --enable-clocale=newlib so I'm just going to disable the check for '\n' entirely, since it doesn't have consistent behaviour on newlib. Tested x86_64-linux, committed to trunk. Hopefully we can finally close this one for good! commit 923ba4238cc715051fa97441c0cca23245289f23 Author: Jonathan Wakely Date: Mon Mar 9 10:26:03 2015 + PR libstdc++/64467 * testsuite/28_regex/traits/char/isctype.cc: Don't test newline for newlib targets. Really fix mixed line-endings this time. diff --git a/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc b/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc index 8f71910..62d3740 100644 --- a/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc +++ b/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc @@ -1,9 +1,9 @@ -// { dg-do run } -// { dg-options "-std=gnu++11" } -// { dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } } - -// -// 2010-06-23 Stephen M. Webb +// { dg-do run } +// { dg-options "-std=gnu++11" } +// { dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } } + +// +// 2010-06-23 Stephen M. Webb // // Copyright (C) 2010-2015 Free Software Foundation, Inc. // @@ -54,11 +54,7 @@ test01() VERIFY(!t.isctype('_', t.lookup_classname(range(digit; VERIFY( t.isctype(' ', t.lookup_classname(range(blank; VERIFY( t.isctype('\t', t.lookup_classname(range(blank; -#if defined (NEWLINE_IN_CLASS_BLANK) - /* On some targets, '\n' is in class 'blank'. - See https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00059.html. */ - VERIFY( t.isctype('\n', t.lookup_classname(range(blank; -#else +#if !defined (NEWLINE_IN_CLASS_BLANK) VERIFY(!t.isctype('\n', t.lookup_classname(range(blank; #endif VERIFY( t.isctype('t', t.lookup_classname(range(upper), true)));
Re: [PATCH] S390: Hotpatching fixes.
New patch with review results: * 6-byte-NOP only for ZARCH * Formatting. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany >From 176268849643c46427ea873c35390700ea7a4489 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Mon, 23 Feb 2015 13:48:26 +0100 Subject: [PATCH 1/2] S390: Hotpatching fixes. * Properly align function labels with -mhotpatch and add test cases. * Include the nops after the function label in the area covered by cfi and debug information. * Correct a typo in the documentation. * Fix formatting in the generated 6-byte-NOP and adapt the test cases. --- gcc/config/s390/s390.c | 66 ++--- gcc/config/s390/s390.md | 25 +++ gcc/doc/invoke.texi | 4 +- gcc/testsuite/gcc.target/s390/hotpatch-1.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-10.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-11.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-12.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-13.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-14.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-15.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-16.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-17.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-18.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-19.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-2.c | 3 +- gcc/testsuite/gcc.target/s390/hotpatch-21.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-22.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-23.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-24.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-3.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-4.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-5.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-6.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-7.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-8.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-9.c | 2 +- 26 files changed, 144 insertions(+), 46 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-21.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-22.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-23.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-24.c diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 1924f2a..c907577 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -5295,6 +5295,7 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname, if (hotpatch_p) { + unsigned int function_alignment; int i; /* Add a trampoline code area before the function label and initialize it @@ -5308,34 +5309,14 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname, stored directly before the label without crossing a cacheline boundary. All this is necessary to make sure the trampoline code can be changed atomically. */ + function_alignment = MAX (8, DECL_ALIGN (decl) / BITS_PER_UNIT); + if (! DECL_USER_ALIGN (decl)) + function_alignment = MAX (function_alignment, + (unsigned int) align_functions); + ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (function_alignment)); } ASM_OUTPUT_LABEL (asm_out_file, fname); - - /* Output a series of NOPs after the function label. */ - if (hotpatch_p) -{ - while (hw_after > 0) - { - if (hw_after >= 3 && TARGET_CPU_ZARCH) - { - asm_fprintf (asm_out_file, "\tbrcl\t\t0,0\n"); - hw_after -= 3; - } - else if (hw_after >= 2) - { - gcc_assert (hw_after == 2 || !TARGET_CPU_ZARCH); - asm_fprintf (asm_out_file, "\tnop\t0\n"); - hw_after -= 2; - } - else - { - gcc_assert (hw_after == 1); - asm_fprintf (asm_out_file, "\tnopr\t%%r7\n"); - hw_after -= 1; - } - } -} } /* Output machine-dependent UNSPECs occurring in address constant X @@ -11368,6 +11349,7 @@ static void s390_reorg (void) { bool pool_overflow = false; + int hw_before, hw_after; /* Make sure all splits have been performed; splits after machine_dependent_reorg might confuse insn length counts. */ @@ -11503,6 +11485,40 @@ s390_reorg (void) if (insn_added_p) shorten_branches (get_insns ()); } + + s390_function_num_hotpatch_hw (current_function_decl, &hw_before, &hw_after); + if (hw_after > 0) +{ + rtx_insn *insn; + + /* Inject nops for hotpatching. */ + for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) + { + if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_FUNCTION_BEG) + break; + } + gcc_assert (insn); + /* Output a series of NOPs after the NOTE_INSN_FUNCTION_BEG. */ + while (hw_after > 0) + { + if (hw_after >= 3 && TARGET_CPU_ZARCH) + { + insn = emit_insn_after (gen_nop_6_byte (), insn); + hw_after -= 3; + } + else if (hw_after >= 2) + { + insn = emit_insn
Re: [PATCH] Use do_ubsan_in_current_function more
On Mon, Mar 09, 2015 at 12:48:56PM +0100, Jakub Jelinek wrote: > > --- gcc/cp/cp-ubsan.c > > +++ gcc/cp/cp-ubsan.c > > @@ -63,9 +63,7 @@ cp_ubsan_instrument_vptr_p (tree type) > >if (!flag_rtti || flag_sanitize_undefined_trap_on_error) > > return false; > > > > - if (current_function_decl > > - && lookup_attribute ("no_sanitize_undefined", > > - DECL_ATTRIBUTES (current_function_decl))) > > + if (!do_ubsan_in_current_function ()) > > return false; > > > >if (type) > > This changes behavior. Previously it would (intentionally) instrument > current_function_decl == NULL case, now it doesn't. I see. A test/comment indicating that would have been helpful then. I'll apply only the C part then.
Re: [PATCH, stage1] Move insns without introducing new temporaries in loop2_invariant
On Thu, Mar 5, 2015 at 10:53 AM, Thomas Preud'homme wrote: > diff --git a/gcc/dominance.c b/gcc/dominance.c > index 33d4ae4..09c8c90 100644 > --- a/gcc/dominance.c > +++ b/gcc/dominance.c > @@ -982,7 +982,7 @@ nearest_common_dominator_for_set (enum cdi_direction dir, > bitmap blocks) > > A_Dominated_by_B (node A, node B) > { > - return DFS_Number_In(A) >= DFS_Number_In(A) > + return DFS_Number_In(A) >= DFS_Number_In(B) > && DFS_Number_Out (A) <= DFS_Number_Out(B); > } */ This hunk is obvious enough ;-) > diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c > index f79b497..ab2a45c 100644 > --- a/gcc/loop-invariant.c > +++ b/gcc/loop-invariant.c ... > + /* Check whether the set is always executed. We could omit this condition > if > + we know that the register is unused outside of the loop, but it does not > + seem worth finding out. */ > + may_exit = BITMAP_ALLOC (NULL); > + has_exit = BITMAP_ALLOC (NULL); > + always_executed = BITMAP_ALLOC (NULL); > + body = get_loop_body_in_dom_order (loop); > + find_exits (loop, body, may_exit, has_exit); > + compute_always_reached (loop, body, has_exit, always_executed); > + /* Find bit position for basic block bb. */ > + for (i = 0; i < loop->num_nodes && body[i] != bb; i++); > + if (!bitmap_bit_p (always_executed, i)) > +goto cleanup; It looks like this would run for all candidate loop invariants, right? If so, you're creating run time of O(n_invariants*n_bbs_in_loop), a potential compile time hog for large loops. But why compute this at all? Perhaps I'm missing something, but you already have inv->always_executed available, no? > + /* Check that all uses reached by the def in insn would still be reached > + it. */ > + dest_regno = REGNO (reg); > + for (use = DF_REG_USE_CHAIN (dest_regno); use; use = DF_REF_NEXT_REG (use)) > +{ > + rtx ref; Would be nice if we can start using rtx_insn for new code. You do so further up, I suggest you continue that good citizenship here :-) > + basic_block use_bb; > + > + ref = DF_REF_INSN (use); > + use_bb = BLOCK_FOR_INSN (ref); You can use DF_REF_BB. > + /* Ignore instruction considered for moving. */ > + if (ref == insn) > + continue; > + > + /* Don't consider uses outside loop. */ > + if (!flow_bb_inside_loop_p (loop, use_bb)) > + continue; > + > + /* Don't move if a use is not dominated by def in insn. */ > + if (use_bb == bb && DF_INSN_LUID (insn) > DF_INSN_LUID (ref)) > + goto cleanup; You're safer with ">=" even if you've already checked ref==insn. Ciao! Steven
Re: [PATCH] Use do_ubsan_in_current_function more
On Mon, Mar 09, 2015 at 12:35:54PM +0100, Marek Polacek wrote: > I noticed that we can use the do_ubsan_in_current_function wrapper more, which > allows us to simplify the code a bit further. > > Ran ubsan testsuite on x86_64-linux, ok for trunk? > > 2015-03-09 Marek Polacek > > * c-convert.c (convert): Make use of do_ubsan_in_current_function. > * c-decl.c (grokdeclarator): Likewise. > * c-typeck.c (build_binary_op): Likewise. These are ok. > * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Make use of > do_ubsan_in_current_function. > --- gcc/cp/cp-ubsan.c > +++ gcc/cp/cp-ubsan.c > @@ -63,9 +63,7 @@ cp_ubsan_instrument_vptr_p (tree type) >if (!flag_rtti || flag_sanitize_undefined_trap_on_error) > return false; > > - if (current_function_decl > - && lookup_attribute ("no_sanitize_undefined", > -DECL_ATTRIBUTES (current_function_decl))) > + if (!do_ubsan_in_current_function ()) > return false; > >if (type) This changes behavior. Previously it would (intentionally) instrument current_function_decl == NULL case, now it doesn't. Jakub
[PATCH] Use do_ubsan_in_current_function more
I noticed that we can use the do_ubsan_in_current_function wrapper more, which allows us to simplify the code a bit further. Ran ubsan testsuite on x86_64-linux, ok for trunk? 2015-03-09 Marek Polacek * c-convert.c (convert): Make use of do_ubsan_in_current_function. * c-decl.c (grokdeclarator): Likewise. * c-typeck.c (build_binary_op): Likewise. * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Make use of do_ubsan_in_current_function. diff --git gcc/c/c-convert.c gcc/c/c-convert.c index 2cb53f7..27fc3fc 100644 --- gcc/c/c-convert.c +++ gcc/c/c-convert.c @@ -121,9 +121,7 @@ convert (tree type, tree expr) if (flag_sanitize & SANITIZE_FLOAT_CAST && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE && COMPLETE_TYPE_P (type) - && current_function_decl != NULL_TREE - && !lookup_attribute ("no_sanitize_undefined", - DECL_ATTRIBUTES (current_function_decl))) + && do_ubsan_in_current_function ()) { tree arg; if (in_late_binary_op) diff --git gcc/c/c-decl.c gcc/c/c-decl.c index 7497858..c140837 100644 --- gcc/c/c-decl.c +++ gcc/c/c-decl.c @@ -5837,10 +5837,7 @@ grokdeclarator (const struct c_declarator *declarator, warn_variable_length_array (name, size); if (flag_sanitize & SANITIZE_VLA && decl_context == NORMAL - && current_function_decl != NULL_TREE - && !lookup_attribute ("no_sanitize_undefined", - DECL_ATTRIBUTES - (current_function_decl))) + && do_ubsan_in_current_function ()) { /* Evaluate the array size only once. */ size = c_save_expr (size); diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c index a3a9c77..7c6d974 100644 --- gcc/c/c-typeck.c +++ gcc/c/c-typeck.c @@ -11229,9 +11229,7 @@ build_binary_op (location_t location, enum tree_code code, if ((flag_sanitize & (SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_FLOAT_DIVIDE)) - && current_function_decl != 0 - && !lookup_attribute ("no_sanitize_undefined", - DECL_ATTRIBUTES (current_function_decl)) + && do_ubsan_in_current_function () && (doing_div_or_mod || doing_shift)) { /* OP0 and/or OP1 might have side-effects. */ diff --git gcc/cp/cp-ubsan.c gcc/cp/cp-ubsan.c index ce12263..e0c8c2e4 100644 --- gcc/cp/cp-ubsan.c +++ gcc/cp/cp-ubsan.c @@ -63,9 +63,7 @@ cp_ubsan_instrument_vptr_p (tree type) if (!flag_rtti || flag_sanitize_undefined_trap_on_error) return false; - if (current_function_decl - && lookup_attribute ("no_sanitize_undefined", - DECL_ATTRIBUTES (current_function_decl))) + if (!do_ubsan_in_current_function ()) return false; if (type) Marek
Re: [PATCH] S390: Hotpatching fixes.
On Mon, Mar 09, 2015 at 12:22:21PM +0100, Dominik Vogt wrote: > @@ -5308,34 +5309,14 @@ s390_asm_output_function_label (FILE *asm_out_file, > const char *fname, >stored directly before the label without crossing a cacheline >boundary. All this is necessary to make sure the trampoline code can >be changed atomically. */ > + function_alignment = MAX (8, DECL_ALIGN (decl) / BITS_PER_UNIT); > + if (! DECL_USER_ALIGN (decl)) > + function_alignment = MAX (function_alignment, > + (unsigned int) align_functions); Wrong formatting. function_alignment should be only 2 columns to the right from if. > +(define_insn "nop_6_byte" > + [(unspec_volatile [(const_int 0)] UNSPECV_NOP_6_BYTE)] > + "" Shouldn't this use "TARGET_ZARCH" condition? BTW, have you tried say: __attribute__((hotpatch (0, 6))) void foo (void) { __builtin_unreachable (); } ? Have you verified there never are real instructions before NOTE_INSN_FUNCTION_BEG? Jakub
Re: [PATCH] S390: Hotpatching fixes.
Updated patch after internal review: * Moved the hotpatch specific NOP patterns to the normal NOP patterns in the .md file. * Make function_alignment unsigned and cast align_function instead. (ChangeLog is still the same.) Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany >From e0083a3044797bf13ebdc9294fb0ebc117cbed4b Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Mon, 23 Feb 2015 13:48:26 +0100 Subject: [PATCH] S390: Hotpatching fixes. * Properly align function labels with -mhotpatch and add test cases. * Include the nops after the function label in the area covered by cfi and debug information. * Correct a typo in the documentation. * Fix formatting in the generated 6-byte-NOP and adapt the test cases. --- gcc/config/s390/s390.c | 66 ++--- gcc/config/s390/s390.md | 25 +++ gcc/doc/invoke.texi | 4 +- gcc/testsuite/gcc.target/s390/hotpatch-1.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-10.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-11.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-12.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-13.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-14.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-15.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-16.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-17.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-18.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-19.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-2.c | 3 +- gcc/testsuite/gcc.target/s390/hotpatch-21.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-22.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-23.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-24.c | 14 ++ gcc/testsuite/gcc.target/s390/hotpatch-3.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-4.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-5.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-6.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-7.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-8.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-9.c | 2 +- 26 files changed, 144 insertions(+), 46 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-21.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-22.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-23.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-24.c diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 1924f2a..d0584e8 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -5295,6 +5295,7 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname, if (hotpatch_p) { + unsigned int function_alignment; int i; /* Add a trampoline code area before the function label and initialize it @@ -5308,34 +5309,14 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname, stored directly before the label without crossing a cacheline boundary. All this is necessary to make sure the trampoline code can be changed atomically. */ + function_alignment = MAX (8, DECL_ALIGN (decl) / BITS_PER_UNIT); + if (! DECL_USER_ALIGN (decl)) + function_alignment = MAX (function_alignment, + (unsigned int) align_functions); + ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (function_alignment)); } ASM_OUTPUT_LABEL (asm_out_file, fname); - - /* Output a series of NOPs after the function label. */ - if (hotpatch_p) -{ - while (hw_after > 0) - { - if (hw_after >= 3 && TARGET_CPU_ZARCH) - { - asm_fprintf (asm_out_file, "\tbrcl\t\t0,0\n"); - hw_after -= 3; - } - else if (hw_after >= 2) - { - gcc_assert (hw_after == 2 || !TARGET_CPU_ZARCH); - asm_fprintf (asm_out_file, "\tnop\t0\n"); - hw_after -= 2; - } - else - { - gcc_assert (hw_after == 1); - asm_fprintf (asm_out_file, "\tnopr\t%%r7\n"); - hw_after -= 1; - } - } -} } /* Output machine-dependent UNSPECs occurring in address constant X @@ -11368,6 +11349,7 @@ static void s390_reorg (void) { bool pool_overflow = false; + int hw_before, hw_after; /* Make sure all splits have been performed; splits after machine_dependent_reorg might confuse insn length counts. */ @@ -11503,6 +11485,40 @@ s390_reorg (void) if (insn_added_p) shorten_branches (get_insns ()); } + + s390_function_num_hotpatch_hw (current_function_decl, &hw_before, &hw_after); + if (hw_after > 0) +{ + rtx_insn *insn; + + /* Inject nops for hotpatching. */ + for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) + { + if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_FUNCTION_BEG) + break; + } + gcc_assert (insn); + /* Output a series of NOPs after the NOTE_INSN_FUNCTION_BEG. */ + while (hw_after > 0) + { + if (hw_after >= 3 && TARGET_CPU_ZARCH)
[Patch, libstdc++/64441] Fix out of range match_results submatch access
I guess this patch doesn't break abi compatibility, so if everything is Ok, I'm gonna patch it to 4.9 too. I'm not sure if this is a "regression fix" though; if it's inappropriate for trunk, then I can simply wait. Bootstrapped in trunk and tested. Thanks! :) -- Regards, Tim Shen commit cf3977f3077a10de8ccf6dae188f945e1008b2c6 Author: timshen Date: Mon Mar 9 03:41:31 2015 -0700 PR libstdc++/64441 * include/bits/regex.h (match_results<>::size, match_results<>::position, match_results<>::str, match_results<>::operator[], match_results<>::prefix, match_results<>::suffix, match_results<>::end, match_results<>::_M_resize, match_results<>::_M_unmatched_sub, match_results<>::_M_prefix, match_results<>::_M_suffix): Remove global __unmatched_sub. Add unmatched submatch as part of match_results. * include/bits/regex.tcc (__regex_algo_impl<>, regex_replace<>, regex_iterator<>::operator++): Adjust to use match_results::_M_prefix. * testsuite/28_regex/match_results/out_of_range_submatches.cc: New testcases. diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 2b09da6..a23c2c9 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -1483,17 +1483,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // [7.10] Class template match_results - /* - * Special sub_match object representing an unmatched sub-expression. - */ - template -inline const sub_match<_Bi_iter>& -__unmatched_sub() -{ - static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>(); - return __unmatched; -} - /** * @brief The results of a match or search operation. * @@ -1523,15 +1512,20 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { private: /* - * The vector base is empty if this does not represent a successful match. - * Otherwise it contains n+3 elements where n is the number of marked + * The vector base is empty if this does not represent a match (!ready()); + * Otherwise if it's a match failure, it contains 3 elements: + * [0] unmatched + * [1] prefix + * [2] suffix + * Otherwise it contains n+4 elements where n is the number of marked * sub-expressions: * [0] entire match * [1] 1st marked subexpression * ... * [n] nth marked subexpression - * [n+1] prefix - * [n+2] suffix + * [n+1] unmatched + * [n+2] prefix + * [n+3] suffix */ typedef std::vector, _Alloc> _Base_type; typedef std::iterator_traits<_Bi_iter> __iter_traits; @@ -1623,10 +1617,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ size_type size() const - { - size_type __size = _Base_type::size(); - return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0; - } + { return _Base_type::empty() ? 0 : _Base_type::size() - 3; } size_type max_size() const @@ -1670,15 +1661,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * is zero (the default), in which case this function returns the offset * from the beginning of the target sequence to the beginning of the * match. - * - * Returns -1 if @p __sub is out of range. */ difference_type position(size_type __sub = 0) const - { - return __sub < size() ? std::distance(_M_begin, - (*this)[__sub].first) : -1; - } + { return std::distance(_M_begin, (*this)[__sub].first); } /** * @brief Gets the match or submatch converted to a string type. @@ -1691,7 +1677,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ string_type str(size_type __sub = 0) const - { return (*this)[__sub].str(); } + { return string_type((*this)[__sub]); } /** * @brief Gets a %sub_match reference for the match or submatch. @@ -1707,10 +1693,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference operator[](size_type __sub) const { - _GLIBCXX_DEBUG_ASSERT( ready() ); - return __sub < size() - ? _Base_type::operator[](__sub) - : __unmatched_sub<_Bi_iter>(); + _GLIBCXX_DEBUG_ASSERT( ready() ); + return __sub < size() + ? _Base_type::operator[](__sub) + : _M_unmatched_sub(); } /** @@ -1724,10 +1710,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference prefix() const { - _GLIBCXX_DEBUG_ASSERT( ready() ); - return !empty() - ? _Base_type::operator[](_Base_type::size() - 2) - : __unmatched_sub<_Bi_iter>(); + _GLIBCXX_DEBUG_ASSERT( ready() ); + return !empty() ? _M_prefix() : _M_unmatched_sub(); } /** @@ -1742,9 +1726,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 suffix() const {
RE: [PATCH, stage1] Move insns without introducing new temporaries in loop2_invariant
> From: Jiong Wang [mailto:jiong.w...@arm.com] > Sent: Friday, March 06, 2015 8:10 PM > > On 05/03/15 09:53, Thomas Preud'homme wrote: > > *** gcc/testsuite/ChangeLog *** > > > > 2015-02-16 Thomas Preud'homme > > > > * gcc.dg/loop-7.c: Run on all targets and check for loop2_invariant > > being able to move instructions without introducing new > temporary > Thomas, > >Can you please confirm this relax on all target will not fail on > AArch64? It do fails on my quick test. Indeed, I made a very naïve assumption here and should have tested on a wider range of targets. I'll rework the testcases associated with this patch. Thanks for catching it Jiong. Best regards, Thomas
Re: [PATCH] [RTL] Relax CSE check to set REG_EQUAL notes.
On Wed, Mar 4, 2015 at 12:09 PM, Alex Velenko wrote: > For example, in arm testcase pr43920-2.c, CSE previously decided not to put > an "obvious" note on insn 9, as set value was the same as note value. > At the same time, other insns set up as -1 were set up through a register > and did get a note: ...which is the point of the REG_EQUAL notes. In insn 8 there is a REG_EQUAL note to show that the value of r111 is known. In insn 9 the known value is, well, known from SET_SRC so there is no need for a REG_EQUAL note. Adding REG_EQUAL notes in such cases is just wasteful. > (insn 9 53 34 8 (set (reg:SI 110 [ D.4934 ]) > (const_int -1 [0x])) > /work/src/gcc/gcc/testsuite/gcc.target/arm/pr43920-2.c:21 613 > {*thumb2_movsi_vfp} > (nil)) > > (insn 8 45 50 6 (set (reg:SI 110 [ D.4934 ]) > (reg/v:SI 111 [ startD.4917 ])) > /work/src/gcc/gcc/testsuite/gcc.target/arm/pr43920-2.c:21 613 > {*thumb2_movsi_vfp} > (expr_list:REG_EQUAL (const_int -1 [0x]) > (nil))) > > (insn 6 49 54 7 (set (reg:SI 110 [ D.4934 ]) > (reg/v:SI 112 [ endD.4918 ])) > /work/src/gcc/gcc/testsuite/gcc.target/arm/pr43920-2.c:21 613 > {*thumb2_movsi_vfp} > (expr_list:REG_EQUAL (const_int -1 [0x]) > (nil))) > > Jump2 pass, optimizing common code, was looking at notes to reason about > register values and failing to recognize those insns to be equal. I suppose you are talking about the head/tail merging code? Can you please provide a test case for problem preferably filed in Bugzilla)? Ciao! Steven
Re: [PATCH][RFC] Fix PR63155
On Fri, 6 Mar 2015, Jeff Law wrote: > On 03/06/15 06:16, Richard Biener wrote: > > > > This fixes PR63155 and reduces the memory usage at -O0 from reported > > 10GB (couldn't verify/update on my small box) to 350MB (still worse > > compared to 4.8 which needs only 50MB). > > > > It fixes this by no longer computing live info or building a conflict > > graph for coalescing of SSA names flowing over abnormal edges > > (which needs to succeed). > > > > Of course this also removes verification that this coalescing is valid > > (but computing this has quadratic cost). With this it turns > > ICEs into miscompiles. > > > > We could restrict verifying that we can perform abnormal coalescing > > to ENABLE_CHECKING (and I've wanted a verifier pass that can verify > > this multiple times to be able to catch what breaks it and not having > > to work back from out-of-SSA ICEing...). > > > > So any opinion on this patch welcome. > > > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. > > > > Ok for trunk? ;) > > > > Thanks, > > Richard. > > > > 2015-03-06 Richard Biener > > > > PR middle-end/63155 > > * tree-ssa-coalesce.c (attempt_coalesce): Handle graph being NULL. > > (coalesce_partitions): Split out abnormal coalescing to ... > > (perform_abnormal_coalescing): ... this function. > > (coalesce_ssa_name): Perform abnormal coalescing without computing > > live/conflict. > I'd personally like to keep the checking when ENABLE_CHECKING. > > I haven't followed this discussion real closely, but I wonder if some kind of > blocking approach would work without blowing up the memory consumption. > There's no inherent reason why we have to coalesce everything at the same > time. We can use a blocking factor and do coalescing on some N number of > SSA_NAMEs at a time. Yes, that's possible at (quite?) some compile-time cost. Note that we can't really guarantee that the resulting live/conflict problems shrink significantly enough without sorting the coalesces in a different way (not after important coalesces but after their basevars). > I suspect we can select an N that ultimately degenerates into the current "do > everything together" for the common case and only has to iterate over blocks > of SSA_NAMEs in extreme cases. I've attached a patch to the PR that adds such a number N after which we simply stop coalescing. Of course that doesn't work for abnormals where we _must_ coalesce. Thus this patch ... As said, it's simple to keep the checking with ENABLE_CHECKING (I wonder if we should make some of the checking we do a runtime choice rather than a compile-time one...). I'll update the patch. Thanks, Richard.
Re: sh-*-linux build failure
At Sun, 08 Mar 2015 23:14:10 +0900 (JST), Kaz Kojima wrote: > > Oleg Endo wrote: > >> diff --git a/gcc/config/sh/t-linux b/gcc/config/sh/t-linux > >> index d33c638..22b8e3e 100644 > >> --- a/gcc/config/sh/t-linux > >> +++ b/gcc/config/sh/t-linux > >> @@ -1,2 +1,3 @@ > >> MULTILIB_DIRNAMES= > >> -MULTILIB_MATCHES = > >> +MULTILIB_MATCHES = > >> +MULTILIB_EXCEPTIONS = m2a m2a/ml > > > > This disables SH2A completely? AFAIK SH2A big-endian Linux is a valid > > configuration. It should be 'm2a/ml' only, as in t-sh. Although all of > > that will probably not work if --with-endian=little,big or > > --with-endian=little is specified as configure option. > > How about a bit modified patch below? > > Regards, > kaz > -- > * config/sh/t-linux (MULTILIB_EXCEPTIONS): Define for m2a cases. > > diff --git a/config/sh/t-linux b/config/sh/t-linux > index d33c638..a30ab2e 100644 > --- a/config/sh/t-linux > +++ b/config/sh/t-linux > @@ -1,2 +1,9 @@ > MULTILIB_DIRNAMES= > MULTILIB_MATCHES = > + > +DEFAULT_ENDIAN = $(word 1,$(TM_ENDIAN_CONFIG)) > +ifeq ($(DEFAULT_ENDIAN),ml) > +MULTILIB_EXCEPTIONS = m2a m2a/ml > +else > +MULTILIB_EXCEPTIONS = ml/m2a > +endif It works fine. Thanks. -- Yoshinori Sato