Re: [PATCH, PR 51782] Derive rtx address space from base object

2012-02-22 Thread Richard Guenther
On Tue, Feb 21, 2012 at 6:02 PM, Georg-Johann Lay a...@gjlay.de wrote:
 Martin Jambor wrote:
 Hi,

 PR 51782 showed that COMPONENT_REFs created by SRA got expanded with a
 wrong address space because the address space was not specified in the
 type of the whole tree.  This is however inconsistent with how we
 encode address spaces in MEM_REFs where they are supposed to be stored
 in the type of its address operand (as opposed to the type of the
 reference).  Therefore the following patch changes the expansion to
 always look at the base address and look through MEM_REFs if
 necessary.

 It fixes the issue for me on a cross compiler, a bootstrap and
 testsuite run on x86_64-linux showed only regressions described in PR
 52297 so I consider it successful.  My understanding is that Richi
 approved it in bugzilla.  Georg-Johann Lay said he would test it on HW
 or simulator that actually uses address spaces and he has also already
 committed a testcase for this bug.  Therefore I intend to commit the
 patch if his tests pass too.

 Thanks,

 Martin

 The avr test suite has passed now, okay from that side.

And indeed the patch is ok from my side as well.

Thanks,
Richard.

 Johann


[Patch, Fortran] PR52335 - allow OPEN(..., DELIM=) with -std=f95

2012-02-22 Thread Tobias Burnus
The following patch fixes a 4.4 to 4.7 regression. Already Fortran 95 
allows DELIM= in OPEN and INQUIRE. Fortran 2003 only added it to data 
transfer statements (i.e. WRITE; not allowed for READ and not possible 
for PRINT). Cf. F95/F2003 standard and the PR.


Build and regtested on x86-64-linux.
OK for the trunk and the 4.4 to 4.6 branches?

Tobias

PS: I am not sure how far I will back port, maybe only to 4.5.
2012-02-22  Tobias Burnus  bur...@net-b.de

	PR fortran/52335
	* io.c (gfc_match_open): Remove bogus F2003 DELIM= check.

2012-02-22  Tobias Burnus  bur...@net-b.de

	PR fortran/52335
	* gfortran.dg/io_constraints_10.f90: New.

Index: gcc/fortran/io.c
===
--- gcc/fortran/io.c	(revision 184459)
+++ gcc/fortran/io.c	(working copy)
@@ -1947,10 +1947,6 @@ gfc_match_open (void)
   /* Checks on the DELIM specifier.  */
   if (open-delim)
 {
-  if (gfc_notify_std (GFC_STD_F2003, Fortran 2003: DELIM= at %C 
-	  not allowed in Fortran 95) == FAILURE)
-	goto cleanup;
-
   if (open-delim-expr_type == EXPR_CONSTANT)
 	{
 	  static const char *delim[] = { APOSTROPHE, QUOTE, NONE, NULL };
Index: gcc/testsuite/gfortran.dg/io_constraints_10.f90
===
--- gcc/testsuite/gfortran.dg/io_constraints_10.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/io_constraints_10.f90	(working copy)
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options -std=f95 }
+!
+! PR fortran/52335
+!
+
+integer :: lun
+character(len=20) :: str
+
+! VALID Fortran 95:
+open(unit=lun,file=str,delim='apostrophe',status='old')
+inquire(lun, delim=str)
+
+! Fortran 2003:
+write(*,*, delim='apostrophe') 'a' ! { dg-error Fortran 2003: DELIM= at .1. not allowed in Fortran 95 }
+end


Re: [patch lto-plugin]: Fix pr 50616

2012-02-22 Thread Richard Guenther
On Wed, Feb 22, 2012 at 11:05 AM, Kai Tietz ktiet...@googlemail.com wrote:
 Here is revised patch.  Sadly inttypes.h can't be used here.  So we
 need local check for this.

 ChangeLog

 2012-02-22  Kai Tietz  kti...@redhat.com

        PR lto/50616
        * lto-plugin.c (PRI_LL): New macro.
        (dump_symtab): Use PRI_LL instead of ll in print.
        (process_symtab): Use PRI_LL instead of ll in scan.

 Tested for i686-w64-mingw32, x86_64-w64-mingw32, and for
 x86_64-unknown-linux-gnu.

 Ok for apply?

Ok.

Thanks,
Richard.

 Regards,
 Kai


 Index: lto-plugin.c
 ===
 --- lto-plugin.c        (revision 184426)
 +++ lto-plugin.c        (working copy)
 @@ -62,6 +62,14 @@
  #include simple-object.h
  #include plugin-api.h

 +/* We need to use I64 instead of ll width-specifier on native Windows.
 +   The reason for this is that older MS-runtimes don't support the ll.  */
 +#ifdef __MINGW32__
 +#define PRI_LL I64
 +#else
 +#define PRI_LL ll
 +#endif
 +
  /* Handle opening elf files on hosts, such as Windows, that may use
    text file handling that will break binary access.  */
  #ifndef O_BINARY
 @@ -360,7 +368,7 @@

       assert (resolution != LDPR_UNKNOWN);

 -      fprintf (f, %u %llx %s %s\n,
 +      fprintf (f, %u % PRI_LL x %s %s\n,
                (unsigned int) slot, symtab-aux[j].id,
               lto_resolution_str[resolution],
               symtab-syms[j].name);
 @@ -816,7 +824,7 @@

   s = strrchr (name, '.');
   if (s)
 -    sscanf (s, .%llx, obj-out-id);
 +    sscanf (s, .% PRI_LL x, obj-out-id);
   secdata = xmalloc (length);
   offset += obj-file-offset;
   if (offset != lseek (obj-file-fd, offset, SEEK_SET)


[Patch,AVR,4.6]: Fix PR50063 GCC does not support FP = SP

2012-02-22 Thread Georg-Johann Lay
Denis Chertykov wrote:
 2012/2/21 Richard Henderson:
 On 02/21/12 09:08, Georg-Johann Lay wrote:
   PR rtl-optimization/50063
   * config/avr/avr.md (movhi_sp_r): Handle -1 (unknown IRQ state)
   and 2 (8-bit SP) in operand 2.
   * config/avr/avr.c (avr_prologue_setup_frame): Adjust prologue
   setup to use movhi_sp_r instead of vanilla move to write SP.
   Adjust REG_CFA notes to superseed unspec.
   (expand_epilogue): Adjust epilogue setup to use read_sp instead
   of vanilla move.
   As function body might contain CLI or SEI: Use irq_state 0 (IRQ
   known to be off) only with TARGET_NO_INTERRUPTS. Never use
   irq_state 1 (IRQ known to be on) here.
 The CFA bits in avr_prologue_setup_frame look good.
 I'll let Denis or Eric review the movhi_sp_r change.
 
 Approved.
 
 Denis.

Here is a patchlet for 4.6. It just sets -fno-dse to work around the problem
because I think back-porting all what's needed is too much change.

Compiling avr-libc without DSE gives the same sizes for all objects which shows
that this is not a crucial optimization for avr.

Ok for 4.6 branch?

Johann


PR rtl-optimization/50063
* config/avr/avr.c (avr_option_override): Disable DSE.



Index: config/avr/avr.c
===
--- config/avr/avr.c(revision 184460)
+++ config/avr/avr.c(working copy)
@@ -245,6 +245,11 @@ avr_option_override (void)

   flag_delete_null_pointer_checks = 0;

+  /* Kick off DSE in order to hack around PR rtl-optimization/50063.
+ Backporting all of 4.7 is too much.  */
+
+  flag_dse = 0;
+
   for (t = avr_mcu_types; t-name; t++)
 if (strcmp (t-name, avr_mcu_name) == 0)
   break;



Unreviewed libstdc++/libgomp patch

2012-02-22 Thread Rainer Orth
The following patch has remained unreviewed for a week:

[v3, libgomp, build] Fix Solaris symbol versioning (PR libstdc++/52188)
http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00819.html

It is critical to avoid breaking libstdc++.so symbol versioning on
Solaris and requires libstdc++ and libgomp maintainers.

Thanks.
Rainer

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


Re: [Patch,AVR,4.6]: Fix PR50063 GCC does not support FP = SP

2012-02-22 Thread Richard Guenther
On Wed, Feb 22, 2012 at 11:39 AM, Georg-Johann Lay a...@gjlay.de wrote:
 Denis Chertykov wrote:
 2012/2/21 Richard Henderson:
 On 02/21/12 09:08, Georg-Johann Lay wrote:
       PR rtl-optimization/50063
       * config/avr/avr.md (movhi_sp_r): Handle -1 (unknown IRQ state)
       and 2 (8-bit SP) in operand 2.
       * config/avr/avr.c (avr_prologue_setup_frame): Adjust prologue
       setup to use movhi_sp_r instead of vanilla move to write SP.
       Adjust REG_CFA notes to superseed unspec.
       (expand_epilogue): Adjust epilogue setup to use read_sp instead
       of vanilla move.
       As function body might contain CLI or SEI: Use irq_state 0 (IRQ
       known to be off) only with TARGET_NO_INTERRUPTS. Never use
       irq_state 1 (IRQ known to be on) here.
 The CFA bits in avr_prologue_setup_frame look good.
 I'll let Denis or Eric review the movhi_sp_r change.

 Approved.

 Denis.

 Here is a patchlet for 4.6. It just sets -fno-dse to work around the problem
 because I think back-porting all what's needed is too much change.

 Compiling avr-libc without DSE gives the same sizes for all objects which 
 shows
 that this is not a crucial optimization for avr.

 Ok for 4.6 branch?

I don't think this kind of fixes are wanted.  The patch misses a
testcase to backport
and the issue surely not only affects DSE.

Richard.

 Johann


        PR rtl-optimization/50063
        * config/avr/avr.c (avr_option_override): Disable DSE.



 Index: config/avr/avr.c
 ===
 --- config/avr/avr.c    (revision 184460)
 +++ config/avr/avr.c    (working copy)
 @@ -245,6 +245,11 @@ avr_option_override (void)

   flag_delete_null_pointer_checks = 0;

 +  /* Kick off DSE in order to hack around PR rtl-optimization/50063.
 +     Backporting all of 4.7 is too much.  */
 +
 +  flag_dse = 0;
 +
   for (t = avr_mcu_types; t-name; t++)
     if (strcmp (t-name, avr_mcu_name) == 0)
       break;



Re: Unreviewed libstdc++/libgomp patch

2012-02-22 Thread Jakub Jelinek
On Wed, Feb 22, 2012 at 12:07:39PM +0100, Rainer Orth wrote:
 The following patch has remained unreviewed for a week:
 
   [v3, libgomp, build] Fix Solaris symbol versioning (PR libstdc++/52188)
 http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00819.html
 
 It is critical to avoid breaking libstdc++.so symbol versioning on
 Solaris and requires libstdc++ and libgomp maintainers.
 

The libgomp changes are ok if the libstdc++ changes are approved.

Jakub


[build] Use alternate thread library on Solaris 8 even without TLS

2012-02-22 Thread Rainer Orth
I noticed the following testsuite failure on Solaris 8/x86 with Sun as/ld:

WARNING: program timed out.
FAIL: gcc.dg/di-sync-multithread.c execution test

It turns out that the testcase hangs if /usr/lib/libthread.so is used
(as it is by default), but works with the alternate thread library in
/usr/lib/lwp.  The latter is what's supposed to be used on Solaris 8,
anyway, but right now it does not when the toolchain used (Sun as in
this case) doesn't support TLS.  To avoid this, I chose to
unconditionally link with -lthread for -pthread on Solaris 8, which
achieves the desired outcome and fixes the failure: without -lthread and
LD_LIBRARY_PATH, libthread.so is just a dependency of libpthread.so and
is only searched for via the latter's RUNPATH (none), with an explicit
-lthread, -L/-R/usr/lib/lwp causes the alternate thread library to be
used.

Bootstrapped without regressions on i386-pc-solaris2.8 and
sparc-sun-solaris2.8, installed on mainline.

Rainer


2012-01-29  Rainer Orth  r...@cebitec.uni-bielefeld.de

* configure.ac (LIB_TLS_SPEC): Enforce use of alternate thread
library on Solaris 8 even without TLS support.
* configure: Regenerate.

# HG changeset patch
# Parent 1fb4a848efe883fb988c1d3c4089f85a125f7932
Use alternate thread library on Solaris 8 even without TLS

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3259,6 +3259,13 @@ case $target in
 if test $set_have_as_tls = no; then
   LIBS=
 fi
+# Even without TLS support on Solaris 8, explicitly link with libthread
+# to guarantee that the alternate thread library is used.
+case $target in
+  *-*-solaris2.8)
+	LIBS=-lthread
+	;;
+esac
 # Always define LIB_TLS_SPEC, even without TLS support.
 AC_DEFINE_UNQUOTED(LIB_TLS_SPEC, $LIBS,
 [Define to the library containing __tls_get_addr/___tls_get_addr.])


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


[PATCH] Fix PR52329

2012-02-22 Thread Richard Guenther

This fixes PR52329 and avoids invalid MEM_REFs to be passed to
RTL expansion.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-02-22  Richard Guenther  rguent...@suse.de

PR middle-end/52329
* gimple-fold.c (fold_stmt_1): Also canonicalize ADDR_EXPRs
for GIMPLE_DEBUG stmts.

Index: gcc/gimple-fold.c
===
--- gcc/gimple-fold.c   (revision 184460)
+++ gcc/gimple-fold.c   (working copy)
@@ -1250,6 +1250,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi,
  changed = true;
}
}
+ else if (val
+   TREE_CODE (val) == ADDR_EXPR)
+   {
+ tree ref = TREE_OPERAND (val, 0);
+ tree tem = maybe_fold_reference (ref, false);
+ if (tem)
+   {
+ tem = build_fold_addr_expr_with_type (tem, TREE_TYPE (val));
+ gimple_debug_bind_set_value (stmt, tem);
+ changed = true;
+   }
+   }
}
   break;
 


