Re: [PATCH, doc] NDS32: Describe -mcmodel= option instead of -mgp-direct in the documentation.

2015-01-18 Thread Gerald Pfeifer
On Wednesday 2015-01-14 17:56, Chung-Ju Wu wrote:
> 2015-01-14  Chung-Ju Wu  
> 
> * doc/invoke.texi (NDS32 Options): Add -mcmodel= option and
> remove -mgp-direct option.
>
> Although these changes are target-specific part, I think it would be better
> for others to have review comments, if any, on its format and layout.

That's easier for us if you attach patches as text as opposed
to Content-Type: application/octet-stream.

Gerald


Re: [PATCH, doc] NDS32: Remove -mforce-fp-as-gp, -mforbid-fp-as-gp, and -mex9 options from documentation.

2015-01-18 Thread Gerald Pfeifer
On Wednesday 2015-01-14 17:58, Chung-Ju Wu wrote:
> 2015-01-14  Chung-Ju Wu  
> 
> * doc/invoke.texi (NDS32 Options): Remove -mforce-fp-as-gp,
> -mforbid-fp-as-gp, and -mex9 options.

Can you cover these, and similar changes, in the release notes
at htdocs/gcc-5/changes.html, please?  (Cf. gcc.gnu.org/about.html
for the web pages side of things.)

Gerald


Re: [doc, committed] remove duplicate docs for -ftracer

2015-01-18 Thread Gerald Pfeifer
On Saturday 2015-01-17 13:55, Sandra Loosemore wrote:
> 2015-01-17  Sandra Loosemore  
> 
>   gcc/
>   * doc/invoke.texi ([-ftracer]): Remove duplicate option listing.

Thanks for doing these cleanups, Sandra.

The attachment only had the ChangeLog, not the patch.  Since I had
a look anyway, here it is for the record.

Gerald

Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 219802)
+++ doc/invoke.texi (revision 219803)
@@ -8727,12 +8727,6 @@
 elimination is only done if @option{-fdelete-null-pointer-checks} is
 enabled.
 
-@item -ftracer
-@opindex ftracer
-Perform tail duplication to enlarge superblock size.  This transformation
-simplifies the control flow of the function allowing other optimizations to do
-a better job.
-
 @item -funroll-loops
 @opindex funroll-loops
 Unroll loops whose number of iterations can be determined at compile


Re: [PATCH, i386] Remove EBX usage from asm code

2015-01-18 Thread Uros Bizjak
On Sat, Jan 17, 2015 at 7:36 PM, Rainer Orth
 wrote:
> Uros Bizjak  writes:
>
>> On Sat, Jan 17, 2015 at 4:18 PM, Rainer Orth
>>  wrote:
>>
 The patch removes EBX usage from asm code used in libgcc/crtstuff.c
 It is safe now, but potentially buggy when glibc is rebuild with GCC
 5.0 as EBX is not GOT register any more.

 x86 bootstrap, make check passed.

 Is it ok?

 Evgeny

 2014-12-28  Evgeny Stupachenko  

 * gnu-user.h (CRT_GET_RFIB_DATA): Remove EBX register usage.
 * config/i386/sysv4.h (CRT_GET_RFIB_DATA): Ditto.
>>>
>>> this patch broke Solaris 10/x86 bootstrap: when building amd64
>>> crtbegin.o, gas complains
>>
>> Looks like config.gcc error for Solaris x86, amd64 target should not
>> include i386/gnu-user.h but i386/gnu-user64.h
>
> The target is i386-pc-solaris2.10, which includes i386/sysv4.h.  Only
> the amd64 crtbegin.o is affected, the i386 one is fine.

Please split sysv4-common.h out of i386/sysv4.h, similar to how
i386/gnu-user.h and gnu-user-common.h are split.

Uros.


[Patch, Fortran, OOP] PR 60922: [4.9/5 regression] Memory leak with allocatable CLASS components

2015-01-18 Thread Janus Weil
Hi all,

the attached patch is close to trivial and fixes a memory-leak
regression that appeared after the implementation of finalization.

My suspicion it that it's simply a copy'n'paste error, where the wrong
attribute was copied from very similar code a few lines above, but I'd
like to have that confirmed by the original author (which should be
Tobias).

Regtested on x86_64-unknown-linux-gnu. Ok for trunk and 4.9?

Cheers,
Janus


2015-01-18  Janus Weil  

PR fortran/60922
* class.c (finalize_component): Apply the check for 'fini_coarray' only
to coarray components.

2015-01-18  Janus Weil  

PR fortran/60922
* gfortran.dg/class_allocate_17.f90: Extended.
Index: gcc/fortran/class.c
===
--- gcc/fortran/class.c (Revision 219813)
+++ gcc/fortran/class.c (Arbeitskopie)
@@ -875,7 +875,7 @@ finalize_component (gfc_expr *expr, gfc_symbol *de
   /* Add IF (fini_coarray).  */
   if (comp->attr.codimension
  || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)
- && CLASS_DATA (comp)->attr.allocatable))
+ && CLASS_DATA (comp)->attr.codimension))
{
  block = gfc_get_code (EXEC_IF);
  if (*code)
! { dg-do compile }
! { dg-options "-fdump-tree-original" }
!
! PR 60922: [4.9/5 regression] Memory leak with allocatable CLASS components
!
! Contributed by Salvatore Filippone 

program test_leak
  implicit none

  type d_base_vect_type
  end type

  type d_vect_type
class(d_base_vect_type), allocatable :: v
  end type

  call test()

contains

  subroutine test()
class(d_vect_type), allocatable :: x
allocate(x)
allocate(x%v)
print *,"allocated!"
  end subroutine

end

! { dg-final { scan-tree-dump-times "fini_coarray" 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } }


Re: [PATCH] IPA ICF: add no_icf attribute for a function

2015-01-18 Thread Marek Polacek
On Fri, Jan 16, 2015 at 04:04:27PM +0100, Martin Liška wrote:
> Hello.
> 
> This patch adds support for __attribute__((no_icf)) that prevents a function
> being merged with a different one.
> 
> Tested on x86_64-linux-pc.
> 
> Ready for trunk?
> Thanks,
> Martin

> From 234fc8018f9810e2adf6d975d6d0051631ef8c02 Mon Sep 17 00:00:00 2001
> From: mliska 
> Date: Fri, 16 Jan 2015 14:35:23 +0100
> Subject: [PATCH] IPA ICF: add no_icf attribute.
> 
> gcc/c-family/ChangeLog:
> 
> 2015-01-16  Martin Liska  
> 
>   * c-common.c (handle_noicf_attribute): New function.
> 
> gcc/ChangeLog:
> 
> 2015-01-16  Martin Liska  
> 
>   * doc/extend.texi (no_icf): Add new attribute description.
>   * ipa-icf.c (sem_item_optimizer::merge_classes): Handle cases
>   where the pass attempts to merge a function with no_icf attribute.
> 
> gcc/testsuite/ChangeLog:
> 
> 2015-01-16  Martin Liska  
> 
>   * gcc.dg/ipa/ipa-icf-33.c: New test.
> ---
>  gcc/c-family/c-common.c   | 21 +
>  gcc/doc/extend.texi   |  6 ++
>  gcc/ipa-icf.c |  8 
>  gcc/testsuite/gcc.dg/ipa/ipa-icf-33.c | 27 +++
>  4 files changed, 62 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.dg/ipa/ipa-icf-33.c
> 
> diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
> index eb132c5..3c18d1c 100644
> --- a/gcc/c-family/c-common.c
> +++ b/gcc/c-family/c-common.c
> @@ -330,6 +330,7 @@ static tree handle_no_sanitize_undefined_attribute (tree 
> *, tree, tree, int,
>  static tree handle_stack_protect_attribute (tree *, tree, tree, int, bool *);
>  static tree handle_noinline_attribute (tree *, tree, tree, int, bool *);
>  static tree handle_noclone_attribute (tree *, tree, tree, int, bool *);
> +static tree handle_noicf_attribute (tree *, tree, tree, int, bool *);
>  static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
>  static tree handle_always_inline_attribute (tree *, tree, tree, int,
>   bool *);
> @@ -664,6 +665,8 @@ const struct attribute_spec c_common_attribute_table[] =
> handle_noinline_attribute, false },
>{ "noclone",0, 0, true,  false, false,
> handle_noclone_attribute, false },
> +  { "no_icf", 0, 0, true,  false, false,
> +   handle_noicf_attribute, false },
>{ "leaf",   0, 0, true,  false, false,
> handle_leaf_attribute, false },
>{ "always_inline",  0, 0, true,  false, false,
> @@ -6853,6 +6856,24 @@ handle_noclone_attribute (tree *node, tree name,
>return NULL_TREE;
>  }
>  
> +/* Handle a "no_icf" attribute; arguments as in
> +   struct attribute_spec.handler.  */
> +
> +static tree
> +handle_noicf_attribute (tree *node, tree name,
> + tree ARG_UNUSED (args),
> + int ARG_UNUSED (flags), bool *no_add_attrs)
> +{
> +  if (TREE_CODE (*node) != FUNCTION_DECL)
> +{
> +  warning (OPT_Wattributes, "%qE attribute ignored", name);
> +  *no_add_attrs = true;
> +}
> +
> +  return NULL_TREE;
> +}
> +
> +
>  /* Handle a "always_inline" attribute; arguments as in
> struct attribute_spec.handler.  */
>  
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index bf6d710..ba921e9 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -2195,6 +2195,7 @@ attribute specification inside double parentheses.  The 
> following
>  attributes are currently defined for functions on all targets:
>  @code{aligned}, @code{alloc_size}, @code{alloc_align}, @code{assume_aligned},
>  @code{noreturn}, @code{returns_twice}, @code{noinline}, @code{noclone},
> +@code{no_icf},
>  @code{always_inline}, @code{flatten}, @code{pure}, @code{const},
>  @code{nothrow}, @code{sentinel}, @code{format}, @code{format_arg},
>  @code{no_instrument_function}, @code{no_split_stack},
> @@ -3475,6 +3476,11 @@ cloning---a mechanism that produces specialized copies 
> of functions
>  and which is (currently) performed by interprocedural constant
>  propagation.
>  
> +@item no_icf
> +@cindex @code{no_icf} function attribute
> +This function attribute prevents a functions from being merged with another

s/functions/function/

> +semantically equivalent function.
> +
>  @item nonnull (@var{arg-index}, @dots{})
>  @cindex @code{nonnull} function attribute
>  The @code{nonnull} attribute specifies that some function parameters should
> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> index bbd5724..4b70900 100644
> --- a/gcc/ipa-icf.c
> +++ b/gcc/ipa-icf.c
> @@ -2372,6 +2372,14 @@ sem_item_optimizer::merge_classes (unsigned int 
> prev_class_count)
>source->asm_name (), alias->asm_name ());
> }
>  
> + if (lookup_attribute ("no_icf", DECL_ATTRIBUTES (alias->decl)))
> +   {
> + if (dump_file)
> +   

Re: [SH] Introduce treg_set_expr

2015-01-18 Thread Oleg Endo
On Sat, 2015-01-17 at 22:40 +0900, Kaz Kojima wrote:
> Oleg Endo  wrote:
> > Kaz, could you please test the patch on your sh4-linux setup and report
> > your findings?  Even though it's a bit late, I'd like to get this in for
> > GCC 5, if it doesn't break too many things.
> 
> Looks wrong code problem for tls and atomic constructs.
> Here is the result of compare_tests for unpatched/patched
> sh4-unknown-linux-gnu compilers:
> 
> New tests that FAIL:
> 
> ...

Thanks.  Doesn't look so bad actually.  I've expected worse.  These are
the two problems:

1) sh_find_extending_set_of_reg (introduced earlier as part of PR 53988)
hits atomic insns, which in fact do a indirect sign extending mem load.
The cmpeqsi_t splitter for const_int 0 then tries to use the value as
sign extended, which wrongly converts an atomic into a simple mem load.

