avoid useless if-before-free tests

2011-03-05 Thread Jim Meyering
Hello,

Someone asked me about this yesterday, and since I've been carrying
this patch series for over a year -- it's not high priority --
this seems like a good time finally to post it.

I've been removing if-before-free tests for a few years now.
Here are some of the projects that have endured this janitorial work:
  git
  emacs
  glibc
  gnulib
  coreutils
  freeIPA
  libvirt
  util-linux-ng
  idutils
  openais
  corosync

Over the course of those adventures, there has been plenty
of discussion.  If you'd like links with justification, I
can provide several.

When I started, I wrote a script to automate the process.
Then I realized that coccinelle's spatch could do it, too, and more
cleanly.  Here's the script I use:
  http://git.sv.gnu.org/cgit/gnulib.git/tree/build-aux/useless-if-before-free
Some projects run it via a "make syntax-check" rule that ensures no
new offending test is introduced (see gnulib's maint.mk).

Here's what I've done, to see if you're ok with it in principle.
If so, let me know and I'll be happy to add proper ChangeLog entries.

The 4th patch merely fixes a syntax error introduced by the
transformation of the 3rd.  For the sake of bisection, at least
those two should be combined.  I'm all for combining all four,
if you prefer.


>From 0c74949d030103a9c33caaf5d753fe1bfe5792a5 Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Mon, 3 Jan 2011 16:52:37 +0100
Subject: [PATCH 1/4] don't encourage unnecessary use of if before free

* README.Portability: Don't encourage people to write
"if (foo) free (foo)".
---
 gcc/README.Portability |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/gcc/README.Portability b/gcc/README.Portability
index 32a33e2..c4a485f 100644
--- a/gcc/README.Portability
+++ b/gcc/README.Portability
@@ -51,16 +51,6 @@ foo (bar, )
 needs to be coded in some other way.


-free and realloc
-
-
-Some implementations crash upon attempts to free or realloc the null
-pointer.  Thus if mem might be null, you need to write
-
-  if (mem)
-free (mem);
-
-
 Trigraphs
 -

--
1.7.4.1.21.g4cc62


>From 6cea681646b53decf2feb9797be8df28e2e33d0a Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Mon, 3 Jan 2011 16:54:55 +0100
Subject: [PATCH 2/4] remove unnecessary if-before-free tests

git grep -l -z "$free *(" | xargs -0 useless-if-before-free -l --name="$free" \
  | xargs -0 perl -0x3b -pi -e
 
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
---
 gcc/ada/initialize.c   |3 +-
 gcc/c-family/c-format.c|6 +-
 gcc/calls.c|   15 +---
 gcc/cfgcleanup.c   |3 +-
 gcc/collect2.c |3 +-
 gcc/config/i386/gmm_malloc.h   |3 +-
 gcc/config/i386/i386.c |3 +-
 gcc/config/mcore/mcore.c   |3 +-
 gcc/coverage.c |3 +-
 gcc/cp/tree.c  |3 +-
 gcc/cse.c  |6 +-
 gcc/cselib.c   |3 +-
 gcc/df-core.c  |   15 +---
 gcc/fortran/gfortranspec.c |3 +-
 gcc/function.c |3 +-
 gcc/gcc.c  |   15 +---
 gcc/gcov.c |6 +-
 gcc/gensupport.c   |   12 +--
 gcc/graphite-clast-to-gimple.c |3 +-
 gcc/graphite-sese-to-poly.c|3 +-
 gcc/haifa-sched.c  |3 +-
 gcc/ipa-prop.c |3 +-
 gcc/ipa-pure-const.c   |3 +-
 gcc/ipa-reference.c|3 +-
 gcc/ira-costs.c|   15 +---
 gcc/ira.c  |9 +--
 gcc/java/jcf-parse.c   |3 +-
 gcc/matrix-reorg.c |9 +--
 gcc/prefix.c   |3 +-
 gcc/profile.c  |3 +-
 gcc/reload1.c  |   12 +--
 gcc/sched-deps.c   |3 +-
 gcc/sel-sched-ir.c |3 +-
 gcc/sese.c |6 +-
 gcc/tree-data-ref.c|6 +-
 gcc/tree-eh.c  |3 +-
 gcc/tree-ssa-coalesce.c|3 +-
 gcc/tree-ssa-live.c|6 +-
 gcc/tree-ssa-loop-ivopts.c |6 +-
 gcc/tree-ssa-pre.c

Re: [patch, ARM] Fix minipool ICE

2011-03-05 Thread Richard Earnshaw

On Mon, 2011-02-28 at 23:40 +0800, Chung-Lin Tang wrote:
> On 2011/2/28 11:07 PM, Richard Earnshaw wrote:
> > 
> > On Mon, 2011-02-07 at 14:09 +0800, Chung-Lin Tang wrote:
> >> Hi,
> >> the *arm_zero_extendhisi2[_v6] patterns currently do not have the
> >> constant pool range attributes specified, causing a minipool ICE case.
> >> This patch adds the needed pool_range/neg_pool_range settings.
> >>
> >> Reported originally from https://bugs.launchpad.net/bugs/711819 , also
> >> happens to occur when building ffmpeg svn trunk.
> >>
> >> Ok for trunk?
> >>
> >> Thanks,
> >> Chung-Lin
> >>
> >> 2011-02-07  Chung-Lin Tang  
> >>
> >> * config/arm/arm.md (*arm_zero_extendhisi2): Set pool_range,
> >> neg_pool_range attributes for ldrh alternative.
> >> (*arm_zero_extendhisi2_v6): Same.
> > 
> > This is wrong.  Neither the predicate nor the constraint accept an
> > immediate, so these should never need to generate mini-pool entries.  If
> > reload is letting these through, then that's a bug in reload IMO.  If
> > it's not reload, then that needs investigating further too.
> 
> Hi Richard,
> 
> To re-cap some of the discussion Bernd, Ramana, and I had off-list: we
> are seeing in some cases, IRA/reload ending up with insns with constant
> pool references (not generated from ARM reorg):
> (insn 262 92 94 3 (set (reg:HI 4 r4 [orig:328 iftmp.6 ] [328])
> (mem/u/c/i:HI (symbol_ref/u:SI ("*.LC0") [flags 0x2]) [2 S2
> A16])) k.c:11 177 {*movhi_insn_arch4}
>  (expr_list:REG_EQUAL (const_int 2047 [0x7ff])
> (nil)))
> 

Thanks for the testcase.  It looks like the problems all started when
the insn above was created.  Reload shouldn't have done that, but was
forced to because the constant being spilt wasn't valid in the
arm_movhi_arch4 pattern.  Once that is done we start down the slippery
slope that leads to the ICE.

It's easily fixed by making that pattern accept any constant and then
processing that directly into the minipools rather than letting reload
push it in to the per-function constant pool and then trying to
eliminate that.

We should do more to optimize handling of constants in HImode,
particularly when we have MOVW available.  But for now this patch will
solve the ICE.

2011-03-05  Richard Earnshaw  

PR target/47719
* arm.md (movhi_insn_arch4):  Accept any immediate constant.
*** config/arm/arm.md	(revision 170711)
--- config/arm/arm.md	(local)
*** (define_expand "movhi_bigend"
*** 5790,5801 
  ;; Pattern to recognize insn generated default case above
  (define_insn "*movhi_insn_arch4"
[(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r")
! 	(match_operand:HI 1 "general_operand"  "rI,K,r,m"))]
"TARGET_ARM
 && arm_arch4
!&& (GET_CODE (operands[1]) != CONST_INT
!|| const_ok_for_arm (INTVAL (operands[1]))
!|| const_ok_for_arm (~INTVAL (operands[1])))"
"@
 mov%?\\t%0, %1\\t%@ movhi
 mvn%?\\t%0, #%B1\\t%@ movhi
--- 5790,5800 
  ;; Pattern to recognize insn generated default case above
  (define_insn "*movhi_insn_arch4"
[(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r")
! 	(match_operand:HI 1 "general_operand"  "rI,K,r,mi"))]
"TARGET_ARM
 && arm_arch4
!&& (register_operand (operands[0], HImode)
!|| register_operand (operands[1], HImode))"
"@
 mov%?\\t%0, %1\\t%@ movhi
 mvn%?\\t%0, #%B1\\t%@ movhi

[committed] Fix get_loop_body ICE (PR rtl-optimization/47899)

2011-03-05 Thread Jakub Jelinek
Hi!

I've committed this patch of Zdenek to fix PR47899 after bootstrap/regtest
on x86_64-linux and i686-linux to trunk, pre-approved in the PR.
Zdenek, if you want to adjust the ChangeLog entry I've made up or use
different e-mail address, just Change it in SVN.  kam.uniff.cz
domain you've used in your last two commits doesn't resolve...

2011-03-05  Zdenek Dvorak  

PR rtl-optimization/47899
* cfgloopmanip.c (fix_bb_placements): Fix first argument
to flow_loop_nested_p when moving the loop upward.

* gcc.dg/pr47899.c: New test.

--- gcc/cfgloopmanip.c.jj   2010-11-03 10:48:15.0 +0100
+++ gcc/cfgloopmanip.c  2011-03-02 13:16:50.171526946 +0100
@@ -174,7 +174,7 @@ fix_bb_placements (basic_block from,
 {
   sbitmap in_queue;
   basic_block *queue, *qtop, *qbeg, *qend;
-  struct loop *base_loop;
+  struct loop *base_loop, *target_loop;
   edge e;
 
   /* We pass through blocks back-reachable from FROM, testing whether some
@@ -214,12 +214,14 @@ fix_bb_placements (basic_block from,
  /* Subloop header, maybe move the loop upward.  */
  if (!fix_loop_placement (from->loop_father))
continue;
+ target_loop = loop_outer (from->loop_father);
}
   else
{
  /* Ordinary basic block.  */
  if (!fix_bb_placement (from))
continue;
+ target_loop = from->loop_father;
}
 
   FOR_EACH_EDGE (e, ei, from->succs)
@@ -248,9 +250,12 @@ fix_bb_placements (basic_block from,
  && (nca == base_loop
  || nca != pred->loop_father))
pred = pred->loop_father->header;
- else if (!flow_loop_nested_p (from->loop_father, pred->loop_father))
+ else if (!flow_loop_nested_p (target_loop, pred->loop_father))
{
- /* No point in processing it.  */
+ /* If PRED is already higher in the loop hierarchy than the
+TARGET_LOOP to that we moved FROM, the change of the position
+of FROM does not affect the position of PRED, so there is no
+point in processing it.  */
  continue;
}
 
--- gcc/testsuite/gcc.dg/pr47899.c.jj   2011-01-16 05:42:39.626675592 +0100
+++ gcc/testsuite/gcc.dg/pr47899.c  2011-03-02 13:23:02.675527008 +0100
@@ -0,0 +1,26 @@
+/* PR rtl-optimization/47899 */
+/* { dg-do compile } */
+/* { dg-options "-O -funroll-loops" } */
+
+extern unsigned int a, b, c;
+extern int d;
+
+static int
+foo (void)
+{
+lab:
+  if (b)
+for (d = 0; d >= 0; d--)
+  if (a || c)
+   for (; c; c++)
+ ;
+  else
+   goto lab;
+}
+
+int
+main ()
+{
+  foo ();
+  return 0;
+}

Jakub


Re: [2/2] Reducing the overhead of dwarf2 location tracking

2011-03-05 Thread Richard Sandiford
Jakub Jelinek  writes:
> On Fri, Mar 04, 2011 at 01:56:55PM +, Richard Sandiford wrote:
>>  * dwarf2out.c (dw_loc_list_node): Add resolved_addr and replaced.
>>  (cached_dw_loc_list_def): New structure.
>>  (cached_dw_loc_list): New typedef.
>>  (cached_dw_loc_list_table): New variable.
>>  (cached_dw_loc_list_table_hash): New function.
>>  (cached_dw_loc_list_table_eq): Likewise.
>>  (add_location_or_const_value_attribute): Take a bool cache_p.
>>  Cache the list when the parameter is true.
>>  (gen_formal_parameter_die): Update caller.
>>  (gen_variable_die): Likewise.
>>  (dwarf2out_finish): Likewise.
>>  (dwarf2out_function_decl): Clear cached_dw_loc_list_table.
>>  (dwarf2out_init): Initialize cached_dw_loc_list_table.
>>  (resolve_addr): Cache the result of resolving a chain of
>>  location lists.
>
> I think you should handle the cached_dw_loc_list_table in
> dwarf2out_abstract_function similarly to say decl_loc_table, i.e.
> save/clear for the duration of the of recursive dwarf2out_decl
> call, restore afterwards and in the places where you actually use
> it guard it also with cached_dw_loc_list_table != NULL.

OK, thanks for the pointer.  How does this look?  Bootstrapped
& regression-tested on x86_64-linux-gnu.

Richard


gcc/
* dwarf2out.c (dw_loc_list_node): Add resolved_addr and replaced.
(cached_dw_loc_list_def): New structure.
(cached_dw_loc_list): New typedef.
(cached_dw_loc_list_table): New variable.
(cached_dw_loc_list_table_hash): New function.
(cached_dw_loc_list_table_eq): Likewise.
(add_location_or_const_value_attribute): Take a bool cache_p.
Cache the list when the parameter is true.
(gen_formal_parameter_die): Update caller.
(gen_variable_die): Likewise.
(dwarf2out_finish): Likewise.
(dwarf2out_abstract_function): Nullify cached_dw_loc_list_table
while generating debug info for the decl.
(dwarf2out_function_decl): Clear cached_dw_loc_list_table.
(dwarf2out_init): Initialize cached_dw_loc_list_table.
(resolve_addr): Cache the result of resolving a chain of
location lists.

Index: gcc/dwarf2out.c
===
--- gcc/dwarf2out.c 2011-03-05 09:02:43.0 +
+++ gcc/dwarf2out.c 2011-03-05 09:09:46.0 +
@@ -4464,6 +4464,11 @@ typedef struct GTY(()) dw_loc_list_struc
   const char *section; /* Section this loclist is relative to */
   dw_loc_descr_ref expr;
   hashval_t hash;
+  /* True if all addresses in this and subsequent lists are known to be
+ resolved.  */
+  bool resolved_addr;
+  /* True if this list has been replaced by dw_loc_next.  */
+  bool replaced;
   bool emitted;
 } dw_loc_list_node;
 
@@ -6119,6 +6124,19 @@ typedef struct var_loc_list_def var_loc_
 /* Table of decl location linked lists.  */
 static GTY ((param_is (var_loc_list))) htab_t decl_loc_table;
 
+/* A cached location list.  */
+struct GTY (()) cached_dw_loc_list_def {
+  /* The DECL_UID of the decl that this entry describes.  */
+  unsigned int decl_id;
+
+  /* The cached location list.  */
+  dw_loc_list_ref loc_list;
+};
+typedef struct cached_dw_loc_list_def cached_dw_loc_list;
+
+/* Table of cached location lists.  */
+static GTY ((param_is (cached_dw_loc_list))) htab_t cached_dw_loc_list_table;
+
 /* A pointer to the base of a list of references to DIE's that
are uniquely identified by their tag, presence/absence of
children DIE's, and list of attribute/value pairs.  */
@@ -6479,7 +6497,7 @@ static void insert_int (HOST_WIDE_INT, u
 static void insert_double (double_int, unsigned char *);
 static void insert_float (const_rtx, unsigned char *);
 static rtx rtl_for_decl_location (tree);
-static bool add_location_or_const_value_attribute (dw_die_ref, tree,
+static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool,
   enum dwarf_attribute);
 static bool tree_add_const_value_attribute (dw_die_ref, tree);
 static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree);
@@ -8201,6 +8219,24 @@ lookup_decl_loc (const_tree decl)
 htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl));
 }
 
+/* Returns a hash value for X (which really is a cached_dw_loc_list_list).  */
+
+static hashval_t
+cached_dw_loc_list_table_hash (const void *x)
+{
+  return (hashval_t) ((const cached_dw_loc_list *) x)->decl_id;
+}
+
+/* Return nonzero if decl_id of cached_dw_loc_list X is the same as
+   UID of decl *Y.  */
+
+static int
+cached_dw_loc_list_table_eq (const void *x, const void *y)
+{
+  return (((const cached_dw_loc_list *) x)->decl_id
+ == DECL_UID ((const_tree) y));
+}
+
 /* Equate a DIE to a particular declaration.  */
 
 static void
@@ -16978,15 +17014,22 @@ fortran_common (tree decl, HOST_WIDE_INT
these things can crop up in other ways also.

[patch, moxie] Use newlib-stdint.h

2011-03-05 Thread Anthony Green
I just  checked in the attached patch to use newlib-stdint.h for
moxie-elf.  This fixes a few newer test cases that use macros like
__UINTPTR_TYPE__.

AG


2011-03-05  Anthony Green  

* config.gcc (moxie-*-elf): Add newlib-stdint.h to tmfile.


Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 170520)
+++ gcc/config.gcc  (working copy)
@@ -1008,7 +1008,7 @@
 moxie-*-elf)
