[PATCH] Fix PR55270

2013-01-29 Thread Richard Biener

This fixes PR55270 - we need to fixup loops after phicprop as
that removes edges without doing so.  The following patch makes
us rely on cfgcleanup scheduled after the pass for this.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2013-01-29  Richard Biener  

PR tree-optimization/55270
* tree-ssa-dom.c (eliminate_degenerate_phis): If we changed
the CFG, schedule loops for fixup.

* gcc.dg/torture/pr55270.c: New testcase.

Index: gcc/tree-ssa-dom.c
===
--- gcc/tree-ssa-dom.c  (revision 195530)
+++ gcc/tree-ssa-dom.c  (working copy)
@@ -3006,7 +3006,12 @@ eliminate_degenerate_phis (void)
 }
 
   if (cfg_altered)
-free_dominance_info (CDI_DOMINATORS);
+{
+  free_dominance_info (CDI_DOMINATORS);
+  /* If we changed the CFG schedule loops for fixup by cfgcleanup.  */
+  if (current_loops)
+   loops_state_set (LOOPS_NEED_FIXUP);
+}
 
   /* Propagation of const and copies may make some EH edges dead.  Purge
  such edges from the CFG as needed.  */
Index: gcc/testsuite/gcc.dg/torture/pr55270.c
===
--- gcc/testsuite/gcc.dg/torture/pr55270.c  (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr55270.c  (working copy)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+unsigned a, b, c;
+
+void f(void)
+{
+  for(; a; a++)
+{
+  long *p1 = (long *)&b;
+
+  if(*p1)
+   return;
+
+  if(b && (*p1 = b) || c && ++*p1)
+   {
+ unsigned *p2 = &b;
+
+ for(*p2 = 0; *p2 < 1;)
+   for(; b; b++);
+   }
+}
+}


[PATCH][RFC] Add -fno-aggressive-loop-optimizations

2013-01-29 Thread Richard Biener

The following patch adds -faggressive-loop-optimizations, enabled by
default, guarding the use of language constraints for number of
iteration analysis.  Starting with GCC 4.8 we more aggressively
make use of iteration bounds derived from those constraints
which for example breaks SPEC CPU 2006 464.h264ref which is
not C99 conforming but SPEC folks think it is not in the spirit
of theirs to fix such issues (but we compiler folks have to deal
with that - where the language standard interpretation would
be to DWIM, thus let SPEC pass).

Thus, GCC 4.8 will need -fno-aggressive-loop-optimizations in
base flags to compile official SPEC CPU 2006 sources (as opposed
to local patched ones).  I suppose I'll add a sentence to
changes.html reflecting that fact.

Note that using this flag will disable using of language constraints
of this kind from number-of-iteration analysis completely
(mind, that's not previous behavior - previous behavior just used
the resulting information in less places).  It places it in the
same ballpark as -fno-strict-aliasing and -fno-strict-overflow.
Thus, no guarantees - it does not make out-of-bound array accesses
in any way more valid - your broken code may still be optimized
in unexpected ways.  It just disables one source of "unexpectedness".
No testcase added for that reason.

Thus, any objections to providing this switch guarding an
implementation detail of number of iteration analysis?

I'm curious about the affect of -fno-aggressive-loop-optimizations
on SPEC CPU 2006 numbers (not curious enough to try for myself
though).  Both on extra PASSes for official latest sources
(I have no access to those) and on performance.

Thanks,
Richard.

2013-01-29  Richard Biener  

PR middle-end/53073
* common.opt (faggressive-loop-optimizations): New flag,
enabled by default.
* doc/invoke.texi (faggressive-loop-optimizations): Document.
* tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Guard
infer_loop_bounds_from_undefined by it.

Index: gcc/common.opt
===
*** gcc/common.opt  (revision 195530)
--- gcc/common.opt  (working copy)
*** Driver Undocumented
*** 792,797 
--- 792,801 
  fabi-version=
  Common Joined RejectNegative UInteger Var(flag_abi_version) Init(2)
  
+ faggressive-loop-optimizations
+ Common Report Var(flag_aggressive_loop_optimizations) Optimization Init(1) 
+ Aggressively optimize loops using language constraints
+ 
  falign-functions
  Common Report Var(align_functions,0) Optimization UInteger
  Align the start of functions
Index: gcc/doc/invoke.texi
===
*** gcc/doc/invoke.texi (revision 195530)
--- gcc/doc/invoke.texi (working copy)
*** Objective-C and Objective-C++ Dialects}.
*** 349,355 
  
  @item Optimization Options
  @xref{Optimize Options,,Options that Control Optimization}.
! @gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
  -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
  -fassociative-math -fauto-inc-dec -fbranch-probabilities @gol
  -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
--- 349,356 
  
  @item Optimization Options
  @xref{Optimize Options,,Options that Control Optimization}.
! @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
! -falign-jumps[=@var{n}] @gol
  -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
  -fassociative-math -fauto-inc-dec -fbranch-probabilities @gol
  -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
*** When @option{-fgcse-after-reload} is ena
*** 6988,6993 
--- 6989,7004 
  pass is performed after reload.  The purpose of this pass is to clean up
  redundant spilling.
  
+ @item -faggressive-loop-optimizations
+ @opindex faggressive-loop-optimizations
+ This option tells the loop optimizer to use language constraints to
+ derive bounds for the number of iterations of a loop.  This assumes that
+ loop code does not invoke undefined behavior by for example causing signed
+ integer overflows or out-of-bound array accesses.  The bounds for the
+ number of iterations of a loop are used to guide loop unrolling and peeling
+ and loop exit test optimizations.
+ This option is enabled by default.
+ 
  @item -funsafe-loop-optimizations
  @opindex funsafe-loop-optimizations
  This option tells the loop optimizer to assume that loop indices do not
Index: gcc/tree-ssa-loop-niter.c
===
*** gcc/tree-ssa-loop-niter.c   (revision 195530)
--- gcc/tree-ssa-loop-niter.c   (working copy)
*** estimate_numbers_of_iterations_loop (str
*** 3336,3342 
  }
exits.release ();
  
!   infer_loop_bounds_from_undefined (loop);
  
discover_iteration_bound_by_body_walk (loop);
  
--- 3336,3343 
  }
exits.release ();
  
!   

Re: [Patch] PR56064: Fold VIEW_CONVERT_EXPR with FIXED_CST

2013-01-29 Thread Richard Biener
On Mon, Jan 21, 2013 at 2:28 PM, Georg-Johann Lay  wrote:
> This is tentative patch as discussed in
>
> http://gcc.gnu.org/ml/gcc/2013-01/msg00187.html
>
> fold-const.c gets 2 new function native_encode_fixed and
> native_interpret_fixed.  Code common with the integer case is factored out and
> moved to the new constructor-like function double_int::from_buffer.
>
> The code bootstraps fine on x86-linux-gnu and I have test coverage from
> avr-unknown-none.
>
> Ok to apply?

Ok.

Thanks,
Richard.

> There are less intrusive solutions that only handle the int <-> fixed cases,
> for example fold-const.c:fold_view_convert_expr() could test for these cases
> and use double_int directly without serializing / deserializing through a
> memory buffer.
>
> Johann
>
>
> PR tree-optimization/56064
> * fixed-value.c (const_fixed_from_double_int): New function.
> * fixed-value.h (const_fixed_from_double_int): New prototype.
> * fold-const.c (native_interpret_fixed): New static function.
> (native_interpret_expr) : Use it.
> (can_native_interpret_type_p) : Return true.
> (native_encode_fixed): New static function.
> (native_encode_expr) : Use it.
> (native_interpret_int): Move double_int worker code to...
> * double-int.c (double_int::from_buffer): ...this new static method.
> * double-int.h (double_int::from_buffer): Prototype it.
>
> testsuite/
> PR tree-optimization/56064
> * gcc.dg/fixed-point/view-convert.c: New test.


Re: SLP for vectors

2013-01-29 Thread Richard Biener
On Sun, Jan 27, 2013 at 4:28 PM, Marc Glisse  wrote:
> Hello,
>
> this message is to check that I am not doing something absurd and ask for a
> bit of advice.
>
> In the attached patch, I let SLP recognize vector loads/stores just like it
> recognizes those in an array. It has a few issues: the cost of the
> vectorized version is overestimated, the base object is wrong (doesn't strip
> the bit_field_ref, but since the base address is right and the base object
> is almost unused...), but most importantly it only works if the vectors have
> their address taken, otherwise (after asking gimple_vuse?) SLP doesn't
> detect their use as loads or stores at all.

Yes, if they have not their address taken they are not loads.

> Also, it only works if you write
> result[0]=..., result[1]=... and does not recognize a constructor as a
> series of stores.
>
> Is slowly extending SLP the right way to go? Should get_references_in_stmt
> report vector element accesses?

It does if it is a memory access.

You didn't provide a new testcase so it's hard for me to guess what you
are trying to do.  I suppose you want to vectorize

   w[0] = v[0] + v[0];
   w[1] = v[1] + v[1];

into

   w = v + v;

As it would work if w and v are array accesses instead of vector subscripts?
Note that similar issues (and bugreports) exist for complex component accesses.

