Re: [Patch/libiberty] Assume strncmp works in cross compilation

2011-12-20 Thread Tristan Gingold

On Dec 19, 2011, at 7:11 PM, Ian Lance Taylor wrote:

> Tristan Gingold  writes:
> 
>> 2011-12-19  Tristan Gingold  
>> 
>>  * aclocal.m4: Assume strncmp works in cross case.
>>  * configure: Regenerate.
> 
> This is OK.

Thanks, committed.

Tristan.



Re: Unreviewed Ada, libffi patches

2011-12-20 Thread Arnaud Charlet
> The following two patches are necessary to allow a i?86-linux
> --enable-targets=all bootstrap to complete, but have remained
> unreviewed
> for a week:
> 
>   [ada] Support 64-bit libgnat multilib on i?86-linux
>   http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01009.html

This part is OK


[committed] Alpha/VMS: adjust condition to create trampoline entry point

2011-12-20 Thread Tristan Gingold
Hi,

the alpha/vms backend emitted the trampoline entry point too often, as 
functions declared directly within a translation unit weren't considered as 
top-level functions.

Fixed by this patch, applied on trunk.

Tristan.

2011-12-20  Tristan Gingold  

* config/alpha/alpha.c (alpha_start_function): Adjust condition to
create VMS trampoline entry point.

Index: config/alpha/alpha.c
===
--- config/alpha/alpha.c(revision 182519)
+++ config/alpha/alpha.c(working copy)
@@ -7935,7 +7935,8 @@
if (TARGET_ABI_OPEN_VMS
&& !TREE_PUBLIC (decl)
&& DECL_CONTEXT (decl)
-   && !TYPE_P (DECL_CONTEXT (decl)))
+   && !TYPE_P (DECL_CONTEXT (decl))
+   && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)
  {
strcpy (tramp_label, fnname);
strcat (tramp_label, "..tr");



[RFC]: use cgraph to emit alpha vas trampoline entry point

2011-12-20 Thread Tristan Gingold
Hi,

currently alpha/vms backend emits a trampoline entry point for all nested 
functions.  This is a waste of code space, as although nested functions are 
very common in Ada, address of nested functions are only seldom taken.

The fact that the address of a function is taken seems only be available in 
cgraph.  Is it OK to use cgraph in alpha.c ?

Tristan.

diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index e3976ed..4f59fe8 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -7936,9 +7936,14 @@ alpha_start_function (FILE *file, const char *fnname,
   && !TYPE_P (DECL_CONTEXT (decl))
   && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)
 {
-  fprintf (file, "%s..tr:\n", fnname);
-  fprintf (file, "\tldq $1,24($27)\n");
-  fprintf (file, "\tldq $27,16($27)\n");
+  struct cgraph_node *node = cgraph_get_node (decl);
+
+  if (node == NULL || node->address_taken)
+   {
+ fprintf (file, "%s..tr:\n", fnname);
+ fprintf (file, "\tldq $1,24($27)\n");
+ fprintf (file, "\tldq $27,16($27)\n");
+   }
 }
 
   if (TARGET_ABI_OPEN_VMS)



partial fix for libstdc++/51365

2011-12-20 Thread Jonathan Wakely
PR libstdc++/51365
* include/std/tuple (_Tuple_impl): Check __is_final as well as
is_empty.
* testsuite/20_util/tuple/51365.cc: New.

This uses __is_final for std::tuple, it still needs to be used for
containers, shared_ptr and futures.

Tested x86_64-linux, committed to trunk.
Index: include/std/tuple
===
--- include/std/tuple   (revision 182460)
+++ include/std/tuple   (working copy)
@@ -69,7 +69,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 struct __add_r_ref<_Tp&>
 { typedef _Tp& type; };
 
-  template
+  template
 struct _Head_base;
 
   template
@@ -201,6 +201,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   void _M_swap(_Tuple_impl&) noexcept { /* no-op */ }
 };
 
+  // Use the Empty Base-class Optimization for empty, non-final types.
+  template
+using __empty_not_final
+  = typename conditional<__is_final(_Tp), false_type, is_empty<_Tp>>::type;
+
   /**
* Recursive tuple implementation. Here we store the @c Head element
* and derive from a @c Tuple_impl containing the remaining elements
@@ -209,12 +214,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template
 struct _Tuple_impl<_Idx, _Head, _Tail...>
 : public _Tuple_impl<_Idx + 1, _Tail...>,
-  private _Head_base<_Idx, _Head, std::is_empty<_Head>::value>
+  private _Head_base<_Idx, _Head, __empty_not_final<_Head>::value>
 {
   template friend class _Tuple_impl;
 
   typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
-  typedef _Head_base<_Idx, _Head, std::is_empty<_Head>::value> _Base;
+  typedef _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> _Base;
 
   static constexpr _Head&  
   _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
Index: testsuite/20_util/tuple/51365.cc
===
--- testsuite/20_util/tuple/51365.cc(revision 0)
+++ testsuite/20_util/tuple/51365.cc(revision 0)
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 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 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 
+
+// libstdc++/51365
+
+struct F final { };
+std::tuple t;
+


Re: [PATCH] PR51280 LTO/trans-mem ICE with TM builtins

2011-12-20 Thread Richard Guenther
On Mon, 19 Dec 2011, Patrick Marlier wrote:

> On 12/16/2011 03:54 AM, Richard Guenther wrote:
> > On Thu, 15 Dec 2011, Patrick Marlier wrote:
> > 
> > > In PR51280, LTO does ICE because the object file uses TM builtin but the
> > > TM is
> > > not enabled.
> > > In the patch, it displays a error message if the builtin is not defined
> > > and
> > > due to TM.
> > > I moved is_tm_builtin() from calls.c to trans-mem.c. I splitted it into 2
> > > functions is_tm_builtin/is_tm_builtin_code. In is_tm_builtin_code, I added
> > > some missing builtins (TM_START, TM_GETTMCLONE_SAFE, TM_MALLOC, TM_CALLOC,
> > > TM_FREE). Finally, I declared them into tree.h to be usable in calls.c and
> > > tree-streamer-in.c.
> > > 
> > > Bootstrapped and LTO/TM regtested on Linux/i686.
> > > (If ok, please commit it. Thanks.)
> > 
> > No - why should this matter?  All of TM should be lowered to a point
> > where only target specific code should be needed.
> > 
> > Richard.
> 
> Thanks Richard.
> 
> In lto file, there is GIMPLE_TRANSACTION statement and a builtin call
> (__builtin_ITM_commitTransaction) to delimit the end of the transaction
> region. The transaction is not yet instrumented. So all of TM are not lowered.
> 
> I guess this could be also added even if we should always break at the missing
> _ITM_commitTransaction builtin declaration.
> 
> Index: gimple-streamer-in.c
> ===
> --- gimple-streamer-in.c(revision 182487)
> +++ gimple-streamer-in.c(working copy)
> @@ -234,6 +234,9 @@ input_gimple_stmt (struct lto_input_block *ib, str
>break;
> 
>  case GIMPLE_TRANSACTION:
> +  if (!flag_tm)
> +error_at (gimple_location (stmt),
> + "use of transactional memory without support enabled");
>gimple_transaction_set_label (stmt, stream_read_tree (ib, data_in));
>break;
> 
> 
> It seems a bit out of my scope of my GCC knowledge so I guess I will let GCC
> guys solve this in a proper way.

I'd say we should stream the new IL elements and enable TM at link-time
once we encounter such IL element (similar to how we enable exceptions
when one TU contains EH regions).

Richard.


Re: Restore widening madd optimisation for fixed-point types

2011-12-20 Thread Richard Guenther
On Mon, Dec 19, 2011 at 10:39 PM, Richard Sandiford
 wrote:
> The recent(ish) improvements to widening multiplication support have
> disabled madd and msub for fixed-point types.  The problem is that the
> optab is now chosen based on:
>
>  optype = build_nonstandard_integer_type (from_mode, from_unsigned1);
>
> which is specific to integer types.
>
> The only time optype differs from type1 is when we've switched to using
> unsigned types, possibly with a wider mode.  As written, the handling of
> mixed signedness really is only suitable for integer types, so this patch
> enforces that and makes the call above conditional on it.  It also fixes
> the first argument to be the precision rather than the mode.
>
> (As the argument mismatch proved, the precision doesn't actually
> matter here; only the signedness does.  I think an equivalent fix
> would be to call:
>
>  optype = unsigned_type_for (type1);
>
> That ought to work for fixed point types too, but is a little less
> obvious and a little less future-proof.  Since the rest of the block
> hasn't been adapted to fixed point types, it didn't seem worth the
> confusion.)
>
> Tested on mips-sde-elf, where it fixes gcc.target/mips/dpaq_sa_l_w.c
> and gcc.target/mips/dpsq_sa_l_w.c.  OK to install?

Ok with ...

> Richard
>
>
> gcc/
>        * tree-ssa-math-opts.c (convert_plusminus_to_widen): Restrict
>        handling of signedness differences to integer types.  Only build
>        a new optype if type1 isn't correct.
>
> Index: gcc/tree-ssa-math-opts.c
> ===
> --- gcc/tree-ssa-math-opts.c    2011-12-19 21:18:43.0 +
> +++ gcc/tree-ssa-math-opts.c    2011-12-19 21:23:12.0 +
> @@ -2304,10 +2304,13 @@ convert_plusminus_to_widen (gimple_stmt_
>   from_mode = TYPE_MODE (type1);
>   from_unsigned1 = TYPE_UNSIGNED (type1);
>   from_unsigned2 = TYPE_UNSIGNED (type2);
> +  optype = type1;
>
>   /* There's no such thing as a mixed sign madd yet, so use a wider mode.  */
>   if (from_unsigned1 != from_unsigned2)
>     {
> +      if (TREE_CODE (type) != INTEGER_TYPE)
> +       return false;

using INTEGRAL_TYPE_P (type) instead.  That way it still works
when applied to enum type multiplications.

Thanks,
Richard.

>       /* We can use a signed multiply with unsigned types as long as
>         there is a wider mode to use, or it is the smaller of the two
>         types that is unsigned.  Note that type1 >= type2, always.  */
> @@ -2322,6 +2325,8 @@ convert_plusminus_to_widen (gimple_stmt_
>        }
>
>       from_unsigned1 = from_unsigned2 = false;
> +      optype = build_nonstandard_integer_type (GET_MODE_PRECISION 
> (from_mode),
> +                                              false);
>     }
>
>   /* If there was a conversion between the multiply and addition
> @@ -2355,7 +2360,6 @@ convert_plusminus_to_widen (gimple_stmt_
>   /* Verify that the machine can perform a widening multiply
>      accumulate in this mode/signedness combination, otherwise
>      this transformation is likely to pessimize code.  */
> -  optype = build_nonstandard_integer_type (from_mode, from_unsigned1);
>   this_optab = optab_for_tree_code (wmult_code, optype, optab_default);
>   handler = find_widening_optab_handler_and_mode (this_optab, to_mode,
>                                                  from_mode, 0, &actual_mode);


Re: [committed] Alpha/VMS: adjust condition to create trampoline entry point

2011-12-20 Thread Richard Guenther
On Tue, Dec 20, 2011 at 9:37 AM, Tristan Gingold  wrote:
> Hi,
>
> the alpha/vms backend emitted the trampoline entry point too often, as 
> functions declared directly within a translation unit weren't considered as 
> top-level functions.
>
> Fixed by this patch, applied on trunk.
>
> Tristan.
>
> 2011-12-20  Tristan Gingold  
>
>        * config/alpha/alpha.c (alpha_start_function): Adjust condition to
>        create VMS trampoline entry point.
>
> Index: config/alpha/alpha.c
> ===
> --- config/alpha/alpha.c        (revision 182519)
> +++ config/alpha/alpha.c        (working copy)
> @@ -7935,7 +7935,8 @@
>    if (TARGET_ABI_OPEN_VMS
>        && !TREE_PUBLIC (decl)
>        && DECL_CONTEXT (decl)
> -       && !TYPE_P (DECL_CONTEXT (decl)))
> +       && !TYPE_P (DECL_CONTEXT (decl))
> +       && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)

We'd have !DECL_FILE_SCOPE_P (decl) which covers the
DECL_CONTEXT (decl) && TREE_CODE check.

>      {
>        strcpy (tramp_label, fnname);
>        strcat (tramp_label, "..tr");
>


Re: [committed] Alpha/VMS: adjust condition to create trampoline entry point

2011-12-20 Thread Tristan Gingold

On Dec 20, 2011, at 10:57 AM, Richard Guenther wrote:

> On Tue, Dec 20, 2011 at 9:37 AM, Tristan Gingold  wrote:
>> Hi,
>> 
>> the alpha/vms backend emitted the trampoline entry point too often, as 
>> functions declared directly within a translation unit weren't considered as 
>> top-level functions.
>> 
>> Fixed by this patch, applied on trunk.
>> 
>> Tristan.
>> 
>> 2011-12-20  Tristan Gingold  
>> 
>>* config/alpha/alpha.c (alpha_start_function): Adjust condition to
>>create VMS trampoline entry point.
>> 
>> Index: config/alpha/alpha.c
>> ===
>> --- config/alpha/alpha.c(revision 182519)
>> +++ config/alpha/alpha.c(working copy)
>> @@ -7935,7 +7935,8 @@
>>if (TARGET_ABI_OPEN_VMS
>>&& !TREE_PUBLIC (decl)
>>&& DECL_CONTEXT (decl)
>> -   && !TYPE_P (DECL_CONTEXT (decl)))
>> +   && !TYPE_P (DECL_CONTEXT (decl))
>> +   && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)
> 
> We'd have !DECL_FILE_SCOPE_P (decl) which covers the
> DECL_CONTEXT (decl) && TREE_CODE check.

Thanks.  I will use it.

Tristan.



[C++ Patch] PR 51621

2011-12-20 Thread Paolo Carlini

Hi,

this ICE - which leads to worse diagnostics - seems caused by a trivial 
typo: to mean value initialization diagnose_non_constexpr_vec_init is 
passing zoid_zero_node instead of void_type_node to build_vec_init_elt. 
My guess is also confirmed by the beginning of the other caller, 
build_vec_init_expr, which evidently has void_type_node meaning value 
initialization.


The below tested x86_64-linux.

Thanks,
Paolo.

///
/cp
2011-12-20  Paolo Carlini  

PR c++/51621
* tree.c (diagnose_non_constexpr_vec_init): For value initialization
pass void_type_node, not void_zero_node, to build_vec_init_elt.

/testsuite
2011-12-20  Paolo Carlini  