gas=yes
gnu_ld=yes
-   tm_file="dbxelf.h elfos.h ${tm_file}"
+   tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
extra_parts="crti.o crtn.o crtbegin.o crtend.o"
tmake_file="${tmake_file} moxie/t-moxie moxie/t-moxie-softfp 
soft-fp/t-softfp"
;;


Re: [committed] Fix get_loop_body ICE (PR rtl-optimization/47899)

2011-03-05 Thread H.J. Lu
On Sat, Mar 5, 2011 at 6:35 AM, Jakub Jelinek  wrote:
> Hi!
>
> I've committed this patch of Zdenek to fix PR47899 after bootstrap/regtest
> on x86_64-linux and i686-linux to trunk, pre-approved in the PR.
> Zdenek, if you want to adjust the ChangeLog entry I've made up or use
> different e-mail address, just Change it in SVN.  kam.uniff.cz
> domain you've used in your last two commits doesn't resolve...
>
> 2011-03-05  Zdenek Dvorak  
>
>        PR rtl-optimization/47899
>        * cfgloopmanip.c (fix_bb_placements): Fix first argument
>        to flow_loop_nested_p when moving the loop upward.
>
>        * gcc.dg/pr47899.c: New test.
>

This caused:

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



-- 
H.J.


Re: [x32] PATCH: Use long long to check rt_sigreturn syscall

