Re: [patch] New backend header reduction

2015-11-01 Thread Thomas Schwinge
Hi!

"Hooray for the C programming language's module system"...  ;-)

On Fri, 23 Oct 2015 12:53:40 -0400, Andrew MacLeod  wrote:
> Just finished running...  I think the external hard drive was slowing 
> down this run :-P  It took quite a while.
> 
> Anyway, this is the reduction patch independent of the header-ordering 
> patch... ie, that patch needs to be applied before this one.   So this 
> should be mostly just removals.   I also need to follow up and build all 
> the target and bootstrap from scratch to make sure there arent any 
> weirdnesses with it.   But you can at least get a look at it now.

Similar to the ENABLE_OFFLOADING preprocessor conditional as reported by
Cesar and Nathan, I've run into a problem with code "hidden" behind
ENABLE_FOLD_CHECKING, and this has independently also been reported as
:

[...]/source-gcc/gcc/fold-const.c: In function 'tree_node* fold(tree)':
[...]/source-gcc/gcc/fold-const.c:12038:18: error: aggregate 'md5_ctx ctx' 
has incomplete type and cannot be defined
   struct md5_ctx ctx;
  ^

..., followed by many more errors.

As obvious, committed in r229652:

commit b7c78b0949974f6e22fa9a3f3eca665442641ec8
Author: tschwinge 
Date:   Mon Nov 2 07:42:04 2015 +

[PR middle-end/68166] Restore build with fold checking enabled

gcc/
PR middle-end/68166
* fold-const.c: Include "md5.h".

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229652 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog| 5 +
 gcc/fold-const.c | 1 +
 2 files changed, 6 insertions(+)

diff --git gcc/ChangeLog gcc/ChangeLog
index d927d35..966a7f9 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-02  Thomas Schwinge  
+
+   PR middle-end/68166
+   * fold-const.c: Include "md5.h".
+
 2015-11-01  Jeff Law 
 
* vmsdbgout.c: Revert unused header file reduction patch.
diff --git gcc/fold-const.c gcc/fold-const.c
index 197ccfd..1a2fb810 100644
--- gcc/fold-const.c
+++ gcc/fold-const.c
@@ -71,6 +71,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-fold.h"
 #include "params.h"
 #include "tree-into-ssa.h"
+#include "md5.h"
 
 #ifndef LOAD_EXTEND_OP
 #define LOAD_EXTEND_OP(M) UNKNOWN


Grüße
 Thomas


signature.asc
Description: PGP signature


Re: [wwwdocs] GCC 6 Release Notes for RTEMS

2015-11-01 Thread Sebastian Huber

Hello Gerald,

On 31/10/15 21:36, Gerald Pfeifer wrote:

Hi Sebastian,

what do you think about the follow-up patch below, on top of
your original patch?


thanks for the style changes.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



Re: [PATCH 0/2] Levenshtein-based suggestions (v3)

2015-11-01 Thread Jeff Law

On 10/30/2015 06:47 AM, David Malcolm wrote:


The typename suggestion seems to be at least somewhat controversial,
whereas (I hope) the misspelled field names suggestion is more
acceptable.

Hence I'm focusing on the field name lookup for now; other uses of the
algorithm (e.g. the typename lookup) could be done in followup patches,
but I'm deferring them for now in the hope of getting the simplest case
into trunk as a first step.  Similarly, for simplicity, I didn't
implement any attempt at error-recovery using the hint.

The following patch kit is in two parts (for ease of review; they would
be applied together):

   patch 1: Implement Levenshtein distance
   patch 2: C FE: suggest corrections for misspelled field names

I didn't implement a limiter, on the grounds that this only fires
once per "has no member named" error, and so is unlikely to slow
things down noticeably.

Successfully bootstrapped®rtested the combination of these two
on x86_64-pc-linux-gnu (adds 11 new PASS results to gcc.sum)

OK for trunk?

  gcc/Makefile.in  |   1 +
  gcc/c/c-typeck.c |  70 +++-
  gcc/spellcheck.c | 136 +++
  gcc/spellcheck.h |  32 ++
  gcc/testsuite/gcc.dg/plugin/levenshtein-test-1.c |   9 ++
  gcc/testsuite/gcc.dg/plugin/levenshtein_plugin.c |  64 +++
  gcc/testsuite/gcc.dg/plugin/plugin.exp   |   1 +
  gcc/testsuite/gcc.dg/spellcheck-fields.c |  63 +++
  8 files changed, 375 insertions(+), 1 deletion(-)
  create mode 100644 gcc/spellcheck.c
  create mode 100644 gcc/spellcheck.h
  create mode 100644 gcc/testsuite/gcc.dg/plugin/levenshtein-test-1.c
  create mode 100644 gcc/testsuite/gcc.dg/plugin/levenshtein_plugin.c
  create mode 100644 gcc/testsuite/gcc.dg/spellcheck-fields.c

I'm going to assume you got levenshtein's algorithm reasonably correct.

This is OK for the trunk.  Obviously I'd like to see it extend into the 
other front-ends (C++ in particular).  Then I'd like to see it extend 
beyond just misspelled field names.


jeff



Re: [patch] New 'all' front end header reduction

2015-11-01 Thread Jeff Law

On 10/30/2015 07:37 AM, Andrew MacLeod wrote:

OK, here's the much delayed front end reduction patch based on the
reordering already being checked in.

I discovered that my targets builds were only building c/c++, so the
other languages were being reduced based only on the host
x86_64-pc-linux-gnu build.   Thats *probably* ok, but I wanted to be
sure.  This is when I discovered that the other languages have varying
amounts of support amongst the targets. Simply building all the targets
to compile, say ada, doesn't actually work quite right.

So this patch covers all the languages which do have full support.. the
ones enabled by 'all' languages.

I am determining which targets build the other languages now, and will
submit separate reduction patches for those languages.

This bootstraps on  x86_64-pc-linux-gnu with no new regressions, and is
currently undergoing the full config-list target build.

OK for trunk?

OK, assuming the config-list build was successful.

jeff



[PATCH] Avoid ssa-thread-11.c on various targets

2015-11-01 Thread Jeff Law
This test is sensitive to the branch costing on the target.  The target 
selector ought to be fairly accurate now.


Installed on the trunk.

Jeff
commit 3659591cfec9c1a0b84ce6a076bf3b398a4dea66
Author: law 
Date:   Mon Nov 2 05:59:19 2015 +

[PATCH] Avoid ssa-thread-11.c on various targets

* gcc.dg/tree-ssa/ssa-thread-11.c: Update target selector.

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

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c1499f8..4d91e50 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-11-01  Jeff Law  
+
+   * gcc.dg/tree-ssa/ssa-thread-11.c: Update target selector.
+
 2015-11-01  Uros Bizjak  
 
