Re: [PATCH] Fix vectorizable_reduction (PR tree-optimization/56350)

2013-02-19 Thread Richard Biener
On Mon, 18 Feb 2013, Jakub Jelinek wrote:

 Hi!
 
 On the following testcase, a = a / 8; looks like reasonable reduction
 statement, but we pattern recognize it as
 patt_1 = a  0 ? 7 : 0;
 patt_2 = a + patt_1;
 a = patt2  3;
 and in the first pattern stmt the reduction operand is in the condition of
 COND_EXPR, not operands as vectorizable_reduction was asserting.  Generally,
 it couldn't be used anywhere in a pattern stmt, it could be just some
 preparation statement.
 
 Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
 trunk?

Ok.

Thanks,
Richard.

 2013-02-18  Jakub Jelinek  ja...@redhat.com
 
   PR tree-optimization/56350
   * tree-vect-loop.c (vectorizable_reduction): If orig_stmt, return false
   if haven't found reduction or nested cycle operand, rather than
   asserting we must find it.
 
   * gcc.dg/pr56350.c: New test.
 
 --- gcc/tree-vect-loop.c.jj   2013-01-15 10:30:19.0 +0100
 +++ gcc/tree-vect-loop.c  2013-02-18 11:32:30.306566358 +0100
 @@ -4692,7 +4692,7 @@ vectorizable_reduction (gimple stmt, gim
   The last use is the reduction variable.  In case of nested cycle this
   assumption is not true: we use reduc_index to record the index of the
   reduction variable.  */
 -  for (i = 0; i  op_type-1; i++)
 +  for (i = 0; i  op_type - 1; i++)
  {
/* The condition of COND_EXPR is checked in vectorizable_condition().  
 */
if (i == 0  code == COND_EXPR)
 @@ -4724,11 +4724,18 @@ vectorizable_reduction (gimple stmt, gim
if (!vectype_in)
  vectype_in = tem;
gcc_assert (is_simple_use);
 -  gcc_assert (dt == vect_reduction_def
 -  || dt == vect_nested_cycle
 -  || ((dt == vect_internal_def || dt == vect_external_def
 -   || dt == vect_constant_def || dt == vect_induction_def)
 -nested_cycle  found_nested_cycle_def));
 +  if (!(dt == vect_reduction_def
 + || dt == vect_nested_cycle
 + || ((dt == vect_internal_def || dt == vect_external_def
 +  || dt == vect_constant_def || dt == vect_induction_def)
 +  nested_cycle  found_nested_cycle_def)))
 +{
 +  /* For pattern recognized stmts, orig_stmt might be a reduction,
 +  but some helper statements for the pattern might not, or
 +  might be COND_EXPRs with reduction uses in the condition.  */
 +  gcc_assert (orig_stmt);
 +  return false;
 +}
if (!found_nested_cycle_def)
  reduc_def_stmt = def_stmt;
  
 --- gcc/testsuite/gcc.dg/pr56350.c.jj 2013-02-18 11:30:12.117327599 +0100
 +++ gcc/testsuite/gcc.dg/pr56350.c2013-02-18 11:29:59.0 +0100
 @@ -0,0 +1,13 @@
 +/* PR tree-optimization/56350 */
 +/* { dg-do compile } */
 +/* { dg-options -O -ftree-vectorize } */
 +
 +int a, b, c;
 +
 +void
 +f (void)
 +{
 +  for (; c; c++)
 +for (b = 0; b  2; b++)
 +  a /= 8;
 +}
 
   Jakub
 
 

-- 
Richard Biener rguent...@suse.de
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


Re: [PATCH] Fix create_expression_by_pieces (PR tree-optimization/56381)

2013-02-19 Thread Richard Biener
On Mon, 18 Feb 2013, Jeff Law wrote:

 On 02/18/13 15:32, Jakub Jelinek wrote:
  Hi!
  
  This accesses one past the last initialized argument.
  Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
  trunk?
  
  2013-02-18  Jakub Jelinek  ja...@redhat.com
  
  PR tree-optimization/56381
  * tree-ssa-pre.c (create_expression_by_pieces): Fix up last argument
  to fold_build3.
  
  * g++.dg/opt/pr56381.C: New test.
 OK.  Arguably this could have gone in under the obvious rule.

Btw, the 4.7 branch is affected, too.

Richard.


Re: [patch] [libffi] do not install libffi library, headers and documentation

2013-02-19 Thread Richard Biener
On Mon, Feb 18, 2013 at 6:02 PM, Matthias Klose d...@ubuntu.com wrote:
 Am 12.02.2013 13:45, schrieb Richard Biener:
 On Tue, Feb 12, 2013 at 1:44 PM, Richard Biener
 richard.guent...@gmail.com wrote:
 On Tue, Feb 12, 2013 at 1:30 PM, Matthias Klose d...@ubuntu.com wrote:
 The libffi library, headers and documentation are still installed, although
 libffi provides separate releases for a long time.  So do not install these
 anymore as part of a GCC install.  Tested with a build and an install with 
 go
 and java enabled (both using libffi_convenience). Ok for the trunk?

 openSUSE is using the GCC provided libffi, so no, this is not ok (not at 
 this
 stage anyway).  Also proper not-installing libffi would work by disabling
 the maybe-install-target-libffi at the toplevel, not changing libffi 
 makfiles
 (which are supposed to be imported from upstream, no?)

 Thus, add no_install= true; to the libffi target module

 updated patch attached, checked with a make install that no ffi headers and
 libraries are installed. If not ok for 4.8, ok for 4.9 when it opens?

I'm fine with that variant but I'd like to see another ok.  No preference as to
whether to target 4.8 or 4.9.

Richard.

   Matthias



Re: [PATCH, PR 55334] Disable IPA-CP on restrict pointers to arrays

2013-02-19 Thread Richard Biener
On Mon, Feb 18, 2013 at 9:06 PM, Martin Jambor mjam...@suse.cz wrote:
 Hi,

 after much pondering about PR 55334 I came to conclusion that no nice
 fix to the regression could be introduced in stage4.  So for the sake
 of the SPEC 200 benchmark I decided to cripple IPA-CP on restrict
 pointers to arrays so that the restrict-ness of the memory references
 which need to be vectorized is not lost.

 I have tried various less aggressive tricks like only propagating the
 one constant address that heuristics decided was profitable and not
 all the others that came from the same calling contexts (and were
 restrict) but then inlining came along and finished the deed with the
 same consequences as IPA-CP had.

 That only reinforced my feeling that the patch below is a spec hack
 and that we ought to find a better way of preserving the restrict-ness
 across IPA optimizations.  Therefore I will keep the bug open and
 revert this patch after 4.8 is branched and stage1 opens.

 Meanwhile, this passes bootstrap and testsuite on x86_64-linux.  OK
 for trunk?

 Thanks,

 Martin


 2013-02-07  Martin Jambor  mjam...@suse.cz

 PR tree-optimization/55334
 * ipa-cp.c (initialize_node_lattices): Disable IPA-CP through and to
 restricted pointers to arrays.

 Index: src/gcc/ipa-cp.c
 ===
 --- src.orig/gcc/ipa-cp.c
 +++ src/gcc/ipa-cp.c
 @@ -730,6 +730,22 @@ initialize_node_lattices (struct cgraph_
  cgraph_node_name (node), node-uid,
  disable ? BOTTOM : VARIABLE);
  }
 +  if (!disable)
 +for (i = 0; i  ipa_get_param_count (info) ; i++)
 +  {
 +   struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
 +   tree t = TREE_TYPE (ipa_get_param(info, i));
 +
 +   if (TYPE_RESTRICT (t)  POINTER_TYPE_P (t)

You want to first test for POINTER_TYPE_P and then for TYPE_RESTRICT.

 +TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)

With only testing for ARRAY_TYPE here you will still IPA-CP array
descriptors, right?  Those are RECORD_TYPE, the parameter being
DECL_BY_REFERENCE.  So I'd try instead

 DECL_BY_REFERENCE (ipa_get_parm (info, i))

which leads me to the question - what is ipa_get_parm (info, i) returning?
Is it the lattice _value_?  Or is it the PARM_DECL of the callee (which is
the only important piece of information!)?

Thanks,
Richard.

 + {
 +   set_lattice_to_bottom (plats-itself);
 +   if (dump_file  (dump_flags  TDF_DETAILS)
 +!node-alias  !node-thunk.thunk_p)
 + fprintf (dump_file, Going to ignore param %i of of %s/%i.\n,
 +  i, cgraph_node_name (node), node-uid);
 + }
 +  }

for (ie = node-indirect_calls; ie; ie = ie-next_callee)
  if (ie-indirect_info-polymorphic)



Re: [PATCH, PR 55334] Disable IPA-CP on restrict pointers to arrays

2013-02-19 Thread Martin Jambor
Hi,

On Tue, Feb 19, 2013 at 10:21:32AM +0100, Richard Biener wrote:
 On Mon, Feb 18, 2013 at 9:06 PM, Martin Jambor mjam...@suse.cz wrote:
  Hi,
 
  after much pondering about PR 55334 I came to conclusion that no nice
  fix to the regression could be introduced in stage4.  So for the sake
  of the SPEC 200 benchmark I decided to cripple IPA-CP on restrict
  pointers to arrays so that the restrict-ness of the memory references
  which need to be vectorized is not lost.
 
  I have tried various less aggressive tricks like only propagating the
  one constant address that heuristics decided was profitable and not
  all the others that came from the same calling contexts (and were
  restrict) but then inlining came along and finished the deed with the
  same consequences as IPA-CP had.
 
  That only reinforced my feeling that the patch below is a spec hack
  and that we ought to find a better way of preserving the restrict-ness
  across IPA optimizations.  Therefore I will keep the bug open and
  revert this patch after 4.8 is branched and stage1 opens.
 
  Meanwhile, this passes bootstrap and testsuite on x86_64-linux.  OK
  for trunk?
 
  Thanks,
 
  Martin
 
 
  2013-02-07  Martin Jambor  mjam...@suse.cz
 
  PR tree-optimization/55334
  * ipa-cp.c (initialize_node_lattices): Disable IPA-CP through and to
  restricted pointers to arrays.
 
  Index: src/gcc/ipa-cp.c
  ===
  --- src.orig/gcc/ipa-cp.c
  +++ src/gcc/ipa-cp.c
  @@ -730,6 +730,22 @@ initialize_node_lattices (struct cgraph_
   cgraph_node_name (node), node-uid,
   disable ? BOTTOM : VARIABLE);
   }
  +  if (!disable)
  +for (i = 0; i  ipa_get_param_count (info) ; i++)
  +  {
  +   struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
  +   tree t = TREE_TYPE (ipa_get_param(info, i));
  +
  +   if (TYPE_RESTRICT (t)  POINTER_TYPE_P (t)
 
 You want to first test for POINTER_TYPE_P and then for TYPE_RESTRICT.
 

I see, will do.

  +TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
 
 With only testing for ARRAY_TYPE here you will still IPA-CP array
 descriptors, right?  Those are RECORD_TYPE, the parameter being
 DECL_BY_REFERENCE.

Possibly, why do you think that matters?  In reality, can the
descriptors ever be global variables and thus propagated?  (This is
all about the old scalar IPA-CP, it has nothing to do with the new
aggregate one.  It's just that in 4.8 heuristics decides to clone
since an otherwise unrelated patch in r190015.  In fact, aggregate
IPA-CP is not disabled by this patch).

 So I'd try instead
 
  DECL_BY_REFERENCE (ipa_get_parm (info, i))
 

This would also disable propagation of simple scalar constants passed
by reference the Fortran way (I have just checked by looking at of PR
53787) which I specifically did not want to do.  Therefore, I'd rather
stick to my original proposal (modulo the order of pointer and
restrict tests order).

 which leads me to the question - what is ipa_get_parm (info, i) returning?
 Is it the lattice _value_?  Or is it the PARM_DECL of the callee (which is
 the only important piece of information!)?

The PARM_DECL.

Thanks,

Martin


Re: [PATCH, PR 55334] Disable IPA-CP on restrict pointers to arrays

2013-02-19 Thread Richard Biener
On Tue, Feb 19, 2013 at 12:22 PM, Martin Jambor mjam...@suse.cz wrote:
 Hi,

 On Tue, Feb 19, 2013 at 10:21:32AM +0100, Richard Biener wrote:
 On Mon, Feb 18, 2013 at 9:06 PM, Martin Jambor mjam...@suse.cz wrote:
  Hi,
 
  after much pondering about PR 55334 I came to conclusion that no nice
  fix to the regression could be introduced in stage4.  So for the sake
  of the SPEC 200 benchmark I decided to cripple IPA-CP on restrict
  pointers to arrays so that the restrict-ness of the memory references
  which need to be vectorized is not lost.
 
  I have tried various less aggressive tricks like only propagating the
  one constant address that heuristics decided was profitable and not
  all the others that came from the same calling contexts (and were
  restrict) but then inlining came along and finished the deed with the
  same consequences as IPA-CP had.
 
  That only reinforced my feeling that the patch below is a spec hack
  and that we ought to find a better way of preserving the restrict-ness
  across IPA optimizations.  Therefore I will keep the bug open and
  revert this patch after 4.8 is branched and stage1 opens.
 
  Meanwhile, this passes bootstrap and testsuite on x86_64-linux.  OK
  for trunk?
 
  Thanks,
 
  Martin
 
 
  2013-02-07  Martin Jambor  mjam...@suse.cz
 
  PR tree-optimization/55334
  * ipa-cp.c (initialize_node_lattices): Disable IPA-CP through and 
  to
  restricted pointers to arrays.
 
  Index: src/gcc/ipa-cp.c
  ===
  --- src.orig/gcc/ipa-cp.c
  +++ src/gcc/ipa-cp.c
  @@ -730,6 +730,22 @@ initialize_node_lattices (struct cgraph_
   cgraph_node_name (node), node-uid,
   disable ? BOTTOM : VARIABLE);
   }
  +  if (!disable)
  +for (i = 0; i  ipa_get_param_count (info) ; i++)
  +  {
  +   struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, 
  i);
  +   tree t = TREE_TYPE (ipa_get_param(info, i));
  +
  +   if (TYPE_RESTRICT (t)  POINTER_TYPE_P (t)

 You want to first test for POINTER_TYPE_P and then for TYPE_RESTRICT.


 I see, will do.

  +TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)

 With only testing for ARRAY_TYPE here you will still IPA-CP array
 descriptors, right?  Those are RECORD_TYPE, the parameter being
 DECL_BY_REFERENCE.

 Possibly, why do you think that matters?  In reality, can the
 descriptors ever be global variables and thus propagated?  (This is
 all about the old scalar IPA-CP, it has nothing to do with the new
 aggregate one.  It's just that in 4.8 heuristics decides to clone
 since an otherwise unrelated patch in r190015.  In fact, aggregate
 IPA-CP is not disabled by this patch).

I'm not sure about global array descriptors but I seem to remember seeing
those.

 So I'd try instead

  DECL_BY_REFERENCE (ipa_get_parm (info, i))


 This would also disable propagation of simple scalar constants passed
 by reference the Fortran way (I have just checked by looking at of PR
 53787) which I specifically did not want to do.  Therefore, I'd rather
 stick to my original proposal (modulo the order of pointer and
 restrict tests order).

Ok, that makes sense.

 which leads me to the question - what is ipa_get_parm (info, i) returning?
 Is it the lattice _value_?  Or is it the PARM_DECL of the callee (which is
 the only important piece of information!)?

 The PARM_DECL.

Fine.

The patch is ok then, with the restrict / pointer test re-ordered.

Thanks,
Richard.

 Thanks,

 Martin


[PATCH] Fix PR56384

2013-02-19 Thread Richard Biener

This fixes PHI value-numbering which did not correctly distinguish
types in case of still VN_TOP PHI arguments.

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

Richard.

2013-02-19  Richard Biener  rguent...@suse.de

PR tree-optimization/56384
* tree-ssa-sccvn.h (struct vn_phi_s): Add type member.
(vn_hash_type): Split out from ...
(vn_hash_constant_with_type): ... here.
* tree-ssa-sccvn.c (vn_phi_compute_hash): Use vn_hash_type.
(vn_phi_eq): Compare types from vn_phi_s structure.
(vn_phi_lookup): Populate vn_phi_s type.
(vn_phi_insert): Likewise.

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

Index: gcc/tree-ssa-sccvn.h
===
*** gcc/tree-ssa-sccvn.h(revision 196134)
--- gcc/tree-ssa-sccvn.h(working copy)
*** typedef struct vn_phi_s
*** 67,72 
--- 67,73 
hashval_t hashcode;
vectree phiargs;
basic_block block;
+   tree type;
tree result;
  } *vn_phi_t;
  typedef const struct vn_phi_s *const_vn_phi_t;
*** typedef struct vn_constant_s
*** 122,138 
  enum vn_kind { VN_NONE, VN_CONSTANT, VN_NARY, VN_REFERENCE, VN_PHI };
  enum vn_kind vn_get_stmt_kind (gimple);
  
  /* Hash the constant CONSTANT with distinguishing type incompatible
 constants in the types_compatible_p sense.  */
  
  static inline hashval_t
  vn_hash_constant_with_type (tree constant)
  {
-   tree type = TREE_TYPE (constant);
return (iterative_hash_expr (constant, 0)
! + INTEGRAL_TYPE_P (type)
! + (INTEGRAL_TYPE_P (type)
!? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0));
  }
  
  /* Compare the constants C1 and C2 with distinguishing type incompatible
--- 123,147 
  enum vn_kind { VN_NONE, VN_CONSTANT, VN_NARY, VN_REFERENCE, VN_PHI };
  enum vn_kind vn_get_stmt_kind (gimple);
  
+ /* Hash the type TYPE using bits that distinguishes it in the
+types_compatible_p sense.  */
+ 
+ static inline hashval_t
+ vn_hash_type (tree type)
+ {
+   return (INTEGRAL_TYPE_P (type)
+ + (INTEGRAL_TYPE_P (type)
+? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0));
+ }
+ 
  /* Hash the constant CONSTANT with distinguishing type incompatible
 constants in the types_compatible_p sense.  */
  
  static inline hashval_t
  vn_hash_constant_with_type (tree constant)
  {
return (iterative_hash_expr (constant, 0)
! + vn_hash_type (TREE_TYPE (constant)));
  }
  
  /* Compare the constants C1 and C2 with distinguishing type incompatible
Index: gcc/tree-ssa-sccvn.c
===
*** gcc/tree-ssa-sccvn.c(revision 196134)
--- gcc/tree-ssa-sccvn.c(working copy)
*** vn_phi_compute_hash (vn_phi_t vp1)
*** 2401,2410 
  
/* If all PHI arguments are constants we need to distinguish
   the PHI node via its type.  */
!   type = TREE_TYPE (vp1-phiargs[0]);
!   result += (INTEGRAL_TYPE_P (type)
!+ (INTEGRAL_TYPE_P (type)
!   ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0));
  
FOR_EACH_VEC_ELT (vp1-phiargs, i, phi1op)
  {
--- 2401,2408 
  
/* If all PHI arguments are constants we need to distinguish
   the PHI node via its type.  */
!   type = vp1-type;
!   result += vn_hash_type (type);
  
FOR_EACH_VEC_ELT (vp1-phiargs, i, phi1op)
  {
*** vn_phi_eq (const void *p1, const void *p
*** 2443,2450 
  
/* If the PHI nodes do not have compatible types
 they are not the same.  */
!   if (!types_compatible_p (TREE_TYPE (vp1-phiargs[0]),
!  TREE_TYPE (vp2-phiargs[0])))
return false;
  
/* Any phi in the same block will have it's arguments in the
--- 2441,2447 
  
/* If the PHI nodes do not have compatible types
 they are not the same.  */
!   if (!types_compatible_p (vp1-type, vp2-type))
return false;
  
/* Any phi in the same block will have it's arguments in the
*** vn_phi_lookup (gimple phi)
*** 2484,2489 
--- 2481,2487 
def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def;
shared_lookup_phiargs.safe_push (def);
  }
+   vp1.type = TREE_TYPE (gimple_phi_result (phi));
vp1.phiargs = shared_lookup_phiargs;
vp1.block = gimple_bb (phi);
vp1.hashcode = vn_phi_compute_hash (vp1);
*** vn_phi_insert (gimple phi, tree result)
*** 2516,2521 
--- 2514,2520 
args.safe_push (def);
  }
vp1-value_id = VN_INFO (result)-value_id;
+   vp1-type = TREE_TYPE (gimple_phi_result (phi));
vp1-phiargs = args;
vp1-block = gimple_bb (phi);
vp1-result = result;


[PATCH] Fix PR 55889

2013-02-19 Thread Andrey Belevantsev

Hello,

As we discussed in the PR, the problem here is that the selective scheduler 
does not expect that renaming a hard register to a pseudo would result in 
extra dependencies.  The dependencies come from implicit clobbers code of 
sched-deps.c, so I've made a minimal patch that checks only for that case 
using the same function from IRA and avoids it.


The patch fixes the test case on AIX as reported by David and also 
bootstraps and tests fine on x86-64 and ia64, ok for trunk?


The second patch is restoring debug printing in the scheduler that was 
accidentally broken, possibly by Steven's cleanups (now a pattern is 
expected where an insn was previously).  I will commit is as obvious 
separately.


Andrey

2012-02-19  Andrey Belevantsev  a...@ispras.ru

PR middle-end/55889

* sel-sched.c: Include ira.h.
(implicit_clobber_conflict_p): New function.
(moveup_expr): Use it.
* Makefile.in (sel-sched.o): Depend on ira.h.


And the second patch is:

2012-02-19  Andrey Belevantsev  a...@ispras.ru

* sel-sched-dump.c (dump_insn_rtx_flags): Explicitly set
DUMP_INSN_RTX_UID.
(dump_insn_rtx_1): Pass PATTERN (insn) to str_pattern_slim.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f3bb168..557ab08 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3338,7 +3338,7 @@ sel-sched.o : sel-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(FUNCTION_H) $(INSN_ATTR_H)  $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
$(TM_P_H) output.h $(TARGET_H) $(TREE_PASS_H)  \
$(SCHED_INT_H) $(GGC_H) $(TREE_H) langhooks.h rtlhooks-def.h \
-   $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) sel-sched.h $(DBGCNT_H) $(EMIT_RTL_H)
+   $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) sel-sched.h $(DBGCNT_H) $(EMIT_RTL_H) ira.h
 sel-sched-dump.o : sel-sched-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
$(FUNCTION_H) $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 6f60d70..2944489 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3.  If not see
 #include langhooks.h
 #include rtlhooks-def.h
 #include emit-rtl.h
+#include ira.h
 
 #ifdef INSN_SCHEDULING
 #include sel-sched-ir.h
@@ -2101,6 +2102,61 @@ moving_insn_creates_bookkeeping_block_p (insn_t insn,
   return TRUE;
 }
 
+/* Return true when the conflict with newly created implicit clobbers
+   between EXPR and THROUGH_INSN is found because of renaming.  */
+static bool
+implicit_clobber_conflict_p (insn_t through_insn, expr_t expr)
+{
+  HARD_REG_SET temp;
+  rtx insn, reg, rhs, pat;
+  hard_reg_set_iterator hrsi;
+  unsigned regno;
+  bool valid;
+
+  /* Make a new pseudo register.  */
+  reg = gen_reg_rtx (GET_MODE (EXPR_LHS (expr)));
+  max_regno = max_reg_num ();
+  maybe_extend_reg_info_p ();
+
+  /* Validate a change and bail out early.  */
+  insn = EXPR_INSN_RTX (expr);
+  validate_change (insn, SET_DEST (PATTERN (insn)), reg, 1);
+  valid = verify_changes (0);
+  cancel_changes (0);
+  if (!valid)
+{
+  if (sched_verbose = 6)
+	sel_print (implicit clobbers failed validation, );
+  return true;
+}
+
+  /* Make a new insn with it.  */
+  rhs = copy_rtx (VINSN_RHS (EXPR_VINSN (expr)));
+  pat = gen_rtx_SET (VOIDmode, reg, rhs);
+  start_sequence ();
+  insn = emit_insn (pat);
+  end_sequence ();
+
+  /* Calculate implicit clobbers.  */
+  extract_insn (insn);
+  preprocess_constraints ();
+  ira_implicitly_set_insn_hard_regs (temp);
+  AND_COMPL_HARD_REG_SET (temp, ira_no_alloc_regs);
+
+  /* If any implicit clobber registers intersect with regular ones in
+ through_insn, we have a dependency and thus bail out.  */
+  EXECUTE_IF_SET_IN_HARD_REG_SET (temp, 0, regno, hrsi)
+{
+  vinsn_t vi = INSN_VINSN (through_insn);
+  if (bitmap_bit_p (VINSN_REG_SETS (vi), regno)
+	  || bitmap_bit_p (VINSN_REG_CLOBBERS (vi), regno)
+	  || bitmap_bit_p (VINSN_REG_USES (vi), regno))
+	return true;
+}
+
+  return false;
+}
+
 /* Modifies EXPR so it can be moved through the THROUGH_INSN,
performing necessary transformations.  Record the type of transformation
made in PTRANS_TYPE, when it is not NULL.  When INSIDE_INSN_GROUP,
@@ -2233,6 +2289,17 @@ moveup_expr (expr_t expr, insn_t through_insn, bool inside_insn_group,
   if (!enable_schedule_as_rhs_p || !EXPR_SEPARABLE_P (expr))
 return MOVEUP_EXPR_NULL;
 
+  /* When renaming a hard register to a pseudo before reload, extra
+	 dependencies can occur from the implicit clobbers of the insn.
+	 Filter out such cases here.  */
+  if (!reload_completed  REG_P (EXPR_LHS (expr))
+	   HARD_REGISTER_P (EXPR_LHS (expr))
+	   implicit_clobber_conflict_p (through_insn, expr))
+	{
+	  if (sched_verbose = 6)
+	sel_print (implicit clobbers conflict detected, );
+	  return MOVEUP_EXPR_NULL;
+	}
   EXPR_TARGET_AVAILABLE (expr) = 

[4.7, testsuite] Clear hwcap_2 with Sun ld

2013-02-19 Thread Rainer Orth
I'd like to backport

[testsuite] Clear hwcap_2 with Sun ld
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01246.html

2012-06-19  Rainer Orth  r...@cebitec.uni-bielefeld.de

* gcc.target/i386/clearcapv2.map: New file.
* gcc.target/i386/i386.exp: Try it first before clearcap.map.

to the 4.7 branch since recently all avx2 tests started to FAIL there on
Solaris 10 and 11/x86 with Sun as.  It applies cleanly as is,
bootstrapped without regressions on i386-pc-solaris2.10 and
x86_64-unknown-linux-gnu.

Ok for 4.7 branch?

Rainer 

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


Re: [PATCH] Fix PR 55889

2013-02-19 Thread Alexander Monakov


On Tue, 19 Feb 2013, Andrey Belevantsev wrote:

 Hello,
 
 As we discussed in the PR, the problem here is that the selective scheduler
 does not expect that renaming a hard register to a pseudo would result in
 extra dependencies.  The dependencies come from implicit clobbers code of
 sched-deps.c, so I've made a minimal patch that checks only for that case
 using the same function from IRA and avoids it.
 
 The patch fixes the test case on AIX as reported by David and also bootstraps
 and tests fine on x86-64 and ia64, ok for trunk?

OK (with 1 changed to true in arguments to validate_change as discussed
offline), thanks.

-- 
Alexander


[PATCH] Speedup IVOPTs

2013-02-19 Thread Richard Biener

This speeds up IVOPTs by optimizing its hottest function when compiling
polyhedron linpk.  The datastructure used for recording use, candidate
costs (a hashtable) should make O(1) queries on average - but it turns
out that for use, candidate queries that have no entry recorded in
it it is O(n) currently.  That's because the collision handling does
not abort when coming across an empty hashtable entry (oops).

Overall compile-time effect is noise (linpk compiles in less than
a second for me ...), but callgrind tells me it results in a 3%
compile-time improvement.

There is still the degenerate cases when the hashtable is (almost)
full (doesn't happen for this testcase), but that's an unrelated issue.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Jakub, does this look ok for trunk now or shall I wait for stage1?

Thanks,
Richard.

2013-02-19  Richard Biener  rguent...@suse.de

* tree-ssa-loop-ivopts.c (alloc_use_cost_map): Use bitmap_count_bits
and ceil_log2.
(get_use_iv_cost): Terminate hashtable walk when coming across
an empty entry.

Index: gcc/tree-ssa-loop-ivopts.c
===
*** gcc/tree-ssa-loop-ivopts.c  (revision 196135)
--- gcc/tree-ssa-loop-ivopts.c  (working copy)
*** record_important_candidates (struct ivop
*** 2574,2599 
  static void
  alloc_use_cost_map (struct ivopts_data *data)
  {
!   unsigned i, size, s, j;
  
for (i = 0; i  n_iv_uses (data); i++)
  {
struct iv_use *use = iv_use (data, i);
-   bitmap_iterator bi;
  
if (data-consider_all_candidates)
size = n_iv_cands (data);
else
{
! s = 0;
! EXECUTE_IF_SET_IN_BITMAP (use-related_cands, 0, j, bi)
!   {
! s++;
!   }
  
  /* Round up to the power of two, so that moduling by it is fast.  */
! for (size = 1; size  s; size = 1)
!   continue;
}
  
use-n_map_members = size;
--- 2574,2593 
  static void
  alloc_use_cost_map (struct ivopts_data *data)
  {
!   unsigned i, size, s;
  
for (i = 0; i  n_iv_uses (data); i++)
  {
struct iv_use *use = iv_use (data, i);
  
if (data-consider_all_candidates)
size = n_iv_cands (data);
else
{
! s = bitmap_count_bits (use-related_cands);
  
  /* Round up to the power of two, so that moduling by it is fast.  */
! size = 1  ceil_log2 (s + 1);
}
  
use-n_map_members = size;
*** get_use_iv_cost (struct ivopts_data *dat
*** 2731,2740 
for (i = s; i  use-n_map_members; i++)
  if (use-cost_map[i].cand == cand)
return use-cost_map + i;
! 
for (i = 0; i  s; i++)
  if (use-cost_map[i].cand == cand)
return use-cost_map + i;
  
return NULL;
  }
--- 2725,2737 
for (i = s; i  use-n_map_members; i++)
  if (use-cost_map[i].cand == cand)
return use-cost_map + i;
! else if (use-cost_map[i].cand == NULL)
!   return NULL;
for (i = 0; i  s; i++)
  if (use-cost_map[i].cand == cand)
return use-cost_map + i;
+ else if (use-cost_map[i].cand == NULL)
+   return NULL;
  
return NULL;
  }


Re: [PATCH] Speedup IVOPTs

2013-02-19 Thread Jakub Jelinek
On Tue, Feb 19, 2013 at 02:59:46PM +0100, Richard Biener wrote:
 This speeds up IVOPTs by optimizing its hottest function when compiling
 polyhedron linpk.  The datastructure used for recording use, candidate
 costs (a hashtable) should make O(1) queries on average - but it turns
 out that for use, candidate queries that have no entry recorded in
 it it is O(n) currently.  That's because the collision handling does
 not abort when coming across an empty hashtable entry (oops).
 
 Overall compile-time effect is noise (linpk compiles in less than
 a second for me ...), but callgrind tells me it results in a 3%
 compile-time improvement.
 
 There is still the degenerate cases when the hashtable is (almost)
 full (doesn't happen for this testcase), but that's an unrelated issue.
 
 Bootstrap and regtest running on x86_64-unknown-linux-gnu.
 
 Jakub, does this look ok for trunk now or shall I wait for stage1?
 

This:

 /* Round up to the power of two, so that moduling by it is fast.  */
 !   for (size = 1; size  s; size = 1)
 ! continue;
   }
   
 use-n_map_members = size;

isn't equivalent to:

 /* Round up to the power of two, so that moduling by it is fast.  */
 !   size = 1  ceil_log2 (s + 1);
   }

size = s ? (1  ceil_log2 (s)) : 1;

would be I think.  Is it intentional that for power of 2 you set now size
to double that value?

 --- 2725,2737 
 for (i = s; i  use-n_map_members; i++)
   if (use-cost_map[i].cand == cand)
 return use-cost_map + i;
 ! else if (use-cost_map[i].cand == NULL)
 !   return NULL;
 for (i = 0; i  s; i++)
   if (use-cost_map[i].cand == cand)
 return use-cost_map + i;
 + else if (use-cost_map[i].cand == NULL)
 +   return NULL;
   
 return NULL;
   }

This looks good to me, even at this point.

Jakub


[PATCH] Speedup lookup_constraint for 2-letter constraints

2013-02-19 Thread Richard Biener

This speeds up lookup_constraint by allowing the generic folding
for n == 1 strncmp calls to trigger, handling two-letter constraints
by two char comparisons instead of one and a call to strncmp (which
ends up not being inlined because it's considered cold ...).

Bootstrap  regtest pending on x86_64-unknown-linux-gnu.

Ok?

Thanks,
Richard.
2013-02-19  Richard Biener  rguent...@suse.de

* genpreds.c (write_lookup_constraint): Do not compare first
letter of the constraint again.

Index: gcc/genpreds.c
===
--- gcc/genpreds.c  (revision 196134)
+++ gcc/genpreds.c  (working copy)
@@ -945,9 +945,10 @@ write_lookup_constraint (void)
{
  do
{
- printf (  if (!strncmp (str, \%s\, %lu))\n
+ printf (  if (!strncmp (str + 1, \%s\, %lu))\n
  return CONSTRAINT_%s;\n,
- c-name, (unsigned long int) c-namelen, c-c_name);
+ c-name + 1, (unsigned long int) c-namelen - 1,
+ c-c_name);
  c = c-next_this_letter;
}
  while (c);
 


Re: [PATCH] Speedup IVOPTs

2013-02-19 Thread Richard Biener
On Tue, 19 Feb 2013, Jakub Jelinek wrote:

 On Tue, Feb 19, 2013 at 02:59:46PM +0100, Richard Biener wrote:
  This speeds up IVOPTs by optimizing its hottest function when compiling
  polyhedron linpk.  The datastructure used for recording use, candidate
  costs (a hashtable) should make O(1) queries on average - but it turns
  out that for use, candidate queries that have no entry recorded in
  it it is O(n) currently.  That's because the collision handling does
  not abort when coming across an empty hashtable entry (oops).
  
  Overall compile-time effect is noise (linpk compiles in less than
  a second for me ...), but callgrind tells me it results in a 3%
  compile-time improvement.
  
  There is still the degenerate cases when the hashtable is (almost)
  full (doesn't happen for this testcase), but that's an unrelated issue.
  
  Bootstrap and regtest running on x86_64-unknown-linux-gnu.
  
  Jakub, does this look ok for trunk now or shall I wait for stage1?
  
 
 This:
 
/* Round up to the power of two, so that moduling by it is fast.  */
  ! for (size = 1; size  s; size = 1)
  !   continue;
  }

  use-n_map_members = size;
 
 isn't equivalent to:
 
/* Round up to the power of two, so that moduling by it is fast.  */
  ! size = 1  ceil_log2 (s + 1);
  }
 
 size = s ? (1  ceil_log2 (s)) : 1;
 
 would be I think.  Is it intentional that for power of 2 you set now size
 to double that value?

Well, I used the lame variant to avoid a zero argument to ceil_log2 ...
I'll use yours instead.

Ok?

Thanks,
Richard.

  --- 2725,2737 
  for (i = s; i  use-n_map_members; i++)
if (use-cost_map[i].cand == cand)
  return use-cost_map + i;
  ! else if (use-cost_map[i].cand == NULL)
  !   return NULL;
  for (i = 0; i  s; i++)
if (use-cost_map[i].cand == cand)
  return use-cost_map + i;
  + else if (use-cost_map[i].cand == NULL)
  +   return NULL;

  return NULL;
}
 
 This looks good to me, even at this point.
 
   Jakub
 
 

-- 
Richard Biener rguent...@suse.de
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


Re: [PATCH] Speedup lookup_constraint for 2-letter constraints

2013-02-19 Thread Jakub Jelinek
On Tue, Feb 19, 2013 at 04:07:49PM +0100, Richard Biener wrote:
 
 This speeds up lookup_constraint by allowing the generic folding
 for n == 1 strncmp calls to trigger, handling two-letter constraints
 by two char comparisons instead of one and a call to strncmp (which
 ends up not being inlined because it's considered cold ...).
 
 Bootstrap  regtest pending on x86_64-unknown-linux-gnu.
 
 Ok?

Yes, thanks.

 2013-02-19  Richard Biener  rguent...@suse.de
 
   * genpreds.c (write_lookup_constraint): Do not compare first
   letter of the constraint again.

Jakub


Re: [PATCH] Speedup IVOPTs

2013-02-19 Thread Jakub Jelinek
On Tue, Feb 19, 2013 at 04:08:57PM +0100, Richard Biener wrote:
 Well, I used the lame variant to avoid a zero argument to ceil_log2 ...
 I'll use yours instead.
 
 Ok?

Yep.

Jakub


Speedup recognizing multi-letter constraints

2013-02-19 Thread Michael Matz
Hi,

from IRC:
[15:45:21] richi ick - lookup_constraint for multi-letter constraints 
is quite expensive ... strncmp is not expanded inline for some reason

Instead of fiddling with strncmp inlining, simply generate better code 
from the start for two character constraints:

  switch (str[0]) {
case 'Y':
  switch (str[1])
{
case 'i':
  return CONSTRAINT_Yi;
case 'm':
  return CONSTRAINT_Ym;

...


Ciao,
Michael.
-- 
* genpreds (write_lookup_constraint): Special case two-character
constraints to also expand to a switch.

Index: genpreds.c
===
--- genpreds.c  (revision 196053)
+++ genpreds.c  (working copy)
@@ -941,6 +941,22 @@ write_lookup_constraint (void)
   printf (case '%c':\n, i);
   if (c-namelen == 1)
printf (  return CONSTRAINT_%s;\n, c-c_name);
+  else if (c-namelen == 2)
+   {
+ puts (  switch (str[1])\n
+   {);
+ do
+   {
+ printf (case '%c':\n
+   return CONSTRAINT_%s;\n,
+ c-name[1], c-c_name);
+ c = c-next_this_letter;
+   }
+ while (c);
+ puts (default: break;\n
+   }\n
+ break;);
+   }
   else
{
  do


Re: RFC: [PATCH,ARM] Fix 56110

2013-02-19 Thread Richard Earnshaw

On 18/02/13 21:47, Tilman Sauerbeck wrote:

Hi,
adding the instruction pattern below fixes my testcase for PR 56110;
however I'm not sure if adding a new pattern is the correct way to go.

I duplicated the andsi3_compare0_scratch pattern, and lifted the
requirement that the 2nd operand be an arm_not_operand. I didn't copy
over the clobber pattern because I don't know what it does ;)

Comments? Can anyone put me in the right direction here? Or take my
humble attempt and massage it into the proper fix?
I can provide a dejagnu testcase if it helps.

No ChangeLog entry because I know this diff won't go anywhere in its
current incarnation.

Thanks,
Tilman

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 64888f9..e47f8f7 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -2212,6 +2212,19 @@
 (set_attr type  simple_alu_imm,simple_alu_imm,*)]
  )

+(define_insn *andsi3_compare0_scratch2
+  [(set (reg:CC_NOOV CC_REGNUM)
+   (compare:CC_NOOV
+(and:SI (match_operand:SI 0 s_register_operand r,r,r)
+(match_operand:SI 1 const_int_operand r,r,r))
+(const_int 0)))]
+  TARGET_32BIT
+  @
+   tst%?\\t%0, %1
+  [(set_attr conds set)
+   (set_attr type  simple_alu_imm,simple_alu_imm,*)]
+)
+
  (define_insn *zeroextractsi_compare0_scratch
[(set (reg:CC_NOOV CC_REGNUM)
(compare:CC_NOOV (zero_extract:SI





Sorry, this is not correct.  You've got a constraint that requires a 
const_int_operand, but then specified only a register.  This will force 
the compiler to reload the immediate operand into a register, just 
negating any saving you've made from getting rid of the compare 
instruction.  Then you've added three identical variants all using two 
registers of the same class.


However, the question you need to be asking is why the pattern 
immediately before the one you've added is not matching.  The compiler 
knows how to add clobbers, so I'm surprised that you're finding a new 
pattern to be necessary.


R.



Ping: [Patch,avr]: Add more devices take #2: 2/2

2013-02-19 Thread Georg-Johann Lay
CCing Richard in case this needs RM approval (I don't think so because 
the patch just changes ternary parts).


Ping #1 for:
http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00579.html


Georg-Johann Lay schrieb:

And here 2/2 with the device - arch mapping for gas.


Ok for trunk?

Johann


* config/avr/avr.h (device_to_arch): Rename to device_to_ld.
(avr_device_to_arch): Rename to avr_device_to_ld.
(avr_device_to_as): New prototype.
(EXTRA_SPEC_FUNCTIONS): Add device_to_as.
(ASM_SPEC): Use device_to_as to get -mmcu= and -mno-skip-bug=.
* config/avr/driver-avr.c (avr_device_to_as): New.
(avr_device_to_arch): Rename to avr_device_to_ld.





Ping: [Patch,avr]: Add more devices take #2: 1/2

2013-02-19 Thread Georg-Johann Lay
CCing Richard in case this needs RM approval (I don't think so because 
the patch just changes ternary parts).


Ping #1 for:
http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00577.html
http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00576.html

Georg-Johann Lay schrieb:

Better attach the patch...

Georg-Johann Lay wrote:

Let me drop this, I was thinking too complicated.

src/gas/config/tc-avr.c

reads:

static struct mcu_type_s mcu_types[] =
{
  {avr1,   AVR_ISA_AVR1,bfd_mach_avr1},
/* TODO: insruction set for avr2 architecture should be AVR_ISA_AVR2,
 but set to AVR_ISA_AVR25 for some following version
 of GCC (from 4.3) for backward compatibility.  */
  {avr2,   AVR_ISA_AVR25,   bfd_mach_avr2},
  {avr25,  AVR_ISA_AVR25,   bfd_mach_avr25},
/* TODO: insruction set for avr3 architecture should be AVR_ISA_AVR3,
 but set to AVR_ISA_AVR3_ALL for some following version
 of GCC (from 4.3) for backward compatibility.  */
  {avr3,   AVR_ISA_AVR3_ALL, bfd_mach_avr3},
  {avr31,  AVR_ISA_AVR31,   bfd_mach_avr31},
  {avr35,  AVR_ISA_AVR35,   bfd_mach_avr35},
  {avr4,   AVR_ISA_AVR4,bfd_mach_avr4},
/* TODO: insruction set for avr5 architecture should be AVR_ISA_AVR5,
 but set to AVR_ISA_AVR51 for some following version
 of GCC (from 4.3) for backward compatibility.  */
  {avr5,   AVR_ISA_AVR51,   bfd_mach_avr5},
  {avr51,  AVR_ISA_AVR51,   bfd_mach_avr51},
  {avr6,   AVR_ISA_AVR6,bfd_mach_avr6},

This means that cores liek avr31, avr35 etc. are supported by binutils and
there is no more the need for avr-gcc to do mappings like avr31 - avr3.

It appears that avr-gcc implemented these mappings to overcome missing binutils
support for specific cores, and in turn binutils arranged for that kludge...

This means that avr_arch_t need not to be extended to hold the arch mapping for
gas calls and the gas call can use the core name from avr_arch_t.


I broke the patch into two parts:

1/2:  New devices
2/2:  Map device to core to disentangle gcc/binutils interdependencies.

Okay for trunk and 4.7 backport?

Johann


* avr/avr-mcus.def (ata5272, ata5505, attiny1634, ata6285)
(ata6286, atmega8a, atmega48pa, ata5790, ata5790n, ata5795)
(atmega164pa, atmega165pa, atmega168pa, atmega16hva, atmega16hvb)
(atmega16hvbrevb, atmega16m1, atmega16u4, atmega26hvg, atmega32a)
(atmega32a, atmega3250pa, atmega3290pa, atmega32c1, atmega32m1)
(atmega32u4, atmega32u6, atmega64a, atmega6490a, atmega6490p)
(atmega64c1, atmega64m1, atmega64rfa2, atmega64rfr2, atmega32hvb)
(atmega32hvbrevb, atmega16hva2, atmega48hvf, at90pwm161)
(atmega128a, atmega1284, atmxt112sl, atmxt224, atmxt224e)
(atmxt336s, atxmega16a4u, atxmega16c4, atxmega32a4u, atxmega32c4)
(atxmega32e5, atxmega64a3u, atxmega64a4u, atxmega64b1, atxmega64b3)
(atxmega64c3, atxmega64d4, atxmega128a3u, atxmega128b1)
(atxmega128b3, atxmega128c3, atxmega128d4, atmxt540s, atmxt540sreva)
(atxmega192a3u, atxmega192c3, atxmega256a3u, atxmega256c3)
(atxmega384c3, atxmega384d3, atxmega128a4u): New AVR_MCU.
(avrxmega6): Increase max flash segments from 5 to 6.
* config/avr/t-multilib: Regenerate.
* config/avr/avr-tables.opt: Regenerate.
* doc/avr-mmcu.texi: Regenerate.




Re: [PATCH] Temporarily revert Steven's PCH changes for 4.8 (PR pch/54117)

2013-02-19 Thread David Edelsohn
On Thu, Feb 14, 2013 at 7:09 PM, Joel Brobecker brobec...@adacore.com wrote:
  AFAICT, for gcc+gas it should already work with binutils that include
  the AdaCore patch for DWARF support. But this has apparently not been
  tested with AIX ld, and there are AdaCore local patches pending.
  http://sourceware.org/ml/binutils/2011-04/msg00250.html
  http://www.sourceware.org/ml/gdb/2013-01/msg00030.html

 What is the status of merging Adacore's patches for DWARF support on AIX?

 Sorry, David. I have been meaning to work on that ever since
 we talked about it...

 I spent some time today isolating the patches. I am currently
 testing the patches we wrote for support on AIX 5.3. I then see
 a few more patches to extend support to AIX 7.1 - section alignment
 constraints, and stuff related to TLS.

 Just for anyone who is curious, this is what I am testing.
 It is missing the pieces for the other tools such as objdump,
 for instance. But I think those can be submitted separately.

Joel,

Thanks!  That's great progress on the Binutils side.

What is the status of patches for GCC to generate DWARF for AIX XCOFF
and do the AIX assembler and linker recognize, consume and process the
directives produced by GCC correctly?

Thanks, David


Re: [C++ Patch] PR 56373

2013-02-19 Thread Paolo Carlini

... in case, we may want to do something like the below too.

Thanks,
Paolo.

///
Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 196136)
+++ cp/cp-tree.h(working copy)
@@ -5834,6 +5834,7 @@ extern bool cast_valid_in_integral_constant_expres
 extern bool cxx_type_hash_eq   (const_tree, const_tree);
 
 extern void cxx_print_statistics   (void);
+extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t);
 
 /* in ptree.c */
 extern void cxx_print_xnode(FILE *, tree, int);
Index: cp/cvt.c
===
--- cp/cvt.c(revision 196136)
+++ cp/cvt.c(working copy)
@@ -203,11 +203,8 @@ cp_convert_to_pointer (tree type, tree expr, tsubs
 
   if (null_ptr_cst_p (expr))
 {
-  if ((complain  tf_warning)
-  c_inhibit_evaluation_warnings == 0
-  !NULLPTR_TYPE_P (TREE_TYPE (expr)))
-   warning_at (loc, OPT_Wzero_as_null_pointer_constant,
-   zero as null pointer constant);
+  if (complain  tf_warning)
+   maybe_warn_zero_as_null_pointer_constant (expr, loc);
 
   if (TYPE_PTRMEMFUNC_P (type))
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0,
@@ -783,7 +780,11 @@ ocp_convert (tree type, tree expr, int convtype, i
   return ignore_overflows (converted, e);
 }
   if (NULLPTR_TYPE_P (type)  e  null_ptr_cst_p (e))
-return nullptr_node;
+{
+  if (complain  tf_warning)
+   maybe_warn_zero_as_null_pointer_constant (e, loc);
+  return nullptr_node;
+}
   if (POINTER_TYPE_P (type) || TYPE_PTRMEM_P (type))
 return fold_if_not_in_template (cp_convert_to_pointer (type, e, complain));
   if (code == VECTOR_TYPE)
Index: cp/decl.c
===
--- cp/decl.c   (revision 196136)
+++ cp/decl.c   (working copy)
@@ -10861,15 +10861,10 @@ check_default_argument (tree decl, tree arg)
   --cp_unevaluated_operand;
 
   if (warn_zero_as_null_pointer_constant
-   c_inhibit_evaluation_warnings == 0
TYPE_PTR_OR_PTRMEM_P (decl_type)
null_ptr_cst_p (arg)
-   !NULLPTR_TYPE_P (TREE_TYPE (arg)))
-{
-  warning (OPT_Wzero_as_null_pointer_constant,
-  zero as null pointer constant);
-  return nullptr_node;
-}
+   maybe_warn_zero_as_null_pointer_constant (arg, input_location))
+return nullptr_node;
 
   /* [dcl.fct.default]
 
Index: cp/tree.c
===
--- cp/tree.c   (revision 196136)
+++ cp/tree.c   (working copy)
@@ -3939,6 +3939,21 @@ cp_tree_operand_length (const_tree t)
   return TREE_OPERAND_LENGTH (t);
 }
 }
+
+/* Implement -Wzero_as_null_pointer_constant.  Return true if the
+   conditions for the warning hold, false otherwise.  */
+bool
+maybe_warn_zero_as_null_pointer_constant (tree expr, location_t loc)
+{
+  if (c_inhibit_evaluation_warnings == 0
+   !NULLPTR_TYPE_P (TREE_TYPE (expr)))
+{
+  warning_at (loc, OPT_Wzero_as_null_pointer_constant,
+ zero as null pointer constant);
+  return true;
+}
+  return false;
+}
 
 #if defined ENABLE_TREE_CHECKING  (GCC_VERSION = 2007)
 /* Complain that some language-specific thing hanging off a tree
Index: cp/typeck.c
===
--- cp/typeck.c (revision 196136)
+++ cp/typeck.c (working copy)
@@ -4293,13 +4293,10 @@ cp_build_binary_op (location_t location,
   delta0,
   integer_one_node,
   complain);
- 
- if ((complain  tf_warning)
-  c_inhibit_evaluation_warnings == 0
-  !NULLPTR_TYPE_P (TREE_TYPE (op1)))
-   warning (OPT_Wzero_as_null_pointer_constant,
-zero as null pointer constant);
 
+ if (complain  tf_warning)
+   maybe_warn_zero_as_null_pointer_constant (op1, input_location);
+
  e2 = cp_build_binary_op (location,
   EQ_EXPR, e2, integer_zero_node,
   complain);
Index: testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-2.C
===
--- testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-2.C   (revision 0)
+++ testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-2.C   (working copy)
@@ -0,0 +1,14 @@
+// PR c++/56373
+// { dg-options -std=c++11 -Wzero-as-null-pointer-constant }
+
+struct shared_ptr
+{
+  shared_ptr(decltype(nullptr));
+};
+
+void f()
+{
+  shared_ptr a = 0;  // { dg-warning zero as null pointer }
+  shared_ptr b(0);   // { dg-warning zero as null pointer }
+  shared_ptr c{0};   // { dg-warning zero as null pointer }
+}

Re: [PATCH] Temporarily revert Steven's PCH changes for 4.8 (PR pch/54117)

2013-02-19 Thread Joel Brobecker
 Thanks!  That's great progress on the Binutils side.

You are very welcome.

 What is the status of patches for GCC to generate DWARF for AIX XCOFF
 and do the AIX assembler and linker recognize, consume and process the
 directives produced by GCC correctly?

I haven't looked at this part in details, but our recollection is that
it's a matter of configuring GCC with --with-gnu-as and --with-gnu-ld,
together with a small patch to make DWARF the default. AFAIK, the rest
should be working as expected.

-- 
Joel


[Patch, fortran] [0/5] PR54730 ICE: confused by type-like fonctions

2013-02-19 Thread Mikael Morin
Hello, this is a fix for cases like:

program main
  implicit none
  intrinsic :: real
  print *,(/ real(a = 1) /)
end

where `real(a = 1)' is initially parsed as a typespec, creating
a symbol for 'a' along the way.  The match fails, and then it is parsed
as a constructor element and accepted that way.  However, accepting the
statement implies accepting all the symbols created so far including 'a',
which is wrong and leads to the ICE.

To handle correctly this, we have to remove 'a' before proceeding with
the second parse attempt.  However, we can't use gfc_undo_symbols, as
it would also remove 'b' in the following case.
  b = (/ real(a = 1) /)
The fix proposed here implements a partial undo framework.  It packs the
changed_syms and tentative_tbp variables into a single 'gfc_change_set'
struct, and makes it possible to have more than one of those structs,
organised as a stack.  That change makes the current linked list
implementation using in-symbol 'tlink' pointer impractical as it prevents
the same symbol from being in more than one changeset.  I don't really know
whether that is a true limitation, but have decided to lift it anyway by
registering the symbols in a vector instead.  This makes backporting a bit
more difficult unfortunately; I will submit the (yet nonexisting) backport
patches separately.


The work is divided as follows:
1/5: Pack the changed_syms and tentative_tbp variables in a 'gfc_change_set'
 struct and move to the vec API.
2/5: New function restore_old_symbol, extracted from gfc_undo_symbols.
3/5: Fix restore_old_symbol
4/5: Add support for more than one 'gfc_change_set' variable.
5/5: Fix gfc_match_array_constructor using the just introduced functions.

The patches are attached to the follow-up mails; the full diff is also provided
here.

Bootstrap-asan'ed and regression tested on x86_64-unknown-linux-gnu.
OK for trunk?

diff --git a/Make-lang.in b/Make-lang.in
index 3584dd8..8c9e7ea 100644
--- a/Make-lang.in
+++ b/Make-lang.in
@@ -327,7 +327,7 @@ $(F95_PARSER_OBJS): fortran/gfortran.h fortran/libgfortran.h \
 		fortran/intrinsic.h fortran/match.h fortran/constructor.h \
 		fortran/parse.h fortran/arith.h fortran/target-memory.h \
 		$(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
-		dumpfile.h $(TREE_H) dumpfile.h $(GGC_H) \
+		dumpfile.h $(TREE_H) dumpfile.h $(GGC_H) $(VEC_H) \
 		$(FLAGS_H) $(DIAGNOSTIC_H) errors.h $(FUNCTION_H) \
 		fortran/iso-c-binding.def fortran/iso-fortran-env.def
 fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
diff --git a/array.c b/array.c
index 6787c05..b4a028b 100644
--- a/array.c
+++ b/array.c
@@ -1046,6 +1046,7 @@ match
 gfc_match_array_constructor (gfc_expr **result)
 {
   gfc_constructor_base head, new_cons;
+  gfc_change_set changed_syms;
   gfc_expr *expr;
   gfc_typespec ts;
   locus where;
@@ -1074,6 +1075,7 @@ gfc_match_array_constructor (gfc_expr **result)
 
   /* Try to match an optional type-spec ::  */
   gfc_clear_ts (ts);
+  gfc_new_checkpoint (changed_syms);
   if (gfc_match_decl_type_spec (ts, 0) == MATCH_YES)
 {
   seen_ts = (gfc_match ( ::) == MATCH_YES);
@@ -1082,19 +1084,28 @@ gfc_match_array_constructor (gfc_expr **result)
 	{
 	  if (gfc_notify_std (GFC_STD_F2003, Array constructor 
 			  including type specification at %C) == FAILURE)
-	goto cleanup;
+	{
+	  gfc_restore_last_checkpoint ();
+	  goto cleanup;
+	}
 
 	  if (ts.deferred)
 	{
 	  gfc_error (Type-spec at %L cannot contain a deferred 
 			 type parameter, where);
+	  gfc_restore_last_checkpoint ();
 	  goto cleanup;
 	}
 	}
 }
 
-  if (! seen_ts)
-gfc_current_locus = where;
+  if (seen_ts)
+gfc_drop_last_checkpoint ();
+  else
+{
+  gfc_restore_last_checkpoint ();
+  gfc_current_locus = where;
+}
 
   if (gfc_match (end_delim) == MATCH_YES)
 {
diff --git a/gfortran.h b/gfortran.h
index 3b4b473..7a18c6c 100644
--- a/gfortran.h
+++ b/gfortran.h
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 #include intl.h
 #include input.h
 #include splay-tree.h
+#include vec.h
 
 /* Major control parameters.  */
 
@@ -1275,6 +1276,15 @@ typedef struct gfc_symbol
 }
 gfc_symbol;
 
+
+struct gfc_change_set
+{
+  vecgfc_symbol * syms;
+  vecgfc_typebound_proc * tbps;
+  gfc_change_set *previous;
+};
+
+
 /* This structure is used to keep track of symbols in common blocks.  */
 typedef struct gfc_common_head
 {
@@ -2632,6 +2642,9 @@ int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **, bool);
 int gfc_get_ha_symbol (const char *, gfc_symbol **);
 int gfc_get_ha_sym_tree (const char *, gfc_symtree **);
 
+void gfc_new_checkpoint (gfc_change_set );
+void gfc_drop_last_checkpoint (void);
+void gfc_restore_last_checkpoint (void);
 void gfc_undo_symbols (void);
 void gfc_commit_symbols (void);
 void gfc_commit_symbol (gfc_symbol *);
diff --git a/symbol.c b/symbol.c
index acfebc5..f040431 100644
--- a/symbol.c
+++ b/symbol.c
@@ -97,21 +97,10 @@ gfc_namespace 

[Patch, fortran] [2/5] PR54730 ICE: confused by type-like fonctions: Extract restore_old_symbol.

2013-02-19 Thread Mikael Morin
The ChangeLog says it all.

2013-02-15  Mikael Morin  mik...@gcc.gnu.org

PR fortran/54730
* symbol.c (gfc_undo_symbols): Move code...
(restore_old_symbol): ... here as a new function.

diff --git a/symbol.c b/symbol.c
index 2c122d0..4f1752d 100644
--- a/symbol.c
+++ b/symbol.c
@@ -2878,6 +2878,64 @@ find_common_symtree (gfc_symtree *st, gfc_common_head *head)
 }
 
 
+/* Restore previous state of symbol.  Just copy simple stuff.  */
+  
+static void
+restore_old_symbol (gfc_symbol *p)
+{
+  gfc_symbol *old;
+
+  p-mark = 0;
+  old = p-old_symbol;
+
+  p-ts.type = old-ts.type;
+  p-ts.kind = old-ts.kind;
+
+  p-attr = old-attr;
+
+  if (p-value != old-value)
+{
+  gfc_free_expr (old-value);
+  p-value = NULL;
+}
+
+  if (p-as != old-as)
+{
+  if (p-as)
+	gfc_free_array_spec (p-as);
+  p-as = old-as;
+}
+
+  p-generic = old-generic;
+  p-component_access = old-component_access;
+
+  if (p-namelist != NULL  old-namelist == NULL)
+{
+  gfc_free_namelist (p-namelist);
+  p-namelist = NULL;
+}
+  else
+{
+  if (p-namelist_tail != old-namelist_tail)
+	{
+	  gfc_free_namelist (old-namelist_tail-next);
+	  old-namelist_tail-next = NULL;
+	}
+}
+
+  p-namelist_tail = old-namelist_tail;
+
+  if (p-formal != old-formal)
+{
+  gfc_free_formal_arglist (p-formal);
+  p-formal = old-formal;
+}
+
+  free (p-old_symbol);
+  p-old_symbol = NULL;
+}
+
+
 /* Undoes all the changes made to symbols in the current statement.
This subroutine is made simpler due to the fact that attributes are
never removed once added.  */
@@ -2885,7 +2943,7 @@ find_common_symtree (gfc_symtree *st, gfc_common_head *head)
 void
 gfc_undo_symbols (void)
 {
-  gfc_symbol *p, *old;
+  gfc_symbol *p;
   unsigned i;
 
   FOR_EACH_VEC_ELT (changes-syms, i, p)
@@ -2944,58 +3002,9 @@ gfc_undo_symbols (void)
 	gfc_delete_symtree (p-ns-sym_root, p-name);
 
 	  gfc_release_symbol (p);
-	  continue;
-	}
-
-  /* Restore previous state of symbol.  Just copy simple stuff.  */
-  p-mark = 0;
-  old = p-old_symbol;
-
-  p-ts.type = old-ts.type;
-  p-ts.kind = old-ts.kind;
-
-  p-attr = old-attr;
-
-  if (p-value != old-value)
-	{
-	  gfc_free_expr (old-value);
-	  p-value = NULL;
-	}
-
-  if (p-as != old-as)
-	{
-	  if (p-as)
-	gfc_free_array_spec (p-as);
-	  p-as = old-as;
-	}
-
-  p-generic = old-generic;
-  p-component_access = old-component_access;
-
-  if (p-namelist != NULL  old-namelist == NULL)
-	{
-	  gfc_free_namelist (p-namelist);
-	  p-namelist = NULL;
 	}
   else
-	{
-	  if (p-namelist_tail != old-namelist_tail)
-	{
-	  gfc_free_namelist (old-namelist_tail-next);
-	  old-namelist_tail-next = NULL;
-	}
-	}
-
-  p-namelist_tail = old-namelist_tail;
-
-  if (p-formal != old-formal)
-	{
-	  gfc_free_formal_arglist (p-formal);
-	  p-formal = old-formal;
-	}
-
-  free (p-old_symbol);
-  p-old_symbol = NULL;
+	restore_old_symbol (p);
 }
 
   changes-syms.truncate (0);


[Patch, fortran] [1/5] PR54730 ICE: confused by type-like fonctions: Move to the vec API.

2013-02-19 Thread Mikael Morin
This packs symbol.c's 'changed_syms' and 'tentative_tbp' variables into a new
'gfc_change_set' structure using the vec API.

2013-02-15  Mikael Morin  mik...@gcc.gnu.org

PR fortran/54730
* Make-lang.in (F95_PARSER_OBJS): Add dependency to vec.h
* gfortran.h: Include vec.h
(gfc_change_set): New struct.
* symbol.c (tentative_tbp): Remove struct.
(changed_syms, tentative_tbp_list): Remove variables.
(change_set_var, changes): New variables.
(save_symbol_data, gfc_get_sym_tree, gfc_undo_symbols,
gfc_commit_symbols, gfc_commit_symbol,
gfc_enforce_clean_symbol_state, gfc_get_typebound_proc):
Use changes instead of changed_syms and tentative_tbp_list.


diff --git a/Make-lang.in b/Make-lang.in
index 3584dd8..8c9e7ea 100644
--- a/Make-lang.in
+++ b/Make-lang.in
@@ -327,7 +327,7 @@ $(F95_PARSER_OBJS): fortran/gfortran.h fortran/libgfortran.h \
 		fortran/intrinsic.h fortran/match.h fortran/constructor.h \
 		fortran/parse.h fortran/arith.h fortran/target-memory.h \
 		$(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
-		dumpfile.h $(TREE_H) dumpfile.h $(GGC_H) \
+		dumpfile.h $(TREE_H) dumpfile.h $(GGC_H) $(VEC_H) \
 		$(FLAGS_H) $(DIAGNOSTIC_H) errors.h $(FUNCTION_H) \
 		fortran/iso-c-binding.def fortran/iso-fortran-env.def
 fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
diff --git a/gfortran.h b/gfortran.h
index 3b4b473..31b0d42 100644
--- a/gfortran.h
+++ b/gfortran.h
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 #include intl.h
 #include input.h
 #include splay-tree.h
+#include vec.h
 
 /* Major control parameters.  */
 
@@ -1275,6 +1276,14 @@ typedef struct gfc_symbol
 }
 gfc_symbol;
 
+
+struct gfc_change_set
+{
+  vecgfc_symbol * syms;
+  vecgfc_typebound_proc * tbps;
+};
+
+
 /* This structure is used to keep track of symbols in common blocks.  */
 typedef struct gfc_common_head
 {
diff --git a/symbol.c b/symbol.c
index acfebc5..2c122d0 100644
--- a/symbol.c
+++ b/symbol.c
@@ -97,21 +97,10 @@ gfc_namespace *gfc_global_ns_list;
 
 gfc_gsymbol *gfc_gsym_root = NULL;
 
-static gfc_symbol *changed_syms = NULL;
-
 gfc_dt_list *gfc_derived_types;
 
-
-/* List of tentative typebound-procedures.  */
-
-typedef struct tentative_tbp
-{
-  gfc_typebound_proc *proc;
-  struct tentative_tbp *next;
-}
-tentative_tbp;
-
-static tentative_tbp *tentative_tbp_list = NULL;
+static gfc_change_set change_set_var = { vNULL, vNULL };
+static gfc_change_set *changes = change_set_var;
 
 
 /*** IMPLICIT NONE and IMPLICIT statement handlers ***/
@@ -2720,8 +2709,7 @@ save_symbol_data (gfc_symbol *sym)
   sym-old_symbol = XCNEW (gfc_symbol);
   *(sym-old_symbol) = *sym;
 
-  sym-tlink = changed_syms;
-  changed_syms = sym;
+  changes-syms.safe_push (sym);
 }
 
 
@@ -2757,10 +2745,9 @@ gfc_get_sym_tree (const char *name, gfc_namespace *ns, gfc_symtree **result,
 
   /* Add to the list of tentative symbols.  */
   p-old_symbol = NULL;
-  p-tlink = changed_syms;
   p-mark = 1;
   p-gfc_new = 1;
-  changed_syms = p;
+  changes-syms.safe_push (p);
 
   st = gfc_new_symtree (ns-sym_root, name);
   st-n.sym = p;
@@ -2898,13 +2885,11 @@ find_common_symtree (gfc_symtree *st, gfc_common_head *head)
 void
 gfc_undo_symbols (void)
 {
-  gfc_symbol *p, *q, *old;
-  tentative_tbp *tbp, *tbq;
+  gfc_symbol *p, *old;
+  unsigned i;
 
-  for (p = changed_syms; p; p = q)
+  FOR_EACH_VEC_ELT (changes-syms, i, p)
 {
-  q = p-tlink;
-
   if (p-gfc_new)
 	{
 	  /* Symbol was new.  */
@@ -3011,18 +2996,10 @@ gfc_undo_symbols (void)
 
   free (p-old_symbol);
   p-old_symbol = NULL;
-  p-tlink = NULL;
 }
 
-  changed_syms = NULL;
-
-  for (tbp = tentative_tbp_list; tbp; tbp = tbq)
-{
-  tbq = tbp-next;
-  /* Procedure is already marked `error' by default.  */
-  free (tbp);
-}
-  tentative_tbp_list = NULL;
+  changes-syms.truncate (0);
+  changes-tbps.truncate (0);
 }
 
 
@@ -3059,26 +3036,21 @@ free_old_symbol (gfc_symbol *sym)
 void
 gfc_commit_symbols (void)
 {
-  gfc_symbol *p, *q;
-  tentative_tbp *tbp, *tbq;
+  gfc_symbol *p;
+  gfc_typebound_proc *tbp;
+  unsigned i;
 
-  for (p = changed_syms; p; p = q)
+  FOR_EACH_VEC_ELT (changes-syms, i, p)
 {
-  q = p-tlink;
-  p-tlink = NULL;
   p-mark = 0;
   p-gfc_new = 0;
   free_old_symbol (p);
 }
-  changed_syms = NULL;
+  changes-syms.truncate (0);
 
-  for (tbp = tentative_tbp_list; tbp; tbp = tbq)
-{
-  tbq = tbp-next;
-  tbp-proc-error = 0;
-  free (tbp);
-}
-  tentative_tbp_list = NULL;
+  FOR_EACH_VEC_ELT (changes-tbps, i, tbp)
+tbp-error = 0;
+  changes-tbps.truncate (0);
 }
 
 
@@ -3089,20 +3061,15 @@ void
 gfc_commit_symbol (gfc_symbol *sym)
 {
   gfc_symbol *p;
+  unsigned i;
 
-  if (changed_syms == sym)
-changed_syms = sym-tlink;
-  else
-{
-  for (p = changed_syms; p; p = p-tlink)
-if (p-tlink == sym)

[Patch, fortran] [3/5] PR54730 ICE: confused by type-like fonctions: Fix restore_old_symbol

2013-02-19 Thread Mikael Morin
This is a fix for what looks like a thinko.
The other patches don't depend on it, so it can well wait for 4.9 if
that is preferred.

2013-02-15  Mikael Morin  mik...@gcc.gnu.org

PR fortran/54730
* symbol.c (restore_old_symbol): Fix thinko.

diff --git a/symbol.c b/symbol.c
index 4f1752d..e4dbb41 100644
--- a/symbol.c
+++ b/symbol.c
@@ -2895,7 +2895,8 @@ restore_old_symbol (gfc_symbol *p)
 
   if (p-value != old-value)
 {
-  gfc_free_expr (old-value);
+  gcc_checking_assert (old-value == NULL);
+  gfc_free_expr (p-value);
   p-value = NULL;
 }
 


[Patch, fortran] [4/5] PR54730 ICE: confused by type-like fonctions: Support multiple change sets.

2013-02-19 Thread Mikael Morin
A new field 'previous' is added to the 'gfc_change_set' structure so that it can
be used as a stack.
New procedures are added to use the new partial undoing feature, namely:
gfc_new_checkpoint, gfc_drop_last_checkpoint and gfc_restore_last_checkpoint.
They will be used in the next patch.

2013-02-15  Mikael Morin  mik...@gcc.gnu.org

PR fortran/54730
* gfortran.h (struct gfc_change_set): New field 'previous'.
(gfc_new_checkpoint, gfc_drop_last_checkpoint, 
gfc_restore_last_checkpoint):
New prototypes.
* symbol.c (change_set_var): Update initialization.
(single_undo_checkpoint_p, gfc_new_checkpoint, free_change_set_data,
pop_change_set, gfc_drop_last_checkpiont, 
enforce_single_undo_checkpoint):
New functions.
(save_symbol_data): Handle multiple change sets.  Make sure old_symbol 
field's
previous value is not overwritten.  Clear gfc_new field.
(restore_old_symbol): Restore previous old_symbol field.
(gfc_restore_last_checkpoint): New function, using body renamed from
gfc_undo_symbols.  Restore the previous change set as current one.
(gfc_undo_symbols): New body.
(gfc_commit_symbols, gfc_commit_symbol, gfc_enforce_clean_symbol_state):
Call enforce_single_undo_checkpoint.
(gfc_symbol_done_2): Free change set data.

diff --git a/gfortran.h b/gfortran.h
index 31b0d42..7a18c6c 100644
--- a/gfortran.h
+++ b/gfortran.h
@@ -1281,6 +1281,7 @@ struct gfc_change_set
 {
   vecgfc_symbol * syms;
   vecgfc_typebound_proc * tbps;
+  gfc_change_set *previous;
 };
 
 
@@ -2641,6 +2642,9 @@ int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **, bool);
 int gfc_get_ha_symbol (const char *, gfc_symbol **);
 int gfc_get_ha_sym_tree (const char *, gfc_symtree **);
 
+void gfc_new_checkpoint (gfc_change_set );
+void gfc_drop_last_checkpoint (void);
+void gfc_restore_last_checkpoint (void);
 void gfc_undo_symbols (void);
 void gfc_commit_symbols (void);
 void gfc_commit_symbol (gfc_symbol *);
diff --git a/symbol.c b/symbol.c
index e4dbb41..f040431 100644
--- a/symbol.c
+++ b/symbol.c
@@ -99,7 +99,7 @@ gfc_gsymbol *gfc_gsym_root = NULL;
 
 gfc_dt_list *gfc_derived_types;
 
-static gfc_change_set change_set_var = { vNULL, vNULL };
+static gfc_change_set change_set_var = { vNULL, vNULL, NULL };
 static gfc_change_set *changes = change_set_var;
 
 
@@ -2697,17 +2697,49 @@ gfc_find_symbol (const char *name, gfc_namespace *ns, int parent_flag,
 }
 
 
+/* Tells whether there is only one set of changes in the stack.  */
+
+static bool
+single_undo_checkpoint_p (void)
+{
+  if (changes == change_set_var)
+{
+  gcc_assert (changes-previous == NULL);
+  return true;
+}
+  else
+{
+  gcc_assert (changes-previous != NULL);
+  return false;
+}
+}
+
 /* Save symbol with the information necessary to back it out.  */
 
 static void
 save_symbol_data (gfc_symbol *sym)
 {
+  gfc_symbol *s;
+  unsigned i;
 
-  if (sym-gfc_new || sym-old_symbol != NULL)
+  if (!single_undo_checkpoint_p ())
+{
+  /* If there is more than one change set, look for the symbol in the
+ current one.  If it is found there, we can reuse it.  */
+  FOR_EACH_VEC_ELT (changes-syms, i, s)
+	if (s == sym)
+	  {
+	gcc_assert (sym-gfc_new || sym-old_symbol != NULL);
+	return;
+	  }
+}
+  else if (sym-gfc_new || sym-old_symbol != NULL)
 return;
 
-  sym-old_symbol = XCNEW (gfc_symbol);
-  *(sym-old_symbol) = *sym;
+  s = XCNEW (gfc_symbol);
+  *s = *sym;
+  sym-old_symbol = s;
+  sym-gfc_new = 0;
 
   changes-syms.safe_push (sym);
 }
@@ -2878,6 +2910,22 @@ find_common_symtree (gfc_symtree *st, gfc_common_head *head)
 }
 
 
+/* Clear the given storage, and make it the current change set for registering
+   changed symbols.  Its contents are freed after a call to
+   gfc_restore_last_checkpoint or gfc_drop_last_checkpoint, but it is up to the
+   caller to free the storage itself.  It is usually a local variable, so there
+   is nothing to do anyway.  */
+
+void
+gfc_new_checkpoint (gfc_change_set chg_syms)
+{
+  chg_syms.syms = vNULL;
+  chg_syms.tbps = vNULL;
+  chg_syms.previous = changes;
+  changes = chg_syms;
+}
+
+
 /* Restore previous state of symbol.  Just copy simple stuff.  */
   
 static void
@@ -2932,17 +2980,88 @@ restore_old_symbol (gfc_symbol *p)
   p-formal = old-formal;
 }
 
-  free (p-old_symbol);
-  p-old_symbol = NULL;
+  p-old_symbol = old-old_symbol;
+  free (old);
+}
+
+
+/* Frees the internal data of a gfc_change_set structure.  Doesn't free the
+   structure itself.  */
+
+static void
+free_change_set_data (gfc_change_set cs)
+{
+  cs.syms.release ();
+  cs.tbps.release ();
+}
+
+
+/* Given a change set pointer, free its target's contents and update it with
+   the address of the previous change set.  Note that only the contents are
+   freed, not the target itself (the contents' container).  It is not a problem
+   as the latter will 

[Patch, fortran] [5/5] PR54730 ICE: confused by type-like fonctions: Fix gfc_match_array_constructor.

2013-02-19 Thread Mikael Morin
This is the fix for the PR.

2013-02-15  Mikael Morin  mik...@gcc.gnu.org

PR fortran/54730
* array.c (gfc_match_array_constructor): Set a checkpoint before 
matching 
a typespec.  Drop it on success, restore it otherwise.
diff --git a/array.c b/array.c
index 6787c05..b4a028b 100644
--- a/array.c
+++ b/array.c
@@ -1046,6 +1046,7 @@ match
 gfc_match_array_constructor (gfc_expr **result)
 {
   gfc_constructor_base head, new_cons;
+  gfc_change_set changed_syms;
   gfc_expr *expr;
   gfc_typespec ts;
   locus where;
@@ -1074,6 +1075,7 @@ gfc_match_array_constructor (gfc_expr **result)
 
   /* Try to match an optional type-spec ::  */
   gfc_clear_ts (ts);
+  gfc_new_checkpoint (changed_syms);
   if (gfc_match_decl_type_spec (ts, 0) == MATCH_YES)
 {
   seen_ts = (gfc_match ( ::) == MATCH_YES);
@@ -1082,19 +1084,28 @@ gfc_match_array_constructor (gfc_expr **result)
 	{
 	  if (gfc_notify_std (GFC_STD_F2003, Array constructor 
 			  including type specification at %C) == FAILURE)
-	goto cleanup;
+	{
+	  gfc_restore_last_checkpoint ();
+	  goto cleanup;
+	}
 
 	  if (ts.deferred)
 	{
 	  gfc_error (Type-spec at %L cannot contain a deferred 
 			 type parameter, where);
+	  gfc_restore_last_checkpoint ();
 	  goto cleanup;
 	}
 	}
 }
 
-  if (! seen_ts)
-gfc_current_locus = where;
+  if (seen_ts)
+gfc_drop_last_checkpoint ();
+  else
+{
+  gfc_restore_last_checkpoint ();
+  gfc_current_locus = where;
+}
 
   if (gfc_match (end_delim) == MATCH_YES)
 {
2013-02-15  Mikael Morin  mik...@gcc.gnu.org

PR fortran/54730
* gfortran.dg/array_constructor_42.f90: New test.
! { dg-do compile }
!
! PR fortran/54730
! A symbol 'a' was created while attempting to parse a typespec in the array
! constructor.  That (invalid) symbol was kept until translation stage
! where it was leading to an ICE.
!
! Original testcase from Paul Kapinos kapi...@rz.rwth-aachen.de
!

  subroutine s
implicit none
intrinsic :: real
real :: vec(1:2)
vec = (/ real(a = 1), 1. /)
  end subroutine s

  program main
implicit none
intrinsic :: real
print *,(/ real(a = 1) /)
  end


4.7 backports

2013-02-19 Thread Jakub Jelinek
Hi!

I've backported a bunch of patches from trunk to 4.7, after
bootstrapping/regtesting them on x86_64-linux and i686-linux.

Jakub
2013-02-19  Jakub Jelinek  ja...@redhat.com

Backported from mainline
2012-11-27  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/55110
* tree-vect-loop.c (vectorizable_reduction): Don't assert
that STMT_VINFO_RELATED_STMT of orig_stmt is stmt.

* gcc.dg/pr55110.c: New test.

--- gcc/tree-vect-loop.c(revision 193844)
+++ gcc/tree-vect-loop.c(revision 193845)
@@ -4624,7 +4624,6 @@ vectorizable_reduction (gimple stmt, gim
   if (orig_stmt)
 {
   orig_stmt_info = vinfo_for_stmt (orig_stmt);
-  gcc_assert (STMT_VINFO_RELATED_STMT (orig_stmt_info) == stmt);
   gcc_assert (STMT_VINFO_IN_PATTERN_P (orig_stmt_info));
   gcc_assert (!STMT_VINFO_IN_PATTERN_P (stmt_info));
 }
--- gcc/testsuite/gcc.dg/pr55110.c  (revision 0)
+++ gcc/testsuite/gcc.dg/pr55110.c  (revision 193845)
@@ -0,0 +1,13 @@
+/* PR tree-optimization/55110 */
+/* { dg-do compile } */
+/* { dg-options -O1 -ftree-vectorize } */
+
+int
+foo (int x)
+{
+  int a, b;
+  for (b = 0; b  8; b++)
+for (a = 0; a  2; a++)
+  x /= 3;
+  return x;
+}
2013-02-19  Jakub Jelinek  ja...@redhat.com

Backported from mainline
2013-02-06  Jakub Jelinek  ja...@redhat.com

PR middle-end/56217
* omp-low.c (use_pointer_for_field): Return false if
lower_send_shared_vars doesn't generate any copy-out code.

* g++.dg/gomp/pr56217.C: New test.

* testsuite/libgomp.c++/pr56217.C: New test.

--- gcc/omp-low.c   (revision 195795)
+++ gcc/omp-low.c   (revision 195796)
@@ -757,12 +757,20 @@ use_pointer_for_field (tree decl, omp_co
   if (TREE_ADDRESSABLE (decl))
return true;
 
+  /* lower_send_shared_vars only uses copy-in, but not copy-out
+for these.  */
+  if (TREE_READONLY (decl)
+ || ((TREE_CODE (decl) == RESULT_DECL
+  || TREE_CODE (decl) == PARM_DECL)
+  DECL_BY_REFERENCE (decl)))
+   return false;
+
   /* Disallow copy-in/out in nested parallel if
 decl is shared in outer parallel, otherwise
 each thread could store the shared variable
 in its own copy-in location, making the
 variable no longer really shared.  */
-  if (!TREE_READONLY (decl)  shared_ctx-is_nested)
+  if (shared_ctx-is_nested)
{
  omp_context *up;
 
@@ -785,11 +793,10 @@ use_pointer_for_field (tree decl, omp_co
}
}
 
-  /* For tasks avoid using copy-in/out, unless they are readonly
-(in which case just copy-in is used).  As tasks can be
+  /* For tasks avoid using copy-in/out.  As tasks can be
 deferred or executed in different thread, when GOMP_task
 returns, the task hasn't necessarily terminated.  */
-  if (!TREE_READONLY (decl)  is_task_ctx (shared_ctx))
+  if (is_task_ctx (shared_ctx))
{
  tree outer;
maybe_mark_addressable_and_ret:
--- gcc/testsuite/g++.dg/gomp/pr56217.C (revision 0)
+++ gcc/testsuite/g++.dg/gomp/pr56217.C (revision 195796)
@@ -0,0 +1,14 @@
+// PR middle-end/56217
+// { dg-do compile }
+// { dg-options -fopenmp }
+
+struct S { int *p; S (); S (S ); };
+
+S
+foo ()
+{
+  S s;
+  #pragma omp task shared (s)
+s.p = 0;
+  return s;
+}
--- libgomp/testsuite/libgomp.c++/pr56217.C (revision 0)
+++ libgomp/testsuite/libgomp.c++/pr56217.C (revision 195796)
@@ -0,0 +1,36 @@
+// PR middle-end/56217
+// { dg-do run }
+// { dg-options -std=c++0x }
+
+extern C void abort ();
+
+template typename T
+struct ptr {
+  T *p;
+  ptr () : p () {}
+  ptr (ptr ) = delete;
+  ptr (ptr o) : p(o) {}
+  operator T * () { return p; }
+};
+
+int a[6] = { 100, 101, 102, 103, 104, 105 };
+
+static ptrint
+f ()
+{
+  ptrint pt;
+  #pragma omp task shared (pt)
+pt.p = a + 2;
+  #pragma omp taskwait
+  return pt;
+}
+
+int
+main ()
+{
+  ptrint pt;
+  #pragma omp parallel
+  #pragma omp single
+  if (f () != a + 2 || *f () != 102)
+abort ();
+}
2013-02-19  Jakub Jelinek  ja...@redhat.com

Backported from mainline
2013-02-07  Jakub Jelinek  ja...@redhat.com

PR c++/56237
* decl.c (push_local_name): Look at DECL_DISCRIMINATOR (t)
only if DECL_DISCRIMINATOR_SET_P (t) rather than just
DECL_LANG_SPECIFIC (t).

* g++.dg/abi/mangle61.C: New test.

--- gcc/cp/decl.c   (revision 195857)
+++ gcc/cp/decl.c   (revision 195858)
@@ -920,7 +920,7 @@ push_local_name (tree decl)
  if (!DECL_LANG_SPECIFIC (decl))
retrofit_lang_decl (decl);
  DECL_LANG_SPECIFIC (decl)-u.base.u2sel = 1;
- if (DECL_LANG_SPECIFIC (t))
+ if (DECL_DISCRIMINATOR_SET_P (t))
DECL_DISCRIMINATOR (decl) = DECL_DISCRIMINATOR (t) + 1;
  else
DECL_DISCRIMINATOR (decl) = 1;
--- 

Re: [4.7, testsuite] Clear hwcap_2 with Sun ld

2013-02-19 Thread Janis Johnson
On 02/19/2013 05:25 AM, Rainer Orth wrote:
 I'd like to backport
 
   [testsuite] Clear hwcap_2 with Sun ld
 http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01246.html
 
 2012-06-19  Rainer Orth  r...@cebitec.uni-bielefeld.de
 
   * gcc.target/i386/clearcapv2.map: New file.
   * gcc.target/i386/i386.exp: Try it first before clearcap.map.
 
 to the 4.7 branch since recently all avx2 tests started to FAIL there on
 Solaris 10 and 11/x86 with Sun as.  It applies cleanly as is,
 bootstrapped without regressions on i386-pc-solaris2.10 and
 x86_64-unknown-linux-gnu.
 
 Ok for 4.7 branch?
 
   Rainer 
 

OK.

Janis


Re: FW: [PATCH] [MIPS] microMIPS gcc support

2013-02-19 Thread Richard Sandiford
Thanks, this is looking much better now.

Moore, Catherine catherine_mo...@mentor.com writes:
 I'd also like to support -mno-jals for backward compatibility.  Are you
 okay with that?  If so, I'll submit as a separate patch.

Hmm, to be honest, I'd rather you kept it local to the Mentor toolchain.
The way the patch is written, we (rightly) use JALS even with
-minterlink-compressed in cases where we can prove that the call
is to another microMIPS function, so calling -mno-jals an alias of
-minterlink-compressed would be a bit confusing.

-mno-jals sounds like it ought to disable JALS in all situations,
which would need special code to handle.  I think doing that would be
extra baggage with little benefit.

 Index: gcc.target/mips/umips-constraints-1.c
 ===
 --- gcc.target/mips/umips-constraints-1.c (revision 0)
 +++ gcc.target/mips/umips-constraints-1.c (revision 0)
 @@ -0,0 +1,14 @@
 +/* { dg-options (-mmicromips) } */
 +/* { dg-skip-if code quality test { *-*-* } { -O0 } {  } } */
 +
 +MICROMIPS void
 +foo (int *x)
 +{
 +  asm volatile (insn1\t%a0 :: ZD (x[0]));
 +  asm volatile (insn2\t%a0 :: ZD (x[511]));
 +  asm volatile (insn3\t%a0 :: ZD (x[512]));
 +}
 +
 +/* { dg-final { scan-assembler \tinsn1\t0\\( } } */
 +/* { dg-final { scan-assembler \tinsn2\t2044\\( } } */
 +/* { dg-final { scan-assembler \tinsn3\t2048\\( } } */

But the insn3 is wrong, isn't it?  I suggested scan-assembler-not for
that one because I thought it had to be a 12-bit signed offset on
microMIPS.  The patch has:

(define_address_constraint ZD
  When compiling microMIPS code, this constraint matches an address operand
   that is formed from a base register and a 12-bit offset.  These operands
   can be used for microMIPS instructions such as @code{prefetch}.  When
   not compiling for microMIPS code, @code{ZD} is equivalent to @code{p}.
   (ior (and (match_test TARGET_MICROMIPS)
 (match_test umips_12bit_offset_address_p (op, mode)))
(match_test mips_address_insns (op, mode, false

but it looks like it ought to be:

   (if_then_else (match_test TARGET_MICROMIPS)
 (match_test umips_12bit_offset_address_p (op, mode))
 (match_test mips_address_insns (op, mode, false)))

Same for ZC.

 @@ -1246,6 +1247,10 @@ proc mips-dg-options { args } {
   append extra_tool_flags  -DMIPS16=__attribute__((mips16))
  }
  
 +if { [mips_have_test_option_p options -mmicromips] } {
 + append extra_tool_flags  -DMICROMIPS=__attribute__((micromips))
 +}
 +
  # Use our version of gcc-dg-test for this test.
  if { ![string equal [info procs mips-gcc-dg-test] ] } {
   rename gcc-dg-test mips-old-gcc-dg-test
 @@ -1275,6 +1280,6 @@ proc mips-gcc-dg-test { prog do_what extra_tool_fl
  dg-init
  mips-dg-init
  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \
 --DNOMIPS16=__attribute__((nomips16))
 +-DNOMIPS16=__attribute__((nomips16)) 
 -DNOMICROMIPS=__attribute__((nomicromips)) 
 -DNOCOMPRESSION=__attribute__((nocompression)) 
 -DMICROMIPS=__attribute__((micromips))
  mips-dg-finish
  dg-finish

Please drop the -DMICROMIPS in the second hunk.  The first hunk is the
right way to add it.  The idea is that we want a compilation failure if
the test uses MICROMIPS but forgets to add:

/* { dg-options (-mmicromips) } */

The -DNOMICROMIPS and -DNOCOMPRESSION in the second hunk are fine though.

 +/* { dg-options (-mmicromips) } */
 +/* { dg-skip-if code quality test { *-*-* } { -O0 -O1 } {  } } */

Sorry, only just realised you were skipping -O1.  Please add a comment saying
why it fails at -O1 or (preferably) add whichever other option is needed for
the test to pass at -O1.  I assume it's -fpeephole2 in this case.

Same for all tests with this skip.

 Index: gcc.target/mips/umips-lwp-swp-2.c
 ===
 --- gcc.target/mips/umips-lwp-swp-2.c (revision 0)
 +++ gcc.target/mips/umips-lwp-swp-2.c (revision 0)
 @@ -0,0 +1,19 @@
 +/* { dg-options -mgp32 (-mmicromips) } */
 +/* { dg-skip-if code quality test { *-*-* } { -O0 -O1 -Os } {  } } 
 */
 +int a[2];
 +
 +MICROMIPS f (b)
 +{
 +  unsigned int i;
 +  int *p;
 +  for (p = a[b], i = b; --i  ~0; )
 +*--p = i * 3 + (int)a;
 +
 +}
 +
 +MICROMIPS main ()
 +{
 +  a[0] = a[1] = 0;
 +  f (2);
 +}
 +/* { dg-final { scan-assembler \tswp\t\\\$3,0\\(\\\$3\\) } }*/

Is this a test of the swap_p case?  Thanks if so, but could you add a
comment saying where the SWP gets generated, and why the test needs
to be skipped at -O1 and -Os?

 Index: gcc.target/mips/umips-lwp-swp-volatile.c
 ===
 --- gcc.target/mips/umips-lwp-swp-volatile.c  (revision 0)
 +++ gcc.target/mips/umips-lwp-swp-volatile.c  (revision 0)
 @@ -0,0 +1,41 @@
 +/* { dg-do compile } */
 +
 +/* This test ensures that we do not generate microMIPS SWP or LWP
 +   instructions 

Re: [PATCH] Temporarily revert Steven's PCH changes for 4.8 (PR pch/54117)

2013-02-19 Thread David Edelsohn
On Tue, Feb 19, 2013 at 11:11 AM, Joel Brobecker brobec...@adacore.com wrote:

 I haven't looked at this part in details, but our recollection is that
 it's a matter of configuring GCC with --with-gnu-as and --with-gnu-ld,
 together with a small patch to make DWARF the default. AFAIK, the rest
 should be working as expected.

A start is the patch that I sent you or Tristan a long time ago, but
simply enabling DWARF is not enough because XCOFF only supports some
of the sections and uses slightly different pseudo-ops.

* AIX 7.1 supports DWARF3 debugging, but XCOFF remains the default.  */
#define DWARF2_DEBUGGING_INFO 1
#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
#define DEBUG_INFO_SECTION  \t.dwsect 0x1,Ldebug_info..0
#define DEBUG_ABBREV_SECTION \t.dwsect 0x6,Ldebug_abbrev..0
#define DEBUG_ARANGES_SECTION \t.dwsect 0x5
#define DEBUG_LINE_SECTION \t.dwsect 0x2,Ldebug_line..0
#define DEBUG_PUBNAMES_SECTION \t.dwsect 0x3
#define DEBUG_PUBTYPES_SECTION \t.dwsect 0x4
#define DEBUG_STR_SECTION \t.dwsect 0x7
#define DEBUG_RANGES_SECTION \t.dwsect 0x8,Ldebug_ranges..0

Thanks, David


Re: [PATCH] Temporarily revert Steven's PCH changes for 4.8 (PR pch/54117)

2013-02-19 Thread Paolo Bonzini
Il 13/02/2013 22:12, Steven Bosscher ha scritto:
 On Wed, Feb 13, 2013 at 4:54 PM, Jakub Jelinek wrote:
 Hi!

 As agreed on in the PR, here is the revertion of 3 commits, so that
 PCH works again for -gstabs and other debug info formats for 4.8
 release.  For 4.9 we should either remove support for anything non-DWARF, or
 hope somebody steps up and fixes dbxout.c etc. not to emit debug info right
 away, but queue it till end of compilation.
 
 
 Hello,
 
 I'd still like to propose deprecating all stabs support for GCC 4.8 and
 remove it for GCC 4.9 (i.e. dbxout, sdbout, xcoffout).
 
 It's not a very useful debug info format, after all.  The only
 argument against DWARF, that it is so much larger than stabs,
 is something I haven't been able to reproduce (see
 http://sourceware.org/ml/binutils/2013-01/msg00221.html and
 http://sourceware.org/ml/binutils/2013-01/msg00239.html).
 DWARF compression via dwz, and debug-fission will improve things
 even further.
 
 An important question is of course: Who still *needs* stabs? If there
 are important platforms that need stabs support to continue to work,
 then deprecating is probably not a realistic option yet...

stabs are needed to use VTune on Windows.

Paolo

 The list of platforms that are IMHO blockers rights now, with possible
 solutions for GCC 4.9, are:
 
 * hppa2.0w-hp-hpux11.11 - no solution immediately available
 * powerpc-ibm-aix* - only support AIX7 and later
- deprecate AIX6 and older in GCC 4.8
 * ix86-*-openbsd2.*, ix86-*openbsd3.[0123] - OpenBSD 3.3 was released
   in May 2003 - deprecate for GCC 4.8
 * m68k*-*-openbsd - port has seen no active maintenance, and has no
   test results posted, ever - deprecate for GCC 4.8
 * pdp11-*-* - toy port - default to DEBUG_NONE
 * ix86-*-interix* - no solution immediately available, and no-one
   listed in MAINTAINERS to ask for help, so maybe Doug can say
   something about this one?
 
 Platforms that support DWARF2+ but currently have another default
 preferred debug info type, would be changed to default to DWARF2+.
 
 So older AIX and 32-bits HPUX are the only real problem cases.
 
 Ciao!
 Steven
 
 
 
 
 
 
 
 All GCC 4.8 primary platforms support DWARF2+, and AFAICT they all have
 it as their PREFERRED_DEBUGGING_TYPE (including freebsd):
 
 * arm-linux-gnueabi
 * i386-unknown-freebsd
 * i686-pc-linux-gnu
 * mipsisa64-elf
 * powerpc64-unknown-linux-gnu
 * sparc-sun-solaris2.10
 * x86_64-unknown-linux-gnu
 
 Most of the above also include other debug info types by default, but
 DWARF2+ is the default.
 
 For the secondary platforms list things are not so simple. Some of them
 have a non-DWARF PREFERRED_DEBUGGING_TYPE by default, and some only
 conditionally (old configurations):
 
 * hppa2.0w-hp-hpux11.11 - DBX_DEBUGGING_INFO
 For 32-bits only, but that's the most common subtarget.
 According to Dave, it should be possible to add DRAWF2+ support:
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54117#c14
 Perhaps Dave can explain what would have to be done to move this
 platform to DWARF2...?
 
 * powerpc-ibm-aix7.1.0.0 - XCOFF_DEBUGGING_INFO
 I think this is for historical reasons. AIX7 has DWARF support,
 but it looks like that's not yet implemented in GCC.
 Older AIX do not support DWARF, AFAICT (David E.?).
 
 * i686-apple-darwin - DBX_DEBUGGING_INFO
 MacOSX10.4, 32-bits (darwin8).
 All 64bits and darwin9+ prefer DWARF2.
 
 * i686-pc-cygwin, i686-mingw32 - DBX_DEBUGGING_INFO
 With binutils 2.16 and later, DWARF2_DEBUGGING_INFO is the default:
 http://sourceware.org/ml/binutils/2004-04/msg00327.html
 http://gcc.gnu.org/ml/gcc-patches/2004-04/msg01885.html
 http://cygwin.com/ml/cygwin/2006-06/msg00865.html
 
 * s390x-linux-gnu - DWARF2_DEBUGGING_INFO
 
 
 Other platforms that support DWARF2+ and have it as the preferred type:
 * *-*-elf* via:
   config/elfos.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
   This is practically all ELF platforms.  A few target headers redefine
   PREFERRED_DEBUGGING_TYPE, usually to DWARF2_DEBUG again...
   Exceptions are microblaze*-*-rtems*, microblaze*-*-elf*
 * tic6x-*-*, ix86-*-nto-qnx* via:
   config/tm-dwarf2.h:#define  PREFERRED_DEBUGGING_TYPE  DWARF2_DEBUG
 * *-*-vxworks* via:
   config/vx-common.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 * alpha*-dec-*vms* via:
   config/alpha/vms.h:#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
 * hppa*64*-*-hpux11* via:
   config/pa/pa64-hpux.h:#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
 
 Other platforms that support DWARF2+ but prefer another debug info type
 by default:
 * rx-*-elf* if using TARGET_AS100_SYNTAX, via:
   config/rx/rx.h:#define PREFERRED_DEBUGGING_TYPE (TARGET_AS100_SYNTAX \
   config/rx/rx.h:? DBX_DEBUG : DWARF2_DEBUG)
 * avr-*-* includes elfos.h but changes preffered debug info type via:
   config/avr/elf.h:#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
 * powerpc-*-lynxos*, ix86-*-lynxos* include elfos.h 

linaro/gcc-4_8-branch created and documented

2013-02-19 Thread Matthew Gretton-Dann

All,

I have just created a distribution branch: 'linaro/gcc-4_8-branch'.  I have 
committed the attached patch to the wwwdocs CVS repository to document this 
branch (and future Linaro branches).


The branch will track the equivalent FSF release branch (once created) and 
also accept backports of patches accepted for trunk which are of interest to 
the ARM and AArch64 backends.  Anyone from Linaro with write access to the 
GCC Subversion repository can commit and approve patches for this branch.


The branch has been created early as there are some Stage 1 pending patches 
which I want to backport early to this branch.


Thanks,

Matt

--
Matthew Gretton-Dann
Toolchain Working Group, Linaro
? htdocs/.svn.html.swp
? htdocs/svn.html~
Index: htdocs/svn.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/svn.html,v
retrieving revision 1.179
diff -u -p -r1.179 svn.html
--- htdocs/svn.html 12 Feb 2013 15:53:34 -  1.179
+++ htdocs/svn.html 19 Feb 2013 21:20:11 -
@@ -621,6 +621,11 @@ be prefixed with the initials of the dis
   The branch is maintained by Michael Meissner,
   a 
href=mailto:meiss...@linux.vnet.ibm.com;meiss...@linux.vnet.ibm.com/a./dd
 
+  dtlinaro/gcc-emx_y/em-branch/dt
+  ddLinaro compilers based on GCC emx.y/em releases.  These branches
+  only accept backports of patches which have been accepted to trunk.  This
+  family of branches is maintained by personnel from Linaro./dd
+
   dtredhat/gcc-3_2-branch/dt
   ddRed Hat GNU/Linux compilers based on GCC 3.2.x./dd
 


[committed] Fix libquadmath strtoflt128 at -O0 (PR libquadmath/56379)

2013-02-19 Thread Jakub Jelinek
Hi!

I've committed to trunk what has been accepted earlier today for glibc
strtod_l.c, a fix for -O0 compilation of the file.

Bootstrapped/regtested on x86_64-linux and i686-linux.

2013-02-19  Jakub Jelinek  ja...@redhat.com

PR libquadmath/56379
* strtod/strtod_l.c (mpn_lshift_1): Rewritten as function-like
macro.

--- libquadmath/strtod/strtod_l.c
+++ libquadmath/strtod/strtod_l.c
@@ -444,28 +444,30 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t 
*n, mp_size_t *nsize,
 /* Shift {PTR, SIZE} COUNT bits to the left, and fill the vacated bits
with the COUNT most significant bits of LIMB.
 
-   Tege doesn't like this function so I have to write it here myself. :)
+   Implemented as a macro, so that __builtin_constant_p works even at -O0.
+
+   Tege doesn't like this macro so I have to write it here myself. :)
--drepper */
-static inline void
-__attribute ((always_inline))
-mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count,
- mp_limb_t limb)
-{
-  if (__builtin_constant_p (count)  count == BITS_PER_MP_LIMB)
-{
-  /* Optimize the case of shifting by exactly a word:
-just copy words, with no actual bit-shifting.  */
-  mp_size_t i;
-  for (i = size - 1; i  0; --i)
-   ptr[i] = ptr[i - 1];
-  ptr[0] = limb;
-}
-  else
-{
-  (void) mpn_lshift (ptr, ptr, size, count);
-  ptr[0] |= limb  (BITS_PER_MP_LIMB - count);
-}
-}
+#define mpn_lshift_1(ptr, size, count, limb) \
+  do   \
+{  \
+  mp_limb_t *__ptr = (ptr);
\
+  if (__builtin_constant_p (count)  count == BITS_PER_MP_LIMB)   \
+   {   \
+ mp_size_t i;  \
+ for (i = (size) - 1; i  0; --i)  \
+   __ptr[i] = __ptr[i - 1];\
+ __ptr[0] = (limb);\
+   }   \
+  else \
+   {   \
+ /* We assume count  0  count  BITS_PER_MP_LIMB here.  */  \
+ unsigned int __count = (count);   \
+ (void) mpn_lshift (__ptr, __ptr, size, __count);  \
+ __ptr[0] |= (limb)  (BITS_PER_MP_LIMB - __count);   \
+   }   \
+}  \
+  while (0)
 
 
 #define INTERNAL(x) INTERNAL1(x)

Jakub


Re: RFC: [PATCH,ARM] Fix 56110

2013-02-19 Thread Tilman Sauerbeck
Richard Earnshaw [2013-02-19 15:12]:

Hi,
thanks for your reply.

 [...]
 However, the question you need to be asking is why the pattern immediately
 before the one you've added is not matching.  The compiler knows how to add
 clobbers, so I'm surprised that you're finding a new pattern to be
 necessary.

From the andsi3_compare0_scratch pattern definition:
 [(set (reg:CC_NOOV CC_REGNUM)
(compare:CC_NOOV
 (and:SI (match_operand:SI 0 s_register_operand r,r,r)
 (match_operand:SI 1 arm_not_operand I,K,r))
   
 (const_int 0)))

So the insn pattern only matches if the 2nd operand is an
arm_not_operand.  In my test program, the 2nd operand is 0x8080
(const_int 32896 [0x8080]) which cannot be used as an immediate operand
(const_ok_for_arm doesn't match 0x8080 nor ~0x8080).

I don't see _why_ we would want the pattern to only be applied
to registers or immediates though.

Actually the diff below makes it so that gcc recognizes the pattern even if
0x8080 is used as the 2nd operand. It looks like using
reg_or_int_operand should be the correct thing to do, since we do have
the I/K constraints in the pattern...

However it breaks the case where the 2nd operand is a const_int that
*can* be used as an immediate (eg 0x80), and ends up generating the
AND/CMP combination.

For the latter case, RTL looks like this before the combiner pass:

 (insn 7 4 8 2 (set (reg:SI 114 [ D.4127 ])
 (and:SI (reg/v:SI 113 [ m ])
 (const_int 128 [0x80]))) /home/user/g.c:3 76 {*arm_andsi3_insn}
  (expr_list:REG_DEAD (reg/v:SI 113 [ m ])
 (nil)))
 (insn 8 7 9 2 (set (reg:CC 100 cc)
 (compare:CC (reg:SI 114 [ D.4127 ])
 (const_int 0 [0]))) /home/user/g.c:3 217 {*arm_cmpsi_insn}
  (expr_list:REG_DEAD (reg:SI 114 [ D.4127 ])
 (nil)))
 
In the combiner pass:
 
 Successfully matched this instruction:
 (set (reg:SI 114 [ D.4127 ])
 (and:SI (reg:SI 1 r1 [ m ])
 (const_int 128 [0x80])))
 [...]

 Failed to match this instruction:
 (set (reg:CC_NOOV 100 cc)
 (compare:CC_NOOV (zero_extract:SI (reg:SI 1 r1 [ m ])
 (const_int 1 [0x1])
 (const_int 7 [0x7]))
 (const_int 0 [0])))

I don't get why relaxing the restrictions for the
andsi3_compare0_scratch pattern results in a mismatch for the
zeroextractsi_compare0_scratch one.

Any ideas?

Thanks,
Tilman


diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 64888f9..3724a8d 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -2200,7 +2200,7 @@
   [(set (reg:CC_NOOV CC_REGNUM)
(compare:CC_NOOV
 (and:SI (match_operand:SI 0 s_register_operand r,r,r)
-(match_operand:SI 1 arm_not_operand I,K,r))
+(match_operand:SI 1 reg_or_int_operand I,K,r))
 (const_int 0)))
(clobber (match_scratch:SI 2 =X,r,X))]
   TARGET_32BIT


Re: FW: [PATCH] [MIPS] microMIPS gcc support

2013-02-19 Thread Maciej W. Rozycki
On Tue, 19 Feb 2013, Richard Sandiford wrote:

  Index: gcc.target/mips/umips-lwp-swp-2.c
  ===
  --- gcc.target/mips/umips-lwp-swp-2.c   (revision 0)
  +++ gcc.target/mips/umips-lwp-swp-2.c   (revision 0)
  @@ -0,0 +1,19 @@
  +/* { dg-options -mgp32 (-mmicromips) } */
  +/* { dg-skip-if code quality test { *-*-* } { -O0 -O1 -Os } {  } 
  } */
  +int a[2];
  +
  +MICROMIPS f (b)
  +{
  +  unsigned int i;
  +  int *p;
  +  for (p = a[b], i = b; --i  ~0; )
  +*--p = i * 3 + (int)a;
  +
  +}
  +
  +MICROMIPS main ()
  +{
  +  a[0] = a[1] = 0;
  +  f (2);
  +}
  +/* { dg-final { scan-assembler \tswp\t\\\$3,0\\(\\\$3\\) } }*/
 
 Is this a test of the swap_p case?  Thanks if so, but could you add a
 comment saying where the SWP gets generated, and why the test needs
 to be skipped at -O1 and -Os?

 TBH, it is -Os where size really matters, so IMHO it is the -Os 
optimisation level where LWP/SWP should be used where possible in the 
first place, even if it hurts performance for some reason (and where e.g. 
-O2 might decide to go for individual accesses instead).

 Not to be meant as a show-stopper for this initial implementation, but if 
the optimisation does not work for LWP/SWP at -Os for some reason, then I 
think there's something going seriously wrong somewhere (instruction 
lengths set wrong for example?) which looks to me worth investigating and 
acting upon accordingly as the next step.

 I saw cases with instruction lengths set too high with our trunk just 
about yesterday and MIPS16 code, e.g.:

.file   1 foo.c
.section .mdebug.abi32
.previous
.gnu_attribute 4, 1
.abicalls
.option pic0
.text
.align  2
.globl  foo
.setmips16
.entfoo
.type   foo, @function
foo:
.frame  $sp,32,$31  # vars= 0, regs= 1/0, args= 16, gp= 8
.mask   0x8000,-4
.fmask  0x,0
save32,$31   # 11   *mips16e_save_restore   [length = 4]
.setnoreorder
.setnomacro
jal bar  # 22   call_split/2[length = 8]
li  $4,0 # 5*movsi_mips16/4 [length = 4]
.setmacro
.setreorder

restore 32,$31   # 18   *mips16e_save_restore   [length = 4]
j   $31  # 20   simple_return_internal  [length = 2]
.endfoo
.size   foo, .-foo

-- it looks all wrong to me except for the final J.  Of course I realise 
where it originally comes from, but I think it would be good if the 
initial pessimistic estimates were actually adjusted as more is known 
about actual insns produced.

 I wonder if we may have similar issues with microMIPS instruction size 
calculation triggering here.

  Maciej


[PATCH] Fix ccp (PR tree-optimization/56396)

2013-02-19 Thread Jakub Jelinek
Hi!

On the following patch gcc ICEs because malloc memory is corrupted.
The problem is that const_val array is allocated at the start of the pass,
but during the execution of ccp some new SSA_NAMEs are created
(update_call_from_tree if I remember well).

The following patch fixes that by making const_val a vector instead of
array, and growing it when needed.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-02-19  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/56396
* tree-ssa-ccp.c (const_val): Change into vector.
(get_value): Use !const_val.exists () instead of const_val == NULL,
call safe_grow_cleared method if SSA_NAME_VERSION (var) is above
last vector element.
(set_value_varying): Call safe_grow_cleared method if
SSA_NAME_VERSION (var) is above last vector element.
(set_lattice_value): Likewise.
(ccp_initialize): Call const_val.create (num_ssa_names) instead
of XCNEWVEC.
(do_dbg_cnt): Call safe_grow_cleared method if num_ssa_names
is above vector length.
(ccp_finalize): Call const_val.release ().

* gcc.dg/pr56396.c: New test.

--- gcc/tree-ssa-ccp.c.jj   2013-01-11 09:02:48.0 +0100
+++ gcc/tree-ssa-ccp.c  2013-02-19 20:04:21.194681227 +0100
@@ -155,13 +155,13 @@ struct prop_value_d {
 
 typedef struct prop_value_d prop_value_t;
 
-/* Array of propagated constant values.  After propagation,
+/* Vector of propagated constant values.  After propagation,
CONST_VAL[I].VALUE holds the constant value for SSA_NAME(I).  If
the constant is held in an SSA name representing a memory store
(i.e., a VDEF), CONST_VAL[I].MEM_REF will contain the actual
memory reference used to store (i.e., the LHS of the assignment
doing the store).  */
-static prop_value_t *const_val;
+static vecprop_value_t const_val;
 
 static void canonicalize_float_value (prop_value_t *);
 static bool ccp_fold_stmt (gimple_stmt_iterator *);
@@ -295,9 +295,12 @@ get_value (tree var)
 {
   prop_value_t *val;
 
-  if (const_val == NULL)
+  if (!const_val.exists ())
 return NULL;
 
+  if (SSA_NAME_VERSION (var) = const_val.length ())
+const_val.safe_grow_cleared (SSA_NAME_VERSION (var) + 32);
+
   val = const_val[SSA_NAME_VERSION (var)];
   if (val-lattice_val == UNINITIALIZED)
 *val = get_default_value (var);
@@ -333,8 +336,12 @@ get_constant_value (tree var)
 static inline void
 set_value_varying (tree var)
 {
-  prop_value_t *val = const_val[SSA_NAME_VERSION (var)];
+  prop_value_t *val;
 
+  if (SSA_NAME_VERSION (var) = const_val.length ())
+const_val.safe_grow_cleared (SSA_NAME_VERSION (var) + 32);
+
+  val = const_val[SSA_NAME_VERSION (var)];
   val-lattice_val = VARYING;
   val-value = NULL_TREE;
   val-mask = double_int_minus_one;
@@ -428,7 +435,12 @@ static bool
 set_lattice_value (tree var, prop_value_t new_val)
 {
   /* We can deal with old UNINITIALIZED values just fine here.  */
-  prop_value_t *old_val = const_val[SSA_NAME_VERSION (var)];
+  prop_value_t *old_val;
+
+  if (SSA_NAME_VERSION (var) = const_val.length ())
+const_val.safe_grow_cleared (SSA_NAME_VERSION (var) + 32);
+
+  old_val = const_val[SSA_NAME_VERSION (var)];
 
   canonicalize_float_value (new_val);
 
@@ -713,7 +725,7 @@ ccp_initialize (void)
 {
   basic_block bb;
 
-  const_val = XCNEWVEC (prop_value_t, num_ssa_names);
+  const_val.create (num_ssa_names);
 
   /* Initialize simulation flags for PHI nodes and statements.  */
   FOR_EACH_BB (bb)
@@ -774,6 +786,9 @@ static void
 do_dbg_cnt (void)
 {
   unsigned i;
+
+  if (num_ssa_names = const_val.length ())
+const_val.safe_grow_cleared (num_ssa_names);
   for (i = 0; i  num_ssa_names; i++)
 {
   if (!dbg_cnt (ccp))
@@ -829,9 +844,8 @@ ccp_finalize (void)
   something_changed = substitute_and_fold (get_constant_value,
   ccp_fold_stmt, true);
 
-  free (const_val);
-  const_val = NULL;
-  return something_changed;;
+  const_val.release ();
+  return something_changed;
 }
 
 
--- gcc/testsuite/gcc.dg/pr56396.c.jj   2013-02-19 20:02:48.663057957 +0100
+++ gcc/testsuite/gcc.dg/pr56396.c  2013-02-19 19:59:00.0 +0100
@@ -0,0 +1,22 @@
+/* PR tree-optimization/56396 */
+/* { dg-do compile } */
+/* { dg-options -O2 -fpic -g } */
+
+struct S { char *s; int z; };
+struct T { int t; } *c, u;
+void bar (int, const char *);
+
+inline void *
+foo (void *x, char *y, int z)
+{
+  struct S s;
+  char b[256];
+  s.s = b;
+  s.z = __builtin___sprintf_chk (s.s, 1, __builtin_object_size (s.s, 2), 
Require);
+  if (s.z  0)
+bar (u.t | c-t, rls);
+  if (foo (x, s.s, s.z))
+{
+}
+  return (void *) 0;
+}

Jakub


[Patch, libfortran] PR 30162 pipe I/O regression with 4.7/4.8

2013-02-19 Thread Janne Blomqvist
Hi,

attached is an attempt to fix writing formatted sequential I/O to a
pipe (The PR was reopened in comment #22, which refers to formatted
I/O so the PR title is incorrect). I think the underlying reason was
that the introduction of the ssize() member function led to a change
in semantics (size of a non-seekable fd is now 0 rather than -1), and
thus in io/open.c test_endfile() we incorrectly concluded that the
file was not positioned at the end, and thus we try to truncate after
writing, leading to the failure.

At the same time, the patch reverts the previous fix; Unformatted
sequential requires seeking due to updating the record markers, I
think that issue can be closed as WONTFIX.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk/4.7?

2013-02-19  Janne Blomqvist  j...@gcc.gnu.org

PR libfortran/30162
* io/open.c (test_endfile): Call stell only if size != 0.
* io/unix.c (raw_tell): Revert r194679.
(raw_size): Return size field only for regular files, otherwise 0.


-- 
Janne Blomqvist


pipe2.diff
Description: Binary data


Re: Patch for 4.7: Avoid subreg'ing VFP D registers in big-endian mode

2013-02-19 Thread Ramana Radhakrishnan
On Fri, Feb 15, 2013 at 10:40 PM, Seth LaForge set...@google.com wrote:
 gcc 4.7.2 generates incorrect code for big-endian ARM VFP processors
 when storing a local double to a packed memory location, as described
 in bug 56351.
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56351

 A fix has been submitted to the trunk by Julian Brown:
 http://gcc.gnu.org/git/?p=gcc.git;a=patch;h=4f0e4afcb2a9d345ed7e9c14233fb97d3a3e8d3c

 This fix is not included in the latest 4.7 snapshot.  Can we please
 include it in the 4.7 branch so that this serious codegen bug is fixed
 in 4.7.3?

 Unfortunately, it's a not a trivial backport, as it appears that
 support for ARM FPA floating point has been removed from gcc since
 4.7.  Below is my best attempt at a backport - it works for me, on a
 big-endian VFP processor.  I'm not familiar with this code, though -
 Julian, can you take a look and confirm whether I'm doing this right?

 2013-02-15 Seth LaForge set...@google.com

 * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Avoid subreg'ing
 VFP D registers in big-endian mode.
 Backported from a change by Julian Brown jul...@codesourcery.com

This is not the correct form of a changelog entry . Please see other
examples of Backports in the Changelog file for the 4.7 branch.

Instead please use something like this.

DATE  yourname  youremailid

TABBackport
TAB2012-10-22  Julian Brown  jul...@codesourcery.com
  * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Avoid subreg'ing
  VFP D registers in big-endian mode.

Ok to backport provided no regressions  when running the testsuite in
big endian mode.


 diff -urp gcc-4.7.2/gcc/config/arm/arm.h gcc-4.7.2.new/gcc/config/arm/arm.h
 --- gcc-4.7.2/gcc/config/arm/arm.h  2012-01-09 20:14:09.0 -0800
 +++ gcc-4.7.2.new/gcc/config/arm/arm.h  2013-02-15 14:03:09.113531299 -0800
 @@ -1123,11 +1123,18 @@ enum reg_class
  /* FPA registers can't do subreg as all values are reformatted to internal
 precision.  In VFPv1, VFP registers could only be accessed in the mode
 they were set, so subregs would be invalid there too.  However, we don't
 -   support VFPv1 at the moment, and the restriction was lifted in VFPv2.  */
 +   support VFPv1 at the moment, and the restriction was lifted in VFPv2.
 +   In big-endian mode, modes greater than word size (i.e. DFmode) are stored 
 in
 +   VFP registers in little-endian order.  We can't describe that accurately 
 to
 +   GCC, so avoid taking subregs of such values.  */
  #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)  \
 -  (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)  \
 -   ? reg_classes_intersect_p (FPA_REGS, (CLASS))   \
 -   : 0)
 +  (TARGET_VFP  \
 +  ? TARGET_BIG_END \
 + (GET_MODE_SIZE (FROM)  UNITS_PER_WORD  \
 +   || GET_MODE_SIZE (TO)  UNITS_PER_WORD) \
 + reg_classes_intersect_p (VFP_REGS, (CLASS)) \
 +  : GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
 + reg_classes_intersect_p (FPA_REGS, (CLASS)))

Watch out for alignment of the \'s though it might be your mailer
munging things rather than anything else. Can you please make sure
that the \'s are aligned to the same column please ? This is why I
prefer to get git to generate out patches using git-format-patch and
attach them as text files to all my mails otherwise it seems to mess
things up like this.

Thanks,
Ramana


Re: [Patch, microblaze]: Handle 0x80000000 as 32bit signed dividend

2013-02-19 Thread Michael Eager

On 02/10/2013 10:38 PM, David Holsgrove wrote:

Handle 0x8000 as 32bit signed dividend

Changelog

2013-02-11  Edgar E. Iglesias  edgar.igles...@gmail.com

  * config/microblaze/modsi3.S (modsi3): Fix case with
0x8000 as dividend.


Committed revision 196156.

--
Michael Eagerea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


Re: [Patch, microblaze]: Avoid PC relative branches between sections

2013-02-19 Thread Michael Eager

On 02/10/2013 10:38 PM, David Holsgrove wrote:

Avoid PC relative branches between sections by further
checking that the symbol we are calling is declared as
a function before using PC relative calls.

Changelog

2013-02-11  Edgar E. Iglesias edgar.igles...@gmail.com

  *  config/microblaze/microblaze.md (call_value_intern):
 Check symbol is function before branching


Committed revision 196157.

--
Michael Eagerea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


Re: [Patch, microblaze]: Add support for the CLZ insn

2013-02-19 Thread Michael Eager

On 02/10/2013 10:39 PM, David Holsgrove wrote:

Add support for the CLZ insn

Will be used if pattern-compare is enabled and the targeted
core is newer than v8.10.a.

Changelog

2013-02-11  Edgar E. Iglesias edgar.igles...@gmail.com

   * config/microblaze/microblaze.c: microblaze_has_clz = 0
  Add version check for v8.10.a to enable microblaze_has_clz
   * config/microblaze/microblaze.h: Add TARGET_HAS_CLZ as
  combined version and TARGET_PATTERN_COMPARE check
   * config/microblaze/microblaze.md: New clzsi2 instruction


Committed revision 196158.

--
Michael Eagerea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


[v3] correct doxygen parse

2013-02-19 Thread Benjamin De Kosnik

Fixups for doxygen. Since 2012-11-20, most of C++11 has been ignored by
doxygen, resulting in some missing modules documentation even in HTML
output.

Jakub, this fixes the libstdc++.tag validation errors.

I've regenerated the gcc.gnu.org docs for 4.8.0. They look equivalent or
better than 4.7.2 to me now.

tested x86/linux

-benjamin2013-02-19  Benjamin Kosnik  b...@redhat.com

	* doc/doxygen/user.cfg.in: Set __cplusplus to 201103L. Change to
	_GLIBCXX_INCLUDE_AS_CXX11. DIRECTORY_GRAPH, MARKDOWN_SUPPORT,
	AUTOLINK_SUPPORT to NO. Update to doxygen 1.8.3.1.
	* include/bits/stl_pair.h: Add to utilities group.
	* include/std/tuple: Same.
	* include/std/typeindex: Same.

	* include/bits/stringfwd.h: Fix markup.
	* include/std/limits: Same.
	* include/std/type_traits: Same.
	* include/tr1/memory: Same.
	* include/tr1/regex: Same.
	* scripts/run_doxygen: Comment.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Fixup line numbers.

diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in
index 5af636b..4a3afc4 100644
--- a/libstdc++-v3/doc/doxygen/user.cfg.in
+++ b/libstdc++-v3/doc/doxygen/user.cfg.in
@@ -1,4 +1,4 @@
-# Doxyfile 1.8.2
+# Doxyfile 1.8.3.1
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project.
@@ -252,14 +252,15 @@ EXTENSION_MAPPING  =
 # can mix doxygen, HTML, and XML commands with Markdown formatting.
 # Disable only in case of backward compatibilities issues.
 
-MARKDOWN_SUPPORT   = YES
+MARKDOWN_SUPPORT   = NO
 
-# When enabled doxygen tries to link words that correspond to documented classes,
-# or namespaces to their corresponding documentation. Such a link can be
-# prevented in individual cases by by putting a % sign in front of the word or
-# globally by setting AUTOLINK_SUPPORT to NO.
+# When enabled doxygen tries to link words that correspond to
+# documented classes, or namespaces to their corresponding
+# documentation. Such a link can be prevented in individual cases by
+# by putting a % sign in front of the word or globally by setting
+# AUTOLINK_SUPPORT to NO.
 
-AUTOLINK_SUPPORT   = YES
+AUTOLINK_SUPPORT   = NO
 
 # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
 # to include (a tag file for) the STL sources as input, then you should
@@ -281,7 +282,12 @@ CPP_CLI_SUPPORT= NO
 
 SIP_SUPPORT= NO
 
-# For Microsoft's IDL there are propget and propput attributes to indicate getter and setter methods for a property. Setting this option to YES (the default) will make doxygen replace the get and set methods by a property in the documentation. This will only work if the methods are indeed getting or setting a simple type. If this is not the case, or you want to show the methods anyway, you should set this option to NO.
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES (the
+# default) will make doxygen replace the get and set methods by a property in
+# the documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
 
 IDL_PROPERTY_SUPPORT   = NO
 
@@ -305,8 +311,7 @@ SUBGROUPING= YES
 # @ingroup) instead of on a separate page (for HTML and Man pages) or
 # section (for LaTeX and RTF).
 
-#INLINE_GROUPED_CLASSES = NO
-INLINE_GROUPED_CLASSES = YES
+INLINE_GROUPED_CLASSES = NO
 
 # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
 # unions with only public data fields will be shown inline in the documentation
@@ -314,7 +319,7 @@ INLINE_GROUPED_CLASSES = YES
 # documentation), provided this scope is documented. If set to NO (the default),
 # structs, classes, and unions are shown on a separate page (for HTML and Man
 # pages) or section (for LaTeX and RTF).
- 
+
 INLINE_SIMPLE_STRUCTS  = NO
 
 # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
@@ -542,7 +547,8 @@ GENERATE_BUGLIST   = YES
 GENERATE_DEPRECATEDLIST= YES
 
 # The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
+# documentation sections, marked by \if section-label ... \endif
+# and \cond section-label ... \endcond blocks.
 
 ENABLED_SECTIONS   = @enabled_sections@
 
@@ -600,7 +606,8 @@ LAYOUT_FILE=
 # requires the bibtex tool to be installed. See also
 # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
 # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
-# feature you need bibtex and perl available in the search path.
+# feature you need bibtex and perl available in the search path. Do not use
+# file names with spaces, bibtex cannot handle them.
 
 CITE_BIB_FILES =
 
@@ -952,6 +959,13 @@ FILTER_SOURCE_FILES= NO
 
 

Re: Version specific onlinedocs page

2013-02-19 Thread Gerald Pfeifer

On Mon, 18 Feb 2013, Tobias Burnus wrote:

If we means that you are volunteering ;-), absolutely, go for it!

;-)


How about the following patch? If it is okay, I will add the remaining 
index.html for 4.6 and 4.7 and update gcc-4.6/index.html – and then 
commit it.


Looks good to me.

Perhaps you can add a note for the release manager how to create
index.html (copy from previous release and adjust)?

Gerald

Re: [C++ Patch] PR 56373

2013-02-19 Thread Jason Merrill

OK.

Jason


Re: RFC: [PATCH,ARM] Fix 56110

2013-02-19 Thread Tilman Sauerbeck
Tilman Sauerbeck [2013-02-19 23:26]:

 However it breaks the case where the 2nd operand is a const_int that
 *can* be used as an immediate (eg 0x80), and ends up generating the
 AND/CMP combination.

... and that would be because I changed the operand patterns in
zeroextractsi_compare0_scratch and didn't restore the originals when
trying the new diff :/

So the diff I posted last night might do the trick.
If there's no obvious reason why it would be wrong, I'll start a
bootstrap and regression test tonight.

Thanks,
Tilman

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?