2011-03-05 Thread H.J. Lu
On Fri, Mar 04, 2011 at 03:50:07PM -0800, H.J. Lu wrote:
> Hi,
> 
> I checked this patch into x32 branch.
> 
> 
> H.J.
> ---
> commit f8dd1a34cd51d52589cac5833dbf60e99e258504
> Author: H.J. Lu 
> Date:   Fri Mar 4 15:22:45 2011 -0800
> 
> Use long long to check rt_sigreturn syscall.
> 
> diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
> index a3b7364..1bee1d9 100644
> --- a/gcc/ChangeLog.x32
> +++ b/gcc/ChangeLog.x32
> @@ -1,3 +1,8 @@
> +2011-03-04  H.J. Lu  
> +
> + * config/i386/linux-unwind.h (x86_64_fallback_frame_state): Use
> + long long to check rt_sigreturn syscall.
> +
>  2011-03-02  H.J. Lu  
>  
>   PR rtl-optimization/47958
> diff --git a/gcc/config/i386/linux-unwind.h b/gcc/config/i386/linux-unwind.h
> index c5f7ea0..11afd86 100644
> --- a/gcc/config/i386/linux-unwind.h
> +++ b/gcc/config/i386/linux-unwind.h
> @@ -45,7 +45,7 @@ x86_64_fallback_frame_state (struct _Unwind_Context 
> *context,
>  
>/* movq __NR_rt_sigreturn, %rax ; syscall  */
>if (*(unsigned char *)(pc+0) == 0x48
> -  && *(unsigned long *)(pc+1) == 0x050f000fc0c7)
> +  && *(unsigned long long *)(pc+1) == 0x050f000fc0c7ULL)
>  {
>struct ucontext *uc_ = context->cfa;
>/* The void * cast is necessary to avoid an aliasing warning.

This isn't right since x32 has a different system call number.  I
checked in this patch.


H.J.
--
diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 1bee1d9..5389f19 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,3 +1,8 @@
+2011-03-05  H.J. Lu  
+
+   * config/i386/linux-unwind.h (x86_64_fallback_frame_state):
+   Support x32 system call.
+
 2011-03-04  H.J. Lu  
 
* config/i386/linux-unwind.h (x86_64_fallback_frame_state): Use
diff --git a/gcc/config/i386/linux-unwind.h b/gcc/config/i386/linux-unwind.h
index 11afd86..a9ddb7e 100644
--- a/gcc/config/i386/linux-unwind.h
+++ b/gcc/config/i386/linux-unwind.h
@@ -43,9 +43,15 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context,
   struct sigcontext *sc;
   long new_cfa;
 
-  /* movq __NR_rt_sigreturn, %rax ; syscall  */
+  /* movq __NR_rt_sigreturn, %rax ; syscall.  FIXME: x32 system call
+ number may change.  */
+#ifdef __LP64__
+#define RT_SIGRETURN_SYSCALL   0x050f000fc0c7ULL
+#else
+#define RT_SIGRETURN_SYSCALL   0x050f100fc0c7ULL
+#endif
   if (*(unsigned char *)(pc+0) == 0x48
-  && *(unsigned long long *)(pc+1) == 0x050f000fc0c7ULL)
+  && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL)
 {
   struct ucontext *uc_ = context->cfa;
   /* The void * cast is necessary to avoid an aliasing warning.


Re: avoid useless if-before-free tests

2011-03-05 Thread Joseph S. Myers
On Sat, 5 Mar 2011, Jim Meyering wrote:

> diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
> index 7a7e840..8993fc7 100644
> --- a/gcc/config/i386/gmm_malloc.h
> +++ b/gcc/config/i386/gmm_malloc.h
> @@ -67,8 +67,7 @@ _mm_malloc (size_t size, size_t align)
>  static __inline__ void
>  _mm_free (void * aligned_ptr)
>  {
> -  if (aligned_ptr)
> -free (((void **) aligned_ptr) [-1]);
> +  free (((void **) aligned_ptr) [-1]);
>  }

This one looks suspicious; it's not if (p) free (p); but if (p) free 
(something-derived-from-p);.

> diff --git a/libjava/classpath/native/fdlibm/dtoa.c 
> b/libjava/classpath/native/fdlibm/dtoa.c
> index 458e629..92aa793 100644

http://gcc.gnu.org/codingconventions.html says Classpath changes should go 
via Classpath upstream, not directly into GCC.  I don't know if that's 
still accurate.

> diff --git a/zlib/contrib/minizip/unzip.c b/zlib/contrib/minizip/unzip.c
> index 9ad4766..644ef1b 100644

We definitely don't want to make local changes to zlib for this sort of 
issue, though importing a new upstream version of zlib (making sure the 
local configure code still works) should be fine for 4.7.

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


Re: avoid useless if-before-free tests

2011-03-05 Thread Joseph S. Myers
On Sat, 5 Mar 2011, Jim Meyering wrote:

> diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
> index 6faac57..ba3cc9a 100644

Sorry, missed these in the first pass; intl/ is another case where we 
wouldn't want to patch this locally.  An import of updated libintl from 
newer upstream gettext would be fine for 4.7, with local changes merged as 
needed, but may be quite involved given how old the present copy is.

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


Update contrib/gennews for GCC 4.6

2011-03-05 Thread Joseph S. Myers
I've applied this patch to update contrib/gennews to include the release 
notes files for GCC 4.6.

Index: ChangeLog
===
--- ChangeLog   (revision 170703)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2011-03-05  Joseph Myers  
+
+   * gennews (files): Add files for GCC 4.6.
+
 2011-01-26  Dave Korn  
 
* patch_tester.sh (nopristinecache): New shell var, set according
Index: gennews
===
--- gennews (revision 170703)
+++ gennews (working copy)
@@ -3,7 +3,7 @@
 # Script to generate the NEWS file from online release notes.
 # Contributed by Joseph Myers .
 #
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010, 2011
 # Free Software Foundation, Inc.
 # This file is part of GCC.
 #
@@ -24,6 +24,7 @@
 
 website=http://gcc.gnu.org/
 files="
+gcc-4.6/index.html gcc-4.6/changes.html
 gcc-4.5/index.html gcc-4.5/changes.html
 gcc-4.4/index.html gcc-4.4/changes.html
 gcc-4.3/index.html gcc-4.3/changes.html

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


Re: [Patch] PR c++/26256

2011-03-05 Thread Jason Merrill

On 03/04/2011 03:11 AM, Fabien Chêne wrote:

Hmm, I've implemented what you were suggesting, and I don't understand
the following check in supplement_binding:

else if (TREE_CODE (bval) == TYPE_DECL&&  DECL_ARTIFICIAL (bval))
 {
   /* The old binding was a type name.  It was placed in
 VALUE field because it was thought, at the point it was
 declared, to be the only entity with such a name.  Move the
 type name into the type slot; it is now hidden by the new
 binding.  */
   binding->type = bval;
   binding->value = decl;
   binding->value_is_inherited = false;
 }

