Re: [Patch, Fortran] PR55763 - reject "type is(INTEGER)" with non-class(*) selector in SELECT TYPE

2013-01-06 Thread Paul Richard Thomas
Dear Tobias,

This, as you say, is obvious.  OKfor trunk.

Thanks for the patch.

Paul

On 6 January 2013 16:32, Tobias Burnus  wrote:
> A rather obvious fix, though one can think about the error wording.
>
> Bootstrapped and regtested on x86-64-gnu-linux.
> OK for the trunk?
>
> Tobias



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
   --Hitchhikers Guide to the Galaxy


[PATCH] avoid undefined behavior in libiberty/cplus-dem.c

2013-01-06 Thread Nickolai Zeldovich
consume_count() in libiberty/cplus-dem.c relies on signed integer overflow 
(which is undefined behavior in C) to detect overflow when parsing a count 
value.  As a result, recent versions of gcc (e.g., 4.7.2) will remove that 
if check altogether as dead code, since it can only be true with UB.  The 
patch below replaces the overflow check with one that does not rely on UB.


Nickolai.

Index: libiberty/cplus-dem.c
===
--- libiberty/cplus-dem.c   (revision 194959)
+++ libiberty/cplus-dem.c   (working copy)
@@ -48,7 +48,18 @@
 #include 
 #include 
 #include 
+#ifdef HAVE_LIMITS_H
+#include 
+#endif

+#ifndef UINT_MAX
+#define UINT_MAX   ((unsigned int)(~0U))   /* 0x */
+#endif
+
+#ifndef INT_MAX
+#define INT_MAX((int)(UINT_MAX >> 1))/* 0x7FFF 
*/
+#endif
+
 #ifdef HAVE_STDLIB_H
 #include 
 #else
@@ -494,20 +505,15 @@

   while (ISDIGIT ((unsigned char)**type))
 {
-  count *= 10;
-
-  /* Check for overflow.
-We assume that count is represented using two's-complement;
-no power of two is divisible by ten, so if an overflow occurs
-when multiplying by ten, the result will not be a multiple of
-ten.  */
-  if ((count % 10) != 0)
+  /* Check whether we can add another digit without overflow. */
+  if (count > (INT_MAX - 9) / 10)
{
  while (ISDIGIT ((unsigned char) **type))
(*type)++;
  return -1;
}

+  count *= 10;
   count += **type - '0';
   (*type)++;
 }


[v3] fix PR 55728 and PR 55847

2013-01-06 Thread Jonathan Wakely
PR libstdc++/55847
* src/c++11/shared_ptr.cc (bad_weak_ptr::what()): Correct string.

PR libstdc++/55728
* include/std/functional (bad_function_call::what()): Declare.
* src/c++11/functional.cc (bad_function_call::what()): Define.
* config/abi/pre/gnu.ver (bad_function_call::what()): Export.
* testsuite/20_util/bad_function_call/what.cc: New.

Tested x86_64-linux, committed to trunk.
commit e23405d43828180dff54f54e40e131a769e2c842
Author: Jonathan Wakely 
Date:   Mon Jan 7 00:13:18 2013 +

PR libstdc++/55847
* src/c++11/shared_ptr.cc (bad_weak_ptr::what()): Correct string.
* testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Verify
string.

PR libstdc++/55728
* include/std/functional (bad_function_call::what()): Declare.
* src/c++11/functional.cc (bad_function_call::what()): Define.
* config/abi/pre/gnu.ver (bad_function_call::what()): Export.
* testsuite/20_util/bad_function_call/what.cc: New.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver 
b/libstdc++-v3/config/abi/pre/gnu.ver
index 8b1ec0d..35b4c44 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1342,6 +1342,9 @@ GLIBCXX_3.4.18 {
 # std::this_thread::__sleep_for
 _ZNSt11this_thread11__sleep_for*;
 
+# std::bad_function_call::what()
+_ZNKSt17bad_function_call4whatEv;
+
 } GLIBCXX_3.4.17;
 
 # Symbols in the support library (libsupc++) have their own tag.
diff --git a/libstdc++-v3/include/std/functional 
b/libstdc++-v3/include/std/functional
index 3ec2e1e..0b5d475 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1,6 +1,6 @@
 //  -*- C++ -*-
 