So yes, handling BIT_FIELD_REF in the vectorizer looks like the correct
way to do - but mind that you should constrain the BIT_FIELD_REFs you
allow (I suppose in the end that's properly done by other part of the analysis).

As of handling non-memory BIT_FIELD_REFs - I suggest to split out
the test of whether a stmt is considered a "load" for the purpose of
vectorization and simply special-case this therein, not requiring a VUSE.

I suppose the data-ref analysis parts are not strictly required, nor
the get_addr_base_and_unit_offset_1 parts?  They should be split out
and separately tested anyway.  The data-ref part at least will confuse
analysis of 'a[0]' or 'a[1]' vs. 'a', but I suppose independent of the patch.

Richard.

> (the patch as is passes the testsuite on x86_64-linux and vectorizes the few
> examples I tried)
>
> --
> Marc Glisse
> Index: gcc/tree-vect-stmts.c
> ===
> --- gcc/tree-vect-stmts.c   (revision 195493)
> +++ gcc/tree-vect-stmts.c   (working copy)
> @@ -3860,20 +3860,21 @@ vectorizable_store (gimple stmt, gimple_
>/* Is vectorizable store? */
>
>if (!is_gimple_assign (stmt))
>  return false;
>
>scalar_dest = gimple_assign_lhs (stmt);
>if (TREE_CODE (scalar_dest) == VIEW_CONVERT_EXPR
>&& is_pattern_stmt_p (stmt_info))
>  scalar_dest = TREE_OPERAND (scalar_dest, 0);
>if (TREE_CODE (scalar_dest) != ARRAY_REF
> +  && TREE_CODE (scalar_dest) != BIT_FIELD_REF
>&& TREE_CODE (scalar_dest) != INDIRECT_REF
>&& TREE_CODE (scalar_dest) != COMPONENT_REF
>&& TREE_CODE (scalar_dest) != IMAGPART_EXPR
>&& TREE_CODE (scalar_dest) != REALPART_EXPR
>&& TREE_CODE (scalar_dest) != MEM_REF)
>  return false;
>
>gcc_assert (gimple_assign_single_p (stmt));
>op = gimple_assign_rhs1 (stmt);
>if (!vect_is_simple_use (op, stmt, loop_vinfo, bb_vinfo, &def_stmt,
> @@ -4394,20 +4395,21 @@ vectorizable_load (gimple stmt, gimple_s
>/* Is vectorizable load? */
>if (!is_gimple_assign (stmt))
>  return false;
>
>scalar_dest = gimple_assign_lhs (stmt);
>if (TREE_CODE (scalar_dest) != SSA_NAME)
>  return false;
>
>code = gimple_assign_rhs_code (stmt);
>if (code != ARRAY_REF
> +  && code != BIT_FIELD_REF
>&& code != INDIRECT_REF
>&& code != COMPONENT_REF
>&& code != IMAGPART_EXPR
>&& code != REALPART_EXPR
>&& code != MEM_REF
>&& TREE_CODE_CLASS (code) != tcc_declaration)
>  return false;
>
>if (!STMT_VINFO_DATA_REF (stmt_info))
>  return false;
> Index: gcc/tree-vect-slp.c
> ===
> --- gcc/tree-vect-slp.c (revision 195493)
> +++ gcc/tree-vect-slp.c (working copy)
> @@ -660,20 +660,21 @@ vect_build_slp_tree (loop_vec_info loop_
> }
>else
> {
>   if (first_stmt_code != rhs_code
>   && (first_stmt_code != IMAGPART_EXPR
>   || rhs_code != REALPART_EXPR)
>   && (first_stmt_code != REALPART_EXPR
>   || rhs_code != IMAGPART_EXPR)
>&& !(STMT_VINFO_GROUPED_ACCESS (vinfo_for_stmt (stmt))
> && (first_stmt_code == ARRAY_REF
> +   || first_stmt_code == BIT_FIELD_REF
> || first_stmt_code == INDIRECT_REF
> || first_stmt_code == COMPONENT_REF
> || first_stmt_code == MEM_REF)))
> {
>   if (dump_enabled_p ())
> {
>   dump_printf_l

Re: libgo patch committed: Support sparc64 in lfstack.c

2013-01-29 Thread Rainer Orth
Ian Lance Taylor  writes:

> Looks like sparc64 broke for libgo when parallel garbage collection was
> introduced.  This patch is an attempt to get it working again.
> Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu, not that
> that proves much.  Committed to mainline.

I needed the following patch on top of yours to get it to compile on
Solaris/SPARC.  The #undefs are necessary to avoid redefinition
errors.  This massivly improves Solaris/SPARC testsuite results,
though there are still a few common Solaris failures and a few others
that might be endianess issues.

Rainer


diff --git a/libgo/runtime/lfstack.c b/libgo/runtime/lfstack.c
--- a/libgo/runtime/lfstack.c
+++ b/libgo/runtime/lfstack.c
@@ -19,7 +19,10 @@
 
 #if __SIZEOF_POINTER__ == 8 && defined(__sparc__)
 // SPARC64 uses all 64 bits of virtual addresses.  Use low-order three
-bits as ABA counter.
+// bits as ABA counter.
+#undef PTR_BITS
+#undef CNT_MASK
+#undef PTR_MASK
 #define PTR_BITS 0
 #define CNT_MASK 7
 #define PTR_MASK ((0ull-1)<<3)

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[build] Properly set progbits/nobits for Solaris/SPARC as

2013-01-29 Thread Rainer Orth
As originally reported as binutils PR ld/15057, several gfortran tests
are failing on Solaris/SPARC with Sun as and GNU ld like this:

FAIL: gfortran.dg/coarray/alloc_comp_1.f90 -fcoarray=lib  -O2  -lcaf_single 
(test for excess errors)
Excess errors:
/vol/gcc/bin/gld-2.23.1: warning: section `.bss' type changed to PROGBITS

As analyzed in the PR, this happens because .bss.* sections are not
marked as SHT_NOBITS when Sun as is in use.  The following patch fixes
this; it should be low-risk since the result of the configure test
(necessary since only Solaris 10/SPARC as added #nobits/#progbits
support) is only used in a Solaris-specific function.

Bootstrapped without regressions on sparc-sun-solaris2.11 (as/gld,
gas/gld in progress), ok for mainline?

Rainer


2013-01-25  Rainer Orth  

* configure.ac (HAVE_AS_SPARC_NOBITS): New test.
* configure: Regenerate.
* config.in: Regenerate.
* config/sparc/sparc.c (sparc_solaris_elf_asm_named_section): Emit
#nobits/#progbits if supported.

# HG changeset patch
# Parent 85fc0b8b3ae505640c01266617905fe671551692
Properly set progbits/nobits for Solaris/SPARC as

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -9512,7 +9512,14 @@ sparc_solaris_elf_asm_named_section (con
   if (flags & SECTION_CODE)
 fputs (",#execinstr", asm_out_file);
 
-  /* ??? Handle SECTION_BSS.  */
+  /* Sun as only supports #nobits/#progbits since Solaris 10.  */
+  if (HAVE_AS_SPARC_NOBITS)
+{
+  if (flags & SECTION_BSS)
+	fputs (",#nobits", asm_out_file);
+  else
+	fputs (",#progbits", asm_out_file);
+}
 
   fputc ('\n', asm_out_file);
 }
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3461,6 +3461,13 @@ case "$target" in
   [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
 		[Define if your assembler supports .register.])])
 
+gcc_GAS_CHECK_FEATURE([@%:@nobits], gcc_cv_as_sparc_nobits,,,
+  [.section "nobits",#alloc,#write,#nobits
+   .section "progbits",#alloc,#write,#progbits])
+AC_DEFINE_UNQUOTED(HAVE_AS_SPARC_NOBITS,
+  [`if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`],
+  [Define to 1 if your assembler supports #nobits, 0 otherwise.])
+
 gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
   [-relax], [.text],,
   [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] Add faster HTM fastpath for libitm TSX

2013-01-29 Thread Torvald Riegel
On Thu, 2013-01-24 at 17:45 +0100, Andi Kleen wrote:
> > 
> > > +  uint32_t *__gtm_global_lock;
> > 
> > Same, and rearrange the serial lock's fields (see below).
> 
> My understanding is that C++ makes no guarantees of class layout.
> That is why i ended up not relying on the layout.

gtm_rwlock is a POD type, so you get the guarantees that C would
provide.

Torvald



[PATCH] Fix PR56113

2013-01-29 Thread Richard Biener

This reduces the amount of memory needed by PTA pointer unification
which has quadratic memory requirements.  It's very easy to improve
the situation where a lot of pointer equivalences are present
by not keeping duplicate bitmaps we unify using a hashtable already.
This reduces the overhead of the testcase in the PR from requiring
peak 2.5GB to 1.4MB instead.  This doesn't change the fact that
the algorithm is quadratic in its memory requirements (worst memory
requirements when it doesn't produce anything useful in the end).

Bootstrap and regtest running on x86_64-unknown-linux-gnu.  I plan
to install this on trunk and the 4.7 branch for the general
memory-hog regressions.

Richard.

2013-01-29  Richard Biener  

PR tree-optimization/56113
* tree-ssa-structalias.c (equiv_class_lookup): Also return
the bitmap leader.
(label_visit): Free duplicate bitmaps and record the leader instead.
(perform_var_substitution): Adjust.

Index: gcc/tree-ssa-structalias.c
===
--- gcc/tree-ssa-structalias.c  (revision 195532)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -1907,10 +1908,10 @@ equiv_class_label_eq (const void *p1, co
 }
 
 /* Lookup a equivalence class in TABLE by the bitmap of LABELS it
-   contains.  */
+   contains.  Sets *REF_LABELS to the bitmap LABELS is equivalent to.  */
 
 static unsigned int
-equiv_class_lookup (htab_t table, bitmap labels)
+equiv_class_lookup (htab_t table, bitmap labels, bitmap *ref_labels)
 {
   void **slot;
   struct equiv_class_label ecl;
@@ -1921,9 +1922,18 @@ equiv_class_lookup (htab_t table, bitmap
   slot = htab_find_slot_with_hash (table, &ecl,
   ecl.hashcode, NO_INSERT);
   if (!slot)
-return 0;
+{
+  if (ref_labels)
+   *ref_labels = NULL;
+  return 0;
+}
   else
-return ((equiv_class_label_t) *slot)->equivalence_class;
+{
+  equiv_class_label_t ec = (equiv_class_label_t) *slot;
+  if (ref_labels)
+   *ref_labels = ec->labels;
+  return ec->equivalence_class;
+}
 }
 
 
@@ -2123,14 +2133,21 @@ label_visit (constraint_graph_t graph, s
 
   if (!bitmap_empty_p (graph->points_to[n]))
 {
+  bitmap ref_points_to;
   unsigned int label = equiv_class_lookup (pointer_equiv_class_table,
-  graph->points_to[n]);
+  graph->points_to[n],
+  &ref_points_to);
   if (!label)
{
  label = pointer_equiv_class++;
  equiv_class_add (pointer_equiv_class_table,
   label, graph->points_to[n]);
}
+  else
+   {
+ BITMAP_FREE (graph->points_to[n]);
+ graph->points_to[n] = ref_points_to;
+   }
   graph->pointer_label[n] = label;
 }
 }
@@ -2190,7 +2223,7 @@ perform_var_substitution (constraint_gra
   /* Look up the location equivalence label if one exists, or make
 one otherwise.  */
   label = equiv_class_lookup (location_equiv_class_table,
- pointed_by);
+ pointed_by, NULL);
   if (label == 0)
{
  label = location_equiv_class++;


Re: Update my entry into the contributions

2013-01-29 Thread Aldy Hernandez
Andrew Pinski  writes:

> +gimple interal representation of pointer addition, and for various

s/interal/internal/


Re: [PATCH] Add faster HTM fastpath for libitm TSX v2

2013-01-29 Thread Torvald Riegel
On Thu, 2013-01-24 at 19:30 -0800, Andi Kleen wrote:
> From: Andi Kleen 
> 
> The libitm TSX hardware transaction fast path currently does quite a bit of
> unnecessary work (saving registers etc.) before even trying to start
> a hardware transaction. This patch moves the initial attempt at a
> transaction early into the assembler stub. Complicated work like retries
> is still done in C. So this is essentially a fast path for the fast
> path.
> 
> The assembler code doesn't understand the layout of "serial_lock", but
> it needs to check that serial_lock is free. We export just the lock
> variable as a separate pointer for this.
> 
> The assembler code controls the HTM fast path with a new pr_tryHTM flag.
> 
> I had to reorganize the retry loop slightly so that the waiting for the
> lock to be free again is done first (because the first transaction
> is already done elsewhere). This makes the patch look larger than
> it really is. This just moves one basic block around.
> 
> Passes bootstrap/testsuite on x86_64
> 
> v2: Use asm() to supply assembler name of namespaced variables
> Make comments more verbose.

Andi,

next time please reply to the points raised in a review if you disagree
with them, and don't just ignore them.  That speeds up the review.

> libitm/:
> 2013-01-24  Andi Kleen  
> 
>   * beginend.cc (GTM::htm_fastpath): Add asm alias to
>   __gtm_htm_fastpath
>   (GTM::global_lock): Add.
>   (begin_transaction): Check pr_tryHTM. Remove one iteration
>   from HTM retry loop. Move lock free check to the beginning of
>   loop body.
>   * config/linux/rwlock.h (gtm_rwlock::get_lock_var): Add.
>   * config/posix/rwlock.h (tm_rwlock::get_lock_var): Add.
>   * config/x86/sjlj.S: Include config.h.
>   (pr_tryHTM, pr_uninstrumentedCode, pr_hasNoAbort,
>a_runInstrumentedCode, a_runUninstrumentedCode,
>_XABORT_EXPLICIT, _XABORT_RETRY): Add defines.
>   (_ITM_beginTransaction): Add HTM fast path.
>   * libitm.h (pr_tryHTM): Add.
>   * libitm_i.h (GTM::htm_fastpath): Add asm alias.
>   (GTM::gtm_global_lock): Add.
>   * method-serial.cc (method_group::init, fini): Initialize
>   GTM::global_lock and GTM::htm_fastpath.
> ---
>  libitm/beginend.cc   |   46 +++--
>  libitm/config/linux/rwlock.h |5 +
>  libitm/config/posix/rwlock.h |5 +
>  libitm/config/x86/sjlj.S |   47 
> ++
>  libitm/libitm.h  |7 +--
>  libitm/libitm_i.h|3 ++-
>  libitm/method-serial.cc  |2 ++
>  7 files changed, 92 insertions(+), 23 deletions(-)
> 
> diff --git a/libitm/beginend.cc b/libitm/beginend.cc
> index 4369946..118920b 100644
> --- a/libitm/beginend.cc
> +++ b/libitm/beginend.cc
> @@ -55,7 +55,9 @@ static pthread_key_t thr_release_key;
>  static pthread_once_t thr_release_once = PTHREAD_ONCE_INIT;
>  
>  // See gtm_thread::begin_transaction.
> -uint32_t GTM::htm_fastpath = 0;
> +uint32_t GTM::htm_fastpath asm("__gtm_htm_fastpath") = 0;
> +
> +uint32_t *GTM::global_lock asm("__gtm_global_lock");

Rearrange the serial lock's fields (see below).

>  /* Allocate a transaction structure.  */
>  void *
> @@ -187,27 +189,13 @@ GTM::gtm_thread::begin_transaction (uint32_t prop, 
> const gtm_jmpbuf *jb)
>// indeed in serial mode, and HW transactions should never need serial mode
>// for any internal changes (e.g., they never abort visibly to the STM code
>// and thus do not trigger the standard retry handling).

Add a comment as second paragraph in the previous block of comments,
briefly explaining when pr_tryHTM is set (ie, under which condition),
and that this happens in the assembler implementation of
_ITM_beginTransaction.

> -  if (likely(htm_fastpath && (prop & pr_hasNoAbort)))
> +  // pr_tryHTM can be set by an assembler fast path when it already tried
> +  // a hardware transaction once. In this case we do one retry less.
> +  if (likely(prop & pr_tryHTM))
>  {
> -  for (uint32_t t = htm_fastpath; t; t--)
> +  // One transaction has been already tried by the assembler fast path.
> +  for (uint32_t t = htm_fastpath - 1; t; t--)
>   {
> -   uint32_t ret = htm_begin();
> -   if (htm_begin_success(ret))
> - {
> -   // We are executing a transaction now.
> -   // Monitor the writer flag in the serial-mode lock, and abort
> -   // if there is an active or waiting serial-mode transaction.
> -   if (unlikely(serial_lock.is_write_locked()))
> - htm_abort();
> -   else
> - // We do not need to set a_saveLiveVariables because of HTM.
> - return (prop & pr_uninstrumentedCode) ?
> - a_runUninstrumentedCode : a_runInstrumentedCode;
> - }
> -   // The transaction has aborted.  Don't retry if it's unlikely that
> -   // retrying the transaction will be successful.
> -

[PATCH] Add -pthread option for RTEMS

2013-01-29 Thread Sebastian Huber
A lot of things use the -pthread GCC option if they want to use the
Pthreads.  Examples are various configure scripts and some GCC test
cases.  RTEMS supports Pthreads.  It is convenient to simply add a
-pthread option and ignore it for RTEMS.

2013-01-29  Sebastian Huber  

* config/rtems.opt: Add -pthread option.
---
 gcc/config/rtems.opt |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gcc/config/rtems.opt b/gcc/config/rtems.opt
index d76b7e7..0b1a353 100644
--- a/gcc/config/rtems.opt
+++ b/gcc/config/rtems.opt
@@ -23,6 +23,9 @@
 
 ; Please try to keep this file in ASCII collating order.
 
+pthread
+Ignore
+
 qnolinkcmds
 Driver
 
-- 
1.7.7



[AArch64] Implement Bitwise AND and Set Flags

2013-01-29 Thread Hurugalawadi, Naveen
Hi,

Please find attached the patch that implements Bitwise AND and Set
Flags instruction for aarch64 target.
The patch adds a testcase ands.c which is similar to the adds.c.

Please review the patch and let me know if there should be any
modifications?

Build and tested on aarch64-thunder-elf (using Cavium's internal
simulator). 

Thanks,
Naveen.H.S

gcc/

2013-01-29   Naveen H.S  

* config/aarch64/aarch64.md (*and3_compare0): New pattern.
(*andsi3_compare0_uxtw): New pattern.

gcc/testsuite/

2013-01-29   Naveen H.S  

* gcc.target/aarch64/ands.c: New.--- gcc/config/aarch64/aarch64.md	2013-01-29 12:27:37.289475066 +0530
+++ gcc/config/aarch64/aarch64.md	2013-01-29 11:43:06.693434952 +0530
@@ -2433,6 +2433,35 @@
   [(set_attr "v8type" "logic,logic_imm")
(set_attr "mode" "SI")])
 
+(define_insn "*and3_compare0"
+  [(set (reg:CC CC_REGNUM)
+	(compare:CC
+	 (and:GPI (match_operand:GPI 1 "register_operand" "%r,r")
+		  (match_operand:GPI 2 "aarch64_logical_operand" "r,"))
+	 (const_int 0)))
+   (set (match_operand:GPI 0 "register_operand" "=r,r")
+	(and:GPI (match_dup 1) (match_dup 2)))]
+  ""
+  "ands\\t%0, %1, %2"
+  [(set_attr "v8type" "logic,logic_imm")
+   (set_attr "mode" "")]
+)
+
+;; zero_extend version of above
+(define_insn "*andsi3_compare0_uxtw"
+  [(set (reg:CC CC_REGNUM)
+	(compare:CC
+	 (and:SI (match_operand:SI 1 "register_operand" "%r,r")
+		 (match_operand:SI 2 "aarch64_logical_operand" "r,K"))
+	 (const_int 0)))
+   (set (match_operand:DI 0 "register_operand" "=r,r")
+	(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2]
+  ""
+  "ands\\t%w0, %w1, %w2"
+  [(set_attr "v8type" "logic,logic_imm")
+   (set_attr "mode" "SI")]
+)
+
 (define_insn "*_3"
   [(set (match_operand:GPI 0 "register_operand" "=r")
 	(LOGICAL:GPI (SHIFT:GPI
--- gcc/testsuite/gcc.target/aarch64/ands.c	1970-01-01 05:30:00.0 +0530
+++ gcc/testsuite/gcc.target/aarch64/ands.c	2013-01-29 12:29:02.001476339 +0530
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int z;
+int
+foo (int x, int y)
+{
+  int l = x & y;
+  if (l == 0)
+return 5;
+
+  /* { dg-final { scan-assembler "ands\tw\[0-9\]" } } */
+  z = l ;
+  return 25;
+}
+
+typedef long long s64;
+
+s64 zz;
+s64
+foo2 (s64 x, s64 y)
+{
+  s64 l = x & y;
+  if (l < 0)
+return 5;
+
+  /* { dg-final { scan-assembler "ands\tx\[0-9\]" } } */
+  zz = l ;
+  return 25;
+}


[Patch, AArch64, AArch64-4.7] Implement Bitwise AND and Set Flags

2013-01-29 Thread Hurugalawadi, Naveen
Hi,

Please find attached the patch that implements Bitwise AND and Set
Flags instruction for aarch64 target.
The patch adds a testcase ands.c which is similar to the adds.c.

Please review the patch and let me know if there should be any
modifications?

Regressed for aarch64-elf on aarch64-4.7-branch.

Thanks,
Naveen.H.S

gcc/

2013-01-29   Naveen H.S  

* config/aarch64/aarch64.md (*and3_compare0): New pattern.
(*andsi3_compare0_uxtw): New pattern.

gcc/testsuite/

2013-01-29   Naveen H.S  

* gcc.target/aarch64/ands.c: New.
--- gcc/config/aarch64/aarch64.md	2013-01-25 15:52:09.214218793 +0530
+++ gcc/config/aarch64/aarch64.md	2013-01-29 18:51:46.965821291 +0530
@@ -2370,6 +2370,35 @@
   [(set_attr "v8type" "logic,logic_imm")
(set_attr "mode" "")])
 
+(define_insn "*and3_compare0"
+  [(set (reg:CC CC_REGNUM)
+	(compare:CC
+	 (and:GPI (match_operand:GPI 1 "register_operand" "%r,r")
+		  (match_operand:GPI 2 "aarch64_logical_operand" "r,"))
+	 (const_int 0)))
+   (set (match_operand:GPI 0 "register_operand" "=r,r")
+	(and:GPI (match_dup 1) (match_dup 2)))]
+  ""
+  "ands\\t%0, %1, %2"
+  [(set_attr "v8type" "logic,logic_imm")
+   (set_attr "mode" "")]
+)
+
+;; zero_extend version of above
+(define_insn "*andsi3_compare0_uxtw"
+  [(set (reg:CC CC_REGNUM)
+	(compare:CC
+	 (and:SI (match_operand:SI 1 "register_operand" "%r,r")
+		 (match_operand:SI 2 "aarch64_logical_operand" "r,K"))
+	 (const_int 0)))
+   (set (match_operand:DI 0 "register_operand" "=r,r")
+	(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2]
+  ""
+  "ands\\t%w0, %w1, %w2"
+  [(set_attr "v8type" "logic,logic_imm")
+   (set_attr "mode" "SI")]
+)
+
 (define_insn "*_3"
   [(set (match_operand:GPI 0 "register_operand" "=r")
 	(LOGICAL:GPI (SHIFT:GPI
--- gcc/testsuite/gcc.target/aarch64/ands.c	1970-01-01 05:30:00.0 +0530
+++ gcc/testsuite/gcc.target/aarch64/ands.c	2013-01-29 16:10:23.817675842 +0530
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int z;
+int
+foo (int x, int y)
+{
+  int l = x & y;
+  if (l == 0)
+return 5;
+
+  /* { dg-final { scan-assembler "ands\tw\[0-9\]" } } */
+  z = l ;
+  return 25;
+}
+
+typedef long long s64;
+
+s64 zz;
+s64
+foo2 (s64 x, s64 y)
+{
+  s64 l = x & y;
+  if (l < 0)
+return 5;
+
+  /* { dg-final { scan-assembler "ands\tx\[0-9\]" } } */
+  zz = l ;
+  return 25;
+}


Re: libgo patch committed: Support sparc64 in lfstack.c

2013-01-29 Thread Ian Lance Taylor
On Tue, Jan 29, 2013 at 4:34 AM, Rainer Orth
 wrote:
> Ian Lance Taylor  writes:
>
>> Looks like sparc64 broke for libgo when parallel garbage collection was
>> introduced.  This patch is an attempt to get it working again.
>> Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu, not that
>> that proves much.  Committed to mainline.
>
> I needed the following patch on top of yours to get it to compile on
> Solaris/SPARC.  The #undefs are necessary to avoid redefinition
> errors.  This massivly improves Solaris/SPARC testsuite results,
> though there are still a few common Solaris failures and a few others
> that might be endianess issues.

Thanks.  Committed to mainline.

Ian


[Ada] Obsolescence considerations for pragma Interface/Interface_Name

2013-01-29 Thread Arnaud Charlet
Interface is now flagged as violating restriction No_Obsolescent_Features
even in Ada 95 mode.

Both Interface and Interface_Name cause warnings to be issued
with -gnatwj (but we don't consider that Interface_Name
violates the restriction, since Interface_Name is a GNAT
defined pragma that is not in the RM, and in particular not
in Annex J). The following is compiled with -gnatwj

  1. pragma Restrictions (No_Obsolescent_Features);
  2. package ObsInter is
  3.procedure q;
  4.pragma Interface (C, q);
1  3
 >>> warning: pragma Interface is an obsolescent feature
 >>> warning: use pragma Import instead
 >>> violation of restriction "no_obsolescent_features" at line 1

  5.pragma Interface_Name (q, "qroutine");
|
 >>> warning: pragma Interface_Name is an obsolescent feature
 >>> warning: use pragma Import instead

  6. end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Robert Dewar  

* sem_prag.adb (Analyze_Pragma, case Interface): Consider to
be a violation of No_Obsolescent_Features even in Ada 95. Also
generates a warning in -gnatwj mode.
(Analyze_Pragma, case Interface_Name): Generates a warning in -gnatwj
mode.
* gnat_ugn.texi: Additional documentation on -gnatwj and pragma
Interface[_Name].

Index: gnat_ugn.texi
===
--- gnat_ugn.texi   (revision 195533)
+++ gnat_ugn.texi   (working copy)
@@ -5523,7 +5523,9 @@
 GNAT features that have been provided in past versions but which
 have been superseded (typically by features in the new Ada standard).
 For example, @code{pragma Ravenscar} will be flagged since its
-function is replaced by @code{pragma Profile(Ravenscar)}.
+function is replaced by @code{pragma Profile(Ravenscar)}, and
+@code{pragma Interface_Name} will be flagged since its function
+is replaced by @code{pragma Import}.
 
 Note that this warning option functions differently from the
 restriction @code{No_Obsolescent_Features} in two respects.
Index: sem_prag.adb
===
--- sem_prag.adb(revision 195533)
+++ sem_prag.adb(working copy)
@@ -11095,11 +11095,19 @@
 Process_Import_Or_Interface;
 
 --  In Ada 2005, the permission to use Interface (a reserved word)
---  as a pragma name is considered an obsolescent feature.
+--  as a pragma name is considered an obsolescent feature, and this
+--  pragma was already obsolescent in Ada 95.
 
-if Ada_Version >= Ada_2005 then
+if Ada_Version >= Ada_95 then
Check_Restriction
  (No_Obsolescent_Features, Pragma_Identifier (N));
+
+   if Warn_On_Obsolescent_Feature then
+  Error_Msg_N
+("pragma Interface is an obsolescent feature?j?", N);
+  Error_Msg_N
+("|use pragma Import instead?j?", N);
+   end if;
 end if;
 
  
@@ -11126,6 +11134,19 @@
 Id := Get_Pragma_Arg (Arg1);
 Analyze (Id);
 
+--  This is obsolete from Ada 95 on, but it is an implementation
+--  defined pragma, so we do not consider that it violates the
+--  restriction (No_Obsolescent_Features).
+
+if Ada_Version >= Ada_95 then
+   if Warn_On_Obsolescent_Feature then
+  Error_Msg_N
+("pragma Interface_Name is an obsolescent feature?j?", N);
+  Error_Msg_N
+("|use pragma Import instead?j?", N);
+   end if;
+end if;
+
 if not Is_Entity_Name (Id) then
Error_Pragma_Arg
  ("first argument for pragma% must be entity name", Arg1);


[Ada] Avoid duplexing of fields in entity nodes (internal change)

2013-01-29 Thread Arnaud Charlet
This patch uses the newly available fields in an extended entity
node to avoid some nasty cases of field duplexing, which we try
to avoid. Internal change only, no functional effect, no test.

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Robert Dewar  

* atree.ads, atree.adb (Node30): New function.
(Set_Node30): New procedure.
(Num_Extension_Nodes): Change to 5 (activate new fields/flags).
* atree.h: Add macros for Field30 and Node30.
* einfo.ads, einfo.adb: Move some fields to avoid duplexing.
* treepr.adb (Print_Entity_Information): Print fields 30-35.

Index: einfo.adb
===
--- einfo.adb   (revision 195533)
+++ einfo.adb   (working copy)
@@ -108,7 +108,6 @@
--Esize   Uint12
--Next_Inlined_Subprogram Node12
 
-   --Corresponding_Equality  Node13
--Component_ClauseNode13
--Elaboration_Entity  Node13
--Extra_Accessibility Node13
@@ -232,7 +231,6 @@
--Overridden_OperationNode26
--Package_Instantiation   Node26
--Relative_Deadline_Variable  Node26
-   --Static_Initialization   Node26
 
--Current_Use_Clause  Node27
--Related_TypeNode27
@@ -244,7 +242,8 @@
 
--Subprograms_For_TypeNode29
 
-   --(unused)Node30
+   --Corresponding_Equality  Node30
+   --Static_Initialization   Node30
 
--(unused)Node31
 
@@ -863,7 +862,7 @@
 (Ekind (Id) = E_Function
   and then not Comes_From_Source (Id)
   and then Chars (Id) = Name_Op_Ne);
-  return Node13 (Id);
+  return Node30 (Id);
end Corresponding_Equality;
 
function Corresponding_Protected_Entry (Id : E) return E is
@@ -2862,7 +2861,7 @@
begin
   pragma Assert
 (Ekind (Id) = E_Procedure and then not Is_Dispatching_Operation (Id));
-  return Node26 (Id);
+  return Node30 (Id);
end Static_Initialization;
 
function Stored_Constraint (Id : E) return L is
@@ -3391,7 +3390,7 @@
 (Ekind (Id) = E_Function
   and then not Comes_From_Source (Id)
   and then Chars (Id) = Name_Op_Ne);
-  Set_Node13 (Id, V);
+  Set_Node30 (Id, V);
end Set_Corresponding_Equality;
 
procedure Set_Corresponding_Protected_Entry (Id : E; V : E) is
@@ -5469,7 +5468,7 @@
begin
   pragma Assert
 (Ekind (Id) = E_Procedure and then not Is_Dispatching_Operation (Id));
-  Set_Node26 (Id, V);
+  Set_Node30 (Id, V);
end Set_Static_Initialization;
 
procedure Set_Stored_Constraint (Id : E; V : L) is
@@ -8221,19 +8220,8 @@
 Write_Str ("Component_Clause");
 
  when E_Function   =>
-if not Comes_From_Source (Id)
- and then
-   Chars (Id) = Name_Op_Ne
-then
-   Write_Str ("Corresponding_Equality");
+Write_Str ("Elaboration_Entity");
 
-elsif Comes_From_Source (Id) then
-   Write_Str ("Elaboration_Entity");
-
-else
-   Write_Str ("Field13??");
-end if;
-
  when E_Procedure  |
   E_Package|
   Generic_Unit_Kind=>
@@ -8879,13 +8867,7 @@
 
  when E_Procedure  |
   E_Function   =>
-if Ekind (Id) = E_Procedure
-  and then not Is_Dispatching_Operation (Id)
-then
-   Write_Str ("Static_Initialization");
-else
-   Write_Str ("Overridden_Operation");
-end if;
+Write_Str ("Overridden_Operation");
 
  when others   =>
 Write_Str ("Field26??");
@@ -8942,6 +8924,10 @@
   end case;
end Write_Field28_Name;
 
+   
+   -- Write_Field29_Name --
+   
+
procedure Write_Field29_Name (Id : Entity_Id) is
begin
   case Ekind (Id) is
@@ -8953,6 +8939,84 @@
   end case;
end Write_Field29_Name;
 
+   
+   -- Write_Field30_Name --
+   
+
+   procedure Write_Field30_Name (Id : Entity_Id) is
+   begin
+  case Ekind (Id) is
+ when E_Function   =>
+Write_Str ("Corresponding_Equality");
+
+ when E_Procedure  =>
+Write_Str ("Static_Initialization");
+
+ when others   =>
+Write_Str ("Field30??");
+  end case;
+   end Write_Fie

[Ada] Allow Ada 2012 aspects on renaming declarations

2013-01-29 Thread Arnaud Charlet
This patch completes the implementation of Ada 2012 aspects on all
renaming declarations. This is only relevant for implementation-defined
aspects such as Warnings, as shown by the following example program
which is compiled with -gnatwa -gnatld7

 1. pragma Ada_2012;
 2. procedure renameaspect is
 3.Q : Integer with Warnings => Off;
 4.R : Integer renames Q with Warnings => On;
   |
>>> warning: renamed variable "R" is not referenced

 5.X : Integer with Warnings => Off;
 6.Y : Integer renames X with Warnings => Off;
 7. begin
 8.null;
 9. end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Robert Dewar  

* aspects.ads: Aspect Warnings is implementation defined Add
some other missing entries to impl-defined list Mark Warnings
as GNAT pragma in main list.
* sem_ch8.adb: Process aspects for all cases of renaming
declarations.

Index: aspects.ads
===
--- aspects.ads (revision 195533)
+++ aspects.ads (working copy)
@@ -127,7 +127,7 @@
   Aspect_Unsuppress,
   Aspect_Value_Size,-- GNAT
   Aspect_Variable_Indexing,
-  Aspect_Warnings,
+  Aspect_Warnings,  -- GNAT
   Aspect_Write,
 
   --  The following aspects correspond to library unit pragmas
@@ -234,6 +234,7 @@
  Aspect_Favor_Top_Level  => True,
  Aspect_Global   => True,
  Aspect_Inline_Always=> True,
+ Aspect_Invariant=> True,
  Aspect_Lock_Free=> True,
  Aspect_Object_Size  => True,
  Aspect_Persistent_BSS   => True,
@@ -243,18 +244,19 @@
  Aspect_Pure_12  => True,
  Aspect_Pure_Function=> True,
  Aspect_Remote_Access_Type   => True,
+ Aspect_Scalar_Storage_Order => True,
  Aspect_Shared   => True,
- Aspect_Scalar_Storage_Order => True,
  Aspect_Simple_Storage_Pool  => True,
  Aspect_Simple_Storage_Pool_Type => True,
  Aspect_Suppress_Debug_Info  => True,
  Aspect_Test_Case=> True,
+ Aspect_Universal_Aliasing   => True,
  Aspect_Universal_Data   => True,
- Aspect_Universal_Aliasing   => True,
  Aspect_Unmodified   => True,
  Aspect_Unreferenced => True,
  Aspect_Unreferenced_Objects => True,
  Aspect_Value_Size   => True,
+ Aspect_Warnings => True,
  others  => False);
 
--  The following array indicates aspects for which multiple occurrences of
Index: sem_ch8.adb
===
--- sem_ch8.adb (revision 195533)
+++ sem_ch8.adb (working copy)
@@ -554,6 +554,14 @@
 Set_Renamed_Object (Id, Entity (Nam));
  end if;
   end if;
+
+  --  Implementation-defined aspect specifications can appear in a renaming
+  --  declaration, but not language-defined ones. The call to procedure
+  --  Analyze_Aspect_Specifications will take care of this error check.
+
+  if Has_Aspects (N) then
+ Analyze_Aspect_Specifications (N, Id);
+  end if;
end Analyze_Exception_Renaming;
 
---
@@ -681,6 +689,14 @@
 
  Check_Library_Unit_Renaming (N, Old_P);
   end if;
+
+  --  Implementation-defined aspect specifications can appear in a renaming
+  --  declaration, but not language-defined ones. The call to procedure
+  --  Analyze_Aspect_Specifications will take care of this error check.
+
+  if Has_Aspects (N) then
+ Analyze_Aspect_Specifications (N, New_P);
+  end if;
end Analyze_Generic_Renaming;
 
-
@@ -728,8 +744,7 @@
 then
null;
 
---  A renaming of an unchecked union does not have an
---  actual subtype.
+--  A renaming of an unchecked union has no actual subtype
 
 elsif Is_Unchecked_Union (Typ) then
null;
@@ -800,9 +815,7 @@
   --  when the renaming is generated in removing side effects of an
   --  already-analyzed expression.
 
-  i

[Ada] gnatmake find old ALI files in wrong object directory

2013-01-29 Thread Arnaud Charlet
When gnatmake is invoked with project files and a source has been moved
from one project A to another project B in the project tree, but the ALI
and object files has not be removed from the object directory of A,
gnatmake may always recompile the source moved to project B, even when it
is up to date. This patch is fixing this.

The test is to have 3 projects: Prj that withs A that withs B.
The object directories of the 3 projects are different.
A package Pkg in project A is used by the main in Prj. Invoke gnatmake to
build the main in Prj. Move package Pkg from project A to project B,
without removing the ALI and object files in the object directory of A.
Invoke gnatmake to build the main in Prj. Invoke again gnatmake to build
the main in Prj: gnatmake should report that everything is up to date.

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Vincent Celier  

* clean.adb (Clean_Executables): Add Sid component when calling
Queue.Insert.
* make.adb: When inserting in the Queue, add the Source_Id
(Sid) when it is known (Start_Compile_If_Possible): When the
Source_Id is known (Sid), get the path name of the ALI file
(Full_Lib_File) from it, to avoid finding old ALI files in other
object directories.
* makeutl.ads (Source_Info): New Source_Id component Sid in
Format_Gnatmake variant.

Index: make.adb
===
--- make.adb(revision 195533)
+++ make.adb(working copy)
@@ -2746,7 +2746,8 @@
  File=> Sfile,
  Unit=> No_Unit_Name,
  Project => No_Project,
- Index   => 0))
+ Index   => 0,
+ Sid => No_Source))
   then
  if Is_In_Obsoleted (Sfile) then
 Executable_Obsolete := True;
@@ -3091,6 +3092,7 @@
  ALI  : ALI_Id;
  Source_Index : Int;
  Sfile: File_Name_Type;
+ Sid  : Prj.Source_Id;
  Uname: Unit_Name_Type;
  Unit_Name: Name_Id;
  Uid  : Prj.Unit_Index;
@@ -3137,6 +3139,7 @@
   loop
  Sfile := Withs.Table (K).Sfile;
  Uname := Withs.Table (K).Uname;
+ Sid   := No_Source;
 
  --  If project files are used, find the proper source to
  --  compile in case Sfile is the spec but there is a body.
@@ -3154,12 +3157,14 @@
then
   Sfile:= Uid.File_Names (Impl).File;
   Source_Index := Uid.File_Names (Impl).Index;
+  Sid  := Uid.File_Names (Impl);
 
elsif Uid.File_Names (Spec) /= null
  and then not Uid.File_Names (Spec).Locally_Removed
then
   Sfile:= Uid.File_Names (Spec).File;
   Source_Index := Uid.File_Names (Spec).Index;
+  Sid  := Uid.File_Names (Spec);
end if;
 end if;
  end if;
@@ -3187,7 +3192,8 @@
File=> Sfile,
Project => ALI_P.Project,
Unit=> Withs.Table (K).Uname,
-   Index   => Source_Index));
+   Index   => Source_Index,
+   Sid => Sid));
 end if;
  end if;
   end loop;
@@ -3308,16 +3314,16 @@
   is
  In_Lib_Dir  : Boolean;
  Need_To_Compile : Boolean;
- Pid : Process_Id;
+ Pid : Process_Id := Invalid_Pid;
  Process_Created : Boolean;
 
  Source   : Queue.Source_Info;
- Full_Source_File : File_Name_Type;
+ Full_Source_File : File_Name_Type := No_File;
  Source_File_Attr : aliased File_Attributes;
  --  The full name of the source file and its attributes (size, ...)
 
  Lib_File  : File_Name_Type;
- Full_Lib_File : File_Name_Type;
+ Full_Lib_File : File_Name_Type := No_File;
  Lib_File_Attr : aliased File_Attributes;
  Read_Only : Boolean := False;
  ALI   : ALI_Id;
@@ -3335,24 +3341,50 @@
  then
 Queue.Extract (Found, Source);
 
-Osint.Full_Source_Name
-  (Source.File,
-   Full_File => Full_Source_File,
-   Attr  => Source_File_Attr'Access);
+--  If it is a source in a project, first look for the ALI file
+--

[Ada] Fixes to -gnatyn mode (casing of standard identifiers)

2013-01-29 Thread Arnaud Charlet
Identifiers for other than control characters and LC_? in ASCII are
not all upper case, they are mixed case. This patch corrects that
error in the handling of -gnatyn. It also removes a couple of
references to ASCII.BACK_SLASH from the run-time, since they are
now flagged, and removing the references solves any concerns about
bootstrapping.

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Robert Dewar  

* mlib-utl.adb, gnatlink.adb: Avoid reference to ASCII.Back_Slash
because of casing issues.
* sem_util.ads: Minor comment fix.
* style.adb (Check_Identifier): Set proper casing for entities
in ASCII.
* styleg.adb: Minor comment improvement.
* stylesw.ads (Style_Check_Standard): Fix bad comments.

Index: style.adb
===
--- style.adb   (revision 195533)
+++ style.adb   (working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+--  Copyright (C) 1992-2013, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -94,7 +94,9 @@
--
 
--  In check references mode (-gnatyr), identifier uses must be cased
-   --  the same way as the corresponding identifier declaration.
+   --  the same way as the corresponding identifier declaration. If standard
+   --  references are checked (-gnatyn), then identifiers from Standard must
+   --  be cased as in the Reference Manual.
 
procedure Check_Identifier
  (Ref : Node_Or_Entity_Id;
@@ -197,11 +199,31 @@
if Entity (Ref) = Standard_ASCII then
   Cas := All_Upper_Case;
 
-   --  Special names in ASCII are also all upper case
+   --  Special handling for names in package ASCII
 
elsif Sdef = Standard_ASCII_Location then
-  Cas := All_Upper_Case;
+  declare
+ Nam : constant String := Get_Name_String (Chars (Def));
 
+  begin
+ --  Bar is mixed case
+
+ if Nam = "bar" then
+Cas := Mixed_Case;
+
+ --  All names longer than 4 characters are mixed case
+
+ elsif Nam'Length > 4 then
+Cas := Mixed_Case;
+
+ --  All names shorter than 4 characters (other than Bar,
+ --  which we already tested for specially) are Upper case.
+
+ else
+Cas := All_Upper_Case;
+ end if;
+  end;
+
--  All other entities are in mixed case
 
else
Index: mlib-utl.adb
===
--- mlib-utl.adb(revision 195533)
+++ mlib-utl.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
--- Copyright (C) 2002-2012, AdaCore --
+-- Copyright (C) 2002-2013, AdaCore --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -396,7 +396,8 @@
   --
 
   procedure Write_RF (S : String) is
- Success : Boolean := True;
+ Success: Boolean:= True;
+ Back_Slash : constant Character := '\';
 
   begin
  --  If a GNU response file is used, space and backslash need to be
@@ -408,7 +409,7 @@
  if Using_GNU_response_file then
 for J in S'Range loop
if S (J) = ' ' or else S (J) = '\' then
-  if Write (Tname_FD, ASCII.BACK_SLASH'Address, 1) /= 1 then
+  if Write (Tname_FD, Back_Slash'Address, 1) /= 1 then
  Success := False;
   end if;
end if;
Index: sem_util.ads
===
--- sem_util.ads(revision 195533)
+++ sem_util.ads(working copy)
@@ -6,7 +6,7 @@
 --  --

[Ada] gnat stub -P crashes when Ada is not a language of the project

2013-01-29 Thread Arnaud Charlet
This patch prevents the GNAT driver from crashing when it is called as
"gnat stub -P ..." and Ada is not one of the languages of the project,
for example if the project is an aggregate project.

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Vincent Celier  

* gnatcmd.adb: For "gnat stub -P ...", do not check the naming
scheme for Ada, when Ada is not a language for the project.

Index: gnatcmd.adb
===
--- gnatcmd.adb (revision 195535)
+++ gnatcmd.adb (working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1996-2012, Free Software Foundation, Inc. --
+--  Copyright (C) 1996-2013, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -2477,7 +2477,9 @@
--  the file name ends with the spec suffix, then indicate to
--  gnatstub the name of the body file with a -o switch.
 
-   if not Is_Standard_GNAT_Naming (Lang.Config.Naming_Data) then
+   if Lang /= No_Language_Index
+ and then not Is_Standard_GNAT_Naming (Lang.Config.Naming_Data)
+   then
   if File_Index /= 0 then
  declare
 Spec : constant String :=


[Ada] Ada 2012: Rule on function writable actuals (AI05-0144-2)

2013-01-29 Thread Arnaud Charlet
If the construct N has two or more direct constituents that are names or
expressions whose evaluation may occur in an arbitrary order, at least
one of which contains a function call with an in out or out parameter,
then the construct is legal only if: for each name that is passed as
a parameter of mode in out or out to some inner function call C2 (not
including the construct N itself), there is no other name anywhere
within a direct constituent of the construct C other than the
one containing C2, that is known to refer to the same object
(RM 6.4.1(6.17/3)).

The following test now compiles with errors:

pragma Ada_2012;
procedure aliasfunc is

   function Init_Value return Integer is
   begin
  return 0;
   end;

   function f (a : in out integer) return integer is
   begin
  a := a + 1;
  return 3;
   end;

   procedure p (a : in out Integer; b : in out Integer) is
   begin
  a := b;
   end;

   table : array (1 .. 3) of Integer := (others => 0);

   x : integer := Init_Value;
begin
   p (a => x, b => table (f (x)));
end;

Command: gcc -c aliasfunc.adb
Output:
aliasfunc.adb:24:30: conflict of writable function parameter in construct
 with arbitrary order of evaluation

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Javier Miranda  

* errout.ads, errout.adb (Get_Ignore_Errors): New subprogram.
* opt.ads (Warn_On_Overlap): Update documentation.
* sem_aggr.adb (Resolve_Aggregate, Resolve_Extension_Aggregate):
Check function writable actuals.
* sem_ch3.adb (Build_Derived_Record_Type,
Record_Type_Declaration): Check function writable actuals.
* sem_ch4.adb (Analyze_Range): Check function writable actuals.
* sem_ch5.adb (Analyze_Assignment): Remove code of the initial
implementation of AI05-0144.
* sem_ch6.adb (Analyze_Function_Return,
(Analyze_Procedure_Call.Analyze_Call_And_Resolve): Remove code
of the initial implementation of AI05-0144.
* sem_res.adb (Resolve): Remove code of the initial implementation.
(Resolve_Actuals): Call Check_Function_Writable_Actuals and remove call
of the initial implementation.
(Resolve_Arithmetic_Op, Resolve_Logical_Op,
Resolve_Membership_Op): Check function writable actuals.
* sem_util.ad[sb] (Actuals_In_Call): Removed
(Check_Order_Dependence): Removed (Save_Actual): Removed
(Check_Function_Writable_Actuals): New subprogram.
* usage.adb (Usage): Update documentation.
* warnsw.adb (Set_Warning_Switch): Enable warn_on_overlap when
setting all warnings.

Index: sem_aggr.adb
===
--- sem_aggr.adb(revision 195533)
+++ sem_aggr.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+--  Copyright (C) 1992-2013, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -1252,6 +1252,8 @@
  Set_Etype (N, Aggr_Subtyp);
  Set_Analyzed (N);
   end if;
+
+  Check_Function_Writable_Actuals (N);
end Resolve_Aggregate;
 
-
@@ -2816,6 +2818,8 @@
   else
  Error_Msg_N ("no unique type for this aggregate",  A);
   end if;
+
+  Check_Function_Writable_Actuals (N);
end Resolve_Extension_Aggregate;
 
--
Index: sem_ch3.adb
===
--- sem_ch3.adb (revision 195538)
+++ sem_ch3.adb (working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+--  Copyright (C) 1992-2013, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -8061,6 +8061,8 @@
  Set_Last_Entity
(Class_Wide_Type (Derived_Type), Last_Entity (Derived_Type));
   end if;
+
+  Check_Function_Writable_Actuals (N);
end Build_Derived_Record_Type;
 

@@ -19678,6 +19680,8 @@
   t

[Ada] Expression functions and protected definitions

2013-01-29 Thread Arnaud Charlet
An expression_function_declaration is a different syntactic category from
a subprogram_declaration. As a consequence, an expression function cannot
appear in a protected definition, i.e. cannot declare a protected operation.

Compiling essai.adb must yield:

   essai.adb:4:07: an expression function is not a legal protected operation
   essai.adb:7:07: an expression function is not a legal protected operation

---
pragma Ada_2012;
procedure Essai is
   protected P1 is
  function F1 return Integer is (1);
  function F2 return Integer;--  ERROR
   private
  function F3 return Boolean is (False); --  ERROR
   end P1;
   protected body P1 is
  function F2 return Integer is (1); --  OK
   end P1;
begin
   null;
end Essai;

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Ed Schonberg  

* sem_ch6.adb (Analyze_Expression_Function): An expression
function declaration is not a subprogram declaration, and thus
cannot appear in a protected definition.

Index: sem_ch6.adb
===
--- sem_ch6.adb (revision 195540)
+++ sem_ch6.adb (working copy)
@@ -408,6 +408,15 @@
   --  that the expression can be inlined whenever possible.
 
   else
+ --  An expression function that is not a completion is not a
+ --  subprogram declaration, and thus cannot appear in a protected
+ --  definition.
+
+ if Nkind (Parent (N)) = N_Protected_Definition then
+Error_Msg_N
+  ("an expression function is not a legal protected operation", N);
+ end if;
+
  New_Decl :=
Make_Subprogram_Declaration (Loc, Specification => Spec);
 


[Ada] Insertion of generated constructs in N_Expression_With_Actions nodes

2013-01-29 Thread Arnaud Charlet
This patch corrects the mechanism that inserts various generated constructs in
the tree, in particular the interaction with expression_with_actions nodes. No
test case applicable as this latent bug was found during code reading.

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-01-29  Hristian Kirtchev  

* exp_util.adb (Insert_Actions): When new
actions come from the expression of the expression with actions,
then they must be added to the list of existing actions.

Index: exp_util.adb
===
--- exp_util.adb(revision 195533)
+++ exp_util.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+--  Copyright (C) 1992-2013, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -3141,25 +3141,27 @@
 
   --  N_Raise_xxx_Error is an annoying special case, it is a statement if
   --  it has type Standard_Void_Type, and a subexpression otherwise.
-  --  otherwise. Procedure attribute references are also statements.
+  --  otherwise. Procedure calls, and similarly procedure attribute
+  --  references, are also statements.
 
   if Nkind (Assoc_Node) in N_Subexpr
-and then (Nkind (Assoc_Node) in N_Raise_xxx_Error
+and then (Nkind (Assoc_Node) not in N_Raise_xxx_Error
or else Etype (Assoc_Node) /= Standard_Void_Type)
+and then Nkind (Assoc_Node) /= N_Procedure_Call_Statement
 and then (Nkind (Assoc_Node) /= N_Attribute_Reference
or else
  not Is_Procedure_Attribute_Name
(Attribute_Name (Assoc_Node)))
   then
- P := Assoc_Node; -- ??? does not agree with above!
- N := Parent (Assoc_Node);
+ N := Assoc_Node;
+ P := Parent (Assoc_Node);
 
   --  Non-subexpression case. Note that N is initially Empty in this case
   --  (N is only guaranteed Non-Empty in the subexpr case).
 
   else
+ N := Empty;
  P := Assoc_Node;
- N := Empty;
   end if;
 
   --  Capture root of the transient scope
@@ -3171,6 +3173,13 @@
   loop
  pragma Assert (Present (P));
 
+ --  Make sure that inserted actions stay in the transient scope
+
+ if Present (Wrapped_Node) and then N = Wrapped_Node then
+Store_Before_Actions_In_Scope (Ins_Actions);
+return;
+ end if;
+
  case Nkind (P) is
 
 --  Case of right operand of AND THEN or OR ELSE. Put the actions
@@ -3282,14 +3291,17 @@
 
return;
 
---  Case of appearing within an Expressions_With_Actions node. We
---  append the actions to the list of actions already there, if
---  the node has not been analyzed yet. Otherwise find insertion
---  location further up the tree.
+--  Case of appearing within an Expressions_With_Actions node. When
+--  the new actions come from the expression of the expression with
+--  actions, they must be added to the existing actions. The other
+--  alternative is when the new actions are related to one of the
+--  existing actions of the expression with actions. In that case
+--  they must be inserted further up the tree.
 
 when N_Expression_With_Actions =>
-   if not Analyzed (P) then
-  Append_List (Ins_Actions, Actions (P));
+   if N = Expression (P) then
+  Insert_List_After_And_Analyze
+(Last (Actions (P)), Ins_Actions);
   return;
end if;
 
@@ -3697,13 +3709,6 @@
 
  end case;
 
- --  Make sure that inserted actions stay in the transient scope
-
- if P = Wrapped_Node then
-Store_Before_Actions_In_Scope (Ins_Actions);
-return;
- end if;
-
  --  If we fall through above tests, keep climbing tree
 
  N := P;


Re: [build] Properly set progbits/nobits for Solaris/SPARC as

2013-01-29 Thread Paolo Bonzini
Il 29/01/2013 13:42, Rainer Orth ha scritto:
> As originally reported as binutils PR ld/15057, several gfortran tests
> are failing on Solaris/SPARC with Sun as and GNU ld like this:
> 
> FAIL: gfortran.dg/coarray/alloc_comp_1.f90 -fcoarray=lib  -O2  -lcaf_single 
> (test for excess errors)
> Excess errors:
> /vol/gcc/bin/gld-2.23.1: warning: section `.bss' type changed to PROGBITS
> 
> As analyzed in the PR, this happens because .bss.* sections are not
> marked as SHT_NOBITS when Sun as is in use.  The following patch fixes
> this; it should be low-risk since the result of the configure test
> (necessary since only Solaris 10/SPARC as added #nobits/#progbits
> support) is only used in a Solaris-specific function.
> 
> Bootstrapped without regressions on sparc-sun-solaris2.11 (as/gld,
> gas/gld in progress), ok for mainline?

Ok.

Paolo


[PATCH 1/2] PowerPC testsuite clean up

2013-01-29 Thread Sebastian Huber
2013-01-18  Sebastian Huber  

* lib/target-supports.exp
(check_effective_target_powerpc_eabi_ok): New.
* gcc.target/powerpc/ppc-eabi.c: Use require effective target
powerpc_eabi_ok.
* gcc.target/powerpc/ppc-sdata-1.c: Likewise.
* gcc.target/powerpc/spe-small-data-2.c: Likewise.
* gcc.target/powerpc/ppc-sdata-2.c: Add powerpc-*-rtems*.
* gcc.target/powerpc/pr51623.c: Likewise.
* gcc.target/powerpc/ppc-stackalign-1.c: Likewise.
* gcc.target/powerpc/ppc-ldstruct.c: Likewise.
* gcc.target/powerpc/spe-small-data-2.c: Do not run, compile
only.
---
 gcc/testsuite/gcc.target/powerpc/ppc-eabi.c|3 ++-
 gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c|2 +-
 gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c |3 ++-
 gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c |2 +-
 .../gcc.target/powerpc/ppc-stackalign-1.c  |2 +-
 gcc/testsuite/gcc.target/powerpc/pr51623.c |2 +-
 .../gcc.target/powerpc/spe-small-data-2.c  |3 ++-
 gcc/testsuite/lib/target-supports.exp  |   12 
 8 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c 
b/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c
index 47ba1a7..cd15586 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c
@@ -1,4 +1,5 @@
 /* PR target/16952 */
-/* { dg-do compile { target { powerpc*-*-linux* && ilp32 } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_eabi_ok } */
 /* { dg-options "-meabi -mrelocatable" } */
 char *s = "boo";
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c 
b/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c
index da6001f..ffb4264 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* } } 
*/
+/* { dg-do run { target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* 
powerpc*-*-rtems* } } */
 /* { dg-options "-O -mlong-double-128" } */
 
 #include 
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c 
b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c
index 5f39d86..efd5a5e 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c
@@ -1,5 +1,6 @@
-/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { 
powerpc-*-eabi* } } } } */
+/* { dg-do compile } */
 /* { dg-options "-O2 -fno-common -G 8 -meabi -msdata=eabi" } */
+/* { dg-require-effective-target powerpc_eabi_ok } */
 /* { dg-require-effective-target nonpic } */
 /* { dg-final { scan-assembler "\\.section\[ \t\]\\.sdata," } } */
 /* { dg-final { scan-assembler "\\.section\[ \t\]\\.sdata2," } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c 
b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
index f102b1d..570c81f 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { 
powerpc-*-eabi* } } } } */
+/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { 
powerpc-*-eabi* powerpc-*-rtems* } } } } */
 /* { dg-options "-O2 -fno-common -G 8 -msdata=sysv" } */
 /* { dg-require-effective-target nonpic } */
 /* { dg-final { scan-assembler "\\.section\[ \t\]\\.sdata," } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c 
b/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c
index 465fc41..59bd39f 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target powerpc*-*-linux* powerpc*-*-eabi* } } */
+/* { dg-do run { target powerpc*-*-linux* powerpc*-*-eabi* powerpc-*-rtems* } 
} */
 /* { dg-options {} } */
 
 /* Test stack pointer alignment against variable alloca.  */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr51623.c 