* gcc.target/i386/pr67609-2.c: Include sse2-check.h.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c 
b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
index 03d0334..6a076e1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { ! { logical_op_short_circuit || { m68k*-*-* 
mep*-*-* bfin*-*-* v850*-*-* moxie*-*-* m32c*-*-* fr30*-*-* mcore*-*-* frv-*-* 
h8300-*-* m32r-*-* mn10300-*-* msp430-*-* pdp11-*-* rl78-*-* rx-*-* vax-*-*} } 
} } } */
 /* { dg-options "-O2 -fdump-tree-vrp2-details" } */
 /* { dg-final { scan-tree-dump "FSM" "vrp2" } } */
 


[PATCH] Fix vms targets

2015-11-01 Thread Jeff Law


The header reduction didn't seem to handle the vms targets correctly. 
This reverts that part of Andrew's patch which allows the alpha, alpha64 
and ia64 vms targets to build again.


Installed on the trunk.  That covers all the fallout from standard 
builds of config-list.mk that I'm aware of.




Jeff
commit 1eddb04c7103a2f87118fc98111c1877b544a6a9
Author: law 
Date:   Mon Nov 2 05:27:14 2015 +

[PATCH] Fix vms targets

* vmsdbgout.c: Revert unused header file reduction patch.

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

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1ce0d36..d927d35 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,7 @@
 2015-11-01  Jeff Law 
 
+   * vmsdbgout.c: Revert unused header file reduction patch.
+
* config/mcore/mcore.c: Include regs.h.
 
 2015-10-31  Segher Boessenkool  
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index 26dd590..d41d4b2 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tm.h"
 
 #ifdef VMS_DEBUGGING_INFO
 #include "alias.h"


[PATCH] Fix mcore-elf builds

2015-11-01 Thread Jeff Law


Something must have changed as mcore-elf isn't building because mcore.c 
doesn't have access to reg_renumber via regs.h.


Fixed in the obvious way and verified that mcore-elf builds again.

Jeff

commit dc49c8409d2ed0ee53618fc334c7c72401550992
Author: Jeff Law 
Date:   Sun Nov 1 22:13:54 2015 -0700

* config/mcore/mcore.c: Include regs.h.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ff4a7ff..1ce0d36 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2015-11-01  Jeff Law 
+
+   * config/mcore/mcore.c: Include regs.h.
+
 2015-10-31  Segher Boessenkool  
 
* config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Rewrite.
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index b42f633..9ca2326 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -38,6 +38,7 @@
 #include "expr.h"
 #include "cfgrtl.h"
 #include "builtins.h"
+#include "regs.h"
 
 /* This file should be included last.  */
 #include "target-def.h"


Allow matching of side effects in operand_equal_p

2015-11-01 Thread Jan Hubicka
Hi,
this patch adds OEP_MATCH_SIDE_EFFECT to tell operand_equal_p that the two
operands compared are from different code paths and thus they can be matched
even if they have side effects.

I.e. 

volatile int a;

if (a==a)

has two reads and thus can't be optimized (I guess), while

b?a:a

can be optimized.  OEP_MATCH_SIDE_EFFECTS will be needed by ipa-icf.  I changed
gimple_operand_equal_value_p in tail-merge to use it.  I do not know how to
make the folding of ?: happen, since there seems to be no way to specify flags
to match_operand in match.pd. This makes it hard to construct a testcase - all
my attempts to trick tree-ssa-tailmerge to merge something that involve volatile
operands failed, because it uses GVN to compare and GVN punt on these.

I also wonder if we can drop OEP_CONSTANT_ADDRESS_OF. The only difference is 
that
OEP_MATCH_SIDE_EFFECTS permits function calls.  I think those should not appear
in constant addresses.

Bootstrapped/regtested x86_64-linux, OK?

* tree-core.h (OEP_MATCH_SIDE_EFFECTS): New.
* tree-ssa-tail-merge.c (gimple_operand_equal_value_p): Pass
OEP_MATCH_SIDE_EFFECTS
* fold-const.c (operand_equal_p): Support OEP_MATCH_SIDE_EFFECTS.
Index: tree-core.h
===
--- tree-core.h (revision 229263)
+++ tree-core.h (working copy)
@@ -732,7 +732,8 @@ enum operand_equal_flag {
   OEP_ONLY_CONST = 1,
   OEP_PURE_SAME = 2,
   OEP_CONSTANT_ADDRESS_OF = 4,
-  OEP_ADDRESS_OF = 8
+  OEP_ADDRESS_OF = 8,
+  OEP_MATCH_SIDE_EFFECTS = 16
 };
 
 /* Enum and arrays used for tree allocation stats.
Index: tree-ssa-tail-merge.c
===
--- tree-ssa-tail-merge.c   (revision 229263)
+++ tree-ssa-tail-merge.c   (working copy)
@@ -1091,7 +1091,7 @@ gimple_operand_equal_value_p (tree t1, t
   || t2 == NULL_TREE)
 return false;
 
-  if (operand_equal_p (t1, t2, 0))
+  if (operand_equal_p (t1, t2, OEP_MATCH_SIDE_EFFECTS))
 return true;
 
   return gvn_uses_equal (t1, t2);
Index: fold-const.c
===
--- fold-const.c(revision 229494)
+++ fold-const.c(working copy)
@@ -2657,8 +2657,7 @@ combine_comparisons (location_t loc,
 }
 
 /* Return nonzero if two operands (typically of the same tree node)
-   are necessarily equal.  If either argument has side-effects this
-   function returns zero.  FLAGS modifies behavior as follows:
+   are necessarily equal. FLAGS modifies behavior as follows:
 
If OEP_ONLY_CONST is set, only return nonzero for constants.
This function tests whether the operands are indistinguishable;
@@ -2685,7 +2684,12 @@ combine_comparisons (location_t loc,
If OEP_ADDRESS_OF is set, we are actually comparing addresses of objects,
not values of expressions.  OEP_CONSTANT_ADDRESS_OF in addition to
OEP_ADDRESS_OF is used for ADDR_EXPR with TREE_CONSTANT flag set and we
-   further ignore any side effects on SAVE_EXPRs then.  */
+   further ignore any side effects on SAVE_EXPRs then.
+
+   Unless OEP_MATCH_SIDE_EFFECTS is set, the function returns false on
+   any operand with side effect.  This is unnecesarily conservative in the
+   case we know that arg0 and arg1 are in disjoint code paths (such as in
+   ?: operator).  */
 
 int
 operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