-// Copyright (C) 2001-2012 Free Software Foundation, Inc.
+// Copyright (C) 2001-2013 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
@@ -1767,6 +1767,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
   {
   public:
 virtual ~bad_function_call() noexcept;
+
+const char* what() const noexcept;
   };
 
   /**
diff --git a/libstdc++-v3/src/c++11/functional.cc 
b/libstdc++-v3/src/c++11/functional.cc
index 2ab3405..8d81f60 100644
--- a/libstdc++-v3/src/c++11/functional.cc
+++ b/libstdc++-v3/src/c++11/functional.cc
@@ -1,7 +1,6 @@
 // Support for  -*- C++ -*-
 
-// Copyright (C) 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2011-2013 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
@@ -29,7 +28,11 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-  bad_function_call::~bad_function_call() throw() = default;
+  bad_function_call::~bad_function_call() noexcept = default;
+
+  const char*
+  bad_function_call::what() const noexcept
+  { return "bad_function_call"; }
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc 
b/libstdc++-v3/src/c++11/shared_ptr.cc
index 911e745..ca5714a 100644
--- a/libstdc++-v3/src/c++11/shared_ptr.cc
+++ b/libstdc++-v3/src/c++11/shared_ptr.cc
@@ -1,7 +1,6 @@
 // Support for pointer abstractions -*- C++ -*-
 
-// Copyright (C) 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2011-2013 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
@@ -33,7 +32,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   char const*
   bad_weak_ptr::what() const noexcept
-  { return "std::bad_weak_ptr"; }
+  { return "bad_weak_ptr"; }
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
diff --git a/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc 
b/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc
new file mode 100644
index 000..4d9c8b4
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc
@@ -0,0 +1,33 @@
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2013 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 
+
+int main()
+{
+  try
+  {
+std::function{}();
+

PR tree-optimization/55823 (ipa-inline-transform ICE)

2013-01-06 Thread Jan Hubicka
Hi,
as discused in the PR log there seems to be ordering issue in
update_indirect_edges_after_inlining that first updates info in call edge to
correspond the situation after inlining and then it tries to devirtualize that
is trying to look up the info prior inlining.

Bootstrapped/regtested x86_64-linux
Martin, does it look sane?
Can you also, please, look into why ipa-cp is not handling both calls?

Honza

PR tree-optimization/55823 
* g++.dg/ipa/devirt-10.C: New testcase.

* ipa-prop.c (update_indirect_edges_after_inlining): Fix ordering issue.
Index: testsuite/g++.dg/ipa/devirt-10.C
===
*** testsuite/g++.dg/ipa/devirt-10.C(revision 0)
--- testsuite/g++.dg/ipa/devirt-10.C(revision 0)
***
*** 0 
--- 1,34 
+ /* { dg-do compile } */
+ /* { dg-options "-O3 -fdump-ipa-inline -fdump-ipa-cp"  } */
+ class wxPaintEvent {  };
+ struct wxDCBase
+ { 
+   wxDCBase ();
+   virtual int GetLayoutDirection() const{}
+   virtual void SetLayoutDirection(int){}
+ };
+ struct wxWindowDC  : public wxDCBase {};
+ struct wxBufferedDC  : public wxDCBase
+ { 
+   void Init(wxDCBase*dc) {
+ InitCommon(dc);
+   }
+   void InitCommon(wxDCBase*dc) {
+ if (dc)
+   SetLayoutDirection(dc->GetLayoutDirection());
+   }
+ };
+ struct wxBufferedPaintDC  : public wxBufferedDC {
+   wxBufferedPaintDC() {
+ Init(&m_paintdc);
+   }
+  wxWindowDC m_paintdc;
+ };
+ void  OnPaint(wxPaintEvent & event) {
+   wxBufferedPaintDC dc;
+ }
+ /* IPA-CP should really discover both cases, but for time being the second is 
handled by inliner.  */
+ /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known 
target" 1 "inline"  } } */
+ /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known 
target" 1 "cp"  } } */
+ /* { dg-final { cleanup-ipa-dump "inline" } } */
+ /* { dg-final { cleanup-ipa-dump "cp" } } */
Index: ipa-prop.c
===
*** ipa-prop.c  (revision 194918)
--- ipa-prop.c  (working copy)
*** update_indirect_edges_after_inlining (st
*** 2264,2303 
  
param_index = ici->param_index;
jfunc = ipa_get_ith_jump_func (top, param_index);
-   if (jfunc->type == IPA_JF_PASS_THROUGH
- && ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
-   {
- if (ici->agg_contents
- && !ipa_get_jf_pass_through_agg_preserved (jfunc))
-   ici->param_index = -1;
- else
-   ici->param_index = ipa_get_jf_pass_through_formal_id (jfunc);
-   }
-   else if (jfunc->type == IPA_JF_ANCESTOR)
-   {
- if (ici->agg_contents
- && !ipa_get_jf_ancestor_agg_preserved (jfunc))
-   ici->param_index = -1;
- else
-   {
- ici->param_index = ipa_get_jf_ancestor_formal_id (jfunc);
- ici->offset += ipa_get_jf_ancestor_offset (jfunc);
-   }
-   }
-   else
-   /* Either we can find a destination for this edge now or never. */
-   ici->param_index = -1;
  
if (!flag_indirect_inlining)
!   continue;
! 
!   if (ici->polymorphic)
new_direct_edge = try_make_edge_direct_virtual_call (ie, jfunc,
 new_root_info);
else
new_direct_edge = try_make_edge_direct_simple_call (ie, jfunc,
new_root_info);
- 
if (new_direct_edge)
{
  new_direct_edge->indirect_inlining_edge = 1;
--- 2264,2278 
  
param_index = ici->param_index;
jfunc = ipa_get_ith_jump_func (top, param_index);
  
if (!flag_indirect_inlining)
!   new_direct_edge = NULL;
!   else if (ici->polymorphic)
new_direct_edge = try_make_edge_direct_virtual_call (ie, jfunc,
 new_root_info);
else
new_direct_edge = try_make_edge_direct_simple_call (ie, jfunc,
new_root_info);
if (new_direct_edge)
{
  new_direct_edge->indirect_inlining_edge = 1;
*** update_indirect_edges_after_inlining (st
*** 2312,2317 
--- 2287,2315 
  res = true;
}
}
+   else if (jfunc->type == IPA_JF_PASS_THROUGH
+  && ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
+   {
+ if (ici->agg_contents
+ && !ipa_get_jf_pass_through_agg_preserved (jfunc))
+   ici->param_index = -1;
+ else
+   ici->param_index = ipa_get_jf_pass_through_formal_id (jfunc);
+   }
+   else if (jfunc->type == IPA_JF_ANCESTOR)
+   {
+ if (ici->agg_contents
+ && !ipa_get_jf_ancestor_agg_preserved (jfunc))
+   ici->param_index = -1;
+ else
+   {
+ 

Support for MIPS r5900

2013-01-06 Thread Jürgen Urban
Hello,

I created a patch from scratch to support MIPS r5900 used in the Playstation 2, 
but I have some problems with it.
The attached patch only works with the latest binutils from CVS. The binutils 
forces the compiler to use r5900 compatible instructions which is good to find 
errors in the GCC. Later I will try to submit a patch here, but first I need 
some help.
The MIPS r5900 supports 32 bit, 64 bit and 128 bit data accesses on a 32 Bit 
address bus. It supports instructions from MIPS ISA I, II, III, IV and has 
additional instructions, but none of them are complete. On each ISA level there 
are instructions missing.
It can run MIPS ABI o32, n32 and o64 code, as long as unsupported instructions 
are not used or emulated by the operating system and the addresses keep in the 
first 32 bit.
My patch adds support for r5900 and tries to disable the following unsupported 
instructions:
ll, sc, dmult, ddiv, cvt.w.s, 64 bit FPU instructions.
ll and sc is disabled with "-mno-llsc" and works.
cvt.w.s is replaced by trunc.w.s. This seems to work.
I disabled 64 bit FPU instructions by "-msoft-float". This works, but using 
"-msingle-float" fails. This would be the better configuration. There are still 
64 bit FPU instructions used (e.g. "dmfc1   $2,$f0" when using "long double" 
multiplication). So "-msingle-float" doesn't seem to work on generic 
mips64-linux-gnu.
I tried to disable dmult and ddiv (see mips.md). Disabling worked, but now 
muldi3 calls itself in libgcc2. I thought this should work, because I got this 
working with GCC 4.3, but the latest GCC version is a problem. multi3 is 
calling muldi3, so that muldi3 should be able to use mulsi3, because it is the 
same C code in libgcc2. Can someone get me some hints or comments? How can this 
be debugged?

Does someone know how to enable TImode in MIPS ABI o32 (this doesn't need to 
use the 128 bit instructions at the moment)? There is some old code for the 
Playstation 2 which needs this. I know that TImode is supported in ABI n32, but 
some code uses also the 32 bit FPU and FPU registers are not available with 
"-msoft-float" in inline assembler.

What is the best way to change the alignment to 128 bit for all structures and 
stack in any MIPS ABI? Much old code for the Playstation 2 expects this.

Best regards
Jürgen Urban
diff -Nurp '--exclude=build01' ../gcc-svn-20130105.orig/config.sub gcc-svn-20130105-mips64r5900el-linux-patched/config.sub
--- ../gcc-svn-20130105.orig/config.sub	2013-01-05 20:06:32.859960482 +0100
+++ gcc-svn-20130105-mips64r5900el-linux-patched/config.sub	2013-01-06 19:11:56.332755480 +0100
@@ -284,6 +284,8 @@ case $basic_machine in
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
 	| mips64vr5900 | mips64vr5900el \
+	| mips64r5900 | mips64r5900el \
+	| mipsr5900 | mipsr5900el \
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
 	| mipsisa64 | mipsisa64el \
@@ -401,6 +403,8 @@ case $basic_machine in
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
 	| mips64vr5900-* | mips64vr5900el-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mipsr5900-* | mipsr5900el-* \
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
 	| mipsisa64-* | mipsisa64el-* \
diff -Nurp '--exclude=build01' ../gcc-svn-20130105.orig/gcc/config/mips/mips.c gcc-svn-20130105-mips64r5900el-linux-patched/gcc/config/mips/mips.c
--- ../gcc-svn-20130105.orig/gcc/config/mips/mips.c	2013-01-05 20:03:24.231962472 +0100
+++ gcc-svn-20130105-mips64r5900el-linux-patched/gcc/config/mips/mips.c	2013-01-06 19:11:56.336755480 +0100
@@ -1025,6 +1025,19 @@ static const struct mips_rtx_cost_data
 		 1,   /* branch_cost */
 		 4/* memory_latency */
   },
+  { /* R5900 */
+COSTS_N_INSNS (4),/* fp_add */
+COSTS_N_INSNS (4),/* fp_mult_sf */
+COSTS_N_INSNS (256),  /* fp_mult_df */
+COSTS_N_INSNS (8),/* fp_div_sf */
+COSTS_N_INSNS (256),  /* fp_div_df */
+COSTS_N_INSNS (4),/* int_mult_si */
+COSTS_N_INSNS (256),  /* int_mult_di */
+COSTS_N_INSNS (37),   /* int_div_si */
+COSTS_N_INSNS (256),  /* int_div_di */
+		 1,   /* branch_cost */
+		 4/* memory_latency */
+  },
   { /* R7000 */
 /* The only costs that are changed here are
integer multiplication.  */
@@ -12793,6 +12806,7 @@ mips_issue_rate (void)
 case PROCESSOR_R4130:
 case PROCESSOR_R5400:
 case PROCESSOR_R5500:
+case PROCESSOR_R5900:
 case PROCESSOR_R7000:
 case PROCESSOR_R9000:
 case PROCESSOR_OCTEON:
@@ -15573,6 +15587,7 @@ vr4130_align_insns (void)
 }
   dfa_finish ();
 }
+
 
 /* This structure records that the current function has a LO_SUM
involving SYMBOL_REF or LABEL_REF BASE and that MAX_OFFSET is
@@ -15801,6 +15816,11 @@ mips_reorg_process_insns (void)
   if (TARGET_FIX_VR4120 || TARGET_FIX_24K)
 cfun->machine->a

Re: [cxx-conversion] Change uses of htab_t in gcc/config to hash_table.

2013-01-06 Thread Lawrence Crowl
On 1/6/13, Richard Biener  wrote:
> On Sun, Jan 6, 2013 at 6:55 AM, Xinliang David Li  wrote:
>> I noticed that the traverse and traverse_noresize method takes
>> Argument as the first template parameter. It should be moved to be the
>> second after the callback. In most of the cases, the type of the
>> Argument can be deduced from the callsite, so that the user only need
>> to specify the callback:
>>
>> ht->traverse_noresize(&arg);
>>
>> In the current way, user has to do this:
>>
>> ht->traverse_noresize (&arg);
>>
>> which is not as friendly.
>
> Agreed.

Agreed.  The current structure was handy in the conversion process.
Now that the conversion is done, we could change the order.

>> David
>>
>>
>> On Tue, Dec 18, 2012 at 8:02 PM, Lawrence Crowl 
>> wrote:
>>> Update various config htab_t uses to hash_table.
>>>
>>> Modify types and calls to match.
>>>
>>> * config/arm/arm.c'arm_libcall_uses_aapcs_base::libcall_htab
>>>
>>> Fold libcall_eq and libcall_hash into new struct libcall_hasher.
>>>
>>> * config/ia64/ia64.c'bundle_state_table
>>>
>>> Fold bundle_state_hash and bundle_state_eq_p into new struct
>>> bundle_state_hasher.
>>>
>>> * config/mips/mips.c'mips_offset_table
>>>
>>> Fold mips_lo_sum_offset_hash and mips_lo_sum_offset_eq into new
>>> struct mips_lo_sum_offset_hasher.
>>>
>>> In mips_reorg_process_insns, change call to for_each_rtx to pass
>>> a pointer to the hash_table rather than a htab_t.  This change
>>> requires then dereferencing that pointer in mips_record_lo_sum to
>>> obtain the hash_table.
>>>
>>> * config/sol2.c'solaris_comdat_htab
>>>
>>> Fold comdat_hash and comdat_eq into new struct comdat_entry_hasher.
>>>
>>> * config/i386/winnt.c'i386_pe_section_type_flags::htab
>>>
>>> * config/i386/winnt.c'i386_find_on_wrapper_list::wrappers
>>>
>>> Fold wrapper_strcmp into new struct wrapped_symbol_hasher.
>>>
>>>
>>> Tested on x86-64.
>>> Tested with contrib/config-list.mk.
>>>
>>>
>>> Okay for branch?
>>>
>>>
>>> Index: gcc/config/arm/arm.c
>>> ===
>>> --- gcc/config/arm/arm.c(revision 194511)
>>> +++ gcc/config/arm/arm.c(working copy)
>>> @@ -25,6 +25,7 @@
>>>  #include "config.h"
>>>  #include "system.h"
>>>  #include "coretypes.h"
>>> +#include "hash-table.h"
>>>  #include "tm.h"
>>>  #include "rtl.h"
>>>  #include "tree.h"
>>> @@ -3716,36 +3717,48 @@ arm_function_value(const_tree type, cons
>>>return arm_libcall_value_1 (mode);
>>>  }
>>>
>>> -static int
>>> -libcall_eq (const void *p1, const void *p2)
>>> +/* libcall hashtable helpers.  */
>>> +
>>> +struct libcall_hasher : typed_noop_remove 
>>>  {
>>> -  return rtx_equal_p ((const_rtx) p1, (const_rtx) p2);
>>> +  typedef rtx_def value_type;
>>> +  typedef rtx_def compare_type;
>>> +  static inline hashval_t hash (const value_type *);
>>> +  static inline bool equal (const value_type *, const compare_type *);
>>> +  static inline void remove (value_type *);
>>> +};
>>> +
>>> +inline bool
>>> +libcall_hasher::equal (const value_type *p1, const compare_type *p2)
>>> +{
>>> +  return rtx_equal_p (p1, p2);
>>>  }
>>>
>>> -static hashval_t
>>> -libcall_hash (const void *p1)
>>> +inline hashval_t
>>> +libcall_hasher::hash (const value_type *p1)
>>>  {
>>> -  return hash_rtx ((const_rtx) p1, VOIDmode, NULL, NULL, FALSE);
>>> +  return hash_rtx (p1, VOIDmode, NULL, NULL, FALSE);
>>>  }
>>>
>>> +typedef hash_table  libcall_table_type;
>>> +
>>>  static void
>>> -add_libcall (htab_t htab, rtx libcall)
>>> +add_libcall (libcall_table_type htab, rtx libcall)
>>>  {
>>> -  *htab_find_slot (htab, libcall, INSERT) = libcall;
>>> +  *htab.find_slot (libcall, INSERT) = libcall;
>>>  }
>>>
>>>  static bool
>>>  arm_libcall_uses_aapcs_base (const_rtx libcall)
>>>  {
>>>static bool init_done = false;
>>> -  static htab_t libcall_htab;
>>> +  static libcall_table_type libcall_htab;
>>>
>>>if (!init_done)
>>>  {
>>>init_done = true;
>>>
>>> -  libcall_htab = htab_create (31, libcall_hash, libcall_eq,
>>> - NULL);
>>> +  libcall_htab.create (31);
>>>add_libcall (libcall_htab,
>>>convert_optab_libfunc (sfloat_optab, SFmode,
>>> SImode));
>>>add_libcall (libcall_htab,
>>> @@ -3804,7 +3817,7 @@ arm_libcall_uses_aapcs_base (const_rtx l
>>> DFmode));
>>>  }
>>>
>>> -  return libcall && htab_find (libcall_htab, libcall) != NULL;
>>> +  return libcall && libcall_htab.find (libcall) != NULL;
>>>  }
>>>
>>>  static rtx
>>> Index: gcc/config/arm/t-arm
>>> ===
>>> --- gcc/config/arm/t-arm(revision 194511)
>>> +++ gcc/config/arm/t-arm(working copy)
>>> @@ -73,8 +73,8 @@ $(srcdir)/config/arm/arm-tables.opt: $(s
>>> $(SHELL) $(srcdir)/config/arm/genopt.sh $(srcdir)/config/arm > \
>>> $(srcdir)/config/arm/arm-tables.opt
>>>
>>

[v3] Document implementation-defined bucket counts

2013-01-06 Thread Jonathan Wakely
The standard says that the initial number of buckets in an unordered
associative container is implementation-defined when not set by the
user (I would have made it unspecified but noone asked me ;-) so this
patch documents our implementation's choice.

* include/bits/unordered_map.h: Fix typo in comments.
* doc/xml/manual/status_cxx2011.xml: Add implementation-defined bucket
counts for unordered associative containers.

Committed to trunk.
commit 823cb734cf2f37650fe12634eb2d58f0ff4645a2
Author: Jonathan Wakely 
Date:   Sun Jan 6 20:48:53 2013 +

* include/bits/unordered_map.h: Fix typo in comments.
* doc/xml/manual/status_cxx2011.xml: Add implementation-defined bucket
counts for unordered associative containers.

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml 
b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index 0164b0b..c0780de 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -2635,6 +2635,15 @@ particular release.

 

+  23.5.4.2 [unord.map.cnstr],
+  23.5.5.2 [unord.multimap.cnstr],
+  23.5.6.2 [unord.set.cnstr],
+  23.5.7.2 [unord.multiset.cnstr]
+  The default bucket count is 10 for the default constructors
+  and 0 for the range constructors and initializer-list constructors.
+   
+
+   
   30.2.3 [thread.req.native]/1
   native_handle_type and
   native_handle are provided. The handle types
diff --git a/libstdc++-v3/include/bits/unordered_map.h 
b/libstdc++-v3/include/bits/unordered_map.h
index e2b83db..9fa0553 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -1,6 +1,6 @@
 // unordered_map implementation -*- C++ -*-
 
-// Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2010-2013 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
@@ -167,7 +167,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   /// Copy constructor.
   unordered_map(const unordered_map&) = default;
 
-  /// Move constrcutor.
+  /// Move constructor.
   unordered_map(unordered_map&&) = default;
 
   /**
@@ -848,7 +848,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   /// Copy constructor.
   unordered_multimap(const unordered_multimap&) = default;
 
-  /// Move constrcutor.
+  /// Move constructor.
   unordered_multimap(unordered_multimap&&) = default;
 
   /**


Re: [committed] 2011 and 2012 Copyright year updates

2013-01-06 Thread Richard Sandiford
Mike Stump  writes:
> On Jan 6, 2013, at 4:13 AM, Richard Sandiford
>  wrote:
>> Anyway, here's my attempt a script to convert to ranges and, if enabled,
>> to include the current year.
>
> I don't think we should update to the current year.

It just seems easier than having to remember to update the copyright
whenever you change a file.  The GNU guidelines seem to actively
encourage it now.

>> The script only updates FSF copyright notices
>> and leaves others alone.  I've tried my best to make sure that licences
>> and imported FSF sources aren't touched, but I could have missed some cases.
>
> I've audited the change…  I noticed an inconsistent use of:
>
> Copyright (c) 2010
> Copyright 1992
> Copyright (C) 2010
>
> but that is pre-existing.  Also, I noticed a 90-2007, which should
> canonicalized to 1990-2007, but that is also pre-existing.

Thanks, I updated my local copy to handle both of these.

Richard


Re: [committed] 2011 and 2012 Copyright year updates

2013-01-06 Thread Richard Sandiford
Jakub Jelinek  writes:
> On Sun, Jan 06, 2013 at 12:13:32PM +, Richard Sandiford wrote:
>> I never remember to update the copyright years, so I thought I'd have a go.
>> And you were right of course.  It ended up being a huge time sink.
>> 
>> Anyway, here's my attempt a script to convert to ranges and, if enabled,
>> to include the current year.  The script only updates FSF copyright notices
>> and leaves others alone.  I've tried my best to make sure that licences
>> and imported FSF sources aren't touched, but I could have missed some cases.
>
> Looks reasonable to me, though I'd like to hear richi's and Joseph's
> opinion too.
>
> I've noticed a minor nit:
> --- gcc.orig/gcc/testsuite/gcc.misc-tests/linkage.exp
> +++ gcc/gcc/testsuite/gcc.misc-tests/linkage.exp
> @@ -1,5 +1,4 @@
> -# Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010,
> -# 2011,  
> -# 2012 Free Software Foundation, Inc.
> +# Copyright (C) 90-2012 Free Software Foundation, Inc.
>
> That should have been presumably 1988-2012, haven't looked at other similar
> cases.

Gah, good catch.  Fixed in my local copy.  I also added a bit of extra
error checking to try to make sure the years were sane.

Since it's a big patch, I'll see if there are any more comments before
sending an update.

> As for updating to -2013, I think it isn't appropriate for all
> files, e.g. I'd leave ChangeLog* and various README* files to keep their
> finish date as is, say ChangeLog.2003 can be just Copyright (c) 2003,
> doesn't need to be 2003-2013.  Perhaps just automatically add -2013 to gcc
> (except gcc/testsuite) *.[ch], *.md, *.def, *.opt files or so, plus
> gcc/testsuite *.exp files?  E.g. testsuite *.c/*.C files that are Copyright
> 2004 don't need to be -2013?

Yeah.  I'd also tried to avoid touching the gcc tests in this patch,
so hopefully the same filter would be OK when adding the extra year.

The script applies a similar filter to the libjava testsuite.  I wasn't
sure what do about libstdc++ though, since its testsuite seems less like
a random collection of tests.  I'll cross-post any libstdc++ stuff to
the libstdc++ list once the GCC side has settled down.

I think we should also update the year in the documentation (possibly
including the READMEs).  There are also awk scripts, random shell
scripts, OCaml generators, etc., so it's probably easier to list what
should be left out rather than what should be included.  The current GNU
guidelines seem to actively encourage a blanket update.

Agreed on the historical changelogs though.  It does seem silly to
update those.

> Also, just a remainder, any Copyright line change in libstdc++-v3/include
> might potentially require adjustments to libstdc++-v3/testsuite/, because
> various tests have header line numbers hardcoded in them.

OK, thanks for the heads up.  The libstdc++ and libjava changes the
ones I'm least certain about.

Richard


Re: [Patch, fortran] Fix PR53876 (regression), PR55990 (regression) and PR55992

2013-01-06 Thread Paul Richard Thomas
Indeed - all your nits are veritable nits.  For some reason, I set the
working directory as PR55990 and kept referring to that :-)  The
tescase was always checked with a local version but I did verify that
DejaGnu agreed that it worked.

Committed revision 194953


gnu central is taking its time about registering the commit, so I'll
close the PRs in the morning.


Thanks for the review


Paul

On 6 January 2013 15:25, Tobias Burnus  wrote:
> Paul Richard Thomas wrote:
>>
>> Boostratpped and regtested on FC17/x86_64 - OK for trunk?
>
>
> OK - with the below nits fixed.  Thanks for the patch.
>
>
>
>>  PR fortran/PR53876
>>  PR fortran/PR55990
>>  PR fortran/PR55992
>
>
> Change 55* into 54*.
>
>
>
>>  PR fortran/PR53876
>>  PR fortran/PR55990
>>  PR fortran/PR55992
>
>
> Ditto.
>
>> +   /* Ensure that the CLASS langauge specific flag is set.  */
>
>
> s/langauge/language/
>
>> + ! { dg-do run}
>
>
> s/run}/run }/
>
> Without the " " before the right curly brace, DejaGNU will ignore the line
> and handle it as "dg-do compile". Please check after that change that the
> test case doesn't fail at run time.
>
> Tobias



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
   --Hitchhikers Guide to the Galaxy


Re: abi doc out of date?

2013-01-06 Thread Jonathan Wakely
On 1 January 2013 13:04, Jonathan Wakely wrote:
> On 1 January 2013 03:33, Kenny Simpson wrote:
>> http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
>>
>> does not seem to have updates for gcc 4.7 in sections 3,4,7.
>>
>> e.g. should there be an entry in section 3 like...
>> GCC 4.7.0: libstdc++.so.6.0.17
>
> Thanks, I'll fix it in svn, but the online copy will probably stay out
> of date as I can't update it.

Fixed with this doc patch on trunk, I'll apply something similar to
the 4.7 branch too.
commit e23ca07a8b4072a14bbfc5a10b5f7b6d09f15b60
Author: Jonathan Wakely 
Date:   Sun Jan 6 21:12:08 2013 +

* doc/xml/manual/abi.xml: Update library and symbol versions.

diff --git a/libstdc++-v3/doc/xml/manual/abi.xml 
b/libstdc++-v3/doc/xml/manual/abi.xml
index 9d7395e..6cf79a1 100644
--- a/libstdc++-v3/doc/xml/manual/abi.xml
+++ b/libstdc++-v3/doc/xml/manual/abi.xml
@@ -259,6 +259,8 @@ compatible.
 GCC 4.5.0: libstdc++.so.6.0.14
 GCC 4.6.0: libstdc++.so.6.0.15
 GCC 4.6.1: libstdc++.so.6.0.16
+GCC 4.7.0: libstdc++.so.6.0.17
+GCC 4.8.0: libstdc++.so.6.0.18
 
 
   Note 1: Error should be libstdc++.so.3.0.3.
@@ -320,6 +322,8 @@ compatible.
 GCC 4.5.0: GLIBCXX_3.4.14, CXXABI_1.3.4
 GCC 4.6.0: GLIBCXX_3.4.15, CXXABI_1.3.5
 GCC 4.6.1: GLIBCXX_3.4.16, CXXABI_1.3.5
+GCC 4.7.0: GLIBCXX_3.4.17, CXXABI_1.3.6
+GCC 4.8.0: GLIBCXX_3.4.18, CXXABI_1.3.7
 
 
 
@@ -437,13 +441,19 @@ compatible.
 GCC 4.4.4: 20100429
 GCC 4.4.5: 20101001
 GCC 4.4.6: 20110416
+GCC 4.4.7: 20120313
 GCC 4.5.0: 20100414
 GCC 4.5.1: 20100731
 GCC 4.5.2: 20101216
 GCC 4.5.3: 20110428
+GCC 4.5.4: 20120702
 GCC 4.6.0: 20110325
 GCC 4.6.1: 20110627
 GCC 4.6.2: 20111026
+GCC 4.6.3: 20120301
+GCC 4.7.0: 20120322
+GCC 4.7.1: 20120614
+GCC 4.7.2: 20120920
 
 
 


Re: [v3 testsuite] gdb-test.exp: catch error running gdb command

2013-01-06 Thread Mike Stump
On Jan 3, 2013, at 3:57 PM, Janis Johnson  wrote:
> The libstdc++ prettyprinter tests require a certain level of support
> from GDB, and the check for that GDB support runs a command that
> includes a quoted string.  This causes an error from the testsuite
> infrastructure for embedded processors whose board support passes
> commands through additional levels of procedures that lose the
> backslashes that escape the quotes.  Adding more backslashes wouldn't
> work because it would prevent the command from working for the majority
> of boards.  I can't figure out a real solution to the problem.
> 
> Rather than gdb_version_check resulting in an error for boards that
> pass a command through additional levels of procedure calls, this
> patch lets it catch the error so that it can fail gracefully and the
> tests will be reported as UNSUPPORTED.  This will skip the tests for
> a relatively small number of test setups.
> 
> OK for trunk?

Ok.  If one wants to fix the real problem, just track down call chain and find 
who does what with quoting.  I usually do this by mixing in spaces, tabs, 
newlines, backslashes, single quotes and double quotes into the content and 
then ensue identity at the bottom.  At each step, the content should be 
preserved.  If anything strips content, that is wrong, and can be fixed by 
adding:

string=add_quotes(string)

before the thing that strips.  The exact form of add_quote is dependent upon 
the thing that does the stripped (interpretation).


Re: fixincludes for libquadmath build regression

2013-01-06 Thread Bruce Korb
On 01/06/13 12:12, Alexandre Oliva wrote:
> On Dec 30, 2012, Bruce Korb  wrote:
> 
>> On 12/30/12 01:42, Paolo Bonzini wrote:
>>> Not my territory anymore, but it looks much better!  CCing Bruce.
> 
>> Long time.  It's no wonder you've forgotten this little world! :)
> 
> Indeed!
> 
>> Anyway, please make the expressions more readable and strip
>> out the generated text from the review message.
> 
> Done.  Ok?

Looks good to me.  Thanks!


Re: [committed] 2011 and 2012 Copyright year updates

2013-01-06 Thread Mike Stump
On Jan 6, 2013, at 12:24 PM, Mike Stump  wrote:
> I did the analysis by case reduction so that like case classes reduce to 
> generalized forms and then I audited all the forms of changes that appeared.  
> This lets me skip quickly the majority of changes and focus in on just the 
> weirdest of the weird quickly and accurately without missing them in the 
> noise of the common cases.

Oh, just in case people want to see the last residual:

$ grep '^[-+]' copyright-range-gcc.patch  | grep -v '^---' | grep -v '^+++' | 
sed 's/.*opyright/Copyright/; s/Free.*/Free/; s/[12][0-9][0-9][0-9], //g; 
s/opyright (c)/opyright/; s/opyright (C)/opyright/; s/opyright 
[12][0-9][0-9][0-9], */opyright /g; s/[12][0-9][0-9][0-9][,-] *//g' | more | 
sort | uniq -c | more
   5 -
  52 -   
   1 -   2002 Free
   4 -   2007 Free
  24 -   2010
   2 -   2010  Free
  10 -   2010 Free
  39 -   2011
   8 -   2011  Free
  43 -   2011 Free
 136 -   2012
  31 -   2012  Free
 147 -   2012 Free
  12 -   2013
   1 -   2013  Free
   5 -   2013 Free
   1 -   Foundation, Inc.
 706 -   Free
   1 -   Inc.
   2 - * 2008
   2 - *  The Free
   1 - * Free
   1 -#   2010 Free
   3 -#   2011 Free
   2 -#   2012
   1 -#   2012 Free
  14 -#   Free
   8 -#  Free
   1 -#  The Free
   1 -# 2003 Free
   1 -# 2008  Free
   1 -# 2008 Free
   1 -# 2010 Free
  12 -# 2011 Free
   5 -# 2012
  12 -# 2012 Free
  54 -# Free
   1 -1998 Free
   1 -2007 Free
   1 -2009 Free
   1 -2010  Free
   3 -2010 Free
   1 -2011
   3 -2011 Free
   1 -2012
   2 -2012 Free
   1 -;  2011 Free
   2 -; 2012 Free
  39 -; Free
   2 -;;  
   1 -;;   2012 Free
   7 -;;   Free
   1 -;;  2011 Free
   4 -;;  2012
   1 -;;  2012 Free
  12 -;;  Free
   1 -;; 2010 Free
   2 -;; 2011 Free
   4 -;; 2012
   1 -;; 2012  Free
   7 -;; 2012 Free
  71 -;; Free
   1 -@c 
   1 -@c 2002 Free
   2 -@c 2004 Free
   1 -@c 2006 Free
   2 -@c 2007 Free
   1 -@c 2009
   2 -@c 2010
   2 -@c 2010 Free
   2 -@c 2011 Free
   8 -@c 2012
   1 -@c 2012 Free
   1 -@c 2013
  25 -@c Free
   1 -Foundation, Inc.
   7 -Free
   1 -Inc.
   1 -dnl Free
 546 Copyright 
   1 Copyright 1996
   2 Copyright 1996 Free
   2 Copyright 1997
   4 Copyright 1997 Free
   4 Copyright 1998
   1 Copyright 1998 - 2012
   9 Copyright 1998 Free
   1 Copyright 1999
   3 Copyright 1999 Free
   1 Copyright 1999 The Free
   5 Copyright 2001 Free
   1 Copyright 2001 The Free
   2 Copyright 2002 Free
   9 Copyright 2003 Free
   1 Copyright 2004
  20 Copyright 2004 Free
   1 Copyright 2004 The Free
   2 Copyright 2005
   1 Copyright 2005 , 2012
  12 Copyright 2005 Free
   1 Copyright 2006
   4 Copyright 2006 Free
  20 Copyright 2007
   1 Copyright 2007  Free
 324 Copyright 2007 Free
  13 Copyright 2008
  64 Copyright 2008 Free
  18 Copyright 2009
 143 Copyright 2009 Free
  80 Copyright 2010
   3 Copyright 2010  Free
 277 Copyright 2010 Free
   1 Copyright 2010. 2011 Free
 148 Copyright 2011
   1 Copyright 2011  Free
 631 Copyright 2011 Free
 416 Copyright 2012
  16 Copyright 2012  Free
1374 Copyright 2012 Free
   6 Copyright 2013
  25 Copyright 2013 Free
   1 Copyright 90, 91, 92, 2007
   2 Copyright 90, 91, 92, 95, 96, 2007
   3 Copyright 90-2007 Free
   1 Copyright 90-2012 Free
   1 Copyright 90-96, 
   6 Copyright Free
   2 Copyrights-gcj 2010
   2 Copyrights-gfortran 2010
   2 Copyrights-gfortran 2012
   2 Copyrights-gfortran} Free
   2 Copyrights-go 2012
   6 Copyright{} 
   1 Copyright{} 2005
   1 Copyright{} 2005 Free
   3 Copyright{} 2010 Free
   1 Copyright{} 2011
   2 Copyright{} 2011 Free
   2 Copyright{} 2012 Free

Of course, this leaves out all the intermediates and audit steps.  This is 
merely the last step.


Re: [PATCH] Adding target rdos to GCC

2013-01-06 Thread Uros Bizjak
Hello!

> Updated patches with the suggestions below, except that the initial value is 0
> (which is not meaningful). I also added a setting in rdos target file to use 
> r15
> for PIC instead of rbx.

*** gcc-4.8-20121230/gcc/config/i386/i386.c Thu Dec 27 02:58:06 2012
--- gcc-work/gcc/config/i386/i386.c Sun Jan  6 14:10:34 2013

+   if (ix86_section_threshold == 0)
+ ix86_section_threshold = DEFAULT_SECTION_THRESHOLD;

Please see attached patch on how to initialize an option.

*** gcc-4.8-20121230/gcc/config/i386/i386.h Wed Dec 19 17:04:12 2012
--- gcc-work/gcc/config/i386/i386.h Sun Jan  6 13:24:26 2013

+ #define TARGET_MEDIUM_PIC   0

You should just use TARGET_RDOS here (also, please see attached patch).

+ /* Default threshold for putting data in large sections with x86-64
+medium memory model */
+ #define DEFAULT_SECTION_THRESHOLD 65536

Do not put this define in the middle of i386.h section that deals with
alignment...

*** gcc-4.8-20121230/gcc/config/i386/rdos.h Thu Jan  1 01:00:00 1970
--- gcc-work/gcc/config/i386/rdos.h Sun Jan  6 13:20:12 2013

+ #undef REAL_PIC_OFFSET_TABLE_REGNUM
+ #define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG

Is this header also used for 32bit target? You should not use REX
registers for 32bit targets.

+ #undef TARGET_MEDIUM_PIC
+ #define TARGET_MEDIUM_PIC   1

TARGET_RDOS

+ #define DEFAULT_SECTION_THRESHOLD0x10

No hex numbers here. Also, you will need to #undef this first to
override the default in i386.h.

*** gcc-4.8-20121230/gcc/config.gcc Thu Nov 22 00:33:40 2012
--- gcc-work/gcc/config.gcc Fri Jan  4 21:08:46 2013

+ i[34567]86-*-rdos*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h
newlib-stdint.h"
+ ;;

You forgot to include i386/rdos.h here (other headers too?). It is
needed at least for TARGET_EXECUTABLE_SUFFIX define.

Uros.
Index: i386.c
===
--- i386.c  (revision 194945)
+++ i386.c  (working copy)
@@ -3239,6 +3239,8 @@
 DLL, and is essentially just as efficient as direct addressing.  */
   if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+  else if (TARGET_64BIT && TARGET_RDOS)
+   ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1;
   else if (TARGET_64BIT)
ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
   else
Index: i386.h
===
--- i386.h  (revision 194945)
+++ i386.h  (working copy)
@@ -519,6 +519,9 @@
 #define MACHOPIC_INDIRECT 0
 #define MACHOPIC_PURE 0
 
+/* For the RDOS  */
+#define TARGET_RDOS 0
+
 /* For the Windows 64-bit ABI.  */
 #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
 
@@ -2081,6 +2084,10 @@
asm (SECTION_OP "\n\t"  \
"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n" \
TEXT_SECTION_ASM_OP);
+
+/* Default threshold for putting data in large sections
+   with x86-64 medium memory model */
+#define DEFAULT_LARGE_SECTION_THRESHOLD 65536
 
 /* Which processor to tune code generation for.  */
 
Index: i386.opt
===
--- i386.opt(revision 194945)
+++ i386.opt(working copy)
@@ -141,7 +141,7 @@
 Branches are this expensive (1-5, arbitrary units)
 
 mlarge-data-threshold=
-Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(65536)
+Target RejectNegative Joined UInteger Var(ix86_section_threshold) 
Init(DEFAULT_LARGE_SECTION_THRESHOLD)
 Data greater than given threshold will go into .ldata section in x86-64 medium 
model
 
 mcmodel=


Re: [committed] 2011 and 2012 Copyright year updates

2013-01-06 Thread Mike Stump
On Jan 6, 2013, at 4:13 AM, Richard Sandiford  
wrote:
> Anyway, here's my attempt a script to convert to ranges and, if enabled,
> to include the current year.

I don't think we should update to the current year.

> The script only updates FSF copyright notices
> and leaves others alone.  I've tried my best to make sure that licences
> and imported FSF sources aren't touched, but I could have missed some cases.

I've audited the change…  I noticed an inconsistent use of:

Copyright (c) 2010
Copyright 1992
Copyright (C) 2010

but that is pre-existing.  Also, I noticed a 90-2007, which should 
canonicalized to 1990-2007, but that is also pre-existing.

I did the analysis by case reduction so that like case classes reduce to 
generalized forms and then I audited all the forms of changes that appeared.  
This lets me skip quickly the majority of changes and focus in on just the 
weirdest of the weird quickly and accurately without missing them in the noise 
of the common cases.

Look good.  I think we should put it in.  I didn't audit upstream or out of 
tree files.  Only the form of the change.


Re: fixincludes for libquadmath build regression

2013-01-06 Thread Alexandre Oliva
On Dec 30, 2012, Bruce Korb  wrote:

> On 12/30/12 01:42, Paolo Bonzini wrote:
>> Not my territory anymore, but it looks much better!  CCing Bruce.

> Long time.  It's no wonder you've forgotten this little world! :)

