Re: [Patch libitm] [V2] config-based assessment of weakref capability

2012-01-06 Thread Iain Sandoe


On 6 Jan 2012, at 01:44, Patrick Marlier wrote:


Hello Iain,

On 11/21/2011 10:17 AM, Iain Sandoe wrote:

This checked to DTRT on i686-darwin9 (weak ref doesn't behave like
ELF's) and x86-64-darwin10/XCode 3.2.5 (weak ref behaves as per ELF).

It is my understanding from some off-list discussion reported with  
the

ld64 engineer -
- that Darwin = 10 should, in principle, support ELF-style weak refs
(as well as the two-level and flat_namespace versions).


I think something is wrong in the configure. Indeed, on apple- 
darwin10.8.0, weak ref works but it is configure as no.
I guess it should not try to run it but only compile it (or the  
symbol should exists).


Which tool-chain are you using ? (XCode version) - the problem is tool- 
chain related.

thanks
Iain.



Patrick.

Part of my config.log

configure:17219: checking whether weak refs work like ELF
configure:17251: /Users/patrick/gcc/trunk-build/./gcc/xgcc -B/Users/ 
patrick/gcc/trunk-build/./gcc/ -B/Users/patrick/gcc/trunk-install/ 
x86_64-apple-darwin10.8.0/bin/ -B/Users/patrick/gcc/trunk-install/ 
x86_64-apple-darwin10.8.0/lib/ -isystem /Users/patrick/gcc/trunk- 
install/x86_64-apple-darwin10.8.0/include -isystem /Users/patrick/ 
gcc/trunk-install/x86_64-apple-darwin10.8.0/sys-include   -o  
conftest -g -O2 -pthread  -Wl,-undefined,dynamic_lookup conftest.c   
5

configure:17251: $? = 0
configure:17251: ./conftest
dyld: Symbol not found: _fNotToBeFound
 Referenced from: /Users/patrick/gcc/trunk-build/x86_64-apple- 
darwin10.8.0/libitm/./conftest

 Expected in: flat namespace
in /Users/patrick/gcc/trunk-build/x86_64-apple-darwin10.8.0/libitm/./ 
conftest
/Users/patrick/gcc/trunk/libitm/configure: line 1742: 47745 Trace/ 
BPT trap  ./conftest$ac_exeext

configure:17251: $? = 133
configure: program exited with status 133
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME GNU TM Runtime Library
| #define PACKAGE_TARNAME libitm
| #define PACKAGE_VERSION 1.0
| #define PACKAGE_STRING GNU TM Runtime Library 1.0
| #define PACKAGE_BUGREPORT 
| #define PACKAGE_URL http://www.gnu.org/software/libitm/;
| #define PACKAGE libitm
| #define VERSION 1.0
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR .libs/

| #define STDC_HEADERS 1
| #define TIME_WITH_SYS_TIME 1
| #define STRING_WITH_STRINGS 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SEMAPHORE_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_MMAP_FILE 1
| #define HAVE_MMAP_ANON 1
| #define HAVE_STRTOULL 1
| #define HAVE_POSIX_MEMALIGN 1
| #define HAVE_BROKEN_POSIX_SEMAPHORES 1
| #define HAVE_TLS 1
| #define HAVE_ATTRIBUTE_VISIBILITY 1
| #define MANGLE_SIZE_T m
| #define HAVE_SYNC_BUILTINS 1
| #define HAVE_64BIT_SYNC_BUILTINS 1
| /* end confdefs.h.  */
|
| extern void fNotToBeFound(void) __attribute__((weak));
| int main ()
| {
|   if (fNotToBeFound)
| return 1;
|   else
| return 0;
| }
|
configure:17261: result: no




Re: [ARM] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST

2012-01-06 Thread Richard Earnshaw
On 05/01/12 18:54, Anatoly Sokolov wrote:
Hi.
 
This patch removes obsolete PREFERRED_RELOAD_CLASS macro from the ARM back 
 end in the GCC and introduces equivalent TARGET_PREFERRED_RELOAD_CLASS target 
 hook.
 
Bootstrapped and regression tested on arm-unknown-linux-gnueabi.
 
OK to install?
 
   * config/arm/arm.h (PREFERRED_RELOAD_CLASS): Remove.
   * config/arm/arm.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
   (arm_preferred_reload_class): New function.
 

This is OK when we go back to stage 1.

R.



PATCH: fix -fdump-ada-spec after PR debug/51410

2012-01-06 Thread Arnaud Charlet
The fix for PR debug/51410 (http://gcc.gnu.org/PR51410) available at:
  http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00375.html
has introduced a regression in the handling of -fdump-ada-spec which
was taking the previous behavior wrt ext_block into account to
avoid generating twice the same declarations, as in:


struct _jobject;

typedef struct _jobject * jobject;

void P (jobject t);


which should generate:


package my_type_h is

   -- skipped empty struct u_jobject

   type jobject is new System.Address; -- my_type.h:3

   procedure P (arg1 : jobject); -- my_type.h:5
   pragma Import (C, P, P);

end my_type_h;


and now generates, after PR51410 change:


package my_type_h is

   -- skipped empty struct u_jobject

   type jobject is new System.Address; -- my_type.h:3

end my_type_h;


Fixed by now taking into account ext_block in collect_all_refs and
for_each_global_decl (and moving the declaration of ext_block up in the
file).

Tested on i686-pc-linux-gnu, OK for trunk?

2011-01-06  Arnaud Charlet  char...@adacore.com

* c-decl.c (ext_block): Moved up.
(collect_all_refs, for_each_global_decl): Take ext_block into account.

Index: c-decl.c
===
--- c-decl.c(revision 182586)
+++ c-decl.c(working copy)
@@ -9951,6 +9951,9 @@ collect_source_ref_cb (tree decl)
 collect_source_ref (LOCATION_FILE (decl_sloc (decl, false)));
 }
 
+/* Preserve the external declarations scope across a garbage collect.  */
+static GTY(()) tree ext_block;
+
 /* Collect all references relevant to SOURCE_FILE.  */
 
 static void
@@ -9961,6 +9964,8 @@ collect_all_refs (const char *source_fil
 
   FOR_EACH_VEC_ELT (tree, all_translation_units, i, t)
 collect_ada_nodes (BLOCK_VARS (DECL_INITIAL (t)), source_file);
+
+  collect_ada_nodes (BLOCK_VARS (ext_block), source_file);
 }
 
 /* Iterate over all global declarations and call CALLBACK.  */
@@ -9979,10 +9984,10 @@ for_each_global_decl (void (*callback) (
   for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl))
callback (decl);
 }
-}
 
-/* Preserve the external declarations scope across a garbage collect.  */
-static GTY(()) tree ext_block;
+  for (decl = BLOCK_VARS (ext_block); decl; decl = TREE_CHAIN (decl))
+callback (decl);
+}
 
 void
 c_write_global_declarations (void)


Re: [PATCH][ARM] Fix headmerge testcases

2012-01-06 Thread Ramana Radhakrishnan

 OK?

OK

Ramana


Re: Unreviewed libffi, libgfortran, libitm patches

2012-01-06 Thread Rainer Orth
Richard Henderson r...@redhat.com writes:

 On 01/04/2012 11:27 PM, Rainer Orth wrote:
  [libgfortran, libitm] Link with -shared-libgcc
  http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01382.html
 
 This will need a fortran resp. libitm maintainer.

 Does the following alleviate the need for -shared-libgcc for libitm?

Yep.  I've bootstrapped with this patch on i386-pc-solaris2.11 with both
gas/Sun ld and gas/gld, with no regressions.  libitm.so is linked with
libgcc_s.so with Sun ld since -shared implies -shared-libgcc there, and
without with gld.

Thanks.
Rainer

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


[Add] Run ACATS cb20004 with -gnato

2012-01-06 Thread Eric Botcazou
I just discovered that the ACATS test cb20004 should be compiled with overflow 
checking, otherwise it can fail when you're tweaking the generated code.

As a matter of fact, it fails with the unmodified compiler if you change the 51

   Initial_Data_Block:
   begin-- Data causes Constraint_Error.
  Data_Buffer.Put (CB20004_0.Data_Item(Report.Ident_Int(51)));

to 35 for example.  The exception is supposed to be raised from:

 if Item  10 then
Item_Array (I) := Item * 8;  -- Constraint_Error will be raised

and you need overflow checking to handle all the cases.

Tested on i586-suse-linux, applied on the mainline, 4.6 and 4.5 branches.


2012-01-06  Eric Botcazou  ebotca...@adacore.com

* ada/acats/overflow.lst: Add cb20004.


-- 
Eric Botcazou
Index: ada/acats/overflow.lst
===
--- ada/acats/overflow.lst	(revision 182780)
+++ ada/acats/overflow.lst	(working copy)
@@ -14,3 +14,4 @@ c46014a
 c460008
 c460011
 c4a012b
+cb20004


Re: [Patch, Fortran] Deregister allocatable COARRAYS, fixes to (de)allocate

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

Please excuse the delay on coming back to you with this.  Since the
power cut the other evening, I have been exceptionally busy.

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

I have to confess that I do not like /* A better error message may be
possible, but not required.  */ one little bit.  Either write the
better message or eliminate the comment.  I would vote for the latter
:-)

Other than that, it looks fine: OK for trunk

Thanks

Paul


Re: [PATCH][ARM] Fix headmerge testcases

2012-01-06 Thread Andrew Stubbs

On 06/01/12 10:23, Ramana Radhakrishnan wrote:

OK


Committed.

Andrew


Re: PATCH: fix -fdump-ada-spec after PR debug/51410

2012-01-06 Thread Joseph S. Myers
On Fri, 6 Jan 2012, Arnaud Charlet wrote:

 2011-01-06  Arnaud Charlet  char...@adacore.com
 
   * c-decl.c (ext_block): Moved up.
   (collect_all_refs, for_each_global_decl): Take ext_block into account.

OK.

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


[PR 51759, 4.5] Backport the fix for PR 45644 to the 4.5 branch

2012-01-06 Thread Martin Jambor
Hi,

the original testcase for PR 45644 did not fail on gcc 4.5 but the bug
is there as the testcase of PR 51759 shows.  Therefore I've backported
the patch to the 4.5 branch.  The only change is the use of gcc_assert
instead of gcc_checking_assert since we didn't have that in 4.5 times.

Bootstrapped and tested on x86_64-linux, unless someone objects, I
will commit it to the branch and the new test to both the 4.6 branch
and the trunk on Monday.

Thanks,

Martin


2012-01-06  Martin Jambor  mjam...@suse.cz

PR tree-optimization/51759

Backport from mainline
2010-09-15  Martin Jambor  mjam...@suse.cz

PR middle-end/45644
* tree-sra.c (create_access): Check for bit-fields directly.

* testsuite/gcc.dg/ipa/pr45644.c: New test.
* testsuite/g++.dg/ipa/pr51759.C: Likewise.

Index: testsuite/gcc.dg/ipa/pr45644.c
===
--- testsuite/gcc.dg/ipa/pr45644.c  (revision 0)
+++ testsuite/gcc.dg/ipa/pr45644.c  (revision 0)
@@ -0,0 +1,35 @@
+/* Verify that we do not IPA-SRA bitfields.  */
+/* { dg-do run } */
+/* { dg-options -O2  } */
+
+extern void abort (void);
+
+struct S
+{
+  int j : 8;
+  int i : 24;
+  int l;
+};
+
+static int __attribute__((noinline)) foo (struct S *s)
+{
+  int z = s-i;
+  if (z != 777)
+abort ();
+  return 0;
+}
+
+int __attribute__((noinline)) bar (struct S *s)
+{
+  return foo (s);
+}
+
+int main (int argc, char *argv[])
+{
+  struct S s;
+  s.j = 5;
+  s.i = 777;
+  s.l = -1;
+
+  return bar (s);
+}
Index: testsuite/g++.dg/ipa/pr51759.C
===
--- testsuite/g++.dg/ipa/pr51759.C  (revision 0)
+++ testsuite/g++.dg/ipa/pr51759.C  (revision 0)
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options -O2  } */
+
+extern C void abort (void);
+struct S
+{
+  void __attribute__((noinline)) set(unsigned val)
+{
+  data = val;
+  if (data != val)
+abort ();
+}
+  int pad0;
+  unsigned pad1 : 8;
+  unsigned data : 24;
+  int pad2;
+};
+int main()
+{
+  S s;
+  s.pad2 = -1;
+  s.set(0);
+  if (s.pad2 != -1)
+abort ();
+}
+
Index: tree-sra.c
===
--- tree-sra.c  (revision 182905)
+++ tree-sra.c  (working copy)
@@ -771,12 +771,13 @@ create_access (tree expr, gimple stmt, b
  disqualify_candidate (base, Encountered a variable sized access.);
  return NULL;
}
-  if ((offset % BITS_PER_UNIT) != 0 || (size % BITS_PER_UNIT) != 0)
+  if (TREE_CODE (expr) == COMPONENT_REF
+  DECL_BIT_FIELD (TREE_OPERAND (expr, 1)))
{
- disqualify_candidate (base,
-   Encountered an acces not aligned to a byte.);
+ disqualify_candidate (base, Encountered a bit-field access.);
  return NULL;
}
+  gcc_assert ((offset % BITS_PER_UNIT) == 0);
 
   if (ptr)
