[Patch, Fortran, committed] PR51972 - Extended checking of gfortran.dg/class_48.f90

2012-02-05 Thread Tobias Burnus
The patch for PR 51972 fixed some issues with intrinsic assignment, 
which involved polymorphic components.


However, I couldn't check the correctness in some cases as I run ICEs. 
Those were fixed by Mikael's recent patch (cf. PR 51754 et alia).


The committed (Rev. ) and attached patch adds the missing checks. On the 
way, I run into another issue (now: PR 52102), which I worked around. 
However, as MALLOC_PERTURB_ or valgrind shows, the issue also affects 
the current version. Thus, in the committed patch, only test3() has 
proper checking, for test4() I have added a commented out test case, 
which without MALLOC_PERTURB_ should work.


Committed as Rev. 183904.

Tobias
Index: gcc/testsuite/gfortran.dg/class_48.f90
===
--- gcc/testsuite/gfortran.dg/class_48.f90	(Revision 183903)
+++ gcc/testsuite/gfortran.dg/class_48.f90	(Arbeitskopie)
@@ -70,14 +70,16 @@
 
   type(t2) :: one, two
 
-  one = two
+  allocate (two%a(2))
+  two%a(1)%x = 4
+  two%a(2)%x = 6
   if (allocated (one%a)) call abort ()
-
-  allocate (two%a(2), source=[t(4), t(6)])
   one = two
   if (.not.allocated (one%a)) call abort ()
-! FIXME: Check value
 
+  if ((one%a(1)%x /= 4)) call abort ()
+  if ((one%a(2)%x /= 6)) call abort ()
+
   deallocate (two%a)
   one = two
   if (allocated (one%a)) call abort ()
@@ -94,12 +96,43 @@
 
   type(t2) :: one, two
 
-  one = two
   if (allocated (one%a)) call abort ()
-
-!  allocate (two%a(2)) ! ICE: SEGFAULT
+  if (allocated (two%a)) call abort ()
+!
+! FIXME: Fails due to PR 51754
+!
+! NOTE: Might be only visible with MALLOC_PERTURB_ or with valgrind
+!
+!  allocate (two%a(2))
+!  if (allocated (two%a(1)%x)) call abort ()
+!  if (allocated (two%a(2)%x)) call abort ()
+!  allocate (two%a(1)%x(3), source=[1,2,3])
+!  allocate (two%a(2)%x(5), source=[5,6,7,8,9])
 !  one = two
 !  if (.not. allocated (one%a)) call abort ()
+!  if (.not. allocated (one%a(1)%x)) call abort ()
+!  if (.not. allocated (one%a(2)%x)) call abort ()
+!
+!  if (size(one%a) /= 2) call abort()
+!  if (size(one%a(1)%x) /= 3) call abort()
+!  if (size(one%a(2)%x) /= 5) call abort()
+!  if (any (one%a(1)%x /= [1,2,3])) call abort ()
+!  if (any (one%a(2)%x /= [5,6,7,8,9])) call abort ()
+!
+!  deallocate (two%a(1)%x)
+!  one = two
+!  if (.not. allocated (one%a)) call abort ()
+!  if (allocated (one%a(1)%x)) call abort ()
+!  if (.not. allocated (one%a(2)%x)) call abort ()
+!
+!  if (size(one%a) /= 2) call abort()
+!  if (size(one%a(2)%x) /= 5) call abort()
+!  if (any (one%a(2)%x /= [5,6,7,8,9])) call abort ()
+!
+!  deallocate (two%a)
+  one = two
+  if (allocated (one%a)) call abort ()
+  if (allocated (two%a)) call abort ()
 end subroutine test4
 
 
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog	(Revision 183903)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2012-02-05  Tobias Burnus  
+
+	PR fortran/51972
+	* gfortran.dg/class_48.f90: Add some further checks.
+
 2012-02-05  Ira Rosen  
 
 	PR tree-optimization/52091


[patch, fortran] Fix PR 48847, bogus "unused parameter" warning

2012-02-05 Thread Thomas Koenig

Hello world,

the attached, rather obvious patch fixed a bogus "unused parameter"
warning with procedure dummy arguments and warns about these if
they occur.

Regression-tested.  OK for trunk?  Or rather wait until 4.8?

Thomas

2012-02-05  Thomas König  

PR fortran/48847
* trans-decl.c:  Warn about unused dummy procedure arguments
if -Wunused-dummy-argument is specified.  Suppress middle-end
warnings about procedure arguments.

2012-02-05  Thomas König  

PR fortran/48847
* gfortran.dg/warn_unused_dummy_argument_3.f90:  New test.
Index: trans-decl.c
===
--- trans-decl.c	(Revision 183873)
+++ trans-decl.c	(Arbeitskopie)
@@ -4683,6 +4683,22 @@ generate_local_decl (gfc_symbol * sym)
 	  && sym->ts.type == BT_CHARACTER && sym->ts.is_c_interop
 	  && sym->ns->proc_name != NULL && sym->ns->proc_name->attr.is_bind_c)
 	gfc_conv_scalar_char_value (sym, NULL, NULL);