b/gcc/testsuite/gcc.target/powerpc/pr51623.c
index 37b7d65..2ac118c 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr51623.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr51623.c
@@ -1,5 +1,5 @@
 /* PR target/51623 */
-/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { 
powerpc-*-eabi* } } } } */
+/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { 
powerpc-*-eabi* powerpc-*-rtems* } } } } */
 /* { dg-options "-mrelocatable -ffreestanding" } */
 
 /* This generated an error, since the compiler was calling
diff --git a/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c 
b/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c
index 2a466e3..5354e49 100644
--- a/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c
@@ -1,5 +1,6 @@
 /* Verify that we don't ICE trying to put float data in .sdata2.  */
-/* { dg

[PATCH 2/2] Test case for PR55033

2013-01-29 Thread Sebastian Huber
2013-01-29  Sebastian Huber  

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] Potential fix for PR55033

2013-01-29 Thread Sebastian Huber

Hello,

is it possible to integrate this patch into the GCC 4.8 release?

On 10/24/2012 04:50 PM, Alan Modra wrote:

On Tue, Oct 23, 2012 at 06:25:43PM +0200, Sebastian Huber wrote:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55033

This patch fixes my problem, but I am absolutely not sure if this is the
right way.

[snip]

This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9571 all over again.

IMHO your patch is not wrong, but a better idea is that if we've used
categorize_decl_for_section to choose a section name, then we ought to
also use categorize_decl_for_section to choose section flags.

My original fix for pr9571 was to pass the decl down to
get_named_section.
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02487.html
That hit the assert in get_named_section when building libgfortran for
ia64, and my knee-jerk patch to fix that was to simply satisfy the
assert.  After looking at all the target section_type_flags functions,
I believe the following is what I should have done way back then.
Bootstrapped and regression tested powerpc64-linux.

* 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.

Index: gcc/varasm.c
===
--- gcc/varasm.c(revision 192660)
+++ gcc/varasm.c(working copy)
@@ -403,12 +403,16 @@ get_named_section (tree decl, const char *name, in
  {
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);
  }

@@ -5943,7 +5947,7 @@ default_section_type_flags (tree decl, const char
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))
@@ -6299,8 +6303,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);
  }

Index: gcc/config/i386/winnt.c
===
--- gcc/config/i386/winnt.c (revision 192660)
+++ gcc/config/i386/winnt.c (working copy)
@@ -476,7 +476,7 @@ i386_pe_section_type_flags (tree decl, const char
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.  */
Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 192660)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -25689,7 +25689,7 @@ rs6000_xcoff_section_type_flags (tree decl, const
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.  */




--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


Re: [PATCH 2/2] Test case for PR55033

2013-01-29 Thread Sebastian Huber

Test results with these patches are here:

http://gcc.gnu.org/ml/gcc-testresults/2013-01/msg03064.html

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


Ping: [RFA/dwarf] Add DW_AT_use_GNAT_descriptive_type flag for Ada units.

2013-01-29 Thread Joel Brobecker
Hello,

I was hoping someone would kindly review this patch? It is an
important part for debugging Ada code, helping with performance.

Thank you!

On Tue, Jan 08, 2013 at 07:24:14AM -0500, Joel Brobecker wrote:
> Hello,
> 
> I just noticed that part of the proposal we made for...
> http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type
> 
> ... got missed in the patch that got checked in:
> http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00099.html
> 
> In particular, we're missing the second part, where we are
> expected to generate a DW_AT_use_GNAT_descriptive_type flag
> in the CU in order to tell the consumers that we are providing
> the descriptive type.
> 
> gcc/ChangeLog:
> 
> * dwarf2out.c (gen_compile_unit_die): Add
> DW_AT_use_GNAT_descriptive_type attribute for Ada units.
> 
> Tested on x86_64-linux, no regression. I also tested against
> the GDB testsuite, before and after, and no regression.  This
> is expected, since GDB currently does not look for this attribute
> (but I would like it to).
> 
> OK to apply for HEAD and 4.7?
> 
> Thanks,
> -- 
> Joel
> 
> ---
>  gcc/dwarf2out.c |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index a865250..8117ce9 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -18940,6 +18940,10 @@ gen_compile_unit_die (const char *filename)
>/* The default DW_ID_case_sensitive doesn't need to be specified.  */
>break;
>  }
> +
> +  if (language == DW_LANG_Ada95)
> +add_AT_flag (die, DW_AT_use_GNAT_descriptive_type, 1);
> +
>return die;
>  }
>  
> -- 
> 1.7.0.4

