[PATCH 1/2] Fix minor glitches with basic asm

2015-12-06 Thread Bernd Edlinger

Hi,

while looking at the handling of basic asm statements
I noticed two minor glitches, which I want to fix now.

First there is a missing check in compare_gimple_asm in ipa-icf-gimple.c

Here we check if two asm statements are exactly identical,
there is a possibility that one is a basic asm and the other is an
extended asm with zero operands. Even if both have the same string
the string means something slightly different, if % or { } are around.

example:

asm("%"); // OK
asm("%":); // error: invalid 'asm': invalid %-code


Boot-strapped and reg-tested on x86_64-pc-linux-gnu,
OK for trunk?


Thanks
Bernd.2015-12-06  Bernd Edlinger  

	* ipa-icf-gimple.c (func_checker::compare_gimple_asm): Fix check for
	basic asm.

Index: gcc/ipa-icf-gimple.c
===
--- gcc/ipa-icf-gimple.c	(revision 231320)
+++ gcc/ipa-icf-gimple.c	(working copy)
@@ -981,6 +981,9 @@ func_checker::compare_gimple_asm (const gasm *g1,
   if (gimple_asm_volatile_p (g1) != gimple_asm_volatile_p (g2))
 return false;
 
+  if (gimple_asm_input_p (g1) != gimple_asm_input_p (g2))
+return false;
+
   if (gimple_asm_ninputs (g1) != gimple_asm_ninputs (g2))
 return false;
 


[PATCH] Fix new sancov tests

2015-12-06 Thread Dmitry Vyukov
Hello,

Sancov tests submitted in 231296 assume that asan is supported on all platforms.
This patch fixes that assumption.
OK for trunk?



Index: ChangeLog
===
--- ChangeLog (revision 231328)
+++ ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2015-12-06  Dmitry Vyukov  
+
+ * gcc.dg/sancov/sancov.exp: Don't run asan tests when asan is not
+ available.
+
 2015-12-05  David Edelsohn  

  * gcc.target/powerpc/recip-sqrtf.c: New test.
Index: gcc.dg/sancov/sancov.exp
===
--- gcc.dg/sancov/sancov.exp (revision 231328)
+++ gcc.dg/sancov/sancov.exp (working copy)
@@ -18,6 +18,7 @@

 load_lib gcc-dg.exp
 load_lib torture-options.exp
+load_lib asan-dg.exp

 dg-init
 torture-init
@@ -31,7 +32,11 @@
  { -O2 -g } \
  { -O3 -g } ]

-gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""

+if [check_effective_target_fsanitize_address] {
+  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
+}
+
 torture-finish
 dg-finish
Index: ChangeLog
===
--- ChangeLog	(revision 231328)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2015-12-06  Dmitry Vyukov  
+
+	* gcc.dg/sancov/sancov.exp: Don't run asan tests when asan is not
+	available.
+
 2015-12-05  David Edelsohn  
 
 	* gcc.target/powerpc/recip-sqrtf.c: New test.
Index: gcc.dg/sancov/sancov.exp
===
--- gcc.dg/sancov/sancov.exp	(revision 231328)
+++ gcc.dg/sancov/sancov.exp	(working copy)
@@ -18,6 +18,7 @@
 
 load_lib gcc-dg.exp
 load_lib torture-options.exp
+load_lib asan-dg.exp
 
 dg-init
 torture-init
@@ -31,7 +32,11 @@
 	{ -O2 -g } \
 	{ -O3 -g } ]
 
-gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/basic*.c]] "" ""
 
+if [check_effective_target_fsanitize_address] {
+  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/asan*.c]] "" ""
+}
+
 torture-finish
 dg-finish


Re: Add fuzzing coverage support

2015-12-06 Thread Dmitry Vyukov
On Sat, Dec 5, 2015 at 1:54 AM, Nathan Sidwell  wrote:
> On 12/04/15 13:28, Dmitry Vyukov wrote:
>>
>> On Fri, Dec 4, 2015 at 6:39 PM, Jakub Jelinek  wrote:
>>>
>>> On Fri, Dec 04, 2015 at 06:32:38PM +0100, Dmitry Vyukov wrote:

 +2015-12-04  Dmitry Vyukov  
 +
 + * sancov.c: New file.
 + * Makefile.in (OBJS): Add sancov.o.
 + * invoke.texi (-fsanitize-coverage=trace-pc): Describe.
 + * passes.def (sancov_pass): Add.
 + * tree-pass.h  (sancov_pass): Add.
 + * common.opt (-fsanitize-coverage=trace-pc): Add.
 + * sanitizer.def (BUILT_IN_SANITIZER_COV_TRACE_PC): Add.
 + * builtins.def (DEF_SANITIZER_BUILTIN): Enable for
 + flag_sanitize_coverage.
>>>
>>>
>>> This is ok for trunk.
>>
>>
>>
>> Committed as 231296
>
>
> This seems to have changed the testsuite (gcc.dg/sancov) without record in
> testsuite/ChangeLog.  Further, the tests presume sanitizer coverage is
> implemented.  I'm seeing asan.c fail with:
>
> cc1: warning: -fsanitize=address and -fsanitize=kernel-address are not
> supported for this target
>
> cc1: warning: -fsanitize=address not supported for this target
>
> output is:
> cc1: warning: -fsanitize=address and -fsanitize=kernel-address are not
> supported for this target
>
> cc1: warning: -fsanitize=address not supported for this target
>
>
> FAIL: gcc.dg/sancov/asan.c   -O0  (test for excess errors)


Mailed a fix titled "[PATCH] Fix new sancov tests".
Sorry for the breakage.


[PATCH 2/2] Fix minor glitches with basic asm

2015-12-06 Thread Bernd Edlinger

Hi,

while looking at the handling of basic asm statements
I noticed two minor glitches, which I want to fix now.

Secondly there is a wrong check in shorten_branches in final.c

Here we check if GET_CODE (body) == ASM_INPUT, that is
never true, because GET_CODE (body) == SEQUENCE here.
The right object to check is PATTERN (inner_insn).


Boot-strapped and reg-tested on x86_64-pc-linux-gnu,
OK for trunk?


Thanks
Bernd.2015-12-06  Bernd Edlinger  

	* final.c (shorten_branches): Fix check for basic asm.

Index: gcc/final.c
===
--- gcc/final.c	(revision 231320)
+++ gcc/final.c	(working copy)
@@ -1157,7 +1157,7 @@ shorten_branches (rtx_insn *first)
 	  int inner_uid = INSN_UID (inner_insn);
 	  int inner_length;
 