The easy solution is not to report 'sign extended' in
sh_find_extending_set_of_reg for mems that are buried in UNSPEC/UNSPECV
insns.  This also revealed a problem of inconsistent return values of
sh_find_set_of_reg.  This should be fixed regardless of the
treg_set_expr stuff first.  I'll create separate patch for that.

The more complex solution would be to somehow convert the atomics so
that the sign extension becomes visible for the following code.  Maybe
later.

2) The GBR related insns (e.g. store_gbr, *mov_gbr_load) use
"register_operand" as destination.  Since "register_operand" matches
T_REG, a (set (reg:SI T_REG) ()) will be wrongly matched
by any_treg_expr_to_reg.  This should actually have ended in an
unrecognized insn ICE, but then there's the *negtstsi insn, which
results in funny code.

The easy solution for this is to use "arith_reg_dest" instead of
"register_operand" in the GBR insns.  I'll send around an updated
treg_set_expr patch after 1) is done.

Cheers,
Oleg



Re: [patch libstdc++] Optimize synchronization in std::future if futexes are available.

2015-01-18 Thread Jonathan Wakely

On 17/01/15 19:51 -0700, Sandra Loosemore wrote:

On 01/17/2015 03:58 PM, Jonathan Wakely wrote:


My fault, this additional chunk is needed alongside the patch I sent
earlier:

--- a/libstdc++-v3/include/bits/atomic_futex.h
+++ b/libstdc++-v3/include/bits/atomic_futex.h
@@ -35,7 +35,7 @@
#include 
#include 
#include 
-#if !defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+#if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1)
#include 
#include 
#endif

What I sent earlier causes your target to use std::mutex and
std::condition_variable, but without the bit above the headers aren't
included.