Re: Implementation of swi attribute for ARM

2012-02-22 Thread Richard Earnshaw
On 21/02/12 19:30, Barracuda wrote:
 1) No, I don't. I think I should read FAQ about this then work will be 
 completed =) I'm not interested in copyrighting this, just want to share it 
 with other people.

This is an FSF concern, it has to be sorted to their satisfaction and rules.

 2) Probably most hard part for me, but I'll try to do this.
 I've never used testsuites before, but now it's time to begin.
 3) What type of documentation I must provide? Brief annotation (as for other 
 attributes)? Yes, I've just use standart calling convention - first 4 args 
 resides in r0-r3, others in stack.

Patches to the GCC manual (to be found in the texinfo files in the
gcc/doc subdirectory of the sources).

 4,5,6,7,8,10 - thanks for help, I made some corrections and improvements - 
 wrote comments, tidy up the style, add more range and null-pointer checks. 
 Also, as you suggested, in addition to svc I've implemented smc attribute 
 and dummy hvc attribute - can't find documentation for hvc, I've just noted 
 it's Hypervisor Call. Then code will be completed, I'll made patch for trunk, 
 for now I can't checkout it, sorry.
 And, of course, thanks for reply

R.



[Ada] Front-end layout in a generic unit

2012-02-22 Thread Arnaud Charlet
Front-end layout must not be performed within a generic unit, because the
types therein will be recreated in an instance, and their characteristics are
partially unknown when analyzing a generic unit. Previously only generic types
themselves were excluded from layout determination.

Patch allows compilation of some run-time units when Fronend_Layout is true.

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

2012-02-22  Ed Schonberg  schonb...@adacore.com

* freeze.adb (Freeze_Entity): Do not perform type layout within
a generic unit.

Index: freeze.adb
===
--- freeze.adb  (revision 184470)
+++ freeze.adb  (working copy)
@@ -4407,10 +4407,12 @@
  --  the size and alignment values. This processing is not required for
  --  generic types, since generic types do not play any part in code
  --  generation, and so the size and alignment values for such types
- --  are irrelevant.
+ --  are irrelevant. Ditto for types declared within a generic unit,
+ --  which may have components that depend on generic parameters, and
+ --  that will be recreated in an instance.
 
- if Is_Generic_Type (E) then
-return Result;
+ if Inside_A_Generic then
+null;
 
  --  Otherwise we call the layout procedure
 


[Ada] Small tweak to signal handling code

2012-02-22 Thread Arnaud Charlet
This changes the mapping of SIGBUS from Constraint_Error to Storage_Error in
non-tasking mode on Linux, to be consistent with the tasking mode.

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

2012-02-22  Eric Botcazou  ebotca...@adacore.com

* init.c (__gnat_error_handler) [Linux]: Map SIGBUS to
Storage_Error.

Index: init.c
===
--- init.c  (revision 184470)
+++ init.c  (working copy)
@@ -6,7 +6,7 @@
  *  *
  *  C Implementation File   *
  *  *
- *  Copyright (C) 1992-2011, Free Software Foundation, Inc. *
+ *  Copyright (C) 1992-2012, Free Software Foundation, Inc. *
  *  *
  * GNAT 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- *
@@ -661,8 +661,8 @@
   break;
 
 case SIGBUS:
-  exception = constraint_error;
-  msg = SIGBUS;
+  exception = storage_error;
+  msg = SIGBUS: possible stack overflow;
   break;
 
 case SIGFPE:


[Ada] An actual for a formal type that is an extesion of a limited interface

2012-02-22 Thread Arnaud Charlet
AI05-087 is a binding interpretation that applies to previous versions of the
language. The compiler diagnoses the error at the point of instantiation in
Ada2012 mode, and at a point of illegal use in  Ada2005 mode.

the command:
gcc -c -gnat05 proc.adb
must yield:

   proc.adb:18:05: instantiation error at line 13
   proc.adb:18:05: assignment not available on limited type

the command:
   gcc -c -gnat12 proc.adb
must yield:

   proc.adb:18:45: actual for non-limited T cannot be a limited type
   proc.adb:18:45: instantiation abandoned
   proc.adb:33:06: Store is undefined

procedure Proc is
   package Pack is

  type Ifc is limited interface;

  generic
 type T is abstract new Ifc with private; -- T is nonlimited: 7.5(6.1/2)
 procedure Classwide_Store (Target : out T'Class; Source : T'Class);
   end Pack;
   package body Pack is
  procedure Classwide_Store (Target : out T'Class; Source : T'Class) is
  begin
  Target := Source;
  end Classwide_Store;
end Pack;
use Pack;

procedure Store is new Classwide_Store (Ifc); -- legal? (No.)

 task type Tsk;
 task body Tsk is
 begin
 null;
 end Tsk;

 type Has_Task is limited new Ifc with
 record
 F : Tsk;
 end record;

 X, Y : Has_Task;
 begin
 Store (X, Y);
 end;

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

2012-02-22  Ed Schonberg  schonb...@adacore.com

* exp_ch5.adb (Expand_N_Assignment_Statement): Reject an
assignment to a classwide type whose type is limited, as
can happen in an instantiation in programs that run afoul or
AI05-0087.