+
+  /* Unused procedure passed as dummy argument.  */
+  if (sym->attr.flavor == FL_PROCEDURE)
+	{
+	  if (!sym->attr.referenced)
+	{
+	  if (gfc_option.warn_unused_dummy_argument)
+		gfc_warning ("Unused dummy argument '%s' at %L", sym->name,
+			 &sym->declared_at);	 
+	}
+
+	  /* Silence bogus "unused parameter" warnings from the
+	 middle end.  */
+	  if (sym->backend_decl != NULL_TREE)
+		TREE_NO_WARNING(sym->backend_decl) = 1;
+	}
 }
 
   /* Make sure we convert the types of the derived types from iso_c_binding
! { dg-do compile }
! { dg-options "-Wunused-dummy-argument -Wunused-parameter" }
! PR 48847 - we used to generate a warning for g(), and none for h()
program main
contains
  function f(g,h)
interface
   real function g()
   end function g
end interface
interface
   real function h()  !  { dg-warning "Unused dummy argument" }
   end function h
end interface
real :: f
f = g()
  end function f
end program main


New Swedish PO file for 'gcc' (version 4.7-b20120128)

2012-02-05 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Swedish team of translators.  The file is available at:

http://translationproject.org/latest/gcc/sv.po

(This file, 'gcc-4.7-b20120128.sv.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




[v3] libstdc++/52119

2012-02-05 Thread Paolo Carlini

Hi,

the library bits seem straightforward enough to go in now. Of course the 
substantive issue seems C++ front end diagnostics, post 4.7.0 material.


Sanity checked x86_64-linux.

Thanks,
Paolo.

///
2012-02-05  Jeffrey Yasskin  
Paolo Carlini  

PR libstdc++/52119
* include/std/limits (__glibcxx_min): Fix to aboid undefined behavior.
Index: include/std/limits
===
--- include/std/limits  (revision 183904)
+++ include/std/limits  (working copy)
@@ -1,7 +1,7 @@
 // The template and inlines for the numeric_limits classes. -*- C++ -*-
 
 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-// 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// 2008, 2009, 2010, 2011, 2012 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
@@ -129,7 +129,7 @@
 #define __glibcxx_signed(T)((T)(-1) < 0)
 
 #define __glibcxx_min(T) \
-  (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
+  (__glibcxx_signed (T) ? -__glibcxx_max (T) - 1 : (T)0)
 
 #define __glibcxx_max(T) \
   (__glibcxx_signed (T) ? \


[patch] [4.8] Support pattern recognition in SLP

2012-02-05 Thread Ira Rosen

Hi,

This patch adds a support of pattern recognition in basic block SLP.

Bootstrapped and tested on powerpc64-suse-linux.

Ira

ChangeLog:

* tree-vectorizer.h (vect_pattern_recog): Add new argument.
* tree-vect-loop.c (vect_analyze_loop_2): Update call to
vect_pattern_recog.
* tree-vect-patterns.c (widened_name_p): Pass basic block
info to vect_is_simple_use.
(vect_recog_dot_prod_pattern): Fail for basic blocks.
(vect_recog_widen_sum_pattern): Likewise.
(vect_handle_widen_op_by_const): Support basic blocks.
(vect_operation_fits_smaller_type,
vect_recog_over_widening_pattern): Likewise.
(vect_recog_vector_vector_shift_pattern): Support basic blocks.
Update call to vect_is_simple_use.
(vect_recog_mixed_size_cond_pattern): Support basic blocks.
Add printing.
(check_bool_pattern): Add an argument, update call to
vect_is_simple_use and the recursive calls.
(vect_recog_bool_pattern): Update relevant function calls.
Add printing.
(vect_mark_pattern_stmts): Update calls to new_stmt_vec_info.
(vect_pattern_recog_1): Check for reduction only in loops.
(vect_pattern_recog): Add new argument.  Support basic blocks.
* tree-vect-stmts.c (vectorizable_conversion): Pass basic block
info to vect_is_simple_use_1.
* tree-vect-slp.c (vect_get_and_check_slp_defs): Support basic
blocks.
(vect_slp_analyze_bb_1): Call vect_pattern_recog.

testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-pattern-1.c: New test.
* gcc.dg/vect/bb-slp-pattern-2.c: New test.

(See attached file: bb-patterns.txt)Index: testsuite/gcc.dg/vect/bb-slp-pattern-1.c
===
--- testsuite/gcc.dg/vect/bb-slp-pattern-1.c(revision 0)
+++ testsuite/gcc.dg/vect/bb-slp-pattern-1.c(revision 0)
@@ -0,0 +1,54 @@
+/* { dg-require-effective-target vect_int } */
+
+#include 
+#include "tree-vect.h"
+
+#define N 8
+
+unsigned short X[N];
+unsigned short Y[N];
+unsigned int result[N];
+
+/* unsigned short->unsigned int widening-mult.  */
+__attribute__ ((noinline, noclone)) void
+foo (void)
+{
+  result[0] = (unsigned int) (X[0] * Y[0]);
+  result[1] = (unsigned int) (X[1] * Y[1]);
+  result[2] = (unsigned int) (X[2] * Y[2]);
+  result[3] = (unsigned int) (X[3] * Y[3]);
+  result[4] = (unsigned int) (X[4] * Y[4]);
+  result[5] = (unsigned int) (X[5] * Y[5]);
+  result[6] = (unsigned int) (X[6] * Y[6]);
+  result[7] = (unsigned int) (X[7] * Y[7]);
+}
+
+int main (void)
+{
+  int i, tmp;
+
+  check_vect ();
+
+  for (i = 0; i < N; i++)
+{
+  X[i] = i;
+  Y[i] = 64-i;
+}
+
+  foo ();
+
+  for (i = 0; i < N; i++)
+{
+  __asm__ volatile ("");
+  tmp = X[i] * Y[i];
+  if (result[i] != tmp)
+abort ();
+}
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "slp" { 
target { vect_widen_mult_hi_to_si || vect_unpack } } } } */
+/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 
8 "slp" { target vect_widen_mult_hi_to_si_pattern } } } */
+/* { dg-final { scan-tree-dump-times "pattern recognized" 8 "slp" { target 
vect_widen_mult_hi_to_si_pattern } } } */
+/* { dg-final { cleanup-tree-dump "slp" } } */
Index: testsuite/gcc.dg/vect/bb-slp-pattern-2.c
===
--- testsuite/gcc.dg/vect/bb-slp-pattern-2.c(revision 0)
+++ testsuite/gcc.dg/vect/bb-slp-pattern-2.c(revision 0)
@@ -0,0 +1,52 @@
+/* { dg-require-effective-target vect_condition } */
+
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__((noinline, noclone)) void
+foo (short * __restrict__ a, int * __restrict__ b, int stride)
+{
+  int i;
+
+  for (i = 0; i < N/stride; i++, a += stride, b += stride)
+   {
+ a[0] = b[0] ? 1 : 7;
+ a[1] = b[1] ? 2 : 0;
+ a[2] = b[2] ? 3 : 0;
+ a[3] = b[3] ? 4 : 0;
+ a[4] = b[4] ? 5 : 0;
+ a[5] = b[5] ? 6 : 0;
+ a[6] = b[6] ? 7 : 0;
+ a[7] = b[7] ? 8 : 0;
+   }
+}
+
+short a[N];
+int b[N];
+int main ()
+{
+  int i;
+
+  check_vect ();
+
+  for (i = 0; i < N; i++)
+{
+  a[i] = i;
+  b[i] = -i;
+}
+
+  foo (a, b, 8);
+
+  for (i = 1; i < N; i++)
+if (a[i] != i%8 + 1)
+  abort ();
+
+  if (a[0] != 7)
+abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 
"slp" { target { vect_element_align && vect_pack_trunc } } } } */
+/* { dg-final { cleanup-tree-dump "slp" } } */
Index: tree-vectorizer.h
===
--- tree-vectorizer.h   (revision 183902)
+++ tree-vectorizer.h   (working copy)
@@ -933,7 +933,7 @@ extern void vect_slp_transform_bb (basic_block);
in the future.  */
 typedef gimple (* vect_recog_func_ptr) (VEC (gimple, heap) **, tree *, tree *);
 #define NUM_PATTERNS 10

Re: [patch] should not define bool, true or false as macros for C++

2012-02-05 Thread Jonathan Wakely
On 4 February 2012 23:35, Gerald Pfeifer wrote:
> For what it's worth, I strongly suggest that you only define those when
> __cpluplus is pre-C++11.
>
> There is simply too much software out there which will run into this

Really? Why would any C++ code assume "bool" is defined as a macro?
It's been a keyword in C++ for longer than C99 has defined it as a macro.

> and being aggressive in breaking (admittedly non-standard confirming
> programs) gives GCC a bad reputation and is not nice to our users to
> begin with.

Fair enough, this revised patch still defines bool, true and false for
C++98 mode, but not for C++11 mode.

gcc/
* ginclude/stdbool.h (true, false, bool): Do not define for C++11.

libstdc++/
   * testsuite/18_support/headers/cstdbool/macros.cc: New.

Tested x86_64-linux, OK for trunk?
diff --git a/gcc/ginclude/stdbool.h b/gcc/ginclude/stdbool.h
index 4ed911f..4645654 100644
--- a/gcc/ginclude/stdbool.h
+++ b/gcc/ginclude/stdbool.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2009, 2012 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -36,11 +36,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 
 #else /* __cplusplus */
 
-/* Supporting  in C++ is a GCC extension.  */
+/* Supporting _Bool in C++ is a GCC extension.  */
 #define _Bool  bool
+
+#if __cplusplus < 201103L
+/* Defining these macros in C++98 is a GCC extension.  */
 #define bool   bool
 #define false  false
 #define true   true
+#endif
 
 #endif /* __cplusplus */
 
diff --git a/libstdc++-v3/testsuite/18_support/headers/cstdbool/macros.cc 
b/libstdc++-v3/testsuite/18_support/headers/cstdbool/macros.cc
new file mode 100644
index 000..58631d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/headers/cstdbool/macros.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2012 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
+// .
+
+#include 
+
+#ifndef __bool_true_false_are_defined
+# error "The header  fails to define a macro named 
__bool_true_false_are_defined"
+#endif
+
+#ifdef bool
+# error "The header  defines a macro named bool"
+#endif
+
+#ifdef true
+# error "The header  defines a macro named true"
+#endif
+
+#ifdef false
+# error "The header  defines a macro named false"
+#endif
+


Re: [v3] adjust weak_ptr testcase

2012-02-05 Thread Jonathan Wakely
On 23 December 2011 17:33, Jonathan Wakely wrote:
> This modifies the test to PASS when the expected type of exception is
> caught, instead of being XFAIL due to uncaught exception.
>
> Tested x86_64-linux, committed to trunk.
>
>        * testsuite/tr1/2_general_utilities/shared_ptr/cons/
>        weak_ptr_expired.cc: Modify to PASS instead of XFAIL.

And the same for the 20_util equivalent of the same test, this avoids
aborting which should make it run slightly faster (and means Fedora's
ABRT doesn't flag up a crash when running the testsuite)

2012-02-05  Jonathan Wakely  

* testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Modify to
PASS instead of XFAIL.

Tested x86_64-linux and committed to trunk.
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc 
b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
index cff9b3b..d2bf508 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
@@ -1,7 +1,6 @@
 // { dg-options "-std=gnu++0x" }
-// { dg-do run { xfail *-*-* } }
 
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation
+// Copyright (C) 2005, 2006, 2007, 2009, 2012 Free Software Foundation
 //
 // 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
@@ -31,7 +30,7 @@ struct A { };
 int
 test01()
 {
-  bool test __attribute__((unused)) = true;
+  bool test = false;
 
   std::shared_ptr a1(new A);
   std::weak_ptr wa(a1);
@@ -44,12 +43,9 @@ test01()
   catch (const std::bad_weak_ptr&)
   {
 // Expected.
-  __throw_exception_again;
-  }
-  catch (...)
-  {
-// Failed.
+test = true;
   }
+  VERIFY( test );
 
   return 0;
 }


[MIPS, committed] Tidy atomic-related failures for mips-elf

2012-02-05 Thread Richard Sandiford
Plain MIPS I testing on mips-elf has quite a few atomic-related failures,
due to the lack of LL and SC.  Fixed as below.

Tested on mips-elf, mips64-linux-gnu, and a host of others.  Applied.

Richard


gcc/testsuite/
* lib/target-supports.exp (check_effective_target_mips_llsc): New.
(check_effective_target_sync_int_long): Use it.
(check_effective_target_sync_char_short): Likewise.
* gcc.target/mips/atomic-memory-1.c: Restrict error check to mips_llsc.

Index: gcc/testsuite/lib/target-supports.exp
===
--- gcc/testsuite/lib/target-supports.exp   2012-02-05 14:34:48.0 
+
+++ gcc/testsuite/lib/target-supports.exp   2012-02-05 14:51:03.0 
+
@@ -890,6 +890,26 @@ proc check_effective_target_mips_newabi_
 } "-mabi=64"]
 }
 
