[PATCH, libgcc] Make possible to disable JCR in crtstuff.c

2012-09-21 Thread Joey Ye
Current crtstuff.c checks if JCR_SECTION_NAME is defined to decide whether
do work for JCR. However, defaults.h always defines JCR_SECTION_NAME:

#ifndef JCR_SECTION_NAME
#define JCR_SECTION_NAME .jcr
#endif

So it is impossible to disable JCR related code in crtbegin.o, which can
save some bytes for every applications that doesn't need java. 

This patch revise the check of JCR_SECTION_NAME to TARGET_USE_JCR_SECTION.
By defining latter to zero disable JCR in crtstuff. This change doesn't
impact logic of any target given following defines in defaults.h:

#ifndef TARGET_USE_JCR_SECTION
#ifdef JCR_SECTION_NAME
#define TARGET_USE_JCR_SECTION 1
#else
#define TARGET_USE_JCR_SECTION 0
#endif
#endif

Again, this patch doesn't impact libgcc on any target, unless
TARGET_USE_JCR_SECTION is explicitly defined to 0 with make
CFLAGS_FOR_TARGET=-DTARGET_USE_JCR_SECTION=0. AIX defines
TARGET_USE_JCR_SECTION to 0, but it has no crtbegin/end stuff. So also no
impact.

OK to trunk?

2012-09-21  Joey Ye  joey...@arm.com

* crtstuff.c: Check TARGET_USE_JCR_SECTION.

Index: libgcc/crtstuff.c
===
--- libgcc/crtstuff.c   (revision 190556)
+++ libgcc/crtstuff.c   (working copy)
@@ -256,13 +256,13 @@
  = { };
 #endif /* USE_EH_FRAME_REGISTRY */
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION  defined (JCR_SECTION_NAME)
 /* Stick a label at the beginning of the java class registration info
so we can register them properly.  */
 STATIC void *__JCR_LIST__[]
   __attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void*
   = { };
-#endif /* JCR_SECTION_NAME */
+#endif /* TARGET_USE_JCR_SECTION  JCR_SECTION_NAME */
 
 #if USE_TM_CLONE_REGISTRY
 STATIC func_ptr __TMC_LIST__[]
@@ -438,7 +438,7 @@
 #endif
 
 #if defined(USE_EH_FRAME_REGISTRY) \
-|| defined(JCR_SECTION_NAME) \
+|| defined(TARGET_USE_JCR_SECTION) \
 || defined(USE_TM_CLONE_REGISTRY)
 /* Stick a call to __register_frame_info into the .init section.  For some
reason calls with no arguments work more reliably in .init, so stick the
@@ -461,7 +461,7 @@
 #endif /* CRT_GET_RFIB_DATA */
 #endif /* USE_EH_FRAME_REGISTRY */
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION
   if (__JCR_LIST__[0])
 {
   void (*register_classes) (void *) = _Jv_RegisterClasses;
@@ -469,7 +469,7 @@
   if (register_classes)
register_classes (__JCR_LIST__);
 }
-#endif /* JCR_SECTION_NAME */
+#endif /* TARGET_USE_JCR_SECTION */
 
 #if USE_TM_CLONE_REGISTRY
   register_tm_clones ();
