Re: [C++ RFC/Patch] PR 34938

2014-08-23 Thread Paolo Carlini
.. on the other hand, the below is a case which my patchlet, which 
simply tracks pointers, does *not* handle correctly:


struct B { };
template  struct A { };
A*p = 42;

should be fixable by complicating a bit the tracking, telling apart 
member pointers.


Paolo.


Re: [PATCH i386 AVX512] [21/n] Extend variable shift patterns.

2014-08-23 Thread Uros Bizjak
On Fri, Aug 22, 2014 at 12:15 PM, Kirill Yukhin  wrote:

> This patch extends shift patterns with per-element
> shift value. It was adopted by approach suggested
> in previous patches.
>
> Bootstrapped.
> New tests on top of patch-set all pass
> under simulator.
>
> Is it ok for trunk?
>
> gcc/
> * config/i386/sse.md
> (define_mode_iterator VI48_AVX2_48_AVX512F): Delete.
> (define_mode_iterator VI48_AVX512BW): New.
> (define_insn "_v"): Delete.
> (define_insn "_v"
> with VI48_AVX2_48_AVX512F): New.
> (define_insn "_v"
> with VI2_AVX512VL): Ditto.

OK.

Thanks,
Uros.


Re: [PATCH i386 AVX512] [22/n] Extend unaligned loads & stores.

2014-08-23 Thread Uros Bizjak
On Fri, Aug 22, 2014 at 1:51 PM, Kirill Yukhin  wrote:

> This patch extends unaligned loads and stores patterns.
>
> I've refactored original patch (stored on SVN's branch)
> toward reducing complexity of conditions in
>define_insn "_storedqu_mask"
>
> It seems like such a trick won't work for:
>_loaddqu
> Problem is V[32|16]QI modes, which enabled for SSE/AVX
> w/o masking and for AVX-512BW & AVX-512VL when masking is
> on.
>
> Of course, I can split the define_insn & define_expand
> into 3 patterns w/ mode iterators of:
>   1. V16QI, V32QI - baseline is SSE2, masks enabled for AVX-512BW&VL
>   2. V64QI, V8HI, V16HI, V32HI - baseline is AVX-512BW, masks enabled
>  for AVX-512VL
>   3. V8DI, V4DI, V2DI, V16SI, V8SI, V4SI - baseline is AVX-512F, masks
>  enabled for AVX-512VL.
>
> But such approach will lead to 6 patterns instead of 2 (with non-trivial
> asm emit). I have doubts if it is useful...

At this stage, I'd still prefer simple constraints (the solution,
proposed above), even for the price of additional patterns. Looking at
the patterns, it is quite hard to calculate final condition for the
particular mode/target combo, even without enable attribute and
conditional operand constraints/predicates. With the solution above,
the complexity is conveniently pushed to mask define_subst attribute.

Uros.


[PATCH libcpp] Use CPP() for Wbuiltin-macro-redefined

2014-08-23 Thread Manuel López-Ibáñez
Hi,

The problem here is that builtin macros are marked with NO_WARN flag
depending on the value of Wbuiltin-macro-redefined, but this only
happens during libcpp initialization, so it doesn't work for #pragmas.
It neither works when using CPP(), since the default in the c.opt file
is set before libcpp initialization, overriding the default of libcpp.

The problem with #pragma is fixed in this patch by making NO_WARN
independent of the value of Wbuiltin-macro-redefined.

The problem with overriding the default in libcpp is fixed by setting
Init(1) in c.opt to match the default. However, it is too easy to
forget the Init(). It would be better if no Init() meant "use the
default of libcpp". This would require calling another generated
function just after initializing cpp_opts to set the defaults in
global_opts. Would that be ok? Or should I just set Init() explicitly
for every CPP()?

In any case, bootstrapped & regression tested x86_64-linux-gnu.

libcpp/ChangeLog:

2014-08-23  Manuel López-Ibáñez  

* macro.c (warn_of_redefinition): Suppress warnings for builtins
that lack the NODE_WARN flag, unless Wbuiltin-macro-redefined.
(_cpp_create_definition): Use Wbuiltin-macro-redefined for
builtins that lack the NODE_WARN flag.
* directives.c (do_undef): Likewise.
* init.c (cpp_init_special_builtins): Do not change flags
depending on Wbuiltin-macro-redefined.


gcc/c-family/ChangeLog:

2014-08-23  Manuel López-Ibáñez  

* c.opt (Wbuiltin-macro-redefined): Use CPP, Var and Init.
* c-opts.c (c_common_handle_option): Do not handle here.
Index: gcc/c-family/c.opt
===
--- gcc/c-family/c.opt  (revision 214396)
+++ gcc/c-family/c.opt  (working copy)
@@ -290,11 +290,11 @@ Warn about casting functions to incompat
 Wbool-compare
 C ObjC C++ ObjC++ Var(warn_bool_compare) Warning LangEnabledBy(C ObjC C++ 
ObjC++,Wall)
 Warn about boolean expression compared with an integer value different from 
true/false
 
 Wbuiltin-macro-redefined
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ CPP(warn_builtin_macro_redefined) 
Var(cpp_warn_builtin_macro_redefined) Init(1) Warning
 Warn when a built-in preprocessor macro is undefined or redefined
 
 Wc90-c99-compat
 C ObjC Var(warn_c90_c99_compat) Init(-1) Warning
 Warn about features not present in ISO C90, but present in ISO C99