PR c++/51621
* g++.dg/cpp0x/constexpr-ice5.C: New.
Index: testsuite/g++.dg/cpp0x/constexpr-ice5.C
===
--- testsuite/g++.dg/cpp0x/constexpr-ice5.C (revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-ice5.C (revision 0)
@@ -0,0 +1,13 @@
+// PR c++/51621
+// { dg-options -std=c++0x }
+
+struct A
+{
+  A() {}
+};
+
+struct B
+{
+  A a[1];
+  constexpr B() : a() {} // { dg-error "non-constant|non-constexpr" }
+};
Index: cp/tree.c
===
--- cp/tree.c   (revision 182525)
+++ cp/tree.c   (working copy)
@@ -564,7 +564,7 @@ diagnose_non_constexpr_vec_init (tree expr)
   tree type = TREE_TYPE (VEC_INIT_EXPR_SLOT (expr));
   tree init, elt_init;
   if (VEC_INIT_EXPR_VALUE_INIT (expr))
-init = void_zero_node;
+init = void_type_node;
   else
 init = VEC_INIT_EXPR_INIT (expr);
 


Re: [committed] forward_propagate_subreg vs. mode_rep_extended

2011-12-20 Thread Paolo Bonzini

On 12/19/2011 11:06 PM, Richard Sandiford wrote:


I've normally tried to avoid self-approving rtl optimiser stuff,
but since this is a simple extension of the existing MEM handling,
and since the mode_rep_extended test effectively makes it MIPS-specific,
I hope it's OK to make an exception here.


Looks good anyway. :)

Paolo


Re: [ada] Support 64-bit libgnat multilib on i?86-linux

2011-12-20 Thread Rainer Orth
Eric Botcazou  writes:

>> 2011-12-13  Rainer Orth  
>>
>>  * gcc-interface/Makefile.in (%86 linux%):
>>  (LIBGNAT_TARGET_PAIRS_32): Split off from LIBGNAT_TARGET_PAIRS.
>>  (LIBGNAT_TARGET_PAIRS_64): New.
>>  (LIBGNAT_TARGET_PAIRS): Add either depending on multilib.
>
> OK, thanks.  You can also backport it to 4.6 and 4.5 branches if you want.

Probably not: I only test my own targets on branches for lack of time.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[Ada] Verification of Ada 2012 subpool implementation

2011-12-20 Thread Arnaud Charlet
This patch updates s-stposu.ads and s-stposu.adb to reflect the final version
of the Ada 2012 Reference Manual.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Hristian Kirtchev  

* sem_res.adb (Resolve_Allocator): Warning on allocation
of tasks on a subpool and rewrite the allocator into a raise
Program_Error statement.
* s-stposu.ads, s-stposu.adb: Code reformatting.
(Create_Subpool): Remove formal parameter Storage_Size.
(Default_Subpool_For_Pool): Add the default implementation of this
routine.
(Set_Pool_Of_Subpool): Rename formal parameter Pool to To. Update
all the uses of the parameter.

Index: sem_res.adb
===
--- sem_res.adb (revision 182532)
+++ sem_res.adb (working copy)
@@ -4469,23 +4469,26 @@
 and then Ekind (Current_Scope) = E_Package
 and then not In_Package_Body (Current_Scope)
   then
- Error_Msg_N ("cannot activate task before body seen?", N);
- Error_Msg_N ("\Program_Error will be raised at run time?", N);
+ Error_Msg_N ("?cannot activate task before body seen", N);
+ Error_Msg_N ("\?Program_Error will be raised at run time", N);
   end if;
 
-  --  Ada 2012 (AI05-0111-3): Issue a warning whenever allocating a task
-  --  or a type containing tasks on a subpool since the deallocation of
-  --  the subpool may lead to undefined task behavior. Perform the check
-  --  only when the allocator has not been converted into a Program_Error
-  --  due to a previous error.
+  --  Ada 2012 (AI05-0111-3): Detect an attempt to allocate a task or a
+  --  type with a task component on a subpool. This action must raise
+  --  Program_Error at runtime.
 
   if Ada_Version >= Ada_2012
 and then Nkind (N) = N_Allocator
 and then Present (Subpool_Handle_Name (N))
 and then Has_Task (Desig_T)
   then
- Error_Msg_N ("?allocation of task on subpool may lead to " &
-  "undefined behavior", N);
+ Error_Msg_N ("?cannot allocate task on subpool", N);
+ Error_Msg_N ("\?Program_Error will be raised at run time", N);
+
+ Rewrite (N,
+   Make_Raise_Program_Error (Sloc (N),
+ Reason => PE_Explicit_Raise));
+ Set_Etype (N, Typ);
   end if;
end Resolve_Allocator;
 
Index: s-stposu.adb
===
--- s-stposu.adb(revision 182532)
+++ s-stposu.adb(working copy)
@@ -431,6 +431,19 @@
   Deallocate (Pool, N_Addr, N_Size, Alignment);
end Deallocate_Any_Controlled;
 
+   --
+   -- Default_Subpool_For_Pool --
+   --
+
+   function Default_Subpool_For_Pool
+ (Pool : Root_Storage_Pool_With_Subpools) return not null Subpool_Handle
+   is
+   begin
+  raise Program_Error;
+
+  return Pool.Subpools.Subpool;
+   end Default_Subpool_For_Pool;
+

-- Detach --

@@ -607,7 +620,8 @@
-
 
function Pool_Of_Subpool (Subpool : not null Subpool_Handle)
- return access Root_Storage_Pool_With_Subpools'Class is
+ return access Root_Storage_Pool_With_Subpools'Class
+   is
begin
   return Subpool.Owner;
end Pool_Of_Subpool;
@@ -762,7 +776,7 @@
 