-- 
Joel


Re: [PATCH 2/2] [asan] Avoid instrumenting duplicated memory access in the same basic block

2013-01-29 Thread Jakub Jelinek
On Mon, Jan 28, 2013 at 10:32:43PM +0100, Dodji Seketeli wrote:

Thanks for working on this.

> @@ -212,6 +213,159 @@ alias_set_type asan_shadow_set = -1;
> alias set is used for all shadow memory accesses.  */
>  static GTY(()) tree shadow_ptr_types[2];
>  
> +/* Hashtable support for memory references used by gimple
> +   statements.  */
> +
> +/* This type represents a reference to a memory region.  */
> +struct __attribute__ ((visibility ("hidden"))) mem_ref

This is wrong, you aren't checking whether visibility or even hidden
visibility is supposed by the compiler.

The C++ way I think would be to use anonymous namespace,
but I don't see anything like that used in gcc/*.c yet, so
perhaps just name it asan_mem_ref and be done with that.

> +{
> +  /* The expression of the begining of the memory region.  */
> +  tree start;
> +  /* The expression representing the length of the region.  */
> +  tree len;

Do you really need to store len as tree?  Wouldn't it be better
just to store the access size in bytes as integer (1, 2, 4, 8 or 16
bytes) into say unsigned char; variable?

> +struct __attribute__((visibility ("hidden"))) mem_ref_hasher
> +  : typed_delete_remove 

Likewise.

> +static hash_table &

Not sure about agreed formatting for references, but grep '>&' doesn't
show anything, while '> &' shows some hits.

> +get_mem_ref_hash_table ()
> +{
> +static hash_table  ht;
> +
> +if (!ht.is_created ())
> +  ht.create (10);
> +
> +return ht;

The above is all indented too much.

> +  hash_table  ht = get_mem_ref_hash_table ();
> +  mem_ref **slot = ht.find_slot (&ref, INSERT);
> +  gcc_assert (*slot == NULL);
> +  *slot = new mem_ref (ref);

Wouldn't it be better to use pool_alloc/pool_free here instead of
new/delete?

>  case BUILT_IN_STRLEN:
> -  return instrument_strlen_call (iter);
> +  source0 = gimple_call_arg (call, 0);

Reminds me that we should replace all uses of is_gimple_builtin_call
in asan.c/tsan.c with gimple_call_builtin_p (stmt, BUILT_IN_NORMAL),
and probably nuke is_gimple_builtin_call, otherwise no verification
whether K&R unprototyped size_t strlen (); etc. aren't used
say with x = strlen (); .  Right now gimple_call_arg here is unsafe,
we haven't checked, whether it has at least one argument.  But if we
ignore calls which don't match the builtin prototype, we'd be safe.

> +static int
> +test1 ()
> +{
> +  /*__builtin___asan_report_store1 called 1 time here to instrument
> +the initialization.  */
> +  char foo[4] = {1}; 
> +
> +  /*__builtin___asan_report_store1 called 2 times here to instrument
> +the store to the memory region of tab.  */
> +  __builtin_memset (tab, 3, sizeof (tab));
> +
> +  /* There is no instrumentation for the two memset calls below.  */
> +  __builtin_memset (tab, 4, sizeof (tab));
> +  __builtin_memset (tab, 5, sizeof (tab));

If you don't instrument the above two, it shows something bad.
I'd say for calls which test two bytes (first and last) you actually
should enter into the hash table two records, one that &tab[0] with size 1
byte has been instrumented, another one that &tab[3] (resp. 4, resp. 5)
with size 1 byte has been instrumented, and e.g. if the first access has
been instrumented already, but second access hasn't (or vice versa), just
emit instrumentation for the one which is missing.

For future improvements (but 4.9 material likely, after we lower
each instrumentation just to a single builtin first), different access
sizes and/or different is_store should just mean we (at least in the same bb
and with no intervening calls that could never return) could upgrade the
the previous instrumentation to cover a wider access size, or load into
store (or just ignore loads vs. stores?).

> +/* 

I wouldn't start the comment on different line.

> +   { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 7 
> "instrumented stores"}  }

Space between " and }, only one space between }  }.

> +
> +   { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 4 
> "instrumented loads"}  }

and just close */ at the end of the above line (or use /* */ on each line
separately.

Jakub


Re: [PATCH 2/2] [asan] Avoid instrumenting duplicated memory access in the same basic block

2013-01-29 Thread Jakub Jelinek
On Tue, Jan 29, 2013 at 04:00:22PM +0100, Jakub Jelinek wrote:
> @@ -1464,23 +1726,39 @@ transform_statements (void)
>  
>FOR_EACH_BB (bb)
>  {
> +  get_mem_ref_hash_table ().dispose ();
> +
>if (bb->index >= saved_last_basic_block) continue;
>   for (i = gsi_start_bb (bb); !gsi_end_p (i);)

> +   if (is_gimple_call (s))
> + get_mem_ref_hash_table ().dispose ();
> +

Two more things.  IMHO the hash table should be a global var,
not a static inside get_mem_ref_hash_table (), because otherwise
all these 3 calls just create an empty hash table and immediately
destroy it.  And, at BB boundaries and for calls, you shouldn't
use .dispose (), but .empty () method.
So my preference would be
  if (asan_mem_ref_ht.is_created ())
asan_mem_ref_ht.empty ();
(for the two above occurrences, resp. .dispose () for the one below).

+ gsi_next (&i);
}
- gsi_next (&i);
}
 }
+  get_mem_ref_hash_table ().dispose ();
 }
 

Jakub


[PATCH] Fix PTA compile-time for PR56113

2013-01-29 Thread Richard Biener

This brings down compile-time in PTA from

 tree PTA:  25.37 (24%) usr

to

 tree PTA:   5.06 ( 6%) usr

by doing something that was on my TODO list for ... ages.  We
are currently re-translating internal points-to sets to final
points-to sets all the time even if we know the result will
be the same as one we computed already.  When a lot of points-to
sets are equivalent (as in the above testcase) we spend a lot
of time doing that useless work.

The following patch simply caches the result using a pointer-map
(instead of enlarging the varinfo struct).

For the testcase incremental SSA update is now the worst offender:

 tree SSA incremental:  34.14 (39%) usr

out of a remaining total

 TOTAL :  86.53

(that's at -O1).

Bootstrap & regtest ongoing on x86_64-unknown-linux-gnu, scheduled
for a commit to trunk (generic compile-time regression, etc.).

Richard.

2013-01-29  Richard Biener  

* tree-ssa-structalias.c (final_solutions, final_solutions_obstack):
New pointer-map and obstack.
(init_alias_vars): Allocate pointer-map and obstack.
(delete_points_to_sets): Free them.
(find_what_var_points_to): Cache result.
(find_what_p_points_to): Adjust for changed interface of
find_what_var_points_to.
(compute_points_to_sets): Likewise.
(ipa_pta_execute): Likewise.

Index: gcc/tree-ssa-structalias.c
===
*** gcc/tree-ssa-structalias.c  (revision 195549)
--- gcc/tree-ssa-structalias.c  (working copy)
*** static inline bool type_can_have_subvars
*** 303,309 
  /* Pool of variable info structures.  */
  static alloc_pool variable_info_pool;
  
! 
  
  /* Table of variable info structures for constraint variables.
 Indexed directly by variable info id.  */
--- 303,311 
  /* Pool of variable info structures.  */
  static alloc_pool variable_info_pool;
  
! /* Map varinfo to final pt_solution.  */
! static pointer_map_t *final_solutions;
! struct obstack final_solutions_obstack;
  
  /* Table of variable info structures for constraint variables.
 Indexed directly by variable info id.  */
*** set_uids_in_ptset (bitmap into, bitmap f
*** 5872,5892 
  
  /* Compute the points-to solution *PT for the variable VI.  */
  
! static void
! find_what_var_points_to (varinfo_t orig_vi, struct pt_solution *pt)
  {
unsigned int i;
bitmap_iterator bi;
bitmap finished_solution;
bitmap result;
varinfo_t vi;
! 
!   memset (pt, 0, sizeof (struct pt_solution));
  
/* This variable may have been collapsed, let's get the real
   variable.  */
vi = get_varinfo (find (orig_vi->id));
  
/* Translate artificial variables into SSA_NAME_PTR_INFO
   attributes.  */
EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi)
--- 5960,5988 
  
  /* Compute the points-to solution *PT for the variable VI.  */
  
! static struct pt_solution
! find_what_var_points_to (varinfo_t orig_vi)
  {
unsigned int i;
bitmap_iterator bi;
bitmap finished_solution;
bitmap result;
varinfo_t vi;
!   void **slot;
!   struct pt_solution *pt;
  
/* This variable may have been collapsed, let's get the real
   variable.  */
vi = get_varinfo (find (orig_vi->id));
  
+   /* See if we have already computed the solution and return it.  */
+   slot = pointer_map_insert (final_solutions, vi);
+   if (*slot != NULL)
+ return *(struct pt_solution *)*slot;
+ 
+   *slot = pt = XOBNEW (&final_solutions_obstack, struct pt_solution);
+   memset (pt, 0, sizeof (struct pt_solution));
+ 
/* Translate artificial variables into SSA_NAME_PTR_INFO
   attributes.  */
EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi)
*** find_what_var_points_to (varinfo_t orig_
*** 5921,5927 
/* Instead of doing extra work, simply do not create
   elaborate points-to information for pt_anything pointers.  */
if (pt->anything)
! return;
  
/* Share the final set of variables when possible.  */
finished_solution = BITMAP_GGC_ALLOC ();
--- 6017,6023 
/* Instead of doing extra work, simply do not create
   elaborate points-to information for pt_anything pointers.  */
if (pt->anything)
! return *pt;
  
/* Share the final set of variables when possible.  */
finished_solution = BITMAP_GGC_ALLOC ();
*** find_what_var_points_to (varinfo_t orig_
*** 5939,5944 
--- 6035,6042 
pt->vars = result;
bitmap_clear (finished_solution);
  }
+ 
+   return *pt;
  }
  
  /* Given a pointer variable P, fill in its points-to set.  */
*** find_what_p_points_to (tree p)
*** 5963,5969 
  return;
  
pi = get_ptr_info (p);
!   find_what_var_points_to (vi, &pi->pt);
  }
  
  
--- 6061,6067 
  return;
  
pi = get_ptr_info (p);
!   pi->pt = find_what_var_points_to (vi);
  }
  
  
**

[PATCH] Small cleanup in cleanup_cfg

2013-01-29 Thread Marek Polacek
I don't see any reason why we'd want to mark BBs in this case,
changed_bbs are thrown away right after fix_loop_structure
marks them.

Regtested/bootstrapped on x86_64-linux, ok for trunk?

2013-01-29  Marek Polacek  

* cfgcleanup.c (cleanup_cfg): Don't mark affected BBs.

--- gcc/cfgcleanup.c.mp 2013-01-29 13:53:21.740473075 +0100
+++ gcc/cfgcleanup.c2013-01-29 13:53:27.942491341 +0100
@@ -3017,14 +3017,11 @@ cleanup_cfg (int mode)
   && (changed
  || (mode & CLEANUP_CFG_CHANGED)))
 {
-  bitmap changed_bbs;
   timevar_push (TV_REPAIR_LOOPS);
   /* The above doesn't preserve dominance info if available.  */
   gcc_assert (!dom_info_available_p (CDI_DOMINATORS));
   calculate_dominance_info (CDI_DOMINATORS);
-  changed_bbs = BITMAP_ALLOC (NULL);
-  fix_loop_structure (changed_bbs);
-  BITMAP_FREE (changed_bbs);
+  fix_loop_structure (NULL);
   free_dominance_info (CDI_DOMINATORS);
   timevar_pop (TV_REPAIR_LOOPS);
 }