Index: gcc/c-family/c-opts.c
===
--- gcc/c-family/c-opts.c   (revision 214396)
+++ gcc/c-family/c-opts.c   (working copy)
@@ -383,14 +383,10 @@ c_common_handle_option (size_t scode, co
 
   cpp_opts->warn_trigraphs = value;
   cpp_opts->warn_num_sign_change = value;
   break;
 
-case OPT_Wbuiltin_macro_redefined:
-  cpp_opts->warn_builtin_macro_redefined = value;
-  break;
-
 case OPT_Wc___compat:
   cpp_opts->warn_cxx_operator_names = value;
   break;
 
 case OPT_Wdeprecated:
Index: libcpp/macro.c
===
--- libcpp/macro.c  (revision 214396)
+++ libcpp/macro.c  (working copy)
@@ -2697,17 +2697,16 @@ warn_of_redefinition (cpp_reader *pfile,
 
   /* Some redefinitions need to be warned about regardless.  */
   if (node->flags & NODE_WARN)
 return true;
 
-  /* Suppress warnings for builtins that lack the NODE_WARN flag.  */
-  if (node->flags & NODE_BUILTIN)
-{
-  if (!pfile->cb.user_builtin_macro
- || !pfile->cb.user_builtin_macro (pfile, node))
-   return false;
-}
+  /* Suppress warnings for builtins that lack the NODE_WARN flag,
+ unless Wbuiltin-macro-redefined.  */
+  if (node->flags & NODE_BUILTIN
+  && (!pfile->cb.user_builtin_macro
+ || !pfile->cb.user_builtin_macro (pfile, node)))
+return CPP_OPTION (pfile, warn_builtin_macro_redefined);
 
   /* Redefinitions of conditional (context-sensitive) macros, on
  the other hand, must be allowed silently.  */
   if (node->flags & NODE_CONDITIONAL)
 return false;
@@ -3179,18 +3178,18 @@ _cpp_create_definition (cpp_reader *pfil
   if (CPP_OPTION (pfile, warn_unused_macros))
_cpp_warn_if_unused_macro (pfile, node, NULL);
 
   if (warn_of_redefinition (pfile, node, macro))
{
-  const int reason = (node->flags & NODE_BUILTIN)
+  const int reason = ((node->flags & NODE_BUILTIN)
+ && !(node->flags & NODE_WARN))
  ? CPP_W_BUILTIN_MACRO_REDEFINED : CPP_W_NONE;
- bool warned;
 
- warned = cpp_pedwarning_with_line (pfile, reason,
-pfile->directive_line, 0,
-"\"%s\" redefined",
- NODE_NAME (node));
+ bool warned = 
+   cpp_pedwarning_with_line (pfile, reason,
+ pfile->directive_line, 0,
+ 

[wwwdocs] Buildstat update for 4.8

2014-08-23 Thread Raghunath Lolur
Hi,

Please find an update of test results for 4.8.x


Test Results for 4.8.3:
  aarch64-unknown-linux-gnu

Best Regards,
Raghunath Lolur.
Index: buildstat.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/buildstat.html,v
retrieving revision 1.10
diff -u -r1.10 buildstat.html
--- buildstat.html	18 Aug 2014 05:35:30 -	1.10
+++ buildstat.html	23 Aug 2014 10:52:42 -
@@ -26,6 +26,7 @@
 aarch64-unknown-linux-gnu
  
 Test results:
+https://gcc.gnu.org/ml/gcc-testresults/2014-07/msg01057.html";>4.8.3
 https://gcc.gnu.org/ml/gcc-testresults/2014-03/msg02123.html";>4.8.2
 
 


fix gfcov regression

2014-08-23 Thread Nathan Sidwell

Hi,
this patch fixes a defect Jan found with firefox and its shared objects.  We 
were inadvertently calling an externally visible and overridable symbol, rather 
than the local shared object's instance.  This led to strangely sparse gcov results.


I've taken the STRONG_ALIAS #define from glibc.  I'm not 100% sure it's valid 
for all supported targets.


Tested in x86_64-linux

I've not committed this patch because of that, and (b) I'm  about to emmigrate, 
so likely to be unable to respond to any potential fallout in a timely manner.


Jan, if you think this patch is sufficiently safe, please apply.

nathan
2014-08-22  Nathan sidwell  

* libgcov-interface.c (STRONG_ALIAS): New.
(__gcov_flush): Call __gcov_reset_int.
(__gcov_reset): Strong alias for ...
(__gcov_reset_ing): ... this renamed hidden version.
* libgcov.h (__gcov_reset_int): New declaration.

Index: libgcc/libgcov-interface.c
===
--- libgcc/libgcov-interface.c  (revision 214320)
+++ libgcc/libgcov-interface.c  (working copy)
@@ -42,6 +42,12 @@ void __gcov_dump (void) {}
 
 #else
 
+
+/* Some functions we want to bind in this dynamic object, but have an
+   overridable global alias.  */
+#define STRONG_ALIAS(src,dst) \
+  extern __typeof (src) dst __attribute__((alias (#src)))
+
 extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
 extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
 
@@ -77,7 +83,7 @@ __gcov_flush (void)
   __gthread_mutex_lock (&__gcov_flush_mx);
 
   __gcov_dump_one (&__gcov_root);
-  __gcov_reset ();
+  __gcov_reset_int ();
 
   __gthread_mutex_unlock (&__gcov_flush_mx);
 }
@@ -121,12 +127,14 @@ gcov_clear (const struct gcov_info *list
in order to collect profile in region of interest.  */
 
 void
-__gcov_reset (void)
+__gcov_reset_int (void)
 {
   gcov_clear (__gcov_root.list);
   __gcov_root.dumped = 0;
 }
 
+STRONG_ALIAS (__gcov_reset_int, __gcov_reset);
+
 #endif /* L_gcov_reset */
 
 #ifdef L_gcov_dump
Index: libgcc/libgcov.h
===
--- libgcc/libgcov.h(revision 214320)
+++ libgcc/libgcov.h(working copy)
@@ -225,8 +225,10 @@ extern void __gcov_init (struct gcov_inf
 /* Called before fork, to avoid double counting.  */
 extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
 
-/* Function to reset all counters to 0.  */
+/* Function to reset all counters to 0.  Both externally visible (and
+   overridable) and internal version.  */
 extern void __gcov_reset (void);
+extern void __gcov_reset_int (void) ATTRIBUTE_HIDDEN;
 
 /* Function to enable early write of profile information so far.  */
 extern void __gcov_dump (void);


[patch] PR fortran/61669

2014-08-23 Thread Steven Bosscher
Hello,

This bug is an error recovery issue. A data declaration is parsed and
accepted, and added to gfc_current_ns->data, but the statement is
rejected. The rejected data decl is not rolled back, causing memory
corruption later on.

Proposed fix is to roll back DATA for rejected statements.

Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK for trunk?

Ciao!
Steven
fortran/
PR fortran/61669
* gfortran.h (struct gfc_namespace): Add OLD_DATA field.
* decl.c (gfc_reject_data): New function.
* parse.c *use_modules): Record roll-back point.
(next_statement): Likewise.
(reject_statement): Roll back to last accepted DATA.

testsuite/
PR fortran/61669
* gfortran.dg/pr61669.f90: New test.

Index: fortran/gfortran.h
===
--- fortran/gfortran.h  (revision 214350)
+++ fortran/gfortran.h  (working copy)
@@ -1625,7 +1625,7 @@ typedef struct gfc_namespace
   gfc_st_label *st_labels;
   /* This list holds information about all the data initializers in
  this namespace.  */
-  struct gfc_data *data;
+  struct gfc_data *data, *old_data;
 
   gfc_charlen *cl_list, *old_cl_list;
 
@@ -2941,6 +2941,7 @@ void gfc_free_omp_namelist (gfc_omp_namelist *);
 void gfc_free_equiv (gfc_equiv *);
 void gfc_free_equiv_until (gfc_equiv *, gfc_equiv *);
 void gfc_free_data (gfc_data *);
+void gfc_reject_data (gfc_namespace *);
 void gfc_free_case_list (gfc_case *);
 
 /* matchexp.c -- FIXME too?  */
Index: fortran/decl.c
===
--- fortran/decl.c  (revision 214350)
+++ fortran/decl.c  (working copy)
@@ -178,7 +178,21 @@ gfc_free_data_all (gfc_namespace *ns)
 }
 }
 
+/* Reject data parsed since the last restore point was marked.  */
 
+void
+gfc_reject_data (gfc_namespace *ns)
+{
+  gfc_data *d;
+
+  while (ns->data && ns->data != ns->old_data)
+{
+  d = ns->data->next;
+  free (ns->data);
+  ns->data = d;
+}
+}
+
 static match var_element (gfc_data_variable *);
 
 /* Match a list of variables terminated by an iterator and a right
Index: fortran/parse.c
===
--- fortran/parse.c (revision 214350)
+++ fortran/parse.c (working copy)
@@ -118,6 +118,7 @@ use_modules (void)
   gfc_warning_check ();
   gfc_current_ns->old_cl_list = gfc_current_ns->cl_list;
   gfc_current_ns->old_equiv = gfc_current_ns->equiv;
+  gfc_current_ns->old_data = gfc_current_ns->data;
   last_was_use_stmt = false;
 }
 
@@ -1097,6 +1098,7 @@ next_statement (void)
 
   gfc_current_ns->old_cl_list = gfc_current_ns->cl_list;
   gfc_current_ns->old_equiv = gfc_current_ns->equiv;
+  gfc_current_ns->old_data = gfc_current_ns->data;
   for (;;)
 {
   gfc_statement_label = NULL;
@@ -2045,6 +2047,8 @@ reject_statement (void)
   gfc_free_equiv_until (gfc_current_ns->equiv, gfc_current_ns->old_equiv);
   gfc_current_ns->equiv = gfc_current_ns->old_equiv;
 
+  gfc_reject_data (gfc_current_ns);
+
   gfc_new_block = NULL;
   gfc_undo_symbols ();
   gfc_clear_warning ();
Index: testsuite/gfortran.dg/pr61669.f90
===
--- testsuite/gfortran.dg/pr61669.f90   (revision 0)
+++ testsuite/gfortran.dg/pr61669.f90   (working copy)
@@ -0,0 +1,8 @@
+! { dg-do compile }
+  write (*,"(a)") char(12)
+  CHARACTER*80 A /"A"/  ! { dg-error "Unexpected data declaration 
statement" }
+  REAL*4 B  ! { dg-error "Unexpected data declaration 
statement" }
+  write (*,"(a)") char(12)
+  DATA B / 0.02 /
+  END
+


Re: [C++ RFC/Patch] PR 34938

2014-08-23 Thread Paolo Carlini

Hi again,

On 08/23/2014 09:16 AM, Paolo Carlini wrote:
.. on the other hand, the below is a case which my patchlet, which 
simply tracks pointers, does *not* handle correctly:


struct B { };
template  struct A { };
A*p = 42;

should be fixable by complicating a bit the tracking, telling apart 
member pointers.
Thus I finished testing the below. I separated to a new pr34938-2.C all 
the cases which 4.9 is already getting right and on which we don't want 
to regress.


As you can see, in order to handle correctly snippets like the above in 
pr34938-2.C, I added to the pointer check a check TREE_CODE (t) == 
FUNCTION_TYPE, close to the original idea... For a while that made me a 
little nervous because I was afraid that we would not print the 
attribute for member function pointers when we should, but in fact, as 
we ignore it for typedefs of such types (as I reported a couple of 
messages ago), we also appear to drop to the floor when no typedefs are 
involved, thus, eg we simply accept:


struct A { template void foo(); };

template void bar();

fptr f1 = bar< &A::foo<0> >;

and if we butcher it a little bit to force an error message (eg, we 
change A::foo to be const) there is no trace of the attribute in the 
error message anyway. Thus I *think* that given our current status 
elsewhere at least, we are fine.


Thanks,
Paolo.


Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 214396)
+++ cp/cp-tree.h(working copy)
@@ -4728,7 +4728,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, T
TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS: do not omit template arguments
identical to their defaults.
TFF_NO_TEMPLATE_BINDINGS: do not print information about the template
-   arguments for a function template specialization.  */
+   arguments for a function template specialization.
+   TFF_POINTER: we are printing a pointer type.  */
 
 #define TFF_PLAIN_IDENTIFIER   (0)
 #define TFF_SCOPE  (1)
@@ -4745,6 +4746,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, T
 #define TFF_UNQUALIFIED_NAME   (1 << 11)
 #define TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS (1 << 12)
 #define TFF_NO_TEMPLATE_BINDINGS   (1 << 13)
+#define TFF_POINTER(1 << 14)
 
 /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
node.  */
Index: cp/cxx-pretty-print.h
===
--- cp/cxx-pretty-print.h   (revision 214396)
+++ cp/cxx-pretty-print.h   (working copy)
@@ -59,8 +59,8 @@ struct cxx_pretty_printer : c_pretty_printer
 
 #define pp_cxx_cv_qualifier_seq(PP, T)   \
pp_c_type_qualifier_list (PP, T)
-#define pp_cxx_cv_qualifiers(PP, CV)   \
-   pp_c_cv_qualifiers (PP, CV, false)
+#define pp_cxx_cv_qualifiers(PP, CV, FT) \
+   pp_c_cv_qualifiers (PP, CV, FT)
 
 #define pp_cxx_whitespace(PP)  pp_c_whitespace (PP)
 #define pp_cxx_left_paren(PP)  pp_c_left_paren (PP)
Index: cp/error.c
===
--- cp/error.c  (revision 214396)
+++ cp/error.c  (working copy)
@@ -820,6 +820,8 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t,
   if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
  || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
pp_cxx_right_paren (pp);
+  if (TREE_CODE (t) == POINTER_TYPE)
+   flags |= TFF_POINTER;
   dump_type_suffix (pp, TREE_TYPE (t), flags);
   break;
 
@@ -839,7 +841,9 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t,
dump_parameters (pp, arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
 
pp->padding = pp_before;
-   pp_cxx_cv_qualifiers (pp, type_memfn_quals (t));
+   pp_cxx_cv_qualifiers (pp, type_memfn_quals (t),
+ TREE_CODE (t) == FUNCTION_TYPE
+ && (flags & TFF_POINTER));
dump_ref_qualifier (pp, t, flags);
dump_exception_spec (pp, TYPE_RAISES_EXCEPTIONS (t), flags);
dump_type_suffix (pp, TREE_TYPE (t), flags);
Index: testsuite/g++.dg/template/pr34938-1.C
===
--- testsuite/g++.dg/template/pr34938-1.C   (revision 0)
+++ testsuite/g++.dg/template/pr34938-1.C   (working copy)
@@ -0,0 +1,7 @@
+// PR c++/34938
+
+typedef void (*fptr)() __attribute((noreturn)); 
+template  void foo();
+template void bar();
+
+fptr f = bar< foo<0> >;   // { dg-error "noreturn" }
Index: testsuite/g++.dg/template/pr34938-2.C
===
--- testsuite/g++.dg/template/pr34938-2.C   (revision 0)
+++ testsuite/g++.dg/template/pr34938-2.C   (working copy)
@@ -0,0 +1,10 @@
+// PR c++/34938
+
+template  struct A { };
+struct B { };
+
+A* p1 = 42;   // { dg-error "void\\(\\) const" }
+A* p2 = 42; // { dg-

[wwwdocs] Fix spelling of "cost model" in gcc-4.9/changes.html

2014-08-23 Thread Gerald Pfeifer
Applied.

Gerald

Index: gcc-4.9/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/changes.html,v
retrieving revision 1.78
diff -u -r1.78 changes.html
--- gcc-4.9/changes.html16 Jul 2014 09:51:24 -  1.78
+++ gcc-4.9/changes.html23 Aug 2014 15:58:24 -
@@ -132,7 +132,7 @@
>-fsimd-cost-model= option permits to tune the
vectorization cost model for loops annotated with OpenMP and Cilk
Plus simd directives; -Wopenmp-simd warns when
-   the current costmodel overrides simd directives set by the user.
+   the current cost model overrides simd directives set by the user.
 The -Wdate-time option has been added for the C, C++ and
Fortran compilers, which warns when the __DATE__,
__TIME__ or __TIMESTAMP__ macros are used.


Re: Doc Bug: cxa-atexit not use-cxa-atexit

2014-08-23 Thread Gerald Pfeifer
On Mon, 18 Aug 2014, Joel Sherrill wrote:
> I think this is a minor documentation bug which is in the head but also
> seems to be in the gcc 4.4.7 docs shipped with CentOS 6.x.
> 
> OK to commit?
> 
> 2014-08-18  Joel Sherrill 
> 
> * doc/invoke.texi: -fno-cxa-atexit should be -fno-use-cxa-atexit.

Sure thing.  Okay for all open branches.

Gerald


Re: [patch, nios2] testsuite cleanup

2014-08-23 Thread Mike Stump
On Aug 22, 2014, at 3:48 PM, Hans-Peter Nilsson  wrote:
> 
>> +/* non default branch cost */
>> +/* { dg-do run { target { ! "m68k*-*-* mmix*-*-* mep*-*-* bfin*-*-* 
>> v850*-*-* picochip*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* 
>> powerpc*-*-* xtensa*-*-* hppa*-*-* nios2*-*-*"} } } */

> It's the other way round re "listed targets".  (CRIS and MMIX
> have the default branch cost, ditto m68k and moxie, didn't check
> the others.)

Right.  I had ! on the brain.  Do you like non-default branch cost, or would it 
be better to describe it some other way?

[committed] Fix bug target/62038 Out of range branch target in thunk

2014-08-23 Thread John David Anglin
The attached change fixes the PR.  This problem affects building  
texmaker and a few other Debian

packages.

The code in pa_asm_output_mi_thunk originally checked whether the  
function was reachable with
a pc-relative branch, but the assembler complains if the branch can't  
reach the stub table.  I don't think
thunks need to reach the stub table in this case but it's probably  
hard to distinguish  in the assembler
this case from situations where a "call" needs to reach the stub  
table.  So, I fixed the problem in the compiler.


In debugging this problem, I noticed a small regression in the  
computation of last_address which was
introduced when we changed to using final_start_function and  
final_end_function to get debug info for
thunks.  The final_end_function call messed up the value of  
last_address.


Tested on hppa2.0w-hp-hpux11.11, hppa64-hp-hpux11.11 and hppa-unknown- 
linux-gnu.  Committed

to trunk, 4.9 and 4.8.

Dave
--
John David Anglin   dave.ang...@bell.net


2014-08-23  John David Anglin  

PR target/62038
* config/pa/pa.c (pa_output_function_epilogue): Don't set
last_address when the current function is a thunk.
(pa_asm_output_mi_thunk): When we don't have named sections or they
are not being used, check that thunk can reach the stub table with a
short branch.

Index: config/pa/pa.c
===
--- config/pa/pa.c  (revision 214251)
+++ config/pa/pa.c  (working copy)
@@ -4137,9 +4137,8 @@
 pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
 {
   rtx insn = get_last_insn ();
+  bool extra_nop;
 
-  last_address = 0;
-
   /* pa_expand_epilogue does the dirty work now.  We just need
  to output the assembler directives which denote the end
  of a function.
@@ -4162,8 +4161,10 @@
   if (insn && CALL_P (insn))
 {
   fputs ("\tnop\n", file);
-  last_address += 4;
+  extra_nop = true;
 }
+  else
+extra_nop = false;
 
   fputs ("\t.EXIT\n\t.PROCEND\n", file);
 
@@ -4176,12 +4177,13 @@
   cfun->machine->in_nsubspa = 2;
 }
 
-  /* Thunks do their own accounting.  */
+  /* Thunks do their own insn accounting.  */
   if (cfun->is_thunk)
 return;
 
   if (INSN_ADDRESSES_SET_P ())
 {
+  last_address = extra_nop ? 4 : 0;
   insn = get_last_nonnote_insn ();
   last_address += INSN_ADDRESSES (INSN_UID (insn));
   if (INSN_P (insn))
@@ -8275,12 +8277,16 @@
   || ((DECL_SECTION_NAME (thunk_fndecl)
== DECL_SECTION_NAME (function))
   && last_address < 262132)))
+ /* In this case, we need to be able to reach the start of
+the stub table even though the function is likely closer
+and can be jumped to directly.  */
  || (targetm_common.have_named_sections
  && DECL_SECTION_NAME (thunk_fndecl) == NULL
  && DECL_SECTION_NAME (function) == NULL
- && last_address < 262132)
+ && total_code_bytes < MAX_PCREL17F_OFFSET)
+ /* Likewise.  */
  || (!targetm_common.have_named_sections
- && last_address < 262132
+ && total_code_bytes < MAX_PCREL17F_OFFSET
 {
   if (!val_14)
output_asm_insn ("addil L'%2,%%r26", xoperands);


Re: [patch, nios2] testsuite cleanup

2014-08-23 Thread Sandra Loosemore

On 08/23/2014 10:26 AM, Mike Stump wrote:

On Aug 22, 2014, at 3:48 PM, Hans-Peter Nilsson  wrote:



+/* non default branch cost */
+/* { dg-do run { target { ! "m68k*-*-* mmix*-*-* mep*-*-* bfin*-*-* v850*-*-* 
picochip*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* 
xtensa*-*-* hppa*-*-* nios2*-*-*"} } } */



It's the other way round re "listed targets".  (CRIS and MMIX
have the default branch cost, ditto m68k and moxie, didn't check
the others.)


Right.  I had ! on the brain.  Do you like non-default branch cost, or would it
be better to describe it some other way?


If we're going to go through the trouble of adding a comment here, we 
might as well make it something less terse and more explicit, like:


These tests fail unless the target backend overrides BRANCH_COST to 
return a value >= 2.


-Sandra



Re: [patch, nios2] testsuite cleanup

2014-08-23 Thread Mike Stump
On Aug 23, 2014, at 9:37 AM, Sandra Loosemore  wrote:
> If we're going to go through the trouble of adding a comment here, we might 
> as well make it something less terse and more explicit, like:
> 
> These tests fail unless the target backend overrides BRANCH_COST to return a 
> value >= 2.

Sounds good to me.  :-)


Re: [GSoC] Elimination of CLooG library installation dependency

2014-08-23 Thread Dominique d'Humières

I see two regressions after r214069 on x86_64-apple-darwin13 for both -m32 and 
-m64:


(1) FAIL: gcc.dg/graphite/vect-pr43423.c scan-tree-dump-times vect "vectorized 
2 loops" 1

before I saw

[Book15] f90/bug% grep vectorized vect-pr43423.c.114t.vect 
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:14:17: note: === 
vect_mark_stmts_to_be_vectorized ===
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:14:17: note: loop 
vectorized
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:12:17: note: === 
vect_mark_stmts_to_be_vectorized ===
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:12:17: note: loop 
vectorized
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:6:6: note: 
vectorized 2 loops in function.

after I see

[Book15] f90/bug% grep vectorized vect-pr43423.c.115t.vect  

/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:14:17: note: not 
vectorized: not suitable for gather load _55 = a[_56];
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:12:17: note: not 
vectorized: not suitable for gather load _36 = a[_37];
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:6:6: note: 
vectorized 0 loops in function.

(2) FAIL: gfortran.dg/graphite/pr42393.f90   -O  (internal compiler error)
FAIL: gfortran.dg/graphite/pr42393.f90   -O  (test for excess errors)

The backtrace is

* thread #1: tid = 0x13bd91f, 0x7fff8621aca0 
libsystem_malloc.dylib`tiny_malloc_from_free_list + 12, queue = 
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, 
address=0x7fff5bc00ff8)
frame #0: 0x7fff8621aca0 
libsystem_malloc.dylib`tiny_malloc_from_free_list + 12
libsystem_malloc.dylib`tiny_malloc_from_free_list + 12:
-> 0x7fff8621aca0:  pushq  %rbx
   0x7fff8621aca1:  pushq  %rax
   0x7fff8621aca2:  movl   %edx, %r12d
   0x7fff8621aca5:  movq   %rsi, %r14
(lldb) bt
* thread #1: tid = 0x13bd91f, 0x7fff8621aca0 
libsystem_malloc.dylib`tiny_malloc_from_free_list + 12, queue = 
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, 
address=0x7fff5bc00ff8)
  * frame #0: 0x7fff8621aca0 
libsystem_malloc.dylib`tiny_malloc_from_free_list + 12
frame #1: 0x7fff8621b3c3 
libsystem_malloc.dylib`szone_malloc_should_clear + 320
frame #2: 0x7fff8621d868 libsystem_malloc.dylib`malloc_zone_malloc + 71
frame #3: 0x7fff8621e27c libsystem_malloc.dylib`malloc + 42
frame #4: 0x000141dbdc79 libgmp.10.dylib`__gmp_default_allocate + 9
frame #5: 0x000141dd0148 libgmp.10.dylib`__gmpz_init + 24
frame #6: 0x000141c180ef 
libisl.10.dylib`isl_basic_map_normalize_constraints + 47
frame #7: 0x000141c18f04 libisl.10.dylib`isl_basic_map_simplify + 68
frame #8: 0x000141c2509b libisl.10.dylib`isl_basic_set_preimage + 619
frame #9: 0x000141c4e146 libisl.10.dylib`isl_basic_set_sample_with_cone 
+ 150
frame #10: 0x000141c4ea88 libisl.10.dylib`basic_set_sample + 744
frame #11: 0x000141c4e849 libisl.10.dylib`basic_set_sample + 169
frame #12: 0x000141c09978 libisl.10.dylib`isl_basic_map_is_empty + 136
frame #13: 0x000141bb2870 libisl.10.dylib`domain_follows_at_depth + 112
frame #14: 0x000141c7cdba libisl.10.dylib`isl_tarjan_components + 154

getting to the ICE take ~19s compared to less than a second before r214069.

Dominique



Re: [patch] PR fortran/61669

2014-08-23 Thread Paul Richard Thomas
Dear Steven,

I am constantly amazed that data statement bugs keep turning up:-)
Anyway, your fix is fine for trunk and, if you feel so inclined, 4.8
and 4.9.

Thanks

Paul

On 23 August 2014 16:52, Steven Bosscher  wrote:
> Hello,
>
> This bug is an error recovery issue. A data declaration is parsed and
> accepted, and added to gfc_current_ns->data, but the statement is
> rejected. The rejected data decl is not rolled back, causing memory
> corruption later on.
>
> Proposed fix is to roll back DATA for rejected statements.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK for trunk?
>
> Ciao!
> Steven



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
   --Hitchhikers Guide to the Galaxy


Re: [PATCH, C++, CPP] Add C++1z to the preprocessor. Rename C++1y to C++14.

2014-08-23 Thread Ed Smith-Rowland

On 08/22/2014 04:36 PM, Jason Merrill wrote:

OK, thanks.

Jason


Committed 214400.

Attached patch is the one committed.
Thanks.


libcpp/

2014-08-23  Edward Smith-Rowland  <3dw...@verizon.net>

* include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Z, CLK_CXX1Z;
Rename CLK_GNUCXX1Y, CLK_CXX1Y to CLK_GNUCXX14, CLK_CXX14;
* init.c (struct lang_flags lang_defaults): Add column for trigraphs;
Add rows for CLK_GNUCXX1Z, CLK_CXX1Z; (cpp_set_lang): Set trigraphs;
(cpp_init_builtins): Set __cplusplus to 201402L for C++14;
Set __cplusplus to 201500L for C++17.
* expr.c (cpp_classify_number): Change C++1y to C++14 in binary
constants error message.


gcc/c-family/

2014-08-23  Edward Smith-Rowland  <3dw...@verizon.net>

* c-common.h (enum cxx_dialect): Add cxx14.
* c-opts.c (set_std_cxx1y): Rename to set_std_cxx14; Use cxx14.
* c-ubsan.c (ubsan_instrument_shift): Change comment and logic from
cxx_dialect == cxx11 || cxx_dialect == cxx1y to cxx_dialect >= cxx11.


gcc/cp/

2014-08-23  Edward Smith-Rowland  <3dw...@verizon.net>

* decl.c (compute_array_index_type, grokdeclarator,
undeduced_auto_decl): Change from cxx1y to cxx14.
*lambda.c(add_capture()): Change error message from C++1y to C++14.
* parser.c (cp_parser_unqualified_id, cp_parser_pseudo_destructor_name,
cp_parser_lambda_introducer, cp_parser_lambda_declarator_opt,
cp_parser_decltype, cp_parser_conversion_type_id,
cp_parser_simple_type_specifier, cp_parser_type_id_1,
cp_parser_template_type_arg, cp_parser_std_attribute,
cp_parser_template_declaration_after_export): Ditto.
* pt.c (tsubst): Ditto.
* semantics.c (force_paren_expr, finish_decltype_type): Ditto.
* tree.c: Change comment.
* typeck.c (comp_template_parms_position, cxx_sizeof_or_alignof_type,
cp_build_addr_expr_1, maybe_warn_about_useless_cast): Ditto.


gcc/

2014-08-23  Edward Smith-Rowland  <3dw...@verizon.net>

* doc/invoke.texi: Change c++1y to c++14 and gnu++1y to gnu++14.
Deprecate c++1y. Change language to reflect greater confidence in C++14.


gcc/testsuite/

2014-08-23  Edward Smith-Rowland  <3dw...@verizon.net>

* g++.dg/cpp0x/cplusplus.C: New.
* g++.dg/cpp0x/cplusplus_0x.C: New.
* g++.dg/cpp0x/auto3.C: Change c++1y to c++14.
* g++.dg/cpp0x/auto41.C: Ditto.
* g++.dg/cpp0x/auto9.C: Ditto.
* g++.dg/cpp0x/initlist26.C: Ditto.
* g++.dg/cpp0x/pr59111.C: Ditto.
* g++.dg/cpp0x/trailing2.C: Ditto.
* g++.dg/cpp1y/attr-deprecated.C: Ditto.
* g++.dg/cpp1y/auto-dtor1.C: Ditto.
* g++.dg/cpp1y/auto-fn1.C: Ditto.
* g++.dg/cpp1y/auto-fn2.C: Ditto.
* g++.dg/cpp1y/auto-fn3.C: Ditto.
* g++.dg/cpp1y/auto-fn4.C: Ditto.
* g++.dg/cpp1y/auto-fn5.C: Ditto.
* g++.dg/cpp1y/auto-fn6.C: Ditto.
* g++.dg/cpp1y/auto-fn7.C: Ditto.
* g++.dg/cpp1y/auto-fn8.C: Ditto.
* g++.dg/cpp1y/auto-fn9.C: Ditto.
* g++.dg/cpp1y/auto-fn10.C: Ditto.
* g++.dg/cpp1y/auto-fn11.C: Ditto.
* g++.dg/cpp1y/auto-fn12.C: Ditto.
* g++.dg/cpp1y/auto-fn13.C: Ditto.
* g++.dg/cpp1y/auto-fn14.C: Ditto.
* g++.dg/cpp1y/auto-fn15.C: Ditto.
* g++.dg/cpp1y/auto-fn16.C: Ditto.
* g++.dg/cpp1y/auto-fn17.C: Ditto.
* g++.dg/cpp1y/auto-fn18.C: Ditto.
* g++.dg/cpp1y/auto-fn19.C: Ditto.
* g++.dg/cpp1y/auto-fn20.C: Ditto.
* g++.dg/cpp1y/auto-fn21.C: Ditto.
* g++.dg/cpp1y/auto-fn22.C: Ditto.
* g++.dg/cpp1y/auto-fn23.C: Ditto.
* g++.dg/cpp1y/auto-fn24.C: Ditto.
* g++.dg/cpp1y/auto-fn25.C: Ditto.
* g++.dg/cpp1y/auto-mangle1.C: Ditto.
* g++.dg/cpp1y/auto-neg1.C: Ditto.
* g++.dg/cpp1y/digit-sep.C: Ditto.
* g++.dg/cpp1y/digit-sep-neg.C: Ditto.
* g++.dg/cpp1y/digit-sep-cxx11-neg.C: Ditto.
* g++.dg/cpp1y/fn-generic-member-ool.C: Ditto.
* g++.dg/cpp1y/lambda-deduce-mult.C: Ditto.
* g++.dg/cpp1y/lambda-generic.C: Ditto.
* g++.dg/cpp1y/lambda-generic-cfun.C: Ditto.
* g++.dg/cpp1y/lambda-generic-dep.C: Ditto.
* g++.dg/cpp1y/lambda-generic-mixed.C: Ditto.
* g++.dg/cpp1y/lambda-generic-udt.C: Ditto.
* g++.dg/cpp1y/lambda-generic-variadic.C: Ditto.
* g++.dg/cpp1y/lambda-generic-vla1.C: Ditto.
* g++.dg/cpp1y/lambda-generic-x.C: Ditto.
* g++.dg/cpp1y/lambda-generic-xcfun.C: Ditto.
* g++.dg/cpp1y/lambda-generic-xudt.C: Ditto.
* g++.dg/cpp1y/lambda-init.C: Ditto.
* g++.dg/cpp1y/lambda-init1.C: Ditto.
* g++.dg/cpp1y/lambda-init2.C: Ditto.
* g++.dg/cpp1y/lambda-init3.C: Ditto.
* g++.dg/cpp1y/lambda-init4.C: Ditto.
* g++.dg/cpp1y/lambda-init5.C: Ditto.
* g++.dg/cpp1y/lambda-init6.C: Ditto.
* g++.dg

Re: [patch, nios2] testsuite cleanup

2014-08-23 Thread Hans-Peter Nilsson
On Sat, 23 Aug 2014, Sandra Loosemore wrote:
> On 08/23/2014 10:26 AM, Mike Stump wrote:
> > On Aug 22, 2014, at 3:48 PM, Hans-Peter Nilsson  wrote:
> > >
> > > > +/* non default branch cost */
> > > > +/* { dg-do run { target { ! "m68k*-*-* mmix*-*-* mep*-*-* bfin*-*-*
> > > > v850*-*-* picochip*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-*
> > > > mcore*-*-* powerpc*-*-* xtensa*-*-* hppa*-*-* nios2*-*-*"} } } */
> >
> > > It's the other way round re "listed targets".  (CRIS and MMIX
> > > have the default branch cost, ditto m68k and moxie, didn't check
> > > the others.)
> >
> > Right.  I had ! on the brain.  Do you like non-default branch cost, or would
> > it
> > be better to describe it some other way?
>
> If we're going to go through the trouble of adding a comment here, we might as
> well make it something less terse and more explicit, like:
>
> These tests fail unless the target backend overrides BRANCH_COST to return a
> value >= 2.

Agreed!

The target list line is getting longish, maybe put it in an
effective-target proc while it's being edited anyway.

brgds, H-P


[GOOGLE] Fix AutoFDO LIPO ICE due to eliminated abstract origin

2014-08-23 Thread Teresa Johnson
This patch ensures we don't prematurely delete an abstract origin node, leading
to creating a new one after LIPO linking when we invoke similar handling in
symtab_remove_unreachable_nodes, which then does not have a resolved node. It
makes the handling of such nodes equivalent to that in
symtab_remove_unreachable_nodes.

Tested with regression tests and internal benchmarks. Ok for google/4_9

2014-08-23  Teresa Johnson  

Google ref b/16731481
* cgraphunit.c (analyze_functions): Don't remove origin node.

Index: cgraphunit.c
===
--- cgraphunit.c(revision 214320)
+++ cgraphunit.c(working copy)
@@ -1051,6 +1051,7 @@ analyze_functions (void)
  struct cgraph_node *origin_node
  = cgraph_get_node (DECL_ABSTRACT_ORIGIN (decl));
  origin_node->used_as_abstract_origin = true;
+ enqueue_node (origin_node);
}
}
  else