procedure Set_Pool_Of_Subpool
  (Subpool : not null Subpool_Handle;
-  Pool: in out Root_Storage_Pool_With_Subpools'Class)
+  To  : in out Root_Storage_Pool_With_Subpools'Class)
is
   N_Ptr : SP_Node_Ptr;
 
@@ -777,12 +791,12 @@
   --  Prevent the creation of a new subpool while the owner is being
   --  finalized. This is a serious error.
 
-  if Pool.Finalization_Started then
+  if To.Finalization_Started then
  raise Program_Error
with "subpool creation after finalization started";
   end if;
 
-  Subpool.Owner := Pool'Unchecked_Access;
+  Subpool.Owner := To'Unchecked_Access;
 
   --  Create a subpool node and decorate it. Since this node is not
   --  allocated on the owner's pool, it must be explicitly destroyed by
@@ -792,7 +806,7 @@
   N_Ptr.Subpool := Subpool;
   Subpool.Node := N_Ptr;
 
-  Attach (N_Ptr, Pool.Subpools'Unchecked_Access);
+  Attach (N_Ptr, To.Subpools'Unchecked_Access);
 
   --  Mark the subpool's master as being a heterogeneous collection of
   --  controlled objects.
Index: s-stposu.ads
===
--- s-stposu.ads(revision 182532)
+++ s-stposu.ads(working copy)
@@ -38,7 +38,7 @@
 with System.Storage_Elements;
 
 package System.Storage_Pools.Subpools is
-   pragma Preelaborate;
+   pragma Preelaborate (Subpools);
 
type Root_Storage_Pool_With_Subpools is abstract
  new Root_Storage_Pool with private;
@@ -70,21 

[Ada] Prevent use of attribute definitions for renamings

2011-12-20 Thread Arnaud Charlet
The RM forbids local names from being renamings, hence the
attempt to specify an attribute such as size or alignment
for a renaming should be illegal. We detected this for the
case of an address clause but missed many other cases.

The following should compile with the messages shown
with -gnatj60 -gnatld7

 1. package BadRenameAttr is
 2.type r is record
 3.   a, b, c, d : Character;
 4.end record;
 5.
 6.B : R;
 7.C : R renames B;
 8.for C'Alignment use 8;
   |
>>> alignment clause not allowed for a renaming
declaration (RM 13.1(6))

 9.
10.D : R renames B;
11.for D'Size use 128;
   |
>>> size clause not allowed for a renaming
declaration (RM 13.1(6))

12. end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Robert Dewar  

* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Check
renaming case.

Index: sem_ch13.adb
===
--- sem_ch13.adb(revision 182532)
+++ sem_ch13.adb(working copy)
@@ -2184,18 +2184,41 @@
  U_Ent := Underlying_Type (Ent);
   end if;
 
-  --  Complete other routine error checks
+  --  Avoid cascaded error
 
   if Etype (Nam) = Any_Type then
  return;
 
+  --  Must be declared in current scope
+
   elsif Scope (Ent) /= Current_Scope then
  Error_Msg_N ("entity must be declared in this scope", Nam);
  return;
 
+  --  Must not be a source renaming (we do have some cases where the
+  --  expander generates a renaming, and those cases are OK, in such
+  --  cases any attribute applies to the renamed object as well.
+
+  elsif Is_Object (Ent)
+and then Present (Renamed_Object (Ent))
+and then Comes_From_Source (Renamed_Object (Ent))
+  then
+ Get_Name_String (Chars (N));
+ Error_Msg_Strlen := Name_Len;
+ Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
+ Error_Msg_N
+   ("~ clause not allowed for a renaming declaration (RM 13.1(6))",
+Nam);
+ return;
+
+  --  If no underlying entity, use entity itself, applies to some
+  --  previously detected error cases ???
+
   elsif No (U_Ent) then
  U_Ent := Ent;
 
+  --  Cannot specify for a subtype (exception Object/Value_Size)
+
   elsif Is_Type (U_Ent)
 and then not Is_First_Subtype (U_Ent)
 and then Id /= Attribute_Object_Size
@@ -2367,12 +2390,6 @@
   then
  Error_Msg_N ("constant overlays a variable?", Expr);
 
-  elsif Present (Renamed_Object (U_Ent)) then
- Error_Msg_N
-   ("address clause not allowed"
-  & " for a renaming declaration (RM 13.1(6))", Nam);
- return;
-
   --  Imported variables can have an address clause, but then
   --  the import is pretty meaningless except to suppress
   --  initializations, so we do not need such variables to
@@ -2523,10 +2540,16 @@
 elsif Align /= No_Uint then
Set_Has_Alignment_Clause (U_Ent);
 
+   --  Tagged type case, check for attempt to set alignment to a
+   --  value greater than Max_Align, and reset if so.
+
if Is_Tagged_Type (U_Ent) and then Align > Max_Align then
   Error_Msg_N
 ("?alignment for & set to Maximum_Aligment", Nam);
-  Set_Alignment (U_Ent, Max_Align);
+ Set_Alignment (U_Ent, Max_Align);
+
+   --  All other cases
+
else
   Set_Alignment (U_Ent, Align);
end if;
@@ -6057,7 +6080,7 @@
   Aspect_Type_Invariant=>
 T := Standard_Boolean;
 
- when Aspect_Dimension |
+ when Aspect_Dimension|
   Aspect_Dimension_System =>
 raise Program_Error;
 
@@ -8792,8 +8815,8 @@
 Source : constant Entity_Id  := T.Source;
 Target : constant Entity_Id  := T.Target;
 
-Source_Siz: Uint;
-Target_Siz: Uint;
+Source_Siz : Uint;
+Target_Siz : Uint;
 
  begin
 --  This validation check, which warns if we have unequal sizes for


[Ada] Guard against WITH clause on child unit that is an illegal instantiation

2011-12-20 Thread Arnaud Charlet
This change prevents the compiler from hanging in the presence of a WITH
clause on a child unit that is an illegal generic instantiation. The following
compilation must be rejected:

$ gcc -c dist_monolithic_app.adb 
worker-registry.ads:4:51: expect valid subtype mark to instantiate "Handle"
worker-registry.ads:4:51: instantiation abandoned
worker-registry.ads:5:37: "Registry" not declared in "Worker"

with worker.main;
procedure dist_monolithic_app is
begin
null;
end dist_monolithic_app;


package body Registry is

   --
   -- Register --
   --

   procedure Register
 (Object : in Handle;
  Name   : in String) is
   begin
  null;
   end Register;

end Registry;

generic
   type Handle is private;
   Void : Handle;
   --  Object handle to store and the corresponding null value

package Registry is

   pragma Remote_Call_Interface;

   procedure Register (Object : in Handle; Name : in String);
   --  Register a new distributed object

end Registry;
package Worker is
   pragma Pure;

   type Object is abstract tagged limited private;

private

   type Object is abstract tagged limited null record;

end Worker;
procedure Worker_Main is
begin
   null;
end Worker_Main;

with Worker.Registry;

procedure Worker.Main is
begin
   null;
end Worker.Main;

with Registry;

package Worker.Registry is new Standard.Registry (null, null);
pragma Remote_Call_Interface (Worker.Registry);

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Thomas Quinot  

* sem_cat.adb, sem_ch10.adb (Analyze_With_Clause): For a WITH clause on
a child unit that is an illegal instantiation, mark the WITH clause in
error.
(Install_Siblings, Validate_Categorization_Dependency): Guard
against WITH clause marked as in error.

Index: sem_cat.adb
===
--- sem_cat.adb (revision 182532)
+++ sem_cat.adb (working copy)
@@ -972,7 +972,13 @@
  while Present (Item) loop
 if Nkind (Item) = N_With_Clause
   and then not (Implicit_With (Item)
-  or else Limited_Present (Item))
+  or else Limited_Present (Item)
+
+  --  Skip if error already posted on the WITH
+  --  clause (in which case the Name attribute
+  --  may be invalid).
+
+  or else Error_Posted (Item))
 then
Entity_Of_Withed := Entity (Name (Item));
Check_Categorization_Dependencies
Index: sem_ch10.adb
===
--- sem_ch10.adb(revision 182532)
+++ sem_ch10.adb(working copy)
@@ -2678,7 +2678,14 @@
 Generate_Reference (Par_Name, Pref);
 
  else
-Set_Name (N, Make_Null (Sloc (N)));
+pragma Assert (Serious_Errors_Detected /= 0);
+
+--  Mark the node to indicate that a related error has been posted.
+--  This defends further compilation passes against cascaded errors
+--  caused by the invalid WITH clause node.
+
+Set_Error_Posted (N);
+Set_Name (N, Error);
 return;
  end if;
   end if;
@@ -4100,6 +4107,7 @@
  if Nkind (Item) /= N_With_Clause
or else Implicit_With (Item)
or else Limited_Present (Item)
+   or else Error_Posted (Item)
  then
 null;
 


[Ada] MKS dimension system

2011-12-20 Thread Arnaud Charlet
New GNAT library packages that defines the MKS dimension system (SI system of
units) and provide IO routines for this dimension system.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Vincent Pucci  

* impunit.adb: s-dimkio, s-dimmks and s-dmotpr defined as GNAT
Defined Additions to System.
* Makefile.rtl: s-dimkio, s-dimmks and s-dmotpr added.
* s-dimkio.ads, s-dimmks.ads, s-dmotpr.ads: New files.

Index: impunit.adb
===
--- impunit.adb (revision 182532)
+++ impunit.adb (working copy)
@@ -368,6 +368,9 @@
 ("s-assert", F),  -- System.Assertions
 ("s-diflio", F),  -- System.Dim_Float_IO
 ("s-diinio", F),  -- System.Dim_Integer_IO
+("s-dimkio", F),  -- System.Dim_Mks_IO
+("s-dimmks", F),  -- System.Dim_Mks
+("s-dmotpr", F),  -- System.Dim_Mks.Other_Prefixes
 ("s-memory", F),  -- System.Memory
 ("s-parint", F),  -- System.Partition_Interface
 ("s-pooglo", F),  -- System.Pool_Global
Index: s-dmotpr.ads
===
--- s-dmotpr.ads(revision 0)
+++ s-dmotpr.ads(revision 0)
@@ -0,0 +1,168 @@
+--
+--  --
+--  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS--
+--  --
+-- S Y S T E M . D I M _ M K S . O T H E R _ P R E F I X E S--
+--  --
+--  S p e c --
+--  --
+--  Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+--  --
+-- GNARL is free software; you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+--  --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.   --
+--  --
+-- You should have received a copy of the GNU General Public License and--
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see--
+-- .  --
+--  --
+-- GNARL was developed by the GNARL team at Florida State University.   --
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
+--  --
+--
+
+--  Package that defines some other prefixes for the MKS base unit system.
+
+--  These prefixes have been defined in a child package in order to avoid too
+--  many constant declarations in System.Dim_Mks.
+
+package System.Dim_Mks.Other_Prefixes is
+
+   --  SI prefixes for Meter
+
+   ym  : constant Length := 1.0E-24;  -- yocto
+   zm  : constant Length := 1.0E-21;  -- zepto
+   am  : constant Length := 1.0E-18;  -- atto
+   fm  : constant Length := 1.0E-15;  -- femto
+   pm  : constant Length := 1.0E-12;  -- pico
+   nm  : constant Length := 1.0E-09;  -- nano
+   Gm  : constant Length := 1.0E+09;  -- giga
+   Tm  : constant Length := 1.0E+12;  -- tera
+   Pem : constant Length := 1.0E+15;  -- peta
+   Em  : constant Length := 1.0E+18;  -- exa
+   Zem : constant Length := 1.0E+21;  -- zetta
+   Yom : constant Length := 1.0E+24;  -- yotta
+
+   --  SI prefixes for Kilogram
+
+   yg  : constant Mass := 1.0E-27;  -- yocto
+   zg  : constant Mass := 1.0E-24;  -- zepto
+   ag  : constant Mass := 1.0E-21;  -- atto
+   fg  : constant Mass := 1.0E-18;  -- femto
+   pg  : constant Mass := 1.0E-15;  -- pico
+   ng  : constant Mass := 1.0E-12;  -- nano
+   Gg  : constant Mass := 1.0E+06;  -- giga
+   Tg  : constant Mass := 1.0E+09;  -- tera
+   Peg : constant Mass := 1.0E+13;  -- peta
+   Eg  : constant Mass := 1.0E+15;  -- exa
+   Zeg : constant Mass := 1.0E+1

[Ada] Error on use of 'Class applied to limited view of tagged type

2011-12-20 Thread Arnaud Charlet
When the Class attribute is applied in one package that has a limited view of
a tagged type with an untagged incomplete type in its own package, then when
another unit with a nonlimited with clause for the type's package is compiled,
the compiler issues an error complaining that the prefix must be tagged. The
Available_View of the type must be tested as a condition for issuing this error.

The following test must compile quietly:

gcc -c -gnat05 ltd_with_class_attr_bug.ads

--
package Pkg1 is

   type Typ;

   type Ref is access all Typ'Class;

   type Typ is tagged null record;

end Pkg1;

package Pkg2 is

   type Typ;

   type Ref is access all Typ'Class;

   type Typ is tagged null record;

end Pkg2;

limited with Pkg1;
limited with Pkg2;

package Pkg_Ltd_With is

   procedure Proc1 (X : access Pkg1.Typ'Class);

   procedure Proc2 (Y : Pkg1.Typ'Class);

   procedure Proc3 (X : access Pkg2.Typ'Class);

   procedure Proc4 (Y : Pkg2.Typ'Class);

end Pkg_Ltd_With;

with Pkg1;
with Pkg_Ltd_With;

package Ltd_With_Class_Attr_Bug is 
end Ltd_With_Class_Attr_Bug;
--

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Gary Dismukes  

* sem_ch8.adb (Find_Type): Test taggedness
of the Available_Type when checking for an illegal use of an
incomplete type, when the incomplete view is a limited view of
a type. Remove redundant Is_Tagged test.

Index: sem_ch8.adb
===
--- sem_ch8.adb (revision 182532)
+++ sem_ch8.adb (working copy)
@@ -6119,10 +6119,16 @@
   --  is completed in the current scope, and not for a limited
   --  view of a type.
 
-  if not Is_Tagged_Type (T)
-and then Ada_Version >= Ada_2005
-  then
- if From_With_Type (T) then
+  if Ada_Version >= Ada_2005 then
+
+ --  Test whether the Available_View of a limited type view
+ --  is tagged, since the limited view may not be marked as
+ --  tagged if the type itself has an untagged incomplete
+ --  type view in its package.
+
+ if From_With_Type (T)
+   and then not Is_Tagged_Type (Available_View (T))
+ then
 Error_Msg_N
   ("prefix of Class attribute must be tagged", N);
 Set_Etype (N, Any_Type);


[Ada] Iteration over Ada container causes Program_Error

2011-12-20 Thread Arnaud Charlet
This patch corrects the machinery which identifies an object as being a
transient variable. Objects which denote Ada containers in the context of
iterator loops are not considered transients and now share the life time of the
related loop.


-- Source --


pragma Ada_2012;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Text_IO; use Ada.Text_IO;

procedure Main is
package Lists is new Ada.Containers.Doubly_Linked_Lists (Integer);
use Lists;
function Get_Tmp_List return Lists.List;
function Get_Tmp_List return Lists.List is
   Tmp : Lists.List;
begin
   Tmp.Append (1);
   Tmp.Append (2);
   Tmp.Append (3);
   return Tmp;
end Get_Tmp_List;
begin
for A in Get_Tmp_List.Iterate loop
   Put_Line ("Index => " & Element (A)'Img);
end loop;
end Main;


-- Compilation and output --


$ gnatmake -q -gnat12 main.adb
$ ./main
$ Index =>  1
$ Index =>  2
$ Index =>  3

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Hristian Kirtchev  

* exp_util.adb: Add with and use clause for Aspects.
(Is_Finalizable_Transient): Objects which denote Ada containers
in the context of iterators are not considered transients. Such
object must live for as long as the loop is around.
(Is_Iterated_Container): New routine.

Index: exp_util.adb
===
--- exp_util.adb(revision 182532)
+++ exp_util.adb(working copy)
@@ -23,6 +23,7 @@
 --  --
 --
 
+with Aspects;  use Aspects;
 with Atree;use Atree;
 with Casing;   use Casing;
 with Checks;   use Checks;
@@ -3966,6 +3967,13 @@
   function Is_Allocated (Trans_Id : Entity_Id) return Boolean;
   --  Determine whether transient object Trans_Id is allocated on the heap
 
+  function Is_Iterated_Container
+(Trans_Id   : Entity_Id;
+ First_Stmt : Node_Id) return Boolean;
+  --  Determine whether transient object Trans_Id denotes a container which
+  --  is in the process of being iterated in the statement list starting
+  --  from First_Stmt.
+
   ---
   -- Initialized_By_Access --
   ---
@@ -4180,6 +4188,90 @@
  and then Nkind (Expr) = N_Allocator;
   end Is_Allocated;
 
+  ---
+  -- Is_Iterated_Container --
+  ---
+
+  function Is_Iterated_Container
+(Trans_Id   : Entity_Id;
+ First_Stmt : Node_Id) return Boolean
+  is
+ Aspect : Node_Id;
+ Call   : Node_Id;
+ Iter   : Entity_Id;
+ Param  : Node_Id;
+ Stmt   : Node_Id;
+ Typ: Entity_Id;
+
+  begin
+ --  It is not possible to iterate over containers in non-Ada 2012 code
+
+ if Ada_Version < Ada_2012 then
+return False;
+ end if;
+
+ Typ := Etype (Trans_Id);
+
+ --  Handle access type created for secondary stack use
+
+ if Is_Access_Type (Typ) then
+Typ := Designated_Type (Typ);
+ end if;
+
+ --  Look for aspect Default_Iterator
+
+ if Has_Aspects (Parent (Typ)) then
+Aspect := Find_Aspect (Typ, Aspect_Default_Iterator);
+
+if Present (Aspect) then
+   Iter := Entity (Aspect);
+
+   --  Examine the statements following the container object and
+   --  look for a call to the default iterate routine where the
+   --  first parameter is the transient. Such a call appears as:
+
+   -- It : Access_To_CW_Iterator :=
+   --Iterate (Tran_Id.all, ...)'reference;
+
+   Stmt := First_Stmt;
+   while Present (Stmt) loop
+
+  --  Detect an object declaration which is initialized by a
+  --  secondary stack function call.
+
+  if Nkind (Stmt) = N_Object_Declaration
+and then Present (Expression (Stmt))
+and then Nkind (Expression (Stmt)) = N_Reference
+and then Nkind (Prefix (Expression (Stmt))) =
+   N_Function_Call
+  then
+ Call := Prefix (Expression (Stmt));
+
+ --  The call must invoke the default iterate routine of
+ --  the container and the transient object must appear as
+ --  the first actual parameter.
+
+ if Entity (Name (Call)) = Iter
+   and then Present (Parameter_Associations (Call))
+ then
+Param := First (Parameter_Associations (Call));
+
+

[Ada] Attribute 'Width and pragma Discard_Names

2011-12-20 Thread Arnaud Charlet
This patch corrects the expansion of attribute 'Width when applied to a
dynamic enumeration type with suppressed names.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Hristian Kirtchev  

* exp_imgv.adb (Expand_Width_Attribute): Add a
type conversion from the enumeration subtype to its base subtype.

Index: exp_imgv.adb
===
--- exp_imgv.adb(revision 182532)
+++ exp_imgv.adb(working copy)
@@ -1177,7 +1177,7 @@
  --  ...
  --  else n)))...
 
- --  where n is equal to Rtyp'Pos (Rtyp'Last) + 1
+ --  where n is equal to Rtyp'Pos (Ptyp'Last) + 1
 
  --  Note: The above processing is in accordance with the intent of
  --  the RM, which is that Width should be related to the impl-defined
@@ -1206,12 +1206,13 @@
  New_Occurrence_Of (Standard_Integer, Loc),
Expression =>
  Make_Attribute_Reference (Loc,
-   Prefix=> New_Occurrence_Of (Rtyp, Loc),
-   Attribute_Name=> Name_Pos,
-   Expressions   => New_List (
- Make_Attribute_Reference (Loc,
-   Prefix=> New_Occurrence_Of (Ptyp, Loc),
-   Attribute_Name=> Name_Last);
+   Prefix => New_Occurrence_Of (Rtyp, Loc),
+   Attribute_Name => Name_Pos,
+   Expressions=> New_List (
+ Convert_To (Rtyp,
+   Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Ptyp, Loc),
+ Attribute_Name => Name_Last));
 
--  OK, now we need to build the conditional expression. First
--  get the value of M, the largest possible value needed.


[Ada] Default to -gnatw.L

2011-12-20 Thread Arnaud Charlet
This patch changes the default from -gnatw.l to -gnatw.L. That is, inherited
aspects are no longer listed by default.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Bob Duff  

* opt.ads (List_Inherited_Aspects): Default to False
(i.e. -gnatw.L is the default).
* usage.adb: Document new default for -gnatw.L.
* gnat_ugn.texi: Document -gnatw.l and -gnatw.L switches.
* warnsw.adb (Set_Warning_Switch): Do not include
List_Inherited_Aspects in -gnatwa.

Index: usage.adb
===
--- usage.adb   (revision 182532)
+++ usage.adb   (working copy)
@@ -453,8 +453,8 @@
   "elaboration pragma");
Write_Line ("L*   turn off warnings for missing " &
   "elaboration pragma");
-   Write_Line (".l*  turn on info messages for inherited aspects");
-   Write_Line (".L   turn off info messages for inherited aspects");
+   Write_Line (".l   turn on info messages for inherited aspects");
+   Write_Line (".L*   turn off info messages for inherited aspects");
Write_Line ("m+   turn on warnings for variable assigned " &
   "but not read");
Write_Line ("M*   turn off warnings for variable assigned " &
Index: gnat_ugn.texi
===
--- gnat_ugn.texi   (revision 182532)
+++ gnat_ugn.texi   (working copy)
@@ -5093,6 +5093,7 @@
 @option{-gnatwh} (hiding),
 @option{-gnatw.h} (holes (gaps) in record layouts)
 @option{-gnatwl} (elaboration warnings),
+@option{-gnatw.l} (inherited aspects),
 @option{-gnatw.o} (warn on values set by out parameters ignored)
 and @option{-gnatwt} (tracking of deleted conditional code).
 All other optional warnings are turned on.
@@ -5424,6 +5425,19 @@
 See the section in this guide on elaboration checking for details on
 when such pragmas should be used.
 
+@item -gnatw.l
+@emph{List inherited aspects.}
+@cindex @option{-gnatw.l} (@command{gcc})
+This switch causes the compiler to list inherited invariants,
+preconditions, and postconditions from Invariant'Class, Pre'Class, and
+Post'Class aspects. Also list inherited subtype predicates.
+These messages are not automatically turned on by the use of @option{-gnatwa}.
+
+@item -gnatw.L
+@emph{Suppress listing of inherited aspects.}
+@cindex @option{-gnatw.L} (@command{gcc})
+This switch suppresses listing of inherited aspects.
+
 @item -gnatwm
 @emph{Activate warnings on modified but unreferenced variables.}
 @cindex @option{-gnatwm} (@command{gcc})
Index: warnsw.adb
===
--- warnsw.adb  (revision 182532)
+++ warnsw.adb  (working copy)
@@ -251,7 +251,6 @@
 Constant_Condition_Warnings := True;
 Implementation_Unit_Warnings:= True;
 Ineffective_Inline_Warnings := True;
-List_Inherited_Aspects  := True;
 Warn_On_Ada_2005_Compatibility  := True;
 Warn_On_Ada_2012_Compatibility  := True;
 Warn_On_Assertion_Failure   := True;
Index: opt.ads
===
--- opt.ads (revision 182532)
+++ opt.ads (working copy)
@@ -801,10 +801,12 @@
--  Set to True to skip compile and bind steps (except when Bind_Only is
--  set to True).
 
-   List_Inherited_Aspects : Boolean := True;
+   List_Inherited_Aspects : Boolean := False;
--  GNAT
--  List inherited invariants, preconditions, and postconditions from
-   --  Invariant'Class, Pre'Class, and Post'Class aspects.
+   --  Invariant'Class, Pre'Class, and Post'Class aspects. Also list inherited
+   --  subtype predicates. Set True by use of -gnatw.l and False by use of
+   --  -gnatw.L.
 
List_Restrictions : Boolean := False;
--  GNATBIND


[Ada] Freeze node for nested generic instantiations

2011-12-20 Thread Arnaud Charlet
This patches handles complex cases of nested package instantiations, and
determines properly the placement of freeze nodes for instantiations of
generic units that are themselves declared in a previous instantiaion in the
same compilation unit.

The following must compile quietly:
gcc -c ppp.ads

---
with QQQ;
package PPP is
package My_QQQ is new QQQ ("");
end PPP;
---
with RRR;
generic
Name : String;
package QQQ is
package My_RRR is new RRR ("");

package My_Nested2 is new My_RRR.Nested2 ("");
end QQQ;
---
with SSS;
generic
   Name : in String;
package RRR is
   package Nested is
  package My_SSS renames SSS;
   end Nested;

   generic
  Name : in String;
   package Nested2 is
  package Inner is
 package My_Nested renames RRR.Nested;
 procedure Proc;
  end Inner;
   end Nested2;
end RRR;
---
package body RRR is
   package body Nested2 is

  package body Inner is

 package My_Inner is new My_Nested.My_SSS.Inner ("");

 procedure Proc is begin null; end;

  end Inner;

   end Nested2;
end RRR;
---
package SSS is
   generic
  Name : String;
   package Inner is

  procedure Proc2;

   end Inner;
end SSS;
---
with TTT;
package body SSS is

   package body Inner is

  package My_Nested is new TTT.Nested ("");

  procedure Proc1 is begin null; end;

 package My_Inner is new My_Nested.Inner ("");

  procedure Proc2 is begin null; end;

   end Inner;
end SSS;
---
package TTT is
   generic

  Name : in String;

   package Nested is
  generic

 Name : in String;

  package Inner is
 procedure Proc;
  end Inner;
   end Nested;
end TTT;
---
package body TTT is
   package body Nested is
  package body Inner is
 procedure Proc is begin null; end;
  end Inner;

   end Nested;
end TTT;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-20  Ed Schonberg  

* sem_ch12.adb (Insert_Freeze_Node_For_Instance):  Further
refinements on the placement of a freeze node for a package
instantiation, when the generic appears within a previous
instantiation in the same unit.If the current instance is within
the one that contains the generic, the freeze node for the
current one must appear in the current declarative part. Ditto
if the current instance is within another package instance. In
these cases the freeze node of the previous instance is is not
relevant. New predicate Enclosing_Body simplifies the process.
(Freeze_Subprogram_Body): Rename Enclosing_Body to
Enclosing_Package_Body, to prevent confusion with subprogram of
same name elsewhere.
(Install_Body): Recognize enclosing subprogram bodies to determine
whether freeze_node belongs in current declarative list.

Index: sem_ch12.adb
===
--- sem_ch12.adb(revision 182532)
+++ sem_ch12.adb(working copy)
@@ -738,7 +738,8 @@
--  actuals themselves.
 
function True_Parent (N : Node_Id) return Node_Id;
-   --  For a subunit, return parent of corresponding stub
+   --  For a subunit, return parent of corresponding stub, else return
+   --  parent of node.
 
procedure Valid_Default_Attribute (Nam : Entity_Id; Def : Node_Id);
--  Verify that an attribute that appears as the default for a formal
@@ -6948,29 +6949,30 @@
   Enc_I: Node_Id;
   F_Node   : Node_Id;
 
-  function Enclosing_Body (N : Node_Id) return Node_Id;
+  function Enclosing_Package_Body (N : Node_Id) return Node_Id;
   --  Find innermost package body that encloses the given node, and which
   --  is not a compilation unit. Freeze nodes for the instance, or for its
   --  enclosing body, may be inserted after the enclosing_body of the
-  --  generic unit.
+  --  generic unit. Used to determine proper placement of freeze node for
+  --  both package and subprogram instances.
 
   function Package_Freeze_Node (B : Node_Id) return Node_Id;
   --  Find entity for given package body, and locate or create a freeze
   --  node for it.
 
-  
-  -- Enclosing_Body --
-  
+  
+  -- Enclosing_Package_Body --
+  
 
-  function Enclosing_Body (N : Node_Id) return Node_Id is
- P : Node_Id := Parent (N);
+  function Enclosing_Package_Body (N : Node_Id) return Node_Id is
+ P : Node_Id;
 
   begin
+ P := Parent (N);
  while Present (P)
and then Nkind (Parent (P)) /= N_Compilation_Unit
  loop
 if Nkind (P) = N_Package_Body then
-
if Nkind (Parent (P)) = N_Subunit then
   return Corresponding_Stub (Parent (P));
else
@@ -6982,7 +6984,7 @@
  end loop;
 
  return Empty;
-  e

[PATCH, SMS] Prevent the creation of reg-moves for definitions with MODE_CC

2011-12-20 Thread Revital Eres
Hello,

The testcase attached causes ICE when compiling with
-fmodulo-sched-allow-regmoves on ARM due to reg-moves created for the
definition of mode MODE_CC.

The following is a snippet from the ddg of the definition and use of vfpcc
which triggers the creation of the reg-move:

Node num: 1
(insn 151 77 152 6 (set (reg:CCFP 127 vfpcc)
(compare:CCFP (reg:SF 202 [ MEM[base: D.5306_32, offset: 0B] ])
(reg:SF 183 [ D.5284 ]))) test_new.c:8 694 {*cmpsf_vfp}
 (expr_list:REG_DEAD (reg:SF 202 [ MEM[base: D.5306_32, offset: 0B] ])
(nil)))
OUT ARCS:  [151 -(T,4,0)-> 152]
IN ARCS:  [77 -(T,3,0)-> 151]
Node num: 2
(insn 152 151 120 6 (set (reg:CCFP 24 cc)
(reg:CCFP 127 vfpcc)) test_new.c:8 689 {*movcc_vfp}
 (expr_list:REG_DEAD (reg:CCFP 127 vfpcc)
(nil)))
OUT ARCS:  [152 -(O,0,0)-> 144]  [152 -(T,0,0)-> 120]
IN ARCS:  [145 -(A,0,1)-> 152]  [151 -(T,4,0)-> 152]

The attached patch prevents the creation of reg-moves for definitions
with MODE_CC and thus solves this ICE.

Currently testing and bootstrap on ppc64-redhat-linux, enabling SMS on
loops with SC 1.

OK for 4.7 once testing completes?

Thanks,
Revital

Changelog:

gcc/
* ddg.c (def_has_ccmode_p): New function.
(add_cross_iteration_register_deps): Call it.

testsuite/
 * gcc.dg/sms-11.c: New file.
Index: ddg.c
===
--- ddg.c   (revision 182482)
+++ ddg.c   (working copy)
@@ -263,6 +263,23 @@ create_ddg_dep_no_link (ddg_ptr g, ddg_n
 add_edge_to_ddg (g, e);
 }
 
+/* Return true if one of the definitions in INSN has MODE_CC.  Otherwise
+   return false.  */
+static bool
+def_has_ccmode_p (rtx insn)
+{
+  df_ref *def;
+
+  for (def = DF_INSN_DEFS (insn); *def; def++)
+{
+  enum machine_mode mode = GET_MODE (DF_REF_REG (*def));
+
+  if (GET_MODE_CLASS (mode) == MODE_CC)
+   return true;
+}
+
+  return false;
+}
 
 /* Given a downwards exposed register def LAST_DEF (which is the last
definition of that register in the bb), add inter-loop true dependences
@@ -335,7 +352,8 @@ add_cross_iteration_register_deps (ddg_p
   if (DF_REF_ID (last_def) != DF_REF_ID (first_def)
   || !flag_modulo_sched_allow_regmoves
  || JUMP_P (use_node->insn)
-  || autoinc_var_is_used_p (DF_REF_INSN (last_def), use_insn))
+  || autoinc_var_is_used_p (DF_REF_INSN (last_def), use_insn)
+ || def_has_ccmode_p (DF_REF_INSN (last_def)))
 create_ddg_dep_no_link (g, use_node, first_def_node, ANTI_DEP,
 REG_DEP, 1);
 
Index: testsuite/gcc.dg/sms-11.c
===
--- testsuite/gcc.dg/sms-11.c   (revision 0)
+++ testsuite/gcc.dg/sms-11.c   (revision 0)
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms" } */
+
+extern void abort (void);
+
+float out[4][4] = { 6, 6, 7, 5, 6, 7, 5, 5, 6, 4, 4, 4, 6, 2, 3, 4 };
+
+void
+invert (void)
+{
+  int i, j, k = 0, swap;
+  float tmp[4][4] = { 5, 6, 7, 5, 6, 7, 5, 5, 4, 4, 4, 4, 3, 2, 3, 4 };
+
+  for (i = 0; i < 4; i++)
+{
+  for (j = i + 1; j < 4; j++)
+   if (tmp[j][i] > tmp[i][i])
+ swap = j;
+
+  if (swap != i)
+   tmp[i][k] = tmp[swap][k];
+}
+
+  for (i = 0; i < 4; i++)
+for (j = 0; j < 4; j++)
+  if (tmp[i][j] != out[i][j])
+   abort ();
+}
+
+int
+main ()
+{
+  invert ();
+  return 0;
+}
+
+/* { dg-final { cleanup-rtl-dump "sms" } } */


Re: [C++ Patch] PR 51621

2011-12-20 Thread Jason Merrill

OK.

Jason


Re: [RFC, ARM] Split xorsi with constant after reload

2011-12-20 Thread Richard Earnshaw
On 17/12/11 00:30, Richard Henderson wrote:
> This follows the other logical patterns, andsi3 and iorsi3, which
> also accept reg_or_int_operand and split post-reload.
> 
> For the atomic optabs, I have two choices: either rely on this 
> post-reload splitting, or call arm_split_constant myself.  Making
> all of the logicals work similarly seemed cleaner to me.
> 
> Ok?
> 

We don't do that already?   Durr.

OK.

R.

> 
> r~
> 
> 
> z2
> 
> 
> commit 55a22158e15362bda60bd89b223de9bee72cb52a
> Author: Richard Henderson 
> Date:   Thu Dec 15 13:34:04 2011 -0800
> 
> arm: Split xorsi with constant after reload.
> 
> This puts xorsi3 in the same format as andsi3 and iorsi3.
> This similarity fixes code generation issues with splitting
> atomic_fetch_xor post-reload.
> 
> diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
> index 521d6a3..0e4bc3e 100644
> --- a/gcc/config/arm/arm.md
> +++ b/gcc/config/arm/arm.md
> @@ -3049,13 +3049,25 @@
>  }"
>  )
>  
> -(define_insn "*arm_xorsi3"
> -  [(set (match_operand:SI 0 "s_register_operand" "=r")
> - (xor:SI (match_operand:SI 1 "s_register_operand" "r")
> - (match_operand:SI 2 "arm_rhs_operand" "rI")))]
> +(define_insn_and_split "*arm_xorsi3"
> +  [(set (match_operand:SI 0 "s_register_operand" "=r,r")
> + (xor:SI (match_operand:SI 1 "s_register_operand" "%r,r")
> + (match_operand:SI 2 "reg_or_int_operand" "rI,?n")))]
>"TARGET_32BIT"
> -  "eor%?\\t%0, %1, %2"
> -  [(set_attr "predicable" "yes")]
> +  "@
> +   eor%?\\t%0, %1, %2
> +   #"
> +  "TARGET_32BIT
> +   && GET_CODE (operands[2]) == CONST_INT
> +   && !const_ok_for_arm (INTVAL (operands[2]))"
> +  [(clobber (const_int 0))]
> +{
> +  arm_split_constant (XOR, SImode, curr_insn,
> +  INTVAL (operands[2]), operands[0], operands[1], 0);
> +  DONE;
> +}
> +  [(set_attr "length" "4,16")
> +   (set_attr "predicable" "yes")]
>  )
>  
>  (define_insn "*thumb1_xorsi3_insn"




Re: [RFA, ARM] Streamline thumb2 DImode compares

2011-12-20 Thread Richard Earnshaw
On 17/12/11 00:26, Richard Henderson wrote:
> I noticed this while testing my atomic optabs patch with -mthumb.
> This is identical to what we actually output in the current sync code:
> 
>>   arm_output_asm_insn (emit, 0, operands, "cmp\t%%0, %%1");
>>   if (is_di)
>> {
>>   arm_output_it (emit, "", "eq");
>>   arm_output_op2 (emit, "cmpeq", old_value_hi, required_value_hi);
>> }
> 
> except now it's applicable to all DImode comparisons everywhere.
> 
> Bootstrapped with -march=armv7-a -mthumb.  
> 
> The only question I have is, can we assume a universal syntax assembler,
> or should the output pattern be changed to
> 
>   {
> if (TARGET_THUMB)
>   return "cmp\t%R0, %R1\;it eq\;cmpeq\t%Q0, %Q1";
> else
>   return "cmp\t%R0, %R1\;cmpeq\t%Q0, %Q1";
>   }
> 
> ?
> 

It works from binutils-2.17 onwards (ie back to 2006 release).  That's
probably far enough back that you'd encounter other problems if you
tried to mix older binutils with latest GCC.

So on that basis, OK.

R.

> 
> r~
> 
> 
> z1
> 
> 
> commit c1181684567b75719d3599891f0e650cee51d573
> Author: Richard Henderson 
> Date:   Thu Dec 15 12:02:03 2011 -0800
> 
> arm: Use arm_cmpdi_unsigned for thumb2 as well
> 
> This changes code generation from "eors; eors; orrs" (which ranges
> from 6 to 12 bytes and requires three scratch registers), to
> "cmp; it; cmp" (which is always 6 bytes for register inputs and
> requires no scratch registers).
> 
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index f829a83..18dabda 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -11606,7 +11606,7 @@ arm_select_cc_mode (enum rtx_code op, rtx x, rtx y)
>   return CC_Zmode;
>  
> /* We can do an equality test in three Thumb instructions.  */
> -   if (!TARGET_ARM)
> +   if (!TARGET_32BIT)
>   return CC_Zmode;
>  
> /* FALLTHROUGH */
> @@ -11618,7 +11618,7 @@ arm_select_cc_mode (enum rtx_code op, rtx x, rtx y)
> /* DImode unsigned comparisons can be implemented by cmp +
>cmpeq without a scratch register.  Not worth doing in
>Thumb-2.  */
> -   if (TARGET_ARM)
> +   if (TARGET_32BIT)
>   return CC_CZmode;
>  
> /* FALLTHROUGH */
> diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
> index 937a009..4ec300a 100644
> --- a/gcc/config/arm/arm.md
> +++ b/gcc/config/arm/arm.md
> @@ -7529,8 +7529,8 @@
>[(set (reg:CC_CZ CC_REGNUM)
>   (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r")
>  (match_operand:DI 1 "arm_di_operand" "rDi")))]
> -  "TARGET_ARM"
> -  "cmp%?\\t%R0, %R1\;cmpeq\\t%Q0, %Q1"
> +  "TARGET_32BIT"
> +  "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1"
>[(set_attr "conds" "set")
> (set_attr "length" "8")]
>  )




Re: Go patch committed: Implement new syscall package

2011-12-20 Thread Rainer Orth
Ian Lance Taylor  writes:

> It's possible that this patch will once again break the Solaris and Irix
> support.  I've tried to ensure that I didn't make any stupid errors, but
> I haven't done any actual testing.  Sorry about any problems.

Now IRIX finally bootstrap again, I had to make two adjustments to have
libgo build there.

* go/syscall/wait.c doesn't compile:

/vol/gcc/src/hg/trunk/local/libgo/go/syscall/wait.c:11:0: error: 
"__EXTENSIONS__" redefined [-Werror]
/vol/gcc/src/hg/trunk/local/libgo/go/syscall/wait.c:1:0: note: this is the 
location of the previous definition

  I've wrapped the __EXTENSIONS__ definition in #ifndef/#endif, but
  think this is the wrong approach: definitions of _GNU_SOURCE,
  __EXTENSIONS__ and other platform-specific stuff should go into
  configure.ac or mksysinfo.sh, not individual sources.  There are more
  instances of this problem, but they don't hurt me on IRIX.

* There's a redefinition of IPMreq now:

sysinfo.go:3089:6: error: redefinition of 'IPMreq'
/vol/gcc/src/hg/trunk/local/libgo/go/syscall/socket_irix.go:81:6: note: 
previous definition of 'IPMreq' was here

  For some reason, sysinfo.go now gets the right definition, so the one
  in socket_irix.go isn't necessary any longer.

make check is still running, but it seems that all 64-bit tests fail, as
they do on Solaris/x86.

Rainer


diff --git a/libgo/go/syscall/socket_irix.go b/libgo/go/syscall/socket_irix.go
--- a/libgo/go/syscall/socket_irix.go
+++ b/libgo/go/syscall/socket_irix.go
@@ -74,17 +74,9 @@ func BindToDevice(fd int, device string)
 	return ENOSYS
 }
 
-// struct ip_mreg is provived in , but protected with _SGIAPI.
-// This could be enabled with -D_SGI_SOURCE, but conflicts with
-// -D_XOPEN_SOURCE=500 required for msg_control etc. in struct msghgr, so
-// simply provide it here.
-type IPMreq struct {
-	Multiaddr [4]byte
-	Interface [4]byte
-}
-
-// Similarly,  only provides struct addrinfo, AI_* and EAI_* if
-// _NO_XOPEN4 && _NO_XOPEN5.
+//  only provides struct addrinfo, AI_* and EAI_* if  _NO_XOPEN4
+// && _NO_XOPEN5, but -D_XOPEN_SOURCE=500 is required for msg_control etc.
+// in struct msghgr, so simply provide them here.
 type Addrinfo struct {
 	Ai_flags int32
 	Ai_family int32
diff --git a/libgo/go/syscall/wait.c b/libgo/go/syscall/wait.c
--- a/libgo/go/syscall/wait.c
+++ b/libgo/go/syscall/wait.c
@@ -8,7 +8,9 @@
OS-independent.  */
 
 #define _GNU_SOURCE
+#ifndef __EXTENSIONS__
 #define __EXTENSIONS__
+#endif
 
 #include 
 #include 


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Continue strict-volatile-bitfields fixes

2011-12-20 Thread Bernd Schmidt
On 11/29/11 17:35, Mitchell, Mark wrote:
>>> So, I still think this patch is the best way to go forward, and it
>> does
>>> fix incorrect code generation. Would appreciate an OK.
>>
>> Ping.
> 
> If you don't hear any objections within a week, please proceed.

Committed now after bootstrapping i686-linux and retesting arm-linux
(some timeout permutations in libstdc++, expected with my qemu setup).


Bernd


[ada] Provide CLOCK_REALTIME on Tru64 UNIX

2011-12-20 Thread Rainer Orth
Some patch within the last week has broken Tru64 UNIX Ada bootstrap:

s-taprop.adb:46:12: warning: no entities of "Os_Constants" are referenced
s-taprop.adb:58:04: warning: no entities of "OSC" are referenced
s-taprop.adb:594:35: "CLOCK_RT_Ada" not declared in "OS_Constants"
make[6]: *** [s-taprop.o] Error 1

The definition of CLOCK_REALTIME in  is only visible if
_POSIX_C_SOURCE >= 199309L, which isn't the case by default, but implied
by _XOPEN_SOURCE = 500.

The following patch does this and allowed the build to complete.  make
check is still running.

Ok for mainline if it passes?

Rainer


2011-12-20  Rainer Orth  

gcc/ada:
* s-oscons-tmplt.c [__alpha__ && __osf__] (_XOPEN_SOURCE): Define.

diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -85,6 +85,12 @@ pragma Style_Checks ("M32766");
  **/
 #define _XOPEN_SOURCE 500
 
+#elif defined (__alpha__) && defined (__osf__)
+/** For Tru64 UNIX, _XOPEN_SOURCE must be defined, otherwise CLOCK_REALTIME
+ ** is not defined.
+ **/
+#define _XOPEN_SOURCE 500
+
 #elif defined (__mips) && defined (__sgi)
 /** For IRIX 6, _XOPEN5 must be defined and _XOPEN_IOV_MAX must be used as
  ** IOV_MAX, otherwise IOV_MAX is not defined.  IRIX 5 has neither.


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Avoid leading dash in expr call

2011-12-20 Thread Andreas Schwab
Andreas Tobler pointed out that passing a string with leading dash as
argument to expr is non-portable.  Checked in as obvious.

Andreas.

2011-12-20  Andreas Schwab  

* warnings.m4 (ACX_PROG_CC_WARNING_OPTS): Avoid leading dash in
expr call.

diff --git a/config/warnings.m4 b/config/warnings.m4
index 292e5a4..b64b594 100644
--- a/config/warnings.m4
+++ b/config/warnings.m4
@@ -32,7 +32,7 @@ for real_option in $1; do
   # Do the check with the no- prefix removed since gcc silently
   # accepts any -Wno-* option on purpose
   case $real_option in
--Wno-*) option=-W`expr $real_option : '-Wno-\(.*\)'` ;;
+-Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
 *) option=$real_option ;;
   esac
   AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
-- 
1.7.8


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


PR middle-end/51472: set DECL_GIMPLE_REG_P on TM vector saves

2011-12-20 Thread Aldy Hernandez
The problem here is a verify_gimple ICE because a vector store's LHS is 
not a gimple register, but the vector type is a gimple_reg_type.


 if (!is_gimple_reg (lhs)
  && is_gimple_reg_type (TREE_TYPE (lhs)))
{
  error ("invalid rhs for gimple memory store");
  debug_generic_stmt (lhs);
  debug_generic_stmt (rhs1);
  return true;
}

The reason that is_gimple_reg() is false, is because the vector variable 
is not marked as DECL_GIMPLE_REG_P.  If I understand DECL_GIMPLE_REG_P 
correctly, it should be true, since the TM saves/restores are not 
aliased and the only store to them are killing assignments.


I also noticed we didn't call update_stmt() after 
gimple_assign_set_lhs(), so I have called it.  However, this part is not 
strictly necessary for the patch.


The attached patch fixes the PR, and causes no regressions to the TM 
testsuite.


OK pending further tests?
PR middle-end/51472
* trans-mem.c (tm_log_emit_saves): Set DECL_GIMPLE_REG_P and
update statement.

Index: testsuite/gcc.dg/tm/pr51472.c
===
--- testsuite/gcc.dg/tm/pr51472.c   (revision 0)
+++ testsuite/gcc.dg/tm/pr51472.c   (revision 0)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O  --param tm-max-aggregate-size=32" } */
+
+typedef int __attribute__ ((vector_size (16))) vectype;
+vectype v;
+
+void
+foo (int c)
+{
+  vectype *p = __builtin_malloc (sizeof (vectype));
+  __transaction_atomic
+  {
+*p = v;
+if (c)
+  __transaction_cancel;
+  }
+}
Index: trans-mem.c
===
--- trans-mem.c (revision 182542)
+++ trans-mem.c (working copy)
@@ -1186,8 +1186,15 @@ tm_log_emit_saves (basic_block entry_blo
 will create a VOP for us and everything will just work.  */
   if (is_gimple_reg_type (TREE_TYPE (lp->save_var)))
{
+ tree var;
+
  lp->save_var = make_ssa_name (lp->save_var, stmt);
+ var = SSA_NAME_VAR (lp->save_var);
  gimple_assign_set_lhs (stmt, lp->save_var);
+ if (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
+   DECL_GIMPLE_REG_P (var) = 1;
+ update_stmt (stmt);
}
 
   gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);


Re: [ada] Provide CLOCK_REALTIME on Tru64 UNIX

2011-12-20 Thread Arnaud Charlet
> Some patch within the last week has broken Tru64 UNIX Ada bootstrap:
> 
> s-taprop.adb:46:12: warning: no entities of "Os_Constants" are
> referenced
> s-taprop.adb:58:04: warning: no entities of "OSC" are referenced
> s-taprop.adb:594:35: "CLOCK_RT_Ada" not declared in "OS_Constants"
> make[6]: *** [s-taprop.o] Error 1
> 
> The definition of CLOCK_REALTIME in  is only visible if
> _POSIX_C_SOURCE >= 199309L, which isn't the case by default, but implied
> by _XOPEN_SOURCE = 500.
> 
> The following patch does this and allowed the build to complete.  make
> check is still running.
> 
> Ok for mainline if it passes?
> 
>   Rainer
> 
> 2011-12-20  Rainer Orth  
> 
>   gcc/ada:
>   * s-oscons-tmplt.c [__alpha__ && __osf__] (_XOPEN_SOURCE): Define.

OK, thanks.


Re: [PATCH, SMS] Prevent the creation of reg-moves for definitions with MODE_CC

2011-12-20 Thread Richard Sandiford
Revital Eres  writes:
> +/* Return true if one of the definitions in INSN has MODE_CC.  Otherwise
> +   return false.  */
> +static bool
> +def_has_ccmode_p (rtx insn)
> +{
> +  df_ref *def;
> +
> +  for (def = DF_INSN_DEFS (insn); *def; def++)
> +{
> +  enum machine_mode mode = GET_MODE (DF_REF_REG (*def));
> +
> +  if (GET_MODE_CLASS (mode) == MODE_CC)
> +   return true;
> +}
> +
> +  return false;
> +}

FWIW, an alternative might be to test have_regs_of_mode[(int) mode].
That says whether there are any allocatable (non-fixed) registers
of the given mode.

Richard


Re: Go patch committed: Implement new syscall package

2011-12-20 Thread Ian Lance Taylor
Rainer Orth  writes:

> Now IRIX finally bootstrap again, I had to make two adjustments to have
> libgo build there.
>
> * go/syscall/wait.c doesn't compile:
>
> /vol/gcc/src/hg/trunk/local/libgo/go/syscall/wait.c:11:0: error: 
> "__EXTENSIONS__" redefined [-Werror]
> /vol/gcc/src/hg/trunk/local/libgo/go/syscall/wait.c:1:0: note: this is the 
> location of the previous definition
>
>   I've wrapped the __EXTENSIONS__ definition in #ifndef/#endif, but
>   think this is the wrong approach: definitions of _GNU_SOURCE,
>   __EXTENSIONS__ and other platform-specific stuff should go into
>   configure.ac or mksysinfo.sh, not individual sources.  There are more
>   instances of this problem, but they don't hurt me on IRIX.

Makes sense.  I have committed this patch to try to clean this up a bit.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.

Ian

diff -r 870b56a3d07e libgo/Makefile.am
--- a/libgo/Makefile.am	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/Makefile.am	Tue Dec 20 09:18:16 2011 -0800
@@ -37,7 +37,7 @@
 ACLOCAL_AMFLAGS = -I ./config -I ../config
 
 AM_CFLAGS = -fexceptions -fplan9-extensions $(SPLIT_STACK) $(WARN_CFLAGS) \
-	$(STRINGOPS_FLAG) \
+	$(STRINGOPS_FLAG) $(OSCFLAGS) \
 	-I $(srcdir)/../libgcc -I $(MULTIBUILDTOP)../../gcc/include
 
 if USING_SPLIT_STACK
diff -r 870b56a3d07e libgo/configure.ac
--- a/libgo/configure.ac	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/configure.ac	Tue Dec 20 09:18:16 2011 -0800
@@ -277,23 +277,24 @@
 AC_SUBST(GO_SYSCALL_OS_FILE)
 AC_SUBST(GO_SYSCALL_OS_ARCH_FILE)
 
-dnl Some targets need special flags to build sysinfo.go.
+dnl Special flags used to generate sysinfo.go.
+OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 case "$target" in
 mips-sgi-irix6.5*)
 	# IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct
 	# msghdr in .
-	OSCFLAGS='-D_XOPEN_SOURCE=500'
+	OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=500"
 	;;
 *-*-solaris2.[[89]])
 	# Solaris 8/9 need this so struct msghdr gets the msg_control
 	# etc. fields in  (_XPG4_2).
-	OSCFLAGS='-D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D__EXTENSIONS__'
+	OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D__EXTENSIONS__"
 	;;
 *-*-solaris2.1[[01]])
 	# Solaris 10+ needs this so struct msghdr gets the msg_control
 	# etc. fields in  (_XPG4_2).  _XOPEN_SOURCE=500 as
 	# above doesn't work with C99.
-	OSCFLAGS='-D_XOPEN_SOURCE=600 -D__EXTENSIONS__'
+	OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
 	;;
 esac
 AC_SUBST(OSCFLAGS)
diff -r 870b56a3d07e libgo/go/syscall/wait.c
--- a/libgo/go/syscall/wait.c	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/go/syscall/wait.c	Tue Dec 20 09:18:16 2011 -0800
@@ -7,9 +7,6 @@
We use C code to extract the wait status so that we can easily be
OS-independent.  */
 
-#define _GNU_SOURCE
-#define __EXTENSIONS__
-
 #include 
 #include 
 
diff -r 870b56a3d07e libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Fri Dec 16 06:45:11 2011 -0800
+++ b/libgo/mksysinfo.sh	Tue Dec 20 09:18:16 2011 -0800
@@ -25,10 +25,6 @@
 cat > sysinfo.c <
 #include 
 #include 


Re: Go patch committed: Implement new syscall package

2011-12-20 Thread Ian Lance Taylor
Rainer Orth  writes:

> * There's a redefinition of IPMreq now:
>
> sysinfo.go:3089:6: error: redefinition of 'IPMreq'
> /vol/gcc/src/hg/trunk/local/libgo/go/syscall/socket_irix.go:81:6: note: 
> previous definition of 'IPMreq' was here
>
>   For some reason, sysinfo.go now gets the right definition, so the one
>   in socket_irix.go isn't necessary any longer.

It changed because mksysinfo.sh now unconditionally defines IPMreq.  I
did that because it is needed in order to compile the net package, and
RTEMS doesn't define it at all.  We can get away with this on Irix
because the definition is pretty much the same on all systems.

I committed your patch to socket_irix.go.

Thank.

Ian


libgo patch committed: Remove some more _GNU_SOURCE

2011-12-20 Thread Ian Lance Taylor
I realized that I didn't remove uses of _GNU_SOURCE from libgo/runtime.
They are no longer necessary now that it is defined on the command line
for all libgo .c files.  Bootstrapped on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r cf7ab235f776 libgo/runtime/runtime.h
--- a/libgo/runtime/runtime.h	Tue Dec 20 10:17:02 2011 -0800
+++ b/libgo/runtime/runtime.h	Tue Dec 20 10:46:59 2011 -0800
@@ -6,7 +6,6 @@
 
 #include "config.h"
 
-#define _GNU_SOURCE
 #include "go-assert.h"
 #include 
 #include 
diff -r cf7ab235f776 libgo/runtime/yield.c
--- a/libgo/runtime/yield.c	Tue Dec 20 10:17:02 2011 -0800
+++ b/libgo/runtime/yield.c	Tue Dec 20 10:46:59 2011 -0800
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-#define _GNU_SOURCE
-
 #include "config.h"
 
 #include 


[PATCH][Cilkplus] Test case for N-Dimension array notation feature

2011-12-20 Thread Iyer, Balaji V
 
Hello Everyone,
This patch affects the C-Compiler in the Cilkplus branch. This patch will 
add a test case for the N-Dimension array notation feature.

Thanking You,

Yours Sincerely,

Balaji V. iyer.diff --git a/gcc/testsuite/ChangeLog.cilk b/gcc/testsuite/ChangeLog.cilk
index 6fef5a8..e4df224 100644
--- a/gcc/testsuite/ChangeLog.cilk
+++ b/gcc/testsuite/ChangeLog.cilk
@@ -1,3 +1,8 @@
+2011-12-20  Balaji V. Iyer  
+
+   * gcc.dg/cilk-plus/array_notation_test/array_test_ND.c: New N-Dimension
+   array notation test.
+
 2011-12-07  Balaji V. Iyer  
 
* gcc.dg/cilk-plus/array_notation_test/array_test1.c: New.
diff --git 
a/gcc/testsuite/gcc.dg/cilk-plus/array_notation_tests/array_test_ND.c 
b/gcc/testsuite/gcc.dg/cilk-plus/array_notation_tests/array_test_ND.c
new file mode 100644
index 000..e8e3882
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/array_notation_tests/array_test_ND.c
@@ -0,0 +1,98 @@
+#include 
+
+int main(int argc, char **argv)
+{
+  int array[10][15], ii = 0, jj = 0,x = 0, z= 1 , y = 10 ;
+  int array_2[10][15];
+ 
+  if (argc != 3)
+{
+  fprintf(stderr, "Usage: %s 10 15\n", argv[0]);
+  return -1;
+}
+  printf("==\n"); 
+  for (ii = 0; ii < 10; ii++) {
+for (jj = 0; jj< 15; jj++) {
+  array[ii][jj] = ii+jj;
+  array_2[ii][jj] = 0;
+}
+  }
+  array_2[0:5:2][0:5:3] = array[0:5:2][0:5:3] + 1 + 5 + array[0][5] + x;
+
+  for (ii = 0; ii < 10; ii++)
+{
+  for (jj = 0; jj < 15; jj++)
+   {
+ printf("%2d ", array_2[ii][jj]);
+   }
+  printf("\n");
+}
+
+
+  printf("==\n"); 
+  for (ii = 0; ii < 10; ii++) {
+for (jj = 0; jj< 15; jj++) {
+  array[ii][jj] = ii+jj;
+  array_2[ii][jj] = 0;
+}
+  }
+  x = atoi(argv[1]);
+  y = atoi(argv[2]);
+  array_2[0:x:1][0:y:1] = array[0:x:1][0:y:1] + x + y + array[0:x:1][0:y:1];
+
+  for (ii = 0; ii < 10; ii++)
+{
+  for (jj = 0; jj < 15; jj++)
+   {
+ printf("%2d ", array_2[ii][jj]);
+   }
+  printf("\n");
+}
+
+  printf("==\n"); 
+  for (ii = 0; ii < 10; ii++) {
+for (jj = 0; jj< 15; jj++) {
+  array[ii][jj] = ii+jj;
+  array_2[ii][jj] = 0;
+}
+  }
+  x = atoi(argv[1]);
+  y = atoi(argv[2]);
+  z = (20- atoi (argv[1]))/atoi(argv[1]);
+  /* (20-10)/10 evaluates to 1 all the time :-). */
+  array_2[0:x:z][0:y:z] = array[0:x:z][0:y:z] + array[0:x:z][0:y:z] + y + z;
+  printf("x = %2d\ty = %2d\tz = %2d\n", x, y, z);
+  for (ii = 0; ii < 10; ii++)
+{
+  for (jj = 0; jj < 15; jj++)
+   {
+ printf("%2d ", array_2[ii][jj]);
+   }
+  printf("\n");
+}
+
+#if 1
+  printf("==\n"); 
+  for (ii = 0; ii < 10; ii++) {
+for (jj = 0; jj< 15; jj++) {
+  array[ii][jj] = ii+jj;
+  array_2[ii][jj] = 0;
+}
+  }
+  x = argc-3;
+  y = 20-atoi(argv[1]);
+  z = (20- atoi (argv[1]))/atoi(argv[1]);
+  /* (20-10)/10 evaluates to 1 all the time :-). */
+  
array_2[(argc-3):(20-atoi(argv[1])):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])):
 ((30-atoi(argv[2]))/atoi(argv[2]))] = 