Marek


Re: [Patch] Potential fix for PR55033

2013-01-29 Thread Sebastian Huber

On 01/29/2013 03:40 PM, Sebastian Huber wrote:

Hello,

is it possible to integrate this patch into the GCC 4.8 release?


With this patch we have:

LAST_UPDATED: Mon Jan 28 07:50:05 UTC 2013 (revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3)


Native configuration is x86_64-unknown-linux-gnu

=== gcc tests ===


Running target unix
XPASS: gcc.dg/inline_3.c (test for excess errors)
XPASS: gcc.dg/inline_4.c (test for excess errors)
XPASS: gcc.dg/unroll_2.c (test for excess errors)
XPASS: gcc.dg/unroll_3.c (test for excess errors)
XPASS: gcc.dg/unroll_4.c (test for excess errors)

=== gcc Summary ===

# of expected passes92116
# of unexpected successes   5
# of expected failures  257
# of unsupported tests  1522
/scratch/git-build/b-gcc-git-linux/gcc/xgcc  version 4.8.0 20130128 
(experimental) [master revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)


=== g++ tests ===


Running target unix

=== g++ Summary ===

# of expected passes53540
# of expected failures  289
# of unsupported tests  738
/scratch/git-build/b-gcc-git-linux/gcc/testsuite/g++/../../xg++  version 4.8.0 
20130128 (experimental) [master revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)