-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


[GOOGLE] Fix -fopt-info seg fault in AutoFDO LIPO mode

2014-08-23 Thread Teresa Johnson
Fixes seg fault when using -fopt-info with AutoFDO LIPO. Ensure that the
mapping between module name and ident is setup.

Tested with regression tests and internal benchmarks. Ok for google/4_9

2014-08-23  Teresa Johnson  

Google ref b/17124135
* auto-profile.c (read_aux_modules): Record the module name/ident pair.
* coverage.c (record_module_name): Make non-static.
* l-ipo.h (record_module_name): Ditto.

Index: auto-profile.c
===
--- auto-profile.c  (revision 214320)
+++ auto-profile.c  (working copy)
@@ -958,6 +958,7 @@ read_aux_modules (void)
   module_infos = XCNEWVEC (gcov_module_info *, num_aux_modules + 1);
   module_infos[0] = module;
   primary_module_id = module->ident;
+  record_module_name (module->ident, lbasename (in_fnames[0]));
   if (aux_modules == NULL)
 return;
   unsigned curr_module = 1, max_group = PARAM_VALUE (PARAM_MAX_LIPO_GROUP);
@@ -1004,6 +1005,7 @@ read_aux_modules (void)
}
   module_infos[curr_module++] = aux_module;
   add_input_filename (*iter);