@@ -2814,7 +2818,7 @@ operand_equal_p (const_tree arg0, const_
  they are necessarily equal as well.  */
   if (arg0 == arg1 && ! (flags & OEP_ONLY_CONST)
   && (TREE_CODE (arg0) == SAVE_EXPR
- || (flags & OEP_CONSTANT_ADDRESS_OF)
+ || (flags & (OEP_CONSTANT_ADDRESS_OF | OEP_MATCH_SIDE_EFFECTS))
  || (! TREE_SIDE_EFFECTS (arg0) && ! TREE_SIDE_EFFECTS (arg1
 return 1;
 
@@ -2936,7 +2940,7 @@ operand_equal_p (const_tree arg0, const_
   /* If either of the pointer (or reference) expressions we are
 dereferencing contain a side effect, these cannot be equal,
 but their addresses can be.  */
-  if ((flags & OEP_CONSTANT_ADDRESS_OF) == 0
+  if ((flags & (OEP_CONSTANT_ADDRESS_OF | OEP_MATCH_SIDE_EFFECTS)) == 0
  && (TREE_SIDE_EFFECTS (arg0)
  || TREE_SIDE_EFFECTS (arg1)))
return 0;
@@ -3097,15 +3101,16 @@ operand_equal_p (const_tree arg0, const_
return 0;
}
 
- {
-   unsigned int cef = call_expr_flags (arg0);
-   if (flags & OEP_PURE_SAME)
- cef &= ECF_CONST | ECF_PURE;
-   else
- cef &= ECF_CONST;
-   if (!cef)
- return 0;
- }
+ if (!(flags & OEP_MATCH_SIDE_EFFECTS))
+   {
+ unsigned int cef = call_expr_flags (arg0);
+ if (flags & OEP_PURE_SAME)
+   cef &= ECF_CONST | ECF_PURE;
+ else
+   cef &= ECF_CONST;
+ if (!cef)
+   return 0;
+   

Re: [PATCH 4/4] Add -Wmisleading-indentation to -Wall

2015-11-01 Thread Patrick Palka
On Fri, Oct 30, 2015 at 5:03 AM, Richard Biener
 wrote:
> On Thu, Oct 29, 2015 at 6:38 PM, Jeff Law  wrote:
>> On 10/29/2015 10:49 AM, David Malcolm wrote:
>>>
>>> Our documentation describes -Wall as enabling "all the warnings about
>>> constructions that some users consider questionable, and that are easy to
>>> avoid
>>> (or modify to prevent the warning), even in conjunction with macros."
>>>
>>> I believe that -Wmisleading-indentation meets these criteria, and is
>>> likely to be of benefit to users who may not read release notes; it
>>> warns for indentation that's misleading, but not for indentation
>>> that's merely bad: the former are places where a user will likely
>>> want to fix the code.
>>>
>>> The fix is usually easy and obvious: fix the misleadingly-indented
>>> code.  If that isn't an option for some reason, pragmas can be used to
>>> turn off the warning for a particular fragment of code:
>>>
>>>#pragma GCC diagnostic push
>>>#pragma GCC diagnostic ignored "-Wmisleading-indentation"
>>>  if (flag)
>>>x = 3;
>>>y = 2;
>>>#pragma GCC diagnostic pop
>>>
>>> -Wmisleading-indentation has been tested with a variety of indentation
>>> styles (see gcc/testsuite/c-c++-common/Wmisleading-indentation.c)
>>> and on a variety of real-world projects.  For example, in:
>>>https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg119790.html
>>> Patrick reports:
>>> "Tested by building the linux, git, vim, sqlite and gdb-binutils sources
>>>   with -Wmisleading-indentation."
>>>
>>> With the tweak earlier in this kit I believe we now have a good
>>> enough signal:noise ratio for this warning to be widely used; hence this
>>> patch adds the warning to -Wall.
>>>
>>> Bootstrapped®rtested with x86_64-pc-linux-gnu.
>>>
>>> OK for trunk?
>>>
>>> gcc/c-family/ChangeLog:
>>> * c.opt (Wmisleading-indentation): Add to -Wall for C and C++.
>>>
>>> gcc/ChangeLog:
>>> * doc/invoke.texi (-Wall): Add -Wmisleading-indentation to the
>>> list.
>>> (-Wmisleading-indentation): Update documentation to reflect
>>> being enabled by -Wall in C/C++.
>>
>> I'm sure we'll get some grief for this :-)
>>
>> Approved once we're clean in GCC.  I'm going to explicitly say that we'll
>> have to watch for fallout, particularly as we start getting feedback from
>> Debian & Fedora mass-rebuilds as we approach release time.  If the fallout
>> is too bad, we'll have to reconsider.
>>
>> I'll pre-approve patches which fix anything caught by this option in GCC as
>> long as the fix just adjusts whitespace :-)
>
> Please at least check also binutils and gdb and other packages that use 
> -Werror
> (well, just rebuild Fedora world).

FYI binutils, gdb and glibc, from git, all fail to build due to
-Wmisleading-indentation warnings/errors. (None of the warnings are
bogus (IMO), though I don't think any of the warnings expose a real
bug either.)


[PATCH] PR fortran/68151 -- Check CASE selector for valid type

2015-11-01 Thread Steve Kargl
The attach patch add checking for a valid type during
matching of a CASE selector.  Built and regression
tested on i386-*-freebsd.  OK to commit?

2015-11-01  Steven G. Kargl  

PR fortran/68151
* match.c (match_case_selector):  Check for invalid type.

2015-11-01  Steven G. Kargl  

PR fortran/68151
* gfortran.dg/pr68151.f90: New test.

-- 
Steve
Index: gcc/fortran/match.c
===
--- gcc/fortran/match.c	(revision 229634)
+++ gcc/fortran/match.c	(working copy)
@@ -5036,6 +5036,15 @@ match_case_selector (gfc_case **cp)
 	goto need_expr;
   if (m == MATCH_ERROR)
 	goto cleanup;
+
+  /* F08:C830 case-expr shall be of type character, integer, or logical.  */
+  if (c->high->ts.type != BT_LOGICAL && c->high->ts.type != BT_INTEGER
+	  && c->high->ts.type != BT_CHARACTER)
+	{
+	  gfc_error ("Expression in CASE at %L cannot be %s",
+		 &c->high->where, gfc_typename (&c->high->ts));
+	  goto cleanup;
+	}
 }
   else
 {
@@ -5045,6 +5054,15 @@ match_case_selector (gfc_case **cp)
   if (m == MATCH_NO)
 	goto need_expr;
 
+  /* F08:C830 case-expr shall be of type character, integer, or logical.  */
+  if (c->low->ts.type != BT_LOGICAL && c->low->ts.type != BT_INTEGER
+	  && c->low->ts.type != BT_CHARACTER)
+	{
+	  gfc_error ("Expression in CASE at %L cannot be %s",
+		 &c->low->where, gfc_typename (&c->low->ts));
+	  goto cleanup;
+	}
+
   /* If we're not looking at a ':' now, make a range out of a single
 	 target.  Else get the upper bound for the case range.  */
   if (gfc_match_char (':') != MATCH_YES)
Index: gcc/testsuite/gfortran.dg/pr68151.f90
===
--- gcc/testsuite/gfortran.dg/pr68151.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/pr68151.f90	(working copy)
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! PR fortran/68151
+! Original code contribute by Gerhard Steinmetz
+! 
+!
+program p
+   integer :: k = 1
+   select case (k)
+   case (:huge(1._4))   ! { dg-error "Expression in CASE" }
+   case (:huge(2._8))   ! { dg-error "Expression in CASE" }
+   case ((1.0,2.0)) ! { dg-error "Expression in CASE" }
+   end select
+end


Re: libgo patch committed: Update to Go 1.5 release

2015-11-01 Thread Ian Lance Taylor
On Sun, Nov 1, 2015 at 1:39 AM, Andreas Schwab  wrote:
> ../../../../libgo/go/syscall/exec_linux.go:185:37: error: reference to 
> undefined name 'TIOCSPGRP'
>_, err1 = raw_ioctl_ptr(sys.Ctty, TIOCSPGRP, unsafe.Pointer(&pgrp))
>  ^
>
> $ grep TIOCSPGRP gen-sysinfo.go
> // unknowndefine TIOCSPGRP _IOW('t', 118, int)

I have committed this patch which may fix the problem.  Let me know if
it still happens for you.  Thanks.

Ian
Index: gcc/go/gofrontend/MERGE
===
--- gcc/go/gofrontend/MERGE (revision 229642)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-65ff1d5fb581717229e5c02796d719671a1e8628
+6b4b969f552b8f9ac87a715d5ad06e52bd031b60
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/mksysinfo.sh
===
--- libgo/mksysinfo.sh  (revision 229616)
+++ libgo/mksysinfo.sh  (working copy)
@@ -183,6 +183,9 @@ enum {
 #ifdef TIOCSCTTY
   TIOCSCTTY_val = TIOCSCTTY,
 #endif
+#ifdef TIOCSPGRP
+  TIOCSPGRP_val = TIOCSPGRP,
+#endif
 #ifdef TIOCGPTN
   TIOCGPTN_val = TIOCGPTN,
 #endif
@@ -917,6 +920,11 @@ if ! grep '^const TIOCSCTTY' ${OUT} >/de
 echo 'const TIOCSCTTY = _TIOCSCTTY_val' >> ${OUT}
   fi
 fi
+if ! grep '^const TIOCSPGRP' ${OUT} >/dev/null 2>&1; then
+  if grep '^const _TIOCSPGRP_val' ${OUT} >/dev/null 2>&1; then
+echo 'const TIOCSPGRP = _TIOCSPGRP_val' >> ${OUT}
+  fi
+fi
 if ! grep '^const TIOCGPTN' ${OUT} >/dev/null 2>&1; then
   if grep '^const _TIOCGPTN_val' ${OUT} >/dev/null 2>&1; then
 echo 'const TIOCGPTN = _TIOCGPTN_val' >> ${OUT}


Go patch committed: Traverse types of call expression

2015-11-01 Thread Ian Lance Taylor
GCC PR 67968 provides a test case that causes a gccgo crash.  The
crash is because the compiler failed to build the hash and equality
functions required for a type descriptor.  The descriptor is for an
unnamed type that is being returned by a function imported from a
different package.  The unnamed type is being implicitly converted to
an interface type by a return statement.  The fix is to ensure that
the type of a call expression is always traversed.  Bootstrapped and
ran Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline and 5
branch.

Test case sent out for the master testsuite as https://golang.org/cl/16532 .

Ian
Index: gcc/go/gofrontend/MERGE
===
--- gcc/go/gofrontend/MERGE (revision 229636)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-1c1f226662a6c84eae83f8aaec3d4503e70be843
+65ff1d5fb581717229e5c02796d719671a1e8628
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/expressions.cc
===
--- gcc/go/gofrontend/expressions.cc(revision 229541)
+++ gcc/go/gofrontend/expressions.cc(working copy)
@@ -8608,6 +8608,16 @@ Builtin_call_expression::do_export(Expor
 int
 Call_expression::do_traverse(Traverse* traverse)
 {
+  // If we are calling a function in a different package that returns
+  // an unnamed type, this may be the only chance we get to traverse
+  // that type.  We don't traverse this->type_ because it may be a
+  // Call_multiple_result_type that will just lead back here.
+  if (this->type_ != NULL && !this->type_->is_error_type())
+{
+  Function_type *fntype = this->get_function_type();
+  if (fntype != NULL && Type::traverse(fntype, traverse) == TRAVERSE_EXIT)
+   return TRAVERSE_EXIT;
+}
   if (Expression::traverse(&this->fn_, traverse) == TRAVERSE_EXIT)
 return TRAVERSE_EXIT;
   if (this->args_ != NULL)


Re: libgo patch committed: Update to Go 1.5 release

2015-11-01 Thread Ian Lance Taylor
On Sun, Nov 1, 2015 at 1:39 AM, Andreas Schwab  wrote:
> ../../../../libgo/go/syscall/exec_linux.go:185:37: error: reference to 
> undefined name 'TIOCSPGRP'
>_, err1 = raw_ioctl_ptr(sys.Ctty, TIOCSPGRP, unsafe.Pointer(&pgrp))
>  ^
>
> $ grep TIOCSPGRP gen-sysinfo.go
> // unknowndefine TIOCSPGRP _IOW('t', 118, int)

What system?

Ian


[PATCH, testsuite]: Improve gcc.target/i386/pr67609-2.c SSE2 runtime test

2015-11-01 Thread Uros Bizjak
Hello!

Attached patch improves pr67609-2.c testcase with the SSE2 runtime
test framework.

2015-11-01  Uros Bizjak  

* gcc.target/i386/pr67609-2.c: Include sse2-check.h.
(sse2_test): Rename from main.  Do not return 0.

Tested on x86_64-linux-gnu {,-m32}  and committed to mainline SVN.

Uros.
Index: gcc.target/i386/pr67609-2.c
===
--- gcc.target/i386/pr67609-2.c (revision 229639)
+++ gcc.target/i386/pr67609-2.c (working copy)
@@ -2,7 +2,8 @@
 /* { dg-options "-O2 -msse2" } */
 /* { dg-require-effective-target sse2 } */
 
-#include 
+#include "sse2-check.h"
+
 #include 
 
 __m128d reg = { 2.0, 4.0 };
@@ -17,13 +18,11 @@ set_lower (double b)
   reg = _mm_load_pd(v);
 }
 
-int
-main ()
+static void
+sse2_test (void)
 {
   set_lower (6.0);
 
   if (reg[1] != 4.0)
-abort ();
-
-  return 0;
+__builtin_abort ();
 }


[PATCH 10/9] ENABLE_CHECKING refactoring: remove remaining occurrences

2015-11-01 Thread Mikhail Maltsev
This patch cleans up remaining bits related to ENABLE_CHECKING. After applying
this patch (on top of part 9) we will no longer have any references to
ENABLE_CHECKING in the source code.

Bootstrapped and regtested (on top of part 9) on x86_64-pc-linux-gnu with
--enable-checking=yes and --enable-checking=release.

libcpp/ChangeLog:

2015-11-01  Mikhail Maltsev  

* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Remove ENABLE_CHECKING.

gcc/ChangeLog:

2015-11-01  Mikhail Maltsev  

* cfganal.c (inverted_post_order_compute): Remove conditional
compilation, use flag_checking.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Remove ENABLE_CHECKING.
* genconditions.c: Do not #undef ENABLE_CHECKING.
* sese.h (bb_in_region): Comment out broken check.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa_1): Remove
conditional compilation, use flag_checking.

-- 
Regards,
Mikhail Maltsev
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 6f3e348..0f26038 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -784,9 +784,8 @@ inverted_post_order_compute (int *post_order)
   int post_order_num = 0;
   sbitmap visited;
 
-#if ENABLE_CHECKING
-  verify_no_unreachable_blocks ();
-#endif
+  if (flag_checking)
+verify_no_unreachable_blocks ();
 
   /* Allocate stack for back-tracking up CFG.  */
   stack = XNEWVEC (edge_iterator, n_basic_blocks_for_fn (cfun) + 1);
diff --git a/gcc/config.in b/gcc/config.in
index 48d7e64..6f46f70 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -76,13 +76,6 @@
 #endif
 
 
-/* Define if you want more run-time sanity checks. This one gets a grab bag of
-   miscellaneous but relatively cheap checks. */
-#ifndef USED_FOR_TARGET
-#undef ENABLE_CHECKING
-#endif
-
-
 /* Define to 1 to specify that we are using the BID decimal floating point
format instead of DPD */
 #ifndef USED_FOR_TARGET
diff --git a/gcc/configure b/gcc/configure
index 92bda6c..1d2e8f2 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -7098,9 +7098,6 @@ IFS="$ac_save_IFS"
 nocommon_flag=""
 if test x$ac_checking != x ; then
 
-$as_echo "#define ENABLE_CHECKING 1" >>confdefs.h
-
-
 $as_echo "#define CHECKING_P 1" >>confdefs.h
 
   nocommon_flag=-fno-common
@@ -18405,7 +18402,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18408 "configure"
+#line 18405 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18511,7 +18508,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18514 "configure"
+#line 18511 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7e22267..d03a0bd 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -566,9 +566,6 @@ IFS="$ac_save_IFS"
 
 nocommon_flag=""
 if test x$ac_checking != x ; then
-  AC_DEFINE(ENABLE_CHECKING, 1,
-[Define if you want more run-time sanity checks.  This one gets a grab
-   bag of miscellaneous but relatively cheap checks.])
   AC_DEFINE(CHECKING_P, 1,
 [Define to 1 if you want more run-time sanity checks.  This one gets a grab
bag of miscellaneous but relatively cheap checks.])
diff --git a/gcc/genconditions.c b/gcc/genconditions.c
index 7481ab4..dd5bc92 100644
--- a/gcc/genconditions.c
+++ b/gcc/genconditions.c
@@ -59,7 +59,6 @@ write_header (void)
 #if GCC_VERSION >= 3001\n\
 \n\
 /* Do not allow checking to confuse the issue.  */\n\
-#undef ENABLE_CHECKING\n\
 #undef CHECKING_P\n\
 #define CHECKING_P 0\n\
 #undef ENABLE_TREE_CHECKING\n\
diff --git a/gcc/sese.h b/gcc/sese.h
index d2ad9bd..98ab491 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -108,16 +108,18 @@ sese_nb_params (sese_info_p region)
 static inline bool
 bb_in_region (basic_block bb, basic_block entry, basic_block exit)
 {
-#ifdef ENABLE_CHECKING
-  {
-edge e;
-edge_iterator ei;
-
-/* Check that there are no edges coming in the region: all the
-   predecessors of EXIT are dominated by ENTRY.  */
-FOR_EACH_EDGE (e, ei, exit->preds)
-  dominated_by_p (CDI_DOMINATORS, e->src, entry);
-  }
+  /* FIXME: PR67842.  */
+#if 0
+  if (flag_checking)
+{
+  edge e;
+  edge_iterator ei;
+
+  /* Check that there are no edges coming in the region: all the
+	 predecessors of EXIT are dominated by ENTRY.  */
+  FOR_EACH_EDGE (e, ei, exit->preds)
+	gcc_assert (dominated_by_p (CDI_DOMINATORS, e->src, entry));
+}
 #endif
 
   return dominated_by_p (CDI_DOMINATORS, bb, entry)
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index db797cc..b614412 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -616,14 +616,10 @@ rewrite_into_loop_closed_ssa_1 (bitmap changed_bbs, unsigned update_flag,
 
   /* If the pass has caused the SSA form to be out-of-date, update it
  now.  */
-  if (upd

[PATCH] Pr fortran/68153 -- Enhance checking of RESHAPE shape arg

2015-11-01 Thread Steve Kargl
The attached patch enhances the check of the shape argument
when it is a named constant.  See the testcase for example.
Built and regression tested on i386-*-freebsd.  OK to commit?

2015-11-01  Steven G. Kargl  

PR fortran/68153
* check.c (gfc_check_reshape): Improve check for valid SHAPE argument.

2015-11-01  Steven G. Kargl  

PR fortran/68153
* gfortran.dg/pr68153.f90: New test.

-- 
Steve
Index: gcc/fortran/check.c
===
--- gcc/fortran/check.c	(revision 229634)
+++ gcc/fortran/check.c	(working copy)
@@ -3711,6 +3711,36 @@ gfc_check_reshape (gfc_expr *source, gfc
 	}
 	}
 }
+  else if (shape->expr_type == EXPR_VARIABLE && shape->ref
+	   && shape->ref->u.ar.type == AR_FULL && shape->ref->u.ar.dimen == 1
+	   && shape->ref->u.ar.as
+	   && shape->ref->u.ar.as->lower[0]->expr_type == EXPR_CONSTANT
+	   && shape->ref->u.ar.as->lower[0]->ts.type == BT_INTEGER
+	   && shape->ref->u.ar.as->upper[0]->expr_type == EXPR_CONSTANT
+	   && shape->ref->u.ar.as->upper[0]->ts.type == BT_INTEGER
+	   && shape->symtree->n.sym->attr.flavor == FL_PARAMETER)
+{
+  int i, dim;
+  gfc_expr *e, *v;
+
+  v = shape->symtree->n.sym->value;
+
+  for (i = 0; i < shape_size; i++)
+	{
+	  e = gfc_constructor_lookup_expr (v->value.constructor, i);
+	  if (e == NULL)
+	 break;
+
+	  gfc_extract_int (e, &dim);
+
+	  if (dim < 0)
+	{
+	  gfc_error ("Element %d of actual argument of RESHAPE at %L "
+			 "cannot be negative", i + 1, &shape->where);
+	  return false;
+	}
+	}
+}
 
   if (pad != NULL)
 {
Index: gcc/testsuite/gfortran.dg/pr68153.f90
===
--- gcc/testsuite/gfortran.dg/pr68153.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/pr68153.f90	(working copy)
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/68153
+! Original code contribute by Gerhard Steinmetz
+! 
+!
+program foo
+   integer, parameter :: a(2) = [2, -2]
+   integer, parameter :: b(2,2) = reshape([1, 2, 3, 4], a) ! { dg-error "cannot be negative" }
+end program foo


Re: [PATCH][ARM] PR target/67929 Tighten vfp3_const_double_for_bits checks

2015-11-01 Thread Yvan Roux
Hi Kyrill,

On 27 October 2015 at 13:08, Ramana Radhakrishnan
 wrote:
> On Wed, Oct 14, 2015 at 1:23 PM, Kyrill Tkachov  
> wrote:
>> Hi all,
>>
>> This patch fixes the referenced PR by rewriting the
>> vfp3_const_double_for_bits function in arm.c
>> The function is supposed to accept positive CONST_DOUBLE rtxes whose value
>> is an exact power of 2
>> and whose log2 is between 1 and 32. That is values like 2.0, 4.0, 8.9, 16.0
>> etc...
>>
>> The current implementation seems to have been written under the assumption
>> that exact_real_truncate returns
>> false if the input value is not an exact integer, whereas in fact
>> exact_real_truncate returns false if the
>> truncation operation was not exact, which are different things. This would
>> lead the function to accept any
>> CONST_DOUBLE that can truncate to a power of 2, such as 4.9, 16.2 etc.
>>
>> In any case, I've rewritten this function and used the real_isinteger
>> predicate to check if the real value
>> is an exact integer.
>>
>> The testcase demonstrates the kind of wrong code that this patch addresses.
>>
>> This bug appears on GCC 5 and 4.9 as well, but due to the recent
>> introduction of CONST_DOUBLE_REAL_VALUE
>> this patch doesn't apply on those branches. I will soon post the
>> backportable variant.
>>
>> Bootstrapped and tested on arm-none-linux-gnueabihf.
>>
>> Ok for trunk?
>
>
> Thanks, this is OK for trunk and all release branches.
>
> Ramana
>
>>
>> Thanks,
>> Kyrill
>>
>> 2015-10-12  Kyrylo Tkachov  
>>
>> PR target/67929
>> * config/arm/arm.c (vfp3_const_double_for_bits): Rewrite.
>> * config/arm/constraints.md (Dp): Update callsite.
>> * config/arm/predicates.md (const_double_vcvt_power_of_two): Likewise.
>>
>> 2015-10-12  Kyrylo Tkachov  
>>
>> PR target/67929
>> * gcc.target/arm/pr67929_1.c: New test.

This test fails when tested on hard-float targets, adding the
following line to avoid testing it in such cases will fix the issue,
but I wonder if there is a better dejaGNU directives sequence to do
that.

/* { dg-skip-if "avoid conflicting multilib options" { *-*-*eabihf } {
"*" } { "" } } */

Cheers,
Yvan


[PATCH, 2/2] Handle recursive restrict in function parameter

2015-11-01 Thread Tom de Vries

On 01/11/15 19:03, Tom de Vries wrote:

So, the new patch series is:

  1Rename make_restrict_var_constraints to make_param_constraints
  2Handle recursive restrict in function parameter

I'll repost in reply to this message.



This patch adds handling of all the restrict qualifiers in the type of a 
function parameter.


Thanks,
- Tom

Handle recursive restrict in function parameter

	* tree-ssa-structalias.c (struct fieldoff): Add restrict_var field.
	(push_fields_onto_fieldstack): Add and handle handle_param parameter.
	(create_variable_info_for_1): Add and handle
	handle_param parameter.  Add extra arg to call to
	push_fields_onto_fieldstack.  Handle restrict pointer fields.
	(create_variable_info_for): Call create_variable_info_for_1 with extra
	arg.
	(make_param_constraints): Drop restrict_name parameter.  Ignore
	vi->only_restrict_pointers.
	(intra_create_variable_infos): Call create_variable_info_for_1 with
	extra arg.  Remove restrict handling.  Call make_param_constraints with
	one less arg.

	* gcc.dg/tree-ssa/restrict-7.c: New test.
	* gcc.dg/tree-ssa/restrict-8.c: New test.
---
 gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c | 12 +
 gcc/testsuite/gcc.dg/tree-ssa/restrict-8.c | 17 ++
 gcc/tree-ssa-structalias.c | 87 ++
 3 files changed, 82 insertions(+), 34 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/restrict-8.c

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c
new file mode 100644
index 000..f7a68c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-fre1" } */
+
+int
+f (int *__restrict__ *__restrict__ *__restrict__ a, int *b)
+{
+  *b = 1;
+  ***a  = 2;
+  return *b;
+}
+
+/* { dg-final { scan-tree-dump-times "return 1" 1 "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-8.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-8.c
new file mode 100644
index 000..b0ab164
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-8.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-fre1" } */
+
+struct s
+{
+  int *__restrict__ *__restrict__ pp;
+};
+
+int
+f (struct s s, int *b)
+{
+  *b = 1;
+  **s.pp = 2;
+  return *b;
+}
+
+/* { dg-final { scan-tree-dump-times "return 1" 1 "fre1" } } */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index ea34764..f4e9b0a 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -320,6 +320,7 @@ static varinfo_t first_or_preceding_vi_for_offset (varinfo_t,
 		   unsigned HOST_WIDE_INT);
 static varinfo_t lookup_vi_for_tree (tree);
 static inline bool type_can_have_subvars (const_tree);
+static void make_param_constraints (varinfo_t, bool);
 
 /* Pool of variable info structures.  */
 static object_allocator variable_info_pool
@@ -406,6 +407,7 @@ new_var_info (tree t, const char *name, bool add_id)
   return ret;
 }
 
+static varinfo_t create_variable_info_for_1 (tree, const char *, bool, bool);
 
 /* A map mapping call statements to per-stmt variables for uses
and clobbers specific to the call.  */
@@ -5208,6 +5210,8 @@ struct fieldoff
   unsigned may_have_pointers : 1;
 
   unsigned only_restrict_pointers : 1;
+
+  varinfo_t restrict_var;
 };
 typedef struct fieldoff fieldoff_s;
 
@@ -5302,11 +5306,12 @@ field_must_have_pointers (tree t)
OFFSET is used to keep track of the offset in this entire
structure, rather than just the immediately containing structure.
Returns false if the caller is supposed to handle the field we
-   recursed for.  */
+   recursed for.  If HANDLE_PARAM is set, we're handling part of a function
+   parameter.  */
 
 static bool
 push_fields_onto_fieldstack (tree type, vec *fieldstack,
-			 HOST_WIDE_INT offset)
+			 HOST_WIDE_INT offset, bool handle_param)
 {
   tree field;
   bool empty_p = true;
@@ -5332,7 +5337,7 @@ push_fields_onto_fieldstack (tree type, vec *fieldstack,
 	|| TREE_CODE (field_type) == UNION_TYPE)
 	  push = true;
 	else if (!push_fields_onto_fieldstack
-		(field_type, fieldstack, offset + foff)
+		(field_type, fieldstack, offset + foff, handle_param)
 		 && (DECL_SIZE (field)
 		 && !integer_zerop (DECL_SIZE (field
 	  /* Empty structures may have actual size, like in C++.  So
@@ -5353,7 +5358,8 @@ push_fields_onto_fieldstack (tree type, vec *fieldstack,
 	if (!pair
 		&& offset + foff != 0)
 	  {
-		fieldoff_s e = {0, offset + foff, false, false, false, false};
+		fieldoff_s e = {0, offset + foff, false, false, false, false,
+NULL};
 		pair = fieldstack->safe_push (e);
 	  }
 
@@ -5387,6 +5393,19 @@ push_fields_onto_fieldstack (tree type, vec *fieldstack,
 		  = (!has_unknown_size
 		 && POINTER_TYPE_P (field_type)
 		 && TYPE_RESTRICT (field_type));
+		if (handle_param
+		&&

Re: [PATCH, 3/6] Add recursion to make_param_constraints

2015-11-01 Thread Tom de Vries

On 01/11/15 19:03, Tom de Vries wrote:


So, the new patch series is:

  1Rename make_restrict_var_constraints to make_param_constraints
  2Handle recursive restrict in function parameter

I'll repost in reply to this message.


This no-functional-changes patch:
- moves the one constraint handling loop left in
   intra_create_variable_infos to make_restrict_var_constraints
- renames make_restrict_var_constraints to make_param_constraints
- adds a parameter toplevel to make_param_constraints to distinguish
   between the two calling contexts
- adds a parmeter restrict_name that allows to pass in the name of
  restrict vars

This patch was posted before at 
https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03111.html .


Thanks,
- Tom

Rename make_restrict_var_constraints to make_param_constraints

2015-10-27  Tom de Vries  

	* tree-ssa-structalias.c (make_restrict_var_constraints): Rename to ...
	(make_param_constraints): ... this.  Add toplevel and restrict_name
	parameter.
	(intra_create_variable_infos): Use make_param_constraints.
---
 gcc/tree-ssa-structalias.c | 39 ---
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index d409727..ea34764 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -5892,19 +5892,28 @@ debug_solution_for_var (unsigned int var)
   dump_solution_for_var (stderr, var);
 }
 
-/* Register the constraints for restrict var VI.  */
+/* Register the constraints for VI.  If TOPLEVEL then VI is a function
+   parameter, otherwise VI is part of a function parameter.  Use RESTRICT_NAME
+   as the base name of created restrict vars.  */
 
 static void
-make_restrict_var_constraints (varinfo_t vi)
+make_param_constraints (varinfo_t vi, bool toplevel, const char *restrict_name)
 {
   for (; vi; vi = vi_next (vi))
-if (vi->may_have_pointers)
-  {
-	if (vi->only_restrict_pointers)
-	  make_constraint_from_global_restrict (vi, "GLOBAL_RESTRICT", true);
-	else
-	  make_copy_constraint (vi, nonlocal_id);
-  }
+{
+  if (vi->only_restrict_pointers)
+	make_constraint_from_global_restrict (vi, restrict_name, true);
+  else if (vi->may_have_pointers)
+	{
+	  if (toplevel)
+	make_constraint_from (vi, nonlocal_id);
+	  else
+	make_copy_constraint (vi, nonlocal_id);
+	}
+
+if (vi->is_full_var)
+  break;
+}
 }
 
 /* Create varinfo structures for all of the variables in the
@@ -5941,19 +5950,11 @@ intra_create_variable_infos (struct function *fn)
 	  vi->is_restrict_var = 1;
 	  insert_vi_for_tree (heapvar, vi);
 	  make_constraint_from (p, vi->id);
-	  make_restrict_var_constraints (vi);
+	  make_param_constraints (vi, false, "GLOBAL_RESTRICT");
 	  continue;
 	}
 
-  for (; p; p = vi_next (p))
-	{
-	  if (p->only_restrict_pointers)
-	make_constraint_from_global_restrict (p, "PARM_RESTRICT", true);
-	  else if (p->may_have_pointers)
-	make_constraint_from (p, nonlocal_id);
-	  if (p->is_full_var)
-	break;
-	}
+  make_param_constraints (p, true, "PARM_RESTRICT");
 }
 
   /* Add a constraint for a result decl that is passed by reference.  */
-- 
1.9.1



Re: [PATCH, 3/6] Add recursion to make_param_constraints

2015-11-01 Thread Tom de Vries

On 27/10/15 13:56, Tom de Vries wrote:

On 27/10/15 13:24, Tom de Vries wrote:

Thinking it over a bit more, I realized the constraint handling started
to be messy. I've reworked the patch series to simplify that first.

  1Simplify constraint handling
  2Rename make_restrict_var_constraints to make_param_constraints
  3Add recursion to make_param_constraints
  4Add handle_param parameter to create_variable_info_for_1
  5Handle recursive restrict pointer in
create_variable_info_for_1
  6Handle restrict struct fields recursively

Currently doing bootstrap and regtest on x86_64.

I'll repost the patch series in reply to this message.



This patch:
- registers the connection between a restrict pointer var and a
   restrict var in a new hash_map restrict_pointed_var.
- move the restrict pointer constraint handling from
   intra_create_variable_infos to make_param_constraints

The result of this and the two preceding patches is that the constraint
handling for params in intra_create_variable_infos is reduced to a
single call to make_param_constraints.


I've managed to eliminate this patch from the patch series, at the cost 
of having to merge patches 4-6 into a single patch, rather than having a 
more stepwise approach.


So, the new patch series is:

 1  Rename make_restrict_var_constraints to make_param_constraints
 2  Handle recursive restrict in function parameter

I'll repost in reply to this message.

Thanks,
- Tom


Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-11-01 Thread Joel Sherrill

On 10/31/2015 10:47 AM, Jan Sommer wrote:

Hi,

This patch changes the Ada-declaration of the pthread-related structs such as 
pthread_attr_t from a field-equivalent declaration to just reserving the right 
amount of memory.
It is only rtems related and essentially copies the way how the types are 
defined in s-osinte-linux.ads. It makes the declarations independent of a 
particular newlib-version and fixes the bug I filed here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169

CC are the rtems developers for discussion.


I am ok with this patch unless Arnaud says otherwise.

I would like to apply it to 4.9 and newer.

Comments?


Best regards,

Jan



--
-- Joel Sherrill
Ask me about RTEMS: a free RTOS
Support and Training Available



[PATCH 9/9] ENABLE_CHECKING refactoring: C family front ends

2015-11-01 Thread Mikhail Maltsev
Hi all!

This patch was intended to be the last one in this series (but I'll send one
more cleanup patch today). It removes ENABLE_CHECKING macros in the C++ front
end (and also touches a small piece of common C family code in OpenMP).

I could convert most of "#ifdef ENABLE_CHECKING" conditions into checks
performed at run time (i.e. flag_checking), except for
GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT logic. The definition of this macro depends
on ENABLE_CHECKING (now CHECKING_P) and frankly speaking I don't know how these
checks should work (though I did not try hard to understand the details, I hope
Jason will give some comments), so I left them as-is, just got rid of
conditional compilation (i.e., used CHECKING_P).

Also, the patch renames 'check_unstripped_args' into 'verify_unstripped_args'
because I think it's more consistent with names of other internal state checking
functions.

Bootstrapped and regtested on x86_64-pc-linux-gnu with --enable-checking=yes and
--enable-checking=release. (there were some problems with languages other than C
and C++, not related to the patch, but ISTM they were fixed, so I'm currently
running a second check after rebasing).

OK for trunk?

-- 
Regards,
Mikhail Maltsev

gcc/c-family/ChangeLog:

2015-10-31  Mikhail Maltsev  

* c-omp.c (c_omp_split_clauses): Remove conditional compilation. Use
flag_checking.

gcc/cp/ChangeLog:

2015-10-31  Mikhail Maltsev  

* call.c (validate_conversion_obstack): Define unconditionally.
* constexpr.c (maybe_constant_value, fold_non_dependent_expr): Use
gcc_checking_assert.
* cp-tree.h: Use CHECKING_P instead of ENABLE_CHECKING.
* decl2.c (cxx_post_compilation_parsing_cleanups): Use flag_checking.
* mangle.c (add_substitution): Likewise.
* method.c (maybe_explain_implicit_delete): Likewise.
* parser.c (cp_parser_template_argument_list): Remove conditional
compilation.
* pt.c (check_unstripped_args): Rename to...
(verify_unstripped_args): ...this and remove conditional compilation.
(retrieve_specialization): Guard call of verify_unstripped_args with
flag_checking.
(template_parm_to_arg): Remove conditional compilation.
(template_parms_to_args, coerce_template_parameter_pack,
coerce_template_parms): Likewise.
(tsubst_copy): Use flag_checking.
(type_unification_real): Remove conditional compilation.
(build_non_dependent_expr): Use flag_checking.
* tree.c (build_target_expr): Remove conditional compilation, use
gcc_checking_assert.
* typeck.c (comptypes): Likewise.
* typeck2.c (digest_init_r): Likewise.


diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index 133d079..ca64eda 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -1135,7 +1135,10 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
   OMP_CLAUSE_CHAIN (clauses) = cclauses[s];
   cclauses[s] = clauses;
 }
-#ifdef ENABLE_CHECKING
+
+  if (!flag_checking)
+return;
+
   if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP)) == 0)
 gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_TARGET] == NULL_TREE);
   if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) == 0)
@@ -1150,7 +1153,6 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
 gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_FOR] == NULL_TREE);
   if (code != OMP_SIMD)
 gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_SIMD] == NULL_TREE);
-#endif
 }
 
 
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9178188..0b7d143 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -724,8 +724,6 @@ alloc_conversion (conversion_kind kind)
   return c;
 }
 
-#ifdef ENABLE_CHECKING
-
 /* Make sure that all memory on the conversion obstack has been
freed.  */
 
@@ -737,8 +735,6 @@ validate_conversion_obstack (void)
 		 == obstack_base (&conversion_obstack)));
 }
 
-#endif /* ENABLE_CHECKING */
-
 /* Dynamically allocate an array of N conversions.  */
 
 static conversion **
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 038c6f5..51fae5a 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3856,13 +3856,11 @@ maybe_constant_value (tree t, tree decl)
 }
 
   r = cxx_eval_outermost_constant_expr (t, true, true, decl);
-#ifdef ENABLE_CHECKING
-  gcc_assert (r == t
-	  || CONVERT_EXPR_P (t)
-	  || TREE_CODE (t) == VIEW_CONVERT_EXPR
-	  || (TREE_CONSTANT (t) && !TREE_CONSTANT (r))
-	  || !cp_tree_equal (r, t));
-#endif
+  gcc_checking_assert (r == t
+		   || CONVERT_EXPR_P (t)
+		   || TREE_CODE (t) == VIEW_CONVERT_EXPR
+		   || (TREE_CONSTANT (t) && !TREE_CONSTANT (r))
+		   || !cp_tree_equal (r, t));
   return r;
 }
 
@@ -3906,14 +3904,12 @@ fold_non_dependent_expr (tree t)
 	}
 
 	  tree r = cxx_eval_outermost_constant_expr (t, true, true, NULL_TREE);
-#ifdef ENABLE_CHECKING
 	  /* cp_tree_equal looks through NOPs, so allow them.  */
-	  

Re: libgo patch committed: Update to Go 1.5 release

2015-11-01 Thread Andreas Schwab
../../../../libgo/go/syscall/exec_linux.go:185:37: error: reference to 
undefined name 'TIOCSPGRP'
   _, err1 = raw_ioctl_ptr(sys.Ctty, TIOCSPGRP, unsafe.Pointer(&pgrp))
 ^

$ grep TIOCSPGRP gen-sysinfo.go 
// unknowndefine TIOCSPGRP _IOW('t', 118, int)

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."