-	  if (GET_CODE (body) == ASM_INPUT
+	  if (GET_CODE (PATTERN (inner_insn)) == ASM_INPUT
 		  || asm_noperands (PATTERN (inner_insn)) >= 0)
 		inner_length = (asm_insn_count (PATTERN (inner_insn))
 * insn_default_length (inner_insn));


Fix PR ada/49940

2015-12-06 Thread Eric Botcazou
The fix was posted at https://gcc.gnu.org/ml/gcc-patches/2011-08/msg00139.html

Applied on all active branches.


2015-12-06  Ludovic Brenta  

PR ada/49940
* s-osinte-kfreebsd-gnu.ads (lwp_self): New imported function.

-- 
Eric BotcazouIndex: s-osinte-kfreebsd-gnu.ads
===
--- s-osinte-kfreebsd-gnu.ads	(revision 231318)
+++ s-osinte-kfreebsd-gnu.ads	(working copy)
@@ -7,7 +7,7 @@
 --  S p e c --
 --  --
 --   Copyright (C) 1991-1994, Florida State University  --
---Copyright (C) 1995-2014, Free Software Foundation, Inc.   --
+--Copyright (C) 1995-2015, Free Software Foundation, Inc.   --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -236,6 +236,16 @@ package System.OS_Interface is
function getpid return pid_t;
pragma Import (C, getpid, "getpid");
 
+   -
+   -- LWP --
+   -
+
+   function lwp_self return System.Address;
+   --  lwp_self does not exist on this thread library, revert to pthread_self
+   --  which is the closest approximation (with getpid). This function is
+   --  needed to share 7staprop.adb across POSIX-like targets.
+   pragma Import (C, lwp_self, "pthread_self");
+
-
-- Threads --
-


Fix PR ada/49944

2015-12-06 Thread Eric Botcazou
The fix was posted at https://gcc.gnu.org/ml/gcc-patches/2011-08/msg00594.html

Applied on all active branches.


2015-12-06  Ludovic Brenta  

PR ada/49944
* s-osinte-freebsd.ads: Minor reformatting.
(Stack_Base_Available): Correct comments.
* s-osinte-kfreebsd-gnu.ads (Time_Slice_Supported, nanosleep,
clock_id_t, clock_gettime, Stack_Base_Available, Get_Page_Size,
mprotect, pthread_mutexattr_setprotocol,pthread_mutexattr_getprotocol
pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling,
pthread_attr_setscope, pthread_attr_getscope,
pthread_attr_setinheritsched, pthread_attr_getinheritsched,
Time_Slice_Supported): Copy from s-osinte-freebsd.ads.
* gcc-interface/Makefile.in (x86/kfreebsd): Use the POSIX version of
the System.Task_Primitives.Operations package.

-- 
Eric BotcazouIndex: gcc-interface/Makefile.in
===
--- gcc-interface/Makefile.in	(revision 231318)
+++ gcc-interface/Makefile.in	(working copy)
@@ -1398,9 +1398,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%
   s-osinte.adb

[gomp4] Fix Fortran deviceptr

2015-12-06 Thread James Norris

Hi,

This patch fixes a some runtime issues when dealing with
the deviceptr clause in Fortran. There were some corner
cases that were not being dealt with correctly, and the
patch resolves these. Also a new set of test cases has
been added.

I've applied this patch to gomp-4_0-branch.

Jim
diff --git a/libgomp/ChangeLog.gomp b/libgomp/ChangeLog.gomp
index a2f1c31..791aa4c 100644
--- a/libgomp/ChangeLog.gomp
+++ b/libgomp/ChangeLog.gomp
@@ -1,3 +1,10 @@
+2015-12-06  James Norris  
+
+	* oacc-parallel.c (GOACC_parallel_keyed, GOACC_data_start):
+	Handle Fortran deviceptr clause combination.
+	* testsuite/libgomp.oacc-fortran/deviceptr-1.f90: New test.
+	* testsuite/libgomp.oacc-fortran/declare-1.f90: Remove erroneous test.
+
 2015-12-05  Chung-Lin Tang  
 
 	* oacc-plugin.h (GOMP_PLUGIN_async_unmap_vars): Add int parameter.
diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index a4b2c01..a606152 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -99,18 +99,37 @@ GOACC_parallel_keyed (int device, void (*fn) (void *),
   thr = goacc_thread ();
   acc_dev = thr->dev;
 
-  for (i = 0; i < (signed)(mapnum - 1); i++)
+  for (i = 0; i < mapnum; i++)
 {
   unsigned short kind1 = kinds[i] & 0xff;
-  unsigned short kind2 = kinds[i+1] & 0xff;
 
   /* Handle Fortran deviceptr clause.  */
-  if ((kind1 == GOMP_MAP_FORCE_DEVICEPTR && kind2 == GOMP_MAP_POINTER)
-	   && (sizes[i + 1] == 0)
-	   && (hostaddrs[i] == *(void **)hostaddrs[i + 1]))
+  if (kind1 == GOMP_MAP_FORCE_DEVICEPTR)
 	{
-	  kinds[i+1] = kinds[i];
-	  sizes[i+1] = sizeof (void *);
+	  unsigned short kind2;
+
+	  if (i < (signed)mapnum - 1)
+	kind2 = kinds[i + 1] & 0xff;
+	  else
+	kind2 = 0x;
+
+	  if (sizes[i] == sizeof (void *))
+	continue;
+
+	  /* At this point, we're dealing with a Fortran deviceptr.
+	 If the next element is not what we're expecting, then
+	 this is an instance of where the deviceptr variable was
+	 not used within the region and the pointer was removed
+	 by the gimplifier.  */
+	  if (kind2 == GOMP_MAP_POINTER
+	  && sizes[i + 1] == 0
+	  && hostaddrs[i] == *(void **)hostaddrs[i + 1])
+	{
+	  kinds[i+1] = kinds[i];
+	  sizes[i+1] = sizeof (void *);
+	}
+
+	  /* Invalidate the entry.  */
 	  hostaddrs[i] = NULL;
 	}
 }
@@ -254,18 +273,38 @@ GOACC_data_start (int device, size_t mapnum,
   struct goacc_thread *thr = goacc_thread ();
   struct gomp_device_descr *acc_dev = thr->dev;
 
-  for (i = 0; i < (signed)(mapnum - 1); i++)
+  for (i = 0; i < mapnum; i++)
 {
   unsigned short kind1 = kinds[i] & 0xff;
-  unsigned short kind2 = kinds[i+1] & 0xff;
 
   /* Handle Fortran deviceptr clause.  */
-  if ((kind1 == GOMP_MAP_FORCE_DEVICEPTR && kind2 == GOMP_MAP_POINTER)
-	   && (sizes[i + 1] == 0)
-	   && (hostaddrs[i] == *(void **)hostaddrs[i + 1]))
+  if (kind1 == GOMP_MAP_FORCE_DEVICEPTR)
 	{
-	  kinds[i+1] = kinds[i];
-	  sizes[i+1] = sizeof (void *);
+	  unsigned short kind2;
+
+	  if (i < (signed)mapnum - 1)
+	kind2 = kinds[i + 1] & 0xff;
+	  else
+	kind2 = 0x;
+
+	  /* If the size is right, skip it.  */
+	  if (sizes[i] == sizeof (void *))
+	continue;
+
+	  /* At this point, we're dealing with a Fortran deviceptr.
+	 If the next element is not what we're expecting, then
+	 this is an instance of where the deviceptr variable was
+	 not used within the region and the pointer was removed
+	 by the gimplifier.  */
+	  if (kind2 == GOMP_MAP_POINTER
+	  && sizes[i + 1] == 0
+	  && hostaddrs[i] == *(void **)hostaddrs[i + 1])
+	{
+	  kinds[i+1] = kinds[i];
+	  sizes[i+1] = sizeof (void *);
+	}
+
+	  /* Invalidate the entry.  */
 	  hostaddrs[i] = NULL;
 	}
 }
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
index 430cd24..e781878 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
@@ -1,6 +1,4 @@
 ! { dg-do run  { target openacc_nvidia_accel_selected } }
-! libgomp: cuStreamSynchronize error: an illegal memory access was encountered
-! { dg-xfail-run-if "TODO" { *-*-* } }
 
 module vars
   implicit none
@@ -8,24 +6,6 @@ module vars
   !$acc declare create (z)
 end module vars
 
-subroutine subr6 (a, d)
-  implicit none
-  integer, parameter :: N = 8
-  integer :: i
-  integer :: a(N)
-  !$acc declare deviceptr (a)
-  integer :: d(N)
-
-  i = 0
-
-  !$acc parallel copy (d)
-do i = 1, N
-  d(i) = a(i) + a(i)
-end do
-  !$acc end parallel
-
-end subroutine
-
 subroutine subr5 (a, b, c, d)
   implicit none
   integer, parameter :: N = 8
@@ -203,15 +183,6 @@ subroutine subr0 (a, b, c, d)
 if (d(i) .ne. 13) call abort
   end do
 
-  call subr6 (a, d)
-
-  call test (a, .true.)
-  call test (d, .false.)
-
-  do i = 1, N
-if (d(i) .ne. 16) call abort
-  end do
-
 end subroutine
 
 program mai

Fix PR ada/56274

2015-12-06 Thread Eric Botcazou
This just mimics what's done on FreeBSD.

Applied on all active branches.


2015-12-06  Eric Botcazou  

PR ada/56274
* s-osinte-kfreebsd-gnu.ads (pthread_rwlock_t): New subtype.
(pthread_rwlockattr_t): Likewise.

-- 
Eric BotcazouIndex: s-osinte-kfreebsd-gnu.ads
===
--- s-osinte-kfreebsd-gnu.ads	(revision 231333)
+++ s-osinte-kfreebsd-gnu.ads	(working copy)
@@ -292,6 +292,14 @@ package System.OS_Interface is
PTHREAD_SCOPE_PROCESS : constant := 0;
PTHREAD_SCOPE_SYSTEM  : constant := 2;
 
+   --  Read/Write lock not supported on kfreebsd. To add support both types
+   --  pthread_rwlock_t and pthread_rwlockattr_t must properly be defined
+   --  with the associated routines pthread_rwlock_[init/destroy] and
+   --  pthread_rwlock_[rdlock/wrlock/unlock].
+
+   subtype pthread_rwlock_t is pthread_mutex_t;
+   subtype pthread_rwlockattr_t is pthread_mutexattr_t;
+
---
-- Stack --
---


RE: Add support for CLZERO ISA

2015-12-06 Thread Kumar, Venkataramanan
Hi  Uros,


> -Original Message-
> From: Stepanyan, Victoria
> Sent: Thursday, November 26, 2015 1:43 AM
> To: Uros Bizjak; gcc-patches@gcc.gnu.org
> Cc: Kumar, Venkataramanan
> Subject: RE: Add support for CLZERO ISA
> 
> Thank you for the feedback, PFA fixed patch.
> 
> Victoria
> 
> 
> -Original Message-
> From: Uros Bizjak [mailto:ubiz...@gmail.com]
> Sent: Wednesday, November 25, 2015 11:32
> To: gcc-patches@gcc.gnu.org
> Cc: Stepanyan, Victoria; Kumar, Venkataramanan
> Subject: Re: Add support for CLZERO ISA
> 
> Hello!
> 
> > 2015-11-25 Victoria Stepanyan  
> >
> > * common/config/i386/i386-common.c
> > (OPTION_MASK_ISA_CLZERO_SET): New.
> > (ix86_handle_option): Handle clzero.
> >* config.gcc (i[34567]86-*-*): Add clzerointrin.h,
> > (x86_64-*-*): Likewise.
> > * config/i386/clzerointrin.h: New header.
> > * config/i386/cpuid.h (bit_CLZERO):  Define.
> > * config/i386/driver-i386.c (host_detect_local_cpu): Detect
> > CLZERO support.
> >* config/i386/i386.opt (clzero): New.
> >* config/i386/i386-c.c: Define __CLZERO__ if needed.
> > * config/i386/i386.c (ix86_target_string): Define -mclzero option.
> > (PTA_CLZERO): New.
> > (ix86_option_override_internal): Handle new option.
> > (processor_alias_table): Added PTA_CLZERO.
> > (ix86_valid_target_attribute_inner_p): Add OPT_mclzero.
> > (ix86_builtins): Add IX86_BUILTIN_CLZERO, IX86_BUILTIN_CLZERO.
> > (ix86_expand_builtin): Handle IX86_BUILTIN_CLZERO and
> > IX86_BUILTIN_CLZERO  built-ins.
> > * config/i386/i386.h (TARGET_CLZERO):  New.
> > * config/i386/i386.md (unspecv): Add UNSPEC_CLZERO.
> > (clzero):  New pattern.
> > (clzero_): New pattern.
> > * config/i386/x86intrin.h: Include clzerointrin.h.
> >* doc/extend.texi: Document clzero builtins.
> >* doc/invoke.texi: Document -mclzero option.
> >
> > gcc/testsuite/ChangeLog:
> >
> > 2015-11-25 Victoria Stepanyan  
> >
> > * gcc.target/i386/clzero.c: New.
> > * gcc.target/i386/sse-12.c: Add -mclzero.
> > * gcc.target/i386/sse-13.c: Ditto.
> > * gcc.target/i386/sse-14.c: Ditto.
> > * gcc.target/i386/sse-22.c: Ditto.
> > * gcc.target/i386/sse-23.c: Ditto.
> > * g++.dg/other/i386-2.C: Ditto.
> > * g++.dg/other/i386-3.C: Ditto.
> >
> > Ok for trunk ?
> 
> OK for mainline SVN with a few issues, mentioned below fixed.

Up streamed the patch on behalf of Victoria. 
https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=revision&revision=231340

Regards,
Venkat.

> 
> @@ -5902,6 +5905,7 @@
>  IX86_ATTR_ISA ("clwb", OPT_mclwb),
>  IX86_ATTR_ISA ("pcommit", OPT_mpcommit),
>  IX86_ATTR_ISA ("mwaitx", OPT_mmwaitx),
> +IX86_ATTR_ISA ("clzero",OPT_mclzero),
> 
> Please use tab instead of spaces before OPT_mclzero.
> 
> @@ -116,8 +116,8 @@
>  #define TARGET_SHA_P(x) TARGET_ISA_SHA_P(x)  #define
> TARGET_CLFLUSHOPT TARGET_ISA_CLFLUSHOPT  #define
> TARGET_CLFLUSHOPT_P(x) TARGET_ISA_CLFLUSHOPT_P(x) -#define
> TARGET_CLZERO TARGET_ISA_CLZERO -#define TARGET_CLZERO_P(x)
> TARGET_ISA_CLZERO_P(x)
> +#define TARGET_CLZERO   TARGET_ISA_CLZERO
> +#define TARGET_CLZERO_P(x)  TARGET_ISA_CLZERO_P(x)
>  #define TARGET_XSAVEC TARGET_ISA_XSAVEC  #define
> TARGET_XSAVEC_P(x) TARGET_ISA_XSAVEC_P(x)  #define TARGET_XSAVES
> TARGET_ISA_XSAVES
> 
> Unwanted change.
> 
> +;; CLZERO
> +(define_insn "clzero_"
> +  [(unspec_volatile [(match_operand:P 0 "register_operand" "a")]
> +   UNSPECV_CLZERO)]
> +  "TARGET_CLZERO"
> +  "clzero"
> +  [(set_attr "memory" "unknown")])
> +
> 
> Please also add (probably invariant) "length" attribute, see e.g. mwaitx insn.
> 
> @@ -310,7 +310,7 @@
>  -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style}
> @gol  -fasan-shadow-offset=@var{number} -fsanitize-
> sections=@var{s1},@var{s2},... @gol  -fsanitize-undefined-trap-on-error
> @gol --fcheck-pointer-bounds -fchecking -fchkp-check-incomplete-type
> @gol
> +-fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
>  -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol  -fchkp-
> narrow-to-innermost-array -fchkp-optimize @gol  -fchkp-use-fast-string-
> functions -fchkp-use-nochk-string-functions @gol
> 
> Unwanted change.
> 
> @@ -6145,12 +6145,6 @@
>  functions for controlling the Pointer Bounds Checker.  @xref{Pointer
> Bounds Checker builtins}, for more information.
> 
> -@item -fchecking
> -@opindex fchecking
> -@opindex fno-checking
> -Enable internal consistency checking.  The default depends on -the compiler
> configuration.
> -
>  @item -fchkp-check-incomplete-type
>  @opindex fchkp-check-incomplete-type
>  @opindex fno-chkp-check-incomplete-type
> 
> Unwanted change.
> 
> Thanks,
> Uros.


Re: -fstrict-aliasing fixes 5/6: make type system independent of flag_strict_aliasing

2015-12-06 Thread Eric Botcazou
> Bootstrapped/regtested x86_64-linux and also lto-bootstraped. Looks OK?
> 
>   * alias.c (alias_set_subset_of, alias_sets_conflict_p,
>   objects_must_conflict_p): Short circuit for !flag_strict_aliasing
>   (get_alias_set): Remove flag_strict_aliasing check.
>   (new_alias_set): Likewise.

Not clear whether it's this patch specifically or another one in the series, 
but the compiler now hangs on simple Ada code it used to compile instantly.

A couple of testcases is attached.  It looks like the compiler is now stuck in 
get_alias_set endlessly pushing references onto a vector.

-- 
Eric Botcazoupackage Access1 is

   type R;
   type S is access R;
   type R is new S;

end Access1;
package Access2 is

type Priv;
type Inc is access Priv;
type Priv is access Inc;
C : constant Priv := new Inc;

end Access2;


Fix PR ada/50048

2015-12-06 Thread Eric Botcazou
Tested on x86_64-suse-linux, applied on the mainline.


2015-12-06  Eric Botcazou  

PR ada/50048
* Makefile.in (ftop_srcdir): New variable.
(INCLUDES_FOR_SUBDIR): Use -iquote and $(ftop_srcdir).


2015-12-06  Eric Botcazou  

PR ada/50048
* gcc-interface/Makefile.in (INCLUDES): Use -iquote.

-- 
Eric BotcazouIndex: gcc/ada/gcc-interface/Makefile.in
===
--- gcc/ada/gcc-interface/Makefile.in	(revision 231333)
+++ gcc/ada/gcc-interface/Makefile.in	(working copy)
@@ -257,7 +257,8 @@ TOOLS_LIBS += @NO_PIE_FLAG@
 # Both . and srcdir are used, in that order,
 # so that tm.h and config.h will be found in the compilation
 # subdirectory rather than in the source directory.
-INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(ftop_srcdir)/include $(GMPINC)
+INCLUDES = -iquote . -iquote .. -iquote $(srcdir)/ada -iquote $(srcdir) \
+	   -I $(ftop_srcdir)/include $(GMPINC)
 
 ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
 
Index: gnattools/Makefile.in
===
--- gnattools/Makefile.in	(revision 231318)
+++ gnattools/Makefile.in	(working copy)
@@ -57,12 +57,16 @@ ADAFLAGS= -gnatpg -gnata
 # For finding the GCC build dir, which is used far too much
 GCC_DIR=../gcc
 
+# Full path to top source directory
+ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND})
+
 # Absolute srcdir for gcc (why do we want absolute?  I dunno)
 fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND})
 
 # Useful "subroutines" for the excess includes
-INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -I$(fsrcdir)/ada -I$(fsrcdir)/config \
-	-I$(fsrcdir)/../include -I$(fsrcdir)
+INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
+		  -iquote $(fsrcdir)/ada -iquote $(fsrcdir)/config \
+		  -iquote $(fsrcdir) -I$(ftop_srcdir)/include
 ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
 
 CXX_LFLAGS = \


Re: [PATCH] New version of libmpx with new memmove wrapper

2015-12-06 Thread Aleksandra Tsvetkova
Fixed all.
Now there are no new fails on spec2000
diff --git a/gcc/testsuite/gcc.target/i386/mpx/memmove.c 
b/gcc/testsuite/gcc.target/i386/mpx/memmove.c
new file mode 100755
index 000..57030a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/memmove.c
@@ -0,0 +1,119 @@
+/* { dg-do run } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
+
+
+#include 
+#include 
+#include 
+#include 
+#include "mpx-check.h"
+
+#ifdef __i386__
+/* i386 directory size is 4MB.  */
+#define MPX_NUM_L2_BITS 10
+#define MPX_NUM_IGN_BITS 2
+#else /* __i386__ */
+/* x86_64 directory size is 2GB.  */
+#define MPX_NUM_L2_BITS 17
+#define MPX_NUM_IGN_BITS 3
+#endif /* !__i386__ */
+
+
+/* bt_num_of_elems is the number of elements in bounds table.  */
+unsigned long bt_num_of_elems = (1UL << MPX_NUM_L2_BITS);
+/* Function to test MPX wrapper of memmove function.
+   src_bigger_dst determines which address is bigger, can be 0 or 1.
+   src_bt_index and dst_bt index are bt_indexes
+   from the beginning of the page.
+   bd_index_end is the bd index of the last element of src if we define
+   bd index of the first element as 0.
+   src_bt index_end is bt index of the last element of src.
+   pointers inside determines if array being copied includes pointers
+   src_align and dst_align are alignments of src and dst.
+   Arrays may contain unaligned pointers.  */
+int
+test (int src_bigger_dst, int src_bt_index, int dst_bt_index,
+  int bd_index_end, int src_bt_index_end, int pointers_inside,
+  int src_align, int dst_align)
+{
+  const int n =
+src_bt_index_end - src_bt_index + bd_index_end * bt_num_of_elems;
+  if (n < 0)
+{
+  return 0;
+}
+  const int num_of_pointers = (bd_index_end + 2) * bt_num_of_elems;
+  void **arr = 0;
+  posix_memalign ((void **) (&arr),
+   1UL << (MPX_NUM_L2_BITS + MPX_NUM_IGN_BITS),
+   num_of_pointers * sizeof (void *));
+  void **src = arr, **dst = arr;
+  if ((src_bigger_dst) && (src_bt_index < dst_bt_index))
+src_bt_index += bt_num_of_elems;
+  if (!(src_bigger_dst) && (src_bt_index > dst_bt_index))
+dst_bt_index += bt_num_of_elems;
+  src += src_bt_index;
+  dst += dst_bt_index;
+  char *realign = (char *) src;
+  realign += src_align;
+  src = (void **) realign;
+  realign = (char *) dst;
+  realign += src_align;
+  dst = (void **) realign;
+  if (pointers_inside)
+{
+  for (int i = 0; i < n; i++)
+src[i] = __bnd_set_ptr_bounds (arr + i, i * sizeof (void *) + 1);
+}
+  memmove (dst, src, n * sizeof (void *));
+  if (pointers_inside)
+{
+  for (int i = 0; i < n; i++)
+{
+  if (dst[i] != arr + i)
+abort ();
+  if (__bnd_get_ptr_lbound (dst[i]) != arr + i)
+abort ();
+  if (__bnd_get_ptr_ubound (dst[i]) != arr + 2 * i)
+abort ();
+}
+}
+  free (arr);
+  return 0;
+}
+
+/* Call testall to test common cases of memmove for MPX.  */
+void
+testall ()
+{
+  int align[3];
+  align[0] = 0;
+  align[1] = 1;
+  align[2] = 7;
+  for (int pointers_inside = 0; pointers_inside < 2; pointers_inside++)
+for (int src_bigger_dst = 0; src_bigger_dst < 2; src_bigger_dst++)
+  for (int src_align = 0; src_align < 3; src_align ++)
+for (int dst_align = 0; dst_align < 3; dst_align ++)
+  for (int pages = 0; pages < 4; pages++)
+{
+  test (src_bigger_dst, 1, 2, pages, 1, pointers_inside,
+align[src_align], align[dst_align]);
+  test (src_bigger_dst, 1, 2, pages, 2, pointers_inside,
+align[src_align], align[dst_align]);
+  test (src_bigger_dst, 2, 1, pages, 12, pointers_inside,
+align[src_align], align[dst_align]);
+  test (src_bigger_dst, 2, 1, pages, 1, pointers_inside,
+align[src_align], align[dst_align]);
+  test (src_bigger_dst, 2, 3, pages, 12, pointers_inside,
+align[src_align], align[dst_align]);
+  test (src_bigger_dst, 1, bt_num_of_elems - 2, pages, 2,
+pointers_inside, align[src_align], align[dst_align]);
+}
+};
+
+int
+mpx_test (int argc, const char **argv)
+{
+  testall ();
+  return 0;
+}
diff --git a/libmpx/Makefile.in b/libmpx/Makefile.in
index ff36a7f..d644af3 100644
--- a/libmpx/Makefile.in
+++ b/libmpx/Makefile.in
@@ -228,7 +228,6 @@ install_sh = @install_sh@
 libdir = @libdir@
 libexecdir = @libexecdir@
 link_libmpx = @link_libmpx@