Indeed!

> Anyway, please make the expressions more readable and strip
> out the generated text from the review message.

Done.  Ok?

Fix mandatory SSE in 2.1[56]ish glibc's feraiseexcept

From: Alexandre Oliva 

for fixincludes/ChangeLog

	* inclhack.def (feraiseexcept_nosse_invalid): New.
	(feraiseexcept_nosse_divbyzero): Likewise.
	* fixincl.x: Rebuilt.
	* tests/base/bits/fenv.h: New.
---

 fixincludes/fixincl.x  |  130 ++--
 fixincludes/inclhack.def   |   49 ++
 fixincludes/tests/base/bits/fenv.h |   29 
 3 files changed, 200 insertions(+), 8 deletions(-)
 create mode 100644 fixincludes/tests/base/bits/fenv.h


diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 09eac7c6..2406920 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4815,4 +4815,53 @@ fix = {
 test_text = "extern char *\tsprintf();";
 };
 
+/*
+ *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ *  that fails when compiling for SSE-less 32-bit x86.
+ */
+fix = {
+hackname  = feraiseexcept_nosse_invalid;
+mach  = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+files = bits/fenv.h;
+select= "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
+		": \"x\" \\(__f\\)\\);$";
+bypass= "\"fdiv .*; fwait\"";
+
+c_fix = format;
+c_fix_arg = <<- _EOText_
+	# ifdef __SSE_MATH__
+	%0
+	# else
+	%1__asm__ __volatile__ ("fdiv st, st(0); fwait"
+	%1			: "=t" (__f) : "0" (__f));
+	# endif
+	_EOText_;
+
+test_text = <<- _EOText_
+	  __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
+	_EOText_;
+};
+fix = {
+hackname  = feraiseexcept_nosse_divbyzero;
+mach  = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+files = bits/fenv.h;
+select= "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
+		": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
+bypass= "\"fdivp .*; fwait\"";
+
+c_fix = format;
+c_fix_arg = <<- _EOText_
+	# ifdef __SSE_MATH__
+	%0
+	# else
+	%1__asm__ __volatile__ ("fdivp st, st(1); fwait"
+	%1			: "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+	# endif
+	_EOText_;
+
+test_text = <<- _EOText_
+	  __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+	_EOText_;
+};
+
 /*EOF*/
diff --git a/fixincludes/tests/base/bits/fenv.h b/fixincludes/tests/base/bits/fenv.h
new file mode 100644
index 000..a82ec25
--- /dev/null
+++ b/fixincludes/tests/base/bits/fenv.h
@@ -0,0 +1,29 @@
+/*  DO NOT EDIT THIS FILE.
+
+It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/bits/fenv.h"
+
+This had to be done to correct non-standard usages in the
+original, manufacturer supplied header file.  */
+
+
+
+#if defined( FERAISEEXCEPT_NOSSE_INVALID_CHECK )
+# ifdef __SSE_MATH__
+  __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
+# else
+  __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait"
+  			: "=t" (__f) : "0" (__f));
+# endif
+#endif  /* FERAISEEXCEPT_NOSSE_INVALID_CHECK */
+
+
+#if defined( FERAISEEXCEPT_NOSSE_DIVBYZERO_CHECK )
+# ifdef __SSE_MATH__
+  __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+# else
+  __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait"
+  			: "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+# endif
+#endif  /* FERAISEEXCEPT_NOSSE_DIVBYZERO_CHECK */