Index: exp_ch5.adb
===
--- exp_ch5.adb (revision 184470)
+++ exp_ch5.adb (working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+--  Copyright (C) 1992-2012, Free Software Foundation, Inc. --
 --  --
 -- GNAT 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- --
@@ -28,6 +28,7 @@
 with Checks;   use Checks;
 with Debug;use Debug;
 with Einfo;use Einfo;
+with Errout;   use Errout;
 with Exp_Aggr; use Exp_Aggr;
 with Exp_Ch6;  use Exp_Ch6;
 with Exp_Ch7;  use Exp_Ch7;
@@ -2086,6 +2087,18 @@
  and then
not Restriction_Active (No_Dispatching_Calls))
 then
+   if Is_Limited_Type (Typ) then
+
+  --  This can happen in an instance when the formal is an
+  --  extension of a limited interface, and the actual is
+  --  limited. This is an error according to AI05-0087, but
+  --  is not caught at the point of instantiation in earlier
+  --  versions.
+
+  Error_Msg_N (assignment not available on limited type, N);
+  return;
+   end if;
+
--  Fetch the primitive op _assign and proper type to call it.
--  Because of possible conflicts between private and full view,
--  fetch the proper type directly from the operation profile.


[Ada] Minor changes for GNAT dimensionality checking system

2012-02-22 Thread Arnaud Charlet
Tested on x86_64-pc-linux-gnu, committed on trunk

2012-02-22  Vincent Pucci  pu...@adacore.com

* rtsfind.adb (Get_Unit_Name): Ada_Numerics_Child and
System_Dim_Child cases added.
* rtsfind.ads: Ada_Numerics,
Ada_Numerics_Generic_Elementary_Functions, System_Dim,
System_Dim_Float_IO and System_Dim_Integer_IO added to the list
of RTU_Id.  Ada_Numerics_Child and System_Dim_Child added as
new RTU_Id subtypes.
* sem_dim.adb (Is_Dim_IO_Package_Entity): Use of
Rtsfind to verify the package entity is located either
in System.Dim.Integer_IO or in System.Dim.Float_IO.
(Is_Dim_IO_Package_Instantiation): Minor changes.
(Is_Elementary_Function_Call): Removed.
(Is_Elementary_Function_Entity): New routine.
(Is_Procedure_Put_Call): Is_Dim_IO_Package_Entity call added.
* snames.ads-tmpl: Name_Dim and Name_Generic_Elementary_Functions
removed.

Index: sem_dim.adb
===
--- sem_dim.adb (revision 184470)
+++ sem_dim.adb (working copy)
@@ -36,7 +36,6 @@
 with Sem;  use Sem;
 with Sem_Eval; use Sem_Eval;
 with Sem_Res;  use Sem_Res;
-with Sem_Util; use Sem_Util;
 with Sinfo;use Sinfo;
 with Snames;   use Snames;
 with Stand;use Stand;
@@ -1359,94 +1358,105 @@
-- Analyze_Dimension_Function_Call --
-
 
+   --  Propagate the dimensions from the returned type to the call node. Note
+   --  that there is a special treatment for elementary function calls. Indeed
+   --  for Sqrt call, the resulting dimensions equal to half the dimensions of
+   --  the actual, and for other elementary calls, this routine check that
+   --  every actuals are dimensionless.
+
procedure Analyze_Dimension_Function_Call (N : Node_Id) is
+  Actuals: constant List_Id := Parameter_Associations (N);
   Name_Call  : constant Node_Id := Name (N);
-  Actuals: constant List_Id := Parameter_Associations (N);
   Actual : Node_Id;
   Dims_Of_Actual : Dimension_Type;
   Dims_Of_Call   : Dimension_Type;
+  Ent: Entity_Id;
 
-  function Is_Elementary_Function_Call return Boolean;
-  --  Return True if the call is a call of an elementary function (see
+  function Is_Elementary_Function_Entity (E : Entity_Id) return Boolean;
+  --  Given E the original subprogram entity, return True if the call is a
+  --  an elementary function call (see
   --  Ada.Numerics.Generic_Elementary_Functions).
 
-  -
-  -- Is_Elementary_Function_Call --
-  -
+  ---
+  -- Is_Elementary_Function_Entity --
+  ---
 
-  function Is_Elementary_Function_Call return Boolean is
- Ent : Entity_Id;
+  function Is_Elementary_Function_Entity (E : Entity_Id) return Boolean is
+ Loc : constant Source_Ptr := Sloc (E);
 
   begin
- if Is_Entity_Name (Name_Call) then
-Ent := Entity (Name_Call);
+ --  Check the function entity is located in
+ --  Ada.Numerics.Generic_Elementary_Functions.
 
---  Check the procedure is defined in an instantiation of a generic
---  package.
+ return
+   Loc  No_Location
+ and then
+   Is_RTU
+(Cunit_Entity (Get_Source_Unit (Loc)),
+ Ada_Numerics_Generic_Elementary_Functions);
+  end Is_Elementary_Function_Entity;
 
-if Is_Generic_Instance (Scope (Ent)) then
-   Ent := Cunit_Entity (Get_Source_Unit (Ent));
+   --  Start of processing for Analyze_Dimension_Function_Call
 
-   --  Check the name of the generic package is
-   --  Generic_Elementary_Functions
+   begin
+  --  Look for elementary function call
 
-   return
- Is_Library_Level_Entity (Ent)
-   and then Chars (Ent) = Name_Generic_Elementary_Functions;
-end if;
- end if;
+  if Is_Entity_Name (Name_Call) then
+ Ent := Entity (Name_Call);
 
- return False;
-  end Is_Elementary_Function_Call;
+ --  Get the original subprogram entity following the renaming chain
 
-   --  Start of processing for Analyze_Dimension_Function_Call
+ if Present (Alias (Ent)) then
+Ent := Alias (Ent);
+ end if;
 
-   begin
-  --  Elementary function case
+ --  Elementary function case
 
-  if Is_Elementary_Function_Call then
+ if Is_Elementary_Function_Entity (Ent) then
 
  --  Sqrt function call case
 
- if Chars (Name_Call) = Name_Sqrt then
-Dims_Of_Call := Dimensions_Of (First (Actuals));
+if Chars (Ent) = Name_Sqrt then
+   Dims_Of_Call := 

Re: [Patch,AVR,4.6]: Fix PR50063 GCC does not support FP = SP

2012-02-22 Thread Richard Guenther
On Wed, Feb 22, 2012 at 1:11 PM, Georg-Johann Lay a...@gjlay.de wrote:
 Richard Guenther wrote:
 On Wed, Feb 22, 2012 at 11:39 AM, Georg-Johann Lay a...@gjlay.de wrote:
 Denis Chertykov wrote:
 2012/2/21 Richard Henderson:
 On 02/21/12 09:08, Georg-Johann Lay wrote:
       PR rtl-optimization/50063
       * config/avr/avr.md (movhi_sp_r): Handle -1 (unknown IRQ state)
       and 2 (8-bit SP) in operand 2.
       * config/avr/avr.c (avr_prologue_setup_frame): Adjust prologue
       setup to use movhi_sp_r instead of vanilla move to write SP.
       Adjust REG_CFA notes to superseed unspec.
       (expand_epilogue): Adjust epilogue setup to use read_sp instead
       of vanilla move.
       As function body might contain CLI or SEI: Use irq_state 0 (IRQ
       known to be off) only with TARGET_NO_INTERRUPTS. Never use
       irq_state 1 (IRQ known to be on) here.
 The CFA bits in avr_prologue_setup_frame look good.
 I'll let Denis or Eric review the movhi_sp_r change.
 Approved.

 Denis.
 Here is a patchlet for 4.6. It just sets -fno-dse to work around the problem
 because I think back-porting all what's needed is too much change.

 Compiling avr-libc without DSE gives the same sizes for all objects which 
 shows
 that this is not a crucial optimization for avr.

 Ok for 4.6 branch?

 I don't think this kind of fixes are wanted.  The patch misses a
 testcase to backport
 and the issue surely not only affects DSE.

 Richard.

 Actually, hacking the backend to work around assumptions in rtl-optimizers by
 hiding information in unspec_volatile is not wanted, too.

 If I understand correctly, no one is inclined to fix the root cause of the 
 bug,
 i.e. don't let RTL optimizers make assumptions that shred some backends.

I'm not sure about this.  Certainly you are the one hitting this bug(?), so you
would be the perfect volunteer to fix it ;)

Richard.

 Johann


[Ada] Bogus elaboration warnings on internally-generated finalizers

2012-02-22 Thread Arnaud Charlet
This patch suppresses elaboration checks on stack-related finalizers. Both the
spec and body of a finalizer are within the same construct and scope, but the
body is part of the handled sequence of statements. This placement confuses the
elaboration mechanism on targets which do not fully support AT_END handlers.
Since the compiler guarantees that the body of a finalizer is always inserted
in the same construct where the AT_END handler resides, there is no need for
elaboration checks.

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

2012-02-22  Hristian Kirtchev  kirtc...@adacore.com

* exp_ch7.adb (Create_Finalizer): Suppress elaboration checks on 
stack-related finalizers.

Index: exp_ch7.adb
===
--- exp_ch7.adb (revision 184470)
+++ exp_ch7.adb (working copy)
@@ -1372,6 +1372,37 @@
 Fin_Id :=
   Make_Defining_Identifier (Loc,
 Chars = New_External_Name (Name_uFinalizer));
