Re: [PATCH PR62151]Fix REG_DEAD note distribution issue by using right ELIM_I0/ELIM_I1

2014-12-22 Thread Bin.Cheng
On Mon, Dec 22, 2014 at 3:54 PM, Bin.Cheng  wrote:
> On Sat, Dec 20, 2014 at 8:18 PM, Eric Botcazou  wrote:
>>> As described both in the PR and patch comments, this patch fixes PR62151 by
>>> setting right value to ELIM_I0/ELIM_I1 when distributing REG_DEAD notes from
>>> i0/i1.  It is said that distribute_notes had caused many bugs in the past.
>>> I think it still has bug in it, as noted in the PR.  This patch doesn't
>>> touch distribute_notes because we are in stage3 and I want to have more
>>> discussion on it.
>>> Bootstrap and test on x86_64.  aarch64 is ongoing.  So is it ok?
>>>
>>> 2014-12-11  Bin Cheng  
>>>
>>>   PR rtl-optimization/62151
>>>   * combine.c (try_combine): Reset elim_i0 and elim_i1 when
>>>   distributing notes from i0notes or i1notes, this time don't
>>>   check whether newi2pat sets i1dest or i0dest.
>>
>> The reasoning looks correct to me and the patch is certainly safe so it's OK
>> on principle, but I think that we should avoid the duplication of predicates.
>>
>> Can you move the computation of the alternative elim_i1 & elim_i0 up to where
>> the original ones are computed along with the explanation of why we care 
>> about
>> newi2pat only for notes that were on I3 and I2?  Something like:
>>
>>/* Compute which registers we expect to eliminate.  newi2pat may be 
>> setting
>>   either i3dest or i2dest, so we must check it.  */
>> rtx elim_i2 = ((newi2pat && reg_set_p (i2dest, newi2pat))
>>|| i2dest_in_i2src || i2dest_in_i1src || i2dest_in_i0src
>>|| !i2dest_killed
>>? 0 : i2dest);
>>/* For I1 we need to compute both local elimination and global elimination
>>   because i1dest may be the same as i3dest, in which case newi2pat may be
>>   setting i1dest.*/
>> rtx local_elim_i1 = (i1 == 0 || i1dest_in_i1src || i1dest_in_i0src
>>|| !i1dest_killed
>>? 0 : i1dest);
>> rtx elim_i1 = (local_elim_i1 == 0
>>|| (newi2pat && reg_set_p (i1dest, newi2pat))
>>? 0 : i1dest);
>> /* Likewise for I0.  */
>> rtx local_elim_i0 = (i0 == 0 || i0dest_in_i0src
>>|| !i0dest_killed
>>? 0 : i0dest);
>> rtx elim_i0 = (local_elim_i0 == 0
>>|| (newi2pat && reg_set_p (i0dest, newi2pat))
>>? 0 : i0dest);
>>
>> --
>> Eric Botcazou
>
> Hi Eric,
> Thanks for reviewing.  Here comes the revised patch.  Bootstrap and
> test on x86_64, is it OK?
>
> Thanks,
> bin
>
>
> 2014-12-22  Bin Cheng  
>
> PR rtl-optimization/62151
> * combine.c (try_combine): New local variables local_elim_i1
> and local_elim_i0.  Set elim_i1 and elim_i0 using the local
> version variables.  Distribute notes from i0notes or i1notes
> using the local variavbles.
>
> gcc/testsuite/ChangeLog
> 2014-12-22  Bin Cheng  
>
> PR rtl-optimization/62151
> * gcc.c-torture/execute/pr62151.c: New test.

Hmm, I further revised comment in the patch since in try_combine, i2
is always after i0/i1.  The original comment is inaccurate about that.

Thanks,
bin
Index: gcc/testsuite/gcc.c-torture/execute/pr62151.c
===
--- gcc/testsuite/gcc.c-torture/execute/pr62151.c   (revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/pr62151.c   (revision 0)
@@ -0,0 +1,41 @@
+/* PR rtl-optimization/62151 */
+
+int a, c, d, e, f, g, h, i;
+short b;
+
+int
+fn1 ()
+{
+  b = 0;
+  for (;;)
+{
+  int j[2];
+  j[f] = 0;
+  if (h)
+   d = 0;
+  else
+   {
+ for (; f; f++)
+   ;
+ for (a = 0; a < 1; a++)
+   for (;;)
+ {
+   i = b & ((b ^ 1) & 83647) ? b : b - 1;
+   g = 1 ? i : 0;
+   e = j[0];
+   if (c)
+ break;
+   return 0;
+ }
+   }
+}
+}
+
+int
+main ()
+{
+  fn1 ();
+  if (g != -1)
+__builtin_abort ();
+  return 0;
+}
Index: gcc/combine.c
===
--- gcc/combine.c   (revision 218855)
+++ gcc/combine.c   (working copy)
@@ -4119,19 +4119,46 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn
 rtx midnotes = 0;
 int from_luid;
 /* Compute which registers we expect to eliminate.  newi2pat may be setting
-   either i3dest or i2dest, so we must check it.  Also, i1dest may be the
-   same as i3dest, in which case newi2pat may be setting i1dest.  */
+   either i3dest or i2dest, so we must check it.  */
 rtx elim_i2 = ((newi2pat && reg_set_p (i2dest, newi2pat))
   || i2dest_in_i2src || i2dest_in_i1src || i2dest_in_i0src
   || !i2dest_killed
   ? 0 : i2dest);
-rtx elim_i1 = (i1 == 0 || i1dest_in_i1src || i1dest_in_i0src
+/* For i1, we need to compute both local elimination and global
+

Re: [PATCH PR62151]Fix REG_DEAD note distribution issue by using right ELIM_I0/ELIM_I1

2014-12-22 Thread Eric Botcazou
> 2014-12-22  Bin Cheng  
> 
> PR rtl-optimization/62151
> * combine.c (try_combine): New local variables local_elim_i1
> and local_elim_i0.  Set elim_i1 and elim_i0 using the local
> version variables.  Distribute notes from i0notes or i1notes
> using the local variavbles.
> 
> gcc/testsuite/ChangeLog
> 2014-12-22  Bin Cheng  
> 
> PR rtl-optimization/62151
> * gcc.c-torture/execute/pr62151.c: New test.

OK, thanks.

-- 
Eric Botcazou


Re: [PATCH PR62151]Fix REG_DEAD note distribution issue by using right ELIM_I0/ELIM_I1

2014-12-22 Thread Eric Botcazou
> Hmm, I further revised comment in the patch since in try_combine, i2
> is always after i0/i1.  The original comment is inaccurate about that.

OK.

-- 
Eric Botcazou


[PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.

2014-12-22 Thread Martin Liška

Hello.

Following IPA ICF patch restricts thunk creation for static-chain thunks.
Patch can bootstrap on x86_64-linux-pc and no new regression has been seen.

Ready for thunk?
Thanks,
Martin
>From b247009735cd294b3fd8b727905cb47b5cdaeb51 Mon Sep 17 00:00:00 2001
From: mliska 
Date: Mon, 22 Dec 2014 10:46:41 +0100
Subject: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.

gcc/ChangeLog:

2014-12-22  Martin Liska  

	PR ipa/63851
	PR ipa/63852
	* ipa-icf.c (sem_function::merge): Ignore merge operation
	for a thunk created from static chain.
---
 gcc/ipa-icf.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 6cdc21b..b8ef6e0 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -694,6 +694,14 @@ sem_function::merge (sem_item *alias_item)
 	  return 0;
 	}
 
+  if (DECL_STATIC_CHAIN (alias->decl))
+{
+ if (dump_file)
+   fprintf (dump_file, "Thunk creation is risky for static-chain functions.\n\n");
+
+ return 0;
+}
+
   alias->icf_merged = true;
   ipa_merge_profiles (local_original, alias);
   alias->create_wrapper (local_original);
-- 
2.1.2



Fix inconsistent diagnostics for support of Atomic aspect

2014-12-22 Thread Eric Botcazou
pragma Atomic forces fields to be aligned in record types but we nevertheless 
accept atomic misaligned standalone variables.  This changes the latter.

Tested on x86_64-suse-linux, applied on the mainline.


2014-12-22  Eric Botcazou  

* gcc-interface/decl.c (check_ok_for_atomic): Rename into...
(check_ok_for_atomic_type): ...this.  When checking the mode, also
check that the type is sufficient aligned.  Remove useless code and
tidy up implementation.
(gnat_to_gnu_entity): Adjust to above renaming.
(gnat_to_gnu_component_type): Likewise.
(gnat_to_gnu_field): Likewise.


2014-12-22  Eric Botcazou  

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


-- 
Eric BotcazouIndex: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 218987)
+++ gcc-interface/decl.c	(working copy)
@@ -191,7 +191,7 @@ static vec build_variant_l
 static tree validate_size (Uint, tree, Entity_Id, enum tree_code, bool, bool);
 static void set_rm_size (Uint, tree, Entity_Id);
 static unsigned int validate_alignment (Uint, Entity_Id, unsigned int);
-static void check_ok_for_atomic (tree, Entity_Id, bool);
+static void check_ok_for_atomic_type (tree, Entity_Id, bool);
 static tree create_field_decl_from (tree, tree, tree, tree, tree,
 vec );
 static tree create_rep_part (tree, tree, tree);
@@ -870,7 +870,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 		   && TYPE_MULTI_ARRAY_P (gnu_inner))
 	  gnu_inner = TREE_TYPE (gnu_inner);
 
-	check_ok_for_atomic (gnu_inner, gnat_entity, true);
+	check_ok_for_atomic_type (gnu_inner, gnat_entity, true);
 	  }
 
 	/* Now check if the type of the object allows atomic access.  Note
@@ -880,7 +880,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	   always copying via an intermediate value, but it's not clear it's
 	   worth the effort.  */
 	if (Is_Atomic (gnat_entity))
-	  check_ok_for_atomic (gnu_type, gnat_entity, false);
+	  check_ok_for_atomic_type (gnu_type, gnat_entity, false);
 
 	/* If this is an aliased object with an unconstrained nominal subtype,
 	   make a type that includes the template.  */
@@ -5035,7 +5035,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	}
 
   if (Is_Atomic (gnat_entity))
-	check_ok_for_atomic (gnu_type, gnat_entity, false);
+	check_ok_for_atomic_type (gnu_type, gnat_entity, false);
 
   /* If this is not an unconstrained array type, set some flags.  */
   if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE)
@@ -5548,7 +5548,7 @@ gnat_to_gnu_component_type (Entity_Id gn
 gnu_type = make_packable_type (gnu_type, false);
 
   if (Has_Atomic_Components (gnat_array))
-check_ok_for_atomic (gnu_type, gnat_array, true);
+check_ok_for_atomic_type (gnu_type, gnat_array, true);
 
   /* Get and validate any specified Component_Size.  */
   gnu_comp_size
@@ -6484,7 +6484,7 @@ gnat_to_gnu_field (Entity_Id gnat_field,
 }
 
   if (Is_Atomic (gnat_field))
-check_ok_for_atomic (gnu_field_type, gnat_field, false);
+check_ok_for_atomic_type (gnu_field_type, gnat_field, false);
 
   if (Present (Component_Clause (gnat_field)))
 {
@@ -8088,78 +8088,63 @@ validate_alignment (Uint alignment, Enti
   return align;
 }
 
-/* Verify that OBJECT, a type or decl, is something we can implement
-   atomically.  If not, give an error for GNAT_ENTITY.  COMP_P is true
-   if we require atomic components.  */
+/* Verify that TYPE is something we can implement atomically.  If not, issue
+   an error for GNAT_ENTITY.  COMPONENT_P is true if we are being called to
+   process a component type.  */
 
 static void
-check_ok_for_atomic (tree object, Entity_Id gnat_entity, bool comp_p)
+check_ok_for_atomic_type (tree type, Entity_Id gnat_entity, bool component_p)
 {
   Node_Id gnat_error_point = gnat_entity;
   Node_Id gnat_node;
   machine_mode mode;
+  enum mode_class mclass;
   unsigned int align;
   tree size;
 
-  /* There are three case of what OBJECT can be.  It can be a type, in which
- case we take the size, alignment and mode from the type.  It can be a
- declaration that was indirect, in which case the relevant values are
- that of the type being pointed to, or it can be a normal declaration,
- in which case the values are of the decl.  The code below assumes that
- OBJECT is either a type or a decl.  */
-  if (TYPE_P (object))
-{
-  /* If this is an anonymous base type, nothing to check.  Error will be
-	 reported on the source type.  */
-  if (!Comes_From_Source (gnat_entity))
-	return;
-
-  mode = TYPE_MODE (object);
-  align = TYPE_ALIGN (object);
-  size = TYPE_SIZE (object);
-}
-  else if (DECL_BY_REF_P (object))
-{
-  mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (object)));
-  align = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (object)));
-  size = TYPE_SIZE (TREE_TYPE (TREE_TYPE (object)));
-}
-  else
-{
-  mode = DECL_MODE (object);
-  align =

[Ada] Fix inconsistent diagnostics for support of Volatile aspect

2014-12-22 Thread Eric Botcazou
pragma Volatile forces fields to be of nominal size in record types but we 
nevertheless accept volatile oversized variables.  This changes the former.

Tested on x86_64-suse-linux, applied on the mainline.


2014-12-22  Eric Botcazou  

* gcc-interface/decl.c (gnat_to_gnu_field): Post the error message
for parent overlapping on the position instead of on the first bit.
For a field that needs strict alignment, issue the error for the
position first and, for the size, issue an error if it is too large
only for the atomic and aliased cases.  Issue a specific error if
the size is not a multiple of a byte in the volatile and the strict
alignment cases.


2014-12-22  Eric Botcazou  

* gnat.dg/specs/volatile1.ads: New test.
* gnat.dg/specs/clause_on_volatile.ads: Adjust.
* gnat.dg/specs/size_clause3.ads: Likewise.


-- 
Eric BotcazouIndex: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 219007)
+++ gcc-interface/decl.c	(working copy)
@@ -6414,12 +6414,14 @@ gnat_to_gnu_field (Entity_Id gnat_field,
   tree gnu_field_type = gnat_to_gnu_type (gnat_field_type);
   tree gnu_field_id = get_entity_name (gnat_field);
   tree gnu_field, gnu_size, gnu_pos;
+  bool is_aliased
+= Is_Aliased (gnat_field);
+  bool is_atomic
+= (Is_Atomic (gnat_field) || Is_Atomic (gnat_field_type));
   bool is_volatile
 = (Treat_As_Volatile (gnat_field) || Treat_As_Volatile (gnat_field_type));
   bool needs_strict_alignment
-= (is_volatile
-   || Is_Aliased (gnat_field)
-   || Strict_Alignment (gnat_field_type));
+= (is_aliased || is_volatile || Strict_Alignment (gnat_field_type));
 
   /* If this field requires strict alignment, we cannot pack it because
  it would very likely be under-aligned in the record.  */
@@ -6488,6 +6490,7 @@ gnat_to_gnu_field (Entity_Id gnat_field,
 
   if (Present (Component_Clause (gnat_field)))
 {
+  Node_Id gnat_clause = Component_Clause (gnat_field);
   Entity_Id gnat_parent
 	= Parent_Subtype (Underlying_Type (Scope (gnat_field)));
 
@@ -6506,91 +6509,95 @@ gnat_to_gnu_field (Entity_Id gnat_field,
 
 	  if (TREE_CODE (TYPE_SIZE (gnu_parent)) == INTEGER_CST
 	  && tree_int_cst_lt (gnu_pos, TYPE_SIZE (gnu_parent)))
-	{
-	  post_error_ne_tree
-		("offset of& must be beyond parent{, minimum allowed is ^}",
-		 First_Bit (Component_Clause (gnat_field)), gnat_field,
-		 TYPE_SIZE_UNIT (gnu_parent));
-	}
+	post_error_ne_tree
+	  ("offset of& must be beyond parent{, minimum allowed is ^}",
+	   Position (gnat_clause), gnat_field, TYPE_SIZE_UNIT (gnu_parent));
 	}
 
-  /* If this field needs strict alignment, check that the record is
-	 sufficiently aligned and that position and size are consistent with
-	 the alignment.  But don't do it if we are just annotating types and
+  /* If this field needs strict alignment, make sure that the record is
+	 sufficiently aligned and that the position and size are consistent
+	 with the type.  But don't do it if we are just annotating types and
 	 the field's type is tagged, since tagged types aren't fully laid out
 	 in this mode.  Also, note that atomic implies volatile so the inner
 	 test sequences ordering is significant here.  */
   if (needs_strict_alignment
 	  && !(type_annotate_only && Is_Tagged_Type (gnat_field_type)))
 	{
-	  TYPE_ALIGN (gnu_record_type)
-	= MAX (TYPE_ALIGN (gnu_record_type), TYPE_ALIGN (gnu_field_type));
+	  const unsigned int type_align = TYPE_ALIGN (gnu_field_type);
 
-	  if (gnu_size
-	  && !operand_equal_p (gnu_size, TYPE_SIZE (gnu_field_type), 0))
+	  if (TYPE_ALIGN (gnu_record_type) < type_align)
+	TYPE_ALIGN (gnu_record_type) = type_align;
+
+	  /* If the position is not a multiple of the alignment of the type,
+	 then error out and reset the position.  */
+	  if (!integer_zerop (size_binop (TRUNC_MOD_EXPR, gnu_pos,
+	  bitsize_int (type_align
 	{
-	  if (Is_Atomic (gnat_field) || Is_Atomic (gnat_field_type))
-		post_error_ne_tree
-		  ("atomic field& must be natural size of type{ (^)}",
-		   Last_Bit (Component_Clause (gnat_field)), gnat_field,
-		   TYPE_SIZE (gnu_field_type));
+	  const char *s;
 
+	  if (is_atomic)
+		s = "position of atomic field& must be multiple of ^ bits";
+	  else if (is_aliased)
+		s = "position of aliased field& must be multiple of ^ bits";
 	  else if (is_volatile)
-		post_error_ne_tree
-		  ("volatile field& must be natural size of type{ (^)}",
-		   Last_Bit (Component_Clause (gnat_field)), gnat_field,
-		   TYPE_SIZE (gnu_field_type));
-
-	  else if (Is_Aliased (gnat_field))
-		post_error_ne_tree
-		  ("size of aliased field& must be ^ bits",
-		   Last_Bit (Component_Clause (gnat_field)), gnat_field,
-		   TYPE_SIZE (gnu_field_type));
-
+		s = "position of volatile field& must be multiple of ^ bits";
 	  else if (Strict

Re: Fix streaming of target optimization/option nodes

2014-12-22 Thread Thomas Schwinge
Hi!

On Mon, 15 Dec 2014 23:36:11 +0100, Jan Hubicka  wrote:
> this is final version I comitted.

>   PR lto/64043

>   * tree-streamer.c (preload_common_nodes): Skip preloading
>   of main_identifier_node, pid_type and optimization/option nodes.

> --- tree-streamer.c   (revision 218726)
> +++ tree-streamer.c   (working copy)
> @@ -324,7 +324,18 @@ preload_common_nodes (struct streamer_tr
>  /* Skip boolean type and constants, they are frontend dependent.  */
>  if (i != TI_BOOLEAN_TYPE
>   && i != TI_BOOLEAN_FALSE
> - && i != TI_BOOLEAN_TRUE)
> + && i != TI_BOOLEAN_TRUE
> + /* MAIN_IDENTIFIER is not always initialized by Fortran FE.  */
> + && i != TI_MAIN_IDENTIFIER
> + /* PID_TYPE is initialized only by C family front-ends.  */
> + && i != TI_PID_TYPE
> + /* Skip optimization and target option nodes; they depend on flags.  */
> + && i != TI_OPTIMIZATION_DEFAULT
> + && i != TI_OPTIMIZATION_CURRENT
> + && i != TI_TARGET_OPTION_DEFAULT
> + && i != TI_TARGET_OPTION_CURRENT
> + && i != TI_CURRENT_TARGET_PRAGMA
> + && i != TI_CURRENT_OPTIMIZE_PRAGMA)
>record_common_node (cache, global_trees[i]);
>  }

This regresses offloading (tested Intel MIC emulation):

FAIL: libgomp.c/examples-4/e.53.5.c (internal compiler error)
FAIL: libgomp.c/for-3.c (internal compiler error)
FAIL: libgomp.c++/for-11.C (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O2  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer  
(internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer 
-funroll-loops  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -g  (internal compiler 
error)
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -Os  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O2  (test for excess errors)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O0  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O1  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O2  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer  
(internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer 
-funroll-loops  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  (internal compiler error)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -g  (internal compiler 
error)
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -Os  (internal compiler error)

FAIL: libgomp.c/examples-4/e.53.5.c (internal compiler error)

[...]/source-gcc/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c: In 
function 'accum._omp_fn.1':
[...]/source-gcc/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c:53:13: 
error: unrecognizable insn:
 #pragma omp parallel for reduction(+:tmp)
 ^
(insn 176 66 177 4 (set (reg:DI 0 ax)
(symbol_ref:DI ("Q") )) -1
 (nil))
[...]/source-gcc/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c:53:13: 
internal compiler error: in extract_insn, at recog.c:2327
0x9c124a _fatal_insn(char const*, rtx_def const*, char const*, int, char 
const*)
[...]/source-gcc/gcc/rtl-error.c:110
0x9c1279 _fatal_insn_not_found(rtx_def const*, char const*, int, char 
const*)
[...]/source-gcc/gcc/rtl-error.c:118
0x98f346 extract_insn(rtx_insn*)
[...]/source-gcc/gcc/recog.c:2327
0x9902c8 extract_constrain_insn(rtx_insn*)
[...]/source-gcc/gcc/recog.c:2228
0x998a16 copyprop_hardreg_forward_1
[...]/source-gcc/gcc/regcprop.c:773
0x99978a execute
[...]/source-gcc/gcc/regcprop.c:1279

FAIL: libgomp.c/for-3.c (internal compiler error)

[...]/source-gcc/libgomp/testsuite/libgomp.c/for-2.h: In function 
'f13_d_normal':
[...]/source-gcc/libgomp/testsuite/libgomp.c/for-2.h:171:1: error: 
unrecognizable insn:
 }
 ^
(insn 73 72 55 5 (set (reg/f:DI 1 dx [orig:106 D.6870 ] [106])
(plus:DI (reg:DI 0 ax [orig:105 D.6869 ] [105])
(symbol_ref:DI ("a") ))) -1
 (nil))
[...]/source-gcc/libgomp/testsuite/libgomp.c/for-2.h:171:1: internal 
compiler error: in extract_insn, at recog.c:2327
0x9c124a _fatal_insn(char const*, rtx_def const*, char const*, int, char 
const*)
[...]/source-gcc/gcc/rtl-error.c:110
0x9c1279 _fatal_insn_not_found(rtx_def const*, char const*, int, char 
const*)
[...]/source-gcc/gcc/rtl-error.c:118
0x98f346 extract_insn(rtx_insn*)
[...]/source-gcc/gcc/recog.c:2327
0x98f3c4 ext

[Ada] implement C99 fmax semantics for floating-point 'Min/Max

2014-12-22 Thread Eric Botcazou
NaNs are invalid values in Ada so the language doesn't specify how they should 
be handled but GNAT nevertheless attempts to implement sensible semantics for 
them.  This patch extends this to the Min and Max attributes.

Tested on x86_64-suse-linux, applied on the mainline.


2014-12-22  Eric Botcazou  

* gcc-interface/trans.c (Attribute_to_gnu) : If the
type is a floating-point type, implement the semantics of the C99
f{min,max} routines with regard to NaNs.
(gnat_to_gnu): Call builtin_decl_implicit.
* gcc-interface/utils2.c (compare_arrays): Adjust comments.


2014-12-22  Eric Botcazou  

* gnat.dg/nan_max.adb: New test.


-- 
Eric Botcazou


Re: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.

2014-12-22 Thread Martin Liška

On 12/22/2014 10:53 AM, Martin Liška wrote:

Hello.

Following IPA ICF patch restricts thunk creation for static-chain thunks.
Patch can bootstrap on x86_64-linux-pc and no new regression has been seen.

Ready for thunk?
Thanks,
Martin


In previous mail, I forgot to add one obvious hunk that is quite obvious.

Thanks,
Martin
>From a32fceb4af65a21b3b3d48cd3d981bcbe6faa8ab Mon Sep 17 00:00:00 2001
From: mliska 
Date: Mon, 22 Dec 2014 10:46:41 +0100
Subject: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.

gcc/ChangeLog:

2014-12-22  Martin Liska  

	PR ipa/63851
	PR ipa/63852
	* ipa-icf.c (sem_function::merge): Ignore merge operation
	for a thunk created from static chain.
	* ipa-icf-gimple.c (func_checker::compatible_types_p): Verify that
	types have same restrict flag.
---
 gcc/ipa-icf-gimple.c | 3 +++
 gcc/ipa-icf.c| 8 
 2 files changed, 11 insertions(+)

diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index fa2c353..6689463 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -185,6 +185,9 @@ bool func_checker::compatible_types_p (tree t1, tree t2,
   if (TREE_CODE (t1) != TREE_CODE (t2))
 return return_false_with_msg ("different tree types");
 
+  if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
+return return_false_with_msg ("restrict flags are different");
+
   if (!types_compatible_p (t1, t2))
 return return_false_with_msg ("types are not compatible");
 
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 6cdc21b..b8ef6e0 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -694,6 +694,14 @@ sem_function::merge (sem_item *alias_item)
 	  return 0;
 	}
 
+  if (DECL_STATIC_CHAIN (alias->decl))
+{
+ if (dump_file)
+   fprintf (dump_file, "Thunk creation is risky for static-chain functions.\n\n");
+
+ return 0;
+}
+
   alias->icf_merged = true;
   ipa_merge_profiles (local_original, alias);
   alias->create_wrapper (local_original);
-- 
2.1.2



Re: [PATCH 3/4] Add Visium support to gcc

2014-12-22 Thread Eric Botcazou
Revised version after Joseph's comments and latest libgcc changes.


gcc/ChangeLog

2014-12-22  Eric Botcazou  

* config.gcc: Add Visium support.
* configure.ac: Likewise.
* configure: Regenerate.
* doc/extend.texi (interrupt attribute): Add Visium.
* doc/invoke.texi: Document Visium options.
* doc/install.texi: Document Visium target.
* doc/md.texi: Document Visium constraints.
* common/config/visium: New directory.
* config/visium: Likewise.



-- 
Eric Botcazou


gcc_visium-2.tar.gz
Description: application/compressed-tar
Index: config.gcc
===
--- config.gcc	(revision 218987)
+++ config.gcc	(working copy)
@@ -2888,6 +2888,10 @@ vax-*-openbsd*)
 	extra_options="${extra_options} openbsd.opt"
 	use_collect2=yes
 	;;
+visium-*-elf*)
+	tm_file="dbxelf.h elfos.h ${tm_file} visium/elf.h newlib-stdint.h"
+	tmake_file="visium/t-visium visium/t-crtstuff"
+	;;
 xstormy16-*-elf)
 	# For historical reasons, the target files omit the 'x'.
 	tm_file="dbxelf.h elfos.h newlib-stdint.h stormy16/stormy16.h"
Index: configure.ac
===
--- configure.ac	(revision 218987)
+++ configure.ac	(working copy)
@@ -4442,7 +4442,7 @@ esac
 case "$cpu_type" in
   aarch64 | alpha | arm | avr | bfin | cris | i386 | m32c | m68k | microblaze \
   | mips | nios2 | pa | rs6000 | score | sparc | spu | tilegx | tilepro \
-  | xstormy16 | xtensa)
+  | visium | xstormy16 | xtensa)
 insn="nop"
 ;;
   ia64 | s390)
Index: doc/extend.texi
===
--- doc/extend.texi	(revision 218987)
+++ doc/extend.texi	(working copy)
@@ -2935,12 +2935,11 @@ least version 2.20.1), and GNU C library
 @item interrupt
 @cindex interrupt handler functions
 Use this attribute on the ARC, ARM, AVR, CR16, Epiphany, M32C, M32R/D,
-m68k, MeP, MIPS, MSP430, RL78, RX and Xstormy16 ports to indicate that
-the specified function is an
-interrupt handler.  The compiler generates function entry and exit
-sequences suitable for use in an interrupt handler when this attribute
-is present.  With Epiphany targets it may also generate a special section with
-code to initialize the interrupt vector table.
+m68k, MeP, MIPS, MSP430, RL78, RX, Visium and Xstormy16 ports to indicate
+that the specified function is an interrupt handler.  The compiler generates
+function entry and exit sequences suitable for use in an interrupt handler
+when this attribute is present.  With Epiphany targets it may also generate
+a special section with code to initialize the interrupt vector table.
 
 Note, interrupt handlers for the Blackfin, H8/300, H8/300H, H8S, MicroBlaze,
 and SH processors can be specified via the @code{interrupt_handler} attribute.
Index: doc/invoke.texi
===
--- doc/invoke.texi	(revision 218987)
+++ doc/invoke.texi	(working copy)
@@ -1064,6 +1064,10 @@ See RS/6000 and PowerPC Options.
 @emph{VAX Options}
 @gccoptlist{-mg  -mgnu  -munix}
 
+@emph{Visium Options}
+@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
+-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
+
 @emph{VMS Options}
 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
 -mpointer-size=@var{size}}
@@ -11892,6 +11896,7 @@ platform.
 * TILEPro Options::
 * V850 Options::
 * VAX Options::
+* Visium Options::
 * VMS Options::
 * VxWorks Options::
 * x86-64 Options::
@@ -22532,6 +22537,77 @@ GNU assembler is being used.
 Output code for G-format floating-point numbers instead of D-format.
 @end table
 
+@node Visium Options
+@subsection Visium Options
+@cindex Visium options
+
+@table @gcctabopt
+
+@item -mdebug
+@opindex mdebug
+A program which performs file I/O and is destined to run on an MCM target
+should be linked with this option.  It causes the libraries libc.a and
+libdebug.a to be linked.  The program should be run on the target under
+the control of the GDB remote debugging stub.
+
+@item -msim
+@opindex msim
+A program which performs file I/O and is destined to run on the simulator
+should be linked with option.  This causes libraries libc.a and libsim.a to
+be linked.
+
+@item -mfpu
+@itemx -mhard-float
+@opindex mfpu
+@opindex mhard-float
+Generate code containing floating-point instructions.  This is the
+default.
+
+@item -mno-fpu
+@itemx -msoft-float
+@opindex mno-fpu
+@opindex msoft-float
+Generate code containing library calls for floating-point.
+
+@option{-msoft-float} changes the calling convention in the output file;
+therefore, it is only useful if you compile @emph{all} of a program with
+this option.  In particular, you need to compile @file{libgcc.a}, the
+library that comes with GCC, with @option{-msoft-float} in order for
+this to work.
+
+@item -mcpu=@var{cpu_type}
+@opindex mcpu
+Set the instruction set, register s

OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2014-12-22 Thread Thomas Schwinge
Hi!

On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin  wrote:
> --- /dev/null
> +++ b/gcc/config/i386/intelmic-mkoffload.c
> @@ -0,0 +1,541 @@
> +/* Offload image generation tool for Intel MIC devices.

> +static const char *
> +prepare_target_image (const char *target_compiler, int argc, char **argv)
> +{
> +  [...]
> +  obstack_init (&argv_obstack);
> +  obstack_ptr_grow (&argv_obstack, target_compiler);
> +  obstack_ptr_grow (&argv_obstack, "-xlto");
> +  obstack_ptr_grow (&argv_obstack, "-fopenmp");
> +  obstack_ptr_grow (&argv_obstack, "-shared");
> +  obstack_ptr_grow (&argv_obstack, "-fPIC");
> +  obstack_ptr_grow (&argv_obstack, opt1);

What is the reason that you're adding -fopenmp here?  I assume it is that
otherwise you'd get tree streaming errors because of different builtins
configurations, like this?

$ [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ 
[...]/source-gcc/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/collapse-1.c
 -B[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/ 
-B[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs 
-I[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp 
-I[...]/source-gcc/libgomp/testsuite/../../include 
-I[...]/source-gcc/libgomp/testsuite/.. -fmessage-length=0 
-fno-diagnostics-show-caret -fdiagnostics-color=never 
-B[...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0
 -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/bin -fopenacc 
-DACC_DEVICE_TYPE_host_nonshm=1 -DACC_MEM_SHARED=0 -O2 
-L[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs -lm -o 
./collapse-1.exe
lto1: internal compiler error: in streamer_get_builtin_tree, at 
tree-streamer-in.c:1136
0xc0b7ff streamer_get_builtin_tree(lto_input_block*, data_in*)
[...]/source-gcc/gcc/tree-streamer-in.c:1136
0x8f7cc4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned 
int)
[...]/source-gcc/gcc/lto-streamer-in.c:1303
0x8f7ee0 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned 
int*)
[...]/source-gcc/gcc/lto-streamer-in.c:1231
0x5e9bee lto_read_decls
[...]/source-gcc/gcc/lto/lto.c:1889
0x5ebc5c lto_file_finalize
[...]/source-gcc/gcc/lto/lto.c:2218
0x5ebc5c lto_create_files_from_ids
[...]/source-gcc/gcc/lto/lto.c:2228
0x5ebc5c lto_file_read
[...]/source-gcc/gcc/lto/lto.c:2269
0x5ebc5c read_cgraph_and_symbols
[...]/source-gcc/gcc/lto/lto.c:2969
0x5ebc5c lto_main()
[...]/source-gcc/gcc/lto/lto.c:3424
[...]
mkoffload-intelmic: fatal error: 
[...]/install/offload-x86_64-intelmicemul-linux-gnu/bin//x86_64-unknown-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc
 returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: 
[...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0//accel/x86_64-intelmicemul-linux-gnu/mkoffload
 returned 1 exit status
compilation terminated.
[...]/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status

If that is the "only" reason to add -fopenmp there, can we then instead
do the following?

 gcc/builtins.def | 8 ++--
 gcc/config/i386/intelmic-mkoffload.c | 1 -
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git gcc/builtins.def gcc/builtins.def
index b70e8e0..08bf62e 100644
--- gcc/builtins.def
+++ gcc/builtins.def
@@ -148,10 +148,13 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Builtin used by the implementation of OpenACC and OpenMP.  Few of these are
actually implemented in the compiler; most are in libgomp.  */
+/* These builtins also need to be enabled in offloading compilers invoked from
+   mkoffload; for that purpose, we're checking the -foffload-abi flag here.  */
 #undef DEF_GOACC_BUILTIN
 #define DEF_GOACC_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
   DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,\
-  false, true, true, ATTRS, false, flag_openacc)
+  false, true, true, ATTRS, false, \
+  (flag_openacc || flag_offload_abi != OFFLOAD_ABI_UNSET))
 #undef DEF_GOACC_BUILTIN_COMPILER
 #define DEF_GOACC_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \
   DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,\
@@ -160,7 +163,8 @@ along with GCC; see the file COPYING3.  If not see
 #define DEF_GOMP_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
   DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,\
false, true, true, ATTRS, false, \
-  (flag_openmp || flag_tree_parallelize_loops))
+  (flag_openmp || flag_tree_parallelize_loops \
+   || flag_offload_abi != OFFLOAD_ABI_UNSET))
 
 /* Builtin used by implementation of Cilk Plus.  Most of these are decomposed
by the compiler but a few are implemented in libcilkrts.  */ 
diff --git gcc/config/i386/inte

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-12-22 Thread Thomas Schwinge
Hi!