Still no joy:
/scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/futex.cc:45:3: 
error: '__atomic_futex_unsigned_base' has not been declared

  __atomic_futex_unsigned_base::_M_futex_wait_until(unsigned *__addr,
  ^
/scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/futex.cc:88:3: 
error: '__atomic_futex_unsigned_base' has not been declared

  __atomic_futex_unsigned_base::_M_futex_notify_all(unsigned* __addr)
  ^


futex.cc needs the same change ...
diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index ad766c8..f24b44e 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -23,7 +23,7 @@
 // .
 
 #include 
-#if defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
 #include 
 #include 
 #include 


Re: [patch libstdc++] Optimize synchronization in std::future if futexes are available.

2015-01-18 Thread Jonathan Wakely

On 18/01/15 13:19 +, Jonathan Wakely wrote:

On 17/01/15 19:51 -0700, Sandra Loosemore wrote:

On 01/17/2015 03:58 PM, Jonathan Wakely wrote:


My fault, this additional chunk is needed alongside the patch I sent
earlier:

--- a/libstdc++-v3/include/bits/atomic_futex.h
+++ b/libstdc++-v3/include/bits/atomic_futex.h
@@ -35,7 +35,7 @@
#include 
#include 
#include 
-#if !defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+#if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1)
#include 
#include 
#endif

What I sent earlier causes your target to use std::mutex and
std::condition_variable, but without the bit above the headers aren't
included.


Still no joy:
/scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/futex.cc:45:3: 
error: '__atomic_futex_unsigned_base' has not been declared

 __atomic_futex_unsigned_base::_M_futex_wait_until(unsigned *__addr,
 ^
/scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/futex.cc:88:3: 
error: '__atomic_futex_unsigned_base' has not been declared

 __atomic_futex_unsigned_base::_M_futex_notify_all(unsigned* __addr)
 ^


futex.cc needs the same change ...



diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index ad766c8..f24b44e 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -23,7 +23,7 @@
// .

#include 
-#if defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
#include 
#include 
#include 


I've committed the attached after succesfully building
arm-none-linux-gnueabi with it and testing on x86_64-linux.

(The other changes in the patch are just whitespace and making the
member variables private.)

commit 07fcc71b616a253ed34b8b6f83e7f8cf6ea08a7a
Author: Jonathan Wakely 
Date:   Sun Jan 18 14:34:52 2015 +

	* src/c++11/futex.cc: Fix order of includes and preprocessor condition.

diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index f24b44e..1336779 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -22,9 +22,8 @@
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // .
 
-#include 
-#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
 #include 
+#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
 #include 
 #include 
 #include 

commit c0b71ac062080887ae2bc072c9db21118155ae22
Author: redi 
Date:   Sun Jan 18 14:25:22 2015 +

	* include/bits/atomic_futex.h: Use mutex and condition_variable when
	atomic int is not lock-free. Make member variables private.
	* src/c++11/futex.cc: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219815 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/include/bits/atomic_futex.h b/libstdc++-v3/include/bits/atomic_futex.h
index 2673604..51b9c7e 100644
--- a/libstdc++-v3/include/bits/atomic_futex.h
+++ b/libstdc++-v3/include/bits/atomic_futex.h
@@ -35,7 +35,7 @@
 #include 
 #include 
 #include 
-#if !defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+#if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1)
 #include 
 #include 
 #endif
@@ -49,7 +49,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-#if defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
   struct __atomic_futex_unsigned_base
   {
 // Returns false iff a timeout occurred.
@@ -62,16 +62,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   };
 
   template 
-  struct __atomic_futex_unsigned : __atomic_futex_unsigned_base
+  class __atomic_futex_unsigned : __atomic_futex_unsigned_base
   {
 typedef chrono::system_clock __clock_t;
 
-// XXX We expect this to be lock-free, and having the payload at offset 0.
-#if ATOMIC_INT_LOCK_FREE < 2
-# error We require lock-free atomic operations on int
-#endif
+// This must be lock-free and at offset 0.
 atomic _M_data;
 
+  public:
+explicit
 __atomic_futex_unsigned(unsigned __data) : _M_data(__data)
 { }
 
@@ -82,7 +81,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 }
 
   private:
-
 // If a timeout occurs, returns a current value after the timeout;
 // otherwise, returns the operand's value if equal is true or a different
 // value if equal is false.
@@ -165,26 +163,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 // Returns false iff a timeout occurred.
 template
-_GLIBCXX_ALWAYS_INLINE bool
-_M_load_when_equal_for(unsigned __val, memory_order __mo,
-	const chrono::duration<_Rep, _Period>& __rtime)
-{
-  return _M_load_when_equal_until(__val, __mo, __clock_t::now() + __rtime);
-}
+  _GLIBCXX_ALWAYS_INLINE bool
+  _M_load_when_equal_for(unsigned __val, memory_order __mo,
+	  const chrono::duration<_Rep, _Period>& __rtime)
+  {
+	return _M_load_when_e

Re: [patch libstdc++] Optimize synchronization in std::future if futexes are available.

2015-01-18 Thread Jonathan Wakely

On 16/01/15 18:00 +0100, Torvald Riegel wrote:

+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  __atomic_futex_unsigned_base::_M_futex_wait_until(unsigned *__addr,
+  unsigned __val,
+  bool __has_timeout, chrono::seconds __s, chrono::nanoseconds __ns)
+  {
+if (!__has_timeout)
+  {
+   // Ignore whether we actually succeeded to block because at worst,
+   // we will fall back to spin-waiting.  The only thing we could do
+   // here on errors is abort.
+   int ret __attribute__((unused));
+   ret = syscall (SYS_futex, __addr, futex_wait_op, __val);
+   _GLIBCXX_DEBUG_ASSERT(ret == 0 || errno == EINTR || errno == EAGAIN);


I've just noticed these debug assertions in the futex.cc file, which
will never fire because the library isn't build with -D_GLIBCXX_DEBUG
defined. We should decide whether other errors are necessary to handle
and either throw an exception or std::terminate().



Re: [patch] powerpc-vxworksmils port, variant of powerpc-vxworksae

2015-01-18 Thread Gerald Pfeifer
Hi Olivier,

On Thursday 2014-09-18 12:36, Olivier Hainque wrote:
> We have been maintaining a port to VxWorks MILS for powerpc for a while now
> and thought others might be interested.
> 
> VxWorksMILS is very close to VxWorksAE, so the patch is pretty small. The main
> noticeable difference is that only the vthreads environment headers are
> available, so we arrange to build the libgcc variants all with -mvthreads.

this feels a little too small for an announcement on our home
page, but would you mind adding something to gcc-5/changes.html?

(Or suggest some wording for that page and I'll take care.)

Gerald


[Patch, fortran] PR57959 - [F03] ICE with structure constructor with scalar allocatable components

2015-01-18 Thread Paul Richard Thomas
Dear All,

Andre's patch for PR60357 did not fix this PR as we had hoped. The fix
needed is trivial, nay 'obvious'.

The problem was that a deep copy was not being performed; just an
assignement of the pointers to the data. In consequence the testcase
was being clobbered with a double free in the 'finally' block
generated by the fortran block.

Note that the PR title shows this as an F03 bug. However, the example
crashed because of the block construct, which is F2008. For this
reason, the testcase is f08.

Boostrapped and regtested on x86_64/FC21 - I will commit to trunk as 'obvious'

Cheers

Paul

2015-01-18  Paul Thomas  

PR fortran/64578
* trans-expr.c (gfc_trans_subcomponent_assign): Use a deep copy
for allocatable components, where the source is a variable.

2015-01-18  Paul Thomas  

PR fortran/64578
* gfortran.dg/block_13.f08: New test


-- 
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.

Groucho Marx
Index: gcc/fortran/trans-expr.c
===
*** gcc/fortran/trans-expr.c(revision 219801)
--- gcc/fortran/trans-expr.c(working copy)
*** gfc_trans_pointer_assignment (gfc_expr *
*** 7075,7080 
--- 7075,7081 
rse.expr = gfc_class_data_get (rse.expr);
  else
{
+ gfc_add_block_to_block (&block, &rse.pre);
  tmp = gfc_create_var (TREE_TYPE (rse.expr), "ptrtemp");
  gfc_add_modify (&lse.pre, tmp, rse.expr);
  
*** gfc_trans_pointer_assignment (gfc_expr *
*** 7146,7151 
--- 7147,7153 
}
  else
{
+ gfc_add_block_to_block (&block, &rse.pre);
  tmp = gfc_create_var (TREE_TYPE (rse.expr), "ptrtemp");
  gfc_add_modify (&lse.pre, tmp, rse.expr);
  
Index: gcc/fortran/trans-intrinsic.c
===
*** gcc/fortran/trans-intrinsic.c   (revision 219800)
--- gcc/fortran/trans-intrinsic.c   (working copy)
*** gfc_conv_associated (gfc_se *se, gfc_exp
*** 6554,6560 
--- 6554,6564 
arg1se.expr = build_fold_indirect_ref_loc (input_location,
   arg1se.expr);
  if (arg1->expr->ts.type == BT_CLASS)
+   {
  tmp2 = gfc_class_data_get (arg1se.expr);
+ if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (tmp2)))
+   tmp2 = gfc_conv_descriptor_data_get (tmp2);
+   }
  else
tmp2 = arg1se.expr;
  }
Index: gcc/testsuite/gfortran.dg/unlimited_polymorphic_21.f90
===
*** gcc/testsuite/gfortran.dg/unlimited_polymorphic_21.f90  (revision 0)
--- gcc/testsuite/gfortran.dg/unlimited_polymorphic_21.f90  (working copy)
***
*** 0 
--- 1,35 
+ ! { dg-do run }
+ ! Tests the fix for PR64578.
+ !
+ ! Contributed by Damian Rouson  
+ !
+   type foo
+  real, allocatable :: component(:)
+   end type
+   type (foo), target :: f
+   class(*), pointer :: ptr(:)
+   allocate(f%component(1),source=[0.99])
+   call associate_pointer(f,ptr)
+   select type (ptr)
+ type is (real)
+   if (abs (ptr(1) - 0.99) > 1e-5) call abort
+   end select
+   ptr => return_pointer(f)  ! runtime segmentation fault
+   if (associated(return_pointer(f)) .neqv. .true.) call abort
+   select type (ptr)
+ type is (real)
+   if (abs (ptr(1) - 0.99) > 1e-5) call abort
+   end select
+ contains
+   subroutine associate_pointer(this, item)
+ class(foo), target :: this
+ class(*), pointer :: item(:)
+ item => this%component
+   end subroutine
+   function return_pointer(this)
+ class(foo), target :: this
+ class(*), pointer :: return_pointer(:)
+ return_pointer => this%component
+   end function
+ end
+ 


Re: [patch] Update C++11 status in libstdc++ docs

2015-01-18 Thread Jonathan Wakely

I have no idea why the C++11 status table says we're missing offsetof,
so I've removed that remark with this patch.

Committed to trunk.
commit c0783cfb57885eb5bd10bc52184872c5fae1a709
Author: Jonathan Wakely 
Date:   Sun Jan 18 15:46:23 2015 +

	* doc/xml/manual/status_cxx2011.xml: Remove note about offsetof.
	* doc/html/manual/status.html: Regenerate.

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index f1c9639..76387c7 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -75,11 +75,10 @@ particular release.
   
 
 
-  
   18.2
   Types
-  Partial
-  Missing offsetof
+  Y
+  
 
 
   18.3


[patch] libstdc++/64646 fix 4-iterator overload of std::is_permutation

2015-01-18 Thread Jonathan Wakely

Fix a past-the-end dereference in the new C++14 version of
is_permutation. This only affects C++14 mode, but fixes a new function
that exists entirely because it's meant to be safer than the C++98
version ... but it isn't safer if it goes past-the-end!

Tested x86_64-linux, committed to 4.9 and trunk.
commit dd920757d437ffa60a0f9b008e57507d4c8ee831
Author: redi 
Date:   Sun Jan 18 16:31:06 2015 +

	PR libstdc++/64646
	* include/bits/stl_algo.h (__is_permutation): Also test for reaching
	end of the second range.
	* testsuite/25_algorithms/is_permutation/64646.cc: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219821 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 3325b94..c27c092 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -3601,7 +3601,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // Efficiently compare identical prefixes:  O(N) if sequences
   // have the same elements in the same order.
-  for (; __first1 != __last1; ++__first1, ++__first2)
+  for (; __first1 != __last1 && __first2 != __last2;
+	  ++__first1, ++__first2)
 	if (!__pred(__first1, __first2))
 	  break;
 
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc b/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc
new file mode 100644
index 000..799a18c
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 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
+// .
+
+// { dg-options "-std=gnu++14" }
+
+#include 
+#include 
+#include 
+
+void
+test01()
+{
+  std::forward_list l1{0}, l2;
+  VERIFY( !std::is_permutation(l1.begin(), l1.end(), l2.begin(), l2.end()) );
+}
+
+int
+main()
+{
+  test01();
+}


Fix ipa-inline-transform ICE

2015-01-18 Thread Jan Hubicka
Hi,
the testcase shows a case where try_make_edge_direct_virtual_call disagrees with
ipa_get_indirect_edge_target_1 making ipa-inline-transform to ICE on mismatch.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

Index: ChangeLog
===
--- ChangeLog   (revision 219821)
+++ ChangeLog   (working copy)
@@ -1,3 +1,10 @@
+2015-01-18  Jan Hubicka  
+
+   PR ipa/64378
+   * ipa-prop.c (try_make_edge_direct_virtual_call): Clear speculative
+   flag correctly.
+   * ipa-cp.c (ipa_get_indirect_edge_target_1): Handle speculation.
+
 2015-01-18  Sandra Loosemore  
 
* doc/invoke.texi ([-funroll-loops], [-funroll-all-loops]):
Index: testsuite/ChangeLog
===
--- testsuite/ChangeLog (revision 219821)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2015-01-18  Jan Hubicka  
+
+   PR ipa/64378
+   * g++.dg/torture/pr64378.C: New testcase.
+
 2015-01-18  Paul Thomas  
 
PR fortran/57959
Index: testsuite/g++.dg/torture/pr64378.C
===
--- testsuite/g++.dg/torture/pr64378.C  (revision 0)
+++ testsuite/g++.dg/torture/pr64378.C  (revision 0)
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-fno-ipa-cp" }
+struct data {
+  data(int) {}
+};
+
+struct top {
+  virtual int topf() {}
+};
+
+struct child1: top {
+void childf()
+{
+data d(topf());
+}
+};
+
+void test(top *t)
+{
+child1 *c = static_cast(t);
+c->childf();
+child1 d;
+test(&d);
+}
Index: ipa-prop.c
===
--- ipa-prop.c  (revision 219821)
+++ ipa-prop.c  (working copy)
@@ -2985,7 +2985,7 @@ try_make_edge_direct_virtual_call (struc
  || !possible_polymorphic_call_target_p
   (ie, cgraph_node::get (t)))
{
- /* Do not speculate builtin_unreachable, it is stpid!  */
+ /* Do not speculate builtin_unreachable, it is stupid!  */
  if (!ie->indirect_info->vptr_changed)
target = ipa_impossible_devirt_target (ie, target);
}
@@ -3013,6 +3013,7 @@ try_make_edge_direct_virtual_call (struc
  ctx, &final);
   if (final && targets.length () <= 1)
 {
+  speculative = false;
   if (targets.length () == 1)
target = targets[0]->decl;
   else
Index: ipa-cp.c
===
--- ipa-cp.c(revision 219821)
+++ ipa-cp.c(working copy)
@@ -1975,8 +1975,13 @@ ipa_get_indirect_edge_target_1 (struct c
}
 }
   else if (t)
-context = ipa_polymorphic_call_context (t, ie->indirect_info->otr_type,
-   anc_offset);
+{
+  context = ipa_polymorphic_call_context (t, ie->indirect_info->otr_type,
+ anc_offset);
+  if (ie->indirect_info->vptr_changed)
+   context.possible_dynamic_type_change (ie->in_polymorphic_cdtor,
+ ie->indirect_info->otr_type);
+}
   else
 return NULL_TREE;
 


Re: common.opt and optimization attribute housekeeping

2015-01-18 Thread Jan Hubicka
Hi,
this is variant I comitted after further testing.  Main change is in 
ipa-reference that can not
treat -fno-ipa-reference functions as external functions, because unlike those 
they may affect
local variables.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

* gcc.dg/ipa/ipa-icf-32.c: Update template.
* c-c++-common/asan/instrument-with-calls-3.c: Likewise.
* c-c++-common/asan/instrument-with-calls-2.c: Likewise.
* c-c++-common/asan/instrument-with-calls-1.c: Likewise.
* c-c++-common/asan/kasan-recover-1.c: Likewise.
* c-c++-common/asan/kasan-recover-2.c: Likewise.

* ipa-reference.c (set_reference_optimization_summary,
ipa_reference_get_not_written_global): Do nothing if ipa-reference is 
disabled.
(ignore_module_statics): New static var.
(propagate_bits): If ipa-reference is disabled, do not look into local 
properties.
(analyze_function): Disable analysis when ipa_reference is disabled.
(generate_summary): Do not dump when reference is disabled;
collect vars accessed from functions with ipa-reference disabled.
(get_read_write_all_from_node): When ipa-reference is disabled, use the
node flags.
(gate): Enable for LTO.
(ignore_edge_p): New function.
(propagate): Skip functions w/o ipa-reference analysis.
* optc-save-gen.awk: Handle optimize_debug correctly.
* opth-gen.awk: Likewise.
* common.opt (fauto-inc-dec, fdelete-dead-exceptions, ffunction-cse,
fgraphite, fstrict-volatile-bitfields, fira-algorithm, fira-region,
fira-share-save-slots, fira-share-spill-slots,
fmodulo-sched-allow-regmoves, fpartial-inlining,
sched-stalled-insns, fsched-stalled-insns-dep, fstrict-overflow,
ftracer, ftree-parallelize-loops, fassociative-math,
freciprocal-math, fvect-cost-model, fsimd-cost-model): Mark as
Optimization
(fauto-profile, fcommon, fdata-sections, fipa-icf-variables,
ftoplevel-reorder, funit-at-a-time, fwhole-program): Do not mark as
Optimization.
* ipa-icf.c (gate, sem_item_optimizer::filter_removed_items):
Fix for IPA.
Index: ipa-icf.c
===
--- ipa-icf.c   (revision 219821)
+++ ipa-icf.c   (working copy)
@@ -1652,7 +1652,8 @@ sem_item_optimizer::filter_removed_items
 {
   sem_item *item = m_items[i];
 
-  if (!flag_ipa_icf_functions && item->type == FUNC)
+  if (item->type == FUNC
+ && !opt_for_fn (item->decl, flag_ipa_icf_functions))
{
  remove_item (item);
  continue;
@@ -2499,7 +2500,7 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *)
   {
-return flag_ipa_icf_variables || flag_ipa_icf_functions;
+return in_lto_p || flag_ipa_icf_variables || flag_ipa_icf_functions;
   }
 
   virtual unsigned int execute (function *)
Index: opth-gen.awk
===
--- opth-gen.awk(revision 219821)
+++ opth-gen.awk(working copy)
@@ -132,13 +132,14 @@ print "/* Structure to save/restore opti
 print "struct GTY(()) cl_optimization";
 print "{";
 
-n_opt_char = 2;
+n_opt_char = 3;
 n_opt_short = 0;
 n_opt_int = 0;
 n_opt_enum = 1;
 n_opt_other = 0;
 var_opt_char[0] = "unsigned char x_optimize";
 var_opt_char[1] = "unsigned char x_optimize_size";
+var_opt_char[2] = "unsigned char x_optimize_debug";
 var_opt_enum[0] = "enum fp_contract_mode x_flag_fp_contract_mode";
 
 for (i = 0; i < n_opts; i++) {
Index: testsuite/gcc.dg/ipa/ipa-icf-32.c
===
--- testsuite/gcc.dg/ipa/ipa-icf-32.c   (revision 219821)
+++ testsuite/gcc.dg/ipa/ipa-icf-32.c   (working copy)
@@ -1,8 +1,8 @@
 /* { dg-do run } */
-/* { dg-options "-O0 -fipa-icf -fdump-ipa-icf-details" } */
+/* { dg-options "-O1 -fipa-icf -fdump-ipa-icf-details" } */
 
 int
-__attribute__((optimize("O0"), noinline, noclone))
+__attribute__((optimize("Os"), noinline, noclone))
 foo(int a)
 {
   return a * a;
Index: testsuite/c-c++-common/asan/instrument-with-calls-2.c
===
--- testsuite/c-c++-common/asan/instrument-with-calls-2.c   (revision 
219821)
+++ testsuite/c-c++-common/asan/instrument-with-calls-2.c   (working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "--param asan-instrumentation-with-call-threshold=1" } */
+/* { dg-options "--param asan-instrumentation-with-call-threshold=1 
-ffat-lto-objects" } */
 
 int x;
 
Index: testsuite/c-c++-common/asan/kasan-recover-1.c
===
--- testsuite/c-c++-common/asan/kasan-recover-1.c   (revision 219821)
+++ testsuite/c-c++-common/asan/kasan-recover-1.c   (working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fno-sanitize=ad

Re: common.opt and optimization attribute housekeeping

2015-01-18 Thread Jakub Jelinek
On Sun, Jan 18, 2015 at 06:45:03PM +0100, Jan Hubicka wrote:
> @@ -1299,7 +1299,7 @@ has finished
>  
>  ; This option is not documented yet as its semantics will change.
>  fgraphite
> -Common Report Var(flag_graphite)
> +Common Report Var(flag_graphite) Opitmization
>  Enable in and out of Graphite representation

Did it compile?  s/Opit/Opti/ ...

Jakub


Re: common.opt and optimization attribute housekeeping

2015-01-18 Thread Jan Hubicka
> On Sun, Jan 18, 2015 at 06:45:03PM +0100, Jan Hubicka wrote:
> > @@ -1299,7 +1299,7 @@ has finished
> >  
> >  ; This option is not documented yet as its semantics will change.
> >  fgraphite
> > -Common Report Var(flag_graphite)
> > +Common Report Var(flag_graphite) Opitmization
> >  Enable in and out of Graphite representation
> 
> Did it compile?  s/Opit/Opti/ ...

It did, I do not think there is any checking if the flag is known. Will fix that
as obvious.

Honza
> 
>   Jakub


[SH][committed] Fix PR 64652

2015-01-18 Thread Oleg Endo
Hi,

The attached patch fixes PR 64652.  Tested with
make -k check-gcc RUNTESTFLAGS="sh-torture.exp --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r219824.

Cheers,
Oleg

gcc/ChangeLog:
PR target/64652
* config/sh/sh.md (udivsi3_i4, divsi3_i4): Make use of sfunc address
reg appear first in the parallel.

gcc/testsuite/ChangeLog:
PR target/64652
* gcc.target/sh/torture/pr64652.c: New.
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 219823)
+++ gcc/config/sh/sh.md	(working copy)
@@ -2402,8 +2402,8 @@
(clobber (reg:SI R4_REG))
(clobber (reg:SI R5_REG))
(clobber (reg:SI FPSCR_STAT_REG))
-   (use (reg:SI FPSCR_MODES_REG))
-   (use (match_operand:SI 1 "arith_reg_operand" "r"))]
+   (use (match_operand:SI 1 "arith_reg_operand" "r"))
+   (use (reg:SI FPSCR_MODES_REG))]
   "TARGET_FPU_DOUBLE && ! TARGET_FPU_SINGLE"
   "jsr	@%1%#"
   [(set_attr "type" "sfunc")
@@ -2674,8 +2674,8 @@
(clobber (reg:DF DR0_REG))
(clobber (reg:DF DR2_REG))
(clobber (reg:SI FPSCR_STAT_REG))
-   (use (reg:SI FPSCR_MODES_REG))
-   (use (match_operand:SI 1 "arith_reg_operand" "r"))]
+   (use (match_operand:SI 1 "arith_reg_operand" "r"))
+   (use (reg:SI FPSCR_MODES_REG))]
   "TARGET_FPU_DOUBLE && ! TARGET_FPU_SINGLE"
   "jsr	@%1%#"
   [(set_attr "type" "sfunc")
Index: gcc/testsuite/gcc.target/sh/torture/pr64652.c
===
--- gcc/testsuite/gcc.target/sh/torture/pr64652.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/torture/pr64652.c	(revision 0)
@@ -0,0 +1,10 @@
+/* Check that using -mdiv=call-fp compiles without fuzz.  */
+/* { dg-do compile }  */
+/* { dg-additional-options "-mdiv=call-fp" }  */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } }  */
+
+int
+test (int a, int b, int c, int d)
+{
+  return (a / b) + c + d;
+}


Re: [PATCH, AARCH64] Fix ICE in CCMP (PR64015)

2015-01-18 Thread Christophe Lyon
On 16 January 2015 at 11:54, Marcus Shawcroft
 wrote:
> On 15 January 2015 at 18:18, Richard Henderson  wrote:
>> On 12/15/2014 12:41 AM, Zhenqiang Chen wrote:
>>> +(define_expand "cmp"
>>> +  [(set (match_operand 0 "cc_register" "")
>>> +(match_operator:CC 1 "aarch64_comparison_operator"
>>> + [(match_operand:GPI 2 "register_operand" "")
>>> +  (match_operand:GPI 3 "aarch64_plus_operand" "")]))]
>>> +  ""
>>> +  "
>>> +  operands[1] = gen_rtx_fmt_ee (COMPARE, SELECT_CC_MODE (GET_CODE 
>>> (operands[1]),
>>> +  operands[2],
>>> +  operands[3]),
>>> +  operands[2], operands[3]);
>>> +  "
>>> +)
>>
>> Use { } not "" for the C portion.
>>
>> Otherwise ok.
>
> Jiong... this is fine with me. /Marcus

Jiong,

I have noticed regressions on aarch64 after this patch:

See: 
http://abe.tcwglab.linaro.org/logs/validations/cross-validation/gcc/trunk/219723/report-build-info.html
Passed now fails  [PASS => FAIL]:
  gcc.target/aarch64/test_frame_1.c scan-assembler-times ldr\tx30,
\\[sp\\], [0-9]+ 3
  gcc.target/aarch64/test_frame_2.c scan-assembler-times ldp\tx19,
x30, \\[sp\\], [0-9]+ 2
  gcc.target/aarch64/test_frame_4.c scan-assembler-times ldp\tx19,
x30, \\[sp\\], [0-9]+ 2
  gcc.target/aarch64/test_frame_6.c scan-assembler-times ldr\tx30,
\\[sp\\], [0-9]+ 3
  gcc.target/aarch64/test_frame_7.c scan-assembler-times ldp\tx19,
x30, \\[sp\\], [0-9]+ 2

Is this expected?

Thanks,

Christophe.


Re: [PATCH, AARCH64] Fix ICE in CCMP (PR64015)

2015-01-18 Thread Andrew Pinski
On Sun, Jan 18, 2015 at 11:58 AM, Christophe Lyon
 wrote:
> On 16 January 2015 at 11:54, Marcus Shawcroft
>  wrote:
>> On 15 January 2015 at 18:18, Richard Henderson  wrote:
>>> On 12/15/2014 12:41 AM, Zhenqiang Chen wrote:
 +(define_expand "cmp"
 +  [(set (match_operand 0 "cc_register" "")
 +(match_operator:CC 1 "aarch64_comparison_operator"
 + [(match_operand:GPI 2 "register_operand" "")
 +  (match_operand:GPI 3 "aarch64_plus_operand" "")]))]
 +  ""
 +  "
 +  operands[1] = gen_rtx_fmt_ee (COMPARE, SELECT_CC_MODE (GET_CODE 
 (operands[1]),
 +  operands[2],
 +  operands[3]),
 +  operands[2], operands[3]);
 +  "
 +)
>>>
>>> Use { } not "" for the C portion.
>>>
>>> Otherwise ok.
>>
>> Jiong... this is fine with me. /Marcus
>
> Jiong,
>
> I have noticed regressions on aarch64 after this patch:
>
> See: 
> http://abe.tcwglab.linaro.org/logs/validations/cross-validation/gcc/trunk/219723/report-build-info.html
> Passed now fails  [PASS => FAIL]:
>   gcc.target/aarch64/test_frame_1.c scan-assembler-times ldr\tx30,
> \\[sp\\], [0-9]+ 3
>   gcc.target/aarch64/test_frame_2.c scan-assembler-times ldp\tx19,
> x30, \\[sp\\], [0-9]+ 2
>   gcc.target/aarch64/test_frame_4.c scan-assembler-times ldp\tx19,
> x30, \\[sp\\], [0-9]+ 2
>   gcc.target/aarch64/test_frame_6.c scan-assembler-times ldr\tx30,
> \\[sp\\], [0-9]+ 3
>   gcc.target/aarch64/test_frame_7.c scan-assembler-times ldp\tx19,
> x30, \\[sp\\], [0-9]+ 2
>
> Is this expected?

Yes and now you just have to revert the revert of my patch to fix those.

Thanks,
Andrew

>
> Thanks,
>
> Christophe.


Re: [PATCH, AARCH64] Fix ICE in CCMP (PR64015)

2015-01-18 Thread Christophe Lyon
On 18 January 2015 at 21:22, Andrew Pinski  wrote:
> On Sun, Jan 18, 2015 at 11:58 AM, Christophe Lyon
>  wrote:
>> On 16 January 2015 at 11:54, Marcus Shawcroft
>>  wrote:
>>> On 15 January 2015 at 18:18, Richard Henderson  wrote:
 On 12/15/2014 12:41 AM, Zhenqiang Chen wrote:
> +(define_expand "cmp"
> +  [(set (match_operand 0 "cc_register" "")
> +(match_operator:CC 1 "aarch64_comparison_operator"
> + [(match_operand:GPI 2 "register_operand" "")
> +  (match_operand:GPI 3 "aarch64_plus_operand" "")]))]
> +  ""
> +  "
> +  operands[1] = gen_rtx_fmt_ee (COMPARE, SELECT_CC_MODE (GET_CODE 
> (operands[1]),
> +  operands[2],
> +  operands[3]),
> +  operands[2], operands[3]);
> +  "
> +)

 Use { } not "" for the C portion.

 Otherwise ok.
>>>
>>> Jiong... this is fine with me. /Marcus
>>
>> Jiong,
>>
>> I have noticed regressions on aarch64 after this patch:
>>
>> See: 
>> http://abe.tcwglab.linaro.org/logs/validations/cross-validation/gcc/trunk/219723/report-build-info.html
>> Passed now fails  [PASS => FAIL]:
>>   gcc.target/aarch64/test_frame_1.c scan-assembler-times ldr\tx30,
>> \\[sp\\], [0-9]+ 3
>>   gcc.target/aarch64/test_frame_2.c scan-assembler-times ldp\tx19,
>> x30, \\[sp\\], [0-9]+ 2
>>   gcc.target/aarch64/test_frame_4.c scan-assembler-times ldp\tx19,
>> x30, \\[sp\\], [0-9]+ 2
>>   gcc.target/aarch64/test_frame_6.c scan-assembler-times ldr\tx30,
>> \\[sp\\], [0-9]+ 3
>>   gcc.target/aarch64/test_frame_7.c scan-assembler-times ldp\tx19,
>> x30, \\[sp\\], [0-9]+ 2
>>
>> Is this expected?
>
> Yes and now you just have to revert the revert of my patch to fix those.
>
Thanks for the clarification/confirmation, I thought I had seen
something like that but I was confused.

> Thanks,
> Andrew
>
>>
>> Thanks,
>>
>> Christophe.


Re: Compare-elim pass (was: Re: [PATCH] Fix PR 61225)

2015-01-18 Thread Hans-Peter Nilsson
On Sat, 17 Jan 2015, Jakub Jelinek wrote:
> On Sat, Jan 17, 2015 at 01:18:44PM -0500, Hans-Peter Nilsson wrote:
> > (Waking up an old thread with my 2 cents due to being a little
> > behind on reading...)
> >
> > On Sat, 6 Dec 2014, Jakub Jelinek wrote:
> > > On Sat, Dec 06, 2014 at 09:28:57AM +0100, Uros Bizjak wrote:
> > > > > That's already what it does though, did you mean the opposite?  Or 
> > > > > did you
> > > > > mean to write "combine" instead of "compare"?
> > > >
> > > > The above should read "... that existing RTX *combine* pass be updated
> > > > ...", thanks for pointing out!
> > >
> > > Which target actually uses the [(operation) (set (cc) ...)] order in their
> > > *.md patterns?  Even aarch64 and arm use the [(set (cc) ...) (operation)]
> > > order that combine expects, I thought compare-elim was written for those
> > > targets?  If the vast majority of mds use the order that combine expects,
> > > I think it should be easier to adjust compare-elim.c and those few targets
> > > that diverge.
> >
> > The current cc-first order happened more of an accidental
> > opinion than an architectural decision as I vaguely recall, when
> > asking.  We also have the canonical location of a *cc clobber*,
> > i.e. last in a parallel.  For that reason, it then makes sense
> > to have the *cc-setting* last.  Changing rebelling ports doesn't
> > solve that inconsistency.
>
> Clobber is clobber, all clobbers come last, so it has nothing to do if
> cc set is first or second.

You honestly don't see the benefit of using that order also
when there's a cc-setting conceptually in place of a clobber?

For targets where most insns set condition-codes (and that don't
use the deprecated CC0-machinery), those insns will always be
expressed using a parallel with (most often) two members, one
being the "main" part of the insn and the other either a
(clobber (reg:CC ...)) or a (set (reg:CC ...) ...).

There, it doesn't make sense to have a different canonical
order.  For example: people have already brought up error-prone
operand renumbering as a problem, from the perspective of
changing *from* the compare-elim (aka. swapped) order.
Conversely, if it was declared canonical, you'd have to more
often perform otherwise needless operand renumbering in bodies
of define_expand's and define_insns (where you hopefully use
e.g. define_subst to avoid pattern explosion), when you need to
refer to the operands of the "main", non-cc part, for both the
set and the clobber substitution.

I don't insist on changing compare-elim and matching targets,
but declaring the *lack of canonical order* and having gcc cope
(by e.g. matching both), as others have suggested, makes sense.

brgds, H-P


[PATCH, libstdc++] PR libstdc++/64656

2015-01-18 Thread Ville Voutilainen
This patch implements the free functions std::cbegin, std::cend,
std::rbegin, std::rend, std::crbegin and std::crend, which were
missing from our C++14 iterator library. I have run the added test
manually but I haven't finished running the full testsuite yet. I will
send the patch now anyway, if there are some funny line-number
changes that need to be done elsewhere in the testsuite, I will
know in a couple of hours which quantifies to tomorrow morning,
since I won't stay up for it. ;)

2015-01-19  Ville Voutilainen  

PR libstdc++/64656
* include/bits/range_access.h (cbegin, cend, rbegin, rend,
crbegin, crend): New.
* testsuite/24_iterators/range_access_cpp14.cc: New.
diff --git a/libstdc++-v3/include/bits/range_access.h 
b/libstdc++-v3/include/bits/range_access.h
index fa18aa2..e429bcc 100644
--- a/libstdc++-v3/include/bits/range_access.h
+++ b/libstdc++-v3/include/bits/range_access.h
@@ -33,7 +33,7 @@
 #pragma GCC system_header
 
 #if __cplusplus >= 201103L
-
+#include 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -97,6 +97,131 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 end(_Tp (&__arr)[_Nm])
 { return __arr + _Nm; }
 
+#if __cplusplus >= 201402L
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline constexpr auto
+cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont)))
+  -> decltype(std::begin(__cont))
+{ return std::begin(__cont); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline constexpr auto
+cend(const _Container& __cont) noexcept(noexcept(std::end(__cont)))
+  -> decltype(std::end(__cont))
+{ return std::end(__cont); }
+
+  /**
+   *  @brief  Return an iterator pointing to the last element of
+   *  the container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rbegin(_Container& __cont) -> decltype(__cont.rbegin())
+{ return __cont.rbegin(); }
+
+  /**
+   *  @brief  Return an iterator pointing to the last element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rbegin(const _Container& __cont) -> decltype(__cont.rbegin())
+{ return __cont.rbegin(); }
+
+  /**
+   *  @brief  Return an iterator pointing one past the first element of
+   *  the container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rend(_Container& __cont) -> decltype(__cont.rend())
+{ return __cont.rend(); }
+
+  /**
+   *  @brief  Return an iterator pointing one past the first element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rend(const _Container& __cont) -> decltype(__cont.rend())
+{ return __cont.rend(); }
+
+  /**
+   *  @brief  Return an iterator pointing to the last element of
+   *  the array.
+   *  @param  __arr  Array.
+   */
+  template
+inline reverse_iterator<_Tp*>
+rbegin(_Tp (&__arr)[_Nm])
+{ return reverse_iterator<_Tp*>(__arr + _Nm); }
+
+  /**
+   *  @brief  Return an iterator pointing one past the first element of
+   *  the array.
+   *  @param  __arr  Array.
+   */
+  template
+inline reverse_iterator<_Tp*>
+rend(_Tp (&__arr)[_Nm])
+{ return reverse_iterator<_Tp*>(__arr); }
+
+  /**
+   *  @brief  Return an iterator pointing to the last element of
+   *  the initializer_list.
+   *  @param  __il  initializer_list.
+   */
+  template
+inline reverse_iterator
+rbegin(initializer_list<_Tp> __il)
+{ return reverse_iterator(__il.end()); }
+
+  /**
+   *  @brief  Return an iterator pointing one past the first element of
+   *  the initializer_list.
+   *  @param  __il  initializer_list.
+   */
+  template
+inline reverse_iterator
+rend(initializer_list<_Tp> __il)
+{ return reverse_iterator(__il.begin()); }
+
+  /**
+   *  @brief  Return an iterator pointing to the last element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+crbegin(const _Container& __cont) -> decltype(std::rbegin(__cont))
+{ return std::rbegin(__cont); }
+
+  /**
+   *  @brief  Return an iterator pointing one past the first element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+crend(const _Container& __cont) -> decltype(std::rend(__cont))
+{ return std::rend(__cont); }
+
+#endif
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
diff --git a/libstdc++-v3/testsuite/24_iterators/range_access_cpp14.cc 
b/libstdc++-v3/testsuite/24_iterators/range_access_cpp14.cc
new file mode 100644
index 000..d618dba
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators

Re: Compare-elim pass (was: Re: [PATCH] Fix PR 61225)

2015-01-18 Thread Segher Boessenkool
On Sat, Jan 17, 2015 at 01:18:44PM -0500, Hans-Peter Nilsson wrote:
> The current cc-first order happened more of an accidental
> opinion than an architectural decision as I vaguely recall, when
> asking.  We also have the canonical location of a *cc clobber*,
> i.e. last in a parallel.  For that reason, it then makes sense
> to have the *cc-setting* last.  Changing rebelling ports doesn't
> solve that inconsistency.

Except you also have the variant of the insn pattern where the CC is
set and the GPR is clobbered (on PowerPC we have one of those for
every insn, and only a few where CC is clobbered).

> So, my vote for canonically declaring the order non-canonical
> *and* automatically generating/matching both orders.

It would be nice to only have to write the set+set version, and do
some markup to say which of the clobber variants should be generated,
yes.

Having the order canonical is nice for whatever has to match it.
There are a lot more places that have to match it than places that
have to generate it.  We could of course change gen* so you can
write patterns in any order you please in your machine description
files.


Segher


Re: [RFC] POWER8 default for PPC64LE

2015-01-18 Thread Alan Modra
On Sat, Jan 17, 2015 at 09:18:14PM -0500, David Edelsohn wrote:
> Supporting this turned out to be more involved.  --with-cpu implicitly
> adds -mcpu to all specs, which invokes the assembler with the correct
> option.  Directly setting TARGET_DEFAULT does not adjust the assembler
> invocation.

Since you've been looking at this area, please consider reviewing
https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01157.html

-- 
Alan Modra
Australia Development Lab, IBM


Re: Compare-elim pass (was: Re: [PATCH] Fix PR 61225)

2015-01-18 Thread Segher Boessenkool
On Sun, Jan 18, 2015 at 04:26:27PM -0500, Hans-Peter Nilsson wrote:
> For targets where most insns set condition-codes (and that don't
> use the deprecated CC0-machinery), those insns will always be
> expressed using a parallel with (most often) two members, one
> being the "main" part of the insn and the other either a
> (clobber (reg:CC ...)) or a (set (reg:CC ...) ...).
> 
> There, it doesn't make sense to have a different canonical
> order.  For example: people have already brought up error-prone
> operand renumbering as a problem, from the perspective of
> changing *from* the compare-elim (aka. swapped) order.

You don't need to renumber operands, operand numbers can be in
any order.  A big nuisance though is having to move all your
match_dups and match_operands around (the latter should be first
always).

Although that can be fixed in gen* as well of course.

> Conversely, if it was declared canonical, you'd have to more
> often perform otherwise needless operand renumbering in bodies
> of define_expand's and define_insns (where you hopefully use
> e.g. define_subst to avoid pattern explosion), when you need to
> refer to the operands of the "main", non-cc part, for both the
> set and the clobber substitution.

I wish I could use define_subst, but it a) is not generic enough
for most uses, and b) does not handle splitters at all :-(
That is something for a different discussion though.


Segher


Re: [PATCH, libstdc++] PR libstdc++/64656

2015-01-18 Thread Ville Voutilainen
On 19 January 2015 at 00:11, Ville Voutilainen
 wrote:
> This patch implements the free functions std::cbegin, std::cend,
> std::rbegin, std::rend, std::crbegin and std::crend, which were
> missing from our C++14 iterator library. I have run the added test
> manually but I haven't finished running the full testsuite yet. I will
> send the patch now anyway, if there are some funny line-number
> changes that need to be done elsewhere in the testsuite, I will
> know in a couple of hours which quantifies to tomorrow morning,
> since I won't stay up for it. ;)
>
> 2015-01-19  Ville Voutilainen  
>
> PR libstdc++/64656
> * include/bits/range_access.h (cbegin, cend, rbegin, rend,
> crbegin, crend): New.
> * testsuite/24_iterators/range_access_cpp14.cc: New.

Minor additions:
- add a comment to the #endif for the c++14 #if
- fix the doc comments to talk about reverse iterators

This passes the testsuite.
diff --git a/libstdc++-v3/include/bits/range_access.h 
b/libstdc++-v3/include/bits/range_access.h
index fa18aa2..a5a511c 100644
--- a/libstdc++-v3/include/bits/range_access.h
+++ b/libstdc++-v3/include/bits/range_access.h
@@ -33,7 +33,7 @@
 #pragma GCC system_header
 
 #if __cplusplus >= 201103L
-
+#include 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -97,6 +97,131 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 end(_Tp (&__arr)[_Nm])
 { return __arr + _Nm; }
 
+#if __cplusplus >= 201402L
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline constexpr auto
+cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont)))
+  -> decltype(std::begin(__cont))
+{ return std::begin(__cont); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline constexpr auto
+cend(const _Container& __cont) noexcept(noexcept(std::end(__cont)))
+  -> decltype(std::end(__cont))
+{ return std::end(__cont); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing to the last element of
+   *  the container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rbegin(_Container& __cont) -> decltype(__cont.rbegin())
+{ return __cont.rbegin(); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing to the last element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rbegin(const _Container& __cont) -> decltype(__cont.rbegin())
+{ return __cont.rbegin(); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing one past the first element of
+   *  the container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rend(_Container& __cont) -> decltype(__cont.rend())
+{ return __cont.rend(); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing one past the first element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+rend(const _Container& __cont) -> decltype(__cont.rend())
+{ return __cont.rend(); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing to the last element of
+   *  the array.
+   *  @param  __arr  Array.
+   */
+  template
+inline reverse_iterator<_Tp*>
+rbegin(_Tp (&__arr)[_Nm])
+{ return reverse_iterator<_Tp*>(__arr + _Nm); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing one past the first element of
+   *  the array.
+   *  @param  __arr  Array.
+   */
+  template
+inline reverse_iterator<_Tp*>
+rend(_Tp (&__arr)[_Nm])
+{ return reverse_iterator<_Tp*>(__arr); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing to the last element of
+   *  the initializer_list.
+   *  @param  __il  initializer_list.
+   */
+  template
+inline reverse_iterator
+rbegin(initializer_list<_Tp> __il)
+{ return reverse_iterator(__il.end()); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing one past the first element of
+   *  the initializer_list.
+   *  @param  __il  initializer_list.
+   */
+  template
+inline reverse_iterator
+rend(initializer_list<_Tp> __il)
+{ return reverse_iterator(__il.begin()); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing to the last element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+crbegin(const _Container& __cont) -> decltype(std::rbegin(__cont))
+{ return std::rbegin(__cont); }
+
+  /**
+   *  @brief  Return a reverse iterator pointing one past the first element of
+   *  the const container.
+   *  @param  __cont  Container.
+   */
+  template
+inline auto
+crend(const _Container& __cont) -> decltype(std::rend(__cont))
+{ return std::rend(__

Re: Use static chain and libffi for Go closures

2015-01-18 Thread Ian Lance Taylor
On Sat, Jan 17, 2015 at 2:42 PM, Richard Henderson  wrote:
>
> I tested non-support of libffi go closures before applying the patches
> for them for ppc, but I guess I busted something in the meantime.
>
> Please try this.

I don't think that will work if configured with --without-libffi.

I'm going to commit this patch, which seems simpler and should fix
this problem.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu, where admittedly the problem does not occur.

Ian
diff -r 49d48c62427f libgo/go/reflect/makefunc.go
--- a/libgo/go/reflect/makefunc.go  Fri Jan 16 15:22:43 2015 -0800
+++ b/libgo/go/reflect/makefunc.go  Sun Jan 18 18:52:45 2015 -0800
@@ -63,7 +63,7 @@
method: -1,
}
 
-   makeFuncFFI(ftyp, impl)
+   makeFuncFFI(ftyp, unsafe.Pointer(impl))
 
return Value{t, unsafe.Pointer(&impl), flag(Func) | flagIndir}
 }
@@ -102,7 +102,7 @@
rcvr:   rcvr,
}
 
-   makeFuncFFI(ftyp, fv)
+   makeFuncFFI(ftyp, unsafe.Pointer(fv))
 
return Value{ft, unsafe.Pointer(&fv), v.flag&flagRO | flag(Func) | 
flagIndir}
 }
@@ -128,7 +128,7 @@
rcvr:   v,
}
 
-   makeFuncFFI(ftyp, impl)
+   makeFuncFFI(ftyp, unsafe.Pointer(impl))
 
return Value{t, unsafe.Pointer(&impl), v.flag&flagRO | flag(Func) | 
flagIndir}
 }
diff -r 49d48c62427f libgo/go/reflect/makefunc_ffi.go
--- a/libgo/go/reflect/makefunc_ffi.go  Fri Jan 16 15:22:43 2015 -0800
+++ b/libgo/go/reflect/makefunc_ffi.go  Sun Jan 18 18:52:45 2015 -0800
@@ -10,7 +10,7 @@
 
 // The makeFuncFFI function, written in C, fills in an FFI closure.
 // It arranges for ffiCall to be invoked directly from FFI.
-func makeFuncFFI(ftyp *funcType, impl *makeFuncImpl)
+func makeFuncFFI(ftyp *funcType, impl unsafe.Pointer)
 
 // FFICallbackGo implements the Go side of the libffi callback.
 // It is exported so that C code can call it.
diff -r 49d48c62427f libgo/go/reflect/makefunc_ffi_c.c
--- a/libgo/go/reflect/makefunc_ffi_c.c Fri Jan 16 15:22:43 2015 -0800
+++ b/libgo/go/reflect/makefunc_ffi_c.c Sun Jan 18 18:52:45 2015 -0800
@@ -18,7 +18,7 @@
 
 /* Declare C functions with the names used to call from Go.  */
 
-void makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
+void makeFuncFFI(const struct __go_func_type *ftyp, void *impl)
   __asm__ (GOSYM_PREFIX "reflect.makeFuncFFI");
 
 #ifdef USE_LIBFFI_CLOSURES
@@ -70,7 +70,7 @@
 /* Allocate an FFI closure and arrange to call ffi_callback.  */
 
 void
-makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
+makeFuncFFI(const struct __go_func_type *ftyp, void *impl)
 {
   ffi_cif *cif;
 
@@ -83,7 +83,7 @@
 #else /* !defined(USE_LIBFFI_CLOSURES) */
 
 void
-makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
+makeFuncFFI(const struct __go_func_type *ftyp, void *impl)
 {
   runtime_panicstring ("libgo built without FFI does not support "
   "reflect.MakeFunc");


[patch, Fortran] PR61933 Inquire on Internal Units

2015-01-18 Thread Jerry DeLisle
I reopened this PR to do some cleanup and to address a use case presented by 
Joost in comment #7 of the subject PR.


The fundamental problem: if the variable containing the unit number in an 
INQUIRE statement is of type KIND greater than 4 and the value is outside the 
range of a KIND=4 we cannot test for it within the run-time library.  Unit 
numbers are passed to the run-time in the IOPARM structures as a KIND=4. KIND=8 
are cast into the KIND=4.  The test case gfortran.dg/negative_unit_int8.f 
illustrates a case where a bogus unit number can get passed to the library.


To resolve this previously we built range checks in trans_io.c 
(set_parameter_value) that tests the unit numbers and issues an error call to 
the run-time library.  This is fine for all statements except INQUIRE which 
should not give an error. However, we do want to identify such an out-of-range 
unit number as not existing.


This patch changes this by renaming the previous set_parameter_value to 
set_parameter_value_chk.  I then created a new version of set_parameter_value 
that does no checking so that it can be used where generating errors is not 
needed.  I have created two new functions which build code that tests for the 
out of range cases specific to INQUIRE.  If a bad unit number is found, the UNIT 
value in the IOPARM structure is set to -2, a new reserved value. (after this 
patch we will have reserved values -3 thru -9 still available for future uses)


The definition of unit existence is adjusted to be any negative unit currently 
connected having been created with NEWUNIT and all KIND=4 positive values.  A -2 
indicating an invalid unit will, by default, return EXISTS=false.


The behind the scenes testing is never seen in user space as shown here with an 
-fdump-tree-original example from the negative_unit_int8.f .


For non-INQUIRE cases:

D.3384 = i;
if (D.3384 < -2147483647)
  {
_gfortran_generate_error (&dt_parm.0, 5005, &"Unit number in I/O 
statement too small"

[1]{lb: 1 sz: 1});
  }
if (D.3384 > 2147483647)
  {
_gfortran_generate_error (&dt_parm.0, 5005, &"Unit number in I/O 
statement too large"

[1]{lb: 1 sz: 1});
  }
dt_parm.0.common.unit = (integer(kind=4)) D.3384;

For the new INQUIRE case:

integer(kind=8) i;

--- snip ---

inquire_parm.4.common.unit = (integer(kind=4)) i;<---notice the conversion 
to kind=4 here

D.3393 = i;
if (D.3393 < 0)
  {
inquire_parm.4.common.unit = -2;
  }
if (D.3393 > 2147483647)
  {
inquire_parm.4.common.unit = -2;
  }

When all is acceptable, common.unit is untouched and the normal assignment has 
happened.  The users variable, in this case i, is untouched as well because of 
the temporary D.3393.  The IOPARM stucture is also temporary and not used again.


The patch updates the test case mentioned above.

Regression tested on x86-64 and Joost's case in the PR now works as expected.

OK for trunk?

Regards,

Jerry


2015-01-18  Jerry DeLisle  

PR fortran/61933
* trans-io.c (set_parameter_value): Delete use of has_iostat.
Redefine to not generate any runtime error check calls.
(set_parameter_value_chk): Rename of the former
set_parameter_value with the runtimr error checks and fix
whitespace. (gfc_trans_io_inquire_check): New function that
builds a runtime conditional block to set the INQUIRE
common parameter block unit number to -2 when unit numbers
exceed positive KIND=4 limits. (set_parameter_value_inquire):
New function that builds the conditional expressions and calls
gfc_trans_io_inquire_check. (gfc_trans_open): Whitespace.  For
unit, use the renamed set_parameter_value_chk.
(gfc_trans_close): Likewise use renamed function.
(build_filepos): Whitespace and use renamed function.
(gfc_trans_inquire): Whitespace and for unit use
set_parameter_value and set_parameter_value_inquire.
(gfc_trans_wait): Remove p->iostat from call to
set_parameter_value. Use new set_parameter_value_chk for unit.
(build_dt): Use the new set_parameter_value without p->iostat
and fix whitespace. Use set_parameter_value_chk for unit.

2015-01-18  Jerry DeLisle  

PR libgfortran/61933
* io/inquire.c (inquire_via_unit): Set existing to true for
any negative unit that is currently connected and any positive
units within range of KIND=4 value.  The unit value for any out
of range case that may occur if the user is using a KIND=8 will
have been set to -2 which is reserved and can never be opened,
and therefore the unit does not exist.
Index: gcc/fortran/trans-io.c
===
--- gcc/fortran/trans-io.c	(revision 219703)
+++ gcc/fortran/trans-io.c	(working copy)
@@ -512,7 +512,37 @@ set_parameter_const (stmtblock_t *block, t

Re: Compare-elim pass (was: Re: [PATCH] Fix PR 61225)

2015-01-18 Thread Jakub Jelinek
On Sun, Jan 18, 2015 at 05:28:39PM -0600, Segher Boessenkool wrote:
> On Sat, Jan 17, 2015 at 01:18:44PM -0500, Hans-Peter Nilsson wrote:
> > The current cc-first order happened more of an accidental
> > opinion than an architectural decision as I vaguely recall, when
> > asking.  We also have the canonical location of a *cc clobber*,
> > i.e. last in a parallel.  For that reason, it then makes sense
> > to have the *cc-setting* last.  Changing rebelling ports doesn't
> > solve that inconsistency.
> 
> Except you also have the variant of the insn pattern where the CC is
> set and the GPR is clobbered (on PowerPC we have one of those for
> every insn, and only a few where CC is clobbered).
> 
> > So, my vote for canonically declaring the order non-canonical
> > *and* automatically generating/matching both orders.
> 
> It would be nice to only have to write the set+set version, and do
> some markup to say which of the clobber variants should be generated,
> yes.

define_subst should be able to do that.

Jakub


Re: [PATCH 01/10] rs6000: Clobber XER[CA] in all user asm statements

2015-01-18 Thread Hans-Peter Nilsson
On Mon, 8 Dec 2014, Segher Boessenkool wrote:

> A lot of old user code clobbers the carry bit without telling the compiler
> about it.  This used to just work, because the compiler never used the bit
> outside of a single RTL instruction.  But that will change.  Let's clobber
> the carry bit in every asm; this isn't very expensive.

There's also the option of clobbering it only if it's not
explicitly mentioned in the asm, say with a singleton
regclass, see cris_md_asm_clobbers.

brgds, H-P


Re: [PATCH][wwwdocs] Mention -freport-bug in release notes

2015-01-18 Thread Yury Gribov

Hi Gerald,


how about the following variation (which I have not committed yet)?


The wording is good but the patch places the comment into gcc-ar section 
which is wrong. Perhaps make a separate section for driver like this?


-Y
Index: htdocs/gcc-5/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.66
diff -u -r1.66 changes.html
--- htdocs/gcc-5/changes.html	17 Jan 2015 11:52:18 -	1.66
+++ htdocs/gcc-5/changes.html	19 Jan 2015 07:37:54 -
@@ -572,5 +572,11 @@
 The gcc-ar, gcc-nm, gcc-ranlib wrappers now
 	understand a -B option to set the compiler to use.
   
+  
+  
+When the new command-line option -freport-bug is
+  used, GCC automatically generates a developer-friendly reproducer
+  whenever an internal compiler error is encountered.
+