+# Return true if the target is a MIPS target that has access
+# to the LL and SC instructions.
+
+proc check_effective_target_mips_llsc { } {
+if { ![istarget mips*-*-*] } {
+   return 0
+}
+# Assume that these instructions are always implemented for
+# non-elf* targets, via emulation if necessary.
+if { ![istarget *-*-elf*] } {
+   return 1
+}
+# Otherwise assume LL/SC support for everything but MIPS I.
+return [check_no_compiler_messages mips_llsc assembly {
+   #if __mips == 1
+   #error FOO
+   #endif
+}]
+}
+
 # Return 1 if the current multilib does not generate PIC by default.
 
 proc check_effective_target_nonpic { } {
@@ -3770,7 +3790,7 @@ proc check_effective_target_sync_int_lon
 || [istarget powerpc*-*-*]
 || [istarget sparc64-*-*]
 || [istarget sparcv9-*-*]
-|| [istarget mips*-*-*] } {
+|| [check_effective_target_mips_llsc] } {
set et_sync_int_long_saved 1
 }
 }
@@ -3800,7 +3820,7 @@ proc check_effective_target_sync_char_sh
 || [istarget powerpc*-*-*]
 || [istarget sparc64-*-*]
 || [istarget sparcv9-*-*]
-|| [istarget mips*-*-*] } {
+|| [check_effective_target_mips_llsc] } {
set et_sync_char_short_saved 1
 }
 }
Index: gcc/testsuite/gcc.target/mips/atomic-memory-1.c
===
--- gcc/testsuite/gcc.target/mips/atomic-memory-1.c 2012-02-05 
14:34:48.0 +
+++ gcc/testsuite/gcc.target/mips/atomic-memory-1.c 2012-02-05 
14:50:33.0 +
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 
-/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" 
"" { target *-*-* } 0 } */
+/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" 
"" { target mips_llsc } 0 } */
 
 extern void abort (void);
 extern void exit (int);


[MIPS, committed] XFAIL gcc.dg/pr48774.c for MIPS REL targets

2012-02-05 Thread Richard Sandiford
gcc.dg/pr48774.c fails on MIPS REL targets because of an orphaned
HI16 relocation; see PR 52125 for details.  This isn't a regression,
so I'm just going to XFAIL it for now.

Tested on mips64-linux-gnu and various *-elf targets.  Applied.

Richard


gcc/testsuite/
PR target/52125
* lib/target-supports.exp (check_effective_target_mips_rel): New.
* gcc.dg/pr48774.c: Skip on MIPS REL targets.

Index: gcc/testsuite/lib/target-supports.exp
===
--- gcc/testsuite/lib/target-supports.exp   2012-02-05 14:53:05.0 
+
+++ gcc/testsuite/lib/target-supports.exp   2012-02-05 14:53:19.0 
+
@@ -910,6 +910,20 @@ proc check_effective_target_mips_llsc {
 }]
 }
 
+# Return true if the target is a MIPS target that uses in-place relocations.
+
+proc check_effective_target_mips_rel { } {
+if { ![istarget mips*-*-*] } {
+   return 0
+}
+return [check_no_compiler_messages mips_rel object {
+   #if (defined _ABIN32 && _MIPS_SIM == _ABIN32) \
+   || (defined _ABI64 && _MIPS_SIM == _ABI64)
+   #error FOO
+   #endif
+}]
+}
+
 # Return 1 if the current multilib does not generate PIC by default.
 
 proc check_effective_target_nonpic { } {
Index: gcc/testsuite/gcc.dg/pr48774.c
===
--- gcc/testsuite/gcc.dg/pr48774.c  2012-02-05 14:30:22.0 +
+++ gcc/testsuite/gcc.dg/pr48774.c  2012-02-05 14:53:46.0 +
@@ -1,5 +1,6 @@
 /* PR target/48774 */
 /* { dg-do run } */
+/* { dg-skip-if "PR 52125" { mips_rel } { "*" } { "" } } */
 /* { dg-options "-O2 -funroll-loops" } */
 
 extern void abort (void);


[MIPS, committed] Expect MIPS16 to use memcpy for short strings

2012-02-05 Thread Richard Sandiford
Although I changed non-MIPS16 code to allow larger inline copies:

   http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00053.html

MIPS16 code is still for now expected to use memcpy.  This patch
adjusts the testsuite accordingly.

Tested on mips64-linux-gnu and various ELF targets.  Applied.

Richard


gcc/testsuite/
* gcc.dg/tree-prof/stringop-2.c (main): Add a nomips16 attribute
on MIPS targets.
* gfortran.dg/pr45636.f90: XFAIL for MIPS16 targets.

Index: gcc/testsuite/gcc.dg/tree-prof/stringop-2.c
===
--- gcc/testsuite/gcc.dg/tree-prof/stringop-2.c 2012-02-04 10:57:10.0 
+
+++ gcc/testsuite/gcc.dg/tree-prof/stringop-2.c 2012-02-05 14:23:07.0 
+
@@ -3,6 +3,10 @@
 int b[1000];
 int size=1;
 int max=1;
+#ifdef __mips
+/* We allow short memcpy()s for MIPS16.  */
+int __attribute__((nomips16))
+#endif
 main()
 {
   int i;
Index: gcc/testsuite/gfortran.dg/pr45636.f90
===
--- gcc/testsuite/gfortran.dg/pr45636.f90   2012-02-05 14:23:36.0 
+
+++ gcc/testsuite/gfortran.dg/pr45636.f90   2012-02-05 14:26:41.0 
+
@@ -10,5 +10,5 @@ program main
   b = y
   call sub(a, b)
 end program main
-! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" } }
+! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { mips*-*-* 
&& { ! nomips16 } } } } }
 ! { dg-final { cleanup-tree-dump "forwprop2" } }


Re: [PATCH] MIPS16 TLS support for GCC

2012-02-05 Thread Richard Sandiford
Richard Sandiford  writes:
> "Maciej W. Rozycki"  writes:
>>> If there's still some concern that __mips16_rdhwr might not have
>>> the right ABI, then maybe we should simply emit a link-once function
>>> in each object that needs it.  We could then switch to another function
>>> (and another API) without having to keep the old one in libgcc.a for
>>> compatibility.  It would also avoid the -shared-libgcc thing.
>>> 
>>> Admittedly that's just an off-the-top-of-my-head idea. :-)
>>> What do you think?
>>
>>  Actually I had that idea of a link-once function too, but it turned out 
>> quite complicated to do without rewriting some generic parts of GCC as it 
>> is currently not prepared to emit link-once functions outside C++ 
>> compilations.  It's been a while and I did lots of other stuff meanwhile, 
>> so please excuse me if I got anything wrong here.
>
> Hmm, OK, I wouldn't have expected that.  But if you've tried making
> __mips16_rdhwr link-once and had a bad experience with it, then yeah,
> let's go with the hidden libgcc function.  It's just a shame that we're
> having to force static linking of libgcc for this one case.
>
> I'll take the relevant parts from Chung-Lin's patch and test them
> over the weekend.

Here's what I committed after testing on mips64-linux-gnu, both with
and without PLTs.

Richard


libgcc/
2012-02-05  Chung-Lin Tang  

* config.host (mips64*-*-linux*, mipsisa64*-*-linux*, mips*-*-linux*):
Add t-slibgcc-libgcc to tmake_file.
* config/mips/libgcc-mips16.ver: Revert previous patch.
* config/mips/mips16.S (__mips16_rdhwr): Hide.

Index: libgcc/config.host
===
--- libgcc/config.host  2012-02-04 10:27:18.0 +
+++ libgcc/config.host  2012-02-04 11:34:03.0 +
@@ -746,12 +746,12 @@ mips*-*-netbsd*)  # NetBSD/mips, either
;;
 mips64*-*-linux* | mipsisa64*-*-linux*)
extra_parts="$extra_parts crtfastmath.o"
-   tmake_file="${tmake_file} t-crtfm mips/t-mips16 mips/t-tpbit"
+   tmake_file="${tmake_file} t-crtfm mips/t-mips16 mips/t-tpbit 
t-slibgcc-libgcc"
md_unwind_header=mips/linux-unwind.h
;;
 mips*-*-linux*)# Linux MIPS, either endian.