+
+--  The visibility semantics of AT_END handlers force a strange
+--  separation of spec and body for stack-related finalizers:
+
+-- declare : Enclosing_Scope
+--procedure _finalizer;
+-- begin
+--controlled objects
+--procedure _finalizer is
+--   ...
+-- at end
+--_finalizer;
+-- end;
+
+--  Both spec and body are within the same construct and scope, but
+--  the body is part of the handled sequence of statements. This
+--  placement confuses the elaboration mechanism on targets where
+--  AT_END handlers are expanded into when all others handlers:
+
+-- exception
+--when all others =
+--   _finalizer;  --  appears to require elab checks
+-- at end
+--_finalizer;
+-- end;
+
+--  Since the compiler guarantees that the body of a _finalizer is
+--  always inserted in the same construct where the AT_END handler
+--  resides, there is no need for elaboration checks.
+
+Set_Kill_Elaboration_Checks (Fin_Id);
  end if;
 
  --  Step 2: Creation of the finalizer specification


[Ada] Handling of library unit renamings in with_clauses

2012-02-22 Thread Arnaud Charlet
A library unit name that is a renaming can appear in the name of a with_clause.
When it is the prefix of a name, an implicit with_clause must be created for it,
as well as for the unit it renames. So if R renames A, and we have a with_clause
on R.B (where B is a child unit of A) we need with_clauses on both R an A (both
of which can themselves be child units). This is because R may be used as a
prefix within the current unit, and because A is needed to retrieve A.B.
This patch fixes a bug in the handling of such with_clauses, and simplifies the
processing by creating the with_clause for R when processing the with_clause
for R.B at load time, before any analysis has taken place.

The following must compile quietly:

  gcc -c with_child.ads

---
package Orig_Parent is
end Orig_Parent;
---
package Orig_Parent.Child is
end Orig_Parent.Child;
---
function Orig_Parent.Child.Grandchild return Integer;
---
package Renam_Parent is
end Renam_Parent;
---
with Orig_Parent.Child;
package Renam_Parent.Child renames Orig_Parent.Child;
---
with Renam_Parent.Child.Grandchild;
package With_Child is
   X : Integer := Renam_Parent.Child.Grandchild;
end With_Child;

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

2012-02-22  Ed Schonberg  schonb...@adacore.com

* lib-load.adb (Load_Unit): If the prefix of the name in a
with-clause is a renaming, add a with-clause on the original unit.
* sem_ch10.adb (Build_Unit_Name): Remove code made obsolete by
new handling of renamings in with-clauses.

Index: lib-load.adb
===
--- lib-load.adb(revision 184470)
+++ lib-load.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+--  Copyright (C) 1992-2012, Free Software Foundation, Inc. --
 --  --
 -- GNAT 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- --
