RE: [PATCH] Fix PR50293 - LTO plugin with space in path
On Mon, 18 Feb 2013, Joey Ye wrote: > +static char * convert_white_space (char *); No space after "*". > - linker_plugin_file_spec = find_a_file (&exec_prefixes, > + char * temp_spec = find_a_file (&exec_prefixes, >LTOPLUGINSONAME, R_OK, >false); The indentation of the following lines looks odd after this patch; unless that's just an effect of TABs plus quoting, make sure they are reindented to line up with the new position of the opening '('. > +/* Insert back slash before spaces in orig (usually a file path), to Capitalize variable names when referring to the value of the variable, so ORIG; likewise elsewhere in this comment. Single work "backslash". > + the filename should be treated as a single argument rather than being "file name" should be two words, according to the GNU Coding Standards. > + This function converts and only converts all occurrance of ' ' "occurrence" > + Return: orig if no conversion needed. orig if conversion needed but no > + sufficient memory for a new string. Otherwise a newly allocated string Returning wrong results on insufficient memory doesn't make sense. Anyway, xmalloc always exits the program if there is insufficient memory, so you don't need any code to allow for that case. > +static char * convert_white_space (char *orig) Newline, not space, between return type and function name, so that the function name comes at the start of the line. > + if (orig == NULL) return orig; The comment didn't mention NULL as a valid argument, and it doesn't appear NULL can actually be passed to this function. So don't include code to handle that case. > + for (len=0; orig[len]; len++) Spaces around "=". > +if (orig[len] == ' ' || orig[len] == '\t') number_of_space ++; No space before "++", but put the body of the "if" on a separate line. > + char * new_spec = (char *)xmalloc (len + number_of_space + 1); No space after "*". Space in the cast after "(char *)". > + int j,k; Space after ",". > + if (new_spec == NULL) return orig; As discussed above, not needed. > + for (j=0, k=0; j<=len; j++, k++) Spaces around "=" and "<=". > + if (orig[j] == ' ' || orig[j] == '\t') new_spec[k++] = '\\'; Put the "if" both on a separate line. > + else return orig; Put the "else" body on a separate line. -- Joseph S. Myers jos...@codesourcery.com
Re: [Patch, microblaze]: Add support for swap instructions and reorder option
On 02/27/2013 04:36 PM, David Holsgrove wrote: -Original Message- From: Michael Eager [mailto:ea...@eagercon.com] Sent: Thursday, 28 February 2013 3:06 am To: David Holsgrove Cc: Michael Eager; gcc-patches@gcc.gnu.org; John Williams; Edgar E. Iglesias (edgar.igles...@gmail.com); Vinod Kathail; Vidhumouli Hunsigida; Nagaraju Mekala; Tom Shui Subject: Re: [Patch, microblaze]: Add support for swap instructions and reorder option The purpose is to avoid issuing a warning for processors before 8.30.a unless the user explicitly specifies -mxl-reorder. Warning the user who explicitly specifies -mxl-reorder with cpu before v8.30.a is the first goal, but we also need to prevent the usage of swap instructions by default if they are not possible to use. I think that the code can be reordered to make it clearer. Replace this + /* TARGET_REORDER initialised as 2 in microblaze.opt, + passing -mxl-reorder sets TARGET_REORDER to 1, + and passing -mno-xl-reorder sets TARGET_REORDER to 0. */ + ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.30.a"); + if (ver < 0) +{ +/* MicroBlaze prior to 8.30a didn't have swapb or swaph insns, + so if -mxl-reorder passed, warn and clear TARGET_REORDER. */ +if (TARGET_REORDER == 1) + warning (0, + "-mxl-reorder can be used only with -mcpu=v8.30.a or greater"); +TARGET_REORDER = 0; +} + else if (ver == 0) +{ +/* MicroBlaze v8.30a requires pattern compare for + swapb / swaph insns. */ +if (!TARGET_PATTERN_COMPARE) + TARGET_REORDER = 0; +} With this: /* TARGET_REORDER defaults to 2 if -mxl-reorder not specified. */ if (TARGET_REORDER == 1) { ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.30.a"); if (ver < 0) { warning (0, "-mxl-reorder can be used only with -mcpu=v8.30.a or greater"); TARGET_REORDER = 0; } else if ((ver == 0) && !TARGET_PATTERN_COMPARE) { warning (0, "-mxl-reorder requires -mxl-pattern-compare for -mcpu=v8.30.a"); TARGET_REORDER = 0; } } So if we switch to your alternative, the default case (TARGET_REORDER=2) will not be checked for cpu version, or use of TARGET_PATTERN_COMPARE, meaning we emit swap instructions which aren’t valid for these situations. Adjusting your if statement to be; if (TARGET_REORDER) would catch the default case along with explicit use of -mxl-reorder, but then we would also be issuing the warnings for every compilation where cpu is less than v8.30.a, or the user hasn’t passed -mxl-pattern-compare. My attached patch will warn the user if they've explicitly used -mxl-reorder and don’t meet the requirements, and will adjust the default case silently if required. +mxl-reorder +Target Var(TARGET_REORDER) Init(2) +Use reorder instructions (default) Change to +Use reorder instructions (swap and byte reversed load/store) (default) Yes thanks, this is a clearer definition of the intent behind the option. I'll check in the patch with these changes unless you have objections. thanks again for the review, please let me know if this patch is acceptable. David Committed revision 196415. Please submit a patch to update gcc/doc/invoke.texi with -mxl-reorder description. -- Michael Eagerea...@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
New Swedish PO file for 'gcc' (version 4.8-b20130224)
Hello, gentle maintainer. This is a message from the Translation Project robot. A revised PO file for textual domain 'gcc' has been submitted by the Swedish team of translators. The file is available at: http://translationproject.org/latest/gcc/sv.po (This file, 'gcc-4.8-b20130224.sv.po', has just now been sent to you in a separate email.) All other PO files for your package are available in: http://translationproject.org/latest/gcc/ Please consider including all of these in your next release, whether official or a pretest. Whenever you have a new distribution with a new version number ready, containing a newer POT file, please send the URL of that distribution tarball to the address below. The tarball may be just a pretest or a snapshot, it does not even have to compile. It is just used by the translators when they need some extra translation context. The following HTML page has been updated: http://translationproject.org/domain/gcc.html If any question arises, please contact the translation coordinator. Thank you for all your work, The Translation Project robot, in the name of your translation coordinator.
[Patch, fortran] PR56477 ICE on pointer assignment checking
Hello, I'm testing the attached patch which fixes the PR56477 test case. Will commit as obvious tonight. Mikael 2013-03-03 Mikael Morin PR fortran/56477 * expr.c (gfc_check_pointer_assign): Avoid NULL pointer dereference. 2013-03-03 Mikael Morin PR fortran/56477 * gfortran.dg/pointer_check_13.f90: New test. Index: fortran/expr.c === --- fortran/expr.c (révision 196416) +++ fortran/expr.c (copie de travail) @@ -3732,7 +3732,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_ex && rvalue->symtree->n.sym->ns->proc_name->attr.flavor != FL_PROCEDURE && rvalue->symtree->n.sym->ns->proc_name->attr.flavor != FL_PROGRAM) for (ns = rvalue->symtree->n.sym->ns; - ns->proc_name && ns->proc_name->attr.flavor != FL_PROCEDURE; + ns && ns->proc_name && ns->proc_name->attr.flavor != FL_PROCEDURE; ns = ns->parent) if (ns->parent == lvalue->symtree->n.sym->ns) warn = true; ! { dg-do compile } ! ! PR fortran/56477 ! The pointer target live range checking code using to trigger an ICE on ! the following ! ! Contributed by Andrew Benson ! module s contains function so() implicit none integer, target :: so integer, pointer :: sp sp => so return end function So end module s
Re: [PATCH] Fix PR50293 - LTO plugin with space in path
Joey Ye schrieb: Ping Subject: RE: [PATCH] Fix PR50293 - LTO plugin with space in path Does this patch also work with MS-Windows as host, i.e. with \ as path separator? +static char * convert_white_space(char * orig); Please fix formatting in many places in this patch to follow the GNU Coding Standards. No space after '*', but space before '('; there seem to be various other formatting problems as well. My bad. All fixed. +/* Insert back slash before spaces in a string, to avoid path + that has space in it broken into multiple arguments. */ That doesn't seem to be a proper specification of the interface to this function. What are the semantics of ORIG? A string that is a filename, or something else? What are the exact semantics of the return value for quoting - is it correct for the function to convert a (backslash, space) pair to (backslash, backslash, space) or not? Is anything special in the return value other than backslash and space, and how are any special characters in the return value to be interpreted? As it seems like this function frees the argument (why?) this also needs to be specified in the comment as part of the semantics of the function. This function might need a string longer than original one to accommodate additional back slashes. So it has to xmalloc a new string. The original string should be freed in such a case. However, it is tedious to caller to figure out that conversion does happens and free the orig. The solution is for this function to free it when conversion happens. By doing so it is required that orig must be allocated and can be freed, as the newly added comments described explicitly. It would be a good idea for you to give a more detailed explanation in the next version of the patch submission of how the path, before the patch, got processed so that the spaces were wrongly interpreted. That might help make clearer whether the interface to this new function is actually correct, since the subsequent operations on the return value should act as an inverse to the operation carried out by this function. -- Joseph S. Myers jos...@codesourcery.com Index: gcc/gcc.c === --- gcc/gcc.c (revision 195189) +++ gcc/gcc.c (working copy) @@ -265,6 +265,7 @@ static const char *compare_debug_auxbase_opt_spec_function (int, const char **); static const char *pass_through_libs_spec_func (int, const char **); static const char *replace_extension_spec_func (int, const char **); +static char * convert_white_space (char *); /* The Specs Language @@ -6595,6 +6596,7 @@ X_OK, false); if (lto_wrapper_file) { + lto_wrapper_file = convert_white_space (lto_wrapper_file); lto_wrapper_spec = lto_wrapper_file; obstack_init (&collect_obstack); obstack_grow (&collect_obstack, "COLLECT_LTO_WRAPPER=", @@ -7005,12 +7007,13 @@ + strlen (fuse_linker_plugin), 0)) #endif { - linker_plugin_file_spec = find_a_file (&exec_prefixes, + char * temp_spec = find_a_file (&exec_prefixes, LTOPLUGINSONAME, R_OK, false); - if (!linker_plugin_file_spec) + if (!temp_spec) fatal_error ("-fuse-linker-plugin, but %s not found", LTOPLUGINSONAME); + linker_plugin_file_spec = convert_white_space (temp_spec); } #endif lto_gcc_spec = argv[0]; @@ -8506,3 +8509,52 @@ free (name); return result; } + +/* Insert back slash before spaces in orig (usually a file path), to + avoid being broken by spec parser. + + This function is needed as do_spec_1 treats white space (' ' and '\t') + as the end of an argument. But in case of -plugin /usr/gcc install/xxx.so, + the filename should be treated as a single argument rather than being + broken into multiple. Solution is to insert '\\' before the space in a + filename. + + This function converts and only converts all occurrance of ' ' + to '\\' + ' ' and '\t' to '\\' + '\t'. For example: + "a b" -> "a\\ b" + "a b" -> "a\\ \\ b" + "a\tb" -> "a\\\tb" + "a\\ b" -> "a b" + + orig: input null-terminating string that was allocated by xalloc. The + memory it points to might be freed in this function. Behavior undefined + if orig isn't xalloced or is freed already at entry. + + Return: orig if no conversion needed. orig if conversion needed but no + sufficient memory for a new string. Otherwise a newly allocated string + that was converted from orig. */ + +static char * convert_white_space (char *orig) +{ + int len, number_of_space = 0; + if (orig == NULL) return orig; + + for (len=0; orig[len]; len++) +if (orig[len] == ' ' || orig[len] == '\t') number_of_space ++; + + if (number_of_space) +
[patch, committed] internal documentation for TARGET_OPTION_PRAGMA_PARSE
I was finding the internal documentation for TARGET_OPTION_PRAGMA_PARSE and friends confusing until I realized that it had never been updated after #pragma gcc option was renamed to #pragma gcc target, back in 2008: http://gcc.gnu.org/ml/gcc-patches/2008-08/msg02394.html I've checked in this patch to make that change to tm.texi, plus a little copy-editing to improve readability. I also updated the comments in target.def similarly. I think this qualifies as "obvious" as well as being appropriate for the current trunk stage at least it's an incremental improvement over the current docs. ;-) -Sandra 2013-03-03 Sandra Loosemore gcc/ * target.def (TARGET_OPTION_VALID_ATTRIBUTE_P): Update comments; the attribute is now called "target" instead of "option". (TARGET_OPTION_PRAGMA_PARSE): Likewise, for the pragma. * doc/tm.texi.in (Target Attributes): Likewise document the correct attribute/pragma name for TARGET_OPTION_VALID_P and TARGET_OPTION_PRAGMA_PARSE. Also copy-edit and correct markup. * doc/tm.texi: Regenerated. Index: gcc/target.def === --- gcc/target.def (revision 196416) +++ gcc/target.def (working copy) @@ -2774,9 +2774,9 @@ HOOK_VECTOR_END (emutls) #define HOOK_PREFIX "TARGET_OPTION_" HOOK_VECTOR (TARGET_OPTION_HOOKS, target_option_hooks) -/* Function to validate the attribute((option(...))) strings or NULL. If - the option is validated, it is assumed that DECL_FUNCTION_SPECIFIC will - be filled in in the function decl node. */ +/* Function to validate the attribute((target(...))) strings. If + the option is validated, the hook should also fill in + DECL_FUNCTION_SPECIFIC_TARGET in the function decl node. */ DEFHOOK (valid_attribute_p, "", @@ -2803,11 +2803,10 @@ DEFHOOK "", void, (FILE *file, int indent, struct cl_target_option *ptr), NULL) -/* Function to parse arguments to be validated for #pragma option, and to +/* Function to parse arguments to be validated for #pragma target, and to change the state if the options are valid. If the first argument is NULL, the second argument specifies the default options to use. Return true if the options are valid, and set the current state. */ -/* ??? The documentation in tm.texi is incomplete. */ DEFHOOK (pragma_parse, "", Index: gcc/doc/tm.texi.in === --- gcc/doc/tm.texi.in (revision 196416) +++ gcc/doc/tm.texi.in (working copy) @@ -9709,40 +9709,40 @@ target specific attribute attached to it @end deftypefn @hook TARGET_OPTION_VALID_ATTRIBUTE_P -This hook is called to parse the @code{attribute(option("..."))}, and -it allows the function to set different target machine compile time -options for the current function that might be different than the -options specified on the command line. The hook should return +This hook is called to parse @code{attribute(target("..."))}, which +allows setting target-specific options on individual functions. +These function-specific options may differ +from the options specified on the command line. The hook should return @code{true} if the options are valid. -The hook should set the @var{DECL_FUNCTION_SPECIFIC_TARGET} field in -the function declaration to hold a pointer to a target specific -@var{struct cl_target_option} structure. +The hook should set the @code{DECL_FUNCTION_SPECIFIC_TARGET} field in +the function declaration to hold a pointer to a target-specific +@code{struct cl_target_option} structure. @end deftypefn @hook TARGET_OPTION_SAVE -This hook is called to save any additional target specific information -in the @var{struct cl_target_option} structure for function specific +This hook is called to save any additional target-specific information +in the @code{struct cl_target_option} structure for function-specific options. @xref{Option file format}. @end deftypefn @hook TARGET_OPTION_RESTORE -This hook is called to restore any additional target specific -information in the @var{struct cl_target_option} structure for -function specific options. +This hook is called to restore any additional target-specific +information in the @code{struct cl_target_option} structure for +function-specific options. @end deftypefn @hook TARGET_OPTION_PRINT -This hook is called to print any additional target specific -information in the @var{struct cl_target_option} structure for -function specific options. +This hook is called to print any additional target-specific +information in the @code{struct cl_target_option} structure for +function-specific options. @end deftypefn @hook TARGET_OPTION_PRAGMA_PARSE -This target hook parses the options for @code{#pragma GCC option} to -set the machine specific options for functions that occur later in the -input stream. The options should be the same as handled by the +This target hook parses the options for @code{#pragma GCC target}, which +sets the target-speci
[PATCH] Skip some vect tests on AIX.
AIX does not support 64 bit instructions in 32 bit addressing mode. * vect/vect-82_64.c: Skip on AIX. * vect/vect-83_64.c: Same. Index: vect-82_64.c === --- vect-82_64.c(revision 196418) +++ vect-82_64.c(working copy) @@ -1,6 +1,7 @@ /* { dg-do run { target { { powerpc*-*-* && lp64 } && powerpc_altivec_ok } } } */ /* { dg-do compile { target { { powerpc*-*-* && ilp32 } && powerpc_altivec_ok } } } */ /* { dg-options "-O2 -ftree-vectorize -mpowerpc64 -fdump-tree-vect-details -maltivec" } */ +/* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ #include #include "tree-vect.h" Index: vect-83_64.c === --- vect-83_64.c(revision 196418) +++ vect-83_64.c(working copy) @@ -1,6 +1,7 @@ /* { dg-do run { target { { powerpc*-*-* && lp64 } && powerpc_altivec_ok } } } */ /* { dg-do compile { target { { powerpc*-*-* && ilp32 } && powerpc_altivec_ok } } } */ /* { dg-options "-O2 -ftree-vectorize -mpowerpc64 -fdump-tree-vect-details -maltivec" } */ +/* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ #include #include "tree-vect.h"
Ping: [PATCH][ARM] GCC command line support for Cortex-R7
Ping... The patch is at http://gcc.gnu.org/ml/gcc-patches/2013-02/msg01105.html. BR, Terry > -Original Message- > From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches- > ow...@gcc.gnu.org] On Behalf Of Terry Guo > Sent: Monday, February 25, 2013 10:23 AM > To: gcc-patches@gcc.gnu.org > Subject: [PATCH][ARM] GCC command line support for Cortex-R7 > > Hi, > > This patch is to enable GCC to accept new command line option - > mcpu=cortex-r7. Is it OK to trunk? > > BR, > Terry > > 2013-02-25 Terry Guo > > * config/arm/arm-cores.def: Added core cortex-r7. > * config/arm/arm-tune.md: Regenerated. > * config/arm/arm-tables.opt: Regenerated. > * doc/invoke.texi: Added entry for core cortex-r7.
von Mises distribution improvement
I'd like to check in this patch which would improve the performance of the distribution quite a bit by pulling constant computations into the constructor. This patch will change the memory layout which can be done easily only now. It also fixes one small bug in operator== and in a comment. OK? Index: libstdc++-v3/include/ext/random === --- libstdc++-v3/include/ext/random (revision 196416) +++ libstdc++-v3/include/ext/random (working copy) @@ -2621,6 +2621,12 @@ const _RealType __pi = __gnu_cxx::__math_constants<_RealType>::__pi; _GLIBCXX_DEBUG_ASSERT(_M_mu >= -__pi && _M_mu <= __pi); _GLIBCXX_DEBUG_ASSERT(_M_kappa >= _RealType(0)); + + auto __tau = std::sqrt(_RealType(4) * _M_kappa * _M_kappa + + _RealType(1)) + _RealType(1); + auto __rho = ((__tau - std::sqrt(_RealType(2) * __tau)) + / (_RealType(2) * _M_kappa)); + _M_r = (_RealType(1) + __rho * __rho) / (_RealType(2) * __rho); } _RealType @@ -2633,16 +2639,17 @@ friend bool operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_kappa == __p2._M_kappa; } + { return (__p1._M_mu == __p2._M_mu + && __p1._M_kappa == __p2._M_kappa); } private: - _RealType _M_mu; _RealType _M_kappa; + _RealType _M_r; }; /** - * @brief Constructs a beta distribution with parameters + * @brief Constructs a von Mises distribution with parameters * @f$\mu@f$ and @f$\kappa@f$. */ explicit @@ -2727,20 +2734,13 @@ = __gnu_cxx::__math_constants::__pi; std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); - result_type __tau = (std::sqrt(result_type(4) * this->kappa() - * this->kappa() + result_type(1)) - + result_type(1)); - result_type __rho = ((__tau - std::sqrt(result_type(2) * __tau)) - / (result_type(2) * this->kappa())); - result_type __r = ((result_type(1) + __rho * __rho) - / (result_type(2) * __rho)); result_type __f; while (1) { result_type __rnd = std::cos(__pi * __aurng()); - __f = (result_type(1) + __r * __rnd) / (__r + __rnd); - result_type __c = this->kappa() * (__r - __f); + __f = (result_type(1) + __p._M_r * __rnd) / (__p._M_r + __rnd); + result_type __c = __p._M_kappa * (__p._M_r - __f); result_type __rnd2 = __aurng(); if (__c * (result_type(2) - __c) > __rnd2) @@ -2756,7 +2756,7 @@ if (__aurng() < result_type(0.5)) __res = -__res; #endif - __res += this->mu(); + __res += __p._M_mu; if (__res > __pi) __res -= result_type(2) * __pi; else if (__res < -__pi)
__sdivsi3_i4i and __udivsi3_i4i called for sh2 variant.
It function called to divide operator. But libgcc.a is not include it helper functions. This patch is included those functions. diff -ru gcc-4.7.2.org/gcc/config.gcc gcc-4.7.2/gcc/config.gcc --- gcc-4.7.2.org/gcc/config.gcc2012-09-12 18:03:54.0 +0900 +++ gcc-4.7.2/gcc/config.gcc2013-03-03 03:12:41.0 +0900 @@ -2338,7 +2338,7 @@ sh[1234]*) sh_multilibs=${sh_cpu_target} ;; sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; - sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;; + sh*-*-linux*) sh_multilibs=m1,m2,m3e,m4 ;; sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;; *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;; esac diff -ru gcc-4.7.2.org/libgcc/config/sh/lib1funcs.S gcc-4.7.2/libgcc/config/sh/lib1funcs.S --- gcc-4.7.2.org/libgcc/config/sh/lib1funcs.S 2011-11-03 00:03:19.0 +0900 +++ gcc-4.7.2/libgcc/config/sh/lib1funcs.S 2013-03-03 03:29:32.0 +0900 @@ -3255,8 +3255,8 @@ .word 17136 .word 16639 -#elif defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__) -/* This code used shld, thus is not suitable for SH1 / SH2. */ +#elif defined (__sh2__) || defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__) +/* This code used shld, thus is not suitable for SH1. */ /* Signed / unsigned division without use of FPU, optimized for SH4. Uses a lookup table for divisors in the range -128 .. +128, and