extra_parts="$extra_parts crtfastmath.o"
-   tmake_file="${tmake_file} t-crtfm mips/t-mips16"
+   tmake_file="${tmake_file} t-crtfm mips/t-mips16 t-slibgcc-libgcc"
md_unwind_header=mips/linux-unwind.h
;;
 mips*-*-openbsd*)
Index: libgcc/config/mips/libgcc-mips16.ver
===
--- libgcc/config/mips/libgcc-mips16.ver2012-02-04 11:12:01.0 
+
+++ libgcc/config/mips/libgcc-mips16.ver2012-02-04 11:34:03.0 
+
@@ -84,7 +84,3 @@ GCC_4.4.0 {
   __mips16_call_stub_dc_9
   __mips16_call_stub_dc_10
 }
-
-GCC_4.7.0 {
-  __mips16_rdhwr
-}
Index: libgcc/config/mips/mips16.S
===
--- libgcc/config/mips/mips16.S 2012-02-04 10:27:18.0 +
+++ libgcc/config/mips/mips16.S 2012-02-04 11:34:03.0 +
@@ -712,6 +712,9 @@ CALL_STUB_RET (__mips16_call_stub_dc_10,
 
 #ifdef L_m16rdhwr
 STARTFN (__mips16_rdhwr)
+   /* Forced always hidden, because the PLT resolver function would
+  not preserve all necessary registers.  */
+   .hidden __mips16_rdhwr
.setpush
.setmips32r2
.setnoreorder


[MIPS, committed] Fix lengths of MIPS16 call patterns

2012-02-05 Thread Richard Sandiford
gcc.dg/fixed-point/convert.c and libgomp.fortran/vla3.f90 were failing
on MIPS16 for mips64-linux-gnu with PLTs enabled because we were
underestimating the length of a direct JAL.

Tested on mips64-linux-gnu and various ELF targets.  Applied.

Richard

gcc/
* config/mips/mips.md (sibcall_internal, sibcall_value_internal)
(sibcall_value_multiple_internal, call_split, call_internal_direct)
(call_direct_split, call_value_split, call_value_internal_direct)
(call_value_direct_split, call_value_multiple_split): Use jal and
jal_macro attributes.

Index: gcc/config/mips/mips.md
===
--- gcc/config/mips/mips.md 2012-02-04 20:15:02.0 +
+++ gcc/config/mips/mips.md 2012-02-04 20:17:58.0 +
@@ -6119,7 +6119,8 @@ (define_insn "sibcall_internal"
 (match_operand 1 "" ""))]
   "TARGET_SIBCALLS && SIBLING_CALL_P (insn)"
   { return MIPS_CALL ("j", operands, 0, 1); }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "indirect,direct")
+   (set_attr "jal_macro" "no")])
 
 (define_expand "sibcall_value"
   [(parallel [(set (match_operand 0 "")
@@ -6139,7 +6140,8 @@ (define_insn "sibcall_value_internal"
   (match_operand 2 "" "")))]
   "TARGET_SIBCALLS && SIBLING_CALL_P (insn)"
   { return MIPS_CALL ("j", operands, 1, 2); }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "indirect,direct")
+   (set_attr "jal_macro" "no")])
 
 (define_insn "sibcall_value_multiple_internal"
   [(set (match_operand 0 "register_operand" "")
@@ -6150,7 +6152,8 @@ (define_insn "sibcall_value_multiple_int
  (match_dup 2)))]
   "TARGET_SIBCALLS && SIBLING_CALL_P (insn)"
   { return MIPS_CALL ("j", operands, 1, 2); }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "indirect,direct")