mark_parm_dereference (base, offset + size, stmt);


Re: [Patch]: split libgcc/config/ia64/t-ia64 in two

2012-01-06 Thread Tristan Gingold

On Jan 6, 2012, at 12:40 AM, Richard Henderson wrote:

 On 12/21/2011 10:04 PM, Tristan Gingold wrote:
  * config/ia64/t-ia64 (LIB1ASMFUNCS): Move backward
  compatibility thunks...
  (CUSTOM_CRTSTUFF, crtbegin.o, crtend.o)
  (crtbeginS.o, crtendS.o): ... and these to ...
  * config/ia64/t-ia64-elf: ... this new file.
  * config.host (ia64*-*-elf*, ia64*-*-freebsd*, ia64*-*-linux*)
  (ia64*-*-hpux*): Add ia64/t-ia64-elf in tmake_file.
 
 Ok.
 

Thanks, committed after rebuilding gcc for ia64-linux (C only).

Tristan.



[PATCH] MIPS16 TLS support for GCC

2012-01-06 Thread Chung-Lin Tang
Hi Richard,
here are the patches for MIPS16 TLS. Some highlights of the implementation:

1) For the common -mcode-readable=yes case, TP/DTP offset constants are
loaded pc-relative (this saves insn count and size). HI16/LO16
constructing is used only as a fall-back when text is not readable.

2) To support the Initial/Local-Exec TLS access models, direct access to
the TP is needed. However, MIPS16 mode cannot access the 'rdhwr $3,$29'
instruction used to do that, thus a new __mips16_rdhwr() helper routine
is added to libgcc.a

3) Uses of this __mips16_rdhwr() routine are only generated by by (a)
IE/LE accesses, and (b) calls to the (new added)
__builtin_thread_pointer() builtin function. To facilitate lower
overhead, such calls are represented as UNSPECs instead of actual
function calls, and doesn't really follow the standard ABI (e.g. value
returned in $3). The __mips16_rdhwr() function is not intended for
general use, just tightly coupled compiler runtime support; therefore,
it is only linked statically from libgcc.a, not exported from shared libgcc.

4) Due to containing such a static only support routine, mips*-linux*
targets have been adjusted to use config/t-slibgcc-libgcc in
libgcc/config.host (or else static -lgcc would not be included when
linking with -shared -shared-libgcc)

5) The libgomp MIPS futex.h header has been adjusted; sys_futex0() has
been modified to be static, non-inlined, nomips16 under MIPS16 mode (for
sake of using 'syscall'). The inline assembly has also been fixed, as
Maciej noticed a possible violation of the MIPS syscall restart
convention; the 'li $2, #syscall_number' must be right before the
syscall insn.

Only O32 support has been attempted right now, though the code should
not have anything really old-ABI specific. We were able to build glibc
as MIPS16 code with this TLS implementation, so I believe things should
be fairly stable.

Anyways, I believe this will be going in only after 4.8-stage1 opens, so
you should have plenty time to review it :)

Thanks, and Happy New Year
Chung-Lin

2012-01-06  Chung-Lin Tang  clt...@codesourcery.com

gcc/
* config/mips/mips.h (CRT_CALL_STATIC_FUNCTION): Define versions
for MIPS16 O32.
* config/mips/mips-protos.h (mips_symbol_type): Add
SYMBOL_DTPREL_HI,SYMBOL_TPREL_HI. Update in comments.
(mips_output_tls_reloc_directive): New prototype.
* config/mips/mips-ftypes.def: Add (0, (POINTER)) entry.
* config/mips/predicates.md (tls_reloc_operand): New predicate.
* config/mips/mips.md (V0_REGNUM,PIC_JUMP_REGNUM): New constant.
(MIPS16 %dtprel_hi,%tprel_hi split pattern): New.
(consttable_tls_reloc): New.
(tls_get_tp_mode_mips16): New insn and split pattern.
(*tls_get_tp_mode_mips16_rdhwr): New insn pattern.

libgcc/
* config.host
(mips64*-*-linux*,mipsisa64*-*-linux*,mips*-*-linux*):
Use config/t-slibgcc-libgcc.
* config/mips/t-mips16 (LIB1ASMFUNCS): Add _m16rdhwr.
* config/mips/crtfastmath.c (set_fast_math): Add 'nomips16'
attribute.
* config/mips/mips16.S (__mips16_rdhwr): New.

libgomp/
* config/linux/mips/futex.h (sys_futex0): Change to static
function with noinline, nomips16 attributes under MIPS16. Adjust
asm statement to place 'li v0,SYS_futex' immediately before
syscall insn.

Index: gcc/config/mips/mips-ftypes.def
===
--- gcc/config/mips/mips-ftypes.def (revision 182952)
+++ gcc/config/mips/mips-ftypes.def (working copy)
@@ -51,6 +51,8 @@ DEF_MIPS_FTYPE (2, (INT, SF, SF))
 DEF_MIPS_FTYPE (2, (INT, V2SF, V2SF))
 DEF_MIPS_FTYPE (4, (INT, V2SF, V2SF, V2SF, V2SF))
 
+DEF_MIPS_FTYPE (0, (POINTER))
+
 DEF_MIPS_FTYPE (2, (SI, DI, SI))
 DEF_MIPS_FTYPE (2, (SI, POINTER, SI))
 DEF_MIPS_FTYPE (2, (DI, POINTER, SI))
Index: gcc/config/mips/predicates.md
===
--- gcc/config/mips/predicates.md   (revision 182952)
+++ gcc/config/mips/predicates.md   (working copy)
@@ -312,6 +312,14 @@
   type == SYMBOL_GOT_PAGE_OFST);
 })
 
+(define_predicate tls_reloc_operand
+  (match_code const,symbol_ref,label_ref)
+{
+  enum mips_symbol_type type;
+  return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, type)
+  (type == SYMBOL_DTPREL || type == SYMBOL_TPREL));
+})
+
 (define_predicate symbol_ref_operand
   (match_code symbol_ref))
 