Compiler version: 4.8.0 20130128 (experimental) [master revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)

Platform: x86_64-unknown-linux-gnu
configure flags: --prefix=/scratch/install-gcc-git --verbose --with-gnu-as 
--with-gnu-ld --enable-languages=c,c++


Without this patch we have:

LAST_UPDATED: Mon Jan 28 07:50:05 UTC 2013 (revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3)


Native configuration is x86_64-unknown-linux-gnu

=== gcc tests ===


Running target unix
XPASS: gcc.dg/inline_3.c (test for excess errors)
XPASS: gcc.dg/inline_4.c (test for excess errors)
XPASS: gcc.dg/unroll_2.c (test for excess errors)
XPASS: gcc.dg/unroll_3.c (test for excess errors)
XPASS: gcc.dg/unroll_4.c (test for excess errors)

=== gcc Summary ===

# of expected passes92116
# of unexpected successes   5
# of expected failures  257
# of unsupported tests  1522
/scratch/git-build/b-gcc-git-linux/gcc/xgcc  version 4.8.0 20130128 
(experimental) [master revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)


=== g++ tests ===


Running target unix

=== g++ Summary ===

# of expected passes53540
# of expected failures  289
# of unsupported tests  738
/scratch/git-build/b-gcc-git-linux/gcc/testsuite/g++/../../xg++  version 4.8.0 
20130128 (experimental) [master revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)



Compiler version: 4.8.0 20130128 (experimental) [master revision 
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)

Platform: x86_64-unknown-linux-gnu
configure flags: --prefix=/scratch/install-gcc-git --verbose --with-gnu-as 
--with-gnu-ld --enable-languages=c,c++


=> No new regressions on platform x86_64-unknown-linux-gnu for C and C++

Some PowerPC results are here:

http://gcc.gnu.org/ml/gcc-testresults/2013-01/msg03064.html

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


Re: [PATCH,ARM][1/5] Add ffmas and ffmad type attribute

2013-01-29 Thread Ramana Radhakrishnan



gcc/

2013-01-03  Greta Yorsh  

 * config/arm/arm.md (type): Add ffmas and ffmad to "type" attribute.
 * config/arm/vfp.md (fma,fmsub,fnmsub,fnmadd): Change type
 from fmac to ffma.
 * config/arm/vfp11.md (vfp_farith): Use ffmas.
 (vfp_fmul): Use ffmad.
 * config/arm/cortex-r4f.md (cortex_r4_fmacs): Use ffmas.
 (cortex_r4_fmacd): Use ffmad.
 * config/arm/cortex-m4-fpu.md (cortex_m4_fmacs): Use ffmas.
 * config/arm/cortex-a9.md (cortex_a9_fmacs):  Use ffmas.
 (cortex_a9_fmacd): Use ffmad.
 * config/arm/cortex-a8-neon.md (cortex_a8_vfp_macs): Use ffmas.
 (cortex_a8_vfp_macd): Use ffmad.
 * config/arm/cortex-a5.md (cortex_a5_fpmacs): Use ffmas.
 (cortex_a5_fpmacd): Use ffmad.
 * config/arm/cortex-a15-neon.md (cortex_a15_vfp_macs) Use ffmas.
 (cortex_a15_vfp_macd): Use ffmad.
 * config/arm/arm1020e.md (v10_fmul): Use ffmas and ffmad.




This is ok as it is only a tuning change.

Ramana



Re: [PATCH,ARM][2/5] Update cortex-a7 vfp/neon pipeline description

2013-01-29 Thread Ramana Radhakrishnan

On 01/25/13 18:22, Greta Yorsh wrote:

This patch updates the description of vmul, vdiv, vsqrt, vmla,vmls, vfma,
vfms operations for vfp and neon. It uses ffmas and ffmad type attribute
introduced by the previous patch.

gcc/

2013-01-03  Greta Yorsh  

 * config/arm/cortex-a7.md (cortex_a7_neon_mul, cortex_a7_neon_mla):
New
 reservations.
 (cortex_a7_fpfmad): New reservation.
 (cortex_a7_fpmacs): Use ffmas and update required units.
 (cortex_a7_fpmuld): Update required units and latency.
 (cortex_a7_fpmacd): Likewise.
 (cortex_a7_fdivs, cortex_a7_fdivd): Likewise.
 (cortex_a7_neon). Likewise.
 (bypass) Update participating units.



Ok as it only touches Cortex-A7 tuning .

Ramana



Re: [PATCH,ARM][3/5] New bypass between mac operations in cortex-a7 pipeline description

2013-01-29 Thread Ramana Radhakrishnan

On 01/25/13 18:23, Greta Yorsh wrote:

Add bypasses to forward the result of one MAC operation to the accumulator
of another MAC operation.

Towards this end, we add a new function arm_mac_accumulator_is_result to be
used as a guard for bypasses. Existing guard
arm_mac_accumulator_is_mul_result requires a multiply operation as the
producer and a multiply-accumulate operation as the consumer. The new guard
allows more general producers and consumers. It allows the consumer to be a
multiply-accumulate or multiply-subtract operation. It allows the producer
to be any SET operation, although only MAC operations are used as producers
in the pipeline description of Cortex-A7.

gcc/

2013-01-03  Greta Yorsh  

 * config/arm/arm-protos.h (arm_mac_accumulator_is_result): New
 declaration.
 * config/arm/arm.c (arm_mac_accumulator_is_result): New function.
 * config/arm/cortex-a7.md: New bypasses using
 arm_mac_accumulator_is_result.



Ok as it only affects Cortex-A7.

Ramana



Re: [PATCH,ARM][4/5] Fix calls in cortex-a7 pipeline description

2013-01-29 Thread Ramana Radhakrishnan

On 01/25/13 18:24, Greta Yorsh wrote:

Improve handling of call insns in cortex-a7 pipeline description, as
follows.

A call can dual-issue as a younger instruction but not as an older
instruction (from compiler's point of view). This patch adjusts the function
cortexa7_younger (used by the implementation of TARGET_SCHED_REORDER hook)
to return true for calls. The patch also updates the pipeline description
for calls to allow either dual-issue as a younger instruction or
single-issue.

gcc/

2013-01-03  Greta Yorsh  

 * config/arm/arm.c (cortexa7_younger): Return true for TYPE_CALL.
 * config/arm/cortex-a7.md (cortex_a7_call): Update required units.




Ok.

Ramana



Re: [PATCH,ARM][5/5] Cleanup in cortex-a7 pipeline description

2013-01-29 Thread Ramana Radhakrishnan

On 01/25/13 18:25, Greta Yorsh wrote:

In cortex_a7_idiv, the use of cortex_a7_all reservation can be replaced by
cortex_a7_both, because all other reservations require at least one of
cortex_a7_ex1 or cortex_a7_ex2. Then, remove unused reservation units
cortex_a7_neon and cortex_a7_all.

gcc/

2013-01-03  Greta Yorsh  

 * config/arm/cortex-a7.md (cortex_a7_neon, cortex_a7_all): Remove.
 (cortex_a7_idiv): Use cortex_a7_both instead of cortex_a7_all.




Ok for the same reason as others given they only touch A7 pipeline 
descriptions.


Ramana



[PATCH] __cxa_atexit support for AIX

2013-01-29 Thread David Edelsohn
Inspired by Perry's patch to add __cxa_atexit support, I have
implemented a similar patch.  This version adds __cxa_atexit and
__cxa_finalize support to libgcc on AIX and makes no changes to
collect2 processing.  Because AIX does not use crtstuff.c for
init/fini processing, I used an extremely low-priority destructor to
invoke __cxa_finalize very early in destructor processing.  I would
appreciate any feedback about that approach.

Also, most of the code liberally copies from GNU Libc cxa_atexit.c and
cxa_finalize.c.  I have submitted a request to Richard Stallman to
allow me to copy the code into GCC, modify it, and distribute it using
the GCC Runtime Exception license for use with GCC on AIX.  I will
update copyrights once the mechanism is decided.

I inserted the definition of __dso_handle and the call to
__cxa_finalize in cxa_atexit.c.  I could merge and rearrange the files
further, but I want to limit the amount of changes to the original GNU
Libc code. I have no expectation of sharing the code with GNU Libc,
but want to simplify the detection of any changes that need to be
imported.

Thanks, David

Index: libgcc/config.host
===
--- libgcc/config.host  (revision 195542)
+++ libgcc/config.host  (working copy)
@@ -899,7 +899,7 @@
;;
 rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
md_unwind_header=rs6000/aix-unwind.h
-   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix
rs6000/t-ibm-ldouble"
+   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix
rs6000/t-ibm-ldouble rs6000/t-aix-cxa"
;;
 rl78-*-elf)
tmake_file="$tm_file t-fdpbit rl78/t-rl78"
Index: libgcc/config/rs6000/exit.h
===
--- libgcc/config/rs6000/exit.h (revision 0)
+++ libgcc/config/rs6000/exit.h (revision 0)
@@ -0,0 +1,85 @@
+/* Copyright (C) 1991,1996,1997,1999,2001,2002,2006,2009
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#ifndef_EXIT_H
+#define _EXIT_H 1
+
+#define attribute_hidden
+#define INTDEF(name)
+
+#include 
+#include 
+
+enum
+{
+  ef_free, /* `ef_free' MUST be zero!  */
+  ef_us,
+  ef_on,
+  ef_at,
+  ef_cxa
+};
+
+struct exit_function
+  {
+/* `flavour' should be of type of the `enum' above but since we need
+   this element in an atomic operation we have to use `long int'.  */
+long int flavor;
+union
+  {
+   void (*at) (void);
+   struct
+ {
+   void (*fn) (int status, void *arg);
+   void *arg;
+ } on;
+   struct
+ {
+   void (*fn) (void *arg, int status);
+   void *arg;
+   void *dso_handle;
+ } cxa;
+  } func;
+  };
+struct exit_function_list
+  {
+struct exit_function_list *next;
+size_t idx;
+struct exit_function fns[32];
+  };
+extern struct exit_function_list *__exit_funcs attribute_hidden;
+extern struct exit_function_list *__quick_exit_funcs attribute_hidden;
+
+extern struct exit_function *__new_exitfn (struct exit_function_list **listp);
+extern uint64_t __new_exitfn_called attribute_hidden;
+
+extern void __run_exit_handlers (int status, struct exit_function_list **listp,
+bool run_list_atexit)
+  attribute_hidden __attribute__ ((__noreturn__));
+
+extern int __internal_atexit (void (*func) (void *), void *arg, void *d,
+ struct exit_function_list **listp)
+  attribute_hidden;
+extern int __cxa_at_quick_exit (void (*func) (void *), void *d);
+
+extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
+extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d)
+ attribute_hidden;
+
+extern void __cxa_finalize (void *d);
+
+#endif /* exit.h  */
Index: libgcc/config/rs6000/cxa_atexit.c
===
--- libgcc/config/rs6000/cxa_atexit.c   (revision 0)
+++ libgcc/config/rs6000/cxa_atexit.c   (revision 0)
@@ -0,0 +1,137 @@
+/* Copyright (C) 1999,2001,2002,2005,2006,2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it un

Re: [PATCH] Add faster HTM fastpath for libitm TSX v2

2013-01-29 Thread Andi Kleen
> next time please reply to the points raised in a review if you disagree
> with them, and don't just ignore them.  That speeds up the review.

It was all in the previous email on the topic.

> >  // See gtm_thread::begin_transaction.
> > -uint32_t GTM::htm_fastpath = 0;
> > +uint32_t GTM::htm_fastpath asm("__gtm_htm_fastpath") = 0;
> > +
> > +uint32_t *GTM::global_lock asm("__gtm_global_lock");
> 
> Rearrange the serial lock's fields (see below).

To my knowledge C++ classes have no guaranteed layout,
so that's not safe because there is no guarantee where
the vtable pointers are. it would be only with plain old structs.

+  // pr_tryHTM can be set by an assembler fast path when it already
tried
+  // a hardware transaction once. In this case we do one retry less.

pr_tryHTM is already documented.

-Andi


Re: [Patch] PR56064: Fold VIEW_CONVERT_EXPR with FIXED_CST, Take #2

2013-01-29 Thread Georg-Johann Lay
Richard Biener wrote:
> Georg-Johann Lay wrote:
>> This is tentative patch as discussed in
>>
>> http://gcc.gnu.org/ml/gcc/2013-01/msg00187.html
>>
>> fold-const.c gets 2 new function native_encode_fixed and
>> native_interpret_fixed.  Code common with the integer case is factored out 
>> and
>> moved to the new constructor-like function double_int::from_buffer.
>>
>> The code bootstraps fine on x86-linux-gnu and I have test coverage from
>> avr-unknown-none.
>>
>> Ok to apply?
> 
> Ok.
> 
> Thanks,
> Richard.

Let me drop this, I don't like the name "const_fixed_from_double_int".  It's
bad and I think "fixed_from_double_int" is better.  Other constructor-like
functions for FIXED_VALUE_TYPE use fixed_from_* whereas const_fixed_* returns a
CONST_FIXED rtx.

This is less confusing and fits better the naming convention.

The new patch also adds const_fixed_from_double_int that actually returns a
CONST_FIXED rtx.  It's unused, but I would use it in the avr back.

Okay with that rename? (Or, at your option, without 
const_fixed_from_double_int).

Johann


PR tree-optimization/56064
* fixed-value.c (fixed_from_double_int): New function.
* fixed-value.h (fixed_from_double_int): New prototype.
(const_fixed_from_double_int): New static inline function.
* fold-const.c (native_interpret_fixed): New static function.
(native_interpret_expr) : Use it.
(can_native_interpret_type_p) : Return true.
(native_encode_fixed): New static function.
(native_encode_expr) : Use it.
(native_interpret_int): Move double_int worker code to...
* double-int.c (double_int::from_buffer): ...this new static method.
* double-int.h (double_int::from_buffer): Prototype it.

testsuite/
PR tree-optimization/56064
* gcc.dg/fixed-point/view-convert.c: New test.



> 
>> There are less intrusive solutions that only handle the int <-> fixed cases,
>> for example fold-const.c:fold_view_convert_expr() could test for these cases
>> and use double_int directly without serializing / deserializing through a
>> memory buffer.
>>
>> Johann
>>
>>
>> PR tree-optimization/56064
>> * fixed-value.c (const_fixed_from_double_int): New function.
>> * fixed-value.h (const_fixed_from_double_int): New prototype.
>> * fold-const.c (native_interpret_fixed): New static function.
>> (native_interpret_expr) : Use it.
>> (can_native_interpret_type_p) : Return true.
>> (native_encode_fixed): New static function.
>> (native_encode_expr) : Use it.
>> (native_interpret_int): Move double_int worker code to...
>> * double-int.c (double_int::from_buffer): ...this new static method.
>> * double-int.h (double_int::from_buffer): Prototype it.
>>
>> testsuite/
>> PR tree-optimization/56064
>> * gcc.dg/fixed-point/view-convert.c: New test.
> 

Index: fixed-value.c
===
--- fixed-value.c	(revision 195514)
+++ fixed-value.c	(working copy)
@@ -81,6 +81,24 @@ check_real_for_fixed_mode (REAL_VALUE_TY
   return FIXED_OK;
 }
 
+
+/* Construct a CONST_FIXED from a bit payload and machine mode MODE.
+   The bits in PAYLOAD are used verbatim.  */
+
+FIXED_VALUE_TYPE
+fixed_from_double_int (double_int payload, enum machine_mode mode)
+{
+  FIXED_VALUE_TYPE value;
+
+  gcc_assert (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_DOUBLE_INT);
+
+  value.data = payload;
+  value.mode = mode;
+
+  return value;
+}
+
+
 /* Initialize from a decimal or hexadecimal string.  */
 
 void