On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin  wrote:
> --- /dev/null
> +++ b/gcc/config/i386/intelmic-mkoffload.c
> @@ -0,0 +1,541 @@
> +/* Offload image generation tool for Intel MIC devices.

> +/* Shows if we should compile binaries for i386 instead of x86-64.  */
> +bool target_ilp32 = false;

My linker defaults to 32-bit x86, so I explicitly have to switch to
64-bit x86_64 mode; OK to commit the following, to always explicitly
specify what is wanted?

 gcc/config/i386/intelmic-mkoffload.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git gcc/config/i386/intelmic-mkoffload.c 
gcc/config/i386/intelmic-mkoffload.c
index c972f56..7337c31 100644
--- gcc/config/i386/intelmic-mkoffload.c
+++ gcc/config/i386/intelmic-mkoffload.c
@@ -191,6 +191,8 @@ compile_for_target (struct obstack *argv_obstack)
 {
   if (target_ilp32)
 obstack_ptr_grow (argv_obstack, "-m32");
+  else
+obstack_ptr_grow (argv_obstack, "-m64");
   obstack_ptr_grow (argv_obstack, NULL);
   char **argv = XOBFINISH (argv_obstack, char **);
 
@@ -355,6 +357,8 @@ generate_host_descr_file (const char *host_compiler)
   new_argv[new_argc++] = "-shared";
   if (target_ilp32)
 new_argv[new_argc++] = "-m32";
+  else
+new_argv[new_argc++] = "-m64";
   new_argv[new_argc++] = src_filename;
   new_argv[new_argc++] = "-o";
   new_argv[new_argc++] = obj_filename;
@@ -511,11 +515,11 @@ main (int argc, char **argv)
   unsigned new_argc = 0;
   const char *new_argv[9];
   new_argv[new_argc++] = "ld";
+  new_argv[new_argc++] = "-m";
   if (target_ilp32)
-{
-  new_argv[new_argc++] = "-m";
-  new_argv[new_argc++] = "elf_i386";
-}
+new_argv[new_argc++] = "elf_i386";
+  else
+new_argv[new_argc++] = "elf_x86_64";
   new_argv[new_argc++] = "--relocatable";
   new_argv[new_argc++] = host_descr_filename;
   new_argv[new_argc++] = target_so_filename;


Grüße,
 Thomas


signature.asc
Description: PGP signature


Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2014-12-22 Thread Jakub Jelinek
On Mon, Dec 22, 2014 at 12:20:58PM +0100, Thomas Schwinge wrote:
> On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin  wrote:
> > --- /dev/null
> > +++ b/gcc/config/i386/intelmic-mkoffload.c
> > @@ -0,0 +1,541 @@
> > +/* Offload image generation tool for Intel MIC devices.
> 
> > +static const char *
> > +prepare_target_image (const char *target_compiler, int argc, char **argv)
> > +{
> > +  [...]
> > +  obstack_init (&argv_obstack);
> > +  obstack_ptr_grow (&argv_obstack, target_compiler);
> > +  obstack_ptr_grow (&argv_obstack, "-xlto");
> > +  obstack_ptr_grow (&argv_obstack, "-fopenmp");
> > +  obstack_ptr_grow (&argv_obstack, "-shared");
> > +  obstack_ptr_grow (&argv_obstack, "-fPIC");
> > +  obstack_ptr_grow (&argv_obstack, opt1);
> 
> What is the reason that you're adding -fopenmp here?  I assume it is that
> otherwise you'd get tree streaming errors because of different builtins
> configurations, like this?
> 
> $ [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ 
> [...]/source-gcc/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/collapse-1.c
>  -B[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/ 
> -B[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs 
> -I[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp 
> -I[...]/source-gcc/libgomp/testsuite/../../include 
> -I[...]/source-gcc/libgomp/testsuite/.. -fmessage-length=0 
> -fno-diagnostics-show-caret -fdiagnostics-color=never 
> -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0
>  -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/bin -fopenacc 
> -DACC_DEVICE_TYPE_host_nonshm=1 -DACC_MEM_SHARED=0 -O2 
> -L[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs -lm -o 
> ./collapse-1.exe
> lto1: internal compiler error: in streamer_get_builtin_tree, at 
> tree-streamer-in.c:1136
> 0xc0b7ff streamer_get_builtin_tree(lto_input_block*, data_in*)
> [...]/source-gcc/gcc/tree-streamer-in.c:1136
> 0x8f7cc4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned 
> int)
> [...]/source-gcc/gcc/lto-streamer-in.c:1303
> 0x8f7ee0 lto_input_scc(lto_input_block*, data_in*, unsigned int*, 
> unsigned int*)
> [...]/source-gcc/gcc/lto-streamer-in.c:1231
> 0x5e9bee lto_read_decls
> [...]/source-gcc/gcc/lto/lto.c:1889
> 0x5ebc5c lto_file_finalize
> [...]/source-gcc/gcc/lto/lto.c:2218
> 0x5ebc5c lto_create_files_from_ids
> [...]/source-gcc/gcc/lto/lto.c:2228
> 0x5ebc5c lto_file_read
> [...]/source-gcc/gcc/lto/lto.c:2269
> 0x5ebc5c read_cgraph_and_symbols
> [...]/source-gcc/gcc/lto/lto.c:2969
> 0x5ebc5c lto_main()
> [...]/source-gcc/gcc/lto/lto.c:3424
> [...]
> mkoffload-intelmic: fatal error: 
> [...]/install/offload-x86_64-intelmicemul-linux-gnu/bin//x86_64-unknown-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc
>  returned 1 exit status
> compilation terminated.
> lto-wrapper: fatal error: 
> [...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0//accel/x86_64-intelmicemul-linux-gnu/mkoffload
>  returned 1 exit status
> compilation terminated.
> [...]/ld: lto-wrapper failed
> collect2: error: ld returned 1 exit status
> 
> If that is the "only" reason to add -fopenmp there, can we then instead
> do the following?
> 
>  gcc/builtins.def | 8 ++--
>  gcc/config/i386/intelmic-mkoffload.c | 1 -
>  2 files changed, 6 insertions(+), 3 deletions(-)

If Ilya confirms that is the sole reason, I'm fine with this change.
Please write ChangeLog entry for it.

Jakub


Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-12-22 Thread Jakub Jelinek
On Mon, Dec 22, 2014 at 12:25:32PM +0100, Thomas Schwinge wrote:
> Hi!
> 
> On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin  wrote:
> > --- /dev/null
> > +++ b/gcc/config/i386/intelmic-mkoffload.c
> > @@ -0,0 +1,541 @@
> > +/* Offload image generation tool for Intel MIC devices.
> 
> > +/* Shows if we should compile binaries for i386 instead of x86-64.  */
> > +bool target_ilp32 = false;
> 
> My linker defaults to 32-bit x86, so I explicitly have to switch to
> 64-bit x86_64 mode; OK to commit the following, to always explicitly
> specify what is wanted?
> 
>  gcc/config/i386/intelmic-mkoffload.c | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)

Ok with proper ChangeLog entry.

Jakub


Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing

2014-12-22 Thread Thomas Schwinge
Hi!

On Thu, 18 Dec 2014 18:41:18 +0100, Ilya Verbin  wrote:
> 2014-12-18 16:27 GMT+01:00 Thomas Schwinge :
> > On Thu, 30 Oct 2014 14:40:01 +0300, Ilya Verbin  wrote:
> >> This patch allows to run non-fallback 'make check-target-libgomp'.  It 
> >> passes to
> >> the host compiler additional -B options with the paths to the offload 
> >> compilers,
> >> since non-installed host compiler doesn't know where to find mkoffload 
> >> tools.
> >> Also in case of intelmic offload targets it appends paths to liboffloadmic 
> >> lib.
> >
> >> --- a/libgomp/configure.ac
> >> +++ b/libgomp/configure.ac
> >> @@ -280,9 +280,13 @@ else
> >>multilib_arg=
> >>  fi
> >>
> >> +# Get accel target and path to install tree of accel compiler
> >> +offload_additional_options=
> >> +offload_additional_lib_paths=
> >>  offload_targets=
> >>  if test x"$enable_offload_targets" != x; then
> >>for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
> >> +tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
> >>  tgt=`echo $tgt | sed 's/=.*//'`
> >>  case $tgt in
> >>*-intelmic-* | *-intelmicemul-*)
> >> @@ -295,10 +299,20 @@ if test x"$enable_offload_targets" != x; then
> >>  else
> >>offload_targets=$offload_targets,$tgt_name
> >>  fi
> >> +if test x"$tgt_dir" != x; then
> >> +  offload_additional_options="$offload_additional_options 
> >> -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
> >> +  
> >> offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib"
> >> +else
> >> +  offload_additional_options="$offload_additional_options 
> >> -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
> >> +  
> >> offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"
> >> +fi
> >>done
> >>  fi
> >
> > Hmm, maybe I'm seeing a problem where there isn't one, but in case I'm
> > not: how will this work if there is more than one offloading compiler
> > configured?  Won't you get conflicting -B paths added to
> > offload_additional_options in this case?

> In this place I don't see any problems, at least for the case with
> installed offloading compilers.
> One -B allows to find mkoffload in lto-wrapper:compile_offload_image.
> This function tries to open all paths + '/accel/target_name/mkoffload'
> suffix. So, there should be no conflicts.
> Another -B allows mkoffload to find target driver. It tries to open
> 'host_name-accel-target_name-gcc', so, there also should be no
> conflicts.

Aha, thanks for the explanation, and yes, that seems all good.


What is the reason for adding paths if $tgt_dir is empty?  (I mean, if
properly installed and $tgt_dir empty, this should just work, because
that's what a user will be doing, so why does the libgomp testsuite have
to do differently?)  These paths will (basically) point to GCC's
configured --prefix=[...] -- which may not actually match where the
installed offloading compilers are to be found, for example, in the
common case that DESTDIR is used with make install.  And, isn't it that
GCC by default will already be looking into "$prefix" installation
directories, or is this solving an actual problem for you?  If not, is it
then OK to remove the cases for empty $tgt_dir?


> However, I still did not tried to enable 'make check' with
> non-installed offloading compilers.

I'm working of that (with low priority, though).