+  record_module_name (aux_module->ident, lbasename (*iter));
 }
 }

Index: coverage.c
===
--- coverage.c  (revision 214320)
+++ coverage.c  (working copy)
@@ -658,7 +658,7 @@ typedef struct {

 static vec *mod_names;

-static void
+void
 record_module_name (unsigned int mod_id, const char *name)
 {
   mod_id_to_name_t t;
Index: l-ipo.h
===
--- l-ipo.h (revision 214320)
+++ l-ipo.h (working copy)
@@ -63,6 +63,7 @@ int equivalent_struct_types_for_tbaa (const_tree t
 void lipo_link_and_fixup (void);
 extern void copy_defined_module_set (tree, tree);
 extern bool is_parsing_done_p (void);
+extern void record_module_name (unsigned int, const char *);
 extern const char* get_module_name (unsigned int);

 #endif

-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


[BUILDROBOT][PATCH] frv-linux fallout (was: [PATCH 009/236] Replace BB_HEAD et al macros with functions)

2014-08-23 Thread Jan-Benedict Glaw
On Wed, 2014-08-06 13:19:48 -0400, David Malcolm  wrote:
> This is further scaffolding; convert the BB_* and SET_BB_* macros
> into functions.  Convert the BB_* rvalue-style functions into returning
> rtx_insn * rather than plain rtx.
[...]

This gave some fallout for frv-linux (see eg. build
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=345281): 

g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions 
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings 
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic 
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  
-DHAVE_CONFIG_H -I. -I. -I/home/vaxbuild/repos/gcc/gcc 
-I/home/vaxbuild/repos/gcc/gcc/. -I/home/vaxbuild/repos/gcc/gcc/../include 
-I/home/vaxbuild/repos/gcc/gcc/../libcpp/include  
-I/home/vaxbuild/repos/gcc/gcc/../libdecnumber 
-I/home/vaxbuild/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
-I/home/vaxbuild/repos/gcc/gcc/../libbacktrace-o ifcvt.o -MT ifcvt.o -MMD 
-MP -MF ./.deps/ifcvt.TPo /home/vaxbuild/repos/gcc/gcc/ifcvt.c
In file included from ./tm.h:23:0,
 from /home/vaxbuild/repos/gcc/gcc/ifcvt.c:23:
/home/vaxbuild/repos/gcc/gcc/ifcvt.c: In function ‘int 
cond_exec_process_insns(ce_if_block*, rtx, rtx, rtx, int, int)’:
/home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1964:58: error: 
‘frv_ifcvt_modify_insn’ was not declared in this scope
 (PATTERN) = frv_ifcvt_modify_insn (CE_INFO, PATTERN, INSN)
  ^
/home/vaxbuild/repos/gcc/gcc/ifcvt.c:408:7: note: in expansion of macro 
‘IFCVT_MODIFY_INSN’
   IFCVT_MODIFY_INSN (ce_info, pattern, insn);
   ^
/home/vaxbuild/repos/gcc/gcc/ifcvt.c: In function ‘int 
cond_exec_process_if_block(ce_if_block*, int)’:
/home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1948:57: error: 
‘frv_ifcvt_modify_tests’ was not declared in this scope
 frv_ifcvt_modify_tests (CE_INFO, &TRUE_EXPR, &FALSE_EXPR)
 ^
/home/vaxbuild/repos/gcc/gcc/ifcvt.c:613:3: note: in expansion of macro 
‘IFCVT_MODIFY_TESTS’
   IFCVT_MODIFY_TESTS (ce_info, true_expr, false_expr);
   ^
/home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1957:70: error: 
‘frv_ifcvt_modify_multiple_tests’ was not declared in this scope
 frv_ifcvt_modify_multiple_tests (CE_INFO, BB, &TRUE_EXPR, &FALSE_EXPR)
  ^
/home/vaxbuild/repos/gcc/gcc/ifcvt.c:686:4: note: in expansion of macro 
‘IFCVT_MODIFY_MULTIPLE_TESTS’
IFCVT_MODIFY_MULTIPLE_TESTS (ce_info, bb, t, f);
^
/home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1974:70: error: 
‘frv_ifcvt_modify_cancel’ was not declared in this scope
 #define IFCVT_MODIFY_CANCEL(CE_INFO) frv_ifcvt_modify_cancel (CE_INFO)
  ^
/home/vaxbuild/repos/gcc/gcc/ifcvt.c:724:7: note: in expansion of macro 
‘IFCVT_MODIFY_CANCEL’
   IFCVT_MODIFY_CANCEL (ce_info);
   ^
/home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1969:68: error: 
‘frv_ifcvt_modify_final’ was not declared in this scope
 #define IFCVT_MODIFY_FINAL(CE_INFO) frv_ifcvt_modify_final (CE_INFO)
^
/home/vaxbuild/repos/gcc/gcc/ifcvt.c:731:3: note: in expansion of macro 
‘IFCVT_MODIFY_FINAL’
   IFCVT_MODIFY_FINAL (ce_info);
   ^
/home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1974:70: error: 
‘frv_ifcvt_modify_cancel’ was not declared in this scope
 #define IFCVT_MODIFY_CANCEL(CE_INFO) frv_ifcvt_modify_cancel (CE_INFO)
  ^
/home/vaxbuild/repos/gcc/gcc/ifcvt.c:761:3: note: in expansion of macro 
‘IFCVT_MODIFY_CANCEL’
   IFCVT_MODIFY_CANCEL (ce_info);
   ^
Makefile:1064: recipe for target 'ifcvt.o' failed





This is because the macro-implementing functions are declared in
frv-protos.h iff BB_HEAD is define'd.  Is this okay to apply?



2014-08-23  Jan-Benedict Glaw  
* config/frv/frv-protos.h (frv_ifcvt_init_extra_fields): Declare
unconditionally.
(frv_ifcvt_modify_tests): Ditto.
(frv_ifcvt_modify_multiple_tests): Ditto.
(frv_ifcvt_modify_insn): Ditto.
(frv_ifcvt_modify_final): Ditto.
(frv_ifcvt_modify_cancel): Ditto.

diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index d50ca64..c689813 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -61,7 +61,6 @@ extern rtx frv_split_minmax   (rtx *);
 extern rtx frv_split_abs   (rtx *);
 extern void frv_split_double_load  (rtx, rtx);
 extern void frv_split_double_store (rtx, rtx);
-#ifdef BB_HEAD
 extern void frv_ifcvt_init_extra_fields(ce_if_block *);
 extern void frv_ifcvt_modify_tests (ce_if_block *, rtx *, rtx *);
 extern void frv_ifcvt_modify_multiple_tests
@@ -70,7 +69,6 @@ extern void frv_ifcvt_mo

Re: [GOOGLE] Fix AutoFDO LIPO ICE due to eliminated abstract origin

2014-08-23 Thread Xinliang David Li
Is it a problem specific to LIPO?

David

On Sat, Aug 23, 2014 at 11:41 AM, Teresa Johnson  wrote:
> This patch ensures we don't prematurely delete an abstract origin node, 
> leading
> to creating a new one after LIPO linking when we invoke similar handling in
> symtab_remove_unreachable_nodes, which then does not have a resolved node. It
> makes the handling of such nodes equivalent to that in
> symtab_remove_unreachable_nodes.
>
> Tested with regression tests and internal benchmarks. Ok for google/4_9
>
> 2014-08-23  Teresa Johnson  
>
> Google ref b/16731481
> * cgraphunit.c (analyze_functions): Don't remove origin node.
>
> Index: cgraphunit.c
> ===
> --- cgraphunit.c(revision 214320)
> +++ cgraphunit.c(working copy)
> @@ -1051,6 +1051,7 @@ analyze_functions (void)
>   struct cgraph_node *origin_node
>   = cgraph_get_node (DECL_ABSTRACT_ORIGIN (decl));
>   origin_node->used_as_abstract_origin = true;
> + enqueue_node (origin_node);
> }
> }
>   else
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [GOOGLE] Fix -fopt-info seg fault in AutoFDO LIPO mode

2014-08-23 Thread Xinliang David Li
ok.

David

On Sat, Aug 23, 2014 at 11:42 AM, Teresa Johnson  wrote:
> Fixes seg fault when using -fopt-info with AutoFDO LIPO. Ensure that the
> mapping between module name and ident is setup.
>
> Tested with regression tests and internal benchmarks. Ok for google/4_9
>
> 2014-08-23  Teresa Johnson  
>
> Google ref b/17124135
> * auto-profile.c (read_aux_modules): Record the module name/ident 
> pair.
> * coverage.c (record_module_name): Make non-static.
> * l-ipo.h (record_module_name): Ditto.
>
> Index: auto-profile.c
> ===
> --- auto-profile.c  (revision 214320)
> +++ auto-profile.c  (working copy)
> @@ -958,6 +958,7 @@ read_aux_modules (void)
>module_infos = XCNEWVEC (gcov_module_info *, num_aux_modules + 1);
>module_infos[0] = module;
>primary_module_id = module->ident;
> +  record_module_name (module->ident, lbasename (in_fnames[0]));
>if (aux_modules == NULL)
>  return;
>unsigned curr_module = 1, max_group = PARAM_VALUE (PARAM_MAX_LIPO_GROUP);
> @@ -1004,6 +1005,7 @@ read_aux_modules (void)
> }
>module_infos[curr_module++] = aux_module;
>add_input_filename (*iter);
> +  record_module_name (aux_module->ident, lbasename (*iter));
>  }
>  }
>
> Index: coverage.c
> ===
> --- coverage.c  (revision 214320)
> +++ coverage.c  (working copy)
> @@ -658,7 +658,7 @@ typedef struct {
>
>  static vec *mod_names;
>
> -static void
> +void
>  record_module_name (unsigned int mod_id, const char *name)
>  {
>mod_id_to_name_t t;
> Index: l-ipo.h
> ===
> --- l-ipo.h (revision 214320)
> +++ l-ipo.h (working copy)
> @@ -63,6 +63,7 @@ int equivalent_struct_types_for_tbaa (const_tree t
>  void lipo_link_and_fixup (void);
>  extern void copy_defined_module_set (tree, tree);
>  extern bool is_parsing_done_p (void);
> +extern void record_module_name (unsigned int, const char *);
>  extern const char* get_module_name (unsigned int);
>
>  #endif
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [GOOGLE] Fix AutoFDO LIPO ICE due to eliminated abstract origin

2014-08-23 Thread Teresa Johnson
The ICE is, because we create a new node when querying the node during
symtab_remove_unreachable_nodes after LIPO linking is complete, and
then try to access its resolved node, for which there is none. Trunk
has the same code in these two locations, but the creation of a new
node after deleting the first does not cause any problems.
Teresa

On Sat, Aug 23, 2014 at 11:50 AM, Xinliang David Li  wrote:
> Is it a problem specific to LIPO?
>
> David
>
> On Sat, Aug 23, 2014 at 11:41 AM, Teresa Johnson  wrote:
>> This patch ensures we don't prematurely delete an abstract origin node, 
>> leading
>> to creating a new one after LIPO linking when we invoke similar handling in
>> symtab_remove_unreachable_nodes, which then does not have a resolved node. It
>> makes the handling of such nodes equivalent to that in
>> symtab_remove_unreachable_nodes.
>>
>> Tested with regression tests and internal benchmarks. Ok for google/4_9
>>
>> 2014-08-23  Teresa Johnson  
>>
>> Google ref b/16731481
>> * cgraphunit.c (analyze_functions): Don't remove origin node.
>>
>> Index: cgraphunit.c
>> ===
>> --- cgraphunit.c(revision 214320)
>> +++ cgraphunit.c(working copy)
>> @@ -1051,6 +1051,7 @@ analyze_functions (void)
>>   struct cgraph_node *origin_node
>>   = cgraph_get_node (DECL_ABSTRACT_ORIGIN (decl));
>>   origin_node->used_as_abstract_origin = true;
>> + enqueue_node (origin_node);
>> }
>> }
>>   else
>>
>> --
>> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413



-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [GOOGLE] Fix AutoFDO LIPO ICE due to eliminated abstract origin

2014-08-23 Thread Xinliang David Li
Ok for google branch.

David

On Sat, Aug 23, 2014 at 11:58 AM, Teresa Johnson  wrote:
> The ICE is, because we create a new node when querying the node during
> symtab_remove_unreachable_nodes after LIPO linking is complete, and
> then try to access its resolved node, for which there is none. Trunk
> has the same code in these two locations, but the creation of a new
> node after deleting the first does not cause any problems.
> Teresa
>
> On Sat, Aug 23, 2014 at 11:50 AM, Xinliang David Li  
> wrote:
>> Is it a problem specific to LIPO?
>>
>> David
>>
>> On Sat, Aug 23, 2014 at 11:41 AM, Teresa Johnson  
>> wrote:
>>> This patch ensures we don't prematurely delete an abstract origin node, 
>>> leading
>>> to creating a new one after LIPO linking when we invoke similar handling in
>>> symtab_remove_unreachable_nodes, which then does not have a resolved node. 
>>> It
>>> makes the handling of such nodes equivalent to that in
>>> symtab_remove_unreachable_nodes.
>>>
>>> Tested with regression tests and internal benchmarks. Ok for google/4_9
>>>
>>> 2014-08-23  Teresa Johnson  
>>>
>>> Google ref b/16731481
>>> * cgraphunit.c (analyze_functions): Don't remove origin node.
>>>
>>> Index: cgraphunit.c
>>> ===
>>> --- cgraphunit.c(revision 214320)
>>> +++ cgraphunit.c(working copy)
>>> @@ -1051,6 +1051,7 @@ analyze_functions (void)
>>>   struct cgraph_node *origin_node
>>>   = cgraph_get_node (DECL_ABSTRACT_ORIGIN (decl));
>>>   origin_node->used_as_abstract_origin = true;
>>> + enqueue_node (origin_node);
>>> }
>>> }
>>>   else
>>>
>>> --
>>> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
>
>
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