array[(argc-3):20-atoi(argv[1]):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])):
 (30-atoi(argv[2]))/atoi(argv[2])] + 
array[(argc-3):20-atoi(argv[1]):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])):
 (30-atoi(argv[2]))/atoi(argv[2])] * 
array[(argc-3):20-atoi(argv[1]):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])):
 (30-atoi(argv[2]))/atoi(argv[2])];
+  printf("x = %2d\ty = %2d\tz = %2d\n", x, y, z);
+  for (ii = 0; ii < 10; ii++)
+{
+  for (jj = 0; jj < 15; jj++)
+   {
+ printf("%4d ", array_2[ii][jj]);
+   }
+  printf("\n");
+}
+#endif
+  return 0;
+}


Re: [PATCH, SMS] Prevent the creation of reg-moves for definitions with MODE_CC

2011-12-20 Thread Revital Eres
Hello,

> FWIW, an alternative might be to test have_regs_of_mode[(int) mode].
> That says whether there are any allocatable (non-fixed) registers
> of the given mode.

Thanks, I'll prepare a new version of the patch using have_regs_of_mode.

Revital

>
> Richard


[PATCH] PR48524 spec language does not cover switches with separated form

2011-12-20 Thread Magnus Granberg
Hi

This patch make -D and -U work in the spec language, bug pr48524.
Tested on x86_64-unknown-linux-gnu snapshot 4.7-20111217