Index: fixed-value.h
===
--- fixed-value.h	(revision 195514)
+++ fixed-value.h	(working copy)
@@ -49,6 +49,22 @@ extern FIXED_VALUE_TYPE fconst1[MAX_FCON
   const_fixed_from_fixed_value (r, m)
 extern rtx const_fixed_from_fixed_value (FIXED_VALUE_TYPE, enum machine_mode);
 
+/* Construct a FIXED_VALUE from a bit payload and machine mode MODE.
+   The bits in PAYLOAD are used verbatim.  */
+extern FIXED_VALUE_TYPE fixed_from_double_int (double_int,
+		 enum machine_mode);
+
+/* Return a CONST_FIXED from a bit payload and machine mode MODE.
+   The bits in PAYLOAD are used verbatim.  */
+static inline rtx
+const_fixed_from_double_int (double_int payload,
+ enum machine_mode mode)
+{
+  return
+const_fixed_from_fixed_value (fixed_from_double_int (payload, mode),
+  mode);
+}
+
 /* Initialize from a decimal or hexadecimal string.  */
 extern void fixed_from_string (FIXED_VALUE_TYPE *, const char *,
 			   enum machine_mode);
Index: fold-const.c
===
--- fold-const.c	(revision 195514)
+++ fold-const.c	(working copy)
@@ -7200,6 +7200,36 @@ native_encode_int (const_tree expr, unsi
 }
 
 
+/* Subroutine of native_encode_expr.  Encode the FIXED_CST
+   specified by EX

libgo patch committed: Update to current sources

2013-01-29 Thread Ian Lance Taylor
I've updated libgo to the current sources, in an attempt to get GCC 4.8
closer to the upcoming Go 1.1 release.  I've attached the patches to the
directories that are mainly different for gccgo.  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 03c4cdef61a5 libgo/MERGE
--- a/libgo/MERGE	Tue Jan 29 05:57:54 2013 -0800
+++ b/libgo/MERGE	Tue Jan 29 10:54:22 2013 -0800
@@ -1,4 +1,4 @@
-6fdc1974457c
+921e53d4863c
 
 The first line of this file holds the Mercurial revision number of the
 last merge done from the master library sources.
diff -r 03c4cdef61a5 libgo/Makefile.am
--- a/libgo/Makefile.am	Tue Jan 29 05:57:54 2013 -0800
+++ b/libgo/Makefile.am	Tue Jan 29 10:54:22 2013 -0800
@@ -227,8 +227,8 @@
 	$(exp_inotify_gox) \
 	exp/norm.gox \
 	exp/proxy.gox \
+	exp/ssa.gox \
 	exp/terminal.gox \
-	exp/types.gox \
 	exp/utf8string.gox
 
 toolexeclibgoexphtmldir = $(toolexeclibgoexpdir)/html
@@ -256,7 +256,8 @@
 	go/parser.gox \
 	go/printer.gox \
 	go/scanner.gox \
-	go/token.gox
+	go/token.gox \
+	go/types.gox
 
 toolexeclibgohashdir = $(toolexeclibgodir)/hash
 
@@ -682,7 +683,7 @@
 go_net_newpollserver_file = go/net/newpollserver_unix.go
 else # !LIBGO_IS_LINUX && !LIBGO_IS_RTEMS
 if LIBGO_IS_NETBSD
-go_net_fd_os_file = go/net/fd_netbsd.go
+go_net_fd_os_file = go/net/fd_bsd.go
 go_net_newpollserver_file = go/net/newpollserver_unix.go
 else # !LIBGO_IS_NETBSD && !LIBGO_IS_LINUX && !LIBGO_IS_RTEMS
 # By default use select with pipes.  Most systems should have
@@ -753,9 +754,16 @@
 endif
 endif
 
+if LIBGO_IS_LINUX
+go_net_cloexec_file = go/net/sock_cloexec.go
+else
+go_net_cloexec_file = go/net/sys_cloexec.go
+endif
+
 go_net_files = \
 	go/net/cgo_unix.go \
 	$(go_net_cgo_file) \
+	$(go_net_cloexec_file) \
 	go/net/dial.go \
 	go/net/dnsclient.go \
 	go/net/dnsclient_unix.go \
@@ -856,6 +864,12 @@
 endif
 endif
 
+if LIBGO_IS_LINUX
+go_os_pipe_file = go/os/pipe_linux.go
+else
+go_os_pipe_file = go/os/pipe_bsd.go
+endif
+
 go_os_files = \
 	$(go_os_dir_file) \
 	go/os/dir.go \
@@ -872,6 +886,7 @@
 	go/os/getwd.go \
 	go/os/path.go \
 	go/os/path_unix.go \
+	$(go_os_pipe_file) \
 	go/os/proc.go \
 	$(go_os_stat_file) \
 	go/os/str.go \
@@ -1026,6 +1041,7 @@
 go_compress_flate_files = \
 	go/compress/flate/copy.go \
 	go/compress/flate/deflate.go \
+	go/compress/flate/fixedhuff.go \
 	go/compress/flate/huffman_bit_writer.go \
 	go/compress/flate/huffman_code.go \
 	go/compress/flate/inflate.go \
@@ -1222,8 +1238,10 @@
 go_exp_locale_collate_files = \
 	go/exp/locale/collate/colelem.go \
 	go/exp/locale/collate/collate.go \
+	go/exp/locale/collate/colltab.go \
 	go/exp/locale/collate/contract.go \
 	go/exp/locale/collate/export.go \
+	go/exp/locale/collate/sort.go \
 	go/exp/locale/collate/table.go \
 	go/exp/locale/collate/tables.go \
 	go/exp/locale/collate/trie.go
@@ -1248,23 +1266,18 @@
 	go/exp/proxy/per_host.go \
 	go/exp/proxy/proxy.go \
 	go/exp/proxy/socks5.go
+go_exp_ssa_files = \
+	go/exp/ssa/blockopt.go \
+	go/exp/ssa/doc.go \
+	go/exp/ssa/func.go \
+	go/exp/ssa/sanity.go \
+	go/exp/ssa/ssa.go \
+	go/exp/ssa/literal.go \
+	go/exp/ssa/print.go \
+	go/exp/ssa/util.go
 go_exp_terminal_files = \
 	go/exp/terminal/terminal.go \
 	go/exp/terminal/util.go
-go_exp_types_files = \
-	go/exp/types/builtins.go \
-	go/exp/types/check.go \
-	go/exp/types/const.go \
-	go/exp/types/conversions.go \
-	go/exp/types/errors.go \
-	go/exp/types/exportdata.go \
-	go/exp/types/expr.go \
-	go/exp/types/gcimporter.go \
-	go/exp/types/operand.go \
-	go/exp/types/predicates.go \
-	go/exp/types/stmt.go \
-	go/exp/types/types.go \
-	go/exp/types/universe.go
 go_exp_utf8string_files = \
 	go/exp/utf8string/string.go
 
@@ -1305,6 +1318,24 @@
 	go/go/token/position.go \
 	go/go/token/serialize.go \
 	go/go/token/token.go
+go_go_types_files = \
+	go/go/types/api.go \
+	go/go/types/builtins.go \
+	go/go/types/check.go \
+	go/go/types/const.go \
+	go/go/types/conversions.go \
+	go/go/types/errors.go \
+	go/go/types/exportdata.go \
+	go/go/types/expr.go \
+	go/go/types/gcimporter.go \
+	go/go/types/objects.go \
+	go/go/types/operand.go \
+	go/go/types/predicates.go \
+	go/go/types/resolve.go \
+	go/go/types/scope.go \
+	go/go/types/stmt.go \
+	go/go/types/types.go \
+	go/go/types/universe.go
 
 go_hash_adler32_files = \
 	go/hash/adler32/adler32.go
@@ -1848,8 +1879,8 @@
 	exp/locale/collate/build.lo \
 	exp/norm.lo \
 	exp/proxy.lo \
+	exp/ssa.lo \
 	exp/terminal.lo \
-	exp/types.lo \
 	exp/utf8string.lo \
 	html/template.lo \
 	go/ast.lo \
@@ -1860,6 +1891,7 @@
 	go/printer.lo \
 	go/scanner.lo \
 	go/token.lo \
+	go/types.lo \
 	hash/adler32.lo \
 	hash/crc32.lo \
 	hash/crc64.lo \
@@ -2751,6 +2783,15 @@
 	@$(CHECK)
 .PHONY: exp/proxy/check
 
+@go_include@ exp/ssa.lo.dep
+exp/ssa.lo.dep: $(go_exp_ssa_files)
+	$(BUILDDEPS)
+exp/ssa.lo: $(go_exp_ssa_files)
+	$(BUILDPACKAGE)
+exp/ssa/check: $(CHECK_DEPS)
+	@$(CHECK)
+.PHONY: exp/ssa/check
+
 @go_include@ exp/terminal.lo.dep
 exp/terminal.lo.

Re: [Patch, Fortran] PR 54107: [4.8 Regression] Memory hog with abstract interface

2013-01-29 Thread Janus Weil
Hi Thomas,

>>> Or maybe wait for the fix for comment #4?
>>
>> Rather not (technically it's a separate issue, I guess).
>
>
> While the patch is rather large, I think it is OK.
>
> One request:  Could you add a comment to gfc_sym_get_dummy_args
> explaining what the function does and under which conditions sym->formal
> is NULL, while sym->ts.interface->formal isn't?

thanks for the review. I have added the comment to
gfc_sym_get_dummy_args that you requested, and committed the patch as
r195562.

Cheers,
Janus


[Patch, Fortran] PR56138 - fix deferred-length character funcs w/o result variable

2013-01-29 Thread Tobias Burnus
For allocatable string lengths (deferred length strings), the current 
code generates a local integer variable to which the the length is assigned.


For some reason, that doesn't work for some functions which do not use a 
result variable - leading to failures as the pass-by-reference variable 
is not dereferenced. That's fixed by the attached patch. I have to admit 
that I do not understand why it works without the patch for the examples 
in gfortran.dg/allocatable_function_5.f90, where - for some tests - also 
no result variable is used.


Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2012-01-29  Tobias Burnus  

	PR fortran/56138
	* trans-decl.c (gfc_trans_deferred_vars): Fix deferred-length
	results for functions without extra result variable.

2012-01-29  Tobias Burnus  

	PR fortran/56138
	* gfortran.dg/allocatable_function_6.f90: New.

diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 1d0919d..7732440 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3775,7 +3775,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
 	null_pointer_node));
 		}
 
-	  if ((sym->attr.dummy ||sym->attr.result)
+	  if ((sym->attr.dummy || sym->attr.result || sym->result == sym)
 		&& sym->ts.type == BT_CHARACTER
 		&& sym->ts.deferred)
 		{
diff --git a/gcc/testsuite/gfortran.dg/allocatable_function_6.f90 b/gcc/testsuite/gfortran.dg/allocatable_function_6.f90
new file mode 100644
index 000..4255009
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocatable_function_6.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+!
+! PR fortran/56138
+!
+! Contributed by John Chludzinski, using the code of John Reid
+!
+implicit none
+CHARACTER(LEN=:),ALLOCATABLE :: str 
+if (s_to_c("ABCdef") /= "ABCdef" .or. len(s_to_c("ABCdef")) /= 6) call abort()
+str = s_to_c("ABCdef")
+if (str /= "ABCdef" .or. len(str) /= 6) call abort()
+str(1:3) = s_to_c("123")
+if (str /= "123def" .or. len(str) /= 6) call abort()
+
+contains
+
+PURE FUNCTION s_to_c(string) 
+  CHARACTER(LEN=*),INTENT(IN)   :: string 
+  CHARACTER(LEN=:),ALLOCATABLE :: s_to_c 
+  s_to_c = string
+ENDFUNCTION s_to_c 
+end


Merge from trunk to gccgo branch

2013-01-29 Thread Ian Lance Taylor
I've merged trunk revision 195560 to the gccgo branch.

Ian


[PATCH] Fix RTL fwprop compile-time for PR56113

2013-01-29 Thread Steven Bosscher
Hello,

This brings down compile time for fwprop by avoiding CFG changes in
loop_optimizer_init(). The CFG changes it could make would invalidate
the fast dominance queries, so that walk_dominator_tree had to work
with the slow queries -- rather painful on a CFG with an almost flat
dominator tree.

With the n=1 test case, we go from unpatched:

 forward prop:  39.13 (13%) usr

to patched:

 forward prop:  13.60 ( 5%) usr

That's still not a reasonable amount of time for such a simple pass,
but it's better than before...

To prevent that mistake in the future, I've add an assert in dominance.c.

OK for trunk?

Ciao!
Steven


PR56113_3.diff
Description: Binary data


Re: [PATCH] Fix RTL fwprop compile-time for PR56113

2013-01-29 Thread Steven Bosscher
On Wed, Jan 30, 2013 at 12:01 AM, Steven Bosscher wrote:
> To prevent that mistake in the future, I've add an assert in dominance.c.

Hmm, that worked with my release-checking compiler of course, but
fails in at least tree-ssa-dom.c (same as for fwprop.c,
loop_optimizer_init destroys fast queries) and tree-ssa-loop-im.c (not
sure yet why).

NB, the fwprop.c change is independent and should go in. The domwalk.c
thing is something to maybe postpone to gcc 4.9.

Testing this patch now:

Index: domwalk.c
===
--- domwalk.c   (revision 195559)
+++ domwalk.c   (working copy)
@@ -147,8 +147,17 @@ walk_dominator_tree (struct dom_walk_dat
   bitmap_clear (visited);
   bitmap_set_bit (visited, ENTRY_BLOCK_PTR->index);

+  /* Make sure dominance information is available, and compute fast queries
+ if necessary.  */
+  gcc_assert (dom_info_state (walk_data->dom_direction) >= DOM_NO_FAST_QUERY);
+  calculate_dominance_info (walk_data->dom_direction);
+
   while (true)
 {
+  /* Thou shall not modify the dominator tree while walking it
+ (nor present it without fast queries available).  */
+  gcc_assert (dom_info_state (walk_data->dom_direction) == DOM_OK);
+
   /* Don't worry about unreachable blocks.  */
   if (EDGE_COUNT (bb->preds) > 0
  || bb == ENTRY_BLOCK_PTR


libgo patch committed: Update libgo again

2013-01-29 Thread Ian Lance Taylor
Unfortunately I updated the last libgo version from sources that a bug
in the JSON package.  This patch updates libgo again to the new current
sources, fixing the bug.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 6141bbace093 libgo/MERGE
--- a/libgo/MERGE	Tue Jan 29 10:59:14 2013 -0800
+++ b/libgo/MERGE	Tue Jan 29 17:29:12 2013 -0800
@@ -1,4 +1,4 @@
-921e53d4863c
+229081515358
 
 The first line of this file holds the Mercurial revision number of the
 last merge done from the master library sources.
diff -r 6141bbace093 libgo/go/encoding/json/bench_test.go
--- a/libgo/go/encoding/json/bench_test.go	Tue Jan 29 10:59:14 2013 -0800
+++ b/libgo/go/encoding/json/bench_test.go	Tue Jan 29 17:29:12 2013 -0800
@@ -153,5 +153,37 @@
 			b.Fatal("Unmmarshal:", err)
 		}
 	}
-	b.SetBytes(int64(len(codeJSON)))
 }
+
+func BenchmarkUnmarshalString(b *testing.B) {
+	data := []byte(`"hello, world"`)
+	var s string
+
+	for i := 0; i < b.N; i++ {
+		if err := Unmarshal(data, &s); err != nil {
+			b.Fatal("Unmarshal:", err)
+		}
+	}
+}
+
+func BenchmarkUnmarshalFloat64(b *testing.B) {
+	var f float64
+	data := []byte(`3.14`)
+
+	for i := 0; i < b.N; i++ {
+		if err := Unmarshal(data, &f); err != nil {
+			b.Fatal("Unmarshal:", err)
+		}
+	}
+}
+
+func BenchmarkUnmarshalInt64(b *testing.B) {
+	var x int64
+	data := []byte(`3`)
+
+	for i := 0; i < b.N; i++ {
+		if err := Unmarshal(data, &x); err != nil {
+			b.Fatal("Unmarshal:", err)
+		}
+	}
+}
diff -r 6141bbace093 libgo/go/encoding/json/decode.go
--- a/libgo/go/encoding/json/decode.go	Tue Jan 29 10:59:14 2013 -0800
+++ b/libgo/go/encoding/json/decode.go	Tue Jan 29 17:29:12 2013 -0800
@@ -52,25 +52,6 @@
 // an UnmarshalTypeError describing the earliest such error.
 //
 func Unmarshal(data []byte, v interface{}) error {
-
-	// skip heavy processing for primitive values
-	var first byte
-	var i int
-	for i, first = range data {
-		if !isSpace(rune(first)) {
-			break
-		}
-	}
-	if first != '{' && first != '[' {
-		rv := reflect.ValueOf(v)
-		if rv.Kind() != reflect.Ptr || rv.IsNil() {
-			return &InvalidUnmarshalError{reflect.TypeOf(v)}
-		}
-		var d decodeState
-		d.literalStore(data[i:], rv.Elem(), false)
-		return d.savedError
-	}
-
 	d := new(decodeState).init(data)
 
 	// Quick check for well-formedness.
diff -r 6141bbace093 libgo/go/encoding/json/decode_test.go
--- a/libgo/go/encoding/json/decode_test.go	Tue Jan 29 10:59:14 2013 -0800
+++ b/libgo/go/encoding/json/decode_test.go	Tue Jan 29 17:29:12 2013 -0800
@@ -1059,12 +1059,33 @@
 	for _, item := range decodeTypeErrorTests {
 		err := Unmarshal([]byte(item.src), item.dest)
 		if _, ok := err.(*UnmarshalTypeError); !ok {
-			t.Errorf("expected type error for Unmarshal(%q, type %T): got %v instead",
+			t.Errorf("expected type error for Unmarshal(%q, type %T): got %T",
 item.src, item.dest, err)
 		}
 	}
 }
 
+var unmarshalSyntaxTests = []string{
+	"tru",
+	"fals",
+	"nul",
+	"123e",
+	`"hello`,
+	`[1,2,3`,
+	`{"key":1`,
+	`{"key":1,`,
+}
+
+func TestUnmarshalSyntax(t *testing.T) {
+	var x interface{}
+	for _, src := range unmarshalSyntaxTests {
+		err := Unmarshal([]byte(src), &x)
+		if _, ok := err.(*SyntaxError); !ok {
+			t.Errorf("expected syntax error for Unmarshal(%q): got %T", src, err)
+		}
+	}
+}
+
 // Test handling of unexported fields that should be ignored.
 // Issue 4660
 type unexportedFields struct {
diff -r 6141bbace093 libgo/go/encoding/json/stream.go
--- a/libgo/go/encoding/json/stream.go	Tue Jan 29 10:59:14 2013 -0800
+++ b/libgo/go/encoding/json/stream.go	Tue Jan 29 17:29:12 2013 -0800
@@ -5,6 +5,7 @@
 package json
 
 import (
+	"bytes"
 	"errors"
 	"io"
 )
@@ -58,6 +59,12 @@
 	return err
 }
 
+// Buffered returns a reader of the data remaining in the Decoder's
+// buffer. The reader is valid until the next call to Decode.
+func (dec *Decoder) Buffered() io.Reader {
+	return bytes.NewReader(dec.buf)
+}
+
 // readValue reads a JSON value into dec.buf.
 // It returns the length of the encoding.
 func (dec *Decoder) readValue() (int, error) {
diff -r 6141bbace093 libgo/go/encoding/json/stream_test.go
--- a/libgo/go/encoding/json/stream_test.go	Tue Jan 29 10:59:14 2013 -0800
+++ b/libgo/go/encoding/json/stream_test.go	Tue Jan 29 17:29:12 2013 -0800
@@ -6,8 +6,10 @@
 
 import (
 	"bytes"
+	"io/ioutil"
 	"net"
 	"reflect"
+	"strings"
 	"testing"
 )
 
@@ -83,6 +85,28 @@
 	}
 }
 