[PING^2] Re: [PATCH 1/2] Add -B support to gcc-ar/ranlib/nm

2014-08-23 Thread Andi Kleen
Andi Kleen  writes:

PING^2 !

Would be nice to make slim bootstrap work, it really speeds it up quite
a bit.

> From: Andi Kleen 
>
> To use gcc-{ar,ranlib} for boot strap we need to add a -B option
> to the tool. Since ar has weird and unusual argument conventions
> implement the code by hand instead of using any libraries.
>
> v2: Fix typo
>
> gcc/:
>
> 2014-08-04  Andi Kleen  
>
>   * gcc-ar.c (main): Support -B option.
> ---
>  gcc/gcc-ar.c | 41 +
>  1 file changed, 41 insertions(+)
>
> diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c
> index aebaa92..70bf222 100644
> --- a/gcc/gcc-ar.c
> +++ b/gcc/gcc-ar.c
> @@ -132,9 +132,50 @@ main (int ac, char **av)
>const char **nargv;
>bool is_ar = !strcmp (PERSONALITY, "ar");
>int exit_code = FATAL_EXIT_CODE;
> +  int i;
>  
>setup_prefixes (av[0]);
>  
> +  /* Not using getopt for now.  */
> +  for (i = 0; i < ac; i++)
> +  if (!strncmp (av[i], "-B", 2))
> + {
> +   const char *arg = av[i] + 2;
> +   const char *end;
> +
> +   memmove (av + i, av + i + 1, sizeof (char *) * ((ac + 1) - i));
> +   ac--;
> +   if (*arg == 0)
> + {
> +   arg = av[i + 1];
> +   if (!arg)
> + {
> +   fprintf (stderr, "Usage: gcc-ar [-B prefix] ar arguments 
> ...\n");
> +   exit (EXIT_FAILURE);
> + }
> +   memmove (av + i, av + i + 1, sizeof (char *) * ((ac + 1) - i));
> +   ac--;
> +   i++;
> + }
> +
> +   for (end = arg; *end; end++)
> + ;
> +   end--;
> +   if (end > arg && *end != '/')
> + {
> +   char *newarg = (char *)xmalloc (strlen(arg) + 2);
> +
> +   strcpy (newarg, arg);
> +   strcat (newarg, "/");
> +   arg = newarg;
> + }
> +
> +   add_prefix (&path, arg);
> +   add_prefix (&target_path, arg);
> +   break;
> + }
> +
> +
>/* Find the GCC LTO plugin */
>plugin = find_a_file (&target_path, LTOPLUGINSONAME, R_OK);
>if (!plugin)

-- 
a...@linux.intel.com -- Speaking for myself only


Re: C++ PATCH to support non-constexpr variable templates

2014-08-23 Thread Ville Voutilainen
Based on my quick tests with it, it seems to me that we need more
tests for static member variable templates. My first attempt at something
like that gave an ICE...


[PATCH. libstdc++] Use the correct C++14 __cplusplus value (201402L). Added C++1z to the preprocessor.

2014-08-23 Thread Ed Smith-Rowland
With revision 214400 we have the C++14 value of __cplusplus set to the 
correct value of 201402L (from 201300L).

We should use this in the std lib headers.  This patch does this.

Also, we've set C++14 value of __cplusplus to 201500L so we can start 
adding post-C++14 library bits with

#if __cplusplus > 201402L
...
#endif

Built and tested clean on x86_64-linux.

OK?


2014-08-23  Ed Smith-Rowland  <3dw...@verizon.net>

* libsupc++/new: Use the C++14 value of __cplusplus as appropriate.
* include/bits/parse_numbers.h: Ditto.
* include/bits/stl_function.h: Ditto.
* include/bits/unique_ptr.h: Ditto.
* include/bits/stl_algo.h: Ditto.
* include/bits/stl_algobase.h: Ditto.
* include/bits/basic_string.h: Ditto.
* include/std/complex: Ditto.
* include/std/iomanip: Ditto.
* include/std/utility: Ditto.
* include/std/type_traits: Ditto.
* include/std/tuple: Ditto.
* include/std/chrono: Ditto.
* include/parallel/algobase.h: Ditto.
Index: libsupc++/new
===
--- libsupc++/new   (revision 214399)
+++ libsupc++/new   (working copy)
@@ -81,7 +81,7 @@
 
   // We throw this exception for GNU VLAs of negative length in all C++
   // dialects, so declare it if we aren't in strict conformance mode.
-#if __cplusplus > 201103L || !defined(__STRICT_ANSI__)
+#if __cplusplus >= 201402L || !defined(__STRICT_ANSI__)
   class bad_array_length : public bad_alloc
   {
   public:
Index: include/bits/parse_numbers.h
===
--- include/bits/parse_numbers.h(revision 214399)
+++ include/bits/parse_numbers.h(working copy)
@@ -34,7 +34,7 @@
 
 // From n3642.pdf except I added binary literals and digit separator '\''.
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
 
 #include 
 
@@ -283,6 +283,6 @@
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // __cplusplus > 201103L
+#endif // __cplusplus >= 201402L
 
 #endif // _GLIBCXX_PARSE_NUMBERS_H
Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h (revision 214399)
+++ include/bits/stl_function.h (working copy)
@@ -56,7 +56,7 @@
 #ifndef _STL_FUNCTION_H
 #define _STL_FUNCTION_H 1
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
 #include 
 #endif
 
@@ -140,7 +140,7 @@
*  @{
*/
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   struct __is_transparent;  // undefined
 
   template
@@ -216,7 +216,7 @@
   { return -__x; }
 };
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   template<>
 struct plus
 {
@@ -311,7 +311,7 @@
*
*  @{
*/
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   template
 struct equal_to;
 
@@ -385,7 +385,7 @@
   { return __x <= __y; }
 };
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   /// One of the @link comparison_functors comparison functors@endlink.
   template<>
 struct equal_to
@@ -481,7 +481,7 @@
*
*  @{
*/
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   template
 struct logical_and;
 
@@ -519,7 +519,7 @@
   { return !__x; }
 };
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   /// One of the @link logical_functors Boolean operations functors@endlink.
   template<>
 struct logical_and
@@ -564,7 +564,7 @@
 #endif
   /** @}  */
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   template
 struct bit_and;
 
@@ -612,7 +612,7 @@
   { return ~__x; }
 };
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   template <>
 struct bit_and
 {
Index: include/bits/unique_ptr.h
===
--- include/bits/unique_ptr.h   (revision 214399)
+++ include/bits/unique_ptr.h   (working copy)
@@ -742,7 +742,7 @@
   }
 };
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   template
 struct _MakeUniq
 { typedef unique_ptr<_Tp> __single_object; };
Index: include/bits/stl_algo.h
===
--- include/bits/stl_algo.h (revision 214399)
+++ include/bits/stl_algo.h (working copy)
@@ -3570,7 +3570,7 @@
   __gnu_cxx::__ops::__iter_comp_iter(__pred));
 }
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   template
 bool