Index: gcc/config/mips/mips.md
===
--- gcc/config/mips/mips.md (revision 182952)
+++ gcc/config/mips/mips.md (working copy)
@@ -134,7 +134,9 @@
 ])
 
 (define_constants
-  [(TLS_GET_TP_REGNUM  3)
+  [(V0_REGNUM  2)
+   (TLS_GET_TP_REGNUM  3)
+   (PIC_JUMP_REGNUM25)
(RETURN_ADDR_REGNUM 31)
(CPRESTORE_SLOT_REGNUM  76)

[Ada] Ada.[Wide_]Wide_Characters.Handling should be Pure

2012-01-06 Thread Arnaud Charlet
An oversight in the preparation of the RM left out the intended pragma
Pure for Ada.Wide_[Wide_]Characters.Handling (obviously intended since
Ada.Characters.Handling is Pure). This is expected to be corrected in
a future versiobn of AI05-0266-1, and this patch adds the required
pragma Pure statements. Also Ada.Wide_[Wide_]Characters.Unicode are
now Pure, as is System.UTF_32, since the two packages in question
depend on these packages, which should be pure in any case.

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

2012-01-06  Robert Dewar  de...@adacore.com

* a-wichha.ads, a-wichun.ads, a-zchhan.ads, a-zchuni.ads,
s-utf_32.ads: Add pragma Pure
* s-utf_32.adb: Suppress warnings on non-static constants (now
that this is Pure).

Index: a-zchuni.ads
===
--- a-zchuni.ads(revision 182950)
+++ a-zchuni.ads(working copy)
@@ -34,6 +34,7 @@
 with System.UTF_32;
 
 package Ada.Wide_Wide_Characters.Unicode is
+   pragma Pure;
 
--  The following type defines the categories from the unicode definitions.
--  The one addition we make is Fe, which represents the characters FFFE
Index: a-zchhan.ads
===
--- a-zchhan.ads(revision 182950)
+++ a-zchhan.ads(working copy)
@@ -14,6 +14,11 @@
 --
 
 package Ada.Wide_Wide_Characters.Handling is
+   pragma Pure;
+   --  This package is clearly intended to be Pure, by analogy with the
+   --  base Ada.Characters.Handling package. The version in the RM does
+   --  not yet have this pragma, but that is a clear omission. This will
+   --  be fixed in a future version of AI05-0266-1.
 
function Is_Control (Item : Wide_Wide_Character) return Boolean;
pragma Inline (Is_Control);
Index: s-utf_32.adb
===
--- s-utf_32.adb(revision 182950)
+++ s-utf_32.adb(working copy)
@@ -34,6 +34,13 @@
 pragma Style_Checks (Off);
 --  Allow long lines in this unit
 
+--  pragma Warnings (Off, non-static constant in preelaborated unit);
+--  We need this to be pure, and the three constants in question are not a
+--  real problem, they are completely known at compile time. This pragma
+--  is commented out for now, because we still want to be able to bootstrap
+--  with old versions of the compiler that did not support this form. We
+--  have added additional pragma Warnings (Off/On) for now ???
+
 package body System.UTF_32 is
 
--
@@ -1850,6 +1857,9 @@
  (16#F#, 16#D#),  -- (Co)  Plane 15 Private Use, First .. Plane 
15 Private Use, Last
  (16#10#, 16#10FFFD#));  -- (Co)  Plane 16 Private Use, First .. 
Plane 16 Private Use, Last
 
+   pragma Warnings (Off);
+   --  Temporary, until pragma at start can be activated ???
+
--  The following array is parallel to the Unicode_Ranges table above. For
--  each entry in the Unicode_Ranges table, there is a corresponding entry
--  in the following table indicating the corresponding unicode category.
@@ -6060,6 +6070,9 @@
 40,  -- DESERET CAPITAL LETTER LONG I .. DESERET CAPITAL LETTER EW
 32); -- TAG LATIN CAPITAL LETTER A .. TAG LATIN CAPITAL LETTER Z
 
+   pragma Warnings (On);
+   --  Temporary until pragma Warnings at start can be activated ???
+
--  The following is a list of the 10646 names for CAPITAL LETTER entries
--  that have no matching SMALL LETTER entry and are thus not folded
 
Index: s-utf_32.ads
===
--- s-utf_32.ads(revision 182950)
+++ s-utf_32.ads(working copy)
@@ -44,6 +44,7 @@
 pragma Compiler_Unit;
 
 package System.UTF_32 is
+   pragma Pure;
 
type UTF_32 is range 0 .. 16#7FFF_#;
--  So far, the only defined character codes are in 0 .. 16#01_#
Index: a-wichun.ads
===
--- a-wichun.ads(revision 182950)
+++ a-wichun.ads(working copy)
@@ -37,6 +37,7 @@
 with System.UTF_32;
 
 package Ada.Wide_Characters.Unicode is
+   pragma Pure;
 
--  The following type defines the categories from the unicode definitions.
--  The one addition we make is Fe, which represents the characters FFFE
Index: a-wichha.ads
===
--- a-wichha.ads(revision 182950)
+++ a-wichha.ads(working copy)
@@ -14,6 +14,11 @@
 --
 
 package Ada.Wide_Characters.Handling is
+   pragma Pure;
+   --  This package is clearly intended to be Pure, by analogy with the
+   --  base Ada.Characters.Handling package. The version in the RM does
+   --  not yet have this pragma, but that is a clear omission. This will
+   --  

[Ada] Add overriding indicators

2012-01-06 Thread Arnaud Charlet
This patch adds some missing overriding indicators.
No change in functionality

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

2012-01-06  Bob Duff  d...@adacore.com

* s-rpc.ads (Read, Write): Add overriding indicators.

Index: s-rpc.ads
===
--- s-rpc.ads   (revision 182950)
+++ s-rpc.ads   (working copy)
@@ -52,12 +52,12 @@
  (Initial_Size : Ada.Streams.Stream_Element_Count) is new
Ada.Streams.Root_Stream_Type with private;
 
-   procedure Read
+   overriding procedure Read
  (Stream : in out Params_Stream_Type;
   Item   : out Ada.Streams.Stream_Element_Array;
   Last   : out Ada.Streams.Stream_Element_Offset);
 
-   procedure Write
+   overriding procedure Write
  (Stream : in out Params_Stream_Type;
   Item   : Ada.Streams.Stream_Element_Array);
 


[Ada] Visibility of selected components that are prefixed calls in instances

2012-01-06 Thread Arnaud Charlet
This patch fixes a rare visibility bug in instantiations. A selected component
that resolves to a prefixed call in a generic unit may accidentally resolve to
a selected component with a different selector in an instance, when both a
primitive operation with a single parameter and a record component are
homographs. The fix constists in labelling the node in the generic (and thus in
the copy of the node in the instance) so that it is always resolved as a call.
As a consequence, in an instance body a selected component is known to be legal
without having to examine the current visibility of the selector name.

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

2012-01-06  Ed Schonberg  schonb...@adacore.com

* sinfo.ads, sinfo.adb (Has_Prefixed_Call): New flag to indicate
that a selected component within a generic unit has been resolved
as a prefixed call with local references.
* sem_ch3.adb (Is_Visible_Component): In an instance body a selected
component is always visible.
* sem_ch4.adb (Analyze_Selected_Component): If the node is a
prefixed call in an instance, do not look for visible components
of the type.
* sem_ch12.adb (Reset_Entity): If a selected component has resolved
to a prefixed call, mark the node accordingly when prefix and
selector are local references.

Index: sem_ch12.adb
===
--- sem_ch12.adb(revision 182950)
+++ sem_ch12.adb(working copy)
@@ -12676,6 +12676,7 @@
   Save_Entity_Descendants (N);
 
else
+  Set_Is_Prefixed_Call (Parent (N));
   Set_Associated_Node (N, Empty);
   Set_Etype (N, Empty);
end if;
@@ -12683,10 +12684,13 @@
 --  In Ada 2005, X.F may be a call to a primitive operation,
 --  rewritten as F (X). This rewriting will be done again in an
 --  instance, so keep the original node. Global entities will be
---  captured as for other constructs.
+--  captured as for other constructs. Indicate that this must
+--  resolve as a call, to prevent accidental overloading in the
+--  instance, if both a component and a primitive operation appear
+--  as candidates.
 
 else
-   null;
+   Set_Is_Prefixed_Call (Parent (N));
 end if;
 
  --  Entity is local. Reset in generic unit, so that node is resolved
Index: sem_ch3.adb
===
--- sem_ch3.adb (revision 182950)
+++ sem_ch3.adb (working copy)
@@ -16300,35 +16300,12 @@
   then
  return True;
 
-  --  If we are in the body of an instantiation, the component is visible
-  --  if the parent type is non-private, or in  an enclosing scope. The
-  --  scope stack is not present when analyzing an instance body, so we
-  --  must inspect the chain of scopes explicitly.
+  --  In the body of an instantiation, no need to check for the visibility
+  --  of a component.
 
   elsif In_Instance_Body then
- if not Is_Private_Type (Scope (C)) then
-return True;
+ return True;
 
- else
-declare
-   S : Entity_Id;
-
-begin
-   S := Current_Scope;
-   while Present (S)
- and then S /= Standard_Standard
-   loop
-  if S = Type_Scope then
- return True;
-  end if;
-
-  S := Scope (S);
-   end loop;
-
-   return False;
-end;
- end if;
-
   --  If the component has been declared in an ancestor which is currently
   --  a private type, then it is not visible. The same applies if the
   --  component's containing type is not in an open scope and the original
Index: sem_ch4.adb
===
--- sem_ch4.adb (revision 182950)
+++ sem_ch4.adb (working copy)
@@ -3858,8 +3858,10 @@
   elsif Is_Record_Type (Prefix_Type) then
 
  --  Find component with given name
+ --  In an instance, if the node is known as a prefixed call, do
+ --  not examine components whose visibility may be accidental.
 
- while Present (Comp) loop
+ while Present (Comp) and then not Is_Prefixed_Call (N) loop
 if Chars (Comp) = Chars (Sel)
   and then Is_Visible_Component (Comp)
 then
Index: sinfo.adb
===
--- sinfo.adb   (revision 182950)
+++ sinfo.adb   (working copy)
@@ -1838,6 +1838,14 @@
   return Flag13 (N);
end Is_Power_Of_2_For_Shift;
 
+   function Is_Prefixed_Call
+  (N : Node_Id) return Boolean is
+   begin
+  pragma Assert 

Re: [ARM] Convert to atomic optabs

2012-01-06 Thread Richard Earnshaw
On 06/01/12 04:57, Richard Henderson wrote:
 Ping.  Reposting the patch as it required updates to HEAD.
 
 
 r~
 
 

This is OK apart from:

 +   gcc_assert(!reload_completed);

Missing space.


  (define_special_predicate add_operator
(match_code plus))
 +
 +(define_predicate mem_noofs_operand
 +  (and (match_code mem)
 +   (match_code reg 0)))


Hmm, I'm a bit worried about things like the frame pointer reg matching
this and then everything going screwy when elimination takes place.
Almost certainly LEGITIMIZE_RELOAD_ADDRESS is going to be confused here
as it doesn't have enough information to know what's legitimate in this
particular case.

R.



Re: Ping^2: backport fix for PR 48660 (assigning to BLKmode return regs)

2012-01-06 Thread Richard Sandiford
Richard Sandiford richard.sandif...@linaro.org writes:
 Ping for backporting this expand patch, which fixes an ice-on-valid
 regression from 4.4 while compiling certain C++ packages on ARM:

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

Approved by richi on IRC.  Now applied to both 4.5 and 4.6 branches.

Richard


Re: [Google/main Patch] Cleanup pubnames/pubtypes and test-suite (issue5514045)

2012-01-06 Thread Tom Tromey
 Sterling == Sterling Augustine saugust...@google.com writes:

Sterling The enclosed patch to google/main contains certain small fixes
Sterling for pubnames and pubtypes, which are now emitted completely
Sterling and canonically.

I am curious to know how you ensure that they are canonical.

My recollection is that there are some differences between the names
emitted by g++ and those emitted by the demangler.  I can dig up some
examples if you want; I think they are in GCC bugzilla somewhere.

Tom


Re: [PING] PR33919/preprocessor fix __BASE_FILE__ when included from the command line

2012-01-06 Thread Tom Tromey
 Gary == Gary Funck g...@intrepid.com writes:

Gary I have a specific question re: this new code.
Gary +   name = _cpp_get_file_name (pfile-main_file);
Gary +   if (!name)
Gary + name = unknown;
Gary I wasn't sure whether 'name' can have a NULL value, and handled
Gary that case as shown above.  Would a gcc_assert() be more
Gary appropriate, or is it safe to simply assume that the name
Gary value is not NULL?

I think you can assume that it is not NULL.
libcpp can't use gcc_assert, but if you really want you could do

if (!name)
  abort ();

The patch is ok with either that change or with those 2 lines removed.

Thanks for doing this.

Tom


Re: [Patch libitm] [V2] config-based assessment of weakref capability

2012-01-06 Thread Mike Stump
On Jan 6, 2012, at 12:29 AM, Iain Sandoe wrote:
 I think something is wrong in the configure. Indeed, on apple-darwin10.8.0, 
 weak ref works but it is configure as no.
 I guess it should not try to run it but only compile it (or the symbol 
 should exists).
 
 Which tool-chain are you using ? (XCode version) - the problem is tool-chain 
 related.
 thanks

3.2.6 on x86_64-apple-darwin10.8.0 works for me with either -m32 or -m64.  If 
you have an older Xcode 3.2.x, try updating.


Re: [Patch libitm] [V2] config-based assessment of weakref capability

2012-01-06 Thread Patrick Marlier

On 01/06/2012 10:38 AM, Mike Stump wrote:

On Jan 6, 2012, at 12:29 AM, Iain Sandoe wrote:

I think something is wrong in the configure. Indeed, on apple-darwin10.8.0, weak ref 
works but it is configure as no.
I guess it should not try to run it but only compile it (or the symbol should 
exists).


Which tool-chain are you using ? (XCode version) - the problem is tool-chain 
related.
thanks


3.2.6 on x86_64-apple-darwin10.8.0 works for me with either -m32 or -m64.  If 
you have an older Xcode 3.2.x, try updating.


4.0 (build 4A304a) on x86_64-apple-darwin10.8.0. I will try to update it.

Thanks.


Re: [testsuite,trans-mem] memcpy-1.c testcase

2012-01-06 Thread Aldy Hernandez

On 01/05/12 17:44, Patrick Marlier wrote:

On Darwin, the memcpy is a macro to provide secure string operations
(FORTIFY_LEVEL  0). I propose to remove the string.h include and add
manually the declaration.

Tested on x86_64-apple-darwin and on x86_64-unknown-linux-gnu.
This solves PR51655.

Patrick Marlier.

testsuite/ChangeLog
2012-01-05 Patrick Marlier patrick.marl...@gmail.com

PR testsuite/51655
* c-c++-common/tm/memcpy-1.c: Declare memcpy instead of
including string.h.


This looks reasonable.  Richard will have to give the approval.

Thanks.


[PATCH] Fix miscompilation with -fprofile-use (PR gcov-profile/50127)

2012-01-06 Thread Jakub Jelinek
Hi!

When tree-prof/bb-reorg.c is compiled with 32-bit host cc1 with
-fprofile-use, it is miscompiled.  The problem is
that partition_hot_cold_basic_blocks leaves garbage (other bb
pointers) in bb-aux of some basic blocks and df_analyze
assumes (like other passes) that it is cleared and uses
-aux cast to ptrdiff_t as age value.
If the bb pointer is in the second half of address space (likely
on 32-bit, unlikely on 64-bit hosts), they are treated as negative age.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

We really should have some
#ifdef ENABLE_CHECKING
  FOR_ALL_BB (bb)
gcc_assert (bb-aux == NULL);
#endif
somewhere in the pass manager and early in df_analyze.

2012-01-06  Jakub Jelinek  ja...@redhat.com

PR gcov-profile/50127
* bb-reorder.c (partition_hot_cold_basic_blocks): Clear
bb-aux before running df_analyze.

--- gcc/bb-reorder.c.jj 2011-11-10 18:09:12.0 +0100
+++ gcc/bb-reorder.c2012-01-06 13:47:39.619401395 +0100
@@ -2219,6 +2219,7 @@ static unsigned
 partition_hot_cold_basic_blocks (void)
 {
   VEC(edge, heap) *crossing_edges;
+  basic_block bb;
 
   if (n_basic_blocks = NUM_FIXED_BLOCKS + 1)
 return 0;
@@ -2254,6 +2255,10 @@ partition_hot_cold_basic_blocks (void)
 
   add_reg_crossing_jump_notes ();
 
+  /* Clear bb-aux fields that the above routines were using.  */
+  FOR_EACH_BB (bb)
+bb-aux = NULL;
+
   VEC_free (edge, heap, crossing_edges);
 
   /* ??? FIXME: DF generates the bb info for a block immediately.

Jakub


[PATCH] Fix LTO with returns_twice TM builtins (PR lto/51774)

2012-01-06 Thread Jakub Jelinek
Hi!

Now that one of the TM builtins is returns_twice, the LTO FE needs to handle
it too.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2012-01-06  Jakub Jelinek  ja...@redhat.com

PR lto/51774
* lto-lang.c (handle_returns_twice_attribute): New function.
(lto_attribute_table): Add returns_twice attribute.

--- gcc/lto/lto-lang.c.jj   2011-12-02 01:52:27.0 +0100
+++ gcc/lto/lto-lang.c  2012-01-06 14:14:25.154067869 +0100
@@ -1,5 +1,5 @@
 /* Language-dependent hooks for LTO.
-   Copyright 2009, 2010 Free Software Foundation, Inc.
+   Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by CodeSourcery, Inc.
 
 This file is part of GCC.
@@ -47,6 +47,7 @@ static tree handle_nothrow_attribute (tr
 static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
 static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
 static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool 
*);
+static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *);
 static tree ignore_attribute (tree *, tree, tree, int, bool *);
 
 static tree handle_format_attribute (tree *, tree, tree, int, bool *);
@@ -74,6 +75,8 @@ const struct attribute_spec lto_attribut
  handle_nonnull_attribute, false },
   { nothrow,0, 0, true,  false, false,
  handle_nothrow_attribute, false },
+  { returns_twice,  0, 0, true,  false, false,
+ handle_returns_twice_attribute, false },
   { sentinel,   0, 1, false, true, true,
  handle_sentinel_attribute, false },
   { type generic,   0, 0, false, true, true,
@@ -424,6 +427,21 @@ handle_transaction_pure_attribute (tree
 
   return NULL_TREE;
 }
+
+/* Handle a returns_twice attribute.  */
+
+static tree
+handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name),
+   tree ARG_UNUSED (args),
+   int ARG_UNUSED (flags),
+   bool * ARG_UNUSED (no_add_attrs))
+{
+  gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
+
+  DECL_IS_RETURNS_TWICE (*node) = 1;
+
+  return NULL_TREE;
+}
 
 /* Ignore the given attribute.  Used when this attribute may be usefully
overridden by the target, but is not used generically.  */

Jakub


[PATCH] Fix LTO weakref handling without .weakref assembler support (PR target/47333)

2012-01-06 Thread Jakub Jelinek
Hi!

If as doesn't support .weakref, we handle weakrefs by
assemble_alias setting IDENTIFIER_TRANSPARENT_ALIAS and using
ultimate_transparent_alias_target from assemble_name.
But for this to work, assemble_alias has to be called before
asm for functions is emitted, not after it.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
and tested with the hacked up x86_64-linux gcc without HAVE_GAS_WEAKREF
in auto-host.h on the testcase.

Ok for trunk?

2012-01-06  Jakub Jelinek  ja...@redhat.com

PR target/47333
* cgraphunit.c (cgraph_optimize): Call output_weakrefs
before emitting functions.

--- gcc/cgraphunit.c.jj 2011-12-15 08:06:54.0 +0100
+++ gcc/cgraphunit.c2012-01-06 14:50:50.291364878 +0100
@@ -2187,6 +2187,7 @@ cgraph_optimize (void)
 #endif
   bitmap_obstack_release (NULL);
   cgraph_mark_functions_to_output ();
+  output_weakrefs ();
 
   cgraph_state = CGRAPH_STATE_EXPANSION;
   if (!flag_toplevel_reorder)
@@ -2201,7 +2202,6 @@ cgraph_optimize (void)
   varpool_assemble_pending_decls ();
 }
 
-  output_weakrefs ();
   cgraph_process_new_functions ();
   cgraph_state = CGRAPH_STATE_FINISHED;
 

Jakub


Re: [Patch libitm] [V2] config-based assessment of weakref capability

2012-01-06 Thread Jack Howarth
On Fri, Jan 06, 2012 at 10:58:51AM -0500, Patrick Marlier wrote:
 On 01/06/2012 10:38 AM, Mike Stump wrote:
 On Jan 6, 2012, at 12:29 AM, Iain Sandoe wrote:
 I think something is wrong in the configure. Indeed, on 
 apple-darwin10.8.0, weak ref works but it is configure as no.
 I guess it should not try to run it but only compile it (or the symbol 
 should exists).

 Which tool-chain are you using ? (XCode version) - the problem is 
 tool-chain related.
 thanks

 3.2.6 on x86_64-apple-darwin10.8.0 works for me with either -m32 or -m64.  
 If you have an older Xcode 3.2.x, try updating.

 4.0 (build 4A304a) on x86_64-apple-darwin10.8.0. I will try to update it.

 Thanks.

Using Xcode 4.2 on Snow Leopard, I see the same runtime failure for the 
configure test of 
checking whether weak refs work like ELF...

configure:17251: ./conftest
dyld: Symbol not found: _fNotToBeFound
  Referenced from: 
/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin10.8.0/libitm/./conftest
  Expected in: flat namespace
 in 
/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin10.8.0/libitm/./conftest
/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111216/libitm/configure: line 1742: 
24547 Trace/BPT trap  ./conftest$ac_exeext
configure:17251: $? = 133
configure: program exited with status 133

However if I execute the compile line with -v --save-temps and repeat the 
linkage with...

/Developer-3.2.6/usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.6.8 
-weak_reference_mismatches non-weak -o conftest -lcrt1.10.6.o 
-L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/./gcc -undefined 
dynamic_lookup conftest.o -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc 
-lSystem -v

the resulting binary for conftest runs fine. So we appear to have broken 
weakref support in the linker
for Xcode 4 and later.
Jack


Re: [PATCH] Fix LTO with returns_twice TM builtins (PR lto/51774)

2012-01-06 Thread Diego Novillo

On 12-01-06 11:38 , Jakub Jelinek wrote:

Hi!

Now that one of the TM builtins is returns_twice, the LTO FE needs to handle
it too.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2012-01-06  Jakub Jelinekja...@redhat.com

PR lto/51774
* lto-lang.c (handle_returns_twice_attribute): New function.
(lto_attribute_table): Add returns_twice attribute.


OK.


Diego.


Re: [Google/main Patch] Cleanup pubnames/pubtypes and test-suite (issue5514045)

2012-01-06 Thread Sterling Augustine
On Fri, Jan 6, 2012 at 7:21 AM, Tom Tromey tro...@redhat.com wrote:
 Sterling == Sterling Augustine saugust...@google.com writes:

 Sterling The enclosed patch to google/main contains certain small fixes
 Sterling for pubnames and pubtypes, which are now emitted completely
 Sterling and canonically.

 I am curious to know how you ensure that they are canonical.

Ensure is probably a too strong a word.

But, I have been using a local python script that compares the names
emitted by this patch with those as produced by gdb in the .gdb_index.
(I suppose I should get it contributed, but it started out as a one
off and would need some cleaning up to get contributable.) I also
would have to figure out the rules on contributing python scripts.

I know of two very small differences at this point, and it is
debatable whether or not they should be fixed. First, the demangler
doesn't use the underscores around restrict, and GCC does. Second, I
forget off-hand which way it goes, but one of them uses short int
and the other just short, and similarly for the other built-in
integer types. I know of no other mismatches.

This does bring up an issue that--to my limited knowledge
anyway--isn't well addressed by the current structure of GCC vs
binutils vs GDB: There aren't good ways to run full integration tests
between the three components. Perhaps I am just ignorant.


 My recollection is that there are some differences between the names
 emitted by g++ and those emitted by the demangler.

Indeed, I have changed g++ in google/main to fix that. See the earlier
patch that this one cleaned up, for example.

  I can dig up some
 examples if you want; I think they are in GCC bugzilla somewhere.

I have found a lot of them (some tests have to be pretty contorted to
make it show up), but a pointer to bugzilla would be great. I expect
we will contribute these test-cases as part of a patch to Gold in the
near future.

Sterling


[RFC] Fixing expansion of misaligned MEM_REFs on strict-alignment targets

2012-01-06 Thread Martin Jambor
Hi,

I'm trying to teach our expander how to deal with misaligned MEM_REFs
on strict alignment targets.  We currently generate code which leads
to bus error signals due to misaligned accesses.

I admit my motivation is not any target in particular but simply being
able to produce misaligned MEM_REFs in SRA, currently we work-around
that by producing COMPONENT_REFs which causes quite a few headaches.
Nevertheless, I started by following Richi's advice and set out to fix
the following two simple testcases on a strict-alignment platform, a
sparc64 in the compile farm.  If I understood him correctly, Richi
claimed they have been failing since forever:

- test case 1: -

extern void abort ();

typedef unsigned int myint __attribute__((aligned(1)));

/* even without the attributes we get bus error */
unsigned int __attribute__((noinline, noclone))
foo (myint *p)
{
  return *p;
}

struct blah
{
  char c;
  myint i;
};

struct blah g;

#define cst 0xdeadbeef

int
main (int argc, char **argv)
{
  int i;
  g.i = cst;
  i = foo (g.i);
  if (i != cst)
abort ();
  return 0;
}

- test case 2: -

extern void abort ();

typedef unsigned int myint __attribute__((aligned(1)));

void __attribute__((noinline, noclone))
foo (myint *p, unsigned int i)
{
  *p = i;
}

struct blah
{
  char c;
  myint i;
};

struct blah g;

#define cst 0xdeadbeef

int
main (int argc, char **argv)
{
  foo (g.i, cst);
  if (g.i != cst)
abort ();
  return 0;
}



I dug in expr.c and found two places which handle misaligned MEM_REfs
loads and stores respectively but only if there is a special
movmisalign_optab operation available for the given mode.  My approach
therefore was to append calls to extract_bit_field and store_bit_field
which seem to be the part of expander capable of dealing with
misaligned memory accesses.  The patch is below, it fixes both
testcases on sparc64--linux-gnu.

Is this approach generally the right thing to do?  And of course,
since my knowledge of RTL and expander is very limited I expect that
there will by quite many suggestions about its various particular
aspects.  I have run the c and c++ testsuite with the second hunk in
place without any problems, the same test of the whole patch is under
way right now but it takes quite a lot of time, therefore most
probably I won't have the results today.  Of course I plan to do a
bootstrap and at least Fortran checking on this platform too but that
is really going to take some time and I'd like to hear any comments
before that.

One more question: I'd like to be able to handle misaligned loads of
stores of SSE vectors this way too but then of course I cannot use
STRICT_ALIGNMENT as the guard but need a more elaborate predicate.  I
assume it must already exist, which one is it?

Thanks a lot in advance for any feedback,

Martin


*** /gcc/trunk/src/gcc/expr.c   Mon Jan  2 11:47:54 2012
--- expr.c  Fri Jan  6 16:39:34 2012
*** expand_assignment (tree to, tree from, b
*** 4572,4630 
 || TREE_CODE (to) == TARGET_MEM_REF)
 mode != BLKmode
 ((align = get_object_or_type_alignment (to))
!  GET_MODE_ALIGNMENT (mode))
!((icode = optab_handler (movmisalign_optab, mode))
! != CODE_FOR_nothing))
  {
-   struct expand_operand ops[2];
enum machine_mode address_mode;
!   rtx reg, op0, mem;
  
reg = expand_expr (from, NULL_RTX, VOIDmode, EXPAND_NORMAL);
reg = force_not_mem (reg);
  
!   if (TREE_CODE (to) == MEM_REF)
{
  addr_space_t as
! = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (to, 1;
  tree base = TREE_OPERAND (to, 0);
  address_mode = targetm.addr_space.address_mode (as);
  op0 = expand_expr (base, NULL_RTX, VOIDmode, EXPAND_NORMAL);
  op0 = convert_memory_address_addr_space (address_mode, op0, as);
- if (!integer_zerop (TREE_OPERAND (to, 1)))
-   {
- rtx off
- = immed_double_int_const (mem_ref_offset (to), address_mode);
- op0 = simplify_gen_binary (PLUS, address_mode, op0, off);
-   }
  op0 = memory_address_addr_space (mode, op0, as);
  mem = gen_rtx_MEM (mode, op0);
  set_mem_attributes (mem, to, 0);
  set_mem_addr_space (mem, as);
-   }
-   else if (TREE_CODE (to) == TARGET_MEM_REF)
-   {
- addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (to));
- struct mem_address addr;
  
! get_address_description (to, addr);
! op0 = addr_for_mem_ref (addr, as, true);
! op0 = memory_address_addr_space (mode, op0, as);
! mem = gen_rtx_MEM (mode, op0);
! set_mem_attributes (mem, to, 0);
! set_mem_addr_space (mem, as);
}
-   else
-   gcc_unreachable ();
-   if (TREE_THIS_VOLATILE (to))
-   MEM_VOLATILE_P (mem) = 1;
- 
-   create_fixed_operand (ops[0], mem);
-   create_input_operand 

Re: [ARM] Implement vec_perm for NEON

2012-01-06 Thread Richard Earnshaw
On 06/01/12 04:59, Richard Henderson wrote:
 Ping.  Reposting the patch as it required updates to HEAD.
 
 

OK.

R.



Re: patch: remove is_gimple_non_addressable

2012-01-06 Thread Aldy Hernandez

On 01/05/12 09:36, Richard Guenther wrote:

On Thu, Jan 5, 2012 at 3:48 PM, Aldy Hernandezal...@redhat.com  wrote:

As you suggested here:

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

Bootregged on x86-64 Linux.

OK?


No, this pessimizes things too much at gimplification time, please simply
inline the predicate instead.

Richard.


It wasn't clear from your other message whether you want me to replace 
the call with:


!is_gimple_reg ()  !TREE_ADDRESSABLE ()

or outright inline the exact function call as we have now.

I have done the later.  Let me know if you want the former.

Tested on x86-64 Linux.

OK?
* gimple.c (is_gimple_non_addressable): Remove.
* gimple.h: Remove is_gimple_non_addressable.
* gimplify.c (gimplify_modify_expr_rhs): Use is_gimple_reg instead of
is_gimple_non_addressable.
* trans-mem.c (expand_assign_tm): Same.

Index: trans-mem.c
===
--- trans-mem.c (revision 182908)
+++ trans-mem.c (working copy)
@@ -2184,7 +2184,7 @@ expand_assign_tm (struct tm_region *regi
   /* ??? Figure out if there's any possible overlap between the LHS
 and the RHS and if not, use MEMCPY.  */
 
-  if (load_p  is_gimple_non_addressable (lhs))
+  if (load_p  is_gimple_reg (lhs))
{
  tmp = create_tmp_var (TREE_TYPE (lhs), NULL);
  lhs_addr = build_fold_addr_expr (tmp);
Index: gimplify.c
===
--- gimplify.c  (revision 182848)
+++ gimplify.c  (working copy)
@@ -4411,16 +4411,27 @@ gimplify_modify_expr_rhs (tree *expr_p,
/* It's OK to use the target directly if it's being
   initialized. */
use_target = true;
- else if (!is_gimple_non_addressable (*to_p))
-   /* Don't use the original target if it's already addressable;
-  if its address escapes, and the called function uses the
-  NRV optimization, a conforming program could see *to_p
-  change before the called function returns; see c++/19317.
-  When optimizing, the return_slot pass marks more functions
-  as safe after we have escape info.  */
-   use_target = false;
  else
-   use_target = true;
+   {
+ tree t;
+
+ if (TREE_CODE (*to_p) == SSA_NAME)
+   t = SSA_NAME_VAR (*to_p);
+ else
+   t = *to_p;
+ if (!is_gimple_variable (t) || needs_to_live_in_memory (t))
+   /* Don't use the original target if it's already
+  addressable; if its address escapes, and the
+  called function uses the NRV optimization, a
+  conforming program could see *to_p change
+  before the called function returns; see
+  c++/19317.  When optimizing, the return_slot
+  pass marks more functions as safe after we have
+  escape info.  */
+   use_target = false;
+ else
+   use_target = true;
+   }
 
  if (use_target)
{
Index: gimple.c
===
--- gimple.c(revision 182848)
+++ gimple.c(working copy)
@@ -2963,17 +2963,6 @@ is_gimple_reg (tree t)
 }
 
 
-/* Return true if T is a GIMPLE variable whose address is not needed.  */
-
-bool
-is_gimple_non_addressable (tree t)
-{
-  if (TREE_CODE (t) == SSA_NAME)
-t = SSA_NAME_VAR (t);
-
-  return (is_gimple_variable (t)  ! needs_to_live_in_memory (t));
-}
-
 /* Return true if T is a GIMPLE rvalue, i.e. an identifier or a constant.  */
 
 bool
Index: gimple.h
===
--- gimple.h(revision 182848)
+++ gimple.h(working copy)
@@ -1006,9 +1006,6 @@ extern bool is_gimple_mem_rhs (tree);
 /* Returns true iff T is a valid if-statement condition.  */
 extern bool is_gimple_condexpr (tree);
 
-/* Returns true iff T is a variable that does not need to live in memory.  */
-extern bool is_gimple_non_addressable (tree t);
-
 /* Returns true iff T is a valid call address expression.  */
 extern bool is_gimple_call_addr (tree);
 


Re[2]: [BFIN] Hookize PREFERRED_RELOAD_CLASS

2012-01-06 Thread Anatoly Sokolov
Hi, Jie.

On Jan 6, 2012, Jie Zhang jzhang...@gmail.com wrote:

 Hi Anatoly,

 The patch looks OK.

 But I cannot apply your patch by saving your email as a patch file. If
 you take a look at this:


I attach the patch.

Anatoly.

bfin_prc.diff
Description: Binary data


Re: [Patch libitm] [V2] config-based assessment of weakref capability

2012-01-06 Thread Iain Sandoe


On 6 Jan 2012, at 16:42, Jack Howarth wrote:


On Fri, Jan 06, 2012 at 10:58:51AM -0500, Patrick Marlier wrote:

On 01/06/2012 10:38 AM, Mike Stump wrote:

On Jan 6, 2012, at 12:29 AM, Iain Sandoe wrote:
I think something is wrong in the configure. Indeed, on apple- 
darwin10.8.0, weak ref works but it is configure as no.
I guess it should not try to run it but only compile it (or the  
symbol should exists).


Which tool-chain are you using ? (XCode version) - the problem is  
tool-chain related.

thanks


3.2.6 on x86_64-apple-darwin10.8.0 works for me with either -m32  
or -m64.  If you have an older Xcode 3.2.x, try updating.


4.0 (build 4A304a) on x86_64-apple-darwin10.8.0. I will try to  
update it.


Thanks.


Using Xcode 4.2 on Snow Leopard, I see the same runtime failure for  
the configure test of

checking whether weak refs work like ELF...


Note the like ELF
.. the purpose of the test is to find out if we need to have the dummy  
routines.


(weak refs actually work at runtime for all current versions of Darwin  
- - the tricky bit is getting the link phase right)


Is the resulting libitm working?

cheers
Iain




Re: PATCH: fix -fdump-ada-spec after PR debug/51410

2012-01-06 Thread Eric Botcazou
 Fixed by now taking into account ext_block in collect_all_refs and
 for_each_global_decl (and moving the declaration of ext_block up in the
 file).

 Tested on i686-pc-linux-gnu, OK for trunk?

Since it only affects -fdump-ada-spec, I took the liberty to backport it to the 
4.6 branch, as Jakub's patch has been installed there as well.

-- 
Eric Botcazou


Re: [Patch libitm] [V2] config-based assessment of weakref capability

2012-01-06 Thread Iain Sandoe


On 6 Jan 2012, at 18:04, Patrick Marlier wrote:


On 01/06/2012 12:30 PM, Iain Sandoe wrote:


On 6 Jan 2012, at 16:42, Jack Howarth wrote:


On Fri, Jan 06, 2012 at 10:58:51AM -0500, Patrick Marlier wrote:

On 01/06/2012 10:38 AM, Mike Stump wrote:

On Jan 6, 2012, at 12:29 AM, Iain Sandoe wrote:

I think something is wrong in the configure. Indeed, on
apple-darwin10.8.0, weak ref works but it is configure as no.
I guess it should not try to run it but only compile it (or the
symbol should exists).


Which tool-chain are you using ? (XCode version) - the problem is
tool-chain related.
thanks


3.2.6 on x86_64-apple-darwin10.8.0 works for me with either -m32  
or

-m64. If you have an older Xcode 3.2.x, try updating.


4.0 (build 4A304a) on x86_64-apple-darwin10.8.0. I will try to  
update

it.

Thanks.


Using Xcode 4.2 on Snow Leopard, I see the same runtime failure for
the configure test of
checking whether weak refs work like ELF...


Note the like ELF
.. the purpose of the test is to find out if we need to have the  
dummy

routines.

(weak refs actually work at runtime for all current versions of  
Darwin -

- the tricky bit is getting the link phase right)

Is the resulting libitm working?


libitm compiles but the dummy function are used at runtime (eh-1.C  
testcase fails)...

Removing the dummy definitions in eh_cpp.cc makes it compile and work.


OK. could you file a PR please?
thanks
Iain



Re: [patch] Fix PR tree-optimization/51624

2012-01-06 Thread Eric Botcazou
  OK, I see.  Then the only way out I can think of is to stop going up the
  chain of COMPONENT_REFs as soon as the offset becomes negative.

 Yeah, that sounds like a better solution.

PR ada/51775 shows that this pessimizes though because if you have an enclosing 
sub-component at offset 0 on the LHS and not on the RHS, and you're using the 
model of the LHS for the RHS, you'll build a convoluted (but correct) MEM on 
the RHS, and this is apparently enough to thwart FRE/PRE and the likes in some 
simple cases:

  t$F$i2_9 = MEM[(struct pack9__r2 *)y_1(D)].F.i2;
  D.2233_3 = y_1(D)-i2;

The compiler doesn't see that D.2233_3 == t$F$i2_9.  Additionally using the 
type trick would help, at least for PR ada/51775 and I guess in most cases.  

Thoughts?

-- 
Eric Botcazou


Re: patch ping^2: PR 51516 (TM clone aliases)

2012-01-06 Thread Aldy Hernandez

On 01/05/12 16:05, Richard Henderson wrote:

On 01/06/2012 12:53 AM, Aldy Hernandez wrote:

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


It looks like it would be cleaner to put the .alias dereferencing
directly into get_cg_data.


r~


Arghh, I knew you were going to say that.  That was my first thought 
when I looked at Patrick's patch.


It looks like everywhere but two places (where we are dealing with the 
aliases themselves), we can traverse the aliases.


How does this look?

Tested on x86-64 Linux.
Patrick Marlier  patrick.marl...@gmail.com
PR middle-end/51516
* trans-mem.c (get_cg_data): Traverse aliases if requested.
(ipa_tm_scan_calls_block): Update parameters to get_cg_data.
(ipa_tm_note_irrevocable): Same.
(ipa_tm_scan_irr_block): Same.
(ipa_tm_decrement_clone_counts): Same.
(ipa_tm_scan_irr_function): Same.
(ipa_tm_create_version_alias): Same.
(ipa_tm_create_version): Same.
(ipa_tm_transform_calls_redirect): Same.
(ipa_tm_transform_calls): Same.
(ipa_tm_transform_transaction): Same.
(ipa_tm_execute): Same.

Index: testsuite/g++.dg/tm/pr51516.C
===
--- testsuite/g++.dg/tm/pr51516.C   (revision 0)
+++ testsuite/g++.dg/tm/pr51516.C   (revision 0)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options -fgnu-tm -fdump-tree-optimized } */
+
+struct C {
+  long l;
+  C():l(0) {}
+};
+
+int main()
+{
+  C* alloc;
+  __transaction_atomic {
+alloc = new C;
+  }
+  alloc-l = 2;
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-not _ITM_getTMCloneOrIrrevocable } } */
+/* { dg-final { scan-tree-dump-times ;; Function C::C 1 optimized } } */
+/* { dg-final { cleanup-tree-dump optimized } } */
Index: trans-mem.c
===
--- trans-mem.c (revision 182958)
+++ trans-mem.c (working copy)
@@ -3522,18 +3522,24 @@ DEF_VEC_ALLOC_P (cgraph_node_p, heap);
 typedef VEC (cgraph_node_p, heap) *cgraph_node_queue;
 
 /* Return the ipa data associated with NODE, allocating zeroed memory
-   if necessary.  */
+   if necessary.  TRAVERSE_ALIASES is true if we must traverse aliases
+   and set *NODE accordingly.  */
 
 static struct tm_ipa_cg_data *
-get_cg_data (struct cgraph_node *node)
+get_cg_data (struct cgraph_node **node, bool traverse_aliases)
 {
-  struct tm_ipa_cg_data *d = (struct tm_ipa_cg_data *) node-aux;
+  struct tm_ipa_cg_data *d;
+
+  if (traverse_aliases  (*node)-alias)
+*node = cgraph_get_node ((*node)-thunk.alias);
+
+  d = (struct tm_ipa_cg_data *) (*node)-aux;
 
   if (d == NULL)
 {
   d = (struct tm_ipa_cg_data *)
obstack_alloc (tm_obstack.obstack, sizeof (*d));
-  node-aux = (void *) d;
+  (*node)-aux = (void *) d;
   memset (d, 0, sizeof (*d));
 }
 
@@ -3582,7 +3588,7 @@ ipa_tm_scan_calls_block (cgraph_node_que
 
  node = cgraph_get_node (fndecl);
  gcc_assert (node != NULL);
- d = get_cg_data (node);
+ d = get_cg_data (node, true);
 
  pcallers = (for_clone ? d-tm_callers_clone
  : d-tm_callers_normal);
@@ -3643,7 +3649,7 @@ static void
 ipa_tm_note_irrevocable (struct cgraph_node *node,
 cgraph_node_queue *worklist_p)
 {
-  struct tm_ipa_cg_data *d = get_cg_data (node);
+  struct tm_ipa_cg_data *d = get_cg_data (node, true);
   struct cgraph_edge *e;
 
   d-is_irrevocable = true;
@@ -3651,6 +3657,7 @@ ipa_tm_note_irrevocable (struct cgraph_n
   for (e = node-callers; e ; e = e-next_caller)
 {
   basic_block bb;
+  struct cgraph_node *caller;
 
   /* Don't examine recursive calls.  */
   if (e-caller == node)
@@ -3660,7 +3667,8 @@ ipa_tm_note_irrevocable (struct cgraph_n
   if (is_tm_safe_or_pure (e-caller-decl))
continue;
 
-  d = get_cg_data (e-caller);
+  caller = e-caller;
+  d = get_cg_data (caller, true);
 
   /* Check if the callee is in a transactional region.  If so,
 schedule the function for normal re-scan as well.  */
@@ -3670,7 +3678,7 @@ ipa_tm_note_irrevocable (struct cgraph_n
   bitmap_bit_p (d-transaction_blocks_normal, bb-index))
d-want_irr_scan_normal = true;
 
-  maybe_push_queue (e-caller, worklist_p, d-in_worklist);
+  maybe_push_queue (caller, worklist_p, d-in_worklist);
 }
 }
 
@@ -3704,6 +3712,7 @@ ipa_tm_scan_irr_block (basic_block bb)
  if (TREE_CODE (fn) == ADDR_EXPR)
{
  struct tm_ipa_cg_data *d;
+ struct cgraph_node *node;
 
  fn = TREE_OPERAND (fn, 0);
  if (is_tm_ending_fndecl (fn))
@@ -3711,7 +3720,8 @@ ipa_tm_scan_irr_block (basic_block bb)
  if (find_tm_replacement_function (fn))
break;
 
- d = get_cg_data (cgraph_get_node (fn));
+ node = 

Re: [Patch libitm] [V2] config-based assessment of weakref capability

2012-01-06 Thread Jack Howarth
On Fri, Jan 06, 2012 at 06:07:37PM +, Iain Sandoe wrote:

 On 6 Jan 2012, at 18:04, Patrick Marlier wrote:

 On 01/06/2012 12:30 PM, Iain Sandoe wrote:

 On 6 Jan 2012, at 16:42, Jack Howarth wrote:

 On Fri, Jan 06, 2012 at 10:58:51AM -0500, Patrick Marlier wrote:
 On 01/06/2012 10:38 AM, Mike Stump wrote:
 On Jan 6, 2012, at 12:29 AM, Iain Sandoe wrote:
 I think something is wrong in the configure. Indeed, on
 apple-darwin10.8.0, weak ref works but it is configure as no.
 I guess it should not try to run it but only compile it (or the
 symbol should exists).

 Which tool-chain are you using ? (XCode version) - the problem is
 tool-chain related.
 thanks

 3.2.6 on x86_64-apple-darwin10.8.0 works for me with either 
 -m32 or
 -m64. If you have an older Xcode 3.2.x, try updating.

 4.0 (build 4A304a) on x86_64-apple-darwin10.8.0. I will try to  
 update
 it.

 Thanks.

 Using Xcode 4.2 on Snow Leopard, I see the same runtime failure for
 the configure test of
 checking whether weak refs work like ELF...

 Note the like ELF
 .. the purpose of the test is to find out if we need to have the  
 dummy
 routines.

 (weak refs actually work at runtime for all current versions of  
 Darwin -
 - the tricky bit is getting the link phase right)

 Is the resulting libitm working?

 libitm compiles but the dummy function are used at runtime (eh-1.C  
 testcase fails)...
 Removing the dummy definitions in eh_cpp.cc makes it compile and work.

 OK. could you file a PR please?
 thanks

Iain,
   We have radar Problem ID: 10466868, -undefined dynamic_lookup linker bug 
open with
your testcase (which I appended below). Do you recall if Nick ever indicated 
that this
was recognized a real regression in Xcode 4's linker or if it was unsupported  
behavior on
darwin that happened to work with the linker on prior Xcode releases? Also, 
perhaps we
can find someone with access to the Xcode 4.3 pre-release so they can check if 
this is
fixed yet.
 Jack

17-Nov-2011 08:22 PM Jack Howarth:
Summary: The following weak.c test case reveals a linker bug in -undefined 
dynamic_lookup in Xcode 4.2/4.2.1 under both darwin10 and darwin11.

--- weak.c -
#include stdio.h

char *myweakfunc(void) __attribute__((weak)) ;

int main(int argc, char **argv)
{
  if (myweakfunc)
printf (found myweakfunc %s\n, myweakfunc());
  else
printf(Weak func not found\n);
  return 0;
}
---

Steps to Reproduce:
1) Install Xcode 4.2 on darwin10 or darwin11.
2) Compile the weak.c test case with...

/usr/bin/llvm-gcc weak.c -o wk -undefined dynamic_lookup

3) Execute the resulting wk executable

Expected Results:

I expected the same results as is seen when the weak.c test case is compiled 
with llvm-gcc from Xcode 3.2.6...

howarth% /Developer-3.2.6/usr/bin/llvm-gcc weak.c -o wk -undefined 
dynamic_lookup
howarth% ./wk
Weak func not found

Actual Results:

The resulting binary fails to execute with the runtime error...

dyld: Symbol not found: _myweakfunc
  Referenced from: /Users/howarth/./wk
  Expected in: flat namespace
 in /Users/howarth/./wk
Trace/BPT trap

Regression:

This can be shown to be a regression in Xcode 4.2's ld since...

howarth% /usr/bin/llvm-gcc weak.c -o wk -undefined dynamic_lookup --save-temps
howarth% /Developer-3.2.6//usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 
10.6.8 -undefined dynamic_lookup -weak_reference_mismatches non-weak -undefined 
dynamic_lookup -o wk -lcrt1.10.6.o 
-L/Developer-3.2.6/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1/x86_64
 -L/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 
-L/usr/lib/i686-apple-darwin10/4.2.1 
-L/Developer-3.2.6/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1 
-L/Developer-3.2.6/usr/llvm-gcc-4.2/bin/../lib/gcc 
-L/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1 
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1 
-L/Developer-3.2.6/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1/../../..
 -L/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/../../.. 
weak.o -lSystem -lgcc -lSystem
howarth% ./wk
Weak func not found

works when the Xcode 3.2.6 linker is used instead of the Xcode 4.2 linker.

Notes:


 Iain


Re: [PATCH] Fix arm var-tracking ICE (PR debug/51746)

2012-01-06 Thread Alexandre Oliva
On Jan  4, 2012, Jakub Jelinek ja...@redhat.com wrote:

 Before the htab expansion
 cselib_lookup on r1 - 1 gave value 18:18 which contains the right value, but
 doesn't have the hash value for r1 - 1 (8169), thus is found only by
 accident.  Unfortunately after the expansion we don't look at the 18:18
 value at all, don't find a value and thus a new value for r1 - 1 is
 created (27:8169).  Unfortunately the expected MEM value is in 18:18's
 addr_list, not in 27:8169, so add_stores doesn't find it (and is create=0
 call, thus it returns NULL).

The problem was a bug in the hash number computation for the reverse
operation, that used the hash number of the original r1's VALUE when it
was in a register, but didn't use it when we computed the hash code of
the expression with a VALUE instead of the REG.

This patch fixes expression hash computation so that it uses the hash
code of a VALUE just as it would for REGs and MEMs, so that we compute
the same hashcode and locate the VALUEs for reverse expressions
correctly.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu, verified to solve
the ARM problem, with and without your patch.

I'm checking it in as obvious.

Index: gcc/cselib.c
===
--- gcc/cselib.c.orig	2012-01-06 14:18:38.954548069 -0200
+++ gcc/cselib.c	2012-01-06 14:18:44.952460886 -0200
@@ -1035,6 +1035,10 @@ cselib_hash_rtx (rtx x, int create, enum
 
   switch (code)
 {
+case VALUE:
+  e = CSELIB_VAL_PTR (x);
+  return e-hash;
+
 case MEM:
 case REG:
   e = cselib_lookup (x, GET_MODE (x), create, memmode);


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


Re: [PATCH] Another canonical cselib_val bootstrap fix (PR bootstrap/51725)

2012-01-06 Thread Alexandre Oliva
On Jan  3, 2012, Jakub Jelinek ja...@redhat.com wrote:

 My previous patch apparently wasn't enough.

I think we need to propagate addr_lists to the canonical value too, and
I found other spots that AFAICT require or would benefit from canonical
values.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu, also verified with
gnu-CORBA.list with a ia64-linux-gnu cross.

Ok to install?

for  gcc/ChangeLog
from  Alexandre Oliva  aol...@redhat.com

	PR bootstrap/51725
	* cselib.c (new_elt_loc_list): Promote addr_list to canonical node.
	Add canonical node to containing_mem chain after the non-canonical
	one, even if there weren't any locs to propagate.
	(remove_useless_values): Keep only canonical values.
	(add_mem_for_addr, cselib_lookup_mem): Canonicalize addr.
	(cselib_invalidate_mem): Likewise.  Ensure v is canonical, and
	canonicalize mem_chain elements that are not discarded.

Index: gcc/cselib.c
===
--- gcc/cselib.c.orig	2012-01-06 14:15:37.049194330 -0200
+++ gcc/cselib.c	2012-01-06 14:18:38.954548069 -0200
@@ -277,12 +277,27 @@ new_elt_loc_list (cselib_val *val, rtx l
 	}
 	  el-next = val-locs;
 	  next = val-locs = CSELIB_VAL_PTR (loc)-locs;
-	  if (CSELIB_VAL_PTR (loc)-next_containing_mem != NULL
-	   val-next_containing_mem == NULL)
-	{
-	  val-next_containing_mem = first_containing_mem;
-	  first_containing_mem = val;
-	}
+	}
+
+  if (CSELIB_VAL_PTR (loc)-addr_list)
+	{
+	  /* Bring in addr_list into canonical node.  */
+	  struct elt_list *last = CSELIB_VAL_PTR (loc)-addr_list;
+	  while (last-next)
+	last = last-next;
+	  last-next = val-addr_list;
+	  val-addr_list = CSELIB_VAL_PTR (loc)-addr_list;
+	  CSELIB_VAL_PTR (loc)-addr_list = NULL;
+	}
+
+  if (CSELIB_VAL_PTR (loc)-next_containing_mem != NULL
+	   val-next_containing_mem == NULL)
+	{
+	  /* Add VAL to the containing_mem list after LOC.  LOC will
+	 be removed when we notice it doesn't contain any
+	 MEMs.  */
+	  val-next_containing_mem = CSELIB_VAL_PTR (loc)-next_containing_mem;
+	  CSELIB_VAL_PTR (loc)-next_containing_mem = val;
 	}
 
   /* Chain LOC back to VAL.  */
@@ -641,7 +656,7 @@ remove_useless_values (void)
 
   p = first_containing_mem;
   for (v = *p; v != dummy_val; v = v-next_containing_mem)
-if (v-locs)
+if (v-locs  v == canonical_cselib_val (v))
   {
 	*p = v;
 	p = (*p)-next_containing_mem;
@@ -1270,6 +1285,7 @@ add_mem_for_addr (cselib_val *addr_elt, 
 {
   struct elt_loc_list *l;
 
+  addr_elt = canonical_cselib_val (addr_elt);
   mem_elt = canonical_cselib_val (mem_elt);
 
   /* Avoid duplicates.  */
@@ -1318,6 +1334,7 @@ cselib_lookup_mem (rtx x, int create)
   if (! addr)
 return 0;
 
+  addr = canonical_cselib_val (addr);
   /* Find a value that describes a value of our mode at that address.  */
   for (l = addr-addr_list; l; l = l-next)
 if (GET_MODE (l-elt-val_rtx) == mode)
@@ -2214,15 +2231,22 @@ cselib_invalidate_mem (rtx mem_rtx)
 	  /* We must have a mapping from this MEM's address to the
 	 value (E).  Remove that, too.  */
 	  addr = cselib_lookup (XEXP (x, 0), VOIDmode, 0, GET_MODE (x));
+	  addr = canonical_cselib_val (addr);
+	  gcc_checking_assert (v == canonical_cselib_val (v));
 	  mem_chain = addr-addr_list;
 	  for (;;)
 	{
-	  if (canonical_cselib_val ((*mem_chain)-elt) == v)
+	  cselib_val *canon = canonical_cselib_val ((*mem_chain)-elt);
+
+	  if (canon == v)
 		{
 		  unchain_one_elt_list (mem_chain);
 		  break;
 		}
 
+	  /* Record canonicalized elt.  */
+	  (*mem_chain)-elt = canon;
+
 	  mem_chain = (*mem_chain)-next;
 	}
 

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


Re: Keep static VTA locs in cselib tables only

2012-01-06 Thread Alexandre Oliva
On Jan  2, 2012, Hans-Peter Nilsson hans-peter.nils...@axis.com wrote:

 (canonical_cselib_val): New.
 * cselib.c (new_elt_loc_list): Rework to support value
 equivalences.  Adjust all callers.

 This (r182760) caused regressions in the libstdc++ testsuite for
 cris-elf, PR51728.

On Jan  2, 2012, Andreas Krebbel kreb...@linux.vnet.ibm.com wrote:

 this seem to have caused a bootstrap failure on s390x: PR51735

 /home/andreas/git/gcc-head/gcc/tree-ssa-pre.c: In function ‘bool
 insert_aux(basic_block)’:
 /home/andreas/git/gcc-head/gcc/tree-ssa-pre.c:3791:1: internal compiler error:
 Segmentation fault

Sorry about the breakage.  Can you please confirm that these problems
are both fixed with Jakub's patches?  If not, could you please try the
patch I've just posted in a follow up to the PR bootstrap/51725 thread,
and let me know in case any problem remains?

Thanks to Jakub for covering for me while I was network-challenged.

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


Re: [PATCH] Another canonical cselib_val bootstrap fix (PR bootstrap/51725)

2012-01-06 Thread Jakub Jelinek
On Fri, Jan 06, 2012 at 05:30:52PM -0200, Alexandre Oliva wrote:
 Regstrapped on x86_64-linux-gnu and i686-linux-gnu, also verified with
 gnu-CORBA.list with a ia64-linux-gnu cross.
 
 Ok to install?

Ok.

Jakub


Re: [PING] PR33919/preprocessor fix __BASE_FILE__ when included from the command line

2012-01-06 Thread Gary Funck
On 01/06/12 08:34:52, Tom Tromey wrote:
Tom The patch is ok with either that change or with those 2 lines removed.

Tom, thanks for the review.  Another question ...

The test case tries to sanity check the __FILE__ value
by comparing the 'basename' part.

#define BASE_NAME pr33919.c

int
main ()
{
  size_t file_len = strlen (__FILE__);
  size_t basename_len = strlen (BASE_NAME);
  if (file_len  basename_len)
abort ();
  if (strcmp (__FILE__ + file_len - basename_len, BASE_NAME))
abort ();
[...]

which probably works fine on most systems, but perhaps
not so well if the OS upper cases all file names?

I can either remove the check, or change it so
that it just compares to make sure that __BASE_FILE__
isn't equal to command line, which is the
problem documented in the bug report.

- Gary


Re: [patch] libitm: Optimize undo log.

2012-01-06 Thread Richard Henderson
On 01/06/2012 11:15 AM, Torvald Riegel wrote:
 libitm: Optimize undo log.
 
   libitm/
   * local.cc (GTM_LB): Use GTM::gtm_undolog.
   (GTM::gtm_thread::drop_references_undolog): Remove.
   (GTM::gtm_thread::commit_undolog,
   GTM::gtm_thread::rollback_undolog): Move to ...
   * libitm_i.h (GTM::gtm_undolog): ...here. New.
   (GTM::gtm_undolog_entry): Remove.
   (GTM::gtm_thread): Adapt.
   * beginend.cc (GTM::gtm_thread::rollback): Adapt.
   (GTM::gtm_thread::trycommit): Adapt.
   * method-serial.cc (serial_dispatch::log): Adapt.
   * method-gl.cc (gl_wt_dispatch::pre_write): Adapt.
   (gl_wt_dispatch::store): Fix likely/unlikely.
   * containers.h (GTM::vector::resize): Add additional_capacity
   parameter and handle it.
   (GTM::vector::resize_noinline): New/adapt.
   (GTM::vector::push): New.

Ok.


r~


C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)

2012-01-06 Thread Jason Merrill
This patch fixes several mangling issues that have been around for a 
while; several things didn't have a defined mangling until recently, and 
others have been adjusted subtly.  The most notable of these is that the 
mangling for a C++11 template argument pack has changed, which affects 
any code that uses variadic templates.


For the moment, only the additions are enabled by default; the changes 
require -fabi-version=6 or =0.  Other changes since -fabi-version=2 have 
been fairly limited in scope, not affecting very much code.  But this is 
a big change, that will require recompilation of pretty much any C++11 
code when it happens.  The question is, should it happen now, or wait 
until a later flag day when we make other changes as well?


We have said that we make no guarantees about backward compatibility in 
C++0x mode, but we still need to decide whether to break it 
incrementally (so that future breakage will be less, and to improve 
compatibility with other compilers) or all at once later on?


Tested x86_64-pc-linux-gnu, applying to trunk.
commit c712790430099b450bbdcdbda237121893b7b3d2
Author: Jason Merrill ja...@redhat.com
Date:   Fri Jan 6 09:35:14 2012 -0500

	* error.c (dump_expr): Print type of CONSTRUCTOR.

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 21d6781..62b47ca 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2194,6 +2194,8 @@ dump_expr (tree t, int flags)
 	}
   else
 	{
+	  if (!BRACE_ENCLOSED_INITIALIZER_P (t))
+	dump_type (TREE_TYPE (t), 0);
 	  pp_cxx_left_brace (cxx_pp);
 	  dump_expr_init_vec (CONSTRUCTOR_ELTS (t), flags);
 	  pp_cxx_right_brace (cxx_pp);
diff --git a/gcc/testsuite/g++.dg/cpp0x/error7.C b/gcc/testsuite/g++.dg/cpp0x/error7.C
new file mode 100644
index 000..0dfbf9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/error7.C
@@ -0,0 +1,10 @@
+// Test for printing the type of T{} in error messages.
+// { dg-options -std=c++0x }
+
+template class T, T t struct A { };
+template class T AT,T{} f(T t); // { dg-message T{} }
+
+int main()
+{
+  f();// { dg-error no match }
+}

commit 5bebdf16393c8f6ca7b9b2f2cd741919ac25d952
Author: Jason Merrill ja...@redhat.com
Date:   Fri Jan 6 09:39:03 2012 -0500

	* mangle.c (mangle_decl): Don't generate mangling aliases
	for maybe-in-charge [cd]tors.

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 548998a..e5c2895 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3194,7 +3194,10 @@ mangle_decl (const tree decl)
   tree id = get_mangled_id (decl);
   SET_DECL_ASSEMBLER_NAME (decl, id);
 
-  if (G.need_abi_warning)
+  if (G.need_abi_warning
+  /* Don't do this for a fake symbol we aren't going to emit anyway.  */
+   !DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
+   !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
 {
 #ifdef ASM_OUTPUT_DEF
   /* If the mangling will change in the future, emit an alias with the

commit c427dcbe4bedd0f17df7054d17412960e0cba40c
Author: Jason Merrill ja...@redhat.com
Date:   Fri Jan 6 09:44:05 2012 -0500

	* cp-demangle.c (cplus_demangle_type): decltype, pack expansion
	and vector are substitutable.
	(cplus_demangle_operators): Sort.

diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 0f1166b..0ed8397 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -1554,7 +1554,8 @@ d_identifier (struct d_info *di, int len)
 /* operator_name ::= many different two character encodings.
  ::= cv type
  ::= v digit source-name
-*/
+
+   This list is sorted for binary search.  */
 
 #define NL(s) s, (sizeof s) - 1
 
@@ -1566,6 +1567,8 @@ const struct demangle_operator_info cplus_demangle_operators[] =
   { aa, NL (),2 },
   { ad, NL (), 1 },
   { an, NL (), 2 },
+  { at, NL (alignof ),   1 },
+  { az, NL (alignof ),   1 },
   { cl, NL (()),2 },
   { cm, NL (,), 2 },
   { co, NL (~), 1 },
@@ -1611,8 +1614,6 @@ const struct demangle_operator_info cplus_demangle_operators[] =
   { rs, NL (),2 },
   { st, NL (sizeof ),   1 },
   { sz, NL (sizeof ),   1 },
-  { at, NL (alignof ),   1 },
-  { az, NL (alignof ),   1 },
   { NULL, NULL, 0,  0 }
 };
 
@@ -2242,12 +2243,14 @@ cplus_demangle_type (struct d_info *di)
 			 d_expression (di), NULL);
 	  if (ret  d_next_char (di) != 'E')
 	ret = NULL;
+	  can_subst = 1;
 	  break;
 	  
 	case 'p':
 	  /* Pack expansion.  */
 	  ret = d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION,
 			 cplus_demangle_type (di), NULL);
+	  can_subst = 1;
 	  break;
 	  
 	case 'f':
@@ -2298,6 +2301,7 @@ cplus_demangle_type (struct d_info *di)
 
 	case 'v':
 	  ret = d_vector_type (di);
+	  can_subst = 1;
 	  break;
 
 case 'n':
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 70abf68..642fe14 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4018,6 +4018,18 @@ K1, S::m::f()
 

Re: [ARM] Convert to atomic optabs

2012-01-06 Thread Richard Henderson
On 01/07/2012 01:54 AM, Richard Earnshaw wrote:
  +
  +(define_predicate mem_noofs_operand
  +  (and (match_code mem)
  +   (match_code reg 0)))
 
 Hmm, I'm a bit worried about things like the frame pointer reg matching
 this and then everything going screwy when elimination takes place.
 Almost certainly LEGITIMIZE_RELOAD_ADDRESS is going to be confused here
 as it doesn't have enough information to know what's legitimate in this
 particular case.

Given that there's a define_memory_constraint to go along with it, I 
think we should be ok.  The main part of reload certainly has enough
information to reload the address.

FWIW, ARM is not unique in the no-offset restriction to atomic memories.
I've used exactly the same scheme there for years implementing the original
sync optabs.


r~


Re: [PATCH] Fix LTO weakref handling without .weakref assembler support (PR target/47333)

2012-01-06 Thread Richard Henderson
On 01/07/2012 03:41 AM, Jakub Jelinek wrote:
   PR target/47333
   * cgraphunit.c (cgraph_optimize): Call output_weakrefs
   before emitting functions.

Ok.


r~


Re: [PATCH] Fix miscompilation with -fprofile-use (PR gcov-profile/50127)

2012-01-06 Thread Richard Henderson
On 01/07/2012 03:36 AM, Jakub Jelinek wrote:
   PR gcov-profile/50127
   * bb-reorder.c (partition_hot_cold_basic_blocks): Clear
   bb-aux before running df_analyze.

Ok except,

 +  /* Clear bb-aux fields that the above routines were using.  */
 +  FOR_EACH_BB (bb)
 +bb-aux = NULL;

clear_aux_for_blocks


r~


Re: [PATCH] Fix LTO weakref handling without .weakref assembler support (PR target/47333)

2012-01-06 Thread Jan Hubicka
 Hi!
 
 If as doesn't support .weakref, we handle weakrefs by
 assemble_alias setting IDENTIFIER_TRANSPARENT_ALIAS and using
 ultimate_transparent_alias_target from assemble_name.
 But for this to work, assemble_alias has to be called before
 asm for functions is emitted, not after it.
 
 Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
 and tested with the hacked up x86_64-linux gcc without HAVE_GAS_WEAKREF
 in auto-host.h on the testcase.
 
 Ok for trunk?

OK,
thanks!
Honza


Re: C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)

2012-01-06 Thread Joseph S. Myers
On Fri, 6 Jan 2012, Jason Merrill wrote:

 For the moment, only the additions are enabled by default; the changes require
 -fabi-version=6 or =0.  Other changes since -fabi-version=2 have been fairly
 limited in scope, not affecting very much code.  But this is a big change,
 that will require recompilation of pretty much any C++11 code when it happens.
 The question is, should it happen now, or wait until a later flag day when we
 make other changes as well?

other changes might also include moving to libstdc++.so.7 - if there's a 
such an incompatible library ABI change coming up, it would make sense to 
do the compiler ABI changes at the same time.

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


Re: [testsuite,trans-mem] memcpy-1.c testcase

2012-01-06 Thread Richard Henderson
On 01/06/2012 10:44 AM, Patrick Marlier wrote:
 2012-01-05  Patrick Marlier  patrick.marl...@gmail.com
 
 PR testsuite/51655
 * c-c++-common/tm/memcpy-1.c: Declare memcpy instead of
 including string.h.

Applied.


r~


Re: Keep static VTA locs in cselib tables only

2012-01-06 Thread Hans-Peter Nilsson
 From: Alexandre Oliva aol...@redhat.com
 Date: Fri, 6 Jan 2012 20:35:39 +0100

 On Jan  2, 2012, Hans-Peter Nilsson hans-peter.nils...@axis.com wrote:
  This (r182760) caused regressions in the libstdc++ testsuite for
  cris-elf, PR51728.

 On Jan  2, 2012, Andreas Krebbel kreb...@linux.vnet.ibm.com wrote:
  this seem to have caused a bootstrap failure on s390x: PR51735

 Sorry about the breakage.  Can you please confirm that these problems
 are both fixed with Jakub's patches?

I can't add anything about Andreas' observation besides his own
confirmation in the PR of it being fixed, but the problem I
reported is fine now.  No worries, if it wasn't fixed, I'd have
mentioned it. ;)

No testsuite result regressions (since T0=2007-01-05-16:47:21!)
for cris-elf at r182959.

brgds, H-P


C++ PATCH for c++/47450 (defining class in new-expression)

2012-01-06 Thread Jason Merrill
DR 686 clarified that it is ill-formed to define a class in the 
(type-id) of a new-expression as well as in a new-type-id.  This patch 
implements that, so we now reject the testcase.


Tested x86_64-pc-linux-gnu, applying to trunk.

commit f9a4c24ed3c76e4777414733d3c7de43c6642286
Author: Jason Merrill ja...@redhat.com
Date:   Fri Jan 6 17:59:50 2012 -0500

	DR 686
	PR c++/47450
	* parser.c (cp_parser_new_expression): Set
	type_definition_forbidden_message.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 0ae55a2..9be68d0 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -6668,10 +6668,17 @@ cp_parser_new_expression (cp_parser* parser)
   if (cp_lexer_next_token_is (parser-lexer, CPP_OPEN_PAREN))
 {
   cp_token *token;
+  const char *saved_message = parser-type_definition_forbidden_message;
+
   /* Consume the `('.  */
   cp_lexer_consume_token (parser-lexer);
+
   /* Parse the type-id.  */
+  parser-type_definition_forbidden_message
+	= G_(types may not be defined in a new-expression);
   type = cp_parser_type_id (parser);
+  parser-type_definition_forbidden_message = saved_message;
+
   /* Look for the closing `)'.  */
   cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
   token = cp_lexer_peek_token (parser-lexer);
diff --git a/gcc/testsuite/g++.dg/parse/new5.C b/gcc/testsuite/g++.dg/parse/new5.C
new file mode 100644
index 000..83937c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/new5.C
@@ -0,0 +1,4 @@
+// PR c++/47450
+
+struct A { };
+A* ap = new(struct: A { });	// { dg-error types may not be defined }


Re: [PATCH] PR debug/45682 - wrong struct DIE nesting with -fdebug-types-section

2012-01-06 Thread Cary Coutant
 I think the real problem is that the skeleton declaration DIE for
 class Executor is being inserted under the wrong DIE -- probably in
 remove_child_or_replace_with_skeleton().

The problem is that we're inserting the skeleton DIE for class
Executor in place of the original specification DIE at the top level
under the compile_unit DIE. The original had a DW_AT_specification
pointing to a declaration DIE under namespace thread, but the skeleton
is a declaration, so it needs to be directly under the namespace DIE.
The original declaration DIE gets pruned because there are no
references left that point to it.

The patch below fixes that by noting that the DIE we're replacing had
a specification DIE, and when it's time to replace it with the
skeleton DIE, we need to insert it under the original declaration's
parent.

Take a look at this and see if it makes sense; if it does, I'll add a
ChangeLog and a testcase on Monday, bootstrap, test, and submit. I did
verify that gdb can read the resulting debug info for the test case in
the original PR.

-cary


diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 695b7b1..f1632ea 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3307,11 +3307,12 @@ static int should_move_die_to_comdat (dw_die_ref);
 static dw_die_ref clone_as_declaration (dw_die_ref);
 static dw_die_ref clone_die (dw_die_ref);
 static dw_die_ref clone_tree (dw_die_ref);
-static void copy_declaration_context (dw_die_ref, dw_die_ref);
+static dw_die_ref copy_declaration_context (dw_die_ref, dw_die_ref);
 static void generate_skeleton_ancestor_tree (skeleton_chain_node *);
 static void generate_skeleton_bottom_up (skeleton_chain_node *);
 static dw_die_ref generate_skeleton (dw_die_ref);
 static dw_die_ref remove_child_or_replace_with_skeleton (dw_die_ref,
+ dw_die_ref,
  dw_die_ref);
 static void break_out_comdat_types (dw_die_ref);
 static dw_die_ref copy_ancestor_tree (dw_die_ref, dw_die_ref, htab_t);
@@ -7160,11 +7161,12 @@ clone_as_declaration (dw_die_ref die)
AT_specification attribute, it also includes attributes and children
attached to the specification.  */

-static void
+static dw_die_ref
 copy_declaration_context (dw_die_ref unit, dw_die_ref die)
 {
   dw_die_ref decl;
   dw_die_ref new_decl;
+  dw_die_ref new_parent = NULL;

   decl = get_AT_ref (die, DW_AT_specification);
   if (decl == NULL)
@@ -7175,6 +7177,10 @@ copy_declaration_context (dw_die_ref unit,
dw_die_ref die)
   dw_die_ref c;
   dw_attr_ref a;

+  /* The original DIE will be changed to a declaration, and must
+ be moved to be a child of the original declaration DIE.  */
+  new_parent = decl-die_parent;
+
   /* Copy the type node pointer from the new DIE to the original
  declaration DIE so we can forward references later.  */
   decl-die_id.die_type_node = die-die_id.die_type_node;
@@ -7203,6 +7209,8 @@ copy_declaration_context (dw_die_ref unit, dw_die_ref die)
   add_AT_specification (die, new_decl);
 }
 }
+
+  return new_parent;
 }

 /* Generate the skeleton ancestor tree for the given NODE, then clone
@@ -7286,7 +7294,7 @@ generate_skeleton (dw_die_ref die)
   return node.new_die;
 }

-/* Remove the DIE from its parent, possibly replacing it with a cloned
+/* Remove the CHILD DIE from its parent, possibly replacing it with a cloned
declaration.  The original DIE will be moved to a new compile unit
so that existing references to it follow it to the new location.  If
any of the original DIE's descendants is a declaration, we need to
@@ -7294,7 +7302,8 @@ generate_skeleton (dw_die_ref die)
declarations back into the skeleton tree.  */

 static dw_die_ref
-remove_child_or_replace_with_skeleton (dw_die_ref child, dw_die_ref prev)
+remove_child_or_replace_with_skeleton (dw_die_ref child, dw_die_ref prev,
+  dw_die_ref new_parent)
 {
   dw_die_ref skeleton;

@@ -7304,7 +7313,16 @@ remove_child_or_replace_with_skeleton
(dw_die_ref child, dw_die_ref prev)
   else
 {
   skeleton-die_id.die_type_node = child-die_id.die_type_node;
-  replace_child (child, skeleton, prev);
+
+  /* If the original DIE was a specification, we need to put
+ the skeleton under the parent DIE of the declaration.  */
+  if (new_parent != NULL)
+   {
+ remove_child_with_prev (child, prev);
+ add_child_die (new_parent, skeleton);
+   }
+  else
+   replace_child (child, skeleton, prev);
 }

   return skeleton;
@@ -7332,7 +7350,7 @@ break_out_comdat_types (dw_die_ref die)
 next = (c == first ? NULL : c-die_sib);
 if (should_move_die_to_comdat (c))
   {
-dw_die_ref replacement;
+dw_die_ref replacement, new_parent;
comdat_type_node_ref type_node;

 /* Create a new type unit DIE as the root for the new tree, and
@@ -7350,10 

binutils et al broken from C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)

2012-01-06 Thread Hans-Peter Nilsson
 From: Jason Merrill ja...@redhat.com
 Date: Fri, 6 Jan 2012 22:38:28 +0100

 include/
 * demangle.h (enum demangle_component_type): Add
 DEMANGLE_COMPONENT_INITIALIZER_LIST, DEMANGLE_COMPONENT_NULLARY.
 
 diff --git a/include/demangle.h b/include/demangle.h
 index 98b11d7..34b3ed3 100644
 --- a/include/demangle.h
 +++ b/include/demangle.h
 @@ -344,6 +344,9 @@ enum demangle_component_type
   template argument, and the right subtree is either NULL or
   another TEMPLATE_ARGLIST node.  */
DEMANGLE_COMPONENT_TEMPLATE_ARGLIST,
 +  /* An initializer list.  The left subtree is either an explicit type or
 + NULL, and the right subtree is a DEMANGLE_COMPONENT_ARGLIST.  */
 +  DEMANGLE_COMPONENT_INITIALIZER_LIST,
/* An operator.  This holds information about a standard
   operator.  */
DEMANGLE_COMPONENT_OPERATOR,
 @@ -353,6 +356,8 @@ enum demangle_component_type
/* A typecast, represented as a unary operator.  The one subtree is
   the type to which the argument should be cast.  */
DEMANGLE_COMPONENT_CAST,
 +  /* A nullary expression.  The left subtree is the operator.  */
 +  DEMANGLE_COMPONENT_NULLARY,
/* A unary expression.  The left subtree is the operator, and the
   right subtree is the single argument.  */
DEMANGLE_COMPONENT_UNARY,

Please commit this too to binutils CVS, it's apparently missing
in the CVS commit and thus binutils et al broken as follows:

gcc -O2 -m32 -c -DHAVE_CONFIG_H -g -O2  -I. 
-I/tmp/hpautotest-binutils/bsrc/src/libiberty/../include  -W -Wall 
-Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  
/tmp/hpautotest-binutils/bsrc/src/libiberty/cp-demangle.c -o cp-demangle.o
/tmp/hpautotest-binutils/bsrc/src/libiberty/cp-demangle.c: In function 
'd_make_comp':
/tmp/hpautotest-binutils/bsrc/src/libiberty/cp-demangle.c:851: error: 
'DEMANGLE_COMPONENT_NULLARY' undeclared (first use in this function)
/tmp/hpautotest-binutils/bsrc/src/libiberty/cp-demangle.c:851: error: (Each 
undeclared identifier is reported only once
/tmp/hpautotest-binutils/bsrc/src/libiberty/cp-demangle.c:851: error: for each 
function it appears in.)
(etc.)

brgds, H-P


Re: [BFIN] Hookize PREFERRED_RELOAD_CLASS

2012-01-06 Thread Jie Zhang

On 01/06/2012 12:07 PM, Anatoly Sokolov wrote:

Hi, Jie.

On Jan 6, 2012, Jie Zhangjzhang...@gmail.com  wrote:


Hi Anatoly,



The patch looks OK.



But I cannot apply your patch by saving your email as a patch file. If
you take a look at this:



I attach the patch.


I can apply the attached patch. OK. Thank you.


Jie