+func TestDecoderBuffered(t *testing.T) {
+	r := strings.NewReader(`{"Name": "Gopher"} extra `)
+	var m struct {
+		Name string
+	}
+	d := NewDecoder(r)
+	err := d.Decode(&m)
+	if err != nil {
+		t.Fatal(err)
+	}
+	if m.Name != "Gopher" {
+		t.Errorf("Name = %q; want Gopher", m.Name)
+	}
+	rest, err := ioutil.ReadAll(d.Buffered())
+	if err != nil {
+		t.Fatal(err)
+	}
+	if g, w := string(rest), " extra "; g != w {
+		t.Errorf("Remaining = %q; want %q", g, w)
+	}
+}
+
 func nlines(s string, n int) string {
 	if n <= 0 {
 		return ""
diff -r 6141bbace093 libgo/go/exp/ssa/blocko

[Patch, AArch64] Implement SIMD Absolute Difference Instructions

2013-01-29 Thread Hurugalawadi, Naveen
Hi,

Please find attached the patch that implements absolute difference
instructions for aarch64 target.
The patch modifies the testcase vect.c and vect-fp.c to check the
generated instructions and also their functionality.

Please review the patch and let me know if there should be any
modifications?

Build and tested on aarch64-thunder-elf (using Cavium's internal
simulator). 

Thanks,
Naveen.H.S

gcc/

2013-01-30   Naveen H.S  

* config/aarch64/aarch64-simd.md (simd_fabd): New Attribute.
(abd_3): New pattern.
(aba_3): New pattern.
(fabd_3): New pattern.

gcc/testsuite/

2013-01-30   Naveen H.S  

* gcc.target/aarch64/vect.c: Test and result vector added
for sabd and saba instructions.
* gcc.target/aarch64/vect-compile.c: Check for sabd and saba
instructions in assembly.
* gcc.target/aarch64/vect.x: Add sabd and saba test functions.
* gcc.target/aarch64/vect-fp.c: Test and result vector added
for fabd instruction.
* gcc.target/aarch64/vect-fp-compile.c: Check for fabd 
instruction in assembly.
* gcc.target/aarch64/vect-fp.x: Add fabd test function.
--- gcc/config/aarch64/aarch64-simd.md	2013-01-29 11:37:04.705429514 +0530
+++ gcc/config/aarch64/aarch64-simd.md	2013-01-29 16:58:07.401718855 +0530
@@ -44,6 +44,7 @@
 ; simd_dup  duplicate element.
 ; simd_dupgpduplicate general purpose register.
 ; simd_ext  bitwise extract from pair.
+; simd_fabd floating absolute difference and accumulate.
 ; simd_fadd floating point add/sub.
 ; simd_fcmp floating point compare.
 ; simd_fcvtifloating point convert to integer.
@@ -148,6 +149,7 @@
simd_dupgp,\
simd_ext,\
simd_fadd,\
+   simd_fabd,\
simd_fcmp,\
simd_fcvti,\
simd_fcvtl,\
@@ -520,6 +522,40 @@
(set_attr "simd_mode" "")]
 )
 
+(define_insn "abd_3"
+  [(set (match_operand:VDQ_BHSI 0 "register_operand" "=w")
+	(abs:VDQ_BHSI (minus:VDQ_BHSI 
+		   (match_operand:VDQ_BHSI 1 "register_operand" "w")
+		   (match_operand:VDQ_BHSI 2 "register_operand" "w"]
+  "TARGET_SIMD"
+  "sabd\t%0., %1., %2."
+  [(set_attr "simd_type" "simd_abd")
+   (set_attr "simd_mode" "")]
+)
+
+(define_insn "aba_3"
+  [(set (match_operand:VDQ_BHSI 0 "register_operand" "=w")
+	(plus:VDQ_BHSI (abs:VDQ_BHSI (minus:VDQ_BHSI 
+			 (match_operand:VDQ_BHSI 1 "register_operand" "w")
+			 (match_operand:VDQ_BHSI 2 "register_operand" "w")))
+		   (match_operand:VDQ_BHSI 3 "register_operand" "0")))]
+  "TARGET_SIMD"
+  "saba\t%0., %1., %2."
+  [(set_attr "simd_type" "simd_abd")
+   (set_attr "simd_mode" "")]
+)
+
+(define_insn "fabd_3"
+  [(set (match_operand:VDQF 0 "register_operand" "=w")
+	(abs:VDQF (minus:VDQF 
+		   (match_operand:VDQF 1 "register_operand" "w")
+		   (match_operand:VDQF 2 "register_operand" "w"]
+  "TARGET_SIMD"
+  "fabd\t%0., %1., %2."
+  [(set_attr "simd_type" "simd_fabd")
+   (set_attr "simd_mode" "")]
+)
+
 (define_insn "and3"
   [(set (match_operand:VDQ 0 "register_operand" "=w")
 (and:VDQ (match_operand:VDQ 1 "register_operand" "w")
--- gcc/testsuite/gcc.target/aarch64/vect.c	2013-01-24 20:10:09.703833384 +0530
+++ gcc/testsuite/gcc.target/aarch64/vect.c	2013-01-30 10:30:05.089505837 +0530
@@ -55,6 +55,8 @@ int main (void)
   int smin_vector[] = {0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15};
   unsigned int umax_vector[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
   unsigned int umin_vector[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+  int sabd_vector[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+  int saba_vector[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
   int reduce_smax_value = 0;
   int reduce_smin_value = -15;
   unsigned int reduce_umax_value = 15;
@@ -81,6 +83,8 @@ int main (void)
   TEST (smin, s);
   TEST (umax, u);
   TEST (umin, u);
+  TEST (sabd, s);
+  TEST (saba, s);
   TESTV (reduce_smax, s);
   TESTV (reduce_smin, s);
   TESTV (reduce_umax, u);
--- gcc/testsuite/gcc.target/aarch64/vect-compile.c	2013-01-24 20:10:09.703833384 +0530
+++ gcc/testsuite/gcc.target/aarch64/vect-compile.c	2013-01-29 14:11:16.909568490 +0530
@@ -16,5 +16,7 @@
 /* { dg-final { scan-assembler "uminv" } } */
 /* { dg-final { scan-assembler "smaxv" } } */
 /* { dg-final { scan-assembler "sminv" } } */
+/* { dg-final { scan-assembler "sabd" } } */
+/* { dg-final { scan-assembler "saba" } } */
 /* { dg-final { scan-assembler-times "addv" 2} } */
 /* { dg-final { scan-assembler-times "addp" 2} } */
--- gcc/testsuite/gcc.target/aarch64/vect-fp.c	2013-01-24 20:10:09.703833384 +0530
+++ gcc/testsuite/gcc.target/aarch64/vect-fp.c	2013-01-30 10:40:23.877491750 +0530
@@ -117,6 +117,16 @@ int main (void)
 			9.0, 10.0, 11.0, 12.0,
 			13.0, 14.0, 15.0, 16.0 };
 
+  F32  fabd_F32_vector[] = { 1.0f, 1.0f, 1.0f, 1.0f,
+			 1.0f, 1.0f, 1.0f, 1.0f,
+			 1.0f, 1.0f

[Patch, AArch64, AArch64-4.7] Implement SIMD Absolute Difference Instructions

2013-01-29 Thread Hurugalawadi, Naveen
Hi,

Please find attached the patch that implements absolute difference
instructions for aarch64 target.
The patch modifies the testcase vect.c and vect-fp.c to check the
generated instructions and also their functionality.

Please review the patch and let me know if there should be any
modifications?

Regressed for aarch64-elf on aarch64-4.7-branch.

Thanks,
Naveen.H.S

gcc/

2013-01-30   Naveen H.S  

* config/aarch64/aarch64-simd.md (simd_fabd): New Attribute.
(abd_3): New pattern.
(aba_3): New pattern.
(fabd_3): New pattern.

gcc/testsuite/

2013-01-30   Naveen H.S  

* gcc.target/aarch64/vect.c: Test and result vector added
for sabd and saba instructions.
* gcc.target/aarch64/vect-compile.c: Check for sabd and saba
instructions in assembly.
* gcc.target/aarch64/vect.x: Add sabd and saba test functions.
* gcc.target/aarch64/vect-fp.c: Test and result vector added
for fabd instruction.
* gcc.target/aarch64/vect-fp-compile.c: Check for fabd 
instruction in assembly.
* gcc.target/aarch64/vect-fp.x: Add fabd test function.
--- gcc/config/aarch64/aarch64-simd.md	2013-01-29 11:37:04.705429514 +0530
+++ gcc/config/aarch64/aarch64-simd.md	2013-01-29 16:58:07.401718855 +0530
@@ -44,6 +44,7 @@
 ; simd_dup  duplicate element.
 ; simd_dupgpduplicate general purpose register.
 ; simd_ext  bitwise extract from pair.
+; simd_fabd floating absolute difference and accumulate.
 ; simd_fadd floating point add/sub.
 ; simd_fcmp floating point compare.
 ; simd_fcvtifloating point convert to integer.
@@ -148,6 +149,7 @@
simd_dupgp,\
simd_ext,\
simd_fadd,\
+   simd_fabd,\
simd_fcmp,\
simd_fcvti,\
simd_fcvtl,\
@@ -520,6 +522,40 @@
(set_attr "simd_mode" "")]
 )
 
+(define_insn "abd_3"
+  [(set (match_operand:VDQ_BHSI 0 "register_operand" "=w")
+	(abs:VDQ_BHSI (minus:VDQ_BHSI 
+		   (match_operand:VDQ_BHSI 1 "register_operand" "w")
+		   (match_operand:VDQ_BHSI 2 "register_operand" "w"]
+  "TARGET_SIMD"
+  "sabd\t%0., %1., %2."
+  [(set_attr "simd_type" "simd_abd")
+   (set_attr "simd_mode" "")]
+)
+
+(define_insn "aba_3"
+  [(set (match_operand:VDQ_BHSI 0 "register_operand" "=w")
+	(plus:VDQ_BHSI (abs:VDQ_BHSI (minus:VDQ_BHSI 
+			 (match_operand:VDQ_BHSI 1 "register_operand" "w")
+			 (match_operand:VDQ_BHSI 2 "register_operand" "w")))
+		   (match_operand:VDQ_BHSI 3 "register_operand" "0")))]
+  "TARGET_SIMD"
+  "saba\t%0., %1., %2."
+  [(set_attr "simd_type" "simd_abd")
+   (set_attr "simd_mode" "")]
+)
+
+(define_insn "fabd_3"
+  [(set (match_operand:VDQF 0 "register_operand" "=w")
+	(abs:VDQF (minus:VDQF 
+		   (match_operand:VDQF 1 "register_operand" "w")
+		   (match_operand:VDQF 2 "register_operand" "w"]
+  "TARGET_SIMD"
+  "fabd\t%0., %1., %2."
+  [(set_attr "simd_type" "simd_fabd")
+   (set_attr "simd_mode" "")]
+)
+
 (define_insn "and3"
   [(set (match_operand:VDQ 0 "register_operand" "=w")
 (and:VDQ (match_operand:VDQ 1 "register_operand" "w")
--- gcc/testsuite/gcc.target/aarch64/vect.c	2013-01-24 20:10:09.703833384 +0530
+++ gcc/testsuite/gcc.target/aarch64/vect.c	2013-01-30 10:30:05.089505837 +0530
@@ -55,6 +55,8 @@ int main (void)
   int smin_vector[] = {0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15};
   unsigned int umax_vector[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
   unsigned int umin_vector[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+  int sabd_vector[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+  int saba_vector[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
   int reduce_smax_value = 0;
   int reduce_smin_value = -15;
   unsigned int reduce_umax_value = 15;
@@ -81,6 +83,8 @@ int main (void)
   TEST (smin, s);
   TEST (umax, u);
   TEST (umin, u);
+  TEST (sabd, s);
+  TEST (saba, s);
   TESTV (reduce_smax, s);
   TESTV (reduce_smin, s);
   TESTV (reduce_umax, u);
--- gcc/testsuite/gcc.target/aarch64/vect-compile.c	2013-01-24 20:10:09.703833384 +0530
+++ gcc/testsuite/gcc.target/aarch64/vect-compile.c	2013-01-29 14:11:16.909568490 +0530
@@ -16,5 +16,7 @@
 /* { dg-final { scan-assembler "uminv" } } */
 /* { dg-final { scan-assembler "smaxv" } } */
 /* { dg-final { scan-assembler "sminv" } } */
+/* { dg-final { scan-assembler "sabd" } } */
+/* { dg-final { scan-assembler "saba" } } */
 /* { dg-final { scan-assembler-times "addv" 2} } */
 /* { dg-final { scan-assembler-times "addp" 2} } */
--- gcc/testsuite/gcc.target/aarch64/vect-fp.c	2013-01-24 20:10:09.703833384 +0530
+++ gcc/testsuite/gcc.target/aarch64/vect-fp.c	2013-01-30 10:40:23.877491750 +0530
@@ -117,6 +117,16 @@ int main (void)
 			9.0, 10.0, 11.0, 12.0,
 			13.0, 14.0, 15.0, 16.0 };
 
+  F32  fabd_F32_vector[] = { 1.0f, 1.0f, 1.0f, 1.0f,
+			 1.0f, 1.0f, 1.0f, 1.0f,
+			 1.0f, 1.0f, 1.0f, 1.0f,
+			 1.0f, 1.0f, 1.0f, 1.0f };
+
+  F64  fabd_F64_vector[] = { 1.0,

Re: [Patch, Fortran] PR56138 - fix deferred-length character funcs w/o result variable

2013-01-29 Thread Paul Richard Thomas
Dear Tobias,

For a variety of reasons, I did not open my mailbox this morning but
got down to developing an almost identical fix and taking the PR!

Anyway, it would be best that you commit your fix, so it's OK for trunk.

Thanks

Paul

On 29 January 2013 23:36, Tobias Burnus  wrote:
> For allocatable string lengths (deferred length strings), the current code
> generates a local integer variable to which the the length is assigned.
>
> For some reason, that doesn't work for some functions which do not use a
> result variable - leading to failures as the pass-by-reference variable is
> not dereferenced. That's fixed by the attached patch. I have to admit that I
> do not understand why it works without the patch for the examples in
> gfortran.dg/allocatable_function_5.f90, where - for some tests - also no
> result variable is used.
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?
>
> Tobias



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


[PING^1] Allow widening multiplication in tree-ssa/slsr-*.c

2013-01-29 Thread Hurugalawadi, Naveen

Hi,

Please consider this as a reminder to review the patch posted at
following link:-
http://gcc.gnu.org/ml/gcc-patches/2013-01/msg00823.html

Please review the patch and let me know if its okay?

Thanks & Regards,
Naveen.H.S