Re: [Patch,avr]: ad PR54222: Add saturated multiply
2013/2/11 Georg-Johann Lay a...@gjlay.de: This patch adds optimized support for (short) (un)signed _Sat _Accum multiplication (HA, UHA, SA, USA). The 32-bit multiply uses 64 = 32 * 32 widening multiplication. As a spin-off, the widening mul is available as [u]mulsidi3 default pattern. Okay for trunk? Johann gcc/ PR target/54222 * config/avr/avr-dimode.md (umulsidi3, mulsidi3): New expanders. (umulsidi3_insn, mulsidi3_insn): New insns. libgcc/ PR target/54222 * config/avr/t-avr (LIB2FUNCS_EXCLUDE): Add: _usmulUHA, _usmulUSA, _ssmulHA, _ssmulSA. (LIB1ASMFUNCS): Add: _muldi3_6, _mulsidi3, _umulsidi3, _usmuluha3, _ssmulha3, _usmulusa3, _ssmulsa3. * config/avr/lib1funcs.S (__muldi3_6): Break out of __muldi3. (__muldi3): XCALL __muldi3_6 instead of rcall. (__umulsidi3, __mulsidi3): New functions. (do_prologue_saves, do_epilogue_restores): New .macros. (__divdi3_moddi3): Use them. * config/avr/lib1funcs-fixed.S (__usmuluha3, __ssmulha3) (__usmulusa3, __ssmulsa3): New functions. Approved. Denis.
Re: [patch, Fortran] Fix PR 56224
Thomas Koenig wrote: Am 09.02.2013 11:22, schrieb Tobias Burnus: Why did you put a FIXME there? What's wrong with adding the directory here? I think module files are different enough from include files that I would like to have them in different directories. I think they are similar enough to be in one directory - especially as include files are very unlikely to ever end in .mod and, thus, they can happily live alongside each other. Hence, I wouldn't put a FIXME there. This version of the patch should fix that particular issue, and also has no test cases. Regression-tested. OK? OK. Thanks for the patch after fixing the nit below. 2013-02-09 Thomas Koenig tkoe...@gcc.gnu.org PR fortran/56224 * gfortran.h (gfc_add_include_path): Add boolean argument for warn. * scanner.c (gfc_add_include_path): Pass along warn argument to add_path_to_list. * options.c (gfc_post_options): Add true warn argument to gfc_add_include_path. (gfc_handle_module_path_options): Likewise. (gfc_handle_option): Also gfc_add_include_path for intrinsic modules, without warning. -gfc_add_include_path (const char *path, bool use_for_modules, bool file_dir) +gfc_add_include_path (const char *path, bool use_for_modules, bool file_dir, bool warn) That line is too long. Tobias
Re: [Patch, Fortran, OOP] PR 46952: [OOP] Spurious recursive call error with type bound procedure
Janus Weil wrote: here is a simple patch for a rejects-valid problem with deferred type-bound procedures. This is the patch from comment 5 in the PR. A simpler (but equivalent) patch can be found in comment 4. Both fix the problem and are free of testsuite regressions. Is any of the two versions still ok for 4.8? Or should it wait for 4.9? The patch looks fine and simple enough for 4.8. Thanks, Tobias 2013-01-18 Janus Weil ja...@gcc.gnu.org PR fortran/46952 * resolve.c (resolve_call): Do not check deferred procedures for recursiveness. 2013-01-18 Janus Weil ja...@gcc.gnu.org PR fortran/46952 * gfortran.dg/typebound_deferred_1.f90: New.
[PATCH] Fix PR56288
This fixes a oversight when introducing anonymous SSA names. I managed to change a checking piece to a noop. Oops. I took the opportunity to move the freelist check earlier, as the type check would trigger for freed SSA names as well. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2013-02-12 Richard Biener rguent...@suse.de PR middle-end/56288 * tree-ssa.c (verify_ssa_name): Fix check, move SSA_NAME_IN_FREE_LIST check up. Index: gcc/tree-ssa.c === --- gcc/tree-ssa.c (revision 195941) +++ gcc/tree-ssa.c (working copy) @@ -626,16 +626,16 @@ verify_ssa_name (tree ssa_name, bool is_ return true; } - if (SSA_NAME_VAR (ssa_name) != NULL_TREE - TREE_TYPE (ssa_name) != TREE_TYPE (ssa_name)) + if (SSA_NAME_IN_FREE_LIST (ssa_name)) { - error (type mismatch between an SSA_NAME and its symbol); + error (found an SSA_NAME that had been released into the free pool); return true; } - if (SSA_NAME_IN_FREE_LIST (ssa_name)) + if (SSA_NAME_VAR (ssa_name) != NULL_TREE + TREE_TYPE (ssa_name) != TREE_TYPE (SSA_NAME_VAR (ssa_name))) { - error (found an SSA_NAME that had been released into the free pool); + error (type mismatch between an SSA_NAME and its symbol); return true; }
Re: [GCC 4.8 changes] PATCH: Mention -maddress-mode=[short|long]
On Mon, Feb 11, 2013 at 7:05 PM, H.J. Lu hongjiu...@intel.com wrote: Hi, This patch updates GCC 4.8 changes.html to mention -maddress-mode=[short|long] for x32. OK to install? H.J. --- Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.95 diff -u -p -r1.95 changes.html --- changes.html11 Feb 2013 15:12:58 - 1.95 +++ changes.html11 Feb 2013 18:03:31 - @@ -460,6 +460,10 @@ B b(42); // OK wrong results. You must build all modules with code-mpreferred-stack-boundary=3/code, including any libraries. This includes the system libraries and startup modules./li +liNew code-maddress-mode=[short|long]/code option for x32. +code-maddress-mode=short/code overrides default 64-bit addresses to +32-bit by emitting 0x67 size prefix. This is the default address mode for Use code0x67/code, otherwise ok. Thanks, Richard. +x32./li li New built-in functions to detect run-time CPU type and ISA: ul liA built-in function code__builtin_cpu_is/code has been added to
Re: [PATCH] Cilk Plus merging to trunk (3 of n)
On Mon, Feb 11, 2013 at 7:12 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, Attached, please find a patch that implements Array Notations for C++. This patch affects the C++ compiler and should build (or be applied) on top of the Array Notation for C patch (2 of n: http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01213.html). To my best knowledge, I have implemented all the applicable comments that GCC reviewers have made about my previous patches into this. Please let me know if it is Ok for trunk. Note that these patches have to wait until stage1 for GCC 4.9 opens independent on whether they are approved. Thanks, Richard. Here are the ChangeLog Entries: gcc/cp/Changelog 2013-02-11 Balaji V. Iyer balaji.v.i...@intel.com * typeck.c (cp_build_array_ref): Added a check if array notation used as index for an array has a rank greater than 1. If so, then emit an error. (cp_build_binary_op): Find the correct type when array notation expr. is used in op0 and op1. (cp_build_addr_expr_1): Check if array notation is used and if so then handle the arg and var like you handle an array. (convert_for_assignment): If array notation is used, then just return the rhs. * semantics.c (finish_return_stmt): Added a check for array notations in return statement. If so, then issue an error. (cxx_eval_constant_expression): Added a ARRAY_NOTATION_REF case. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. * pt.c (tsubst_copy_and_build): Likewise. (type_unification_real): Return 1 when array notation is used and cilk plus is enabled. (instantiate_decl): Check if array notation is used in (sub)tree when Cilk plus is enabled. If so, then expand them. * parser.c (cp_parser_nested_name_specifier_opt): Added a check if cilk plus is enabled. If so, then we don't issue the error. (cp_parser_postfix_open_square_expression): Added checks for colon(s) after square braces when cilkplus is enabled. if so, then do the array notation parsing. (cp_parser_compound_statement): Added a check to see if array notations are used in the (sub)tree. if so, then call function to expand them. (cp_parser_ctor_initializer_opt_and_function_body): Likewise. (cp_parser_function_definition_after_declarator): Likewise. (cp_parser_selection_statement): Added a check if array notation is used in a switch statement. If so, then issue an error. (cp_parser_iteration_statement): Likewise for while and do-while and for statements. (cp_parser_direct_declarator): Added a check for intialization near an array notation. If so, then issue an error. * cp-tree.h (build_x_array_notation_expr): New function declaration. (contains_array_notation_expr): Likewise. (fix_array_notation_exprs): Likewise. (is_builtin_array_notation_fn): Likewise. (find_correct_array_notation_type): Likewise. (cp_parser_array_notation): New function. * cp-objcp-common.c (cp_common_init_ts): Marked ARRAY_NOTATION_REF as typed. * call.c (convert_like_real): Added a check for array notations when cilkplus is enabled. (build_over_call): Added a check if the function call is a builtin array notation function. If so, then no type conversion is necessary. * cp-array-notation.c: New file. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Added cp/cp-array-notation.o gcc/testsuite/Changelog 2013-02-11 Balaji V. Iyer balaji.v.i...@intel.com * g++.dg/cilk-plus/array_notation/compile/array_test1.cc: New test. * g++.dg/cilk-plus/array_notation/compile/array_test2.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/builtin_fn_double.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/builtin_funcs.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/gather_scatter.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/if_test1.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/if_test2.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/postdecr_test.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/postincr_test.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/preincr_test.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/predecr_test.cc: Likewise. * g++.dg/cilk-plus/array_notation/compile/sec_implicit_ex.cc: Likewise. * g++.dg/cilk-plus/array_notation/errors/decl-ptr-colon.cc: Likewise. * g++.dg/cilk-plus/array_notation/errors/fn_ptr.cc: Likewise. * g++.dg/cilk-plus/array_notation/errors/fp_triplet_values.cc: Likewise.
Re: RFA: v3 PATCH to add on_quick_exit/quick_exit to std
The test fails on x86_64-apple-darwin10 with FAIL: 18_support/quick_exit/quick_exit.cc (test for excess errors) Excess errors: /opt/gcc/work/libstdc++-v3/testsuite/18_support/quick_exit/quick_exit.cc:36:3: error: 'at_quick_exit' is not a member of 'std' /opt/gcc/work/libstdc++-v3/testsuite/18_support/quick_exit/quick_exit.cc:38:3: error: 'quick_exit' is not a member of 'std' UNRESOLVED: 18_support/quick_exit/quick_exit.cc compilation failed to produce executable TIA Dominique
Re: RFA: v3 PATCH to add on_quick_exit/quick_exit to std
On 02/12/2013 12:26 PM, domi...@lps.ens.fr wrote: The test fails on x86_64-apple-darwin10 with FAIL: 18_support/quick_exit/quick_exit.cc (test for excess errors) Excess errors: /opt/gcc/work/libstdc++-v3/testsuite/18_support/quick_exit/quick_exit.cc:36:3: error: 'at_quick_exit' is not a member of 'std' /opt/gcc/work/libstdc++-v3/testsuite/18_support/quick_exit/quick_exit.cc:38:3: error: 'quick_exit' is not a member of 'std' UNRESOLVED: 18_support/quick_exit/quick_exit.cc compilation failed to produce executable Looks like the configure test isn't strict enough and ends up defining the macros when the darwin libc actually doesn't provide the functions. Jason may want to review it... Paolo.
Re: RFA: v3 PATCH to add on_quick_exit/quick_exit to std
On 02/12/2013 12:32 PM, Paolo Carlini wrote: On 02/12/2013 12:26 PM, domi...@lps.ens.fr wrote: The test fails on x86_64-apple-darwin10 with FAIL: 18_support/quick_exit/quick_exit.cc (test for excess errors) Excess errors: /opt/gcc/work/libstdc++-v3/testsuite/18_support/quick_exit/quick_exit.cc:36:3: error: 'at_quick_exit' is not a member of 'std' /opt/gcc/work/libstdc++-v3/testsuite/18_support/quick_exit/quick_exit.cc:38:3: error: 'quick_exit' is not a member of 'std' UNRESOLVED: 18_support/quick_exit/quick_exit.cc compilation failed to produce executable Looks like the configure test isn't strict enough and ends up defining the macros when the darwin libc actually doesn't provide the functions. Jason may want to review it... An alternate explanation would be that darwin provides the functions but uses c_std instead of c_global. I can add back the functions to c_std/cstdlib too, but that seems wrong, because, as I said, normally we don't provide C++11 facilities in c_std. Paolo.
Re: RFA: v3 PATCH to add on_quick_exit/quick_exit to std
IIRC I have already asked a similar question about atan2, erf, ... which don't appear in the std namespace on darwin. Dominique
Re: RFA: v3 PATCH to add on_quick_exit/quick_exit to std
On 02/12/2013 12:40 PM, domi...@lps.ens.fr wrote: IIRC I have already asked a similar question about atan2, erf, ... which don't appear in the std namespace on darwin. You should check whether darwin by chance uses by default c_std instead of c_global. The former doesn't provide C++11 facilities. If, on the other hand, it uses c_global, it means _GLIBCXX_USE_C99_MATH_TR1 is undefined because a configure test fails on that specific darwin release you are using. But the last time I checked, modern darwin defined _GLIBCXX_USE_C99_MATH_TR1, no problems. Anyway, about the cstdlib issue the below makes available the new functions in c_std/cstdlib too, and I'm going to commit it, it's close to what Jason originally committed. But, as I said already we don't normally provide C++11 functions in c_std, Benjamin may want to review what we are doing in c_std vs c_global, he designed the split. Paolo. // Index: include/c_std/cstdlib === --- include/c_std/cstdlib (revision 195968) +++ include/c_std/cstdlib (working copy) @@ -57,6 +57,14 @@ extern C void abort(void) throw () _GLIBCXX_NORETURN; extern C int atexit(void (*)()) throw (); extern C void exit(int) throw () _GLIBCXX_NORETURN; +#if __cplusplus = 201103L +# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT + extern C int at_quick_exit(void (*)()) throw (); +# endif +# ifdef _GLIBCXX_HAVE_QUICK_EXIT + extern C void quick_exit(int) throw() _GLIBCXX_NORETURN; +# endif +#endif } // namespace #else @@ -67,6 +75,11 @@ #undef abort #undef abs #undef atexit +#if __cplusplus = 201103L +# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT +# undef at_quick_exit +# endif +#endif #undef atof #undef atoi #undef atol @@ -83,6 +96,11 @@ #undef mbstowcs #undef mbtowc #undef qsort +#if __cplusplus = 201103L +# ifdef _GLIBCXX_HAVE_QUICK_EXIT +# undef quick_exit +# endif +#endif #undef rand #undef realloc #undef srand @@ -103,6 +121,11 @@ using ::abort; using ::abs; using ::atexit; +#if __cplusplus = 201103L +# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT + using ::at_quick_exit; +# endif +#endif using ::atof; using ::atoi; using ::atol; @@ -121,6 +144,11 @@ using ::mbtowc; #endif // _GLIBCXX_HAVE_MBSTATE_T using ::qsort; +#if __cplusplus = 201103L +# ifdef _GLIBCXX_HAVE_QUICK_EXIT + using ::quick_exit; +# endif +#endif using ::rand; using ::realloc; using ::srand;
Re: [Patch, Fortran, OOP] PR 46952: [OOP] Spurious recursive call error with type bound procedure
here is a simple patch for a rejects-valid problem with deferred type-bound procedures. This is the patch from comment 5 in the PR. A simpler (but equivalent) patch can be found in comment 4. Both fix the problem and are free of testsuite regressions. Is any of the two versions still ok for 4.8? Or should it wait for 4.9? The patch looks fine and simple enough for 4.8. Thanks, Tobias. Committed as r195975. Cheers, Janus 2013-01-18 Janus Weil ja...@gcc.gnu.org PR fortran/46952 * resolve.c (resolve_call): Do not check deferred procedures for recursiveness. 2013-01-18 Janus Weil ja...@gcc.gnu.org PR fortran/46952 * gfortran.dg/typebound_deferred_1.f90: New.
[patch] [libffi] do not install libffi library, headers and documentation
The libffi library, headers and documentation are still installed, although libffi provides separate releases for a long time. So do not install these anymore as part of a GCC install. Tested with a build and an install with go and java enabled (both using libffi_convenience). Ok for the trunk? Matthias 2013-02-12 Matthias Klose d...@ubuntu.com * Makefile.am: Do not install texinfo documentation and the libffi library. * include/Makefile.am: Do not install header files. * man/Makefile.am: Do not install man pages. * Makefile.in, include/Makefile.in, man/Makefile.in: Regenerate. Index: Makefile.am === --- Makefile.am (Revision 195973) +++ Makefile.am (Arbeitskopie) @@ -49,7 +49,7 @@ # Defines info, dvi, pdf and html targets MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include -info_TEXINFOS = doc/libffi.texi +noinst_info_TEXINFOS = doc/libffi.texi # AM_CONDITIONAL on configure option --generated-files-in-srcdir if GENINSRC @@ -130,8 +130,7 @@ MAKEOVERRIDES= -toolexeclib_LTLIBRARIES = libffi.la -noinst_LTLIBRARIES = libffi_convenience.la +noinst_LTLIBRARIES = libffi.la libffi_convenience.la libffi_la_SOURCES = src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c Index: include/Makefile.am === --- include/Makefile.am (Revision 195973) +++ include/Makefile.am (Arbeitskopie) @@ -9,4 +9,4 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) toollibffidir := $(libdir)/gcc/$(target_alias)/$(gcc_version)/include -toollibffi_HEADERS = ffi.h ffitarget.h +noinst_HEADERS = ffi.h ffitarget.h Index: man/Makefile.am === --- man/Makefile.am (Revision 195973) +++ man/Makefile.am (Arbeitskopie) @@ -4,5 +4,5 @@ EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 -man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 +noinst_man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
[PATCH] PR55033: Test case
Test results with this patch: http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01351.html 2013-02-12 Sebastian Huber sebastian.hu...@embedded-brains.de PR target/55033 * gcc.target/powerpc/pr55033.c: New. --- gcc/testsuite/gcc.target/powerpc/pr55033.c | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr55033.c diff --git a/gcc/testsuite/gcc.target/powerpc/pr55033.c b/gcc/testsuite/gcc.target/powerpc/pr55033.c new file mode 100644 index 000..cd8abcb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr55033.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_eabi_ok } */ +/* { dg-options -mcpu=8540 -msoft-float -msdata=eabi -G 8 -fno-common } */ + +void f(void); + +struct s { + int *p; + int *q; +}; + +extern int a; + +extern const struct s c; + +const struct s c = { a, 0 }; + +void f(void) +{ + char buf[4] = { 0, 1, 2, 3 }; +} -- 1.7.7
Re: [patch] [libffi] do not install libffi library, headers and documentation
On Tue, Feb 12, 2013 at 1:30 PM, Matthias Klose d...@ubuntu.com wrote: The libffi library, headers and documentation are still installed, although libffi provides separate releases for a long time. So do not install these anymore as part of a GCC install. Tested with a build and an install with go and java enabled (both using libffi_convenience). Ok for the trunk? openSUSE is using the GCC provided libffi, so no, this is not ok (not at this stage anyway). Also proper not-installing libffi would work by disabling the maybe-install-target-libffi at the toplevel, not changing libffi makfiles (which are supposed to be imported from upstream, no?) Richard. Matthias
Re: [patch] [libffi] do not install libffi library, headers and documentation
On Tue, Feb 12, 2013 at 1:44 PM, Richard Biener richard.guent...@gmail.com wrote: On Tue, Feb 12, 2013 at 1:30 PM, Matthias Klose d...@ubuntu.com wrote: The libffi library, headers and documentation are still installed, although libffi provides separate releases for a long time. So do not install these anymore as part of a GCC install. Tested with a build and an install with go and java enabled (both using libffi_convenience). Ok for the trunk? openSUSE is using the GCC provided libffi, so no, this is not ok (not at this stage anyway). Also proper not-installing libffi would work by disabling the maybe-install-target-libffi at the toplevel, not changing libffi makfiles (which are supposed to be imported from upstream, no?) Thus, add no_install= true; to the libffi target module Richard. Matthias
Re: RFA: v3 PATCH to add on_quick_exit/quick_exit to std
But the last time I checked, modern darwin defined _GLIBCXX_USE_C99_MATH_TR1, no problems. AFAICT this is true, but I think darwin10 was released in 2011 so I doubt it has any support for c++11. Anyway, about the cstdlib issue the below makes available the new functions in c_std/cstdlib too, and I'm going to commit it, it's close to what Jason originally committed. ... It works, thanks, Dominique PS any chance to use this machinery for other missing items: hypot, erf, ..., i.e., the c++11 additions?
Re: RFA: v3 PATCH to add on_quick_exit/quick_exit to std
On 02/12/2013 01:47 PM, domi...@lps.ens.fr wrote: But the last time I checked, modern darwin defined _GLIBCXX_USE_C99_MATH_TR1, no problems. AFAICT this is true, but I think darwin10 was released in 2011 so I doubt it has any support for c++11. Anyway, about the cstdlib issue the below makes available the new functions in c_std/cstdlib too, and I'm going to commit it, it's close to what Jason originally committed. ... It works, thanks, Good, thus looks like you are using c_std on your machine?!? Because I just tried, and on a Darwin 12.2.0 machine the build uses c_global by default and everything was fine even before my last patchlet (_GLIBCXX_USE_C99_MATH_TR1 defined of course). I think current Darwin is already fine, in general, in these areas. Again, the current status is in a sense good because when the _GLIBCXX_HAVE_AT_QUICK_EXIT and _GLIBCXX_HAVE_QUICK_EXIT are defined, thus the system has the functions in its c library, including cstdlib makes available the functions in namespace std irrespective of the configury. But then why having c_std in the first place? I'll leave this to Benjamin... Paolo.
Re: libsanitizer merge from upstream r173241
Hey, seems like that last of the scanf changes are in. We're intercepting __isoc99_*scanf irrespective of the glibc version, because (a) it does not hurt (and with the static runtime, even interceptor itself is thrown out by the linker), and (b) user program and tool's runtime can be built with different libc versions. Thanks for the help with scanf testing, we've got much more confidence in our implementation now. On Mon, Feb 11, 2013 at 5:55 PM, Jack Howarth howa...@bromo.med.uc.edu wrote: On Mon, Feb 11, 2013 at 12:38:00PM +0100, Jakub Jelinek wrote: On Wed, Jan 23, 2013 at 04:24:01PM +0400, Evgeniy Stepanov wrote: What if glibc adds a scanf hook (like it has already printf hooks), apps could then register their own stuff and the above would then break. It really should be very conservative, and should be checked e.g. with all glibc's *scanf tests (e.g. stdio-common/scanf[0-9]*.c, stdio-common/tst-sscanf.c). I'll add support for the missing %specs. About the testing, these files seem like GPL, so I'd prefer not to look at them at all. We've got a smallish test for the scanf implementation in sanitizer_common, but it would be really great to run it on full glibc scanf tests. Would you be willing to setup such testing gnu-side? Seems the code in llvm repo looks much better now to me than it used to, still it breaks on: Jakub, So there is likely to be at least one more remerge in libsanitizer for the gcc 4.8 release? I saw that Richard felt that PR56128 justified one. FYI, I'm interested because it would get us the new allocator support on darwin. Jack #define _GNU_SOURCE 1 #include stdio.h #include string.h int main () { char *p; long double q; if (sscanf (abcdefghijklmno 1.0, %ms %Lf, p, q) != 2 || strcmp (p, abcdefghijklmno) != 0 || q != 1.0L) return 1; return 0; } because it mishandles %ms. Attached patch fixes that and also handles %a when possible. There are cases where it is unambiguous, e.g. s%Las is s %La s, reading long double, or %ar is %a r, reading float, other cases where we can check at least something and keep checking the rest of the format string, e.g. for: %as we know it will either store float, or char * pointer, so just assume conservatively the smaller size, and other cases where we have to punt, %a[a%d] (where % appears in the [...] list). I've tested various glibc *scanf testcases with the GCC libsanitizer + enabling of # define SANITIZER_INTERCEPT_SCANF SI_NOT_WINDOWS + llvm svn diff between last merge point to GCC and current llvm trunk + this patch, and it looked good. There is one further issue, I'd say you need to pass down to scanf_common the result from the intercepted call, and use it to see if it is valid to call strlen on the ptr, or if just 1 should be assumed for SSS_STRLEN. Note 'n' doesn't count towards that. Because, it is unsafe to call strlen on arguments that haven't been assigned yet. Testcase that still fails: #define _GNU_SOURCE 1 #include stdio.h #include string.h int main () { int a, b, c, d; char e[3], f[10]; memset (e, ' ', sizeof e); memset (f, ' ', sizeof f); if (sscanf (1 2 a, %d%n%n%d %s %s, a, b, c, d, e, f) != 3 || a != 1 || b != 1 || c != 1 || d != 2 || strcmp (e, a) != 0) return 1; return 0; } Oh, one more thing, on Linux for recent enough glibc's it would be desirable to also intercept: __isoc99_sscanf, __isoc99_scanf, __isoc99_vsscanf, __isoc99_fscanf, __isoc99_vfscanf, __isoc99_vscanf functions (guard the interception with #if defined __GLIBC_PREREQ __GLIBC_PREREQ (2, 7) ). All these work exactly like the corresponding non-__isoc99_ functions, just %a followed by s, S or [ always writes float, thus there is no ambiguity. Jakub --- sanitizer_common_interceptors_scanf.inc.jj2013-02-08 13:21:51.0 +0100 +++ sanitizer_common_interceptors_scanf.inc 2013-02-11 12:15:27.575871424 +0100 @@ -18,11 +18,12 @@ struct ScanfDirective { int argIdx; // argument index, or -1 of not specified (%n$) - bool suppressed; // suppress assignment (*) int fieldWidth; + bool suppressed; // suppress assignment (*) bool allocate; // allocate space (m) char lengthModifier[2]; char convSpecifier; + bool maybeGnuMalloc; }; static const char *parse_number(const char *p, int *out) { @@ -119,6 +120,31 @@ static const char *scanf_parse_next(cons // Consume the closing ']'. ++p; } +// This is unfortunately ambiguous between old GNU extension +// of %as, %aS and %a[...] and newer POSIX %a followed by +// letters s, S or [. +if (dir-convSpecifier == 'a' !dir-lengthModifier[0]) { + if (*p == 's' || *p == 'S') { + dir-maybeGnuMalloc = true; + ++p; + } else if (*p == '[') { + // Watch for %a[h-j%d], if % appears in the + //
Re: [PATCH][ARM] Implement vectorizer cost hooks
On 11/02/13 15:43, Christophe Lyon wrote: Richard, Thanks for your comments. Here a new version with the changes you suggested. Thanks for turning this around quickly. This is fine. Ramana and I have discussed this and we're agreed that we'd like this to go into 4.8. However, if any problems do crop up we'll back it out again and wait for stage1 to re-open. Please can you commit it ASAP so that we can make sure it gets a reasonable amount of testing. R. Christophe On 11 February 2013 11:57, Richard Earnshaw rearn...@arm.com wrote: On 05/02/13 18:18, Christophe Lyon wrote: Hi, Following the discussion about disable peeling [1] a few weeks ago, it turned out that the vectorizer cost model needed some implementation for ARM. The attached patch implements arm_builtin_vectorization_cost and arm_add_stmt_cost, providing default costs when aligned and unaligned loads/stores have the same cost (=1). init_cost and finish_cost still use the default implementation (I noticed that x86 has chosen to duplicate the default implementation without changing it, why?) Benchmarking shows very little variation, expect a noticeable +1.6% on coremark. If this is OK, we can then discuss how to disable peeling completely when aligned and unaligned accesses have the same cost (and thus where peeling is a loss of performance). I think adding a new hook is necessary, since target descriptions may use different models for these costs (eg x86 makes no difference between unaligned loads and unaligned stores). Thanks, Christophe. [1] http://gcc.gnu.org/ml/gcc/2012-12/msg00036.html 2013-02-05 Christophe Lyon christophe.l...@linaro.org * config/arm/arm.c (arm_builtin_vectorization_cost) (arm_add_stmt_cost): New functions. (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST) (TARGET_VECTORIZE_ADD_STMT_COST): Define. (struct processor_costs): New struct type. (default_arm_cost): New struct of type processor_costs.= Christophe, Thanks for the patch. This is mostly OK, but please can you make the following changes. +struct processor_costs { Please name this something like cpu_vec_costs. It's not the only cost table in the back-end. +struct processor_costs default_arm_cost = {/* arm generic costs. */ Similarly, use something like default_arm_vec_cost. +const struct processor_costs *arm_cost = default_arm_cost; And here. But better still, link this through the current_tune table rather than introducing a new global. Finally, @@ -27256,4 +27272,130 @@ arm_validize_comparison (rtx *comparison, rtx * op1, rtx * op2) } +/* Vectorizer cost model implementation. */ Please put the patch in a more suitable location rather than just dumping it at the end of the file. There are already numerous functions related to costs that are mostly grouped together. I suggest this goes near the rtx_costs code. R. = vect-cost-model2.txt diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bfb857d..56fde74 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2013-02-05 Christophe Lyon christophe.l...@linaro.org + + * config/arm/arm-protos.h (struct cpu_vec_costs): New struct type. + (struct tune_params): Add vec_costs field. + * config/arm/arm.c (arm_builtin_vectorization_cost) + (arm_add_stmt_cost): New functions. + (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST) + (TARGET_VECTORIZE_ADD_STMT_COST): Define. + (arm_default_vec_cost): New struct of type cpu_vec_costs. + (arm_slowmul_tune, arm_fastmul_tune, arm_strongarm_tune) + (arm_xscale_tune, arm_9e_tune, arm_v6t2_tune, arm_cortex_tune) + (arm_cortex_a15_tune, arm_cortex_a5_tune, arm_cortex_a9_tune) + (arm_v6m_tune, arm_fa726te_tune): Define new vec_costs field. + 2013-02-04 Alexander Potapenko gli...@google.com Jack Howarth howa...@bromo.med.uc.edu Jakub Jelinek ja...@redhat.com vect-cost-model2.patch N¬n‡r¥ªíÂ)emçhÂyhi×¢w^™©Ý
Re: libsanitizer merge from upstream r173241
On Tue, Feb 12, 2013 at 05:28:53PM +0400, Evgeniy Stepanov wrote: Hey, seems like that last of the scanf changes are in. We're intercepting __isoc99_*scanf irrespective of the glibc version, because (a) it does not hurt (and with the static runtime, even interceptor itself is thrown out by the linker), and (b) user program and tool's runtime can be built with different libc versions. Thanks for the help with scanf testing, we've got much more confidence in our implementation now. Thanks. Perhaps (completely untested) you could still disallow the GNU %as/%aS/%a[ compatibility for __isoc99_*, that way you can acurately verify even #define _XOPEN_SOURCE 700 ... float flt; int i; sscanf (0.1234[x6], %a[x%d], flt, i); --- sanitizer_common/sanitizer_common_interceptors.inc.jj 2013-02-12 14:34:06.0 +0100 +++ sanitizer_common/sanitizer_common_interceptors.inc 2013-02-12 14:40:05.486968072 +0100 @@ -150,7 +150,7 @@ INTERCEPTOR(int, prctl, int option, unsi #include sanitizer_common_interceptors_scanf.inc -#define VSCANF_INTERCEPTOR_IMPL(vname, ...) \ +#define VSCANF_INTERCEPTOR_IMPL(vname, allowGnuMalloc, ...) \ { \ void *ctx; \ COMMON_INTERCEPTOR_ENTER(ctx, vname, __VA_ARGS__); \ @@ -158,29 +158,29 @@ INTERCEPTOR(int, prctl, int option, unsi va_copy(aq, ap); \ int res = REAL(vname)(__VA_ARGS__); \ if (res 0) \ - scanf_common(ctx, res, format, aq); \ + scanf_common(ctx, res, allowGnuMalloc, format, aq); \ va_end(aq); \ return res; \ } INTERCEPTOR(int, vscanf, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(vscanf, format, ap) +VSCANF_INTERCEPTOR_IMPL(vscanf, true, format, ap) INTERCEPTOR(int, vsscanf, const char *str, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(vsscanf, str, format, ap) +VSCANF_INTERCEPTOR_IMPL(vsscanf, true, str, format, ap) INTERCEPTOR(int, vfscanf, void *stream, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(vfscanf, stream, format, ap) +VSCANF_INTERCEPTOR_IMPL(vfscanf, true, stream, format, ap) INTERCEPTOR(int, __isoc99_vscanf, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(__isoc99_vscanf, format, ap) +VSCANF_INTERCEPTOR_IMPL(__isoc99_vscanf, false, format, ap) INTERCEPTOR(int, __isoc99_vsscanf, const char *str, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(__isoc99_vsscanf, str, format, ap) +VSCANF_INTERCEPTOR_IMPL(__isoc99_vsscanf, false, str, format, ap) INTERCEPTOR(int, __isoc99_vfscanf, void *stream, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(__isoc99_vfscanf, stream, format, ap) +VSCANF_INTERCEPTOR_IMPL(__isoc99_vfscanf, false, stream, format, ap) #define SCANF_INTERCEPTOR_IMPL(name, vname, ...) \ { \ --- sanitizer_common/sanitizer_common_interceptors_scanf.inc.jj 2013-02-11 16:56:09.0 +0100 +++ sanitizer_common/sanitizer_common_interceptors_scanf.inc2013-02-12 14:37:46.948784135 +0100 @@ -39,7 +39,8 @@ static bool char_is_one_of(char c, const // returned in dir. This function returns the pointer to the first // unprocessed character, or 0 in case of error. // In case of the end-of-string, a pointer to the closing \0 is returned. -static const char *scanf_parse_next(const char *p, ScanfDirective *dir) { +static const char *scanf_parse_next(const char *p, bool allowGnuMalloc, + ScanfDirective *dir) { internal_memset(dir, 0, sizeof(*dir)); dir-argIdx = -1; @@ -121,7 +122,8 @@ static const char *scanf_parse_next(cons // This is unfortunately ambiguous between old GNU extension // of %as, %aS and %a[...] and newer POSIX %a followed by // letters s, S or [. -if (dir-convSpecifier == 'a' !dir-lengthModifier[0]) { +if (dir-convSpecifier == 'a' !dir-lengthModifier[0] +allowGnuMalloc) { if (*p == 's' || *p == 'S') { dir-maybeGnuMalloc = true; ++p; @@ -271,14 +273,14 @@ static int scanf_get_store_size(ScanfDir // Common part of *scanf interceptors. // Process format string and va_list, and report all store ranges. // Stops when consuming n_inputs input items. -static void scanf_common(void *ctx, int n_inputs, const char *format, - va_list aq) { +static void scanf_common(void *ctx, int n_inputs, bool
[PATCH] Fix PR56295
This fixes the code difference -O3 vs. -O3 -flto reported in PR56295. For the -flto run we are confused by the extra MEM_REF we wrap every global decl with in the IL (that is to support seamless and alias-correct replacement of global decls with their prevailing decl). The following un-wraps the decl again if the extra MEM_REF has no semantic meaning (we also do that in fold_stmt, I chose to duplicate the code in a slightly stricter form here - eventually we should simply fold all stmts, we have got extra information like global initializers available at LTRANS time after all). LTO bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2013-02-12 Richard Biener rguent...@suse.de PR lto/56295 * gimple-streamer-in.c (input_gimple_stmt): Strip MEM_REFs off decls again if possible. Index: gcc/gimple-streamer-in.c === *** gcc/gimple-streamer-in.c(revision 195973) --- gcc/gimple-streamer-in.c(working copy) *** input_gimple_stmt (struct lto_input_bloc *** 143,164 case GIMPLE_DEBUG: for (i = 0; i num_ops; i++) { ! tree op = stream_read_tree (ib, data_in); gimple_set_op (stmt, i, op); if (!op) continue; ! if (TREE_CODE (op) == ADDR_EXPR) ! op = TREE_OPERAND (op, 0); ! while (handled_component_p (op)) { ! if (TREE_CODE (op) == COMPONENT_REF) { /* Fixup FIELD_DECLs in COMPONENT_REFs, they are not handled by decl merging. */ tree field, type, tem; tree closest_match = NULL_TREE; ! field = TREE_OPERAND (op, 1); type = DECL_CONTEXT (field); for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem)) { --- 143,165 case GIMPLE_DEBUG: for (i = 0; i num_ops; i++) { ! tree *opp, op = stream_read_tree (ib, data_in); gimple_set_op (stmt, i, op); if (!op) continue; ! opp = gimple_op_ptr (stmt, i); ! if (TREE_CODE (*opp) == ADDR_EXPR) ! opp = TREE_OPERAND (*opp, 0); ! while (handled_component_p (*opp)) { ! if (TREE_CODE (*opp) == COMPONENT_REF) { /* Fixup FIELD_DECLs in COMPONENT_REFs, they are not handled by decl merging. */ tree field, type, tem; tree closest_match = NULL_TREE; ! field = TREE_OPERAND (*opp, 1); type = DECL_CONTEXT (field); for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem)) { *** input_gimple_stmt (struct lto_input_bloc *** 186,197 if (warning_at (gimple_location (stmt), 0, use of type %%E% with two mismatching declarations at field %%E%, ! type, TREE_OPERAND (op, 1))) { if (TYPE_FIELDS (type)) inform (DECL_SOURCE_LOCATION (TYPE_FIELDS (type)), original type declared here); ! inform (DECL_SOURCE_LOCATION (TREE_OPERAND (op, 1)), field in mismatching type declared here); if (TYPE_NAME (TREE_TYPE (field)) (TREE_CODE (TYPE_NAME (TREE_TYPE (field))) --- 187,198 if (warning_at (gimple_location (stmt), 0, use of type %%E% with two mismatching declarations at field %%E%, ! type, TREE_OPERAND (*opp, 1))) { if (TYPE_FIELDS (type)) inform (DECL_SOURCE_LOCATION (TYPE_FIELDS (type)), original type declared here); ! inform (DECL_SOURCE_LOCATION (TREE_OPERAND (*opp, 1)), field in mismatching type declared here); if (TYPE_NAME (TREE_TYPE (field)) (TREE_CODE (TYPE_NAME (TREE_TYPE (field))) *** input_gimple_stmt (struct lto_input_bloc *** 208,235 type of mismatching field declared here); } /* And finally fixup the types. */ ! TREE_OPERAND (op, 0) = build1 (VIEW_CONVERT_EXPR, type, ! TREE_OPERAND (op, 0)); } else ! TREE_OPERAND (op, 1) = tem;
Re: PR target/52555: attribute optimize is overriding command line options
On Mon, Feb 11, 2013 at 06:15:05PM -0600, Aldy Hernandez wrote: How does this look? Looks good to me. Jakub, what's this you mention in the PR about caching __optimize__((3))? You also mention I shouldn't compare against this_target_optabs, but default_target_optabs. But what if this_target_optabs has changed? (See patch). The reason for that is that this_target_optabs could at that point be simply whatever optabs used the last parsed function. this_target_optabs changes only either because of optimize attribute (not sure if MIPS as the only switchable target? supports that), or because of mips_set_mips16_mode. I think invoke_set_current_function_hook invokes the target hook after the code you've changed, so I'd say it should work fine even on MIPS. CCing Richard for that anyway. Tested on x86-64 Linux. It would be nice if someone with access to a SWITCHABLE_TARGET platform (mips) could also test this. A few nits below. I'm not sure about the behavior of multiple optimize attributes either, let's try it and see how it is handled right now (ignoring optabs). @@ -6184,6 +6184,41 @@ init_optabs (void) targetm.init_libfuncs (); } +/* Recompute the optabs. If they have changed, save the new set of + optabs in the optimization node OPTNODE. */ + +void +save_optabs_if_changed (tree optnode) +{ + struct target_optabs *save_target_optabs = this_target_optabs; + struct target_optabs *tmp_target_optabs = XNEW (struct target_optabs); + + /* Generate a new set of optabs into tmp_target_optabs. */ + memset (tmp_target_optabs, 0, sizeof (struct target_optabs)); I think you should just use XCNEW and drop the memset. + this_target_optabs = tmp_target_optabs; + init_all_optabs (); + this_target_optabs = save_target_optabs; + + /* If the optabs changed, record it in the node. */ + if (memcmp (tmp_target_optabs, this_target_optabs, + sizeof (struct target_optabs))) +{ + /* ?? An existing entry in TREE_OPTIMIZATION_OPTABS indicates + multiple ((optimize)) attributes for the same function. Is + this even valid? For now, just clobber the existing entry + with the new optabs. */ + if (TREE_OPTIMIZATION_OPTABS (optnode)) + free (TREE_OPTIMIZATION_OPTABS (optnode)); + + TREE_OPTIMIZATION_OPTABS (optnode) = tmp_target_optabs; +} + else +{ + TREE_OPTIMIZATION_OPTABS (optnode) = NULL; + free (tmp_target_optabs); Shouldn't this (and above) be XDELETE to match the allocation style? Jakub
[PATCH] Fix LTO with global register vars
We add global register vars into the LTO symtab processed by the linker. That's of course bogus. Fixed with the following patch. Bootstrap regtest running on x86_64-unknown-linux-gnu. Richard. 2013-02-12 Richard Biener rguent...@suse.de PR lto/56297 * lto-streamer-out.c (write_symbol): Do not output symbols for hard register variables. * gcc.dg/lto/pr56297_0.c: New testcase. * gcc.dg/lto/pr56297_0.c: Likewise. Index: gcc/lto-streamer-out.c === *** gcc/lto-streamer-out.c (revision 195973) --- gcc/lto-streamer-out.c (working copy) *** write_symbol (struct streamer_tree_cache *** 1166,1172 if (!TREE_PUBLIC (t) || is_builtin_fn (t) || DECL_ABSTRACT (t) ! || TREE_CODE (t) == RESULT_DECL) return; gcc_assert (TREE_CODE (t) == VAR_DECL --- 1166,1173 if (!TREE_PUBLIC (t) || is_builtin_fn (t) || DECL_ABSTRACT (t) ! || TREE_CODE (t) == RESULT_DECL ! || (TREE_CODE (t) == VAR_DECL DECL_HARD_REGISTER (t))) return; gcc_assert (TREE_CODE (t) == VAR_DECL Index: gcc/testsuite/gcc.dg/lto/pr56297_0.c === *** gcc/testsuite/gcc.dg/lto/pr56297_0.c(revision 0) --- gcc/testsuite/gcc.dg/lto/pr56297_0.c(working copy) *** *** 0 --- 1,13 + /* { dg-lto-do link } */ + /* { dg-lto-options { { -flto -fno-common } } } */ + + #if __x86_64__ || __i386__ + register int i asm(esp); + #else + extern int i; + #endif + + int main(void) + { + return i; + } Index: gcc/testsuite/gcc.dg/lto/pr56297_1.c === *** gcc/testsuite/gcc.dg/lto/pr56297_1.c(revision 0) --- gcc/testsuite/gcc.dg/lto/pr56297_1.c(working copy) *** *** 0 --- 1,5 + #if __x86_64__ || __i386__ + register int i asm(esp); + #else + int i; + #endif
Re: [PATCH 2/2] [asan] Avoid instrumenting duplicated memory access in the same basic block
On Tue, Feb 12, 2013 at 03:19:37PM +0100, Dodji Seketeli wrote: gcc/ * Makefile.in (asan.o): Add new dependency on hash-table.h * asan.c (struct asan_mem_ref, struct mem_ref_hasher): New types. (asan_mem_ref_init, asan_mem_ref_get_end, get_mem_ref_hash_table) (has_stmt_been_instrumented_p, empty_mem_ref_hash_table) (free_mem_ref_resources, has_mem_ref_been_instrumented) (has_stmt_been_instrumented_p, update_mem_ref_hash_table) (get_mem_ref_of_assignment): New functions. (get_mem_refs_of_builtin_call): Extract from instrument_builtin_call and tweak a little bit to make it fit with the new signature. (instrument_builtin_call): Use the new get_mem_refs_of_builtin_call. Use gimple_call_builtin_p instead of is_gimple_builtin_call. (instrument_derefs, instrument_mem_region_access): Insert the instrumented memory reference into the hash table. (maybe_instrument_assignment): Renamed instrument_assignment into this, and change it to advance the iterator when instrumentation actually happened and return true in that case. This makes it homogeneous with maybe_instrument_assignment, and thus give a chance to callers to be more 'regular'. (transform_statements): Clear the memory reference hash table whenever we enter a new BB, when we cross a function call, or when we are done transforming statements. Use maybe_instrument_assignment instead of instrumentation. No more need to special case maybe_instrument_assignment and advance the iterator after calling it; it's now handled just like maybe_instrument_call. Update comment. Ok. Just some testsuite nits. gcc/testsuite/ * c-c++-common/asan/no-redundant-instrumentation-1.c: New test. * testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c: Likewise. * testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c: Likewise. * testsuite/c-c++-common/asan/inc.c: Likewise. diff --git a/gcc/testsuite/c-c++-common/asan/inc.c b/gcc/testsuite/c-c++-common/asan/inc.c new file mode 100644 index 000..09ad176 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/inc.c @@ -0,0 +1,20 @@ +/* { dg-options -fdump-tree-asan0 } + { dg-do compile } */ I think generally the style used in the gcc testsuite is for C tests: /* { dg-options ... } */ /* { dg-do compile } */ and for C++ // comments. I.e. don't merge multiple lines into one comments, no extra spaces. + +/* { dg-final { scan-tree-dump-times __builtin___asan_report 1 asan0 } } */ + +/* { dg-final { scan-tree-dump __builtin___asan_report_load4 asan0 } } */ No need for the empty line in between that. diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c new file mode 100644 index 000..8c6cca4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c @@ -0,0 +1,67 @@ +/* This tests that when faced with two references to the same memory + location in the same basic block, the second reference should not + be instrumented by the Address Sanitizer Here I'd end with a full stop, i.e. Address Sanitizer. */ + + { dg-options -fdump-tree-asan0 } + { dg-do compile } + */ And the above would be one comment per one line style again. + +/* { dg-final { scan-tree-dump-times __builtin___asan_report_store1 7 asan0 } } + + { dg-final { scan-tree-dump-times __builtin___asan_report_load 2 asan0 } } + */ Again, both one line comments, and no empty line in between. --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c @@ -0,0 +1,26 @@ +/* This tests that when faced with two references to the same memory + location in the same basic block, the second reference should not + be instrumented by the Address Sanitizer. But in case of access to + overlapping regions we must be precise. + + { dg-options -fdump-tree-asan0 } + { dg-do compile } + */ Ditto. + +int +main () +{ + char tab[5]; + + /* Here, we instrument the access at offset 0 and access at offset + 4. */ + __builtin_memset (tab, 1, sizeof (tab)); + /* We instrumented access at offset 0 above already, so only access + at offset 3 is instrumented. */ + __builtin_memset (tab, 1, 3); +} + +/* { dg-final { scan-tree-dump-times __builtin___asan_report_store1 3 asan0 } } + + { dg-final { scan-tree-dump-times __builtin___asan_report 3 asan0 } } + */ Ditto. ... Jakub
Re: [PATCH] Fix PR56181, rewrite fix_loop_structure
On 7 February 2013 11:38, Richard Biener rguent...@suse.de wrote: This rewrites fix_loop_structure to be equivalent to loop detection from scratch via flow_loops_find with re-using of existing loop tree entries. This addresses a few shortcomings of fix_loop_structure. First, as shown by the testcase in PR56181, fix_loop_structure does Hi, This patch appears to trigger the following regression on arm-none-linux-gnueabi: FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer (test for excess errors) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-loops (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-loops (test for excess errors) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (test for excess errors) FAIL: gcc.dg/torture/pr54458.c -O3 -g (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -g (test for excess errors) Where each of the failures looks like this: output is: /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c: In function 'foo': /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: error: loop with header 9 not in loop tree /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: error: loop with header 33 not in loop tree /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: error: loop with header 34 not in loop tree /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: internal compiler error: in verify_loop_structure, at cfgloop.c:1614 0x5d83f3 verify_loop_structure() /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/cfgloop.c:1614 0x7cbfa4 unswitch_single_loop /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/loop-unswitch.c:368 0x7cc508 unswitch_loops() /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/loop-unswitch.c:147 0x7bdf17 rtl_unswitch /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/loop-init.c:441 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions. FAIL: gcc.dg/torture/pr54458.c -O3 -g (internal compiler error) The same regression also appears on aarch64-none-linux-gnu Cheers /Marcus
Re: [PATCH] Fix PR56181, rewrite fix_loop_structure
On Tue, 12 Feb 2013, Marcus Shawcroft wrote: On 7 February 2013 11:38, Richard Biener rguent...@suse.de wrote: This rewrites fix_loop_structure to be equivalent to loop detection from scratch via flow_loops_find with re-using of existing loop tree entries. This addresses a few shortcomings of fix_loop_structure. First, as shown by the testcase in PR56181, fix_loop_structure does Hi, This patch appears to trigger the following regression on arm-none-linux-gnueabi: FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer (test for excess errors) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-loops (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-loops (test for excess errors) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (test for excess errors) FAIL: gcc.dg/torture/pr54458.c -O3 -g (internal compiler error) FAIL: gcc.dg/torture/pr54458.c -O3 -g (test for excess errors) I can't reproduce this with a cross-compiler (--target=arm-non-eabi). How exactly did you configure? Please provide -v output. Richard. Where each of the failures looks like this: output is: /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c: In function 'foo': /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: error: loop with header 9 not in loop tree /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: error: loop with header 33 not in loop tree /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: error: loop with header 34 not in loop tree /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/testsuite/gcc.dg/torture/pr54458.c:20:1: internal compiler error: in verify_loop_structure, at cfgloop.c:1614 0x5d83f3 verify_loop_structure() /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/cfgloop.c:1614 0x7cbfa4 unswitch_single_loop /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/loop-unswitch.c:368 0x7cc508 unswitch_loops() /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/loop-unswitch.c:147 0x7bdf17 rtl_unswitch /projects/pd/pdsw-infrastructure/production-builds/bld-root/channels/fsf-trunk/builds/34/src/gcc/gcc/loop-init.c:441 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions. FAIL: gcc.dg/torture/pr54458.c -O3 -g (internal compiler error) The same regression also appears on aarch64-none-linux-gnu Cheers /Marcus -- Richard Biener rguent...@suse.de SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imend
Re: [PATCH][ARM] Implement vectorizer cost hooks
On 12 February 2013 14:42, Richard Earnshaw rearn...@arm.com wrote: On 11/02/13 15:43, Christophe Lyon wrote: Richard, Thanks for your comments. Here a new version with the changes you suggested. Thanks for turning this around quickly. This is fine. Ramana and I have discussed this and we're agreed that we'd like this to go into 4.8. However, if any problems do crop up we'll back it out again and wait for stage1 to re-open. Please can you commit it ASAP so that we can make sure it gets a reasonable amount of testing. R. Thanks, I have just committed it, as rev #195977. Christophe.
[PATCH] Fix PR56181, rewrite fix_loop_structure
Sorry, I'll send that again copying gcc-patches in this time... -- Forwarded message -- From: Marcus Shawcroft marcus.shawcr...@gmail.com Date: 12 February 2013 15:17 Subject: Re: [PATCH] Fix PR56181, rewrite fix_loop_structure To: Richard Biener rguent...@suse.de On 12 February 2013 14:54, Richard Biener rguent...@suse.de wrote: I can't reproduce this with a cross-compiler (--target=arm-non-eabi). How exactly did you configure? Please provide -v output. Richard. I don't see the issue in arm-none-eabi either, just arm-none-linux-gnueabi. --enable-shared --disable-libssp --disable-libmudflap --with-plugin-ld=arm-none-linux-gnueabi-ld --enable-languages=c,c++,fortran --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp /Marcus
Re: [PATCH] Fix PR56181, rewrite fix_loop_structure
On Tue, 12 Feb 2013, Marcus Shawcroft wrote: Sorry, I'll send that again copying gcc-patches in this time... -- Forwarded message -- From: Marcus Shawcroft marcus.shawcr...@gmail.com Date: 12 February 2013 15:17 Subject: Re: [PATCH] Fix PR56181, rewrite fix_loop_structure To: Richard Biener rguent...@suse.de On 12 February 2013 14:54, Richard Biener rguent...@suse.de wrote: I can't reproduce this with a cross-compiler (--target=arm-non-eabi). How exactly did you configure? Please provide -v output. Richard. I don't see the issue in arm-none-eabi either, just arm-none-linux-gnueabi. --enable-shared --disable-libssp --disable-libmudflap --with-plugin-ld=arm-none-linux-gnueabi-ld --enable-languages=c,c++,fortran --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp I still can't reproduce it. I tried with pristine trunk rev. 195979. --target=arm-none-linux-gnueabi --enable-languages=c,c++,fortran --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp gcc ./cc1 -quiet pr54458.c -O3 -fomit-frame-pointer -g -I include gcc Richard.
New branch: c++-concepts
Hi, I've created a new branch, called c++-concepts for work being done for C++ concepts (yes, again.) This new effort is unrelated to previous ConceptGCC so I left alone the inactive branch c++0x-concepts. The patch below has been committed. Thanks, -- Gaby Index: svn.html === RCS file: /cvs/gcc/wwwdocs/htdocs/svn.html,v retrieving revision 1.178 diff -p -r1.178 svn.html *** svn.html24 Jan 2013 17:21:33 - 1.178 --- svn.html12 Feb 2013 15:52:33 - *** the command codesvn log --stop-on-copy *** 508,513 --- 508,518 and a href=mailto:cr...@google.com;Lawrence Crowl/a. Patches should be prefixed with code[pph]/code in the subject line./dd + dtc++-concepts/dt + ddThis is the sandbox for renewed work on emconcepts for C++/em. + The branch is maintained by + a href=mailto:g...@gcc.gnu.org;Gabriel Dos Reis/a./dd + /dl h3 id=distrobranchesDistribution Branches/h3
Re: PR target/52555: attribute optimize is overriding command line options
Jakub, what's this you mention in the PR about caching __optimize__((3))? You also mention I shouldn't compare against this_target_optabs, but default_target_optabs. But what if this_target_optabs has changed? (See patch). The reason for that is that this_target_optabs could at that point be simply whatever optabs used the last parsed function. this_target_optabs changes only either because of optimize attribute (not sure if MIPS as the only switchable target? supports that), or because of mips_set_mips16_mode. I think invoke_set_current_function_hook invokes the target hook after the code you've changed, so I'd say it should work fine even on MIPS. CCing Richard for that anyway. Ok, fixed. I think you should just use XCNEW and drop the memset. Perfect. Done. Shouldn't this (and above) be XDELETE to match the allocation style? Absolutely. Done. OK for trunk? commit ee1f2aebe23fe0d5cecfdfde9822ef681bf6ef0c Author: Aldy Hernandez al...@redhat.com Date: Mon Feb 11 15:51:24 2013 -0600 PR target/52555 * tree.h (struct tree_optimization_option): New field target_optabs. (TREE_OPTIMIZATION_OPTABS): New. (save_optabs_if_changed): Protoize. * optabs.h: Always declare this_target_optabs. * optabs.c (save_optabs_if_changed): New. Always declare this_target_optabs. * function.c (invoke_set_current_function_hook): Set this_target_optabs if there is one in the optimization node. c-family/ * c-common.c (handle_optimize_attribute): Call save_optabs_if_changed. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 1e6afaa..3711e69 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -8925,6 +8925,8 @@ handle_optimize_attribute (tree *node, tree name, tree args, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node) = build_optimization_node (); + save_optabs_if_changed (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)); + /* Restore current options. */ cl_optimization_restore (global_options, cur_opts); } diff --git a/gcc/function.c b/gcc/function.c index 4ce2259..f37e91f 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4397,6 +4397,13 @@ invoke_set_current_function_hook (tree fndecl) { optimization_current_node = opts; cl_optimization_restore (global_options, TREE_OPTIMIZATION (opts)); + + /* Change optabs if needed. */ + if (TREE_OPTIMIZATION_OPTABS (opts)) + this_target_optabs + = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); + else + this_target_optabs = default_target_optabs; } targetm.set_current_function (fndecl); diff --git a/gcc/optabs.c b/gcc/optabs.c index c1dacf4..11153aa 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -44,8 +44,8 @@ along with GCC; see the file COPYING3. If not see struct target_optabs default_target_optabs; struct target_libfuncs default_target_libfuncs; -#if SWITCHABLE_TARGET struct target_optabs *this_target_optabs = default_target_optabs; +#if SWITCHABLE_TARGET struct target_libfuncs *this_target_libfuncs = default_target_libfuncs; #endif @@ -6207,6 +6207,40 @@ init_optabs (void) targetm.init_libfuncs (); } +/* Recompute the optabs. If they have changed, save the new set of + optabs in the optimization node OPTNODE. */ + +void +save_optabs_if_changed (tree optnode) +{ + struct target_optabs *save_target_optabs = this_target_optabs; + struct target_optabs *tmp_target_optabs = XCNEW (struct target_optabs); + + /* Generate a new set of optabs into tmp_target_optabs. */ + this_target_optabs = tmp_target_optabs; + init_all_optabs (); + this_target_optabs = save_target_optabs; + + /* If the optabs changed, record it in the node. */ + if (memcmp (tmp_target_optabs, default_target_optabs, + sizeof (struct target_optabs))) +{ + /* ?? An existing entry in TREE_OPTIMIZATION_OPTABS indicates +multiple ((optimize)) attributes for the same function. Is +this even valid? For now, just clobber the existing entry +with the new optabs. */ + if (TREE_OPTIMIZATION_OPTABS (optnode)) + XDELETE (TREE_OPTIMIZATION_OPTABS (optnode)); + + TREE_OPTIMIZATION_OPTABS (optnode) = tmp_target_optabs; +} + else +{ + TREE_OPTIMIZATION_OPTABS (optnode) = NULL; + XDELETE (tmp_target_optabs); +} +} + /* A helper function for init_sync_libfuncs. Using the basename BASE, install libfuncs into TAB for BASE_N for 1 = N = MAX. */ diff --git a/gcc/optabs.h b/gcc/optabs.h index c08adcf..2e8b6ec 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -76,11 +76,7 @@ struct target_optabs { }; extern struct target_optabs default_target_optabs; -#if SWITCHABLE_TARGET extern struct target_optabs *this_target_optabs; -#else -#define this_target_optabs (default_target_optabs) -#endif /* Define functions given in
Re: libsanitizer merge from upstream r173241
Yes, this looks good. I've added some tests and committed to compiler-rt. Thanks! On Tue, Feb 12, 2013 at 5:46 PM, Jakub Jelinek ja...@redhat.com wrote: On Tue, Feb 12, 2013 at 05:28:53PM +0400, Evgeniy Stepanov wrote: Hey, seems like that last of the scanf changes are in. We're intercepting __isoc99_*scanf irrespective of the glibc version, because (a) it does not hurt (and with the static runtime, even interceptor itself is thrown out by the linker), and (b) user program and tool's runtime can be built with different libc versions. Thanks for the help with scanf testing, we've got much more confidence in our implementation now. Thanks. Perhaps (completely untested) you could still disallow the GNU %as/%aS/%a[ compatibility for __isoc99_*, that way you can acurately verify even #define _XOPEN_SOURCE 700 ... float flt; int i; sscanf (0.1234[x6], %a[x%d], flt, i); --- sanitizer_common/sanitizer_common_interceptors.inc.jj 2013-02-12 14:34:06.0 +0100 +++ sanitizer_common/sanitizer_common_interceptors.inc 2013-02-12 14:40:05.486968072 +0100 @@ -150,7 +150,7 @@ INTERCEPTOR(int, prctl, int option, unsi #include sanitizer_common_interceptors_scanf.inc -#define VSCANF_INTERCEPTOR_IMPL(vname, ...) \ +#define VSCANF_INTERCEPTOR_IMPL(vname, allowGnuMalloc, ...) \ { \ void *ctx; \ COMMON_INTERCEPTOR_ENTER(ctx, vname, __VA_ARGS__); \ @@ -158,29 +158,29 @@ INTERCEPTOR(int, prctl, int option, unsi va_copy(aq, ap); \ int res = REAL(vname)(__VA_ARGS__); \ if (res 0) \ - scanf_common(ctx, res, format, aq); \ + scanf_common(ctx, res, allowGnuMalloc, format, aq); \ va_end(aq); \ return res; \ } INTERCEPTOR(int, vscanf, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(vscanf, format, ap) +VSCANF_INTERCEPTOR_IMPL(vscanf, true, format, ap) INTERCEPTOR(int, vsscanf, const char *str, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(vsscanf, str, format, ap) +VSCANF_INTERCEPTOR_IMPL(vsscanf, true, str, format, ap) INTERCEPTOR(int, vfscanf, void *stream, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(vfscanf, stream, format, ap) +VSCANF_INTERCEPTOR_IMPL(vfscanf, true, stream, format, ap) INTERCEPTOR(int, __isoc99_vscanf, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(__isoc99_vscanf, format, ap) +VSCANF_INTERCEPTOR_IMPL(__isoc99_vscanf, false, format, ap) INTERCEPTOR(int, __isoc99_vsscanf, const char *str, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(__isoc99_vsscanf, str, format, ap) +VSCANF_INTERCEPTOR_IMPL(__isoc99_vsscanf, false, str, format, ap) INTERCEPTOR(int, __isoc99_vfscanf, void *stream, const char *format, va_list ap) -VSCANF_INTERCEPTOR_IMPL(__isoc99_vfscanf, stream, format, ap) +VSCANF_INTERCEPTOR_IMPL(__isoc99_vfscanf, false, stream, format, ap) #define SCANF_INTERCEPTOR_IMPL(name, vname, ...) \ { \ --- sanitizer_common/sanitizer_common_interceptors_scanf.inc.jj 2013-02-11 16:56:09.0 +0100 +++ sanitizer_common/sanitizer_common_interceptors_scanf.inc2013-02-12 14:37:46.948784135 +0100 @@ -39,7 +39,8 @@ static bool char_is_one_of(char c, const // returned in dir. This function returns the pointer to the first // unprocessed character, or 0 in case of error. // In case of the end-of-string, a pointer to the closing \0 is returned. -static const char *scanf_parse_next(const char *p, ScanfDirective *dir) { +static const char *scanf_parse_next(const char *p, bool allowGnuMalloc, + ScanfDirective *dir) { internal_memset(dir, 0, sizeof(*dir)); dir-argIdx = -1; @@ -121,7 +122,8 @@ static const char *scanf_parse_next(cons // This is unfortunately ambiguous between old GNU extension // of %as, %aS and %a[...] and newer POSIX %a followed by // letters s, S or [. -if (dir-convSpecifier == 'a' !dir-lengthModifier[0]) { +if (dir-convSpecifier == 'a' !dir-lengthModifier[0] +allowGnuMalloc) { if (*p == 's' || *p == 'S') { dir-maybeGnuMalloc = true; ++p; @@ -271,14 +273,14 @@ static int scanf_get_store_size(ScanfDir // Common part of *scanf interceptors. // Process format string and va_list, and report
[PATCH] PR55033: Fix
This patch from Alan Modra fixes a section type conflict error. See also http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02172.html Test results on PowerPC without this patch: http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01351.html Test results on PowerPC with this patch: http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01371.html Test results for x86_64-unknown-linux-gnu with and without this patch: http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01358.html http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg01376.html The patch has no impact on x86_64-unknown-linux-gnu test results. Alan Modra * varasm.c (default_elf_select_section): Move !DECL_P check.. (get_named_section): ..to here before calling get_section_name. Adjust assertion. (default_section_type_flags): Add DECL_P check. * config/i386/winnt.c (i386_pe_section_type_flags): Likewise. * config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): * Likewise. --- gcc/config/i386/winnt.c|2 +- gcc/config/rs6000/rs6000.c |2 +- gcc/varasm.c | 12 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 118b1ec..7e7c155 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -476,7 +476,7 @@ i386_pe_section_type_flags (tree decl, const char *name, int reloc) flags |= SECTION_PE_SHARED; } - if (decl DECL_ONE_ONLY (decl)) + if (decl DECL_P (decl) DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE; /* See if we already have an entry for this section. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fbf57be..bf0cacb 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -25913,7 +25913,7 @@ rs6000_xcoff_section_type_flags (tree decl, const char *name, int reloc) unsigned int flags = default_section_type_flags (decl, name, reloc); /* Align to at least UNIT size. */ - if (flags SECTION_CODE || !decl) + if ((flags SECTION_CODE) != 0 || !decl || !DECL_P (decl)) align = MIN_UNITS_PER_WORD; else /* Increase alignment of large objects if not already stricter. */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 6648103..ea709fd 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -402,12 +402,16 @@ get_named_section (tree decl, const char *name, int reloc) { unsigned int flags; - gcc_assert (!decl || DECL_P (decl)); if (name == NULL) -name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); +{ + gcc_assert (decl DECL_P (decl) DECL_SECTION_NAME (decl)); + name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); +} flags = targetm.section_type_flags (decl, name, reloc); + if (decl !DECL_P (decl)) +decl = NULL_TREE; return get_section (name, flags, decl); } @@ -5989,7 +5993,7 @@ default_section_type_flags (tree decl, const char *name, int reloc) flags |= SECTION_RELRO; } - if (decl DECL_ONE_ONLY (decl)) + if (decl DECL_P (decl) DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE; if (decl TREE_CODE (decl) == VAR_DECL DECL_THREAD_LOCAL_P (decl)) @@ -6348,8 +6352,6 @@ default_elf_select_section (tree decl, int reloc, gcc_unreachable (); } - if (!DECL_P (decl)) -decl = NULL_TREE; return get_named_section (decl, sname, reloc); } -- 1.7.7
Re: PR target/52555: attribute optimize is overriding command line options
On Tue, Feb 12, 2013 at 09:58:38AM -0600, Aldy Hernandez wrote: OK for trunk? I'd still prefer Richard to chime in, I'm really not familiar enough with MIPS switchable target stuff. +/* Recompute the optabs. If they have changed, save the new set of + optabs in the optimization node OPTNODE. */ + +void +save_optabs_if_changed (tree optnode) +{ + struct target_optabs *save_target_optabs = this_target_optabs; + struct target_optabs *tmp_target_optabs = XCNEW (struct target_optabs); + + /* Generate a new set of optabs into tmp_target_optabs. */ + this_target_optabs = tmp_target_optabs; + init_all_optabs (); + this_target_optabs = save_target_optabs; + + /* If the optabs changed, record it in the node. */ + if (memcmp (tmp_target_optabs, default_target_optabs, + sizeof (struct target_optabs))) +{ + /* ?? An existing entry in TREE_OPTIMIZATION_OPTABS indicates + multiple ((optimize)) attributes for the same function. Is + this even valid? For now, just clobber the existing entry + with the new optabs. */ + if (TREE_OPTIMIZATION_OPTABS (optnode)) + XDELETE (TREE_OPTIMIZATION_OPTABS (optnode)); I wonder if this necessarily won't mean that if TREE_OPTIMIZATION_OPTABS is non-NULL, then memcmp (tmp_target_optabs, TREE_OPTIMIZATION_OPTABS (optnode), sizeof (*tmp_target_optabs)) == 0. Because, optimization nodes are only shared if they contain the same set of all options. Multiple optimize attributes seems to be valid, see what handle_optimize_attribute says on them, but they together either create a fresh optimization node which certainly won't have TREE_OPTIMIZATION_OPTABS set, or they return one older, but that should be already initialized to the same thing. So perhaps start the function with if (TREE_OPTIMIZATION_OPTABS (optnode)) return; ? I.e., if you have multiple functions with the same optimization node, there is no need to do init_all_optabs again and again. Perhaps we want to have a flag whether TREE_OPTIMIZATION_OPTABS has been computed already, and don't call save_optabs_if_changed if already set, or add some magic value for TREE_OPTIMIZATION_OPTABS, where e.g. NULL would mean not computed yet, the special magic value would mean the default and other values the special optabs? Perhaps the magic value could be just default_target_optabs... Jakub
RFC: c-common PATCH to allow __int128_t literals
Although __int128_t is technically not an extended integer type because we don't want to change intmax_t, it seems appropriate to me to give it the same semantics as an extended integer type apart from that one aspect. The only thing we weren't implementing is support for numeric literals, which is mostly just a matter of setting the libcpp precision option appropriately. Then I added definitions of the appropriate limits macros and updated affected tests. I also constrained C++11 user-defined literals to stay at unsigned long long, since they're being passed to a function with a parameter of that type. If you'd prefer, I could handle that in the front end instead. Does this make sense to you for 4.9? commit 34f930afff6aaba910800d55a58c580ff2046b03 Author: Jason Merrill ja...@redhat.com Date: Mon Feb 11 15:02:05 2013 -0500 * glimits.h (__INT128_MIN__, __UINT128_MAX__): Define. * c-cppbuiltin.c (type_suffix): Handle __int128_t. (c_cpp_builtins): Define __INT128_MAX__. (cpp_atomic_builtins): Define __GCC_ATOMIC_INT128_LOCK_FREE. * c-opts.c (c_common_init): Set cpp max precision to that of the largest integer, not intmax_t. * c-lex.c (interpret_integer): Restrict C++11 user-defined literal precision to unsigned long long. diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 3e210d9..4f41fbc 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -668,6 +668,10 @@ cpp_atomic_builtins (cpp_reader *pfile) (have_swap[SWAP_INDEX (long_integer_type_node)]? 2 : 1)); builtin_define_with_int_value (__GCC_ATOMIC_LLONG_LOCK_FREE, (have_swap[SWAP_INDEX (long_long_integer_type_node)]? 2 : 1)); + if (int128_integer_type_node != NULL_TREE) +builtin_define_with_int_value + (__GCC_ATOMIC_INT128_LOCK_FREE, + have_swap[SWAP_INDEX (int128_integer_type_node)]? 2 : 1); /* If we're dealing with a set value that doesn't exactly correspond to a boolean truth value, let the library work around that. */ @@ -751,6 +755,8 @@ c_cpp_builtins (cpp_reader *pfile) builtin_define_type_max (__INT_MAX__, integer_type_node); builtin_define_type_max (__LONG_MAX__, long_integer_type_node); builtin_define_type_max (__LONG_LONG_MAX__, long_long_integer_type_node); + if (int128_integer_type_node) +builtin_define_type_max (__INT128_MAX__, int128_integer_type_node); builtin_define_type_minmax (__WCHAR_MIN__, __WCHAR_MAX__, underlying_wchar_type_node); builtin_define_type_minmax (__WINT_MIN__, __WINT_MAX__, wint_type_node); @@ -1132,7 +1138,10 @@ type_suffix (tree type) int is_long; if (type == long_long_integer_type_node - || type == long_long_unsigned_type_node) + || type == long_long_unsigned_type_node + /* int128_t doesn't have its own suffix. */ + || type == int128_integer_type_node + || type == int128_unsigned_type_node) is_long = 2; else if (type == long_integer_type_node || type == long_unsigned_type_node) diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 819e9d5..c6c591e 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -596,11 +596,20 @@ interpret_integer (const cpp_token *token, unsigned int flags, enum integer_type_kind itk; cpp_num integer; cpp_options *options = cpp_get_options (parse_in); + unsigned int precision = options-precision; *overflow = OT_NONE; + if (flags CPP_N_USERDEF) +/* A C++11 user-defined literal wants a long long unsigned value even + if normal literals can be larger. */ +options-precision = TYPE_PRECISION (long_long_unsigned_type_node); + integer = cpp_interpret_integer (parse_in, token, flags); integer = cpp_num_sign_extend (integer, options-precision); + + options-precision = precision; + if (integer.overflow) *overflow = OT_OVERFLOW; diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 1a922a8..e6db77b 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -987,7 +987,19 @@ c_common_init (void) { /* Set up preprocessor arithmetic. Must be done after call to c_common_nodes_and_builtins for type nodes to be good. */ - cpp_opts-precision = TYPE_PRECISION (intmax_type_node); + + /* Set cpp precision to be the precision of the largest integer type, + which might be larger than intmax_t (i.e. __int128_t). */ + for (unsigned int itk = itk_none - 1; ; itk--) +{ + tree type = integer_types[itk]; + if (type) + { + cpp_opts-precision = TYPE_PRECISION (type); + break; + } +} + cpp_opts-char_precision = TYPE_PRECISION (char_type_node); cpp_opts-int_precision = TYPE_PRECISION (integer_type_node); cpp_opts-wchar_precision = TYPE_PRECISION (wchar_type_node); diff --git a/gcc/glimits.h b/gcc/glimits.h index 372c2c4..396ca36 100644 --- a/gcc/glimits.h +++ b/gcc/glimits.h @@ -123,4 +123,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #
Re: [PATCH 2/2] [asan] Avoid instrumenting duplicated memory access in the same basic block
Jakub Jelinek ja...@redhat.com writes: On Tue, Feb 12, 2013 at 03:19:37PM +0100, Dodji Seketeli wrote: gcc/ * Makefile.in (asan.o): Add new dependency on hash-table.h * asan.c (struct asan_mem_ref, struct mem_ref_hasher): New types. (asan_mem_ref_init, asan_mem_ref_get_end, get_mem_ref_hash_table) (has_stmt_been_instrumented_p, empty_mem_ref_hash_table) (free_mem_ref_resources, has_mem_ref_been_instrumented) (has_stmt_been_instrumented_p, update_mem_ref_hash_table) (get_mem_ref_of_assignment): New functions. (get_mem_refs_of_builtin_call): Extract from instrument_builtin_call and tweak a little bit to make it fit with the new signature. (instrument_builtin_call): Use the new get_mem_refs_of_builtin_call. Use gimple_call_builtin_p instead of is_gimple_builtin_call. (instrument_derefs, instrument_mem_region_access): Insert the instrumented memory reference into the hash table. (maybe_instrument_assignment): Renamed instrument_assignment into this, and change it to advance the iterator when instrumentation actually happened and return true in that case. This makes it homogeneous with maybe_instrument_assignment, and thus give a chance to callers to be more 'regular'. (transform_statements): Clear the memory reference hash table whenever we enter a new BB, when we cross a function call, or when we are done transforming statements. Use maybe_instrument_assignment instead of instrumentation. No more need to special case maybe_instrument_assignment and advance the iterator after calling it; it's now handled just like maybe_instrument_call. Update comment. Ok. Just some testsuite nits. Thanks. Here is the updated patch that hopefully addresses your comments. Tested against trunk on x86-64-unknown-linux-gnu. gcc/ * Makefile.in (asan.o): Add new dependency on hash-table.h * asan.c (struct asan_mem_ref, struct mem_ref_hasher): New types. (asan_mem_ref_init, asan_mem_ref_get_end, get_mem_ref_hash_table) (has_stmt_been_instrumented_p, empty_mem_ref_hash_table) (free_mem_ref_resources, has_mem_ref_been_instrumented) (has_stmt_been_instrumented_p, update_mem_ref_hash_table) (get_mem_ref_of_assignment): New functions. (get_mem_refs_of_builtin_call): Extract from instrument_builtin_call and tweak a little bit to make it fit with the new signature. (instrument_builtin_call): Use the new get_mem_refs_of_builtin_call. Use gimple_call_builtin_p instead of is_gimple_builtin_call. (instrument_derefs, instrument_mem_region_access): Insert the instrumented memory reference into the hash table. (maybe_instrument_assignment): Renamed instrument_assignment into this, and change it to advance the iterator when instrumentation actually happened and return true in that case. This makes it homogeneous with maybe_instrument_assignment, and thus give a chance to callers to be more 'regular'. (transform_statements): Clear the memory reference hash table whenever we enter a new BB, when we cross a function call, or when we are done transforming statements. Use maybe_instrument_assignment instead of instrumentation. No more need to special case maybe_instrument_assignment and advance the iterator after calling it; it's now handled just like maybe_instrument_call. Update comment. gcc/testsuite/ * c-c++-common/asan/no-redundant-instrumentation-1.c: New test. * testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c: Likewise. * testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c: Likewise. * testsuite/c-c++-common/asan/inc.c: Likewise. --- gcc/Makefile.in|3 +- gcc/asan.c | 1258 +--- gcc/testsuite/c-c++-common/asan/inc.c | 19 + .../asan/no-redundant-instrumentation-1.c | 64 + .../asan/no-redundant-instrumentation-2.c | 24 + .../asan/no-redundant-instrumentation-3.c | 16 + 6 files changed, 974 insertions(+), 410 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/asan/inc.c create mode 100644 gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c create mode 100644 gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c create mode 100644 gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 375d5f5..f3bb168 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2226,7 +2226,8 @@ stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ asan.o : asan.c asan.h $(CONFIG_H) $(SYSTEM_H) $(GIMPLE_H) \ output.h coretypes.h
Re: PR target/52555: attribute optimize is overriding command line options
Jakub Jelinek ja...@redhat.com writes: On Mon, Feb 11, 2013 at 06:15:05PM -0600, Aldy Hernandez wrote: How does this look? Looks good to me. Jakub, what's this you mention in the PR about caching __optimize__((3))? You also mention I shouldn't compare against this_target_optabs, but default_target_optabs. But what if this_target_optabs has changed? (See patch). The reason for that is that this_target_optabs could at that point be simply whatever optabs used the last parsed function. this_target_optabs changes only either because of optimize attribute (not sure if MIPS as the only switchable target? supports that), or because of mips_set_mips16_mode. I think invoke_set_current_function_hook invokes the target hook after the code you've changed, so I'd say it should work fine even on MIPS. CCing Richard for that anyway. The target hook won't do anything for consecutive functions that have the same mode though. It expects this_target_optabs (and other this_target_* stuff) to stay the same. Rather than: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_target_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_target_optabs = default_target_optabs; I think it'd be better to have: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_fn_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_fn_optabs = this_target_optabs; with genopinit.c updated to use this_fn_optabs instead of this_target_optabs. Richard
Re: [PATCH 2/2] [asan] Avoid instrumenting duplicated memory access in the same basic block
On Tue, Feb 12, 2013 at 05:28:11PM +0100, Dodji Seketeli wrote: Thanks. Here is the updated patch that hopefully addresses your comments. Thanks, yes. Just please add /* { dg-final { cleanup-tree-dump asan0 } } */ lines to all new tests after the last dg-final line in those tests and check it in. Sorry for forgetting to mention it earlier. Jakub
Re: PR target/52555: attribute optimize is overriding command line options
Rather than: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_target_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_target_optabs = default_target_optabs; I think it'd be better to have: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_fn_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_fn_optabs = this_target_optabs; with genopinit.c updated to use this_fn_optabs instead of this_target_optabs. Hmmm, ok. I also added a default case setting this_fn_optabs = default_target_optabs when the optimizations haven't changed. I can remove this if redundant. Jakub also recommended bailing if TREE_OPTIMIZATION_OPTABS already set, thus avoiding recomputing init_all_optabs() in save_optabs_if_changed: + if (TREE_OPTIMIZATION_OPTABS (optnode)) +return; Is this still part of the plan? How is this revision? commit 48c1f4d243f81ca975b2aae34773b91ef6cbd8ca Author: Aldy Hernandez al...@redhat.com Date: Mon Feb 11 15:51:24 2013 -0600 PR target/52555 * genopinit.c (main): Use this_fn_optabs in generated init_all_optabs. * tree.h (struct tree_optimization_option): New field target_optabs. (TREE_OPTIMIZATION_OPTABS): New. (save_optabs_if_changed): Protoize. * optabs.h: Always declare this_target_optabs. Declare this_fn_optabs. * optabs.c (save_optabs_if_changed): New. Always declare this_target_optabs. Declare this_fn_optabs. * function.c (invoke_set_current_function_hook): Set this_fn_optabs if there is one in the optimization node. c-family/ * c-common.c (handle_optimize_attribute): Call save_optabs_if_changed. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 1e6afaa..3711e69 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -8925,6 +8925,8 @@ handle_optimize_attribute (tree *node, tree name, tree args, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node) = build_optimization_node (); + save_optabs_if_changed (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)); + /* Restore current options. */ cl_optimization_restore (global_options, cur_opts); } diff --git a/gcc/function.c b/gcc/function.c index 4ce2259..b177a98 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4397,7 +4397,16 @@ invoke_set_current_function_hook (tree fndecl) { optimization_current_node = opts; cl_optimization_restore (global_options, TREE_OPTIMIZATION (opts)); + + /* Change optabs if needed. */ + if (TREE_OPTIMIZATION_OPTABS (opts)) + this_fn_optabs + = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); + else + this_fn_optabs = this_target_optabs; } + else + this_fn_optabs = default_target_optabs; targetm.set_current_function (fndecl); } diff --git a/gcc/genopinit.c b/gcc/genopinit.c index 1bb2f77..2a4b3e2 100644 --- a/gcc/genopinit.c +++ b/gcc/genopinit.c @@ -423,7 +423,7 @@ main (int argc, char **argv) fprintf (s_file, };\n\n); fprintf (s_file, void\ninit_all_optabs (void)\n{\n); - fprintf (s_file, bool *ena = this_target_optabs-pat_enable;\n); + fprintf (s_file, bool *ena = this_fn_optabs-pat_enable;\n); for (i = 0; patterns.iterate (i, p); ++i) fprintf (s_file, ena[%u] = HAVE_%s;\n, i, p-name); fprintf (s_file, }\n\n); diff --git a/gcc/optabs.c b/gcc/optabs.c index c1dacf4..e40bb5f 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -44,8 +44,9 @@ along with GCC; see the file COPYING3. If not see struct target_optabs default_target_optabs; struct target_libfuncs default_target_libfuncs; -#if SWITCHABLE_TARGET struct target_optabs *this_target_optabs = default_target_optabs; +struct target_optabs *this_fn_optabs = default_target_optabs; +#if SWITCHABLE_TARGET struct target_libfuncs *this_target_libfuncs = default_target_libfuncs; #endif @@ -6207,6 +6208,40 @@ init_optabs (void) targetm.init_libfuncs (); } +/* Recompute the optabs. If they have changed, save the new set of + optabs in the optimization node OPTNODE. */ + +void +save_optabs_if_changed (tree optnode) +{ + struct target_optabs *save_target_optabs = this_target_optabs; + struct target_optabs *tmp_target_optabs = XCNEW (struct target_optabs); + + /* Generate a new set of optabs into tmp_target_optabs. */ + this_target_optabs = tmp_target_optabs; + init_all_optabs (); + this_target_optabs = save_target_optabs; + + /* If the optabs changed, record it in the node. */ + if (memcmp (tmp_target_optabs, default_target_optabs, + sizeof (struct target_optabs))) +{ + /* ?? An existing entry in TREE_OPTIMIZATION_OPTABS indicates +
Re: PR target/52555: attribute optimize is overriding command line options
Richard Sandiford rdsandif...@googlemail.com writes: Aldy Hernandez al...@redhat.com writes: Rather than: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_target_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_target_optabs = default_target_optabs; I think it'd be better to have: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_fn_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_fn_optabs = this_target_optabs; with genopinit.c updated to use this_fn_optabs instead of this_target_optabs. Hmmm, ok. I also added a default case setting this_fn_optabs = default_target_optabs when the optimizations haven't changed. I can remove this if redundant. No, sounds like a good plan, but I think it should be this_target_optabs rather than default_target_optabs. Gah, just realised after sending that it would be better to have: static void invoke_set_current_function_hook (tree fndecl) { this_fn_optabs = this_target_optabs; if (!in_dummy_function) { tree opts = ((fndecl) ? DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) : optimization_default_node); if (!opts) opts = optimization_default_node; /* Change optimization options if needed. */ if (optimization_current_node != opts) { optimization_current_node = opts; cl_optimization_restore (global_options, TREE_OPTIMIZATION (opts)); /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_fn_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); } targetm.set_current_function (fndecl); } } Richard
patch to fix PR56148
The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56148 The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev.195998. 2013-02-12 Vladimir Makarov vmaka...@redhat.com PR inline-asm/56148 * lra-constraints.c (process_alt_operands): Match early clobber operand with itself. Check conflicts with earlyclobber only if the operand is not reloaded. Prefer to reload conflicting operand if earlyclobber and matching operands are the same. 2013-02-12 Vladimir Makarov vmaka...@redhat.com PR inline-asm/56148 * gcc.target/i386/pr56148.c: New test. Index: lra-constraints.c === --- lra-constraints.c (revision 195902) +++ lra-constraints.c (working copy) @@ -1533,8 +1533,8 @@ process_alt_operands (int only_alternati if (! curr_static_id-operand[m].early_clobber || operand_reg[nop] == NULL_RTX || (find_regno_note (curr_insn, REG_DEAD, - REGNO (operand_reg[nop])) - != NULL_RTX)) + REGNO (op)) +|| REGNO (op) == REGNO (operand_reg[m]))) match_p = true; } if (match_p) @@ -2059,6 +2059,7 @@ process_alt_operands (int only_alternati if ((! curr_alt_win[i] ! curr_alt_match_win[i]) || hard_regno[i] 0) continue; + lra_assert (operand_reg[i] != NULL_RTX); clobbered_hard_regno = hard_regno[i]; CLEAR_HARD_REG_SET (temp_set); add_to_hard_reg_set (temp_set, biggest_mode[i], clobbered_hard_regno); @@ -2073,30 +2074,49 @@ process_alt_operands (int only_alternati else if ((curr_alt_matches[j] == i curr_alt_match_win[j]) || (curr_alt_matches[i] == j curr_alt_match_win[i])) continue; - else if (uses_hard_regs_p (*curr_id-operand_loc[j], temp_set)) + /* If we don't reload j-th operand, check conflicts. */ + else if ((curr_alt_win[j] || curr_alt_match_win[j]) + uses_hard_regs_p (*curr_id-operand_loc[j], temp_set)) break; if (j = n_operands) continue; - /* We need to reload early clobbered register. */ - for (j = 0; j n_operands; j++) - if (curr_alt_matches[j] == i) - { - curr_alt_match_win[j] = false; - losers++; - overall += LRA_LOSER_COST_FACTOR; - } - if (! curr_alt_match_win[i]) - curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++] = i; + /* If earlyclobber operand conflicts with another + non-matching operand which is actually the same register + as the earlyclobber operand, it is better to reload the + another operand as an operand matching the earlyclobber + operand can be also the same. */ + if (operand_reg[j] != NULL_RTX ! curr_alt_match_win[j] + REGNO (operand_reg[i]) == REGNO (operand_reg[j])) + { + curr_alt_win[j] = false; + curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++] = j; + losers++; + overall += LRA_LOSER_COST_FACTOR; + } else { - /* Remember pseudos used for match reloads are never - inherited. */ - lra_assert (curr_alt_matches[i] = 0); - curr_alt_win[curr_alt_matches[i]] = false; + /* We need to reload early clobbered register and the + matched registers. */ + for (j = 0; j n_operands; j++) + if (curr_alt_matches[j] == i) + { + curr_alt_match_win[j] = false; + losers++; + overall += LRA_LOSER_COST_FACTOR; + } + if (! curr_alt_match_win[i]) + curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++] = i; + else + { + /* Remember pseudos used for match reloads are never + inherited. */ + lra_assert (curr_alt_matches[i] = 0); + curr_alt_win[curr_alt_matches[i]] = false; + } + curr_alt_win[i] = curr_alt_match_win[i] = false; + losers++; + overall += LRA_LOSER_COST_FACTOR; } - curr_alt_win[i] = curr_alt_match_win[i] = false; - losers++; - overall += LRA_LOSER_COST_FACTOR; } small_class_operands_num = 0; for (nop = 0; nop n_operands; nop++) Index: testsuite/gcc.target/i386/pr56148.c === --- testsuite/gcc.target/i386/pr56148.c (revision 0) +++ testsuite/gcc.target/i386/pr56148.c (working copy) @@ -0,0 +1,12 @@ +/* PR inline-asm/56148 */ +/* { dg-do compile } */ +/* { dg-options -O2 } */ + +void +foo (void) +{ + unsigned char e[16]; + unsigned long a, b, c, d; + __asm__ __volatile__ ( : =d (a), =c (c), =D (d), =a (b) + : 0 (-1U), mr (e), 1 (128 5), 2 (e), 3 (-1U)); +}
Re: PR target/52555: attribute optimize is overriding command line options
Aldy Hernandez al...@redhat.com writes: Rather than: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_target_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_target_optabs = default_target_optabs; I think it'd be better to have: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_fn_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_fn_optabs = this_target_optabs; with genopinit.c updated to use this_fn_optabs instead of this_target_optabs. Hmmm, ok. I also added a default case setting this_fn_optabs = default_target_optabs when the optimizations haven't changed. I can remove this if redundant. No, sounds like a good plan, but I think it should be this_target_optabs rather than default_target_optabs. Also: @@ -76,11 +76,8 @@ struct target_optabs { }; extern struct target_optabs default_target_optabs; -#if SWITCHABLE_TARGET extern struct target_optabs *this_target_optabs; -#else -#define this_target_optabs (default_target_optabs) -#endif This shouldn't be needed now, and: @@ -44,8 +44,9 @@ along with GCC; see the file COPYING3. If not see struct target_optabs default_target_optabs; struct target_libfuncs default_target_libfuncs; -#if SWITCHABLE_TARGET struct target_optabs *this_target_optabs = default_target_optabs; +struct target_optabs *this_fn_optabs = default_target_optabs; +#if SWITCHABLE_TARGET struct target_libfuncs *this_target_libfuncs = default_target_libfuncs; #endif I think this should be: struct target_optabs default_target_optabs; struct target_libfuncs default_target_libfuncs; +struct target_optabs *this_fn_optabs = default_target_optabs; #if SWITCHABLE_TARGET struct target_optabs *this_target_optabs = default_target_optabs; struct target_libfuncs *this_target_libfuncs = default_target_libfuncs; #endif Looks good to me otherwise as far as switchable targets go. Richard
Re: [PATCH] Fix PR56181, rewrite fix_loop_structure
On 12 February 2013 15:38, Richard Biener rguent...@suse.de wrote: On Tue, 12 Feb 2013, Marcus Shawcroft wrote: Sorry, I'll send that again copying gcc-patches in this time... -- Forwarded message -- From: Marcus Shawcroft marcus.shawcr...@gmail.com Date: 12 February 2013 15:17 Subject: Re: [PATCH] Fix PR56181, rewrite fix_loop_structure To: Richard Biener rguent...@suse.de On 12 February 2013 14:54, Richard Biener rguent...@suse.de wrote: I can't reproduce this with a cross-compiler (--target=arm-non-eabi). How exactly did you configure? Please provide -v output. Richard. I don't see the issue in arm-none-eabi either, just arm-none-linux-gnueabi. --enable-shared --disable-libssp --disable-libmudflap --with-plugin-ld=arm-none-linux-gnueabi-ld --enable-languages=c,c++,fortran --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp I still can't reproduce it. I tried with pristine trunk rev. 195979. --target=arm-none-linux-gnueabi --enable-languages=c,c++,fortran --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp gcc ./cc1 -quiet pr54458.c -O3 -fomit-frame-pointer -g -I include gcc Richard. Richard, could you try that with -fPIC ? cc1 -O3 -fPIC -fomit-frame-pointer -g -quiet pr54458.c pr54458.c: In function ‘foo’: pr54458.c:20:1: error: loop with header 9 not in loop tree } ^ pr54458.c:20:1: error: loop with header 33 not in loop tree pr54458.c:20:1: error: loop with header 34 not in loop tree pr54458.c:20:1: internal compiler error: in verify_loop_structure, at cfgloop.c:1614 0x66c09c verify_loop_structure() /home/marcus/oban-work/work-trunk/src/gcc/gcc/cfgloop.c:1614 0x8f07fb unswitch_single_loop /home/marcus/oban-work/work-trunk/src/gcc/gcc/loop-unswitch.c:368 0x8eff2d unswitch_loops() /home/marcus/oban-work/work-trunk/src/gcc/gcc/loop-unswitch.c:147 0x8dd824 rtl_unswitch /home/marcus/oban-work/work-trunk/src/gcc/gcc/loop-init.c:441 Please submit a full bug report, Cheers /Marcus
Re: [PATCH] Fix bootstrap with -O3
On Sun, Feb 10, 2013 at 12:29:41AM +0100, Marc Glisse wrote: 2013-02-07 Marek Polacek pola...@redhat.com * c-parser.c (origtypes): Initialize to NULL. Maybe mention PR44938? (there may be a dup or two) Ok, I added that. (I thought it was the name of the function that went inside the parentheses in a ChangeLog entry) That's right, so I used something hopefully better this time around ;) Ok for trunk now? 2013-02-12 Marek Polacek pola...@redhat.com PR c/44938 * c-parser.c (c_parser_postfix_expression_after_primar): Initialize origtypes to NULL. --- gcc/c-parser.c.mp 2013-02-07 17:50:10.286742403 +0100 +++ gcc/c-parser.c 2013-02-07 17:50:23.331781876 +0100 @@ -6864,7 +6864,7 @@ c_parser_postfix_expression_after_primar tree sizeof_arg[3]; unsigned int i; vectree, va_gc *exprlist; - vectree, va_gc *origtypes; + vectree, va_gc *origtypes = NULL; while (true) { location_t op_loc = c_parser_peek_token (parser)-location; Marek
[GCC 4.8 changes] PATCH: Mention several user-visible changes for x86
Hi, This patch updates GCC 4.8 changes.html to mention Broadwell's features, RTM and HLE support and fixed pre-reload scheduler. OK to commit? Thanks, Igor Index: htdocs/gcc-4.8/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.95 diff -c -r1.95 changes.html *** htdocs/gcc-4.8/changes.html 11 Feb 2013 15:12:58 - 1.95 --- htdocs/gcc-4.8/changes.html 12 Feb 2013 15:10:41 - *** *** 460,465 --- 460,471 wrong results. You must build all modules with code-mpreferred-stack-boundary=3/code, including any libraries. This includes the system libraries and startup modules./li + liSupport for the new Intel processor codename Broadwell with RDSEED, + ADCX, ADOX, PREFETCHW is available through code-madx/code, + code-mprfchw/code, code-mrdseed/code. + /li + li Support for Intel RTM and HLE intrinsics, built-in functions and code generation is available via -mrtm and -mhle. + /li li New built-in functions to detect run-time CPU type and ISA: ul liA built-in function code__builtin_cpu_is/code has been added to *** *** 524,529 --- 530,538 a href=http://gcc.gnu.org/wiki/FunctionMultiVersioning;wiki/a for more information. /li + li Problem with instability of pre-reload scheduler on x86 targets was fixed. Now option -fschedule-insn + can be used loosely to reach better performance. + /li li Windows MinGW-w64 targets (code*-w64-mingw*/code) require at least r5437 from the Mingw-w64 trunk. /li /ul
[cxx-conversion] Add Record Builder Class
Add class record_builder to ease construction of records and unions. Use it in some appropriate places. Nathan please review the vxworks changes. tree.h New class record_builder. tree.c Implement record_builder member functions. asan.c Change asan_global_struct to use record_builder. coverage.c Change build_info_type() to use record_builder. It now takes a record_builder as a parameter and returns the tree representing the type. Change build_fn_info_type() to use record_builder. It now returns the tree representing the type. Modify coverage_obj_init() to call them appropriately. tree-mudflap.c Change mf_make_mf_cache_struct_type() to use record_builder. target.def Replace the emutls var_fields hook with object_type hook. The essential difference is that the hook is now responsible for full construction of the type, not just adding fields. targhooks.h Replace default_emutls_var_fields() with default_emutls_object_type(). tree-emutls.c Replace default_emutls_var_fields() with default_emutls_object_type(). Use record_builder within default_emutls_object_type(). Change get_emutls_object_type to use the new target hook. doc/tm.texi.in Replace TARGET_EMUTLS_VAR_FIELDS with TARGET_EMUTLS_OBJECT_TYPE. doc/tm.texi Replace TARGET_EMUTLS_VAR_FIELDS with TARGET_EMUTLS_OBJECT_TYPE. config/vxworks.c Replace vxworks_emutls_var_fields() with vxworks_emutls_object_type(). Use record_builder within vxworks_emutls_object_type(). Tested on x86_64. Tested with config-list.mk on vxworks targets. Index: gcc/tree-emutls.c === --- gcc/tree-emutls.c (revision 195904) +++ gcc/tree-emutls.c (working copy) @@ -103,41 +103,22 @@ get_emutls_object_name (tree name) return prefix_name (prefix, name); } -/* Create the fields of the type for the control variables. Ordinarily +/* Create the type for the control variables. Ordinarily this must match struct __emutls_object defined in emutls.c. However this is a target hook so that VxWorks can define its own layout. */ tree -default_emutls_var_fields (tree type, tree *name ATTRIBUTE_UNUSED) +default_emutls_object_type (void) { - tree word_type_node, field, next_field; - - field = build_decl (UNKNOWN_LOCATION, - FIELD_DECL, get_identifier (__templ), ptr_type_node); - DECL_CONTEXT (field) = type; - next_field = field; - - field = build_decl (UNKNOWN_LOCATION, - FIELD_DECL, get_identifier (__offset), - ptr_type_node); - DECL_CONTEXT (field) = type; - DECL_CHAIN (field) = next_field; - next_field = field; - - word_type_node = lang_hooks.types.type_for_mode (word_mode, 1); - field = build_decl (UNKNOWN_LOCATION, - FIELD_DECL, get_identifier (__align), - word_type_node); - DECL_CONTEXT (field) = type; - DECL_CHAIN (field) = next_field; - next_field = field; - - field = build_decl (UNKNOWN_LOCATION, - FIELD_DECL, get_identifier (__size), word_type_node); - DECL_CONTEXT (field) = type; - DECL_CHAIN (field) = next_field; - - return field; + tree word_type_node = lang_hooks.types.type_for_mode (word_mode, 1); + record_builder rec; + rec.add_field (__size, word_type_node); + rec.add_field (__align, word_type_node); + rec.add_field (__offset, ptr_type_node); + rec.add_field (__templ, ptr_type_node); + rec.layout (); + rec.decl_name (__emutls_object); + return rec.as_tree (); } /* Initialize emulated tls object TO, which refers to TLS variable DECL and @@ -182,24 +163,9 @@ default_emutls_var_init (tree to, tree d static tree get_emutls_object_type (void) { - tree type, type_name, field; - - type = emutls_object_type; - if (type) -return type; - - emutls_object_type = type = lang_hooks.types.make_type (RECORD_TYPE); - type_name = NULL; - field = targetm.emutls.var_fields (type, type_name); - if (!type_name) -type_name = get_identifier (__emutls_object); - type_name = build_decl (UNKNOWN_LOCATION, - TYPE_DECL, type_name, type); - TYPE_NAME (type) = type_name; - TYPE_FIELDS (type) = field; - layout_type (type); - - return type; + if (!emutls_object_type) +emutls_object_type = targetm.emutls.object_type (); + return emutls_object_type; } /* Create a read-only variable like DECL, with the same DECL_INITIAL. Index: gcc/asan.c === --- gcc/asan.c (revision 195904) +++ gcc/asan.c (working copy) @@ -1496,28 +1496,16 @@ transform_statements (void) static tree asan_global_struct (void) { - static const char *field_names[5] -= { __beg, __size, __size_with_redzone, - __name, __has_dynamic_init }; - tree fields[5], ret; - int i; - - ret = make_node (RECORD_TYPE); -
Re: [PATCH] Fix bootstrap with -O3
On Tue, Feb 12, 2013 at 08:26:37PM +0100, Marek Polacek wrote: That's right, so I used something hopefully better this time around ;) Ok for trunk now? 2013-02-12 Marek Polacek pola...@redhat.com PR c/44938 * c-parser.c (c_parser_postfix_expression_after_primar): Initialize The function is called c_parser_postfix_expression_after_primary, not c_parser_postfix_expression_after_primar, that is just diff truncating too long names; please fix that up. origtypes to NULL. Ok, thanks. --- gcc/c-parser.c.mp 2013-02-07 17:50:10.286742403 +0100 +++ gcc/c-parser.c2013-02-07 17:50:23.331781876 +0100 @@ -6864,7 +6864,7 @@ c_parser_postfix_expression_after_primar tree sizeof_arg[3]; unsigned int i; vectree, va_gc *exprlist; - vectree, va_gc *origtypes; + vectree, va_gc *origtypes = NULL; while (true) { location_t op_loc = c_parser_peek_token (parser)-location; Marek Jakub
Re: [GCC 4.8 changes] PATCH: Mention several user-visible changes for x86
On Tue, Feb 12, 2013 at 8:45 PM, Igor Zamyatin izamya...@gmail.com wrote: This patch updates GCC 4.8 changes.html to mention Broadwell's features, RTM and HLE support and fixed pre-reload scheduler. OK to commit? Thanks, Igor Index: htdocs/gcc-4.8/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.95 diff -c -r1.95 changes.html *** htdocs/gcc-4.8/changes.html 11 Feb 2013 15:12:58 - 1.95 --- htdocs/gcc-4.8/changes.html 12 Feb 2013 15:10:41 - *** *** 460,465 --- 460,471 wrong results. You must build all modules with code-mpreferred-stack-boundary=3/code, including any libraries. This includes the system libraries and startup modules./li + liSupport for the new Intel processor codename Broadwell with RDSEED, + ADCX, ADOX, PREFETCHW is available through code-madx/code, + code-mprfchw/code, code-mrdseed/code. + /li + li Support for Intel RTM and HLE intrinsics, built-in functions and code generation is available via -mrtm and -mhle. + /li Please also mention new -mfxsr, -mxsave and -mxsaveopt options. li New built-in functions to detect run-time CPU type and ISA: ul liA built-in function code__builtin_cpu_is/code has been added to *** *** 524,529 --- 530,538 a href=http://gcc.gnu.org/wiki/FunctionMultiVersioning;wiki/a for more information. /li + li Problem with instability of pre-reload scheduler on x86 targets was fixed. Now option -fschedule-insn + can be used loosely to reach better performance. used loosely in what sense? Thanks, Uros.
Re: [PATCH] Fix bootstrap with -O3
On Tue, Feb 12, 2013 at 08:52:27PM +0100, Jakub Jelinek wrote: On Tue, Feb 12, 2013 at 08:26:37PM +0100, Marek Polacek wrote: That's right, so I used something hopefully better this time around ;) Ok for trunk now? 2013-02-12 Marek Polacek pola...@redhat.com PR c/44938 * c-parser.c (c_parser_postfix_expression_after_primar): Initialize The function is called c_parser_postfix_expression_after_primary, not c_parser_postfix_expression_after_primar, that is just diff truncating too long names; please fix that up. Thanks for noticing, I used auto-completing of words... I'll fix it up and commit. Marek
Re: [PATCH] Fix bootstrap with -O3
On 12/02/13 19:59, Marek Polacek wrote: Thanks for noticing, I used auto-completing of words... I'll fix it up and commit. Marek Why did this occur? I am curious. Alec
C++ PATCH for c++/56285 (wrong error with inheriting ctor)
We need to move for rvalue ref parms as well as value ones. Tested x86_64-pc-linux-gnu, applying to trunk. commit 29189e48dc7a62ff6a3a67984dbc64f4ada72862 Author: Jason Merrill ja...@redhat.com Date: Tue Feb 12 12:56:52 2013 -0500 PR c++/56285 * method.c (add_one_base_init): Handle base constructor taking rvalue reference parm. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index a1bab95..ff29b59 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -500,7 +500,8 @@ add_one_base_init (tree binfo, tree parm, bool move_p, tree inh, for (; parm; parm = DECL_CHAIN (parm)) { tree exp = convert_from_reference (parm); - if (TREE_CODE (TREE_TYPE (parm)) != REFERENCE_TYPE) + if (TREE_CODE (TREE_TYPE (parm)) != REFERENCE_TYPE + || TYPE_REF_IS_RVALUE (TREE_TYPE (parm))) exp = move (exp); *p = build_tree_list (NULL_TREE, exp); p = TREE_CHAIN (*p); diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C new file mode 100644 index 000..58e848b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C @@ -0,0 +1,15 @@ +// PR c++/56285 +// { dg-options -std=c++11 } + +struct foo { +explicit foo(int) {} +}; + +struct bar: private foo { +using foo::foo; +}; + +int main() +{ +bar b { 42 }; +}
[google 4_7] Fix bad merge into coverage_init (issue7322063)
This patch fixes a bad merge from google/integration to google/4_7. Passes regression tests. Ok for google/4_7? Thanks, Teresa 2013-02-12 Teresa Johnson tejohn...@google.com * coverage.c (coverage_init): Move test coverage handling to the correct location within coverage_init (as in trunk) to avoid overlapping gcov_open calls. Index: coverage.c === --- coverage.c (revision 195984) +++ coverage.c (working copy) @@ -2635,25 +2635,6 @@ coverage_init (const char *filename, const char* s da_base_file_name = XNEWVEC (char, strlen (filename) + 1); strcpy (da_base_file_name, filename); - /* Name of bbg file. */ - if (flag_test_coverage !flag_compare_debug) -{ - bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); - memcpy (bbg_file_name, filename, len); - strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); - if (!gcov_open (bbg_file_name, -1)) - { - error (cannot open %s, bbg_file_name); - bbg_file_name = NULL; - } - else - { - gcov_write_unsigned (GCOV_NOTE_MAGIC); - gcov_write_unsigned (GCOV_VERSION); - gcov_write_unsigned (local_tick); - } -} - if (profile_data_prefix == 0 !IS_ABSOLUTE_PATH (source_name)) { src_name_prefix = getpwd (); @@ -2698,6 +2679,25 @@ coverage_init (const char *filename, const char* s } if (flag_auto_profile) init_auto_profile (); + + /* Name of bbg file. */ + if (flag_test_coverage !flag_compare_debug) +{ + bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); + memcpy (bbg_file_name, filename, len); + strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); + if (!gcov_open (bbg_file_name, -1)) + { + error (cannot open %s, bbg_file_name); + bbg_file_name = NULL; + } + else + { + gcov_write_unsigned (GCOV_NOTE_MAGIC); + gcov_write_unsigned (GCOV_VERSION); + gcov_write_unsigned (local_tick); + } +} } /* Return True if any type of profiling is enabled which requires linking -- This patch is available for review at http://codereview.appspot.com/7322063
Re: [google 4_7] Fix bad merge into coverage_init (issue7322063)
ok. The same problem exists in google/main too. David On Tue, Feb 12, 2013 at 1:38 PM, Teresa Johnson tejohn...@google.com wrote: This patch fixes a bad merge from google/integration to google/4_7. Passes regression tests. Ok for google/4_7? Thanks, Teresa 2013-02-12 Teresa Johnson tejohn...@google.com * coverage.c (coverage_init): Move test coverage handling to the correct location within coverage_init (as in trunk) to avoid overlapping gcov_open calls. Index: coverage.c === --- coverage.c (revision 195984) +++ coverage.c (working copy) @@ -2635,25 +2635,6 @@ coverage_init (const char *filename, const char* s da_base_file_name = XNEWVEC (char, strlen (filename) + 1); strcpy (da_base_file_name, filename); - /* Name of bbg file. */ - if (flag_test_coverage !flag_compare_debug) -{ - bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); - memcpy (bbg_file_name, filename, len); - strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); - if (!gcov_open (bbg_file_name, -1)) - { - error (cannot open %s, bbg_file_name); - bbg_file_name = NULL; - } - else - { - gcov_write_unsigned (GCOV_NOTE_MAGIC); - gcov_write_unsigned (GCOV_VERSION); - gcov_write_unsigned (local_tick); - } -} - if (profile_data_prefix == 0 !IS_ABSOLUTE_PATH (source_name)) { src_name_prefix = getpwd (); @@ -2698,6 +2679,25 @@ coverage_init (const char *filename, const char* s } if (flag_auto_profile) init_auto_profile (); + + /* Name of bbg file. */ + if (flag_test_coverage !flag_compare_debug) +{ + bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); + memcpy (bbg_file_name, filename, len); + strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); + if (!gcov_open (bbg_file_name, -1)) + { + error (cannot open %s, bbg_file_name); + bbg_file_name = NULL; + } + else + { + gcov_write_unsigned (GCOV_NOTE_MAGIC); + gcov_write_unsigned (GCOV_VERSION); + gcov_write_unsigned (local_tick); + } +} } /* Return True if any type of profiling is enabled which requires linking -- This patch is available for review at http://codereview.appspot.com/7322063
Re: [google 4_7] Fix bad merge into coverage_init (issue7322063)
Ok, I will apply the same fix to google/main after appropriate testing. Teresa On Tue, Feb 12, 2013 at 1:54 PM, Xinliang David Li davi...@google.com wrote: ok. The same problem exists in google/main too. David On Tue, Feb 12, 2013 at 1:38 PM, Teresa Johnson tejohn...@google.com wrote: This patch fixes a bad merge from google/integration to google/4_7. Passes regression tests. Ok for google/4_7? Thanks, Teresa 2013-02-12 Teresa Johnson tejohn...@google.com * coverage.c (coverage_init): Move test coverage handling to the correct location within coverage_init (as in trunk) to avoid overlapping gcov_open calls. Index: coverage.c === --- coverage.c (revision 195984) +++ coverage.c (working copy) @@ -2635,25 +2635,6 @@ coverage_init (const char *filename, const char* s da_base_file_name = XNEWVEC (char, strlen (filename) + 1); strcpy (da_base_file_name, filename); - /* Name of bbg file. */ - if (flag_test_coverage !flag_compare_debug) -{ - bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); - memcpy (bbg_file_name, filename, len); - strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); - if (!gcov_open (bbg_file_name, -1)) - { - error (cannot open %s, bbg_file_name); - bbg_file_name = NULL; - } - else - { - gcov_write_unsigned (GCOV_NOTE_MAGIC); - gcov_write_unsigned (GCOV_VERSION); - gcov_write_unsigned (local_tick); - } -} - if (profile_data_prefix == 0 !IS_ABSOLUTE_PATH (source_name)) { src_name_prefix = getpwd (); @@ -2698,6 +2679,25 @@ coverage_init (const char *filename, const char* s } if (flag_auto_profile) init_auto_profile (); + + /* Name of bbg file. */ + if (flag_test_coverage !flag_compare_debug) +{ + bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); + memcpy (bbg_file_name, filename, len); + strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); + if (!gcov_open (bbg_file_name, -1)) + { + error (cannot open %s, bbg_file_name); + bbg_file_name = NULL; + } + else + { + gcov_write_unsigned (GCOV_NOTE_MAGIC); + gcov_write_unsigned (GCOV_VERSION); + gcov_write_unsigned (local_tick); + } +} } /* Return True if any type of profiling is enabled which requires linking -- This patch is available for review at http://codereview.appspot.com/7322063 -- Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
Re: expansion of vector shifts...
From: David Miller da...@redhat.com Date: Fri, 16 Nov 2012 00:33:05 -0500 (EST) From: Richard Sandiford rdsandif...@googlemail.com Date: Mon, 29 Oct 2012 10:14:53 + ...given that the code is like you say written: if (SHIFT_COUNT_TRUNCATED) { if (CONST_INT_P (op1) ... else if (GET_CODE (op1) == SUBREG subreg_lowpart_p (op1) INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1 op1 = SUBREG_REG (op1); } INTEGRAL_MODE_P (GET_MODE (op1)) might be better than an explicit VECTOR_MODE_P check. The code really doesn't make sense for anything other than integers. (It amounts to the same thing in practice, of course...) Agreed, I've just committed the following. Thanks! Fix gcc.c-torture/compile/pr53410-2.c on sparc. * expmed.c (expand_shift_1): Don't strip non-integral SUBREGs. This is broken on sparc again, although I'm confused about how this has happened. The suggestion was to use INTEGRAL_MODE_P as the test, so what's there in expand_shift_1() is: else if (GET_CODE (op1) == SUBREG subreg_lowpart_p (op1) INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))) INTEGRAL_MODE_P (GET_MODE (op1))) op1 = SUBREG_REG (op1); but INTEGRAL_MODE_P accepts vectors. This is really confusing because I was absolutely sure I re-ran the test case with the fix I committed and it didn't crash any more. Maybe what we really mean to do here is check both op1 and SUBREG_REG (op1) against SCALAR_INT_MODE_P instead of INTEGRAL_MODE_P? Something like this: gcc/ 2013-02-12 David S. Miller da...@davemloft.net * expmed.c (expand_shift_1): Only strip scalar integer subregs. diff --git a/gcc/expmed.c b/gcc/expmed.c index 4a6ddb0..954a360 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2116,8 +2116,8 @@ expand_shift_1 (enum tree_code code, enum machine_mode mode, rtx shifted, % GET_MODE_BITSIZE (mode)); else if (GET_CODE (op1) == SUBREG subreg_lowpart_p (op1) - INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))) - INTEGRAL_MODE_P (GET_MODE (op1))) + SCALAR_INT_MODE_P (GET_MODE (SUBREG_REG (op1))) + SCALAR_INT_MODE_P (GET_MODE (op1))) op1 = SUBREG_REG (op1); }
Re: [PATCH] Fix bootstrap with -O3
On Tue, Feb 12, 2013 at 08:21:06PM +, Alec Teal wrote: Why did this occur? I am curious. It is caused by -fipa-cp-clone, which -O3 entails. Marek