@@ -406,9 +406,25 @@
   New_Child
 (Load_Name, Get_Unit_Name (Name (Unit (Cunit (Unump);
 
+--  If the load is for a with_clause, for visibility purposes both
+--  the renamed entity and renaming one must be available in the
+--  current unit: the renamed one in order to retrieve the child
+--  unit, and the original one because it may be used as a prefix
+--  in the body of the current unit. We add an explicit with_clause
+--  for the original parent so that the renaming declaration is
+--  properly loaded and analyzed.
+
+if Present (With_Node) then
+   Insert_After (With_Node,
+ Make_With_Clause (Sloc (With_Node),
+   Name = Copy_Separate_Tree (Prefix (Name (With_Node);
+end if;
+
 --  Save the renaming entity, to establish its visibility when
 --  installing the context. The implicit with is on this entity,
---  not on the package it renames.
+--  not on the package it renames. This is somewhat redundant given
+--  the with_clause just created, but it simplifies subsequent
+--  expansion of the current with_clause. Optimizable ???
 
 if Nkind (Error_Node) = N_With_Clause
   and then Nkind (Name (Error_Node)) = N_Selected_Component
Index: sem_ch10.adb
===
--- sem_ch10.adb(revision 184470)
+++ sem_ch10.adb(working copy)
@@ -2936,33 +2936,12 @@
 
   function Build_Unit_Name (Nam : Node_Id) return Node_Id is
  Ent  : Entity_Id;
- Renaming : Entity_Id;
  Result   : Node_Id;
 
   begin
  if Nkind (Nam) = N_Identifier then
+return New_Occurrence_Of (Entity (Nam), Loc);
 
---  If the parent unit P in the name of the with_clause for P.Q is
---  a renaming of package R, then the entity of the parent is set
---  to R, but the identifier retains Chars (P) to be consistent
---  with the source (see details in lib-load). However the implicit
---  with_clause for the parent must make the entity for P visible,
---  because P.Q may be used as a prefix within the current unit.
---  The entity for P is the current_entity with that name, because
---  the package renaming declaration for it has just been analyzed.
---  Note that this case can only happen if P.Q has already appeared
-  

Re: [Patch,AVR]: Fix missing prototype warning for ACCUMULATE_OUTGOING_ARGS

2012-02-22 Thread Georg-Johann Lay
Denis Chertykov wrote:
 2012/2/15 Georg-Johann Lay:
 Some parts outside the backend use ACCUMULATE_OUTGOING_ARGS without including
 tm_p.h which lead to a build warning because avr.h does

 #define ACCUMULATE_OUTGOING_ARGS avr_accumulate_outgoing_args()

 This patcs moved the prototype from avr-protos.h to avr.h:

* config/avr/avr-protos.h (avr_accumulate_outgoing_args): Move
prototype from here to...
* config/avr/avr.h: ...here.

 Ok for trunk?

 
 Approved.
 
 Denis.

Committed with that change

bool avr_accumulate_outgoing_args (void)
to
int avr_accumulate_outgoing_args (void)

http://gcc.gnu.org/viewcvs?view=revisionrevision=184475

Johann




[PATCH, i386, Android] -mandroid support for i386 target

2012-02-22 Thread Ilya Enkovich
Hello,

This patch adds -mandroid support to i386 target. OK for trunk?

Thanks,
Ilya
--

2012-02-22  Enkovich Ilya  ilya.enkov...@intel.com

* config/i386/gnu-user.h (LINUX_TARGET_CC1_SPEC): New.
(CC1_SPEC): Use LINUX_OR_ANDROID_CC.
(CC1PLUS_SPEC): Likewise.
(LINUX_TARGET_LINK_SPEC): New.
(LINK_SPEC): Support LINUX_OR_ANDROID_LD.
(LIB_SPEC): New.
(STARTFILE_SPEC): New.
(LINUX_TARGET_ENDFILE_SPEC): New.
(ENDFILE_SPEC): Support LINUX_OR_ANDROID_LD.

* config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
crtbegin_so%O%s for -shared.
(ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.


diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index 98d0a25..f114432 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -77,8 +77,15 @@ along with GCC; see the file COPYING3.  If not see
 #undef CPP_SPEC
 #define CPP_SPEC %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}

+#define LINUX_TARGET_CC1_SPEC %(cc1_cpu) %{profile:-p}
+
 #undef CC1_SPEC
-#define CC1_SPEC %(cc1_cpu) %{profile:-p}
+#define CC1_SPEC \
+  LINUX_OR_ANDROID_CC (LINUX_TARGET_CC1_SPEC, \
+  LINUX_TARGET_CC1_SPEC   ANDROID_CC1_SPEC)
+
+#define CC1PLUS_SPEC \
+  LINUX_OR_ANDROID_CC (, ANDROID_CC1PLUS_SPEC)

 /* Provide a LINK_SPEC appropriate for GNU userspace.  Here we provide support
for the special GCC options -static and -shared, which allow us to
@@ -97,22 +104,42 @@ along with GCC; see the file COPYING3.  If not see
   { link_emulation, GNU_USER_LINK_EMULATION },\
   { dynamic_linker, GNU_USER_DYNAMIC_LINKER }

-#undef LINK_SPEC
-#define LINK_SPEC -m %(link_emulation) %{shared:-shared} \
+#define LINUX_TARGET_LINK_SPEC \
+  -m %(link_emulation) %{shared:-shared} \
   %{!shared: \
 %{!static: \
   %{rdynamic:-export-dynamic} \
   -dynamic-linker %(dynamic_linker)} \
   %{static:-static}}

+#undef LINK_SPEC
+#define LINK_SPEC \
+  LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
+  LINUX_TARGET_LINK_SPEC   ANDROID_LINK_SPEC)
+
+#undef  LIB_SPEC
+#define LIB_SPEC \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \
+  GNU_USER_TARGET_LIB_SPEC   ANDROID_LIB_SPEC)
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, \
+  ANDROID_STARTFILE_SPEC)
+
 /* Similar to standard GNU userspace, but adding -ffast-math support.  */
-#undef  ENDFILE_SPEC
-#define ENDFILE_SPEC \
+#define LINUX_TARGET_ENDFILE_SPEC \
   %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
%{mpc32:crtprec32.o%s} \
%{mpc64:crtprec64.o%s} \
-   %{mpc80:crtprec80.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s
+   %{mpc80:crtprec80.o%s}
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  LINUX_OR_ANDROID_LD (LINUX_TARGET_ENDFILE_SPEC   \
+  GNU_USER_TARGET_ENDFILE_SPEC, \
+  LINUX_TARGET_ENDFILE_SPEC  \
+  ANDROID_ENDFILE_SPEC)

 /* A C statement (sans semicolon) to output to the stdio stream
FILE the assembler definition of uninitialized global DECL named
diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
index 94c5274..acbc662 100644
--- a/gcc/config/linux-android.h
+++ b/gcc/config/linux-android.h
@@ -53,8 +53,8 @@
   %{!static: -ldl}

 #define ANDROID_STARTFILE_SPEC \
-  %{!shared: \
+  %{shared: crtbegin_so%O%s;:
\
 %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}

 #define ANDROID_ENDFILE_SPEC \
-  %{!shared: crtend_android%O%s}
+  %{shared: crtend_so%O%s;: crtend_android%O%s}


Serious regressions due to newlib's HAVE_INITFINI_ARRAY (Re: [PATCH] Fix up --enable-initfini-array autodetection in configure (PR bootstrap/50237))

2012-02-22 Thread Ulrich Weigand
Jakub Jelinek wrote:

   PR bootstrap/50237
   * config/initfini-array.h: Guard content of the header
   with #ifdef HAVE_INITFINI_ARRAY.
   * configure.ac: Move gcc_AC_INITFINI_ARRAY much later into the file.
   Add initfini-array.h to tm_file here.
   * acinclude.m4 (gcc_AC_INITFINI_ARRAY): For non-ia64 do a linker
   test.
   * config.gcc: Don't add initfini-array.h to tm_file here.
   * configure: Regenerated.

This patch causes serious regressions on spu-elf, and presumably other
newlib targets.  The effect of the patch is to switch GCC to use
.init_array/.fini_array instead of .init/.fini; but the former is
not actually supported by newlib startup code (at least on SPU and
most other platforms supported by newlib), so that constructors and
destructors end up simply being ignored.

This occurs due to combination of GCC configury changes introduced
by the patch and a bug in newlib system headers.  Before the patch,
initfini-array.h was not included into tm.h when building a cross-
compiler to spu-elf, and after the patch it is.  Now, the patch
also inserts a #ifdef HAVE_INITFINI_ARRAY check, and the configure
check does not define this macro for cross-compilers, so in theory
that should not cause any change in behaviour.

However, the macro HAVE_INITFINI_ARRAY is defined anyway; this
definition is done by an internal newlib.h header that is pulled
in via the stdio.h include in GCC's tsystem.h.  [ This is clearly
a violation of C namespace rules, but this has been the situation
for all newlib releases since about 2005 ... ]

Since initfini-array.h is now pulled in and HAVE_INITFINI_ARRAY
is defined, we get USE_INITFINI_ARRAY defined as well, which
causes the crtstuff files to be build for .init_array support.


Now, I guess the newlib headers should be fixed to no longer
pollute the namespace by defining HAVE_INITFINI_ARRAY.

However, I'm wondering whether there is a way to change
GCC to fix that regression even with existing newlib headers.

For example, I guess GCC configury could rename its instance of
HAVE_INITFINI_ARRAY (maybe define USE_INITFINI_ARRAY to begin
with)?


Any suggestions how to proceed with this welcome!  I'd really
like to see this fixed for 4.7, otherwise the compiler will be
seriously broken ...

Thanks,
Ulrich


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  ulrich.weig...@de.ibm.com



[PATCH, i386, Android] Enable exceptions and RTTI by default for Android

2012-02-22 Thread Ilya Enkovich
Hello,

Here is a simple patch which enables exceptions and RTTI by default
for Android target. OK for trunk?

Thanks,
Ilya
--

2012-02-22  Enkovich Ilya  ilya.enkov...@intel.com

* gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
exceptions and rtti by default.


diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
index 94c5274..7256082 100644
--- a/gcc/config/linux-android.h
+++ b/gcc/config/linux-android.h
@@ -46,8 +46,8 @@
   %{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC

 #define ANDROID_CC1PLUS_SPEC   \
-  %{!fexceptions:%{!fno-exceptions: -fno-exceptions}}\
-  %{!frtti:%{!fno-rtti: -fno-rtti}}
+  %{!fexceptions:%{!fno-exceptions: -fexceptions}}   \
+  %{!frtti:%{!fno-rtti: -frtti}}

 #define ANDROID_LIB_SPEC \
   %{!static: -ldl}


[PATCH, i386, Android] Enable __ANDROID__ macro for Android i386 target

2012-02-22 Thread Ilya Enkovich
Hello,

Here is a one-line fix to enable __ANDROID__ macro on i386 Android
target. OK for trunk?

Thanks,
Ilya
--

2012-02-22  Enkovich Ilya  ilya.enkov...@intel.com

* gcc/config/i386/gnu-user.h (TARGET_OS_CPP_BUILTINS): Add
ANDROID_TARGET_OS_CPP_BUILTINS.


diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index 98d0a25..d317229 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -71,6 +71,7 @@ along with GCC; see the file COPYING3.  If not see
   do   \
 {  \
GNU_USER_TARGET_OS_CPP_BUILTINS();  \
+   ANDROID_TARGET_OS_CPP_BUILTINS();   \
 }  \
   while (0)


Re: Serious regressions due to newlib's HAVE_INITFINI_ARRAY (Re: [PATCH] Fix up --enable-initfini-array autodetection in configure (PR bootstrap/50237))

2012-02-22 Thread Jakub Jelinek
On Wed, Feb 22, 2012 at 03:55:34PM +0100, Ulrich Weigand wrote:
 However, the macro HAVE_INITFINI_ARRAY is defined anyway; this
 definition is done by an internal newlib.h header that is pulled
 in via the stdio.h include in GCC's tsystem.h.  [ This is clearly
 a violation of C namespace rules, but this has been the situation
 for all newlib releases since about 2005 ... ]

Ugh, clearly newlib bug...

 Any suggestions how to proceed with this welcome!  I'd really
 like to see this fixed for 4.7, otherwise the compiler will be
 seriously broken ...

I guess the easiest would be just to rename the gcc HAVE_INITFINI_ARRAY
macro to something else, HAVE_INITFINI_ARRAY_SUPPORT or whatever.

Jakub


Re: [patch] Fix cygwin ada install [was Re: Yet another issue with gcc current trunk with ada on cygwin]

2012-02-22 Thread Dave Korn
On 09/01/2012 11:56, Eric Botcazou wrote:
   Sorry for the delay guys, I got rather busy over the holidays.  I see
 we're now discussing a patch for next stage 1.
 
 No, not necessarily, the patch is specific to Ada on Windows so the risk is 
 quite low.
 
   It does however solve the problem of wanting the DLL to be in the /bin
 directory, while still needing something to stand in its place in the /lib
 directory so that the linker can find it without the compiler having to put
 -L$prefix/bin in the specs.
 
 This indeed sounds compelling enough.
 
   It's also used on Cygwin and MinGW to address library versioning: the
 actual DLL has a numbered suffix to indicate version, but the import
 library is unnumbered, so you can just say -lblah as usual and
 automatically link against whatever the installed version of the DLL is
 without having to know the version suffix and specify it in the -l option. 
 Ada doesn't need that, as it happens, because it always generates the
 specfile to explicitly include the version number of libgnat/libgnarl in
 the -l option, and doesn't try to keep the shared library compatible across
 point releases of the compiler, but it's how all the other runtimes work on
 Windows; they all put an import library in /lib and the DLL itself into
 /bin.  Ada should work the same way, because otherwise you either need to
 point your PATH into gcc's private dir at runtime, or point your linker
 into /bin at linktime, neither of which are entirely neat solutions.
 
 If all the other runtimes do it, I think we should do it too.  Pacal, what do 
 you think?

  Pascal, ping?

cheers,
  DaveK


Re: [patch lto-plugin]: Fix pr 50616

2012-02-22 Thread Joseph S. Myers
On Wed, 22 Feb 2012, Kai Tietz wrote:

 2012-02-22  Kai Tietz  kti...@redhat.com
 
 PR lto/50616
 * lto-plugin.c (PRI_LL): New macro.

Doesn't HOST_LONG_LONG_FORMAT already exist for this, so you don't need a 
local definition in this file?

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


[PATCH, i386]: Fix PR 52330, valgrind problem on invalid asm

2012-02-22 Thread Uros Bizjak
Hello!

2012-02-22  Uros Bizjak  ubiz...@gmail.com

PR target/52330
* config/i386/i386.c (ix86_print_operand) case 'H': Error out if x
is not offsettable memory reference.

testsuite/ChangeLog:

2012-02-22  Uros Bizjak  ubiz...@gmail.com

PR target/52330
* gcc.target/i386/pr52330.c: New test.

Tested on x86_64-pc-linux-gnu, will commit to mainline SVN and release branches.

Uros.
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 184483)
+++ config/i386/i386.c  (working copy)
@@ -14091,6 +14091,13 @@ ix86_print_operand (FILE *file, rtx x, int code)
  return;
 
case 'H':
+ if (!offsettable_memref_p (x))
+   {
+ output_operand_lossage (operand is not an offsettable memory 
+ reference, invalid operand 
+ code 'H');
+ return;
+   }
  /* It doesn't actually matter what mode we use here, as we're
 only going to use this for printing.  */
  x = adjust_address_nv (x, DImode, 8);
Index: testsuite/gcc.target/i386/pr52330.c
===
--- testsuite/gcc.target/i386/pr52330.c (revision 0)
+++ testsuite/gcc.target/i386/pr52330.c (revision 0)
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+
+void foo (int a)
+{
+  asm volatile (# %H0 : : r (a));  /* { dg-error not an offsettable } */
+}


[patch testsuite/g++.dg]: Adjust some tests for *-*-mingw* targets

2012-02-22 Thread Kai Tietz
Hi,

this patch fixes some failures running the g++ testsuite for Windows
native targets.

ChangeLog

2012-02-22  Kai Tietz  kti...@redhat.com

* g++.dg/opt/devirt2.C: Add rule for *-*-mingw* target.
* opt/pr48549.C (long): Replace by long by __PTRDIFF_TYPE__
derived pdiff_t type.
* g++.dg/torture/pr49720.C: Likewise

Tested for i686-w64-mingw32, x86_64-w64-mingw32, and for
x86_64-unknown-linux-gnu.  Ok for apply?

Regards,
Kai

Index: g++.dg/opt/devirt2.C
===
--- g++.dg/opt/devirt2.C(revision 184483)
+++ g++.dg/opt/devirt2.C(working copy)
@@ -5,7 +5,9 @@
 // { dg-additional-options -mshort-calls {target epiphany-*-*} }
 // Using -mno-abicalls avoids a R_MIPS_JALR .reloc.
 // { dg-additional-options -mno-abicalls { target mips*-*-* } }
-// { dg-final { scan-assembler-times xyzzy 2 { target { ! {
alpha*-*-* hppa*-*-* ia64*-*-hpux* sparc*-*-* } } } } }
+// { dg-final { scan-assembler-times xyzzy 2 { target { ! {
alpha*-*-* hppa*-*-* ia64*-*-hpux* sparc*-*-* *-*-mingw* } } } } }
+// For *-*-mingw* there is additionally one .def match
+// { dg-final { scan-assembler-times xyzzy 3 { target *-*-mingw* } } }
 // The IA64 and HPPA compilers generate external declarations in addition
 // to the call so those scans need to be more specific.
 // { dg-final { scan-assembler-times br\[^\n\]*xyzzy 2 { target
ia64*-*-hpux* } } }
Index: g++.dg/opt/pr48549.C
===
--- g++.dg/opt/pr48549.C(revision 184483)
+++ g++.dg/opt/pr48549.C(working copy)
@@ -2,10 +2,13 @@
 // { dg-do compile }
 // { dg-options -fcompare-debug -O2 }