Magnus.

2011-12-18  Magnus Granberg  

pr48524
* gcc/gcc.c (switch_matches) Support switches with 
separated 
form, -D and -U.
* gcc/testsuite/gcc.dg/pr48524.cNew testcase.
* gcc/testsuite/gcc.dg/pr48524.spec New spec file 
for the testcase.


--- a/gcc/gcc.c	2011-11-03 15:46:26.0 +0100
+++ b/gcc/gcc.c	2011-12-17 21:05:02.353999101 +0100
@@ -5445,6 +5445,21 @@
 	&& check_live_switch (i, plen))
   return true;
 
+/* Check if a switch with separated form matching the atom.
+	We check -D and -U switches. */
+else if (switches[i].args != 0)
+  {
+	if ((*switches[i].part1 == 'D' || *switches[i].part1 == 'U')
+	&& *switches[i].part1 == atom[0])
+	  {
+	if (!strncmp (switches[i].args[0], &atom[1], len -1)
+		&& (starred || (switches[i].part1[1]== '\0'
+		&& switches[i].args[0][len -1] == '\0'))
+		&& check_live_switch (i, (starred ? 1 : -1)))
+	  return true;
+	  }
+  }
+
   return false;
 }
 
--- a/gcc/testsuite/gcc.dg/pr48524.c	2011-12-18 16:34:59.592259140 +0100
+++ b/gcc/testsuite/gcc.dg/pr48524.c	2011-12-18 02:11:22.0 +0100
@@ -0,0 +1,6 @@
+/* { dg-do preprocess } */
+/* { dg-options "-specs=${srcdir}/gcc.dg/pr48524.spec -D_TEST_D" } */
+# ifdef _FOO
+# error works /* { dg-error "works" } */
+# endif
+
--- a/gcc/testsuite/gcc.dg/pr48524.spec	2011-12-18 16:35:21.120259782 +0100
+++ b/gcc/testsuite/gcc.dg/pr48524.spec	2011-12-18 00:44:32.0 +0100
@@ -0,0 +1,5 @@
+*cpp_options:
+%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+ %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
+ %{undef} %{save-temps*:-fpch-preprocess} %{D_TEST_D:-D_FOO}
+