Why is it usefull ? It prevents the following illegal code from being rejected:

struct A
{
 struct type {};
 typedef int type;
};


That's a bug.  I guess the check above needs to make sure that decl is 
not a TYPE_DECL.


Jason


New German PO file for 'gcc' (version 4.6-b20101218)

2011-03-05 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the German team of translators.  The file is available at:

http://translationproject.org/latest/gcc/de.po

(This file, 'gcc-4.6-b20101218.de.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




[committed] Fix pr47975.c test compilation on hppa*-*-hpux*

2011-03-05 Thread John David Anglin
On hppa*-*-hpux*, we can't use common for a vector size of 32 due to alignment
limitiations.  Tested on hppa2.0w-hp-hpux11.11.  Committed to trunk.

Dave
-- 
J. David Anglin  dave.ang...@nrc-cnrc.gc.ca
National Research Council of Canada  (613) 990-0752 (FAX: 952-6602)

2011-03-05  John David Anglin  

* gcc.dg/torture/pr47975.c: Add -fno-common option on hppa*-*-hpux*.

Index: gcc.dg/torture/pr47975.c
===
--- gcc.dg/torture/pr47975.c(revision 170674)
+++ gcc.dg/torture/pr47975.c(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-options "-fno-common" { target { hppa*-*-hpux* } } } */
 
 int __attribute__ ((vector_size (32))) x;
 


Re: RFC: C++0x ABI PATCH to decltype handling

2011-03-05 Thread Jason Merrill

On 02/23/2011 11:56 PM, Jason Merrill wrote:

Perhaps so; I'm not sure what the right answer is for the default ABI
version. For now I've just made these changes ABI v6, and I'm checking
in this patch.


It occurred to me that the change in v5 hadn't been released yet, so 
I've changed these to be v5 as well.
commit 352205fb0f842552dde98fd887638f62586bf4ef
Author: Jason Merrill 
Date:   Sat Mar 5 17:35:19 2011 -0500

* mangle.c (write_expression): Change ABI v6 to v5.
(write_type): Likewise.

diff --git a/gcc/common.opt b/gcc/common.opt
index 2717b11..c2f2d6c 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -739,13 +739,12 @@ Driver Undocumented
 ;in template non-type arguments of pointer type.
 ;
 ; 4: The version of the ABI that introduces unambiguous mangling of
-;vector types.
+;vector types.  First selectable in G++ 4.5.
 ;
 ; 5: The version of the ABI that ignores attribute const/noreturn
-;in function pointer mangling.
-;
-; 6: The version of the ABI that corrects mangling of decltype and
+;in function pointer mangling, and corrects mangling of decltype and
 ;function parameters used in other parameters and the return type.
+;First selectable in G++ 4.6.
 ;
 ; Additional positive integers will be assigned as new versions of
 ; the ABI become the default version of the ABI.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 1984094..0297a2a 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1934,8 +1934,8 @@ write_type (tree type)
  gcc_assert (!DECLTYPE_FOR_LAMBDA_CAPTURE (type)
  && !DECLTYPE_FOR_LAMBDA_RETURN (type));
 
- /* In ABI <6, we stripped decltype of a plain decl.  */
- if (!abi_version_at_least (6)
+ /* In ABI <5, we stripped decltype of a plain decl.  */
+ if (!abi_version_at_least (5)
  && DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (type))
{
  tree expr = DECLTYPE_TYPE_EXPR (type);
@@ -2498,7 +2498,7 @@ write_expression (tree expr)
   write_char ('f');
   if (delta != 0)
{
- if (abi_version_at_least (6))
+ if (abi_version_at_least (5))
{
  /* Let L be the number of function prototype scopes from the
 innermost one (in which the parameter reference occurs) up
commit a2f33d5e8edd5fea6e2457abafdb172262762eac
Author: Jason Merrill 
Date:   Sat Mar 5 19:42:41 2011 -0500

* doc/invoke.texi (C++ Dialect Options): Document ABI v5.

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index e642c39..6c4d633 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1846,6 +1846,10 @@ template argument.
 
 Version 4 implements a standard mangling for vector types.
 
+Version 5 corrects the mangling of attribute const/volatile on
+function pointer types, decltype of a plain decl, and use of a
+function parameter in the declaration of another parameter.
+
 See also @option{-Wabi}.
 
 @item -fno-access-control
diff --git a/gcc/testsuite/g++.dg/abi/mangle39.C 
b/gcc/testsuite/g++.dg/abi/mangle39.C
index 7b2ee01..2896356 100644
--- a/gcc/testsuite/g++.dg/abi/mangle39.C
+++ b/gcc/testsuite/g++.dg/abi/mangle39.C
@@ -1,5 +1,5 @@
 // PR c++/42338
-// { dg-options "-std=c++0x -fabi-version=6" }
+// { dg-options "-std=c++0x -fabi-version=5" }
 // { dg-final { scan-assembler "_Z1fIPiEDTcmppfp_Li0EET_" } }
 // { dg-final { scan-assembler "_Z1gIiEvRK1AIT_EDTixfL0p_Li0EE" } }
 
diff --git a/gcc/testsuite/g++.dg/abi/mangle45.C 
b/gcc/testsuite/g++.dg/abi/mangle45.C
index a4df773..3ce9abc 100644
--- a/gcc/testsuite/g++.dg/abi/mangle45.C
+++ b/gcc/testsuite/g++.dg/abi/mangle45.C
@@ -1,5 +1,5 @@
 // Testcase for mangling of parameters used other than in a trailing return 
type
-// { dg-options "-std=c++0x -fabi-version=6" }
+// { dg-options "-std=c++0x -fabi-version=5" }
 
 template void f(T p, decltype(p)) { }// L = 1
 template void g(T p, decltype(p) (*)()) { }  // L = 1
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing1.C 
b/gcc/testsuite/g++.dg/cpp0x/trailing1.C
index b36d1aa..f637857 100644
--- a/gcc/testsuite/g++.dg/cpp0x/trailing1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing1.C
@@ -1,5 +1,5 @@
 // Tests for late-specified return type.
-// { dg-options "-std=c++0x -fabi-version=6" }
+// { dg-options "-std=c++0x -fabi-version=5" }
 
 auto f() -> int
 {


Re: Ping^2 Re: Fix front end specs for -save-temps=

2011-03-05 Thread Jason Merrill

On 03/01/2011 03:56 PM, Mike Stump wrote:

On Mar 1, 2011, at 11:51 AM, Joseph S. Myers wrote:

Ping^2.  This patch
  is pending
review of the C++ front-end part.


As I recall, having C++ in the subject line, or cc Jason can be used to to 
route faster to him...


Indeed.  OK.

Jason