Index: include/bits/stl_algobase.h
===
--- include/bits/stl_algobase.h (revision 214399)
+++ include/bits/stl_algobase.h (working copy)
@@ -1090,7 +1090,7 @@
   return true;
 }
 
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
   /**
*  @brief Tests a range for element-wise equality.
*  @ingroup non_mutating_algorithms
@@ -1326,7 +1326,7 @@
__gnu_cxx::__ops::__iter_comp_i

[patch, fortran] use vec<> in frontend-passes.c

2014-08-23 Thread Thomas Koenig
Hello world,

the attached patch uses the vec<> templates instead of the
home-grown memory management.

Did I get the style right?  I was a bit confused because, with
the declarations used in the patch, using the vec_safe_truncate
function failed with a failure to find the right template.
I'm not an experienced C++ programmer, so I would appreciate a quick
look at what I did.

Regression-tested.  No test case because there is no new
functionality.

OK for trunk?  Any other comments?

Thomas

2014-08-24  Thomas Koenig  

* frontend_passes (expr_array):  Replace by vec template.
(expr_size):  Remove.
(expr_count):  Remove.
(doloop_list):  Replace by vec template.
(doloop_size):  Remove.
(gfc_run_passes):  Adjust to use of vec template.
(cfe_register_funcs):  Likewise.
(cfe_expr_0):  Likewise.
(doloop_code):  Likewise.
Index: frontend-passes.c
===
--- frontend-passes.c	(Revision 214281)
+++ frontend-passes.c	(Arbeitskopie)
@@ -50,8 +50,7 @@ static int count_arglist;
 /* Pointer to an array of gfc_expr ** we operate on, plus its size
and counter.  */
 