-link_mpx = @link_mpx@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
diff --git a/libmpx/mpxrt/Makefile.am b/libmpx/mpxrt/Makefile.am
old mode 100644
new mode 100755
index a00a808..3280b62
--- a/libmpx/mpxrt/Makefile.am
+++ b/libmpx/mpxrt/Makefile.am
@@ -13,7 +13,8 @@ libmpx_la_SOURCES = mpxrt.c mpxrt-utils.c
 
 libmpx_la_CFLAGS = -fPIC
 libmpx_la_DEPENDENCIES = libmpx.map
-libmpx_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libmpx.map $(link_libmpx)

[PATCH] Fix Fortran deviceptr clause.

2015-12-06 Thread James Norris

Hi,

Attached is a patch that fixes some runtime issues dealing
with the deviceptr clause in Fortran. There were some
corner cases that were not being dealt with correctly,
e.g., specifying the deviceptr clause and not using
the variable specified by the deviceptr clause within
the associated region. Also a new set of test cases
has been added.

Regtested on x86_64-pc-linux-gnu

Ok for trunk?

Thanks!
Jim
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index cde0b5c..df26e7c 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-XX  James Norris  
+
+	* oacc-parallel.c (GOACC_parallel_keyed, GOACC_data_start):
+	Handle Fortran deviceptr clause combination.
+	* testsuite/libgomp.oacc-fortran/deviceptr-1.f90: New test.
+	* testsuite/libgomp.oacc-fortran/declare-1.f90: Remove erroneous test.
+
 2015-12-02  Thomas Schwinge  
 
 	* testsuite/libgomp.oacc-c-c++-common/host_data-2.c: Restrict to
diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index db7cab3..bf8cbfe 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -88,6 +88,42 @@ GOACC_parallel_keyed (int device, void (*fn) (void *),
   thr = goacc_thread ();
   acc_dev = thr->dev;
 
+  for (i = 0; i < mapnum; i++)
+{
+  unsigned short kind1 = kinds[i] & 0xff;
+
+  /* Handle Fortran deviceptr clause.  */
+  if (kind1 == GOMP_MAP_FORCE_DEVICEPTR)
+	{
+	  unsigned short kind2;
+
+	  if (i < (signed)mapnum - 1)
+	kind2 = kinds[i + 1] & 0xff;
+	  else
+	kind2 = 0x;
+
+	  /* If the size is right, skip it.  */
+	  if (sizes[i] == sizeof (void *))
+	continue;
+
+	  /* At this point, we're dealing with a Fortran deviceptr.
+	 If the next element is not what we're expecting, then
+	 this is an instance of where the deviceptr variable was
+	 not used within the region and the pointer was removed
+	 by the gimplifier.  */
+	  if (kind2 == GOMP_MAP_POINTER
+	  && sizes[i + 1] == 0
+	  && hostaddrs[i] == *(void **)hostaddrs[i + 1])
+	{
+	  kinds[i+1] = kinds[i];
+	  sizes[i+1] = sizeof (void *);
+	}
+
+	  /* Invalidate the entry.  */
+	  hostaddrs[i] = NULL;
+	}
+}
+
   /* Host fallback if "if" clause is false or if the current device is set to
  the host.  */
   if (host_fallback)
@@ -172,8 +208,13 @@ GOACC_parallel_keyed (int device, void (*fn) (void *),
 
   devaddrs = gomp_alloca (sizeof (void *) * mapnum);
   for (i = 0; i < mapnum; i++)
-devaddrs[i] = (void *) (tgt->list[i].key->tgt->tgt_start
-			+ tgt->list[i].key->tgt_offset);
+{
+  if (tgt->list[i].key != NULL)
+	devaddrs[i] = (void *) (tgt->list[i].key->tgt->tgt_start
++ tgt->list[i].key->tgt_offset);
+  else
+	devaddrs[i] = NULL;
+}
 
   acc_dev->openacc.exec_func (tgt_fn, mapnum, hostaddrs, devaddrs,
 			  async, dims, tgt);
@@ -210,6 +251,7 @@ GOACC_data_start (int device, size_t mapnum,
 {
   bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
   struct target_mem_desc *tgt;
+  int i;
 
 #ifdef HAVE_INTTYPES_H
   gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, size=%p, kinds=%p\n",
@@ -224,6 +266,42 @@ GOACC_data_start (int device, size_t mapnum,
   struct goacc_thread *thr = goacc_thread ();
   struct gomp_device_descr *acc_dev = thr->dev;
 
+  for (i = 0; i < mapnum; i++)
+{
+  unsigned short kind1 = kinds[i] & 0xff;
+
+  /* Handle Fortran deviceptr clause.  */
+  if (kind1 == GOMP_MAP_FORCE_DEVICEPTR)
+	{
+	  unsigned short kind2;
+
+	  if (i < (signed)mapnum - 1)
+	kind2 = kinds[i + 1] & 0xff;
+	  else
+	kind2 = 0x;
+
+	  /* If the size is right, skip it.  */
+	  if (sizes[i] == sizeof (void *))
+	continue;
+
+	  /* At this point, we're dealing with a Fortran deviceptr.
+	 If the next element is not what we're expecting, then
+	 this is an instance of where the deviceptr variable was
+	 not used within the region and the pointer was removed
+	 by the gimplifier.  */
+	  if (kind2 == GOMP_MAP_POINTER
+	  && sizes[i + 1] == 0
+	  && hostaddrs[i] == *(void **)hostaddrs[i + 1])
+	{
+	  kinds[i+1] = kinds[i];
+	  sizes[i+1] = sizeof (void *);
+	}
+
+	  /* Invalidate the entry.  */
+	  hostaddrs[i] = NULL;
+	}
+}
+
   /* Host fallback or 'do nothing'.  */
   if ((acc_dev->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
   || host_fallback)
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
index f717d1b..151f409 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
@@ -6,24 +6,6 @@ module vars
   !$acc declare create (z)
 end module vars
 
-subroutine subr6 (a, d)
-  implicit none
-  integer, parameter :: N = 8
-  integer :: i
-  integer :: a(N)
-  !$acc declare deviceptr (a)
-  integer :: d(N)
-
-  i = 0
-
-  !$acc parallel copy (d)
-do i = 1, N
-  d(i) = a(i) + a(i)
-end do
-  !$acc end parallel
-
-end 

[Fortran, Patch] Memory sync after coarray image control statements and assignment

2015-12-06 Thread Alessandro Fanfarillo
Dear all,

currently, a coarray assignment in a program composed by a single
segment (without any sync statements) produces wrong results.
Furthermore, a coarray code
compiled with an optimization flag higher that -O0 may produce wrong
results. The patch (re)introduces a __sync_synchronize() after coarray
image control statements (sync all, sync images, critical, locks and
events) and get/put.

The attached patch fixes the problems reported by Deepak in the
following discussion:
https://gcc.gnu.org/ml/fortran/2015-04/msg00062.html.

Built and regtested on x86_64-pc-linux-gnu.


PS: Adding the __sync_synchronize() after get/put and sync statements
fix all the problems reported by Deepak. I do the same also for locks,
critical and events. Suggestions are warmly welcome.
commit 75c93d3085116748115c8f69ad5ad58f4ad9369c
Author: Alessandro Fanfarillo 
Date:   Sun Dec 6 18:50:51 2015 +0100

Introducing __sync_synchronize() after image control statements, send and 
get

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ba176a1..b450fae 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+2015-12-06  Alessandro Fanfarillo 
+
+   * trans.c (gfc_allocate_using_lib,gfc_deallocate_with_status):
+   Introducing __sync_synchronize() after image control statements.
+   * trans-stmt.c (gfc_trans_sync,gfc_trans_event_post_wait,
+   gfc_trans_lock_unlock): Ditto.
+   * trans-intrinsic.c (gfc_conv_intrinsic_caf_get,
+   conv_caf_send): Introducing __sync_synchronize() after send,
+   get and sendget.
+
 2015-12-05  Paul Thomas  
 
PR fortran/68676
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 21efe44..07795ca 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1222,6 +1222,12 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, 
tree lhs, tree lhs_kind,
   se->expr = res_var;
   if (array_expr->ts.type == BT_CHARACTER)
 se->string_length = argse.string_length;
+
+  /* It guarantees memory consistency within the same segment */
+  tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
+  tmp = build_call_expr_loc (input_location, tmp, 0);
+  gfc_add_expr_to_block (&se->pre, tmp);
+
 }
 
 
@@ -1390,6 +1396,12 @@ conv_caf_send (gfc_code *code) {
   gfc_add_expr_to_block (&block, tmp);
   gfc_add_block_to_block (&block, &lhs_se.post);
   gfc_add_block_to_block (&block, &rhs_se.post);
+
+  /* It guarantees memory consistency within the same segment */
+  tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
+  tmp = build_call_expr_loc (input_location, tmp, 0);
+  gfc_add_expr_to_block (&block, tmp);
+
   return gfc_finish_block (&block);
 }
 
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 3df483a..b1de0f5 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -818,6 +818,11 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op)
   errmsg, errmsg_len);
   gfc_add_expr_to_block (&se.pre, tmp);
 
+  /* It guarantees memory consistency within the same segment */
+  tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
+  tmp = build_call_expr_loc (input_location, tmp, 0);
+  gfc_add_expr_to_block (&se.pre, tmp);
+
   if (stat2 != NULL_TREE)
gfc_add_modify (&se.pre, stat2,
fold_convert (TREE_TYPE (stat2), stat));
@@ -995,6 +1000,11 @@ gfc_trans_event_post_wait (gfc_code *code, gfc_exec_op op)
   errmsg, errmsg_len);
   gfc_add_expr_to_block (&se.pre, tmp);
 
+  /* It guarantees memory consistency within the same segment */
+  tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
+  tmp = build_call_expr_loc (input_location, tmp, 0);
+  gfc_add_expr_to_block (&se.pre, tmp);
+
   if (stat2 != NULL_TREE)
 gfc_add_modify (&se.pre, stat2, fold_convert (TREE_TYPE (stat2), stat));
 
@@ -1080,6 +1090,15 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
   fold_convert (integer_type_node, images));
 }
 