+   (set_attr "jal_macro" "no")])
 
 (define_expand "call"
   [(parallel [(call (match_operand 0 "")
@@ -6214,13 +6217,14 @@ (define_insn_and_split "call_internal"
   [(set_attr "jal" "indirect,direct")])
 
 (define_insn "call_split"
-  [(call (mem:SI (match_operand 0 "call_insn_operand" "cS"))
+  [(call (mem:SI (match_operand 0 "call_insn_operand" "c,S"))
 (match_operand 1 "" ""))
(clobber (reg:SI RETURN_ADDR_REGNUM))
(clobber (reg:SI 28))]
   "TARGET_SPLIT_CALLS"
   { return MIPS_CALL ("jal", operands, 0, 1); }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "indirect,direct")
+   (set_attr "jal_macro" "no")])
 
 ;; A pattern for calls that must be made directly.  It is used for
 ;; MIPS16 calls that the linker may need to redirect to a hard-float
@@ -6240,7 +6244,7 @@ (define_insn_and_split "call_internal_di
   gen_call_direct_split (operands[0], operands[1]));
   DONE;
 }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "direct")])
 
 (define_insn "call_direct_split"
   [(call (mem:SI (match_operand 0 "const_call_insn_operand"))
@@ -6250,7 +6254,8 @@ (define_insn "call_direct_split"
(clobber (reg:SI 28))]
   "TARGET_SPLIT_CALLS"
   { return MIPS_CALL ("jal", operands, 0, -1); }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "direct")
+   (set_attr "jal_macro" "no")])
 
 (define_expand "call_value"
   [(parallel [(set (match_operand 0 "")
@@ -6284,13 +6289,14 @@ (define_insn_and_split "call_value_inter
 
 (define_insn "call_value_split"
   [(set (match_operand 0 "register_operand" "")
-(call (mem:SI (match_operand 1 "call_insn_operand" "cS"))
+(call (mem:SI (match_operand 1 "call_insn_operand" "c,S"))
   (match_operand 2 "" "")))
(clobber (reg:SI RETURN_ADDR_REGNUM))
(clobber (reg:SI 28))]
   "TARGET_SPLIT_CALLS"
   { return MIPS_CALL ("jal", operands, 1, 2); }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "indirect,direct")
+   (set_attr "jal_macro" "no")])
 
 ;; See call_internal_direct.
 (define_insn_and_split "call_value_internal_direct"
@@ -6309,7 +6315,7 @@ (define_insn_and_split "call_value_inter
operands[2]));
   DONE;
 }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "direct")])
 
 (define_insn "call_value_direct_split"
   [(set (match_operand 0 "register_operand")
@@ -6320,7 +6326,8 @@ (define_insn "call_value_direct_split"
(clobber (reg:SI 28))]
   "TARGET_SPLIT_CALLS"
   { return MIPS_CALL ("jal", operands, 1, -1); }
-  [(set_attr "type" "call")])
+  [(set_attr "jal" "direct")
+   (set_attr "jal_macro" "no")])
 
 ;; See comment for call_internal.
 (define_insn_and_split "call_value_multiple_internal"
@@ -6345,7 +6352,7 @@ (define_insn_and_split "call_value_multi
 
 (define_insn "call_value_multiple_split"
   [(set (match_operand 0 "register_operand" "")
-(call (mem:SI (match_operand 1 "call_insn_operand" "cS"))
+(call (mem:SI (match_operand 1 "call_insn_operand" "c,S"))
   (match_operand 2 "" "")))
(set (match_operand 3 "register_operand" "")
(call (mem:SI (match_dup 1))
@@ -6354,7 +6361,8 @@ (define_insn "call_

Documenting the MIPS changes in 4.7

2012-02-05 Thread Richard Sandiford
I've committed this patch to describe the MIPS changes in GCC 4.7.
Corrections, comments, and help with wordsmithing are all welcome.

Thanks,
Richard


Index: htdocs/gcc-4.7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.74
diff -u -p -r1.74 changes.html
--- htdocs/gcc-4.7/changes.html 16 Jan 2012 08:39:01 -  1.74
+++ htdocs/gcc-4.7/changes.html 5 Feb 2012 15:10:10 -
@@ -51,6 +51,9 @@
 Support has been removed for the NetWare x86 configuration
 obsoleted in GCC 4.6.
 
+It is no longer possible to use the "l"
+constraint in MIPS16 asm statements.
+
 More information on porting to GCC 4.7 from previous versions
 of GCC can be found in
 the http://gcc.gnu.org/gcc-4.7/porting_to.html";>porting
@@ -571,9 +574,29 @@ well.
 ...
   
 
-
+  
+GCC now supports thread-local storage (TLS) for MIPS16.
+This support requires GNU binutils 2.22 or later.
+
+GCC can now generate code specifically for the Cavium Octeon+
+and Octeon2 processors.  The associated command-line options are
+-march=octeon+ and -march=octeon2
+respectively.  Both options require GNU binutils 2.22 or later.
+
+GCC can now work around certain 24k errata, under the control
+of the command-line option -mfix-24k.
+These workarounds require GNU binutils 2.20 or later.
+
+32-bit MIPS GNU/Linux targets such as mips-linux-gnu
+can now build n32 and n64 multilibs.  The result is effectively
+a 64-bit GNU/Linux toolchain that generates 32-bit code by default.
+Use the configure-time option --enable-targets=all
+to select these extra multilibs.
+
+Passing -fno-delayed-branch now also stops the
+assembler from automatically filling delay slots.
+  
 
 

[PATCH 4.8, i386]: Enable post-reload compare optimization pass (PR28685)

2012-02-05 Thread Uros Bizjak
Hello!

Attached patch enables post-reload compare optimization pass for x86 targets.

As shown in following test, patch removes redundant compare:

--cut here--
int test(int a, int b)
{
  int lt = a < b;
  int eq = a == b;
  if (lt)
return 1;
  return eq;
}
--cut here--

gcc -O2 on x86_64, a cmove target:

test:
xorl%edx, %edx
cmpl%esi, %edi
movl$1, %eax
sete%dl
cmovge  %edx, %eax
ret

gcc-O2 -fno-compare-elim:

test:
xorl%edx, %edx
cmpl%esi, %edi
movl$1, %eax
sete%dl
cmpl%esi, %edi
cmovge  %edx, %eax
ret

2012-02-05  Uros Bizjak  

PR target/28685
* config/i386/i386.c (TARGET_FLAGS_REGNUM): New.

testsuite/ChangeLog:

PR target/28685
* gcc.target/i386/pr28685.c: New test.

The patch was tested on x86_64-pc-linux-gnu {,-m32}. The patch will be
committed to 4.8 once stage 1 opens.

Uros.
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 183904)
+++ config/i386/i386.c  (working copy)
@@ -38685,6 +38685,9 @@
 #undef TARGET_EXPAND_TO_RTL_HOOK
 #define TARGET_EXPAND_TO_RTL_HOOK ix86_maybe_switch_abi
 
+#undef TARGET_FLAGS_REGNUM
+#define TARGET_FLAGS_REGNUM FLAGS_REG
+
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P ix86_legitimate_address_p
 
Index: testsuite/gcc.target/i386/pr28685.c
===
--- testsuite/gcc.target/i386/pr28685.c (revision 0)
+++ testsuite/gcc.target/i386/pr28685.c (revision 0)
@@ -0,0 +1,12 @@
+/* { dg-options "-O2" } */
+
+int test(int a, int b)
+{
+  int lt = a < b;
+  int eq = a == b;
+  if (lt)
+return 1;
+  return eq;
+}
+
+/* { dg-final { scan-assembler-times "cmp" 1 } } */


[wwwdocs] Add missing Steering Committee member

2012-02-05 Thread Gerald Pfeifer
It has been brought to my attention that we have been missing
a prominent member of the Steering Committee on our web page.

Fixed thusly.

Gerald

Index: steering.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/steering.html,v
retrieving revision 1.32
diff -u -3 -p -r1.32 steering.html
--- steering.html   20 Nov 2011 11:57:38 -  1.32
+++ steering.html   5 Feb 2012 17:09:29 -
@@ -40,6 +40,12 @@ place to reach them is the gcc 

Re: [wwwdocs] Add missing Steering Committee member

2012-02-05 Thread Paolo Carlini

On 02/05/2012 06:15 PM, Gerald Pfeifer wrote:

It has been brought to my attention that we have been missing
a prominent member of the Steering Committee on our web page.

Fixed thusly.

Gerald

Index: steering.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/steering.html,v
retrieving revision 1.32
diff -u -3 -p -r1.32 steering.html
--- steering.html   20 Nov 2011 11:57:38 -  1.32
+++ steering.html   5 Feb 2012 17:09:29 -
@@ -40,6 +40,12 @@ place to reach them is the gcc
s/Stallmann/Stallman

Paolo.


Re: [PATCH 4.8, i386]: Enable post-reload compare optimization pass (PR28685)

2012-02-05 Thread Steven Bosscher
On Sun, Feb 5, 2012 at 4:27 PM, Uros Bizjak  wrote:
> 2012-02-05  Uros Bizjak  
>
>        PR target/28685
>        * config/i386/i386.c (TARGET_FLAGS_REGNUM): New.
>

Hmm, how is this (apparently new in 2011) TARGET_FLAGS_REGNUM
different from the older targetm.fixed_condition_code_regs?

Ciao!
Steven


Re: [wwwdocs] Add missing Steering Committee member

2012-02-05 Thread Gerald Pfeifer
On Sun, 5 Feb 2012, Paolo Carlini wrote:
>> +Richard Stallmann (Free Software Foundation)
> s/Stallmann/Stallman

Oops, of course!  Too much German recently. :-o  

Thanks, Paolo.  Fixed right away.

Gerald



Re: [PATCH 4.8, i386]: Enable post-reload compare optimization pass (PR28685)

2012-02-05 Thread Uros Bizjak
On Sun, Feb 5, 2012 at 6:27 PM, Steven Bosscher  wrote:

>>        PR target/28685
>>        * config/i386/i386.c (TARGET_FLAGS_REGNUM): New.
>>
>
> Hmm, how is this (apparently new in 2011) TARGET_FLAGS_REGNUM
> different from the older targetm.fixed_condition_code_regs?

This is how backend enables the pass, please see
gate_compare_elim_after_reload function in gcc/compare-elim.c.

FWIW, the value could be anything != INVALID_REGNUM.

Uros.


Re: [patch, fortran] Fix PR 48847, bogus "unused parameter" warning

2012-02-05 Thread Steve Kargl
On Sun, Feb 05, 2012 at 11:12:01AM +0100, Thomas Koenig wrote:
> Hello world,
> 
> the attached, rather obvious patch fixed a bogus "unused parameter"
> warning with procedure dummy arguments and warns about these if
> they occur.
> 
> Regression-tested.  OK for trunk?  Or rather wait until 4.8?
> 

You need a space after TREE_NO_WARNING.  I think that the
patch can be applied now given its simplicity. 

-- 
Steve


[v3] libstdc++/51956 improve pretty printers for shared_ptr and weak_ptr

2012-02-05 Thread Jonathan Wakely
PR libstdc++/51956
* python/libstdcxx/v6/printers.py (StdPointerPrinter): Rename to...
(SharedPointerPrinter): This. Also show weak count.
* testsuite/libstdc++-prettyprinters/shared_ptr.cc: New.

tested x86_64-linux, committed to trunk.
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py 
b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 4f34733..f47da61 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -45,19 +45,24 @@ def find_type(orig, name):
 raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
 typ = field.type
 
-class StdPointerPrinter:
-"Print a smart pointer of some kind"
+class SharedPointerPrinter:
+"Print a shared_ptr or weak_ptr"
 
 def __init__ (self, typename, val):
 self.typename = typename
 self.val = val
 
 def to_string (self):
-if self.val['_M_refcount']['_M_pi'] == 0:
-return '%s (empty) %s' % (self.typename, self.val['_M_ptr'])
-return '%s (count %d) %s' % (self.typename,
- 
self.val['_M_refcount']['_M_pi']['_M_use_count'],
- self.val['_M_ptr'])
+state = 'empty'
+refcounts = self.val['_M_refcount']['_M_pi']
+if refcounts != 0:
+usecount = refcounts['_M_use_count']
+weakcount = refcounts['_M_weak_count']
+if usecount == 0:
+state = 'expired, weak %d' % weakcount
+else:
+state = 'count %d, weak %d' % (usecount, weakcount - 1)
+return '%s (%s) %s' % (self.typename, state, self.val['_M_ptr'])
 
 class UniquePointerPrinter:
 "Print a unique_ptr"
@@ -862,8 +867,8 @@ def build_libstdcxx_dictionary ():
 
 # These are the TR1 and C++0x printers.
 # For array - the default GDB pretty-printer seems reasonable.
-libstdcxx_printer.add_version('std::', 'shared_ptr', StdPointerPrinter)
-libstdcxx_printer.add_version('std::', 'weak_ptr', StdPointerPrinter)
+libstdcxx_printer.add_version('std::', 'shared_ptr', SharedPointerPrinter)
+libstdcxx_printer.add_version('std::', 'weak_ptr', SharedPointerPrinter)
 libstdcxx_printer.add_container('std::', 'unordered_map',
 Tr1UnorderedMapPrinter)
 libstdcxx_printer.add_container('std::', 'unordered_set',
@@ -875,8 +880,8 @@ def build_libstdcxx_dictionary ():
 libstdcxx_printer.add_container('std::', 'forward_list',
 StdForwardListPrinter)
 
-libstdcxx_printer.add_version('std::tr1::', 'shared_ptr', 
StdPointerPrinter)
-libstdcxx_printer.add_version('std::tr1::', 'weak_ptr', StdPointerPrinter)
+libstdcxx_printer.add_version('std::tr1::', 'shared_ptr', 
SharedPointerPrinter)
+libstdcxx_printer.add_version('std::tr1::', 'weak_ptr', 
SharedPointerPrinter)
 libstdcxx_printer.add_version('std::tr1::', 'unordered_map',
   Tr1UnorderedMapPrinter)
 libstdcxx_printer.add_version('std::tr1::', 'unordered_set',
diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc 
b/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc
new file mode 100644
index 000..9328c5f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc
@@ -0,0 +1,83 @@
+// { dg-do run }
+// { dg-options "-std=gnu++11 -g" }
+
+// Copyright (C) 2012 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
+// .
+
+#include 
+#include 
+
+template
+void
+placeholder(const T &s)
+{
+  std::cout << s;
+}
+
+template
+void
+use(const T &p)
+{
+  placeholder(&p);
+}
+
+struct deleter { void operator()(int*) {} };
+
+std::shared_ptr make(uintptr_t p)
+{
+  return std::shared_ptr(reinterpret_cast(p), deleter());
+}
+
+int
+main()
+{
+  typedef std::shared_ptr shared;
+  typedef std::weak_ptr weak;
+
+  shared esp;
+// { dg-final { note-test esp "std::shared_ptr (empty) 0x0" } }
+  weak ewp1;
+// { dg-final { note-test ewp1 "std::weak_ptr (empty) 0x0" } }
+  weak ewp2 = esp;
+// { dg-final { note-test ewp2 "std::weak_ptr (empty) 0x0" } }
+
+  shared sp1 = make(0x12345678);
+  shared sp2 = sp1;
+// { dg-final { note-test sp1 "std::shared_ptr (count 2,

Re: Documenting the MIPS changes in 4.7

2012-02-05 Thread Andrew Pinski
On Sun, Feb 5, 2012 at 7:13 AM, Richard Sandiford
 wrote:
> I've committed this patch to describe the MIPS changes in GCC 4.7.
> Corrections, comments, and help with wordsmithing are all welcome.
>
> Thanks,
> Richard
>
>
> Index: htdocs/gcc-4.7/changes.html
> ===
> RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
> retrieving revision 1.74
> diff -u -p -r1.74 changes.html
> --- htdocs/gcc-4.7/changes.html 16 Jan 2012 08:39:01 -      1.74
> +++ htdocs/gcc-4.7/changes.html 5 Feb 2012 15:10:10 -
> @@ -51,6 +51,9 @@
>     Support has been removed for the NetWare x86 configuration
>     obsoleted in GCC 4.6.
>
> +    It is no longer possible to use the "l"
> +    constraint in MIPS16 asm statements.
> +
>     More information on porting to GCC 4.7 from previous versions
>     of GCC can be found in
>     the http://gcc.gnu.org/gcc-4.7/porting_to.html";>porting
> @@ -571,9 +574,29 @@ well.
>     ...
>   
>
> -
> +  
> +    GCC now supports thread-local storage (TLS) for MIPS16.
> +        This support requires GNU binutils 2.22 or later.
> +
> +    GCC can now generate code specifically for the Cavium Octeon+
> +        and Octeon2 processors.  The associated command-line options are
> +        -march=octeon+ and -march=octeon2
> +        respectively.  Both options require GNU binutils 2.22 or later.

This part looks good from my point of view.

Thanks,
Anrew Pinski


> +
> +    GCC can now work around certain 24k errata, under the control
> +        of the command-line option -mfix-24k.
> +        These workarounds require GNU binutils 2.20 or later.
> +
> +    32-bit MIPS GNU/Linux targets such as mips-linux-gnu
> +        can now build n32 and n64 multilibs.  The result is effectively
> +        a 64-bit GNU/Linux toolchain that generates 32-bit code by default.
> +        Use the configure-time option --enable-targets=all
> +        to select these extra multilibs.
> +
> +    Passing -fno-delayed-branch now also stops the
> +        assembler from automatically filling delay slots.
> +  
>
>  

Re: [Patch, fortran] PR52102 - [OOP] Wrong result with ALLOCATE of CLASS components with array constructor SOURCE-expr

2012-02-05 Thread Paul Richard Thomas
Committed as revision 183915 after green light from Tobias on #gfortran.

2012-02-05  Paul Thomas  

* trans-array.c (gfc_array_allocate): Zero memory for all class
array allocations.
* trans-stmt.c (gfc_trans_allocate): Ditto for class scalars.

PR fortran/52102
* trans-stmt.c (gfc_trans_allocate): Before correcting a class
array reference, ensure that 'dataref' points to the _data
component that is followed by the array reference..

2012-02-05  Paul Thomas  

PR fortran/52102
* gfortran.dg/class_48.f90 : Add test of allocate class array
component with source in subroutine test3.  Remove commenting
out in subroutine test4, since branching on unitialized variable
is now fixed (no PR for this last.).

Paul


Re: [patch, fortran] Fix PR 48847, bogus "unused parameter" warning

2012-02-05 Thread Thomas Koenig

Hi Steve,


You need a space after TREE_NO_WARNING.  I think that the
patch can be applied now given its simplicity.



Committed as rev. 183916 with the space.

Thanks a lot for the review!

Thomas


Gthreads patch to disable static initializer macros

2012-02-05 Thread Jonathan Wakely
PRs libstdc++/51296 and libstdc++/51906 are both caused by problems
with the Pthreads static initializer macros such as
PTHREAD_MUTEX_INITIALIZER.

On Tru64 PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER can
only be used for statically-initialized variables, as allowed by POSIX
currently, but http://austingroupbugs.net/view.php?id=70#c127 removes
that limitation for the next POSIX standard. C++11 needs to use those
macros for variables with automatic and dynamic scope, because the
init functions can't be used in constexpr constructors.

On Mac OS X 10.7 the PTHREAD_RECURSIVE_MUTEX_INITIALIZER is buggy.
This has shown up now because C++11 threads weren't enabled on darwin
before 4.7

My suggestion is to modify gthr-posix.h with the attached patch, so
that target maintainers can define e.g.
_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC to force use of the init
function instead of the __GTHREAD_RECURSIVE_MUTEX_INIT initializer.
The patch includes a change to do that for darwin.

This has been testing on darwin, if Rainer tests it successfully on
Tru64 will the gthr-posix.h change be acceptable?
diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h
index 46054f6..45b15a8 100644
--- a/libgcc/gthr-posix.h
+++ b/libgcc/gthr-posix.h
@@ -74,6 +74,20 @@ typedef struct timespec __gthread_time_t;
 #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
 #define __GTHREAD_TIME_INIT {0,0}
 
+#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
+# undef __GTHREAD_MUTEX_INIT
+# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
+#endif
+#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
+# undef __GTHREAD_RECURSIVE_MUTEX_INIT
+# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
+# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION 
__gthread_recursive_mutex_init_function
+#endif
+#ifdef _GTHREAD_USE_COND_INIT_FUNC
+# undef __GTHREAD_COND_INIT
+# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
+#endif
+
 #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
 # ifndef __gthrw_pragma
 #  define __gthrw_pragma(pragma)
@@ -730,6 +744,15 @@ __gthread_setspecific (__gthread_key_t __key, const void 
*__ptr)
   return __gthrw_(pthread_setspecific) (__key, __ptr);
 }
 
+#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
+static inline void
+__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+__gthrw_(pthread_mutex_init) (__mutex, NULL);
+}
+#endif
+
 static inline int
 __gthread_mutex_destroy (__gthread_mutex_t *__mutex)
 {
@@ -778,7 +801,8 @@ __gthread_mutex_unlock (__gthread_mutex_t *__mutex)
 return 0;
 }
 
-#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
+  || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
 static inline int
 __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
 {
@@ -828,6 +852,15 @@ __gthread_recursive_mutex_unlock 
(__gthread_recursive_mutex_t *__mutex)
   return __gthread_mutex_unlock (__mutex);
 }
 
+#ifdef _GTHREAD_USE_COND_INIT_FUNC
+static inline void
+__gthread_cond_init_function (__gthread_cond_t *__cond)
+{
+  if (__gthread_active_p ())
+__gthrw_(pthread_cond_init) (__cond, NULL);
+}
+#endif
+
 static inline int
 __gthread_cond_broadcast (__gthread_cond_t *__cond)
 {
diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h 
b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
index ccefeaf..421478d 100644
--- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h
+++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
@@ -39,4 +39,7 @@
 // -flat_namespace to work around the way that it doesn't.
 #define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak))
 
+// Static initializer macro is buggy in darwin, see libstdc++/51906
+#define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
+
 #endif


Re: [wwwdocs] Add missing Steering Committee member

2012-02-05 Thread Joseph S. Myers
On Sun, 5 Feb 2012, Gerald Pfeifer wrote:

> It has been brought to my attention that we have been missing
> a prominent member of the Steering Committee on our web page.

Should the list distinguish which members are or are not GNU maintainers 
of GCC?  fencepost:/gd/gnuorg/maintainers lists only the other twelve 
people as maintainers for GCC.

-- 
Joseph S. Myers
jos...@codesourcery.com


Added test case for PR 32373, missed vectorization with equivalence

2012-02-05 Thread Thomas Koenig

Hello world,

I added the attached test case from the PR after verifying that all
loops mentioned in the PR are now vectorized.  The PR is now closed.

2012-02-05  Thomas König  

PR fortran/32373
* gfortran.dg/vect/vect-8.f90:  New test case.
! PR fortran/32373 - eight of these loops were not vectorized.
! { dg-do compile }
! { dg-require-effective-target vect_float }

module lfk_prec
 integer, parameter :: dp=kind(1.d0)
end module lfk_prec

!***

SUBROUTINE kernel(tk)
!***
!  *
!KERNEL executes 24 samples of Fortran computation *
!   TK(1) - total cpu time to execute only the 24 kernels. *
!   TK(2) - total Flops executed by the 24 Kernels *
!***
!  *
! L. L. N. L.   F O R T R A N   K E R N E L S:   M F L O P S   *
!  *
!   These kernels measure  Fortran  numerical  computation rates for a *
!   spectrum of  CPU-limited  computational  structures.  Mathematical *
!   through-put is measured  in  units  of  millions of floating-point *
!   operations executed per Second, called Mega-Flops/Sec. *
!  *
!   This program  measures  a realistic  CPU performance range for the *
!   Fortran programming system  on  a  given day.  The CPU performance *
!   rates depend  strongly  on  the maturity of the Fortran compiler's *
!   ability to translate Fortran code into efficient machine code. *
!   [ The CPU hardware  capability  apart  from  compiler maturity (or *
!   availability), could be measured (or simulated) by programming the *
!   kernels in assembly  or machine code directly.  These measurements *
!   can also  serve  as a framework for tracking the maturation of the *
!   Fortran compiler during system development.]   *
!  *
! Fonzi's Law: There is not now and there never will be a language *
!  in which it is the least bit difficult to write *
!  bad programs.   *
!F.H.MCMAHON  1972 *
!***

! l1 :=  param-dimension governs the size of most 1-d arrays
! l2 :=  param-dimension governs the size of most 2-d arrays

! Loop :=  multiple pass control to execute kernel long enough to ti
!me.
! n  :=  DO loop control for each kernel.  Controls are set in subr.
! SIZES

! **
use lfk_prec
implicit double precision  (a-h,o-z)
!IBM  IMPLICIT  REAL*8   (A-H,O-Z)

REAL(kind=dp), INTENT(inout):: tk
INTEGER :: test !!,AND

COMMON/alpha/mk,ik,im,ml,il,mruns,nruns,jr,iovec,npfs(8,3,47)
COMMON/beta/tic,times(8,3,47),see(5,3,8,3),terrs(8,3,47),csums(8,3  &
,47),fopn(8,3,47),dos(8,3,47)

COMMON/spaces/ion,j5,k2,k3,loop1,laps,loop,m,kr,lp,n13h,ibuf,nx,l,  &
npass,nfail,n,n1,n2,n13,n213,n813,n14,n16,n416,n21,nt1,nt2,last,idebug  &
,mpy,loop2,mucho,mpylim,intbuf(16)

COMMON/spacer/a11,a12,a13,a21,a22,a23,a31,a32,a33,ar,br,c0,cr,di,dk  &
,dm22,dm23,dm24,dm25,dm26,dm27,dm28,dn,e3,e6,expmax,flx,q,qa,r,ri  &
,s,scale,sig,stb5,t,xnc,xnei,xnm

COMMON/space0/time(47),csum(47),ww(47),wt(47),ticks,fr(9),terr1(47  &
),sumw(7),start,skale(47),bias(47),ws(95),total(47),flopn(47),iq(7  &
),npf,npfs1(47)

COMMON/spacei/wtp(3),mul(3),ispan(47,3),ipass(47,3)

! **


INTEGER :: e,f,zone
COMMON/ispace/e(96),f(96),ix(1001),ir(1001),zone(300)

COMMON/space1/u(1001),v(1001),w(1001),x(1001),y(1001),z(1001),g(1001)  &
,du1(101),du2(101),du3(101),grd(1001),dex(1001),xi(1001),ex(1001)  &
,ex1(1001),dex1(1001),vx(1001),xx(1001),rx(1001),rh(2048),vsp(101)  &
,vstp(101),vxne(101),vxnd(101),ve3(101),vlr(101),vlin(101),b5(101)  &
,plan(300),d(300),sa(101),sb(101)

COMMON/space2/p(4,512),px(25,101),cx(25,101),vy(101,25),vh(101,7),  &
vf(101,7),vg(101,7),vs(101,7),za(101,7),zp(101,7),zq(101,7),zr(101  &
,7),zm(101,7),zb(101,7),zu(101,7),zv(101,7),zz(101,7),b(64,64),c(64,64)  &
,h(64,64),u1(5,101,2),u2(5,101,2),u3(5,101,2)

! **

dimension zx(1023),xz(447,3),tk(6),mtmp(1)
EQUIVALENCE(zx(1),z(1)),(xz(1,1),x(1))
double precision temp
logical ltmp


! **

! STANDARD PRO

New German PO file for 'gcc' (version 4.7-b20120128)

2012-02-05 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the German team of translators.  The file is available at:

http://translationproject.org/latest/gcc/de.po

(This file, 'gcc-4.7-b20120128.de.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: Gthreads patch to disable static initializer macros

2012-02-05 Thread Jack Howarth
On Sun, Feb 05, 2012 at 08:26:22PM +, Jonathan Wakely wrote:
> PRs libstdc++/51296 and libstdc++/51906 are both caused by problems
> with the Pthreads static initializer macros such as
> PTHREAD_MUTEX_INITIALIZER.
> 
> On Tru64 PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER can
> only be used for statically-initialized variables, as allowed by POSIX
> currently, but http://austingroupbugs.net/view.php?id=70#c127 removes
> that limitation for the next POSIX standard. C++11 needs to use those
> macros for variables with automatic and dynamic scope, because the
> init functions can't be used in constexpr constructors.
> 
> On Mac OS X 10.7 the PTHREAD_RECURSIVE_MUTEX_INITIALIZER is buggy.
> This has shown up now because C++11 threads weren't enabled on darwin
> before 4.7
> 
> My suggestion is to modify gthr-posix.h with the attached patch, so
> that target maintainers can define e.g.
> _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC to force use of the init
> function instead of the __GTHREAD_RECURSIVE_MUTEX_INIT initializer.
> The patch includes a change to do that for darwin.
> 
> This has been testing on darwin, if Rainer tests it successfully on
> Tru64 will the gthr-posix.h change be acceptable?

There are no unexpected libstdc++ testsuite regressions on 
x86_64-apple-darwin11 with this
patch applied to current gcc trunk.


> diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h
> index 46054f6..45b15a8 100644
> --- a/libgcc/gthr-posix.h
> +++ b/libgcc/gthr-posix.h
> @@ -74,6 +74,20 @@ typedef struct timespec __gthread_time_t;
>  #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
>  #define __GTHREAD_TIME_INIT {0,0}
>  
> +#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
> +# undef __GTHREAD_MUTEX_INIT
> +# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
> +#endif
> +#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
> +# undef __GTHREAD_RECURSIVE_MUTEX_INIT
> +# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
> +# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION 
> __gthread_recursive_mutex_init_function
> +#endif
> +#ifdef _GTHREAD_USE_COND_INIT_FUNC
> +# undef __GTHREAD_COND_INIT
> +# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
> +#endif
> +
>  #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
>  # ifndef __gthrw_pragma
>  #  define __gthrw_pragma(pragma)
> @@ -730,6 +744,15 @@ __gthread_setspecific (__gthread_key_t __key, const void 
> *__ptr)
>return __gthrw_(pthread_setspecific) (__key, __ptr);
>  }
>  
> +#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
> +static inline void
> +__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
> +{
> +  if (__gthread_active_p ())
> +__gthrw_(pthread_mutex_init) (__mutex, NULL);
> +}
> +#endif
> +
>  static inline int
>  __gthread_mutex_destroy (__gthread_mutex_t *__mutex)
>  {
> @@ -778,7 +801,8 @@ __gthread_mutex_unlock (__gthread_mutex_t *__mutex)
>  return 0;
>  }
>  
> -#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
> +#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
> +  || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
>  static inline int
>  __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t 
> *__mutex)
>  {
> @@ -828,6 +852,15 @@ __gthread_recursive_mutex_unlock 
> (__gthread_recursive_mutex_t *__mutex)
>return __gthread_mutex_unlock (__mutex);
>  }
>  
> +#ifdef _GTHREAD_USE_COND_INIT_FUNC
> +static inline void
> +__gthread_cond_init_function (__gthread_cond_t *__cond)
> +{
> +  if (__gthread_active_p ())
> +__gthrw_(pthread_cond_init) (__cond, NULL);
> +}
> +#endif
> +
>  static inline int
>  __gthread_cond_broadcast (__gthread_cond_t *__cond)
>  {
> diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h 
> b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
> index ccefeaf..421478d 100644
> --- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h
> +++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
> @@ -39,4 +39,7 @@
>  // -flat_namespace to work around the way that it doesn't.
>  #define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak))
>  
> +// Static initializer macro is buggy in darwin, see libstdc++/51906
> +#define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
> +
>  #endif



Re: Gthreads patch to disable static initializer macros

2012-02-05 Thread Jonathan Wakely
On 5 February 2012 23:53, Jack Howarth wrote:
>
> There are no unexpected libstdc++ testsuite regressions on 
> x86_64-apple-darwin11 with this
> patch applied to current gcc trunk.

Thanks, Jack.  If I can't get approval for the change I'll workaround
it in libstdc++, but IMHO it would be cleaner to change gthr-posix.h
to not define macros that can't be used safely.


libstdc++/52104 - fix linker error for non-TLS targets

2012-02-05 Thread Jonathan Wakely
The out-of-line destructor in future.cc uses std::call_once which uses
a lambda on TLS targets. Because we compile with
-fno-implicit-templates an explicit instantiation is needed, but can't
be done because the closure type created by the lambda can't be named.
 This puts the destructor inline in the header for TLS targets.  A
better fix would be to avoid using a lambda in std::call_once, but I
don't want to touch that code instage4.

PR libstdc++/52104
* include/std/future (__future_base::_Async_state_common): Define
destructor inline for targets without TLS.
* src/c++11/future.cc (__future_base::_Async_state_common): Only
define destructor for TLS targets.

Tested x86_64-linux by me and on sparc-solaris by Eric Botcazou.
Committed to trunk.
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index 1093e3f..962400b 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -1425,7 +1425,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class __future_base::_Async_state_common : public __future_base::_State_base
   {
   protected:
+#ifdef _GLIBCXX_HAVE_TLS
 ~_Async_state_common();
+#else
+~_Async_state_common() { _M_join(); }
+#endif
 
 // Allow non-timed waiting functions to block until the thread completes,
 // as if joined.
diff --git a/libstdc++-v3/src/c++11/future.cc b/libstdc++-v3/src/c++11/future.cc
index dab0774..61a9729 100644
--- a/libstdc++-v3/src/c++11/future.cc
+++ b/libstdc++-v3/src/c++11/future.cc
@@ -85,11 +85,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   __future_base::_State_base::~_State_base() = default;
 
+#ifdef _GLIBCXX_HAVE_TLS
   __future_base::_Async_state_common::~_Async_state_common() { _M_join(); }
 
   // Explicit instantiation due to -fno-implicit-instantiation.
   template void call_once(once_flag&, void (thread::*&&)(), 
reference_wrapper&&);
 #endif
+#endif
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std


[patch] document which edition of Effective C++ is used for -Weffc++

2012-02-05 Thread Jonathan Wakely
PR c++/48680
* doc/invoke.texi (C++ Dialect Options): Use @option markup for
-Weffc++ and specify guidelines come from second edition.

Tested with 'make doc html'
OK for trunk?
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6105710..6c61e53 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2437,7 +2437,7 @@ the compiler to never throw an exception.
 Warn when a class has virtual functions and accessible non-virtual
 destructor, in which case it would be possible but unsafe to delete
 an instance of a derived class through a pointer to the base class.
-This warning is also enabled if -Weffc++ is specified.
+This warning is also enabled if @option{-Weffc++} is specified.
 
 @item -Wreorder @r{(C++ and Objective-C++ only)}
 @opindex Wreorder
@@ -2467,7 +2467,7 @@ The following @option{-W@dots{}} options are not affected 
by @option{-Wall}.
 @opindex Weffc++
 @opindex Wno-effc++
 Warn about violations of the following style guidelines from Scott Meyers'
-@cite{Effective C++} book:
+@cite{Effective C++, Second Edition} book:
 
 @itemize @bullet
 @item


Re: [patch] document which edition of Effective C++ is used for -Weffc++

2012-02-05 Thread Gerald Pfeifer
On Mon, 6 Feb 2012, Jonathan Wakely wrote:
> PR c++/48680
> * doc/invoke.texi (C++ Dialect Options): Use @option markup for
> -Weffc++ and specify guidelines come from second edition.
> 
> Tested with 'make doc html'
> OK for trunk?

Yes.  The first is a bug fix, the second obvious (for those in
the know, before your patch :-).

Gerald


Re: [patch] document which edition of Effective C++ is used for -Weffc++

2012-02-05 Thread Jonathan Wakely
On 6 February 2012 01:04, Gerald Pfeifer wrote:
> On Mon, 6 Feb 2012, Jonathan Wakely wrote:
>>         PR c++/48680
>>         * doc/invoke.texi (C++ Dialect Options): Use @option markup for
>>         -Weffc++ and specify guidelines come from second edition.
>>
>> Tested with 'make doc html'
>> OK for trunk?
>
> Yes.  The first is a bug fix, the second obvious (for those in
> the know, before your patch :-).

Thanks, I've checked it in.


Re: [Patch] PR 52118 (Description of Wunused-local-typedefs)

2012-02-05 Thread Jason Merrill

OK.

Jason


Re: Gthreads patch to disable static initializer macros

2012-02-05 Thread Jakub Jelinek
On Sun, Feb 05, 2012 at 08:26:22PM +, Jonathan Wakely wrote:
> This has been testing on darwin, if Rainer tests it successfully on
> Tru64 will the gthr-posix.h change be acceptable?

Ok with a suitable ChangeLog entry.

> diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h
> index 46054f6..45b15a8 100644
> --- a/libgcc/gthr-posix.h
> +++ b/libgcc/gthr-posix.h
> @@ -74,6 +74,20 @@ typedef struct timespec __gthread_time_t;
>  #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
>  #define __GTHREAD_TIME_INIT {0,0}
>  
> +#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
> +# undef __GTHREAD_MUTEX_INIT
> +# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
> +#endif
> +#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
> +# undef __GTHREAD_RECURSIVE_MUTEX_INIT
> +# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
> +# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION 
> __gthread_recursive_mutex_init_function
> +#endif
> +#ifdef _GTHREAD_USE_COND_INIT_FUNC
> +# undef __GTHREAD_COND_INIT
> +# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
> +#endif
> +
>  #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
>  # ifndef __gthrw_pragma
>  #  define __gthrw_pragma(pragma)
> @@ -730,6 +744,15 @@ __gthread_setspecific (__gthread_key_t __key, const void 
> *__ptr)
>return __gthrw_(pthread_setspecific) (__key, __ptr);
>  }
>  
> +#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
> +static inline void
> +__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
> +{
> +  if (__gthread_active_p ())
> +__gthrw_(pthread_mutex_init) (__mutex, NULL);
> +}
> +#endif
> +
>  static inline int
>  __gthread_mutex_destroy (__gthread_mutex_t *__mutex)
>  {
> @@ -778,7 +801,8 @@ __gthread_mutex_unlock (__gthread_mutex_t *__mutex)
>  return 0;
>  }
>  
> -#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
> +#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
> +  || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
>  static inline int
>  __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t 
> *__mutex)
>  {
> @@ -828,6 +852,15 @@ __gthread_recursive_mutex_unlock 
> (__gthread_recursive_mutex_t *__mutex)
>return __gthread_mutex_unlock (__mutex);
>  }
>  
> +#ifdef _GTHREAD_USE_COND_INIT_FUNC
> +static inline void
> +__gthread_cond_init_function (__gthread_cond_t *__cond)
> +{
> +  if (__gthread_active_p ())
> +__gthrw_(pthread_cond_init) (__cond, NULL);
> +}
> +#endif
> +
>  static inline int
>  __gthread_cond_broadcast (__gthread_cond_t *__cond)
>  {
> diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h 
> b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
> index ccefeaf..421478d 100644
> --- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h
> +++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
> @@ -39,4 +39,7 @@
>  // -flat_namespace to work around the way that it doesn't.
>  #define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak))
>  
> +// Static initializer macro is buggy in darwin, see libstdc++/51906
> +#define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
> +
>  #endif


Jakub