-static gfc_expr ***expr_array;
-static int expr_size, expr_count;
+static vec expr_array = vec();
 
 /* Pointer to the gfc_code we currently work on - to be able to insert
a block before the statement.  */
@@ -81,9 +80,10 @@ static int iterator_level;
 
 /* Keep track of DO loop levels.  */
 
-static gfc_code **doloop_list;
-static int doloop_size, doloop_level;
+static vec doloop_list = vec();
 
+static int doloop_level;
+
 /* Vector of gfc_expr * to keep track of DO loops.  */
 
 struct my_struct *evec;
@@ -101,23 +101,19 @@ gfc_run_passes (gfc_namespace *ns)
   /* Warn about dubious DO loops where the index might
  change.  */
 
-  doloop_size = 20;
   doloop_level = 0;
-  doloop_list = XNEWVEC(gfc_code *, doloop_size);
+  //  doloop_list = ;
   doloop_warn (ns);
-  XDELETEVEC (doloop_list);
+  doloop_list.truncate (0);
 
   if (gfc_option.flag_frontend_optimize)
 {
-  expr_size = 20;
-  expr_array = XNEWVEC(gfc_expr **, expr_size);
-
   optimize_namespace (ns);
   optimize_reduction (ns);
   if (gfc_option.dump_fortran_optimized)
 	gfc_dump_parse_tree (ns, stdout);
 
-  XDELETEVEC (expr_array);
+  expr_array.truncate (0);
 }
 }
 
@@ -420,13 +416,7 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtre
 	return 0;
 }
 
-  if (expr_count >= expr_size)
-{
-  expr_size += expr_size;
-  expr_array = XRESIZEVEC(gfc_expr **, expr_array, expr_size);
-}
-  expr_array[expr_count] = e;
-  expr_count ++;
+  expr_array.safe_push (e);
   return 0;
 }
 