+  /* Per F2008, 8.5.1, a SYNC MEMORY is implied by calling the
+ image control statements SYNC IMAGES and SYNC ALL.  */
+  if (flag_coarray == GFC_FCOARRAY_LIB)
+{
+  tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
+  tmp = build_call_expr_loc (input_location, tmp, 0);
+  gfc_add_expr_to_block (&se.pre, tmp);
+}
+  
   if (flag_coarray != GFC_FCOARRAY_LIB)
 {
   /* Set STAT to zero.  */
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 001db41..e7803bd 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -746,6 +746,11 @@ gfc_allocate_using_lib (stmtblock_t * block, tree pointer, 
tree size,
 TREE_TYPE (pointer), pointer,
 fold_convert ( TREE_TYPE (pointer), tmp));
   gfc_add_expr_to_block (block, tmp);
+
+  /* It guarantees memory consistency within the same segment */
+  t

[BUILDROBOT] "error: null argument where non-null required" on multiple targets

2015-12-06 Thread Jan-Benedict Glaw
Hi!

I'm not 100% sure, but I *think* that this patch

2015-11-15  Jonathan Wakely  

PR libstdc++/68353
* include/bits/basic_string.h: Test value of 
_GLIBCXX_USE_C99_WCHAR
not whether it is defined.
* include/ext/vstring.h: Likewise.

uncovered errors like this:

/---
| g++ -fno-PIE -c  -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -g -O2 -DIN_GCC  
-DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti 
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings 
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic 
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common 
 -DHAVE_CONFIG_H -I. -Ic-family -I../../../gcc/gcc -I../../../gcc/gcc/c-family 
-I../../../gcc/gcc/../include -I../../../gcc/gcc/../libcpp/include 
-I/opt/cfarm/mpc/include  -I../../../gcc/gcc/../libdecnumber 
-I../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
-I../../../gcc/gcc/../libbacktrace   -o c-family/c-common.o -MT 
c-family/c-common.o -MMD -MP -MF c-family/.deps/c-common.TPo 
../../../gcc/gcc/c-family/c-common.c
| In file included from ../../../gcc/gcc/c-family/c-common.c:31:0:
| ../../../gcc/gcc/c-family/c-common.c: In function ‘void 
c_common_nodes_and_builtins()’:
| ../../../gcc/gcc/stringpool.h:39:53: error: null argument where non-null 
required (argument 1) [-Werror=nonnull]
|  ? get_identifier_with_length ((str), strlen (str))  \
|  ^
| 
| ../../../gcc/gcc/c-family/c-common.c:5501:22: note: in expansion of macro 
‘get_identifier’
|char32_type_node = get_identifier (CHAR32_TYPE);
|   ^~
| 
| cc1plus: all warnings being treated as errors
| Makefile:1085: recipe for target 'c-family/c-common.o' failed
\---

Shows up when using a newly build compiler to build the
contrib/config-list.mk targets. So these targets probably need some
small touch-ups.

avr-rtems   
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478544
mipsel-elf  
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478844
mipsisa64r2-sde-elf 
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478855
mipsisa64sb1-elf
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478865
mips-rtems  
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478877
powerpc-eabialtivec 
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478922
powerpc-eabispe 
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478932
powerpc-rtems   
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478956
ppc-elf 
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=478968
sh-superh-elf   
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=479077

MfG, JBG

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
 Signature of:Don't believe in miracles: Rely on them!
 the second  :


signature.asc
Description: Digital signature


[patch] remove WCHAR_TYPE definition for FreeBSD PowerPC64

2015-12-06 Thread Andreas Tobler

Hi,

I'm going to commit this patch to trunk, 5.4 and 4.9 branch if there are 
no objections.


The redefinition of WCHAR_TYPE for PowerPC64 is wrong since its 
beginning. My fault.


We use the definition from freebsd.h.

Thanks,
Andreas

2015-12-06  Andreas Tobler  

* config/rs6000/freebsd64.h: Remove the redefinition of WCHAR_TYPE.

Index: freebsd64.h
===
--- freebsd64.h (revision 231129)
+++ freebsd64.h (working copy)
@@ -316,8 +316,6 @@
 #define PTRDIFF_TYPE   (TARGET_64BIT ? "long int" : "int")

 /* rs6000.h gets this wrong for FreeBSD.  We use the GCC defaults 
instead.  */

-#undef WCHAR_TYPE
-#defineWCHAR_TYPE  (TARGET_64BIT ? "int" : "long int")
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32



[BUILDROBOT] ./insn-flags.h:342:7: error: ‘operands’ was not declared in this scope (was: Add an rsqrt_optab and IFN_RSQRT internal function)

2015-12-06 Thread Jan-Benedict Glaw
On Thu, 2015-12-03 09:21:03 +, Richard Sandiford 
 wrote:
> All current uses of builtin_reciprocal convert 1.0/sqrt into rsqrt.
> This patch adds an rsqrt optab and associated internal function for
> that instead.  We can then pick up the vector forms of rsqrt automatically,
> fixing an AArch64 regression from my internal_fn patches.
[...]
> Two other ports define rsqrt patterns: sh and v850.  AFAICT these
> patterns aren't currently used, but I think the patch does what the
> authors of the patterns would have expected.  There's obviously some
> risk of fallout though.

shle-linux breaks with:

g++ -fno-PIE -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing 
-Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual 
-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings 
-fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. 
-I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include  
-I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd 
-I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o insn-opinit.o -MT 
insn-opinit.o -MMD -MP -MF ./.deps/insn-opinit.TPo insn-opinit.c
In file included from ./tm.h:60:0,
 from ../../gcc/gcc/backend.h:28,
 from insn-opinit.c:7:
insn-opinit.c: In function ‘void init_all_optabs(target_optabs*)’:
./insn-flags.h:342:7: error: ‘operands’ was not declared in this scope
&& operands[1] == CONST1_RTX (SFmode))
   ^
insn-opinit.c:359:14: note: in expansion of macro ‘HAVE_rsqrtsf2’
   ena[137] = HAVE_rsqrtsf2;
  ^
make[2]: *** [insn-opinit.o] Error 1




See eg. build
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=479005 .

MfG, JBG

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
  Signature of:  Zensur im Internet? Nein danke!
  the second  :


signature.asc
Description: Digital signature


[patch committed SH] Fix build failure

2015-12-06 Thread Kaz Kojima
I've committed the patch below to fix a build failure after
rsqrt_optab changes applied.  Now rsqrtsf2 is expected to have
just 2 operands and HAVE_rsqrtsf2 should be simple enough.
Tested with build for sh4-unknown-linux-gnu and running
gcc.target/sh/sh4a-fsrra.c.

Regards,
kaz
--
2015-12-06  Kaz Kojima  

* config/sh/sh.md (rsqrtsf2): Adjust for canonical form with unspec.