+__extension__ typedef __PTRDIFF_TYPE__ pdiff_t;
+
 void
 foo (void *from, void *to)
 {
-  long offset = reinterpret_cast long(to) - reinterpret_cast long(from);
+  pdiff_t offset = reinterpret_cast pdiff_t(to)
+  - reinterpret_cast pdiff_t(from);
   if (offset != static_cast int(offset))
 *(int *) 0xC0DE = 0;
   reinterpret_cast int *(from)[1] = offset;
Index: g++.dg/torture/pr49720.C
===
--- g++.dg/torture/pr49720.C(revision 184483)
+++ g++.dg/torture/pr49720.C(working copy)
@@ -1,8 +1,10 @@
 /* { dg-do compile } */

+__extension__ typedef __PTRDIFF_TYPE__ pdiff_t;
+
 extern char t_start[], t_end[], t_size[];
 bool foo (void)
 {
-  long size = reinterpret_castlong(t_size);
+  pdiff_t size = reinterpret_castpdiff_t(t_size);
   return (size == t_end - t_start);
 }


Re: [patch] Fix cygwin ada install [was Re: Yet another issue with gcc current trunk with ada on cygwin]

2012-02-22 Thread Pascal Obry
Dave,

   Pascal, ping?

Sorry for the delay, these message has fallen into the crack!

Anyway, with these explanations I'm ok with the patch.

-- 
  Pascal Obry
  --
  gpg --keyserver keys.gnupg.net --recv-key F949BD3B


Re: [Patch, Fortran] PR52335 - allow OPEN(..., DELIM=) with -std=f95

2012-02-22 Thread Steve Kargl
On Wed, Feb 22, 2012 at 10:55:14AM +0100, Tobias Burnus wrote:
 The following patch fixes a 4.4 to 4.7 regression. Already Fortran 95 
 allows DELIM= in OPEN and INQUIRE. Fortran 2003 only added it to data 
 transfer statements (i.e. WRITE; not allowed for READ and not possible 
 for PRINT). Cf. F95/F2003 standard and the PR.
 
 Build and regtested on x86-64-linux.
 OK for the trunk and the 4.4 to 4.6 branches?
 
 Tobias
 
 PS: I am not sure how far I will back port, maybe only to 4.5.

OK for 4.5 to trunk.  I doubt that 4.4 will see a new
release anytime soon.

-- 
Steve


Re: [PATCH, i386, Android] -mandroid support for i386 target

2012-02-22 Thread H.J. Lu
On Wed, Feb 22, 2012 at 6:54 AM, Ilya Enkovich enkovich@gmail.com wrote:
 Hello,

 This patch adds -mandroid support to i386 target. OK for trunk?

 Thanks,
 Ilya
 --

 2012-02-22  Enkovich Ilya  ilya.enkov...@intel.com

        * config/i386/gnu-user.h (LINUX_TARGET_CC1_SPEC): New.

I don't think you should define LINUX_* in gnu-user.h.

        (CC1_SPEC): Use LINUX_OR_ANDROID_CC.
        (CC1PLUS_SPEC): Likewise.
        (LINUX_TARGET_LINK_SPEC): New.
        (LINK_SPEC): Support LINUX_OR_ANDROID_LD.
        (LIB_SPEC): New.
        (STARTFILE_SPEC): New.
        (LINUX_TARGET_ENDFILE_SPEC): New.
        (ENDFILE_SPEC): Support LINUX_OR_ANDROID_LD.

There is a feedback at

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

to my earlier patch to define GNU_USER_TARGET_* in gnu-user.h
and use them in linux.h.

        * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
        crtbegin_so%O%s for -shared.
        (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.



I think you should separate this part similar to

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


-- 
H.J.


Re: [PATCH, i386, Android] Enable __ANDROID__ macro for Android i386 target

2012-02-22 Thread H.J. Lu
On Wed, Feb 22, 2012 at 6:59 AM, Ilya Enkovich enkovich@gmail.com wrote:
 Hello,

 Here is a one-line fix to enable __ANDROID__ macro on i386 Android
 target. OK for trunk?

 Thanks,
 Ilya
 --

 2012-02-22  Enkovich Ilya  ilya.enkov...@intel.com

        * gcc/config/i386/gnu-user.h (TARGET_OS_CPP_BUILTINS): Add
        ANDROID_TARGET_OS_CPP_BUILTINS.


 diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
 index 98d0a25..d317229 100644
 --- a/gcc/config/i386/gnu-user.h
 +++ b/gcc/config/i386/gnu-user.h
 @@ -71,6 +71,7 @@ along with GCC; see the file COPYING3.  If not see
   do                                           \
     {                                          \
        GNU_USER_TARGET_OS_CPP_BUILTINS();      \
 +       ANDROID_TARGET_OS_CPP_BUILTINS();       \
     }                                          \
   while (0)

I think this should be done in linux.h, not gnu-user.h.

-- 
H.J.


[Patch,AVR]: Make flash size a device property (was: core property)

2012-02-22 Thread Georg-Johann Lay
This patch addresses several issues related to device flash size:

* cores avrxmega4/5 have ELPM* instruction

* flash sizes for xmega were wrong because atxmegaXX
  has some extra bootloader flash and thus a flash size
  of XX + epsilon.

* There are devices with different flash sizes, i.e. with
  different sets of reasonable address spaces within the same
  core architecture.  Thus, turn flash size from a core property
  to a device property

* No more try to fix silly (too big) address spaces by means
  of modulo computation. Just emit an error if a nonsensical
  address space is used

Passes without regression.

Ok for trunk?

Johann

PR target/49868
* doc/extend.texi (AVR Named Address Spaces): No more try to fix
address spaces located outside of device flash.

PR target/49868
PR target/52261
* config/avr/avr.h (base_arch_s): Remove field n_segments.
(mcu_type_s): Add field n_flash.
* config/avr/avr-devices.c (avr_arch_types): Remove .n_segments.
Set .have_elpm and .have_elpmx to 1 for avrxmega4 and avrxmega5.
(AVR_MCU): Add N_FLASH argument.
* config/avr/avr-mcus.def (AVR_MCU): Add initializer for .n_flash.
* config/avr/avr-c.c (avr_cpu_cpp_builtins): Only define built-in
macro __FLASHn if that address space makes sense for the device.
* config/avr/avr.c (avr_out_lpm): Don't try to fix address spaces
outside of target flash.
(avr_asm_named_section): Ditto.
(avr_asm_select_section): Ditto.
(avr_addr_space_convert): Ditto.
(avr_emit_movmemhi): Ditto.
(avr_nonconst_pointer_addrspace, avr_pgm_check_var_decl): Error if
address space is outside of device flash.
(avr_insert_attributes): Ditto.
(avr_xload_libgcc_p): Use avr_current_device-n_flash instead of
avr_current_arch-n_segments.
Index: doc/extend.texi
===
--- doc/extend.texi	(revision 184483)
+++ doc/extend.texi	(working copy)
@@ -1266,14 +1266,6 @@ address space @code{__flash@var{N}}.
 The compiler will set the @code{RAMPZ} segment register approptiately 
 before reading data by means of the @code{ELPM} instruction.
 
-On devices with less 64@tie{}kiB flash segments as indicated by the address
-space, the compiler will cut down the segment number to a number the
-device actually supports. Counting starts at@tie{}@code{0}
-for space @code{__flash}. For example, if you access address space
-@code{__flash3} on an ATmega128 device with two 64@tie{}kiB flash segments,
-the compiler will generate a read from @code{__flash1}, i.e.@: it
-will load @code{RAMPZ} with@tie{}@code{1} before reading.
-
 @item __memx
 @cindex @code{__memx} AVR Named Address Spaces
 This is a 24-bit address space that linearizes flash and RAM:
Index: config/avr/avr-devices.c
===
--- config/avr/avr-devices.c	(revision 184469)
+++ config/avr/avr-devices.c	(working copy)
@@ -30,34 +30,34 @@ const struct base_arch_s
 avr_arch_types[] =
 {
   /* unknown device specified */
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1, NULL,  avr2  },
+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, NULL,  avr2  },
   /*
-A  M  J  LM E  E  E  X  R   d S   S O  # F  A
-S  U  M  PO L  L  I  M  A   a t   F ff 6 l  r
-M  L  P  MV P  P  J  E  M   t a   R s  4 a  c 
- XW M  M  M  G  P   a r es  h
-   X  P  A  D t t  k h  ID   */
-  { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1,  1,   avr1  },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1,  2,   avr2  },
-  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  25,  avr25 },
-  { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1,  3,   avr3  },
-  { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0x0060, 32, 2,  31,  avr31 },
-  { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  35,  avr35 },
-  { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  4,   avr4  },
-  { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  5,   avr5  },
-  { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, 32, 2,  51,  avr51 },
-  { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0x0060, 32, 4,  6,   avr6  },
+A  M  J  LM E  E  E  X  R   d S   S O   A
+S  U  M  PO L  L  I  M  A   a t   F ff  r
+M  L  P  MV P  P  J  E  M   t a   R s   c 
+ XW M  M  M  G  P   a r e   h
+   X  P  A  D t t   ID   */
+  { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1,   avr1  },
+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 2,   avr2  },
+  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 25,  avr25 },
+  { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, 3,   avr3  },
+  { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0x0060, 32, 31,  avr31 },
+  { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 35,  avr35 },
+  { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 4,   avr4  },
+  { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 5,   avr5  },
+  { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, 32, 51,  avr51 },
+  { 0, 1, 1, 1, 1, 1, 1, 0, 0, 

Re: [google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-22 Thread Jing Yu
The attachment is a complete patch for [google/gcc-4_6] branch, to
replace .ctors/.dtors with .init_array/.fini_array.

Bootstrap and crosstool testers pass.
I have verified that gcc_cv_initfini_array=no, which means the
crosstool will do whatever it did before (won't replace .ctors/.dtors
with .init_array/.fini_array).

I also built Android toolchain and verified gcc_cv_initfini_array=no.

r177933 is already in google/gcc-4_6_2-mobile and
google/gcc-4_6-mobile. I need to backport the rest to these two
branches.

ok?

2012-02-21   Jing Yu  jin...@google.com

Google Ref 47894
Backport from mainline r177933, r175181, r177963, r178116, r183299.

2011-08-20  H.J. Lu  hongjiu...@intel.com
PR other/46770
* config.gcc (tm_file): Add initfini-array.h if
.init_arrary/.fini_array are supported.
* crtstuff.c: Don't generate .ctors nor .dtors sections if
USE_INITFINI_ARRAY is defined.
* output.h (default_elf_init_array_asm_out_constructor): New.
(default_elf_fini_array_asm_out_destructor): Likewise.
* varasm.c (elf_init_array_section): Likewise.
(elf_fini_array_section): Likewise.
(get_elf_initfini_array_priority_section): Likewise.
(default_elf_init_array_asm_out_constructor): Likewise.
(default_elf_fini_array_asm_out_destructor): Likewise.
* config/initfini-array.h: New.

2011-06-18  H.J. Lu  hongjiu...@intel.com
PR other/49325
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Properly check if
.init_array can be used with .ctors on targets.
* configure: Regenerated.

2011-08-22  H.J. Lu  hongjiu...@intel.com
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Error if __ELF__ isn't
defined.
* configure: Regenerated.

2011-08-26  Rainer Orth  r...@cebitec.uni-bielefeld.de
PR target/50166
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check count in main.
* configure: Regenerate.

2012-01-19  Jakub Jelinek  ja...@redhat.com
PR bootstrap/50237
* config/initfini-array.h: Guard content of the header
with #ifdef HAVE_INITFINI_ARRAY.
* configure.ac: Move gcc_AC_INITFINI_ARRAY much later into the
file.
Add initfini-array.h to tm_file here.
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): For non-ia64 do a
linker test.
* config.gcc: Don't add initfini-array.h to tm_file here.
* configure: Regenerated.

Thanks,
Jing

On Tue, Feb 21, 2012 at 9:34 AM, H.J. Lu hjl.to...@gmail.com wrote:
 On Mon, Feb 20, 2012 at 11:31 PM, Jing Yu jin...@google.com wrote:
 Hi H.J.,

 I think the patch itself is not enough.
 I compared AC_DEFUN([gcc_AC_INITFINI_ARRAY] part (in acinclude.m4)
 of gcc trunk and google/gcc-4_6_2-mobile, and found how
 enable_initfini_array is
 configured is different.

 The patch breaks some of our tests. enable_initfini_array should be
 disabled for cross compile by default. But it is not true in our
 branch. Could you please point us all related patches?


 I missed this backport. There are some additional changes needed for
 non-Linux systems:

 http://gcc.gnu.org/ml/gcc-cvs/2011-08/msg00978.html
 http://gcc.gnu.org/ml/gcc-cvs/2011-08/msg01132.html
 http://gcc.gnu.org/ml/gcc-cvs/2012-01/msg00544.html



 --
 H.J.


initfini.patch
Description: Binary data


Re: [PATCH, i386, Android] Enable exceptions and RTTI by default for Android

2012-02-22 Thread Jing Yu
So far, Android ARM toolchain, which builds Android platform for ARM
boards, does not enable RTTI and exceptions by default. There are
license concerns with the use of GNU libstdc++ and libsupc++.

Thanks,
Jing

On Wed, Feb 22, 2012 at 7:07 AM, Richard Guenther
richard.guent...@gmail.com wrote:
 On Wed, Feb 22, 2012 at 3:57 PM, Ilya Enkovich enkovich@gmail.com wrote:
 Hello,

 Here is a simple patch which enables exceptions and RTTI by default
 for Android target. OK for trunk?

 Err - isn't that the default?  Thus, simply delete the bogus spec?

 Richard.


 Thanks,
 Ilya
 --

 2012-02-22  Enkovich Ilya  ilya.enkov...@intel.com

        * gcc/config/linux-android.h (ANDROID_CC1PLUS_SPEC): Enable
        exceptions and rtti by default.


 diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
 index 94c5274..7256082 100644
 --- a/gcc/config/linux-android.h
 +++ b/gcc/config/linux-android.h
 @@ -46,8 +46,8 @@
   %{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC

  #define ANDROID_CC1PLUS_SPEC                                           \
 -  %{!fexceptions:%{!fno-exceptions: -fno-exceptions}}                \
 -  %{!frtti:%{!fno-rtti: -fno-rtti}}
 +  %{!fexceptions:%{!fno-exceptions: -fexceptions}}           \
 +  %{!frtti:%{!fno-rtti: -frtti}}

  #define ANDROID_LIB_SPEC \
   %{!static: -ldl}


Re: [patch testsuite/g++.dg]: Adjust some tests for *-*-mingw* targets

2012-02-22 Thread Mike Stump
On Feb 22, 2012, at 8:21 AM, Kai Tietz wrote:
 this patch fixes some failures running the g++ testsuite for Windows
 native targets.
 
 ChangeLog
 
 2012-02-22  Kai Tietz  kti...@redhat.com
 
   * g++.dg/opt/devirt2.C: Add rule for *-*-mingw* target.
   * opt/pr48549.C (long): Replace by long by __PTRDIFF_TYPE__
   derived pdiff_t type.
   * g++.dg/torture/pr49720.C: Likewise
 
 Ok for apply?

Ok, thanks.


[patch libffi]: Fix problem 52221

2012-02-22 Thread Kai Tietz
Hi,

this fixes the remaining issues found by libjava for use of libffi.

ChangeLog

2012-02-22  Kai Tietz  kti...@redhat.com

PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New
prototype.
(ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
thiscall-convention.
(ffi_raw_call): Use ffi_prep_args_raw.
* src/x86/win32.S (ffi_closure_raw_THISCALL): Add
implementation for stub.

Tested for i686-w64-mingw32, and regression-tested for
x86_64-unknown-linux-gnu.  Ok for apply?

Regards,
Kai

Index: src/x86/ffi.c
===
--- src/x86/ffi.c   (revision 184486)
+++ src/x86/ffi.c   (working copy)
@@ -447,6 +447,8 @@
 void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
  __attribute__ ((regparm(1)));
 #ifdef X86_WIN32
+void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *)
+ __attribute__ ((regparm(1)));
 void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *)
  __attribute__ ((regparm(1)));
 void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *)
@@ -747,7 +749,7 @@
 }
   else if (cif-abi == FFI_THISCALL)
 {
-  FFI_INIT_TRAMPOLINE_THISCALL (closure-tramp[0], ffi_closure_raw_SYSV,
+  FFI_INIT_TRAMPOLINE_THISCALL (closure-tramp[0],
ffi_closure_raw_THISCALL,
codeloc, cif-bytes);
 }
 #endif
@@ -795,7 +797,7 @@
 #ifdef X86_WIN32
 case FFI_SYSV:
 case FFI_STDCALL:
-  ffi_call_win32(ffi_prep_args, ecif, cif-abi, cif-bytes, cif-flags,
+  ffi_call_win32(ffi_prep_args_raw, ecif, cif-abi, cif-bytes,
cif-flags,
 ecif.rvalue, fn);
   break;
 case FFI_THISCALL:
@@ -823,7 +825,7 @@
  cif-abi = abi = FFI_THISCALL;
if (passed_regs  1  abi == FFI_THISCALL)
  cif-abi = abi = FFI_STDCALL;
-ffi_call_win32(ffi_prep_args, ecif, abi, cif-bytes, cif-flags,
+ffi_call_win32(ffi_prep_args_raw, ecif, abi, cif-bytes, cif-flags,
ecif.rvalue, fn);
   }
   break;
Index: src/x86/win32.S
===
--- src/x86/win32.S (revision 184486)
+++ src/x86/win32.S (working copy)
@@ -264,6 +264,18 @@
 #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
 #define CIF_FLAGS_OFFSET 20

+ffi_closure_raw_THISCALL PROC NEAR
+   push ebp
+   mov  ebp, esp
+   push esi
+   sub esp, 36
+   mov  esi, [eax + RAW_CLOSURE_CIF_OFFSET];; closure-cif
+   mov  edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET]  ;; closure-user_data
+   mov [esp + 12], edx
+   lea edx, [ebp + 12], edx
+   jmp stubraw
+ffi_closure_raw_SYSV ENDP
+
 ffi_closure_raw_SYSV PROC NEAR USES esi
 ;; the ffi_closure ctx is passed in eax by the trampoline.

@@ -272,6 +284,7 @@
 mov  edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET]  ;; closure-user_data
 mov  [esp + 12], edx;; user_data
 lea  edx, [ebp + 8]
