[v3] libstdc++/52689
Seems like libstdc++.a has suffered a bit in the transition to a more modular convenience-library build system. Here's a patch to clean up the compatibility symbols throughout libstdc++, to insure that necessary symbols for versioning purposes are only in shared binaries, ie libstdc++.so. Most of these are completely un-necessary for a static library, and are now duly noted as such. I'm checking this in on trunk and hope to move it to 4_7-branch for 4.7.1 after it's been fire-tested. tested various ways x86/linux -benjamin2012-03-28 Benjamin Kosnik b...@redhat.com PR libstdc++/52689 * libsupc++/Makefile.am (LTCXXCOMPILE, CXXLINK): Tweak. * libsupc++/Makefile.in: Regenerated. * src/Makefile.am (LTCXXCOMPILE, CXXLINK): Tweak. (libstdc___la_SOURCES): Add in compatiblity files, with content that varies with -DPIC. * src/Makefile.in: Regenerated. * src/c++11/Makefile.am (LTCXXCOMPILE, CXXLINK): Tweak. * src/c++11/Makefile.in: Regenerated. * src/c++11/compatibility-atomic-c++0x.cc: Guard with PIC. * src/c++11/compatibility-c++0x.cc: Same. * src/c++11/future.cc: Consolidate compatibility bits into.. * src/c++11/mutex.cc: Consolidate compatibility bits into.. * src/c++11/compatibility-thread-cxx0x.cc: ...here. New. * src/c++98/Makefile.am (LTCXXCOMPILE, CXXLINK): Tweak. * src/c++98/Makefile.in: Regenerated. * src/c++98/compatibility-ldbl.cc: Guard with PIC * src/c++98/compatibility-list-2.cc: Same. * src/c++98/compatibility-list.cc: Same. * src/c++98/compatibility.cc: Tweak comments. diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index bee4353..eaf109e 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -32,17 +32,17 @@ toolexeclib_LTLIBRARIES = libsupc++.la noinst_LTLIBRARIES = libsupc++convenience.la std_HEADERS = \ - cxxabi.h exception initializer_list new typeinfo + cxxabi.h exception initializer_list new typeinfo bits_HEADERS = \ atomic_lockfree_defines.h cxxabi_forced.h \ - exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h + exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h headers = $(std_HEADERS) $(bits_HEADERS) if GLIBCXX_HOSTED c_sources = \ - cp-demangle.c + cp-demangle.c endif sources = \ @@ -95,7 +95,7 @@ sources = \ vmi_class_type_info.cc \ vterminate.cc -libsupc___la_SOURCES = $(sources) $(c_sources) +libsupc___la_SOURCES = $(sources) $(c_sources) libsupc__convenience_la_SOURCES = $(sources) $(c_sources) # AM_CXXFLAGS needs to be in each subdirectory so that it can be @@ -106,9 +106,7 @@ libsupc__convenience_la_SOURCES = $(sources) $(c_sources) AM_CXXFLAGS = \ $(PIC_CXXFLAGS) \ $(XTEMPLATE_FLAGS) \ - $(WARN_CXXFLAGS) \ - $(OPTIMIZE_CXXFLAGS) \ - $(CONFIG_CXXFLAGS) + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) AM_MAKEFLAGS = \ gxx_include_dir=$(gxx_include_dir) @@ -125,7 +123,7 @@ C_COMPILE = \ # LTCOMPILE is copied from LTCXXCOMPILE below. LTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared $(LIBTOOLFLAGS) --mode=compile \ $(CC) $(DEFS) $(C_INCLUDES) $(PIC_CXXFLAGS) \ -$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) cp-demangle.c: rm -f $@ @@ -178,9 +176,11 @@ nested_exception.o: nested_exception.cc # # We have to put --tag disable-shared after --tag CXX lest things # CXX undo the affect of disable-shared. -LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) @@ -190,10 +190,11 @@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) # course is problematic at this point. So, we get the top-level # directory to configure libstdc++-v3 to use gcc as the C++ # compilation driver. -CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared $(LIBTOOLFLAGS) \ - --mode=link $(CXX) \ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ - +CXXLINK = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXX) \ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ # Install notes # We have to have rules modified from the default to counteract SUN make diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index eb80bfe..28430cf 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -29,10 +29,37 @@ SUBDIRS = c++98 c++11 # Cross compiler support. toolexeclib_LTLIBRARIES = libstdc++.la -vpath % $(top_srcdir)/src -vpath % $(top_srcdir) +vpath %
Re: C++ PATCH to add auto return type deduction with -std=c++1y
On Wed, 28 Mar 2012, Marc Glisse wrote: On Sun, 25 Mar 2012, Marc Glisse wrote: - a first goal is simple functions, with a single return statement (which may even often be the only statement). After playing with it a bit, I am not sure how to use it in the simple forwarding case: T f(int); auto g(int i){return f(i);} If T is a reference, this does a copy. auto g(int i){return f(i);} Now if T is not a reference, this returns a reference to a destroyed temporary. I haven't given this idea much thought, but here goes: The main issue seems to be that auto deduction gives a dangerous unusable answer on a temporary. Well, let's change that to make the deduction be the same as plain auto in that case (how different does that make it from decltype?). Sure, it requires some more complicated wording. But to users, it could actually be more intuitive as auto would remain a do-what-I-mean perfect forwarder. And plain auto would remain compatible with lambdas. -- Marc Glisse
Re: [PATCH] Remove bogus assert from CCP's insert_clobbers_for_var
On Wed, 28 Mar 2012, Martin Jambor wrote: Hi, when testing a different patch of mine I hit the assert in insert_clobbers_for_var which is there to make sure that there is a call to builtin_stack_save in a BB with or dominating a call to builtin_alloca_with_align. In my case that was not true because the DOM pass duplicated the call to builtin_stack_save and put it onto two different paths to the same BB. On IRC I've been told that is OK and the that CCP cannot make such assumtions. Since it is only a missed-optimization if the call to the builtin is not found and processed (basically PR 51491 again but only in cases like these), I thought it best to just remove the assert by the following simple patch, bootstrapped and tested on x86_64-linux. OK for trunk? Ok, but please add a comment before the loop why it is ok and why it can happen that we do not find a stack-save. Thanks, Richard. Thanks, Martin 2012-03-28 Martin Jambor mjam...@suse.cz * tree-ssa-ccp.c (insert_clobbers_for_var): Do not assert that there is a builtin_stack_save in a dominating BB. Index: src/gcc/tree-ssa-ccp.c === --- src.orig/gcc/tree-ssa-ccp.c +++ src/gcc/tree-ssa-ccp.c @@ -1769,18 +1769,16 @@ gsi_prev_dom_bb_nondebug (gimple_stmt_it static void insert_clobbers_for_var (gimple_stmt_iterator i, tree var) { - bool save_found; gimple stmt; tree saved_val; htab_t visited = NULL; - for (save_found = false; !gsi_end_p (i); gsi_prev_dom_bb_nondebug (i)) + for (; !gsi_end_p (i); gsi_prev_dom_bb_nondebug (i)) { stmt = gsi_stmt (i); if (!gimple_call_builtin_p (stmt, BUILT_IN_STACK_SAVE)) continue; - save_found = true; saved_val = gimple_call_lhs (stmt); if (saved_val == NULL_TREE) @@ -1792,7 +1790,6 @@ insert_clobbers_for_var (gimple_stmt_ite if (visited != NULL) htab_delete (visited); - gcc_assert (save_found); } /* Detects a __builtin_alloca_with_align with constant size argument. Declares -- Richard Guenther rguent...@suse.de SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
[PATCH, ping #1] Don't insert white space in 'orig_option_with_args_text' for OPT_l
Ping. ludovic.cour...@inria.fr (Ludovic Courtès) skribis: Joseph S. Myers jos...@codesourcery.com skribis: On Mon, 12 Mar 2012, Ludovic Courtès wrote: The patch below solves the problem in a gfortran-specific way. WDYT? I think that's the right approach for this issue. The previous patch was produced with ‘diff -b’. Here’s a fixed one. Let me know if anything else needs to be done. Thanks, Ludo’. 2012-03-09 Ludovic Courtès ludovic.cour...@inria.fr * gcc/fortran/gfotranspec.c (lang_specific_driver): When VERBOSE, make sure `-l' options are printed with no intertwined white spaces. diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c index 2240bfb..55e5e42 100644 --- a/gcc/fortran/gfortranspec.c +++ b/gcc/fortran/gfortranspec.c @@ -461,8 +461,15 @@ For more information about these matters, see the file named COPYING\n\n)); { fprintf (stderr, _(Driving:)); for (i = 0; i g77_newargc; i++) - fprintf (stderr, %s, - g77_new_decoded_options[i].orig_option_with_args_text); + { + if (g77_new_decoded_options[i].opt_index == OPT_l) + /* Make sure no white space is inserted after `-l'. */ + fprintf (stderr, -l%s, + g77_new_decoded_options[i].canonical_option[1]); + else + fprintf (stderr, %s, + g77_new_decoded_options[i].orig_option_with_args_text); + } fprintf (stderr, \n); }
Re: [patch] Fix ICE during inlining with SJLJ
On Wed, Mar 28, 2012 at 4:42 PM, Eric Botcazou ebotca...@adacore.com wrote: Hi, this is a regression present on the mainline and 4.7 branch for platforms using SJLJ exceptions, e.g. the ARM. The scenario is as follows: the main procedure calls My_Iterators.Current which has a pragma Inline on it. The procedure also has exceptions handlers so there is an abnormal edge from the BB containing the call to My_Iterators.Current (which is therefore the last statement in the BB) to the setjmp dispatcher. The local-pure-const pass computes that My_Iterators.Current is pure and may not terminate (DECL_PURE_P DECL_LOOPING_CONST_OR_PURE_P) because it is pure and contains a call to gnat_check, which is no-return, and state_from_flags (call_state, call_looping, flags, ((flags (ECF_NORETURN | ECF_NOTHROW)) == (ECF_NORETURN | ECF_NOTHROW)) || (!flag_exceptions (flags ECF_NORETURN))); considers that, with !flag_exceptions, a no-return function call can really never return, including by exceptional means. The early SRA pass then inserts a statement in the procedure right after the call to My_Iterators.Current, so at the end of the BB, because stmt_ends_bb_p has returned false on the call, in turn because the statement is ECF_PURE and is_ctrl_altering_stmt has /* A non-pure/const call alters flow control if the current function has nonlocal labels. */ if (!(flags (ECF_CONST | ECF_PURE | ECF_LEAF)) cfun-has_nonlocal_label) return true; i.e. doesn't return true if ECF_PURE. As a consequence, the abnormal edge from the BB to the setjmp receiver is deleted. When My_Iterators.Current gets inlined into P, the call to gnat_check is copied into it and, since stmt_can_make_abnormal_goto returns true on it, a new abnormal edge to the setjmp dispatcher is created. The compiler aborts in update_ssa_across_abnormal_edges because it cannot find the original abnormal edge that it needs to use in order to complete the new one. The cause is the discrepancy between local-pure-const, is_ctrl_altering_stmt and stmt_can_make_abnormal_goto (the latter two themselves disagreeing) as to when a call can return exceptionally/make an abnormal goto. It's clear that (!flag_exceptions (flags ECF_NORETURN)) overlooks the __builtin_setjmp/__builtin_longjmp constructs so is optimistic at best. But we cannot really do better in local-pure-const, short of removing the condition entirely. The interesting thing is that stmt_can_make_abnormal_goto, unlike the related is_ctrl_altering_stmt, doesn't consider that a mere ECF_PURE can change the property of a call wrt control flow: bool stmt_can_make_abnormal_goto (gimple t) { if (computed_goto_p (t)) return true; if (is_gimple_call (t)) return (gimple_has_side_effects (t) cfun-has_nonlocal_label !(gimple_call_flags (t) ECF_LEAF)); return false; } because it tests gimple_has_side_effects, which is still true if the call may not return: if (is_gimple_call (s)) { int flags = gimple_call_flags (s); /* An infinite loop is considered a side effect. */ if (!(flags (ECF_CONST | ECF_PURE)) || (flags ECF_LOOPING_CONST_OR_PURE)) return true; return false; } So, in the end, a reasonable fix might be to unify the condition used by is_ctrl_altering_stmt and stmt_can_make_abnormal_goto, by using the most conservative one (the latter), which happens to also cover the optimistic semantics used by local-pure-const. Tested on x86_64-suse-linux, OK for mainline and 4.7 branch? Thanks for the detailed analysis. The patch indeed looks ok and makes things easier to understand even. Thus, ok. Thanks, Richard. 2012-03-28 Eric Botcazou ebotca...@adacore.com * tree-cfg.c (call_can_make_abnormal_goto): New predicate. (stmt_can_make_abnormal_goto): Use it. (is_ctrl_altering_stmt): Likewise. 2012-03-28 Eric Botcazou ebotca...@adacore.com * gnat.dg/controlled6.adb: New test. * gnat.dg/controlled6_pkg.ads: New helper. * gnat.dg/controlled6_pkg-iterators.ad[sb]: Likewise. -- Eric Botcazou
Re: [patch] Add support for FP bit fields in varasm.c
On Wed, Mar 28, 2012 at 4:53 PM, Eric Botcazou ebotca...@adacore.com wrote: Hi, another kind of bit fields supported in Ada are floating-point bit fields. They work fine, except that varasm.c rejects static constants (CONSTRUCTORs) containing them. The attached patch plugs this hole. Tested on x86_64-suse-linux, OK for mainline? You should be able to use fold_unary instead of fold_build1. make_signed_type should also not be used, but build_nonstandard_integer_type (or even better, get an integer mode of the same size of the float mode and then use type_for_mode). Thanks, Richard. 2012-03-28 Eric Botcazou ebotca...@adacore.com * varasm.c (initializer_constant_valid_for_bitfield_p): Return true for REAL_CST as well. (output_constructor): Use RECORD_OR_UNION_TYPE_P predicate. In the bitfield case, if the value is a REAL_CST, convert it first to an INTEGER_CST. 2012-03-28 Eric Botcazou ebotca...@adacore.com * gnat.dg/specs/aggr5.ads: New test. -- Eric Botcazou
[PATCH][1/n] Cleanup internal interfaces, GCC modularization
I am playing with doing some internal interface static analysis using the first patch below (and looking at LTO bootstrap results). An example, obvious patch resulting from that is the 2nd patch, resuling from the static analysis output /space/rguenther/src/svn/trunk/gcc/tree-ssa-pre.c:add_to_value can be made static /space/rguenther/src/svn/trunk/gcc/tree-ssa-pre.c:print_value_expressions can be made static the static analysis is very verbose (and does not consider ipa-refs yet). You also need to union results for building all frontends and all targets (well, in theory, or you can simply manually verify things which is a good idea anyway - even unused functions may be useful exported when they implement a generic data structure for example). Excercise for the reader: turn the analysis into a plugin. Richard. Index: gcc/lto/lto.c === --- gcc/lto/lto.c (revision 185918) +++ gcc/lto/lto.c (working copy) @@ -2721,6 +2721,65 @@ read_cgraph_and_symbols (unsigned nfiles lto_symtab_merge_cgraph_nodes (); ggc_collect (); + if (flag_wpa) +{ + struct cgraph_node *node; + FILE *f = fopen (concat (dump_base_name, .callers, NULL), w); + for (node = cgraph_nodes; node; node = node-next) + { + tree caller_tu = NULL_TREE; + struct cgraph_edge *caller; + bool found = true; + + if (!TREE_PUBLIC (node-decl) + || !TREE_STATIC (node-decl) + || resolution_used_from_other_file_p (node-resolution)) + continue; + + if (!node-callers) + { + expanded_location loc = expand_location (DECL_SOURCE_LOCATION (node-decl)); + fprintf (f, %s:%s no calls\n, + loc.file, IDENTIFIER_POINTER (DECL_NAME (node-decl))); + } + for (caller = node-callers; caller; caller = caller-next_caller) + { + if (!caller_tu) + caller_tu = DECL_CONTEXT (caller-caller-decl); + else if (caller_tu + DECL_CONTEXT (caller-caller-decl) != caller_tu) + found = false; + } + if (found caller_tu) + { + expanded_location loc1 = expand_location (DECL_SOURCE_LOCATION (node-decl)); + expanded_location loc2 = expand_location (DECL_SOURCE_LOCATION (node-callers-caller-decl)); + + if (DECL_CONTEXT (node-decl) == caller_tu) + fprintf (f, %s:%s can be made static\n, +loc1.file, IDENTIFIER_POINTER (DECL_NAME (node-decl))); + else + { + struct cgraph_edge *callee; + bool calls_nonpublic_static_fn = false; + /* Check if we can move node to the caller TU without +moving anything else. */ + for (callee = node-callees; callee; callee = callee-next_callee) + { + if (!TREE_PUBLIC (callee-callee-decl) + TREE_STATIC (callee-callee-decl)) + calls_nonpublic_static_fn = true; + } + if (!calls_nonpublic_static_fn) + fprintf (f, %s:%s called only from %s\n, +loc1.file, IDENTIFIER_POINTER (DECL_NAME (node-decl)), +loc2.file); + } + } + } + fclose (f); +} + if (flag_ltrans) for (node = cgraph_nodes; node; node = node-next) { 2012-03-29 Richard Guenther rguent...@suse.de * tree-flow.h (struct pre_expr_d): Remove forward declaration. (add_to_value): Remove. (print_value_expressions): Likewise. * tree-ssa-pre.c (add_to_value): Make static. (print_value_expressions): Likewise. Index: gcc/tree-flow.h === *** gcc/tree-flow.h (revision 185918) --- gcc/tree-flow.h (working copy) *** extern bool verify_eh_dispatch_edge (gim *** 794,803 extern void maybe_remove_unreachable_handlers (void); /* In tree-ssa-pre.c */ - struct pre_expr_d; - void add_to_value (unsigned int, struct pre_expr_d *); void debug_value_expressions (unsigned int); - void print_value_expressions (FILE *, unsigned int); /* In tree-ssa-sink.c */ bool is_hidden_global_store (gimple); --- 794,800 Index: gcc/tree-ssa-pre.c === *** gcc/tree-ssa-pre.c (revision 185918) --- gcc/tree-ssa-pre.c (working copy) *** phi_trans_add (pre_expr e, pre_expr v, b *** 587,593 /* Add expression E to the expression set of value id V. */ ! void add_to_value (unsigned int v, pre_expr e) { bitmap_set_t set; --- 587,593 /* Add expression E to the expression set of value id V. */ ! static void
[PATCH] SH2A: Don't push/pop registers for functions with resbank attribute
Hi, Please find attached the patch resbank.patch which fixes the issue with resbank attribute. Currently, registers used in the routine are also saved on using resbank attribute. These registers are saved with resbank instruction and need not be saved separately. The patch fixes the issue. Tested with sh2a-elf. Regression results are good. ChangeLog 2012-03-29 Naveen H.S navee...@kpitcummins.com * config/sh/sh.c (push_regs): Condition added for resbank attribute. (sh_expand_epilogue): Condition added for resbank attribute. Thanks Regards, Naveen resbank.patch Description: resbank.patch
Re: C++ PATCH to add auto return type deduction with -std=c++1y
On Thu, 29 Mar 2012, Marc Glisse wrote: On Wed, 28 Mar 2012, Marc Glisse wrote: On Sun, 25 Mar 2012, Marc Glisse wrote: - a first goal is simple functions, with a single return statement (which may even often be the only statement). After playing with it a bit, I am not sure how to use it in the simple forwarding case: T f(int); auto g(int i){return f(i);} If T is a reference, this does a copy. auto g(int i){return f(i);} Now if T is not a reference, this returns a reference to a destroyed temporary. I haven't given this idea much thought, but here goes: The main issue seems to be that auto deduction gives a dangerous unusable answer on a temporary. Well, let's change that to make the deduction be the same as plain auto in that case (how different does that make it from decltype?). Sure, it requires some more complicated wording. But to users, it could actually be more intuitive as auto would remain a do-what-I-mean perfect forwarder. And plain auto would remain compatible with lambdas. Hmm, the fact that this doesn't fit the usual deduce auto and collapse references with model might make it unacceptable, although it would be more useful than rejecting (or strongly warning against) the code for temporaries. Oh well, the current proposal is useful as is, and there is probably room left if we later want to add a syntax that implies decltype deduction (decltype(auto)? decltype without parenthesis?). -- Marc Glisse
Re: [PATCH, i386]: FIX PR 52698, reload failure with complex address
On 03/28/2012 02:40 AM, Uros Bizjak wrote: What about release branches? While this issue didn't trigger there yet, it can be triggered by some bad RA decision, and the fixup is missing. I have no objection to your current patch being backported. It looked fairly safe. r~
[C++ PATCH] Don't call maybe_apply_pragma_weak for templates (PR c++/52759)
Hi! The recently added assert in mangle.c doesn't like mangling to be performed during processing_template_decl. With #pragma weak foo we can hit it unfortunately. This patch fixes that. Perhaps we could call maybe_apply_pragma_weak from pt.c when instantiating, though not sure how much useful will that be, aren't most templates weak already anyway? Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-03-29 Jakub Jelinek ja...@redhat.com PR c++/52759 * decl.c (start_decl): Don't call maybe_apply_pragma_weak if processing_template_decl. * g++.dg/ext/weak4.C: New test. --- gcc/cp/decl.c.jj2012-03-26 11:53:18.0 +0200 +++ gcc/cp/decl.c 2012-03-29 10:17:22.392169256 +0200 @@ -4431,7 +4431,8 @@ start_decl (const cp_declarator *declara } /* If #pragma weak was used, mark the decl weak now. */ - maybe_apply_pragma_weak (decl); + if (!processing_template_decl) +maybe_apply_pragma_weak (decl); if (TREE_CODE (decl) == FUNCTION_DECL DECL_DECLARED_INLINE_P (decl) --- gcc/testsuite/g++.dg/ext/weak4.C.jj 2012-03-29 10:23:00.506445582 +0200 +++ gcc/testsuite/g++.dg/ext/weak4.C2012-03-29 10:22:00.0 +0200 @@ -0,0 +1,9 @@ +// PR c++/52759 +// { dg-do compile } +// { dg-require-weak } +// { dg-options } +#pragma weak foo +template typename T +struct A { }; +template typename T +void bar (AT ); Jakub
Re: [SMS] Support new loop pattern
Hello, I'd like to ping again those SMS patches once we're back to Stage 1. Ayal, maybe it would remove some burden for you if you'd review the general SMS functionality of those patches, and we'd ask RTL folks to look at the pieces related to RTL pattern matching and generation? Yours, Andrey On 10.02.2012 16:15, Roman Zhuykov wrote: Ping. Ayal, please review this patch and these three patches too: http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00505.html http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00506.html http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01800.html -- Roman Zhuykov zhr...@ispras.ru
[libffi] Restore three commits
My merge from a few weeks ago accidentally trampled three patches by Kai Teitz and Eric Botcazou from last month: http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00553.html http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00524.html http://gcc.gnu.org/ml/gcc-patches/2012-02/msg01163.html I've just corrected this. Thanks, AG
[PATCH][2/n] Cleanup internal interfaces
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2012-03-29 Richard Guenther rguent...@suse.de * tree-flow.h (struct pre_expr_d): Remove forward declaration. (add_to_value): Remove. (print_value_expressions): Likewise. * tree-ssa-pre.c (add_to_value): Make static. (print_value_expressions): Likewise. * gimple.h (gimple_adjust_this_by_delta): Remove. * gimple-fold.c (gimple_adjust_this_by_delta): Likewise. Index: gcc/tree-flow.h === *** gcc/tree-flow.h (revision 185918) --- gcc/tree-flow.h (working copy) *** extern bool verify_eh_dispatch_edge (gim *** 794,803 extern void maybe_remove_unreachable_handlers (void); /* In tree-ssa-pre.c */ - struct pre_expr_d; - void add_to_value (unsigned int, struct pre_expr_d *); void debug_value_expressions (unsigned int); - void print_value_expressions (FILE *, unsigned int); /* In tree-ssa-sink.c */ bool is_hidden_global_store (gimple); --- 794,800 Index: gcc/tree-ssa-pre.c === *** gcc/tree-ssa-pre.c (revision 185918) --- gcc/tree-ssa-pre.c (working copy) *** phi_trans_add (pre_expr e, pre_expr v, b *** 587,593 /* Add expression E to the expression set of value id V. */ ! void add_to_value (unsigned int v, pre_expr e) { bitmap_set_t set; --- 587,593 /* Add expression E to the expression set of value id V. */ ! static void add_to_value (unsigned int v, pre_expr e) { bitmap_set_t set; *** debug_bitmap_set (bitmap_set_t set) *** 1031,1037 /* Print out the expressions that have VAL to OUTFILE. */ ! void print_value_expressions (FILE *outfile, unsigned int val) { bitmap_set_t set = VEC_index (bitmap_set_t, value_expressions, val); --- 1031,1037 /* Print out the expressions that have VAL to OUTFILE. */ ! static void print_value_expressions (FILE *outfile, unsigned int val) { bitmap_set_t set = VEC_index (bitmap_set_t, value_expressions, val); Index: gcc/gimple.h === *** gcc/gimple.h(revision 185918) --- gcc/gimple.h(working copy) *** unsigned get_gimple_rhs_num_ops (enum tr *** 960,966 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL); const char *gimple_decl_printable_name (tree, int); tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree); - void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree); tree gimple_extract_devirt_binfo_from_cst (tree); /* Returns true iff T is a valid GIMPLE statement. */ extern bool is_gimple_stmt (tree); --- 960,965 Index: gcc/gimple-fold.c === *** gcc/gimple-fold.c (revision 185918) --- gcc/gimple-fold.c (working copy) *** gimple_fold_builtin (gimple stmt) *** 978,1006 return result; } - /* Generate code adjusting the first parameter of a call statement determined -by GSI by DELTA. */ - - void - gimple_adjust_this_by_delta (gimple_stmt_iterator *gsi, tree delta) - { - gimple call_stmt = gsi_stmt (*gsi); - tree parm, tmp; - gimple new_stmt; - - delta = convert_to_ptrofftype (delta); - gcc_assert (gimple_call_num_args (call_stmt) = 1); - parm = gimple_call_arg (call_stmt, 0); - gcc_assert (POINTER_TYPE_P (TREE_TYPE (parm))); - tmp = create_tmp_var (TREE_TYPE (parm), NULL); - add_referenced_var (tmp); - - tmp = make_ssa_name (tmp, NULL); - new_stmt = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, tmp, parm, delta); - SSA_NAME_DEF_STMT (tmp) = new_stmt; - gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); - gimple_call_set_arg (call_stmt, 0, tmp); - } /* Return a binfo to be used for devirtualization of calls based on an object represented by a declaration (i.e. a global or automatically allocated one) --- 978,983
[PATCH][3/n] Cleanup internal interfaces
Some more stuff. dse.c can probably be simplified with dse_record_singleton_alias_set / dse_invalidate_singleton_alias_set being removed. LTO Bootstrapped on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2012-03-29 Richard Guenther rguent...@suse.de * cgraph.h (cgraph_materialize_all_clones): Remove. (reset_inline_failed): Likewise. * cgraphunit.c (cgraph_materialize_all_clones): Make static. * cgraphbuild.c (reset_inline_failed): Remove. * rtl.h (cse_main): Remove. (extended_count): Likewise. * cse.c (dump_class): Mark as DEBUG_FUNCTION. (cse_main): Make static. * combine.c (extended_count): Remove. (dump_combine_stats): Mark as DEBUG_FUNCTION. * basic-block.h (reorder_basic_blocks): Remove. * bb-reorder.c (reorder_basic_blocks): Make static. * Makefile.in (dse.o): Remove dse.h dependency. * dse.h: Remove. * dse.c (gate_dse): Remove. (clear_alias_mode_eq): Likewise. (clear_alias_mode_hash): Likewise. (dse_record_singleton_alias_set): Likewise. (dse_invalidate_singleton_alias_set): Likewise. Index: gcc/cgraph.h === *** gcc/cgraph.h(revision 185957) --- gcc/cgraph.h(working copy) *** struct cgraph_2edge_hook_list *cgraph_ad *** 613,625 void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *); struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *); void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *); - void cgraph_materialize_all_clones (void); gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *); bool cgraph_propagate_frequency (struct cgraph_node *node); /* In cgraphbuild.c */ unsigned int rebuild_cgraph_edges (void); void cgraph_rebuild_references (void); - void reset_inline_failed (struct cgraph_node *); int compute_call_stmt_bb_frequency (tree, basic_block bb); /* In ipa.c */ --- 613,623 Index: gcc/cgraphunit.c === *** gcc/cgraphunit.c(revision 185957) --- gcc/cgraphunit.c(working copy) *** handle_alias_pairs (void) *** 1294,1352 } - /* Analyze the whole compilation unit once it is parsed completely. */ - - void - cgraph_finalize_compilation_unit (void) - { - timevar_push (TV_CGRAPH); - - /* If LTO is enabled, initialize the streamer hooks needed by GIMPLE. */ - if (flag_lto) - lto_streamer_hooks_init (); - - /* If we're here there's no current function anymore. Some frontends - are lazy in clearing these. */ - current_function_decl = NULL; - set_cfun (NULL); - - /* Do not skip analyzing the functions if there were errors, we - miss diagnostics for following functions otherwise. */ - - /* Emit size functions we didn't inline. */ - finalize_size_functions (); - - /* Mark alias targets necessary and emit diagnostics. */ - finish_aliases_1 (); - handle_alias_pairs (); - - if (!quiet_flag) - { - fprintf (stderr, \nAnalyzing compilation unit\n); - fflush (stderr); - } - - if (flag_dump_passes) - dump_passes (); - - /* Gimplify and lower all functions, compute reachability and - remove unreachable nodes. */ - cgraph_analyze_functions (); - - /* Mark alias targets necessary and emit diagnostics. */ - finish_aliases_1 (); - handle_alias_pairs (); - - /* Gimplify and lower thunks. */ - cgraph_analyze_functions (); - - /* Finally drive the pass manager. */ - cgraph_optimize (); - - timevar_pop (TV_CGRAPH); - } - - /* Figure out what functions we want to assemble. */ static void --- 1294,1299 *** output_weakrefs (void) *** 2134,2257 } - /* Perform simple optimizations based on callgraph. */ - - void - cgraph_optimize (void) - { - if (seen_error ()) - return; - - #ifdef ENABLE_CHECKING - verify_cgraph (); - #endif - - /* Frontend may output common variables after the unit has been finalized. - It is safe to deal with them here as they are always zero initialized. */ - varpool_analyze_pending_decls (); - - timevar_push (TV_CGRAPHOPT); - if (pre_ipa_mem_report) - { - fprintf (stderr, Memory consumption before IPA\n); - dump_memory_report (false); - } - if (!quiet_flag) - fprintf (stderr, Performing interprocedural optimizations\n); - cgraph_state = CGRAPH_STATE_IPA; - - /* Don't run the IPA passes if there was any error or sorry messages. */ - if (!seen_error ()) - ipa_passes (); - - /* Do nothing else if any IPA pass found errors or if we are just streaming LTO. */ - if (seen_error () - || (!in_lto_p flag_lto !flag_fat_lto_objects)) - { - timevar_pop (TV_CGRAPHOPT); - return; - } - -
Re: [PATCH][1/n] Cleanup internal interfaces, GCC modularization
I am playing with doing some internal interface static analysis using the first patch below (and looking at LTO bootstrap results). An example, obvious patch resulting from that is the 2nd patch, resuling from the static analysis output /space/rguenther/src/svn/trunk/gcc/tree-ssa-pre.c:add_to_value can be made static /space/rguenther/src/svn/trunk/gcc/tree-ssa-pre.c:print_value_expressions can be made static the static analysis is very verbose (and does not consider ipa-refs yet). You also need to union results for building all frontends and all targets (well, in theory, or you can simply manually verify things which is a good idea anyway - even unused functions may be useful exported when they implement a generic data structure for example). Excercise for the reader: turn the analysis into a plugin. Richard. Index: gcc/lto/lto.c === --- gcc/lto/lto.c (revision 185918) +++ gcc/lto/lto.c (working copy) @@ -2721,6 +2721,65 @@ read_cgraph_and_symbols (unsigned nfiles lto_symtab_merge_cgraph_nodes (); ggc_collect (); + if (flag_wpa) +{ + struct cgraph_node *node; + FILE *f = fopen (concat (dump_base_name, .callers, NULL), w); + for (node = cgraph_nodes; node; node = node-next) + { + tree caller_tu = NULL_TREE; + struct cgraph_edge *caller; + bool found = true; + + if (!TREE_PUBLIC (node-decl) + || !TREE_STATIC (node-decl) + || resolution_used_from_other_file_p (node-resolution)) + continue; + + if (!node-callers) + { + expanded_location loc = expand_location (DECL_SOURCE_LOCATION (node-decl)); + fprintf (f, %s:%s no calls\n, +loc.file, IDENTIFIER_POINTER (DECL_NAME (node-decl))); + } With Mozilla folks I used the dumps from first WPA unreachable function removal pass with some degree of success. This gets a lot of non-trivial cases of dead code, but also there are a lot of funny false positives wrt comdats etc. + for (caller = node-callers; caller; caller = caller-next_caller) + { + if (!caller_tu) + caller_tu = DECL_CONTEXT (caller-caller-decl); + else if (caller_tu + DECL_CONTEXT (caller-caller-decl) != caller_tu) + found = false; + } Extending to IPA-REF should be straighforward. + if (found caller_tu) + { + expanded_location loc1 = expand_location (DECL_SOURCE_LOCATION (node-decl)); + expanded_location loc2 = expand_location (DECL_SOURCE_LOCATION (node-callers-caller-decl)); + + if (DECL_CONTEXT (node-decl) == caller_tu) + fprintf (f, %s:%s can be made static\n, + loc1.file, IDENTIFIER_POINTER (DECL_NAME (node-decl))); Indeed, this is also useful. Any plans to turn this into general -Wsomething, or you will also stay just with an internal hack like I did? :) Honza
Re: [C++ Patch] for c++/52465
On 03/08/2012 04:34 PM, Fabien Chêne wrote: * decl.c (grokdeclarator): Call strip_using_decl. I would think we ought to be stripping USING_DECLs at a lower level, when we first look up the name in the parser. They shouldn't make it as far as grokdeclarator. Jason
C++ PATCH for c++/52743 (ICE with list-initialized array)
List-initialization of an array of scalars is not considered a user-defined conversion, so we need to check for it specifically to avoid treating it as a standard conversion. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit efaacb4065cce51b7374c31ddfb4682a880cbfc5 Author: Jason Merrill ja...@redhat.com Date: Thu Mar 29 09:41:23 2012 -0400 PR c++/52743 * call.c (compare_ics): Handle ck_aggr like ck_list. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 88733f5..3c3dabb 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7620,7 +7620,7 @@ compare_ics (conversion *ics1, conversion *ics2) Specifically, we need to do the reference binding comparison at the end of this function. */ - if (ics1-user_conv_p || ics1-kind == ck_list) + if (ics1-user_conv_p || ics1-kind == ck_list || ics1-kind == ck_aggr) { conversion *t1; conversion *t2; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C b/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C new file mode 100644 index 000..1a94f4e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C @@ -0,0 +1,10 @@ +// PR c++/52743 +// { dg-do compile { target c++11 } } + +void composite (int const () [2]); +void composite (int const () [3]); + +int main () +{ + composite({0,1}); // { dg-error ambiguous } +}
Re: PATCH: Backport x32 support to libtool
On Sat, Mar 3, 2012 at 9:54 AM, H.J. Lu hongjiu...@intel.com wrote: Hi, This patch backports x32 support to libtool: http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=88992fe6771ec3258bde1b03314ce579da0ac2d5 OK to install? Thanks. H.J. --- ommit 0d8c092cac25c3bce5dbfc1981b84df91b3f6086 Author: H.J. Lu hjl.to...@gmail.com Date: Mon Dec 12 13:03:14 2011 -0800 Add x32 support to libtool.m4 2011-12-12 H.J. Lu hongjiu...@intel.com * libtool.m4 (_LT_ENABLE_LOCK): Support x32. diff --git a/ChangeLog.x32 b/ChangeLog.x32 new file mode 100644 index 000..b6e01ee --- /dev/null +++ b/ChangeLog.x32 @@ -0,0 +1,3 @@ +2011-12-12 H.J. Lu hongjiu...@intel.com + + * libtool.m4 (_LT_ENABLE_LOCK): Support x32. diff --git a/libtool.m4 b/libtool.m4 index 67321a7..a7f99ac 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -1232,7 +1232,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD=${LD-ld} -m elf_i386_fbsd ;; x86_64-*linux*) - LD=${LD-ld} -m elf_i386 + case `/usr/bin/file conftest.o` in + *x86-64*) + LD=${LD-ld} -m elf32_x86_64 + ;; + *) + LD=${LD-ld} -m elf_i386 + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD=${LD-ld} -m elf32ppclinux Hi Ralf, Can you review this patch? Thanks. -- H.J.
Re: [PATCH][3/n] Cleanup internal interfaces
On Thu, Mar 29, 2012 at 8:50 AM, Richard Guenther rguent...@suse.de wrote: Some more stuff. dse.c can probably be simplified with dse_record_singleton_alias_set / dse_invalidate_singleton_alias_set being removed. Can we also make big functions much smaller? semi :-) -- Gaby
Re: [C++ PATCH] Don't call maybe_apply_pragma_weak for templates (PR c++/52759)
On 03/29/2012 08:30 AM, Jakub Jelinek wrote: The recently added assert in mangle.c doesn't like mangling to be performed during processing_template_decl. With #pragma weak foo we can hit it unfortunately. This patch fixes that. Perhaps we could call maybe_apply_pragma_weak from pt.c when instantiating, though not sure how much useful will that be, aren't most templates weak already anyway? Yeah, doesn't seem that useful. The patch is OK. Jason
Re: [C++ RFC / Patch] Implementing Deducing noexcept for destructors
... attached the testsuite changes I have so far (seem all rather straightforward to me). Thanks, Paolo. Index: testsuite/g++.old-deja/g++.eh/cleanup1.C === --- testsuite/g++.old-deja/g++.eh/cleanup1.C(revision 185952) +++ testsuite/g++.old-deja/g++.eh/cleanup1.C(working copy) @@ -2,6 +2,12 @@ // Bug: obj gets destroyed twice because the fixups for the return are // inside its cleanup region. +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + extern C int printf (const char *, ...); int d; @@ -9,7 +15,7 @@ int d; struct myExc { }; struct myExcRaiser { - ~myExcRaiser() { throw myExc(); } + ~myExcRaiser() NOEXCEPT_FALSE { throw myExc(); } }; struct stackObj { Index: testsuite/g++.dg/tree-ssa/ehcleanup-1.C === --- testsuite/g++.dg/tree-ssa/ehcleanup-1.C (revision 185952) +++ testsuite/g++.dg/tree-ssa/ehcleanup-1.C (working copy) @@ -1,9 +1,16 @@ // { dg-options -O2 -fdump-tree-ehcleanup1-details } + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + extern void can_throw (); class a { public: - ~a () + ~a () NOEXCEPT_FALSE { if (0) can_throw (); Index: testsuite/g++.dg/cpp0x/noexcept17.C === --- testsuite/g++.dg/cpp0x/noexcept17.C (revision 0) +++ testsuite/g++.dg/cpp0x/noexcept17.C (revision 0) @@ -0,0 +1,54 @@ +// PR c++/50043 +// { dg-options -std=c++11 } + +struct True1 {}; +struct True2 { ~True2(); }; +struct True3 { ~True3(){ throw 0; } }; +struct False { ~False() noexcept(false); }; + +template typename Base +struct A : Base +{ +}; + +template typename Member +struct B +{ +Member mem; +}; + +template typename Base, typename Member +struct C : Base +{ +Member mem; +}; + +#define SA(X) static_assert(X, #X) + +SA( noexcept(True1())); +SA( noexcept(True2())); +SA( noexcept(True3())); +SA(!noexcept(False())); + +SA( noexcept(ATrue1())); +SA( noexcept(ATrue2())); +SA( noexcept(ATrue3())); +SA(!noexcept(AFalse())); + +SA( noexcept(BTrue1())); +SA( noexcept(BTrue2())); +SA( noexcept(BTrue3())); +SA(!noexcept(BFalse())); + +SA( noexcept(CTrue1, True2())); +SA( noexcept(CTrue1, True3())); +SA( noexcept(CTrue2, True3())); +SA( noexcept(CTrue2, True1())); +SA( noexcept(CTrue3, True1())); +SA( noexcept(CTrue3, True2())); +SA(!noexcept(CFalse, True1())); +SA(!noexcept(CFalse, True2())); +SA(!noexcept(CFalse, True3())); +SA(!noexcept(CTrue1, False())); +SA(!noexcept(CTrue2, False())); +SA(!noexcept(CTrue3, False())); Index: testsuite/g++.dg/cpp0x/noexcept01.C === --- testsuite/g++.dg/cpp0x/noexcept01.C (revision 185952) +++ testsuite/g++.dg/cpp0x/noexcept01.C (working copy) @@ -50,7 +50,7 @@ struct E ~E(); }; -SA (!noexcept (E())); +SA (noexcept (E())); struct F { @@ -74,7 +74,7 @@ void tf() } template void tfint,true(); -template void tfE, false(); +template void tfE, true(); // Make sure that noexcept uses the declared exception-specification, not // any knowledge we might have about whether or not the function really Index: testsuite/g++.dg/eh/init-temp1.C === --- testsuite/g++.dg/eh/init-temp1.C(revision 185952) +++ testsuite/g++.dg/eh/init-temp1.C(working copy) @@ -1,6 +1,12 @@ // PR c++/15764 // { dg-do run } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + extern C void abort (); int thrown; @@ -8,7 +14,7 @@ int thrown; int as; struct a { a () { ++as; } - ~a () { --as; if (thrown++ == 0) throw 42; } + ~a () NOEXCEPT_FALSE { --as; if (thrown++ == 0) throw 42; } }; int f (a const) { return 1; } Index: testsuite/g++.dg/eh/ctor1.C === --- testsuite/g++.dg/eh/ctor1.C (revision 185952) +++ testsuite/g++.dg/eh/ctor1.C (working copy) @@ -5,6 +5,12 @@ // PR 411 +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + bool was_f_in_Bar_destroyed=false; struct Foo @@ -17,7 +23,7 @@ struct Foo struct Bar { - ~Bar() + ~Bar() NOEXCEPT_FALSE { throw 1; }
C++ PATCH for c++/52685 (ICE with dependent/non-dependent bases)
In this testcase, C has a base BU which is a non-dependent scope because it is the current instantiation. But BU has a dependent base ABU, so we need to be able to handle a non-dependent base that itself has a dependent base. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit f44bf02aa21ddfd33505c067f3c26893d432a186 Author: Jason Merrill ja...@redhat.com Date: Thu Mar 29 11:08:11 2012 -0400 PR c++/52685 * tree.c (copy_binfo): Handle BINFO_DEPENDENT_BASE_P. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 87e9be8..30ad5e1 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1237,12 +1237,11 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) TREE_CHAIN (*igo_prev) = new_binfo; *igo_prev = new_binfo; - if (binfo) + if (binfo !BINFO_DEPENDENT_BASE_P (binfo)) { int ix; tree base_binfo; - gcc_assert (!BINFO_DEPENDENT_BASE_P (binfo)); gcc_assert (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), type)); BINFO_OFFSET (new_binfo) = BINFO_OFFSET (binfo); @@ -1255,8 +1254,6 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++) { tree new_base_binfo; - - gcc_assert (!BINFO_DEPENDENT_BASE_P (base_binfo)); new_base_binfo = copy_binfo (base_binfo, BINFO_TYPE (base_binfo), t, igo_prev, BINFO_VIRTUAL_P (base_binfo)); diff --git a/gcc/testsuite/g++.dg/template/inherit8.C b/gcc/testsuite/g++.dg/template/inherit8.C new file mode 100644 index 000..a9b2bdb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/inherit8.C @@ -0,0 +1,13 @@ +// PR c++/52685 + +template typename T +struct A +{ + template typename U + struct B : public A BU + { +struct C : public BU +{ +}; + }; +};
patch to fix a bug in coloring in multi-register allocnos presence.
Frederic Riss sent me IRA dump files for an in-house GCC back-end which helped to find a bug in coloring in presence of multi-register allocnos. The bug resulted in making allocno colorable too earlier and as a consequence in worse code. The problem was in preventing processing of all conflicting objects of an allocno although the impact of each object was taken as 1. It was my mistake in merging code for IRA coloring without cover classes and Bernd's work on multi-object allocnos. The following patch changes SPEC2000 code on x86 (32-bit mode) for vpr, gcc, crafty, parser, and vortex and improves scores (up to 0.7% for crafty) and decrease code size (up to 0.5% for crafty) for these benchmarks. Frederic Riss also reported considerable improvements for his back-end. The patch was successfully bootstrapped on x86/x86-64 and committed as rev. 185971. 2012-03-29 Vladimir Makarov vmaka...@redhat.com * ira-color.c (setup_left_conflict_sizes_p): Process all conflicting objects. Index: ira-color.c === --- ira-color.c (revision 185967) +++ ira-color.c (working copy) @@ -821,7 +821,6 @@ setup_left_conflict_sizes_p (ira_allocno node_preorder_num = node-preorder_num; COPY_HARD_REG_SET (node_set, node-hard_regs-set); node_check_tick++; - curr_allocno_process++; for (k = 0; k nobj; k++) { ira_object_t obj = ALLOCNO_OBJECT (a, k); @@ -838,12 +837,10 @@ setup_left_conflict_sizes_p (ira_allocno conflict_data = ALLOCNO_COLOR_DATA (conflict_a); if (! ALLOCNO_COLOR_DATA (conflict_a)-in_graph_p - || conflict_data-last_process == curr_allocno_process || ! hard_reg_set_intersect_p (profitable_hard_regs, conflict_data -profitable_hard_regs)) continue; - conflict_data-last_process = curr_allocno_process; conflict_node = conflict_data-hard_regs_node; COPY_HARD_REG_SET (conflict_node_set, conflict_node-hard_regs-set); if (hard_reg_set_subset_p (node_set, conflict_node_set))
Re: [PATCH, i386, Android] -mandroid support for i386 target
2012-02-27 Enkovich Ilya ilya.enkov...@intel.com * gcc/config/i386/gnu-user.h (GNU_USER_TARGET_CC1_SPEC): New. (CC1_SPEC): Use GNU_USER_TARGET_CC1_SPEC. (GNU_USER_TARGET_LINK_SPEC): New. (LINK_SPEC): Use GNU_USER_TARGET_LINK_SPEC. (GNU_USER_TARGET_MATHFILE_SPEC): New. (ENDFILE_SPEC): Use GNU_USER_TARGET_MATHFILE_SPEC. * gcc/config/i386/linux.h (CC1_SPEC): New. (LINK_SPEC): New. (LIB_SPEC): New. (STARTFILE_SPEC): New. (ENDFILE_SPEC): New. OK. I guess the patch now follows quite closely the arm implementation, right? I am not quite sure if it makes sense to go around hassle and breaking up the following into generic linux-or-android.h? Honza diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 73681fe..a832ddc 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -22,3 +22,30 @@ along with GCC; see the file COPYING3. If not see #define GNU_USER_LINK_EMULATION elf_i386 #define GLIBC_DYNAMIC_LINKER /lib/ld-linux.so.2 + +#undef CC1_SPEC +#define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ +GNU_USER_TARGET_CC1_SPEC ANDROID_CC1_SPEC) + +#undef LINK_SPEC +#define LINK_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \ +GNU_USER_TARGET_LINK_SPEC ANDROID_LINK_SPEC) + +#undef LIB_SPEC +#define LIB_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ +GNU_USER_TARGET_LIB_SPEC ANDROID_LIB_SPEC) + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, \ +ANDROID_STARTFILE_SPEC) + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_MATHFILE_SPEC \ +GNU_USER_TARGET_ENDFILE_SPEC, \ +GNU_USER_TARGET_MATHFILE_SPEC \ +ANDROID_ENDFILE_SPEC)
Re: [PATCH, i386, Android] Enable __ANDROID__ macro for Android i386 target
Undef TARGET_OS_CPP_BUILTINS and define TARGET_OS_CPP_BUILTINS in linux.h with GNU_USER_TARGET_OS_CPP_BUILTINS and ANDROID_TARGET_OS_CPP_BUILTINS. -- H.J. Hello, Here is a variant with linux.h modification. Does it look fine? OK, Honza
Re: [PATCH] eh_personality.cc: unwinding on ARM
On 19.03.2012 17:38, Daniel Jacobowitz wrote: On Mon, Mar 19, 2012 at 12:12 PM, Andrew Stubbsa...@codesourcery.com wrote: On 16/03/12 13:29, EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31) wrote: The CodeSourcery toolchain contains a fix like the following, please consider for adding it. Here's the full original patch with ChangeLog. I don't know why Dan never submitted this one. Perhaps it's not suitable for upstream or not considered the correct fix? I think it was just a pain to write a test for. Here's another version using siglongjmp to avoid VERIFY in signal handler: Can someone (maybe you) put that at the appropriate place? Please don't let the integration being a pain as well Peter seehttp://gcc.gnu.org/ml/gcc-patches/2012-03/msg01161.html /* author: Peter Waechtler (pwaechtler at mac.com) Copyright FSF or whatever is needed A simple test case to verify if backtrace(3) goes into a loop while unwinding on ARM with cxx_personality routine. */ #includeunistd.h #includestdlib.h #includestring.h #includesignal.h #includeexecinfo.h #includesetjmp.h #includeiostream #includevector using namespace std; //#include testsuite.h #define WE_PASSED 42 #define WE_FAILED 0xff sigjmp_buf env; static void abort_handler(int n_signal, siginfo_t *siginfo, void *ptr) { void *address[20]; int depth; depth = backtrace(address, sizeof(address)/sizeof(void*)); backtrace_symbols_fd(address, depth, 0); /* this is a dumb check, better look for main */ if (depth == sizeof(address)/sizeof(void*)) siglongjmp(env, WE_FAILED); else siglongjmp(env, WE_PASSED); } static int tst_eh01(void) { int rc = 0; std::vectorint v(10); rc = v.at(42); return rc; } int main(int argc, char *argv[]) { int c = 1; struct sigaction sa; memset(sa, 0 , sizeof(sa)); sa.sa_sigaction = abort_handler; sa.sa_flags = SA_SIGINFO; sigaction(SIGABRT,sa, NULL); switch (sigsetjmp(env, 1)) { case 0: /* the context was set */ c = tst_eh01(); break; case WE_PASSED: // VERIFY( true ); cerr PASSED endl; break; default: // VERIFY( false ); cerr FAILED endl; break; } return c; }
Re: [C++ RFC / Patch] Implementing Deducing noexcept for destructors
On 03/28/2012 06:40 PM, Paolo Carlini wrote: + /* 12.4/3 */ + if (cxx_dialect= cxx0x + DECL_DESTRUCTOR_P (decl) + TYPE_RAISES_EXCEPTIONS (TREE_TYPE (old_decl))) + deduce_noexcept_on_destructor (decl); The exception specification on old_decl doesn't matter; we can drop that test. 2- The new register_specialization bits are needed to cope with (also in the C++ library and elsewhere): That's the wrong place. Why doesn't the code in grokfndecl handle this case? Jason
[C++ Patch] PR 52718
Hi, this fixes the PR by checking for zero in check_default_argument and, in case, replacing it with nullptr to avoid further warnings later on. Should be safe enough for 4.7.1 too. Tested x86_64-linux. Thanks, Paolo. / /cp 2012-03-29 Paolo Carlini paolo.carl...@oracle.com PR c++/52718 * decl.c (check_default_argument): With -Wzero-as-null-pointer-constant warn for a zero as null pointer constant default argument. /testsuite 2012-03-29 Paolo Carlini paolo.carl...@oracle.com PR c++/52718 * g++.dg/warn/Wzero-as-null-pointer-constant-5.C: New. Index: testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C === --- testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C(revision 0) +++ testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C(revision 0) @@ -0,0 +1,20 @@ +// PR c++/52718 +// { dg-options -Wzero-as-null-pointer-constant } + +struct foo +{ + foo(void* a = 0) {}; // { dg-warning zero as null pointer } +}; + +void* fun(void* a = 0) {}; // { dg-warning zero as null pointer } + +struct bar: foo +{ + bar() {}; +}; + +struct baz +{ + baz(const foo f1 = foo(), + void* f2 = fun()) {}; +}; Index: cp/decl.c === --- cp/decl.c (revision 185969) +++ cp/decl.c (working copy) @@ -10596,6 +10602,17 @@ check_default_argument (tree decl, tree arg) return error_mark_node; } + if (warn_zero_as_null_pointer_constant + c_inhibit_evaluation_warnings == 0 + (POINTER_TYPE_P (decl_type) || TYPE_PTR_TO_MEMBER_P (decl_type)) + null_ptr_cst_p (arg) + !NULLPTR_TYPE_P (TREE_TYPE (arg))) +{ + warning (OPT_Wzero_as_null_pointer_constant, + zero as null pointer constant); + return nullptr_node; +} + /* [dcl.fct.default] Local variables shall not be used in default argument
Re: [C++ RFC / Patch] Implementing Deducing noexcept for destructors
Hi, On 03/28/2012 06:40 PM, Paolo Carlini wrote: + /* 12.4/3 */ + if (cxx_dialect= cxx0x + DECL_DESTRUCTOR_P (decl) + TYPE_RAISES_EXCEPTIONS (TREE_TYPE (old_decl))) +deduce_noexcept_on_destructor (decl); The exception specification on old_decl doesn't matter; we can drop that test. I seem to remember something going wrong with templates otherwise, because implicitly_declare_fn has gcc_assert (!dependent_type_p (type)); I don't know if that rings a bell to you... I'll double check anyway. 2- The new register_specialization bits are needed to cope with (also in the C++ library and elsewhere): That's the wrong place. Why doesn't the code in grokfndecl handle this case? Ok, I will check, thanks. Paolo.
Re: [C++ RFC / Patch] Implementing Deducing noexcept for destructors
Hi, On 03/28/2012 06:40 PM, Paolo Carlini wrote: + /* 12.4/3 */ + if (cxx_dialect= cxx0x + DECL_DESTRUCTOR_P (decl) + TYPE_RAISES_EXCEPTIONS (TREE_TYPE (old_decl))) +deduce_noexcept_on_destructor (decl); The exception specification on old_decl doesn't matter; we can drop that test. I seem to remember something going wrong with templates otherwise, because implicitly_declare_fn has gcc_assert (!dependent_type_p (type)); I don't know if that rings a bell to you... I'll double check anyway. Yes, If I remove that check, then we hit that gcc_assert for: templatetypename T struct A { ~A(); }; templatetypename T AT::~A() { } Paolo.
Re: [C++ RFC / Patch] Implementing Deducing noexcept for destructors
On 03/29/2012 03:06 PM, Paolo Carlini wrote: The exception specification on old_decl doesn't matter; we can drop that test. I seem to remember something going wrong with templates otherwise, because implicitly_declare_fn has gcc_assert (!dependent_type_p (type)); We shouldn't be doing this for templates anyway, as in general we can't know what the implicitly declared function will look like. Jason
Re: [C++ Patch] PR 52718
OK. Jason
[PATCH] ARM: Use different linker path for hardfloat ABI
This is an updated version of a patch Debian and Ubuntu are using to use an alternate linker path for hardfloat binaries. The difference with this one is that it covers the case where no float flag was passed in, defaulting to the softfloat path. 2012-03-29 dann frazier dann.fraz...@canonical.com * config/arm/linux-elf.h: Use alternate linker path for hardfloat ABI Index: gcc/config/arm/linux-elf.h === --- gcc/config/arm/linux-elf.h (revision 185708) +++ gcc/config/arm/linux-elf.h (working copy) @@ -59,14 +59,21 @@ #define LIBGCC_SPEC %{mfloat-abi=soft*:-lfloat} -lgcc -#define GLIBC_DYNAMIC_LINKER /lib/ld-linux.so.2 +#define LINUX_DYNAMIC_LINKER_SF /lib/ld-linux.so.3 +#define LINUX_DYNAMIC_LINKER_HF /lib/arm-linux-gnueabihf/ld-linux.so.3 #define LINUX_TARGET_LINK_SPEC %{h*} \ %{static:-Bstatic} \ %{shared:-shared} \ %{symbolic:-Bsymbolic} \ %{rdynamic:-export-dynamic} \ - -dynamic-linker GNU_USER_DYNAMIC_LINKER \ + %{msoft-float:-dynamic-linker LINUX_DYNAMIC_LINKER_SF } \ + %{mfloat-abi=soft*:-dynamic-linker LINUX_DYNAMIC_LINKER_SF } \ + %{mhard-float:-dynamic-linker LINUX_DYNAMIC_LINKER_HF } \ + %{mfloat-abi=hard:-dynamic-linker LINUX_DYNAMIC_LINKER_HF } \ + %{!mfloat-abi: \ + %{!msoft-float: \ + %{!mhard-float:-dynamic-linker LINUX_DYNAMIC_LINKER_SF }}} \ -X \ %{mbig-endian:-EB} %{mlittle-endian:-EL} \ SUBTARGET_EXTRA_LINK_SPEC
Re: [C++ RFC / Patch] Implementing Deducing noexcept for destructors
On 03/29/2012 09:27 PM, Jason Merrill wrote: On 03/29/2012 03:06 PM, Paolo Carlini wrote: The exception specification on old_decl doesn't matter; we can drop that test. I seem to remember something going wrong with templates otherwise, because implicitly_declare_fn has gcc_assert (!dependent_type_p (type)); We shouldn't be doing this for templates anyway, as in general we can't know what the implicitly declared function will look like. Can you suggest a robust way to achieve that? I remained stuck a lot because of this, to make sure that the latter testcase and: templatetypename T struct A { ~A() noexcept; }; templatetypename T AT::~A() { } both work. Thanks, Paolo.
Re: [PATCH H8300] Add function_vector attribute
On 03/28/2012 09:10 AM, Ajinkya Dhobale wrote: Hi Jeff, Thank you for replying to the post. How is this different than the function vector support that is already in GCC for the H8/300 series processors? Current H8/300 implementation of function vector seems inappropriate. This patch fixes following problems from it. 1. Attribute syntax: The function vector attribute is expected to accept one argument i.e. vector number. Ref: http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index- calling-functions-through-the-function-vector-on-H8_002f300_002c- M16C_002c-M32C-and-SH2A-processors-2525 However, with H8/300 target, it does not accept any argument and test case compilation fails with an error message: error: wrong number of arguments specified for function_vector attribute This patch fixes this problem. Ok. So the fundamental difference is your version of function_vector is programmer directed. ie, the programmer explicitly assigns slots for functions to call through the function vector. The existing implementation relies upon the linker to handle assignment of a specific slot. The problem with installing your patch as-is is it will break existing code which utilizes the linker driven assignment of slots. ISTM that you either need to use a different attribute name or find a way to make the argument optional. 2. Addressing mode support: Currently, even for function vectors, GCC generates instruction 'jsr' in absolute addressing mode which is incorrect. Instead of that, it should be generating 'jsr' in indirect memory addressing mode (@@aa:8). I think you need to investigate further since functions marked with the attribute should be called through the function vector. When the linker assigns the slot, the proper syntax is jsr name:8 Obviously for the programmer assigned slots, you'll need to use a different syntax. But simply removing the linker assigned slot support is wrong. Jeff
Re: [patch][rfa] Do not call output_constant from the front end
On Wed, Mar 28, 2012 at 12:02 PM, Richard Guenther richard.guent...@gmail.com wrote: Therefore, an RFA for the attached patch. Bootstrappedtested on powerpc64-unknown-linux-gnu. OK? Ok. Thanks. Committed as r185977. Ciao! Steven
[C Patch]: pr52543
This patch takes a different approach to fixing PR52543 than does the patch in http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00641.html This patch transforms the lower-subreg pass(es) from unconditionally splitting wide moves, zero extensions, and shifts, so that it now takes into account the target specific costs and only does the transformations if it is profitable. Unconditional splitting is a problem that not only occurs on the AVR but is also a problem on the ARM NEON and my private port. Furthermore, it is a problem that is likely to occur on most modern larger machines since these machines are more likely to have fast instructions for moving things that are larger than word mode. At compiler initialization time, each mode that is larger that a word mode is examined to determine if the cost of moving a value of that mode is less expensive that inserting the proper number of word sided moves. If it is cheaper to split it up, a bit is set to allow moves of that mode to be lowered. A similar analysis is made for the zero extensions and shifts except that lower subreg had been (and is still limited to only breaking up these operations if the target size was twice the size of word mode.) Also, if the analysis determines that there are no profitable transformations, the pass exits quickly without doing any analysis. It is quite likely that most ports will have to be adjusted after this patch is accepted. For instance, the analysis discovers that there are no profitable transformations to be performed on the x86-64.Since this is not my platform, I have no idea if these are the correct settings. But the pass uses the standard insn_rtx_cost interface and it is the port maintainers responsibility to not lie to the optimization passes so this extra work in stage one should be acceptable. I do know from a private conversation with Richard Sandiford, that mips patches are likely forthcoming. There is preprocessor controlled code that prints out the cost analysis. Only a summary of this can go in the subregs dump file because the analysis is called from backend_init_target and so the dump file is not available. But it is very useful to define LOG_COSTS when adjusting your port. There is also preprocessor code that forces all of the lowering operations to marked as profitable. This is useful in debugging the new logic. Both of these preprocessor symbols are documented at the top of the pass. I have tested this on an x86_64 with both the force lowering on and off and neither cause any regressions as well as extensive testing on my port. Ok to commit? Kenny 2012-03-29 Kenneth Zadeck zad...@naturalbridge.com * toplev.c (backend_init_target): Call initializer for lower-subreg pass. * lower-subreg.c (move_modes_to_split, splitting_ashift, splitting_lshiftrt) splitting_zext, splitting_some_shifts, twice_word_mode, something_to_do, word_mode_move_cost, move_zero_cost): New static vars. (compute_move_cost, profitable_shift_p, init_lower_subreg): New functions. (find_pseudo_copy, resolve_simple_move): Added code to only split based on costs. (find_decomposable_subregs): Added code to mark as decomposable moves that are not profitable. (find_decomposable_shift_zext): Added code to only decompose shifts and zext if profitable. (resolve_shift_zext): Added comment. (decompose_multiword_subregs): Dump list of profitable transformations. Add code to skip non profitable transformations. *rtl.h(init_lower_subreg): Added declaration. Index: toplev.c === --- toplev.c (revision 185969) +++ toplev.c (working copy) @@ -1660,6 +1660,7 @@ backend_init_target (void) /* rtx_cost is mode-dependent, so cached values need to be recomputed on a mode change. */ init_expmed (); + init_lower_subreg (); /* We may need to recompute regno_save_code[] and regno_restore_code[] after a mode change as well. */ Index: lower-subreg.c === --- lower-subreg.c (revision 185969) +++ lower-subreg.c (working copy) @@ -52,10 +52,34 @@ DEF_VEC_P (bitmap); DEF_VEC_ALLOC_P (bitmap,heap); /* Decompose multi-word pseudo-registers into individual - pseudo-registers when possible. This is possible when all the uses - of a multi-word register are via SUBREG, or are copies of the - register to another location. Breaking apart the register permits - more CSE and permits better register allocation. */ + pseudo-registers when possible and profitable. This is possible + when all the uses of a multi-word register are via SUBREG, or are + copies of the register to another location. Breaking apart the + register permits more CSE and permits better register allocation. + This is profitable if the machine does not have move instructions + to do this. + +
Re: [PATCH] SH2A: Don't push/pop registers for functions with resbank attribute
Naveen H. S navee...@kpitcummins.com wrote: Please find attached the patch resbank.patch which fixes the issue with resbank attribute. Currently, registers used in the routine are also saved on using resbank attribute. These registers are saved with resbank instruction and need not be saved separately. The patch fixes the issue. Looks that the patch ignores the case using movml. It could be something like the attached patch, though I don't do any tests. * config/sh/sh.c (push_regs): Skip banked registers when resbank attribute is specified. (sh_expand_epilogue): Likewise. --- ORIG/trunk/gcc/config/sh/sh.c 2012-03-28 17:51:20.0 +0900 +++ trunk/gcc/config/sh/sh.c2012-03-29 21:59:13.0 +0900 @@ -6487,7 +6487,9 @@ push_regs (HARD_REG_SET *mask, int inter use_movml = true; } - if (use_movml) + if (sh_cfun_resbank_handler_p ()) + ; /* Do nothing. */ + else if (use_movml) { rtx x, mem, reg, set; rtx sp_reg = gen_rtx_REG (SImode, STACK_POINTER_REGNUM); @@ -7485,7 +7487,9 @@ sh_expand_epilogue (bool sibcall_p) use_movml = true; } - if (use_movml) + if (sh_cfun_resbank_handler_p ()) + ; /* Do nothing. */ + else if (use_movml) { rtx sp_reg = gen_rtx_REG (SImode, STACK_POINTER_REGNUM);
[PATCH, i386]: Fix vhaddpd/vhsubpd AVX patterns
Hello! My recent patch [1] exposed problem with avx_hplusminus_insnv4df3 AVX pattern. The pattern is defined in a wrong way, since the components of the result should not cross 128bit lane boundary. This is the cause of failures is [2]: FAIL: gcc.target/i386/avx-vhaddpd-256-1.c execution test FAIL: gcc.target/i386/avx-vhsubpd-256-1.c execution test 2012-03-29 Uros Bizjak ubiz...@gmail.com * config/i386/sse.md (avx_hplusminus_insnv4df3): Fix results crossing 128bit lane boundary. Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu AVX target. Patch was committed to mainline, will be committed to all release branches. BTW: It looks that the x86 testsuite is not effective enough, these types of problems should be detected before new patterns are introduced to the .md files. [1] http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01819.html [2] http://gcc.gnu.org/ml/gcc-testresults/2012-03/msg03370.html Uros. Index: sse.md === --- sse.md (revision 185973) +++ sse.md (working copy) @@ -1175,15 +1175,15 @@ (parallel [(const_int 0)])) (vec_select:DF (match_dup 1) (parallel [(const_int 1)]))) (plusminus:DF - (vec_select:DF (match_dup 1) (parallel [(const_int 2)])) - (vec_select:DF (match_dup 1) (parallel [(const_int 3)] - (vec_concat:V2DF - (plusminus:DF (vec_select:DF (match_operand:V4DF 2 nonimmediate_operand xm) (parallel [(const_int 0)])) - (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))) + (vec_select:DF (match_dup 2) (parallel [(const_int 1)] + (vec_concat:V2DF (plusminus:DF + (vec_select:DF (match_dup 1) (parallel [(const_int 2)])) + (vec_select:DF (match_dup 1) (parallel [(const_int 3)]))) + (plusminus:DF (vec_select:DF (match_dup 2) (parallel [(const_int 2)])) (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))] TARGET_AVX
Re: [C++ RFC / Patch] Implementing Deducing noexcept for destructors
On 03/29/2012 09:27 PM, Jason Merrill wrote: On 03/29/2012 03:06 PM, Paolo Carlini wrote: The exception specification on old_decl doesn't matter; we can drop that test. I seem to remember something going wrong with templates otherwise, because implicitly_declare_fn has gcc_assert (!dependent_type_p (type)); We shouldn't be doing this for templates anyway, as in general we can't know what the implicitly declared function will look like. Oh my, as simple as the below appears to work! I simply added a !processing_template_decl check. Then I removed the deduce_noexcept_on_destructor calls in register_specialization and when I found a proper place in grokfndecl (must be before check_explicit_specialization) I noticed that apparently I can remove the other deduce_noexcept_on_destructor call which I had later on in grokfndecl. Thus the below passes the (updated) testsuite on x86_64-linux. I remark (once more) that whereas we accept (otherwise nothing works in, eg, the library): templatetypename T struct A { ~A(); }; templatetypename T AT::~A() { } we reject, with a different exception specifier error, both: templatetypename T struct A { ~A() noexcept; }; templatetypename T AT::~A() { } and: templatetypename T struct A { ~A(); }; templatetypename T AT::~A() noexcept { } Over the last days I wasted a lot of time trying painfully to not reject either, but actually now I'm pretty sure that we are right to reject the former (there are exception specifiers on the declaration thus automatic deduction should not trigger at all) and probably also the latter. These cases, characterized by different situations on declaration and definition, confused me quite a bit... Anyway, I'm attaching the last iteration. Thanks again for all your help! Paolo. /// Index: class.c === --- class.c (revision 185977) +++ class.c (working copy) @@ -4321,6 +4321,41 @@ clone_constructors_and_destructors (tree t) clone_function_decl (OVL_CURRENT (fns), /*update_method_vec_p=*/1); } +/* Deduce noexcept for a destructor DTOR. */ + +void +deduce_noexcept_on_destructor (tree dtor) +{ + if (!TYPE_RAISES_EXCEPTIONS (TREE_TYPE (dtor))) +{ + tree ctx = DECL_CONTEXT (dtor); + tree implicit_fn = implicitly_declare_fn (sfk_destructor, ctx, + /*const_p=*/false); + tree eh_spec = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (implicit_fn)); + TREE_TYPE (dtor) = build_exception_variant (TREE_TYPE (dtor), eh_spec); +} +} + +/* For each destructor in T, deduce noexcept: + + 12.4/3: A declaration of a destructor that does not have an + exception-specification is implicitly considered to have the + same exception-specification as an implicit declaration (15.4). */ + +static void +deduce_noexcept_on_destructors (tree t) +{ + tree fns; + + /* If for some reason we don't have a CLASSTYPE_METHOD_VEC, we bail + out now. */ + if (!CLASSTYPE_METHOD_VEC (t)) +return; + + for (fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns)) +deduce_noexcept_on_destructor (OVL_CURRENT (fns)); +} + /* Subroutine of set_one_vmethod_tm_attributes. Search base classes of TYPE for virtual functions which FNDECL overrides. Return a mask of the tm attributes found therein. */ @@ -4994,6 +5029,10 @@ check_bases_and_members (tree t) cant_have_const_ctor = 0; no_const_asn_ref = 0; + /* Deduce noexcept on destructors. */ + if (cxx_dialect = cxx0x) +deduce_noexcept_on_destructors (t); + /* Check all the base-classes. */ check_bases (t, cant_have_const_ctor, no_const_asn_ref); Index: decl.c === --- decl.c (revision 185977) +++ decl.c (working copy) @@ -7448,6 +7448,12 @@ grokfndecl (tree ctype, if (ctype != NULL_TREE) grokclassfn (ctype, decl, flags); + /* 12.4/3 */ + if (cxx_dialect = cxx0x + DECL_DESTRUCTOR_P (decl) + !processing_template_decl) +deduce_noexcept_on_destructor (decl); + decl = check_explicit_specialization (orig_declarator, decl, template_count, 2 * funcdef_flag + Index: method.c === --- method.c(revision 185977) +++ method.c(working copy) @@ -1444,7 +1444,7 @@ explain_implicit_non_constexpr (tree decl) reference argument or a non-const reference. Returns the FUNCTION_DECL for the implicitly declared function. */ -static tree +tree implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) { tree fn; Index: cp-tree.h === --- cp-tree.h (revision 185977) +++ cp-tree.h (working copy) @@ -4978,6 +4978,7 @@ extern void fixup_attribute_variants
Support for Runtime CPU type detection via builtins (issue5754058)
Subject:Support for Runtime CPU type detection via builtins Hi, I have made a new patch to only have two builtins : * __builtin_cpu_is (CPUNAME) * __builtin_cpu_supports (FEATURE) apart from the cpu init builtin, __builtin_cpu_init. List of CPU names : * amd * intel * atom * core2 * corei7 * nehalem * westmere * sandybridge * amdfam10h * barcelona * shanghai * istanbul * bdver1 * bdver2 List of CPU features : * cmov * mmx * popcnt * sse * sse2 * sse3 * ssse3 * sse4.1 * sse4.2 As an example, to check if CPU is corei7, call __builtin_cpu_is (corei7) Comments? Thanks. * config/i386/i386.c (build_struct_with_one_bit_fields): New function. (make_var_decl): New function. (get_field_from_struct): New function. (fold_builtin_target): New function. (ix86_fold_builtin): New function. (ix86_expand_builtin): Expand new builtins by folding them. (make_cpu_type_builtin): New functions. (ix86_init_platform_type_builtins): Make the new builtins. (ix86_init_builtins): Make new builtins to detect CPU type. (TARGET_FOLD_BUILTIN): New macro. (IX86_BUILTIN_CPU_INIT): New enum value. (IX86_BUILTIN_CPU_IS): New enum value. (IX86_BUILTIN_CPU_SUPPORTS): New enum value. * config/i386/i386-builtin-types.def: New function type. * testsuite/gcc.target/builtin_target.c: New testcase. * libgcc/config/i386/i386-cpuinfo.c: New file. * libgcc/config/i386/t-cpuinfo: New file. * libgcc/config.host: Include t-cpuinfo. * libgcc/config/i386/libgcc-glibc.ver: Version symbols __cpu_model and __cpu_features. Index: libgcc/config.host === --- libgcc/config.host (revision 185898) +++ libgcc/config.host (working copy) @@ -1130,7 +1130,7 @@ i[34567]86-*-linux* | x86_64-*-linux* | \ i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \ i[34567]86-*-knetbsd*-gnu | \ i[34567]86-*-gnu*) - tmake_file=${tmake_file} t-tls i386/t-linux + tmake_file=${tmake_file} t-tls i386/t-linux i386/t-cpuinfo if test $libgcc_cv_cfi = yes; then tmake_file=${tmake_file} t-stack i386/t-stack-i386 fi Index: libgcc/config/i386/t-cpuinfo === --- libgcc/config/i386/t-cpuinfo(revision 0) +++ libgcc/config/i386/t-cpuinfo(revision 0) @@ -0,0 +1 @@ +LIB2ADD += $(srcdir)/config/i386/i386-cpuinfo.c Index: libgcc/config/i386/libgcc-glibc.ver === --- libgcc/config/i386/libgcc-glibc.ver (revision 185898) +++ libgcc/config/i386/libgcc-glibc.ver (working copy) @@ -147,6 +147,11 @@ GCC_4.3.0 { __trunctfxf2 __unordtf2 } + +GCC_4.8.0 { + __cpu_model + __cpu_features +} %else GCC_4.4.0 { __addtf3 @@ -183,4 +188,9 @@ GCC_4.4.0 { GCC_4.5.0 { __extendxftf2 } + +GCC_4.8.0 { + __cpu_model + __cpu_features +} %endif Index: libgcc/config/i386/i386-cpuinfo.c === --- libgcc/config/i386/i386-cpuinfo.c (revision 0) +++ libgcc/config/i386/i386-cpuinfo.c (revision 0) @@ -0,0 +1,306 @@ +/* Get CPU type and Features for x86 processors. + Copyright (C) 2012 Free Software Foundation, Inc. + Contributed by Sriraman Tallam (tmsri...@google.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +http://www.gnu.org/licenses/. */ + +#include cpuid.h +#include tsystem.h + +int __cpu_indicator_init (void) __attribute__ ((constructor (101))); + +enum vendor_signatures +{ + SIG_INTEL = 0x756e6547 /* Genu */, + SIG_AMD =0x68747541 /* Auth */ +}; + +/* ISA Features supported. */ + +struct __processor_features +{ + unsigned int __cpu_cmov : 1; + unsigned int __cpu_mmx : 1; + unsigned int __cpu_popcnt : 1; + unsigned int __cpu_sse : 1; + unsigned int __cpu_sse2 : 1; + unsigned int __cpu_sse3 : 1; + unsigned int __cpu_ssse3 : 1; + unsigned int __cpu_sse4_1 : 1; + unsigned int __cpu_sse4_2 : 1; +} __cpu_features; + +/* Processor Model. */ + +struct __processor_model +{ + /* Vendor. */ + unsigned int __cpu_is_amd : 1; + unsigned int __cpu_is_intel : 1; + /* CPU type. */ + unsigned int __cpu_is_intel_atom : 1; + unsigned int __cpu_is_intel_core2 : 1; + unsigned int __cpu_is_intel_corei7 : 1; + unsigned int
Re: Support for Runtime CPU type detection via builtins (issue5754058)
Subject:Support for Runtime CPU type detection via builtins Hi, I have uploaded a new patch to only have two builtins : * __builtin_cpu_is (CPUNAME) * __builtin_cpu_supports (FEATURE) apart from the cpu init builtin, __builtin_cpu_init. List of CPU names : * amd * intel * atom * core2 * corei7 * nehalem * westmere * sandybridge * amdfam10h * barcelona * shanghai * istanbul * bdver1 * bdver2 List of CPU features : * cmov * mmx * popcnt * sse * sse2 * sse3 * ssse3 * sse4.1 * sse4.2 As an example, to check if CPU is corei7, call __builtin_cpu_is (corei7) Comments? Thanks. On Mon, Mar 12, 2012 at 4:16 AM, Richard Guenther richard.guent...@gmail.com wrote: On Thu, Mar 8, 2012 at 9:35 PM, Xinliang David Li davi...@google.com wrote: On Wed, Mar 7, 2012 at 5:51 AM, Richard Guenther richard.guent...@gmail.com wrote: On Wed, Mar 7, 2012 at 1:49 AM, Sriraman Tallam tmsri...@google.com wrote: Patch for CPU detection at run-time. === Patch for CPU detection at run-time, to be used in dispatching of multi-versioned functions. Please see this discussion: http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01355.html when this patch for reviewed the last time. For more detailed description: http://gcc.gnu.org/ml/gcc/2012-03/msg00074.html One of the main concerns was about making CPU detection initialization a constructor. The main point raised was about constructor ordering. I have added a priority value to the CPU detection constructor to make it very high priority so that it is guaranteed to fire before every constructor without an explicitly marked priority value of 101. However, IFUNC initializers will still fire before this constructor, so the cpu initialization routine has to be explicitly called in such initializers for which I have added a builtin: __builtin_cpu_init (). This patch adds the following new builtins: * __builtin_cpu_init * __builtin_cpu_supports_cmov * __builtin_cpu_supports_mmx * __builtin_cpu_supports_popcount * __builtin_cpu_supports_sse * __builtin_cpu_supports_sse2 * __builtin_cpu_supports_sse3 * __builtin_cpu_supports_ssse3 * __builtin_cpu_supports_sse4_1 * __builtin_cpu_supports_sse4_2 * __builtin_cpu_is_amd * __builtin_cpu_is_intel_atom * __builtin_cpu_is_intel_core2 * __builtin_cpu_is_intel * __builtin_cpu_is_intel_corei7 * __builtin_cpu_is_intel_corei7_nehalem * __builtin_cpu_is_intel_corei7_westmere * __builtin_cpu_is_intel_corei7_sandybridge * __builtin_cpu_is_amdfam10 * __builtin_cpu_is_amdfam10_barcelona * __builtin_cpu_is_amdfam10_shanghai * __builtin_cpu_is_amdfam10_istanbul * __builtin_cpu_is_amdfam15_bdver1 * __builtin_cpu_is_amdfam15_bdver2 I think the non-feature detection functions are not necessary at all. They are useful if compiler needs to do auto versioning based on cpu model. Builtin functions are not exactly cheap, nor is the scheme you invent backward/forward compatible. Instead, why not add a single builtin function, __builtin_cpu_supports(const char *), and decode from a comma-separated list of features? Unknown features are simply not present. So I can write code with only a single configure check, This is a good idea. __builtin_is_cpu (const char* ); __builtin_cpu_supports (char char*); That looks good to me. Richard. thanks, David for __builtin_cpu_supports, and cater for future features or older compilers. And of course that builtin would be even cross-platform. Implementation-wise I'll leave this to x86 maintainers to comment on. Richard. * config/i386/i386.c (build_struct_with_one_bit_fields): New function. (make_var_decl): New function. (get_field_from_struct): New function. (fold_builtin_target): New function. (ix86_fold_builtin): New function. (ix86_expand_builtin): Expand new builtins by folding them. (make_platform_builtin): New functions. (ix86_init_platform_type_builtins): Make the new builtins. (ix86_init_builtins): Make new builtins to detect CPU type. (TARGET_FOLD_BUILTIN): New macro. (IX86_BUILTIN_CPU_SUPPORTS_CMOV): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_MMX): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_POPCOUNT): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_SSE): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_SSE2): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_SSE3): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_SSSE3): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_SSE4_1): New enum value. (IX86_BUILTIN_CPU_SUPPORTS_SSE4_2): New enum value. (IX86_BUILTIN_CPU_INIT): New enum value. (IX86_BUILTIN_CPU_IS_AMD): New enum value. (IX86_BUILTIN_CPU_IS_INTEL): New enum value. (IX86_BUILTIN_CPU_IS_INTEL_ATOM): New enum value. (IX86_BUILTIN_CPU_IS_INTEL_CORE2): New enum value. (IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM): New enum value.
Re: [PATCH] PR c++/52672
On 03/26/2012 09:14 AM, Meador Inge wrote: Hi All, This patch fixes an ICE that occurs when attempting to fold nested INDIRECT_REF trees that have conversions in between the indirect references. For example: constexpr unsigned long b = *((ul_ptr)(*((ul_ptr)0x0))); What happens is that 'cxx_fold_indirect_ref' gets the top indirect reference, strips out all the conversions ending up with the nested indirect reference, and then asserts that the type is a pointer type, which (obviously) it isn't. This patch fixes the problem by exiting the fold for non-pointer sub-trees instead of doing the assert. 'fold_indirect_ref_1' already does things this way. Tested on x86_64 GNU/Linux. OK? Also, This fixes the problem on trunk, but I have reproduced the issue back to the 4.6 branch as well. On the 4.6 branch I think it is OK to just remove the 'gcc_assert (POINTER_TYPE_P (subtype))' assert. I tested this and saw no regressions. P.S. If it is OK can some please commit for me? I don't have write access. Hi Jason, I saw where the fix for this got committed in r185890. Thanks for applying it for me. What about the release branches? I can reproduce the ICE in 4.6 and 4.7. The patch from trunk applies to 4.7. For 4.6 I think we can just drop the assert. -- Meador Inge CodeSourcery / Mentor Embedded http://www.mentor.com/embedded-software
Re: PATCH: Add OPTION_MASK_ISA_X86_64 and support TARGET_BI_ARCH == 2
On Wed, Mar 28, 2012 at 03:40:28PM -0700, H.J. Lu wrote: On Wed, Mar 28, 2012 at 3:07 PM, Joseph S. Myers jos...@codesourcery.com wrote: On Wed, 28 Mar 2012, H.J. Lu wrote: Here is the updated patch. I will wait for OK from Joseph. I have no comments on this patch. Given that my patch doesn't change any command line options, I am checking it in. Please let me know if there are any issues. Thanks. -- H.J. H.J., This patch caused PR52784 where the multilib bootstrap on i386-apple-darwin10 is broken. The multilib bootstrap for x86_64-apple-darwin10 is uneffected. Reverting r185937 eliminates the bootstrap failure on i386-apple-darwin10. Jack
libitm MinGW detect
Hello. -- Regards, niXman libitm-mingw-detect.diff Description: Binary data
[PATCH] SH: Fix m2a-single-only compilation error
Hi, Please find attached the patch crt1.patch which fixes compilation issue with sh2a-single-only target. Currently, compilation generates the following error:- merge of architecture 'sh3e' with architecture 'sh2a' produced unknown architecture The patch fixes the issue. Tested with sh2a-elf. No new regressions. ChangeLog 2012-03-30 Naveen H.S navee...@kpitcummins.com * libgcc/config/sh/crt1.S (VBR_SETUP): Don't define for SH2E targets Thanks Regards, Naveen crt1.patch Description: crt1.patch
Go patch committed: Fix order of evaluation of struct literals
This patch to the Go compiler fixes the order of evaluation of struct composite literals. Previously the compiler assumed that all fields in the struct were set in order. However, the composite literal might be written differently. If the composite literal had function calls, Go specifies that they are evaluated in the order in which they are written. This patch ensures that this is the case. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 07f8da93f9f4 go/expressions.cc --- a/go/expressions.cc Wed Mar 28 20:51:50 2012 -0700 +++ b/go/expressions.cc Thu Mar 29 21:54:38 2012 -0700 @@ -10967,9 +10967,15 @@ Struct_construction_expression(Type* type, Expression_list* vals, Location location) : Expression(EXPRESSION_STRUCT_CONSTRUCTION, location), - type_(type), vals_(vals) + type_(type), vals_(vals), traverse_order_(NULL) { } + // Set the traversal order, used to ensure that we implement the + // order of evaluation rules. Takes ownership of the argument. + void + set_traverse_order(std::vectorint* traverse_order) + { this-traverse_order_ = traverse_order; } + // Return whether this is a constant initializer. bool is_constant_struct() const; @@ -10991,8 +10997,12 @@ Expression* do_copy() { -return new Struct_construction_expression(this-type_, this-vals_-copy(), - this-location()); +Struct_construction_expression* ret = + new Struct_construction_expression(this-type_, this-vals_-copy(), + this-location()); +if (this-traverse_order_ != NULL) + ret-set_traverse_order(this-traverse_order_); +return ret; } tree @@ -11010,6 +11020,9 @@ // The list of values, in order of the fields in the struct. A NULL // entry means that the field should be zero-initialized. Expression_list* vals_; + // If not NULL, the order in which to traverse vals_. This is used + // so that we implement the order of evaluation rules correctly. + std::vectorint* traverse_order_; }; // Traversal. @@ -11017,9 +11030,26 @@ int Struct_construction_expression::do_traverse(Traverse* traverse) { - if (this-vals_ != NULL - this-vals_-traverse(traverse) == TRAVERSE_EXIT) -return TRAVERSE_EXIT; + if (this-vals_ != NULL) +{ + if (this-traverse_order_ == NULL) + { + if (this-vals_-traverse(traverse) == TRAVERSE_EXIT) + return TRAVERSE_EXIT; + } + else + { + for (std::vectorint::const_iterator p = + this-traverse_order_-begin(); + p != this-traverse_order_-end(); + ++p) + { + if (Expression::traverse(this-vals_-at(*p), traverse) + == TRAVERSE_EXIT) + return TRAVERSE_EXIT; + } + } +} if (Type::traverse(this-type_, traverse) == TRAVERSE_EXIT) return TRAVERSE_EXIT; return TRAVERSE_CONTINUE; @@ -12198,6 +12228,7 @@ size_t field_count = st-field_count(); std::vectorExpression* vals(field_count); + std::vectorint* traverse_order = new(std::vectorint); Expression_list::const_iterator p = this-vals_-begin(); while (p != this-vals_-end()) { @@ -12350,6 +12381,7 @@ type-named_type()-message_name().c_str()); vals[index] = val; + traverse_order-push_back(index); } Expression_list* list = new Expression_list; @@ -12357,7 +12389,10 @@ for (size_t i = 0; i field_count; ++i) list-push_back(vals[i]); - return new Struct_construction_expression(type, list, location); + Struct_construction_expression* ret = +new Struct_construction_expression(type, list, location); + ret-set_traverse_order(traverse_order); + return ret; } // Lower an array composite literal. diff -r 07f8da93f9f4 go/expressions.h --- a/go/expressions.h Wed Mar 28 20:51:50 2012 -0700 +++ b/go/expressions.h Thu Mar 29 21:54:38 2012 -0700 @@ -842,6 +842,11 @@ bool contains_error() const; + // Retrieve an element by index. + Expression* + at(size_t i) + { return this-entries_.at(i); } + // Return the first and last elements. Expression* front()