Add -std=c11 option, final __STDC_VERSION__ value, etc.

2011-12-20 Thread Joseph S. Myers
Now that C11 has been published, this patch implements options
-std=c11, -std=iso9899:2011 and -std=gnu11 and deprecates -std=c1x and
-std=gnu1x.  The intended final __STDC_VERSION__ value, 201112L, is
also implemented (the editor forgot to update the 201ymmL placeholders
before sending the document for publication by ISO).

Documentation is updated accordingly.  (Jason, standards.texi still
has a paragraph about C++0x that needs updating for the publication of
C++11.)  I also changed headers testing __STDC_VERSION__ for C11
support to test against the final C11 value.  As testcases for the new
options, I added tests of __STDC_VERSION__ - and since we appeared to
be missing any such tests for C99 or C94, I added those as well.  I
don't plan to rename existing c1x-* tests, but new tests should be
named c11-*.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Applied
to mainline.

gcc:
2011-12-20  Joseph Myers  

* c-decl.c (diagnose_mismatched_decls, grokdeclarator, grokfield)
(finish_struct): Refer to C11 in comments.  Use flag_isoc11.
* c-parser.c (c_parser_static_assert_declaration)
(c_parser_static_assert_declaration_no_semi, c_parser_declspecs)
(c_parser_alignas_specifier, c_parser_alignof_expression): Refer
to C11 in comments.  Use flag_isoc11.
* c-typeck.c (comptypes_check_different_types): Refer to C11 in
comment.
* doc/cpp.texi (Overview): Refer to -std=c11 instead of -std=c1x.
* doc/cppopts.texi (-std=c11, -std=gnu11): Document in preference
to -std=c1x and -std=gnu1x.
* doc/extend.texi (Inline, Alternate Keywords, Other Builtins)
(__builtin_complex, Unnamed Fields): Refer to -std=c11 and C11
instead of -std=c1x and C1X.
* doc/invoke.texi (-std=c11, -std=iso9899:2011): Document in
preference to -std=c1x.
(-std=gnu11): Document in preference to -std=gnu1x.
* doc/standards.texi: Document C11 instead of C1X.  Document C11
as actual standard.  Document headers required from freestanding
C11 implementations.
* ginclude/float.h, ginclude/stddef.h: Test __STDC_VERSION__ >=
201112L for C11.  Update comments to refer to C11.

gcc/c-family:
2011-12-20  Joseph Myers  

* c-common.c (flag_isoc99): Update comment to refer to C11.
(flag_isoc1x): Change to flag_isoc11.
* c-common.h (flag_isoc99): Update comment to refer to C11.
(flag_isoc1x): Change to flag_isoc11.
* c-cppbuiltin.c (cpp_atomic_builtins): Change comment to refer to
C11.
* c-opts.c (set_std_c1x): Change to set_std_c11.
(c_common_handle_option): Handle OPT_std_c11 and OPT_std_gnu11.
Call set_std_c11.
(set_std_c89, set_std_c99, set_std_c11): Use flag_isoc11.
(set_std_c1): Use CLK_STDC11 and CLK_GNUC11.
* c.opt (std=c1x): Change to std=c11.  Document as non-draft
standard.
(std=c1x, std=iso9899:2011): Add as aliases of std=c11.
(std=gnu1x): Change to std=gnu11.  Refer to non-draft standard.
(std=gnu1x): Make alias of std=gnu11.

gcc/testsuite:
2011-12-20  Joseph Myers  

* gcc.dg/c11-version-1.c, gcc.dg/c11-version-2.c,
gcc.dg/c94-version-1.c, gcc.dg/c99-version-1.c,
gcc.dg/gnu11-version-1.c: New tests.

libcpp:
2011-12-20  Joseph Myers  

* include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11.
(CLK_STDC1X): Change to CLK_STDC11.
* init.c (lang_defaults): Update comments.
(cpp_init_builtins): Update language tests.  Use 201112L for C11
__STDC_VERSION__.

Index: gcc/doc/cpp.texi
===
--- gcc/doc/cpp.texi(revision 182544)
+++ gcc/doc/cpp.texi(working copy)
@@ -216,7 +216,7 @@ few things required by the standard.  Th
 rarely, if ever, used, and may cause surprising changes to the meaning
 of a program which does not expect them.  To get strict ISO Standard C,
 you should use the @option{-std=c90}, @option{-std=c99} or
-@option{-std=c1x} options, depending
+@option{-std=c11} options, depending
 on which version of the standard you want.  To get all the mandatory
 diagnostics, you must also use @option{-pedantic}.  @xref{Invocation}.
 
Index: gcc/doc/standards.texi
===
--- gcc/doc/standards.texi  (revision 182544)
+++ gcc/doc/standards.texi  (working copy)
@@ -33,6 +33,8 @@ with some exceptions, and possibly with 
 @cindex C99
 @cindex ISO C9X
 @cindex C9X
+@cindex ISO C11
+@cindex C11
 @cindex ISO C1X
 @cindex C1X
 @cindex Technical Corrigenda
@@ -95,9 +97,11 @@ Errors in the 1999 ISO C standard were c
 Corrigenda published in 2001, 2004 and 2007.  GCC does not support the
 uncorrected version.
 
-A fourth version of the C standard, known as @dfn{C1X}, is under
-development; GCC has limited preliminary support for parts of this
-standard, e

Re: [PATCH] Implement stap probe on ARM's unwinder

2011-12-20 Thread Tom Tromey
> "Ramana" == Ramana Radhakrishnan  writes:

Ramana> Otherwise looks ok to me .

Sergio was asked me to ping this for him, but instead I re-read the
entire thread and I think that this was an approval conditional on him
making the request changes (just to ChangeLog), which he did.

So, I am checking it in.

Tom


[C++ Patch] for c++/23211

2011-12-20 Thread Fabien Chêne
Hi,

As a follow up of c++/14258, this one is about undiagnosed using
declarations whose nested-name-specifier is not a base.
The diagnostic was only emitted at instantiation time, whereas it
could be emitted before.
I just removed a test to perform the verification before
instantiation, it seems to work.
Tested x86_64-unknown-linux-gnu, OK to commit ?

gcc/testsuite/ChangeLog

2011-12-20  Fabien Chêne  

PR c++/23211
* g++.dg/template/using18.C: New.
* g++.dg/template/nested3.C: Remove dg-message on the
instantiation.
* g++.dg/template/crash13.C: Likewise.

gcc/cp/ChangeLog

2011-12-20  Fabien Chêne  

PR c++/23211
* name-lookup.c (do_class_using_decl): Check that the
nested-name-specifier of a class-scope using declaration refers to
a base class, even if the current scope is dependent.
* parser.c (cp_parser_using_declaration): Set
USING_DECL_TYPENAME_P to 1 if the DECL is not null. Re-indent a
'else' close to the prior modification.

-- 
Fabien


23211.patch
Description: Binary data


patch for PR49865

2011-12-20 Thread Vladimir Makarov
The following patch solves PR49865.  The problem is described on 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49865


The patch changes code a bit only for gcc, crafty, and mesa on x86.  
There is no visible change in the performance.
Only code for crafty is changed on x86-64 and improvement in the 
performance is about 0.3%.


The patch was successfully bootstrapped on x86/x86-64.

The patch has been committed as rev. 182553.

2011-12-20  Vladimir Makarov 

PR target/49865
* ira-costs.c (find_costs_and_classes): Prefer registers even
  if the memory cost is the same.


Index: ira-costs.c
===
--- ira-costs.c (revision 182552)
+++ ira-costs.c (working copy)
@@ -1693,7 +1693,14 @@ find_costs_and_classes (FILE *dump_file)
  else if (i_costs[k] == best_cost)
