Re: [PATCH] Fix raw-string handling (PR preprocessor/57620)

2013-06-27 Thread Jakub Jelinek
On Mon, Jun 17, 2013 at 06:28:46PM +0200, Jakub Jelinek wrote:
 lex_raw_string right now only undoes phase {1,2} transformations in between
 Rdelim( and )delim, while it should undo them everywhere between R and
 the final .  The following patch implements that, and adds testsuite
 coverage for that.  Bootstrapped/regtested on x86_64-linux and i686-linux,
 ok for trunk?

Ping.

 2013-06-17  Jakub Jelinek  ja...@redhat.com
 
   PR preprocessor/57620
   * lex.c (lex_raw_string): Undo phase1 and phase2 transformations
   between R and final  rather than only in between Rdel( and )del.
 
   * c-c++-common/raw-string-2.c (s12, u12, U12, L12): Remove.
   (main): Don't test {s,u,U,L}12.
   * c-c++-common/raw-string-13.c: New test.
   * c-c++-common/raw-string-14.c: New test.
   * c-c++-common/raw-string-15.c: New test.
   * c-c++-common/raw-string-16.c: New test.

Jakub


[PATCH] Fix pr57637

2013-06-27 Thread Zhenqiang Chen
Hi,

Shrink-wrap optimization sinks some instructions for more
opportunities. It uses DF_LR_BB_INFO (bb)-def to check whether BB
clobbers SRC. But for ARM, gcc might generate cond_exec insns before
shrink-wrapping. And DF_LR_BB_INFO (bb)-def does not include def info
from cond_exec insns. So the check in function
move_insn_for_shrink_wrap is not enough.

The patch is to add more check bases on DF_LIVE_BB_INFO (bb)-gen if
df-live is available.

Bootstrap and no make check regression on x86-64 and Panda board.

Is is OK for trunk?

Thanks!
-Zhenqiang

ChangeLog:
2013-06-27  Zhenqiang Chen  zhenqiang.c...@linaro.org

PR target/57637
* function.c (move_insn_for_shrink_wrap): Check
DF_LIVE_BB_INFO (bb)-gen.