diff --git a/config/sh/sh.md b/config/sh/sh.md
index 083febe..b6fe05c 100644
--- a/config/sh/sh.md
+++ b/config/sh/sh.md
@@ -13744,12 +13744,11 @@ label:
 
 (define_insn "rsqrtsf2"
   [(set (match_operand:SF 0 "fp_arith_reg_operand" "=f")
-   (div:SF (match_operand:SF 1 "immediate_operand" "i")
-   (sqrt:SF (match_operand:SF 2 "fp_arith_reg_operand" "0"
+   (unspec:SF [(match_operand:SF 1 "fp_arith_reg_operand" "0")]
+  UNSPEC_FSRRA))
(clobber (reg:SI FPSCR_STAT_REG))
(use (reg:SI FPSCR_MODES_REG))]
-  "TARGET_FPU_ANY && TARGET_FSRRA
-   && operands[1] == CONST1_RTX (SFmode)"
+  "TARGET_FPU_ANY && TARGET_FSRRA"
   "fsrra   %0"
   [(set_attr "type" "fsrra")
(set_attr "fp_mode" "single")])


Re: [BUILDROBOT] ./insn-flags.h:342:7: error: ‘operands’ was not declared in this scope

2015-12-06 Thread Kaz Kojima
Jan-Benedict Glaw  wrote:
> shle-linux breaks with:
> 
> g++ -fno-PIE -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   
> -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall 
> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute 
> -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros 
> -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc 
> -I../../gcc/gcc/. -I../../gcc/gcc/../include 
> -I../../gcc/gcc/../libcpp/include  -I../../gcc/gcc/../libdecnumber 
> -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
> -I../../gcc/gcc/../libbacktrace   -o insn-opinit.o -MT insn-opinit.o -MMD -MP 
> -MF ./.deps/insn-opinit.TPo insn-opinit.c
> In file included from ./tm.h:60:0,
>  from ../../gcc/gcc/backend.h:28,
>  from insn-opinit.c:7:
> insn-opinit.c: In function ‘void init_all_optabs(target_optabs*)’:
> ./insn-flags.h:342:7: error: ‘operands’ was not declared in this scope
> && operands[1] == CONST1_RTX (SFmode))
>^
> insn-opinit.c:359:14: note: in expansion of macro ‘HAVE_rsqrtsf2’
>ena[137] = HAVE_rsqrtsf2;
>   ^
> make[2]: *** [insn-opinit.o] Error 1

I've just committed a fix for this as revision 231343.

Regards,
kaz



C++ PATCHes to fix -std=c++1z regressions

2015-12-06 Thread Jason Merrill
Now that I can easily run the testsuite in -std=c++1z mode, I can see 
various testsuite failures with that flag.  This series of patches fixes 
those failures.


The first fixes various issues with 'auto' deduction: We were failing to 
diagnose various erroneous uses of auto, and crashing on the PR68597 
testcase.  Part of this patch moves the diagnosis of inconsistent 
deduction of auto out of do_auto_deduction and no longer uses the 
TREE_TYPE of the auto node at all.


The second fixes a few issues with handling of partial specialization 
with concepts.


The third fixes a few issues with C++1z generalized non-type template 
arguments.


The fourth fixes a crash on template/crash70.C, and also fixes more 
generally our handling of ::template where the template named is not a 
type, as in that testcase.  There is no good reason to use the template 
keyword there, but it is well-formed.


The fifth fixes handling of decltype-call1.C; since concepts tries to 
tentatively parse a concept-introduction, we now first see the decltype 
in that tentative context, fail that tentative parse, and then parse it 
again later, but in the later context we've forgotten about the access 
checks that were involved.  So this patch fixes CPP_DECLTYPE to carry 
the relevant access checks along with it, like CPP_TEMPLATE_ID.


The sixth fixes another issue related to tentative concept-introduction 
parsing, on parse/no-type-defn1.C: when we see "A" we call 
cp_parser_commit_to_tentative_parse when we see that we're parsing a 
class-head for B, even though it's an error.  Here we can bring in my 
tentative parsing firewall trick again that I previously used for 
statement-expressions and lambdas: if we push a committed tentative 
parse level, cp_parser_commit_to_tentative_parse won't mess with levels 
past that one.


And the last patch updates some tests that were wrong for C++1z mode.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 15009525339d14188d38b60b079bef8362a389ed
Author: Jason Merrill 
Date:   Wed Dec 2 16:51:02 2015 -0500

	PR c++/68597, fix auto9.C and auto-neg1.C with -std=c++1z.

	* decl.c (check_tag_decl): Use ds_type_spec in auto diagnostic.
	* typeck.c (check_return_expr): Check for inconsistent deduction.
	* parser.c (class type_id_in_expr_sentinel): New.
	(cp_parser_primary_expression) [RID_VA_ARG]: Use it.
	(cp_parser_new_expression): Use it.
	(cp_parser_trait_expr): Use it.
	(cp_parser_type_id_1): Complain about auto if in_type_id_in_expr_p.
	(cp_parser_default_type_template_argument): Check for auto.
	(cp_parser_type_id_list): Likewise.
	(cp_parser_simple_type_specifier): Allow auto parms if flag_concepts.
	* pt.c (do_auto_deduction): Handle erroneous type.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index e895c5a..0af7bd4 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4555,8 +4555,9 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
 permerror (input_location, "declaration does not declare anything");
   else if (declared_type != NULL_TREE && type_uses_auto (declared_type))
 {
-  error ("% can only be specified for variables "
-	 "or function declarations");
+  error_at (declspecs->locations[ds_type_spec],
+		"% can only be specified for variables "
+		"or function declarations");
   return error_mark_node;
 }
   /* Check for an anonymous union.  */
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index b28d17a9..85f6cc1 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -178,6 +178,22 @@ enum required_token {
   RT_TRANSACTION_CANCEL /* __transaction_cancel */
 };
 
+/* RAII wrapper for parser->in_type_id_in_expr_p, setting it on creation and
+   reverting it on destruction.  */
+
+class type_id_in_expr_sentinel
+{
+  cp_parser *parser;
+  bool saved;
+public:
+  type_id_in_expr_sentinel (cp_parser *parser, bool set = true)
+: parser (parser),
+  saved (parser->in_type_id_in_expr_p)
+  { parser->in_type_id_in_expr_p = set; }
+  ~type_id_in_expr_sentinel ()
+  { parser->in_type_id_in_expr_p = saved; }
+};
+
 /* Prototypes.  */
 
 static cp_lexer *cp_lexer_new_main
@@ -4888,7 +4904,10 @@ cp_parser_primary_expression (cp_parser *parser,
 	cp_parser_require (parser, CPP_COMMA, RT_COMMA);
 	type_location = cp_lexer_peek_token (parser->lexer)->location;
 	/* Parse the type-id.  */
-	type = cp_parser_type_id (parser);
+	{
+	  type_id_in_expr_sentinel s (parser);
+	  type = cp_parser_type_id (parser);
+	}
 	/* Look for the closing `)'.  */
 	location_t finish_loc
 	  = cp_lexer_peek_token (parser->lexer)->location;
@@ -7907,7 +7926,10 @@ cp_parser_new_expression (cp_parser* parser)
   /* Parse the type-id.  */
   parser->type_definition_forbidden_message
 	= G_("types may not be defined in a new-expression");
-  type = cp_parser_type_id (parser);
+  {
+	type_id_in_expr_sentinel s (parser);
+	type = cp_parser_type_id (parser);
+  }
   parser->

[PATCH] [C FE] Fold trivial exprs that refer to const vars

2015-12-06 Thread Patrick Palka
There is a minor inconsistency in the folding behavior within the C
frontend.  The C frontend does not currently fold the expression "x",
where x is a const int, yet the FE does fold the expression "x + 0".

This happens because decl_constant_value is called in c_fully_fold only
while recursing over the operands of the expression being folded, i.e.
there is no top-level call to decl_constant_value to handle the case
where the expression being folded happens to be a singular expression
such as "x", as opposed to "x + 5" (where x is a const variable).

To fix this inconsistency, this patch calls decl_constant_value in
c_fully fold after folding the given expression.

Bootstrap + regtest in progress on x86_64-pc-linux-gnu, OK to commit if
testing succeeds?

gcc/c/ChangeLog:

* c-fold.c (c_fully_fold): Call
decl_constant_value_for_optimization after folding
the given expression.
* c-typeck.c (digest_init): Remove redundant call to
decl_constant_value_for_optimization.

gcc/testsuite/ChangeLog:

* gcc.dg/fold-const-1.c: New test.
---
 gcc/c/c-fold.c  |  1 +
 gcc/c/c-typeck.c|  1 -
 gcc/testsuite/gcc.dg/fold-const-1.c | 23 +++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/fold-const-1.c

diff --git a/gcc/c/c-fold.c b/gcc/c/c-fold.c
index c554e17..ab0b37f 100644
--- a/gcc/c/c-fold.c
+++ b/gcc/c/c-fold.c
@@ -88,6 +88,7 @@ c_fully_fold (tree expr, bool in_init, bool *maybe_const)
 }
   ret = c_fully_fold_internal (expr, in_init, maybe_const,
   &maybe_const_itself, false);
+  ret = decl_constant_value_for_optimization (ret);
   if (eptype)
 ret = fold_convert_loc (loc, eptype, ret);
   *maybe_const &= maybe_const_itself;
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index b691072..4886fc2 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -6791,7 +6791,6 @@ digest_init (location_t init_loc, tree type, tree init, 
tree origtype,
   inside_init = TREE_OPERAND (inside_init, 0);
 }
   inside_init = c_fully_fold (inside_init, require_constant, &maybe_const);
-  inside_init = decl_constant_value_for_optimization (inside_init);
 
   /* Initialization of an array of chars from a string constant
  optionally enclosed in braces.  */
diff --git a/gcc/testsuite/gcc.dg/fold-const-1.c 
b/gcc/testsuite/gcc.dg/fold-const-1.c
new file mode 100644
index 000..9f043b8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-const-1.c
@@ -0,0 +1,23 @@
+/* { dg-options "-O -fdump-tree-gimple -fdump-tree-ccp1" } */
+
+extern void dummy (const void *);
+
+int
+f1 (void)
+{
+  const int x = 7;
+  dummy (&x);
+  return x;
+}
+
+void foo (int);
+
+void
+f2 (void)
+{
+  const int x = 7;
+  foo (x);
+}
+
+/* { dg-final { scan-tree-dump "foo \\(7\\);" "gimple" } } */
+/* { dg-final { scan-tree-dump-times "return 7;" 2 "ccp1" } } */
-- 
2.6.3.517.g5b116b4.dirty



Re: [PATCH] [C FE] Fold trivial exprs that refer to const vars

2015-12-06 Thread Patrick Palka
On Sun, Dec 6, 2015 at 11:50 PM, Patrick Palka  wrote:
> There is a minor inconsistency in the folding behavior within the C
> frontend.  The C frontend does not currently fold the expression "x",
> where x is a const int, yet the FE does fold the expression "x + 0".
>
> This happens because decl_constant_value is called in c_fully_fold only
> while recursing over the operands of the expression being folded, i.e.
> there is no top-level call to decl_constant_value to handle the case
> where the expression being folded happens to be a singular expression
> such as "x", as opposed to "x + 5" (where x is a const variable).
>
> To fix this inconsistency, this patch calls decl_constant_value in
> c_fully fold after folding the given expression.
>
> Bootstrap + regtest in progress on x86_64-pc-linux-gnu, OK to commit if
> testing succeeds?
>
> gcc/c/ChangeLog:
>
> * c-fold.c (c_fully_fold): Call
> decl_constant_value_for_optimization after folding
> the given expression.
> * c-typeck.c (digest_init): Remove redundant call to
> decl_constant_value_for_optimization.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/fold-const-1.c: New test.
> ---
>  gcc/c/c-fold.c  |  1 +
>  gcc/c/c-typeck.c|  1 -
>  gcc/testsuite/gcc.dg/fold-const-1.c | 23 +++
>  3 files changed, 24 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/gcc.dg/fold-const-1.c
>
> diff --git a/gcc/c/c-fold.c b/gcc/c/c-fold.c
> index c554e17..ab0b37f 100644
> --- a/gcc/c/c-fold.c
> +++ b/gcc/c/c-fold.c
> @@ -88,6 +88,7 @@ c_fully_fold (tree expr, bool in_init, bool *maybe_const)
>  }
>ret = c_fully_fold_internal (expr, in_init, maybe_const,
>&maybe_const_itself, false);
> +  ret = decl_constant_value_for_optimization (ret);
>if (eptype)
>  ret = fold_convert_loc (loc, eptype, ret);
>*maybe_const &= maybe_const_itself;
> diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
> index b691072..4886fc2 100644
> --- a/gcc/c/c-typeck.c
> +++ b/gcc/c/c-typeck.c
> @@ -6791,7 +6791,6 @@ digest_init (location_t init_loc, tree type, tree init, 
> tree origtype,
>inside_init = TREE_OPERAND (inside_init, 0);
>  }
>inside_init = c_fully_fold (inside_init, require_constant, &maybe_const);
> -  inside_init = decl_constant_value_for_optimization (inside_init);
>
>/* Initialization of an array of chars from a string constant
>   optionally enclosed in braces.  */
> diff --git a/gcc/testsuite/gcc.dg/fold-const-1.c 
> b/gcc/testsuite/gcc.dg/fold-const-1.c
> new file mode 100644
> index 000..9f043b8
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/fold-const-1.c
> @@ -0,0 +1,23 @@
> +/* { dg-options "-O -fdump-tree-gimple -fdump-tree-ccp1" } */
> +
> +extern void dummy (const void *);
> +
> +int
> +f1 (void)
> +{
> +  const int x = 7;
> +  dummy (&x);
> +  return x;
> +}
> +
> +void foo (int);
> +
> +void
> +f2 (void)
> +{
> +  const int x = 7;
> +  foo (x);
> +}
> +
> +/* { dg-final { scan-tree-dump "foo \\(7\\);" "gimple" } } */
> +/* { dg-final { scan-tree-dump-times "return 7;" 2 "ccp1" } } */

Oops, this last dg-final line should say { scan-tree-dump "return 7;"
"ccp1" } of course.


Re: [PATCH, C++] Wrap OpenACC wait in EXPR_STMT

2015-12-06 Thread Jason Merrill

OK.

Jason



Transparent alias suport part 1

2015-12-06 Thread Jan Hubicka
Hi,
this is first patch to fix PR 61886 which is one of several PRs we have about
need for duplicate declarations.  The cgraph code at the moment expects that
there is one declaration for every symbol. This is unfortunately not true 
and in several side cases (such as fortify source, bounds checking) we produce
multiple declarations for one symbol.

The following patch is kind of minimal support needed to generalize code
for weakrefs (which is one of cases of duplicated declarations) to general
case. Aliases can now be either normal aliases (i.e. multiple symbols
placed on one place in the object file) or transparent aliases which are
translated to the target at assembler time.

The patch itself is mostly a no-op at current copmiler (except for touching
weakref paths and adding a sanity checks), but I tested it with lto-symtab
declaration merging disabled and can bootstrap/build larger apps with that.
There are some bugfixes needed, but I will send them separately as those
may need to be backported in the case we hit the issues with release branches.

Bootstrapped/regtested x86_64-linux, I plan to commit it tomorrow.

Honza

PR ipa/61886
* symtab.c (ultimate_transparent_alias_target): New inline function.
(symbol_table::assembler_names_equal_p): New method; break out from ...
(symbol_table::decl_assembler_name_equal): ... here.
(symbol_table::change_decl_assembler_name): Also update names and
translation links of transparent aliases.
(symtab_node::dump_base): Dump transparent_alias.
(symtab_node::verify_base): Implement basic transparent alias
verification.
(symtab_node::make_decl_local): Support localization of weakrefs;
recurse to transparent aliases; set TREE_STATIC.
(symtab_node::ultimate_alias_target_1): Handle visibility of
transparent aliases.
(symtab_node::resolve_alias): New parmaeter transparent; handle
transparent aliases; recurse to aliases of aliases to fix comdat
groups.
(symtab_node::get_partitioning_class): Handle transparent aliases.
* ipa-visibility.c (cgraph_externally_visible_p,
varpool_node::externally_visible_p): Visibility of transparent alias
depends on its target.
(function_and_variable_visibility): Do not tweak visibility of
transparent laiases.
(function_and_variable_visibility): Likewise.
* ipa.c (symbol_table::remove_unreachable_nodes): Clear
transparent_alias flag.
* alias.c (cgraph_node::create_alias, cgraph_node::get_availability):
Support transparent aliases.
* cgraph.h (symtab_node): Update prototype of resolve_alias;
add transparent_alias flag.
(symbol_table: Add assembler_names_equal_p.
(symtab_node::real_symbol_p): Skip transparent aliases.
* cgraphunit.c (cgraph_node::reset): Reset transparent_alias flag.
(handle_alias_pairs): Set transparent_alias for weakref.
(cgraph_node::assemble_thunks_and_aliases): Do not asemble transparent
aliases.
* lto-cgraph.c (lto_output_node): When outputting same_comdat_group
skip symbols not put into boundary; stream transparent_alias.
(lto_output_varpool_node): Likewise.
(input_overwrite_node, input_varpool_node): Stream transparent alias.
* varpool.c (ctor_for_folding, varpool_node::get_availability,
varpool_node::assemble_aliases,
symbol_table::remove_unreferenced_decls): Handle transparent aliase.
(varpool_node::create_alias): Set transparent_alias.

* lto-partition.c (add_symbol_to_partition_1, contained_in_symbol,
rename_statics, rename_statics): Handle transparent aliases.
Index: lto/lto-partition.c
===
--- lto/lto-partition.c (revision 231327)
+++ lto/lto-partition.c (working copy)
@@ -1035,7 +1035,15 @@ rename_statics (lto_symtab_encoder_t enc
   /* Assign every symbol in the set that shares the same ASM name an unique
  mangled name.  */
   for (s = symtab_node::get_for_asmname (name); s;)
-if (!s->externally_visible
+if ((!s->externally_visible || s->weakref)
+   /* Transparent aliases having same name as target are renamed at a
+  time their target gets new name.  Transparent aliases that use
+  separate assembler name require the name to be unique.  */
+   && (!s->transparent_alias || !s->definition || s->weakref
+   || !symbol_table::assembler_names_equal_p
+(IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (s->decl)),
+ IDENTIFIER_POINTER
+   (DECL_ASSEMBLER_NAME (s->get_alias_target()->decl
&& ((s->real_symbol_p ()
  && !DECL_EXTERNAL (node->decl)
 && !TREE_PUBLIC (node->decl))
Index: ipa-visibility.c
===
--- ipa-visibility.c 

Re: [Fortran, Patch] Memory sync after coarray image control statements and assignment

2015-12-06 Thread Tobias Burnus

Dear Alessandro, dear all,

Alessandro Fanfarillo wrote:

currently, a coarray assignment in a program composed by a single
segment (without any sync statements) produces wrong results.


Always - or only with optimization?


Furthermore, a coarray code
compiled with an optimization flag higher that -O0 may produce wrong
results. The patch (re)introduces a __sync_synchronize() after coarray
image control statements (sync all, sync images, critical, locks and
events) and get/put.


I wonder whether using

__asm__ __volatile__ ("":::"memory");

would be sufficient as it has a way lower overhead than 
__sync_synchronize().



That would be something like:

  r = build_stmt (input_location, ASM_EXPR, string,
  output_operands, input_operands,
  clobbers, labels);
  ASM_VOLATILE_P (r) = 1;

with string = "", output_operands = NULL_TREE, input_operands = 
NULL_TREE, clobbers = "memory" and labels = NULL_TREE.  (Except that 
string+clobbers are trees and not char[].)


Cheers,

Tobias