best = ira_reg_class_subunion[best][rclass];
  if (pass == flag_expensive_optimizations
- && i_costs[k] < i_mem_cost
+ /* We still prefer registers to memory even at this
+stage if their costs are the same.  We will make
+a final decision during assigning hard registers
+when we have all info including more accurate
+costs which might be affected by assigning hard
+registers to other pseudos because the pseudos
+involved in moves can be coalesced.  */
+ && i_costs[k] <= i_mem_cost
  && (reg_class_size[reg_class_subunion[alt_class][rclass]]
  > reg_class_size[alt_class]))
alt_class = reg_class_subunion[alt_class][rclass];


Ping^2: Add a prepare_pch_save target hook (fix many MIPS16 PCH failures)

2011-12-20 Thread Richard Sandiford
Ping for this patch to add a prepare_pch_save target hook:

http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00273.html

It fixes many PCH failures for MIPS16 (which are a regression from
earlier releases).

The patch gets rid of some locally-cached state before writing out the
PCH file.  We have to do that because some of the state is not under
GGC control, and is too expensive to put under GGC control purely for
the sake of PCH.  For avoidance of doubt, the patch doesn't change the
user's MIPS16 vs. non-MIPS16 setting for any code; that's decided by
attributes on a function-by-function basis, or by mips_base_mips16 in
the global case.

Hopefully the pch branch will make all this redundant for 4.8,
but for the time being: OK for trunk?

Richard


Re: [google] Backport r171347 and r181549 from trunk (strict volatile bitfield) (issue5434084)

2011-12-20 Thread Brendan Conoboy
Anyone?

On Wed, Dec 14, 2011 at 1:10 PM, Brendan Conoboy  wrote:
> On Mon, 12 Dec 2011 08:24:41 +0800, Doug Kwan wrote:
>> Sorry about my oversight. I am on vacation now until Dec 19.  I don't
>> have good internet access now and I will backport this to upstream 4.6
>> after I come back if the 4.6 maintainers agree to take this.
>
> There isn't really anything to backport as the patch applies to the
> branch without trouble.  Likewise, Joey Ye's fix also applies cleanly.
>  It seems anybody who is interested in arm is already using one or
> both of these patches so it's really just a question of what is needed
> to get permission for it to be checked into the 4.6 branch.  As I
> mentioned in PR51442, the x86_64 test results are equivalent before
> and after they're applied, so the risk seems quite small.  We just
> need somebody with the authority to do so to approve it and/or check
> it in.
>
> -Brendan


Re: [google] Backport r171347 and r181549 from trunk (strict volatile bitfield) (issue5434084)

2011-12-20 Thread Jakub Jelinek
On Tue, Dec 20, 2011 at 02:35:29PM -0800, Brendan Conoboy wrote:
> Anyone?

This is ok for 4.6 if it has been sufficiently tested.

Jakub


Re: [build] Fix bootstrap/51072: libitm not disabled without c++

2011-12-20 Thread Eric Botcazou
> So, the patch causing this was reverted and bootstrap worked again(?),
> and now it is broken again with the same failure mode:
>
>   cc1: error: unrecognized command line option "-Wno-narrowing"
>
> Actually, not the same, now it is invoking system gcc instead of
> system g++:
>
>   gcc  -I/scratch/tmp/gerald/gcc-HEAD/libcpp -I.
> -I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include -I./../intl
> -I/scratch/tmp/gerald/gcc-HEAD/libcpp/include  -g -f keep-inline-functions
> -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute
> -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
> -Wc++-compat -pedantic -Wno-long-long 
> -I/scratch/tmp/gerald/gcc-HEAD/libcpp -I.
> -I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include -I./../intl
> -I/scratch/tmp/gerald/gcc-HEAD/libcpp/include  -c -o identifiers.o -MT
> identifiers.o -MMD -MP -MF .deps/identifiers.Tpo
> /scratch/tmp/gerald/gcc-HEAD/libcpp/identifiers.c
>
> And it happens in stage1 (stage1-bubble).

This looks like a different problem though, as naked 'gcc' is supposed to be 
invoked during stage1.  I'll try to reproduce...

-- 
Eric Botcazou


Re: [trunk] RFS: translate built-in include paths for sysroot (issue5394041)

2011-12-20 Thread Joseph S. Myers
On Tue, 6 Dec 2011, Han Shen wrote:

> +gcc_gxx_include_dir_add_sysroot=0
> +if test "${with_sysroot+set}" = set; then :
> +  gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : 
> "${with_sysroot}"'\(.*\)'`
> +  if test "${gcc_gxx_without_sysroot}"; then :

No need for the " :" after "then" in two places here (the only reason I 
could see for having it would be if the contents of the "if" were the 
expansion of an autoconf macro that might expand to empty, so you needed 
to make sure the contents were nonempty).

The patch is OK with that fixed.

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


Re: [PATCH] PR48524 spec language does not cover switches with separated form

2011-12-20 Thread Joseph S. Myers
On Tue, 20 Dec 2011, Magnus Granberg wrote:

> This patch make -D and -U work in the spec language, bug pr48524.
> Tested on x86_64-unknown-linux-gnu snapshot 4.7-20111217

Thanks for your contributions.  As you've contributed before, this patch 
brings things to about the point where a copyright assignment will be 
needed.  Please see  for the 
information to send to the FSF to get the assignment form.

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


libgcc patch committed: Improve calling non-split-stack code

2011-12-20 Thread Ian Lance Taylor
When the gold linker sees a call from -fsplit-stack code to code
compiled without -fsplit-stack, it arranges for the function to call
__morestack_non_split instead of __morestack.  The __morestack_non_split
function requests a larger stack, one that is large enough to run code
which doesn't know about split stacks.

In libgo.so, many functions refer to TLS variables, which means that
they are calling the function __tls_get_addr, which is in libc and is
not compiled with -fsplit-stack.  This means that many libgo functions
always split the stack.  In particular, many libgo functions always
split the stack, and then call other libgo functions which themselves
always split the stack.  This leads to the stack being split many times,
far more than necessary.

This libgcc patch to __morestack_non_split partially avoids this
problem.  Before this patch, __morestack_non_split would always simply
increment the requested stack size by 0x4000 and carry on, thus always
splitting the stack.  This patch changes it to first see whether there
is enough space on the current stack to handle the requested stack size
plus 0x4000.  If there is enough space, then it simply returns without
splitting the stack.  If there is not enough space, then it increments
the requested stack size by 0x5000.  The effect of this change is that
the first function which calls non-split-stack code allocates a large
stack, and that functions which it calls in turn can continue using the
same large stack (up to a point, of course).

Splitting the stack requires blocking and unblocking signals, which is a
system call.  Making this change reduced the number of times that the
libgo net/http testsuite calls sigprogmask from 3604100 to 26597, which
is about a 99%.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.  Also ran
the split-stack C tests.  Committed to mainline.

Ian

Index: config/i386/morestack.S
===
--- config/i386/morestack.S	(revision 182418)
+++ config/i386/morestack.S	(working copy)
@@ -96,13 +96,113 @@
 #endif
 
 __morestack_non_split:
+	.cfi_startproc
 
 #ifndef __x86_64__
-	addl	$0x4000,4(%esp)
+
+	# See below for an extended explanation of the CFI instructions.
+	.cfi_offset 8, 8		# New PC stored at CFA + 8
+	.cfi_escape 0x15, 4, 0x7d	# DW_CFA_val_offset_sf, %esp, 12/-4
+	# i.e., next %esp is CFA + 12
+
+	pushl	%eax			# Save %eax in case it is a parameter.
+
+	.cfi_def_cfa %esp,8		# Account for pushed register.
+
+	movl	%esp,%eax		# Current stack,
+	subl	8(%esp),%eax		# less required stack frame size,
+	subl	$0x4000,%eax		# less space for non-split code.
+	cmpl	%gs:0x30,%eax		# See if we have enough space.
+	jb	2f			# Get more space if we need it.
+
+	# Here the stack is
+	#	%esp + 20:	stack pointer after two returns
+	#	%esp + 16:	return address of morestack caller's caller
+	#	%esp + 12:	size of parameters
+	#	%esp + 8:	new stack frame size
+	#	%esp + 4:	return address of this function
+	#	%esp:		saved %eax
+	#
+	# Since we aren't doing a full split stack, we don't need to
+	# do anything when our caller returns.  So we return to our
+	# caller rather than calling it, and let it return as usual.
+	# To make that work we adjust the return address.
+
+	# This breaks call/return address prediction for the call to
+	# this function.  I can't figure out a way to make it work
+	# short of copying the parameters down the stack, which will
+	# probably take more clock cycles than we will lose breaking
+	# call/return address prediction.  We will only break
+	# prediction for this call, not for our caller.
+
+	movl	4(%esp),%eax		# Increment the return address
+	cmpb	$0xc3,(%eax)		# to skip the ret instruction;
+	je	1f			# see above.
+	addl	$2,%eax
+1:	inc	%eax
+	movl	%eax,4(%esp)		# Update return address.
+
+	popl	%eax			# Restore %eax and stack.
+
+	.cfi_def_cfa %esp,4		# Account for popped register.
+
+	ret	$8			# Return to caller, popping args.
+
+2:
+	.cfi_def_cfa %esp,8		# Back to where we were.
+
+	popl	%eax			# Restore %eax and stack.
+
+	.cfi_def_cfa %esp,4		# Account for popped register.
+
+	addl	$0x5000+BACKOFF,4(%esp)	# Increment space we request.
+
+	# Fall through into morestack.
+
+#else
+
+	# See below for an extended explanation of the CFI instructions.
+	.cfi_offset 16, 0
+	.cfi_escape 0x15, 7, 0x7f	# DW_CFA_val_offset_sf, %esp, 8/-8
+
+	pushq	%rax			# Save %rax in case caller is using
+	# it to preserve original %r10.
+	.cfi_def_cfa %rsp,16		# Adjust for pushed register.
+
+	movq	%rsp,%rax		# Current stack,
+	subq	%r10,%rax		# less required stack frame size,
+	subq	$0x4000,%rax		# less space for non-split code.
+
+#ifdef __LP64__
+	cmpq	%fs:0x70,%rax		# See if we have enough space.
 #else
-	addq	$0x4000,%r10
+	cmpl	%fs:0x40,%eax
+#endif
+	jb	2f			# Get more space if we need it.
+
+	# This breaks call/return prediction, as described above.
+	incq	8(%rsp)			# Increment the return address.
+
+	popq	%rax			# Restore register.
+
+	.cfi_def_cfa

Re: [google] Backport r171347 and r181549 from trunk (strict volatile bitfield) (issue5434084)

2011-12-20 Thread Brendan Conoboy
On Tue, Dec 20, 2011 at 2:37 PM, Jakub Jelinek  wrote:
> This is ok for 4.6 if it has been sufficiently tested.

Okay!  Is there any testing you'd like to see beyond the
aforementioned success with arm and x86_64 linux?

-Brendan


Fix generic vector simplification and reduction

2011-12-20 Thread Richard Henderson
As seen on ia64 with some of our explicit test cases for V4SI-alike operations.

On ia64 the actual variables get instantiated in TImode, not BLKmode as bits of
this code had been assuming.  By checking !vector_mode rather than for BLKmode
directly, we can decompose the V4SI shift into two V2SImode shifts.

Additionally, fix several tests using VECTOR_MODE_P when they meant 
VECTOR_TYPE_P.
And since they're shifts, simplify further to VECTOR_INTEGER_TYPE_P.

Bootstrapped and checked on ia64-linux, and x86_64-linux.


r~
commit 64791788b1009469dbbb8709957c2069c77cf400
Author: rth 
Date:   Wed Dec 21 00:41:24 2011 +

Always simplify vector shifts by scalars.
Also decompose vectors in large integer modes.

* tree-vect-generic.c (expand_vector_operations_1): Correct tests
for vector types -- use the type not the mode.  Fix optab selection
for vector shifts by a scalar.  Handle over-large integer modes
like BLKmode.

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

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4304d6e..fbd55ef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
 2011-12-20  Richard Henderson  
 
+   * tree-vect-generic.c (expand_vector_operations_1): Correct tests
+   for vector types -- use the type not the mode.  Fix optab selection
+   for vector shifts by a scalar.  Handle over-large integer modes
+   like BLKmode.
+
+2011-12-20  Richard Henderson  
+
* config/arm/arm.md (*arm_xorsi3): Match iorsi3 and perform
post-reload splitting.
 
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index dc01ce7..469a465 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -796,10 +796,12 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
   || code == LROTATE_EXPR
   || code == RROTATE_EXPR)
 {
+  optab opv;
+
   /* Check whether we have vector  {x,x,x,x} where x
  could be a scalar variable or a constant.  Transform
  vector  {x,x,x,x} ==> vector  scalar.  */
-  if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (rhs2
+  if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
 {
   tree first;
   gimple def_stmt;
@@ -818,17 +820,18 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
 }
 }
 
-  if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (rhs2
-op = optab_for_tree_code (code, type, optab_vector);
+  opv = optab_for_tree_code (code, type, optab_vector);
+  if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
+   op = opv;
   else
{
   op = optab_for_tree_code (code, type, optab_scalar);
 
  /* The rtl expander will expand vector/scalar as vector/vector
 if necessary.  Don't bother converting the stmt here.  */
- if (op == NULL
- || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
-   op = optab_for_tree_code (code, type, optab_vector);
+ if (optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing
+ && optab_handler (opv, TYPE_MODE (type)) != CODE_FOR_nothing)
+   return;
}
 }
   else
@@ -859,14 +862,16 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
 
   /* For very wide vectors, try using a smaller vector mode.  */
   compute_type = type;
-  if (TYPE_MODE (type) == BLKmode && op)
+  if (!VECTOR_MODE_P (TYPE_MODE (type)) && op)
 {
   tree vector_compute_type
 = type_for_widest_vector_mode (TYPE_MODE (TREE_TYPE (type)), op,
   TYPE_SATURATING (TREE_TYPE (type)));
   if (vector_compute_type != NULL_TREE
  && (TYPE_VECTOR_SUBPARTS (vector_compute_type)
- < TYPE_VECTOR_SUBPARTS (compute_type)))
+ < TYPE_VECTOR_SUBPARTS (compute_type))
+ && (optab_handler (op, TYPE_MODE (vector_compute_type))
+ != CODE_FOR_nothing))
compute_type = vector_compute_type;
 }
 


[ia64] Support vec_perm_const

2011-12-20 Thread Richard Henderson
Some improvements to the previous versions, which include more 
permutation patterns actually generated by the vectorizer in the
course of the testsuite.

Tested on ia64-linux and committed.
commit b155a608c2332b4bf64bcfe07ed059178044f97a
Author: rth 
Date:   Wed Dec 21 01:03:00 2011 +

ia64: Implement vec_perm_const.

* config/ia64/ia64.c (MAX_VECT_LEN): New.
(struct expand_vec_perm_d): New.
(TARGET_VECTORIZE_VEC_PERM_CONST_OK): New.
(ia64_unpack_assemble): Use ia64_expand_vec_perm_const_1.
(expand_vselect, expand_vselect_vconcat): New.
(expand_vec_perm_identity, expand_vec_perm_shrp): New.
(expand_vec_perm_1, expand_vec_perm_broadcast): New.
(expand_vec_perm_interleave_2, expand_vec_perm_v4hi_5): New.
(ia64_expand_vec_perm_const_1, ia64_expand_vec_perm_const): New.
(ia64_vectorize_vec_perm_const_ok): New.
(ia64_expand_vec_setv2sf, ia64_expand_vec_perm_even_odd): New.
* config/ia64/ia64-protos.h: Update.
* config/ia64/vect.md (VEC): New mode iterator.
(vecint): New mode attribute.
(vec_interleave_lowv8qi, vec_interleave_highv8qi): Privatize with 
'*'.
(vec_interleave_lowv4hi, vec_interleave_highv4hi): Likewise.
(vec_interleave_lowv2si, vec_interleave_highv2si): Likewise.
(vec_interleave_lowv2sf, vec_interleave_highv2sf): Likewise.
(mix1_even, mix1_odd, mux1_alt): Likewise.
(mux1_brcst_qi): Remove '*' from name.
(vec_extract_evenv8qi, vec_extract_oddv8qi): Remove.
(vec_extract_evenv4hi, vec_extract_oddv4hi): Remove.
(vec_extract_evenv2si, vec_extract_oddv2si): Remove.
(vec_extract_evenv2sf, vec_extract_oddv2sf): Remove.
(vec_extract_evenodd_helper): Remove.
(vec_setv2sf): Use ia64_expand_vec_setv2sf.
(vec_pack_trunc_v4hi): Use ia64_expand_vec_perm_even_odd.
(vec_pack_trunc_v2si): Likewise.
(vec_perm_const): New.

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

diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h
index a680c31..f7bd4c6 100644
--- a/gcc/config/ia64/ia64-protos.h
+++ b/gcc/config/ia64/ia64-protos.h
@@ -61,6 +61,10 @@ extern int ia64_hard_regno_rename_ok (int, int);
 extern enum reg_class ia64_secondary_reload_class (enum reg_class,
   enum machine_mode, rtx);
 extern const char *get_bundle_name (int);
+
+extern void ia64_expand_vec_perm_even_odd (rtx, rtx, rtx, int);
+extern bool ia64_expand_vec_perm_const (rtx op[4]);
+extern void ia64_expand_vec_setv2sf (rtx op[3]);
 #endif /* RTX_CODE */
 
 #ifdef TREE_CODE
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index b970607..1635a7e 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -330,6 +330,24 @@ static reg_class_t ia64_preferred_reload_class (rtx, 
reg_class_t);
 static enum machine_mode ia64_get_reg_raw_mode (int regno);
 static section * ia64_hpux_function_section (tree, enum node_frequency,
 bool, bool);
+
+static bool ia64_vectorize_vec_perm_const_ok (enum machine_mode vmode,
+ const unsigned char *sel);
+
+#define MAX_VECT_LEN   8
+
+struct expand_vec_perm_d
+{
+  rtx target, op0, op1;
+  unsigned char perm[MAX_VECT_LEN];
+  enum machine_mode vmode;
+  unsigned char nelt;
+  bool one_operand_p;
+  bool testing_p; 
+};
+
+static bool ia64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d);
+
 
 /* Table of valid machine attributes.  */
 static const struct attribute_spec ia64_attribute_table[] =
@@ -626,6 +644,9 @@ static const struct attribute_spec ia64_attribute_table[] =
 #undef TARGET_DELAY_VARTRACK
 #define TARGET_DELAY_VARTRACK true
 
+#undef TARGET_VECTORIZE_VEC_PERM_CONST_OK
+#define TARGET_VECTORIZE_VEC_PERM_CONST_OK ia64_vectorize_vec_perm_const_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 typedef enum
@@ -2027,28 +2048,28 @@ ia64_expand_vecint_minmax (enum rtx_code code, enum 
machine_mode mode,
 void
 ia64_unpack_assemble (rtx out, rtx lo, rtx hi, bool highp)
 {
-  enum machine_mode mode = GET_MODE (lo);
-  rtx (*gen) (rtx, rtx, rtx);
-  rtx x;
+  enum machine_mode vmode = GET_MODE (lo);
+  unsigned int i, high, nelt = GET_MODE_NUNITS (vmode);
+  struct expand_vec_perm_d d;
+  bool ok;
 
-  switch (mode)
+  d.target = gen_lowpart (vmode, out);
+  d.op0 = (TARGET_BIG_ENDIAN ? hi : lo);
+  d.op1 = (TARGET_BIG_ENDIAN ? lo : hi);
+  d.vmode = vmode;
+  d.nelt = nelt;
+  d.one_operand_p = false;
+  d.testing_p = false;
+
+  high = (highp ? nelt / 2 : 0);
+  for (i = 0; i < nelt / 2; ++i)
 {
-case V8QImode:
-  gen = highp ? gen_vec_interleave_highv8qi : gen_vec_interleave_lowv8qi;
-  break;
-case V4HImod

[RFC / Patch] PR 51305

2011-12-20 Thread Paolo Carlini

Hi,

this is a rejects-valid with constexpr & noexcept, noticed by Daniel 
(and myself time ago). I find it pretty annoying. Anyway, the issue is, 
we reject:


constexpr bool ok() noexcept
{
  typedef int type;
  return true;
}

constexpr auto x = ok();

because of the noexcept. What happens is that massage_constexpr_body 
looks inside MUST_NOT_THROW_EXPR but then doesn't notice that body is 
still a BIND_EXPR.


Thus the obvious idea is processing the latter as we would do if the 
noexcept were not there and that indeed fixes the issue without 
regressions, but I'm not sure if we shouldn't recurse / iterate more 
generically (or do indeed something else entirely)


Thanks,
Paolo.

//
Index: testsuite/g++.dg/cpp0x/constexpr-noexcept6.C
===
--- testsuite/g++.dg/cpp0x/constexpr-noexcept6.C(revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-noexcept6.C(revision 0)
@@ -0,0 +1,10 @@
+// PR c++/51305
+// { dg-options -std=c++0x }
+
+constexpr bool ok() noexcept
+{
+  typedef int type;
+  return true;
+}
+
+constexpr auto x = ok();
Index: cp/semantics.c
===
--- cp/semantics.c  (revision 182556)
+++ cp/semantics.c  (working copy)
@@ -6003,7 +6003,11 @@ massage_constexpr_body (tree fun, tree body)
   if (TREE_CODE (body) == EH_SPEC_BLOCK)
 body = EH_SPEC_STMTS (body);
   if (TREE_CODE (body) == MUST_NOT_THROW_EXPR)
-   body = TREE_OPERAND (body, 0);
+   {
+ body = TREE_OPERAND (body, 0);
+ if (TREE_CODE (body) == BIND_EXPR)
+   body = BIND_EXPR_BODY (body);
+   }
   body = constexpr_fn_retval (body);
 }
   return body;


Re: [C++ Patch] for c++/23211

2011-12-20 Thread Jason Merrill
This seems problematic to me; it could be that a dependent scope ends up 
matching a non-dependent base in the end, i.e.


struct A { int x; };

template 
struct B: A
{
  using T::x;
};

B b;

this code is silly, but I think well-formed, and that your patch will 
break it.


I think that just changing dependent_type_p (scope) to dependent_scope_p 
(scope) will have the desired effect on this testcase.


Jason


Backport r180979 from branches/google/gcc-4_6. (issue 5501051)

2011-12-20 Thread asharif

Reviewers: xur, bjanakiraman_google.com, jingyu,

Message:
Please review this backport.



Please review this at http://codereview.appspot.com/5501051/

Affected files:
   Mgcc-4_6-mobile
  M gcc-4_6-mobile/gcc/ChangeLog.google-4_6
  M gcc-4_6-mobile/gcc/common.opt
  M gcc-4_6-mobile/gcc/coverage.c
  M gcc-4_6-mobile/gcc/flag-types.h
  M gcc-4_6-mobile/gcc/mcf.c
  M gcc-4_6-mobile/gcc/opts.c
  M gcc-4_6-mobile/gcc/profile.c
  M gcc-4_6-mobile/gcc/testsuite/g++.dg/tree-ssa/dom-invalid.C
  M gcc-4_6-mobile/gcc/testsuite/gcc.dg/pr26570.c
  M gcc-4_6-mobile/gcc/testsuite/gcc.dg/pr32773.c
  M gcc-4_6-mobile/gcc/testsuite/gcc.dg/pr40209.c
  M gcc-4_6-mobile/gcc/tree-profile.c
  M gcc-4_6-mobile/gcc/value-prof.c




Re: Continue strict-volatile-bitfields fixes

2011-12-20 Thread Ye Joey
On Wed, Dec 21, 2011 at 12:46 AM, Bernd Schmidt  wrote:
> On 11/29/11 17:35, Mitchell, Mark wrote:
 So, I still think this patch is the best way to go forward, and it
>>> does
 fix incorrect code generation. Would appreciate an OK.
>>>
>>> Ping.
>>
>> If you don't hear any objections within a week, please proceed.
>
> Committed now after bootstrapping i686-linux and retesting arm-linux
> (some timeout permutations in libstdc++, expected with my qemu setup).
>
>
> Bernd
Noticed a typo in toplev.c:
s/fstrict-volatile-bitfield/fstrict-volatile-bitfields/

Also I'd like to add following target independent test case

Joey Ye  
   * gcc.dg/volatile-bitfields-2.c: New test.

--- gcc/testsuite/gcc.dg/volatile-bitfields-2.c (revision 0)
+++ gcc/testsuite/gcc.dg/volatile-bitfields-2.c (revision 0)
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-fstrict-volatile-bitfields" } */
+
+extern void abort(void);
+struct thing {
+  volatile unsigned short a: 8;
+  volatile unsigned short b: 8;
+} t = {1,2};
+
+int main()
+{
+  t.a = 3;
+  if (t.a !=3 || t.b !=2) abort();
+  return 0;
+}


Re: Continue strict-volatile-bitfields fixes

2011-12-20 Thread Ye Joey
This should be in 4.6 too

- Joey

On Wed, Dec 21, 2011 at 12:46 AM, Bernd Schmidt  wrote:
> On 11/29/11 17:35, Mitchell, Mark wrote:
 So, I still think this patch is the best way to go forward, and it
>>> does
 fix incorrect code generation. Would appreciate an OK.
>>>
>>> Ping.
>>
>> If you don't hear any objections within a week, please proceed.
>
> Committed now after bootstrapping i686-linux and retesting arm-linux
> (some timeout permutations in libstdc++, expected with my qemu setup).
>
>
> Bernd


Re: Backport r180979 from branches/google/gcc-4_6. (issue 5501051)

2011-12-20 Thread asharif

Adding shenhan.

http://codereview.appspot.com/5501051/


Re: [RFC] Cleanup DW_CFA_GNU_args_size handling

2011-12-20 Thread Jie Zhang
Hi,

On Tue, Aug 2, 2011 at 6:32 PM, Richard Henderson  wrote:
> I got Jeff Law to review the reload change on IRC
> and committed the composite patch.
>
> Tested on x86_64, i586, avr, and h8300.  Most other
> tier1 targets ought not be affected, as this patch
> only applies to ACCUMULATE_OUTGOING_ARGS == 0 targets.
>
This commit may have caused

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51552


Regards,
Jie


Re: Backport r180979 from branches/google/gcc-4_6. (issue 5501051)

2011-12-20 Thread 沈涵
LGTM++

On Tue, Dec 20, 2011 at 8:22 PM,  wrote:
>
> Adding shenhan.
>
> http://codereview.appspot.com/5501051/


Re: [build] Fix bootstrap/51072: libitm not disabled without c++

2011-12-20 Thread Andreas Tobler

On 20.12.11 23:35, Eric Botcazou wrote:

So, the patch causing this was reverted and bootstrap worked again(?),
and now it is broken again with the same failure mode:

   cc1: error: unrecognized command line option "-Wno-narrowing"

Actually, not the same, now it is invoking system gcc instead of
system g++:

   gcc  -I/scratch/tmp/gerald/gcc-HEAD/libcpp -I.
-I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include -I./../intl
-I/scratch/tmp/gerald/gcc-HEAD/libcpp/include  -g -f keep-inline-functions
-W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-Wc++-compat -pedantic -Wno-long-long
-I/scratch/tmp/gerald/gcc-HEAD/libcpp -I.
-I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include -I./../intl
-I/scratch/tmp/gerald/gcc-HEAD/libcpp/include  -c -o identifiers.o -MT
identifiers.o -MMD -MP -MF .deps/identifiers.Tpo
/scratch/tmp/gerald/gcc-HEAD/libcpp/identifiers.c

And it happens in stage1 (stage1-bubble).


This looks like a different problem though, as naked 'gcc' is supposed to be
invoked during stage1.  I'll try to reproduce...


Fyi, there was an issue on FreeBSD with this commit:

http://gcc.gnu.org/viewcvs?view=revision&revision=182478

See at the bottom of:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51388

Andreas fixed the issue and committed a fix:

http://gcc.gnu.org/ml/gcc-cvs/2011-12/msg00686.html

After this commit I was able to succesfully bootstrap (r182546) on 
x86_64-unknown-freebsd10.0.


Right now building 182566.

If this is not related, pls ignore.

Andreas


RE: [RFC] Use REG_EXPR in back-end (introduced by optimization to conditional and/or in ARM back-end)

2011-12-20 Thread Jiangning Liu

> -Original Message-
> From: Richard Henderson [mailto:r...@redhat.com]
> Sent: Tuesday, November 22, 2011 9:55 AM
> To: Jiangning Liu
> Cc: gcc-patches@gcc.gnu.org; 'Richard Guenther'
> Subject: Re: [RFC] Use REG_EXPR in back-end (introduced by optimization
> to conditional and/or in ARM back-end)
> 
> On 11/21/2011 05:31 PM, Jiangning Liu wrote:
> > My question is essentially is "May I really use REG_EXPR in back-end
> code?"
> > like the patch I gave below?
> 
> I suppose.
> 
> Another alternative is to use BImode for booleans.  Dunno how much of
> that
> you'd be able to gleen from mere rtl expansion or if you'd need boolean
> decls to be expanded with BImode.

Hi Richard,

The output of expand pass requires the operands must meet the requirement of
general_operand for binary operations, i.e. all RTX operations on top level
must meet the hardware instruction requirement. Generally for a hardware not
directly supporting a single bit logic operation, we can't generate BI mode
rtx dest.

So if I simply generate BImode for NE in expand pass, like "subreg:SI (ne:BI
(reg:SI xxx) (const_int 0)))", there would be an assertion failure due to
failing to find an appropriate instruction code to operate on a single bit.

This looks like a GCC design level issue. How would you suggest generating a
legitimate rtx expression containing BImode?

Thanks,
-Jiangning

> 
> The later would probably need a target hook.  I've often wondered how
> much
> ia64 would benefit from that too, being able to store bool variables
> directly
> in predicate registers.
> 
> All of this almost certainly must wait until stage1 opens up again
> though...
> 
> 
> r~






Re: [google] Backport r171347 and r181549 from trunk (strict volatile bitfield) (issue5434084)

2011-12-20 Thread Jakub Jelinek
On Tue, Dec 20, 2011 at 04:04:16PM -0800, Brendan Conoboy wrote:
> On Tue, Dec 20, 2011 at 2:37 PM, Jakub Jelinek  wrote:
> > This is ok for 4.6 if it has been sufficiently tested.
> 
> Okay!  Is there any testing you'd like to see beyond the
> aforementioned success with arm and x86_64 linux?

That is sufficient.

Jakub