[PING^3] Nios II port

2013-06-25 Thread Chung-Lin Tang
Ping x 3.

On 13/6/18 下午4:38, Chung-Lin Tang wrote:
 On 13/6/18 上午3:05, Sandra Loosemore wrote:
  Ping?  I think these are the most recent versions of the unreviewed
  patches in the series:
  
  http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00287.html
  http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00760.html
  http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01085.html



Fix formatting glitches

2013-06-25 Thread Eric Botcazou
This fixes a few formatting glitches introduced in very recent patches that I 
ran into when merging them on the sso branch.

Bootstrapped/regtested on x86_64-suse-linux, applied on mainline as obvious.


2013-06-25  Eric Botcazou  ebotca...@adacore.com

* expr.c (expand_expr_real_1) ARRAY_REF: Fix formatting glitches.
BIT_FIELD_REF: Remove trailing TAB.
* varasm.c (output_constructor_bitfield): Fix formatting glitch and
remove blank line.


-- 
Eric BotcazouIndex: expr.c
===
--- expr.c	(revision 200350)
+++ expr.c	(working copy)
@@ -9698,7 +9698,7 @@ expand_expr_real_1 (tree exp, rtx target
   {
 	tree array = treeop0;
 	tree index = treeop1;
-tree init;
+	tree init;
 
 	/* Fold an expression like: foo[2].
 	   This is not done in fold so it won't happen inside .
@@ -9776,32 +9776,31 @@ expand_expr_real_1 (tree exp, rtx target
 			break;
 			}
 
-		  return expand_expr (fold (value), target, tmode,
-	  modifier);
+		  return
+		expand_expr (fold (value), target, tmode, modifier);
 		}
 	  }
-	else if(TREE_CODE (init) == STRING_CST)
+	else if (TREE_CODE (init) == STRING_CST)
 	  {
-		tree index1 = index;
 		tree low_bound = array_ref_low_bound (exp);
-		index1 = fold_convert_loc (loc, sizetype,
-	   treeop1);
+		tree index1 = fold_convert_loc (loc, sizetype, treeop1);
 
-		/* Optimize the special-case of a zero lower bound.
+		/* Optimize the special case of a zero lower bound.
 
-		   We convert the low_bound to sizetype to avoid some problems
-		   with constant folding.  (E.g. suppose the lower bound is 1,
-		   and its mode is QI.  Without the conversion,l (ARRAY
-		   +(INDEX-(unsigned char)1)) becomes ((ARRAY+(-(unsigned char)1))
-		   +INDEX), which becomes (ARRAY+255+INDEX).  Opps!)  */
-
-		if (! integer_zerop (low_bound))
+		   We convert the lower bound to sizetype to avoid problems
+		   with constant folding.  E.g. suppose the lower bound is
+		   1 and its mode is QI.  Without the conversion
+		  (ARRAY + (INDEX - (unsigned char)1))
+		   becomes
+		  (ARRAY + (-(unsigned char)1) + INDEX)
+		   which becomes
+		  (ARRAY + 255 + INDEX).  Oops!  */
+		if (!integer_zerop (low_bound))
 		  index1 = size_diffop_loc (loc, index1,
-	fold_convert_loc (loc, sizetype,
-			  low_bound));
+	fold_convert_loc (loc, sizetype,
+			  low_bound));
 
-		if (0  compare_tree_int (index1,
-	  TREE_STRING_LENGTH (init)))
+		if (compare_tree_int (index1, TREE_STRING_LENGTH (init))  0)
 		  {
 		tree type = TREE_TYPE (TREE_TYPE (init));
 		enum machine_mode mode = TYPE_MODE (type);
@@ -10187,7 +10186,7 @@ expand_expr_real_1 (tree exp, rtx target
 	|| modifier == EXPAND_CONST_ADDRESS
 	|| modifier == EXPAND_INITIALIZER)
 	  return op0;
-	
+
 	if (target == 0)
 	  target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
 
Index: varasm.c
===
--- varasm.c	(revision 200350)
+++ varasm.c	(working copy)
@@ -4947,7 +4947,7 @@ output_constructor_bitfield (oc_local_st
   /* Bit position of this element from the start of a possibly ongoing
  outer byte buffer.  */
   HOST_WIDE_INT byte_relative_ebitpos
-  = bit_offset + constructor_relative_ebitpos;
+= bit_offset + constructor_relative_ebitpos;
 
   /* From the start of a possibly ongoing outer byte buffer, offsets to
  the first bit of this element and to the first bit past the end of
@@ -5131,7 +5131,6 @@ output_constructor (tree exp, unsigned H
   local.total_bytes = 0;
   local.byte_buffer_in_use = outer != NULL;
   local.byte = outer ? outer-byte : 0;
-
   local.last_relative_index = -1;
 
   gcc_assert (HOST_BITS_PER_WIDE_INT = BITS_PER_UNIT);

[patch] Fix error recovery issue with alias

2013-06-25 Thread Eric Botcazou
Hi,

this fixes a segfault on a malformed alias declaration, which is correctly 
flagged as an error by handle_alias_pairs:

error: 'Linker_Alias.Var' aliased to undefined symbol 'var2'

but is nevertheless later processed as a valid alias by the cgraph machinery.

Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline?


2013-06-25  Eric Botcazou  ebotca...@adacore.com

* cgraphunit.c (handle_alias_pairs): Reset the alias flag after the
error message is issued for an alias to an undefined symbol.


2013-06-25  Eric Botcazou  ebotca...@adacore.com

* gnat.dg/specs/linker_alias.ads: New test.


-- 
Eric BotcazouIndex: cgraphunit.c
===
--- cgraphunit.c	(revision 200350)
+++ cgraphunit.c	(working copy)
@@ -1001,7 +1001,7 @@ analyze_functions (void)
 
 /* Translate the ugly representation of aliases as alias pairs into nice
representation in callgraph.  We don't handle all cases yet,
-   unforutnately.  */
+   unfortunately.  */
 
 static void
 handle_alias_pairs (void)
@@ -1013,10 +1013,11 @@ handle_alias_pairs (void)
 {
   symtab_node target_node = symtab_node_for_asm (p-target);
 
-  /* Weakrefs with target not defined in current unit are easy to handle; they
-	 behave just as external variables except we need to note the alias flag
-	 to later output the weakref pseudo op into asm file.  */
-  if (!target_node  lookup_attribute (weakref, DECL_ATTRIBUTES (p-decl)) != NULL)
+  /* Weakrefs with target not defined in current unit are easy to handle:
+	 they behave just as external variables except we need to note the
+	 alias flag to later output the weakref pseudo op into asm file.  */
+  if (!target_node
+	   lookup_attribute (weakref, DECL_ATTRIBUTES (p-decl)) != NULL)
 	{
 	  symtab_node node = symtab_get_node (p-decl);
 	  if (node)
@@ -1031,6 +1032,9 @@ handle_alias_pairs (void)
   else if (!target_node)
 	{
 	  error (%q+D aliased to undefined symbol %qE, p-decl, p-target);
+	  symtab_node node = symtab_get_node (p-decl);
+	  if (node)
+	node-symbol.alias = false;
 	  alias_pairs-unordered_remove (i);
 	  continue;
 	}-- { dg-do compile }

package Linker_Alias is

   Var : Integer;  -- { dg-error aliased to undefined symbol }
   pragma Export (C, Var, my_var);
   pragma Linker_Alias (Var, var2);

end Linker_Alias;


Re: [Patch wwwdocs] gcc-4.9 changes: mention support of the Intel Silvermont microarchitecture

2013-06-25 Thread Kirill Yukhin
Hello,

 Looks good to me; just say the new Intel
Checked int www CVS.

Thanks, K


[Patch, libgcc] The files auto-target.h and stamp-h should only be removed by make distclean.

2013-06-25 Thread Chung-Ju Wu
Hi, all,

In the discussion thread:
http://gcc.gnu.org/ml/gcc/2013-06/msg00176.html

There is a bug that auto-target.h and stamp-h are removed by make clean.
The files should only be removed by make distclean.

A patch was then provided and got approval by Ian.
Below are ChangeLog and the patch:


Index: libgcc/ChangeLog
===
--- libgcc/ChangeLog(revision 200389)
+++ libgcc/ChangeLog(working copy)
@@ -1,3 +1,8 @@
+2013-06-25  Chung-Ju Wu  jasonw...@gmail.com
+
+   * Makefile.in (clean, distclean): Remove auto-target.h and stamp-h
+   correctly.
+
 2013-06-21  Joseph Myers  jos...@codesourcery.com

PR other/53317


Index: libgcc/Makefile.in
===
--- libgcc/Makefile.in  (revision 200389)
+++ libgcc/Makefile.in  (working copy)
@@ -121,8 +121,8 @@
 .PHONY: all clean

 clean:
-   -rm -f auto-target.h libgcc_tm.h libgcc.map
-   -rm -f libgcc_tm.stamp stamp-h stmp-ldirs
+   -rm -f libgcc_tm.h libgcc.map
+   -rm -f libgcc_tm.stamp stmp-ldirs
-rm -f *$(objext)
-rm -f *.dep
-rm -f *.a
@@ -131,6 +131,8 @@
@$(MULTICLEAN) multi-clean DO=clean
 distclean: clean
@$(MULTICLEAN) multi-clean DO=distclean
+   -rm -f auto-target.h
+   -rm -f stamp-h
-rm -f *~ Makefile config.cache config.status multilib.out
-rm -f config.log
 maintainer-clean realclean: distclean


Committed into trunk as Rev. 200390.
http://gcc.gnu.org/viewcvs/gcc?view=revisionrevision=200390


Best regards,
jasonwucj


[ARM] Implement static stack checking

2013-06-25 Thread Eric Botcazou
Hi,

this implements static stack checking in the ARM back-end, i.e. checking of 
the static part of the frame in the prologue before it is created, by means of 
probes.  The implementation is both modelled on that of the SPARC back-end 
(for the RISCy aspect) and that of the x86 back-end (for the scarcity of 
scratch registers in the prologue).

As always, it's mostly independent of the rest, except for TARGET_APCS_FRAME 
platforms where we need to do the usual dance with ip, so the patch factors 
out the relevant code.  This essentially affects VxWorks at this point and the 
patch was extensively tested on this platform, with and without -fstack-check.
It was also tested on arm-eabi and arm-androideabi without -fstack-check.

OK for the mainline?


2013-06-25  Eric Botcazou  ebotca...@adacore.com

* config/arm/linux-elf.h (STACK_CHECK_STATIC_BUILTIN): Define.
* config/arm/arm-protos.h (output_probe_stack_range): Declare.
* config/arm/arm.c: Include common/common-target.h.
(arm_compute_static_chain_stack_bytes): Adjust for stack checking.
(struct scratch_reg): New.
(get_scratch_register_on_entry): New function.
(release_scratch_register_on_entry): Likewise.
(arm_emit_probe_stack_range): Likewise.
(output_probe_stack_range): Likewise.
(arm_expand_prologue): Factor out code dealing with the IP register
for nested function and adjust it for stack checking.
Invoke arm_emit_probe_stack_range if static builtin stack checking
is enabled.
(thumb1_expand_prologue): Sorry out if static builtin stack checking
is enabled.
* config/arm/unspecs.md (UNSPEC_PROBE_STACK): New constant.
(UNSPEC_PROBE_STACK_RANGE): Likewise.
* config/arm/arm.md (probe_stack): New insn.
(probe_stack_range): Likewise.


-- 
Eric BotcazouIndex: config/arm/linux-elf.h
===
--- config/arm/linux-elf.h	(revision 200350)
+++ config/arm/linux-elf.h	(working copy)
@@ -113,3 +113,6 @@
 /* Add .note.GNU-stack.  */
 #undef NEED_INDICATE_EXEC_STACK
 #define NEED_INDICATE_EXEC_STACK	1
+
+/* Define this to be nonzero if static stack checking is supported.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
Index: config/arm/arm.c
===
--- config/arm/arm.c	(revision 200350)
+++ config/arm/arm.c	(working copy)
@@ -47,6 +47,7 @@
 #include tm_p.h
 #include target.h
 #include target-def.h
+#include common/common-target.h
 #include debug.h
 #include langhooks.h
 #include df.h
@@ -16198,8 +16199,10 @@ static int
 arm_compute_static_chain_stack_bytes (void)
 {
   /* See the defining assertion in arm_expand_prologue.  */
-  if (TARGET_APCS_FRAME  frame_pointer_needed  TARGET_ARM
-   IS_NESTED (arm_current_func_type ())
+  if (IS_NESTED (arm_current_func_type ())
+   ((TARGET_APCS_FRAME  frame_pointer_needed  TARGET_ARM)
+	  || (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
+	   !df_regs_ever_live_p (LR_REGNUM)))
arm_r3_live_at_start_p ()
crtl-args.pretend_args_size == 0)
 return 4;
@@ -16293,7 +16296,6 @@ arm_compute_save_reg_mask (void)
   return save_reg_mask;
 }
 
-
 /* Compute a bit mask of which registers need to be
saved on the stack for the current function.  */
 static unsigned long
@@ -18070,6 +18072,239 @@ thumb_set_frame_pointer (arm_stack_offse
   RTX_FRAME_RELATED_P (insn) = 1;
 }
 
+struct scratch_reg {
+  rtx reg;
+  bool saved;
+};
+
+/* Return a short-lived scratch register for use as a 2nd scratch register on
+   function entry after the registers are saved in the prologue.  This register
+   must be released by means of release_scratch_register_on_entry.  IP is not
+   considered since it is always used as the 1st scratch register if available.
+
+   REGNO1 is the index number of the 1st scratch register and LIVE_REGS is the
+   mask of live registers.  */
+
+static void
+get_scratch_register_on_entry (struct scratch_reg *sr, unsigned int regno1,
+			   unsigned long live_regs)
+{
+  int regno = -1;
+
+  sr-saved = false;
+
+  if (regno1 != LR_REGNUM  (live_regs  (1  LR_REGNUM)) != 0)
+regno = LR_REGNUM;
+  else
+{
+  unsigned int i;
+
+  for (i = 4; i  11; i++)
+	if (regno1 != i  (live_regs  (1  i)) != 0)
+	  {
+	regno = i;
+	break;
+	  }
+
+  if (regno  0)
+	{
+	  /* If IP is used as the 1st scratch register for a nested function,
+	 then either r3 wasn't available or is used to preserve IP.  */
+	  if (regno1 == IP_REGNUM  IS_NESTED (arm_current_func_type ()))
+	regno1 = 3;
+	  regno = (regno1 == 3 ? 2 : 3);
+	  sr-saved
+	= REGNO_REG_SET_P (df_get_live_out (ENTRY_BLOCK_PTR), regno);
+	}
+}
+
+  sr-reg = gen_rtx_REG (SImode, regno);
+  if (sr-saved)
+{
+  rtx addr = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx);
+  rtx insn = emit_set_insn (gen_frame_mem (SImode, addr), sr-reg);
+  

[PATCH, PR 57208] Add ipa-cp created references to the symbol table

2013-06-25 Thread Martin Jambor
Hi,

the patch reportedly fixes an issue when LTO building chromium.  It
adds references that are created by IPA-CP when propagating references
from aggregates (the scalar case is handled by the call graph
infrastructure).

Bootstrapped and tested on x86_64-linux.  OK for trunk?

Thanks,

Martin


2013-06-24  Martin Jambor  mjam...@suse.cz

PR lto/57208
* ipa-cp.c (create_specialized_node): Add newly created references
to the symbol table.

Index: src/gcc/ipa-cp.c
===
--- src.orig/gcc/ipa-cp.c
+++ src/gcc/ipa-cp.c
@@ -2663,6 +2663,7 @@ create_specialized_node (struct cgraph_n
 {
   struct ipa_node_params *new_info, *info = IPA_NODE_REF (node);
   vecipa_replace_map_p, va_gc *replace_trees = NULL;
+  struct ipa_agg_replacement_value *av;
   struct cgraph_node *new_node;
   int i, count = ipa_get_param_count (info);
   bitmap args_to_skip;
@@ -2704,6 +2705,23 @@ create_specialized_node (struct cgraph_n
   new_node = cgraph_create_virtual_clone (node, callers, replace_trees,
  args_to_skip, constprop);
   ipa_set_node_agg_value_chain (new_node, aggvals);
+  for (av = aggvals; av; av = av-next)
+{
+  tree base;
+  if (TREE_CODE (av-value) != ADDR_EXPR)
+   continue;
+  base = get_base_var (av-value);
+  if (base  (TREE_CODE (base) == FUNCTION_DECL
+  || TREE_CODE (base) == VAR_DECL))
+   {
+ symtab_node referred = symtab_get_node (base);
+
+ gcc_checking_assert (referred);
+ ipa_record_reference ((symtab_node) new_node, referred,
+   IPA_REF_ADDR, NULL);
+   }
+}
+
   if (dump_file  (dump_flags  TDF_DETAILS))
 {
   fprintf (dump_file,  the new node is %s/%i.\n,


[patch] avoid '//' prefixes when sysroot is set to '/'

2013-06-25 Thread Yvan Roux
Hi,

any news on this one, as the issue with --with-sysroot and
--with-gxx-include-dir is still present in 4.8 ?

http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00320.html

Thanks,
Yvan

PS. Sorry for the re-post, I don't have the original one in my history


[wwwdocs,Patch] Update Fortran part in gcc-4.9/changes.html

2013-06-25 Thread Tobias Burnus

The attached patch updates the Fortran part of the GCC 4.9 release notes.

Comments are welcome. Otherwise, I intent to commit it soon. (Well, 
comments are also welcome after committal ;-)


Tobias
Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/changes.html,v
retrieving revision 1.19
diff -u -p -r1.19 changes.html
--- changes.html	25 Jun 2013 08:05:13 -	1.19
+++ changes.html	25 Jun 2013 11:22:14 -
@@ -137,12 +137,32 @@ void f(int n) {
   ul
 liCompatibility notice:
 ul
-  liNote that the argument passing ABI has changed for scalar dummy
-	arguments of type codeINTEGER/code, codeREAL/code,
-	codeCOMPLEX/code and codeLOGICAL/code, which have
-	emboth/em the codeVALUE/code and the codeOPTIONAL/code
-	attribute./li
-/ul/li
+  liModule files: The version of the module files (code.mod/code)
+has been incremented; additionally, module files are now compressed.
+Fortran codeMODULE/codes compiled by earlier GCC versions have
+to be recompiled, when they are codeUSE/coded by files compiled
+with GCC 4.9, because GCC 4.9 is not able to read code.mod/code
+files of earlier GCC versions; attempting to do so gives an error
+message. Note: The ABI of the produced assembler data itself has not
+changed: object files and libraries are fully compatible to older
+versions. (Except for the next items.)/li
+  liABI changes:
+  ul
+liNote that the a
+  href=http://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html;
+  argument passing ABI/a has changed for scalar dummy
+  	  arguments of type codeINTEGER/code, codeREAL/code,
+	  codeCOMPLEX/code and codeLOGICAL/code, which have
+	  emboth/em the codeVALUE/code and the codeOPTIONAL/code
+	  attribute./li
+liDue to the support of finalization, the virtual table associated
+  with polymorphic variables has changed. Therefore, code containing
+  codeCLASS/code should be recompiled, including all files which
+  define derived types involved in the type definition used by
+  polymorphic variables. (Note: Due to the incremented module version,
+  trying to mix old code with new code will usually give an error
+  message.)/li
+  /ul/li
 liThe deprecated command-line option code-fno-whole-file/code
   has been removed. (code-fwhole-file/code is the default since
   GCC 4.6.) code-fwhole-file/code/code-fno-whole-file/code
@@ -167,6 +187,21 @@ void f(int n) {
   rank; contrary to codeNO_ARG_CHECK/code assumed-rank arguments
   pass an array descriptor which contains the array shape and stride
   of the argument./li
+lia href=http://gcc.gnu.org/wiki/Fortran2003Status;Fortran 2003/a:
+ul
+  liFinalization is now supported. Note that finalization is currently
+only done for a subset of the situations in which it should occur./li
+/li/ul
+lia href=http://gcc.gnu.org/wiki/Fortran2008Status;Fortran 2008/a:
+ul
+  liWhen codeSTOP/code or codeERROR STOP/code is used to terminate
+the execution and any exception (but inexact) is signaling, a warning is
+printed to codeERROR_UNIT/code, indicating which exceptions are
+signaling. The codea
+href=http://gcc.gnu.org/onlinedocs/gfortran/Debugging-Options.html;
+-ffpe-summary=/a/code command-line option can be used to fine-tune
+for which exception the warning should be shown./li
+/li/ul
   /ul
 
 !--


[PATCH] Allow vectorization of IVs with non-constant step (PR tree-optimization/57705)

2013-06-25 Thread Jakub Jelinek
Hi!

While hacking on the gomp4 simd clauses stuff, I've noticed that
we don't vectorize IVs with non-constant step.  The following patch
implements it, basically we just can't rely that the step or VF * step
is a constant and instead for VF * step need to emit a temporary with
scalar VF * step value before adding a vector temporary.

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

I wasn't sure about nested loop vectorization, so I've disabled it for that
case, perhaps with a testcase that exhibits it could be replaced just with a
test that the step, if SSA_NAME, doesn't have definition even in the outer
loop, because we still put the vector constants before the outer loop.

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

PR tree-optimization/57705
* tree-vect-loop.c (vect_is_simple_iv_evolution): Allow
SSA_NAME step, provided that it is not defined inside the loop.
(vect_analyze_scalar_cycles_1): Disallow SSA_NAME step in nested
loop.
(get_initial_def_for_induction): Handle SSA_NAME IV step.

* gcc.dg/vect/pr57705.c: New test.
* gcc.dg/vect/vect-iv-7.c: Add noclone attribute, remove xfail.

--- gcc/tree-vect-loop.c.jj 2013-06-06 08:39:24.0 +0200
+++ gcc/tree-vect-loop.c2013-06-25 11:17:02.947602981 +0200
@@ -500,7 +500,7 @@ vect_determine_vectorization_factor (loo
 /* Function vect_is_simple_iv_evolution.
 
FORNOW: A simple evolution of an induction variables in the loop is
-   considered a polynomial evolution with constant step.  */
+   considered a polynomial evolution.  */
 
 static bool
 vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
@@ -509,6 +509,7 @@ vect_is_simple_iv_evolution (unsigned lo
   tree init_expr;
   tree step_expr;
   tree evolution_part = evolution_part_in_loop_num (access_fn, loop_nb);
+  basic_block bb;
 
   /* When there is no evolution in this loop, the evolution function
  is not simple.  */
@@ -534,7 +535,10 @@ vect_is_simple_iv_evolution (unsigned lo
   *init = init_expr;
   *step = step_expr;
 
-  if (TREE_CODE (step_expr) != INTEGER_CST)
+  if (TREE_CODE (step_expr) != INTEGER_CST
+   (TREE_CODE (step_expr) != SSA_NAME
+ || ((bb = gimple_bb (SSA_NAME_DEF_STMT (step_expr)))
+  flow_bb_inside_loop_p (get_loop (cfun, loop_nb), bb
 {
   if (dump_enabled_p ())
 dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -556,7 +560,7 @@ static void
 vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
 {
   basic_block bb = loop-header;
-  tree dumy;
+  tree init, step;
   vecgimple worklist;
   worklist.create (64);
   gimple_stmt_iterator gsi;
@@ -605,7 +609,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_i
}
 
   if (!access_fn
- || !vect_is_simple_iv_evolution (loop-num, access_fn, dumy, dumy))
+ || !vect_is_simple_iv_evolution (loop-num, access_fn, init, step)
+ || (LOOP_VINFO_LOOP (loop_vinfo) != loop
+  TREE_CODE (step) != INTEGER_CST))
{
  worklist.safe_push (phi);
  continue;
@@ -3273,10 +3279,14 @@ get_initial_def_for_induction (gimple iv
   expr = build_int_cst (TREE_TYPE (step_expr), vf);
   new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
  expr, step_expr);
+  if (TREE_CODE (step_expr) == SSA_NAME)
+   new_name = vect_init_vector (iv_phi, new_name,
+TREE_TYPE (step_expr), NULL);
 }
 
   t = unshare_expr (new_name);
-  gcc_assert (CONSTANT_CLASS_P (new_name));
+  gcc_assert (CONSTANT_CLASS_P (new_name)
+ || TREE_CODE (new_name) == SSA_NAME);
   stepvectype = get_vectype_for_scalar_type (TREE_TYPE (new_name));
   gcc_assert (stepvectype);
   new_vec = build_vector_from_val (stepvectype, t);
@@ -3332,8 +3342,12 @@ get_initial_def_for_induction (gimple iv
   expr = build_int_cst (TREE_TYPE (step_expr), nunits);
   new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
  expr, step_expr);
+  if (TREE_CODE (step_expr) == SSA_NAME)
+   new_name = vect_init_vector (iv_phi, new_name,
+TREE_TYPE (step_expr), NULL);
   t = unshare_expr (new_name);
-  gcc_assert (CONSTANT_CLASS_P (new_name));
+  gcc_assert (CONSTANT_CLASS_P (new_name)
+ || TREE_CODE (new_name) == SSA_NAME);
   new_vec = build_vector_from_val (stepvectype, t);
   vec_step = vect_init_vector (iv_phi, new_vec, stepvectype, NULL);
 
--- gcc/testsuite/gcc.dg/vect/pr57705.c.jj  2013-06-25 10:15:21.037092153 
+0200
+++ gcc/testsuite/gcc.dg/vect/pr57705.c 2013-06-25 10:15:02.239733689 +0200
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+
+#include tree-vect.h
+
+int a[1024];
+unsigned char b[1024];
+
+extern void abort (void);
+
+__attribute__((noinline, noclone)) void
+foo (int k, int m)
+{
+  int i, k2 = k;
+  for (i = 0; i  1024; 

[C++ PR57640] Explicit call of system literal operator complains about leading underscore

2013-06-25 Thread Ed Smith-Rowland
This little nit was certainly latent all along but was only exposed once 
we got literal ops into the std library.
A user who calls a operator explicitly get yelled at for not having 
anunderscore.


OK after testing completes on x86_64-linux?

Ed

gcc/cp:

2013-06-25  Ed Smith-Rowland  3dw...@verizon.net

PR c++/57640
* parser.c (cp_parser_unqualified_id): Add declarator_p to checks
to trigger warning, (cp_literal_operator_id): Remove bogus TODO comment.


gcc/testsuite:

2013-06-25  Ed Smith-Rowland  3dw...@verizon.net

PR c++/57640
* g++.dg/cpp1y/pr57640.C: New.
Index: gcc/cp/parser.c
===
--- gcc/cp/parser.c (revision 200342)
+++ gcc/cp/parser.c (working copy)
@@ -5000,7 +4999,7 @@
{
  /* 17.6.3.3.5  */
  const char *name = UDLIT_OP_SUFFIX (id);
- if (name[0] != '_'  !in_system_header)
+ if (name[0] != '_'  !in_system_header  declarator_p)
warning (0, literal operator suffixes not preceded by %_%
 are reserved for future standardization);
}
@@ -12346,7 +12345,6 @@
  + strlen (name) + 10);
   sprintf (buffer, UDLIT_OP_ANSI_FORMAT, name);
   identifier = get_identifier (buffer);
-  /*IDENTIFIER_UDLIT_OPNAME_P (identifier) = 1; If we get a flag someday. */
 
   return identifier;
 }
Index: gcc/testsuite/g++.dg/cpp1y/pr57640.C
===
--- gcc/testsuite/g++.dg/cpp1y/pr57640.C(revision 0)
+++ gcc/testsuite/g++.dg/cpp1y/pr57640.C(working copy)
@@ -0,0 +1,8 @@
+// { dg-options -std=c++1y }
+// { dg-do compile }
+
+#include chrono
+
+using namespace std::literals::chrono_literals;
+
+auto blooper = operator min(45.0L);


[C++] DR1473 - let literal operators be defined with empty user-defined string literal

2013-06-25 Thread Ed Smith-Rowland

This will allow such things as
  constexpr std::complexfloat
  operatorif(long double imag);

OK after testing completes on x86_64-linux.

Ed

gcc/cp:

2013-06-25  Ed Smith-Rowland  3dw...@verizon.net

* gcc/cp/parser.c (cp_parser_operator()): Parse user-defined string
literal as literal operator.


gcc/testsuite:

2013-06-25  Ed Smith-Rowland  3dw...@verizon.net

* gcc/testsuite/g++.dg/cpp0x/udlit-nospace-neg.C: Adjust.
* gcc/testsuite/g++.dg/cpp1y/udlit-enc-prefix-neg.C: New.
* gcc/testsuite/g++.dg/cpp1y/udlit-userdef-string.C: New.
Index: gcc/cp/parser.c
===
--- gcc/cp/parser.c (revision 200342)
+++ gcc/cp/parser.c (working copy)
@@ -12591,6 +12589,12 @@
  return cp_literal_operator_id (name);
}
}
+  else if (token-type == CPP_KEYWORD)
+   {
+ error (unexpected keyword;
+ Remove space between quotes and suffix identifier);
+ return error_mark_node;
+   }
   else
{
  error (expected suffix identifier);
@@ -12598,7 +12602,32 @@
}
 
 case CPP_STRING_USERDEF:
-  error (missing space between %\\% and suffix identifier);
+  if (cxx_dialect == cxx98)
+   maybe_warn_cpp0x (CPP0X_USER_DEFINED_LITERALS);
+  {
+   tree string_tree = USERDEF_LITERAL_VALUE (token-u.value);
+   if (TREE_STRING_LENGTH (string_tree)  2)
+ {
+   error (expected empty string after %operator% keyword);
+   return error_mark_node;
+ }
+   id = USERDEF_LITERAL_SUFFIX_ID (token-u.value);
+   /* Consume the user-defined string literal.  */
+   cp_lexer_consume_token (parser-lexer);
+   if (id != error_mark_node)
+ {
+   const char *name = IDENTIFIER_POINTER (id);
+   return cp_literal_operator_id (name);
+ }
+   else
+ return error_mark_node;
+  }
+
+case CPP_WSTRING_USERDEF:
+case CPP_STRING16_USERDEF:
+case CPP_STRING32_USERDEF:
+case CPP_UTF8STRING_USERDEF:
+  error (invalid encoding prefix in literal operator);
   return error_mark_node;
 
 default:
Index: gcc/testsuite/g++.dg/cpp0x/udlit-nospace-neg.C
===
--- gcc/testsuite/g++.dg/cpp0x/udlit-nospace-neg.C  (revision 200342)
+++ gcc/testsuite/g++.dg/cpp0x/udlit-nospace-neg.C  (working copy)
@@ -1,3 +1,5 @@
 // { dg-options -std=c++0x }
 
-float operator _abc(const char*); // { dg-error missing space between|and 
suffix identifier }
+float operator _abc(const char*);
+
+int operator_def(long double);
Index: gcc/testsuite/g++.dg/cpp1y/udlit-enc-prefix-neg.C
===
--- gcc/testsuite/g++.dg/cpp1y/udlit-enc-prefix-neg.C   (revision 0)
+++ gcc/testsuite/g++.dg/cpp1y/udlit-enc-prefix-neg.C   (working copy)
@@ -0,0 +1,17 @@
+// { dg-options -std=c++1y }
+
+int
+operator LLs(unsigned long long) // { dg-error invalid encoding prefix in 
literal operator }
+{ return 0; }
+
+int
+operator us16(unsigned long long) // { dg-error invalid encoding prefix in 
literal operator }
+{ return 0; }
+
+int
+operator Us32(unsigned long long) // { dg-error invalid encoding prefix in 
literal operator }
+{ return 0; }
+
+int
+operator u8u8s(unsigned long long) // { dg-error invalid encoding prefix in 
literal operator }
+{ return 0; }
Index: gcc/testsuite/g++.dg/cpp1y/udlit-userdef-string.C
===
--- gcc/testsuite/g++.dg/cpp1y/udlit-userdef-string.C   (revision 0)
+++ gcc/testsuite/g++.dg/cpp1y/udlit-userdef-string.C   (working copy)
@@ -0,0 +1,7 @@
+// { dg-options -std=c++1y }
+
+#include complex_literals.h
+
+auto cx = 1.1if;
+
+auto cn = 123if;


Re: [PATCH] Allow vectorization of IVs with non-constant step (PR tree-optimization/57705)

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

Hi!

While hacking on the gomp4 simd clauses stuff, I've noticed that
we don't vectorize IVs with non-constant step.  The following patch
implements it, basically we just can't rely that the step or VF * step
is a constant and instead for VF * step need to emit a temporary with
scalar VF * step value before adding a vector temporary.

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

Ok.

Thanks,
Richard.

I wasn't sure about nested loop vectorization, so I've disabled it for
that
case, perhaps with a testcase that exhibits it could be replaced just
with a
test that the step, if SSA_NAME, doesn't have definition even in the
outer
loop, because we still put the vector constants before the outer loop.

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

   PR tree-optimization/57705
   * tree-vect-loop.c (vect_is_simple_iv_evolution): Allow
   SSA_NAME step, provided that it is not defined inside the loop.
   (vect_analyze_scalar_cycles_1): Disallow SSA_NAME step in nested
   loop.
   (get_initial_def_for_induction): Handle SSA_NAME IV step.

   * gcc.dg/vect/pr57705.c: New test.
   * gcc.dg/vect/vect-iv-7.c: Add noclone attribute, remove xfail.

--- gcc/tree-vect-loop.c.jj2013-06-06 08:39:24.0 +0200
+++ gcc/tree-vect-loop.c   2013-06-25 11:17:02.947602981 +0200
@@ -500,7 +500,7 @@ vect_determine_vectorization_factor (loo
 /* Function vect_is_simple_iv_evolution.
 
FORNOW: A simple evolution of an induction variables in the loop is
-   considered a polynomial evolution with constant step.  */
+   considered a polynomial evolution.  */
 
 static bool
vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree *
init,
@@ -509,6 +509,7 @@ vect_is_simple_iv_evolution (unsigned lo
   tree init_expr;
   tree step_expr;
 tree evolution_part = evolution_part_in_loop_num (access_fn, loop_nb);
+  basic_block bb;
 
   /* When there is no evolution in this loop, the evolution function
  is not simple.  */
@@ -534,7 +535,10 @@ vect_is_simple_iv_evolution (unsigned lo
   *init = init_expr;
   *step = step_expr;
 
-  if (TREE_CODE (step_expr) != INTEGER_CST)
+  if (TREE_CODE (step_expr) != INTEGER_CST
+   (TREE_CODE (step_expr) != SSA_NAME
+|| ((bb = gimple_bb (SSA_NAME_DEF_STMT (step_expr)))
+ flow_bb_inside_loop_p (get_loop (cfun, loop_nb), bb
 {
   if (dump_enabled_p ())
 dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -556,7 +560,7 @@ static void
vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop
*loop)
 {
   basic_block bb = loop-header;
-  tree dumy;
+  tree init, step;
   vecgimple worklist;
   worklist.create (64);
   gimple_stmt_iterator gsi;
@@ -605,7 +609,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_i
   }
 
   if (!access_fn
-|| !vect_is_simple_iv_evolution (loop-num, access_fn, dumy,
dumy))
+|| !vect_is_simple_iv_evolution (loop-num, access_fn, init,
step)
+|| (LOOP_VINFO_LOOP (loop_vinfo) != loop
+ TREE_CODE (step) != INTEGER_CST))
   {
 worklist.safe_push (phi);
 continue;
@@ -3273,10 +3279,14 @@ get_initial_def_for_induction (gimple iv
   expr = build_int_cst (TREE_TYPE (step_expr), vf);
   new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
 expr, step_expr);
+  if (TREE_CODE (step_expr) == SSA_NAME)
+  new_name = vect_init_vector (iv_phi, new_name,
+   TREE_TYPE (step_expr), NULL);
 }
 
   t = unshare_expr (new_name);
-  gcc_assert (CONSTANT_CLASS_P (new_name));
+  gcc_assert (CONSTANT_CLASS_P (new_name)
+|| TREE_CODE (new_name) == SSA_NAME);
   stepvectype = get_vectype_for_scalar_type (TREE_TYPE (new_name));
   gcc_assert (stepvectype);
   new_vec = build_vector_from_val (stepvectype, t);
@@ -3332,8 +3342,12 @@ get_initial_def_for_induction (gimple iv
   expr = build_int_cst (TREE_TYPE (step_expr), nunits);
   new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
 expr, step_expr);
+  if (TREE_CODE (step_expr) == SSA_NAME)
+  new_name = vect_init_vector (iv_phi, new_name,
+   TREE_TYPE (step_expr), NULL);
   t = unshare_expr (new_name);
-  gcc_assert (CONSTANT_CLASS_P (new_name));
+  gcc_assert (CONSTANT_CLASS_P (new_name)
+|| TREE_CODE (new_name) == SSA_NAME);
   new_vec = build_vector_from_val (stepvectype, t);
  vec_step = vect_init_vector (iv_phi, new_vec, stepvectype, NULL);
 
--- gcc/testsuite/gcc.dg/vect/pr57705.c.jj 2013-06-25
10:15:21.037092153 +0200
+++ gcc/testsuite/gcc.dg/vect/pr57705.c2013-06-25 10:15:02.239733689
+0200
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+
+#include tree-vect.h
+
+int a[1024];
+unsigned char b[1024];
+
+extern void abort (void);
+
+__attribute__((noinline, noclone)) void
+foo (int k, int m)
+{
+  int 

Re: [C++ PR57640] Explicit call of system literal operator complains about leading underscore

2013-06-25 Thread Jason Merrill

OK.

Jason


Re: [C++] DR1473 - let literal operators be defined with empty user-defined string literal

2013-06-25 Thread Jason Merrill

On 06/25/2013 08:27 AM, Ed Smith-Rowland wrote:

+  else if (token-type == CPP_KEYWORD)
+   {
+ error (unexpected keyword;
+ Remove space between quotes and suffix identifier);
+ return error_mark_node;
+   }


Lower-case 'r' after a semicolon.

After giving the error, let's try to handle it properly anyway to avoid 
cascading errors.



+   if (TREE_STRING_LENGTH (string_tree)  2)


Why 2?  I would expect TREE_STRING_LENGTH for  to be 1 (the NUL).


+   error (expected empty string after %operator% keyword);
+   return error_mark_node;


And let's continue after the error here, too.


+  error (invalid encoding prefix in literal operator);
   return error_mark_node;


And here.

Jason



Re: [PATCH, PR 57208] Add ipa-cp created references to the symbol table

2013-06-25 Thread Jan Hubicka
 Hi,
 
 the patch reportedly fixes an issue when LTO building chromium.  It
 adds references that are created by IPA-CP when propagating references
 from aggregates (the scalar case is handled by the call graph
 infrastructure).
 
 Bootstrapped and tested on x86_64-linux.  OK for trunk?
 
 Thanks,
 
 Martin
 
 
 2013-06-24  Martin Jambor  mjam...@suse.cz
 
   PR lto/57208
   * ipa-cp.c (create_specialized_node): Add newly created references
   to the symbol table.
 
 Index: src/gcc/ipa-cp.c
 ===
 --- src.orig/gcc/ipa-cp.c
 +++ src/gcc/ipa-cp.c
 @@ -2663,6 +2663,7 @@ create_specialized_node (struct cgraph_n
  {
struct ipa_node_params *new_info, *info = IPA_NODE_REF (node);
vecipa_replace_map_p, va_gc *replace_trees = NULL;
 +  struct ipa_agg_replacement_value *av;
struct cgraph_node *new_node;
int i, count = ipa_get_param_count (info);
bitmap args_to_skip;
 @@ -2704,6 +2705,23 @@ create_specialized_node (struct cgraph_n
new_node = cgraph_create_virtual_clone (node, callers, replace_trees,
 args_to_skip, constprop);
ipa_set_node_agg_value_chain (new_node, aggvals);
 +  for (av = aggvals; av; av = av-next)
 +{
 +  tree base;
 +  if (TREE_CODE (av-value) != ADDR_EXPR)
 + continue;
 +  base = get_base_var (av-value);
 +  if (base  (TREE_CODE (base) == FUNCTION_DECL
 +|| TREE_CODE (base) == VAR_DECL))
 + {
 +   symtab_node referred = symtab_get_node (base);
 +
 +   gcc_checking_assert (referred);
 +   ipa_record_reference ((symtab_node) new_node, referred,
 + IPA_REF_ADDR, NULL);

There is identical code in cgraphclones.c doing the same for non-agg values.
Can you commonize it to (perhaps ipa_maybe_record_reference that will take
value as a parameter)?
OK with that change.

Honza
 + }
 +}
 +
if (dump_file  (dump_flags  TDF_DETAILS))
  {
fprintf (dump_file,  the new node is %s/%i.\n,


[c++-concepts] requires expression semantics

2013-06-25 Thread Andrew Sutton
Added a set of nodes to represent requirements inside of a requires
expression (EXPR_REQ, TYPE_REQ, NESTED_REQ), and a set of nodes
representing the actual checks of those requirements (VALIDEXPR_EXPR,
VALIDTYPE_EXPR, CONSTEXPR_EXPR).

The VALIDEXPR_EXPR, VALIDTYPE_EXPR, and CONSTEXPR_EXPR nodes are
essentially no different than TRAIT_EXPR or NOEXCEPT_EXPR nodes. They
evaluate properties of an operand.

This design is a little different than the previous implementation,
where I rendered the syntax directly into a conjunction of those
expressions.

I also added a nascent implementation of __is_convertible_to since
expression requirements include conversion requirements.

This patch does not include instantiation or decomposition rules. I
wanted to get the design reviewed before implementing the more
intricate stuff.


Changelog:

2013-06-24  Andrew Sutton  andrew.n.sut...@gmail.com
* gcc/cp/cxx-pretty-print.c (pp_cxx_primary_expression): Pretty
print new expr/req nodes.
(pp_cxx_requires_expr): New along with related functions for
pretty printing requirements.
* gcc/cp/cxx-pretty-print.h (pp_cxx_requires_expr): New along with
related functions for pretty printing requirements.
* gcc/cp/semantics.c (convertible_to_p): Implement __is_convertible_to
type trait.
(trait_expr_value): Evaluate __is_convertible_to.
(finish_requires_expr): Implemented, along with other functions to
construct and evaluate nodes for template constraints.
* gcc/cp/parser.c (cp_parser_requires_expr): Update parser using new
requires expression nodes. Renamed some grammar productions to better
reflect the representation of the syntax.
(cp_parser_nested_requirement): Wrap results in a
NESTED_REQ node.
* gcc/cp/cp-tree.def: (REQUIRES_EXPR): New.
(EXPR_REQ): New.
(TYPE_REQ): New.
(NESTED_REQ): New.
(VALIDEXPR_EXPR): New.
(VALIDTYPE_EXPR): New.
(CONSTEXPR_EXPR): New.
* gcc/cp/cp-objcp-common.c (cp_common_init_ts): Make new nodes typed.
* gcc/cp/cp-tree.h (finish_expr_requirement): New.
(finish_type_requirement): New.
(finish_nested_requirement): New.
(finish_validexpr_expr): New.
(finish_validtype_expr): New.
(finish_constexpr_expr): New.
* gcc/cp/error.c: (dump_expr): Pretty print new nodes.

Andrew


reqexpr-2.patch
Description: Binary data


Re: [PATCH, x86] Use vector moves in memmove expanding

2013-06-25 Thread Michael Zolotukhin
Ping.

On 20 June 2013 20:56, Michael Zolotukhin
michael.v.zolotuk...@gmail.com wrote:
 It seems that one of the tests needed a small fix.
 Attached is a corrected version.

 On 20 June 2013 17:16, Michael Zolotukhin
 michael.v.zolotuk...@gmail.com wrote:
 Hi,
 I added two tests to verify we generate vector instructions when
 vector_loop is used.
 Is the patch ok with that change?

 Thanks, Michael

 On 5 June 2013 18:10, Michael Zolotukhin michael.v.zolotuk...@gmail.com 
 wrote:
 I'll prepare some tests shortly,
 What about the rest questions?

 Thanks, Michael

 On 15 May 2013 19:45, H.J. Lu hjl.to...@gmail.com wrote:
 On Wed, May 15, 2013 at 5:47 AM, Michael Zolotukhin
 michael.v.zolotuk...@gmail.com wrote:
 Hi HJ,
 You use Pmode as the largest integer mode.  Is word_mode better
 than Pmode since word_mode is DI and Pmode may be SI for x32.
 I updated the patch to use word_mode instead of Pmode.  Bootstrap,
 make check and Specs2000 are ok.

 Thanks, Michael

 On 14 May 2013 19:55, H.J. Lu hjl.to...@gmail.com wrote:
 On Tue, May 14, 2013 at 7:34 AM, Michael Zolotukhin
 michael.v.zolotuk...@gmail.com wrote:
 Hi,
 I attached an updated version of the patch.  Looks like the 64-bit 
 issue is
 resolved in it (now a vector mode is explicitly chosen instead of TI- or
 another integer mode).  Also, some of remarks are fixed in it - some
 others are still not changed, because I don't know what to do with them 
 right
 now (see my questions in the previous letter).

 Could you take a look at the patch?

 I checked it on i386/x86_64 bootstrap and make check, and on 
 Specs2000/2006
 (I checked only stability).


 You use Pmode as the largest integer mode.  Is word_mode better
 than Pmode since word_mode is DI and Pmode may be SI for x32.



 You should include tests to verify that it works as
 expected.


 --
 H.J.



 --
 ---
 Best regards,
 Michael V. Zolotukhin,
 Software Engineer
 Intel Corporation.



 --
 ---
 Best regards,
 Michael V. Zolotukhin,
 Software Engineer
 Intel Corporation.



 --
 ---
 Best regards,
 Michael V. Zolotukhin,
 Software Engineer
 Intel Corporation.



-- 
---
Best regards,
Michael V. Zolotukhin,
Software Engineer
Intel Corporation.


Re: [PATCH] Replace dynamic arrays with vec_tree in Array Notation for C

2013-06-25 Thread Richard Henderson
On 06/21/2013 05:50 PM, Iyer, Balaji V wrote:
 Hello Richard et al.,
   As I mentioned in my previous email, I have changed all the dynamic 
 array usage in the Array notation for C with vec_trees. I have also made them 
 share the structures from Array Notation for C++. 
   In addition, I have replaced the cp_length_mismatch_in_expr_p from the 
 C++ array notation with one in array-notation-common since the parameters 
 will now match.
 
 Is this OK for trunk? It is passing all the array notation tests in x86 and 
 x86_64. It is also passing/failing all other tests as it is supposed to.
 
 Here are the ChangeLog Entries:
 
 gcc/c-family/ChangeLog
 2013-06-21  Balaji V. Iyer  balaji.v.i...@intel.com
 
 * array-notation-common.c (length_mismatch_in_expr): Changed the
 parameter type's from a dynamic array to a vec_tree.  Also removed
 the size parameters.
 * c-common.h (length_mismatch_in_expr_p): Fixed prototype's as per
 the change above.
 
 gcc/cp/ChangeLog
 2013-06-21  Balaji V. Iyer  balaji.v.i...@intel.com
 
 * cp-array-notation.c (cp_length_mismatch_in_expr_p): Remove.
 (expand_an_in_modify_expr): Changed a function call from the above
 removed function to length_mismatch_in_expr_p.
 
 gcc/c/ChangeLog
 2013-06-21  Balaji V. Iyer  balaji.v.i...@intel.com
 
 * c-array-notation.c (make_triplet_val_inv): New function.
 (create_cmp_incr): Likewise.
 (create_array_refs): Likewise.
 (fix_builtin_array_notation_fn): Replaced all mallocs with tree vec.
 Also modularized common parts between functions and called the 
 function.
 (build_array_notation_expr): Likewise.
 (fix_conditional_array_notations_1): Likewise.
 (fix_array_notation_expr): Likewise.
 (fix_array_notation_call_expr): Likewise.
 
 
 Thanks,
 
 Balaji V. Iyer. 
 

Ok.


r~


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

2013-06-25 Thread Jason Merrill

On 06/24/2013 06:23 PM, Iyer, Balaji V wrote:

Actually, to reduce the amount of changes to non-AN code, let's put the AN case
third, after the offset and {} cases, so you get something like

else if (flag_enable_cilkplus)
   {
 tree an = cp_parser_array_notation (loc, parser, index,
postfix_expression);
 if (an)
   return an;
 /* Otherwise, cp_parser_array_notation set 'index'. */
   }
else
   index = cp_parser_expression (parser, /*cast_p=*/false, NULL);

this way the change is just a few added lines, and everything else is in
cp_parser_array_notation.



If I do it this way, then I don't think I will be able to handle a normal array 
reference when cilk plus is enabled.


What I had in mind is that in the case of a normal array reference, 
cp_parser_array_notation will update index (which is passed by address) 
and return NULL_TREE, so that it gets back on the normal path.



One thing I could do is to assume that people won't use array notations in 
braced list. I had it like this a while back but I made the change to make sure 
I have covered more cases. Please let me know if that is OK and I will fix it.


Yes, that's OK.


I looked into this. But, magic_varargs_p is static to call.c. Should I make it 
non-static?


Yes.


After making it non-static I was planning to do something like this:

if (magic_varargs_p (fndecl)
  Nargs = (*params)-length ();
else
   nargs = convert_arguments (...)

Is that OK with you?


I was thinking to check magic_varargs_p in convert_arguments, where it 
currently has



  if (fndecl  DECL_BUILT_IN (fndecl)
   DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CONSTANT_P)
/* Don't do ellipsis conversion for __built_in_constant_p
   as this will result in spurious errors for non-trivial
   types.  */


change to if (fndecl  magic_varargs_p (fndecl))


By the way, why are you breaking out the elements of the
ARRAY_NOTATION_REF into a cilkplus_an_parts rather than using the _REF
directly?


I use the different parts of array notations for error checking and to create 
the outer for-loop. Also, to create the ARRAY_REF I need the induction variable.


I understand the need for cilkplus_an_loop_parts, but cilkplus_an_parts 
seems to contain exactly the same information as the ARRAY_NOTATION_REF.



Fixed! By the way, what is SFINAE?


SFINAE stands for substitution failure is not an error.  During 
template argument deduction, once we have a full set of template 
arguments we try to substitute them into the template declaration.  In 
that context, things that would normally cause an error just fail and 
return error_mark_node silently.



diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 55ed6a5..9d570b2 100644
Binary files a/gcc/cp/ChangeLog and b/gcc/cp/ChangeLog differ


This patch still has ChangeLog entries.


+  new_var = get_temp_regvar (TREE_TYPE (retval_expr),
+build_zero_cst (TREE_TYPE (retval_expr)));
   new_mod = expand_an_in_modify_expr (loc, new_var, NOP_EXPR,
+ TREE_OPERAND (retval_expr, 1),
+ tf_warning_or_error);


Why not pass TREE_OPERAND (retval_expr, 1) as the init to get_temp_regvar?


- parser-colon_corrects_to_scope_p = saved_colon_corrects_to_scope_p;
  if (!length_index || length_index == error_mark_node)
cp_parser_skip_to_end_of_statement (parser);

@@ -6180,7 +6158,6 @@ cp_parser_array_notation (location_t loc, cp_parser 
*parser, tree init_index,
  saved_colon_corrects_to_scope_p =
parser-colon_corrects_to_scope_p;
  /* Disable correcting single colon correcting to scope.  */
- parser-colon_corrects_to_scope_p = false;


This change looks like now you will only restore 
parser-colon_corrects_to_scope_p if you have a stride.  I would suggest 
putting back the first restore, and removing all the corrects_to_scope_p 
code from the stride block, since there can't be an array-notation colon 
after the stride.



+   /* If stride and start are of same type and the induction var
+  is not, convert induction variable to stride's type.  */
+   if (TREE_TYPE (start) == TREE_TYPE (stride)
+TREE_TYPE (stride) != TREE_TYPE (var))


This seems impossible, since 'var' is created to have the same type as 'start'.


As you suggested further in the email, I have made var of type ptrdiff_type, so 
I think I should keep this.


I think it would be better to convert start/stride to ptrdiff_t.

Incidentally, types should be compared with same_type_p rather than ==.


+  if (lhs_list_size  0  rhs_list_size  0  lhs_rank  0  rhs_rank  0
+   TREE_CODE (lhs_len) == INTEGER_CST  rhs_len
+   TREE_CODE (rhs_len) == INTEGER_CST)
+{
+  HOST_WIDE_INT l_length = int_cst_value (lhs_len);
+  HOST_WIDE_INT r_length = int_cst_value 

New Chinese (traditional) PO file for 'gcc' (version 4.8.0)

2013-06-25 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Chinese (traditional) team of translators.  The file is available at:

http://translationproject.org/latest/gcc/zh_TW.po

(This file, 'gcc-4.8.0.zh_TW.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.
coordina...@translationproject.org



[c++-concepts] out-of-class member definition

2013-06-25 Thread Andrew Sutton
Adds initial support for matching constrained out-of-class member
function definitions to their declarations. Like so:

templatetypename T
  struct S
  {
void f(const T x)
  requires CopyableT();
  };

templatetypename T
  void ST::f() requires CopyableT() { ... };

This does not a complete solution. It won't correctly match ST
against specializations (if any exist), nor will it match f, if f is
declared as a member function template. I'll address this after some
changes to class templates.

Changelog:

2013-06-24  Andrew Sutton  andrew.n.sut...@gmail.com
* gcc/cp/parser.c (cp_parser_init_declarator): Parse template
requirements for out-of-class member definitions.
* gcc/cp/decl2.c (check_classfn): Include match out-of-class
definitions using constraints.
* gcc/cp/constraint.cc (equivalently_constrained). Use get_constraints.
(more_constrained). Use get_constraints.

Andrew


memfun.patch
Description: Binary data


[PATCH, AArch64] Minor refactoring of aarch64_add_offset

2013-06-25 Thread Yufeng Zhang
This patch carries out minor refactoring on aarch64_add_offset; it 
replaces 'DImode' and 'Pmode' with 'mode'.


OK for the trunk?

Thanks,
Yufeng


gcc/

* config/aarch64/aarch64.c (aarch64_add_offset): Change to pass
'mode' to aarch64_plus_immediate and gen_rtx_PLUS.diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 527b00d..81c6fd9 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -804,7 +804,7 @@ aarch64_force_temporary (rtx x, rtx value)
 static rtx
 aarch64_add_offset (enum machine_mode mode, rtx temp, rtx reg, HOST_WIDE_INT offset)
 {
-  if (!aarch64_plus_immediate (GEN_INT (offset), DImode))
+  if (!aarch64_plus_immediate (GEN_INT (offset), mode))
 {
   rtx high;
   /* Load the full offset into a register.  This
@@ -812,7 +812,7 @@ aarch64_add_offset (enum machine_mode mode, rtx temp, rtx reg, HOST_WIDE_INT off
   high = GEN_INT (offset);
   offset = 0;
   high = aarch64_force_temporary (temp, high);
-  reg = aarch64_force_temporary (temp, gen_rtx_PLUS (Pmode, high, reg));
+  reg = aarch64_force_temporary (temp, gen_rtx_PLUS (mode, high, reg));
 }
   return plus_constant (mode, reg, offset);
 }

[PATCH, AArch64] Minor refactoring of aarch64_force_temporary

2013-06-25 Thread Yufeng Zhang
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?

Thanks,
Yufeng

gcc/

* config/aarch64/aarch64.c (aarch64_force_temporary): Add an extra
parameter 'mode' of type 'enum machine_mode mode'; change to pass
'mode' to force_reg.
(aarch64_add_offset): Update calls to aarch64_force_temporary.
(aarch64_expand_mov_immediate): Likewise.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 81c6fd9..77591c1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -789,10 +789,10 @@ aarch64_split_simd_move (rtx dst, rtx src)
 }
 
 static rtx
-aarch64_force_temporary (rtx x, rtx value)
+aarch64_force_temporary (enum machine_mode mode, rtx x, rtx value)
 {
   if (can_create_pseudo_p ())
-return force_reg (Pmode, value);
+return force_reg (mode, value);
   else
 {
   x = aarch64_emit_move (x, value);
@@ -811,8 +811,9 @@ aarch64_add_offset (enum machine_mode mode, rtx temp, rtx reg, HOST_WIDE_INT off
  might be improvable in the future.  */
   high = GEN_INT (offset);
   offset = 0;
-  high = aarch64_force_temporary (temp, high);
-  reg = aarch64_force_temporary (temp, gen_rtx_PLUS (mode, high, reg));
+  high = aarch64_force_temporary (mode, temp, high);
+  reg = aarch64_force_temporary (mode, temp,
+ gen_rtx_PLUS (mode, high, reg));
 }
   return plus_constant (mode, reg, offset);
 }
@@ -851,7 +852,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
 	   targetm.cannot_force_const_mem (mode, imm))
 	{
 	  gcc_assert(can_create_pseudo_p ());
-	  base = aarch64_force_temporary (dest, base);
+	  base = aarch64_force_temporary (mode, dest, base);
 	  base = aarch64_add_offset (mode, NULL, base, INTVAL (offset));
 	  aarch64_emit_move (dest, base);
 	  return;
@@ -868,7 +869,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
 	  if (offset != const0_rtx)
 	{
 	  gcc_assert(can_create_pseudo_p ());
-	  base = aarch64_force_temporary (dest, base);
+	  base = aarch64_force_temporary (mode, dest, base);
 	  base = aarch64_add_offset (mode, NULL, base, INTVAL (offset));
 	  aarch64_emit_move (dest, base);
 	  return;

Go patch committed: Fix some type determination issues

2013-06-25 Thread Ian Lance Taylor
This patch to the Go frontend fixes some type determination issues that
show up in the current master Go testsuite.  There were some cases where
types were not being determined, which lead to incorrect error messages
and in some cases the wrong thing happening.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and 4.8
branch.

Ian

diff -r 478ec87a337f go/expressions.cc
--- a/go/expressions.cc	Mon Jun 24 16:09:40 2013 -0700
+++ b/go/expressions.cc	Tue Jun 25 09:21:43 2013 -0700
@@ -5668,6 +5668,7 @@
   if (tleft-is_abstract()
 	   subcontext.type != NULL
 	   !subcontext.may_be_abstract
+	   subcontext.type-interface_type() == NULL
 	   subcontext.type-integer_type() == NULL)
 	this-report_error((invalid context-determined non-integer type 
 			for left operand of shift));
@@ -7383,6 +7384,8 @@
   Type* uintptr_type = Type::lookup_integer_type(uintptr);
   int uintptr_bits = uintptr_type-integer_type()-bits();
 
+  Type_context int_context(Type::lookup_integer_type(int), false);
+
   ++parg;
   Expression* len_arg;
   if (parg == args-end())
@@ -7401,6 +7404,7 @@
   else
 {
   len_arg = *parg;
+  len_arg-determine_type(int_context);
   if (!this-check_int_value(len_arg, true))
 	return Expression::make_error(this-location());
   if (len_arg-type()-integer_type() != NULL
@@ -7413,6 +7417,7 @@
   if (is_slice  parg != args-end())
 {
   cap_arg = *parg;
+  cap_arg-determine_type(int_context);
   if (!this-check_int_value(cap_arg, false))
 	return Expression::make_error(this-location());
 
@@ -8030,6 +8035,8 @@
 case BUILTIN_REAL:
 case BUILTIN_IMAG:
   arg_type = Builtin_call_expression::complex_type(context-type);
+  if (arg_type == NULL)
+	arg_type = Type::lookup_complex_type(complex128);
   is_print = false;
   break;
 
@@ -8038,6 +8045,8 @@
 	// For the complex function the type of one operand can
 	// determine the type of the other, as in a binary expression.
 	arg_type = Builtin_call_expression::real_imag_type(context-type);
+	if (arg_type == NULL)
+	  arg_type = Type::lookup_float_type(float64);
 	if (args != NULL  args-size() == 2)
 	  {
 	Type* t1 = args-front()-type();
@@ -10379,13 +10388,20 @@
 void
 Array_index_expression::do_check_types(Gogo*)
 {
-  if (this-start_-type()-integer_type() == NULL)
+  Numeric_constant nc;
+  unsigned long v;
+  if (this-start_-type()-integer_type() == NULL
+   !this-start_-type()-is_error()
+   (!this-start_-numeric_constant_value(nc)
+	  || nc.to_unsigned_long(v) == Numeric_constant::NC_UL_NOTINT))
 this-report_error(_(index must be integer));
   if (this-end_ != NULL
this-end_-type()-integer_type() == NULL
!this-end_-type()-is_error()
!this-end_-is_nil_expression()
-   !this-end_-is_error_expression())
+   !this-end_-is_error_expression()
+   (!this-end_-numeric_constant_value(nc)
+	  || nc.to_unsigned_long(v) == Numeric_constant::NC_UL_NOTINT))
 this-report_error(_(slice end must be integer));
 
   Array_type* array_type = this-array_-type()-array_type();
diff -r 478ec87a337f go/statements.cc
--- a/go/statements.cc	Mon Jun 24 16:09:40 2013 -0700
+++ b/go/statements.cc	Tue Jun 25 09:21:43 2013 -0700
@@ -569,7 +569,10 @@
 Assignment_statement::do_determine_types()
 {
   this-lhs_-determine_type_no_context();
-  Type_context context(this-lhs_-type(), false);
+  Type* rhs_context_type = this-lhs_-type();
+  if (rhs_context_type-is_sink_type())
+rhs_context_type = NULL;
+  Type_context context(rhs_context_type, false);
   this-rhs_-determine_type(context);
 }
 


[Patch, AArch64] Vector cost model.

2013-06-25 Thread Tejas Belagod


Hi,

The attached patch implements a generic vector cost model for aarch64.

Regression tested on aarch64-none-elf.

OK?

Thanks,
Tejas Belagod.
ARM.

2013-06-25  Tejas Belagod  tejas.bela...@arm.com

gcc/
* config/aarch64/aarch64-protos.h (cpu_vector_cost): New.
(tune_params): New member 'const vec_costs'.
* config/aarch64/aarch64.c (generic_vector_cost): New.
(generic_tunings): New member 'generic_vector_cost'.
(aarch64_builtin_vectorization_cost): New.
(aarch64_add_stmt_cost): New.
(TARGET_VECTORIZE_ADD_STMT_COST): New.
(TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): New.diff --git a/gcc/config/aarch64/aarch64-protos.h 
b/gcc/config/aarch64/aarch64-protos.h
index 001842e..28d8bae 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -126,11 +126,34 @@ struct cpu_regmove_cost
   const int FP2FP;
 };
 
+/* Cost for vector insn classes.  */
+struct cpu_vector_cost
+{
+  const int scalar_stmt_cost;   /* Cost of any scalar operation,
+   excluding load and store.  */
+  const int scalar_load_cost;   /* Cost of scalar load.  */
+  const int scalar_store_cost;  /* Cost of scalar store.  */
+  const int vec_stmt_cost;  /* Cost of any vector operation,
+   excluding load, store,
+   vector-to-scalar and
+   scalar-to-vector operation.  */
+  const int vec_to_scalar_cost; /* Cost of vec-to-scalar 
operation.  */
+  const int scalar_to_vec_cost; /* Cost of scalar-to-vector
+   operation.  */
+  const int vec_align_load_cost;/* Cost of aligned vector load.  */
+  const int vec_unalign_load_cost;  /* Cost of unaligned vector load.  */
+  const int vec_unalign_store_cost; /* Cost of unaligned vector store.  */
+  const int vec_store_cost; /* Cost of vector store.  */
+  const int cond_taken_branch_cost; /* Cost of taken branch.  */
+  const int cond_not_taken_branch_cost;  /* Cost of not taken branch.  */
+};
+
 struct tune_params
 {
   const struct cpu_rtx_cost_table *const insn_extra_cost;
   const struct cpu_addrcost_table *const addr_cost;
   const struct cpu_regmove_cost *const regmove_cost;
+  const struct cpu_vector_cost *const vec_costs;
   const int memmov_cost;
 };
 
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index d32563d..05eae32 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -45,6 +45,8 @@
 #include gimple.h
 #include optabs.h
 #include dwarf2.h
+#include cfgloop.h
+#include tree-vectorizer.h
 
 /* Classifies an address.
 
@@ -178,6 +180,26 @@ static const struct cpu_regmove_cost generic_regmove_cost =
   NAMED_PARAM (FP2FP, 4)
 };
 
+/* Generic costs for vector insn classes.  */
+#if HAVE_DESIGNATED_INITIALIZERS  GCC_VERSION = 2007
+__extension__
+#endif
+static const struct cpu_vector_cost generic_vector_cost =
+{
+  NAMED_PARAM (scalar_stmt_cost, 1),
+  NAMED_PARAM (scalar_load_cost, 1),
+  NAMED_PARAM (scalar_store_cost, 1),
+  NAMED_PARAM (vec_stmt_cost, 1),
+  NAMED_PARAM (vec_to_scalar_cost, 1),
+  NAMED_PARAM (scalar_to_vec_cost, 1),
+  NAMED_PARAM (vec_align_load_cost, 1),
+  NAMED_PARAM (vec_unalign_load_cost, 1),
+  NAMED_PARAM (vec_unalign_store_cost, 1),
+  NAMED_PARAM (vec_store_cost, 1),
+  NAMED_PARAM (cond_taken_branch_cost, 3),
+  NAMED_PARAM (cond_not_taken_branch_cost, 1)
+};
+
 #if HAVE_DESIGNATED_INITIALIZERS  GCC_VERSION = 2007
 __extension__
 #endif
@@ -186,6 +208,7 @@ static const struct tune_params generic_tunings =
   generic_rtx_cost_table,
   generic_addrcost_table,
   generic_regmove_cost,
+  generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4)
 };
 
@@ -4641,6 +4664,101 @@ aarch64_memory_move_cost (enum machine_mode mode 
ATTRIBUTE_UNUSED,
   return aarch64_tune_params-memmov_cost;
 }
 
+/* Vectorizer cost model target hooks.  */
+
+/* Implement targetm.vectorize.builtin_vectorization_cost.  */
+static int
+aarch64_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
+   tree vectype,
+   int misalign ATTRIBUTE_UNUSED)
+{
+  unsigned elements;
+
+  switch (type_of_cost)
+{
+  case scalar_stmt:
+   return aarch64_tune_params-vec_costs-scalar_stmt_cost;
+
+  case scalar_load:
+   return aarch64_tune_params-vec_costs-scalar_load_cost;
+
+  case scalar_store:
+   return aarch64_tune_params-vec_costs-scalar_store_cost;
+
+  case vector_stmt:
+   return aarch64_tune_params-vec_costs-vec_stmt_cost;
+
+  case vector_load:
+   return aarch64_tune_params-vec_costs-vec_align_load_cost;
+
+  case vector_store:
+   return aarch64_tune_params-vec_costs-vec_store_cost;
+
+  case vec_to_scalar:
+

Go patch committed: Update shift test

2013-06-25 Thread Ian Lance Taylor
This patch updates the shift test to the current master version, to
correspond to the patch I just submitted.  Committed to mainline and 4.8
branch.

Ian

Index: gcc/testsuite/go.test/test/shift1.go
===
--- gcc/testsuite/go.test/test/shift1.go	(revision 200043)
+++ gcc/testsuite/go.test/test/shift1.go	(working copy)
@@ -23,7 +23,7 @@ var (
 
 // non-constant shift expressions
 var (
-	e1   = g(2.0  s) // ERROR invalid as type interface
+	e1   = g(2.0  s) // ERROR invalid|shift of non-integer operand as type interface
 	f1   = h(2  s)   // ERROR invalid as type float64
 	g1 int64 = 1.1  s// ERROR truncated
 )
@@ -36,3 +36,206 @@ var (
 	b2 = 1.0  c// ERROR overflow
 	d2 = f(1.0  c) // ERROR overflow
 )
+
+var (
+	// issues 4882, 4936.
+	a3 = 1.0s + 0 // ERROR invalid|shift of non-integer operand
+	// issue 4937
+	b3 = 1s + 1 + 1.0 // ERROR invalid|shift of non-integer operand
+	// issue 5014
+	c3 = complex(1s, 0) // ERROR invalid|shift of type float64
+	d3 int = complex(1s, 3) // ERROR non-integer|cannot use.*as type int shift of type float64
+	e3 = real(1  s) // ERROR invalid
+	f3 = imag(1  s) // ERROR invalid
+)
+
+// from the spec
+func _() {
+	var (
+		s uint  = 33
+		i   = 1  s // 1 has type int
+		j int32 = 1  s // 1 has type int32; j == 0
+		k   = uint64(1  s) // 1 has type uint64; k == 133
+		m int   = 1.0  s   // 1.0 has type int
+		n   = 1.0s != i// 1.0 has type int; n == false if ints are 32bits in size
+		o   = 1s == 2s   // 1 and 2 have type int; o == true if ints are 32bits in size
+		// next test only fails on 32bit systems
+		// p = 1s == 133  // illegal if ints are 32bits in size: 1 has type int, but 133 overflows int
+		u  = 1.0  s// ERROR non-integer|float64
+		u1 = 1.0s != 0 // ERROR non-integer|float64
+		u2 = 1s != 1.0 // ERROR non-integer|float64
+		v  float32 = 1  s  // ERROR non-integer|float32
+		w  int64   = 1.0  33   // 1.033 is a constant shift expression
+		_, _, _, _, _, _, _, _, _, _ = j, k, m, n, o, u, u1, u2, v, w
+	)
+}
+
+// shifts in comparisons w/ untyped operands
+var (
+	_ = 1s == 1
+	_ = 1s == 1.  // ERROR invalid|shift of type float64
+	_ = 1.s == 1  // ERROR invalid|shift of type float64
+	_ = 1.s == 1. // ERROR invalid|non-integer|shift of type float64
+
+	_ = 1s+1 == 1
+	_ = 1s+1 == 1.   // ERROR invalid|shift of type float64
+	_ = 1s+1. == 1   // ERROR invalid|shift of type float64
+	_ = 1s+1. == 1.  // ERROR invalid|shift of type float64
+	_ = 1.s+1 == 1   // ERROR invalid|shift of type float64
+	_ = 1.s+1 == 1.  // ERROR invalid|shift of type float64
+	_ = 1.s+1. == 1  // ERROR invalid|shift of type float64
+	_ = 1.s+1. == 1. // ERROR invalid|non-integer|shift of type float64
+
+	_ = 1s == 1s
+	_ = 1s == 1.s  // ERROR invalid|shift of type float64
+	_ = 1.s == 1s  // ERROR invalid|shift of type float64
+	_ = 1.s == 1.s // ERROR invalid|non-integer|shift of type float64
+
+	_ = 1s+1s == 1
+	_ = 1s+1s == 1.   // ERROR invalid|shift of type float64
+	_ = 1s+1.s == 1   // ERROR invalid|shift of type float64
+	_ = 1s+1.s == 1.  // ERROR invalid|shift of type float64
+	_ = 1.s+1s == 1   // ERROR invalid|shift of type float64
+	_ = 1.s+1s == 1.  // ERROR invalid|shift of type float64
+	_ = 1.s+1.s == 1  // ERROR invalid|shift of type float64
+	_ = 1.s+1.s == 1. // ERROR invalid|non-integer|shift of type float64
+
+	_ = 1s+1s == 1s+1s
+	_ = 1s+1s == 1s+1.s// ERROR invalid|shift of type float64
+	_ = 1s+1s == 1.s+1s// ERROR invalid|shift of type float64
+	_ = 1s+1s == 1.s+1.s   // ERROR invalid|shift of type float64
+	_ = 1s+1.s == 1s+1s// ERROR invalid|shift of type float64
+	_ = 1s+1.s == 1s+1.s   // ERROR invalid|shift of type float64
+	_ = 1s+1.s == 1.s+1s   // ERROR invalid|shift of type float64
+	_ = 1s+1.s == 1.s+1.s  // ERROR invalid|non-integer|shift of type float64
+	_ = 1.s+1s == 1s+1s// ERROR invalid|shift of type float64
+	_ = 1.s+1s == 1s+1.s   // ERROR invalid|shift of type float64
+	_ = 1.s+1s == 1.s+1s   // ERROR invalid|shift of type float64
+	_ = 1.s+1s == 1.s+1.s  // ERROR invalid|non-integer|shift of type float64
+	_ = 1.s+1.s == 1s+1s   // ERROR invalid|shift of type float64
+	_ = 1.s+1.s == 1s+1.s  // ERROR invalid|non-integer|shift of type float64
+	_ = 1.s+1.s == 1.s+1s  // ERROR invalid|non-integer|shift of type float64
+	_ = 1.s+1.s == 1.s+1.s // ERROR invalid|non-integer|shift of type float64
+)
+
+// shifts in comparisons w/ typed operands
+var (
+	x int
+	_ = 1s == x
+	_ = 1.s == x
+	_ = 1.1s == x // ERROR truncated
+
+	_ = 1s+x == 1
+	_ = 1s+x == 1.
+	_ = 1s+x == 1.1 // ERROR truncated
+	_ = 1.s+x == 1
+	_ = 1.s+x == 1.
+	_ = 1.s+x == 1.1  // ERROR truncated
+	_ = 1.1s+x == 1   // ERROR truncated
+	_ = 1.1s+x == 1.  // ERROR truncated
+	_ = 1.1s+x == 1.1 // ERROR truncated
+
+	_ = 1s == xs
+	_ = 1.s == xs
+	_ = 1.1s == xs // ERROR truncated

[PATCH, AArch64] Support abs standard pattern for DI mode

2013-06-25 Thread Ian Bolton
Hi,

I'm adding support for abs standard pattern name for DI mode,
via the ABS instruction in FP registers and the EOR/SUB combo
in GP registers.

Regression tests for Linux and bare-metal all passed.

OK for trunk?

Cheers,
Ian


2013-06-25  Ian Bolton  ian.bol...@arm.com

gcc/
* config/aarch64/aarch64-simd.md (absdi2): Support abs for
DI mode.

testsuite/
* gcc.target/aarch64/abs_1.c: New test.diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index e88e5be..3700977 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -2003,6 +2003,38 @@
(set_attr mode SI)]
 )
 
+(define_insn_and_split absdi2
+  [(set (match_operand:DI 0 register_operand =r,w)
+   (abs:DI (match_operand:DI 1 register_operand r,w)))
+   (clobber (match_scratch:DI 2 =r,X))]
+  
+  @
+   #
+   abs\\t%d0, %d1
+  reload_completed
+GP_REGNUM_P (REGNO (operands[0]))
+GP_REGNUM_P (REGNO (operands[1]))
+  [(const_int 0)]
+  {
+emit_insn (gen_rtx_SET (VOIDmode, operands[2],
+   gen_rtx_XOR (DImode,
+gen_rtx_ASHIFTRT (DImode,
+  operands[1],
+  GEN_INT (63)),
+operands[1])));
+emit_insn (gen_rtx_SET (VOIDmode,
+   operands[0],
+   gen_rtx_MINUS (DImode,
+  operands[2],
+  gen_rtx_ASHIFTRT (DImode,
+operands[1],
+GEN_INT (63);
+DONE;
+  }
+  [(set_attr v8type alu)
+   (set_attr mode DI)]
+)
+
 (define_insn negmode2
   [(set (match_operand:GPI 0 register_operand =r)
(neg:GPI (match_operand:GPI 1 register_operand r)))]
diff --git a/gcc/testsuite/gcc.target/aarch64/abs_1.c 
b/gcc/testsuite/gcc.target/aarch64/abs_1.c
new file mode 100644
index 000..938bc84
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/abs_1.c
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-options -O2 -fno-inline --save-temps } */
+
+extern long long llabs (long long);
+extern void abort (void);
+
+long long
+abs64 (long long a)
+{
+  /* { dg-final { scan-assembler eor\t } } */
+  /* { dg-final { scan-assembler sub\t } } */
+  return llabs (a);
+}
+
+long long
+abs64_in_dreg (long long a)
+{
+  /* { dg-final { scan-assembler abs\td\[0-9\]+, d\[0-9\]+ } } */
+  register long long x asm (d8) = a;
+  register long long y asm (d9);
+  asm volatile ( : : w (x));
+  y = llabs (x);
+  asm volatile ( : : w (y));
+  return y;
+}
+
+int
+main (void)
+{
+  volatile long long ll0 = 0LL, ll1 = 1LL, llm1 = -1LL;
+
+  if (abs64 (ll0) != 0LL)
+abort ();
+
+  if (abs64 (ll1) != 1LL)
+abort ();
+
+  if (abs64 (llm1) != 1LL)
+abort ();
+
+  if (abs64_in_dreg (ll0) != 0LL)
+abort ();
+
+  if (abs64_in_dreg (ll1) != 1LL)
+abort ();
+
+  if (abs64_in_dreg (llm1) != 1LL)
+abort ();
+
+  return 0;
+}
+
+/* { dg-final { cleanup-saved-temps } } */


Re: [PATCH,ARM] Define MAX_CONDITIONAL_EXECUTE

2013-06-25 Thread Ramana Radhakrishnan
On Mon, Jun 17, 2013 at 12:18 PM, Greta Yorsh greta.yo...@arm.com wrote:
 This patch makes the following changes:
 * Define MAX_CONDITIONAL_EXECUTE in arm backend using max_insns_skipped,
 which is set based on the current tune.
 * Update max_insns_skipped for Cortex-A15 tune to be 2 (instead of 5).
 * Use max_insns_skipped in thumb2_final_prescan_insn to decide when to
 combine IT blocks
 into larger IT blocks. Previously, max_insns_skipped was only used in
 arm_final_prescan_insn to decide when branch should be converted to
 conditional execution.

 No regression on qemu for arm-none-eabi with cortex-a15 arm/thumb mode.
 Bootstrap successful on Cortex-A15.

 Performance improvement on Cortex-A15 in both arm and thumb states on both
 Dhrystone and Coremark, and improvement on Spec2000 in thumb state, with all
 benchmarks showing improvements except three benchmarks in CFP2000 that have
 slight regressions (189,183,178).

 gcc/ChangeLog

 2013-06-17  Greta Yorsh  greta.yo...@arm.com

 * config/arm/arm.h (MAX_CONDITIONAL_EXECUTE): Define macro.
 * config/arm/arm-protos.h (arm_max_conditional_execute): New
 declaration.
 (tune_params): Update comment.
 * config/arm/arm.c (arm_cortex_a15_tune): Set max_cond_insns to 2.
 (arm_max_conditional_execute): New function.
 (thumb2_final_prescan_insn): Use max_insn_skipped and
 MAX_INSN_PER_IT_BLOCK to compute maximum instructions in a block.

Ok

Ramana


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

2013-06-25 Thread Iyer, Balaji V


 -Original Message-
 From: Jason Merrill [mailto:ja...@redhat.com]
 Sent: Tuesday, June 25, 2013 10:39 AM
 To: Iyer, Balaji V; Richard Henderson
 Cc: Aldy Hernandez; gcc-patches@gcc.gnu.org
 Subject: Re: [PATCH] Cilk Plus Array Notation for C++
 
 On 06/24/2013 06:23 PM, Iyer, Balaji V wrote:
  Actually, to reduce the amount of changes to non-AN code, let's put
  the AN case third, after the offset and {} cases, so you get
  something like
 
  else if (flag_enable_cilkplus)
 {
   tree an = cp_parser_array_notation (loc, parser, index,
 postfix_expression);
   if (an)
 return an;
   /* Otherwise, cp_parser_array_notation set 'index'. */
 }
  else
 index = cp_parser_expression (parser, /*cast_p=*/false, NULL);
 
  this way the change is just a few added lines, and everything else is
  in cp_parser_array_notation.
 
  If I do it this way, then I don't think I will be able to handle a normal 
  array
 reference when cilk plus is enabled.
 
 What I had in mind is that in the case of a normal array reference,
 cp_parser_array_notation will update index (which is passed by address) and
 return NULL_TREE, so that it gets back on the normal path.
 
  One thing I could do is to assume that people won't use array notations in
 braced list. I had it like this a while back but I made the change to make 
 sure I
 have covered more cases. Please let me know if that is OK and I will fix it.
 
 Yes, that's OK.
 


  I looked into this. But, magic_varargs_p is static to call.c. Should I make 
  it non-
 static?
 
 Yes.
 
  After making it non-static I was planning to do something like this:
 
  if (magic_varargs_p (fndecl)
Nargs = (*params)-length ();
  else
 nargs = convert_arguments (...)
 
  Is that OK with you?
 
 I was thinking to check magic_varargs_p in convert_arguments, where it
 currently has
 
if (fndecl  DECL_BUILT_IN (fndecl)
 DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CONSTANT_P)
  /* Don't do ellipsis conversion for __built_in_constant_p
 as this will result in spurious errors for non-trivial
 types.  */
 
 change to if (fndecl  magic_varargs_p (fndecl))
 

This change is implemented.

  By the way, why are you breaking out the elements of the
  ARRAY_NOTATION_REF into a cilkplus_an_parts rather than using the
  _REF directly?
 
  I use the different parts of array notations for error checking and to 
  create the
 outer for-loop. Also, to create the ARRAY_REF I need the induction variable.
 
 I understand the need for cilkplus_an_loop_parts, but cilkplus_an_parts seems
 to contain exactly the same information as the ARRAY_NOTATION_REF.
 
  Fixed! By the way, what is SFINAE?
 
 SFINAE stands for substitution failure is not an error.  During template
 argument deduction, once we have a full set of template arguments we try to
 substitute them into the template declaration.  In that context, things that
 would normally cause an error just fail and return error_mark_node silently.
 
  diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index
  55ed6a5..9d570b2 100644 Binary files a/gcc/cp/ChangeLog and
  b/gcc/cp/ChangeLog differ
 
 This patch still has ChangeLog entries.
 

This time, I ran the command you gave me. Please tell me how it looks.

  +  new_var = get_temp_regvar (TREE_TYPE (retval_expr),
  +build_zero_cst (TREE_TYPE (retval_expr)));
 new_mod = expand_an_in_modify_expr (loc, new_var, NOP_EXPR,
  + TREE_OPERAND (retval_expr, 1),
  + tf_warning_or_error);
 
 Why not pass TREE_OPERAND (retval_expr, 1) as the init to get_temp_regvar?
 


new_var = TREE_OPERAND (retval_expr, 1)

and if TREE_OPERAND (retval_expr, 1) has array notations then it wont get 
expanded correctly.

Another solution is to replace get_tmp_regvar with get_temporary_var () + 
add_decl_expr (..). I have implemented this because it looks more correct


  - parser-colon_corrects_to_scope_p =
 saved_colon_corrects_to_scope_p;
if (!length_index || length_index == error_mark_node)
  cp_parser_skip_to_end_of_statement (parser);
 
  @@ -6180,7 +6158,6 @@ cp_parser_array_notation (location_t loc,
 cp_parser *parser, tree init_index,
saved_colon_corrects_to_scope_p =
  parser-colon_corrects_to_scope_p;
/* Disable correcting single colon correcting to scope.  */
  - parser-colon_corrects_to_scope_p = false;
 
 This change looks like now you will only restore
 parser-colon_corrects_to_scope_p if you have a stride.  I would suggest
 putting back the first restore, and removing all the corrects_to_scope_p code
 from the stride block, since there can't be an array-notation colon after the
 stride.

I am setting the scope correction to false right before I look for length and 
restore it right after I parse the scope (i.e. outside the 

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

2013-06-25 Thread Jason Merrill

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

This time, I ran the command you gave me. Please tell me how it looks.


No ChangeLog this time, thanks.


Another solution is to replace get_tmp_regvar with get_temporary_var () + add_decl_expr 
(..). I have implemented this because it looks more correct


OK.


I am setting the scope correction to false right before I look for length and 
restore it right after I parse the scope (i.e. outside the if-statement). I 
think this should fix the issue.


OK.


I think it would be better to convert start/stride to ptrdiff_t.


I don't think I can do that. Stride can be negative and if I am not mistaken, 
ptrdiff_t is unsigned.


You are mistaken.  :)
ptrdiff_t is the signed version of size_t.


What I had in mind is that in the case of a normal array reference,
cp_parser_array_notation will update index (which is passed by address) and
return NULL_TREE, so that it gets back on the normal path.


It doesn't look like you addressed this comment.


+  if (processing_template_decl)
+{
+  array_type = TREE_TYPE (array_value);
+  type = TREE_TYPE (array_type);
+}


We should be able to parse array notation in a template even when the array
expression has unknown type.  In a template, just parse and remember the raw
expressions without worrying about diagnostics and conversions.


Or this one.


+  /* If an array's index is an array notation, then its rank cannot be
+ greater than one.  */


This one error is much easier to do it here than anywhere else. An array_ref 
could be a parameter inside a function, part of a modify expression, unary 
expression etc. If I move it to transformation stage, I have to do checks in 
all these places and there is a small chance some will slip through the cracks. 
This is almost a fool proof way of doing it. Such things have been done before. 
For example, Open MP does a return expression check in finish_return_stmt (even 
though this is a different issue we are talking about).


What's the failure mode if one is missed?  I would expect it to be 
pretty obvious.



If it is the code lines that is an issue, then I am willing to enclose that in 
a function or #define.


But I guess splitting it out into a separate function is OK.


What remaining obstacles are there to sharing most of the expansion code
between C and C++?  That can be a separate patch, of course.


Any thoughts?

Jason



Re: [PATCH] Basic support for MIPS r5900

2013-06-25 Thread Richard Sandiford
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?

Thanks,
Richard


gcc/
* config.gcc (mips*-mti-elf*, mips*-sde-elf*, mips64r5900-*-elf*)
(mips64r5900el-*-elf*): Include mips/n32-elf.h.
* config/mips/sde.h (LOCAL_LABEL_PREFIX, NO_DOLLAR_IN_LABEL)
(LONG_DOUBLE_TYPE_SIZE, LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Move to...
* config/mips/n32-elf.h: ...this new file.

Index: gcc/config.gcc
===
--- gcc/config.gcc  2013-06-25 22:15:25.414731542 +0100
+++ gcc/config.gcc  2013-06-25 22:15:29.076761150 +0100
@@ -1850,12 +1850,12 @@ mips*-*-linux*) # Linux MIPS, 
either
 esac
;;
 mips*-mti-elf*)
-   tm_file=elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h 
mips/mti-elf.h
+   tm_file=elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h 
mips/sde.h mips/mti-elf.h
tmake_file=mips/t-mti-elf
tm_defines=${tm_defines} MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32
;;
 mips*-sde-elf*)
-   tm_file=elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h
+   tm_file=elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h 
mips/sde.h
tmake_file=mips/t-sde
extra_options=${extra_options} mips/sde.opt
case ${with_newlib} in
@@ -1937,7 +1937,7 @@ mips-*-elf* | mipsel-*-elf* | mipsr5900-
tmake_file=mips/t-elf
;;
 mips64r5900-*-elf* | mips64r5900el-*-elf*)
-   tm_file=elfos.h newlib-stdint.h ${tm_file} mips/elf.h
+   tm_file=elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h
tmake_file=mips/t-elf
tm_defines=${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32
;;
Index: gcc/config/mips/sde.h
===
--- gcc/config/mips/sde.h   2013-06-25 22:15:27.563748916 +0100
+++ gcc/config/mips/sde.h   2013-06-25 22:15:33.443796467 +0100
@@ -89,23 +89,6 @@ #define SIZE_TYPE long unsigned int
 #undef PTRDIFF_TYPE
 #define PTRDIFF_TYPE long int
 
-/* Use standard ELF-style local labels (not '$' as on early Irix).  */
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX .
-
-/* Use periods rather than dollar signs in special g++ assembler names.  */
-#define NO_DOLLAR_IN_LABEL
-
-/* Currently we don't support 128bit long doubles, so for now we force
-   n32 to be 64bit.  */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-#ifdef IN_LIBGCC2
-#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
-#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
-#endif
-
 /* Force all .init and .fini entries to be 32-bit, not mips16, so that
in a mixed environment they are all the same mode. The crti.asm and
crtn.asm files will also be compiled as 32-bit due to the
Index: gcc/config/mips/n32-elf.h
===
--- /dev/null   2013-06-17 18:11:16.259026486 +0100
+++ gcc/config/mips/n32-elf.h   2013-06-25 22:15:29.076761150 +0100
@@ -0,0 +1,35 @@
+/* Definitions of target machine for GNU compiler.
+   n32 for embedded systems.
+   Copyright (C) 2003-2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You 

[Patch, Fortran] Add end-of-scope finalization (Part 2 of 2)

2013-06-25 Thread Tobias Burnus
This patch adds finalization calls for components. This completes the 
end-of-scope finalization, but it is also called for the LHS of 
intrinsic assignment. (LHS finalization for the variable itself is still 
lacking.)


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

Tobias
2013-06-25  Tobias Burnus  bur...@net-b.de

	PR fortran/37336
	* trans.c (gfc_add_comp_finalizer_call): New function.
	* trans.h (gfc_add_comp_finalizer_call): New prototype.
	* trans-array.c (structure_alloc_comps): Call it.

2013-06-25  Tobias Burnus  bur...@net-b.de

	PR fortran/37336
	* gfortran.dg/finalize_18.f90: New.

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 96162e5..e4f78f4 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7553,19 +7553,34 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
 	  called_dealloc_with_status = false;
 	  gfc_init_block (tmpblock);
 
+	  if ((c-ts.type == BT_DERIVED  !c-attr.pointer)
+	  || (c-ts.type == BT_CLASS  !CLASS_DATA (c)-attr.class_pointer))
+	{
+	  comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+  decl, cdecl, NULL_TREE);
+
+	  /* The finalizer frees allocatable components.  */
+	  called_dealloc_with_status
+		= gfc_add_comp_finalizer_call (tmpblock, comp, c, true);
+	}
+	  else
+	comp = NULL_TREE;
+
 	  if (c-attr.allocatable  (c-attr.dimension || c-attr.codimension)
 	   !c-attr.proc_pointer)
 	{
-	  comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
-  decl, cdecl, NULL_TREE);
+	  if (comp == NULL_TREE)
+		comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+	decl, cdecl, NULL_TREE);
 	  tmp = gfc_trans_dealloc_allocated (comp, c-attr.codimension, NULL);
 	  gfc_add_expr_to_block (tmpblock, tmp);
 	}
 	  else if (c-attr.allocatable)
 	{
 	  /* Allocatable scalar components.  */
-	  comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
-  decl, cdecl, NULL_TREE);
+	  if (comp == NULL_TREE)
+		comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+	decl, cdecl, NULL_TREE);
 
 	  tmp = gfc_deallocate_scalar_with_status (comp, NULL, true, NULL,
 		   c-ts);
@@ -7580,10 +7595,11 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
 	  else if (c-ts.type == BT_CLASS  CLASS_DATA (c)-attr.allocatable)
 	{
 	  /* Allocatable CLASS components.  */
-	  comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
-  decl, cdecl, NULL_TREE);
 
 	  /* Add reference to '_data' component.  */
+	  if (comp == NULL_TREE)
+		comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+	decl, cdecl, NULL_TREE);
 	  tmp = CLASS_DATA (c)-backend_decl;
 	  comp = fold_build3_loc (input_location, COMPONENT_REF,
   TREE_TYPE (tmp), comp, tmp, NULL_TREE);
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index f17eaca..53a0669 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -948,6 +948,102 @@ gfc_build_final_call (gfc_typespec ts, gfc_expr *final_wrapper, gfc_expr *var,
 }
 
 
+bool
+gfc_add_comp_finalizer_call (stmtblock_t *block, tree decl, gfc_component *comp,
+			 bool fini_coarray)
+{
+  gfc_se se;
+  stmtblock_t block2;
+  tree final_fndecl, size, array, tmp, cond;
+  symbol_attribute attr;
+  gfc_expr *final_expr = NULL;
+
+  if (comp-ts.type != BT_DERIVED  comp-ts.type != BT_CLASS)
+return false;
+
+  gfc_init_block (block2);
+
+  if (comp-ts.type == BT_DERIVED)
+{
+  if (comp-attr.pointer)
+	return false;
+
+  gfc_is_finalizable (comp-ts.u.derived, final_expr);
+  if (!final_expr)
+return false;
+
+  gfc_init_se (se, NULL);
+  gfc_conv_expr (se, final_expr);
+  final_fndecl = se.expr;
+  size = gfc_typenode_for_spec (comp-ts);
+  size = TYPE_SIZE_UNIT (size);
+  size = fold_convert (gfc_array_index_type, size);
+
+  array = decl;
+}
+  else /* comp-ts.type == BT_CLASS.  */
+{
+  if (CLASS_DATA (comp)-attr.class_pointer)
+	return false;
+
+  gfc_is_finalizable (CLASS_DATA (comp)-ts.u.derived, final_expr);
+  final_fndecl = gfc_vtable_final_get (decl);
+  size = gfc_vtable_size_get (decl);
+  array = gfc_class_data_get (decl);
+}
+
+  if (comp-attr.allocatable
+  || (comp-ts.type == BT_CLASS  CLASS_DATA (comp)-attr.allocatable))
+{
+  tmp = GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (array))
+	?  gfc_conv_descriptor_data_get (array) : array;
+  cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+			tmp, fold_convert (TREE_TYPE (tmp),
+		 null_pointer_node));
+}
+  else
+cond = boolean_true_node;
+
+  if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (array)))
+{
+  gfc_clear_attr (attr);
+  gfc_init_se (se, NULL);
+  array = gfc_conv_scalar_to_descriptor (se, array, attr);
+  gfc_add_block_to_block (block2, se.pre);
+  gcc_assert 

[v3] Avoid 4 check-debug spurious fails

2013-06-25 Thread Paolo Carlini

Hi,

noticed while working on the container insert / emplace C++11 
signatures. Committed mainline and 4_8-branch.


Thanks,
Paolo.

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

* testsuite/23_containers/map/modifiers/erase/abi_tag.cc: Avoid
spurious fails with check-debug.
* testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc:
Likewise.
* testsuite/23_containers/set/modifiers/erase/abi_tag.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc:
Likewise.
Index: testsuite/23_containers/map/modifiers/erase/abi_tag.cc
===
--- testsuite/23_containers/map/modifiers/erase/abi_tag.cc  (revision 
200391)
+++ testsuite/23_containers/map/modifiers/erase/abi_tag.cc  (working copy)
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options -std=c++11 }
+// { dg-require-normal-mode  }
 
 // Copyright (C) 2013 Free Software Foundation, Inc.
 //
Index: testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc
===
--- testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc (revision 
200391)
+++ testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc (working copy)
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options -std=c++11 }
+// { dg-require-normal-mode  }
 
 // Copyright (C) 2013 Free Software Foundation, Inc.
 //
Index: testsuite/23_containers/set/modifiers/erase/abi_tag.cc
===
--- testsuite/23_containers/set/modifiers/erase/abi_tag.cc  (revision 
200391)
+++ testsuite/23_containers/set/modifiers/erase/abi_tag.cc  (working copy)
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options -std=c++11 }
+// { dg-require-normal-mode  }
 
 // Copyright (C) 2013 Free Software Foundation, Inc.
 //
Index: testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc
===
--- testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc (revision 
200391)
+++ testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc (working copy)
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options -std=c++11 }
+// { dg-require-normal-mode  }
 
 // Copyright (C) 2013 Free Software Foundation, Inc.
 //


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

2013-06-25 Thread Ed Smith-Rowland

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.

Ed

2013-06-25  Ed Smith-Rowland  3dw...@verizon.net

Status page for C++2014 library features
* doc/xml/faq.xml: Add link to new C++14 status page.
* doc/xml/manual/intro.xml: Ditto.
* doc/xml/manual/status_cxx2014.xml: New.

Index: doc/xml/faq.xml
===
--- doc/xml/faq.xml (revision 200378)
+++ doc/xml/faq.xml (working copy)
@@ -694,6 +694,7 @@
 link linkend=status.iso.1998C++98/link,
 link linkend=status.iso.tr1TR1/link, and 
 link linkend=status.iso.2011C++11/link.
+link linkend=status.iso.2014C++14/link.
 /para 
   /answer
 /qandaentry
Index: doc/xml/manual/intro.xml
===
--- doc/xml/manual/intro.xml(revision 200378)
+++ doc/xml/manual/intro.xml(working copy)
@@ -29,11 +29,15 @@
 xi:include xmlns:xi=http://www.w3.org/2001/XInclude; parse=xml 
href=status_cxx2011.xml
 /xi:include
 
-!-- Section 01.3 : Status C++ TR1 --
+!-- Section 01.3 : Status C++ 2014 --
+xi:include xmlns:xi=http://www.w3.org/2001/XInclude; parse=xml 
href=status_cxx2014.xml
+/xi:include
+
+!-- Section 01.4 : Status C++ TR1 --
 xi:include xmlns:xi=http://www.w3.org/2001/XInclude; parse=xml 
href=status_cxxtr1.xml
 /xi:include
 
-!-- Section 01.4 : Status C++ TR24733 --
+!-- Section 01.5 : Status C++ TR24733 --
 xi:include xmlns:xi=http://www.w3.org/2001/XInclude; parse=xml 
href=status_cxxtr24733.xml
 /xi:include
   /section
Index: doc/xml/manual/status_cxx2014.xml
===
--- doc/xml/manual/status_cxx2014.xml   (revision 0)
+++ doc/xml/manual/status_cxx2014.xml   (revision 0)
@@ -0,0 +1,201 @@
+section xmlns=http://docbook.org/ns/docbook; version=5.0 
+xml:id=status.iso.2014 xreflabel=Status C++ 2014
+?dbhtml filename=status_iso_cxx2014.html?
+
+infotitleC++ 2014/title
+  keywordset
+keywordISO C++/keyword
+keyword2014/keyword
+  /keywordset
+/info
+
+para
+In this implementation literal-std=gnu++1y/literal or
+literal-std=c++1y/literal flags must be used to enable language
+and library
+features. See link linkend=manual.intro.using.flagsdialect/link
+options. The pre-defined symbol
+constant__cplusplus/constant is used to check for the
+presence of the required flag.
+/para
+
+para
+This page describes the C++14 support in mainline GCC SVN, not in any
+particular release.
+/para
+
+table frame=all
+titleC++ 2014 Implementation Status/title
+
+tgroup cols=4 align=left colsep=0 rowsep=1
+colspec colname=c1/
+colspec colname=c2/
+colspec colname=c3/
+colspec colname=c4/
+  thead
+row
+  entryPaper/entry
+  entryTitle/entry
+  entryStatus/entry
+  entryComments/entry
+/row
+  /thead
+
+  tbody
+
+row
+  entryN3669/entry
+  entryFixing constexpr member functions without const/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3668/entry
+  entrycodeexchange()/code utility function/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3670/entry
+  entryWording for Addressing Tuples by Type/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3656/entry
+  entrycodemake_unique/code/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3462/entry
+  entrycodestd::result_of/code and SFINAE/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3545/entry
+  entryAn Incremental Improvement to 
codeintegral_constant/code/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3642/entry
+  entryUser-defined Literals for Standard Library Types/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3671/entry
+  entryMaking non-modifying sequence operations more robust/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3654/entry
+  entryQuoted Strings Library Proposal/entry
+  entryY/entry
+  entry/
+/row
+
+
+row
+  entryN3469/entry
+  entryConstexpr Library Additions: chrono/entry
+  entryY/entry
+  entry/
+/row
+
+row
+  entryN3470/entry
+  entryConstexpr Library Additions: 

[PATCH] Fix for PR 57692

2013-06-25 Thread Iyer, Balaji V
Hello Everyone,
This patch will fix a FAIL in one of the test cases for array 
notations. The reason for fail is that the array sizes were huge and thus it 
was causing a stack overflow. This patch should fix the issue. I am committing 
this patch as semi-obvious. I am willing to revert this change if anyone has 
objections.

2013-06-25  Balaji V. Iyer  balaji.v.i...@intel.com

* c-c++-common/cilk-plus/AN/gather_scatter.c: Fixed a bug of stack
overflow due to size of arrays.

Index: gcc/testsuite/c-c++-common/cilk-plus/AN/gather_scatter.c
===
--- gcc/testsuite/c-c++-common/cilk-plus/AN/gather_scatter.c(revision 
200413)
+++ gcc/testsuite/c-c++-common/cilk-plus/AN/gather_scatter.c(working copy)
@@ -1,16 +1,16 @@
 /* { dg-do run } */
 /* { dg-options -fcilkplus } */

-#define NUMBER 100
+#define NUMBER 20
 #if HAVE_IO
 #include stdio.h
 #endif

+float array4[NUMBER][NUMBER][NUMBER][NUMBER];
 int main(void)
 {
   int array[NUMBER][NUMBER], array2[NUMBER], array3[NUMBER], x = 0, y;
-  int x_correct, y_correct, ii, jj = 0;
-  float array4[NUMBER][NUMBER][NUMBER][NUMBER];
+  int x_correct, y_correct, ii, jj = 0, kk = 0, ll = 0;
   for (ii = 0; ii  NUMBER; ii++)
 {
   for (jj = 0; jj  NUMBER; jj++)


Thanks,

Balaji V. Iyer.