+stubraw:
 mov  [esp + 8], edx ;; raw_args
 lea  edx, [ebp - 24]
 mov  [esp + 4], edx ;; res
@@ -722,7 +735,21 @@
 #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
 #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
 #define CIF_FLAGS_OFFSET 20
-
+.balign 16
+   .globl  _ffi_closure_raw_THISCALL
+#ifndef __OS2__
+   .def_ffi_closure_raw_THISCALL;  .scl2;  .type   32; 
.endef
+#endif
+_ffi_closure_raw_THISCALL:
+   pushl   %ebp
+   movl%esp, %ebp
+   pushl   %esi
+   subl$36, %esp
+   movlRAW_CLOSURE_CIF_OFFSET(%eax), %esi   /* closure-cif */
+   movlRAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure-user_data 
*/
+   movl%edx, 12(%esp)  /* user_data */
+   leal12(%ebp), %edx  /* __builtin_dwarf_cfa () */
+   jmp .stubraw
 # This assumes we are using gas.
 .balign 16
.globl  _ffi_closure_raw_SYSV
@@ -742,6 +769,7 @@
movlRAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure-user_data 
*/
movl%edx, 12(%esp)  /* user_data */
leal8(%ebp), %edx   /* __builtin_dwarf_cfa () */
+.stubraw:
movl%edx, 8(%esp)   /* raw_args */
leal-24(%ebp), %edx
movl%edx, 4(%esp)   /* res */