In my understanding, we'd like to support the modes that either all
compilers are installed (which is what a user will be using), or all are
tested from their build trees.  Or, do we also have to support the mode
that only the offloading compilers are installed, but the target
(offloading host) compiler is not?  (Doesn't make much sense to me.)


Here is a patch to correctly match intelmic in $offload_targets; OK to
commit, I assume?  I suppose I'm the first one to ever do build-tree
testing?  (Jakub?)

--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -115,8 +115,7 @@ proc libgomp_init { args } {
 
 # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
 # non-fallback testing for Intel MIC targets
-if { [string match "*-intelmic-*" $offload_targets]
-   || [string match "*-intelmicemul-*" $offload_targets] } {
+if { [string match "*,intelmic,*" ",$offload_targets,"] } {
append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
# libstdc++ is required by liboffloadmic


Such things also need to be guarded to be done for build-tree testing
only; I'll address this later on, where missing.


Here is a patch to fix 32-bit x86 Intel MIC offloading; OK to commit, I
assume?

[...]
spawn [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ 
[...]/source-gcc/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c 
-B[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/ 
-B[.

[Patch, libada] Fix PR64349 - make darwin use the correct interface to access _environ.

2014-12-22 Thread Iain Sandoe
Hi Eric,

For the main executable, it is permitted for Darwin to access _environ 
directly.  For shared libraries, it is not (one is supposed use 
_NSGetEnviron()).

At present, the more recent darwin ports are "getting away" with the omission 
because they have a blanket setting of -Wl,-undefined,dynamic_lookup which 
means that the symbol can be satisfied from the executable at dynamic load 
time.  However, the change is applicable generally (not just to the older ports 
mentioned in the PR).

The attached patch fixes this properly (we can bike-shed over whether __APPLE__ 
or __MACH__ is a better guard, I don't have an axe to grind particularly).

This is one of two remaining bootstrap blockers across the Darwin patch.

OK for trunk?
Iain

gcc/ada:

PR ada/64349
* env.c (__gnat_environ): Use the _NSGetEnviron() interface to access 
the environment
for Darwin.

From c336acb970b21589368948bc1bdc502546b568fc Mon Sep 17 00:00:00 2001
From: Iain Sandoe 
Date: Mon, 22 Dec 2014 10:47:40 +
Subject: [PATCH] Arrange for libada to use the approved interface to obtain
 _environ on Darwin

---
 gcc/ada/env.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index 9530813..ff602b2 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -198,6 +198,11 @@ __gnat_setenv (char *name, char *value)
 #endif
 }
 
+#ifdef __APPLE__
+#include 
+#define environ (*_NSGetEnviron ())
+#endif
+
 char **
 __gnat_environ (void)
 {
@@ -209,10 +214,10 @@ __gnat_environ (void)
 #elif defined (sun)
   extern char **_environ;
   return _environ;
-#elif ! (defined (__vxworks))
-  extern char **environ;
+#elif defined (__vxworks) || defined (__APPLE__)
   return environ;
 #else
+  extern char **environ;
   return environ;
 #endif
 }
-- 
1.8.4.2





Re: [PATCH 0/4] OpenMP 4.0 offloading to Intel MIC

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 21 Oct 2014 21:13:23 +0400, Ilya Verbin  wrote:
> This patchset would contain target-specific things to support offloading to 
> the
> devices with Intel MIC architecture.
> Particularly: mkoffload tool, liboffloadmic library and a plugin for libgomp.

By chance (when tracking down a different problem), I've found the
following.  Would you please check whether that's a real problem in
liboffloadmic, or its libgomp plugin, or just a mis-diagnosis by
Valgrind?

$ build-gcc/gcc/xgcc -Bbuild-gcc/gcc/ 
source-gcc/libgomp/testsuite/libgomp.fortran/examples-4/e.55.2.f90 
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/ 
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs 
-Ibuild-gcc/x86_64-unknown-linux-gnu/./libgomp 
-Isource-gcc/libgomp/testsuite/../../include -Isource-gcc/libgomp/testsuite/.. 
-Binstall/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0
 -Binstall/offload-x86_64-intelmicemul-linux-gnu/bin -fopenmp 
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs/ -O0 
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs 
-fintrinsic-modules-path=build-gcc/x86_64-unknown-linux-gnu/./libgomp 
-Lbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs 
-Lbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs/ 
-Lbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs -lgfortran 
-lm -g
$ 
LD_LIBRARY_PATH=.:build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/plugin/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libstdc++-v3/src/.libs:install/offload-x86_64-intelmicemul-linux-gnu/lib64:install/offload-x86_64-intelmicemul-linux-gnu/lib:build-gcc/gcc:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs:.:build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/plugin/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libstdc++-v3/src/.libs:install/offload-x86_64-intelmicemul-linux-gnu/lib64:install/offload-x86_64-intelmicemul-linux-gnu/lib:build-gcc/gcc:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs:
 valgrind ./a.out
==21327== Memcheck, a memory error detector
==21327== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==21327== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright 
info
==21327== Command: ./a.out
==21327== 
==21327== Syscall param write(buf) points to uninitialised byte(s)
==21327==at 0x5686340: __write_nocancel (syscall-template.S:81)
==21327==by 0x6AFC5C8: COIPipelineRunFunction@@COI_1.0 
(coi_host.cpp:798)
==21327==by 0x68D942A: 
_ZN6Engine7computeERKSt4listB5cxx11IP9coibufferSaIS2_EEPKvtPvtjPK8coieventPSA_ 
(offload_engine.cpp:424)
==21327==by 0x68DED45: OffloadDescriptor::compute() 
(offload_host.cpp:2934)
==21327==by 0x68E64F8: OffloadDescriptor::offload(char const*, bool, 
VarDesc*, VarDesc2*, int, void const**, int, void const**, int, void const*) 
(offload_host.cpp:2191)
==21327==by 0x68D8D10: offload_offload_wrap(OffloadDescriptor*, char 
const*, int, int, VarDesc*, VarDesc2*, int, void const**, void const**, int, 
void const*) (compiler_if_host.cpp:259)
==21327==by 0x68D8E19: __offload_offload1 (compiler_if_host.cpp:281)
==21327==by 0x66B5387: offload(char const*, unsigned long, int, char 
const*, int, VarDesc*, VarDesc2*) [clone .constprop.24] 
(libgomp-plugin-intelmic.cpp:168)
==21327==by 0x54716C7: gomp_init_device (target.c:628)
==21327==by 0x5471E0D: GOMP_target_data (target.c:750)
==21327==by 0x400E6F: vec_mult_ (e.55.2.f90:38)
==21327==by 0x4011C9: MAIN__ (e.55.2.f90:55)
==21327==  Address 0x62ce6a2 is 18 bytes inside a block of size 72 alloc'd
==21327==at 0x4C2AB80: malloc (vg_replace_malloc.c:292)
==21327==by 0x68DD278: OffloadDescriptor::setup_misc_data(char const*) 
(offload_host.cpp:2060)
==21327==by 0x68E64D8: OffloadDescriptor::offload(char const*, bool, 
VarDesc*, VarDesc2*, int, void const**, int, void const**, int, void const*) 
(offload_host.cpp:2179)
==21327==by 0x68D8D10: offload_offload_wrap(OffloadDescriptor*, char 
const*, int, int, VarDesc*, VarDesc2*, int, void const**, void const**, int, 
void const*) (compiler_if_host.cpp:259)
==21327==by 0x68D8E19: __offload_offload1 (compiler_if_host.cpp:281)
==21327==by 0x66B5387: offload(char const*, unsigned long, int, char 
const*, int, VarDesc*, VarDesc2*) [clone .constprop.24] 
(libgomp-plugin-intelmic.cpp:168)
==21327==by 0x54716C7: gomp_init_device (target.c:628)
==21327==by 0x5471E0D: GOM

[Patch objcpp] Update gtfiles and add a testcase for c++ headers.

2014-12-22 Thread Iain Sandoe
Hi,

Whilst working on another patch for ObjC++, I found that trunk ICEs on #include 
 (on Darwin always, on Linux if you tickle ggc).

After the usual fun with tracking down a GTY(()) issue, it turned out to be 
triggered by 216263 (changes in the gtfiles for cp that were not reflected in 
objcp).  However, it appears that the list was a bit out of sync in general.

I've added a test-case that exercises the c++ headers to try and assist with 
catching this kind of issue.

Probably almost an "obvious" patch, but I'd be interested in any ideas to make 
this sync more automatic (it's an easy omission to make).

OK for trunk?
Iain

gcc/objcp:
* config-lang.in (gtfiles): Update list.

gcc/testsuite:
* obj-c++.dg/standard-headers.mm New File.

From fda7470f52b0bd9ff66dd808f88429d9ab3fc9ea Mon Sep 17 00:00:00 2001
From: Iain Sandoe 
Date: Mon, 22 Dec 2014 10:48:48 +
Subject: [PATCH] Update gtfiles, add a testcase to catch obvious fails caused
 by future changes

---
 gcc/objcp/config-lang.in |  2 +-
 gcc/testsuite/obj-c++.dg/standard-headers.mm | 89 
 2 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/obj-c++.dg/standard-headers.mm

diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in
index bc04022..e623521 100644
--- a/gcc/objcp/config-lang.in
+++ b/gcc/objcp/config-lang.in
@@ -45,6 +45,6 @@ subdir_requires="objc cp"
 
 # This list is separated in two parts: the first one is identical to
 # the C++ one, the second one contains our ObjC++ additions.
-gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c 
\$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h 
\$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c 
\$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c 
\$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h 
\$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c 
\$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h 
\$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c 
\$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c 
\$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \
+gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c 
\$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h 
\$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c 
\$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c 
\$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h 
\$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c 
\$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h 
\$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c 
\$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c 
\$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/except.c 
\$(srcdir)/cp/vtable-class-hierarchy.c \$(srcdir)/cp/constexpr.c \
 \$(srcdir)/objc/objc-map.h \$(srcdir)/objc/objc-act.h 
\$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c 
\$(srcdir)/objc/objc-gnu-runtime-abi-01.c 
\$(srcdir)/objc/objc-next-runtime-abi-01.c 
\$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c-family/c-cppbuiltin.c"
 
diff --git a/gcc/testsuite/obj-c++.dg/standard-headers.mm 
b/gcc/testsuite/obj-c++.dg/standard-headers.mm
new file mode 100644
index 000..68af5d1
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/standard-headers.mm
@@ -0,0 +1,89 @@
+// Contributed by Iain Sandoe , December 2014.  */
+// { dg-do compile }
+// { dg-options "-std=c++11 -Wno-deprecated" }
+
+// Try to catch any problems in standard headers.
+
+// n4296 Section 17.6.1.1 Table 14
+
+#include 
+#include 
+#include 
+#include 
+#include 
+// NOT present at 5.0.0 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+// FIXME: CURRENTLY FAILS #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+// LEGACY #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// n4296 Section 17.6.1.1 Table 15
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+// NOT present everywhere #include 
+#include 
+#include 
-- 
1.8.4.2





Re: [PING][patch 1/2][ARM]: New CPU support for Marvell Whitney

2014-12-22 Thread Xingxing Pan

On 19/12/2014 19:01, Xingxing Pan wrote:

On 19/12/2014 18:38, Kyrill Tkachov wrote:

Hi Xingxin,

It seems that your mail client mangled this patch, at least the
following hunk doesn't apply, even when I try to get it from the web
archives.
Could you please resend it as an attachment perhaps?

Thanks,
Kyrill

On 18/12/14 10:13, Xingxing Pan wrote:

diff --git a/gcc/config/arm/arm-cores.def b/gcc/config/arm/arm-cores.def
index 423ee9e..b0ffbe1 100644
--- a/gcc/config/arm/arm-cores.def
+++ b/gcc/config/arm/arm-cores.def
@@ -159,6 +159,7 @@ ARM_CORE("cortex-m7",   cortexm7,
cortexm7, 7EM,
FL_LDSCHED, cortex_m7)
 ARM_CORE("cortex-m4", cortexm4, cortexm4, 7EM,
FL_LDSCHED, v7m)
 ARM_CORE("cortex-m3", cortexm3, cortexm3, 7M,
FL_LDSCHED, v7m)
 ARM_CORE("marvell-pj4",   marvell_pj4, marvell_pj4,
7A,  FL_LDSCHED, 9e)
+ARM_CORE("marvell-whitney",marvell_whitney,
marvell_whitney,
7A,  FL_LDSCHED | FL_THUMB_DIV | FL_ARM_DIV, marvell_whitney)





Hi Kyrill,

I've changed the code to use "tune" attribute directly. The new patch is
attached.

Thanks,
Xingxing


Any comments are welcome.

Thanks,
Xingxing


Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing

2014-12-22 Thread Jakub Jelinek
On Mon, Dec 22, 2014 at 12:48:08PM +0100, Thomas Schwinge wrote:
> In my understanding, we'd like to support the modes that either all
> compilers are installed (which is what a user will be using), or all are
> tested from their build trees.  Or, do we also have to support the mode
> that only the offloading compilers are installed, but the target
> (offloading host) compiler is not?  (Doesn't make much sense to me.)

All 3 of these, yes.
The nothing is installed yet mode supposedly doesn't work properly on the
trunk yet (and is what I'd like to use e.g. in distro rpm builds), the 
offloading
compilers installed, host is not is useful that you actually test the host 
compiler
before installing, and that supposedly works on the trunk, the all installed 
testing
I've never used myself, but some people are using it.

Jakub


[PATCH c++/objc++] Make Objective-c++ recognise lambdas.

2014-12-22 Thread Iain Sandoe
Hi,

The principle of Objective-c/c++ is that they should be supersets of the parent 
language.  Thus, it is intended that valid c++ (or c) should be parsed by the 
relevant objective-c/c++ FE.

While trying to build some external code, I found that lambdas confuse things 
at present for objcp.

When we find "[" and we're in objcp mode, and the "[" introduces a lambda, we 
try to parse a message expression and if that fails we punt (thus we are unable 
to recognise lambdas).

The attached patch tries "[" as a message expression introducer, if that fails 
it drops through to try for a lambda (no change intended for the 
non-objective-c++ path).

I guess it's a bit of a nuisance that the diagnostics from a failed message 
expression are likely to end up as mentioning a lambda.  Perhaps we might 
decide to punt early if we are both ObjC and < c++11.

This allows me to parse some necessary lldb headers with gcc objcp.

Thoughts / OK for trunk?
(I can raise a formal PR if you like).

Iain

gcc/cp:
* parser.c (cp_parser_primary_expression): If parsing an objective-c++ 
message
expression fails, see if a lambda is present.
(cp_parser_objc_message_reciever): Don't assume that if a message 
reciever expression
fails it is a hard error.

gcc/testsuite:
* obj-c++.dg/lambda-0.mm New file.
* obj-c++.dg/lambda-1.mm New file.

From e8038ba3cb16095e53d09e23ff15f4682cb5bd0c Mon Sep 17 00:00:00 2001
From: Iain Sandoe 
Date: Mon, 22 Dec 2014 10:50:45 +
Subject: [PATCH] Modify objective-c++ parse to check for lambdas when a
 message construct isn't matched after a [

---
 gcc/cp/parser.c| 21 +
 gcc/testsuite/obj-c++.dg/lambda-0.mm   | 22 ++
 gcc/testsuite/obj-c++.dg/lambda-1.mm   | 13 +
 gcc/testsuite/obj-c++.dg/syntax-error-6.mm |  5 -
 4 files changed, 56 insertions(+), 5 deletions(-)
 create mode 100644 gcc/testsuite/obj-c++.dg/lambda-0.mm
 create mode 100644 gcc/testsuite/obj-c++.dg/lambda-1.mm

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 8ff16ed..1409bef 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4441,10 +4441,17 @@ cp_parser_primary_expression (cp_parser *parser,
   }
 
 case CPP_OPEN_SQUARE:
-  if (c_dialect_objc ())
-/* We have an Objective-C++ message. */
-return cp_parser_objc_expression (parser);
   {
+   if (c_dialect_objc ())
+ {
+   /* We might have an Objective-C++ message. */
+   cp_parser_parse_tentatively (parser);
+   tree msg = cp_parser_objc_message_expression (parser);
+   /* If that works out, we're done ... */
+   if (cp_parser_parse_definitely (parser))
+ return msg;
+   /* ... else, fall though to see if it's a lambda.  */
+ }
tree lam = cp_parser_lambda_expression (parser);
/* Don't warn about a failed tentative parse.  */
if (cp_parser_error_occurred (parser))
@@ -25630,14 +25637,20 @@ cp_parser_objc_message_receiver (cp_parser* parser)
   cp_parser_parse_tentatively (parser);
   rcv = cp_parser_expression (parser);
 
+  /* If that worked out, fine.  */
   if (cp_parser_parse_definitely (parser))
 return rcv;
 
+  cp_parser_parse_tentatively (parser);
   rcv = cp_parser_simple_type_specifier (parser,
 /*decl_specs=*/NULL,
 CP_PARSER_FLAGS_NONE);
 
-  return objc_get_class_reference (rcv);
+  if (cp_parser_parse_definitely (parser))
+return objc_get_class_reference (rcv);
+  
+  cp_parser_error (parser, "objective-c++ message receiver expected");
+  return error_mark_node;
 }
 
 /* Parse the arguments and selectors comprising an Objective-C message.
diff --git a/gcc/testsuite/obj-c++.dg/lambda-0.mm 
b/gcc/testsuite/obj-c++.dg/lambda-0.mm
new file mode 100644
index 000..41482fd
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/lambda-0.mm
@@ -0,0 +1,22 @@
+// Contributed by Iain Sandoe , December 2014.  */
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+
+template
+Function thing(Function fn, int a)
+{
+  fn(a);
+  return fn;
+}
+
+int
+test (int *arr, unsigned n)
+{
+  int total = 0;
+  for (unsigned i=0; i, December 2014.  */
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+extern "C" {
+  int printf (const char *,...);
+}
+
+int main () 
+{
+  auto f = [] (const char *msg) -> int { printf("%s", msg); return 0; };
+  return f("Some test\n");
+}
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-6.mm 
b/gcc/testsuite/obj-c++.dg/syntax-error-6.mm
index 21423ec..36a444f 100644
--- a/gcc/testsuite/obj-c++.dg/syntax-error-6.mm
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-6.mm
@@ -8,5 +8,8 @@ void FOO()
 {
   NSButton * mCopyAcrobatCB; 

-  [ [ mCopyAcrobatCB state ] == 0 ] != 1;  /* { dg-error "objective\\-c\\+\\+" 
} */
+  [ [ mCopyAcrobatCB state ] == 0 ] != 1;  /* { dg-error "expected identifier 

Re: [PATCH 1/3] libstdc++: Add time_get::get support.

2014-12-22 Thread Jonathan Wakely

On 15/04/14 23:19 +0200, Rüdiger Sonderfeld wrote:

+  TESTHEAD("check broken format");
+  iss.str("2014-04-14 01:09:35");
+  format = "%";
+  ret = tget.get(istreambuf_iterator(iss), end, iss, err, &time,
+ format.data(), format.data()+format.size());
+  VERIFY(err == ios_base::failbit);
+
+  TESTHEAD("check single format letter version");
+  iss.str("2020");
+  ret = tget.get(istreambuf_iterator(iss), end, iss, err, &time, 'Y');
+  VERIFY(err == ios_base::goodbit);
+  VERIFY(time.tm_year == 120);
+  VERIFY(ret == end);
+
+  TESTHEAD("check skipping of space");
+  iss.str("201007 01");
+  format = "%Y %m %d";
+  ret = tget.get(istreambuf_iterator(iss), end, iss, err, &time,
+ format.data(), format.data()+format.size());
+  VERIFY(err == ios_base::goodbit);
+  VERIFY(time.tm_year == 110);
+  VERIFY(time.tm_mon == 7);


This fails because tm_mon is zero-indexed, so the result is 6


+  VERIFY(time.tm_mday == 1);
+  VERIFY(ret == end);
+
+  TESTHEAD("check mismatch");
+  iss.str("year: 1970");
+  format = "jahr: 1970";
+  ret = tget.get(istreambuf_iterator(iss), end, iss, err, &time,
+ format.data(), format.data()+format.size());
+  VERIFY(err == ios_base::failbit);
+  VERIFY(ret == istreambuf_iterator(iss));
+
+  TESTHEAD("check case insensitive match");
+  iss.str("yEaR: 1980");
+  format = "YeAR: 1980";
+  ret = tget.get(istreambuf_iterator(iss), end, iss, err, &time,
+ format.data(), format.data()+format.size());
+  VERIFY(err == ios_base::goodbit);
+  VERIFY(ret == end);
+  VERIFY(time.tm_year == 80);


This test can never pass because the format has 1980 instead of %Y

Apparently the tests in this patch have never been run :-(

I think I've fixed them now though, and am committing the attached
patch to trunk.

commit 6ffbe32df8431a97d219941579b09ba238816aef
Author: Jonathan Wakely 
Date:   Fri Dec 19 00:02:02 2014 +

2014-12-22  R??diger Sonderfeld  
	Jonathan Wakely  

	PR libstdc++/60396
	* config/abi/pre/gnu.ver: Add new exports.
	* include/bits/locale_facets_nonio.h (time_get::get): New overloads.
	(time_get::do_get):  New virtual function.
	* include/bits/locale_facets_nonio.tcc (time_get::get): Define.
	(time_get::do_get): Define.
	* src/c++11/string-inst.cc (time_get::get, time_get::do_get): Add
	C++11-only instantiations.
	* testsuite/22_locale/time_get/get/char/1.cc: New.
	* testsuite/22_locale/time_get/get/char/2.cc: New.
	* testsuite/22_locale/time_get/get/wchar_t/1.cc: New.
	* testsuite/22_locale/time_get/get/wchar_t/2.cc: New.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 8ba8ed4..6602532 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1748,6 +1748,10 @@ GLIBCXX_3.4.21 {
 
 _ZNKSt3tr14hashINSt7__cxx1112basic_string*;
 
+# std::time_get::get
+_ZNKSt8time_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE3getES3_S3_RSt8ios_baseRSt12_Ios_IostateP2tmPK[cw]SC_;
+_ZNKSt8time_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE6do_getES3_S3_RSt8ios_baseRSt12_Ios_IostateP2tmcc;
+
 } GLIBCXX_3.4.20;
 
 
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h
index 9c629e2..a9feaec 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.h
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.h
@@ -537,6 +537,54 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 	   ios_base::iostate& __err, tm* __tm) const
   { return this->do_get_year(__beg, __end, __io, __err, __tm); }
 
+#if __cplusplus >= 201103L
+  /**
+   *  @brief  Parse input string according to format.
+   *
+   *  This function calls time_get::do_get with the provided
+   *  parameters.  @see do_get() and get().
+   *
+   *  @param __sStart of string to parse.
+   *  @param __end  End of string to parse.
+   *  @param __io   Source of the locale.
+   *  @param __err  Error flags to set.
+   *  @param __tm   Pointer to struct tm to fill in.
+   *  @param __format   Format specifier.
+   *  @param __modifier Format modifier.
+   *  @return  Iterator to first char not parsed.
+   */
+  inline
+  iter_type get(iter_type __s, iter_type __end, ios_base& __io,
+ios_base::iostate& __err, tm* __tm, char __format,
+char __modifier = 0) const
+  {
+return this->do_get(__s, __end, __io, __err, __tm, __format,
+__modifier);
+  }
+
+  /**
+   *  @brief  Parse input string according to format.
+   *
+   *  This function parses the input string according to a
+   *  provided format string.  It does the inverse of
+   *  time_put::put.  The format string follows the format
+   *  specified for strftime(3)/strptime(3).  The actual parsing
+   *  i

Re: [PATCH 3/3] libstdc++: Add get_time support.

2014-12-22 Thread Jonathan Wakely

On 15/04/14 23:20 +0200, Rüdiger Sonderfeld wrote:

* libstdc++-v3/include/std/iomanip (_Get_time): New struct.
 (get_time): New manipulator [ext.manip].
 (operator>>): New overloaded function.
* libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/1.cc:
* libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/2.cc:
* libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/wchar_t/1.cc:
* libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/wchar_t/2.cc:
 New file.


Committed as attached - thanks for the patches, after this there are
very few C++11 features missing from libstdc++!


commit bec22aeacafd666944490aebc1afa007e0043f8f
Author: Jonathan Wakely 
Date:   Tue Oct 14 13:31:28 2014 +0100

2014-12-22  R??diger Sonderfeld  

	PR libstdc++/54354
	* include/std/iomanip (_Get_time): New struct.
	(get_time): New manipulator.
	(operator<<): New overloaded function.
	* testsuite/27_io/manipulators/extended/get_time/char/1.cc: New.
	* testsuite/27_io/manipulators/extended/get_time/char/2.cc: New.
	* testsuite/27_io/manipulators/extended/get_time/wchar_t/1.cc: New.
	* testsuite/27_io/manipulators/extended/get_time/wchar_t/2.cc: New.

diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index fce74c9..080dae3 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -392,6 +392,60 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   return __os;
 }
 
+  template
+struct _Get_time
+{
+  std::tm*	_M_tmb;
+  const _CharT* _M_fmt;
+};
+
+  /**
+   *  @brief  Extended manipulator for extracting time.
+   *
+   *  This manipulator uses time_get::get to extract time.
+   *  [ext.manip]
+   *
+   *  @param __tmb  struct to extract the time data to.
+   *  @param __fmt  format string.
+   */
+  template
+inline _Get_time<_CharT>
+get_time(std::tm* __tmb, const _CharT* __fmt)
+{ return { __tmb, __fmt }; }
+
+  template
+basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, _Get_time<_CharT> __f)
+{
+  typename basic_istream<_CharT, _Traits>::sentry __cerb(__is, false);
+  if (__cerb)
+{
+  ios_base::iostate __err = ios_base::goodbit;
+  __try
+{
+  typedef istreambuf_iterator<_CharT, _Traits>   _Iter;
+  typedef time_get<_CharT, _Iter>_TimeGet;
+
+  const _CharT* const __fmt_end = __f._M_fmt +
+_Traits::length(__f._M_fmt);
+
+  const _TimeGet& __mg = use_facet<_TimeGet>(__is.getloc());
+  __mg.get(_Iter(__is.rdbuf()), _Iter(), __is,
+   __err, __f._M_tmb, __f._M_fmt, __fmt_end);
+}
+  __catch(__cxxabiv1::__forced_unwind&)
+{
+  __is._M_setstate(ios_base::badbit);
+  __throw_exception_again;
+}
+  __catch(...)
+{ __is._M_setstate(ios_base::badbit); }
+  if (__err)
+__is.setstate(__err);
+}
+  return __is;
+}
+
 #if __cplusplus > 201103L
 
 #define __cpp_lib_quoted_string_io 201304
diff --git a/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/1.cc b/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/1.cc
new file mode 100644
index 000..07f0111
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/1.cc
@@ -0,0 +1,49 @@
+// { dg-options " -std=gnu++11 " }
+
+// 2014-04-14 R??diger Sonderfeld  
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// .
+
+// 27.7.5. (C++11) Extended manipulators [ext.manip]: put_time
+
+#include 
+#include 
+#include 
+#include 
+
+void test01()
+{
+  using namespace std;
+  bool test __attribute__((unused)) = true;
+  locale loc_c = locale::classic();
+  istringstream iss;
+  iss.imbue(loc_c);
+  iss.str("12:01:30  1971");
+  tm time1;
+  iss >> get_time(&time1, "%H:%M:%S %Y");
+  VERIFY( static_cast(iss) );
+  VERIFY(time1.tm_hour == 12);
+  VERIFY(time1.tm_min == 1);
+  VERIFY(time1.tm_sec == 30);
+  VERIFY(time1.tm_year == 71);
+}
+
+int main()
+{
+  test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/2.cc b/li

Re: [Patch, libada] Fix PR64349 - make darwin use the correct interface to access _environ.

2014-12-22 Thread Arnaud Charlet
Iain,

The change isn't quite right for iOS (aka arm-darwin), but the general idea
is the right one.

Tristan (cc:ed) has prepared a patch for this issue which works on both
MAC OS and darwin), which I'll merge soon. This will address this PR.

Arno


Re: [Patch, libada] Fix PR64349 - make darwin use the correct interface to access _environ.

2014-12-22 Thread Eric Botcazou
>   PR ada/64349
>   * env.c (__gnat_environ): Use the _NSGetEnviron() interface to access
>   the environment for Darwin.

OK if Tristan has no objections to the patch:
  https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01753.html

-- 
Eric Botcazou


Re: [Patch, libada] Fix PR64349 - make darwin use the correct interface to access _environ.

2014-12-22 Thread Iain Sandoe
hi Arnaud,

On 22 Dec 2014, at 13:53, Arnaud Charlet wrote:

> The change isn't quite right for iOS (aka arm-darwin), but the general idea
> is the right one.

hmm.. I wasn't aware of a [> 4.2.1] arm-mach-o backend .. if that's a general 
issue, then I'll consider it for future patches.

> Tristan (cc:ed) has prepared a patch for this issue which works on both
> MAC OS and darwin), which I'll merge soon. This will address this PR.

Thanks, that's fine .. always better to be general.
Iain



Re: [Patch, libada] Fix PR64349 - make darwin use the correct interface to access _environ.

2014-12-22 Thread Arnaud Charlet
> hmm.. I wasn't aware of a [> 4.2.1] arm-mach-o backend .. if that's a general
> issue, then I'll consider it for future patches.

Yes please.

> > Tristan (cc:ed) has prepared a patch for this issue which works on both
> > MAC OS and darwin), which I'll merge soon. This will address this PR.
> 
> Thanks, that's fine .. always better to be general.

Great.

Arno


Re: [PATCH 2/3] Extended if-conversion

2014-12-22 Thread Yuri Rumyantsev
Richard,

I changed algorithm for bool pattern repair.
It turned out that ifcvt_local_dce phaase is required since for
test-case I sent you in previous mail vectorization is not performed
without dead code elimination:

For the loop
#pragma omp simd safelen(8)
  for (i=0; i<512; i++)
  {
float t = a[i];
if (t > 0.0f & t < 1.0e+17f)
  if (c[i] != 0)
res += 1;
  }

I've got the following message from vectorizer:

t3.c:10:11: note: ==> examining statement: _ifc__39 = t_5 > 0.0;

t3.c:10:11: note: bit-precision arithmetic not supported.
t3.c:10:11: note: not vectorized: relevant stmt not supported:
_ifc__39 = t_5 > 0.0;

It is caused by the following dead predicate computations after
critical edge splitting:

(after combine blocks):

:
# res_15 = PHI 
# i_16 = PHI 
# ivtmp_14 = PHI 
t_5 = a[i_16];
_6 = t_5 > 0.0;
_7 = t_5 < 9.998430674944e+16;
_8 = _6 & _7;
_10 = &c[i_16];
_ifc__36 = _8 ? 4294967295 : 0;
_9 = MASK_LOAD (_10, 0B, _ifc__36);
_28 = _8;
_29 = _9 != 0;
_30 = _28 & _29;
// Statements below are dead!!
_31 = _8;
_32 = _9 != 0;
_33 = ~_32;
_34 = _31 & _33;
// End of dead statements.
_ifc__35 = _30 ? 1 : 0;
res_1 = res_15 + _ifc__35;
i_11 = i_16 + 1;
ivtmp_13 = ivtmp_14 - 1;
if (ivtmp_13 != 0)
  goto ;
else
  goto ;

But if we delete these statements loop will be vectorized.

New patch is attached.

Thanks.
Yuri.

2014-12-19 14:45 GMT+03:00 Richard Biener :
> On Thu, Dec 18, 2014 at 2:45 PM, Yuri Rumyantsev  wrote:
>> Richard,
>>
>> I am sending you full patch (~1000 lines) but if you need only patch.1
>> and patch.2 will let me know and i'll send you reduced patch.
>>
>> Below are few comments regarding your remarks for patch.3.
>>
>> 1. I deleted sub-phase ifcvt_local_dce since I did not find test-case
>> when dead code elimination is required to vectorize loop, i.e. dead
>> statement is marked as relevant.
>> 2. You wrote:
>>> The "retry" code also looks odd - why do you walk the BB multiple
>>> times instead of just doing sth like
>>>
>>>  while (!has_single_use (lhs))
>>>{
>>>  gimple copy = ifcvt_split_def_stmt (def_stmt);
>>>  ifcvt_walk_pattern_tree (copy);
>>>}
>>>
>>> thus returning the copy you create and re-process it (the copy should
>>> now have a single-use).
>>
>> The problem is that not only top SSA_NAME (lhs) may have multiple uses
>> but some intermediate variables too. For example, for the following
>> test-case
>>
>> float a[1000];
>> int c[1000];
>>
>> int foo()
>> {
>>   int i, res = 0;
>> #pragma omp simd safelen(8)
>>   for (i=0; i<512; i++)
>>   {
>> float t = a[i];
>> if (t > 0.0f & t < 1.0e+17f)
>>   if (c[i] != 0)
>> res += 1;
>>   }
>>   return res;
>> }
>>
>> After combine_blocks we have the following bb:
>>
>> :
>> # res_15 = PHI 
>> # i_16 = PHI 
>> # ivtmp_14 = PHI 
>> t_5 = a[i_16];
>> _6 = t_5 > 0.0;
>> _7 = t_5 < 9.998430674944e+16;
>> _8 = _6 & _7;
>> _10 = &c[i_16];
>> _ifc__32 = _8 ? 4294967295 : 0;
>> _9 = MASK_LOAD (_10, 0B, _ifc__32);
>> _28 = _8;
>> _29 = _9 != 0;
>> _30 = _28 & _29;
>> _ifc__31 = _30 ? 1 : 0;
>> res_1 = res_15 + _ifc__31;
>> i_11 = i_16 + 1;
>> ivtmp_13 = ivtmp_14 - 1;
>> if (ivtmp_13 != 0)
>>   goto ;
>> else
>>   goto ;
>>
>> and we can see that _8 has multiple uses. Also note that after splitting of
>> _8 = _6 & _7
>> we also get multiple uses for definition of  _6 and _7. So I used this
>> iterative algorithm as the simplest one.
>
> But it walks the entire pattern again and again while you only need to
> ensure you walk the pattern tree of the now single-use DEF again
> (in fact, rather than replacing a random USE in ifcvt_split_def_stmt
> you should pass down the user_operand_p that you need to make
> single-use).
>
>> I think it would be nice to re-use some utility from tree-vect-patterns.c
>> for stmt_is_root_of_bool_pattern.
>>
>> I assume that function stmt_is_root_of_bool_pattern can be simplified
>> to check on COND_EXPR only since PHI predication and memory access
>> predication produced only such statements,i.e. it can look like
>>
>> static bool
>> stmt_is_root_of_bool_pattern (gimple stmt, tree *var)
>> {
>>   enum tree_code code;
>>   tree lhs, rhs;
>>
>>   code = gimple_assign_rhs_code (stmt);
>>   if (code == COND_EXPR)
>> {
>>   rhs = gimple_assign_rhs1 (stmt);
>>   if (TREE_CODE (rhs) != SSA_NAME)
>> return false;
>>   *var = rhs;
>>   return true;
>> }
>>   return false;
>> }
>>
>> I also did few minor changes in patch.2.
>>
>> 3. You can also notice that I inserted code in tree_if_conversion to
>> do loop version if explicit option "-ftree-loop-if-convert" was not
>> passed to compiler, i.e. we perform if-conversion for loop
>> vectorization only and if it does not take place, we should delete
>> if-converted version of loop.
>> What is your opinion?
>
> Overall part 1 and part 2 look good to me, predicate_scalar_phi
> looks in need of some refactoring to avoid duplicate code.  We can
> do that a followup.
>
> Part 3 still needs the iteration to be 

[patch] Update libstdc++ C++11 status table

2014-12-22 Thread Jonathan Wakely

Committed to trunk.


commit f072f78db945365de5ac5f5c66a6ce936f02682a
Author: Jonathan Wakely 
Date:   Mon Dec 22 14:48:29 2014 +

	* doc/xml/manual/status_cxx2011.xml: Update.
	* doc/html/manual/status.html: Regenerate.

diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html
index 6291917..d953bde 100644
--- a/libstdc++-v3/doc/html/manual/status.html
+++ b/libstdc++-v3/doc/html/manual/status.html
@@ -166,7 +166,7 @@ particular release.
 	19
   
 	Diagnostics
-  19.1GeneralY??19.2Exception classesPartialMissing const char* constructors.19.3AssertionsY??19.4Error numbersY??19.5System error support19.5.1Class error_categoryY??19.5.2Class error_codeY??19.5.3Class error_conditionY??19.5.4Comparison operatorsY??19.5.5Class system_errorPartialMissing const char* constructors.
+  19.1GeneralY??19.2Exception classesY??19.3AssertionsY??19.4Error numbersY??19.5System error support19.5.1Class error_categoryY??19.5.2Class error_codeY??19.5.3Class error_conditionY??19.5.4Comparison operatorsY??19.5.5Class system_errorY??
 	20
   
 	General utilities
@@ -175,18 +175,18 @@ particular release.
 	  Uses code from
 	  http://www.boost.org/libs/smart_ptr/shared_ptr.htm"; target="_top">boost::shared_ptr.
 	
-  20.7.2.3Class template weak_ptrY??20.7.2.4Class template emable_shared_from_thisY??20.7.2.5shared_ptr atomic accessPartial??20.7.2.6Smart pointer hash supportY??20.8Function objects20.8.1Definitions20.8.2Requirements20.8.3Class template reference_wrapperY??20.8.4Arithmetic operationY??20.8.5ComparisonsY??20.8.6Logical operationsY??20.8.7Bitwise operationsY??20.8.8NegatorsY??20.8.9Function template bindY??20.8.10Function template mem_fnY??20.8.11Polymorphic function wrappers20.8.11.1Class bad_function_callY??20.8.11.2Class template functionPartialMissing allocator support20.8.12Class template hashY??20.9Metaprogramming and type traits20.9.1RequirementsY??20.9.2Header  synopsis20.9.3Helper classesY??20.9.4Unary Type TraitsY??20.9.4.1Primary type categoriesY??20.9.4.2Composite type traitsY??20.9.4.3Type propertiesY??20.9.5Type property queriesY??20.9.6Relationships between typesY??20.9.7Transformations between types20.9.7.1Const-volatile modificationsY??20.9.7.2Reference modificationsY??20.9.7.3Sign modificationsY??20.9.7.4Array modificationsY??20.9.7.5Pointer modificationsY??20.9.7.6Other transformationsY??20.10Compile-time rational arithmetic20.10.1In general20.10.2Header  synopsis20.10.3Class template ratioY??20.10.4Arithmetic on ratiosY??20.10.5Comparison of ratiosY??20.10.6SI types for ratioY??20.11Time utilities20.11.3Clock requirementsY??20.11.4Time-related traits20.11.4.1treat_as_floating_pointY??20.11.4.2duration_valuesY??20.11.4.3Specializations of common_typeY??20.11.5Class template durationPartialMissing constexpr for non-member arithmetic operations20.11.6Class template time_pointY??20.11.7Clocks20.11.7.1Class system_clockY??20.11.7.2Class steady_clockY??20.11.7.3Class high_resolution_clockY??20.11.8Date and time functionsY??20.12Scoped allocator adaptorY??20.12.1Header  synopsis20.12.2Scoped allocator adaptor member typesY??20.12.3Scoped allocator adaptor constructorsY??20.12.4Scoped allocator adaptor membersPartialOUTERMOST is not recursive.20.12.5Scoped allocator operatorsY??20.13Class type_indexY??
+  20.7.2.3Class template weak_ptrY??20.7.2.4Class template emable_shared_from_thisY??20.7.2.5shared_ptr atomic accessY??20.7.2.6Smart pointer hash supportY??20.8Function objects20.8.1Definitions20.8.2Requirements20.8.3Class template reference_wrapperY??20.8.4Arithmetic operationY??20.8.5ComparisonsY??20.8.6Logical operationsY??20.8.7Bitwise operationsY??20.8.8NegatorsY??20.8.9Function template bindY??20.8.10Function template mem_fnY??20.8.11Polymorphic function wrappers20.8.11.1Class bad_function_callY??20.8.11.2Class template functionPartialMissing allocator support20.8.12Class template hashY??20.9Metaprogramming and type traits20.9.1RequirementsY??20.9.2Header  synopsis20.9.3Helper classesY??20.9.4Unary Type TraitsY??20.9.4.1Primary type categoriesY??20.9.4.2Composite type traitsY??20.9.4.3Type propertiesY??20.9.5Type property queriesY??20.9.6Relationships between typesY??20.9.7Transformations between types20.9.7.1Const-volatile modificationsY??20.9.7.2Reference modificationsY??20.9.7.3Sign modificationsY??20.9.7.4Array modificationsY??20.9.7.5Pointer modificationsY??20.9.7.6Other transformationsY??20.10Compile-time rational arithmetic20.10.1In general20.10.2Header  synopsis20.10.3Class template ratioY??20.10.4Arithmetic on ratiosY??20.10.5Comparison of ratiosY??20.10.6SI types for ratioY??20.11Time utilities20.11.3Clock requirementsY??20.11.4Time-related traits20.11.4.1treat_as_floating_pointY??20.11.4.2duration_valuesY??20.11.4.3Specializations of common_typeY??2

Re: [PATCH 2/4] New data structure for cgraph_summary introduced.

2014-12-22 Thread Martin Liška

On 12/18/2014 08:40 PM, Jan Hubicka wrote:

2014-12-08  Martin Liska  

* cgraph.h (symbol_table::allocate_cgraph_symbol): Summary UID
is filled up.
* symbol-summary.h: New file.
* gengtype.c (open_base_files): Add symbol-summary.h.
* toplev.c (general_init): Call constructor of symbol_table.
---
  gcc/cgraph.h |   8 ++
  gcc/gengtype.c   |   4 +-
  gcc/symbol-summary.h | 281 +++
  gcc/toplev.c |   3 +-
  4 files changed, 293 insertions(+), 3 deletions(-)
  create mode 100644 gcc/symbol-summary.h

diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index a5c5f56..1664bd7 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1237,6 +1237,8 @@ public:
int count_materialization_scale;
/* Unique id of the node.  */
int uid;
+  /* Summary unique id of the node.  */
+  int summary_uid;


Hmm, can't we just use uid here?  I guess the only difference is that summary
uid is not kept dense, unlike the uid.
This should not propagate into much of trouble simply because the summary 
datastructure
should safely remove the summaires via removal hook.


Hello.

There's patch I've been just testing. It removes summary_uid and uid is going 
to be
really unique. I tested the change on Inkscape WPA, and there's time difference 
in level
of < 1%.

Ready for trunk after proper testing?
Thanks,
Martin


+
+/* We want to pass just pointer types as argument for function_summary
+   template class.  */
+
+template 
+class function_summary
+{
+private:
+  function_summary();
+};
+
+template 
+class GTY((user)) function_summary 


Eventually I would like this to allow attaching summaries to variables (and 
symbols in general),
too. But currently we do not have use for it, so we can care about this later.

The patch is OK.  Preferrably with summary_uid replaced by uid if it is easily 
doable.

Honza



>From 852166518eedaa75562ad8e8324a8dfd25e2b7ff Mon Sep 17 00:00:00 2001
From: mliska 
Date: Fri, 19 Dec 2014 15:10:27 +0100
Subject: [PATCH] Call graph: summary_uid is removed.

gcc/ChangeLog:

2014-12-22  Martin Liska  

	* cgraph.h (symbol_table::allocate_cgraph_symbol):
	Replace cgraph_max_summary_uid with cgraph_max_uid.
	* passes.c (struct cgraph_order_traits): New structure.
	(remove_cgraph_node_from_order): Replace int* with hash_map.
	(do_per_function_toporder): Likewise.
	* symbol-summary.h: Change cgraph_node::symbol_uid with uid that
	is going to be really unique and not recycled.

gcc/lto/ChangeLog:

2014-12-22  Martin Liska  

	* lto-partition.c (lto_balanced_map): Replace array with
	vec data structure.
---
 gcc/cgraph.h| 10 ++
 gcc/lto/lto-partition.c | 11 ++-
 gcc/passes.c| 44 +++-
 gcc/symbol-summary.h| 18 +-
 4 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 0cff779..10f60ad 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1255,8 +1255,6 @@ public:
   int count_materialization_scale;
   /* Unique id of the node.  */
   int uid;
-  /* Summary unique id of the node.  */
-  int summary_uid;
   /* ID assigned by the profiling.  */
   unsigned int profile_id;
   /* Time profiler: first run of function.  */
@@ -1839,7 +1837,7 @@ public:
   friend class cgraph_node;
   friend class cgraph_edge;
 
-  symbol_table (): cgraph_max_summary_uid (1)
+  symbol_table (): cgraph_max_uid (1)
   {
   }
 
@@ -2039,7 +2037,6 @@ public:
 
   int cgraph_count;
   int cgraph_max_uid;
-  int cgraph_max_summary_uid;
 
   int edges_count;
   int edges_max_uid;
@@ -2363,12 +2360,9 @@ symbol_table::allocate_cgraph_symbol (void)
   free_nodes = NEXT_FREE_NODE (node);
 }
   else
-{
   node = ggc_cleared_alloc ();
-  node->uid = cgraph_max_uid++;
-}
 
-  node->summary_uid = cgraph_max_summary_uid++;
+  node->uid = cgraph_max_uid++;
   return node;
 }
 
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 160b910..6c61102 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -449,7 +449,8 @@ lto_balanced_map (int n_lto_partitions)
 {
   int n_nodes = 0;
   int n_varpool_nodes = 0, varpool_pos = 0, best_varpool_pos = 0;
-  struct cgraph_node **order = XNEWVEC (cgraph_node *, symtab->cgraph_max_uid);
+
+  auto_vec order;
   auto_vec noreorder;
   auto_vec varpool_order;
   int i;
@@ -475,17 +476,19 @@ lto_balanced_map (int n_lto_partitions)
 	if (node->no_reorder)
 	  noreorder.safe_push (node);
 	else
-	  order[n_nodes++] = node;
+	  order.safe_push (node);
 	if (!node->alias)
 	  total_size += inline_summaries->get (node)->size;
   }
 
+  n_nodes = order.length ();
+
   /* Streaming works best when the source units do not cross partition
  boundaries much.  This is because importing function from a source
  unit tends to import a lot of global trees defined there.  We should
  get better about minimizing the function bounday, but u

Re: [WWW] Update index.html and gcc-5/changes.html to AVX-512* changes.

2014-12-22 Thread Gerald Pfeifer
On Friday 2014-12-12 14:47, Kirill Yukhin wrote:
> This change mantions AVX-512* new instructions support in GCC: news 
> section of index.html and gcc-5/changes.html.

Thanks Kirill, this looks fine with just one change:  We have
guidance not to link to vendors of proprietary software, so at
least in the version for the main page, can you omit that link,
please?

Gerald

PS: I've been truely offline for two weeks and am catching up
still.  I'm trying to get patches reviewed as quickly as possible;
if there is anything I am missing, any of you just drop me a note.


Re: [PATCH c++/objc++] Make Objective-c++ recognise lambdas.

2014-12-22 Thread Jason Merrill

OK.


Re: Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively)

2014-12-22 Thread Thomas Schwinge
Hi!

I'm sending this again with some more people copied -- because I see
you're working on tree.h/tree-core.h flattening, or know you're familiar
with GCC plugins.  ;-) Here is a question concerning both of that, where
I'd appreciate your input.

(That said, I don't find a "GCC plugins" person listed in the MAINTAINERS
file, would that be worth adding?)

Full quote follows:

On Fri, 19 Dec 2014 18:54:04 +0100, I wrote:
> On Thu, 18 Dec 2014 19:33:07 +0100, Jakub Jelinek  wrote:
> > On Thu, Dec 18, 2014 at 07:25:03PM +0100, Thomas Schwinge wrote:
> > > On Wed, 17 Dec 2014 23:26:53 +0100, I wrote:
> > > > Committed to gomp-4_0-branch in r218840:
> > > > 
> > > > commit febcd8dfdb10fa80edff0880973d1915ca2fef74
> > > > Author: tschwinge 
> > > > Date:   Wed Dec 17 22:26:24 2014 +
> > > > 
> > > > Use include/gomp-constants.h more actively.
> > > 
> > > > diff --git gcc/tree-core.h gcc/tree-core.h
> > > > index 743bc0d..fc61b88 100644
> > > > --- gcc/tree-core.h
> > > > +++ gcc/tree-core.h
> > > > @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
> > > >  #include "alias.h"
> > > >  #include "flags.h"
> > > >  #include "symtab.h"
> > > > +#include "gomp-constants.h"
> > > >  
> > > >  /* This file contains all the data structures that define the 'tree' 
> > > > type.
> > > > There are no accessor macros nor functions in this file. Only the
> > > 
> > > Is it actually "OK" to #include "gomp-constants.h" (living in
> > > [GCC]/include/) from gcc/tree-core.h?  Isn't the tree-core.h file getting
> > > installed, for later use by plugins -- which then need to be able to find
> > > gomp-constants, too, but that is not being installed?
> > 
> > Generally, it must be possible to include include/ headers from gcc/
> > headers, even when they are used by plugins.  Otherwise system.h including
> > libiberty.h and safe-ctype.h etc. wouldn't work.  Perhaps you need to add
> > gomp-constants.h to some Makefile variable or something, look at how is
> > safe-ctype.h etc. handled.
> 
> Aha, that's how it is done, I guess, in gcc/Makefile.in:
> 
> [...]
> SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
> $(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
> [...]
> PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h [...]
> [...]
> # Install the headers needed to build a plugin.
> install-plugin: installdirs lang.install-plugin s-header-vars 
> install-gengtype
> # We keep the directory structure for files in config or c-family and .def
> # files. All other files are flattened to a single directory.
> $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
> headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
> [...]
> [...]
> 
> > That said, including gomp-constants.h from tree-core.h is I think very much
> > against all the Andrew's efforts to flatten headers (which is something I'm
> > not very happy with generally, but in this case, I think only the very few
> > files that really need the constants should include it).
> 
> Like this (not yet applied)?

[Jakub: »I think it is fine.«]

> Talking about external code (GCC plugins), do we have to take any
> measures about the removed enum omp_clause_map_kind?  (Would a mere
> »#define omp_clause_map_kind gomp_map_kind« work?  That'd also mean that
> we do have to add include/gomp-constants.h to PLUGIN_HEADERS, and get it
> included automatically, I think?)
> 
> commit b1255597c6b069719960e53e385399c479c4be8b
> Author: Thomas Schwinge 
> Date:   Fri Dec 19 18:32:25 2014 +0100
> 
> Replace enum omp_clause_map_kind with enum gomp_map_kind.
> 
>   gcc/
>   * tree-core.h: Instead of defining enum omp_clause_map_kind, use
>   include/gomp-constants.h's enum gomp_map_kind.  Update all users.
>   include/
>   * gomp-constants.h: Populate enum gomp_map_kind.
> ---
>  gcc/c/c-parser.c   | 38 ++---
>  gcc/c/c-typeck.c   |  9 +++
>  gcc/cp/parser.c| 38 ++---
>  gcc/cp/semantics.c |  9 +++
>  gcc/fortran/trans-openmp.c | 47 ++--
>  gcc/gimplify.c | 18 +++---
>  gcc/omp-low.c  | 60 
> ++
>  gcc/tree-core.h| 43 +++--
>  gcc/tree-nested.c  |  8 +++
>  gcc/tree-pretty-print.c| 31 
>  gcc/tree-streamer-in.c |  2 +-
>  gcc/tree-streamer-out.c|  2 +-
>  gcc/tree.h |  4 ++--
>  include/gomp-constants.h   | 50 +++---
>  14 files changed, 173 insertions(+), 186 deletions(-)

Here is (this is on top of gomp-4_0-branch, by the way) the patch:
reordererd, and snipped to relevant parts.

The new "provider":

> --- include/gomp-constants.h
> +++ include/gomp-constants.h
> @@ -32,7 +32,7 @@

Re: [C++ Patch] PR 60955

2014-12-22 Thread Jason Merrill

On 12/18/2014 12:55 PM, Paolo Carlini wrote:

Thanks. I'm attaching what I just committed. This is a regression, I
suppose the patch is ok for 4_9-branch too, right?


Yes.

Jason




Re: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.

2014-12-22 Thread Jan Hubicka
> Hello.
> 
> Following IPA ICF patch restricts thunk creation for static-chain thunks.
> Patch can bootstrap on x86_64-linux-pc and no new regression has been seen.
> 
> Ready for thunk?
> Thanks,
> Martin

> >From b247009735cd294b3fd8b727905cb47b5cdaeb51 Mon Sep 17 00:00:00 2001
> From: mliska 
> Date: Mon, 22 Dec 2014 10:46:41 +0100
> Subject: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.
> 
> gcc/ChangeLog:
> 
> 2014-12-22  Martin Liska  
> 
>   PR ipa/63851
>   PR ipa/63852
>   * ipa-icf.c (sem_function::merge): Ignore merge operation
>   for a thunk created from static chain.

OK.
Please add also the code to match TARGET_OPTION and OPTIMIZATION nodes
Honza
> ---
>  gcc/ipa-icf.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> index 6cdc21b..b8ef6e0 100644
> --- a/gcc/ipa-icf.c
> +++ b/gcc/ipa-icf.c
> @@ -694,6 +694,14 @@ sem_function::merge (sem_item *alias_item)
> return 0;
>   }
>  
> +  if (DECL_STATIC_CHAIN (alias->decl))
> +{
> + if (dump_file)
> +   fprintf (dump_file, "Thunk creation is risky for static-chain 
> functions.\n\n");
> +
> + return 0;
> +}
> +
>alias->icf_merged = true;
>ipa_merge_profiles (local_original, alias);
>alias->create_wrapper (local_original);
> -- 
> 2.1.2
> 



Re: [WWW] Update index.html and gcc-5/changes.html to AVX-512* changes.

2014-12-22 Thread H.J. Lu
On Mon, Dec 22, 2014 at 6:51 AM, Gerald Pfeifer  wrote:
> On Friday 2014-12-12 14:47, Kirill Yukhin wrote:
>> This change mantions AVX-512* new instructions support in GCC: news
>> section of index.html and gcc-5/changes.html.
>
> Thanks Kirill, this looks fine with just one change:  We have
> guidance not to link to vendors of proprietary software, so at
> least in the version for the main page, can you omit that link,
> please?
>
> Gerald
>
> PS: I've been truely offline for two weeks and am catching up
> still.  I'm trying to get patches reviewed as quickly as possible;
> if there is anything I am missing, any of you just drop me a note.

Hi Gerald,

When you have time, can you review

https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01441.html
https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01580.html

Thanks.

-- 
H.J.


[Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND

2014-12-22 Thread Janus Weil
Hi all,

here is a small patch which enhances the diagnostics for the intrinsic
KIND function. Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2014-12-22  Janus Weil  

PR fortran/63363
* check.c (gfc_check_kind): Reject polymorphic and non-data arguments.

2014-12-22  Janus Weil  

PR fortran/63363
* gfortran.dg/kind_1.f90: New.
Index: gcc/fortran/check.c
===
--- gcc/fortran/check.c (Revision 219014)
+++ gcc/fortran/check.c (Arbeitskopie)
@@ -2531,13 +2531,20 @@ gfc_check_kill_sub (gfc_expr *pid, gfc_expr *sig,
 bool
 gfc_check_kind (gfc_expr *x)
 {
-  if (x->ts.type == BT_DERIVED)
+  if (x->ts.type == BT_DERIVED || x->ts.type == BT_CLASS)
 {
-  gfc_error ("%qs argument of %qs intrinsic at %L must be a "
-"non-derived type", gfc_current_intrinsic_arg[0]->name,
+  gfc_error ("%qs argument of %qs intrinsic at %L must be of "
+"intrinsic type", gfc_current_intrinsic_arg[0]->name,
 gfc_current_intrinsic, &x->where);
   return false;
 }
+  if (x->ts.type == BT_PROCEDURE)
+{
+  gfc_error ("%qs argument of %qs intrinsic at %L must be a data entity",
+gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
+&x->where);
+  return false;
+}
 
   return true;
 }
! { dg-do compile }
!
! PR 63363: No diagnostic for passing function as actual argument to KIND
!
! Contributed by Ian Harvey 

  type :: t
  end type
  type(t) :: d
  class(*), allocatable :: c

  print *, KIND(d)! { dg-error "must be of intrinsic type" }
  print *, KIND(c)! { dg-error "must be of intrinsic type" }

  print *, KIND(f)! { dg-error "must be a data entity" }
  print *, KIND(f())
  print *, KIND(s)! { dg-error "must be a data entity" }
contains
  FUNCTION f()
INTEGER(SELECTED_INT_KIND(4)) :: f
  END FUNCTION
  subroutine s
  end subroutine
END


Re: [libstdc++ PATCH] C++14 constexpr min/max/minmax/min_element/max_element/minmax_element, also constexpr for 20.9.5-20.9.9, aka various library functors

2014-12-22 Thread Jonathan Wakely

On 18/12/14 02:40 +0200, Ville Voutilainen wrote:

Currently finishing testing on Linux-x64. The only implementation change
in this patch is the initialization of the iterator variables in
__minmax_element,
otherwise it's just adding constexpr.


Thanks, committed to trunk.


commit b31a5c2c4b43d828e6c661915db29624ef96
Author: Jonathan Wakely 
Date:   Thu Dec 18 21:40:57 2014 +

2014-12-22  Ville Voutilainen  

	PR libstdc++/60271
	C++14 constexpr min, max, minmax, min_element, max_element
	and minmax_element. Also constexpr for 20.9.5-20.9.9,
	aka various library functors.
	* include/bits/c++config: Add _GLIBCXX14_CONSTEXPR.
	* include/bits/algorithmfwd.h (min, max, minmax, min_element,
	max_element): Use it.
	* include/bits/predefined_ops.h (_Iter_less_iter, __iter_less_iter,
	_Iter_comp_iter, __iter_comp_iter): Likewise.
	* include/bits/stl_algo.h (minmax, __minmax_element, minmax_element,
	min, max, __min_element, min_element, __max_element, max_element)
	Likewise.
	* include/bits/stl_algobase.h (min, max): Likewise.
	* include/bits/stl_function.h (plus, minus, multiplies, divides,
	modulus, negate, equal_to, not_equal_to, greater, less, greater_equal,
	less_equal, logical_and, logical_or, logical_not, bit_and, bit_or,
	bit_xor, bit_not, unary_negate, not1, binary_negate, not2): Likewise.
	* testsuite/20_util/function_objects/constexpr.cc: New.
	* testsuite/25_algorithms/max/constexpr.cc: Likewise.
	* testsuite/25_algorithms/max_element/constexpr.cc: Likewise.
	* testsuite/25_algorithms/min/constexpr.cc: Likewise.
	* testsuite/25_algorithms/min_element/constexpr.cc: Likewise.
	* testsuite/25_algorithms/minmax/constexpr.cc: Likewise.
	* testsuite/25_algorithms/minmax_element/constexpr.cc: Likewise.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error.

diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index aee1eec..b45828e 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -352,10 +352,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 make_heap(_RAIter, _RAIter, _Compare);
 
   template 
+_GLIBCXX14_CONSTEXPR
 const _Tp& 
 max(const _Tp&, const _Tp&);
 
   template
+_GLIBCXX14_CONSTEXPR
 const _Tp& 
 max(const _Tp&, const _Tp&, _Compare);
 
@@ -363,10 +365,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // merge
 
   template 
+_GLIBCXX14_CONSTEXPR
 const _Tp& 
 min(const _Tp&, const _Tp&);
 
   template
+_GLIBCXX14_CONSTEXPR
 const _Tp& 
 min(const _Tp&, const _Tp&, _Compare);
 
@@ -374,42 +378,52 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus >= 201103L
   template
+_GLIBCXX14_CONSTEXPR
 pair 
 minmax(const _Tp&, const _Tp&);
 
   template
+_GLIBCXX14_CONSTEXPR
 pair
 minmax(const _Tp&, const _Tp&, _Compare);
 
   template
+_GLIBCXX14_CONSTEXPR
 pair<_FIter, _FIter>
 minmax_element(_FIter, _FIter);
 
   template
+_GLIBCXX14_CONSTEXPR
 pair<_FIter, _FIter>
 minmax_element(_FIter, _FIter, _Compare);
 
   template
+_GLIBCXX14_CONSTEXPR
 _Tp
 min(initializer_list<_Tp>);
 
   template
+_GLIBCXX14_CONSTEXPR
 _Tp
 min(initializer_list<_Tp>, _Compare);
 
   template
+_GLIBCXX14_CONSTEXPR
 _Tp
 max(initializer_list<_Tp>);
 
   template
+_GLIBCXX14_CONSTEXPR
 _Tp
 max(initializer_list<_Tp>, _Compare);
 
   template
+_GLIBCXX14_CONSTEXPR
 pair<_Tp, _Tp>
 minmax(initializer_list<_Tp>);
 
   template
+_GLIBCXX14_CONSTEXPR
 pair<_Tp, _Tp>
 minmax(initializer_list<_Tp>, _Compare);
 #endif
@@ -655,10 +669,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
 
   template
+_GLIBCXX14_CONSTEXPR
 _FIter 
 max_element(_FIter, _FIter);
 
   template
+_GLIBCXX14_CONSTEXPR
 _FIter 
 max_element(_FIter, _FIter, _Compare);
 
@@ -672,10 +688,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
 
   template
+_GLIBCXX14_CONSTEXPR
 _FIter 
 min_element(_FIter, _FIter);
 
   template
+_GLIBCXX14_CONSTEXPR
 _FIter 
 min_element(_FIter, _FIter, _Compare);
 
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index ec7414d..356a526 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -103,6 +103,14 @@
 # endif
 #endif
 
+#ifndef _GLIBCXX14_CONSTEXPR
+# if __cplusplus >= 201402L
+#  define _GLIBCXX14_CONSTEXPR constexpr
+# else
+#  define _GLIBCXX14_CONSTEXPR
+# endif
+#endif
+
 // Macro for noexcept, to support in mixed 03/0x mode.
 #ifndef _GLIBCXX_NOEXCEPT
 # if __cplusplus >= 201103L
diff --git a/libstdc++-v3/include/bits/predefined_ops.h b/libstdc++-v3/include/bits/predefined_ops.h
index 78f5e37..e31d8c3 100644
--

[SH][committed] Add another div0s test case

2014-12-22 Thread Oleg Endo
Hi,

This adds another test case for the SH div0s insn utilization.
Tested with
make -k check-gcc RUNTESTFLAGS="sh.exp=pr52933* --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r219017.

Cheers,
Oleg

gcc/testsuite/ChangeLog:
PR target/52933
* gcc.target/sh/sh/pr52933-3.c: New.
Index: gcc/testsuite/gcc.target/sh/pr52933-3.c
===
--- gcc/testsuite/gcc.target/sh/pr52933-3.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr52933-3.c	(revision 0)
@@ -0,0 +1,28 @@
+/* Check that the div0s instruction is used for integer sign comparisons.  */
+/* { dg-do compile }  */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
+/* { dg-final { scan-assembler-times "div0s" 2 } } */
+
+typedef struct { unsigned int arg[100]; } *FunctionCallInfo;
+typedef struct { int day; int month; } Interval;
+void* palloc (unsigned int);
+int bar (void);
+void baz (void);
+
+void
+interval_pl (FunctionCallInfo fcinfo)
+{
+  Interval *span1 = ((Interval *) ((char *) ((fcinfo->arg[0];
+  Interval *span2 = ((Interval *) ((char *) ((fcinfo->arg[1];
+  Interval *result = (Interval *) palloc (sizeof (Interval));
+
+  /* Should emit 2x div0s.  */
+  if span1->month) < 0) == ((span2->month) < 0))
+  && !(((result->month) < 0) == ((span1->month) < 0)))
+do {
+  if (bar ())
+	baz ();
+} while(0);
+  result->day = span1->day + span2->day;
+}


Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing

2014-12-22 Thread Thomas Schwinge
Hi!

On Thu, 18 Dec 2014 11:21:20 +0100, Jakub Jelinek  wrote:
> On Wed, Dec 17, 2014 at 11:48:01PM +0100, Thomas Schwinge wrote:
> > I have another suggestion: on gomp-4_0-branch, we had already started
> > using a libgomp-test-support.exp file for a similar purpose.  I now
> > changed your code on gomp-4_0-branch in r218845 as follows (though, not
> > very much tested).  The advantage here is that people who are not using
> > GCC build-tree testing, but are directly invoking runtest, then don't
> > have to set various environment variables, but instead just have to copy
> > this one libgomp-test-support.exp file from the build tree to the testing
> > tree.  Does this make sense?
> > 
> > commit de01639bf47e29a20959771e587fb6f30c372a45
> > Author: tschwinge 
> > Date:   Wed Dec 17 22:45:05 2014 +
> > 
> > libgomp: Route offloading data through the libgomp-test-support.exp 
> > file.
> > 
> > libgomp/
> > * testsuite/Makefile.am: Don't export OFFLOAD_TARGETS,
> > OFFLOAD_ADDITIONAL_OPTIONS, and OFFLOAD_ADDITIONAL_LIB_PATHS...
> > * testsuite/libgomp-test-support.exp.in: ..., and instead set
> > offload_targets, offload_additional_options, and
> > offload_additional_lib_paths here.  Update all users.
> 
> LGTM.

As discussed in
,
that doesn't really work: there may be additional (recursive) expansions
required (similar to: libexecdir being defined in terms of exec_prefix,
that in terms of prefix, and so on), so we really need to handle that in
the Makefile, where all these variables are available.  Committed to
gomp-4_0-branch in r219016:

commit 6bb8cfa151e40ab1e991112d2bbe2719f0a2c46a
Author: tschwinge 
Date:   Mon Dec 22 16:17:15 2014 +

libgomp: Handle Makefile variable usage in 
testsuite/libgomp-test-support.exp.

libgomp/
* testsuite/libgomp-test-support.exp.in
(offload_additional_options, offload_additional_lib_paths): Don't
set.
* configure.ac: Instantiate testsuite/libgomp-test-support.pt.exp
instead of testsuite/libgomp-test-support.exp.
* testsuite/Makefile.am (libgomp-test-support.exp): New rule.
(all-local): Depend on it.
* configure: Regenerate.
* testsuite/Makefile.in: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219016 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp| 12 
 libgomp/configure |  4 +--
 libgomp/configure.ac  |  2 +-
 libgomp/testsuite/Makefile.am | 14 +
 libgomp/testsuite/Makefile.in | 41 ++-
 libgomp/testsuite/libgomp-test-support.exp.in |  2 --
 6 files changed, 56 insertions(+), 19 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index b7a0e7d..6653e58 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,3 +1,15 @@
+2014-12-22  Thomas Schwinge  
+
+   * testsuite/libgomp-test-support.exp.in
+   (offload_additional_options, offload_additional_lib_paths): Don't
+   set.
+   * configure.ac: Instantiate testsuite/libgomp-test-support.pt.exp
+   instead of testsuite/libgomp-test-support.exp.
+   * testsuite/Makefile.am (libgomp-test-support.exp): New rule.
+   (all-local): Depend on it.
+   * configure: Regenerate.
+   * testsuite/Makefile.in: Likewise.
+
 2014-12-17  Thomas Schwinge  
Tom de Vries  
 
diff --git libgomp/configure libgomp/configure
index f72378e..839b2c6 100755
--- libgomp/configure
+++ libgomp/configure
@@ -16553,7 +16553,7 @@ ac_config_files="$ac_config_files omp.h omp_lib.h 
omp_lib.f90 libgomp_f.h"
 
 ac_config_files="$ac_config_files Makefile testsuite/Makefile libgomp.spec"
 
-ac_config_files="$ac_config_files testsuite/libgomp-test-support.exp"
+ac_config_files="$ac_config_files 
testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -17699,7 +17699,7 @@ do
 "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
 "libgomp.spec") CONFIG_FILES="$CONFIG_FILES libgomp.spec" ;;
-"testsuite/libgomp-test-support.exp") CONFIG_FILES="$CONFIG_FILES 
testsuite/libgomp-test-support.exp" ;;
+"testsuite/libgomp-test-support.pt.exp") CONFIG_FILES="$CONFIG_FILES 
testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in" ;;
 
   *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
diff --git libgomp/configure.ac libgomp/configure.ac
index 178c34d..4687b01 100644
--- libgomp/configure.ac
+++ libgomp/configure.ac
@@ -352,5 +352,5 @@ CFLAGS="$save_CFLAGS"
 
 AC_CONFIG_FILES(omp.h om

[Ping] Re: [C++ Patch] PR 63985

2014-12-22 Thread Paolo Carlini

Hi,

On 12/04/2014 01:54 PM, Paolo Carlini wrote:

... oops, sent the wrong patch. See the below instead.

Paolo.
It occurs to me that a while ago I sent this patch: what do you think? 
Is the diagnostic good enough?


https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00376.html
https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00378.html

Thanks,
Paolo.


Re: [PATCH 7/10] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 23 Sep 2014 19:19:31 +0100, Julian Brown  
wrote:
> This patch contains the bulk of the OpenACC 2.0 runtime support,

> --- /dev/null
> +++ b/libgomp/plugin-nvptx.c
> @@ -0,0 +1,1854 @@
> +/* Plugin for NVPTX execution.

> +const char *
> +get_name (void)
> +{
> +  return "nvidia";
> +}

Committed to gomp-4_0-branch in r219018:

commit 56e092991a343484fe3d26b4506587d9bb99c1a9
Author: tschwinge 
Date:   Mon Dec 22 16:37:48 2014 +

libgomp: Fix nvptx plugin's GOMP_OFFLOAD_get_name.

This is a function in the "generic" interface, so it should return the
"generic" name instead of the OpenACC one.

libgomp/
* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_name): Return "nvptx".
* oacc-init.c (resolve_device): Update for that using...
(get_openacc_name): ... this new function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219018 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp|  4 
 libgomp/oacc-init.c   | 15 ++-
 libgomp/plugin/plugin-nvptx.c |  2 +-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 6653e58..a36ec1f 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,9 @@
 2014-12-22  Thomas Schwinge  
 
+   * plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_name): Return "nvptx".
+   * oacc-init.c (resolve_device): Update for that using...
+   (get_openacc_name): ... this new function.
+
* testsuite/libgomp-test-support.exp.in
(offload_additional_options, offload_additional_lib_paths): Don't
set.
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index 7298d9a..ff51856 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static gomp_mutex_t acc_device_lock;
 
@@ -84,6 +85,17 @@ goacc_register (struct gomp_device_descr const *disp)
   gomp_mutex_unlock (&acc_device_lock);
 }
 
+/* OpenACC names some things a little differently.  */
+
+static const char *
+get_openacc_name (const char *name)
+{
+  if (strcmp (name, "nvptx") == 0)
+return "nvidia";
+  else
+return name;
+}
+
 static struct gomp_device_descr const *
 resolve_device (acc_device_t d)
 {
@@ -98,7 +110,8 @@ resolve_device (acc_device_t d)
/* Lookup the named device.  */
while (++d != _ACC_device_hwm)
  if (dispatchers[d]
- && !strcasecmp (goacc_device_type, dispatchers[d]->name)
+ && !strcasecmp (goacc_device_type,
+ get_openacc_name (dispatchers[d]->name))
  && dispatchers[d]->get_num_devices_func () > 0)
goto found;
 
diff --git libgomp/plugin/plugin-nvptx.c libgomp/plugin/plugin-nvptx.c
index bc5739a..d423d3a 100644
--- libgomp/plugin/plugin-nvptx.c
+++ libgomp/plugin/plugin-nvptx.c
@@ -1499,7 +1499,7 @@ GOMP_OFFLOAD_get_caps (void)
 const char *
 GOMP_OFFLOAD_get_name (void)
 {
-  return "nvidia";
+  return "nvptx";
 }
 
 int


Grüße,
 Thomas


signature.asc
Description: PGP signature


Re: std::stoi and std::to_string on MinGW

2014-12-22 Thread Jonathan Wakely

On 22/12/14 16:02 +0100, Kai Tietz wrote:

2014-12-20 3:28 GMT+01:00 Jonathan Wakely :

People keep hitting the problem that std::stoi and std::to_string are
not defined when using MinGW, because of the fix for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37522

If the problem is only with vswprintf then couldn't we enable
everything except std::to_wstring?

That would solve the problem for most people, as std::to_string and
all the std::sto* functions would be defined, we'd only be missing
std::to_wstring which I never see anyone trying to use anyway.


So patch is ok.  AFAICS it affects just MinGW.org based build of libstdc++, as

_GLIBCXX_HAVE_BROKEN_VSWPRINTF is just defined in this case.  For
mingw targets using mingw-w64 based build this change has no affect
due it provides none-broken w-scanf/printf C99 API,


Yes, this only affects mingw.org not mingw-w64


Patch is ok.

Thanks,
Kai

PS: By mingw-w64 users the wide-character API is actually used.


Thanks, Kai. Here's the full patch, which enables std::stoi etc.
(everything except std::to_wstring) for MinGW.org

Tested powerpc64-linux, committed to trunk.

commit 2f555dc433089e1ae36f0ca6bd79424814bbc218
Author: Jonathan Wakely 
Date:   Mon Dec 22 16:28:28 2014 +

	PR libstdc++/37522
	* include/bits/basic_string.h (stod, stof, stoi, stol, stold, stoll,
	stoul, stoull, to_string): Only use _GLIBCXX_HAVE_BROKEN_VSWPRINTF
	to guard definition of to_wstring.
	* testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc:
	Do not use dg-require-string-conversions.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/
	stoull.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/
	to_string.cc: Likewise.

diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 7729384..6423c59 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -5240,8 +5240,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
- && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
+#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99)
 
 #include 
 
@@ -5392,6 +5391,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
   stold(const wstring& __str, size_t* __idx = 0)
   { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); }
 
+#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
   // DR 1261.
   inline wstring
   to_wstring(int __val)
@@ -5453,6 +5453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 return __gnu_cxx::__to_xstring(&std::vswprintf, __n,
 	L"%Lf", __val);
   }
+#endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF
 #endif
 
 _GLIBCXX_END_NAMESPACE_CXX11
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc
index b9de1cd..e7fea9e 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc
@@ -1,5 +1,4 @@
 // { dg-options "-std=gnu++11" }
-// { dg-require-string-conversions "" }
 
 // 2009-11-11  Paolo Carlini  
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc
index 5e3060c..fa9dedb 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc
@@ -1,5 +1,4 @@
 // { dg-options "-std=gnu++11" }
-// { dg-require-string-conversions "" }
 
 // 2008-06-15  Paolo Carlini  
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc
index 607f97b..16b9fc2 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc
@@ -1,5 +1,4 @@
 // { dg-options "-std=gnu++11" }
-// { dg-require-string-conversions "" }
 
 // 2008-06-15  Paolo Carlini  
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/num

Re: [gomp4] libgomp updates

2014-12-22 Thread Thomas Schwinge
Hi!

On Wed, 17 Dec 2014 23:31:56 +0100, I wrote:
> On Wed, 17 Dec 2014 23:24:17 +0100, I wrote:
> > Committed to gomp-4_0-branch in r218839:
> > 
> > commit 1c4f05a68c6d0d5b6137bb6d85a293d16727b389
> > Author: tschwinge 
> > Date:   Wed Dec 17 22:23:02 2014 +
> > 
> > libgomp updates.
> 
> This has broken libgomp/libgomp_target.h usage from liboffloadmic/plugin.
> Committed to gomp-4_0-branch in r218841:
> 
> commit db16ceabfcaaa6c9e41c01e289201e6a9fbe3b26
> Author: tschwinge 
> Date:   Wed Dec 17 22:30:30 2014 +
> 
> libgomp: Again make libgomp_target.h safe to use "from outside".
> 
>   libgomp/
>   * libgomp_g.h: Move internal stuff from here...
>   * libgomp_target.h: ..., and here...
>   * libgomp.h: ... into here.

> --- libgomp/libgomp.h
> +++ libgomp/libgomp.h

> +#define TARGET_CAP_SHARED_MEM1
> +#define TARGET_CAP_NATIVE_EXEC   2
> +#define TARGET_CAP_OPENMP_4004
> +#define TARGET_CAP_OPENACC_200   8

> --- libgomp/libgomp_target.h
> +++ libgomp/libgomp_target.h

> -#define TARGET_CAP_SHARED_MEM1
> -#define TARGET_CAP_NATIVE_EXEC   2
> -#define TARGET_CAP_OPENMP_4004
> -#define TARGET_CAP_OPENACC_200   8

Those are actually part of the libgomp/plugin interface; committed to
gomp-4_0-branch in r219020:

commit 5932be162d00a1a8c27ec612255c01a57327a942
Author: tschwinge 
Date:   Mon Dec 22 16:47:08 2014 +

libgomp: GOMP_OFFLOAD_* are part of the libgomp/plugin interface.

libgomp/
* libgomp.h (TARGET_CAP_SHARED_MEM, TARGET_CAP_NATIVE_EXEC)
(TARGET_CAP_OPENMP_400, TARGET_CAP_OPENACC_200): Remove, and
instead...
* libgomp_target.h (GOMP_OFFLOAD_CAP_SHARED_MEM)
(GOMP_OFFLOAD_CAP_NATIVE_EXEC, GOMP_OFFLOAD_CAP_OPENMP_400)
(GOMP_OFFLOAD_CAP_OPENACC_200): ... add these new definitions.
Change all users.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219020 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp|  8 
 libgomp/libgomp.h |  5 -
 libgomp/libgomp_target.h  |  6 ++
 libgomp/oacc-host.c   |  5 +++--
 libgomp/oacc-mem.c|  2 +-
 libgomp/oacc-parallel.c   |  8 
 libgomp/plugin/plugin-host.c  | 25 +
 libgomp/plugin/plugin-nvptx.c | 25 -
 libgomp/target.c  | 26 +++---
 9 files changed, 62 insertions(+), 48 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index a36ec1f..898040d 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,13 @@
 2014-12-22  Thomas Schwinge  
 
+   * libgomp.h (TARGET_CAP_SHARED_MEM, TARGET_CAP_NATIVE_EXEC)
+   (TARGET_CAP_OPENMP_400, TARGET_CAP_OPENACC_200): Remove, and
+   instead...
+   * libgomp_target.h (GOMP_OFFLOAD_CAP_SHARED_MEM)
+   (GOMP_OFFLOAD_CAP_NATIVE_EXEC, GOMP_OFFLOAD_CAP_OPENMP_400)
+   (GOMP_OFFLOAD_CAP_OPENACC_200): ... add these new definitions.
+   Change all users.
+
* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_name): Return "nvptx".
* oacc-init.c (resolve_device): Update for that using...
(get_openacc_name): ... this new function.
diff --git libgomp/libgomp.h libgomp/libgomp.h
index 78de0b4..866f6ca 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -662,11 +662,6 @@ struct target_mem_desc {
   splay_tree_key list[];
 };
 
-#define TARGET_CAP_SHARED_MEM  1
-#define TARGET_CAP_NATIVE_EXEC 2
-#define TARGET_CAP_OPENMP_400  4
-#define TARGET_CAP_OPENACC_200 8
-
 /* Information about mapped memory regions (per device/context).  */
 
 struct gomp_memory_mapping
diff --git libgomp/libgomp_target.h libgomp/libgomp_target.h
index b6723fe..63083f3 100644
--- libgomp/libgomp_target.h
+++ libgomp/libgomp_target.h
@@ -25,6 +25,12 @@
 #ifndef LIBGOMP_TARGET_H
 #define LIBGOMP_TARGET_H 1
 
+/* Capabilities of offloading devices.  */
+#define GOMP_OFFLOAD_CAP_SHARED_MEM(1 << 0)
+#define GOMP_OFFLOAD_CAP_NATIVE_EXEC   (1 << 1)
+#define GOMP_OFFLOAD_CAP_OPENMP_400(1 << 2)
+#define GOMP_OFFLOAD_CAP_OPENACC_200   (1 << 3)
+
 /* Type of offload target device.  Keep in sync with include/gomp-constants.h. 
 */
 enum offload_target_type
 {
diff --git libgomp/oacc-host.c libgomp/oacc-host.c
index f1ec426..3b90259 100644
--- libgomp/oacc-host.c
+++ libgomp/oacc-host.c
@@ -35,8 +35,9 @@ static struct gomp_device_descr host_dispatch =
 .name = "host",
 
 .type = OFFLOAD_TARGET_TYPE_HOST,
-.capabilities = TARGET_CAP_OPENACC_200 | TARGET_CAP_NATIVE_EXEC
-   | TARGET_CAP_SHARED_MEM,
+.capabilities = (GOMP_OFFLOAD_CAP_OPENACC_200
+| GOMP_OFFLOAD_CAP_NATIVE_EXEC
+| GOMP_OFFLOAD_CAP_SHARED_MEM),
 .id = 0,
 
 .is_initialized = false,
diff --git libgomp/oacc-mem.c libgomp/oacc-mem.c
index 7453020..8f7868e 100644
--- libgomp/oacc-mem.c
+++ libgomp/oacc-mem.c
@@ -259,7

Re: [Patch objcpp] Update gtfiles and add a testcase for c++ headers.

2014-12-22 Thread Mike Stump
On Dec 22, 2014, at 4:08 AM, Iain Sandoe  wrote:
> After the usual fun with tracking down a GTY(()) issue, it turned out to be 
> triggered by 216263 (changes in the gtfiles for cp that were not reflected in 
> objcp).  However, it appears that the list was a bit out of sync in general.
> 
> Probably almost an "obvious" patch, but I'd be interested in any ideas to 
> make this sync more automatic (it's an easy omission to make).

Yeah, it is obvious.  If you want to make it more automatic, objc/c++ need to 
share the gt lists from c/c++ and only define new things for files the are 
Objective related.

In C/C++, #include would be the solution.  In Makefiles, include doesn’t seem 
unreasonable.  In sh land, . exists.  I don’t know if it can be used here.  
Trivially, in 20/20 hindsight, the way we put gtfiles into a language frontend 
for a sublanguage isn’t right.  We need more derivation and more sharing.

> OK for trunk?

Ok.

I think cleanups to refactor code, while dangerous, I think gcc benefits from 
people that are willing to do the work.  For my areas, I’d accept them as 
obvious.

Re: [PATCH c++/objc++] Make Objective-c++ recognise lambdas.

2014-12-22 Thread Mike Stump
On Dec 22, 2014, at 4:50 AM, Iain Sandoe  wrote:
> When we find "[" and we're in objcp mode, and the "[" introduces a lambda, we 
> try to parse a message expression and if that fails we punt (thus we are 
> unable to recognise lambdas).

Even though Jason reviewed it, I also took a look.  Looks good.  This has to be 
the usual and customary fallout of language derivation.  One has to review the 
intersection and resolve any ambiguities.  Don’t think we get nice easy tools 
for this.  Thanks.

Re: [PATCH 1/1] gcc/ira-build.c: save a conflict obj compare in ira_flattening

2014-12-22 Thread Jeff Law

On 12/21/14 23:34, Zhouyi Zhou wrote:

In function ira_flattening, conflict relationship will be rebuilt in case
of any new pseudo register has been created during ira_emit.

By adding the current object to OBJECTS_LIVE after traversing OBJECTS_LIVE, a 
conflict
obj compare can be saved.


Bootstraped and regtested in x86_64 Linux
Signed-off-by: Zhouyi Zhou 
---
  gcc/ChangeLog   |5 +
  gcc/ira-build.c |2 +-
  2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e5d16f9..c0ce758 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-22  Zhouyi Zhou 
+
+   * ira-build.c (ira_flattening): Add the current
+   object to OBJECTS_LIVE after traversing OBJECTS_LIVE.

This is OK.  Please install on the trunk.

Thanks,
Jeff



Re: [gomp4] Merge trunk r217500 (2014-11-13) into gomp-4_0-branch

2014-12-22 Thread Thomas Schwinge
Hi!

On Fri, 12 Dec 2014 16:59:21 +0100, I wrote:
> In r218677, I have committed a merge from trunk r217500 (2014-11-13) into
> gomp-4_0-branch.
> 
> This spans the "offloading" commits in trunk (plus two interleaved
> non-"offloading" commits).

This failed to update the (new) intelmic plugin in liboffloadmic;
committed to gomp-4_0-branch in r219021:

commit 1838e83800f9e1cf12b09e27e4cd7beec54fe4bf
Author: tschwinge 
Date:   Mon Dec 22 16:55:18 2014 +

liboffloadmic: Add missing GOMP_OFFLOAD_* functions to the intelmic plugin.

liboffloadmic/
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name)
(GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219021 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 liboffloadmic/ChangeLog.gomp |  4 
 liboffloadmic/plugin/libgomp-plugin-intelmic.cpp | 24 
 2 files changed, 28 insertions(+)

diff --git liboffloadmic/ChangeLog.gomp liboffloadmic/ChangeLog.gomp
new file mode 100644
index 000..1c88817
--- /dev/null
+++ liboffloadmic/ChangeLog.gomp
@@ -0,0 +1,4 @@
+2014-12-22  Thomas Schwinge  
+
+   * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name)
+   (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions.
diff --git liboffloadmic/plugin/libgomp-plugin-intelmic.cpp 
liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
index 0428b79..b5aff92 100644
--- liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
+++ liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
@@ -135,6 +135,22 @@ set_mic_lib_path (void)
 }
 }
 
+extern "C" const char *
+GOMP_OFFLOAD_get_name (void)
+{
+  const char *res = "intelmic";
+  TRACE ("(): return %s", res);
+  return res;
+}
+
+extern "C" unsigned int
+GOMP_OFFLOAD_get_caps (void)
+{
+  unsigned int res = GOMP_OFFLOAD_CAP_OPENMP_400;
+  TRACE ("(): return %x", res);
+  return res;
+}
+
 extern "C" enum offload_target_type
 GOMP_OFFLOAD_get_type (void)
 {
@@ -190,6 +206,14 @@ GOMP_OFFLOAD_init_device (int device)
   NULL, NULL);
 }
 
+extern "C" void
+GOMP_OFFLOAD_fini_device (int device)
+{
+  TRACE ("");
+  /* Unreachable for GOMP_OFFLOAD_CAP_OPENMP_400.  */
+  abort ();
+}
+
 static void
 get_target_table (int device, int &num_funcs, int &num_vars, void **&table)
 {


Grüße,
 Thomas


pgpd4LnCecZdZ.pgp
Description: PGP signature


Re: [PATCH] Set stores_off_frame_dead_at_return to false if sibling call

2014-12-22 Thread Jeff Law

On 12/09/14 14:09, John David Anglin wrote:

On 12/9/2014 3:00 PM, Jeff Law wrote:

Thoughts on using both patches to ensure the we don't have extraneous
entries in the GEN set and that we're adding more stuff to the KILL
set for sibcalls?

Maybe we should add all stores to the KILL set
for a sibling call and not worry about whether
they are frame related or not.
For a sibling call, that may not be a terrible idea.  We're not really 
able to track the frame/arg pointer stuff well in that case and once 
those are off the table, there's not much benefit in tracking stuff for 
sibcalls.


Jeff


Re: [PATCH] Treat a sibling call as though it does a wild read

2014-12-22 Thread Jeff Law

On 12/19/14 16:45, John David Anglin wrote:

I believe that this version addresses the above issues.  While there
may be some opportunity to
optimize the handling of sibling call arguments, I think it is more
important to get the overall logic
correct.  Also, it's obviously a rare situation for the arguments to
be pushed to the stack.

Tested on hppa-unknown-linux-gnu and hppa64-hp-hpux11.11.

Okay?



Sorry, forgot to append testcase and ChangeLog entry for it.
No worries, I was sick last week and didn't do any patch review as a 
result.





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



dse.c.d.4.txt


2014-12-16  John David Anglin

PR target/55023
* dse.c (scan_insn): Treat sibling call as though it does a wild read.

* gcc.dg/pr55023.c: New file.

OK.

jeff



Re: [patch, testsuite] Fix ubsan for testing when libstdc++ isn't installed

2014-12-22 Thread Mike Stump
On Dec 20, 2014, at 8:58 AM, FX  wrote:
> This patch below allows ubsan to run when libstdc++ is built but not 
> installed (something which happens on darwin, in particular). This fixes all 
> 658 ubsan failures when run in this particular configuration.
> 
> OK to commit?

Ok.

Re: [gomp4] [1/3] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin

2014-12-22 Thread Thomas Schwinge
Hi!

We had committed to gomp-4_0-branch code to handle TO_PSET memory mapping
(used with Fortran allocatable arrays).  It turns out that is not
actually useful; committed to gomp-4_0-branch in r219022:

commit b2c3a33803b074052c5178fb1b6cabbd834cfa72
Author: tschwinge 
Date:   Mon Dec 22 17:12:40 2014 +

libgomp: Remove the GOMP_MAP_TO_PSET handling code that we once added.

libgomp/
* target.c (gomp_map_vars) : Revert earlier
changes.

With Intel MIC offloading (emulation), this fixes:

FAIL: libgomp.fortran/examples-4/e.55.2.f90   -O0  execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90   -O1  execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90   -O2  execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90   -O3 -fomit-frame-pointer  
execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90   -O3 -fomit-frame-pointer 
-funroll-loops  execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90   -O3 -g  execution test
FAIL: libgomp.fortran/examples-4/e.55.2.f90   -Os  execution test
FAIL: libgomp.fortran/target3.f90   -O0  execution test
FAIL: libgomp.fortran/target3.f90   -O1  execution test
FAIL: libgomp.fortran/target3.f90   -O2  execution test
FAIL: libgomp.fortran/target3.f90   -O3 -fomit-frame-pointer  execution 
test
FAIL: libgomp.fortran/target3.f90   -O3 -fomit-frame-pointer 
-funroll-loops  execution test
FAIL: libgomp.fortran/target3.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  execution test
FAIL: libgomp.fortran/target3.f90   -O3 -g  execution test
FAIL: libgomp.fortran/target3.f90   -Os  execution test

... for which Valgrind had reported:

==21161== Conditional jump or move depends on uninitialised value(s)
==21161==at 0x547233D: gomp_map_vars (target.c:267)
==21161==by 0x54743C3: GOMP_target_data (target.c:934)
==21161==by 0x400E6F: vec_mult_ (e.55.2.f90:38)
==21161==by 0x4011C9: MAIN__ (e.55.2.f90:55)
==21161==by 0x401200: main (e.55.2.f90:56)
*** Error in `/tmp/offload_aCxI50/offload_target_main': corrupted 
double-linked list: 0x00c8b9e0 ***

The OpenACC PSET test cases still work.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219022 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp |   3 +
 libgomp/target.c   | 214 -
 2 files changed, 72 insertions(+), 145 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 898040d..26fdfe6 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@
 2014-12-22  Thomas Schwinge  
 
+   * target.c (gomp_map_vars) : Revert earlier
+   changes.
+
* libgomp.h (TARGET_CAP_SHARED_MEM, TARGET_CAP_NATIVE_EXEC)
(TARGET_CAP_OPENMP_400, TARGET_CAP_OPENACC_200): Remove, and
instead...
diff --git libgomp/target.c libgomp/target.c
index dadcc03..423bbee 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -154,27 +154,6 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t 
mapnum,
   tgt->device_descr = devicep;
   tgt->mem_map = mm;
 
-  /* From gcc/fortran/trans-types.c  */
-  struct descriptor_dimension
-{
-  long stride;
-  long lbound;
-  long ubound;
-};
-
-   struct gfc_array_descriptor
- {
-   void *data;
-   long offset;
-   long dtype;
-   struct descriptor_dimension dimension[];
- };
-
-#define GFC_DTYPE_RANK_MASK 0x07
-#define GFC_DTYPE_TYPE_MASK 0x38
-#define GFC_DTYPE_TYPE_SHIFT3
-#define GFC_DTYPE_SIZE_SHIFT6
-
   if (mapnum == 0)
 return tgt;
 
@@ -210,45 +189,6 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t 
mapnum,
{
  tgt->list[i] = NULL;
 
- if ((kind & typemask) == GOMP_MAP_TO_PSET)
-   {
- struct gfc_array_descriptor *gad;
- size_t rank;
- int j;
-  bool alloc_arrays = true;
-
- for (j = i - 1; j >= 0; j--)
-   {
- if (hostaddrs[j] == *(void**)hostaddrs[i])
-   {
- alloc_arrays = false;
- break;
-   }
-   }
-
- gad = (struct gfc_array_descriptor *) cur_node.host_start;
- rank = gad->dtype & GFC_DTYPE_RANK_MASK;
-
- cur_node.host_start = (uintptr_t)gad->data;
- cur_node.host_end = cur_node.host_start +
-   sizeof (struct gfc_array_descriptor) +
-   (sizeof (struct descriptor_dimension) * rank);
-
- if (alloc_arrays)
-{
-   

Re: [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND

2014-12-22 Thread Steve Kargl
On Mon, Dec 22, 2014 at 04:48:02PM +0100, Janus Weil wrote:
> 
> here is a small patch which enhances the diagnostics for the intrinsic
> KIND function. Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
> 
> Cheers,
> Janus
> 
> 
> 2014-12-22  Janus Weil  
> 
> PR fortran/63363
> * check.c (gfc_check_kind): Reject polymorphic and non-data arguments.
> 
> 2014-12-22  Janus Weil  
> 
> PR fortran/63363
> * gfortran.dg/kind_1.f90: New.


OK.

-- 
Steve


Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 11 Nov 2014 13:53:23 +, Julian Brown  
wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown  wrote:
> 
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, rebased
> on top of a version of Ilya Verbin's patches that I merged to a local
> clone of trunk, and tested as far as possible without the
> middle/front-end pieces, since those are not ready yet.

> --- a/libgomp/target.c
> +++ b/libgomp/target.c

Code is split off of gomp_init_device into the new gomp_init_tables:

>  gomp_init_device (struct gomp_device_descr *devicep)
>  {
> +  /* Initialize the target device.  */
>devicep->init_device_func (devicep->target_id);
> +  
> +  devicep->is_initialized = true;
> +}
>  
> +attribute_hidden void
> +gomp_init_tables (const struct gomp_device_descr *devicep,
> +   struct gomp_memory_mapping *mm)
> +{
>/* Get address mapping table for device.  */
>struct mapping_table *table = NULL;
> [...]

..., and a new function gomp_init_dev_tables added to call both of them:

> +static void
> +gomp_init_dev_tables (struct gomp_device_descr *devicep)
> +{
> +  gomp_init_device (devicep);
> +  gomp_init_tables (devicep, &devicep->mem_map);
> +}

..., which is then used in GOMP_target:

> @@ -673,7 +753,12 @@ GOMP_target (int device, void (*fn) (void *), const void 
> *openmp_target,

> +  if (devicep != NULL && !devicep->is_initialized)
> +gomp_init_dev_tables (devicep);

..., and GOMP_target_data:

> @@ -724,7 +818,12 @@ GOMP_target_data (int device, const void *openmp_target, 
> size_t mapnum,

> +  if (devicep != NULL && !devicep->is_initialized)
> +gomp_init_dev_tables (devicep);

..., but not in GOMP_target_update:

> @@ -771,15 +871,18 @@ GOMP_target_update (int device, const void 
> *openmp_target, size_t mapnum,

> +  if (devicep != NULL && !devicep->is_initialized)
>  gomp_init_device (devicep);

Committed to gomp-4_0-branch in r219023:

commit 0020b7972a6f7f422bd9d4782021ff5b8e2b0f50
Author: tschwinge 
Date:   Mon Dec 22 17:40:37 2014 +

libgomp: Restore code that initializes the address mapping tables in 
GOMP_target_update.

libgomp/
* target.c (GOMP_target_update): To initialize, call
gomp_init_dev_tables instead of gomp_init_device.

With Intel MIC offloading (emulation), this fixes cases of "#pragma omp 
declare
target" of variables, followed by "#pragma omp target update to([...])" 
before
any "#pragma omp target" or "#pragma omp target data" is called:

FAIL: libgomp.c/examples-4/e.53.3.c execution test
FAIL: libgomp.c/examples-4/e.53.4.c execution test
FAIL: libgomp.c/examples-4/e.53.5.c execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O0  execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O1  execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O2  execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer  
execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer 
-funroll-loops  execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -g  execution test
FAIL: libgomp.fortran/examples-4/e.53.3.f90   -Os  execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O0  execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O1  execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O2  execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -fomit-frame-pointer  
execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -fomit-frame-pointer 
-funroll-loops  execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -g  execution test
FAIL: libgomp.fortran/examples-4/e.53.4.f90   -Os  execution test
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O0  execution test
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O1  execution test
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O2  execution test
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer  
execution test
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer 
-funroll-loops  execution test
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  execution test
FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -g  execution test
FAIL: libgomp.fo

[v3] Fix _S_local_capacity for large sizeof(_CharT)

2014-12-22 Thread Paolo Carlini

Hi,

minimally, fix _S_local_capacity for sizeof(_CharT) > 16. Probably we'll 
come back to it in order to tune it more finely for char, wchar_t, 
char16_t, and char32_t.


Tested x86_64-linux.

Thanks,
Paolo.

///
2014-12-22  Paolo Carlini  

* include/bits/basic_string.h: Fix _S_local_capacity for
large sizeof(_CharT).
Index: include/bits/basic_string.h
===
--- include/bits/basic_string.h (revision 219015)
+++ include/bits/basic_string.h (working copy)
@@ -114,7 +114,7 @@
   _Alloc_hider _M_dataplus;
   size_type_M_string_length;
 
-  enum { _S_local_capacity = 16 / sizeof(_CharT) - 1 };
+  enum { _S_local_capacity = 15 / sizeof(_CharT) };
 
   union
   {


Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 11 Nov 2014 13:53:23 +, Julian Brown  
wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown  wrote:
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, [...]

> libgomp/

> * libgomp_target.h [...]
> (struct gomp_device_descr): Move here. Add offload_regions_registered,
> openacc dispatch functions, target_data.

> * target.c [...]
> (splay_tree_key_s, gomp_device_descr): Don't declare here.

> --- a/libgomp/libgomp_target.h
> +++ b/libgomp/libgomp_target.h

> +/* This structure describes accelerator device.
> +   It contains name of the corresponding libgomp plugin, function handlers 
> for
> +   interaction with the device, ID-number of the device, and information 
> about
> +   mapped memory.  */
> +struct gomp_device_descr
> +{
> [...]
> +  /* Extra information required for a device instance by a given target.  */
> +  void *target_data;
> +};

Committed to gomp-4_0-branch in r219024:

commit 095199060ff07ddfd0fb5d5c9fecabfe80ed8eed
Author: tschwinge 
Date:   Mon Dec 22 17:57:50 2014 +

libgomp: Move target_data member from struct gomp_device_descr into struct 
acc_dispatch_t.

It is only used with struct acc_dispatch_t's open_device_func and
close_device_func, so specific to OpenACC support.

libgomp/
* libgomp.h (struct gomp_device_descr): Move target_data member...
(struct acc_dispatch_t): ... into here.  Change all users.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219024 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp |  3 +++
 libgomp/libgomp.h  |  6 +++---
 libgomp/oacc-init.c| 11 ++-
 libgomp/target.c   |  2 +-
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 3aa9bf4..4eac98c 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@
 2014-12-22  Thomas Schwinge  
 
+   * libgomp.h (struct gomp_device_descr): Move target_data member...
+   (struct acc_dispatch_t): ... into here.  Change all users.
+
* target.c (GOMP_target_update): To initialize, call
gomp_init_dev_tables instead of gomp_init_device.
 
diff --git libgomp/libgomp.h libgomp/libgomp.h
index 866f6ca..ec3c52e 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -684,6 +684,9 @@ typedef struct acc_dispatch_t
  happen out-of-order with respect to mapping.  */
   struct target_mem_desc *data_environ;
 
+  /* Extra information required for a device instance by a given target.  */
+  void *target_data;
+
   /* Open or close a device instance.  */
   void *(*open_device_func) (int n);
   int (*close_device_func) (void *h);
@@ -769,9 +772,6 @@ struct gomp_device_descr
 
   /* Memory-mapping info for this device instance.  */
   struct gomp_memory_mapping mem_map;
-
-  /* Extra information required for a device instance by a given target.  */
-  void *target_data;
 };
 
 extern void gomp_acc_insert_pointer (size_t, void **, size_t *, void *);
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index ff51856..06039b3 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -279,11 +279,11 @@ lazy_open (int ord)
   thr->saved_bound_dev = NULL;
   thr->mapped_data = NULL;
 
-  if (!acc_dev->target_data)
-acc_dev->target_data = acc_dev->openacc.open_device_func (ord);
+  if (!acc_dev->openacc.target_data)
+acc_dev->openacc.target_data = acc_dev->openacc.open_device_func (ord);
 
   thr->target_tls
-= acc_dev->openacc.create_thread_data_func (acc_dev->target_data);
+= acc_dev->openacc.create_thread_data_func (acc_dev->openacc.target_data);
 
   acc_dev->openacc.async_set_async_func (acc_async_sync);
 
@@ -344,10 +344,11 @@ acc_shutdown_1 (acc_device_t d)
 
   if (walk->dev)
{
-  if (walk->dev->openacc.close_device_func (walk->dev->target_data) < 
0)
+ void *target_data = walk->dev->openacc.target_data;
+ if (walk->dev->openacc.close_device_func (target_data) < 0)
gomp_fatal ("failed to close device");
 
- walk->dev->target_data = NULL;
+ walk->dev->openacc.target_data = target_data = NULL;
 
  gomp_free_memmap (walk->dev);
 
diff --git libgomp/target.c libgomp/target.c
index 8517a84..bf719f8 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -1106,8 +1106,8 @@ gomp_target_init (void)
current_device.offload_regions_registered = false;
current_device.mem_map.splay_tree.root = NULL;
current_device.mem_map.is_initialized = false;
-   current_device.target_data = NULL;
current_device.openacc.data_environ = NULL;
+   current_device.openacc.target_data = NULL;
for (i = 0; i 

Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 11 Nov 2014 13:53:23 +, Julian Brown  
wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown  wrote:
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, [...]

> --- a/libgomp/libgomp_target.h
> +++ b/libgomp/libgomp_target.h

> +extern attribute_hidden void
> +gomp_free_memmap (struct gomp_device_descr *devicep);

> --- a/libgomp/target.c
> +++ b/libgomp/target.c

> +attribute_hidden void
> +gomp_free_memmap (struct gomp_device_descr *devicep)
> +{
> +  struct gomp_memory_mapping *mm = &devicep->mem_map;
> +
> +  while (mm->splay_tree.root)
> +{
> +  struct target_mem_desc *tgt = mm->splay_tree.root->key.tgt;
> +  
> +  splay_tree_remove (&mm->splay_tree, &mm->splay_tree.root->key);
> +  free (tgt->array);
> +  free (tgt);
> +}
> +
> +  mm->is_initialized = false;
> +}

Committed to gomp-4_0-branch in r219025:

commit 2eb33739d20c07303c42ed56db0fb925b575f33e
Author: tschwinge 
Date:   Mon Dec 22 18:04:41 2014 +

libgomp: gomp_free_memmap interface change.

libgomp/
* libgomp.h (gomp_free_memmap): Take a pointer to a struct
gomp_memory_mapping instead of a pointer to a struct
gomp_device_descr.  Change all users.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219025 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp | 4 
 libgomp/libgomp.h  | 4 ++--
 libgomp/oacc-init.c| 2 +-
 libgomp/target.c   | 4 +---
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 4eac98c..383993d 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,9 @@
 2014-12-22  Thomas Schwinge  
 
+   * libgomp.h (gomp_free_memmap): Take a pointer to a struct
+   gomp_memory_mapping instead of a pointer to a struct
+   gomp_device_descr.  Change all users.
+
* libgomp.h (struct gomp_device_descr): Move target_data member...
(struct acc_dispatch_t): ... into here.  Change all users.
 
diff --git libgomp/libgomp.h libgomp/libgomp.h
index ec3c52e..5897d8f 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -790,10 +790,10 @@ extern void gomp_init_device (struct gomp_device_descr *);
 extern void gomp_init_tables (const struct gomp_device_descr *,
  struct gomp_memory_mapping *);
 
+extern void gomp_free_memmap (struct gomp_memory_mapping *);
+
 extern void gomp_fini_device (struct gomp_device_descr *);
 
-extern void gomp_free_memmap (struct gomp_device_descr *);
-
 /* work.c */
 
 extern void gomp_init_work_share (struct gomp_work_share *, bool, unsigned);
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index 06039b3..3867ca7 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -350,7 +350,7 @@ acc_shutdown_1 (acc_device_t d)
 
  walk->dev->openacc.target_data = target_data = NULL;
 
- gomp_free_memmap (walk->dev);
+ gomp_free_memmap (&walk->dev->mem_map);
 
  walk->dev = NULL;
}
diff --git libgomp/target.c libgomp/target.c
index bf719f8..788d9fb 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -722,10 +722,8 @@ gomp_init_dev_tables (struct gomp_device_descr *devicep)
 
 
 attribute_hidden void
-gomp_free_memmap (struct gomp_device_descr *devicep)
+gomp_free_memmap (struct gomp_memory_mapping *mm)
 {
-  struct gomp_memory_mapping *mm = &devicep->mem_map;
-
   while (mm->splay_tree.root)
 {
   struct target_mem_desc *tgt = mm->splay_tree.root->key.tgt;


Grüße,
 Thomas


signature.asc
Description: PGP signature


Re: Remove unused arguments of bulitin_unreachable

2014-12-22 Thread Jeff Law

On 12/11/14 10:06, Jan Hubicka wrote:

Hi,
in firefox .optimized dumps one can see few places where __builtin_unreachable
is called (as a result of devirtualization code proving the code path to be
undefined).  There is usually some argument setup for the parameters of
__builtin_unreachable that are dead.  This patch makes it somewhat better
so now we get:
   :
   # prephitmp_222 = PHI <_52(27), pretmp_245(29)>
   _57 = prephitmp_222 + 2;
   pool_40(D)->ptr = _57;
   __builtin_unreachable ();

Why DSE does not eliminate the stores prior noreturn const function?

Bootstrapped/regtested x86_64-linux, OK?

Honza
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Remove dead 
parameters
of BUILT_IN_UNREACHABLE
ISTM that we shouldn't need any special handling in DCE for this.  When 
something is transformed into a builtin_unreachable(), arguments which 
are SSA_NAMEs which are no longer referenced ought to just go away via 
the normal DCE mechanisms.


A memory store has side effects that might be observable prior to 
reaching the builtin_unreachable, thus it ought not be deleted.At 
least that's my recollection of how we wanted this to work for other 
transformations which turned turned statements with undefined behaviour 
into a __builtin_unreachable.


jeff



Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 11 Nov 2014 13:53:23 +, Julian Brown  
wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown  wrote:
> 
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, [...]

Committed to gomp-4_0-branch in r219026:

commit 9a4509c31bcb89a4eb78d70dba4eb3d1b4709c8b
Author: tschwinge 
Date:   Mon Dec 22 18:14:16 2014 +

libgomp: Remove dubious "const casting".

This may be re-instantiated later on, but then "more completely".

libgomp/
* libgomp.h (gomp_init_tables): Remove const qualifier from struct
gomp_device_descr.  Change all users.
* oacc-int.h (base_dev, goacc_register): Likewise.
* oacc-init.c (dispatchers, resolve_device, acc_init_1)
(lazy_init): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219026 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp |  6 ++
 libgomp/libgomp.h  |  2 +-
 libgomp/oacc-init.c| 24 
 libgomp/oacc-int.h |  4 ++--
 libgomp/oacc-mem.c |  2 +-
 libgomp/target.c   |  4 ++--
 6 files changed, 24 insertions(+), 18 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 383993d..3439797 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,11 @@
 2014-12-22  Thomas Schwinge  
 
+   * libgomp.h (gomp_init_tables): Remove const qualifier from struct
+   gomp_device_descr.  Change all users.
+   * oacc-int.h (base_dev, goacc_register): Likewise.
+   * oacc-init.c (dispatchers, resolve_device, acc_init_1)
+   (lazy_init): Likewise.
+
* libgomp.h (gomp_free_memmap): Take a pointer to a struct
gomp_memory_mapping instead of a pointer to a struct
gomp_device_descr.  Change all users.
diff --git libgomp/libgomp.h libgomp/libgomp.h
index 5897d8f..440bfce 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -787,7 +787,7 @@ extern void gomp_unmap_vars (struct target_mem_desc *, 
bool);
 
 extern void gomp_init_device (struct gomp_device_descr *);
 
-extern void gomp_init_tables (const struct gomp_device_descr *,
+extern void gomp_init_tables (struct gomp_device_descr *,
  struct gomp_memory_mapping *);
 
 extern void gomp_free_memmap (struct gomp_memory_mapping *);
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index 3867ca7..d10b974 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -46,7 +46,7 @@ static gomp_mutex_t acc_device_lock;
for overall initialisation/shutdown, and other instances -- not necessarily
including this one -- may be opened and closed once the base device has
been initialized.  */
-struct gomp_device_descr const *base_dev;
+struct gomp_device_descr *base_dev;
 
 #if defined HAVE_TLS || defined USE_EMUTLS
 __thread struct goacc_thread *goacc_tls_data;
@@ -65,10 +65,10 @@ static gomp_mutex_t goacc_thread_lock;
only references "base" devices, and other instances of the same type are
found by simply indexing from each such device (which are stored linearly,
grouped by device in target.c:devices).  */
-static struct gomp_device_descr const *dispatchers[_ACC_device_hwm] = { 0 };
+static struct gomp_device_descr *dispatchers[_ACC_device_hwm] = { 0 };
 
 attribute_hidden void
-goacc_register (struct gomp_device_descr const *disp)
+goacc_register (struct gomp_device_descr *disp)
 {
   /* Only register the 0th device here.  */
   if (disp->target_id != 0)
@@ -96,7 +96,7 @@ get_openacc_name (const char *name)
 return name;
 }
 
-static struct gomp_device_descr const *
+static struct gomp_device_descr *
 resolve_device (acc_device_t d)
 {
   acc_device_t d_arg = d;
@@ -158,10 +158,10 @@ resolve_device (acc_device_t d)
(indirectly) the target's device_init hook.  Calling multiple times without
an intervening acc_shutdown_1 call is an error.  */
 
-static struct gomp_device_descr const *
+static struct gomp_device_descr *
 acc_init_1 (acc_device_t d)
 {
-  struct gomp_device_descr const *acc_dev;
+  struct gomp_device_descr *acc_dev;
 
   acc_dev = resolve_device (d);
 
@@ -174,7 +174,7 @@ acc_init_1 (acc_device_t d)
   /* We need to remember what we were intialized as, to check shutdown etc.  */
   init_key = d;  
 
-  gomp_init_device ((struct gomp_device_descr *) acc_dev);
+  gomp_init_device (acc_dev);
 
   return acc_dev;
 }
@@ -272,7 +272,7 @@ lazy_open (int ord)
   if (!thr)
 thr = goacc_new_thread ();
 
-  acc_dev = thr->dev = (struct gomp_device_descr *) &base_dev[ord];
+  acc_dev = thr->dev = &base_dev[ord];
 
   assert (acc_dev->target_id == ord);
 
@@ -358,7 +358,7 @@ acc_shutdown_1 (acc_device_t d)
 
   gomp_mutex_unlock (&goacc_thread_lock);
 
-  gomp_fini_device ((struct gomp_device_descr *) base_dev);
+  gomp_fini

Re: [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND

2014-12-22 Thread Janus Weil
>> here is a small patch which enhances the diagnostics for the intrinsic
>> KIND function. Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>
> OK.

Thanks, committed as r219027.

Cheers,
Janus


Re: [RFC] Offloading Support in libgomp

2014-12-22 Thread Thomas Schwinge
Hi!

On Fri, 13 Sep 2013 15:29:30 +0400, "Michael V. Zolotukhin" 
 wrote:
> Here is the first patch for adding plugins support in libgomp - could you 
> please
> take a look at it?

> --- a/libgomp/target.c
> +++ b/libgomp/target.c

> +/* This structure describes accelerator device.
> +   It contains name of the corresponding libgomp plugin, function handlers 
> for
> +   interaction with the device, ID-number of the device, and information 
> about
> +   mapped memory.  */
> +struct gomp_device_descr
> +{
> +  /* This is the ID number of device.  It could be specified in 
> DEVICE-clause of
> + TARGET construct.  */
> +  int id;

Committed to gomp-4_0-branch in r219028:

commit dac5fae7f58dab3c3f271d2676d20aa653a51e9a
Author: tschwinge 
Date:   Mon Dec 22 18:24:03 2014 +

libgomp: Remove id member from struct gomp_device_descr.

This ID field is not actually used anywhere, and it is redundant, because 
all
devices are kept in a devices array, so the IDth device is simply 
devices[ID].

libgomp/
* libgomp.h (struct gomp_device_descr): Remove id member.  Update
all users.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219028 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp | 3 +++
 libgomp/libgomp.h  | 4 
 libgomp/oacc-host.c| 1 -
 libgomp/target.c   | 3 ---
 4 files changed, 3 insertions(+), 8 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 3439797..eabf737 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@
 2014-12-22  Thomas Schwinge  
 
+   * libgomp.h (struct gomp_device_descr): Remove id member.  Update
+   all users.
+
* libgomp.h (gomp_init_tables): Remove const qualifier from struct
gomp_device_descr.  Change all users.
* oacc-int.h (base_dev, goacc_register): Likewise.
diff --git libgomp/libgomp.h libgomp/libgomp.h
index 440bfce..b6d216b 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -736,10 +736,6 @@ struct gomp_device_descr
   /* Capabilities of device (supports OpenACC, OpenMP).  */
   unsigned int capabilities;
 
-  /* This is the ID number of device.  It could be specified in DEVICE-clause 
of
- TARGET construct.  */
-  int id;
-
   /* This is the ID number of device among devices of the same type.  */
   int target_id;
 
diff --git libgomp/oacc-host.c libgomp/oacc-host.c
index 3b90259..2a82517 100644
--- libgomp/oacc-host.c
+++ libgomp/oacc-host.c
@@ -38,7 +38,6 @@ static struct gomp_device_descr host_dispatch =
 .capabilities = (GOMP_OFFLOAD_CAP_OPENACC_200
 | GOMP_OFFLOAD_CAP_NATIVE_EXEC
 | GOMP_OFFLOAD_CAP_SHARED_MEM),
-.id = 0,
 
 .is_initialized = false,
 .offload_regions_registered = false,
diff --git libgomp/target.c libgomp/target.c
index d823045..226b95b 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -1108,7 +1108,6 @@ gomp_target_init (void)
current_device.openacc.target_data = NULL;
for (i = 0; i < new_num_devices; i++)
  {
-   current_device.id = num_devices + 1;
current_device.target_id = i;
devices[num_devices] = current_device;
gomp_mutex_init (&devices[num_devices].mem_map.lock);
@@ -1136,9 +1135,7 @@ gomp_target_init (void)
{
  struct gomp_device_descr device_tmp = devices[d];
  devices[d] = devices[i];
- devices[d].id = d + 1;
  devices[i] = device_tmp;
- devices[i].id = i + 1;
 
  break;
}


Grüße,
 Thomas


signature.asc
Description: PGP signature


Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 11 Nov 2014 13:53:23 +, Julian Brown  
wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown  wrote:
> 
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, [...]

> --- a/libgomp/target.c
> +++ b/libgomp/target.c

> @@ -920,6 +,43 @@ gomp_target_init (void)
>}
>  while (next);
>  
> +  /* Prefer a device with TARGET_CAP_OPENMP_400 for ICV default-device-var.  
> */
> +  if (num_devices > 1)
> +{
> +  int d = gomp_icv (false)->default_device_var;
> +
> +  if (!(devices[d].capabilities & TARGET_CAP_OPENMP_400))
> + {
> +   for (i = 0; i < num_devices; i++)
> + {
> +   if (devices[i].capabilities & TARGET_CAP_OPENMP_400)
> + {
> +   struct gomp_device_descr device_tmp = devices[d];
> +   devices[d] = devices[i];
> +   devices[d].id = d + 1;
> +   devices[i] = device_tmp;
> +   devices[i].id = i + 1;
> +
> +   break;
> + }
> + }
> + }
> +}

A thinko of mine; committed to gomp-4_0-branch in r219029:

commit 806b4f5eed613a43bf52082816469268df0ed9a5
Author: tschwinge 
Date:   Mon Dec 22 18:31:42 2014 +

libgomp: For OpenMP offloading, only publicize GOMP_OFFLOAD_CAP_OPENMP_400 
devices.

libgomp/
* target.c (num_devices_openmp): New variable.
(gomp_get_num_devices): Use it.
(gomp_target_init): Initialize it, and sort the devices array
appropriately.

With Intel MIC offloading (emulation), this fixes:

FAIL: libgomp.c/examples-4/e.57.2.c execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -O0  execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -O1  execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -O2  execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -O3 -fomit-frame-pointer  
execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -O3 -fomit-frame-pointer 
-funroll-loops  execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -O3 -fomit-frame-pointer 
-funroll-all-loops -finline-functions  execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -O3 -g  execution test
FAIL: libgomp.fortran/examples-4/e.57.2.f90   -Os  execution test

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219029 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp |  5 +
 libgomp/target.c   | 52 --
 2 files changed, 34 insertions(+), 23 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index eabf737..b9bd024 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,10 @@
 2014-12-22  Thomas Schwinge  
 
+   * target.c (num_devices_openmp): New variable.
+   (gomp_get_num_devices): Use it.
+   (gomp_target_init): Initialize it, and sort the devices array
+   appropriately.
+
* libgomp.h (struct gomp_device_descr): Remove id member.  Update
all users.
 
diff --git libgomp/target.c libgomp/target.c
index 226b95b..bf6edd2 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -67,6 +67,9 @@ static struct gomp_device_descr *devices;
 /* Total number of available devices.  */
 static int num_devices;
 
+/* Number of GOMP_OFFLOAD_CAP_OPENMP_400 devices.  */
+static int num_devices_openmp;
+
 /* The comparison function.  */
 
 attribute_hidden int
@@ -94,7 +97,7 @@ attribute_hidden int
 gomp_get_num_devices (void)
 {
   gomp_init_targets_once ();
-  return num_devices;
+  return num_devices_openmp;
 }
 
 static struct gomp_device_descr *
@@ -1048,9 +1051,11 @@ gomp_register_image_for_device (struct gomp_device_descr 
*device,
 }
 
 /* This function initializes the runtime needed for offloading.
-   It parses the list of offload targets and tries to load the plugins for 
these
-   targets.  Result of the function is properly initialized variable 
NUM_DEVICES
-   and array DEVICES, containing descriptors for corresponding devices.  */
+   It parses the list of offload targets and tries to load the plugins for
+   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
+   will be set, and the array DEVICES initialized, containing descriptors for
+   corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
+   by the others.  */
 
 static void
 gomp_target_init (void)
@@ -1089,6 +1094,8 @@ gomp_target_init (void)
new_num_devices = current_device.get_num_devices_func ();
if (new_num_devices >= 1)
  {
+   /* Augment DEVICES and NUM_DEVICES.  */
+
devices = realloc (devices, (num_devices + new_num_devices)

Re: [C++ Patch] PR 63985

2014-12-22 Thread Jason Merrill

On 12/04/2014 07:51 AM, Paolo Carlini wrote:

Ideally, it would be nice to say something
more detailed about the invalid declaration, but that doesn't seem
trivial...


How about giving that error in cp_parser_init_declarator?


  /* An `=' or an `(', or an '{' in C++0x, indicates an initializer.  */
  if (token->type == CPP_EQ
  || token->type == CPP_OPEN_PAREN
  || token->type == CPP_OPEN_BRACE)
{
  is_initialized = SD_INITIALIZED;
  initialization_kind = token->type;
  if (maybe_range_for_decl)
*maybe_range_for_decl = error_mark_node;


Here.

Jason



[SH][committed] Add another test case for PR 58314

2014-12-22 Thread Oleg Endo
Hi,

I've noticed that the test case mentioned in the PR hasn't been
committed.  Moreover, setting -Os in sh/torture/pr58314.c doesn't
accomplish anything.  Tested with
 make -k check-gcc RUNTESTFLAGS="sh-torture.exp=pr58314*
--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r219030.

Cheers,
Oleg

gcc/testsuite/ChangeLog:
PR target/58314
* gcc.target/sh/torture/pr58314-2.c: New.
* gcc.target/sh/torture/pr58314.c: Don't set -Os option.
Index: gcc/testsuite/gcc.target/sh/torture/pr58314-2.c
===
--- gcc/testsuite/gcc.target/sh/torture/pr58314-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/torture/pr58314-2.c	(revision 0)
@@ -0,0 +1,160 @@
+/* { dg-do compile }  */
+
+struct unipair 
+{
+  unsigned short unicode;
+  unsigned short fontpos;
+};
+
+struct __large_struct
+{
+  unsigned long buf[100];
+};
+
+struct vc_data
+{
+  unsigned long *vc_uni_pagedir_loc;
+};
+
+struct uni_pagedir 
+{
+  unsigned short **uni_pgdir[32];
+};
+
+void con_get_unimap (struct vc_data *vc, unsigned short ct, unsigned short *uct,
+		 struct unipair *list)
+{
+  int i, j, k, ect;
+  unsigned short **p1, *p2;
+  struct uni_pagedir *p;
+
+  ect = 0;
+
+  if (*vc->vc_uni_pagedir_loc)
+  {
+p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
+for (i = 0; i < 32; i++)
+if ((p1 = p->uni_pgdir[i]))
+for (j = 0; j < 32; j++)
+if ((p2 = *(p1++)))
+for (k = 0; k < 64; k++)
+{
+  if (*p2 < 512 && ect++ < ct)
+  {
+	{
+	  long __pu_err;
+	  __typeof__(*((&list->unicode))) *__pu_addr = ((&list->unicode));
+	  __typeof__(*((&list->unicode))) __pu_val =
+		((unsigned short)((i<<11)+(j<<6)+k));
+	  __pu_err = 0;
+	  switch ((sizeof(*(&list->unicode
+	  {
+	case 1:
+		__asm__ __volatile__ (
+		"1:\n\t"
+			"mov." "b" "	%1, %2\n\t"
+		"2:\n"
+		".section	.fixup,\"ax\"\n"
+		"3:\n\t"
+			"mov.l	4f, %0\n\t"
+			"jmp	@%0\n\t"
+			" mov	%3, %0\n\t"
+			".balign	4\n"
+		"4:	.long	2b\n\t"
+			".previous\n"
+		".section	__ex_table,\"a\"\n\t"
+			".long	1b, 3b\n\t"
+			".previous"
+		: "=&r" (__pu_err)
+		: "r" (__pu_val), "m" ((*(struct __large_struct *)(__pu_addr))),
+		  "i" (-14), "0" (__pu_err) : "memory" );
+
+	  break;
+
+	case 2:
+		__asm__ __volatile__ (
+		"1:\n\t"
+			"mov." "w" "	%1, %2\n\t"
+		"2:\n"
+		".section	.fixup,\"ax\"\n"
+		"3:\n\t"
+			"mov.l	4f, %0\n\t"
+			"jmp	@%0\n\t"
+			" mov	%3, %0\n\t"
+			".balign	4\n"
+			"4:	.long	2b\n\t"
+			".previous\n"
+		".section	__ex_table,\"a\"\n\t"
+			".long	1b, 3b\n\t"
+			".previous"
+		: "=&r" (__pu_err)
+		: "r" (__pu_val), "m" ((*(struct __large_struct *)(__pu_addr))),
+		  "i" (-14), "0" (__pu_err) : "memory" );
+	  break;
+
+	default:
+	  break;
+	  }
+	}
+
+
+	{
+	  long __pu_err;
+	  __typeof__(*((&list->fontpos))) *__pu_addr = ((&list->fontpos));
+	  __typeof__(*((&list->fontpos))) __pu_val = ((unsigned short) *p2);
+	  __pu_err = 0;
+	  switch ((sizeof(*(&list->fontpos
+	  {
+	case 1:
+		__asm__ __volatile__ (
+		"1:\n\t"
+			"mov." "b" "	%1, %2\n\t"
+		"2:\n"
+		".section	.fixup,\"ax\"\n"
+		"3:\n\t"
+			"mov.l	4f, %0\n\t"
+			"jmp	@%0\n\t"
+			" mov	%3, %0\n\t"
+			".balign	4\n"
+			"4:	.long	2b\n\t"
+			".previous\n"
+		".section	__ex_table,\"a\"\n\t"
+			".long	1b, 3b\n\t"
+			".previous"
+		: "=&r" (__pu_err)
+		: "r" (__pu_val), "m" ((*(struct __large_struct *)(__pu_addr))),
+		  "i" (-14), "0" (__pu_err) : "memory" );
+	  break;
+
+	case 2:
+	  __asm__ __volatile__ (
+		"1:\n\t"
+			"mov." "w" "	%1, %2\n\t"
+		"2:\n"
+			".section	.fixup,\"ax\"\n"
+		"3:\n\t"
+			"mov.l	4f, %0\n\t"
+			"jmp	@%0\n\t"
+			" mov	%3, %0\n\t"
+		".balign	4\n"
+			"4:	.long	2b\n\t"
+		".previous\n"
+		".section	__ex_table,\"a\"\n\t"
+			".long	1b, 3b\n\t"
+			".previous"
+		: "=&r" (__pu_err)
+		: "r" (__pu_val), "m" ((*(struct __large_struct *)(__pu_addr))),
+		  "i" (-14), "0" (__pu_err) : "memory" );
+	  break;
+
+	default:
+	  break;
+	  }
+	}
+
+list++;
+  }
+  p2++;
+}
+  }
+}
Index: gcc/testsuite/gcc.target/sh/torture/pr58314.c
===
--- gcc/testsuite/gcc.target/sh/torture/pr58314.c	(revision 219015)
+++ gcc/testsuite/gcc.target/sh/torture/pr58314.c	(working copy)
@@ -1,13 +1,15 @@
+/* { dg-additional-options "-std=gnu99" }  */
 /* { dg-do compile }  */
-/* { dg-options "-Os" } */
 
 typedef unsigned short __u16;
 typedef unsigned int __u32;
-
 typedef signed short s16;
 
 
-static inline __attribute__((always_inline)) __attribute__((__const__)) __u16 __arch_swab16(__u16 x)
+static inline 
+__attribute__((always_inline))
+__attribute__((__const__))
+__u16 __arch_swab16(__u16 x)
 {
  __asm__(
   "swap.b		%1, %0"


Re: [Patch, Fortran] -fcoarray=lib: Fix vector subscript handling

2014-12-22 Thread Tobias Burnus

PING

On 18 December 2014, 00:14, Tobias Burnus wrote:
As testing by Alessandro revealed, vector subscripts weren't properly 
handled.


This patch fixes the compiler side (or at least those issues I found). 
In particular, for expressions ("get") it wrongly passed a NULL 
pointer, additionally, I used the wrong "ar". For it and for 
assignments/push ("send", "sendget"), I also used the wrong rank value 
as one also passes DIMEN_ELEMENT as DIMEN_RANGE.


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

* * *

I still have to add vector subscript support to libcaf_single. I 
didn't include an -fdump-tree-original test case, but I can add one if 
there regarded as useful.


Attached is – besides the patch for trans-intrinsic.c – a debuging 
patch for libcaf_single. I tested it with:

integer :: A(2,3)[*]
A(2,:) = A(1,[1,3,2])[1]
end

integer :: A(2,3)[*]
A(1,[1,3,2])[1] = A(2,:)
end

integer :: A(2,3)[*]
integer :: B(2,3)[*]
A(1,[1,3,2])[1] = B(1,[1,3,2])[1]
end

The output looks like (for the first one):

DEBUG: CAF_GET: 0x7fffb72f71d0
DEBUG: have vector for rank 2 [1]
DEBUG: dim=0: nvec = 0
DEBUG: (1:1:1)
DEBUG: dim=1: nvec = 3
DEBUG: 0: 1
DEBUG: 1: 3
DEBUG: 2: 2

Tobias




Re: [C++ Patch] PR 63985

2014-12-22 Thread Paolo Carlini

Hi,

On 12/22/2014 07:55 PM, Jason Merrill wrote:

On 12/04/2014 07:51 AM, Paolo Carlini wrote:

Ideally, it would be nice to say something
more detailed about the invalid declaration, but that doesn't seem
trivial...


How about giving that error in cp_parser_init_declarator?


  /* An `=' or an `(', or an '{' in C++0x, indicates an initializer.  */
  if (token->type == CPP_EQ
  || token->type == CPP_OPEN_PAREN
  || token->type == CPP_OPEN_BRACE)
{
  is_initialized = SD_INITIALIZED;
  initialization_kind = token->type;
  if (maybe_range_for_decl)
*maybe_range_for_decl = error_mark_node;


Here.
That would be the place. But, at that point, it could still be a normal 
for loop, thus we can't just give an error. Assigning error_mark_node on 
the other hand is correct, because later, if we find the colon, we 
realize that the declaration is wrong because has an initializer. For 
the record, clang vs edg appear to handle this case differently: clang 
considers it a wrong for loop, edg a wrong range-based for loop. Humm...


Paolo.


Re: [Patch, Fortran] -fcoarray=lib: Fix vector subscript handling

2014-12-22 Thread Janus Weil
2014-12-18 0:14 GMT+01:00 Tobias Burnus :
> As testing by Alessandro revealed, vector subscripts weren't properly
> handled.
>
> This patch fixes the compiler side (or at least those issues I found). In
> particular, for expressions ("get") it wrongly passed a NULL pointer,
> additionally, I used the wrong "ar". For it and for assignments/push
> ("send", "sendget"), I also used the wrong rank value as one also passes
> DIMEN_ELEMENT as DIMEN_RANGE.
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?


Ok.

Thanks,
Janus




> * * *
>
> I still have to add vector subscript support to libcaf_single. I didn't
> include an -fdump-tree-original test case, but I can add one if there
> regarded as useful.
>
> Attached is – besides the patch for trans-intrinsic.c – a debuging patch for
> libcaf_single. I tested it with:
> integer :: A(2,3)[*]
> A(2,:) = A(1,[1,3,2])[1]
> end
>
> integer :: A(2,3)[*]
> A(1,[1,3,2])[1] = A(2,:)
> end
>
> integer :: A(2,3)[*]
> integer :: B(2,3)[*]
> A(1,[1,3,2])[1] = B(1,[1,3,2])[1]
> end
>
> The output looks like (for the first one):
>
> DEBUG: CAF_GET: 0x7fffb72f71d0
> DEBUG: have vector for rank 2 [1]
> DEBUG: dim=0: nvec = 0
> DEBUG: (1:1:1)
> DEBUG: dim=1: nvec = 3
> DEBUG: 0: 1
> DEBUG: 1: 3
> DEBUG: 2: 2
>
> Tobias


Re: [PATCH 1/3] libstdc++: Add time_get::get support.

2014-12-22 Thread Dominique Dhumieres
> I think I've fixed them now though, and am committing the attached
> patch to trunk.

This commit (or a friend of it) breaks bootstrap on darwin

duplicate symbol std::__cxx11::time_get > >::do_get(std::istreambuf_iterator >, std::istreambuf_iterator 
>, std::ios_base&, std::_Ios_Iostate&, tm*, char, char) const in:
../src/c++11/.libs/libc++11convenience.a(cxx11-locale-inst.o)
../src/c++11/.libs/libc++11convenience.a(string-inst.o)
duplicate symbol std::__cxx11::time_get > >::get(std::istreambuf_iterator >, std::istreambuf_iterator 
>, std::ios_base&, std::_Ios_Iostate&, tm*, char, char) const in:
../src/c++11/.libs/libc++11convenience.a(cxx11-locale-inst.o)
../src/c++11/.libs/libc++11convenience.a(string-inst.o)
duplicate symbol std::__cxx11::time_get > >::get(std::istreambuf_iterator >, std::istreambuf_iterator 
>, std::ios_base&, std::_Ios_Iostate&, tm*, char const*, char const*) const in:
../src/c++11/.libs/libc++11convenience.a(cxx11-locale-inst.o)
../src/c++11/.libs/libc++11convenience.a(string-inst.o)
duplicate symbol std::__cxx11::time_get > 
>::do_get(std::istreambuf_iterator >, 
std::istreambuf_iterator >, std::ios_base&, 
std::_Ios_Iostate&, tm*, char, char) const in:
../src/c++11/.libs/libc++11convenience.a(cxx11-wlocale-inst.o)
../src/c++11/.libs/libc++11convenience.a(wstring-inst.o)
duplicate symbol std::__cxx11::time_get > 
>::get(std::istreambuf_iterator >, 
std::istreambuf_iterator >, std::ios_base&, 
std::_Ios_Iostate&, tm*, char, char) const in:
../src/c++11/.libs/libc++11convenience.a(cxx11-wlocale-inst.o)
../src/c++11/.libs/libc++11convenience.a(wstring-inst.o)
duplicate symbol std::__cxx11::time_get > 
>::get(std::istreambuf_iterator >, 
std::istreambuf_iterator >, std::ios_base&, 
std::_Ios_Iostate&, tm*, wchar_t const*, wchar_t const*) const in:
../src/c++11/.libs/libc++11convenience.a(cxx11-wlocale-inst.o)
../src/c++11/.libs/libc++11convenience.a(wstring-inst.o)
ld: 6 duplicate symbols for architecture x86_64

TIA

Dominique


Re: [C++ Patch] PR 63985

2014-12-22 Thread Jason Merrill

On 12/22/2014 03:11 PM, Paolo Carlini wrote:

That would be the place. But, at that point, it could still be a normal
for loop, thus we can't just give an error.


Ah, yes.


Assigning error_mark_node on
the other hand is correct, because later, if we find the colon, we
realize that the declaration is wrong because has an initializer.


We could also peek for a colon in cp_parser_init_declarator after 
parsing the initializer, and give an error then.



For
the record, clang vs edg appear to handle this case differently: clang
considers it a wrong for loop, edg a wrong range-based for loop. Humm...


They're both right.  :)

Jason



#pragma GCC unroll support

2014-12-22 Thread Mike Stump
So, I have a rough cut of a new feature to add pragma GCC unroll support to 
gcc.  It is safe wrt the test suite and code-gen, but there are some corners 
that I need help or suggestions on how to round off nicely.

Things to think about, can we put this in even if we have TODO support for C++ 
template support?  I think that is only 2-5 lines away from completion, but one 
needs to play peak-a-boo with some data (the unroll count) and I wanted to let 
pt fingers decide where to hide the data.  See RANGE_FOR_IVDEP for how I want 
to do it.

Can I increase the size of all annotations to 3 from 2?  It seemed safer, 
easier than trying to subdivide it.

I didn’t engineer ivdeps and unroll together.  Does it sound reasonable to 
allow both to be used at the same time on the same loop?  If so, I can add the 
two other cases, presently I just handle one of them then the loop.

Fortran support is left to the fortran people, if they want to do it.  I wired 
it up tantalizingly close for them to complete.

See ICK in the code.  I was unsure how to resolve that code.

Does unroll 8 mean that the loop is repeated 8 times?

Can I turn on peeling in try_peel_loop by simply wanted to do it for 1 loop?

I support using -1 for a directive that says, don’t peel, don’t unroll.  As a 
UI issue, I think this is wrong.  I want to to be either 0 or 1, those two seem 
better.  But, not sure which is the right one of the two.  Which number says, 
don’t unroll, I’m smarter than you think.

If we have a loop that we know can only be unroll 7 times, and the user says 
unroll 8, should we unroll it 7 times?  Presently I do.  The other option, is 
to ignore the directive when we know it is non-sensicle.

Yes, I’m aware that this isn’t the right phase for this, but such are business 
cycles.  It would not go in until we reenter stage 1.  I see no value in trying 
to squeeze it in past stage 1.

Index: ada/gcc-interface/trans.c
===
--- ada/gcc-interface/trans.c   (revision 219031)
+++ ada/gcc-interface/trans.c   (working copy)
@@ -7850,17 +7850,20 @@ gnat_gimplify_stmt (tree *stmt_p)
  {
/* Deal with the optimization hints.  */
if (LOOP_STMT_IVDEP (stmt))
- gnu_cond = build2 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
+ gnu_cond = build3 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
 build_int_cst (integer_type_node,
-   annot_expr_ivdep_kind));
+   annot_expr_ivdep_kind),
+integer_zero_node);
if (LOOP_STMT_NO_VECTOR (stmt))
- gnu_cond = build2 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
+ gnu_cond = build3 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
 build_int_cst (integer_type_node,
-   annot_expr_no_vector_kind));
+   annot_expr_no_vector_kind),
+integer_zero_node);
if (LOOP_STMT_VECTOR (stmt))
- gnu_cond = build2 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
+ gnu_cond = build3 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
 build_int_cst (integer_type_node,
-   annot_expr_vector_kind));
+   annot_expr_vector_kind),
+integer_zero_node);
 
gnu_cond
  = build3 (COND_EXPR, void_type_node, gnu_cond, NULL_TREE,
Index: c/c-parser.c
===
--- c/c-parser.c(revision 219031)
+++ c/c-parser.c(working copy)
@@ -1206,9 +1206,9 @@ static void c_parser_statement (c_parser
 static void c_parser_statement_after_labels (c_parser *);
 static void c_parser_if_statement (c_parser *);
 static void c_parser_switch_statement (c_parser *);
-static void c_parser_while_statement (c_parser *, bool);
-static void c_parser_do_statement (c_parser *, bool);
-static void c_parser_for_statement (c_parser *, bool);
+static void c_parser_while_statement (c_parser *, bool, int);
+static void c_parser_do_statement (c_parser *, bool, int);
+static void c_parser_for_statement (c_parser *, bool, int);
 static tree c_parser_asm_statement (c_parser *);
 static tree c_parser_asm_operands (c_parser *);
 static tree c_parser_asm_goto_operands (c_parser *);
@@ -4925,13 +4925,13 @@ c_parser_statement_after_labels (c_parse
  c_parser_switch_statement (parser);
  break;
case RID_WHILE:
- c_parser_while_statement (parser, false);
+ c_parser_while_statement (parser, false, 0);
  break;
case RID_DO:
- c_parser_do_statement (parser, false);
+ c_parser_do_statemen

Re: [C++ Patch] PR 63985

2014-12-22 Thread Paolo Carlini

Hi,

On 12/22/2014 10:12 PM, Jason Merrill wrote:
We could also peek for a colon in cp_parser_init_declarator after 
parsing the initializer, and give an error then.

I see.

For
the record, clang vs edg appear to handle this case differently: clang
considers it a wrong for loop, edg a wrong range-based for loop. Humm...


They're both right.  :)
Well, if they are both right, could we maybe do something closer to 
clang, instead, thus not consider the for loop a range-based for loop 
only because after the initializer there is a colon when the decl is 
error_mark_node? As an heuristics I think it may make sense in these 
borderline cases because the declarator is more restricted for a 
range-based. The below passes testing.


Thanks,
Paolo.

/
Index: cp/parser.c
===
--- cp/parser.c (revision 219030)
+++ cp/parser.c (working copy)
@@ -10894,16 +10894,26 @@ cp_parser_for_init_statement (cp_parser* parser, t
   parser->colon_corrects_to_scope_p = saved_colon_corrects_to_scope_p;
   if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
{
- /* It is a range-for, consume the ':' */
- cp_lexer_consume_token (parser->lexer);
- is_range_for = true;
- if (cxx_dialect < cxx11)
+ if (*decl == error_mark_node)
{
- pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
-  "range-based % loops only available with "
-  "-std=c++11 or -std=gnu++11");
- *decl = error_mark_node;
+ /* Give an error and consume the ':' anyway for better
+error recovery.  */
+ cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
+ cp_lexer_consume_token (parser->lexer);
}
+ else
+   {
+ /* It is a range-for, consume the ':' */
+ cp_lexer_consume_token (parser->lexer);
+ is_range_for = true;
+ if (cxx_dialect < cxx11)
+   {
+ pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
+  "range-based % loops only available with "
+  "-std=c++11 or -std=gnu++11");
+ *decl = error_mark_node;
+   }
+   }
}
   else
  /* The ';' is not consumed yet because we told
Index: testsuite/g++.dg/cpp0x/range-for29.C
===
--- testsuite/g++.dg/cpp0x/range-for29.C(revision 0)
+++ testsuite/g++.dg/cpp0x/range-for29.C(working copy)
@@ -0,0 +1,10 @@
+// PR c++/63985
+// { dg-require-effective-target c++11 }
+
+int main()
+{
+  int arr;
+  for (int i = 5: arr)  // { dg-error "expected ';'" }
+return 1;
+  return 0;
+}


Re: [C++ Patch] PR 63985

2014-12-22 Thread Jason Merrill

On 12/22/2014 04:51 PM, Paolo Carlini wrote:

Well, if they are both right, could we maybe do something closer to
clang, instead, thus not consider the for loop a range-based for loop
only because after the initializer there is a colon when the decl is
error_mark_node?


I think we want to tell the user that you can't have an explicit 
initializer in a range-based for loop, since that's the mistake that 
they've made; that seems more helpful than saying you can't have a colon 
after a for-init-statement.


Jason



Re: [PATCH 1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)

2014-12-22 Thread Thomas Schwinge
Hi!

On Tue, 11 Nov 2014 13:53:23 +, Julian Brown  
wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown  wrote:
> 
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, [...]

> --- a/libgomp/target.c
> +++ b/libgomp/target.c

> @@ -673,7 +753,12 @@ GOMP_target (int device, void (*fn) (void *), const void 
> *openmp_target,
>unsigned char *kinds)
>  {
>struct gomp_device_descr *devicep = resolve_device (device);
> -  if (devicep == NULL)
> +  struct gomp_memory_mapping *mm = &devicep->mem_map;
> +
> +  if (devicep != NULL && !devicep->is_initialized)
> +gomp_init_dev_tables (devicep);
> +
> +  if (devicep == NULL || !(devicep->capabilities & TARGET_CAP_OPENMP_400))
>  {
>/* Host fallback.  */
>struct gomp_thread old_thr, *thr = gomp_thread ();
> @@ -690,20 +775,30 @@ GOMP_target (int device, void (*fn) (void *), const 
> void *openmp_target,
>return;
>  }
>  
> -  gomp_mutex_lock (&devicep->dev_env_lock);
> -  if (!devicep->is_initialized)
> -gomp_init_device (devicep);
> [...]
> -  gomp_mutex_unlock (&devicep->dev_env_lock);

Here, gomp_init_device has (correctly) been replaced with
gomp_init_dev_tables, but also locking of dev_env_lock removed.

Then, shortly after that:

> [...]
> +  gomp_mutex_lock (&mm->lock);
> +  if (!devicep->is_initialized)
> + gomp_init_dev_tables (devicep);
> [...]
> +  gomp_mutex_unlock (&mm->lock);
> [...]

Again checking the device's is_initialized flag (should instead be the
memory mappings'?), and again calling gomp_init_dev_tables?  What I think
this meant to do is more fine-grained locking and initialization,
distinguishing between the device itself and its memory mapping tables?

Similar for GOMP_target_data and GOMP_target_update.

Removing locking from device initialization is certainly not a good idea,
for example:

$ build-gcc/gcc/xgcc -Bbuild-gcc/gcc/ 
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/ 
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs 
-Ibuild-gcc/x86_64-unknown-linux-gnu/./libgomp 
-Isource-gcc/libgomp/testsuite/../../include -Isource-gcc/libgomp/testsuite/.. 
-Binstall/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0
 -Binstall/offload-x86_64-intelmicemul-linux-gnu/bin -fopenmp 
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs/   -O0   
-Bbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs 
-fintrinsic-modules-path=build-gcc/x86_64-unknown-linux-gnu/./libgomp   
-Lbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs 
-Lbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs/ 
-Lbuild-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs -lgfortran 
-lm -g source-gcc/libgomp/testsuite/libgomp.fortran/target7.f90 
$ 
LD_LIBRARY_PATH=.:build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/plugin/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libstdc++-v3/src/.libs:install/offload-x86_64-intelmicemul-linux-gnu/lib64:install/offload-x86_64-intelmicemul-linux-gnu/lib:build-gcc/gcc:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs:.:build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../liboffloadmic/plugin/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libstdc++-v3/src/.libs:install/offload-x86_64-intelmicemul-linux-gnu/lib64:install/offload-x86_64-intelmicemul-linux-gnu/lib:build-gcc/gcc:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libgfortran/.libs:build-gcc/x86_64-unknown-linux-gnu/./libgomp/../libquadmath/.libs:
 ./a.out

libgomp: 
libgomp: Duplicate node
Duplicate node
libgomp: 
COI ERROR - TARGET: Cannot read from pipe.
Success

offload error: wait for process shutdown failed on device 0 (error code 1)

Smells like a concurrency issue, and indeed, with OMP_NUM_THREADS=1
everything is fine.  Confirmed (by looking at the source code, or) with
GDB:

#0  gomp_fatal (fmt=fmt@entry=0x775ac69b "Duplicate node")
at 
/home/thomas/tmp/source/gcc/openacc/gomp-4_0-branch-work_/source-gcc/libgomp/error.c:85
#1  0x775a857b in splay_tree_insert (sp=sp@entry=0x7fffe40058e8, 
node=node@entry=0x608570)
at 
/home/thomas/tmp/source/gcc/openacc/gomp-4_0-branch-work_/source-gcc/libgomp/splay-tree.c:156
#2  0x775a5a06 in gomp_init_tables 
(devicep=devicep@entry=0x7fffe40057c0, mm=mm@entry=0x7fffe40058e8)
at 
/home/thomas/tmp/source/gcc/openacc/gomp-4_0-branch-work_/s

Re: [GOOGLE] Make LIPO aux function removal consistent

2014-12-22 Thread Teresa Johnson
Ping.
Teresa

On Fri, Dec 19, 2014 at 5:40 PM, Teresa Johnson  wrote:
> Passes regression tests, ok for google 4_9?
>
> Thanks,
> Teresa
>
> 2014-12-19  Teresa Johnson  
>
> Google ref b/18800499
> * cgraph.c (cgraph_can_remove_if_no_direct_calls_and_refs_p): Make
> consistent with mark_functions_for_output for LIPO aux functions.
>
> Index: cgraph.c
> ===
> --- cgraph.c(revision 216977)
> +++ cgraph.c(working copy)
> @@ -2464,6 +2464,8 @@ cgraph_can_remove_if_no_direct_calls_and_refs_p (s
>/* Extern inlines can always go, we will use the external definition.  */
>if (DECL_EXTERNAL (node->decl))
>  return true;
> +  if (cgraph_is_aux_decl_external (node))
> +return true;
>/* When function is needed, we can not remove it.  */
>if (node->force_output || node->used_from_other_partition)
>  return false;
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413



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


Re: Re: [PATCH 1/1] gcc/ira-build.c: save a conflict obj compare in ira_flattening

2014-12-22 Thread Zhouyi Zhou
Thanks Jeff for reviewing,
I forget to mention that I do not have write access
to gcc. 
Can you install for me ?
Cheers 
Zhouyi

> -Original Messages-
> From: "Jeff Law" 
> Sent Time: Tuesday, December 23, 2014
> To: "Zhouyi Zhou" , gcc-patches@gcc.gnu.org
> Cc: "Zhouyi Zhou" 
> Subject: Re: [PATCH 1/1] gcc/ira-build.c: save a conflict obj compare in 
> ira_flattening
> 
> On 12/21/14 23:34, Zhouyi Zhou wrote:
> > In function ira_flattening, conflict relationship will be rebuilt in case
> > of any new pseudo register has been created during ira_emit.
> >
> > By adding the current object to OBJECTS_LIVE after traversing OBJECTS_LIVE, 
> > a conflict
> > obj compare can be saved.
> >
> >
> > Bootstraped and regtested in x86_64 Linux
> > Signed-off-by: Zhouyi Zhou 
> > ---
> >   gcc/ChangeLog   |5 +
> >   gcc/ira-build.c |2 +-
> >   2 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> > index e5d16f9..c0ce758 100644
> > --- a/gcc/ChangeLog
> > +++ b/gcc/ChangeLog
> > @@ -1,3 +1,8 @@
> > +2014-12-22  Zhouyi Zhou 
> > +
> > +   * ira-build.c (ira_flattening): Add the current
> > +   object to OBJECTS_LIVE after traversing OBJECTS_LIVE.
> This is OK.  Please install on the trunk.
> 
> Thanks,
> Jeff
>