@@ -483,7 +483,7 @@
   __attribute__ ((__used__, section(.init_array),
aligned(sizeof(func_ptr
   = { frame_dummy };
 #endif /* !defined(INIT_SECTION_ASM_OP) */
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME ||
USE_TM_CLONE_REGISTRY */
+#endif /* USE_EH_FRAME_REGISTRY || TARGET_USE_JCR_SECTION ||
USE_TM_CLONE_REGISTRY */
 
 #else  /* OBJECT_FORMAT_ELF */
 
@@ -551,7 +551,7 @@
 }
 
 #if defined(USE_EH_FRAME_REGISTRY) \
-|| defined(JCR_SECTION_NAME) \
+|| defined(TARGET_USE_JCR_SECTION) \
 || defined(USE_TM_CLONE_REGISTRY)
 /* A helper function for __do_global_ctors, which is in crtend.o.  Here
in crtbegin.o, we can reference a couple of symbols not visible there.
@@ -566,7 +566,7 @@
 __register_frame_info (__EH_FRAME_BEGIN__, object);
 #endif
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION
   if (__JCR_LIST__[0])
 {
   void (*register_classes) (void *) = _Jv_RegisterClasses;
@@ -580,7 +580,7 @@
   register_tm_clones ();
 #endif /* USE_TM_CLONE_REGISTRY */
 }
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME ||
USE_TM_CLONE_REGISTRY */
+#endif /* USE_EH_FRAME_REGISTRY || TARGET_USE_JCR_SECTION ||
USE_TM_CLONE_REGISTRY */
 
 #else /* ! INIT_SECTION_ASM_OP  ! HAS_INIT_SECTION */
 #error What are you doing with crtstuff.c, then?
@@ -656,13 +656,13 @@
  = { 0 };
 #endif /* EH_FRAME_SECTION_NAME */
 
-#ifdef JCR_SECTION_NAME
+#if TARGET_USE_JCR_SECTION  defined (JCR_SECTION_NAME)
 /* Null terminate the .jcr section array.  */
 STATIC void *__JCR_END__[1]
__attribute__ ((used, section(JCR_SECTION_NAME),
   aligned(sizeof(void *
= { 0 };
-#endif /* JCR_SECTION_NAME */
+#endif /* TARGET_USE_JCR_SECTION  JCR_SECTION_NAME */
 
 #if USE_TM_CLONE_REGISTRY
 # ifndef HAVE_GAS_HIDDEN
@@ -742,7 +742,7 @@
 {
   func_ptr *p;
 #if defined(USE_EH_FRAME_REGISTRY) \
-|| defined(JCR_SECTION_NAME) \
+|| defined(TARGET_USE_JCR_SECTION) \
 || defined(USE_TM_CLONE_REGISTRY)
   __do_global_ctors_1();
 #endif






Re: [Patch] catch builtin_bswap16 construct

2012-09-21 Thread Christophe Lyon
On 20 September 2012 09:55, Christophe Lyon christophe.l...@linaro.org wrote:
 On 20 September 2012 09:12, Eric Botcazou ebotca...@adacore.com wrote:
 The attached patch catches C constructs:
 (A  8) | (A  8)
 where A is unsigned 16 bits
 and maps them to builtin_bswap16(A) which can provide more efficient
 implementations on some targets.

 This belongs in tree-ssa-math-opts.c:execute_optimize_bswap instead.

 OK I'll have a look at that. Actually I modified fold-const.c because
 it's here that the similar 32 bits pattern is turned into a rotate.

 When I implemented __builtin_bswap16, I didn't add this because I thought 
 this
 would be overkill since the RTL combiner should be able to catch the pattern.
 Have you investigated on this front?  But I don't have a strong opinion.

 No I didn't. As I said above, I looked at where the 32 bits pattern
 was handled and added the 16 bits one.

 Christophe.

Here is a new patch, modifying tree-ssa-math-opts.c as you suggested.
It's indeed simpler :-)

Validated with qemu-arm on target arm-none-linux-gnueabi.

OK?

Christophe.
2012-09-21  Christophe Lyon christophe.l...@linaro.org

gcc/
* tree-ssa-math-opts.c (bswap_stats): Add found_16bit field.
(execute_optimize_bswap): Add support for builtin_bswap16.

gcc/testsuite/
* gcc.target/arm/builtin-bswap16-1.c: New testcase.

diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index c3392fb..340f0df 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -154,6 +154,9 @@ static struct
 
 static struct
 {
+  /* Number of hand-written 16-bit bswaps found.  */
+  int found_16bit;
+
   /* Number of hand-written 32-bit bswaps found.  */
   int found_32bit;
 
@@ -1792,9 +1795,9 @@ static unsigned int
 execute_optimize_bswap (void)
 {
   basic_block bb;
-  bool bswap32_p, bswap64_p;
+  bool bswap16_p, bswap32_p, bswap64_p;
   bool changed = false;
-  tree bswap32_type = NULL_TREE, bswap64_type = NULL_TREE;
+  tree bswap16_type = NULL_TREE, bswap32_type = NULL_TREE, bswap64_type = 
NULL_TREE;
 
   if (BITS_PER_UNIT != 8)
 return 0;
@@ -1802,17 +1805,25 @@ execute_optimize_bswap (void)
   if (sizeof (HOST_WIDEST_INT)  8)
 return 0;
 
+  bswap16_p = (builtin_decl_explicit_p (BUILT_IN_BSWAP16)
+   optab_handler (bswap_optab, HImode) != CODE_FOR_nothing);
   bswap32_p = (builtin_decl_explicit_p (BUILT_IN_BSWAP32)
optab_handler (bswap_optab, SImode) != CODE_FOR_nothing);
   bswap64_p = (builtin_decl_explicit_p (BUILT_IN_BSWAP64)
(optab_handler (bswap_optab, DImode) != CODE_FOR_nothing
   || (bswap32_p  word_mode == SImode)));
 
-  if (!bswap32_p  !bswap64_p)
+  if (!bswap16_p  !bswap32_p  !bswap64_p)
 return 0;
 
   /* Determine the argument type of the builtins.  The code later on
  assumes that the return and argument type are the same.  */
+  if (bswap16_p)
+{
+  tree fndecl = builtin_decl_explicit (BUILT_IN_BSWAP16);
+  bswap16_type = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
+}
+
   if (bswap32_p)
 {
   tree fndecl = builtin_decl_explicit (BUILT_IN_BSWAP32);
@@ -1852,6 +1863,13 @@ execute_optimize_bswap (void)
 
  switch (type_size)
{
+   case 16:
+ if (bswap16_p)
+   {
+ fndecl = builtin_decl_explicit (BUILT_IN_BSWAP16);
+ bswap_type = bswap16_type;
+   }
+ break;
case 32:
  if (bswap32_p)
{
@@ -1879,7 +1897,9 @@ execute_optimize_bswap (void)
continue;
 
  changed = true;
- if (type_size == 32)
+ if (type_size == 16)
+   bswap_stats.found_16bit++;
+ else if (type_size == 32)
bswap_stats.found_32bit++;
  else
bswap_stats.found_64bit++;
@@ -1924,6 +1944,8 @@ execute_optimize_bswap (void)
}
 }
 
+  statistics_counter_event (cfun, 16-bit bswap implementations found,
+   bswap_stats.found_16bit);
   statistics_counter_event (cfun, 32-bit bswap implementations found,
bswap_stats.found_32bit);
   statistics_counter_event (cfun, 64-bit bswap implementations found,
diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c 
b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
new file mode 100644
index 000..6920f00
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options -O2 } */
+/* { dg-require-effective-target arm_arch_v6_ok } */
+/* { dg-add-options arm_arch_v6 } */
+/* { dg-final { scan-assembler-not orr\[ \t\] } } */
+
+unsigned short swapu16_1 (unsigned short x)
+{
+  return (x  8) | (x  8);
+}
+
+unsigned short swapu16_2 (unsigned short x)
+{
+  return (x  8) | (x  8);
+}


Re: [patch] [ARM]

2012-09-21 Thread Richard Earnshaw
On 20/09/12 17:32, Matthias Klose wrote:
 Starting with 4.4, GCC informs about that the `va_list' mangling has changed.
 This makes builds a bit noisy, and maybe it's time to remove this
 informational message in the trunk.
 
   Matthias
 
 
 mangle.diff
 
 
 2012-09-20  Matthias Klose  d...@ubuntu.com
 
   * gcc/config/arm/arm.c (arm_mangle_type): Don't warn anymore that 
   4.4 has changed the `va_list mangling.
 

OK.

R.





Re: [Patch, ARM, testsuite]

2012-09-21 Thread Matthew Gretton-Dann
On 20 September 2012 23:06, Christophe Lyon christophe.l...@linaro.org wrote:
 Hi,

 GCC for ARM does not support compiling in Thumb1 mode  and
 float-abi=hard.  But  it does not fail unless the program being
 compiled actually contains a function with parameters and/or a return
 value.

 This is a (minor) problem in the testsuite in some configurations.

 For instance, if I run the testsuite forcing -mthumb (via site.exp)
 for a GCC configured for float-abi=hard, and a test uses
 /* { dg-require-effective-target arm_arch_v6_ok } */
 /* { dg-add-options arm_arch_v6 } */

 it won't be unresolved since effective-target arm_arch_v6_ok is successful.

 The attached patch adds a dummy function body in the test such that it fails.

 Another way of achieving the same result is by making sure that the
 relevant tests use
 arm_arch_v6_multilib
 instead of
 arm_arch_v6_ok

 even if the test is not intended to be executed.

 OK?

[I'm not a maintainer]

You could argue that as the test is checking for just ARMv6, but then
uses ARMv6+VFPv2 features - and so it going wrong is to be expected
:-).

So other approaches could be to see what adding

/* { dg-require-effective-target arm_vfp_ok } */

after dg-add-options achieves.

If that doesn't work I would suggest you add an arm_arch_v6_vfp_v2_ok
set of effective-targets instead of restricting the current
arm_arch_v6 effective target.

Thanks,

Matt

-- 
Matthew Gretton-Dann
Linaro Toolchain Working Group
matthew.gretton-d...@linaro.org


Re: [Patch, ARM, testsuite]

2012-09-21 Thread Richard Earnshaw
On 21/09/12 09:47, Matthew Gretton-Dann wrote:
 On 20 September 2012 23:06, Christophe Lyon christophe.l...@linaro.org 
 wrote:
 Hi,

 GCC for ARM does not support compiling in Thumb1 mode  and
 float-abi=hard.  But  it does not fail unless the program being
 compiled actually contains a function with parameters and/or a return
 value.

 This is a (minor) problem in the testsuite in some configurations.

 For instance, if I run the testsuite forcing -mthumb (via site.exp)
 for a GCC configured for float-abi=hard, and a test uses
 /* { dg-require-effective-target arm_arch_v6_ok } */
 /* { dg-add-options arm_arch_v6 } */

 it won't be unresolved since effective-target arm_arch_v6_ok is successful.

 The attached patch adds a dummy function body in the test such that it fails.

 Another way of achieving the same result is by making sure that the
 relevant tests use
 arm_arch_v6_multilib
 instead of
 arm_arch_v6_ok

 even if the test is not intended to be executed.

 OK?
 
 [I'm not a maintainer]
 
 You could argue that as the test is checking for just ARMv6, but then
 uses ARMv6+VFPv2 features - and so it going wrong is to be expected
 :-).
 
 So other approaches could be to see what adding
 
 /* { dg-require-effective-target arm_vfp_ok } */
 
 after dg-add-options achieves.

That the test never runs on a Thumb1 processor.  Which slightly defeats
the object of testing thumb1 code.

 
 If that doesn't work I would suggest you add an arm_arch_v6_vfp_v2_ok
 set of effective-targets instead of restricting the current
 arm_arch_v6 effective target.
 
 Thanks,
 
 Matt
 






Re: vector comparisons in C++

2012-09-21 Thread Richard Guenther
On Thu, Sep 20, 2012 at 10:01 PM, Marc Glisse marc.gli...@inria.fr wrote:
 On Sat, 1 Sep 2012, Marc Glisse wrote:

 I have some issues with the vector-compare-2.c torture test. It passes a
 vector by value (argument and return type), which is likely to warn
 (although for some reason it doesn't for me, with today's compiler). And it
 takes -Wno-psabi through a .x file, but those are not read in c-c++-common,
 so I put it in dg-options. I would have changed the function to use
 pointers, but I don't know if it specifically wants to test passing by
 value...


 Hello,

 Pat Haugen just explained it to me: there was a default -w option in the old
 location of the testcase. However, there isn't in the new one. I am thus
 proposing the following, which restores the old behavior. Note that
 -Wno-psabi is still needed as it is not implied by -w.

Ok.

Thanks,
Richard.

 2012-09-20  Marc Glisse  marc.gli...@inria.fr

 PR c++/54427
 * c-c++-common/torture/vector-compare-2.c: Add -w.

 --
 Marc Glisse
 Index: c-c++-common/torture/vector-compare-2.c
 ===
 --- c-c++-common/torture/vector-compare-2.c (revision 191585)
 +++ c-c++-common/torture/vector-compare-2.c (working copy)
 @@ -1,12 +1,12 @@
  /* { dg-do run } */
 -/* { dg-options -Wno-psabi } */
 +/* { dg-options -Wno-psabi -w } */
  #define vector(elcount, type)  \
  __attribute__((vector_size((elcount)*sizeof(type type

  /* Check that constant folding in
 these simple cases works.  */
  vector (4, int)
  foo (vector (4, int) x)
  {
return   (x == x) + (x != x) + (x   x)
  + (x   x) + (x = x) + (x = x);



Re: [PATCH, doc] Separate sections in Chapter Plugins and LTO

2012-09-21 Thread Richard Guenther
On Fri, Sep 21, 2012 at 2:23 AM, Jia Liu pro...@gmail.com wrote:
 Hi all,

 Currently the Chapter Plugins and LTO is all in one html page,
 the other chapters are separated into sections.
 So I separated them to make them easier reading.

 Is this patch OK?

+* LTO Overview::Overview of LTO.
+* ELF sections::LTO file sectionsi in ELF.

typo, sections.

I would not call it 'ELF sections' but 'LTO object file layout' (or similar).
It is no longer ELF only (so the detailed docs need update).

Ok with that fixed.

Thanks,
Richard.

 Regards,
 Jia


 2012-09-21  Jia Liu  pro...@gmail.com

 * gcc/doc/lto.texi: Separate sections.
 * gcc/doc/plugins.texi: Separate sections.


Re: [PATCH, doc] Separate sections in Chapter Plugins and LTO

2012-09-21 Thread Jia Liu
Hi Richard,

Thank you very much for comment.

And, is this time OK?

On Fri, Sep 21, 2012 at 5:11 PM, Richard Guenther
richard.guent...@gmail.com wrote:
 On Fri, Sep 21, 2012 at 2:23 AM, Jia Liu pro...@gmail.com wrote:
 Hi all,

 Currently the Chapter Plugins and LTO is all in one html page,
 the other chapters are separated into sections.
 So I separated them to make them easier reading.

 Is this patch OK?

 +* LTO Overview::Overview of LTO.
 +* ELF sections::LTO file sectionsi in ELF.

 typo, sections.

 I would not call it 'ELF sections' but 'LTO object file layout' (or similar).
 It is no longer ELF only (so the detailed docs need update).

 Ok with that fixed.

 Thanks,
 Richard.

 Regards,
 Jia


 2012-09-21  Jia Liu  pro...@gmail.com

 * gcc/doc/lto.texi: Separate sections.
 * gcc/doc/plugins.texi: Separate sections.

Regards,
Jia


0001-doc-Separate-sections-in-plugins-and-lto.patch
Description: Binary data


Re: [PATCH, doc] Separate sections in Chapter Plugins and LTO

2012-09-21 Thread Richard Guenther
On Fri, Sep 21, 2012 at 11:21 AM, Jia Liu pro...@gmail.com wrote:
 Hi Richard,

 Thank you very much for comment.

 And, is this time OK?

Yes.

Thanks,
Richard.

 On Fri, Sep 21, 2012 at 5:11 PM, Richard Guenther
 richard.guent...@gmail.com wrote:
 On Fri, Sep 21, 2012 at 2:23 AM, Jia Liu pro...@gmail.com wrote:
 Hi all,

 Currently the Chapter Plugins and LTO is all in one html page,
 the other chapters are separated into sections.
 So I separated them to make them easier reading.

 Is this patch OK?

 +* LTO Overview::Overview of LTO.
 +* ELF sections::LTO file sectionsi in ELF.

 typo, sections.

 I would not call it 'ELF sections' but 'LTO object file layout' (or similar).
 It is no longer ELF only (so the detailed docs need update).

 Ok with that fixed.

 Thanks,
 Richard.

 Regards,
 Jia


 2012-09-21  Jia Liu  pro...@gmail.com

 * gcc/doc/lto.texi: Separate sections.
 * gcc/doc/plugins.texi: Separate sections.

 Regards,
 Jia


Ping: Re: Add a configure option to disable system header canonicalizations (issue6495088)

2012-09-21 Thread Simon Baldwin
Ping.

http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00459.html

Full text of previous message and context at URL above.  No comments
or code changes since.  Patch description left below for convenience.


 Add flags to disable system header canonicalizations.

 Libcpp may canonicalize system header paths with lrealpath() for diagnostics,
 dependency output, and similar.  If gcc is held in a symlink farm the
 canonicalized paths may be meaningless to users, and will also conflict with
 build frameworks that (for example) disallow absolute paths to header files.

 This change adds -f[no-]canonical-system-headers to the gcc command line, and
 a configure option --[en/dis]able-canonical-system-headers to set default
 behaviour, allowing the user to select whether or not to implement r186991.
 Default is enabled.  See also PR c++/52974.

 Tested for regressions with bootstrap builds of C and C++, both with and
 without configure --disable-canonical-system-headers.

--
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902


Re: [patch] split FRAME variables back into pieces

2012-09-21 Thread Eric Botcazou
 You rely on being able to see all FRAME accesses as component refs,
 thus nothing transforms them into just MEM[FRAME, offset].  That's of
 course something that can be easily broken by means of doing
 some pointer arithmetic like (untested, but you get the idea)
 
 foo()
 {
   int c[32];
   int j;
   bar()
   {
 int *p = c[4];
 p = p + 1;
 j = *p;
   }
   c[4] = 0;
   bar();
   return j;
 }
 
 this should get you j = MEM[CHAIN, 4]; in bar and thus a missing
 component-ref when inlining.

The patch compiles hundreds of thousands of lines of Ada everyday at AdaCore, 
how could such a blatant hole have survived that?

 I dont' think it's easily possible to recover from this in your scheme,
 but it would be straight-forward for SRA (you basically look for the
 base variable FRAME and special-case that completely for
 replacement construction, also constraining accesses).

Well, it's implemented in the 30-line block of code under the comment:

+  /* Deal with remaining MEM_REFs, i.e. those for which the field reference
+ has been replaced with the offset.  */

 Marking the FRAME VAR_DECL looks useful, maybe you can split that out
 of your patch?

Sure.

 As of doing it in SRA what I'd do there is special-case FRAME for both
 candidate consideration (so you get around the addressable issue)
 and replacement generation.

OK, but you need to be able to split the FRAME structure without necessarily 
splitting its aggregate fields.  Is that (easily) doable with current SRA?

 Maybe you can open an enhancement bugreport for this and link
 your patch / testcase to it?

Will do.

-- 
Eric Botcazou


Re: [Patch] catch builtin_bswap16 construct

2012-09-21 Thread Eric Botcazou
 Here is a new patch, modifying tree-ssa-math-opts.c as you suggested.
 It's indeed simpler :-)
 
 Validated with qemu-arm on target arm-none-linux-gnueabi.

I cannot formally approve, but this looks good to me.

However, could you check that this is also an improvement for PowerPC, which 
is the only other mainstream architecture with a bswaphi pattern AFAIK?

-- 
Eric Botcazou


Re: [patch] [ARM]

2012-09-21 Thread Eric Botcazou
 Starting with 4.4, GCC informs about that the `va_list' mangling has
 changed. This makes builds a bit noisy, and maybe it's time to remove
 this informational message in the trunk.

 2012-09-20  Matthias Klose  d...@ubuntu.com
 
   * gcc/config/arm/arm.c (arm_mangle_type): Don't warn anymore that 
   4.4 has changed the `va_list mangling.

No gcc/ prefix in gcc/ChangeLog.

-- 
Eric Botcazou


[PATCH] Fix PR54647

2012-09-21 Thread Richard Guenther

The introduction of vn_get_stmt_kind brought COND_EXPR and
VEC_COND_EXPR into the PRE machinery - both are not really suited
for SCCVN or PRE in NARY form as they contain an embedded
expression.

The following patch restores previous behavior.  Eventually
we could experiment with moving them to REFERENCE instead.

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Btw, this also means they are presenting a VN barrier and do
not get simplified if the condition would simplify.

Richard.

2012-09-21  Richard Guenther  rguent...@suse.de

PR tree-optimization/54647
* tree-ssa-pre.c (compute_avail): Do not put COND_EXPR
or VEC_COND_EXPR into EXP_GEN again.

* g++.dg/torture/pr54647.C: New testcase.

Index: gcc/tree-ssa-pre.c
===
--- gcc/tree-ssa-pre.c  (revision 191603)
+++ gcc/tree-ssa-pre.c  (working copy)
@@ -3981,9 +3838,18 @@ compute_avail (void)
  {
  case VN_NARY:
{
+ enum tree_code code = gimple_assign_rhs_code (stmt);
  vn_nary_op_t nary;
+
+ /* COND_EXPR and VEC_COND_EXPR are awkward in
+that they contain an embedded complex expression.
+Don't even try to shove those through PRE.  */
+ if (code == COND_EXPR
+ || code == VEC_COND_EXPR)
+   continue;
+
  vn_nary_op_lookup_pieces (gimple_num_ops (stmt) - 1,
-   gimple_assign_rhs_code (stmt),
+   code,
gimple_expr_type (stmt),
gimple_assign_rhs1_ptr (stmt),
nary);
Index: gcc/testsuite/g++.dg/torture/pr54647.C
===
--- gcc/testsuite/g++.dg/torture/pr54647.C  (revision 0)
+++ gcc/testsuite/g++.dg/torture/pr54647.C  (working copy)
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+class A
+{
+};
+template class type struct D:A
+{
+  type  operator[](int);
+};
+struct B
+{
+  typedef D int *Row;
+  struct C
+{
+  Row *row;
+};
+};
+B::C a;
+B::Row  b = *a.row;
+void
+fn1 ()
+{
+  while (1)
+b[0] = b[0] ? (int *) -1 : 0;
+}


Fix PR rtl-optimization/54644

2012-09-21 Thread Eric Botcazou
It's the regression of gcc.c-torture/execute/multi-ix.c at -O1 on Alpha 
reported by Uros and comes from a thinko in my fix for PR rtl-opt/54290.

Tested on x86-64/Linux, applied on the mainline.


2012-09-21  Eric Botcazou  ebotca...@adacore.com

PR rtl-optimization/54290
PR rtl-optimization/54644
* reload1.c (choose_reload_regs): Fix thinko in previous change.


-- 
Eric BotcazouIndex: reload1.c
===
--- reload1.c	(revision 191596)
+++ reload1.c	(working copy)
@@ -6991,16 +6991,17 @@ choose_reload_regs (struct insn_chain *c
 	 If we succeeded removing some reload and we are doing a preliminary
 	 pass just to remove such reloads, make another pass, since the
 	 removal of one reload might allow us to inherit another one.  */
-	  else if (pass
-		rld[r].in
+	  else if (rld[r].in
 		rld[r].out != rld[r].in
 		remove_address_replacements (rld[r].in))
-	pass = 2;
+	{
+	  if (pass)
+	pass = 2;
+	}
 #ifdef SECONDARY_MEMORY_NEEDED
 	  /* If we needed a memory location for the reload, we also have to
 	 remove its related reloads.  */
-	  else if (pass
-	rld[r].in
+	  else if (rld[r].in
 		rld[r].out != rld[r].in
 		(tem = replaced_subreg (rld[r].in), REG_P (tem))		   
 		REGNO (tem)  FIRST_PSEUDO_REGISTER
@@ -7009,7 +7010,10 @@ choose_reload_regs (struct insn_chain *c
 		remove_address_replacements
 		  (get_secondary_mem (tem, rld[r].inmode, rld[r].opnum,
 	  rld[r].when_needed)))
-	pass = 2;
+	{
+	  if (pass)
+	pass = 2;
+	}
 #endif
 	}
 }


[PATCH] Fix PR54629

2012-09-21 Thread Richard Guenther

This patch from Jakub should fix issues with my previous patch.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2012-09-20  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/54629
* tree-loop-distribution.c (classify_partition): Free loop nest only
after freeing ddr.  Free ddr and loop nest also if successful.

--- gcc/tree-loop-distribution.c.jj 2012-09-20 09:22:02.0 +0200
+++ gcc/tree-loop-distribution.c2012-09-20 09:35:05.953016313 +0200
@@ -1019,10 +1019,10 @@ classify_partition (loop_p loop, struct
   ddr = initialize_data_dependence_relation (single_load, single_store,
 loops);
   compute_affine_dependence (ddr, loop);
-  VEC_free (loop_p, heap, loops);
   if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
{
  free_dependence_relation (ddr);
+ VEC_free (loop_p, heap, loops);
  return;
}
   if (DDR_ARE_DEPENDENT (ddr) != chrec_known)
@@ -1030,6 +1030,7 @@ classify_partition (loop_p loop, struct
  if (DDR_NUM_DIST_VECTS (ddr) == 0)
{
  free_dependence_relation (ddr);
+ VEC_free (loop_p, heap, loops);
  return;
}
  lambda_vector dist_v;
@@ -1040,10 +1041,13 @@ classify_partition (loop_p loop, struct
  if (dist  0  !DDR_REVERSED_P (ddr))
{
  free_dependence_relation (ddr);
+ VEC_free (loop_p, heap, loops);
  return;
}
}
}
+  free_dependence_relation (ddr);
+  VEC_free (loop_p, heap, loops);
   partition-kind = PKIND_MEMCPY;
   partition-main_dr = single_store;
   partition-secondary_dr = single_load;


Re: [patch] split FRAME variables back into pieces

2012-09-21 Thread Richard Guenther
On Fri, Sep 21, 2012 at 12:48 PM, Eric Botcazou ebotca...@adacore.com wrote:
 You rely on being able to see all FRAME accesses as component refs,
 thus nothing transforms them into just MEM[FRAME, offset].  That's of
 course something that can be easily broken by means of doing
 some pointer arithmetic like (untested, but you get the idea)

 foo()
 {
   int c[32];
   int j;
   bar()
   {
 int *p = c[4];
 p = p + 1;
 j = *p;
   }
   c[4] = 0;
   bar();
   return j;
 }

 this should get you j = MEM[CHAIN, 4]; in bar and thus a missing
 component-ref when inlining.

 The patch compiles hundreds of thousands of lines of Ada everyday at AdaCore,
 how could such a blatant hole have survived that?

 I dont' think it's easily possible to recover from this in your scheme,
 but it would be straight-forward for SRA (you basically look for the
 base variable FRAME and special-case that completely for
 replacement construction, also constraining accesses).

 Well, it's implemented in the 30-line block of code under the comment:

 +  /* Deal with remaining MEM_REFs, i.e. those for which the field reference
 + has been replaced with the offset.  */

 Marking the FRAME VAR_DECL looks useful, maybe you can split that out
 of your patch?

 Sure.

 As of doing it in SRA what I'd do there is special-case FRAME for both
 candidate consideration (so you get around the addressable issue)
 and replacement generation.

 OK, but you need to be able to split the FRAME structure without necessarily
 splitting its aggregate fields.  Is that (easily) doable with current SRA?

In theory yes.  Though I'd start with trying to improve general SRA here
(because I think it doesn't do that yet), like for

struct { int i; struct { int j0; int j1;  int j128; } s; } x;

while it can scalarize x.i it won't pull out x.s (similar for arrays).  Usually
addressability prevents that from being a valid transform, but excessive
size of sub-structures can prevent SRA from working on them as well.

The replacement machinery at least should handle it fine (not the
replacement object geneation - that only generates SSA names currently).

Likewise SRA can be extended to handle

struct { int i; int a[32]; } s;

with variable index accesses to a by that means (the accesses should
already be properly constrained - what is missing is a pass over all
structure fields matching them with accesses to see if aggregate
replacements are possible).

Yes, most of the SRA heuristic games make it complicated and ugly,
especially as it is isn't clearly separate analysis / decision / transform
phases.  TLC welcome ;)

 Maybe you can open an enhancement bugreport for this and link
 your patch / testcase to it?

 Will do.

Thanks,
Richard.

 --
 Eric Botcazou


Re: [PATCH] Combine location with block using block_locations

2012-09-21 Thread Dominique Dhumieres
Hi Dehao,

You wrote:
 4. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54650
 Failed one regression test in libgomp (I didn't know that there are
 regression tests for libraries before...)
 This error should be a bug exposed by this patch. I'll try to provide
 a patch as soon as possible.

See pr54650 for clarification: there are several libgomp.fortran failing
and not only one. When I saw them I was in rush and analyzed only one.
Sorry for the confusion.

Cherrs,

Dominique


Re: [patch] split FRAME variables back into pieces

2012-09-21 Thread Martin Jambor
Hi,

On Fri, Sep 21, 2012 at 12:48:16PM +0200, Eric Botcazou wrote:


...

  As of doing it in SRA what I'd do there is special-case FRAME for both
  candidate consideration (so you get around the addressable issue)
  and replacement generation.
 
 OK, but you need to be able to split the FRAME structure without necessarily 
 splitting its aggregate fields.  Is that (easily) doable with current SRA?
 

Well, the current code assumes that the replacements are gimple
register types and, perhaps more importantly, it assumes there are no
to-be-replaced pieces within to-be-replaced pieces.  If we were to put
a structure outside of a frame structure and scalarize some field
within it at the same time... a lot of places would probably need to
be slightly re-thought.  OTOH, I assume the frame structure is never
being assigned to or read as a whole so that would simplify a lot of
things.

  Maybe you can open an enhancement bugreport for this and link
  your patch / testcase to it?
 
 Will do.

Please CC me in the bug.  I probably won't be able to try anything
myself for a few weeks but I'm interested in helping.

Thanks,

Martin


Re: [patch] split FRAME variables back into pieces

2012-09-21 Thread Martin Jambor
On Fri, Sep 21, 2012 at 01:32:25PM +0200, Richard Guenther wrote:

...

 Yes, most of the SRA heuristic games make it complicated and ugly,
 especially as it is isn't clearly separate analysis / decision / transform
 phases.  TLC welcome ;)
 

While I agree that the heuristics of SRA is surprisingly complex and a
bit ugly (but that's mostly because people complain when it does too
little or too much), the pass it is clearly divided into analysis,
decision, transform phases.  Specifically, unless a variable is
discarded because of things like volatile accesses or complex
overlapping accesses (usually through unions), all SRA decisions about
it are made in analyze_access_subtree.  All code executed before that
just gathers data for that function (yeah, including a gazillion
flags), every code executed afterwards does transformation as it was
decided and specifically cannot change ay decisiond (even when it
bumps into unions, placement new tricks etc., that's the main reason
why the transformation can be quite ugly too).

What I'd try is to create a replacement for (nearly) all roots of
access trees for a single variable (unless of course there is only one
corresponding to the whole variable) - i.e. those that
analyze_access_trees loops over.  A lot of code in the transformation
phase will still need changes but the heuristics should not actually
be a problem.

Martin


Re: Implement Pareto distribution as an extension.

2012-09-21 Thread Ed Smith-Rowland

On 09/21/2012 05:33 AM, Paolo Carlini wrote:

On 09/21/2012 11:02 AM, Ulrich Drepper wrote:
On Thu, Sep 20, 2012 at 6:17 AM, Paolo Carlini 
paolo.carl...@oracle.com wrote:
Patch looks generally Ok to me. If Ulrich and the other interested 
parties
don't have anything to add over the next 24 hrs or so, let's go 
ahead and

thanks again!

Unfortunately I won't have any time until Wednesday.  I'm sure there's
nothing in the patch which if necessary cannot be fixed.

Good, Ok then we can commit it.

For testing we might want to utilize R for testing, if available.  Or
specific test generation.  There are some things that can be done.
But I have some other patches to contribute first.  Next week...

Ok...

Paolo.


Committed.
Ed

2012-09-21  Edward Smith-Rowland  3dw...@verizon.net

* include/ext/random: Add __gnu_cxx::pareto_distribution class.
* include/ext/random.tcc: Add out-of-line functions for
__gnu_cxx::pareto_distribution.
* testsuite/ext/random/pareto_distribution/operators/equal.cc: New file.
* testsuite/ext/random/pareto_distribution/operators/serialize.cc:
New file.
* testsuite/ext/random/pareto_distribution/operators/inequal.cc:
New file.
* testsuite/ext/random/pareto_distribution/cons/parms.cc: New file.
* testsuite/ext/random/pareto_distribution/cons/default.cc: New file.
* testsuite/ext/random/pareto_distribution/requirements/typedefs.cc:
New file.
* testsuite/ext/random/pareto_distribution/requirements/
explicit_instantiation/1.cc: New file.

Index: include/ext/random
===
--- include/ext/random  (revision 191434)
+++ include/ext/random  (working copy)
@@ -1360,6 +1360,242 @@
   const nakagami_distribution_RealType __d2)
 { return !(__d1 == __d2); }
 
+
+  /**
+   * @brief A Pareto continuous distribution for random numbers.
+   *
+   * The formula for the Pareto cumulative probability function is
+   * @f[
+   * P(x|\alpha,\mu) = 1 - \left(\frac{\mu}{x}\right)^\alpha
+   * @f]
+   * The formula for the Pareto probability density function is
+   * @f[
+   * p(x|\alpha,\mu) = \frac{\alpha + 1}{\mu}
+   *   \left(\frac{\mu}{x}\right)^{\alpha + 1}
+   * @f]
+   * where @f$x = \mu@f$ and @f$\mu  0@f$, @f$\alpha  0@f$.
+   *
+   * table border=1 cellpadding=10 cellspacing=0
+   * caption align=topDistribution Statistics/caption
+   * trtdMean/tdtd@f$\alpha \mu / (\alpha - 1)@f$
+   *  for @f$\alpha  1@f$/td/tr
+   * trtdVariance/tdtd@f$\alpha \mu^2 / [(\alpha - 1)^2(\alpha - 2)]@f$
+   *  for @f$\alpha  2@f$/td/tr
+   * trtdRange/tdtd@f$[\mu, \infty)@f$/td/tr
+   * /table
+   */
+  templatetypename _RealType = double
+class
+pareto_distribution
+{
+  static_assert(std::is_floating_point_RealType::value,
+   template argument not a floating point type);
+
+public:
+  /** The type of the range of the distribution. */
+  typedef _RealType result_type;
+  /** Parameter type. */
+  struct param_type
+  {
+   typedef pareto_distributionresult_type distribution_type;
+
+   param_type(result_type __alpha = result_type(1),
+  result_type __mu = result_type(1))
+   : _M_alpha(__alpha), _M_mu(__mu)
+   {
+ _GLIBCXX_DEBUG_ASSERT(_M_alpha  result_type(0));
+ _GLIBCXX_DEBUG_ASSERT(_M_mu  result_type(0));
+   }
+
+   result_type
+   alpha() const
+   { return _M_alpha; }
+
+   result_type
+   mu() const
+   { return _M_mu; }
+
+   friend bool
+   operator==(const param_type __p1, const param_type __p2)
+   { return __p1._M_alpha == __p2._M_alpha  __p1._M_mu == __p2._M_mu; }
+
+  private:
+   void _M_initialize();
+
+   result_type _M_alpha;
+   result_type _M_mu;
+  };
+
+  /**
+   * @brief Constructors.
+   */
+  explicit
+  pareto_distribution(result_type __alpha = result_type(1),
+ result_type __mu = result_type(1))
+  : _M_param(__alpha, __mu),
+   _M_ud()
+  { }
+
+  explicit
+  pareto_distribution(const param_type __p)
+  : _M_param(__p),
+   _M_ud()
+  { }
+
+  /**
+   * @brief Resets the distribution state.
+   */
+  void
+  reset()
+  {
+   _M_ud.reset();
+  }
+
+  /**
+   * @brief Return the parameters of the distribution.
+   */
+  result_type
+  alpha() const
+  { return _M_param.alpha(); }
+
+  result_type
+  mu() const
+  { return _M_param.mu(); }
+
+  /**
+   * @brief Returns the parameter set of the distribution.
+   */
+  param_type
+  param() const
+  { return _M_param; }
+
+  /**
+   * @brief Sets the parameter set of the distribution.
+   * @param __param The new parameter set of the distribution.
+   */
+  

[PATCH] PR c++/29028 - Missed unused warning on using declaration

2012-09-21 Thread Dodji Seketeli
Hello,

In the example of the patch, g++ fails to warn that the variable N::i
(introduced via a using declaration) is unused.

This is because as we want to emit the warning in poplevel, when we
walk the local bindings returned by getdecls, we forget that a
VAR_DECL introduced by a using declaration is represented by a
TREE_LIST which TREE_VALUE is the VAR_DECL, and we wrongly look for a
bare VAR_DECL.

Fixed thus and tested on x86_64-unknown-linux-gnu against trunk.

gcc/cp/

* decl.c (poplevelwarn_unused*): Do not forget that some local
bindings are represented by a TREE_LIST.

gcc/testsuite/

* g++.dg/warn/Wunused-var-18.C: New test.
---
 gcc/cp/decl.c  |   46 
 gcc/testsuite/g++.dg/warn/Wunused-var-18.C |   14 
 2 files changed, 40 insertions(+), 20 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/warn/Wunused-var-18.C

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6b5b986..dc54904 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -617,26 +617,32 @@ poplevel (int keep, int reverse, int functionbody)
   /* Before we remove the declarations first check for unused variables.  */
   if ((warn_unused_variable || warn_unused_but_set_variable)
!processing_template_decl)
-for (decl = getdecls (); decl; decl = TREE_CHAIN (decl))
-  if (TREE_CODE (decl) == VAR_DECL
-  (! TREE_USED (decl) || !DECL_READ_P (decl))
-  ! DECL_IN_SYSTEM_HEADER (decl)
-  DECL_NAME (decl)  ! DECL_ARTIFICIAL (decl)
-  TREE_TYPE (decl) != error_mark_node
-  (!CLASS_TYPE_P (TREE_TYPE (decl))
- || !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl
-   {
- if (! TREE_USED (decl))
-   warning (OPT_Wunused_variable, unused variable %q+D, decl);
- else if (DECL_CONTEXT (decl) == current_function_decl
-   TREE_CODE (TREE_TYPE (decl)) != REFERENCE_TYPE
-   errorcount == unused_but_set_errorcount)
-   {
- warning (OPT_Wunused_but_set_variable,
-  variable %q+D set but not used, decl); 
- unused_but_set_errorcount = errorcount;
-   }
-   }
+for (tree d = getdecls (); d; d = TREE_CHAIN (d))
+  {
+   /* There are cases where D itself is a TREE_LIST.  See in
+  push_local_binding where the list of decls returned by
+  getdecls is built.  */
+   decl = TREE_CODE (d) == TREE_LIST ? TREE_VALUE (d) : d;
+   if (TREE_CODE (decl) == VAR_DECL
+(! TREE_USED (decl) || !DECL_READ_P (decl))
+! DECL_IN_SYSTEM_HEADER (decl)
+DECL_NAME (decl)  ! DECL_ARTIFICIAL (decl)
+TREE_TYPE (decl) != error_mark_node
+(!CLASS_TYPE_P (TREE_TYPE (decl))
+   || !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl
+ {
+   if (! TREE_USED (decl))
+ warning (OPT_Wunused_variable, unused variable %q+D, decl);
+   else if (DECL_CONTEXT (decl) == current_function_decl
+ TREE_CODE (TREE_TYPE (decl)) != REFERENCE_TYPE
+ errorcount == unused_but_set_errorcount)
+ {
+   warning (OPT_Wunused_but_set_variable,
+variable %q+D set but not used, decl);
+   unused_but_set_errorcount = errorcount;
+ }
+ }
+  }
 
   /* Remove declarations for all the DECLs in this level.  */
   for (link = decls; link; link = TREE_CHAIN (link))
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-18.C 
b/gcc/testsuite/g++.dg/warn/Wunused-var-18.C
new file mode 100644
index 000..0339663
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-18.C
@@ -0,0 +1,14 @@
+// Origin: PR c++/29028
+// { dg-options -Wunused }
+// { dg-do compile }
+
+namespace N
+{
+int i; // { dg-warning unused variable }
+}
+
+void
+f ()
+{
+using N::i;
+}
-- 
Dodji


Re: [PATCH] Combine location with block using block_locations

2012-09-21 Thread Michael Matz
Hi,

On Thu, 20 Sep 2012, Dehao Chen wrote:

 4. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54650 Failed one 
 regression test in libgomp (I didn't know that there are regression 
 tests for libraries before...) This error should be a bug exposed by 
 this patch. I'll try to provide a patch as soon as possible.

Always do a 'make check' from the toplevel build directory.  For looking 
at the results you may find contrib/test_summary afterwards useful.  
Compare it's output from a run with and without patch.  All new FAILs will 
have to be investigated, and with the above procedure you won't miss any.


Ciao,
Michael.


Re: [Patch, ARM, testsuite]

2012-09-21 Thread Christophe Lyon
On 21 September 2012 10:47, Matthew Gretton-Dann
matthew.gretton-d...@linaro.org wrote:
 On 20 September 2012 23:06, Christophe Lyon christophe.l...@linaro.org 
 wrote:
 Hi,

 GCC for ARM does not support compiling in Thumb1 mode  and
 float-abi=hard.  But  it does not fail unless the program being
 compiled actually contains a function with parameters and/or a return
 value.

 This is a (minor) problem in the testsuite in some configurations.

 For instance, if I run the testsuite forcing -mthumb (via site.exp)
 for a GCC configured for float-abi=hard, and a test uses
 /* { dg-require-effective-target arm_arch_v6_ok } */
 /* { dg-add-options arm_arch_v6 } */

 it won't be unresolved since effective-target arm_arch_v6_ok is successful.

 The attached patch adds a dummy function body in the test such that it fails.

 Another way of achieving the same result is by making sure that the
 relevant tests use
 arm_arch_v6_multilib
 instead of
 arm_arch_v6_ok

 even if the test is not intended to be executed.

 OK?

 [I'm not a maintainer]

 You could argue that as the test is checking for just ARMv6, but then
 uses ARMv6+VFPv2 features - and so it going wrong is to be expected
 :-).

No: what I have in mind is a test that doesn't need VFP by itself, but
which happens to become not-compilable if one forces float-abi=hard
and thumb when running the testsuite.

I'd like that the test is UNSUPPORTED rather than FAIL.

Christophe.


Re: [PING] Re: VxWorks Patches Back from the Dead!

2012-09-21 Thread Bruce Korb
From my part, I'm willing to push the patch, but I need confirmation
from Paolo and Nathan
because some of it affects code outside of my authority.

On Thu, Sep 20, 2012 at 7:02 PM, rbmj r...@verizon.net wrote:
 Ping?  Just did a full pull and rebuild today and everything still works :)

 Robert Mason


Re: [PATCH] Combine location with block using block_locations

2012-09-21 Thread Markus Trippelsdorf
On 2012.09.20 at 19:51 -0700, Dehao Chen wrote:
 As expected, since this patch was checked in yesterday, there are 4
 bugs exposed (1 fixed, 1 patch ready, 2 TBD):

It also causes: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54655

-- 
Markus


Re: [PING] Re: VxWorks Patches Back from the Dead!

2012-09-21 Thread Nathan Sidwell

On 09/21/12 14:30, Bruce Korb wrote:

 From my part, I'm willing to push the patch, but I need confirmation
from Paolo and Nathan
because some of it affects code outside of my authority.



I have no objections to the patch.

nathan


[PATCH] PRE TLC

2012-09-21 Thread Richard Guenther

This removes the no longer required dominating stmt argument from
the insertion routines (since the eliminate () reorg) and also
reflects that insertion now never can fail (again).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2012-09-21  Richard Guenther  rguent...@suse.de

* tree-ssa-pre.c (bitmap_find_leader, create_expression_by_pieces,
find_or_generate_expression): Remove dominating stmt argument.
(find_leader_in_sets, phi_translate_1, bitmap_find_leader,
create_component_ref_by_pieces_1, create_component_ref_by_pieces,
do_regular_insertion, do_partial_partial_insertion): Adjust.
(compute_avail): Do not set uids.

Index: gcc/tree-ssa-pre.c
===
--- gcc/tree-ssa-pre.c  (revision 191613)
+++ gcc/tree-ssa-pre.c  (working copy)
@@ -453,7 +453,7 @@ static struct
 } pre_stats;
 
 static bool do_partial_partial;
-static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int, gimple);
+static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int);
 static void bitmap_value_insert_into_set (bitmap_set_t, pre_expr);
 static void bitmap_value_replace_in_set (bitmap_set_t, pre_expr);
 static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
@@ -463,9 +463,8 @@ static void bitmap_insert_into_set_1 (bi
  unsigned int, bool);
 static bitmap_set_t bitmap_set_new (void);
 static tree create_expression_by_pieces (basic_block, pre_expr, gimple_seq *,
-gimple, tree);
-static tree find_or_generate_expression (basic_block, pre_expr, gimple_seq *,
-gimple);
+tree);
+static tree find_or_generate_expression (basic_block, tree, gimple_seq *);
 static unsigned int get_expr_value_id (pre_expr);
 
 /* We can add and remove elements and entries to and from sets
@@ -1339,9 +1338,9 @@ find_leader_in_sets (unsigned int val, b
 {
   pre_expr result;
 
-  result = bitmap_find_leader (set1, val, NULL);
+  result = bitmap_find_leader (set1, val);
   if (!result  set2)
-result = bitmap_find_leader (set2, val, NULL);
+result = bitmap_find_leader (set2, val);
   return result;
 }
 
@@ -1733,39 +1732,26 @@ phi_translate_1 (pre_expr expr, bitmap_s
 
 case NAME:
   {
-   gimple phi = NULL;
-   edge e;
-   gimple def_stmt;
tree name = PRE_EXPR_NAME (expr);
-
-   def_stmt = SSA_NAME_DEF_STMT (name);
+   gimple def_stmt = SSA_NAME_DEF_STMT (name);
+   /* If the SSA name is defined by a PHI node in this block,
+  translate it.  */
if (gimple_code (def_stmt) == GIMPLE_PHI
 gimple_bb (def_stmt) == phiblock)
- phi = def_stmt;
-   else
- return expr;
-
-   e = find_edge (pred, gimple_bb (phi));
-   if (e)
  {
-   tree def = PHI_ARG_DEF (phi, e-dest_idx);
-   pre_expr newexpr;
-
-   if (TREE_CODE (def) == SSA_NAME)
- def = VN_INFO (def)-valnum;
+   edge e = find_edge (pred, gimple_bb (def_stmt));
+   tree def = PHI_ARG_DEF (def_stmt, e-dest_idx);
 
/* Handle constant. */
if (is_gimple_min_invariant (def))
  return get_or_alloc_expr_for_constant (def);
 
-   if (TREE_CODE (def) == SSA_NAME  ssa_undefined_value_p (def))
- return NULL;
-
-   newexpr = get_or_alloc_expr_for_name (def);
-   return newexpr;
+   return get_or_alloc_expr_for_name (def);
  }
+   /* Otherwise return it unchanged - it will get cleaned if its
+  value is not available in PREDs AVAIL_OUT set of expressions.  */
+   return expr;
   }
-  return expr;
 
 default:
   gcc_unreachable ();
@@ -1854,7 +1840,7 @@ phi_translate_set (bitmap_set_t dest, bi
Return NULL if no leader is found.  */
 
 static pre_expr
-bitmap_find_leader (bitmap_set_t set, unsigned int val, gimple stmt)
+bitmap_find_leader (bitmap_set_t set, unsigned int val)
 {
   if (value_id_constant_p (val))
 {
@@ -1887,23 +1873,7 @@ bitmap_find_leader (bitmap_set_t set, un
   bitmap exprset = VEC_index (bitmap, value_expressions, val);
 
   EXECUTE_IF_AND_IN_BITMAP (exprset, set-expressions, 0, i, bi)
-   {
- pre_expr val = expression_for_id (i);
- /* At the point where stmt is not null, there should always
-be an SSA_NAME first in the list of expressions.  */
- if (stmt)
-   {
- gimple def_stmt = SSA_NAME_DEF_STMT (PRE_EXPR_NAME (val));
- if (gimple_code (def_stmt) != GIMPLE_PHI
-  gimple_bb (def_stmt) == gimple_bb (stmt)
- /* PRE insertions are at the end of the basic-block
-and have UID 0.  */
-  (gimple_uid (def_stmt) == 0
- || gimple_uid (def_stmt) = gimple_uid (stmt)))
-

[PATCH] Fix PR52173

2012-09-21 Thread Richard Guenther

This bug happens because GIMPLE_TRANSACTION is a statement
without real but with virtual operands.  The short-cut in gimple_copy
thus is overly optimistic.  Fixed as follows.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2012-09-21  Richard Guenther  rguent...@suse.de

PR middle-end/52173
* gimple.c (gimple_copy): Properly mark the copy modified
if SSA operands are present.

Index: gcc/gimple.c
===
*** gcc/gimple.c(revision 191613)
--- gcc/gimple.c(working copy)
*** gimple_copy (gimple stmt)
*** 2333,2355 
  }
  
/* Make copy of operands.  */
!   if (num_ops  0)
! {
!   for (i = 0; i  num_ops; i++)
!   gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));
  
!   /* Clear out SSA operand vectors on COPY.  */
!   if (gimple_has_ops (stmt))
!   {
! gimple_set_def_ops (copy, NULL);
! gimple_set_use_ops (copy, NULL);
!   }
  
!   if (gimple_has_mem_ops (stmt))
!   {
! gimple_set_vdef (copy, gimple_vdef (stmt));
! gimple_set_vuse (copy, gimple_vuse (stmt));
!   }
  
/* SSA operands need to be updated.  */
gimple_set_modified (copy, true);
--- 2333,2352 
  }
  
/* Make copy of operands.  */
!   for (i = 0; i  num_ops; i++)
! gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));
  
!   if (gimple_has_mem_ops (stmt))
! {
!   gimple_set_vdef (copy, gimple_vdef (stmt));
!   gimple_set_vuse (copy, gimple_vuse (stmt));
! }
  
!   /* Clear out SSA operand vectors on COPY.  */
!   if (gimple_has_ops (stmt))
! {
!   gimple_set_def_ops (copy, NULL);
!   gimple_set_use_ops (copy, NULL);
  
/* SSA operands need to be updated.  */
gimple_set_modified (copy, true);


Re: [PATCH] PR c++/29028 - Missed unused warning on using declaration

2012-09-21 Thread Gabriel Dos Reis
On Fri, Sep 21, 2012 at 7:58 AM, Dodji Seketeli do...@redhat.com wrote:

 +for (tree d = getdecls (); d; d = TREE_CHAIN (d))
 +  {
 +   /* There are cases where D itself is a TREE_LIST.  See in
 +  push_local_binding where the list of decls returned by
 +  getdecls is built.  */
 +   decl = TREE_CODE (d) == TREE_LIST ? TREE_VALUE (d) : d;
 +   if (TREE_CODE (decl) == VAR_DECL
 +(! TREE_USED (decl) || !DECL_READ_P (decl))
 +! DECL_IN_SYSTEM_HEADER (decl)
 +DECL_NAME (decl)  ! DECL_ARTIFICIAL (decl)
 +TREE_TYPE (decl) != error_mark_node
 +(!CLASS_TYPE_P (TREE_TYPE (decl))
 +   || !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl
 + {
 +   if (! TREE_USED (decl))
 + warning (OPT_Wunused_variable, unused variable %q+D, decl);
 +   else if (DECL_CONTEXT (decl) == current_function_decl
 + TREE_CODE (TREE_TYPE (decl)) != REFERENCE_TYPE
 + errorcount == unused_but_set_errorcount)
 + {
 +   warning (OPT_Wunused_but_set_variable,
 +variable %q+D set but not used, decl);
 +   unused_but_set_errorcount = errorcount;
 + }
 + }
 +  }


this is block of code that qualifies to be a function in its own.
the condition is quite impressive...

-- Gaby


Re: [PATCH, middle-end]: Fix g++.dg/other/vector-compare.C testsuite failure on alpha

2012-09-21 Thread Eric Botcazou
 Prepare_cmp_insn in optabs.c expands BLKmode compares using either
 cmp{mem,str,strn}_optab, or through emit_library_call_value to integer
 result register, and follows with the expansion of the compare of the
 result with zero. However, the code blindly assumes that the target is
 able to compare resulting SImode value, which is not true in case of
 alpha. Due to missing SImode compare pattern, the above assert is
 triggered in emit_cmp_and_jump_1.
 
 The patch fixes this oversight by simply expanding the comparison of
 the result through generic comparison expansion code that conveniently
 follows BLKmode compare expansion.
 
 2012-09-18  Uros Bizjak  ubiz...@gmail.com
 
   * optabs.c (prepare_cmp_insn): Expand comparison of the result
   of memory block compare through generic comparison expansion code.

I don't think that the first hunk is necessary since result_mode is taken from 
the comparison pattern itself; the second hunk alone seems to be sufficient.

 Patch was bootstrapped and regression tested on alphaev68-pc-linux-gnu
 and x86_64-pc-linux-gnu {,-m32}.
 
 OK for mainline and release branches?

Is that a regression on release branches?  If no, that's not worth the risk.

-- 
Eric Botcazou


Re: [PATCH, doc] Separate sections in Chapter Plugins and LTO

2012-09-21 Thread Jia Liu
Hi Richard,

On Fri, Sep 21, 2012 at 6:14 PM, Richard Guenther
richard.guent...@gmail.com wrote:
 On Fri, Sep 21, 2012 at 11:21 AM, Jia Liu pro...@gmail.com wrote:
 Hi Richard,

 Thank you very much for comment.

 And, is this time OK?

 Yes.


May you check in it for me please?
Thank you.


 Thanks,
 Richard.

 On Fri, Sep 21, 2012 at 5:11 PM, Richard Guenther
 richard.guent...@gmail.com wrote:
 On Fri, Sep 21, 2012 at 2:23 AM, Jia Liu pro...@gmail.com wrote:
 Hi all,

 Currently the Chapter Plugins and LTO is all in one html page,
 the other chapters are separated into sections.
 So I separated them to make them easier reading.

 Is this patch OK?

 +* LTO Overview::Overview of LTO.
 +* ELF sections::LTO file sectionsi in ELF.

 typo, sections.

 I would not call it 'ELF sections' but 'LTO object file layout' (or 
 similar).
 It is no longer ELF only (so the detailed docs need update).

 Ok with that fixed.

 Thanks,
 Richard.

 Regards,
 Jia


 2012-09-21  Jia Liu  pro...@gmail.com

 * gcc/doc/lto.texi: Separate sections.
 * gcc/doc/plugins.texi: Separate sections.

 Regards,
 Jia

Regards,
Jia


Re: [PATCH, middle-end]: Fix g++.dg/other/vector-compare.C testsuite failure on alpha

2012-09-21 Thread Uros Bizjak
On Fri, Sep 21, 2012 at 4:57 PM, Eric Botcazou ebotca...@adacore.com wrote:
 Prepare_cmp_insn in optabs.c expands BLKmode compares using either
 cmp{mem,str,strn}_optab, or through emit_library_call_value to integer
 result register, and follows with the expansion of the compare of the
 result with zero. However, the code blindly assumes that the target is
 able to compare resulting SImode value, which is not true in case of
 alpha. Due to missing SImode compare pattern, the above assert is
 triggered in emit_cmp_and_jump_1.

 The patch fixes this oversight by simply expanding the comparison of
 the result through generic comparison expansion code that conveniently
 follows BLKmode compare expansion.

 2012-09-18  Uros Bizjak  ubiz...@gmail.com

   * optabs.c (prepare_cmp_insn): Expand comparison of the result
   of memory block compare through generic comparison expansion code.

 I don't think that the first hunk is necessary since result_mode is taken from
 the comparison pattern itself; the second hunk alone seems to be sufficient.

Although the testcase doesn't trip on this part, the result_mode is
taken from the operand mode of cmp{mem,str,strn}_optab. As in the
second case, there is no guarantee that compare that compares the
result of cmp{mem,str,stn}_optab can handle output mode of this optab.

 Patch was bootstrapped and regression tested on alphaev68-pc-linux-gnu
 and x86_64-pc-linux-gnu {,-m32}.

 OK for mainline and release branches?

 Is that a regression on release branches?  If no, that's not worth the risk.

The testcase does not fail on release branches, but simply due to the
fact that BLKmode compares are not adequately tested. Otherwise,
BLKmode compares would always fail on alpha.

Uros.


Re: [PATCH, middle-end]: Fix g++.dg/other/vector-compare.C testsuite failure on alpha

2012-09-21 Thread Eric Botcazou
 Although the testcase doesn't trip on this part, the result_mode is
 taken from the operand mode of cmp{mem,str,strn}_optab. As in the
 second case, there is no guarantee that compare that compares the
 result of cmp{mem,str,stn}_optab can handle output mode of this optab.

It's up to you to write a correct pattern with an appropriate result mode.

 The testcase does not fail on release branches, but simply due to the
 fact that BLKmode compares are not adequately tested. Otherwise,
 BLKmode compares would always fail on alpha.

What happens for the testcase on the release branches?  It doesn't use BKLmode 
compares?  If so, is it ever possible to use BLKmode compares on Alpha?

-- 
Eric Botcazou


Re: [PATCH, middle-end]: Fix g++.dg/other/vector-compare.C testsuite failure on alpha

2012-09-21 Thread Uros Bizjak
On Fri, Sep 21, 2012 at 5:26 PM, Eric Botcazou ebotca...@adacore.com wrote:
 Although the testcase doesn't trip on this part, the result_mode is
 taken from the operand mode of cmp{mem,str,strn}_optab. As in the
 second case, there is no guarantee that compare that compares the
 result of cmp{mem,str,stn}_optab can handle output mode of this optab.

 It's up to you to write a correct pattern with an appropriate result mode.

OK, I can live with this; if some other unfortunate target trips here,
we will know how to fix it.

 The testcase does not fail on release branches, but simply due to the
 fact that BLKmode compares are not adequately tested. Otherwise,
 BLKmode compares would always fail on alpha.

 What happens for the testcase on the release branches?  It doesn't use BKLmode
 compares?  If so, is it ever possible to use BLKmode compares on Alpha?

Vector compare testcases can't be compiled with 4.7- - vector compares
are not implemented for C++ there. As observed, BLKmode compare is not
triggered for alpha in the whole testsuite, as far as release branches
are concerned.

Uros.


Re: [PATCH] Fix a bug that breaks go build

2012-09-21 Thread Dehao Chen
This patch was checked in as
http://gcc.gnu.org/viewcvs?view=revisionrevision=191614

I have another patch to add the new test. The new trunk can pass this
test. If no objection, I'll check in this patch in an hour.

Thanks,
Dehao

gcc/testsuite/ChangeLog:
2012-09-21  Dehao Chen  de...@google.com

PR go/54649
PR tree-optimization/54655
* g++.dg/pr54655.C: New testcase.

Index: gcc/testsuite/g++.dg/pr54655.C
===
--- gcc/testsuite/g++.dg/pr54655.C  (revision 0)
+++ gcc/testsuite/g++.dg/pr54655.C  (revision 0)
@@ -0,0 +1,35 @@
+// { dg-do compile }
+/* { dg-options -O1 }  */
+
+extern C class A
+{
+};
+
+template typename T class B:A
+{
+public:
+B (int *, T);
+~B ()
+{
+}
+};
+
+bool a;
+
+inline void
+fn1 ()
+{
+  switch (0)
+  case 0:
+  {
+B int* b (0, 0);
+if (a)
+  break;
+  }
+}
+
+void
+fn2 ()
+{
+  fn1 ();
+}


Go patch committed: len(-c) is not a constant

2012-09-21 Thread Ian Lance Taylor
The Go compiler was erroneously treating len(-c) as a constant if c was
a chan of an array.  That was causing it to not actually run the channel
receive operation.  This patch fixes the problem, and also does a minor
cleanup by moving the relevant code from do_lower to do_is_constant.
Bootstrapped and tested on x86_64-unknown-linux-gnu.  Committed to
mainline and 4.7 branch.

Ian

diff -r 0776ddf9dcf5 go/expressions.cc
--- a/go/expressions.cc	Thu Sep 20 10:06:54 2012 -0700
+++ b/go/expressions.cc	Fri Sep 21 10:43:39 2012 -0700
@@ -6679,38 +6679,6 @@
   this-set_args(new_args);
 }
 
-// A traversal class which looks for a call expression.
-
-class Find_call_expression : public Traverse
-{
- public:
-  Find_call_expression()
-: Traverse(traverse_expressions),
-  found_(false)
-  { }
-
-  int
-  expression(Expression**);
-
-  bool
-  found()
-  { return this-found_; }
-
- private:
-  bool found_;
-};
-
-int
-Find_call_expression::expression(Expression** pexpr)
-{
-  if ((*pexpr)-call_expression() != NULL)
-{
-  this-found_ = true;
-  return TRAVERSE_EXIT;
-}
-  return TRAVERSE_CONTINUE;
-}
-
 // Lower a builtin call expression.  This turns new and make into
 // specific expressions.  We also convert to a constant if we can.
 
@@ -6731,20 +6699,6 @@
 
   if (this-is_constant())
 {
-  // We can only lower len and cap if there are no function calls
-  // in the arguments.  Otherwise we have to make the call.
-  if (this-code_ == BUILTIN_LEN || this-code_ == BUILTIN_CAP)
-	{
-	  Expression* arg = this-one_arg();
-	  if (arg != NULL  !arg-is_constant())
-	{
-	  Find_call_expression find_call;
-	  Expression::traverse(arg, find_call);
-	  if (find_call.found())
-		return this;
-	}
-	}
-
   Numeric_constant nc;
   if (this-numeric_constant_value(nc))
 	return nc.expression(loc);
@@ -7061,8 +7015,42 @@
   return args-front();
 }
 
-// Return whether this is constant: len of a string, or len or cap of
-// a fixed array, or unsafe.Sizeof, unsafe.Offsetof, unsafe.Alignof.
+// A traversal class which looks for a call or receive expression.
+
+class Find_call_expression : public Traverse
+{
+ public:
+  Find_call_expression()
+: Traverse(traverse_expressions),
+  found_(false)
+  { }
+
+  int
+  expression(Expression**);
+
+  bool
+  found()
+  { return this-found_; }
+
+ private:
+  bool found_;
+};
+
+int
+Find_call_expression::expression(Expression** pexpr)
+{
+  if ((*pexpr)-call_expression() != NULL
+  || (*pexpr)-receive_expression() != NULL)
+{
+  this-found_ = true;
+  return TRAVERSE_EXIT;
+}
+  return TRAVERSE_CONTINUE;
+}
+
+// Return whether this is constant: len of a string constant, or len
+// or cap of an array, or unsafe.Sizeof, unsafe.Offsetof,
+// unsafe.Alignof.
 
 bool
 Builtin_call_expression::do_is_constant() const
@@ -7085,6 +7073,17 @@
 	 !arg_type-points_to()-is_slice_type())
 	  arg_type = arg_type-points_to();
 
+	// The len and cap functions are only constant if there are no
+	// function calls or channel operations in the arguments.
+	// Otherwise we have to make the call.
+	if (!arg-is_constant())
+	  {
+	Find_call_expression find_call;
+	Expression::traverse(arg, find_call);
+	if (find_call.found())
+	  return false;
+	  }
+
 	if (arg_type-array_type() != NULL
 	 arg_type-array_type()-length() != NULL)
 	  return true;


Re: [PATCH] Fix PR52173

2012-09-21 Thread Aldy Hernandez

On 09/21/12 08:52, Richard Guenther wrote:


This bug happens because GIMPLE_TRANSACTION is a statement
without real but with virtual operands.  The short-cut in gimple_copy
thus is overly optimistic.  Fixed as follows.


Thank you so much for fixing this.

When you apply the patch, do you mind including the attached tests-- 
assuming you are ok with them?  Or I can commit them after you commit 
your patch if you prefer.


Thanks again.
Aldy
testsuite/
PR middle-end/52173
* gcc.dg/tm/pr52173-1.c: New.
* gcc.dg/tm/pr52173-2.c: New.

diff --git a/gcc/testsuite/gcc.dg/tm/pr52173-1.c 
b/gcc/testsuite/gcc.dg/tm/pr52173-1.c
new file mode 100644
index 000..9ffa4d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr52173-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options -fgnu-tm -O3 } */
+
+int vec[500];
+
+void func()
+{ 
+  __transaction_relaxed
+{ 
+  vec[123] = 456;
+}
+}
+
+main()
+{ 
+  int i;
+  for(i = 0; i  10; ++i)
+func();
+}
diff --git a/gcc/testsuite/gcc.dg/tm/pr52173-2.c 
b/gcc/testsuite/gcc.dg/tm/pr52173-2.c
new file mode 100644
index 000..ca64893
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr52173-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options -fgnu-tm -O2 } */
+
+int a;
+
+int main()
+{
+  int i;
+  for (i = 0; i  1; ++i)
+__transaction_atomic { ++a; }
+  return 0;
+}


[C++] Mixed scalar-vector operations

2012-09-21 Thread Marc Glisse

Hello,

this patch adds mixed scalar-vector operations to the C++ front-end. It 
also adds a few operators to the C front-end (comparisons in particular). 
This patch is mostly an import from the C front-end (with the maybe_const 
stuff removed).


2012-09-22  Marc Glisse  marc.gli...@inria.fr

PR c++/54427

c/
* c-typeck.c: Include c-common.h.
(enum stv_conv): Moved to c-common.h.
(scalar_to_vector): Moved to c-common.c.
* Make-lang.in: c-typeck.c depends on c-common.h.

c-family/
* c-common.c (scalar_to_vector): Moved from c-typeck.c. Support
more operations.
* c-common.h (enum stv_conv): Moved from c-typeck.c.
(scalar_to_vector): Declare.

cp/
* typeck.c (cp_build_binary_op): Handle mixed scalar-vector
operations.
[LSHIFT_EXPR, RSHIFT_EXPR]: Likewise.

gcc/
* fold-const.c (fold_binary_loc): Use build_zero_cst instead of
build_int_cst for a potential vector.

testsuite/
* c-c++-common/vector-scalar.c: New testcase.
* g++.dg/ext/vector5.C: This is not an error anymore.
* gcc.dg/init-vec-1.c: Move ...
* c-c++-common/init-vec-1.c: ... here. Adapt error message.
* gcc.c-torture/execute/vector-shift1.c: Move ...
* c-c++-common/torture/vector-shift1.c: ... here.
* gcc.dg/scal-to-vec1.c: Move ...
* c-c++-common/scal-to-vec1.c: ... here. Avoid narrowing for
C++11. Adapt error message.
* gcc.dg/convert-vec-1.c: Move ...
* c-c++-common/convert-vec-1.c: ... here.
* gcc.dg/scal-to-vec2.c: Move ...
* c-c++-common/scal-to-vec2.c: ... here.

--
Marc GlisseIndex: c-family/c-common.c
===
--- c-family/c-common.c (revision 191613)
+++ c-family/c-common.c (working copy)
@@ -11147,11 +11147,105 @@ convert_vector_to_pointer_for_subscript
 
   c_common_mark_addressable_vec (*vecp);
   type = build_qualified_type (TREE_TYPE (type), TYPE_QUALS (type));
   type = build_pointer_type (type);
   type1 = build_pointer_type (TREE_TYPE (*vecp));
   *vecp = build1 (ADDR_EXPR, type1, *vecp);
   *vecp = convert (type, *vecp);
 }
 }
 
+/* Convert scalar to vector for the range of operations.  */
+enum stv_conv
+scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1)
+{
+  tree type0 = TREE_TYPE (op0);
+  tree type1 = TREE_TYPE (op1);
+  bool integer_only_op = false;
+  enum stv_conv ret = stv_firstarg;
+
+  gcc_assert (TREE_CODE (type0) == VECTOR_TYPE
+ || TREE_CODE (type1) == VECTOR_TYPE);
+  switch (code)
+{
+  case RSHIFT_EXPR:
+  case LSHIFT_EXPR:
+   if (TREE_CODE (type0) == INTEGER_TYPE
+TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE)
+ {
+   if (unsafe_conversion_p (TREE_TYPE (type1), op0, false))
+ {
+   error_at (loc, conversion of scalar to vector 
+  involves truncation);
+   return stv_error;
+ }
+   else
+ return stv_firstarg;
+ }
+   break;
+
+  case BIT_IOR_EXPR:
+  case BIT_XOR_EXPR:
+  case BIT_AND_EXPR:
+   integer_only_op = true;
+   /* ... fall through ...  */
+
+  case PLUS_EXPR:
+  case MINUS_EXPR:
+  case MULT_EXPR:
+  case TRUNC_DIV_EXPR:
+  case CEIL_DIV_EXPR:
+  case FLOOR_DIV_EXPR:
+  case ROUND_DIV_EXPR:
+  case EXACT_DIV_EXPR:
+  case TRUNC_MOD_EXPR:
+  case FLOOR_MOD_EXPR:
+  case RDIV_EXPR:
+  case EQ_EXPR:
+  case NE_EXPR:
+  case LE_EXPR:
+  case GE_EXPR:
+  case LT_EXPR:
+  case GT_EXPR:
+  /* What about UNLT_EXPR?  */
+   if (TREE_CODE (type0) == VECTOR_TYPE)
+ {
+   tree tmp;
+   ret = stv_secondarg;
+   /* Swap TYPE0 with TYPE1 and OP0 with OP1  */
+   tmp = type0; type0 = type1; type1 = tmp;
+   tmp = op0; op0 = op1; op1 = tmp;
+ }
+
+   if (TREE_CODE (type0) == INTEGER_TYPE
+TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE)
+ {
+   if (unsafe_conversion_p (TREE_TYPE (type1), op0, false))
+ {
+   error_at (loc, conversion of scalar to vector 
+  involves truncation);
+   return stv_error;
+ }
+   return ret;
+ }
+   else if (!integer_only_op
+   /* Allow integer -- real conversion if safe.  */
+ (TREE_CODE (type0) == REAL_TYPE
+|| TREE_CODE (type0) == INTEGER_TYPE)
+ SCALAR_FLOAT_TYPE_P (TREE_TYPE (type1)))
+ {
+   if (unsafe_conversion_p (TREE_TYPE (type1), op0, false))
+ {
+   error_at (loc, conversion of scalar to vector 
+  involves truncation);
+   return stv_error;
+ }
+   

PATCH: PR target/48904: x86_64-knetbsd-gnu fails to build

2012-09-21 Thread H.J. Lu
Hi,

This patch adds i386/knetbsd-gnu64.h for x86_64-knetbsd-gnu.  OK to
install?

Thanks.

H.J.
---
2012-09-21  H.J. Lu  hongjiu...@intel.com

PR target/48904
* config.gcc (tm_file): Add i386/knetbsd-gnu64.h for
x86_64-*-knetbsd*-gnu.

* config/i386/knetbsd-gnu64.h: New file.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index d6c8153..00db1b4 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1275,7 +1275,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | 
x86_64-*-knetbsd*-gnu)
tm_file=${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h
;;
x86_64-*-knetbsd*-gnu)
-   tm_file=${tm_file} knetbsd-gnu.h
+   tm_file=${tm_file} knetbsd-gnu.h i386/knetbsd-gnu64.h
;;
esac
tmake_file=${tmake_file} i386/t-linux64
diff --git a/gcc/config/i386/knetbsd-gnu64.h b/gcc/config/i386/knetbsd-gnu64.h
new file mode 100644
index 000..d621bbe
--- /dev/null
+++ b/gcc/config/i386/knetbsd-gnu64.h
@@ -0,0 +1,27 @@
+/* Definitions for AMD x86-64 running kNetBSD-based GNU systems with ELF format
+   Copyright (C) 2012
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+http://www.gnu.org/licenses/.  */
+
+#define GNU_USER_LINK_EMULATION32 elf_i386
+#define GNU_USER_LINK_EMULATION64 elf_x86_64
+#define GNU_USER_LINK_EMULATIONX32 elf32_x86_64
+
+#define GNU_USER_DYNAMIC_LINKER32 /lib/ld.so.1
+#define GNU_USER_DYNAMIC_LINKER64 /lib/ld-knetbsd-x86-64.so.1
+#define GNU_USER_DYNAMIC_LINKERX32 /lib/ld-knetbsd-x32.so.1


[PATCH] fix PR bootstrap/54642

2012-09-21 Thread Jack Howarth
The attached patch solves the bootstrap failures in PR54642 where the
file lto-symtab.o is rebuilt during 'make install' by the system compiler
due to the dangling dependency left on gt-lto-symtab.h for lto-symtab.o.
Tested on x86_64-apple-darwin12 against clang/clang++ of Xcode 4.5.
Okay for gcc trunk?
  Jack

2012-09-21  Jack Howarth  howa...@bromo.med.uc.edu

PR bootstrap/54642
* Makefile.in (lto-symtab.o): Remove gt-lto-symtab.h dependency.

Index: gcc/Makefile.in
===
--- gcc/Makefile.in (revision 191617)
+++ gcc/Makefile.in (working copy)
@@ -2156,7 +2156,7 @@ lto-section-out.o : lto-section-out.c $(
$(DATA_STREAMER_H)
 lto-symtab.o: lto-symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_H) $(GIMPLE_H) $(GGC_H) $(HASHTAB_H) \
-   $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H) gt-lto-symtab.h
+   $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H)
 lto-opts.o: lto-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
$(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) $(OPTS_H) $(OPTIONS_H) \
$(COMMON_TARGET_H) $(DIAGNOSTIC_H) $(LTO_STREAMER_H)


Re: [PATCH] fix PR bootstrap/54642

2012-09-21 Thread H.J. Lu
On Fri, Sep 21, 2012 at 12:33 PM, Jack Howarth howa...@bromo.med.uc.edu wrote:
 The attached patch solves the bootstrap failures in PR54642 where the
 file lto-symtab.o is rebuilt during 'make install' by the system compiler
 due to the dangling dependency left on gt-lto-symtab.h for lto-symtab.o.
 Tested on x86_64-apple-darwin12 against clang/clang++ of Xcode 4.5.
 Okay for gcc trunk?
   Jack

 2012-09-21  Jack Howarth  howa...@bromo.med.uc.edu

 PR bootstrap/54642
 * Makefile.in (lto-symtab.o): Remove gt-lto-symtab.h dependency.



I checked it in for you.

Thanks.

-- 
H.J.


add typedef printers to libstdc++

2012-09-21 Thread Tom Tromey
This patch adds some typedef printers to libstdc++.

This relies on a gdb patch that hasn't yet gone in (pending on the list).
If the gdb patch changes, I'll change these printers as well.

The basic idea is that you can now have gdb substitute a name of your
choice when printing a type's name.  This lets a library pretend that
some typedefs are canonical.

This includes a fairly comprehensive test case for the new type
printers.

Tom

b/libstdc++-v3/ChangeLog:
2012-09-21  Tom Tromey  tro...@redhat.com

* testsuite/libstdc++-prettyprinters/whatis.cc: New file.
* testsuite/lib/gdb-test.exp (whatis-test): New proc.
(gdb-test): Handle 'whatis' tests.
(gdb_batch_check): New proc.
(gdb_version_check): Rewrite to use gdb_batch_check.
* python/libstdcxx/v6/printers.py: Import gdb.types.
(FilteringTypePrinter): New class.
(add_one_type_printer, register_type_printers): New functions.
(register_libstdcxx_printers): Call register_type_printers.

diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py 
b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 0eac413..5b11cb0 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -26,6 +26,15 @@ try:
 except ImportError:
 _use_gdb_pp = False
 
+# Try to install type-printers.
+_use_type_printing = False
+try:
+import gdb.types
+if hasattr(gdb.types, 'TypePrinter'):
+_use_type_printing = True
+except ImportError:
+pass
+
 # Starting with the type ORIG, search for the member type NAME.  This
 # handles searching upward through superclasses.  This is needed to
 # work around http://sourceware.org/bugzilla/show_bug.cgi?id=13615.
@@ -789,6 +798,97 @@ class Printer(object):
 
 libstdcxx_printer = None
 
+class FilteringTypePrinter(object):
+def __init__(self, match, name):
+self.match = match
+self.name = name
+self.enabled = True
+
+class _recognizer(object):
+def __init__(self, match, name):
+self.match = match
+self.name = name
+self.type_obj = None
+
+def recognize(self, type_obj):
+if type_obj.tag is None:
+return None
+
+if self.type_obj is None:
+if not self.match in type_obj.tag:
+# Filter didn't match.
+return None
+try:
+self.type_obj = gdb.lookup_type(self.name).strip_typedefs()
+except:
+pass
+if self.type_obj == type_obj:
+return self.name
+return None
+
+def instantiate(self):
+return self._recognizer(self.match, self.name)
+
+def add_one_type_printer(obj, match, name):
+printer = FilteringTypePrinter(match, 'std::' + name)
+gdb.types.register_type_printer(obj, printer)
+
+def register_type_printers(obj):
+global _use_type_printing
+
+if not _use_type_printing:
+return
+
+for pfx in ('', 'w'):
+add_one_type_printer(obj, 'basic_string', pfx + 'string')
+add_one_type_printer(obj, 'basic_ios', pfx + 'ios')
+add_one_type_printer(obj, 'basic_streambuf', pfx + 'streambuf')
+add_one_type_printer(obj, 'basic_istream', pfx + 'istream')
+add_one_type_printer(obj, 'basic_ostream', pfx + 'ostream')
+add_one_type_printer(obj, 'basic_iostream', pfx + 'iostream')
+add_one_type_printer(obj, 'basic_stringbuf', pfx + 'stringbuf')
+add_one_type_printer(obj, 'basic_istringstream',
+ pfx + 'istringstream')
+add_one_type_printer(obj, 'basic_ostringstream',
+ pfx + 'ostringstream')
+add_one_type_printer(obj, 'basic_stringstream',
+ pfx + 'stringstream')
+add_one_type_printer(obj, 'basic_filebuf', pfx + 'filebuf')
+add_one_type_printer(obj, 'basic_ifstream', pfx + 'ifstream')
+add_one_type_printer(obj, 'basic_ofstream', pfx + 'ofstream')
+add_one_type_printer(obj, 'basic_fstream', pfx + 'fstream')
+add_one_type_printer(obj, 'basic_regex', pfx + 'regex')
+add_one_type_printer(obj, 'sub_match', pfx + 'csub_match')
+add_one_type_printer(obj, 'sub_match', pfx + 'ssub_match')
+add_one_type_printer(obj, 'match_results', pfx + 'cmatch')
+add_one_type_printer(obj, 'match_results', pfx + 'smatch')
+add_one_type_printer(obj, 'regex_iterator', pfx + 'cregex_iterator')
+add_one_type_printer(obj, 'regex_iterator', pfx + 'sregex_iterator')
+add_one_type_printer(obj, 'regex_token_iterator',
+ pfx + 'cregex_token_iterator')
+add_one_type_printer(obj, 'regex_token_iterator',
+ pfx + 'sregex_token_iterator')
+
+# Note that we can't have a printer for std::wstreampos, because
+# it 

[patch] PR middle-end/53850: memset builtin problem in TM

2012-09-21 Thread Aldy Hernandez
The problem here is that a simple loop gets transformed into a 
__builtin_memset by the loop distribution pass:


+  __transaction_atomic
+  {
+for (i = 0; i  100; ++i)
+  pp[i] = 0x33;
+  }

Since this pass occurs after IPA-tm, the new call to __builtin_memset 
hasn't been analyzed so it has no cgraph node associated with it.


Barring major surgery to the entire TM infrastructure, I think the 
easiest thing to do is find the memset replacement late in 
expand_call_tm and create a cgraph node there.


I also experimented with generating the __builtin_TM_memset in the loop 
distribution pass, but that seemed overly kludgy, as every pass adding 
calls after IPA passes would have to have intimate knowledge of the TM 
builtins.  The patch below seemed like a better idea.


Tested on x86-64 Linux.

OK?

p.s. What do you think of the tm_may_enter_irr comment below?

PR middle-end/53850
* trans-mem.c (expand_call_tm): Handle late built built-ins.

diff --git a/gcc/testsuite/gcc.dg/tm/pr53850.c 
b/gcc/testsuite/gcc.dg/tm/pr53850.c
new file mode 100644
index 000..ca2c604
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr53850.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options -fgnu-tm -O3 } */
+
+unsigned char pp[100];
+
+void
+foo (void)
+{
+  int i;
+  __transaction_atomic
+  {
+for (i = 0; i  100; ++i)
+  pp[i] = 0x33;
+  }
+}
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 242b470..4965b3d 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2296,8 +2296,27 @@ expand_call_tm (struct tm_region *region,
 }
 
   node = cgraph_get_node (fn_decl);
-  /* All calls should have cgraph here. */
-  gcc_assert (node);
+  /* All calls should have cgraph here.  */
+  if (!node)
+{
+  /* We can have a nodeless call here if some pass after IPA-tm
+added uninstrumented calls.  For example, loop distribution
+can transform certain loop constructs into __builtin_mem*
+calls.  In this case, see if we have a suitable TM
+replacement and fill in the gaps.  */
+  tree repl = find_tm_replacement_function (fn_decl);
+  if (repl)
+   {
+ gimple_call_set_fndecl (stmt, repl);
+ update_stmt (stmt);
+ node = cgraph_create_node (repl);
+ /* ?? For TM_* builtin replacements, can we set this to FALSE??
+Otherwise, do we need to propagate the may_irr bit?  */
+ node-local.tm_may_enter_irr = true;
+ return expand_call_tm (region, gsi);
+   }
+  gcc_unreachable ();
+}
   if (node-local.tm_may_enter_irr)
 transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE);
 


[patch] PR54645 move location_adhoc_data map into GC

2012-09-21 Thread Dehao Chen
Hi,

This patch moves location_adhoc_data into GC, and also rebuild the
hash table when reading in the PCH. After the patch, PCH can work as
expected.

Bootstrapped and passed gcc regression tests on x8664_linux.

OK for trunk?

Thanks,
Dehao

libcpp/ChangeLog:
2012-09-21  Dehao Chen  de...@google.com

PR middle-end/54645
* include/line-map.h (location_adhoc_data): Move location_adhoc_data
into GC.
(location_adhoc_data_map): Likewise.
(line_maps): Likewise.
(rebuild_location_adhoc_htab): New Function.
* line-map.c (+rebuild_location_adhoc_htab): new Funcion.
(get_combined_adhoc_loc): Move location_adhoc_data into GC.
(location_adhoc_data_fini): Likewise.
(linemap_init): Likewise.
(location_adhoc_data_init): Remove Function.

gcc/ChangeLog:
2012-09-21  Dehao Chen  de...@google.com

PR middle-end/54645
* c-family/c-pch.c (c_common_read_pch): Rebuild the location_adhoc_data
map when read in the pch.
Index: gcc/c-family/c-pch.c
===
--- gcc/c-family/c-pch.c(revision 191618)
+++ gcc/c-family/c-pch.c(working copy)
@@ -340,6 +340,7 @@ c_common_read_pch (cpp_reader *pfile, const char *
 
   gt_pch_restore (f);
   cpp_set_line_map (pfile, line_table);
+  rebuild_location_adhoc_htab (line_table);
 
   timevar_push (TV_PCH_CPP_RESTORE);
   if (cpp_read_state (pfile, name, f, smd) != 0)
Index: libcpp/include/line-map.h
===
--- libcpp/include/line-map.h   (revision 191618)
+++ libcpp/include/line-map.h   (working copy)
@@ -260,9 +260,9 @@ struct GTY(()) maps_info {
 };
 
 /* Data structure to associate an arbitrary data to a source location.  */
-struct location_adhoc_data {
+struct GTY(()) location_adhoc_data {
   source_location locus;
-  void *data;
+  void * GTY((skip)) data;
 };
 
 struct htab;
@@ -277,11 +277,11 @@ struct htab;
bits of the integer is used to index the location_adhoc_data array,
in which the locus and associated data is stored.  */
 
-struct location_adhoc_data_map {
-  struct htab *htab;
+struct GTY(()) location_adhoc_data_map {
+  struct htab * GTY((skip)) htab;
   source_location curr_loc;
-  struct location_adhoc_data *data;
   unsigned int allocated;
+  struct location_adhoc_data GTY((length (%h.allocated))) *data;
 };
 
 /* A set of chronological line_map structures.  */
@@ -315,7 +315,7 @@ struct GTY(()) line_maps {
  allocated, for a certain allocation size requested.  */
   line_map_round_alloc_size_func round_alloc_size;
 
-  struct location_adhoc_data_map GTY((skip)) location_adhoc_data_map;
+  struct location_adhoc_data_map location_adhoc_data_map;
 };
 
 /* Returns the pointer to the memory region where information about
@@ -446,6 +446,8 @@ extern source_location get_location_from_adhoc_loc
 #define COMBINE_LOCATION_DATA(SET, LOC, BLOCK) \
   get_combined_adhoc_loc ((SET), (LOC), (BLOCK))
 
+extern void rebuild_location_adhoc_htab (struct line_maps *);
+
 /* Initialize a line map set.  */
 extern void linemap_init (struct line_maps *);
 
Index: libcpp/line-map.c
===
--- libcpp/line-map.c   (revision 191618)
+++ libcpp/line-map.c   (working copy)
@@ -82,6 +82,19 @@ location_adhoc_data_update (void **slot, void *dat
   return 1;
 }
 
+/* Rebuild the hash table from the location adhoc data.  */
+
+void
+rebuild_location_adhoc_htab (struct line_maps *set)
+{
+  unsigned i;
+  set-location_adhoc_data_map.htab =
+  htab_create (100, location_adhoc_data_hash, location_adhoc_data_eq, 
NULL);
+  for (i = 0; i  set-location_adhoc_data_map.curr_loc; i++)
+htab_find_slot (set-location_adhoc_data_map.htab,
+   set-location_adhoc_data_map.data + i, INSERT);
+}
+
 /* Combine LOCUS and DATA to a combined adhoc loc.  */
 
 source_location
@@ -109,14 +122,21 @@ get_combined_adhoc_loc (struct line_maps *set,
{
  char *orig_data = (char *) set-location_adhoc_data_map.data;
  long long offset;
- set-location_adhoc_data_map.allocated *= 2;
- set-location_adhoc_data_map.data =
- XRESIZEVEC (struct location_adhoc_data,
- set-location_adhoc_data_map.data,
- set-location_adhoc_data_map.allocated);
+ line_map_realloc reallocator
+ = set-reallocator ? set-reallocator : xrealloc;
+
+ if (set-location_adhoc_data_map.allocated == 0)
+   set-location_adhoc_data_map.allocated = 128;
+ else
+   set-location_adhoc_data_map.allocated *= 2;
+ set-location_adhoc_data_map.data = (struct location_adhoc_data *)
+ reallocator (set-location_adhoc_data_map.data,
+  set-location_adhoc_data_map.allocated
+  * sizeof (struct location_adhoc_data));
  offset = 

Go patch committed: Better error message

2012-09-21 Thread Ian Lance Taylor
This patch to the Go compiler gives a better error message if a method
that requires a pointer receiver is invoked with a non-pointer value.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline and 4.7 branch.

Ian

diff -r cb56a10e8798 go/types.cc
--- a/go/types.cc	Fri Sep 21 10:44:22 2012 -0700
+++ b/go/types.cc	Fri Sep 21 14:00:15 2012 -0700
@@ -6845,7 +6845,8 @@
 	  std::string n = Gogo::message_name(p-name());
 	  size_t len = 100 + n.length();
 	  char* buf = new char[len];
-	  snprintf(buf, len, _(method %s%s%s requires a pointer),
+	  snprintf(buf, len,
+		   _(method %s%s%s requires a pointer receiver),
 		   open_quote, n.c_str(), close_quote);
 	  reason-assign(buf);
 	  delete[] buf;
@@ -9034,7 +9035,7 @@
 		 Gogo::message_name(name).c_str(), ambig1.c_str(),
 		 ambig2.c_str());
   else if (found_pointer_method)
-	error_at(location, method requires a pointer);
+	error_at(location, method requires a pointer receiver);
   else if (nt == NULL  st == NULL  it == NULL)
 	error_at(location,
 		 (reference to field %qs in object which 


Re: [patch testsuite]: Fix failing test for llp64 in gcc.dg/tree-ssa

2012-09-21 Thread Janis Johnson
On 09/19/2012 10:19 AM, Kai Tietz wrote:
 Hi,
 
 this patch fixes testsuite-failures for llp64 targets in
 gcc.dg/tree-ssa testsuite.
 
 ChangeLog
 
 2012-09-19  Kai Tietz
 
 * gcc.dg/tree-ssa/scev-3.c: Add llp64 to xfail.
 * gcc.dg/tree-ssa/scev-4.c: Likewise.
 
 Ok for apply?

OK.

Janis

 Regards,
 Kai
 
 Index: scev-3.c
 ===
 --- scev-3.c(Revision 191443)
 +++ scev-3.c(Arbeitskopie)
 @@ -14,5 +14,5 @@
  }
  }
 
 -/* { dg-final { scan-tree-dump-times a 1 optimized { xfail lp64 } } } */
 +/* { dg-final { scan-tree-dump-times a 1 optimized { xfail {
 lp64 || llp64 } } } } */
  /* { dg-final { cleanup-tree-dump optimized } } */
 Index: scev-4.c
 ===
 --- scev-4.c(Revision 191443)
 +++ scev-4.c(Arbeitskopie)
 @@ -19,5 +19,5 @@
  }
  }
 
 -/* { dg-final { scan-tree-dump-times a 1 optimized { xfail lp64 } } } */
 +/* { dg-final { scan-tree-dump-times a 1 optimized { xfail {
 lp64 || llp64 } } } } */
  /* { dg-final { cleanup-tree-dump optimized } } */
 



Go patch committed: Better error message for single- multiple- value

2012-09-21 Thread Ian Lance Taylor
This patch to the Go frontend adds some missing dashes to error
messages.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline and 4.7 branch.

Ian

diff -r fb59d6712068 go/gogo.cc
--- a/go/gogo.cc	Fri Sep 21 14:06:10 2012 -0700
+++ b/go/gogo.cc	Fri Sep 21 15:05:27 2012 -0700
@@ -4224,7 +4224,7 @@
 	  else if (type-is_call_multiple_result_type())
 	{
 	  error_at(this-location_,
-		   single variable set to multiple value function call);
+		   single variable set to multiple-value function call);
 	  type = Type::make_error_type();
 	}
 
diff -r fb59d6712068 go/types.cc
--- a/go/types.cc	Fri Sep 21 14:06:10 2012 -0700
+++ b/go/types.cc	Fri Sep 21 15:05:27 2012 -0700
@@ -421,7 +421,7 @@
 
 case TYPE_CALL_MULTIPLE_RESULT:
   if (reason != NULL)
-	*reason = invalid use of multiple value function call;
+	*reason = invalid use of multiple-value function call;
   return false;
 
 default:
@@ -627,8 +627,8 @@
   if (rhs-is_call_multiple_result_type())
 	{
 	  if (reason != NULL)
-	reason-assign(_(multiple value function call in 
-			 single value context));
+	reason-assign(_(multiple-value function call in 
+			 single-value context));
 	  return false;
 	}
 }


Re: [PATCH] Fix PR C++/50970 -- Function pointer dereferenced twice in if statement on Arm cpu

2012-09-21 Thread rearnsha
On 20 Sep 2012, at 08:51, Zhenqiang Chen zhenqiang.c...@linaro.org wrote:

 Hi,
 
 PR 50970 is a general c++ front-end issue for targets which define
 TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta, although the
 reporter had issues only on ARM.
 
 Root cause: It misses a check for side effects when generating pfn and
 delta related expressions.
 
 In the failed case, op0 is a function call. pfn0 and delta0 are
 expressions based on the return value of op0. Without the check, the
 function will be called twice.
 
 The patch is to add the check for op0.
 
 No make check regression on ARM.
 
 Is it OK for trunk?
 
 Thanks!
 -Zhenqiang
 
 cp/ChangeLog:
 2012-09-20  Zhenqiang Chen zhenqiang.c...@linaro.org
 
PR c++/50970
* typeck.c (cp_build_binary_op): Check side effects before generating
pfn and delta related expressions.
 

Ok.

R.

 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
 index ad4b090..884f7d0 100644
 --- a/gcc/cp/typeck.c
 +++ b/gcc/cp/typeck.c
 @@ -4159,18 +4159,23 @@ cp_build_binary_op (location_t location,
  if (TARGET_PTRMEMFUNC_VBIT_LOCATION
  == ptrmemfunc_vbit_in_delta)
{
 -  tree pfn0 = pfn_from_ptrmemfunc (op0);
 -  tree delta0 = delta_from_ptrmemfunc (op0);
 -  tree e1 = cp_build_binary_op (location,
 -EQ_EXPR,
 -  pfn0,
 -  build_zero_cst (TREE_TYPE (pfn0)),
 -complain);
 -  tree e2 = cp_build_binary_op (location,
 -BIT_AND_EXPR,
 -delta0,
 -integer_one_node,
 -complain);
 +  tree pfn0, delta0, e1, e2;
 +
 +  if (TREE_SIDE_EFFECTS (op0))
 +op0 = save_expr (op0);
 +
 +  pfn0 = pfn_from_ptrmemfunc (op0);
 +  delta0 = delta_from_ptrmemfunc (op0);
 +  e1 = cp_build_binary_op (location,
 +   EQ_EXPR,
 + pfn0,
 +   build_zero_cst (TREE_TYPE (pfn0)),
 +   complain);
 +  e2 = cp_build_binary_op (location,
 +   BIT_AND_EXPR,
 +   delta0,
 +   integer_one_node,
 +   complain);

  if ((complain  tf_warning)
   c_inhibit_evaluation_warnings == 0
 



Re: [Patch ARM] big-endian support for Neon vext tests

2012-09-21 Thread Richard Henderson
On 09/18/2012 01:24 AM, Richard Earnshaw wrote:
 Quite possibly.  In order to determine what is right, we first need to
 understand the specification.  My reading of that is that the semantics
 should be endian independent, but I was hoping that someone would know
 for certain and be able to chip in.

It is supposed to be endian independant.  The vector elements as visible
to the user are in memory order.

I *believe* we've fixed all of the middle-end interfaces have been fixed
to be properly endian independant.

There could easily be backend bugs that accidentally number vector
elements as per their reference manual, as opposed to in memory order.
We probably don't have enough test cases to ferret all of those out.


r~



[lra] merged with trunk

2012-09-21 Thread Vladimir Makarov

The branch was successfully merged with trunk @191440.

The merged lra branch was successfully bootstrapped on x86/x86-64, 
PPC64, ARM, IA64, SPARC64, and MIPS64.


Bootstrapping SPARC64 and MIPS64 required the following changes:

2012-09-21  Vladimir Makarov  vmaka...@redhat.com

* config/mips/mips.c: Include ira.h.
* config/sparc/sparc.c (TARGET_LRA_P): Use sparc_lra_p instead of
x86_lra_p.



Go patch committed: Fix unnamed struct converted to interface

2012-09-21 Thread Ian Lance Taylor
This patch to the Go frontend fixes the handling of an unnamed struct
type with methods (inherited from embedded fields) converted to an
interface type.  Previously the interface method table was being stored
as NULL, causing a runtime crash.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline and 4.7 branch.

Ian

diff -r 561942122df7 go/expressions.cc
--- a/go/expressions.cc	Fri Sep 21 15:10:32 2012 -0700
+++ b/go/expressions.cc	Fri Sep 21 18:10:51 2012 -0700
@@ -293,19 +293,25 @@
   // object type: a list of function pointers for each interface
   // method.
   Named_type* rhs_named_type = rhs_type-named_type();
+  Struct_type* rhs_struct_type = rhs_type-struct_type();
   bool is_pointer = false;
-  if (rhs_named_type == NULL)
+  if (rhs_named_type == NULL  rhs_struct_type == NULL)
 	{
 	  rhs_named_type = rhs_type-deref()-named_type();
+	  rhs_struct_type = rhs_type-deref()-struct_type();
 	  is_pointer = true;
 	}
   tree method_table;
-  if (rhs_named_type == NULL)
-	method_table = null_pointer_node;
-  else
+  if (rhs_named_type != NULL)
 	method_table =
 	  rhs_named_type-interface_method_table(gogo, lhs_interface_type,
 		 is_pointer);
+  else if (rhs_struct_type != NULL)
+	method_table =
+	  rhs_struct_type-interface_method_table(gogo, lhs_interface_type,
+		  is_pointer);
+  else
+	method_table = null_pointer_node;
   first_field_value = fold_convert_loc(location.gcc_location(),
const_ptr_type_node, method_table);
 }
diff -r 561942122df7 go/gogo-tree.cc
--- a/go/gogo-tree.cc	Fri Sep 21 15:10:32 2012 -0700
+++ b/go/gogo-tree.cc	Fri Sep 21 18:10:51 2012 -0700
@@ -2128,8 +2128,7 @@
 
 tree
 Gogo::interface_method_table_for_type(const Interface_type* interface,
-  Named_type* type,
-  bool is_pointer)
+  Type* type, bool is_pointer)
 {
   const Typed_identifier_list* interface_methods = interface-methods();
   go_assert(!interface_methods-empty());
@@ -2158,7 +2157,9 @@
   // interface.  If the interface has hidden methods, and the named
   // type is defined in a different package, then the interface
   // conversion table will be defined by that other package.
-  if (has_hidden_methods  type-named_object()-package() != NULL)
+  if (has_hidden_methods
+   type-named_type() != NULL
+   type-named_type()-named_object()-package() != NULL)
 {
   tree array_type = build_array_type(const_ptr_type_node, NULL);
   tree decl = build_decl(BUILTINS_LOCATION, VAR_DECL, id, array_type);
@@ -2187,13 +2188,20 @@
   Linemap::predeclared_location());
   elt-value = fold_convert(const_ptr_type_node, tdp);
 
+  Named_type* nt = type-named_type();
+  Struct_type* st = type-struct_type();
+  go_assert(nt != NULL || st != NULL);
   size_t i = 1;
   for (Typed_identifier_list::const_iterator p = interface_methods-begin();
p != interface_methods-end();
++p, ++i)
 {
   bool is_ambiguous;
-  Method* m = type-method_function(p-name(), is_ambiguous);
+  Method* m;
+  if (nt != NULL)
+	m = nt-method_function(p-name(), is_ambiguous);
+  else
+	m = st-method_function(p-name(), is_ambiguous);
   go_assert(m != NULL);
 
   Named_object* no = m-named_object();
diff -r 561942122df7 go/gogo.cc
--- a/go/gogo.cc	Fri Sep 21 15:10:32 2012 -0700
+++ b/go/gogo.cc	Fri Sep 21 18:10:51 2012 -0700
@@ -2872,7 +2872,8 @@
 Build_method_tables::type(Type* type)
 {
   Named_type* nt = type-named_type();
-  if (nt != NULL)
+  Struct_type* st = type-struct_type();
+  if (nt != NULL || st != NULL)
 {
   for (std::vectorInterface_type*::const_iterator p =
 	 this-interfaces_.begin();
@@ -2882,10 +2883,23 @@
 	  // We ask whether a pointer to the named type implements the
 	  // interface, because a pointer can implement more methods
 	  // than a value.
-	  if ((*p)-implements_interface(Type::make_pointer_type(nt), NULL))
+	  if (nt != NULL)
 	{
-	  nt-interface_method_table(this-gogo_, *p, false);
-	  nt-interface_method_table(this-gogo_, *p, true);
+	  if ((*p)-implements_interface(Type::make_pointer_type(nt),
+	 NULL))
+		{
+		  nt-interface_method_table(this-gogo_, *p, false);
+		  nt-interface_method_table(this-gogo_, *p, true);
+		}
+	}
+	  else
+	{
+	  if ((*p)-implements_interface(Type::make_pointer_type(st),
+	 NULL))
+		{
+		  st-interface_method_table(this-gogo_, *p, false);
+		  st-interface_method_table(this-gogo_, *p, true);
+		}
 	}
 	}
 }
diff -r 561942122df7 go/gogo.h
--- a/go/gogo.h	Fri Sep 21 15:10:32 2012 -0700
+++ b/go/gogo.h	Fri Sep 21 18:10:51 2012 -0700
@@ -574,7 +574,7 @@
   // Build an interface method table for a type: a list of function
   // pointers, one for each interface method.  This returns a decl.
   tree
-  interface_method_table_for_type(const Interface_type*, Named_type*,
+ 

Re: [patch] PR middle-end/53850: memset builtin problem in TM

2012-09-21 Thread Richard Henderson
On 09/21/2012 02:00 PM, Aldy Hernandez wrote:
 +   /* ?? For TM_* builtin replacements, can we set this to FALSE??
 +  Otherwise, do we need to propagate the may_irr bit?  */
 +   node-local.tm_may_enter_irr = true;

Yes we can.  Indeed, I think we should have to insist on it.

Assert that the replacement is one of our TM builtins.  If we're
replacing anything else at this stage, something (else) bad has happened.


r~


[Patch, moxie] Add -mno-crt0 option

2012-09-21 Thread Anthony Green
This patch adds a -mno-crt0 option, similar to what is found on the
mn10300 port.  I have checked it in.

Thanks,

AG


2012-09-21  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.opt: Add -mno-crt0 option.
* config/moxie/moxie.h (STARTFILE_SPEC): Handle -mno-crt0 option.
* doc/invoke.texi (Option Summary): Document -mno-crt0 option.


Index: gcc/config/moxie/moxie.h
===
--- gcc/config/moxie/moxie.h(revision 191288)
+++ gcc/config/moxie/moxie.h(working copy)
@@ -1,5 +1,5 @@
 /* Target Definitions for moxie.
-   Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2012  Free Software Foundation, Inc.
Contributed by Anthony Green.

This file is part of GCC.
@@ -22,7 +22,7 @@
 #define GCC_MOXIE_H

 #undef  STARTFILE_SPEC
-#define STARTFILE_SPEC crt0%O%s crti.o%s crtbegin.o%s
+#define STARTFILE_SPEC %{!mno-crt0:crt0%O%s} crti.o%s crtbegin.o%s

 /* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
magical crtend.o file (see crtstuff.c) which provides part of the
Index: gcc/config/moxie/moxie.opt
===
--- gcc/config/moxie/moxie.opt  (revision 191288)
+++ gcc/config/moxie/moxie.opt  (working copy)
@@ -25,3 +25,7 @@
 mel
 Target RejectNegative Report Mask(LITTLE_ENDIAN)
 Generate little-endian code
+
+; Ignored by the compiler
+mno-crt0
+Target RejectNegative
Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi (revision 191288)
+++ gcc/doc/invoke.texi (working copy)
@@ -777,7 +777,7 @@
 -mno-crt0  -mrelax -mliw -msetlb}

 @emph{Moxie Options}
-@gccoptlist{-meb  -mel}
+@gccoptlist{-meb -mel -mno-crt0}

 @emph{PDP-11 Options}
 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
@@ -16467,6 +16467,10 @@
 @opindex mel
 Generate little-endian code.

+@item -mno-crt0
+@opindex mno-crt0
+Do not link in the C run-time initialization object file.
+
 @end table

 @node PDP-11 Options


[PATCH] Fix PR54650

2012-09-21 Thread Dehao Chen
Hi,

The problem is due to a bug when move_block_to_fn. edge-goto_block
should be updated even when its locus is unknown. This patch also
fixes the way to reset block for expr.

Bootstrapped and pass all gcc regression tests.

Is it okay for trunk?

Thanks,
Dehao

gcc/ChangeLog:
tree-cfg.c (move_stmt_op): Reset the expr block only
when necessary.
(move_block_to_fn): Reset the edge's goto block even
when the goto locus is unknown.

Index: tree-cfg.c
===
--- tree-cfg.c  (revision 191614)
+++ tree-cfg.c  (working copy)
@@ -6013,7 +6013,9 @@ move_stmt_op (tree *tp, int *walk_subtrees, void *

   if (EXPR_P (t))
 {
-  if (TREE_BLOCK (t))
+  if (p-orig_block == NULL_TREE
+ || TREE_BLOCK (t) == p-orig_block
+ || TREE_BLOCK (t) == NULL_TREE)
TREE_SET_BLOCK (t, p-new_block);
 }
   else if (DECL_P (t) || TREE_CODE (t) == SSA_NAME)
@@ -6315,7 +6317,7 @@ move_block_to_fn (struct function *dest_cfun, basi
 }

   FOR_EACH_EDGE (e, ei, bb-succs)
-if (!IS_UNKNOWN_LOCATION (e-goto_locus))
+if (e-goto_locus)
   {
tree block = LOCATION_BLOCK (e-goto_locus);
if (d-orig_block == NULL_TREE


[PATCH] rs6000: Tighten register predicates

2012-09-21 Thread Segher Boessenkool
Currently, the register predicates allow a subreg of anything,
including memory or the wrong kind of register.  Most other ports
do not allow this.  As far as I can see, this doesn't help the
compiler generate better code, potentially the opposite.

This also causes a problem for my (upcoming) add-with-carry work.
The patterns for the add-with-carry instructions are each a parallel
of two sets, one of a GPR and one of CA.  Sometimes one of those
sets isn't used, for example for most ADDE instructions, and combine
will try e.g.  (set (reg:P xxx) (reg:P CA_REGNO))  which fails
because that isn't an existing instruction.  But when it tries
(set (reg:SI xxx) (subreg:SI (reg:DI CA_REGNO) 4))  it currently
succeeds, because it looks like movsi2; but of course it ICEs
later on.

This patch tightens the register predicates to only allow a subreg
of the kind of registers the predicates allows.  The generated code
for e.g. gpc_reg_operand looks a bit worse, but benchmarking shows
it to be a wash (average of three runs on combine.ii: original
0m13.014s, patched 0m13.003s).

Tested on powerpc64-linux --enable-languages=c,c++,fortran;
no regressions.  Okay to apply?


Segher


2012-09-21  Segher Boessenkool  seg...@kernel.crashing.org

gcc/
* config/rs6000/predicates.md (altivec_register_operand,
vsx_register_operand, vfloat_operand, vint_operand,
vlogical_operand, gpc_reg_operand, cc_reg_operand,
cc_reg_not_cr0_operand, cc_reg_not_micro_cr0_operand):
If op is a SUBREG, consider its SUBREG_REG instead.

---
 gcc/config/rs6000/predicates.md |  166 +--
 1 files changed, 124 insertions(+), 42 deletions(-)

diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index e2c3e70..12b7527 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -30,44 +30,89 @@ (define_predicate count_register_operand
   (and (match_code reg)
(match_test REGNO (op) == CTR_REGNO
|| REGNO (op)  LAST_VIRTUAL_REGISTER)))
-  
+
 ;; Return 1 if op is an Altivec register.
 (define_predicate altivec_register_operand
-   (and (match_operand 0 register_operand)
-   (match_test GET_CODE (op) != REG
-|| ALTIVEC_REGNO_P (REGNO (op))
-|| REGNO (op)  LAST_VIRTUAL_REGISTER)))
+  (match_operand 0 register_operand)
+{
+  if (GET_CODE (op) == SUBREG)
+op = SUBREG_REG (op);
+
+  if (!REG_P (op))
+return 0;
+
+  if (REGNO (op)  LAST_VIRTUAL_REGISTER)
+return 1;
+
+  return ALTIVEC_REGNO_P (REGNO (op));
+})
 
 ;; Return 1 if op is a VSX register.
 (define_predicate vsx_register_operand
-   (and (match_operand 0 register_operand)
-   (match_test GET_CODE (op) != REG
-|| VSX_REGNO_P (REGNO (op))
-|| REGNO (op)  LAST_VIRTUAL_REGISTER)))
+  (match_operand 0 register_operand)
+{
+  if (GET_CODE (op) == SUBREG)
+op = SUBREG_REG (op);
+
+  if (!REG_P (op))
+return 0;
+
+  if (REGNO (op)  LAST_VIRTUAL_REGISTER)
+return 1;
+
+  return VSX_REGNO_P (REGNO (op));
+})
 
 ;; Return 1 if op is a vector register that operates on floating point vectors
 ;; (either altivec or VSX).
 (define_predicate vfloat_operand
-   (and (match_operand 0 register_operand)
-   (match_test GET_CODE (op) != REG
-|| VFLOAT_REGNO_P (REGNO (op))
-|| REGNO (op)  LAST_VIRTUAL_REGISTER)))
+  (match_operand 0 register_operand)
+{
+  if (GET_CODE (op) == SUBREG)
+op = SUBREG_REG (op);
+
+  if (!REG_P (op))
+return 0;
+
+  if (REGNO (op)  LAST_VIRTUAL_REGISTER)
+return 1;
+
+  return VFLOAT_REGNO_P (REGNO (op));
+})
 
 ;; Return 1 if op is a vector register that operates on integer vectors
 ;; (only altivec, VSX doesn't support integer vectors)
 (define_predicate vint_operand
-   (and (match_operand 0 register_operand)
-   (match_test GET_CODE (op) != REG
-|| VINT_REGNO_P (REGNO (op))
-|| REGNO (op)  LAST_VIRTUAL_REGISTER)))
+  (match_operand 0 register_operand)
+{
+  if (GET_CODE (op) == SUBREG)
+op = SUBREG_REG (op);
+
+  if (!REG_P (op))
+return 0;
+
+  if (REGNO (op)  LAST_VIRTUAL_REGISTER)
+return 1;
+
+  return VINT_REGNO_P (REGNO (op));
+})
 
 ;; Return 1 if op is a vector register to do logical operations on (and, or,
 ;; xor, etc.)
 (define_predicate vlogical_operand
-   (and (match_operand 0 register_operand)
-   (match_test GET_CODE (op) != REG
-|| VLOGICAL_REGNO_P (REGNO (op))
-|| REGNO (op)  LAST_VIRTUAL_REGISTER)))
+  (match_operand 0 register_operand)
+{
+  if (GET_CODE (op) == SUBREG)
+op = SUBREG_REG (op);
+
+  if (!REG_P (op))
+return 0;
+
+  if (REGNO (op)  LAST_VIRTUAL_REGISTER)
+return 1;
+
+  return VLOGICAL_REGNO_P (REGNO (op));
+})
 
 ;; Return 1 if op is the carry register.
 (define_predicate ca_operand
@@ -123,36 +168,73 @@ (define_predicate 

Re: Use conditional casting with symtab_node

2012-09-21 Thread Lawrence Crowl
Add functions symtab_node_def::try_function and symtab_node_def::try_variable.
These function return a pointer to the more specific type (e.g. cgraph_node*)
if and only if the general type (symtab_node aka symtab_node_def*) is an
instance of the specific type.  These functions are essentially checked down
casts.

These functions reduce compile time and increase type safety when treating a
generic item as a more specific item.  In essence, the code change is from

  if (symtab_function_p (node))
{
  struct cgraph_node *cnode = cgraph (node);
  
}

to

  if (cgraph_node *cnode = node-try_function ())
{
  
}

The necessary conditional test defines a variable that holds a known good
pointer to the specific item and avoids subsequent conversion calls and
the assertion checks that may come with them.

When, the property test is embedded within a larger condition, the variable
declaration gets pulled out of the condition.  (This leaves some room for
using the variable inappropritately.)

  if (symtab_variable_p (node)
   varpool (node)-finalized)
varpool_analyze_node (varpool (node));

becomes

  varpool_node *vnode = node-try_variable ();
  if (vnode  vnode-finalized)
varpool_analyze_node (vnode);

Note that we have converted two sets of assertions in the calls to varpool
into safe and efficient use of a variable.


There are remaining calls to symtab_function_p and symtab_variable_p that
do not involve a pointer to a more specific type.  These have been converted
to calls to a member functions symtab_node_def::is_function and
symtab_node_def::is_variable.  The original predicate functions have been
removed.


The cgraph.h header defined both a struct and a function with the name
varpool_node.  This name overloading can cause some unintuitive error messages
when, as is common in C++, one omits the struct keyword when using the type.
I have renamed the function to varpool_node_for_tree.


The new code bootstraps .616% faster with a 99% confidence of being faster.


Tested on x86_64.


Okay for trunk?



Index: gcc/ChangeLog

2012-09-18  Lawrence Crowl  cr...@google.com

* cgraph.h (varpool_node): Rename to varpool_node_for_tree.
Adjust callers to match.
(symtab_node_def::try_function): New.
Change most calls to symtab_function_p with calls to
symtab_node_def::try_function.
(symtab_node_def::try_variable): New.
Change most calls to symtab_variable_p with calls to
symtab_node_def::try_variable.
(symtab_function_p): Rename to symtab_node_def::is_function.
Adjust remaining callers to match.
(symtab_variable_p): Rename to symtab_node_def::is_variable.
Adjust remaining callers to match.
* cgraph.c (cgraph_node_for_asm): Remove redundant call to
symtab_node_for_asm.
* graphunit.c (symbol_finalized_and_needed): New.
(symbol_finalized): New.
(cgraph_analyze_functions): Split complicated conditionals out into
above new functions.



Index: gcc/lto-symtab.c
===
--- gcc/lto-symtab.c(revision 191403)
+++ gcc/lto-symtab.c(working copy)
@@ -743,7 +743,7 @@ lto_symtab_merge_cgraph_nodes_1 (void **
{
  if (!prevailing-vnode)
{
- prevailing-vnode = varpool_node (prevailing-decl);
+ prevailing-vnode = varpool_node_for_tree (prevailing-decl);
  prevailing-vnode-alias = true;
}
  lto_varpool_replace_node (e-vnode, prevailing-vnode);
Index: gcc/cgraphbuild.c
===
--- gcc/cgraphbuild.c   (revision 191403)
+++ gcc/cgraphbuild.c   (working copy)
@@ -84,7 +84,7 @@ record_reference (tree *tp, int *walk_su

   if (TREE_CODE (decl) == VAR_DECL)
{
- struct varpool_node *vnode = varpool_node (decl);
+ struct varpool_node *vnode = varpool_node_for_tree (decl);
  ipa_record_reference ((symtab_node)ctx-varpool_node,
(symtab_node)vnode,
IPA_REF_ADDR, NULL);
@@ -123,7 +123,7 @@ record_type_list (struct cgraph_node *no
  type = TREE_OPERAND (type, 0);
  if (TREE_CODE (type) == VAR_DECL)
{
- struct varpool_node *vnode = varpool_node (type);
+ struct varpool_node *vnode = varpool_node_for_tree (type);
  ipa_record_reference ((symtab_node)node,
(symtab_node)vnode,
IPA_REF_ADDR, NULL);
@@ -233,7 +233,7 @@ mark_address (gimple stmt, tree addr, vo
   else if (addr  TREE_CODE (addr) == VAR_DECL
(TREE_STATIC (addr) || DECL_EXTERNAL (addr)))
 {
-  struct varpool_node *vnode = varpool_node (addr);
+  struct varpool_node *vnode = varpool_node_for_tree (addr);

   ipa_record_reference 

Re: GCC 4.7.3 Status Report (2012-09-20)

2012-09-21 Thread Andris Pavenis

On 09/20/2012 06:33 PM, Jakub Jelinek wrote:

Status
==

The GCC 4.7.2 release tarballs have been created and were uploaded
to ftp.gnu.org.  The GCC 4.7 branch is thus open again for
regression and documentation fixes.



Shouldn't be change

http://gcc.gnu.org/viewcvs/trunk/gcc/gcc.c?r1=188102r2=189918

Invoke GCC_DRIVER_HOST_INITIALIZATION after diagnostic_initialize

* gcc.c (main): Move GCC_DRIVER_HOST_INITIALIZATION after
diagnostic_initialize.

backported to gcc-4.7 branch?

Andris