Re: [PATCH, i386, Android] Enable exceptions and RTTI by default for Android

2012-02-22 Thread H.J. Lu
On Wed, Feb 22, 2012 at 11:20 AM, Jing Yu jin...@google.com wrote:
 So far, Android ARM toolchain, which builds Android platform for ARM
 boards, does not enable RTTI and exceptions by default. There are
 license concerns with the use of GNU libstdc++ and libsupc++.


I am not a lawyer.  From

http://www.gnu.org/licenses/gcc-exception-faq.html

I use a proprietary compiler toolchain without any parts of GCC to
compile my program, and link it with libstdc++. My program itself does
not include any runtime library code the same way that GCC-compiled
programs include libgcc. Can I still take advantage of the exception?

Yes. While combining libgcc with GCC-compiled object code is
probably the most common way the exception is used, neither the GPL
nor the GCC Runtime Library Exception distinguish between static
linking, dynamic linking, and other methods for combining code in
their conditions. The same permissions are available to you, under the
same terms, no matter which method you use.

It indicates both libstdc++.a and libstdc++.so are covered by GPLv3
run-time exception.


-- 
H.J.


Re: PATCH: Use crtbegin_so%O%s/crtend_so%O%s for -mandroid -shared

2012-02-22 Thread Jing Yu
I am OK with the patch, I am not a maintainer though.

Jing

On Wed, Dec 14, 2011 at 9:11 AM, H.J. Lu hongjiu...@intel.com wrote:
 Hi,

 Android uses crtbegin_so.o and crtend_so.o to build shared library with
 -mshared.  OK for trunk in stage 1?


 H.J.
 ---
 2011-12-13  H.J. Lu  hongjiu...@intel.com

        * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
        crtbegin_so%O%s for -shared.
        (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
 ---
  gcc/ChangeLog.android      |    5 +
  gcc/config/linux-android.h |    4 ++--
  2 files changed, 7 insertions(+), 2 deletions(-)
  create mode 100644 gcc/ChangeLog.android

 diff --git a/gcc/ChangeLog.android b/gcc/ChangeLog.android
 new file mode 100644
 index 000..fc54522
 --- /dev/null
 +++ b/gcc/ChangeLog.android
 @@ -0,0 +1,5 @@
 +2011-12-13  H.J. Lu  hongjiu...@intel.com
 +
 +       * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use
 +       crtbegin_so%O%s for -shared.
 +       (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared.
 diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
 index 94c5274..acbc662 100644
 --- a/gcc/config/linux-android.h
 +++ b/gcc/config/linux-android.h
 @@ -53,8 +53,8 @@
   %{!static: -ldl}

  #define ANDROID_STARTFILE_SPEC                                         \
 -  %{!shared:                                                         \
 +  %{shared: crtbegin_so%O%s;:                                              
   \
     %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}

  #define ANDROID_ENDFILE_SPEC \
 -  %{!shared: crtend_android%O%s}
 +  %{shared: crtend_so%O%s;: crtend_android%O%s}
 --
 1.7.6.4



Re: [RFC, 4.8] Magic matching for flags clobbering and setting

2012-02-22 Thread Hans-Peter Nilsson
On Fri, 10 Feb 2012, Richard Henderson wrote:
 Seeing as how Uros is starting to go down the path of cleaning up the
 flags handling for x86, I thought I'd go ahead and knock up the idea
 that I've been tossing around to help automate the process of building
 patterns that match both clobbering the flags and setting the flags to
 a comparison.

Sometimes the destination too unless there's overlap, but I
don't know how often that matters.

 This is far from complete, but it at least shows the direction.

Yes, nice!

 What I know is missing off the top of my head are:

  (2) Can't be usefully used with define_insn_and_split, and no way to tell.
  This problem should simply be documented in the .texi file as user error.

Not sure I see the problem or the impact of the absence.  Would
it help if there was a way to match_dup the clobber/set?  Maybe
as a match_op_flags, the same as match_flags but with the first
argument being an assigning operand number.  You probably
wouldn't want to use this very often.)

  (3) Can't be used for x86 add patterns, as the clobber version wants the
  freedom to use lea and the set flags version cannot.  And there are
  different sets of constraints if lea may be used or not.

Other targets too, but as it's warty for x86 I hope eventually
this'll see improvement...

 Comments?

Er... very interesting!  (The kind of patch you want to play
around with to have any further insightful comments.)

So I can use match_{operand,whatever} in the second, optional
operand to match_flags?  No, wait, no use to have anything but
a match_dup, hm.

I don't see where it'd make sense to have anything else but the
default, absent argument.  Example?

brgds, H-P


Re: We left out the check for param_type in random distributions

2012-02-22 Thread Ed Smith-Rowland

Hi,

   Built and tested on x86_64-linux-gnu. 


Seems safe enough to go in now, Ok.

Thanks,
Paolo.



2012-02-14  Edward Smith-Rowland  3dw...@verizon.net

* testsuite/26_numerics/random/
uniform_real_distribution/requirements/typedefs.cc: Check param_type.
* testsuite/26_numerics/random/
piecewise_constant_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
chi_squared_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
normal_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
uniform_int_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
poisson_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
bernoulli_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
discrete_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
weibull_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
cauchy_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
negative_binomial_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
gamma_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
fisher_f_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
exponential_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
binomial_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
lognormal_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
extreme_value_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
piecewise_linear_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
student_t_distribution/requirements/typedefs.cc: Ditto.
* testsuite/26_numerics/random/
geometric_distribution/requirements/typedefs.cc: Ditto.

Index: 
testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc
===
--- 
testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc 
(revision 183133)
+++ 
testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc 
(working copy)
@@ -4,7 +4,7 @@
 //
 // 2008-11-24  Edward M. Smith-Rowland 3dw...@verizon.net
 //
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -32,4 +32,5 @@
   typedef std::uniform_real_distributiondouble test_type;
 
   typedef test_type::result_type result_type;
+  typedef test_type::param_type param_type;
 }
Index: 
testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc
===
--- 
testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc
   (revision 183133)
+++ 
testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc
   (working copy)
@@ -4,7 +4,7 @@
 //
 // 2008-12-03  Edward M. Smith-Rowland 3dw...@verizon.net
 //
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -32,4 +32,5 @@
   typedef std::piecewise_constant_distribution test_type;
 
   typedef test_type::result_type result_type;
+  typedef test_type::param_type param_type;
 }
Index: 
testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc
===
--- 
testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc  
(revision 183133)
+++ 
testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc  
(working copy)
@@ -4,7 +4,7 @@
 //
 // 2008-11-24  Edward M. Smith-Rowland 3dw...@verizon.net
 //
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -32,4 +32,5 @@
   typedef std::chi_squared_distributiondouble test_type;
 
   typedef test_type::result_type result_type;
+  typedef test_type::param_type param_type;
 }
Index: