Re: Build breakage on darwin and pa64-hpux [was Re: Use -fbuilding-libgcc for more target macros used in libgcc]

2014-09-06 Thread Andreas Schwab
Mike Stump mikest...@comcast.net writes:

 Index: config/pa/pa64-hpux.h
 ===
 --- config/pa/pa64-hpux.h (revision 214981)
 +++ config/pa/pa64-hpux.h (working copy)
 @@ -336,7 +336,7 @@ do {  
 \
 the sections are not actually used.  However, we still must provide
 defines to select the proper code path.  */
  #undef INIT_SECTION_ASM_OP
 -#define INIT_SECTION_ASM_OP
 +#define INIT_SECTION_ASM_OP 
  #undef FINI_SECTION_ASM_OP
  #define FINI_SECTION_ASM_OP

What about FINI_SECTION_ASM_OP?

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.


[committed] PR63171: Fix FOR_EACH_SUBRTX in tls_referenced_p

2014-09-06 Thread Richard Sandiford
tls_referenced_p shouldn't skip subrtxes of CONSTs, since it's supposed
to be looking at all SYMBOL_REFs in the pattern.  The patched version
was what I'd meant to write originally, sorry that it slipped though.

Tested on powerpc64-linux-gnu and applied as obvious.

Thanks,
Richard


gcc/
PR middle-end/63171
* rtlanal.c (tls_referenced_p): Don't skip constant subrtxes.

Index: gcc/rtlanal.c
===
--- gcc/rtlanal.c   2014-08-30 15:53:03.372153860 +0100
+++ gcc/rtlanal.c   2014-09-06 10:59:18.545268494 +0100
@@ -6073,7 +6073,7 @@ tls_referenced_p (const_rtx x)
 return false;
 
   subrtx_iterator::array_type array;
-  FOR_EACH_SUBRTX (iter, array, x, NONCONST)
+  FOR_EACH_SUBRTX (iter, array, x, ALL)
 if (GET_CODE (*iter) == SYMBOL_REF  SYMBOL_REF_TLS_MODEL (*iter) != 0)
   return true;
   return false;


RFA: PR62208: const0_rtx used for vectors in simplify-rtx.c

2014-09-06 Thread Richard Sandiford
This PR is about a case where an XOR+EQ sequence can legitimately
be simplified.  The problem was that the sequence was operating on
vectors while the simplified version used a 0 CONST_INT (const0_rtx).

The code seems to have been like that for a long time but presumably
the bug has been latent until now.  I suppose normally we'd want
earlier optimisations to catch this.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
PR rtl-optimization/62208
* simplify-rtx.c (simplify_relational_operation_1): Use CONST0_RTX
rather than const0_rtx in eq/ne-xor simplifications.

gcc/testsuite/
* gcc.target/i386/pr62208.c: New test.

Index: gcc/simplify-rtx.c
===
--- gcc/simplify-rtx.c  2014-09-06 11:05:20.859563557 +0100
+++ gcc/simplify-rtx.c  2014-09-06 11:05:20.935564244 +0100
@@ -4480,16 +4480,16 @@ simplify_relational_operation_1 (enum rt
op0code == XOR
rtx_equal_p (XEXP (op0, 0), op1)
!side_effects_p (XEXP (op0, 0)))
-return simplify_gen_relational (code, mode, cmp_mode,
-   XEXP (op0, 1), const0_rtx);
+return simplify_gen_relational (code, mode, cmp_mode, XEXP (op0, 1),
+   CONST0_RTX (mode));
 
   /* Likewise (eq/ne (xor x y) y) simplifies to (eq/ne x 0).  */
   if ((code == EQ || code == NE)
op0code == XOR
rtx_equal_p (XEXP (op0, 1), op1)
!side_effects_p (XEXP (op0, 1)))
-return simplify_gen_relational (code, mode, cmp_mode,
-   XEXP (op0, 0), const0_rtx);
+return simplify_gen_relational (code, mode, cmp_mode, XEXP (op0, 0),
+   CONST0_RTX (mode));
 
   /* (eq/ne (xor x C1) C2) simplifies to (eq/ne x (C1^C2)).  */
   if ((code == EQ || code == NE)
Index: gcc/testsuite/gcc.target/i386/pr62208.c
===
--- /dev/null   2014-09-03 21:33:59.721983712 +0100
+++ gcc/testsuite/gcc.target/i386/pr62208.c 2014-09-06 11:09:18.220708443 
+0100
@@ -0,0 +1,23 @@
+/* { dg-options -O3 -fwhole-program -march=x86-64 } */
+
+int *a;
+unsigned int b;
+
+void fn2 ()
+{
+  int t[9];
+  for (; b; b++)
+*a ^= (~t[b] != t[b]);
+}
+
+int fn1 ()
+{
+  fn2 (); 
+  return 0; 
+}
+
+int main ()
+{
+  fn1 (); 
+  return 0;
+}


Re: RFA: PR62208: const0_rtx used for vectors in simplify-rtx.c

2014-09-06 Thread Richard Biener
On September 6, 2014 12:28:29 PM CEST, Richard Sandiford 
rdsandif...@googlemail.com wrote:
This PR is about a case where an XOR+EQ sequence can legitimately
be simplified.  The problem was that the sequence was operating on
vectors while the simplified version used a 0 CONST_INT (const0_rtx).

The code seems to have been like that for a long time but presumably
the bug has been latent until now.  I suppose normally we'd want
earlier optimisations to catch this.

Tested on x86_64-linux-gnu.  OK to install?

OK.

Thanks,
Richard.

Thanks,
Richard


gcc/
   PR rtl-optimization/62208
   * simplify-rtx.c (simplify_relational_operation_1): Use CONST0_RTX
   rather than const0_rtx in eq/ne-xor simplifications.

gcc/testsuite/
   * gcc.target/i386/pr62208.c: New test.

Index: gcc/simplify-rtx.c
===
--- gcc/simplify-rtx.c 2014-09-06 11:05:20.859563557 +0100
+++ gcc/simplify-rtx.c 2014-09-06 11:05:20.935564244 +0100
@@ -4480,16 +4480,16 @@ simplify_relational_operation_1 (enum rt
op0code == XOR
rtx_equal_p (XEXP (op0, 0), op1)
!side_effects_p (XEXP (op0, 0)))
-return simplify_gen_relational (code, mode, cmp_mode,
-  XEXP (op0, 1), const0_rtx);
+return simplify_gen_relational (code, mode, cmp_mode, XEXP (op0,
1),
+  CONST0_RTX (mode));
 
   /* Likewise (eq/ne (xor x y) y) simplifies to (eq/ne x 0).  */
   if ((code == EQ || code == NE)
op0code == XOR
rtx_equal_p (XEXP (op0, 1), op1)
!side_effects_p (XEXP (op0, 1)))
-return simplify_gen_relational (code, mode, cmp_mode,
-  XEXP (op0, 0), const0_rtx);
+return simplify_gen_relational (code, mode, cmp_mode, XEXP (op0,
0),
+  CONST0_RTX (mode));
 
   /* (eq/ne (xor x C1) C2) simplifies to (eq/ne x (C1^C2)).  */
   if ((code == EQ || code == NE)
Index: gcc/testsuite/gcc.target/i386/pr62208.c
===
--- /dev/null  2014-09-03 21:33:59.721983712 +0100
+++ gcc/testsuite/gcc.target/i386/pr62208.c2014-09-06
11:09:18.220708443 +0100
@@ -0,0 +1,23 @@
+/* { dg-options -O3 -fwhole-program -march=x86-64 } */
+
+int *a;
+unsigned int b;
+
+void fn2 ()
+{
+  int t[9];
+  for (; b; b++)
+*a ^= (~t[b] != t[b]);
+}
+
+int fn1 ()
+{
+  fn2 (); 
+  return 0; 
+}
+
+int main ()
+{
+  fn1 (); 
+  return 0;
+}




Re: Vimrc config with GNU formatting

2014-09-06 Thread Yury Gribov
Segher Boessenkool segher at kernel.crashing.org writes:
 On Fri, Sep 05, 2014 at 07:10:02PM +0400, Yury Gribov wrote:
  Now I don't quite like the idea of plugin:
 
 Anything that will make this enabled automatically will meet a lot of
 resistance.  Make something nice for contrib/ instead?

Hm, isn't it already enabled by default for Emacs (in .dirs-local.el)? Also 
GNU coding style is a requirement for GCC so resisting it may not make 
sense...

-Y



Re: Vimrc config with GNU formatting

2014-09-06 Thread Yury Gribov
Bernhard Reutner-Fischer rep.dot.nop at gmail.com writes:
  * gcc_style.vim enables GNU style globally, for all projects
 
 How come? Please explain?

My understanding was that maybe_gcc_style gets run on all opened files and 
this could cause problems with non-GCC projects. But given that you check for 
GCC comment it's probably not an issue.

  But as I mentioned also disables formatting for all new files.
 
 Yes, you could if match(expand('%:p:h'), gcc) != -1
 or something like that but that's not pretty and robust either.

Yeah, and we'll also want GNU coding style in GCC runtime libs (libbacktrace, 
etc.) so filtering may get quite messy.




[PATCH, rs6000] Add handling for UNSPEC_VSPLT_DIRECT to analyze_swaps

2014-09-06 Thread Bill Schmidt
Hi,

Here's one more case of special handling that allows us to optimize more
vectorized loops in analyze_swaps.  UNSPEC_VSPLT_DIRECT is used in some
cases to avoid the possibility of an endian fixup.  We can still handle
this by swapping the lane chosen as the source of the splat.

While implementing this I realized that I had had a thinko with the
adjust_extract changes in the last related patch.  When swapping
doublewords, the right change is to add or subtract n_elts/2, not to
subtract from n_elts-1.  I've corrected that issue herein as well.

I've added a new test to demonstrate the UNSPEC_VSPLT_DIRECT case.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
regressions.  Ok for trunk?

Thanks,
Bill


[gcc]

2014-09-06  Bill Schmidt  wschm...@linux.vnet.ibm.com

* config/rs6000/rs6000.c (special_handling_values):  Add SH_SPLAT.
(rtx_is_swappable_p): Convert UNSPEC cascading ||s to a switch
statement; allow optimization of UNSPEC_VSPLT_DIRECT with special
handling SH_SPLAT.
(adjust_extract): Fix test for VEC_DUPLICATE case; fix adjustment
of extracted lane.
(adjust_splat): New function.
(handle_special_swappables): Call adjust_splat for SH_SPLAT.
(dump_swap_insn_table): Add case for SH_SPLAT.

[gcc/testsuite]

2014-09-06  Bill Schmidt  wschm...@linux.vnet.ibm.com

* gcc.target/powerpc/swaps-p8-16.c: New test.


Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 214957)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -33524,7 +33524,8 @@ enum special_handling_values {
   SH_SUBREG,
   SH_NOSWAP_LD,
   SH_NOSWAP_ST,
-  SH_EXTRACT
+  SH_EXTRACT,
+  SH_SPLAT
 };
 
 /* Union INSN with all insns containing definitions that reach USE.
@@ -33735,43 +33736,50 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
   vector splat are element-order sensitive.  A few of these
   cases might be workable with special handling if required.  */
int val = XINT (op, 1);
-   if (val == UNSPEC_VMRGH_DIRECT
-   || val == UNSPEC_VMRGL_DIRECT
-   || val == UNSPEC_VPACK_SIGN_SIGN_SAT
-   || val == UNSPEC_VPACK_SIGN_UNS_SAT
-   || val == UNSPEC_VPACK_UNS_UNS_MOD
-   || val == UNSPEC_VPACK_UNS_UNS_MOD_DIRECT
-   || val == UNSPEC_VPACK_UNS_UNS_SAT
-   || val == UNSPEC_VPERM
-   || val == UNSPEC_VPERM_UNS
-   || val == UNSPEC_VPERMHI
-   || val == UNSPEC_VPERMSI
-   || val == UNSPEC_VPKPX
-   || val == UNSPEC_VSLDOI
-   || val == UNSPEC_VSLO
-   || val == UNSPEC_VSPLT_DIRECT
-   || val == UNSPEC_VSRO
-   || val == UNSPEC_VSUM2SWS
-   || val == UNSPEC_VSUM4S
-   || val == UNSPEC_VSUM4UBS
-   || val == UNSPEC_VSUMSWS
-   || val == UNSPEC_VSUMSWS_DIRECT
-   || val == UNSPEC_VSX_CONCAT
-   || val == UNSPEC_VSX_CVSPDP
-   || val == UNSPEC_VSX_CVSPDPN
-   || val == UNSPEC_VSX_SET
-   || val == UNSPEC_VSX_SLDWI
-   || val == UNSPEC_VUNPACK_HI_SIGN
-   || val == UNSPEC_VUNPACK_HI_SIGN_DIRECT
-   || val == UNSPEC_VUNPACK_LO_SIGN
-   || val == UNSPEC_VUNPACK_LO_SIGN_DIRECT
-   || val == UNSPEC_VUPKHPX
-   || val == UNSPEC_VUPKHS_V4SF
-   || val == UNSPEC_VUPKHU_V4SF
-   || val == UNSPEC_VUPKLPX
-   || val == UNSPEC_VUPKLS_V4SF
-   || val == UNSPEC_VUPKHU_V4SF)
- return 0;
+   switch (val)
+ {
+ default:
+   break;
+ case UNSPEC_VMRGH_DIRECT:
+ case UNSPEC_VMRGL_DIRECT:
+ case UNSPEC_VPACK_SIGN_SIGN_SAT:
+ case UNSPEC_VPACK_SIGN_UNS_SAT:
+ case UNSPEC_VPACK_UNS_UNS_MOD:
+ case UNSPEC_VPACK_UNS_UNS_MOD_DIRECT:
+ case UNSPEC_VPACK_UNS_UNS_SAT:
+ case UNSPEC_VPERM:
+ case UNSPEC_VPERM_UNS:
+ case UNSPEC_VPERMHI:
+ case UNSPEC_VPERMSI:
+ case UNSPEC_VPKPX:
+ case UNSPEC_VSLDOI:
+ case UNSPEC_VSLO:
+ case UNSPEC_VSRO:
+ case UNSPEC_VSUM2SWS:
+ case UNSPEC_VSUM4S:
+ case UNSPEC_VSUM4UBS:
+ case UNSPEC_VSUMSWS:
+ case UNSPEC_VSUMSWS_DIRECT:
+ case UNSPEC_VSX_CONCAT:
+ case UNSPEC_VSX_CVSPDP:
+ case UNSPEC_VSX_CVSPDPN:
+ case UNSPEC_VSX_SET:
+ case UNSPEC_VSX_SLDWI:
+ case UNSPEC_VUNPACK_HI_SIGN:
+ case UNSPEC_VUNPACK_HI_SIGN_DIRECT:
+ case UNSPEC_VUNPACK_LO_SIGN:
+ case UNSPEC_VUNPACK_LO_SIGN_DIRECT:
+ case UNSPEC_VUPKHPX:
+ case UNSPEC_VUPKHS_V4SF:
+ case UNSPEC_VUPKHU_V4SF:
+ case UNSPEC_VUPKLPX:
+ case UNSPEC_VUPKLS_V4SF:
+ case UNSPEC_VUPKLU_V4SF:
+   return 0;
+ case UNSPEC_VSPLT_DIRECT:
+   *special = SH_SPLAT;
+

Re: Vimrc config with GNU formatting

2014-09-06 Thread Trevor Saunders
On Sat, Sep 06, 2014 at 03:38:31PM +, Yury Gribov wrote:
 Segher Boessenkool segher at kernel.crashing.org writes:
  On Fri, Sep 05, 2014 at 07:10:02PM +0400, Yury Gribov wrote:
   Now I don't quite like the idea of plugin:
  
  Anything that will make this enabled automatically will meet a lot of
  resistance.  Make something nice for contrib/ instead?
 
 Hm, isn't it already enabled by default for Emacs (in .dirs-local.el)? Also 
 GNU coding style is a requirement for GCC so resisting it may not make 
 sense...

If you went the localrc route I think it would be kind of crazy for
people to enable loading of local config files and then complain when projects
make use of that, since that's the major use case for the plugin in the
first place.

Trev

 
 -Y
 


[c++-concepts] concept introductions

2014-09-06 Thread Braden Obrzut

Adds support for concept introduction short hand.

Andrew already committed this patch.

2014-09-04  Braden Obrzut  ad...@maniacsvault.net

 * gcc/cp/constraint.cc (deduce_concept_introduction): New.
 (build_concept_check): Allow arg to be NULL to skip placeholder.
 (process_introduction_parm): New.
 (finish_concept_introduction): New.
 * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Mark introduced parm.
 * gcc/cp/cp-tree.def: New INTRODUCED_PARM_DECL.
 * gcc/cp/parser.c (cp_parser_declaration): Tentatively parse for
 concept introduction.
 (cp_parser_introduction_list): New.
 (cp_parser_member_declaration): Tentatively parse for concept
 introduction.
 (cp_parser_template_introduction): New.
 (cp_parser_template_declaration_after_export): Parse concept
 introductions.
 * gcc/cp/pt.c (convert_template_argument): Treat INTRODUCED_PARM_DECL
 as a placeholder.
 (coerce_template_parms): If INTRODUCED_PARM_DECL represents a pack 
then

 match the entire parameter pack of the template.
 (type_dependent_expression_p): Treat INTRODUCED_PARM_DECL as a
 placeholder.
 * gcc/testsuite/g++.dg/concepts/introduction1.C: New.
 * gcc/testsuite/g++.dg/concepts/introduction2.C: New.
 * gcc/testsuite/g++.dg/concepts/introduction3.C: New.
 * gcc/testsuite/g++.dg/concepts/introduction4.C: New.
 * gcc/testsuite/g++.dg/concepts/introduction5.C: New.

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index c09d212..664d8f0 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -238,13 +238,43 @@ deduce_constrained_parameter (tree expr, tree check, tree proto)
 gcc_unreachable ();
 }
 
+// Given a call expression or template-id expression to a concept, EXPR,
+// deduce the concept being checked and return the template parameters.
+// Returns NULL_TREE if deduction fails.
+static tree
+deduce_concept_introduction (tree expr)
+{
+  if (TREE_CODE (expr) == TEMPLATE_ID_EXPR)
+{
+  // Get the parameters from the template expression.
+  tree decl = TREE_OPERAND (expr, 0);
+  tree args = TREE_OPERAND (expr, 1);
+  tree var = DECL_TEMPLATE_RESULT (decl);
+  tree parms = TREE_VALUE (DECL_TEMPLATE_PARMS (decl));
+
+  parms = coerce_template_parms (parms, args, var);
+  // Check that we are returned a proper set of parameters.
+  if (parms == error_mark_node)
+return NULL_TREE;
+  return parms;
+}
+  else if (TREE_CODE (expr) == CALL_EXPR)
+{
+  // Resolve the constraint check and return parameters.
+  if (tree info = resolve_constraint_check (expr))
+	return TREE_PURPOSE (info);
+  return NULL_TREE;
+}
+  else
+gcc_unreachable ();
+}
+
 // -- //
-// Requirement Reduction
+// Normalization
 //
-// Reduces a template requirement to a logical formula written in terms of
+// Normalize a template requirement to a logical formula written in terms of
 // atomic propositions, returing the new expression.  If the expression cannot
-// be reduced, a NULL_TREE is returned, indicating failure to reduce the
-// original requirment. 
+// be normalized, a NULL_TREE is returned.
 
 namespace {
 
@@ -1080,7 +1110,8 @@ build_call_check (tree id)
 // arguments to the target are given by ARG and REST. If the target is
 // a function (overload set or baselink reffering to an overload set),
 // then ths builds the call expression  TARGETARG, REST(). If REST is 
-// NULL_TREE, then the resulting check is just TARGETARG().
+// NULL_TREE, then the resulting check is just TARGETARG(). If ARG is
+// NULL_TREE, then the resulting check is TARGETREST().
 tree
 build_concept_check (tree target, tree arg, tree rest) 
 {
@@ -1089,19 +1120,26 @@ build_concept_check (tree target, tree arg, tree rest)
   // Build a template-id that acts as the call target using TARGET as
   // the template and ARG as the only explicit argument.
   int n = rest ? TREE_VEC_LENGTH (rest) : 0;
-  tree targs = make_tree_vec (n + 1);
-  TREE_VEC_ELT (targs, 0) = arg;
-  if (rest)
-for (int i = 0; i  n; ++i)
-  TREE_VEC_ELT (targs, i + 1) = TREE_VEC_ELT (rest, i);
-  SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs, n + 1);
-  if (variable_template_p (target))
-return lookup_template_variable (target, targs);
+  tree targs;
+  if (arg)
+{
+  targs = make_tree_vec (n + 1);
+  TREE_VEC_ELT (targs, 0) = arg;
+  if (rest)
+for (int i = 0; i  n; ++i)
+  TREE_VEC_ELT (targs, i + 1) = TREE_VEC_ELT (rest, i);
+  SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs, n + 1);
+}
   else
 {
-  tree id = lookup_template_function (target, targs);
-  return build_call_check (id);
+  gcc_assert (rest != NULL_TREE);
+  targs = rest;
 }
+
+  if (variable_template_p (target))
+return lookup_template_variable (target, targs);
+  else
+return build_call_check (lookup_template_function 

[committed] Require lto for gcc.dg/pr61868.c

2014-09-06 Thread John David Anglin

gcc.dg/pr61868.c requires lto support.  The attach change fixes fail on
hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.

Committed to trunk.

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


2014-09-06  John David Anglin  dang...@gcc.gnu.org

* gcc.dg/pr61868.c: Require lto.

Index: gcc.dg/pr61868.c
===
--- gcc.dg/pr61868.c(revision 214934)
+++ gcc.dg/pr61868.c(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target lto } */
 /* { dg-options -flto -frandom-seed=0x12345 }  */
 extern int foo (int);
 int main ()


Re: Vimrc config with GNU formatting

2014-09-06 Thread Segher Boessenkool
On Sat, Sep 06, 2014 at 03:38:31PM +, Yury Gribov wrote:
 Segher Boessenkool segher at kernel.crashing.org writes:
  On Fri, Sep 05, 2014 at 07:10:02PM +0400, Yury Gribov wrote:
   Now I don't quite like the idea of plugin:
  
  Anything that will make this enabled automatically will meet a lot of
  resistance.  Make something nice for contrib/ instead?
 
 Hm, isn't it already enabled by default for Emacs (in .dirs-local.el)?

That may well be.  But Vim is not Emacs.

 Also 
 GNU coding style is a requirement for GCC so resisting it may not make 
 sense...

I'm not resisting GNU coding style.  I am resisting scripts and/or other
configuration things that make my editor do something else than what I tell
it to do.  If I type enter in insert mode, the cursor should go to column
one in a newly opened line, not helpfully to e.g. four spaces in.  Because
I will bloody well type four spaces anyway.  Etc.  Not to mention the horrors
it will do in a machine description file.

This all should be opt-in.  As it already is.  If you can give some suggested
config for other users, that's marvellous, it will probably be helpful to
some.  Changing the config for everyone is quite the opposite of helpful.


Segher

p.s.  At least you're not forcing syntax hilighting on ;-)


[committed] Require visibility for g++.dg/ipa/pr61800.C

2014-09-06 Thread John David Anglin
The attached change fixes the failure of g++.dg/ipa/pr61800.C on  
hppa2.0w-hp-hpux11.11.
Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.  Committed to  
trunk.


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


2014-09-06  John David Anglin  dang...@gcc.gnu.org

* g++.dg/ipa/pr61800.C: Require visibility.

Index: g++.dg/ipa/pr61800.C
===
--- g++.dg/ipa/pr61800.C(revision 214934)
+++ g++.dg/ipa/pr61800.C(working copy)
@@ -1,5 +1,6 @@
 /* PR ipa/61800 */
 /* { dg-do compile } */
+/* { dg-require-visibility  } */
 /* { dg-options -O2 } */
 
 #pragma GCC visibility push(hidden)


[Patch, FORTRAN] PR61933 Inquire on Internal Unit

2014-09-06 Thread Jerry DeLisle
Hi,

The attached patch adds a compile time check for negative unit numbers given in
an INQUIRE statement. A new test case is provided and one updated.

Regression tested on x86-64.

OK for trunk?


2014-09-06  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR fortran/61933
* io.c (gfc_match_inquire): Add error check for negative unit.


* gfortran.dg/negative_unit_check.f90: New test.
* gfortran.dg/inquire_9.f90: Update test

*libgfortran/io/lock.c: Fix a typo.
Index: gcc/fortran/io.c
===
--- gcc/fortran/io.c	(revision 214973)
+++ gcc/fortran/io.c	(working copy)
@@ -3998,6 +3998,14 @@
   goto cleanup;
 }
 
+  if (inquire-unit != NULL  inquire-unit-expr_type == EXPR_CONSTANT
+   inquire-unit-ts.type == BT_INTEGER
+   mpz_sgn (inquire-unit-value.integer) == -1)
+{
+  gfc_error (INQUIRE statement at %L requires positive UNIT, loc);
+  goto cleanup;
+}
+
   if (gfc_pure (NULL))
 {
   gfc_error (INQUIRE statement not allowed in PURE procedure at %C);
Index: gcc/testsuite/gfortran.dg/inquire_9.f90
===
--- gcc/testsuite/gfortran.dg/inquire_9.f90	(revision 214973)
+++ gcc/testsuite/gfortran.dg/inquire_9.f90	(working copy)
@@ -5,8 +5,6 @@
   inquire (file='inquire_9 file that should not exist', exist=l)
   if (l) call abort
   l = .true.
-  inquire (unit=-16, exist=l)
-  if (l) call abort
   open (unit=16, file='inquire_9.tst')
   write (unit=16, fmt='(a)') 'Test'
   l = .false.
Index: gcc/testsuite/gfortran.dg/negative_unit_check.f90
===
--- gcc/testsuite/gfortran.dg/negative_unit_check.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/negative_unit_check.f90	(working copy)
@@ -0,0 +1,5 @@
+! { dg-do compile }
+!  Test case from PR61933.
+   LOGICAL :: file_exists
+   INQUIRE(UNIT=-1,EXIST=file_exists)! { dg-error requires positive UNIT }
+END
Index: libgfortran/io/lock.c
===
--- libgfortran/io/lock.c	(revision 214973)
+++ libgfortran/io/lock.c	(working copy)
@@ -27,7 +27,7 @@
 #include string.h
 #include stdlib.h
 
-/* library_start()-- Called with a library call is entered.  */
+/* library_start()-- Called when a library call is entered.  */
 
 void
 library_start (st_parameter_common *cmp)
! { dg-do compile }
!  Test case from PR61933.
   LOGICAL :: file_exists
   INQUIRE(UNIT=-1,EXIST=file_exists)! { dg-error requires positive UNIT }
END


[committed] PR testsuite/56194

2014-09-06 Thread John David Anglin
The attached change avoids the failure of the scan-assembler-not check  
for rodata on hppa*-*-*.


Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.  Committed to  
trunk, 4.9 and 4.8.


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


2014-09-06  John David Anglin  dang...@gcc.gnu.org

PR testsuite/56194
* g++.dg/init/const9.C: Skip scan-assembler-not rodata on hppa*-*-*.

Index: g++.dg/init/const9.C
===
--- g++.dg/init/const9.C(revision 214934)
+++ g++.dg/init/const9.C(working copy)
@@ -1,5 +1,5 @@
 // PR c++/55893
-// { dg-final { scan-assembler-not rodata } }
+// { dg-final { scan-assembler-not rodata { target { ! hppa*-*-* } } } }
 
 struct foo
 {


[PATCH C++] - SD-6 Implementation Part 4 - Test suite.

2014-09-06 Thread Ed Smith-Rowland

Greetings,

I am finally getting back to my SD-6 C++ features test work.

This adds front end and preprocessor tests for the language feature tests and 
__has_include.

I am still working on the fifth and last in this series to add 
__had_cpp_attribute but these first four patches add a very useful subset of 
the SD-6 feature testing.

Bootstrapped and tested under x86_64-linux.

OK?

Ed

2014-09-06  Edward Smith-Rowland  3dw...@verizon.net

Implement SD-6: SG10 Feature Test Recommendations
* g++.dg/cpp1y/feat-cxx11-neg.C: New.
* g++.dg/cpp1y/feat-cxx11.C: New.
* g++.dg/cpp1y/feat-cxx14.C: New.
* g++.dg/cpp1y/feat-cxx98.C: New.
* g++.dg/cpp1y/feat-cxx98-neg.C: New.
* g++.dg/cpp1y/phoobhar.h: New.
* g++.dg/cpp1y/testinc/phoobhar.h: New.

Index: g++.dg/cpp1y/feat-cxx11-neg.C
===
--- g++.dg/cpp1y/feat-cxx11-neg.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx11-neg.C   (working copy)
@@ -0,0 +1,32 @@
+// { dg-do compile { target c++11_only } }
+// { dg-options -pedantic-errors }
+
+// These *are* defined in C++14 onwards.
+
+#ifndef __cpp_binary_literals
+#  error __cpp_binary_literals // { dg-error error }
+#endif
+
+#ifndef __cpp_init_captures
+#  error __cpp_init_captures // { dg-error error }
+#endif
+
+#ifndef __cpp_generic_lambdas
+#  error __cpp_generic_lambdas // { dg-error error }
+#endif
+
+#ifndef __cpp_decltype_auto
+#  error __cpp_decltype_auto // { dg-error error }
+#endif
+
+#ifndef __cpp_runtime_arrays
+#  error __cpp_runtime_arrays // { dg-error error }
+#endif
+
+#ifndef __cpp_digit_separators
+#  error __cpp_digit_separators // { dg-error error }
+#endif
+
+#ifndef __cpp_attribute_deprecated
+#  error __cpp_attribute_deprecated // { dg-error error }
+#endif
Index: g++.dg/cpp1y/feat-cxx11.C
===
--- g++.dg/cpp1y/feat-cxx11.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx11.C   (working copy)
@@ -0,0 +1,94 @@
+// { dg-do compile }
+// { dg-options -std=gnu++11 }
+
+#ifndef __cpp_unicode_characters
+#  error __cpp_unicode_characters
+#elif __cpp_unicode_characters != 200704
+#  error __cpp_unicode_characters != 200704
+#endif
+
+#ifndef __cpp_raw_strings
+#  error __cpp_raw_strings
+#elif __cpp_raw_strings != 200710
+#  error __cpp_raw_strings != 200710
+#endif
+
+#ifndef __cpp_unicode_literals
+#  error __cpp_unicode_literals
+#elif __cpp_unicode_literals != 200710
+#  error __cpp_unicode_literals != 200710
+#endif
+
+#ifndef __cpp_user_defined_literals
+#  error __cpp_user_defined_literals
+#elif __cpp_user_defined_literals != 200809
+#  error __cpp_user_defined_literals != 200809
+#endif
+
+#ifndef __cpp_lambdas
+#  error __cpp_lambdas
+#elif __cpp_lambdas != 200907
+#  error __cpp_lambdas != 200907
+#endif
+
+#ifndef __cpp_constexpr
+#  error __cpp_constexpr
+#elif __cpp_constexpr != 200704
+#  error __cpp_constexpr != 200704
+#endif
+
+#ifndef __cpp_static_assert
+#  error __cpp_static_assert
+#elif __cpp_static_assert != 200410
+#  error __cpp_static_assert != 200410
+#endif
+
+#ifndef __cpp_decltype
+#  error __cpp_decltype
+#elif __cpp_decltype != 200707
+#  error __cpp_decltype != 200707
+#endif
+
+#ifndef __cpp_attributes
+#  error __cpp_attributes
+#elif __cpp_attributes != 200809
+#  error __cpp_attributes != 200809
+#endif
+
+#ifndef __cpp_rvalue_reference
+#  error __cpp_rvalue_reference
+#elif __cpp_rvalue_reference != 200610
+#  error __cpp_rvalue_reference != 200610
+#endif
+
+#ifndef __cpp_variadic_templates
+#  error __cpp_variadic_templates
+#elif __cpp_variadic_templates != 200704
+#  error __cpp_variadic_templates != 200704
+#endif
+
+#ifndef __cpp_alias_templates
+#  error __cpp_alias_templates
+#elif __cpp_alias_templates != 200704
+#  error __cpp_alias_templates != 200704
+#endif
+
+//  This C++14 feature was developed as an extension for C++11.
+#ifndef __cpp_return_type_deduction
+#  error __cpp_return_type_deduction
+#elif __cpp_return_type_deduction != 201304
+#  error __cpp_return_type_deduction != 201304
+#endif
+
+//  These C++14 features are allowed in C++11 in non-ANSI modes.
+#ifndef __cpp_binary_literals
+#  error __cpp_binary_literals
+#elif __cpp_binary_literals != 201304
+#  error __cpp_binary_literals != 201304
+#endif
+
+#ifndef __cpp_runtime_arrays
+#  error __cpp_runtime_arrays
+#elif __cpp_runtime_arrays != 201304
+#  error __cpp_runtime_arrays != 201304
+#endif
Index: g++.dg/cpp1y/feat-cxx14.C
===
--- g++.dg/cpp1y/feat-cxx14.C   (revision 0)
+++ g++.dg/cpp1y/feat-cxx14.C   (working copy)
@@ -0,0 +1,232 @@
+// { dg-do compile { target c++14 } }
+// { dg-options -I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc }
+
+// Begin C++11 tests.
+
+#ifndef __cpp_unicode_characters
+#  error __cpp_unicode_characters
+#elif __cpp_unicode_characters != 200704
+#  error __cpp_unicode_characters != 200704

Re: [gofrontend-dev] gccgo and syscall.SysProcAttr.Cloneflags

2014-09-06 Thread Michael Hudson-Doyle
Ian Lance Taylor i...@golang.org writes:

 On Mon, Sep 1, 2014 at 4:18 AM, Michael Hudson-Doyle
 michael.hud...@linaro.org wrote:

 It's late for me and I don't have a proper test case but it seems to me
 that while gccgo's syscall lets you set Cloneflags on its SysProcAttr,
 but doesn't actually *do* anything with the flags.  Am I missing
 something?

 You aren't missing anything.  I made an error in an libgo merge last
 year.  This patch fixes the problem.  

Hi, I can confirm that docker's libcontainer works much better with this
patch!  Thanks for the quick fix.

Cheers,
mwh

 Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
 Committed to mainline and 4.9 branch.

 Ian

 diff -r da369647d0ec libgo/go/syscall/exec_linux.go
 --- a/libgo/go/syscall/exec_linux.go Fri Sep 05 07:42:57 2014 -0700
 +++ b/libgo/go/syscall/exec_linux.go Fri Sep 05 08:05:22 2014 -0700
 @@ -43,7 +43,7 @@
   // Declare all variables at top in case any
   // declarations require heap allocation (e.g., err1).
   var (
 - r1 Pid_t
 + r1 uintptr
   err1   Errno
   nextfd int
   i  int
 @@ -65,7 +65,7 @@
   // About to call fork.
   // No more allocation or calls of non-assembly functions.
   runtime_BeforeFork()
 - r1, err1 = raw_fork()
 + r1, _, err1 = RawSyscall6(SYS_CLONE,
 uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0, 0)
   if err1 != 0 {
   runtime_AfterFork()
   return 0, err1


pgphVdlMFWmUt.pgp
Description: PGP signature


Re: [PATCH v4 0/2] Fix OS X Yosemite-related issues

2014-09-06 Thread James Clarke
Just checking on the status of this as I haven't heard anything further for a 
while.

James Clarke

 On 26 Aug 2014, at 08:11, James Clarke jrt...@jrtc27.com wrote:
 
 These patches combine to address PR target/61407, meaning that GCC is
 able to bootstrap on OS X Yosemite.
 
 Changes from v3:
  [PATCH v4 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__:
* Unchanged
  [PATCH v4 2/2] Fixed dirent sanitizer for 32-bit OS X builds:
* Check whether the _DARWIN_FEATURE_64_BIT_INODE macro is defined
rather than its value
 
 James Clarke (2):
  Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
  Fixed dirent sanitizer for 32-bit OS X builds
 
 gcc/config/darwin-c.c  | 25 --
 gcc/config/darwin-driver.c |  2 --
 gcc/testsuite/gcc.dg/darwin-minversion-1.c |  3 ++-
 gcc/testsuite/gcc.dg/darwin-minversion-2.c |  3 ++-
 gcc/testsuite/gcc.dg/darwin-minversion-3.c |  3 ++-
 gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 +++
 .../sanitizer_platform_limits_posix.cc |  3 ++-
 .../sanitizer_platform_limits_posix.h  |  9 
 8 files changed, 48 insertions(+), 12 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c
 
 -- 
 2.1.0
 


Re: [Patch, FORTRAN] PR61933 Inquire on Internal Unit

2014-09-06 Thread Janne Blomqvist
On Sun, Sep 7, 2014 at 12:51 AM, Jerry DeLisle jvdeli...@charter.net wrote:
 Hi,

 The attached patch adds a compile time check for negative unit numbers given 
 in
 an INQUIRE statement. A new test case is provided and one updated.

What about units opened with newunit= ? Those have negative unit
numbers. It seems strange that one wouldn't be allowed to inquire such
units? Or if that indeed is the case, I suggest it's a bug in the
standard (one can imagine such happening by forgetting to update
inquire constraints after adding newunit= in f2003).

program negunit
  implicit none
  logical :: file_exists
  integer :: u
  open(newunit=u, file=test.dat)
  inquire(unit=u, exist=file_exists)
  write(*,*) u, file_exists
  close(u, status=delete)
end program negunit


Testing with gfortran 4.9.1 (homebrew) on a Mac, the above program prints

 -10 F

which is wrong, but a slightly different issue. The almost identical program

program posunit
  implicit none
  logical :: file_exists
  integer :: u=10
  open(u, file=test.dat)
  inquire(unit=u, exist=file_exists)
  write(*,*) u, file_exists
  close(u, status=delete)
end program posunit

correctly prints

  10 T



-- 
Janne Blomqvist


Re: Vimrc config with GNU formatting

2014-09-06 Thread Yuri Gribov
Replying to all this time.

On Sat, Sep 6, 2014 at 11:35 PM, Segher Boessenkool
seg...@kernel.crashing.org wrote:
 Hm, isn't it already enabled by default for Emacs (in .dirs-local.el)?

 That may well be.  But Vim is not Emacs.

Why is Vim special? As a developer I'd prefer the unified approach:
either nuke both or move them to contrib or make them default.

 Also
 GNU coding style is a requirement for GCC so resisting it may not make
 sense...

 I'm not resisting GNU coding style.  I am resisting scripts and/or other
 configuration things that make my editor do something else than what I tell
 it to do.  If I type enter in insert mode, the cursor should go to column
 one in a newly opened line, not helpfully to e.g. four spaces in.

Two spaces in GNU standard.

 Because
 I will bloody well type four spaces anyway.

Well, good luck with a deeply nested constructs where GNU wants a
weird mix of tabs and spaces which developers get wrong every time
(unless they remember to run sed on their patches which they normally
don't).

 Etc.  Not to mention the horrors
 it will do in a machine description file.

Indenting is only enabled for C, C++ and Java and .def. Md's and other
stuff is untouched (hmm, .md is interesting).

 This all should be opt-in.  As it already is.

Not for other editors...

 If you can give some suggested
 config for other users, that's marvellous, it will probably be helpful to
 some.  Changing the config for everyone is quite the opposite of helpful.

Let's see what other hackers say.

 p.s.  At least you're not forcing syntax hilighting on ;-)

Noo, this is too personal.


Re: [Patch, FORTRAN] PR61933 Inquire on Internal Unit

2014-09-06 Thread Jerry DeLisle
On 06/09/14 21:08, Janne Blomqvist wrote:
 On Sun, Sep 7, 2014 at 12:51 AM, Jerry DeLisle jvdeli...@charter.net wrote:
 Hi,

 The attached patch adds a compile time check for negative unit numbers given 
 in
 an INQUIRE statement. A new test case is provided and one updated.
 
 What about units opened with newunit= ? Those have negative unit
 numbers. It seems strange that one wouldn't be allowed to inquire such
 units? Or if that indeed is the case, I suggest it's a bug in the
 standard (one can imagine such happening by forgetting to update
 inquire constraints after adding newunit= in f2003).
 
 program negunit
   implicit none
   logical :: file_exists
   integer :: u
   open(newunit=u, file=test.dat)
   inquire(unit=u, exist=file_exists)
   write(*,*) u, file_exists
   close(u, status=delete)
 end program negunit
 

I was thinking of the same issue.  The front end patch is correct. But I need to
work further on the run time side. NEWUNIT presents a particular problem.  The
INQUIRE should search the treap for the negative unit and if found, return true.
Having the negative unit number by itself is not sufficient.

I will work on the run time part next. Frontend OK?

Jerry


Re: Vimrc config with GNU formatting

2014-09-06 Thread Yuri Gribov
On Sun, Sep 7, 2014 at 8:18 AM, Yuri Gribov tetra2...@gmail.com wrote:
 Replying to all this time.

 On Sat, Sep 6, 2014 at 11:35 PM, Segher Boessenkool
 seg...@kernel.crashing.org wrote:
 Hm, isn't it already enabled by default for Emacs (in .dirs-local.el)?

 That may well be.  But Vim is not Emacs.

 Why is Vim special? As a developer I'd prefer the unified approach:
 either nuke both or move them to contrib or make them default.

And of course the setting can be easily turned off on user's side by
removing the config.

-Y