diff --git a/gcc/function.c b/gcc/function.c
index 3e33fc7..08ca4a1 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5508,7 +5508,8 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
   bb_defs = DF_LR_BB_INFO (bb)-def;
   for (i = dregno; i  end_dregno; i++)
{
- if (REGNO_REG_SET_P (bb_uses, i) || REGNO_REG_SET_P (bb_defs, i))
+ if (REGNO_REG_SET_P (bb_uses, i) || REGNO_REG_SET_P (bb_defs, i)
+ || (df_live  REGNO_REG_SET_P (DF_LIVE_BB_INFO (bb)-gen, i)))
next_block = NULL;
  CLEAR_REGNO_REG_SET (live_out, i);
  CLEAR_REGNO_REG_SET (live_in, i);
@@ -5518,7 +5519,8 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
 Either way, SRC is now live on entry.  */
   for (i = sregno; i  end_sregno; i++)
{
- if (REGNO_REG_SET_P (bb_defs, i))
+ if (REGNO_REG_SET_P (bb_defs, i)
+ || (df_live  REGNO_REG_SET_P (DF_LIVE_BB_INFO (bb)-gen, i)))
next_block = NULL;
  SET_REGNO_REG_SET (live_out, i);
  SET_REGNO_REG_SET (live_in, i);


[PING] [C++ Patch] Remove finish_stmt

2013-06-27 Thread Paolo Carlini

Hi,

On 06/16/2013 07:21 PM, Paolo Carlini wrote:

Hi,

lately doesn't appear to accomplish much. Tested x86_64-linux.

pinging this clean-up (before I forget ;)

Thanks!
Paolo.

/
2013-06-17  Paolo Carlini  paolo.carl...@oracle.com

* cp-tree.h (finish_stmt): Do not declare.
* decl.c (finish_stmt): Do not define.
* parser.c (cp_parser_expression_statement,
cp_parser_declaration_statement,
cp_parser_transaction_cancel): Don't call finish_stmt.
* semantics.c (finish_expr_stmt, finish_if_stmt,
finish_while_stmt, finish_do_stmt, finish_return_stmt,
finish_for_stmt, finish_switch_stmt, finish_compound_stmt,
finish_transaction_stmt): Likewise.
Index: cp-tree.h
===
--- cp-tree.h   (revision 200134)
+++ cp-tree.h   (working copy)
@@ -5212,7 +5212,6 @@ extern tree grokmethod
(cp_decl_specifier_seq *
 extern void maybe_register_incomplete_var  (tree);
 extern void maybe_commonize_var(tree);
 extern void complete_vars  (tree);
-extern void finish_stmt(void);
 extern tree static_fn_type (tree);
 extern void revert_static_member_fn(tree);
 extern void fixup_anonymous_aggr   (tree);
Index: decl.c
===
--- decl.c  (revision 200134)
+++ decl.c  (working copy)
@@ -14273,13 +14273,6 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t
 }
 
 
-/* When a stmt has been parsed, this function is called.  */
-
-void
-finish_stmt (void)
-{
-}
-
 /* Return the FUNCTION_TYPE that corresponds to MEMFNTYPE, which can be a
FUNCTION_DECL, METHOD_TYPE, FUNCTION_TYPE, pointer or reference to
METHOD_TYPE or FUNCTION_TYPE, or pointer to member function.  */
Index: parser.c
===
--- parser.c(revision 200134)
+++ parser.c(working copy)
@@ -9295,8 +9295,6 @@ cp_parser_expression_statement (cp_parser* parser,
 statement = finish_stmt_expr_expr (statement, in_statement_expr);
   else if (statement)
 statement = finish_expr_stmt (statement);
-  else
-finish_stmt ();
 
   return statement;
 }
@@ -10351,9 +10349,6 @@ cp_parser_declaration_statement (cp_parser* parser
 
   /* Free any declarators allocated.  */
   obstack_free (declarator_obstack, p);
-
-  /* Finish off the statement.  */
-  finish_stmt ();
 }
 
 /* Some dependent statements (like `if (cond) statement'), are
@@ -28410,7 +28405,6 @@ cp_parser_transaction_cancel (cp_parser *parser)
 
   stmt = build_tm_abort_call (token-location, is_outer);
   add_stmt (stmt);
-  finish_stmt ();
 
   return stmt;
 }
Index: semantics.c
===
--- semantics.c (revision 200134)
+++ semantics.c (working copy)
@@ -630,8 +630,6 @@ finish_expr_stmt (tree expr)
   r = add_stmt (expr);
 }
 
-  finish_stmt ();
-
   return r;
 }
 
@@ -696,7 +694,6 @@ finish_if_stmt (tree if_stmt)
   tree scope = IF_SCOPE (if_stmt);
   IF_SCOPE (if_stmt) = NULL;
   add_stmt (do_poplevel (scope));
-  finish_stmt ();
 }
 
 /* Begin a while-statement.  Returns a newly created WHILE_STMT if
@@ -729,7 +726,6 @@ void
 finish_while_stmt (tree while_stmt)
 {
   WHILE_BODY (while_stmt) = do_poplevel (WHILE_BODY (while_stmt));
-  finish_stmt ();
 }
 
 /* Begin a do-statement.  Returns a newly created DO_STMT if
@@ -767,7 +763,6 @@ finish_do_stmt (tree cond, tree do_stmt)
 {
   cond = maybe_convert_cond (cond);
   DO_COND (do_stmt) = cond;
-  finish_stmt ();
 }
 
 /* Finish a return-statement.  The EXPRESSION returned, if any, is as
@@ -804,7 +799,6 @@ finish_return_stmt (tree expr)
   TREE_NO_WARNING (r) |= no_warning;
   r = maybe_cleanup_point_expr_void (r);
   r = add_stmt (r);
-  finish_stmt ();
 
   return r;
 }
@@ -930,8 +924,6 @@ finish_for_stmt (tree for_stmt)
   *scope_ptr = NULL;
   add_stmt (do_poplevel (scope));
 }
-
-  finish_stmt ();
 }
 
 /* Begin a range-for-statement.  Returns a new RANGE_FOR_STMT.
@@ -1065,7 +1057,6 @@ finish_switch_stmt (tree switch_stmt)
   SWITCH_STMT_BODY (switch_stmt) =
 pop_stmt_list (SWITCH_STMT_BODY (switch_stmt));
   pop_switch ();
-  finish_stmt ();
 
   scope = SWITCH_STMT_SCOPE (switch_stmt);
   SWITCH_STMT_SCOPE (switch_stmt) = NULL;
@@ -1287,7 +1278,6 @@ finish_compound_stmt (tree stmt)
 
   /* ??? See c_end_compound_stmt wrt statement expressions.  */
   add_stmt (stmt);
-  finish_stmt ();
 }
 
 /* Finish an asm-statement, whose components are a STRING, some
@@ -5197,7 +5187,6 @@ finish_transaction_stmt (tree stmt, tree compound_
 
   if (compound_stmt)
 finish_compound_stmt (compound_stmt);
-  finish_stmt ();
 }
 
 /* Build a __transaction_atomic or __transaction_relaxed expression.  If


Re: C++ 2014 status page for libstdc++

2013-06-27 Thread Jonathan Wakely
On 26 June 2013 02:28, Ed Smith-Rowland wrote:
 On 06/25/2013 11:59 AM, Jonathan Wakely wrote:

 On 25 June 2013 16:45,  3dw...@verizon.net wrote:

 Here is a C++2014 status page for fun and profit.

 Excellent, thanks!

 Tested with xmllint.  Are there any other tests I should do?

 The makefile target to check the docbook manual is:
 make doc-xml-validate-docbook

 Checked clean.


 It should also be linked from doc/xml/manual/intro.xml so it appears
 as part of the manual.

 Done.


 The first paragraph says the table is based on the table of contents
 of the CD, but it isn't.  I agree with only showing the C++14 changes,
 but the first paragraph should be changed (or removed.)

 Just removed this paragraph.

 Applied.

That patch is definitely OK, but please wait for approval before applying!

Thanks again for doing this - I'll try to find time to finish the WIP
stuff I'm W'ing on :)


Re: [PATCH] Basic support for MIPS r5900

2013-06-27 Thread Jürgen Urban
Hello Richard,

Am 25.06.2013 um 23:24 schrieb Richard Sandiford rdsandif...@googlemail.com:

 Jürgen Urban juergenur...@gmx.de writes:
 Am 23.06.2013 um 22:21 schrieb Richard Sandiford 
 rdsandif...@googlemail.com:
 In the native PS2SDK (i.e. no Linux) I detected that there are undefined
 references to `__fixtfsi', `__floatsitf', `__subtf3', `__multf3',
 __extenddftf2', `__lttf2' and `__gttf2'. These are the functions for
 handling long double.
 There is a fix needed for this in libgcc. I attached 2 patches to this
 e-mail. There should be only one of the patches used to fix this.
 The first one fixes the problem for all mips systems. The second one
 fixes this only for r5900. I think it is a general problem. I assume the
 undefined references could appear on all mips64 systems which are not
 Linux. So the first patch should be applied.
 
 The second patch is right.  Not all targets have 128-bit long doubles,
 so t-tpbit is intentionally an opt-in rather than opt-out thing.
 
 E.g. mips*-sde-elf and mips*-mti-elf both use:
 
 #undef LONG_DOUBLE_TYPE_SIZE
 #define LONG_DOUBLE_TYPE_SIZE 64
 
 to get a form of n32 in which long doubles are the same as doubles.
 
 Do you want to stick with 128-bit long doubles for PS2, or would you
 prefer to do what SDE does?
 
 I prefer shorter long doubles because of the performance impact. For 32
 bit hard float we may need it. Can you change it or do I need to submit
 a patch?
 
 OK, could you give this a go?

I tested it and it is working as expected.

Best regards
Jürgen

Re: [PATCH, AArch64] Minor refactoring of aarch64_add_offset

2013-06-27 Thread Marcus Shawcroft

On 25/06/13 17:04, Yufeng Zhang wrote:

This patch carries out minor refactoring on aarch64_add_offset; it
replaces 'DImode' and 'Pmode' with 'mode'.

OK for the trunk?


OK
/Marcus




Re: [PATCH, AArch64] Minor refactoring of aarch64_force_temporary

2013-06-27 Thread Marcus Shawcroft

On 25/06/13 17:06, Yufeng Zhang wrote:

This patch adds a new parameter 'mode' of type 'enum machine_mode mode'
to aarch64_force_temporary, and updates the calls to it.

OK for the trunk?


OK
/Marcus




Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Marc Glisse

On Wed, 26 Jun 2013, Jason Merrill wrote:


On 06/09/2013 07:09 AM, Marc Glisse wrote:

+  arg0 = build_non_dependent_expr (arg0);
+  arg1 = build_non_dependent_expr (arg1);
+  arg2 = build_non_dependent_expr (arg2);
+}
+  return c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain  
tf_error);


This is wrong; the places in the compiler that currently use 
build_non_dependent_expr only use the result temporarily for determining the 
type of the expression, but then use the original arguments for building the 
return value.


Oups, you are right, my copy-paste was incomplete.

Attached is a version (same ChangeLog) that uses build_min_non_dep to fix 
it, as in the various build_x_* functions. Is it the right way? (it passes 
bootstrap+testsuite, but then so did the previous patch) I assume I can't 
call directly c_build_vec_perm_expr on the original arguments without 
build_non_dependent_expr?


By the way, should I rename cp_build_vec_perm_expr as 
build_x_vec_perm_expr, since most of its code is copied from 
build_x_binary_op and not cp_build_binary_op?


--
Marc GlisseIndex: cp/typeck.c
===
--- cp/typeck.c (revision 200426)
+++ cp/typeck.c (working copy)
@@ -4864,20 +4864,48 @@ cp_build_binary_op (location_t location,
   if (final_type != 0)
 result = cp_convert (final_type, result, complain);
 
   if (TREE_OVERFLOW_P (result) 
!TREE_OVERFLOW_P (op0) 
!TREE_OVERFLOW_P (op1))
 overflow_warning (location, result);
 
   return result;
 }
+
+/* Build a VEC_PERM_EXPR.
+   This is a simple wrapper for c_build_vec_perm_expr.  */
+tree
+cp_build_vec_perm_expr (location_t loc,
+   tree arg0, tree arg1, tree arg2,
+   tsubst_flags_t complain)
+{
+  tree expr;
+  tree orig_arg0 = arg0;
+  tree orig_arg1 = arg1;
+  tree orig_arg2 = arg2;
+  if (processing_template_decl)
+{
+  if (type_dependent_expression_p (arg0)
+ || type_dependent_expression_p (arg1)
+ || type_dependent_expression_p (arg2))
+   return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2);
+  arg0 = build_non_dependent_expr (arg0);
+  arg1 = build_non_dependent_expr (arg1);
+  arg2 = build_non_dependent_expr (arg2);
+}
+  expr = c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain  tf_error);
+  if (processing_template_decl  expr != error_mark_node)
+expr = build_min_non_dep (VEC_PERM_EXPR, expr, orig_arg0, orig_arg1,
+ orig_arg2);
+  return expr;
+}
 
 /* Return a tree for the sum or difference (RESULTCODE says which)
of pointer PTROP and integer INTOP.  */
 
 static tree
 cp_pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
 {
   tree res_type = TREE_TYPE (ptrop);
 
   /* pointer_int_sum() uses size_in_bytes() on the TREE_TYPE(res_type)
Index: cp/pt.c
===
--- cp/pt.c (revision 200426)
+++ cp/pt.c (working copy)
@@ -12457,20 +12457,21 @@ tsubst_copy (tree t, tree args, tsubst_f
int i;
for (i = 0; i  n; i++)
  TREE_OPERAND (t, i) = tsubst_copy (TREE_OPERAND (t, i), args,
 complain, in_decl);
return result;
   }
 
 case COND_EXPR:
 case MODOP_EXPR:
 case PSEUDO_DTOR_EXPR:
+case VEC_PERM_EXPR:
   {
r = build_nt
  (code, tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl),
   tsubst_copy (TREE_OPERAND (t, 1), args, complain, in_decl),
   tsubst_copy (TREE_OPERAND (t, 2), args, complain, in_decl));
TREE_NO_WARNING (r) = TREE_NO_WARNING (t);
return r;
   }
 
 case NEW_EXPR:
@@ -14621,20 +14622,27 @@ tsubst_copy_and_build (tree t,
RETURN (r);
   }
 
 case TRANSACTION_EXPR:
   RETURN (tsubst_expr(t, args, complain, in_decl,
 integral_constant_expression_p));
 
 case PAREN_EXPR:
   RETURN (finish_parenthesized_expr (RECUR (TREE_OPERAND (t, 0;
 
+case VEC_PERM_EXPR:
+  RETURN (cp_build_vec_perm_expr (input_location,
+   RECUR (TREE_OPERAND (t, 0)),
+   RECUR (TREE_OPERAND (t, 1)),
+   RECUR (TREE_OPERAND (t, 2)),
+   complain));
+
 default:
   /* Handle Objective-C++ constructs, if appropriate.  */
   {
tree subst
  = objcp_tsubst_copy_and_build (t, args, complain,
 in_decl, /*function_p=*/false);
if (subst)
  RETURN (subst);
   }
   RETURN (tsubst_copy (t, args, complain, in_decl));
Index: cp/parser.c
===
--- cp/parser.c (revision 200426)
+++ cp/parser.c (working copy)
@@ -5684,23 +5684,25 @@ cp_parser_postfix_expression (cp_parser
vec = cp_parser_parenthesized_expression_list (parser, non_attr,

[v3] Reorganized a bit the basic_string testsuite

2013-06-27 Thread Paolo Carlini

Hi,

now we have /modifiers/ and /operations/ consistently populated.

Thanks,
Paolo.

///
2013-06-27  Paolo Carlini  paolo.carl...@oracle.com

* testsuite/21_strings/basic_string/append/*: Move inside
testsuite/21_strings/basic_string/modifiers/.
* testsuite/21_strings/basic_string/assign/*: Likewise.
* testsuite/21_strings/basic_string/insert/*: Likewise.
* testsuite/21_strings/basic_string/replace/*: Likewise.
* testsuite/21_strings/basic_string/modifiers/pop_back/char/
pop_back.cc: Rename to 1.cc.
* testsuite/21_strings/basic_string/modifiers/pop_back/wchar_t/
pop_back.cc: Likewise.
* testsuite/ext/vstring/assign/*: Move inside
testsuite/ext/vstring/modifiers/.
2013-06-27  Paolo Carlini  paolo.carl...@oracle.com

* testsuite/21_strings/basic_string/operation/*: Move inside
testsuite/21_strings/basic_string/operations/data/.
* testsuite/21_strings/basic_string/compare/*: Move inside
testsuite/21_strings/basic_string/operations/.
* testsuite/21_strings/basic_string/find/*: Likewise.
* testsuite/21_strings/basic_string/rfind/*: Likewise.
* testsuite/21_strings/basic_string/substr/*: Likewise.


Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Jason Merrill

On 06/27/2013 07:59 AM, Marc Glisse wrote:

I assume I can't call directly c_build_vec_perm_expr on the original
arguments without build_non_dependent_expr?


It looks like c_build_vec_perm_expr is safe to take the original 
arguments, since it doesn't look deep into the expression.  So either 
way is fine.



By the way, should I rename cp_build_vec_perm_expr as build_x_vec_perm_expr, 
since most of its code is copied from build_x_binary_op and not 
cp_build_binary_op?


Makes sense.  OK with that change.

Jason


Re: [PATCH] Fix pr57637

2013-06-27 Thread Richard Earnshaw

On 27/06/13 10:02, Zhenqiang Chen wrote:

Hi,

Shrink-wrap optimization sinks some instructions for more
opportunities. It uses DF_LR_BB_INFO (bb)-def to check whether BB
clobbers SRC. But for ARM, gcc might generate cond_exec insns before
shrink-wrapping. And DF_LR_BB_INFO (bb)-def does not include def info
from cond_exec insns. So the check in function
move_insn_for_shrink_wrap is not enough.

The patch is to add more check bases on DF_LIVE_BB_INFO (bb)-gen if
df-live is available.

Bootstrap and no make check regression on x86-64 and Panda board.

Is is OK for trunk?

Thanks!
-Zhenqiang

ChangeLog:
2013-06-27  Zhenqiang Chen  zhenqiang.c...@linaro.org

 PR target/57637
 * function.c (move_insn_for_shrink_wrap): Check
DF_LIVE_BB_INFO (bb)-gen.


First off, this isn't really my area, so all this might be off base. 
Did you really mean Richard Sandiford?


The code you're looking at here looks a bit odd.  We have

  live_out = df_get_live_out (bb);
  live_in = df_get_live_in (next_block);
  bb = next_block;

  /* Check whether BB uses DEST or clobbers DEST.  We need to add
 INSN to BB if so.  Either way, DEST is no longer live on entry,
 except for any part that overlaps SRC (next loop).  */
  bb_uses = DF_LR_BB_INFO (bb)-use;
  bb_defs = DF_LR_BB_INFO (bb)-def;

The setting of live_out and live in uses

  if (df_live)
return DF_LIVE_OUT (bb);
  else
return DF_LR_OUT (bb);

but for bb_uses and bb_defs, we unconditionally use the LR problem and 
never consider live.


That seems strange to me.

Perhaps a better fix would be to set bb_uses and bb_defs based on 
whether or not df_live was valid.  ie


  live_out = df_get_live_out (bb);
  live_in = df_get_live_in (next_block);
  bb = next_block;

  /* Check whether BB uses DEST or clobbers DEST.  We need to add
 INSN to BB if so.  Either way, DEST is no longer live on entry,
 except for any part that overlaps SRC (next loop).  */
  if (df_live)
{
  bb_uses = DF_LIVE_BB_INFO (bb)-use;
  bb_defs = DF_LIVE_BB_INFO (bb)-def;
}
  else
{
  bb_uses = DF_LR_BB_INFO (bb)-use;
  bb_defs = DF_LR_BB_INFO (bb)-def;
}

Richard (S), what are your thoughts?

R.



diff --git a/gcc/function.c b/gcc/function.c
index 3e33fc7..08ca4a1 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5508,7 +5508,8 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
bb_defs = DF_LR_BB_INFO (bb)-def;
for (i = dregno; i  end_dregno; i++)
 {
- if (REGNO_REG_SET_P (bb_uses, i) || REGNO_REG_SET_P (bb_defs, i))
+ if (REGNO_REG_SET_P (bb_uses, i) || REGNO_REG_SET_P (bb_defs, i)
+ || (df_live  REGNO_REG_SET_P (DF_LIVE_BB_INFO (bb)-gen, i)))
 next_block = NULL;
   CLEAR_REGNO_REG_SET (live_out, i);
   CLEAR_REGNO_REG_SET (live_in, i);
@@ -5518,7 +5519,8 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
  Either way, SRC is now live on entry.  */
for (i = sregno; i  end_sregno; i++)
 {
- if (REGNO_REG_SET_P (bb_defs, i))
+ if (REGNO_REG_SET_P (bb_defs, i)
+ || (df_live  REGNO_REG_SET_P (DF_LIVE_BB_INFO (bb)-gen, i)))
 next_block = NULL;
   SET_REGNO_REG_SET (live_out, i);
   SET_REGNO_REG_SET (live_in, i);






[Patch] microMIPS cleanups

2013-06-27 Thread Moore, Catherine
Hi Richard,

This patch adds the m14ke processors to the cpu definition file, adds the m14kc 
to invoke.texi and updates BASE_DRIVER_SELF_SPECS for the m14ke*
Okay to commit?

Thanks,
Catherine


m14ke.cl
Description: m14ke.cl


m14ke.patch
Description: m14ke.patch


Re: [Patch ARM] Add Cortex A15 neon scheduler

2013-06-27 Thread Ramana Radhakrishnan

On 06/26/13 09:37, Tom de Vries wrote:

On 18/10/12 18:48, Ramana Radhakrishnan wrote:

+(define_insn_reservation cortex_a15_vfp_adds_subs 6
+  (and (eq_attr tune cortexa15)
+   (eq_attr type fadds))
+  ca15_issue1,ca15_cx_vfp)


Ramana,

I noticed you use here the fadds value for the type attribute to activate this 
rule.

This same test is also used in this generic_vfp rule:
...
(define_insn_reservation vfp_farith 8
  (and (eq_attr generic_vfp yes)
   (eq_attr type fadds,faddd,fconsts,fconstd,f_cvt,fmuls,fmacs,ffmas))
  fmac)
...
and the generic_vfp is yes for cortex-a15, so these 2 rules are active at the
same time.

The documentation states:
...
You should remember that you will be in trouble if condition for two or more
different define_insn_reservation constructions is TRUE for an insn. In this
case what reservation will be used for the insn is not defined.
...

I made an example, looked at the sched2 dump and found that the cortex-a15 rule
was active. Moving vfp11.md to before cortex-a15.md made the other rule active.

Are we exploiting some undocumented (partially) defined behavior here with
respect to order, or is this a latent bug?



Nice catch - No this is just a latent bug and is just an oversight.

We should just remove the A15 from the generic vfp scheduler.

regards
Ramana



Thanks,
- Tom






Re: [c++-concepts]: constraint association

2013-06-27 Thread Jason Merrill

Just a couple of typos:

On 06/24/2013 11:56 AM, Andrew Sutton wrote:

+// Returns true if NEWDECL and OLDDEC are member functions with with


OLDDECL


+// different constraints. If NEWDECL and OLDDECL are non-template members
+// or specializations of non-template members, they overloads are


the overloads


+// differentiated by the template constraints.


Jason



Re: [c++-concepts]: Diagnostics

2013-06-27 Thread Jason Merrill

On 06/21/2013 10:59 AM, Andrew Sutton wrote:

+  sorry (cannot diagnose disjunctions just yet);


Use diagnose_other for the time being?


+
 /* Langhook for print_error_function.  */
 void
 cxx_print_error_function (diagnostic_context *context, const char *file,
@@ -3326,7 +3331,7 @@ cp_printer (pretty_printer *pp, text_info *text, const 
char *spec,

   switch (*spec)
 {
-case 'A': result = args_to_string (next_tree, verbose);break;
+case 'A': result = args_to_string (next_tree, verbose); break;


Unnecessary whitespace changes.

Jason


[PATCH] Improve __popcount?i2 (PR middle-end/36041)

2013-06-27 Thread Jakub Jelinek
Hi!

This patch speeds up the libgcc __popcount{si,di,ti}2 implementations
more than 2 times by avoiding table lookup.
I've kept using the table lookup for small word size targets (unfortunately
avr/rl78 cheap and thus e.g. MIN_UNITS_PER_WORD isn't reliable for those
purposes).  Maybe it would be nice to detect if UWtype multiplication isn't
too expensive (as in, implemented using libcall) and use shits + additions
instead for that case.

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

2013-06-27  Jakub Jelinek  ja...@redhat.com

PR middle-end/36041
* libgcc2.c (POPCOUNTCST2, POPCOUNTCST4, POPCOUNTCST8, POPCOUNTCST):
Define.
(__popcountSI2): For __SIZEOF_INT__  2 targets use arithmetics
instead of table lookups.
(__popcountDI2): Likewise.

--- libgcc/libgcc2.c.jj 2013-02-05 09:06:55.0 +0100
+++ libgcc/libgcc2.c2013-06-27 08:59:12.319971540 +0200
@@ -819,17 +819,42 @@ const UQItype __popcount_tab[256] =
 };
 #endif
 
+#if defined(L_popcountsi2) || defined(L_popcountdi2)
+#define POPCOUNTCST2(x) (((UWtype) x  BITS_PER_UNIT) | x)
+#define POPCOUNTCST4(x) (((UWtype) x  (2 * BITS_PER_UNIT)) | x)
+#define POPCOUNTCST8(x) (((UWtype) x  (4 * BITS_PER_UNIT)) | x)
+#if W_TYPE_SIZE == BITS_PER_UNIT
+#define POPCOUNTCST(x) x
+#elif W_TYPE_SIZE == 2 * BITS_PER_UNIT
+#define POPCOUNTCST(x) POPCOUNTCST2 (x)
+#elif W_TYPE_SIZE == 4 * BITS_PER_UNIT
+#define POPCOUNTCST(x) POPCOUNTCST4 (POPCOUNTCST2 (x))
+#elif W_TYPE_SIZE == 8 * BITS_PER_UNIT
+#define POPCOUNTCST(x) POPCOUNTCST8 (POPCOUNTCST4 (POPCOUNTCST2 (x)))
+#endif
+#endif
+
 #ifdef L_popcountsi2
 #undef int
 int
 __popcountSI2 (UWtype x)
 {
+  /* Force table lookup on targets like AVR and RL78 which only
+ pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually
+ have 1, and other small word targets.  */
+#if __SIZEOF_INT__  2  defined (POPCOUNTCST)  BITS_PER_UNIT == 8
+  x = x - ((x  1)  POPCOUNTCST (0x55));
+  x = (x  POPCOUNTCST (0x33)) + ((x  2)  POPCOUNTCST (0x33));
+  x = (x + (x  4))  POPCOUNTCST (0x0F);
+  return (x * POPCOUNTCST (0x01))  (W_TYPE_SIZE - BITS_PER_UNIT);
+#else
   int i, ret = 0;
 
   for (i = 0; i  W_TYPE_SIZE; i += 8)
 ret += __popcount_tab[(x  i)  0xff];
 
   return ret;
+#endif
 }
 #endif
 
@@ -838,12 +863,28 @@ __popcountSI2 (UWtype x)
 int
 __popcountDI2 (UDWtype x)
 {
+  /* Force table lookup on targets like AVR and RL78 which only
+ pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually
+ have 1, and other small word targets.  */
+#if __SIZEOF_INT__  2  defined (POPCOUNTCST)  BITS_PER_UNIT == 8
+  const DWunion uu = {.ll = x};
+  UWtype x1 = uu.s.low, x2 = uu.s.high;
+  x1 = x1 - ((x1  1)  POPCOUNTCST (0x55));
+  x2 = x2 - ((x2  1)  POPCOUNTCST (0x55));
+  x1 = (x1  POPCOUNTCST (0x33)) + ((x1  2)  POPCOUNTCST (0x33));
+  x2 = (x2  POPCOUNTCST (0x33)) + ((x2  2)  POPCOUNTCST (0x33));
+  x1 = (x1 + (x1  4))  POPCOUNTCST (0x0F);
+  x2 = (x2 + (x2  4))  POPCOUNTCST (0x0F);
+  x1 += x2;
+  return (x1 * POPCOUNTCST (0x01))  (W_TYPE_SIZE - BITS_PER_UNIT);
+#else
   int i, ret = 0;
 
   for (i = 0; i  2*W_TYPE_SIZE; i += 8)
 ret += __popcount_tab[(x  i)  0xff];
 
   return ret;
+#endif
 }
 #endif
 

Jakub


Re: [c++-concepts]: Requires expression

2013-06-27 Thread Jason Merrill

On 06/21/2013 03:38 PM, Andrew Sutton wrote:

I haven't pushed this into a git branch since its a completely
separate change from the previous patch. Should I create a new branch
for separate work?


Sure.

Jason



Re: [c++-concepts]: Requires expression

2013-06-27 Thread Jason Merrill

On 06/21/2013 03:38 PM, Andrew Sutton wrote:

+  tree parms = cp_parser_parameter_declaration_clause (parser);


Calling this will push the parameter declarations into the current 
binding level; you will want to add the begin_scope/leave_scope and 
pop_binding that cp_parser_direct_declarator does around its call to the 
above function.



+  if (req == error_mark_node)
+cp_parser_abort_tentative_parse (parser);
+  else
+cp_parser_commit_to_tentative_parse (parser);
+
+  // If that failed, then we must have a simple requirement.
+  if (req == error_mark_node)
+req = cp_parser_simple_requirement (parser);


The usual pattern would be

if (!cp_parser_parse_definitely (parser))
  req = cp_parser_simple_requirement (parser);


+  type = cp_parser_type_id (parser);


Not cp_parser_trailing_type_id?

Jason



[PATCH] Fix up bzhi (PR target/57623)

2013-06-27 Thread Jakub Jelinek
Hi!

Another broken define_insn, bzhi has the middle operand r/m, others are r.
But, combine would usually not match memory loads, because the pattern
had non-canonical order of AND operands, thus it would never match there,
and only could result in broken code if the RA decided to use memory instead
of register.

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

2013-06-27  Jakub Jelinek  ja...@redhat.com

PR target/57623
* config/i386/i386.md (bmi2_bzhi_mode3): Swap AND arguments
to match RTL canonicalization.  Swap predicates and
constraints of operand 1 and 2.

* gcc.target/i386/bmi2-bzhi-1.c: New test.

--- gcc/config/i386/i386.md.jj  2013-06-19 19:28:29.0 +0200
+++ gcc/config/i386/i386.md 2013-06-27 13:51:21.771071326 +0200
@@ -11733,9 +11733,9 @@ (define_insn *bmi_blsr_mode
 ;; BMI2 instructions.
 (define_insn bmi2_bzhi_mode3
   [(set (match_operand:SWI48 0 register_operand =r)
-   (and:SWI48 (match_operand:SWI48 1 register_operand r)
-  (lshiftrt:SWI48 (const_int -1)
-  (match_operand:SWI48 2 
nonimmediate_operand rm
+   (and:SWI48 (lshiftrt:SWI48 (const_int -1)
+  (match_operand:SWI48 2 register_operand 
r))
+  (match_operand:SWI48 1 nonimmediate_operand rm)))
(clobber (reg:CC FLAGS_REG))]
   TARGET_BMI2
   bzhi\t{%2, %1, %0|%0, %1, %2}
--- gcc/testsuite/gcc.target/i386/bmi2-bzhi-1.c.jj  2013-06-27 
13:43:03.858202104 +0200
+++ gcc/testsuite/gcc.target/i386/bmi2-bzhi-1.c 2013-06-27 13:43:22.026140832 
+0200
@@ -0,0 +1,31 @@
+/* PR target/57623 */
+/* { dg-do assemble { target bmi2 } } */
+/* { dg-options -O2 -mbmi2 } */
+
+#include x86intrin.h
+
+unsigned int
+f1 (unsigned int x, unsigned int *y)
+{
+  return _bzhi_u32 (x, *y);
+}
+
+unsigned int
+f2 (unsigned int *x, unsigned int y)
+{
+  return _bzhi_u32 (*x, y);
+}
+
+#ifdef  __x86_64__
+unsigned long long
+f3 (unsigned long long x, unsigned long long *y)
+{
+  return _bzhi_u64 (x, *y);
+}
+
+unsigned long long
+f4 (unsigned long long *x, unsigned long long y)
+{
+  return _bzhi_u64 (*x, y);
+}
+#endif

Jakub


Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Marc Glisse

On Thu, 27 Jun 2013, Jason Merrill wrote:


On 06/27/2013 07:59 AM, Marc Glisse wrote:

I assume I can't call directly c_build_vec_perm_expr on the original
arguments without build_non_dependent_expr?


It looks like c_build_vec_perm_expr is safe to take the original arguments, 
since it doesn't look deep into the expression.  So either way is fine.


Cool, I'll go with the short version then (I tested it before posting):

+tree
+build_x_vec_perm_expr (location_t loc,
+   tree arg0, tree arg1, tree arg2,
+   tsubst_flags_t complain)
+{
+  if (processing_template_decl
+   (type_dependent_expression_p (arg0)
+ || type_dependent_expression_p (arg1)
+ || type_dependent_expression_p (arg2)))
+return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2);
+  return c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain  tf_error);
+}

By the way, should I rename cp_build_vec_perm_expr as 
build_x_vec_perm_expr, since most of its code is copied from 
build_x_binary_op and not cp_build_binary_op?


Makes sense.  OK with that change.


Thanks.

--
Marc Glisse


Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Jakub Jelinek
On Thu, Jun 27, 2013 at 05:24:45PM +0200, Marc Glisse wrote:
 On Thu, 27 Jun 2013, Jason Merrill wrote:
 
 On 06/27/2013 07:59 AM, Marc Glisse wrote:
 I assume I can't call directly c_build_vec_perm_expr on the original
 arguments without build_non_dependent_expr?
 
 It looks like c_build_vec_perm_expr is safe to take the original
 arguments, since it doesn't look deep into the expression.  So
 either way is fine.
 
 Cool, I'll go with the short version then (I tested it before posting):
 
 +tree
 +build_x_vec_perm_expr (location_t loc,
 + tree arg0, tree arg1, tree arg2,
 + tsubst_flags_t complain)
 +{
 +  if (processing_template_decl
 +   (type_dependent_expression_p (arg0)
 +   || type_dependent_expression_p (arg1)
 +   || type_dependent_expression_p (arg2)))
 +return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2);
 +  return c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain  tf_error);
 +}

But then you won't diagnose errors in never instantiated templates that
could be diagnosed (i.e. where the arguments aren't type dependent).
I think the standard C++ FE way is doing something like:

+  tree expr;
+  tree orig_arg0 = arg0;
+  tree orig_arg1 = arg1;
+  tree orig_arg2 = arg2;
+  if (processing_template_decl)
+{
+  if (type_dependent_expression_p (arg0)
+ || type_dependent_expression_p (arg1)
+ || type_dependent_expression_p (arg2))
+   return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2);
+  arg0 = build_non_dependent_expr (arg0);
+  arg1 = build_non_dependent_expr (arg1);
+  arg2 = build_non_dependent_expr (arg2);
+}
+  expr = c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain  tf_error);
+  if (processing_template_decl  expr != error_mark_node)
+return build_min_nt_loc (loc, VEC_PERM_EXPR, orig_arg0, orig_arg1,
+orig_arg2);
+  return expr;

Jakub


Re: [PATCH] Fix vectorizable_store

2013-06-27 Thread Richard Biener
Jakub Jelinek ja...@redhat.com wrote:

Hi!

On the gomp4 branch I've noticed a miscompilation of the simd-3.C
testcase I'm adding there, but even say
int a[1024] __attribute__((aligned (32))) = { 1 };
int b[1024] __attribute__((aligned (32))) = { 1 };
unsigned short c[1024] __attribute__((aligned (32))) = { 1 };

__attribute__((noinline, noclone)) void
foo (int *p)
{
  int i;
  p = (int *) __builtin_assume_aligned (p, 32);
  for (i = 0; i  512; i++)
{
  a[i] *= p[i];
  c[i]++;
}
}

int
main ()
{
  int i;
  for (i = 0; i  512; i++)
{
  a[i] = i - 512;
  b[i] = (i - 51) % 39;
  c[i] = (unsigned short) i;
}
  foo (b);
  for (i = 0; i  512; i++)
if (b[i] != (i - 51) % 39
   || a[i] != (i - 512) * b[i]
   || c[i] != (unsigned short) (i + 1))
  __builtin_abort ();
  return 0;
}
without -fopenmp, just -O3 -mavx.  The relevant change was just
that ptr_incr has been initialized to NULL in both vectorizable_store
and vectorizable_load, because vect_create_data_ref_ptr doesn't
initialize
it if only_init is true.  Looking at it, we just trigger undefined
behavior
and are just lucky that it works by accident on the trunk and branches.
The problem is that if ncopies  1, vectorizable_store declares the
variable
inside of the loop, for j == 0 it initializes it through
vect_create_data_ref_ptr, but then on the next iteration the variable
is
uninitialized again (but just due to luck contains the value from the
previous iteration, but say if compiler unrolled the loop, it would
already
misbehave) and then it is passed to bump_vector_ptr.  Fixed by moving
the
var decl outside of the loop.  While not strictly necessary, I find it
cleaner to initialize it to NULL, though if you disagree with it, I can
keep
that change local to gomp4 branch for now (i.e. remove  = NULL from
the
first hunk and the third hunk).

Ok for trunk/4.8?

Ok

Thanks,
Richard.
2013-06-26  Jakub Jelinek  ja...@redhat.com

   * tree-vect-stmts.c (vectorizable_store): Move ptr_incr var
   decl before the loop, initialize to NULL.
   (vectorizable_load): Initialize ptr_incr to NULL.

--- gcc/tree-vect-stmts.c.jj   2013-04-22 08:06:41.0 +0200
+++ gcc/tree-vect-stmts.c  2013-06-26 21:34:28.609654773 +0200
@@ -3796,6 +3796,7 @@ vectorizable_store (gimple stmt, gimple_
   enum vect_def_type dt;
   stmt_vec_info prev_stmt_info = NULL;
   tree dataref_ptr = NULL_TREE;
+  gimple ptr_incr = NULL;
   int nunits = TYPE_VECTOR_SUBPARTS (vectype);
   int ncopies;
   int j;
@@ -4041,7 +4042,6 @@ vectorizable_store (gimple stmt, gimple_
   for (j = 0; j  ncopies; j++)
 {
   gimple new_stmt;
-  gimple ptr_incr;
 
   if (j == 0)
   {
@@ -4314,7 +4314,7 @@ vectorizable_load (gimple stmt, gimple_s
   tree dummy;
   enum dr_alignment_support alignment_support_scheme;
   tree dataref_ptr = NULL_TREE;
-  gimple ptr_incr;
+  gimple ptr_incr = NULL;
   int nunits = TYPE_VECTOR_SUBPARTS (vectype);
   int ncopies;
   int i, j, group_size, group_gap;


   Jakub




Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Marc Glisse

On Thu, 27 Jun 2013, Jakub Jelinek wrote:


On Thu, Jun 27, 2013 at 05:24:45PM +0200, Marc Glisse wrote:

On Thu, 27 Jun 2013, Jason Merrill wrote:


On 06/27/2013 07:59 AM, Marc Glisse wrote:

I assume I can't call directly c_build_vec_perm_expr on the original
arguments without build_non_dependent_expr?


It looks like c_build_vec_perm_expr is safe to take the original
arguments, since it doesn't look deep into the expression.  So
either way is fine.


Cool, I'll go with the short version then (I tested it before posting):

+tree
+build_x_vec_perm_expr (location_t loc,
+   tree arg0, tree arg1, tree arg2,
+   tsubst_flags_t complain)
+{
+  if (processing_template_decl
+   (type_dependent_expression_p (arg0)
+ || type_dependent_expression_p (arg1)
+ || type_dependent_expression_p (arg2)))
+return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2);
+  return c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain  tf_error);
+}


But then you won't diagnose errors in never instantiated templates that
could be diagnosed (i.e. where the arguments aren't type dependent).


I don't really see why, as I am still calling c_build_vec_perm_expr in the 
same cases, just possibly not exactly with the same arguments (they don't 
go through build_non_dependent_expr, but Jason seemed to imply that it 
did not matter since we don't look too deep through the arguments).



I think the standard C++ FE way is doing something like:

[snip previous version that Jason accepted]

If you prefer the long version, I don't mind going back to it.

--
Marc Glisse


patch to build GCC for arm with LRA

2013-06-27 Thread Vladimir Makarov
The following patch is for building arm GCC with LRA.  I found that
ASHIFTRT and LSHIFTRT are used in address calculation for arm, e.g.


(insn 78 76 79 8 (set (reg/v:SI 153 [ offset ])
(mem:SI (plus:SI (ashiftrt:SI (reg:SI 151 [ D.6620 ])
(const_int 8 [0x8]))
(reg/f:SI 183 [ MEM[(const void * const *)obj_ptr_5(D)]
])) [5 *_27+0 S4 A32]))
/home/cygnus/vmakarov/build1/trunk5/gcc/libstdc++-v3/libsupc++/tinfo.h:88 197
{*arm_movsi_insn}
 (expr_list:REG_DEAD (reg/f:SI 183 [ MEM[(const void * const
*)obj_ptr_5(D)] ])
(expr_list:REG_DEAD (reg:SI 151 [ D.6620 ])
(nil


The patch was successfully bootstrapped on arm-hfp.

Richard, is it ok to commit to the trunk?

2013-06-27  Vladimir Makarov  vmaka...@redhat.com

* rtlanal.c (must_be_index_p, set_address_index): Add ASHIFTRT and
LSHIFTRT.

Index: rtlanal.c
===
--- rtlanal.c	(revision 200174)
+++ rtlanal.c	(working copy)
@@ -5480,7 +5480,8 @@ must_be_base_p (rtx x)
 static bool
 must_be_index_p (rtx x)
 {
-  return GET_CODE (x) == MULT || GET_CODE (x) == ASHIFT;
+  return (GET_CODE (x) == MULT || GET_CODE (x) == ASHIFT
+	  || GET_CODE (x) == ASHIFTRT || GET_CODE (x) == LSHIFTRT);
 }
 
 /* Set the segment part of address INFO to LOC, given that INNER is the
@@ -5519,7 +5520,8 @@ set_address_base (struct address_info *i
 static void
 set_address_index (struct address_info *info, rtx *loc, rtx *inner)
 {
-  if ((GET_CODE (*inner) == MULT || GET_CODE (*inner) == ASHIFT)
+  if ((GET_CODE (*inner) == MULT || GET_CODE (*inner) == ASHIFT
+   || GET_CODE (*inner) == ASHIFTRT || GET_CODE (*inner) == LSHIFTRT)
CONSTANT_P (XEXP (*inner, 1)))
 inner = strip_address_mutations (XEXP (*inner, 0));
   gcc_checking_assert (REG_P (*inner)


[Patch, AArch64, ILP32] Pad pointer-typed stack argument downward in ILP32

2013-06-27 Thread Yufeng Zhang
This patch fixes the bug that pointer-typed argument passed on stack is 
not padded properly in ILP32.


OK for the trunk?

Thanks,
Yufeng



gcc/

* config/aarch64/aarch64.c (aarch64_pad_arg_upward): In big-endian,
pad pointer-typed argument downward.

gcc/testsuite/

* gcc.target/aarch64/test-ptr-arg-on-stack-1.c: New test.


diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f78e0d6..79f8761 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1585,11 +1585,12 @@ aarch64_pad_arg_upward (enum machine_mode mode, 
const_tree type)
   if (!BYTES_BIG_ENDIAN)
 return true;
 
-  /* Otherwise, integral types and floating point types are padded downward:
+  /* Otherwise, integral, floating-point and pointer types are padded downward:
  the least significant byte of a stack argument is passed at the highest
  byte address of the stack slot.  */
   if (type
-  ? (INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type))
+  ? (INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type)
+|| POINTER_TYPE_P (type))
   : (SCALAR_INT_MODE_P (mode) || SCALAR_FLOAT_MODE_P (mode)))
 return false;
 
diff --git a/gcc/testsuite/gcc.target/aarch64/test-ptr-arg-on-stack-1.c 
b/gcc/testsuite/gcc.target/aarch64/test-ptr-arg-on-stack-1.c
new file mode 100644
index 000..bb68e0a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/test-ptr-arg-on-stack-1.c
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options -O2 -fno-inline } */
+
+/* Test pass-by-reference and pointer-typed argument passing on stack.
+   This test shall pass on any of the following four combinitions:
+{big-endian, little-endian} {LP64, ILP32}.  */
+
+struct s5
+{
+  double a;
+  double b;
+  double c;
+  double d;
+  double e;
+} gS = {1.0, 2.0, 3.0, 4.0, 5.0};
+
+double  __attribute__ ((noinline))
+foo (struct s5 p1, struct s5 p2, struct s5 p3, struct s5 p4,
+ struct s5 p5, struct s5 p6, struct s5 p7, struct s5 p8,
+ struct s5 p9)
+{
+  asm ();
+  return p9.c;
+}
+
+void abort (void);
+int printf (const char *, ...);
+
+int main (void)
+{
+  printf (Here we print out some values and more importantly hope that
+  the stack is getting a bit dirty for the bug to manifest itself
+ \n\t%f, %f, %f, %f, %f\n, gS.a, gS.b, gS.c, gS.d, gS.e);
+
+  if (foo (gS, gS, gS, gS, gS, gS, gS, gS, gS) != 3.0)
+abort ();
+
+  return 0;
+}

Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Jakub Jelinek
On Thu, Jun 27, 2013 at 05:54:10PM +0200, Marc Glisse wrote:
 I don't really see why, as I am still calling c_build_vec_perm_expr
 in the same cases, just possibly not exactly with the same arguments
 (they don't go through build_non_dependent_expr, but Jason seemed to
 imply that it did not matter since we don't look too deep through
 the arguments).

I guess you're right.  If the c_* routine doesn't mind C++ specific trees
and just cares about their types and pt.c then instantiates it, then it is
fine.

Jakub


Re: patch to build GCC for arm with LRA

2013-06-27 Thread Richard Sandiford
Vladimir Makarov vmaka...@redhat.com writes:
 Richard, is it ok to commit to the trunk?

Looks good to me, but I gave up the right to approve it.  I think you
need ROTATERT too though (see arm_legitimate_index_p).

Also, sorry for the nitpick, but once the full condition overflows one line,
I think each == test should be on its own line.

Thanks,
Richard


patch to fix a bug in LRA hard reg splitting

2013-06-27 Thread Vladimir Makarov
The following patch fixes a LRA bug for some experimental target. 
Sorry, there is no a test case and the bug can not be reproduced by
other people until the target is made public. 

The patch was successfully bootstrapped and tested on x86/x86-64.

Committed as rev. 200475.

2013-06-27  Vladimir Makarov  vmaka...@redhat.com

* lra-constraints.c (inherit_in_ebb): Process static hard regs
too.  Process OP_INOUT regs for splitting too.

Index: lra-constraints.c
===
--- lra-constraints.c	(revision 200425)
+++ lra-constraints.c	(working copy)
@@ -4762,76 +4762,81 @@ inherit_in_ebb (rtx head, rtx tail)
 	}
   else if (INSN_P (curr_insn))
 	{
+	  int iter;
 	  int max_uid = get_max_uid ();
 
 	  curr_id = lra_get_insn_recog_data (curr_insn);
+	  curr_static_id = curr_id-insn_static_data;
 	  to_inherit_num = 0;
 	  /* Process insn definitions.	*/
-	  for (reg = curr_id-regs; reg != NULL; reg = reg-next)
-	if (reg-type != OP_IN
-		 (dst_regno = reg-regno)  lra_constraint_new_regno_start)
-	  {
-		if (dst_regno = FIRST_PSEUDO_REGISTER  reg-type == OP_OUT
-		 reg_renumber[dst_regno]  0  ! reg-subreg_p
-		 usage_insns[dst_regno].check == curr_usage_insns_check
-		 (next_usage_insns
-			= usage_insns[dst_regno].insns) != NULL_RTX)
-		  {
-		struct lra_insn_reg *r;
+	  for (iter = 0; iter  2; iter++)
+	for (reg = iter == 0 ? curr_id-regs : curr_static_id-hard_regs;
+		 reg != NULL;
+		 reg = reg-next)
+	  if (reg-type != OP_IN
+		   (dst_regno = reg-regno)  lra_constraint_new_regno_start)
+		{
+		  if (dst_regno = FIRST_PSEUDO_REGISTER  reg-type == OP_OUT
+		   reg_renumber[dst_regno]  0  ! reg-subreg_p
+		   usage_insns[dst_regno].check == curr_usage_insns_check
+		   (next_usage_insns
+			  = usage_insns[dst_regno].insns) != NULL_RTX)
+		{
+		  struct lra_insn_reg *r;
 
-		for (r = curr_id-regs; r != NULL; r = r-next)
-		  if (r-type != OP_OUT  r-regno == dst_regno)
-			break;
-		/* Don't do inheritance if the pseudo is also
-		   used in the insn.  */
-		if (r == NULL)
-		  /* We can not do inheritance right now
-			 because the current insn reg info (chain
-			 regs) can change after that.  */
-		  add_to_inherit (dst_regno, next_usage_insns);
-		  }
-		/* We can not process one reg twice here because of
-		   usage_insns invalidation.  */
-		if ((dst_regno  FIRST_PSEUDO_REGISTER
-		 || reg_renumber[dst_regno] = 0)
-		 ! reg-subreg_p  reg-type == OP_OUT)
-		  {
-		HARD_REG_SET s;
+		  for (r = curr_id-regs; r != NULL; r = r-next)
+			if (r-type != OP_OUT  r-regno == dst_regno)
+			  break;
+		  /* Don't do inheritance if the pseudo is also
+			 used in the insn.  */
+		  if (r == NULL)
+			/* We can not do inheritance right now
+			   because the current insn reg info (chain
+			   regs) can change after that.  */
+			add_to_inherit (dst_regno, next_usage_insns);
+		}
+		  /* We can not process one reg twice here because of
+		 usage_insns invalidation.  */
+		  if ((dst_regno  FIRST_PSEUDO_REGISTER
+		   || reg_renumber[dst_regno] = 0)
+		 ! reg-subreg_p  reg-type != OP_IN)
+		{
+		  HARD_REG_SET s;
 
-		if (split_if_necessary (dst_regno, reg-biggest_mode,
-	potential_reload_hard_regs,
-	false, curr_insn, max_uid))
-		  change_p = true;
-		CLEAR_HARD_REG_SET (s);
-		if (dst_regno  FIRST_PSEUDO_REGISTER)
-		  add_to_hard_reg_set (s, reg-biggest_mode, dst_regno);
-		else
-		  add_to_hard_reg_set (s, PSEUDO_REGNO_MODE (dst_regno),
-	   reg_renumber[dst_regno]);
-		AND_COMPL_HARD_REG_SET (live_hard_regs, s);
-		  }
-		/* We should invalidate potential inheritance or
-		   splitting for the current insn usages to the next
-		   usage insns (see code below) as the output pseudo
-		   prevents this.  */
-		if ((dst_regno = FIRST_PSEUDO_REGISTER
-		  reg_renumber[dst_regno]  0)
-		|| (reg-type == OP_OUT  ! reg-subreg_p
-			 (dst_regno  FIRST_PSEUDO_REGISTER
-			|| reg_renumber[dst_regno] = 0)))
-		  {
-		/* Invalidate and mark definitions.  */
-		if (dst_regno = FIRST_PSEUDO_REGISTER)
-		  usage_insns[dst_regno].check = -(int) INSN_UID (curr_insn);
-		else
-		  {
-			nregs = hard_regno_nregs[dst_regno][reg-biggest_mode];
-			for (i = 0; i  nregs; i++)
-			  usage_insns[dst_regno + i].check
-			= -(int) INSN_UID (curr_insn);
-		  }
-		  }
-	  }
+		  if (split_if_necessary (dst_regno, reg-biggest_mode,
+	  potential_reload_hard_regs,
+	  false, curr_insn, max_uid))
+			change_p = true;
+		  CLEAR_HARD_REG_SET (s);
+		  if (dst_regno  FIRST_PSEUDO_REGISTER)
+			add_to_hard_reg_set (s, reg-biggest_mode, dst_regno);
+		  else
+			add_to_hard_reg_set (s, PSEUDO_REGNO_MODE (dst_regno),
+	 reg_renumber[dst_regno]);
+		  AND_COMPL_HARD_REG_SET (live_hard_regs, s);
+		}
+		  /* We 

Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Marc Glisse

On Thu, 27 Jun 2013, Jakub Jelinek wrote:


On Thu, Jun 27, 2013 at 05:54:10PM +0200, Marc Glisse wrote:

I don't really see why, as I am still calling c_build_vec_perm_expr
in the same cases, just possibly not exactly with the same arguments
(they don't go through build_non_dependent_expr, but Jason seemed to
imply that it did not matter since we don't look too deep through
the arguments).


I guess you're right.  If the c_* routine doesn't mind C++ specific trees
and just cares about their types and pt.c then instantiates it, then it is
fine.


Even if both are fine, if you prefer the long version (safer, or more 
uniform with the rest), please say so, I don't mind.


--
Marc Glisse


Re: [PATCH, i386, PR57623] Introduce _bextr (single underscore) intrinsucs

2013-06-27 Thread Richard Henderson
On 06/24/2013 01:55 AM, Kirill Yukhin wrote:
  extern __inline unsigned long long __attribute__((__gnu_inline__, 
 __always_inline__, __artificial__))
 +_bextr_u64 (unsigned long long __X, unsigned long long __Y, unsigned long 
 long __Z)
 +{
 +  return __builtin_ia32_bextr_u64 (__X, ((__Y  0xff) | ((__Z  0xff)  
 8)));
 +}
 +

The __Y and __Z arguments have the wrong type, according to the intel manual:

 extern unsigned __int64 _bextr_u64(unsigned __int64 s1, unsigned int 
 start_bit, unsigned int len_in_bits);

The patch is ok with that fixed.


r~


RFA: patch to build GCC for arm with LRA

2013-06-27 Thread Vladimir Makarov
On 06/27/2013 12:15 PM, Richard Sandiford wrote:
 Vladimir Makarov vmaka...@redhat.com writes:
 Richard, is it ok to commit to the trunk?
 Looks good to me, but I gave up the right to approve it.  I think you
 need ROTATERT too though (see arm_legitimate_index_p).

 Also, sorry for the nitpick, but once the full condition overflows one line,
 I think each == test should be on its own line.


Thanks for the comments.  Here is the new version of the patch:

2013-06-27  Vladimir Makarov  vmaka...@redhat.com

* rtlanal.c (must_be_index_p, set_address_index): Add ASHIFTRT,
LSHIFTRT, and ROTATERT.

Index: rtlanal.c
===
--- rtlanal.c	(revision 200174)
+++ rtlanal.c	(working copy)
@@ -5480,7 +5480,11 @@ must_be_base_p (rtx x)
 static bool
 must_be_index_p (rtx x)
 {
-  return GET_CODE (x) == MULT || GET_CODE (x) == ASHIFT;
+  return (GET_CODE (x) == MULT
+	  || GET_CODE (x) == ASHIFT
+	  || GET_CODE (x) == ASHIFTRT
+	  || GET_CODE (x) == LSHIFTRT
+	  || GET_CODE (x) == ROTATERT);
 }
 
 /* Set the segment part of address INFO to LOC, given that INNER is the
@@ -5519,7 +5523,11 @@ set_address_base (struct address_info *i
 static void
 set_address_index (struct address_info *info, rtx *loc, rtx *inner)
 {
-  if ((GET_CODE (*inner) == MULT || GET_CODE (*inner) == ASHIFT)
+  if ((GET_CODE (*inner) == MULT
+   || GET_CODE (*inner) == ASHIFT
+   || GET_CODE (*inner) == ASHIFTRT
+   || GET_CODE (*inner) == LSHIFTRT
+   || GET_CODE (*inner) == ROTATERT)
CONSTANT_P (XEXP (*inner, 1)))
 inner = strip_address_mutations (XEXP (*inner, 0));
   gcc_checking_assert (REG_P (*inner)


Re: [PATCH] Fix up bzhi (PR target/57623)

2013-06-27 Thread Richard Henderson
On 06/27/2013 07:40 AM, Jakub Jelinek wrote:
 2013-06-27  Jakub Jelinek  ja...@redhat.com
 
   PR target/57623
   * config/i386/i386.md (bmi2_bzhi_mode3): Swap AND arguments
   to match RTL canonicalization.  Swap predicates and
   constraints of operand 1 and 2.
 
   * gcc.target/i386/bmi2-bzhi-1.c: New test.

Ok.


r~


Re: RFA: patch to build GCC for arm with LRA

2013-06-27 Thread Richard Earnshaw

On 27/06/13 17:32, Vladimir Makarov wrote:

On 06/27/2013 12:15 PM, Richard Sandiford wrote:

Vladimir Makarov vmaka...@redhat.com writes:

Richard, is it ok to commit to the trunk?

Looks good to me, but I gave up the right to approve it.  I think you
need ROTATERT too though (see arm_legitimate_index_p).

Also, sorry for the nitpick, but once the full condition overflows one line,
I think each == test should be on its own line.



Thanks for the comments.  Here is the new version of the patch:

2013-06-27  Vladimir Makarov  vmaka...@redhat.com

 * rtlanal.c (must_be_index_p, set_address_index): Add ASHIFTRT,
 LSHIFTRT, and ROTATERT.



Although it's not needed for ARM, why would you leave out ROTATE?

Hmm, on second thoughts ROTATERT immediate is always canonicalized to 
ROTATE (Pmode-size - imm), so it might be needed on ARM too.


R.



arm2.patch


Index: rtlanal.c
===
--- rtlanal.c   (revision 200174)
+++ rtlanal.c   (working copy)
@@ -5480,7 +5480,11 @@ must_be_base_p (rtx x)
  static bool
  must_be_index_p (rtx x)
  {
-  return GET_CODE (x) == MULT || GET_CODE (x) == ASHIFT;
+  return (GET_CODE (x) == MULT
+ || GET_CODE (x) == ASHIFT
+ || GET_CODE (x) == ASHIFTRT
+ || GET_CODE (x) == LSHIFTRT
+ || GET_CODE (x) == ROTATERT);
  }

  /* Set the segment part of address INFO to LOC, given that INNER is the
@@ -5519,7 +5523,11 @@ set_address_base (struct address_info *i
  static void
  set_address_index (struct address_info *info, rtx *loc, rtx *inner)
  {
-  if ((GET_CODE (*inner) == MULT || GET_CODE (*inner) == ASHIFT)
+  if ((GET_CODE (*inner) == MULT
+   || GET_CODE (*inner) == ASHIFT
+   || GET_CODE (*inner) == ASHIFTRT
+   || GET_CODE (*inner) == LSHIFTRT
+   || GET_CODE (*inner) == ROTATERT)
 CONSTANT_P (XEXP (*inner, 1)))
  inner = strip_address_mutations (XEXP (*inner, 0));
gcc_checking_assert (REG_P (*inner)






Re: RFA: patch to build GCC for arm with LRA

2013-06-27 Thread Vladimir Makarov
On 06/27/2013 12:50 PM, Richard Earnshaw wrote:
 On 27/06/13 17:32, Vladimir Makarov wrote:
 On 06/27/2013 12:15 PM, Richard Sandiford wrote:
 Vladimir Makarov vmaka...@redhat.com writes:
 Richard, is it ok to commit to the trunk?
 Looks good to me, but I gave up the right to approve it.  I think you
 need ROTATERT too though (see arm_legitimate_index_p).

 Also, sorry for the nitpick, but once the full condition overflows
 one line,
 I think each == test should be on its own line.


 Thanks for the comments.  Here is the new version of the patch:

 2013-06-27  Vladimir Makarov  vmaka...@redhat.com

  * rtlanal.c (must_be_index_p, set_address_index): Add ASHIFTRT,
  LSHIFTRT, and ROTATERT.


 Although it's not needed for ARM, why would you leave out ROTATE?

 Hmm, on second thoughts ROTATERT immediate is always canonicalized to
 ROTATE (Pmode-size - imm), so it might be needed on ARM too.
Thanks, Richard.  I guess we can include ROTATE.  It definitely will not
hurt but it might be useful for other targets too.

So I added ROTATE to the patch and like to get approval for it too.



Re: RFA: patch to build GCC for arm with LRA

2013-06-27 Thread Richard Earnshaw

On 27/06/13 17:59, Vladimir Makarov wrote:

On 06/27/2013 12:50 PM, Richard Earnshaw wrote:

On 27/06/13 17:32, Vladimir Makarov wrote:

On 06/27/2013 12:15 PM, Richard Sandiford wrote:

Vladimir Makarov vmaka...@redhat.com writes:

Richard, is it ok to commit to the trunk?

Looks good to me, but I gave up the right to approve it.  I think you
need ROTATERT too though (see arm_legitimate_index_p).

Also, sorry for the nitpick, but once the full condition overflows
one line,
I think each == test should be on its own line.



Thanks for the comments.  Here is the new version of the patch:

2013-06-27  Vladimir Makarov  vmaka...@redhat.com

  * rtlanal.c (must_be_index_p, set_address_index): Add ASHIFTRT,
  LSHIFTRT, and ROTATERT.



Although it's not needed for ARM, why would you leave out ROTATE?

Hmm, on second thoughts ROTATERT immediate is always canonicalized to
ROTATE (Pmode-size - imm), so it might be needed on ARM too.

Thanks, Richard.  I guess we can include ROTATE.  It definitely will not
hurt but it might be useful for other targets too.

So I added ROTATE to the patch and like to get approval for it too.




Oh, and another thought, AArch64 will probably need ZERO_EXTEND and 
SIGN_EXTEND as well.


R.



Fix PR middle-end/57370

2013-06-27 Thread Easwaran Raman
A newly generated statement in build_and_add_sum  function of
tree-ssa-reassoc.c has to be assigned the UID of its adjacent
statement. In one instance, it was assigned the wrong uid (of an
earlier phi statement) which messed up the IR and caused the test
program to hang. Bootstraps and no test regressions on x86_64/linux.
Ok for trunk?

Thanks,
Easwaran


2013-06-27  Easwaran Raman  era...@google.com

PR middle-end/57370
* tree-ssa-reassoc.c (build_and_add_sum): Do not use the UID of a phi
node for a non-phi gimple statement.

testsuite/ChangeLog:
2013-06-27  Easwaran Raman  era...@google.com

PR middle-end/57370
* gfortran.dg/reassoc_12.f90: New testcase.


Index: gcc/testsuite/gfortran.dg/reassoc_12.f90
===
--- gcc/testsuite/gfortran.dg/reassoc_12.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/reassoc_12.f90 (revision 0)
@@ -0,0 +1,74 @@
+! { dg-do compile }
+! { dg-options -O2 -ffast-math }
+! PR middle-end/57370
+
+ SUBROUTINE xb88_lr_adiabatic_lda_calc(e_ndrho_ndrho_ndrho, 
+   grad_deriv,npoints, sx)
+IMPLICIT REAL*8 (t)
+INTEGER, PARAMETER :: dp=8
+REAL(kind=dp), DIMENSION(1:npoints) :: e_ndrho_ndrho_ndrho, 
+   e_ndrho_ndrho_rho
+  DO ii=1,npoints
+  IF( grad_deriv = 2 .OR. grad_deriv == -2 ) THEN
+t1425 = t233 * t557
+t1429 = beta * t225
+t1622 = t327 * t1621
+t1626 = t327 * t1625
+t1632 = t327 * t1631
+t1685 = t105 * t1684
+t2057 = t1636 + t8 * (t2635 + t3288)
+  END IF
+  IF( grad_deriv = 3 .OR. grad_deriv == -3 ) THEN
+t5469 = t5440 - t5443 - t5446 - t5449 - 
+t5451 - t5454 - t5456 + t5459  - 
+t5462 + t5466 - t5468
+t5478 = 0.240e2_dp * t1616 * t973 * t645 * t1425
+t5489 = 0.16e2_dp * t1429 * t1658
+t5531 = 0.160e2_dp * t112 * t1626
+t5533 = 0.160e2_dp * t112 * t1632
+t5537 = 0.160e2_dp * t112 * t1622
+t5541 = t5472 - t5478 - t5523 + t5525 + 
+t5531 + t5533 + t5535 + t5537 + 
+t5540
+t5565 = t112 * t1685
+t5575 = t5545 - t5548 + t5551 + t5553 - 
+t5558 + t5560 - t5562 + t5564 - 
+0.80e1_dp * t5565 + t5568 + t5572 + 
+t5574
+t5611 = t5579 - t5585 + t5590 - t5595 + 
+t5597 - t5602 + t5604 + t5607 + 
+t5610
+t5613 = t5469 + t5541 + t5575 + t5611
+t6223 = t6189 - 
+0.36e0_dp  * t83 * t84 * t5613 + 
+t6222
+t6227 = - t8 * (t5305 + t6223)
+e_ndrho_ndrho_rho(ii) = e_ndrho_ndrho_rho(ii) + 
+ t6227 * sx
+t6352 = t5440 - t5443 - t5446 - t5449 - 
+t5451 - t5454 + 
+0.40e1_dp * t102  * t327 * t2057 * t557 - 
+t5456 + t5459 - t5462 + t5466 - 
+t5468
+t6363 = t5480 - t5489 + 
+0.96e2_dp  * t1054 * t640 * t3679
+t6367 = t5472 - t5474 - t5478 - t5523 + 
+t5525 + t5531 + t5533 + t5535 + 
+t5537 - 0.20e1_dp * t102 * t105 * t6363 + 
+t5540
+t6370 = t5545 - t5548 + t5551 + t5553 - 
+t5558 + t5560 - t5562 + t5564  - 
+0.40e1_dp * t5565 + 
+t5568 + t5572 + t5574
+t6373 = t5579 - t5585 + t5590 - t5595 + 
+t5597 - t5602 + t5604 + t5607 + 
+t5610
+t6375 = t6352 + t6367 + t6370 + t6373
+t6380 = - 0.36e0_dp * t83 * t84 * t6375 + t5701
+t6669 = -t4704 - t8 * (t6344 + t6380 + t6665)
+e_ndrho_ndrho_ndrho(ii) = e_ndrho_ndrho_ndrho(ii) + 
+ t6669 * sx
+  END IF
+  END DO
+  END SUBROUTINE xb88_lr_adiabatic_lda_calc
+
Index: gcc/tree-ssa-reassoc.c
===
--- gcc/tree-ssa-reassoc.c(revision 200429)
+++ gcc/tree-ssa-reassoc.c(working copy)
@@ -1207,7 +1207,7 @@ build_and_add_sum (tree type, tree op1, tree op2,
   if (gimple_code (op1def) == GIMPLE_PHI)
 {
   gsi = gsi_after_labels (gimple_bb (op1def));
-   gimple_set_uid (sum, gimple_uid (op1def));
+  gimple_set_uid (sum, gimple_uid (gsi_stmt (gsi)));
   gsi_insert_before (gsi, sum, GSI_NEW_STMT);
 }
   else


Re: RFA: patch to build GCC for arm with LRA

2013-06-27 Thread Vladimir Makarov
On 06/27/2013 01:10 PM, Richard Earnshaw wrote:
 On 27/06/13 17:59, Vladimir Makarov wrote:
 On 06/27/2013 12:50 PM, Richard Earnshaw wrote:
 On 27/06/13 17:32, Vladimir Makarov wrote:
 On 06/27/2013 12:15 PM, Richard Sandiford wrote:
 Vladimir Makarov vmaka...@redhat.com writes:
 Richard, is it ok to commit to the trunk?
 Looks good to me, but I gave up the right to approve it.  I think you
 need ROTATERT too though (see arm_legitimate_index_p).

 Also, sorry for the nitpick, but once the full condition overflows
 one line,
 I think each == test should be on its own line.


 Thanks for the comments.  Here is the new version of the patch:

 2013-06-27  Vladimir Makarov  vmaka...@redhat.com

   * rtlanal.c (must_be_index_p, set_address_index): Add
 ASHIFTRT,
   LSHIFTRT, and ROTATERT.


 Although it's not needed for ARM, why would you leave out ROTATE?

 Hmm, on second thoughts ROTATERT immediate is always canonicalized to
 ROTATE (Pmode-size - imm), so it might be needed on ARM too.
 Thanks, Richard.  I guess we can include ROTATE.  It definitely will not
 hurt but it might be useful for other targets too.

 So I added ROTATE to the patch and like to get approval for it too.



 Oh, and another thought, AArch64 will probably need ZERO_EXTEND and
 SIGN_EXTEND as well.

It is already implemented as many targets use it.


Re: [c++-concepts] requires expression semantics

2013-06-27 Thread Jason Merrill

On 06/25/2013 09:27 AM, Andrew Sutton wrote:

+/* The REQ expressions are unary expressions that specific inididual


specify?


+/* A unary expression representing a requirement for an expression that
+   may be evaluated at compile time. */


The word may is ambiguous and should be avoided in favor of might or 
can.


Judging from the implementation, it seems that this relies on the notion 
of potentially-constant expression which is no longer part of the 
standard; that notion should only be used for diagnostics that are not 
required, not for things that participate in the type system.


I think it would be better to have a requirement that a particular 
expression instantiate into an actual constant expression.



+  // Note that vlaidtype requirements are implicit.


validtype


+  // Pretty print the '- type-id' part of the expression.
+  // Note that treq will contain a TRAIT_EXPR.
+  tree type = TRAIT_EXPR_TYPE2 (TREE_VALUE (treq));


This seems to assume that there is a result-type-requirement.


+// Returns true if type1 can be implicitly converted to type2.
+static inline bool
+convertible_to_p (tree type1, tree type2)
+{
+  // Build a fake conversion expression to force the lookup of user
+  // defined conversion sequences.
+  tree expr = build_min (CAST_EXPR, type1);
+  return can_convert_arg (type2, type1, expr, LOOKUP_IMPLICIT, tf_none);
+}


Can't you use can_convert instead of a new function?


+  // Modify the declared parameters by removing their context (so they
+  // don't refer to the enclosing scope), and making the constant (so
+  // we can actually check constexpr properties).


marking them?

Does this actually work?


+build_check_expr (tree_code c, tree t)
+{
+  tree r = build_min (c, boolean_type_node, t);
+  TREE_SIDE_EFFECTS (r) = false;
+  TREE_READONLY (r) = true;
+  TREE_CONSTANT (r) = true;


TREE_READONLY isn't meaningful on rvalue expressions.


+  return truth_node (expr  EXPR_P (expr)  TYPE_P (TREE_TYPE (expr)));


This excludes expressions that just name a declaration.  I would expect
'expr  expr != error_mark_node' to do the right thing; was the 
TREE_TYPE check motivated by anything in particular?


Jason



Re: [Patch] microMIPS cleanups

2013-06-27 Thread Richard Sandiford
Moore, Catherine catherine_mo...@mentor.com writes:
 2013-06-27  Catherine Moore c...@codesourcery.com
 
   * config/mips/mips-tables.opt: Regenerate.
   * config/mips/mips-cpus.def: Add m14ke and m14kec.
   * config/mips/mips.h (BASE_DRIVER_SELF_SPECS): m14ke* implies
   -mdspr2.
   * doc/invoke.texi: Add -m14kc.

OK, thanks.

Richard


SSA identifiers

2013-06-27 Thread Andrew MacLeod
I'm doing some trial file conversions to my proposed wrapper classes,  
I'm seeing a couple of places which aren't mapping properly (they 
triggered compile errors),  and I think its  because there is a couple 
of bugs regarding  the use of IDENTIFIERS in ssanames..   (I wasn't even 
aware you could have non-var_decls...) so this is just a sanity check :-)



the macros are defined as:

/* Returns the IDENTIFIER_NODE giving the SSA name a name or NULL_TREE
   if there is no name associated with it.  */
#define SSA_NAME_IDENTIFIER(NODE)   \
  (SSA_NAME_CHECK (NODE)-ssa_name.var != NULL_TREE \
   ? (TREE_CODE ((NODE)-ssa_name.var) == IDENTIFIER_NODE   \
  ? (NODE)-ssa_name.var\
  : DECL_NAME ((NODE)-ssa_name.var))   \
   : NULL_TREE)

/* Returns the variable being referenced.  This can be NULL_TREE for
   temporaries not associated with any user variable.
   Once released, this is the only field that can be relied upon. */
#define SSA_NAME_VAR(NODE)  \
  (SSA_NAME_CHECK (NODE)-ssa_name.var == NULL_TREE \
   || TREE_CODE ((NODE)-ssa_name.var) == IDENTIFIER_NODE   \
   ? NULL_TREE : (NODE)-ssa_name.var)

#define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \
  do { SSA_NAME_CHECK (NODE)-ssa_name.var = (VAR); } while (0)


in tree-ssanames.c:release_ssa_names() :

if (! SSA_NAME_IN_FREE_LIST (var))
{
  tree saved_ssa_name_var = SSA_NAME_VAR (var);
  int saved_ssa_name_version = SSA_NAME_VERSION (var);
  use_operand_p imm = (SSA_NAME_IMM_USE_NODE (var));
..
/* Hopefully this can go away once we have the new incremental
 SSA updating code installed.  */
  SET_SSA_NAME_VAR_OR_IDENTIFIER (var, saved_ssa_name_var);

It would seem to me that if the identifier is set rather than the 
vardecl, it is not going  to be reset properly here since the saved 
value is going to be NULL rather than the identifier node...Or does 
it really matter here? Its not really clear to me.



in tree-outof-ssa.c:insert_backedge_copies() :

for (i = 0; i  gimple_phi_num_args (phi); i++)
{
  tree arg = gimple_phi_arg_def (phi, i);
  edge e = gimple_phi_arg_edge (phi, i);

  /* If the argument is not an SSA_NAME, then we will need a
 constant initialization.  If the argument is an 
SSA_NAME with
 a different underlying variable then a copy statement 
will be

 needed.  */
  if ((e-flags  EDGE_DFS_BACK)
   (TREE_CODE (arg) != SSA_NAME
  || SSA_NAME_VAR (arg) != SSA_NAME_VAR (result)
  || trivially_conflicts_p (bb, result, arg)))

If both SSA_NAMEs have an identifier, then   SSA_NAME_VAR(arg) != 
SSA_NAME_VAR(result)   is going to compare NULL_TREE != NULL_TREE every 
time...


 I would say its really looking to compare that underlying field
TREE_CODE ((arg)-ssa_name.var != TREE_CODE ((result)-ssa_name.var

They could both be resolved by adding an equivalent
#define SSA_NAME_VAR_OR_IDENTIFIER(NODE  (SSA_NAME_CHECK 
(NODE)-ssa_name.var)
and using that macro instead of SSA_NAME_VAR.. and  probably more 
efficient.  something like that attached, which bootstraps but I haven't 
done a full testrun yet...


Or perhaps even just use SSA_NAME_IDENTIFIER in both cases would 
work...  seems dangerous if 2 different decls have the same identifier tho.


It is interesting how these 2 cases just popped up as errors building 
during the conversion of those files...  Early tangible benefit? :-)


Andrew



* tree.h (SSA_NAME_VAR_OR_IDENTIFIER): New.
* tree-ssanames.c: Use instead of SSA_NAME_VAR.
* tree-outof-ssa.c: Use instead of SSA_NAME_VAR.

Index: tree.h
===
--- tree.h  (revision 196663)
+++ tree.h  (working copy)
@@ -1917,6 +1918,8 @@
|| TREE_CODE ((NODE)-ssa_name.var) == IDENTIFIER_NODE  \
? NULL_TREE : (NODE)-ssa_name.var)
 
+#define SSA_NAME_VAR_OR_IDENTIFIER(NODE) (SSA_NAME_CHECK (NODE)-ssa_name.var)
+
 #define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \
   do { SSA_NAME_CHECK (NODE)-ssa_name.var = (VAR); } while (0)
 
Index: tree-ssanames.c
===
--- tree-ssanames.c (revision 195512)
+++ tree-ssanames.c (working copy)
@@ -200,7 +200,7 @@
  defining statement.  */
   if (! SSA_NAME_IN_FREE_LIST (var))
 {
-  tree saved_ssa_name_var = SSA_NAME_VAR (var);
+  tree saved_ssa_name_var = SSA_NAME_VAR_OR_IDENTIFIER (var);
   int saved_ssa_name_version = SSA_NAME_VERSION (var);
   use_operand_p imm = (SSA_NAME_IMM_USE_NODE (var));
 
Index: tree-outof-ssa.c
===
--- tree-outof-ssa.c(revision 195512)
+++ tree-outof-ssa.c(working copy)
@@ 

Re: SSA identifiers

2013-06-27 Thread Jakub Jelinek
On Thu, Jun 27, 2013 at 02:25:21PM -0400, Andrew MacLeod wrote:
 I'm doing some trial file conversions to my proposed wrapper
 classes,  I'm seeing a couple of places which aren't mapping
 properly (they triggered compile errors),  and I think its  because
 there is a couple of bugs regarding  the use of IDENTIFIERS in
 ssanames..   (I wasn't even aware you could have non-var_decls...)
 so this is just a sanity check :-)

If ssa_name.var is IDENTIFIER_NODE, it is just like ssa_name.var == NULL,
i.e. anonymous SSA_NAME, just that in the dumps it is given some name
and not just _NNN.

 in tree-ssanames.c:release_ssa_names() :
 
 if (! SSA_NAME_IN_FREE_LIST (var))
 {
   tree saved_ssa_name_var = SSA_NAME_VAR (var);
   int saved_ssa_name_version = SSA_NAME_VERSION (var);
   use_operand_p imm = (SSA_NAME_IMM_USE_NODE (var));
 ..
 /* Hopefully this can go away once we have the new incremental
  SSA updating code installed.  */
   SET_SSA_NAME_VAR_OR_IDENTIFIER (var, saved_ssa_name_var);

I don't see a big issue with this, sure, you could
tree saved_ssa_name_identifier = saved_ssa_name_var ? saved_ssa_name_var : 
SSA_NAME_IDENTIFIER (var);
and use that instead in SET_SSA_NAME_VAR_OR_IDENTIFIER.

Jakub


Re: [Patch, AArch64, ILP32] 5/5 Define _ILP32 and __ILP32__

2013-06-27 Thread Yufeng Zhang

On 06/27/13 01:56, Joseph S. Myers wrote:

On Wed, 26 Jun 2013, Yufeng Zhang wrote:


This patch defines _ILP32 and __ILP32__ for the AArch64 port when the ILP32
ABI is in use.

This helps libraries, e.g. libgloss and glibc, recognize which model is being
compiled.


GCC already defines _LP64 and __LP64__ in architecture-independent code
for LP64 systems.  Libraries can use those to distinguish the two models
for AArch64, so I don't see any need to add architecture-specific macros
with the opposite sense.


We need a reliable way to tell we are compiling for ILP32.  On one hand 
LLP64 support may be added in the future; on the other hand, not all 
AArch64 compilers may define _LP64 and __LP64__.


Other ports like x86_64, ia64-hpux and pa-hpux also define one or both.

Thanks,
Yufeng




Re: SSA identifiers

2013-06-27 Thread Andrew MacLeod

On 06/27/2013 02:39 PM, Jakub Jelinek wrote:


in tree-ssanames.c:release_ssa_names() :

if (! SSA_NAME_IN_FREE_LIST (var))
 {
   tree saved_ssa_name_var = SSA_NAME_VAR (var);
   int saved_ssa_name_version = SSA_NAME_VERSION (var);
   use_operand_p imm = (SSA_NAME_IMM_USE_NODE (var));
..
/* Hopefully this can go away once we have the new incremental
  SSA updating code installed.  */
   SET_SSA_NAME_VAR_OR_IDENTIFIER (var, saved_ssa_name_var);
I don't see a big issue with this, sure, you could
tree saved_ssa_name_identifier = saved_ssa_name_var ? saved_ssa_name_var : 
SSA_NAME_IDENTIFIER (var);
and use that instead in SET_SSA_NAME_VAR_OR_IDENTIFIER.


Yeah I wasn't too concerned about this one, the outof-ssa case looked 
like more of a possible issue.  Maybe neither is, they just popped out 
as inconsistent uses.


Andrew



[patch, fortran] PR 50554 - redefinition of index variable with inquire(iolength=...)

2013-06-27 Thread Thomas Koenig

Hello world,

the attached patch raises an error if an index variable is redefined
with inquire(iolength=...).

OK for trunk?

Thomas

2013-06-27  Thomas Koenig  tkoe...@gcc.gnu.org

PR fortran/50554
* frontend-passes.c (doloop_code): Check do loop variables for
EXEC_IOLENGTH.
(do_function):  Whitespace fix.
(gfc_code_walker):  Handle EXEC_IOLENGTH.

2013-06-27  Thomas Koenig  tkoe...@gcc.gnu.org

PR fortran/50554
* gfortran.dg/do_check_9.f90:  New test.
! { dg-do compile }
! PR 50554 - error for index variable redefined by inquire (iolength=...)
program main
  implicit none
  integer :: i
  do i=1,10   ! { dg-error beginning at }
inquire (iolength=i) 'aa' ! { dg-error cannot be redefined }
  end do
end program main
Index: frontend-passes.c
===
--- frontend-passes.c	(Revision 200132)
+++ frontend-passes.c	(Arbeitskopie)
@@ -1615,6 +1615,7 @@ doloop_code (gfc_code **c, int *walk_subtrees ATTR
   int i;
   gfc_formal_arglist *f;
   gfc_actual_arglist *a;
+  gfc_symbol *do_sym;
 
   co = *c;
 
@@ -1654,8 +1655,6 @@ doloop_code (gfc_code **c, int *walk_subtrees ATTR
 	{
 	  for (i=0; idoloop_level; i++)
 	{
-	  gfc_symbol *do_sym;
-	  
 	  if (doloop_list[i] == NULL)
 		break;
 
@@ -1683,6 +1682,27 @@ doloop_code (gfc_code **c, int *walk_subtrees ATTR
 	}
   break;
 
+case EXEC_IOLENGTH:
+
+  for (i=0; idoloop_level; i++)
+	{
+	  gfc_expr *iolength;
+
+	  if (doloop_list[i] == NULL)
+	break;
+
+	  do_sym = doloop_list[i]-ext.iterator-var-symtree-n.sym;
+
+	  iolength = co-ext.inquire-iolength;
+	  if (iolength != NULL  iolength-symtree-n.sym == do_sym)
+	gfc_error_now (Variable '%s' at %L cannot be redefined 
+			   inside loop beginning at %L, do_sym-name,
+			   iolength-where, doloop_list[i]-loc);
+
+	}
+
+  break;
+
 default:
   break;
 }
@@ -1724,7 +1744,6 @@ do_function (gfc_expr **e, int *walk_subtrees ATTR
   for (i=0; idoloop_level; i++)
 	{
 	  gfc_symbol *do_sym;
-	 
 
 	  if (doloop_list[i] == NULL)
 	break;
@@ -2057,6 +2076,10 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code
 	  WALK_SUBEXPR (co-ext.inquire-round);
 	  break;
 
+	case EXEC_IOLENGTH:
+	  WALK_SUBEXPR (co-ext.inquire-iolength);
+	  break;
+
 	case EXEC_WAIT:
 	  WALK_SUBEXPR (co-ext.wait-unit);
 	  WALK_SUBEXPR (co-ext.wait-iostat);


Re: [PATCH][ARM][testsuite] Add 'dg-require-effective-target sync_*' to some atomic tests

2013-06-27 Thread Mike Stump
On Jun 12, 2013, at 9:46 AM, Meador Inge mead...@codesourcery.com wrote:
 This patch adds the needed 'dg-require-effective-target sync_*' lines to some
 of the atomic tests so that they will not be run if the appropriate atomic
 support is not available.
 
 OK for trunk?

Ok.

 2013-06-12  Meador Inge  mead...@codesourcery.com
 
   * gcc.dg/atomic-flag.c: Add dg-require-effective-target sync_*.
   * g++.dg/simulate-thread/atomics-2.C: Likewise.
   * g++.dg/simulate-thread/atomics-1.C: Likewise.
 
 gcc-atomic-tests.patch



Go patch committed: Improve error message

2013-06-27 Thread Ian Lance Taylor
This patch from Rémy Oudompheng improves an error message for an invalid
use of [...] in a variable declaration.  The error message said it was
in a type conversion, but it was not.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline and 4.8 branch.

Ian

diff -r 6412862fce26 go/parse.cc
--- a/go/parse.cc	Wed Jun 26 15:57:10 2013 -0700
+++ b/go/parse.cc	Thu Jun 27 12:17:15 2013 -0700
@@ -3040,7 +3040,7 @@
 		   t-array_type()-length()-is_nil_expression())
 		{
 		  error_at(ret-location(),
-			   invalid use of %...% in type conversion);
+			   use of %[...]% outside of array literal);
 		  ret = Expression::make_error(loc);
 		}
 	  else


Re: [Patch, AArch64, ILP32] 5/5 Define _ILP32 and __ILP32__

2013-06-27 Thread Joseph S. Myers
On Thu, 27 Jun 2013, Yufeng Zhang wrote:

 We need a reliable way to tell we are compiling for ILP32.  On one hand LLP64
 support may be added in the future; on the other hand, not all AArch64

If thinking of adding a third ABI, that suggests you should be using 
something along the lines of _MIPS_SIM - a macro that's always defined, 
with an integer value depending on the ABI in used.

 compilers may define _LP64 and __LP64__.

Why should all such compilers define the ILP32 macros, but not all define 
the LP64 macros?  Do you have an AArch64 equivalent of the ACLE that 
specifies such things?

 Other ports like x86_64, ia64-hpux and pa-hpux also define one or both.

If multiple ports define something, that might be an indication for 
defining it in target-independent code (like _LP64) rather than repeating 
it for more targets.  Although of course the macros __SIZEOF_INT__, 
__SIZEOF_LONG__, __SIZEOF_LONG_LONG__ and __SIZEOF_POINTER__ have been 
around for a long time, so new macros would just be for convenience (which 
may nevertheless be a sensible reason to define macros) at the expense of 
startup time.

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


Re: [PATCH] Improve __popcount?i2 (PR middle-end/36041)

2013-06-27 Thread Richard Henderson
On 06/27/2013 07:48 AM, Jakub Jelinek wrote:
 Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
 
 2013-06-27  Jakub Jelinek  ja...@redhat.com
 
   PR middle-end/36041
   * libgcc2.c (POPCOUNTCST2, POPCOUNTCST4, POPCOUNTCST8, POPCOUNTCST):
   Define.
   (__popcountSI2): For __SIZEOF_INT__  2 targets use arithmetics
   instead of table lookups.
   (__popcountDI2): Likewise.

Ok.


r~


Re: [x86] Remove 2 builtins

2013-06-27 Thread Richard Henderson
On 06/26/2013 07:22 AM, Marc Glisse wrote:
 Ping http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00478.html
 
 On Sun, 9 Jun 2013, Marc Glisse wrote:
 
 Hello,

 this patch removes 2 builtins that are undocumented, unused, and have
 confusing semantics. Bootstrap+testsuite on x86_64-linux-gnu.


 2013-06-10  Marc Glisse  marc.gli...@inria.fr

 PR target/57224
 * config/i386/i386.c (enum ix86_builtins, bdesc_args): Remove
 IX86_BUILTIN_CMPNGTSS and IX86_BUILTIN_CMPNGESS.


 

Ok.


r~


Go patch committed: Fix method sets with embedded pointer types

2013-06-27 Thread Ian Lance Taylor
This patch from Rémy Oudompheng fixes the handling of method sets for
structs with embedded pointer fields.  Any such methods can be value
methods of the struct, not just pointer methods.  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and 4.8
branch.

Ian

diff -r bd3d5e75023b go/types.cc
--- a/go/types.cc	Thu Jun 27 12:19:13 2013 -0700
+++ b/go/types.cc	Thu Jun 27 13:49:08 2013 -0700
@@ -9396,13 +9396,18 @@
 	fnt = pf-type()-deref()-named_type();
   go_assert(fnt != NULL);
 
+  // Methods with pointer receivers on embedded field are
+  // inherited by the pointer to struct, and also by the struct
+  // type if the field itself is a pointer.
+  bool can_be_pointer = (receiver_can_be_pointer
+			 || pf-type()-points_to() != NULL);
   int sublevel = level == NULL ? 1 : *level + 1;
   bool sub_is_method;
   std::string subambig1;
   std::string subambig2;
   bool subfound = Type::find_field_or_method(fnt,
 		 name,
-		 receiver_can_be_pointer,
+		 can_be_pointer,
 		 seen,
 		 sublevel,
 		 sub_is_method,


Re: [c++-concepts] requires expression semantics

2013-06-27 Thread Andrew Sutton
 Judging from the implementation, it seems that this relies on the notion of
 potentially-constant expression which is no longer part of the standard;
 that notion should only be used for diagnostics that are not required, not
 for things that participate in the type system.

 I think it would be better to have a requirement that a particular
 expression instantiate into an actual constant expression.

I was not aware of that. That's probably the right, but I remember
having some troubles getting that to work the way I wanted in the
previous implementation. It seemed like I actually had to evaluate the
expression to determine if it was actually constexpr.

Andrew


Re: [PATCH] Basic support for MIPS r5900

2013-06-27 Thread Richard Sandiford
Jürgen Urban juergenur...@gmx.de writes:
 Am 25.06.2013 um 23:24 schrieb Richard Sandiford rdsandif...@googlemail.com:
 Jürgen Urban juergenur...@gmx.de writes:
 Am 23.06.2013 um 22:21 schrieb Richard Sandiford
 Do you want to stick with 128-bit long doubles for PS2, or would you
 prefer to do what SDE does?
 
 I prefer shorter long doubles because of the performance impact. For 32
 bit hard float we may need it. Can you change it or do I need to submit
 a patch?
 
 OK, could you give this a go?

 I tested it and it is working as expected.

Now applied, thanks.

Richard


Re: [patch, fortran] PR 50554 - redefinition of index variable with inquire(iolength=...)

2013-06-27 Thread Tobias Burnus

Thomas Koenig wrote:

the attached patch raises an error if an index variable is redefined
with inquire(iolength=...).

* frontend-passes.c (doloop_code): Check do loop variables for
EXEC_IOLENGTH.


What's the advantage to place it into doloop_code rather than using - as 
Steve's patch in the PR - gfc_check_do_variable. Your version looks much 
more complicated, adding a special case for IOLENGTH. His version is 
already used, e.g., for match_out_tag in io.c - which is about nearly 
all intent(out) integer items in IO statements.


Actually, I wonder whether the following (untested) shouldn't be sufficient:

--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -3892,3 +3892,3 @@ match_inquire_element (gfc_inquire *inquire)
   RETM m = match_vtag (tag_s_decimal, inquire-decimal);
-  RETM m = match_vtag (tag_size, inquire-size);
+  RETM m = match_out_tag (tag_size, inquire-size);
   RETM m = match_vtag (tag_s_encoding, inquire-encoding);
@@ -3897,3 +3897,3 @@ match_inquire_element (gfc_inquire *inquire)
   RETM m = match_vtag (tag_s_pad, inquire-pad);
-  RETM m = match_vtag (tag_iolength, inquire-iolength);
+  RETM m = match_out_tag (tag_iolength, inquire-iolength);
   RETM m = match_vtag (tag_convert, inquire-convert);


Tobias


Re: [C++] Fix __builtin_shuffle

2013-06-27 Thread Marc Glisse

On Thu, 27 Jun 2013, Marc Glisse wrote:


On Thu, 27 Jun 2013, Jakub Jelinek wrote:


On Thu, Jun 27, 2013 at 05:54:10PM +0200, Marc Glisse wrote:

I don't really see why, as I am still calling c_build_vec_perm_expr
in the same cases, just possibly not exactly with the same arguments
(they don't go through build_non_dependent_expr, but Jason seemed to
imply that it did not matter since we don't look too deep through
the arguments).


I guess you're right.  If the c_* routine doesn't mind C++ specific trees
and just cares about their types and pt.c then instantiates it, then it is
fine.


Even if both are fine, if you prefer the long version (safer, or more uniform 
with the rest), please say so, I don't mind.


I committed the short version, since that's the one I currently had in my 
tree (and I had tested it). We can always change it later.


Thanks to you both for the comments,

--
Marc Glisse


Re: [PATCH] Cilk Plus Array Notation for C++

2013-06-27 Thread Jason Merrill

On 06/27/2013 02:36 PM, Iyer, Balaji V wrote:

I looked through the patch again. I was able to get rid of the first 
if-statement in cp_parser_postfix_open_square_expression function. I think now 
it looks exactly as you requested.


Much better, thanks.


+ /* Sometimes, it type-casts certain functions to void. Unwrap it.  */
+ if (VOID_TYPE_P (TREE_TYPE (t))  TREE_CODE (t) == CONVERT_EXPR)
+   t = TREE_OPERAND (t, 0);


If something is typecast to void, we shouldn't need to keep it in a 
temporary; we should be able to just pass it directly to 
finish_expr_stmt and then replace other occurrences with void_zero_node. 
 When are you encountering this?



+  if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == POINTER_TYPE)
+   {
+ error_at (loc, start-index and length fields necessary for 
+   using array notation in pointers or records);
+ return error_mark_node;
+   }


I'd turn this around and for anything that isn't an array, say that the 
[:] notation can only be used with arrays.  In particular it almost 
never makes sense to check for RECORD_TYPE specifically.



   if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == POINTER_TYPE)
 TREE_TYPE (array_ntn_expr) = TREE_TYPE (type);
   else
 TREE_TYPE (array_ntn_expr) = type;


So the type of an ARRAY_NOTATION_EXPR where the array is a class 
object is that same class?  That seems wrong.



+  bool saved_colon_corrects = parser-colon_corrects_to_scope_p;


Let's declare this just before you change parser-colon_corrects_to_scope_p.


+  if (!*init_index || *init_index == error_mark_node)
+   cp_parser_skip_to_end_of_statement (parser);
+
   length_index = cp_parser_expression (parser, false, NULL);


It doesn't make sense to skip to the end of the statement and then try 
to keep parsing the stuff you just skipped over.



+ bool saved_colon_corrects = parser-colon_corrects_to_scope_p;
+ parser-colon_corrects_to_scope_p = false;
+ if (flag_enable_cilkplus
+  cp_lexer_peek_token (parser-lexer)-type == CPP_COLON)
+   {
+ error_at (cp_lexer_peek_token (parser-lexer)-location,
+   braced list index is not allowed with array 
+   notation);
+ cp_parser_skip_to_end_of_statement (parser);
+ return error_mark_node;
+   }
+ parser-colon_corrects_to_scope_p = saved_colon_corrects;


You don't need to mess with colon_corrects_to_scope_p here; it doesn't 
affect the peek.


Jason



[C++ Patch] PR 57645 (Core/1123 fallout) 2nd Try

2013-06-27 Thread Paolo Carlini

Hi,

this is a better fix for this regression, IMHO. Certainly it's simple 
and passes the extended testcase, thus tests for defaulted destructors 
too, etc, with no regressions. The idea, which I got studying in detail 
check_bases_and_members and its comments, is setting temporarily 
TYPE_HAS_NONTRIVIAL_DESTRUCTOR before deducing noexcept on the 
destructors and then restoring it at the end of the work. Makes sense?


Tested x86_64-linux.

Thanks,
Paolo.

///
/cp
2013-06-28  Paolo Carlini  paolo.carl...@oracle.com

PR c++/57645
* class.c (deduce_noexcept_on_destructors): Save, set, and restore
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) around the main loop over the
destructors.

/testsuite
2013-06-28  Paolo Carlini  paolo.carl...@oracle.com

PR c++/57645
* testsuite/g++.dg/cpp0x/noexcept21.C: New.
Index: cp/class.c
===
--- cp/class.c  (revision 200486)
+++ cp/class.c  (working copy)
@@ -4593,15 +4593,18 @@ deduce_noexcept_on_destructor (tree dtor)
 static void
 deduce_noexcept_on_destructors (tree t)
 {
-  tree fns;
-
   /* If for some reason we don't have a CLASSTYPE_METHOD_VEC, we bail
  out now.  */
   if (!CLASSTYPE_METHOD_VEC (t))
 return;
 
-  for (fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+  bool saved_nontrivial_dtor = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
+  TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = true;
+
+  for (tree fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns))
 deduce_noexcept_on_destructor (OVL_CURRENT (fns));
+
+  TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = saved_nontrivial_dtor;
 }
 
 /* Subroutine of set_one_vmethod_tm_attributes.  Search base classes
Index: testsuite/g++.dg/cpp0x/noexcept21.C
===
--- testsuite/g++.dg/cpp0x/noexcept21.C (revision 0)
+++ testsuite/g++.dg/cpp0x/noexcept21.C (working copy)
@@ -0,0 +1,87 @@
+// PR c++/57645
+// { dg-do compile { target c++11 } }
+
+struct Thrower
+{
+  ~Thrower() noexcept(false) { throw 1; }
+};
+
+struct ExplicitA
+{
+  ~ExplicitA() {}
+
+  Thrower t;
+};
+
+struct ExplicitB
+{
+  ~ExplicitB();
+
+  Thrower t;
+};
+
+ExplicitB::~ExplicitB() {}
+
+struct ExplicitC
+{
+  ~ExplicitC() = default;
+
+  Thrower t;
+};
+
+struct ExplicitD
+{
+  ~ExplicitD();
+
+  Thrower t;
+};
+
+ExplicitD::~ExplicitD() = default;
+
+struct NoThrower
+{
+  ~NoThrower() noexcept(true) {}
+};
+
+struct ExplicitE
+{
+  ~ExplicitE() {}
+
+  NoThrower t;
+};
+
+struct ExplicitF
+{
+  ~ExplicitF();
+
+  NoThrower t;
+};
+
+ExplicitF::~ExplicitF() {}
+
+struct ExplicitG
+{
+  ~ExplicitG() = default;
+
+  NoThrower t;
+};
+
+struct ExplicitH
+{
+  ~ExplicitH();
+
+  NoThrower t;
+};
+
+ExplicitH::~ExplicitH() = default;
+
+#define SA(X) static_assert(X, #X)
+
+SA( !noexcept(ExplicitA()) );
+SA( !noexcept(ExplicitB()) );
+SA( !noexcept(ExplicitC()) );
+SA( !noexcept(ExplicitD()) );
+SA( noexcept(ExplicitE()) );
+SA( noexcept(ExplicitF()) );
+SA( noexcept(ExplicitG()) );
+SA( noexcept(ExplicitH()) );


Re: [c++-concepts] requires expression semantics

2013-06-27 Thread Jason Merrill

On 06/27/2013 04:56 PM, Andrew Sutton wrote:

I was not aware of that. That's probably the right, but I remember
having some troubles getting that to work the way I wanted in the
previous implementation. It seemed like I actually had to evaluate the
expression to determine if it was actually constexpr.


Right; an expression is a constant-expression iff it evaluates to a 
constant value.  Without evaluating the expression we can't catch things 
like division by zero which prevent it from being a constant-expression.


Jason



Re: [C++ Patch] PR 57645

2013-06-27 Thread Jason Merrill

On 06/19/2013 08:22 PM, Paolo Carlini wrote:

If, in check_bases_and_members, I simply move
deduce_noexcept_on_destructors after check_methods and nothing else, all
the new testcases are fine + the tests added for Core/1123, but there
are regressions, for example for testcases involving virtual
destructors, eg, debug/dwarf2/non-virtual-thunk.C.


Probably because we need to update the exception specification before we 
check for overrides, since that check will look at the exception 
specification.


Let's move


  if (DECL_DESTRUCTOR_P (x)  user_provided_p (x))
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = 1;


to the top of the loop in check_methods, and call 
deduce_noexcept_on_destructor under the same if.


Jason




Re: [C++ Patch] PR 57682

2013-06-27 Thread Jason Merrill
OK, but also remove the check for try after a mem-initializer; it has 
to come before the mem-initializers.


Jason


Re: C++ 2014 status page for libstdc++

2013-06-27 Thread Ed Smith-Rowland

On 06/27/2013 07:01 AM, Jonathan Wakely wrote:

On 26 June 2013 02:28, Ed Smith-Rowland wrote:

On 06/25/2013 11:59 AM, Jonathan Wakely wrote:

On 25 June 2013 16:45,  3dw...@verizon.net wrote:

Here is a C++2014 status page for fun and profit.

Excellent, thanks!


Tested with xmllint.  Are there any other tests I should do?

The makefile target to check the docbook manual is:
make doc-xml-validate-docbook

Checked clean.


It should also be linked from doc/xml/manual/intro.xml so it appears
as part of the manual.

Done.


The first paragraph says the table is based on the table of contents
of the CD, but it isn't.  I agree with only showing the C++14 changes,
but the first paragraph should be changed (or removed.)


Just removed this paragraph.

Applied.

That patch is definitely OK, but please wait for approval before applying!

Will do.  Sorry.


Thanks again for doing this - I'll try to find time to finish the WIP
stuff I'm W'ing on :)


Cool!

I should have waited because I thought it would be better to have links 
for the papers.


Also, how does one regenerate html?  Do you do that?

Finally, should we put a line for thins in the 4.9 changes page?


Index: doc/xml/manual/status_cxx2014.xml
===
--- doc/xml/manual/status_cxx2014.xml   (revision 200429)
+++ doc/xml/manual/status_cxx2014.xml   (working copy)
@@ -44,63 +44,99 @@
   tbody
 
 row
-  entryN3669/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3669.pdf;
+ N3669
+   /link
+  /entry
   entryFixing constexpr member functions without const/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3668/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3668.html;
+ N3668
+   /link
+  /entry
   entrycodeexchange()/code utility function/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3670/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3670.html;
+ N3670
+   /link
+  /entry
   entryWording for Addressing Tuples by Type/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3656/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3656.htm;
+ N3656
+   /link
+  /entry
   entrycodemake_unique/code/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3462/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2012/n3462.html;
+ N3462
+   /link
+  /entry
   entrycodestd::result_of/code and SFINAE/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3545/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3545.pdf;
+ N3545
+   /link
+  /entry
   entryAn Incremental Improvement to 
codeintegral_constant/code/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3642/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3642.pdf;
+ N3642
+   /link
+  /entry
   entryUser-defined Literals for Standard Library Types/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3671/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3671.html;
+ N3671
+   /link
+  /entry
   entryMaking non-modifying sequence operations more robust/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3654/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3654.html;
+ N3654
+   /link
+  /entry
   entryQuoted Strings Library Proposal/entry
   entryY/entry
   entry/
@@ -108,21 +144,33 @@
 
 
 row
-  entryN3469/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2012/n3469.html;
+ N3469
+   /link
+  /entry
   entryConstexpr Library Additions: chrono/entry
   entryY/entry
   entry/
 /row
 
 row
-  entryN3470/entry
+  entry
+   link xmlns:xlink=http://www.w3.org/1999/xlink; 
xlink:href=http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2012/n3470.html;
+ N3470
+   /link
+  /entry
   entryConstexpr Library 

[patch] regex_traits implementation

2013-06-27 Thread Tim Shen
Here is an all-in-one patch of implementing std::regex_traits in
libstdc++-v3, including testsuites.

This patch also includes changes in
http://gcc.gnu.org/ml/libstdc++/2013-04/msg00115.html, so just forget
that one.

Thank you!

--
Tim Shen


regex_traits.patch
Description: Binary data