-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [Bug bootstrap/53607] opt-functions.awk --> "awk: There is a regular expression error."

2013-01-06 Thread Daniel Richard G.
On Sun, 2013 Jan  6 18:45+0100, Andreas Schwab wrote:
>
> > sub(".* " name "\\(", "", flags)
> > -   if (flags ~ "^{")
> > +   if (flags ~ "^\{")
> > {
> > -   sub ("^{", "", flags)
> > +   sub ("^\{", "", flags)
> > sub("}\\).*", "", flags)
> 
> You need to escape the backslash inside a string.

Revised patch attached; awk behavior/output is same as before.


--Daniel


-- 
Daniel Richard G. || sk...@iskunk.org
My ASCII-art .sig got a bad case of Times New Roman.
Index: gcc/opt-functions.awk
===
--- gcc/opt-functions.awk	(revision 194916)
+++ gcc/opt-functions.awk	(working copy)
@@ -62,9 +62,9 @@
 	if (flags !~ " " name "\\(")
 		return ""
 	sub(".* " name "\\(", "", flags)
-	if (flags ~ "^{")
+	if (flags ~ "^\\{")
 	{
-		sub ("^{", "", flags)
+		sub ("^\\{", "", flags)
 		sub("}\\).*", "", flags)
 	}
 	else


Re: [PR libmudflap/53359] don't register symbols not emitted

2013-01-06 Thread Alexandre Oliva
On Jan  2, 2013, Richard Biener  wrote:

> On Sun, Dec 30, 2012 at 1:22 AM, Alexandre Oliva  wrote:
>> On Dec 21, 2012, Richard Biener  wrote:
>> 
>>> On Fri, Dec 21, 2012 at 6:33 AM, Alexandre Oliva  wrote:
 libmudflap emits a global initializer that registers memory ranges for
 global data symbols.  However, even if IPA decides not to emit a symbol
 because it's unused, we'd still emit registration sequences for them in
 some cases, which, in the PR testcase, would result in TOC references to
 the undefined symbols.
>> 
>>> Hmm, I think that at this point of the compilation you are looking for
>>> TREE_ASM_WRITTEN instead.
>> 
>> That doesn't work, several mudflap regressions show up because accesses
>> to global library symbols that are accessed by template methods compiled
>> with mudflap (say cout) are then verified but not registered.  We have
>> to register symbols that are not emitted but that referenced.

> Ehm, how can something be not emitted but still referenced?  You mean if
> it's external?

Yeah.

>   if (!TREE_ASM_WRITTEN (obj) || DECL_EXTERNAL (obj))

> instead?

Then we're back to the original bug.

How does the test above tell whether we're actually referencing the
object?  Only when we are do we want to register it with mudflap.  If
it's referenced and we don't register it, we get mudflap runtime errors.
If it's not referenced but we register it, we get link-time errors if
the symbol is one we'd have emitted if it was referenced.

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [Patch, Fortran] PR55758 - Non-C_Bool handling with BIND(C)

2013-01-06 Thread Steve Kargl
On Sun, Jan 06, 2013 at 05:52:23PM +0100, Tobias Burnus wrote:
> 
> PS: If there is consensus that this patch is a bad idea, I propose to 
> reject non-C_BOOL LOGICALs unconditionally as dummy argument or result 
> variable of BIND(C) procedures. Or do you have a better suggestion?
> 

IMHO, I think that this is the correct fix.  If a programmer
wants the non-C_BOOL behavior, at least make the user explicitly
ask for it with an option, e.g., -fenable-non-c_bool-logicals.

OTOH, I have so little time to help with gfortran development,
you can ignore my opinion and I won't be offended.

-- 
Steve


Re: RFA: Add missing copyright holders

2013-01-06 Thread Ian Lance Taylor
On Sun, Jan 6, 2013 at 3:50 AM, Richard Sandiford
 wrote:
> I noticed three files are missing a copyright holder.  Since claims of
> copyright ownership never feel obvious: OK to install?
>
> Richard
>
>
> gcc/
> * file-find.c, file-find.h, realmpfr.c: Add FSF as copyright holder.

This is OK.

Thanks.

Ian


Re: [Bug bootstrap/53607] opt-functions.awk --> "awk: There is a regular expression error."

2013-01-06 Thread Andreas Schwab
"Daniel Richard G."  writes:

> Index: gcc/opt-functions.awk
> ===
> --- gcc/opt-functions.awk (revision 194916)
> +++ gcc/opt-functions.awk (working copy)
> @@ -62,9 +62,9 @@
>   if (flags !~ " " name "\\(")
>   return ""
>   sub(".* " name "\\(", "", flags)
> - if (flags ~ "^{")
> + if (flags ~ "^\{")
>   {
> - sub ("^{", "", flags)
> + sub ("^\{", "", flags)
>   sub("}\\).*", "", flags)

You need to escape the backslash inside a string.

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."


Re: [PATCH] Adding target rdos to GCC

2013-01-06 Thread Leif Ekblad
Updated patches with the suggestions below, except that the initial value is 
0
(which is not meaningful). I also added a setting in rdos target file to use 
r15

for PIC instead of rbx.

New change log:
* config/gthr.m4: Added rdos thread header.
* gcc/config/i386/i386.c: Provided a way to define a default setting for 
medium memory model and PIC. Provided a way to define a default value for 
large-data-threshold.
* gcc/config/i386/i386.h: Defined default value for medium memory model & 
PIC. Defined default value for large-data-threshold.

* gcc/config/i386/i386.md: Added r14 and r15 register names.
* gcc/config/i386/i386.opt: Changed initial value for large-data-threshold 
to 0 to allow detection of modification.

* gcc/config/i386/rdos.h: Added new file for rdos target definition.
* gcc/config.gcc: Added rdos target

Tested for target rdos and rdos32.

Regards,
Leif Ekblad


- Original Message - 
From: "H.J. Lu" 

To: "Leif Ekblad" 
Cc: "GCC Patches" 
Sent: Friday, January 04, 2013 11:32 PM
Subject: Re: [PATCH] Adding target rdos to GCC



On Fri, Jan 4, 2013 at 2:22 PM, Leif Ekblad  wrote:

Change log:
* config/gthr.m4: Added rdos thread header.
* gcc/config/i386/i386.c: Provided a way to define a default setting for
medium memory model and PIC. Provided a way to define a default value for
large-data-threshold.
* gcc/config/i386/i386.h: Defined default value for medium memory model &
PIC.
* gcc/config/i386/rdos.h: Added new file for rdos target definition.
* gcc/config.gcc: Added rdos target

The change to gthr.m4 requires rebuilding the configure scripts.

Tested with target rdos and rdos32. Is this ok for trunk?

Regards,
Leif Ekblad


+ #ifdef TARGET_SECTION_THRESHOLD
+   ix86_section_threshold = TARGET_SECTION_THRESHOLD;
+ #endif

You should

1. Add DEFAULT_SECTION_THRESHOLD and set it to
65536.
2. Change the init value of  ix86_section_threshold to -1.
3. Set ix86_section_threshold to DEFAULT_SECTION_THRESHOLD
if it is -1.


--
H.J. 


gcc.diff
Description: Binary data


Re: [Patch, Fortran] PR55758 - Non-C_Bool handling with BIND(C)

2013-01-06 Thread Tobias Burnus

** ping **

Attached is a small variation, which in addition handles the case that a 
non-BOOL_C LOGICAL, Bind(C) dummy argument (or result variable) is used 
in a procedure call. In that case, the variable is now converted to a 
TYPE_PRECISION == 1 variable. -- The updated patch was build and 
regtested successfully.


As written before, I believe that the patch avoids some pitfalls with C 
interoperability of logical variables:  On one hand, it improves 
cross-compiler portability by rejecting non C_BOOL ones with 
-std=f2003/f2008/f2008ts; on the other hand, it makes wrong-code issues 
due to using non-0/1 integers from C much less likely. In both cases, 
the type-precision==1 handling for non-BIND(C) Fortran LOGICALs or for 
Bind(C) LOGICAL(kind=C_BOOL) remains the same; hence, no optimization 
issue is caused.


OK for the trunk?

Tobias

PS: If there is consensus that this patch is a bad idea, I propose to 
reject non-C_BOOL LOGICALs unconditionally as dummy argument or result 
variable of BIND(C) procedures. Or do you have a better suggestion?



On December 30, 2012, Tobias Burnus wrote:

Janne Blomqvist wrote:

On Fri, Dec 28, 2012 at 12:31 AM, Tobias Burnus  wrote:

a) The Fortran standard only defines LOGICAL(kind=C_Bool) as being
interoperable with C - no other LOGICAL type. That matches GCC: With 
gcc

(the C compiler) only _Bool is a BOOLEAN_TYPE with TYPE_PRECISION == 1.
Hence, this patch rejects other logical kinds as dummy argument/result
variable in BIND(C) procedures if -std=f2003/f2008/f2008ts is specified
(using -pedantic, one gets a warning).

Sorry, I don't understand, what is the -pedantic warning about if it's
already rejected? Or do you mean std=gnu -pedantic?


The latter. Actually, I use "gfc_notify_std(GFC_STD_GNU, ..." and just 
observed the -pedantic result. (I have to admit that I never quite 
understood - and still don't - what -pedantic exactly does.)


b) As GNU extension, other logical kinds are accepted in BIND(C) 
procedures;
however, as the main use of "LOGICAL(kind=4)" (for BIND(C) 
procedures) is to

handle logical expressions which use C's int, one has to deal with all
integer values and not only 0 and 1. Hence, a normal integer type is 
used
internally in that case. That has been done to avoid surprises of 
users and

hard to trace bugs.

Does this actually work robustly?


I think it does in the sense that it mitigates the problems related to 
LOGICAL(kind=4) and BIND(C) procedures. No, if one thinks of it as 
full cure for the problem. The only way to ensure this is to turn all 
of gfortran's LOGICALs into integers - and even that won't prevent 
issues related to interoperability with C's _Bool as that one expects 
only 0 and 1. Thus, either C<->Fortran or Fortran <-> Fortran 
logical(kind=C_Bool) could still lead to problems.


E.g. if you have a logical but really integer under the covers, what 
happens if you equivalence it with a "normal" logical variable.


Well, equivalencing of actual arguments / result variables is not 
allowed (I think, not checked). Besides, if you have equivalenced two 
variables, if you have set one, you may not access the other, e.g.:


logical :: A
integer :: B
equivalence (A,B)
A = .true.
B = 1
if (A) ...

is invalid as "A" is not defined, even if A = .true. and B = 1 have 
exactly the same storage size and bit patterns and, hence, in practice 
"A" would be a well defined .true.



Or pass it as an argument to a procedure expecting a normal logical etc.


If the value is only 1 or 0, there shouldn't be any problems. Only if 
one uses in turn ".not. dummy" there might be one.


The idea of the patch was only to mitigate the problems - a full cure 
is not possible (cf. above). I think the most likely problematic code is

   if (.not. c_function())
which is fixed by the patch. And the hope is that fold-converting to a 
type-precision=1, Boolean-type logical fixes most of the remaining 
issues.


I think the current solution which only affects non-C_BOOL-kind actual 
arguments and result variables of BIND(C) procedures is a good 
compromise.


* * *

But if others do not like this approach, one could turn the 
gfc_notify_std into a gfc_error are completely reject logicals with 
kinds /= C_Bool for dummy arguments/result variables in BIND(C) 
procedures. Would you prefer that approach?


(Doing so will break user code (e.g. Open MPI) and make users unhappy 
but it will be a tad safer as the current patch.)


Tobias



2013-01-06  Tobias Burnus  

	PR fortran/55758
	* resolve.c (resolve_symbol): Reject non-C_Bool logicals
	in BIND(C) procedures with -std=f*.
	* trans-types.c (gfc_sym_type): Use a non-BOOLEAN_TYPE
	integer for non-C_Bool logicals in BIND(C) procedures.
	* trans-expr.c (gfc_conv_unary_op): Add fold convert for
	INTRINSIC_NOT.
	(gfc_conv_procedure_call): Convert type-precision != 1
	logicals to type-precision == 1.

2013-01-06  Tobias Burnus  

	PR fortran/55758
	* gfortran.dg/bind_c_bool_1.f90: New.
	* gfortran.dg/bind_c

Re: [Bug bootstrap/53607] opt-functions.awk --> "awk: There is a regular expression error."

2013-01-06 Thread Daniel Richard G.
This patch addresses a build failure on HP-UX due to the vendor
awk(1) apparently treating a lone curly-brace as an incomplete
repetition operator:

[...]
awk -f /home/src/gcc-4.7.2/gcc/opt-functions.awk -f
/home/src/gcc-4.7.2/gcc/opt-read.awk \
   -f /home/src/gcc-4.7.2/gcc/opth-gen.awk \
   < optionlist > tmp-options.h
awk: There is a regular expression error.
?, *, or + not preceded by valid regular expression
 The source line number is 90.
 The error context is
if (flags ~ >>>  "^{") <<< 
gmake[3]: *** [s-options-h] Error 2
gmake[3]: Leaving directory `/tmp/gcc-build/gcc'
gmake[2]: *** [all-stage1-gcc] Error 2
gmake[2]: Leaving directory `/tmp/gcc-build'
gmake[1]: *** [stage1-bubble] Error 2
gmake[1]: Leaving directory `/tmp/gcc-build'
gmake: *** [bootstrap-lean] Error 2


Fixed by escaping two curly-braces with backslashes.

Tested by getting past that point in the bootstrap successfully on
hppa2.0w-hp-hpux11.00; formal test case not applicable.

ChangeLog entry:

PR bootstrap/53607
* opt-functions.awk: Fix compatibility with HP-UX awk.

Patch: See attached.


--Daniel


On Sun, 2012 Dec 23 3:18+, danglin at gcc dot gnu.org wrote:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53607
> 
> --- Comment #1 from John David Anglin <...> 2012-12-23 03:18:19 UTC ---
> Please send patch with ChangeLog to gcc-patches and CC me.  I will
> apply if approved.
> 
> -- 
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> --- You are receiving this mail because: ---
> You reported the bug.

-- 
Daniel Richard G. || sk...@iskunk.org
My ASCII-art .sig got a bad case of Times New Roman.
Index: gcc/opt-functions.awk
===
--- gcc/opt-functions.awk	(revision 194916)
+++ gcc/opt-functions.awk	(working copy)
@@ -62,9 +62,9 @@
 	if (flags !~ " " name "\\(")
 		return ""
 	sub(".* " name "\\(", "", flags)
-	if (flags ~ "^{")
+	if (flags ~ "^\{")
 	{
-		sub ("^{", "", flags)
+		sub ("^\{", "", flags)
 		sub("}\\).*", "", flags)
 	}
 	else


Re: [PATCH, dataflow]: Fix PR55845, 454.calculix miscompares on x86 AVX due to movement of vzeroupper

2013-01-06 Thread Eric Botcazou
> BTW, can't UNSPEC_VOLATILE be embedded deeply in the pattern?
> So volatile_insn_p (insn) && asm_noperands (PATTERN (insn)) == -1?
> But perhaps you want to treat that way only UNSPEC_VOLATILE directly in the
> pattern and all other UNSPEC_VOLATILE insns must describe in detail what
> exactly they are changing?  This really needs to be better documented.

Yes, I think that we should document that UNSPEC_Vs are full optimization 
barriers so the existing blockage insn of all ports are really blockage.
That's already what is implemented and seems non-controversial (unlike the 
volatile asms).  Something like:

Index: rtl.def
===
--- rtl.def (revision 194946)
+++ rtl.def (working copy)
@@ -213,7 +213,9 @@ DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands
*/
 DEF_RTL_EXPR(UNSPEC, "unspec", "Ei", RTX_EXTRA)
 
-/* Similar, but a volatile operation and one which may trap.  */
+/* Similar, but a volatile operation and one which may trap.  Moreover, it's 
a
+   full optimization barrier, i.e. no instructions may be moved and no 
register
+   (hard or pseudo) or memory equivalences may be used across it.  */
 DEF_RTL_EXPR(UNSPEC_VOLATILE, "unspec_volatile", "Ei", RTX_EXTRA)
 
 /* Vector of addresses, stored as full words.  */

I'd also propose that blockage insns always be UNSPEC_Vs (that's already the 
case in practice, but the manual also lists volatile asms).

And I'm somewhat dubious about the distinction between toplevel and embedded 
UNSPEC_Vs in a pattern; IMO, that shouldn't make any difference.

-- 
Eric Botcazou


Re: [patch, Fortran] PR 55806 - Inefficient ANY with array constructors

2013-01-06 Thread Thomas Koenig

Ping?


http://gcc.gnu.org/ml/fortran/2013-01/msg0.html


Hello world,

the attached patch replaces ANY(a, b, c) with a .or. b .or c,
leading to reduced execution time.  It also handles ALL, PRODUCT
and SUM.

This fixes a bug noted by Michael Metcalf.

Regression-tested.  OK for trunk?




Re: [PATCH, dataflow]: Fix PR55845, 454.calculix miscompares on x86 AVX due to movement of vzeroupper

2013-01-06 Thread Jakub Jelinek
On Sun, Jan 06, 2013 at 04:48:03PM +0100, Uros Bizjak wrote:
> --- df-problems.c (revision 194945)
> +++ df-problems.c (working copy)
> @@ -3916,6 +3916,10 @@ can_move_insns_across (rtx from, rtx to, rtx acros
>   break;
>if (NONDEBUG_INSN_P (insn))
>   {
> +   /* Do not move unspec_volatile insns.  */
> +   if (GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE)
> + break;
> +

Shouldn't UNSPEC_VOLATILE be handled similarly in the across_from ..
across_to loop?  Both UNSPEC_VOLATILE and volatile asm are handled there
just with
trapping_insns_in_across |= may_trap_p (PATTERN (insn));
but your new change doesn't prevent moving just trapping insns across
UNSPEC_VOLATILE, but any insns whatsoever.  So supposedly for UNSPEC_VOLATILE
the first loop should just return false; (or fail = 1; ?).
For asm volatile I guess the code is fine as is, it must always describe
what exactly it modifies, so supposedly non-trapping insns can be moved
across asm volatile.

> if (may_trap_or_fault_p (PATTERN (insn))
> && (trapping_insns_in_across || other_branch_live != NULL))
>   break;

You could do the check only for may_trap_or_fault_p, all UNSPEC_VOLATILE
may trap.

BTW, can't UNSPEC_VOLATILE be embedded deeply in the pattern?
So volatile_insn_p (insn) && asm_noperands (PATTERN (insn)) == -1?
But perhaps you want to treat that way only UNSPEC_VOLATILE directly in the
pattern and all other UNSPEC_VOLATILE insns must describe in detail what
exactly they are changing?  This really needs to be better documented.

Jakub


Re: [Patch, fortran] PR fortran/42769 typebound call resolved incorrectly.

2013-01-06 Thread Mikael Morin

Le 06/01/2013 13:06, Thomas Koenig a écrit :

Am 06.01.2013 12:45, schrieb Janus Weil:

I think your patch is indeed ok for trunk.

Thanks, applied as revision 194949.


4.7?
4.6?

Since it's not a regression, it does not necessarily need to be
backported. However, the sort of wrong-code behavior seen in comment
#24 is severe enough that it might justify backporting. I leave that
up to you.


FWITW, I think it should be backported to 4.7 at least.


I will backport to both.

Mikael


[PATCH, dataflow]: Fix PR55845, 454.calculix miscompares on x86 AVX due to movement of vzeroupper

2013-01-06 Thread Uros Bizjak
Hello!

Attached patch fixes runtime comparison failure of 454.calculix due to
wrong movement of vzeroupper in jump2 pass. It turns out, that
can_move_insns_accross function does not special-case
unspec_volatiles, so vzeroupper is allowed to pass various 256bit avx
instructions.

The patch rejects moves of unspec_volatile insns in can_move_insn_accross.

2012-01-06  Uros Bizjak  

PR rtl-optimization/55845
* df-problems.c (can_move_insns_across): Stop scanning at
unspec_volatile source instruction.

2012-01-06  Uros Bizjak  
Vladimir Yakovlev  

PR rtl-optimization/55845
* gcc.target/i386/pr55845.c: New test.

Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32} AVX target.

OK for mainline and 4.7 branch?

Uros.
Index: df-problems.c
===
--- df-problems.c   (revision 194945)
+++ df-problems.c   (working copy)
@@ -3916,6 +3916,10 @@ can_move_insns_across (rtx from, rtx to, rtx acros
break;
   if (NONDEBUG_INSN_P (insn))
{
+ /* Do not move unspec_volatile insns.  */
+ if (GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE)
+   break;
+
  if (may_trap_or_fault_p (PATTERN (insn))
  && (trapping_insns_in_across || other_branch_live != NULL))
break;
Index: testsuite/gcc.target/i386/pr55845.c
===
--- testsuite/gcc.target/i386/pr55845.c (revision 0)
+++ testsuite/gcc.target/i386/pr55845.c (working copy)
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O3 -ffast-math -fschedule-insns -mavx -mvzeroupper" } */
+
+#include "avx-check.h"
+
+#define N 100
+
+double
+__attribute__((noinline))
+foo (int size, double y[], double x[])
+{
+  double sum = 0.0;
+  int i;
+  for (i = 0, sum = 0.; i < size; i++)
+sum += y[i] * x[i];
+  return (sum);
+}
+
+static void
+__attribute__ ((noinline))
+avx_test ()
+{
+  double x[N];
+  double y[N];
+  double s;
+  int i;
+
+  for (i = 0; i < N; i++)
+{
+  x[i] = i;
+  y[i] = i;
+}
+
+  s = foo (N, y, x);
+
+  if (s != 328350.0)
+abort ();
+}


[Patch, Fortran] PR55763 - reject "type is(INTEGER)" with non-class(*) selector in SELECT TYPE

2013-01-06 Thread Tobias Burnus

A rather obvious fix, though one can think about the error wording.

Bootstrapped and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2012-01-06  Tobias Burnus  

	PR fortran/55763
	* resolve.c (resolve_select_type): Reject intrinsic types for
	a non-unlimited-polymorphic selector.

2012-01-06  Tobias Burnus  

	PR fortran/55763
	* gfortran.dg/select_type_32.f90: New.

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 54ac3c6..a3f0485 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8388,12 +8388,16 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
 	}
 
   /* Check F03:C816.  */
-  if ((c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS)
-	  && !selector_type->attr.unlimited_polymorphic
-	  && !gfc_type_is_extension_of (selector_type, c->ts.u.derived))
+  if (c->ts.type != BT_UNKNOWN && !selector_type->attr.unlimited_polymorphic
+	  && ((c->ts.type != BT_DERIVED && c->ts.type != BT_CLASS)
+	  || !gfc_type_is_extension_of (selector_type, c->ts.u.derived)))
 	{
-	  gfc_error ("Derived type '%s' at %L must be an extension of '%s'",
-		 c->ts.u.derived->name, &c->where, selector_type->name);
+	  if (c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS)
+	gfc_error ("Derived type '%s' at %L must be an extension of '%s'",
+		   c->ts.u.derived->name, &c->where, selector_type->name);
+	  else
+	gfc_error ("Unexpected intrinsic type '%s' at %L",
+		   gfc_basic_typename (c->ts.type), &c->where);
 	  error++;
 	  continue;
 	}
diff --git a/gcc/testsuite/gfortran.dg/select_type_32.f90 b/gcc/testsuite/gfortran.dg/select_type_32.f90
new file mode 100644
index 000..5e36639
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/select_type_32.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR fortran/55763
+!
+! Contributed by Harald Anlauf
+!
+
+module gfcbug122
+  implicit none
+  type myobj
+ class(*), allocatable :: x
+   contains
+ procedure :: print
+  end type myobj
+contains
+  subroutine print(this)
+class(myobj) :: this
+select type (this)
+type is (integer) ! { dg-error "Unexpected intrinsic type 'INTEGER'" }
+type is (real) ! { dg-error "Unexpected intrinsic type 'REAL'" }
+type is (complex) ! { dg-error "Unexpected intrinsic type 'COMPLEX'" }
+type is (character(len=*)) ! { dg-error "Unexpected intrinsic type 'CHARACTER'" }
+end select
+  end subroutine print
+end module gfcbug122


Re: [Patch, Fortran] PR55763 - improve init-data checks for pointers

2013-01-06 Thread Tobias Burnus

Early * ping*
http://gcc.gnu.org/ml/fortran/2013-01/msg00025.html


On January 4, 2013, Tobias Burnus wrote:

Fortran 2008 allows:
   integer :: pointer => init_data
and
  type t
 integer :: pointer => init_data
  end type t

The current check in gfc_check_assign_symbol was only called for 
former and for constructors, but not for the type definition. 
Additionally, BT_CLASS wasn't handled. I also improved the error 
location.




The patch has a downside: One gets some messages twice or trice: Once 
for resolving the type declaration ("type t") and then for resolving 
the default initialization via

   gfc_traverse_ns (ns, resolve_values);

Currently, that's unavoidable as one cannot trivially distinguish 
between a user-supplied "sym->value" and the default constructor. If 
you think that this is a problem, one can change it, e.g. by setting a 
sym->attr.value_is_default_init.



Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias

PS: For CLASS pointers, there will be an ICE if one tries to associate 
a variable to them; that's unchanged by this patch.




Re: [Patch, fortran] Fix PR53876 (regression), PR55990 (regression) and PR55992

2013-01-06 Thread Tobias Burnus

Paul Richard Thomas wrote:

Boostratpped and regtested on FC17/x86_64 - OK for trunk?


OK - with the below nits fixed.  Thanks for the patch.



 PR fortran/PR53876
 PR fortran/PR55990
 PR fortran/PR55992


Change 55* into 54*.



 PR fortran/PR53876
 PR fortran/PR55990
 PR fortran/PR55992


Ditto.


+   /* Ensure that the CLASS langauge specific flag is set.  */


s/langauge/language/


+ ! { dg-do run}


s/run}/run }/

Without the " " before the right curly brace, DejaGNU will ignore the 
line and handle it as "dg-do compile". Please check after that change 
that the test case doesn't fail at run time.


Tobias


Re: [committed, libstdc++] Fix a couple of copyright typos

2013-01-06 Thread Paolo Carlini
>As per the subject, although I'd love to hear about this imaginary
>2010. :-)

Well, in physics imaginary time is a pretty useful abstraction, eg, you can 
easily switch between statistical mechanics and quantum field theory in 
interesting calculations :-)

Paolo



[Patch, fortran] Fix PR53876 (regression), PR55990 (regression) and PR55992

2013-01-06 Thread Paul Richard Thomas
Dear All,

These PRs all have a similar or identical cause. GFC_CLASS_TYPE_P was
not being set and/or pointer references were not being cast correctly.
 The fundamental fix is in trans_types.c(gfc_get_derived_type), where
the flag is now explicitly set for field_type, thereby ensuring that
no matter what gfc_build_array_type does with the type, the component
is correctly marked.  A partial fix had been to check the
TYPE_CANONICAL in trans-expr.c (gfc_get_vptr_from_expr) and
trans-array.c (build_array_ref).  I have left these checks in place,
just in case any unmarked types get through by different routes.

The testcase is an amalgam of the three contributed testcases,
developed to make certain that the correct dynamic type is being
picked up and that pointer arithmetic is correctly done to access
array elements.

Boostratpped and regtested on FC17/x86_64 - OK for trunk?


Paul

2013-01-06  Paul Thomas  

PR fortran/PR53876
PR fortran/PR55990
PR fortran/PR55992
* trans-array.c (build_array_ref): Check the TYPE_CANONICAL
to see if it is GFC_CLASS_TYPE_P.
* trans-expr.c (gfc_get_vptr_from_expr): The same.
(gfc_conv_class_to_class): If the types are not the same,
cast parmese->expr to the type of ctree.
* trans-types.c (gfc_get_derived_type): GFC_CLASS_TYPE_P of
CLASS components must be set.

2013-01-06  Paul Thomas  

PR fortran/PR53876
PR fortran/PR55990
PR fortran/PR55992
* gfortran.dg/class_array_15.f03: New test.


submit.diff
Description: Binary data


[Patch, Fortran, committed] PR54678 - don't use an uninitialized variable

2013-01-06 Thread Tobias Burnus

Committed as obvious (Rev. 194948) - with Thomas' approval in the PR.

Tobias
Index: libgfortran/ChangeLog
===
--- libgfortran/ChangeLog	(Revision 194947)
+++ libgfortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2013-01-06  Tobias Burnus  
+
+	PR fortran/54678
+	* intrinsics/env.c (get_environment_variable_i8): Don't use
+	uninitialized variable.
+
 2013-01-02  Jerry DeLisle  
 
 	PR libfortran/55818
Index: libgfortran/intrinsics/env.c
===
--- libgfortran/intrinsics/env.c	(Revision 194947)
+++ libgfortran/intrinsics/env.c	(Arbeitskopie)
@@ -185,7 +185,8 @@ get_environment_variable_i8 (char *name, char *val
 trim_name4 = *trim_name;
 
   get_environment_variable_i4 (name, value, &length4, &status4, 
-			   &trim_name4, name_len, value_len);
+			   trim_name ? &trim_name4 : NULL,
+			   name_len, value_len);
 
   if (length)
 *length = length4;


Re: [committed] 2011 and 2012 Copyright year updates

2013-01-06 Thread Jakub Jelinek
On Sun, Jan 06, 2013 at 12:13:32PM +, Richard Sandiford wrote:
> I never remember to update the copyright years, so I thought I'd have a go.
> And you were right of course.  It ended up being a huge time sink.
> 
> Anyway, here's my attempt a script to convert to ranges and, if enabled,
> to include the current year.  The script only updates FSF copyright notices
> and leaves others alone.  I've tried my best to make sure that licences
> and imported FSF sources aren't touched, but I could have missed some cases.

Looks reasonable to me, though I'd like to hear richi's and Joseph's
opinion too.

I've noticed a minor nit:
--- gcc.orig/gcc/testsuite/gcc.misc-tests/linkage.exp   
   
+++ gcc/gcc/testsuite/gcc.misc-tests/linkage.exp
   
@@ -1,5 +1,4 @@ 
   
-# Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010,
-# 2011,  
-# 2012 Free Software Foundation, Inc.  
   
+# Copyright (C) 90-2012 Free Software Foundation, Inc. 
   

That should have been presumably 1988-2012, haven't looked at other similar
cases.  As for updating to -2013, I think it isn't appropriate for all
files, e.g. I'd leave ChangeLog* and various README* files to keep their
finish date as is, say ChangeLog.2003 can be just Copyright (c) 2003,
doesn't need to be 2003-2013.  Perhaps just automatically add -2013 to gcc
(except gcc/testsuite) *.[ch], *.md, *.def, *.opt files or so, plus
gcc/testsuite *.exp files?  E.g. testsuite *.c/*.C files that are Copyright
2004 don't need to be -2013?

Also, just a remainder, any Copyright line change in libstdc++-v3/include
might potentially require adjustments to libstdc++-v3/testsuite/, because
various tests have header line numbers hardcoded in them.

Jakub


Re: [Ada] Remove dead code in elaborate_entity

2013-01-06 Thread Eric Botcazou
> Tested on x86_64-suse-linux, applied on mainline and 4.7 branch.

Pasto: applied on mainline only.

-- 
Eric Botcazou


[Ada] Refine diagnostics on size or position mistakes in component rep clause

2013-01-06 Thread Eric Botcazou
Atomic or Volatile components must occupy their "natural" size and position
in records, with allocated room and alignment matching what the component type
calls for in absence of a rep clause for the component.

There was a dissimetry in the gigi code checking for this, with
- the checks on position featuring a single case for volatile covering
 atomic as well, and a gcc_unreachable() at the end.
- the checks on size featuring a case for atomic only, missing the
 lone-volatile case and not having a gcc_unreachable() at the end.

The change introduced here improves this code to have the size
and position checks match each other, adding the missing case and
the gcc_unreachable() to the size checks, and splitting the volatile
case into two more precise checks for position.

Tested on x86_64-suse-linux, applied on mainline.


2013-01-06  Olivier Hainque  

* gcc-interface/decl.c (gnat_to_gnu_field): Emit a specialized
diagnostic for component size mismatch wrt volatile requirements.
Add a gcc_unreachable() at the end of the checks for size.  Split
the check on volatile for positions into one check on atomic and
a subsequent one on volatile.


2013-01-06  Olivier Hainque  

* gnat.dg/specs/clause_on_volatile.ads: New test.


-- 
Eric BotcazouIndex: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 194945)
+++ gcc-interface/decl.c	(working copy)
@@ -6489,10 +6489,11 @@ gnat_to_gnu_field (Entity_Id gnat_field,
 	}
 
   /* If this field needs strict alignment, check that the record is
-	 sufficiently aligned and that position and size are consistent
-	 with the alignment.  But don't do it if we are just annotating
-	 types and the field's type is tagged, since tagged types aren't
-	 fully laid out in this mode.  */
+	 sufficiently aligned and that position and size are consistent with
+	 the alignment.  But don't do it if we are just annotating types and
+	 the field's type is tagged, since tagged types aren't fully laid out
+	 in this mode.  Also, note that atomic implies volatile so the inner
+	 test sequences ordering is significant here.  */
   if (needs_strict_alignment
 	  && !(type_annotate_only && Is_Tagged_Type (gnat_field_type)))
 	{
@@ -6508,6 +6509,12 @@ gnat_to_gnu_field (Entity_Id gnat_field,
 		   Last_Bit (Component_Clause (gnat_field)), gnat_field,
 		   TYPE_SIZE (gnu_field_type));
 
+	  else if (is_volatile)
+		post_error_ne_tree
+		  ("volatile field& must be natural size of type{ (^)}",
+		   Last_Bit (Component_Clause (gnat_field)), gnat_field,
+		   TYPE_SIZE (gnu_field_type));
+
 	  else if (Is_Aliased (gnat_field))
 		post_error_ne_tree
 		  ("size of aliased field& must be ^ bits",
@@ -6520,6 +6527,9 @@ gnat_to_gnu_field (Entity_Id gnat_field,
 		   Last_Bit (Component_Clause (gnat_field)), gnat_field,
 		   TYPE_SIZE (gnu_field_type));
 
+  else
+		gcc_unreachable ();
+
 	  gnu_size = NULL_TREE;
 	}
 
@@ -6527,7 +6537,13 @@ gnat_to_gnu_field (Entity_Id gnat_field,
 			  (TRUNC_MOD_EXPR, gnu_pos,
 			   bitsize_int (TYPE_ALIGN (gnu_field_type)
 	{
-	  if (is_volatile)
+	  if (Is_Atomic (gnat_field) || Is_Atomic (gnat_field_type))
+		post_error_ne_num
+		  ("position of atomic field& must be multiple of ^ bits",
+		   First_Bit (Component_Clause (gnat_field)), gnat_field,
+		   TYPE_ALIGN (gnu_field_type));
+
+  else if (is_volatile)
 		post_error_ne_num
 		  ("position of volatile field& must be multiple of ^ bits",
 		   First_Bit (Component_Clause (gnat_field)), gnat_field,-- { dg-do compile }

package Clause_On_Volatile is

  type U8 is mod 2 ** 8;

  type Word is record
 A, B : U8;
  end record;
  For Word'Alignment use 4;

  type Vword is new Word;
  For Vword'Alignment use 4;
  pragma Volatile (Vword);

  type Aword is new Word;
  For Aword'Alignment use 4;
  pragma Atomic (Aword);

  type R1 is record
 W : Word;
  end record;
  for R1 use record
 W at 0 range 0 .. 15; -- OK, packing regular
  end record;

  type A1 is record
 AW : Aword;
  end record;
  For A1'Alignment use 4;
  for A1 use record
 AW at 0 range 0 .. 15; -- { dg-error "must be natural size" }
  end record;

  type A2 is record
 B : U8;
 AW : Aword;
  end record;
  For A2'Alignment use 4;
  for A2 use record
 B at 0 range 0 .. 7;
 AW at 1 range 0 .. 31; -- { dg-error "must be multiple" }
  end record;

  type A3 is record
 B : U8;
 AW : Aword;
  end record;
  For A3'Alignment use 4;
  for A3 use record
 B at 0 range 0 .. 7;
 AW at 1 range 0 .. 15; -- { dg-error "must be (multiple|natural size)" }
  end record;

  --

  type V1 is record
 VW : Vword;
  end record;
  For V1'Alignment use 4;
  for V1 use record
 VW at 0 range 0 .. 15; -- { dg-error "must be natural size" }
  end record;

  type V2 is record
 B : U8;
 VW : Vword;
  end record;
  For V2'Alignment u

[Ada] Remove dead code in elaborate_entity

2013-01-06 Thread Eric Botcazou
Tested on x86_64-suse-linux, applied on mainline and 4.7 branch.


2013-01-06  Eric Botcazou  

* gcc-interface/decl.c (elaborate_entity) : Delete.


-- 
Eric BotcazouIndex: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 194942)
+++ gcc-interface/decl.c	(working copy)
@@ -5944,18 +5944,6 @@ elaborate_entity (Entity_Id gnat_entity)
   break;
   }
 
-case E_Record_Type:
-  {
-	Node_Id full_definition = Declaration_Node (gnat_entity);
-	Node_Id record_definition = Type_Definition (full_definition);
-
-	/* If this is a record extension, go a level further to find the
-	   record definition.  */
-	if (Nkind (record_definition) == N_Derived_Type_Definition)
-	  record_definition = Record_Extension_Part (record_definition);
-  }
-  break;
-
 case E_Record_Subtype:
 case E_Private_Subtype:
 case E_Limited_Private_Subtype:


Re: [Patch, fortran] PR fortran/42769 typebound call resolved incorrectly.

2013-01-06 Thread Thomas Koenig

Am 06.01.2013 12:45, schrieb Janus Weil:

Since it's not a regression, it does not necessarily need to be
backported. However, the sort of wrong-code behavior seen in comment
#24 is severe enough that it might justify backporting. I leave that
up to you.


FWITW, I think it should be backported to 4.7 at least.

Thomas


[Ada] Fix layout of misaligned integer subtypes on big-endian

2013-01-06 Thread Eric Botcazou
This is a regression present on mainline and 4.7 branch, exposed by a recent 
change in the propagation of alignment from types to subtypes.  The layout of 
misaligned integer subtypes is incorrect on big-endian platforms (it is left 
justified instead of being right justified).

Fixed thusly, tested on x86_64-suse-linux, applied on mainline and 4.7 branch.


2013-01-06  Eric Botcazou  

* gcc-interface/decl.c (gnat_to_gnu_entity) : Do not
pack the field of the record type made for a misaligned type.


2013-01-06  Eric Botcazou  

* gnat.dg/alignment10.adb: New test.


-- 
Eric BotcazouIndex: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 194939)
+++ gcc-interface/decl.c	(working copy)
@@ -1887,8 +1887,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	}
 
   /* If the type we are dealing with has got a smaller alignment than the
-	 natural one, we need to wrap it up in a record type and under-align
-	 the latter.  We reuse the padding machinery for this purpose.  */
+	 natural one, we need to wrap it up in a record type and misalign the
+	 latter; we reuse the padding machinery for this purpose.  Note that,
+	 even if the record type is marked as packed because of misalignment,
+	 we don't pack the field so as to give it the size of the type.  */
   else if (align > 0)
 	{
 	  tree gnu_field_type, gnu_field;
@@ -1918,7 +1920,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	 a bitfield.  */
 	  gnu_field
 	= create_field_decl (get_identifier ("F"), gnu_field_type,
- gnu_type, NULL_TREE, bitsize_zero_node, 1, 0);
+ gnu_type, TYPE_SIZE (gnu_field_type),
+ bitsize_zero_node, 0, 0);
 
 	  finish_record_type (gnu_type, gnu_field, 2, debug_info_p);
 	  compute_record_mode (gnu_type);
-- { dg-do run }

procedure Alignment10 is

   type Short_T is mod 2 ** 16;
   for Short_T'Size use 16;
   for Short_T'Alignment use 1;

   subtype Short_Sub_T is Short_T range 1000 .. 1005;

   A : aliased Short_T := 1000;
   B : Short_Sub_T;
   for B'Address use A'Address;
   pragma Import (Ada, B);

begin
  if B /= 1000 then
raise Program_Error;
  end if;
end;


[committed, libstdc++] Fix a couple of copyright typos

2013-01-06 Thread Richard Sandiford
As per the subject, although I'd love to hear about this imaginary 2010. :-)

Committed as obvious.

Richard


libstdc++-v3/
* include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp: Fix typo
in copyright years.
* testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc: Likewise.

Index: libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
===
--- libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
2013-01-06 11:36:11.918659461 +
+++ libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
2013-01-06 11:38:01.933408174 +
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009, 2010i, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010, 2011 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
Index: libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc
===
--- libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc  
2013-01-06 11:36:11.918659461 +
+++ libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/3.cc  
2013-01-06 11:38:01.934408183 +
@@ -1,6 +1,6 @@
 // 2001-09-21 Benjamin Kosnik  
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009'
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
 // Free Software Foundation
 //
 // This file is part of the GNU ISO C++ Library.  This library is free


RFA: Add missing copyright holders

2013-01-06 Thread Richard Sandiford
I noticed three files are missing a copyright holder.  Since claims of
copyright ownership never feel obvious: OK to install?

Richard


gcc/
* file-find.c, file-find.h, realmpfr.c: Add FSF as copyright holder.

Index: gcc/file-find.c
===
--- gcc/file-find.c 2013-01-06 11:36:13.0 +
+++ gcc/file-find.c 2013-01-06 11:37:45.131294794 +
@@ -1,6 +1,7 @@
 /* Utility functions for finding files relative to GCC binaries.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
Index: gcc/file-find.h
===
--- gcc/file-find.h 2013-01-06 11:36:13.0 +
+++ gcc/file-find.h 2013-01-06 11:37:45.132294802 +
@@ -2,6 +2,7 @@
finding files relative to GCC binaries.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
Index: gcc/realmpfr.c
===
--- gcc/realmpfr.c  2013-01-06 11:36:13.0 +
+++ gcc/realmpfr.c  2013-01-06 11:37:45.132294802 +
@@ -1,5 +1,5 @@
 /* Conversion routines from GCC internal float representation to MPFR.
-   Copyright (C) 2010
+   Copyright (C) 2010 Free Software Foundation, Inc.
 
This file is part of GCC.
 


Tweak config/tilepro/gen-mul-tables.cc copyright

2013-01-06 Thread Richard Sandiford
As minor as minor can be, but: put the config/tilepro/gen-mul-tables.cc
copyright on a single line so that scripts can more easily update the
printf() line.

This is a trivial change, so I don't think 2013 needs to be added.

Committed as obvious (I hope).

Richard


gcc/
* config/tilepro/gen-mul-tables.cc: Put copyright on one line.

Index: gcc/config/tilepro/gen-mul-tables.cc
===
--- gcc/config/tilepro/gen-mul-tables.cc2013-01-06 11:36:13.108667529 
+
+++ gcc/config/tilepro/gen-mul-tables.cc2013-01-06 11:37:04.722018282 
+
@@ -1,6 +1,5 @@
 /* Multiply table generator for tile.
-   Copyright (C) 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
Contributed by Walter Lee (w...@tilera.com)
 
This file is part of GCC.
@@ -1231,8 +1230,7 @@ main ()
 #else
   printf ("/* Constant multiply table for TILE-Gx.\n");
 #endif
-  printf ("   Copyright (C) 2011, 2012\n");
-  printf ("   Free Software Foundation, Inc.\n");
+  printf ("   Copyright (C) 2011, 2012 Free Software Foundation, Inc.\n");
   printf ("   Contributed by Walter Lee (w...@tilera.com)\n");
   printf ("\n");
   printf ("   This file is part of GCC.\n");


Re: [Patch, fortran] PR fortran/42769 typebound call resolved incorrectly.

2013-01-06 Thread Janus Weil
Hi Mikael,

> here is a fix for PR42769, where a type bound call was resolved statically
> into a normal procedure call, but using the local procedure (with the same
> name) instead of the original (and correct) one.
> It turned out to not be OOP specific, and be a pure module loading problem
> in the way we associate a symbol number in the module file with the
> corresponding symbol pointer once module is loaded.
>
> The first module.c hunk fixes comment #14 in the PR. Here, p == NULL, which
> means that the user didn't ask to load the symbol (USE,ONLY:...), so we can
> just continue to the next one.  However, as an optimization, we try to find
> the symbol in the current name space and associate the pointer info (mapping
> module's integer <-> symbol pointer) with it if found to avoid reloading it
> from the module file if needed.
> The problem was there was no check that the symbol is really the same, not
> another symbol with the same name.  Fixed by checking symbol's name and
> module name too.  The original code was only reusing the symtree; I took the
> opportunity to reuse the symbol as well, and the test suite didn't complain
> :-).
>
> The second module.c hunk fixes comment #24 in the PR.  Here, p != NULL: the
> symbol will have to be loaded.  Before creating a new symbol and a new
> symtree and inserting them in the current name space, we check whether a
> symtree of the same name exists in the current name space. If it exists and
> is not ambiguous, it is either the same one as the one from the module, or
> both are generic so we can reuse the existing symbol in both cases.
> However, if the symtree in the name space is ambiguous we shall not reuse it
> as it is different than the one to be loaded. Thus fixed by not reusing it
> in that case, and letting a unique non ambiguous name being automatically
> generated later.
>
> The resolve.c hunk fixes comment #34 in the PR.  This one is not a module
> problem, but let's fix all cases in one go.  Resolve_call reloads the call's
> procedure symbol to take into account contained procedure which were not
> known at parse time.  However, it uses the symbol's name (original name) for
> lookup instead of the symtree's (local name).  The resolve.c hunk changes
> that.
>
> The tests are adapted from comment 14, 24, 34 from pr42769, and the original
> test cases from pr45836 and pr45900.
> Regression tested on x86_64-unknown-linux-gnu. OK for trunk?

thanks for taking care of this rather long-standing bug. I was
convinced that it is a module-loading problem, but couldn't really
nail it down.

I think your patch is indeed ok for trunk.


> 4.7?
> 4.6?

Since it's not a regression, it does not necessarily need to be
backported. However, the sort of wrong-code behavior seen in comment
#24 is severe enough that it might justify backporting. I leave that
up to you.

Cheers,
Janus


[Ada] Fix glitch in -gnatR output

2013-01-06 Thread Eric Botcazou
When the discriminant of a record type comes from a parent type, the size of 
the type isn't properly displayed in the -gnatR output.

Fixed thusly, tested on x86_64-suse-linux, applied on mainline.


2013-01-06  Eric Botcazou  

* gcc-interface/decl.c (annotate_value) : Be prepared
for discriminants inherited from parent record types.


-- 
Eric BotcazouIndex: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 194926)
+++ gcc-interface/decl.c	(working copy)
@@ -4965,7 +4965,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	}
 	}
 
-  /* If this is a record type or subtype, call elaborate_expression_1 on
+  /* If this is a record type or subtype, call elaborate_expression_2 on
 	 any field position.  Do this for both global and local types.
 	 Skip any fields that we haven't made trees for to avoid problems with
 	 class wide types.  */
@@ -7286,15 +7286,22 @@ annotate_value (tree gnu_size)
 
 case COMPONENT_REF:
   /* The only case we handle here is a simple discriminant reference.  */
-  if (TREE_CODE (TREE_OPERAND (gnu_size, 0)) == PLACEHOLDER_EXPR
-	  && TREE_CODE (TREE_OPERAND (gnu_size, 1)) == FIELD_DECL
-	  && DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1)))
-	return Create_Node (Discrim_Val,
-			annotate_value (DECL_DISCRIMINANT_NUMBER
-	(TREE_OPERAND (gnu_size, 1))),
-			No_Uint, No_Uint);
-  else
-	return No_Uint;
+  if (DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1)))
+	{
+	  tree n = DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1));
+
+	  /* Climb up the chain of successive extensions, if any.  */
+	  while (TREE_CODE (TREE_OPERAND (gnu_size, 0)) == COMPONENT_REF
+		 && DECL_NAME (TREE_OPERAND (TREE_OPERAND (gnu_size, 0), 1))
+		== parent_name_id)
+	gnu_size = TREE_OPERAND (gnu_size, 0);
+
+	  if (TREE_CODE (TREE_OPERAND (gnu_size, 0)) == PLACEHOLDER_EXPR)
+	return
+	  Create_Node (Discrim_Val, annotate_value (n), No_Uint, No_Uint);
+	}
+
+  return No_Uint;
 
 CASE_CONVERT:   case NON_LVALUE_EXPR:
   return annotate_value (TREE_OPERAND (gnu_size, 0));


Re: [cxx-conversion] Change uses of htab_t in gcc/config to hash_table.

2013-01-06 Thread Richard Biener
On Sun, Jan 6, 2013 at 6:55 AM, Xinliang David Li  wrote:
> I noticed that the traverse and traverse_noresize method takes
> Argument as the first template parameter. It should be moved to be the
> second after the callback. In most of the cases, the type of the
> Argument can be deduced from the callsite, so that the user only need
> to specify the callback:
>
> ht->traverse_noresize(&arg);
>
> In the current way, user has to do this:
>
> ht->traverse_noresize (&arg);
>
> which is not as friendly.

Agreed.

> David
>
>
> On Tue, Dec 18, 2012 at 8:02 PM, Lawrence Crowl  wrote:
>> Update various config htab_t uses to hash_table.
>>
>> Modify types and calls to match.
>>
>> * config/arm/arm.c'arm_libcall_uses_aapcs_base::libcall_htab
>>
>> Fold libcall_eq and libcall_hash into new struct libcall_hasher.
>>
>> * config/ia64/ia64.c'bundle_state_table
>>
>> Fold bundle_state_hash and bundle_state_eq_p into new struct
>> bundle_state_hasher.
>>
>> * config/mips/mips.c'mips_offset_table
>>
>> Fold mips_lo_sum_offset_hash and mips_lo_sum_offset_eq into new
>> struct mips_lo_sum_offset_hasher.
>>
>> In mips_reorg_process_insns, change call to for_each_rtx to pass
>> a pointer to the hash_table rather than a htab_t.  This change
>> requires then dereferencing that pointer in mips_record_lo_sum to
>> obtain the hash_table.
>>
>> * config/sol2.c'solaris_comdat_htab
>>
>> Fold comdat_hash and comdat_eq into new struct comdat_entry_hasher.
>>
>> * config/i386/winnt.c'i386_pe_section_type_flags::htab
>>
>> * config/i386/winnt.c'i386_find_on_wrapper_list::wrappers
>>
>> Fold wrapper_strcmp into new struct wrapped_symbol_hasher.
>>
>>
>> Tested on x86-64.
>> Tested with contrib/config-list.mk.
>>
>>
>> Okay for branch?
>>
>>
>> Index: gcc/config/arm/arm.c
>> ===
>> --- gcc/config/arm/arm.c(revision 194511)
>> +++ gcc/config/arm/arm.c(working copy)
>> @@ -25,6 +25,7 @@
>>  #include "config.h"
>>  #include "system.h"
>>  #include "coretypes.h"
>> +#include "hash-table.h"
>>  #include "tm.h"
>>  #include "rtl.h"
>>  #include "tree.h"
>> @@ -3716,36 +3717,48 @@ arm_function_value(const_tree type, cons
>>return arm_libcall_value_1 (mode);
>>  }
>>
>> -static int
>> -libcall_eq (const void *p1, const void *p2)
>> +/* libcall hashtable helpers.  */
>> +
>> +struct libcall_hasher : typed_noop_remove 
>>  {
>> -  return rtx_equal_p ((const_rtx) p1, (const_rtx) p2);
>> +  typedef rtx_def value_type;
>> +  typedef rtx_def compare_type;
>> +  static inline hashval_t hash (const value_type *);
>> +  static inline bool equal (const value_type *, const compare_type *);
>> +  static inline void remove (value_type *);
>> +};
>> +
>> +inline bool
>> +libcall_hasher::equal (const value_type *p1, const compare_type *p2)
>> +{
>> +  return rtx_equal_p (p1, p2);
>>  }
>>
>> -static hashval_t
>> -libcall_hash (const void *p1)
>> +inline hashval_t
>> +libcall_hasher::hash (const value_type *p1)
>>  {
>> -  return hash_rtx ((const_rtx) p1, VOIDmode, NULL, NULL, FALSE);
>> +  return hash_rtx (p1, VOIDmode, NULL, NULL, FALSE);
>>  }
>>
>> +typedef hash_table  libcall_table_type;
>> +
>>  static void
>> -add_libcall (htab_t htab, rtx libcall)
>> +add_libcall (libcall_table_type htab, rtx libcall)
>>  {
>> -  *htab_find_slot (htab, libcall, INSERT) = libcall;
>> +  *htab.find_slot (libcall, INSERT) = libcall;
>>  }
>>
>>  static bool
>>  arm_libcall_uses_aapcs_base (const_rtx libcall)
>>  {
>>static bool init_done = false;
>> -  static htab_t libcall_htab;
>> +  static libcall_table_type libcall_htab;
>>
>>if (!init_done)
>>  {
>>init_done = true;
>>
>> -  libcall_htab = htab_create (31, libcall_hash, libcall_eq,
>> - NULL);
>> +  libcall_htab.create (31);
>>add_libcall (libcall_htab,
>>convert_optab_libfunc (sfloat_optab, SFmode, SImode));
>>add_libcall (libcall_htab,
>> @@ -3804,7 +3817,7 @@ arm_libcall_uses_aapcs_base (const_rtx l
>> DFmode));
>>  }
>>
>> -  return libcall && htab_find (libcall_htab, libcall) != NULL;
>> +  return libcall && libcall_htab.find (libcall) != NULL;
>>  }
>>
>>  static rtx
>> Index: gcc/config/arm/t-arm
>> ===
>> --- gcc/config/arm/t-arm(revision 194511)
>> +++ gcc/config/arm/t-arm(working copy)
>> @@ -73,8 +73,8 @@ $(srcdir)/config/arm/arm-tables.opt: $(s
>> $(SHELL) $(srcdir)/config/arm/genopt.sh $(srcdir)/config/arm > \
>> $(srcdir)/config/arm/arm-tables.opt
>>
>> -arm.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
>> -  $(RTL_H) $(TREE_H) $(OBSTACK_H) $(REGS_H) hard-reg-set.h \
>> +arm.o: $(srcdir)/config/arm/arm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h 
>> $(TM_H) \
>> +  $(RTL_H) $(TREE_H) $(HASH_TABLE_H) $(OBSTACK_H) $(REGS_H) hard-reg-set.h \
>>insn-config.h conditions.h 

Re: [Patch, libfortran] Improve performance of byte swapped IO

2013-01-06 Thread Richard Biener
On Sat, Jan 5, 2013 at 10:13 PM, Janne Blomqvist
 wrote:
> On Sat, Jan 5, 2013 at 5:35 PM, Richard Biener
>  wrote:
>> On Fri, Jan 4, 2013 at 11:35 PM, Andreas Schwab  
>> wrote:
>>> Janne Blomqvist  writes:
>>>
 diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
 index c8ecc3a..bf2250a 100644
 --- a/libgfortran/io/file_pos.c
 +++ b/libgfortran/io/file_pos.c
 @@ -140,15 +140,21 @@ unformatted_backspace (st_parameter_filepos *fpp, 
 gfc_unit *u)
   }
else
   {
 +   uint32_t u32;
 +   uint64_t u64;
 switch (length)
   {
   case sizeof(GFC_INTEGER_4):
 -   reverse_memcpy (&m4, p, sizeof (m4));
 +   memcpy (&u32, p, sizeof (u32));
 +   u32 = __builtin_bswap32 (u32);
 +   m4 = *(GFC_INTEGER_4*)&u32;
>>>
>>> Isn't that an aliasing violation?
>>
>> It looks like one.  Why not simply do
>>
>>m4 = (GFC_INTEGER_4) u32;
>>
>> ?  I suppose GFC_INTEGER_4 is always the same size as uint32_t but signed?
>
> Yes, GFC_INTEGER_4 is a typedef for int32_t. As for why I didn't do
> the above, C99 6.3.1.3(3) says that if the unsigned value is outside
> the range of the signed variable, the result is
> implementation-defined. Though I suppose the sensible
> "implementation-defined behavior" in this case on a two's complement
> target is to just do a bitwise copy.

As libgfortran is a target library and thus always compiled by GCC you
can rely on GCCs documented implementation-defined behavior here
(which is to do bitwise re-interpretation).  No need to obfuscate the
code more than necessary.

Richard.

> Anyway, to be really safe one could use memcpy instead; the compiler
> optimizes small fixed size memcpy's just fine. Updated patch attached.
>
>
> --
> Janne Blomqvist