@@ -599,6 +589,7 @@ cfe_expr_0 (gfc_expr **e, int *walk_subtrees,
 {
   int i,j;
   gfc_expr *newvar;
+  gfc_expr **ei, **ej;
 
   /* Don't do this optimization within OMP workshare. */
 
@@ -608,36 +599,35 @@ cfe_expr_0 (gfc_expr **e, int *walk_subtrees,
   return 0;
 }
 
-  expr_count = 0;
+  expr_array.truncate (0);
 
   gfc_expr_walker (e, cfe_register_funcs, NULL);
 
   /* Walk through all the functions.  */
 
-  for (i=1; iexpr_type == EXPR_VARIABLE)
+  if ((*ei)->expr_type == EXPR_VARIABLE)
 	continue;
 
   newvar = NULL;
-  for (j=0; jop)
 {
+
 case EXEC_DO:
 
-  /* Grow the temporary storage if necessary.  */
-  if (doloop_level >= doloop_size)
-	{
-	  doloop_size = 2 * doloop_size;
-	  doloop_list = XRESIZEVEC (gfc_code *, doloop_list, doloop_size);
-	}
-
-  /* Mark the DO loop variable if there is one.  */
   if (co->ext.iterator && co->ext.iterator->var)
-	doloop_list[doloop_level] = co;
+	doloop_list.safe_push (co);
   else
-	doloop_list[doloop_level] = NULL;
+	doloop_list.safe_push ((gfc_code *) NULL);
   break;
 
 case EXEC_CALL:
@@ -1708,14 +1697,14 @@ doloop_code (gfc_code **c, int *walk_subtrees ATTR
 
   while (a && f)
 	{
-	  for (i=0; iext.iterator->var->symtree->n.sym;
+	  do_sym = cl->ext.iterator->var->symtree->n.sym;
 	  
 	  if (a->expr && a->expr->symtree
 		  && a->expr->symtree->n.sym == do_sym)
@@ -1968,7 +1957,6 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code
 
 	  switch (co->op)
 	{
-
 	case EXEC_BLOCK:
 	  WALK_SUBCODE (co->ext.block.ns->code);
 	  if (co->ext.block.assoc)


Re: [patch, fortran] use vec<> in frontend-passes.c

2014-08-23 Thread Trevor Saunders
On Sun, Aug 24, 2014 at 12:47:17AM +0200, Thomas Koenig wrote:
> Hello world,
> 
> the attached patch uses the vec<> templates instead of the
> home-grown memory management.
> 
> Did I get the style right?  I was a bit confused because, with
> the declarations used in the patch, using the vec_safe_truncate
> function failed with a failure to find the right template.
> I'm not an experienced C++ programmer, so I would appreciate a quick
> look at what I did.
> 
> Regression-tested.  No test case because there is no new
> functionality.
> 
> OK for trunk?  Any other comments?
> 
>   Thomas
> 
> 2014-08-24  Thomas Koenig  
> 
> * frontend_passes (expr_array):  Replace by vec template.
> (expr_size):  Remove.
> (expr_count):  Remove.
> (doloop_list):  Replace by vec template.
> (doloop_size):  Remove.
> (gfc_run_passes):  Adjust to use of vec template.
> (cfe_register_funcs):  Likewise.
> (cfe_expr_0):  Likewise.
> (doloop_code):  Likewise.

> Index: frontend-passes.c
> ===
> --- frontend-passes.c (Revision 214281)
> +++ frontend-passes.c (Arbeitskopie)
> @@ -50,8 +50,7 @@ static int count_arglist;
>  /* Pointer to an array of gfc_expr ** we operate on, plus its size
> and counter.  */
>  
> -static gfc_expr ***expr_array;
> -static int expr_size, expr_count;
> +static vec expr_array = vec();

that's usually written as just static vec foo; vec doesn't actually
have ctors, and 0 initialization works fine.

>  /* Pointer to the gfc_code we currently work on - to be able to insert
> a block before the statement.  */
> @@ -81,9 +80,10 @@ static int iterator_level;
>  
>  /* Keep track of DO loop levels.  */
>  
> -static gfc_code **doloop_list;
> -static int doloop_size, doloop_level;
> +static vec doloop_list = vec();

same

> @@ -101,23 +101,19 @@ gfc_run_passes (gfc_namespace *ns)
>/* Warn about dubious DO loops where the index might
>   change.  */
>  
> -  doloop_size = 20;
>doloop_level = 0;
> -  doloop_list = XNEWVEC(gfc_code *, doloop_size);
> +  //  doloop_list = ;

what is this comment supposed to mean?

>doloop_warn (ns);
> -  XDELETEVEC (doloop_list);
> +  doloop_list.truncate (0);

.release () would be more typical.

>  
>if (gfc_option.flag_frontend_optimize)
>  {
> -  expr_size = 20;
> -  expr_array = XNEWVEC(gfc_expr **, expr_size);
> -
>optimize_namespace (ns);
>optimize_reduction (ns);
>if (gfc_option.dump_fortran_optimized)
>   gfc_dump_parse_tree (ns, stdout);
>  
> -  XDELETEVEC (expr_array);
> +  expr_array.truncate (0);

same

> @@ -608,36 +599,35 @@ cfe_expr_0 (gfc_expr **e, int *walk_subtrees,
>return 0;
>  }
>  
> -  expr_count = 0;
> +  expr_array.truncate (0);

.release ()

>gfc_expr_walker (e, cfe_register_funcs, NULL);
>  
>/* Walk through all the functions.  */
>  
> -  for (i=1; i +  for (i=1; expr_array.iterate (i, &ei); i++)

FOR_EACH_VEC_ELT, though Its not really clear to my why that's better
than
size_t length = vec.length ();
for (size_t i = 0; i < length; i++)
  // do something with vec[i]

>  {
>/* Skip if the function has been replaced by a variable already.  */
> -  if ((*(expr_array[i]))->expr_type == EXPR_VARIABLE)
> +  if ((*ei)->expr_type == EXPR_VARIABLE)
>   continue;
>  
>newvar = NULL;
> -  for (j=0; j +  for (j=0; j

Re: [PATCH] Fix comment typo in ira.c

2014-08-23 Thread Chung-Ju Wu
2014-08-19 22:04 GMT+08:00 Vladimir Makarov :
> On 08/18/2014 10:51 AM, Kito Cheng wrote:
>> Hi Vladimir:
>>
>> Here is a tiny typo in comment, allono -> allocno.
>>
>> ChangLog
>> 2014-08-18  Kito Cheng  
>>
>> * ira.c: Fix typo in comment.
> Thanks, Kito.  Of course, the patch is ok.  You can commit it if it is
> not committed yet.
>

It seems that Kito has not got his svn write access yet.
I can help him to commit this patch.

Committed as Rev.214404.
  https://gcc.gnu.org/r214404


Best regards,
jasonwucj


Re: [PATCH] Remove CALLER_SAVE_PROFITABLE since nobody use it now

2014-08-23 Thread Chung-Ju Wu
2014-08-22 1:45 GMT+08:00 Joseph S. Myers :
> On Thu, 21 Aug 2014, Richard Earnshaw wrote:
>
>> On 19/08/14 15:24, Kito Cheng wrote:
>> > Hi Richard:
>> >> Hmm, I'm not sure about this.  It might not be used at present, but on:
>> >> AArch64, with more call-clobbered registers than call-saved registers, I
>> >> would expect this ought to be a win.  The fact that it isn't on today
>> >> may say more about the way it works than the concept that it's the wrong
>> >> thing to do in principle.
>> >
>> > In my view, calculate cost/profit should be done by register allocator 
>> > instead
>> > of a target hook/marco is more reasonable since register allocator can
>> > have more globe view to it, and IRA do it now.
>> >
>> > And as Joseph say, no code calling it, so I think it's time to remove it.
>> > thanks for your comment :)
>>
>> Objection withdrawn.
>
> Thanks.  The patch is OK.
>

Hi, Joseph,

Kito talked to me that he has signed FSF agreement
but has not got his svn write access yet.
So I help to commit this patch for him (Rev.214405).
  https://gcc.gnu.org/r214405

I think he needs to finish this form
https://sourceware.org/cgi-bin/pdw/ps_form.cgi
so that he can commit patches on his own in the future.
Could Kito list you as the one who approve his write access request?
Or could you suggest someone who may help with it? :)


Best regards,
jasonwucj


> --
> Joseph S. Myers
> jos...@codesourcery.com


Re: [PATCH 142/236] config/nds32: Use rtx_insn

2014-08-23 Thread Chung-Ju Wu
2014-08-07 1:22 GMT+08:00 David Malcolm :
> gcc/
> * config/nds32/nds32-protos.h (nds32_adjust_insn_length):
> Strengthen first param from rtx to rtx_insn *.
> * config/nds32/nds32.c (nds32_adjust_insn_length): Likewise for
> param "insn".
> ---
>  gcc/config/nds32/nds32-protos.h | 2 +-
>  gcc/config/nds32/nds32.c| 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/nds32/nds32-protos.h b/gcc/config/nds32/nds32-protos.h
> index 6d94027..ddcec9c 100644
> --- a/gcc/config/nds32/nds32-protos.h
> +++ b/gcc/config/nds32/nds32-protos.h
> @@ -92,7 +92,7 @@ extern int nds32_can_use_bitci_p (int);
>
>  /* Auxiliary function for 'Computing the Length of an Insn'.  */
>
> -extern int nds32_adjust_insn_length (rtx, int);
> +extern int nds32_adjust_insn_length (rtx_insn *, int);
>
>  /* Auxiliary functions for FP_AS_GP detection.  */
>
> diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
> index 47b1318..47e5ae4 100644
> --- a/gcc/config/nds32/nds32.c
> +++ b/gcc/config/nds32/nds32.c
> @@ -4412,7 +4412,7 @@ nds32_valid_stack_push_pop (rtx op, bool push_p)
> Modifies the length assigned to instruction INSN.
> LEN is the initially computed length of the insn.  */
>  int
> -nds32_adjust_insn_length (rtx insn, int length)
> +nds32_adjust_insn_length (rtx_insn *insn, int length)
>  {
>rtx src, dst;
>
> --

The changes in nds32 part are obvious to me.
I will check bootstrap and regression if there is any problem.

Thank you, David. :)


Best reagrds,
jasonwucj