Re: [v3] libstdc++/49829

2012-01-25 Thread Dominique Dhumieres
Revision 183457 breaks bootstrap on darwin (pr51985).

TIA

Dominique


[PATCH] Handle non-volatile GIMPLE_ASM in get_references_in_stmt (PR tree-optimization/51987)

2012-01-25 Thread Jakub Jelinek
Hi!

The s390 glibc (_itoa function in particular) is miscompiled because
pcom pass changes:
  __asm__(lr %N0,%1
mr %0,%2 : =r __x.__ll : r ti_10, r s1_12);
  __w1_15 = __x.__i.__h;
into:
  __x___i___h_lsm0.28_34 = __x.__i.__h;
...
  __asm__(lr %N0,%1
mr %0,%2 : =r __x.__ll : r ti_10, r s1_12);
  __w1_15 = __x___i___h_lsm0.28_34;
(where __x is a non-addressable union var of a DImode __ll and a struct of
two SImode __i.__{l,h}.  The problem is in get_references_in_stmt:
  /* ASM_EXPR and CALL_EXPR may embed arbitrary side effects.
 Calls have side-effects, except those to const or pure
 functions.  */
  if ((stmt_code == GIMPLE_CALL
!(gimple_call_flags (stmt)  (ECF_CONST | ECF_PURE)))
  || (stmt_code == GIMPLE_ASM
   gimple_asm_volatile_p (stmt)))
clobbers_memory = true;
is the only place where it handles asm (but the testcase doesn't have
it volatile) and otherwise ignores all the references.

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

BTW, not sure about non-volatile asm that has memory clobber, maybe
the above snippet should be changed into:
  || (stmt_code == GIMPLE_ASM
   (gimple_asm_volatile_p (stmt)
  || gimple_asm_clobbers_memory_p (stmt)))

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

PR tree-optimization/51987
* tree-data-ref.c (get_references_in_stmt): Handle references in
non-volatile GIMPLE_ASM.

* gcc.target/i386/pr51987.c: New test.

--- gcc/tree-data-ref.c.jj  2011-11-28 17:58:04.0 +0100
+++ gcc/tree-data-ref.c 2012-01-24 22:33:18.995077693 +0100
@@ -1,5 +1,5 @@
 /* Data references and dependences detectors.
-   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Sebastian Pop p...@cri.ensmp.fr
 
@@ -4226,6 +4226,35 @@ get_references_in_stmt (gimple stmt, VEC
}
}
 }
+  else if (stmt_code == GIMPLE_ASM)
+{
+  unsigned i;
+  /* Inputs may perform loads.  */
+  for (i = 0; i  gimple_asm_ninputs (stmt); ++i)
+   {
+ op1 = TREE_VALUE (gimple_asm_input_op (stmt, i));
+ if (DECL_P (*op1)
+ || (REFERENCE_CLASS_P (*op1)  get_base_address (*op1)))
+   {
+ ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
+ ref-pos = op1;
+ ref-is_read = true;
+   }
+   }
+  /* Outputs may perform stores.  */
+  for (i = 0; i  gimple_asm_noutputs (stmt); ++i)
+   {
+ op0 = TREE_VALUE (gimple_asm_output_op (stmt, i));
+ if (DECL_P (*op0)
+ || (REFERENCE_CLASS_P (*op0)  get_base_address (*op0)))
+   {
+ ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
+ ref-pos = op0;
+ ref-is_read = false;
+   }
+   }
+  return clobbers_memory;
+}
   else
 return clobbers_memory;
 
--- gcc/testsuite/gcc.target/i386/pr51987.c.jj  2012-01-24 23:32:44.887896707 
+0100
+++ gcc/testsuite/gcc.target/i386/pr51987.c 2012-01-24 23:34:26.289296794 
+0100
@@ -0,0 +1,33 @@
+/* PR tree-optimization/51987 */
+/* { dg-do run { target { ! { ia32 } } } } */
+/* { dg-options -O3 } */
+
+extern void abort (void);
+union U { unsigned long long l; struct { unsigned int l, h; } i; };
+
+__attribute__((noinline, noclone)) void
+foo (char *x, char *y)
+{
+  int i;
+  for (i = 0; i  64; i++)
+{
+  union U u;
+  asm (movl %1, %k0; salq $32, %0 : =r (u.l) : r (i));
+  x[i] = u.i.h;
+  union U v;
+  asm (movl %1, %k0; salq $32, %0 : =r (v.l) : r (i));
+  y[i] = v.i.h;
+}
+}
+
+int
+main ()
+{
+  char a[64], b[64];
+  int i;
+  foo (a, b);
+  for (i = 0; i  64; i++)
+if (a[i] != i || b[i] != i)
+  abort ();
+  return 0;
+}

Jakub


[PATCH] Fix -free ICE on powerpc64 (PR tree-optimization/51987)

2012-01-25 Thread Jakub Jelinek
Hi!

On powerpc64-linux the ext-elim-1.c testcase started failing,
becuase we have there an insn with a sign (or was it zero?) extension
in a parallel with setting flags.  Via note_stores it happily accepts
the insn as an candidate, but later on assumes the sign extension
must be right in the insn pattern by passing PATTERN of the insn
as set_pat on which we do XEXP (SET_SRC (set_pat), 0).
The following patch fixes it by passing curr_cand-expr (i.e. the
sign/zero extending set we've found earlier) as set_pat, and
additionally just uses single_set instead of note_stores to find the
candidates - we don't try to understand what the other sets in
the pattern do and e.g. removing an insn that has an unneeded
extension but also sets flags or something similar based on it
and something actually uses them would result in wrong-code.

Bootstrapped/regtested on x86_64-linux and i686-linux, tested on
powerpc64-linux on the testcase.  Ok for trunk?

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

PR rtl-optimization/51978
* ree.c (make_defs_and_copies_lists): Change set_pat type
to const_rtx.
(combine_reaching_defs): Likewise.
(struct re_info): Remove.
(add_removable_extension): Remove x and data arguments,
add insn, insn_list and def_map.  Use the arguments directly
instead of using struct re_info.
(find_removable_extensions): Don't call add_removable_extension
through note_stores, instead just call it with single_set
result if non-NULL.
(find_and_remove_re): Pass curr_cand-expr instead of
PATTERN (curr_cand-insn) as set_pat argument to
combine_reaching_defs.

--- gcc/ree.c.jj2012-01-23 18:23:55.0 +0100
+++ gcc/ree.c   2012-01-24 23:47:15.539731021 +0100
@@ -523,7 +523,7 @@ typedef struct ext_state
success.  */
 
 static bool
-make_defs_and_copies_lists (rtx extend_insn, rtx set_pat,
+make_defs_and_copies_lists (rtx extend_insn, const_rtx set_pat,
ext_state *state)
 {
   rtx src_reg = XEXP (SET_SRC (set_pat), 0);
@@ -651,7 +651,7 @@ merge_def_and_ext (ext_cand *cand, rtx d
and false upon failure.  */
 
 static bool
-combine_reaching_defs (ext_cand *cand, rtx set_pat, ext_state *state)
+combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
 {
   rtx def_insn;
   bool merge_successful = true;
@@ -742,27 +742,13 @@ combine_reaching_defs (ext_cand *cand, r
   return false;
 }
 
-/* This structure holds information while walking the RTL stream.  */
-
-struct re_info
-{
-  /* The current insn.  */
-  rtx insn;
-
-  /* The list of candidates.  */
-  VEC (ext_cand, heap) *insn_list;
-
-  /* The map of definition instructions to candidates.  */
-  ext_cand **def_map;
-};
-
-/* Add an extension pattern that could be eliminated.  This is called via
-   note_stores from find_removable_extensions.  */
+/* Add an extension pattern that could be eliminated.  */
 
 static void
-add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data)
+add_removable_extension (const_rtx expr, rtx insn,
+VEC (ext_cand, heap) **insn_list,
+ext_cand **def_map)
 {
-  struct re_info *rei = (struct re_info *)data;
   enum rtx_code code;
   enum machine_mode mode;
   rtx src, dest;
@@ -785,13 +771,13 @@ add_removable_extension (rtx x ATTRIBUTE
   ext_cand *cand;
 
   /* First, make sure we can get all the reaching definitions.  */
-  defs = get_defs (rei-insn, XEXP (src, 0), NULL);
+  defs = get_defs (insn, XEXP (src, 0), NULL);
   if (!defs)
{
  if (dump_file)
{
  fprintf (dump_file, Cannot eliminate extension:\n);
- print_rtl_single (dump_file, rei-insn);
+ print_rtl_single (dump_file, insn);
  fprintf (dump_file,  because of missing definition(s)\n);
}
  return;
@@ -800,13 +786,13 @@ add_removable_extension (rtx x ATTRIBUTE
   /* Second, make sure the reaching definitions don't feed another and
 different extension.  FIXME: this obviously can be improved.  */
   for (def = defs; def; def = def-next)
-   if ((cand = rei-def_map[INSN_UID(DF_REF_INSN (def-ref))])
+   if ((cand = def_map[INSN_UID(DF_REF_INSN (def-ref))])
 (cand-code != code || cand-mode != mode))
  {
if (dump_file)
  {
fprintf (dump_file, Cannot eliminate extension:\n);
-   print_rtl_single (dump_file, rei-insn);
+   print_rtl_single (dump_file, insn);
fprintf (dump_file,  because of other extension\n);
  }
return;
@@ -814,14 +800,14 @@ add_removable_extension (rtx x ATTRIBUTE
 
   /* Then add the candidate to the list and insert the reaching definitions
  into the definition map.  */
-  cand = VEC_safe_push (ext_cand, heap, rei-insn_list, NULL);
+  cand = 

incorrect composite_type result for pointers with mode

2012-01-25 Thread Tristan Gingold
Hi,

composite_type doesn't consider the pointer mode when creating a pointer.
As a consequence:

type char *p32 __attribute__((mode (SI));
type char *p32 __attribute__((mode (SI));

creates a 64-bit pointers (on ia64-hp-openvms and certainly some other 
configuration).
This breaks some compiler builds (depending on the build options).

As far as I know, this is not a regression, so it may not qualify for a stage 4 
submission.

Tristan.

2012-01-25  Tristan Gingold  ging...@adacore.com

* c-typeck.c (composite_type): Keep mode for pointers.

diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index b696e5e..2e33763 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -394,7 +394,7 @@ composite_type (tree t1, tree t2)
tree pointed_to_1 = TREE_TYPE (t1);
tree pointed_to_2 = TREE_TYPE (t2);
tree target = composite_type (pointed_to_1, pointed_to_2);
-   t1 = build_pointer_type (target);
+   t1 = build_pointer_type_for_mode (target, TYPE_MODE (t1), false);
t1 = build_type_attribute_variant (t1, attributes);
return qualify_type (t1, t2);
   }



Re: [libitm] Link eh-1.exe with -shared-libgcc on Solaris (PR libitm/51822)

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

 The eh-1.o reference to _Unwind_Resume drags in one copy of the unwinder
 from libgcc_eh.a, while libstdc++.so is linked against libgcc_s.so.1,
 providing another copy.

 So... are we linking with the gcc binary, not the g++ binary?

Right.  This was just copied over from libgomp, like most of the libitm
build and test framework.

 Because I thought -shared-libgcc is the default for C++.

Indeed: manually replacing xgcc with g++ in the link line fixes the
test, and is certainly far better than a per-platform per-test
workaround.

I'll see what it takes to properly fix that.

 If this goes too far down a rat-hole, your original patch is ok.

Thanks.
Rainer

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


Re: PR lto/51698 and the state of LTO + transactional memory

2012-01-25 Thread Richard Guenther
On Wed, Jan 25, 2012 at 12:16 AM, Aldy Hernandez al...@redhat.com wrote:
 The problem here is that -flto cannot equate the instrumentation functions
 being generated with a user supplied version of the library functions.  This
 would happen if the user tried to link a transactional program with libitm
 with -flto (as in -fwhole-program, etc).

 This is an easy problem to fix, just by changing DEF_TM_BUILTIN to set
 BOTH_P so the __builtin_ITM_* variants and _ITM_* are considered the same.

 In doing so, I noticed that there are a myriad of _ITM_* builtins that have
 incorrect prototypes as defined in the builtins*.def files.  So using
 libitm/libitm.h fails miserably because of mismatches.  The attached patch
 fixes all problems, and the PR.

 However...

 Looking at the generated code, I've noticed that LTO isn't inlining the TM
 builtins as one would expect.  This is a two-fold problem:

 First, LTO streaming happens before the final TM lowering (tmmark pass), so
 there is nothing to inline.  The instrumented function calls (_ITM_RU4, et
 al), aren't generated until after LTO.

Which means they are not available for inlining without LTO either ...
(unless you mark them to be always inlined, in which case the inline
transform, which happens first at local after-IPA passes, probably
still inlines it - but that should work at LTRANS stage as well).

 Second, it seems that by design, LTO prefers builtins to user-provided
 versions of them.  In particular, lto_symtab_prevailing_decl() stipulates
 that builtins are their own prevailing decl.  So even if we lowered TM
 before LTO streaming, user provided builtins wouldn't be preferred (and thus
 inlined) as we would expect into application code.

Hmm, so you say you have sth like

void *memcpy(void *dst, void *src, size_t n) { ...implementation... }
void foo()
{
  memcpy (...);
}

and expect it to be inlined from the supplied body instead of using the
builtin expander?

I think we could make this work ... at least under a sort-of ODR, that
all bodies (from different TUs) and the builtin have the same behavior.

Mind to file an enhancement bug?  Does it work without LTO?

 Though I don't think fixing LTO of instrumented TM code is 4.7 material, I
 thought I'd write this up for the record.

 With regards to the first problem, the reason we lower TM so late (in
 contrast to openmp) is because we were hoping to get good optimization of
 the memory operations before fudging them all up.  So at some point we
 should decide what's the biggest gain, deeper optimization of the memory
 operations or the ability to inline the instrumentation.  Or perhaps,
 whether we can simply move the LTO streaming point under certain conditions
 and get both.

I think that lowering at ipa_tm time should be good enough for scalar
code optimizations, but it will surely fuck up loop optimizations galore
(you might want to try).

Richard.

 With regards to the second problem, I suppose I should tackle #1 first, but
 I would be curious if the LTO experts could weigh in here.

 The attached patch fixes the ICE in the PR, though it won't do what the user
 ultimately wants to do, given the limitations described.  Perhaps we could
 create another PR and tag it with an enhancement request.

 OK pending tests?

 Aldy

 p.s. Oh, and btw, does this all make sense?


[patch libffi]: Add support for fastcall/thiscall to x86 variant of libffi for PR 51500

2012-01-25 Thread Kai Tietz
Hello,

this patch adds required support for thiscall/fastcall
calling-convention of x86 Windows.  It is a prerequisit for fixing PR
libgcj/51500 for 32-bit Windows.  The default-calling-convention for
C++ none-static and none-variadic class-members is changed by 4.7 to
thiscall as described by vendors ABI defintion.

2012-01-25  Kai Tietz  kti...@redhat.com

* src/libffi/src/x86/ffi.c (ffi_call_win32): Add new
argument to prototype for specify calling-convention.
(ffi_call): Add support for stdcall/thiscall convention.
(ffi_raw_call): Likewise.
* src/x86/ffitarget.h (ffi_abi): Add FFI_THISCALL and
FFI_FASTCALL.
* src/x86/win32.S (_ffi_call_win32): Add support for
fastcall/thiscall calling-convention calls.

Tested for i686-w64-mingw32 and i686-pc-cygwin.  Ok for apply?

Regards,
Kai
ChangeLog

2012-01-25  Kai Tietz  kti...@redhat.com

* src/libffi/src/x86/ffi.c (ffi_call_win32): Add new
argument to prototype for specify calling-convention.
(ffi_call): Add support for stdcall/thiscall convention.
(ffi_raw_call): Likewise.
* src/x86/ffitarget.h (ffi_abi): Add FFI_THISCALL and
FFI_FASTCALL.
* src/x86/win32.S (_ffi_call_win32): Add support for
fastcall/thiscall calling-convention calls.

Index: gcc/libffi/src/x86/ffi.c
===
--- gcc.orig/libffi/src/x86/ffi.c
+++ gcc/libffi/src/x86/ffi.c
@@ -252,7 +252,7 @@ ffi_call_win64(void (*)(char *, extended
 #elif defined(X86_WIN32)
 extern void
 ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *,
-   unsigned, unsigned, unsigned *, void (*fn)(void));
+   unsigned, unsigned, unsigned, unsigned *, void (*fn)(void));
 #else
 extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *,
   unsigned, unsigned, unsigned *, void (*fn)(void));
@@ -316,8 +316,23 @@ void ffi_call(ffi_cif *cif, void (*fn)(v
 #elif defined(X86_WIN32)
 case FFI_SYSV:
 case FFI_STDCALL:
-  ffi_call_win32(ffi_prep_args, ecif, cif-bytes, cif-flags,
- ecif.rvalue, fn);
+case FFI_THISCALL:
+case FFI_FASTCALL:
+  {
+   unsigned int abi = cif-abi;
+   size_t sz = 0;
+   unsigned int i;
+
+   for (i=0; i  cif-nargs  sz  8;i++)
+ sz += (cif-arg_types[i]-size + 3)  ~3;
+   if (sz = 4  cif-nargs = 1
+abi == FFI_FASTCALL)
+ abi = FFI_THISCALL;
+   if (!sz  cif-nargs == 0  abi == FFI_THISCALL)
+ abi = FFI_STDCALL;
+ffi_call_win32(ffi_prep_args, ecif, abi, cif-bytes, cif-flags,
+   ecif.rvalue, fn);
+  }
   break;
 #else
 case FFI_SYSV:
@@ -644,8 +659,22 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(vo
 #ifdef X86_WIN32
 case FFI_SYSV:
 case FFI_STDCALL:
-  ffi_call_win32(ffi_prep_args_raw, ecif, cif-bytes, cif-flags,
- ecif.rvalue, fn);
+case FFI_THISCALL:
+case FFI_FASTCALL:
+  {
+unsigned int abi = cif-abi;
+size_t sz = 0;
+unsigned int i;
+
+for (i=0; i  cif-nargs  sz  8;i++)
+  sz += (cif-arg_types[i]-size + 3)  ~3;
+if (sz = 4  cif-nargs  2  abi == FFI_FASTCALL)
+  abi = FFI_THISCALL;
+if (!sz  cif-nargs == 0  abi == FFI_THISCALL)
+  abi = FFI_STDCALL;
+ffi_call_win32(ffi_prep_args, ecif, abi, cif-bytes, cif-flags,
+   ecif.rvalue, fn);
+  }
   break;
 #else
 case FFI_SYSV:
Index: gcc/libffi/src/x86/ffitarget.h
===
--- gcc.orig/libffi/src/x86/ffitarget.h
+++ gcc/libffi/src/x86/ffitarget.h
@@ -64,6 +64,8 @@ typedef enum ffi_abi {
 #ifdef X86_WIN32
   FFI_SYSV,
   FFI_STDCALL,
+  FFI_THISCALL,
+  FFI_FASTCALL,
   /* TODO: Add fastcall support for the sake of completeness */
   FFI_DEFAULT_ABI = FFI_SYSV,
 #endif
Index: gcc/libffi/src/x86/win32.S
===
--- gcc.orig/libffi/src/x86/win32.S
+++ gcc/libffi/src/x86/win32.S
@@ -45,6 +45,7 @@ _TEXT SEGMENT
 ffi_call_win32 PROC NEAR,
 ffi_prep_args : NEAR PTR DWORD,
 ecif  : NEAR PTR DWORD,
+cif_abi   : DWORD,
 cif_bytes : DWORD,
 cif_flags : DWORD,
 rvalue: NEAR PTR DWORD,
@@ -64,6 +65,19 @@ ffi_call_win32 PROC NEAR,
 ;; Return stack to previous state and call the function
 add  esp, 8
 
+   ;; Handle thiscall and fastcall
+   cmp cif_abi, 3 ;; FFI_THISCALL
+   jz do_thiscall
+   cmp cif_abi, 4 ;; FFI_FASTCALL
+   jnz do_stdcall
+   mov ecx, DWORD PTR [esp]
+   mov edx, DWORD PTR [esp+4]
+   add esp, 8
+   jmp do_stdcall
+do_thiscall:
+   mov ecx, DWORD PTR [esp]
+   add esp, 4
+do_stdcall:
 call fn
 
 ;; cdecl:   we restore esp in the epilogue, so there's no need to

Re: [PATCH] Handle non-volatile GIMPLE_ASM in get_references_in_stmt (PR tree-optimization/51987)

2012-01-25 Thread Jakub Jelinek
On Wed, Jan 25, 2012 at 10:49:27AM +0100, Richard Guenther wrote:
 I wonder if it's worth handling asms in any fancy way here, considering
 that data-ref analysis happily punts on them completely.  Thus, why
 not change the above to
 
   || stmt_code == GIMPLE_ASM)

I think asm (... : +r (x)); and similar are sufficiently common that
it is worth doing something at least for those.
Thus, I'd be fine with say
  (stmt_code == GIMPLE_ASM
(gimple_asm_volatile_p (stmt) || gimple_vuse (stmt)))
and don't do anything about the operands.
That would handle the gimple_asm_clobbers_memory_p case, or the case in this
PR, etc.
Would you be ok with that instead?  That would be a conservative fix
for this stage.

 ?  That sounds more safe for this stage anyway (does a volatile
 asm really clobber memory even if you don't explicitely say so?
 At least the operand scanner won't add virtual operands just because of 
 that, so the check looks bogus anyway).

Given that asm volatile should act like an optimization barrier, I think it
is desirable to punt on them even when they don't have memory operands.

 Btw, there are numerous callers of get_references_in_stmt that
 do not check its return value ... (and I think it misses a
 return value kind that tells the vector of references may be incomplete,
 like in the ASM kind right now).

Incomplete should be signalled by returning true I'd say, that means beyond
the listed ones it accesses some others too.

 Btw, get_references_in_stmt should probably use walk_stmt_load_store_ops,
 so we have a single place where we put knowledge where memory references
 can occur.

Probably, but wouldn't that be a 4.8 material?

Jakub


[Patch,AVR]: Rename address spaces

2012-01-25 Thread Georg-Johann Lay
This patch renames the named address spaces from their initial draft names to
their final names as proposed by several developers, amongst them Eric.

* Using __flash will make porting to/from other compilers easier.
* __flash is more descriptive than the meaningless __pgm.
* __pgm might lead to confusion with the pgm_ macros from avr-libc.

The 24-bit address space is named differently: It's renamed to __memx to point
out its difference to the other spaces that only address flash.

The patch not only renames the address spaces (which would just change the 7
strings in avr.c:avr_addrspace) but also renames some identifiers, function
names, enums etc. so that they are kept in sync with the new names is most 
places.

Ok for trunk?

PR target/49868
Rename __pgm to __flash.
Rename __pgm1 to __flash1.
Rename __pgm2 to __flash2.
Rename __pgm3 to __flash3.
Rename __pgm4 to __flash4.
Rename __pgm5 to __flash5.
Rename __pgmx to __memx.
* doc/extend.texi (AVR Named Address Spaces)
Rename address space names as indicated above.
* config/avr/avr.c (avr_addrspace): Ditto.

* config/avr/avr-protos.h
(avr_mem_pgmx_p): Rename to avr_mem_memx_p.
(avr_mem_pgm_p): Rename to avr_mem_flash_p.
* config/avr/predicates.md: Ditto.
* config/avr/avr.c Ditto, and
(avr_decl_pgmx_p): Rename to avr_decl_memx_p.
(avr_decl_pgm_p): Rename to avr_decl_flash_p.

* config/avr/avr.h (ADDR_SPACE_PGM): Rename to ADDR_SPACE_FLASH.
(ADDR_SPACE_PGM1): Rename to ADDR_SPACE_FLASH1.
(ADDR_SPACE_PGM2): Rename to ADDR_SPACE_FLASH2.
(ADDR_SPACE_PGM3): Rename to ADDR_SPACE_FLASH3.
(ADDR_SPACE_PGM4): Rename to ADDR_SPACE_FLASH4.
(ADDR_SPACE_PGM5): Rename to ADDR_SPACE_FLASH5.
(ADDR_SPACE_PGMX): Rename to ADDR_SPACE_MEMX.
* config/avr/avr.c: Ditto.
* config/avr/avr.md: Ditto.
Index: doc/extend.texi
===
--- doc/extend.texi	(revision 183473)
+++ doc/extend.texi	(working copy)
@@ -1244,38 +1244,38 @@ needed to locate read-only data in flash
 without using (inline) assembler code.
 
 @table @code
-@item __pgm
-@cindex @code{__pgm} AVR Named Address Spaces
-The @code{__pgm} qualifier will locate data in the
+@item __flash
+@cindex @code{__flash} AVR Named Address Spaces
+The @code{__flash} qualifier will locate data in the
 @code{.progmem.data} section. Data will be read using the @code{LPM}
 instruction. Pointers to this address space are 16 bits wide.
 
-@item __pgm1
-@item __pgm2
-@item __pgm3
-@item __pgm4
-@item __pgm5
-@cindex @code{__pgm1} AVR Named Address Spaces
-@cindex @code{__pgm2} AVR Named Address Spaces
-@cindex @code{__pgm3} AVR Named Address Spaces
-@cindex @code{__pgm4} AVR Named Address Spaces
-@cindex @code{__pgm5} AVR Named Address Spaces
+@item __flash1
+@item __flash2
+@item __flash3
+@item __flash4
+@item __flash5
+@cindex @code{__flash1} AVR Named Address Spaces
+@cindex @code{__flash2} AVR Named Address Spaces
+@cindex @code{__flash3} AVR Named Address Spaces
+@cindex @code{__flash4} AVR Named Address Spaces
+@cindex @code{__flash5} AVR Named Address Spaces
 These are 16-bit address spaces locating data in section
 @code{.progmem@var{N}.data} where @var{N} refers to
-address space @code{__pgm@var{N}}.
+address space @code{__flash@var{N}}.
 The compiler will set the @code{RAMPZ} segment register approptiately 
 before reading data by means of the @code{ELPM} instruction.
 
 On devices with less 64@tie{}kiB flash segments as indicated by the address
 space, the compiler will cut down the segment number to a number the
 device actually supports. Counting starts at@tie{}@code{0}
-for space @code{__pgm}. For example, if you access address space
-@code{__pgm3} on an ATmega128 device with two 64@tie{}kiB flash segments,
-the compiler will generate a read from @code{__pgm1}, i.e.@: it
+for space @code{__flash}. For example, if you access address space
+@code{__flash3} on an ATmega128 device with two 64@tie{}kiB flash segments,
+the compiler will generate a read from @code{__flash1}, i.e.@: it
 will load @code{RAMPZ} with@tie{}@code{1} before reading.
 
-@item __pgmx
-@cindex @code{__pgmx} AVR Named Address Spaces
+@item __memx
+@cindex @code{__memx} AVR Named Address Spaces
 This is a 24-bit address space that linearizes flash and RAM:
 If the high bit of the address is set, data is read from
 RAM using the lower two bytes as RAM address.
@@ -1288,7 +1288,7 @@ Objects in this address space will be lo
 @b{Example}
 
 @example
-char my_read (const __pgm char ** p)
+char my_read (const __flash char ** p)
 @{
 /* p is a pointer to RAM that points to a pointer to flash.
The first indirection of p will read that flash pointer
@@ -1299,7 +1299,7 @@ char my_read (const __pgm char ** p)
 @}
 
 /* Locate array[] in flash memory */
-const __pgm int array[] = @{ 3, 5, 

Re: [PATCH] Handle non-volatile GIMPLE_ASM in get_references_in_stmt (PR tree-optimization/51987)

2012-01-25 Thread Richard Guenther
On Wed, 25 Jan 2012, Jakub Jelinek wrote:

 On Wed, Jan 25, 2012 at 10:49:27AM +0100, Richard Guenther wrote:
  I wonder if it's worth handling asms in any fancy way here, considering
  that data-ref analysis happily punts on them completely.  Thus, why
  not change the above to
  
|| stmt_code == GIMPLE_ASM)
 
 I think asm (... : +r (x)); and similar are sufficiently common that
 it is worth doing something at least for those.
 Thus, I'd be fine with say
   (stmt_code == GIMPLE_ASM
 (gimple_asm_volatile_p (stmt) || gimple_vuse (stmt)))
 and don't do anything about the operands.
 That would handle the gimple_asm_clobbers_memory_p case, or the case in this
 PR, etc.
 Would you be ok with that instead?  That would be a conservative fix
 for this stage.

Yes, that's ok with me.  For the rest you can file an enhancement PR.

  ?  That sounds more safe for this stage anyway (does a volatile
  asm really clobber memory even if you don't explicitely say so?
  At least the operand scanner won't add virtual operands just because of 
  that, so the check looks bogus anyway).
 
 Given that asm volatile should act like an optimization barrier, I think it
 is desirable to punt on them even when they don't have memory operands.

A volatile asm without explicitely clobbering memory does not act as
an optimization barrier.  If it should, then it definitely needs
virtual operands.

Sure, but just like we punt on gimple_has_volatile_ops_p stmts - passes
should explicitely check for gimple_asm_volatile_p or use
gimple_has_side_effects.

  Btw, there are numerous callers of get_references_in_stmt that
  do not check its return value ... (and I think it misses a
  return value kind that tells the vector of references may be incomplete,
  like in the ASM kind right now).
 
 Incomplete should be signalled by returning true I'd say, that means beyond
 the listed ones it accesses some others too.
 
  Btw, get_references_in_stmt should probably use walk_stmt_load_store_ops,
  so we have a single place where we put knowledge where memory references
  can occur.
 
 Probably, but wouldn't that be a 4.8 material?

Yes.

Thanks,
Richard.


[PATCH] Fix PR 51389

2012-01-25 Thread Andrey Belevantsev

Hello,

In this PR data dependence analysis goes wild by trying to process 20k 
datarefs, so the patch limits the number of datarefs per loop we handle to 
1000 via a param.  On the way find_data_references_in_loop is made static 
and predcom/parloops are fixed for compute_data_dependences_for_loop 
returning false.


Bootstrapped and tested on x86_64-linux, no testcase as it is really a 
memory hog.  Strictly speaking, this could be a regression only from the 
time when -O3 didn't have predcom/vectorization turned on by default, so -- 
ok for trunk or 4.8?  Branches?


Andrey

2012-01-25  Andrey Belevantsev  a...@ispras.ru

PR middle-end/51389

* Makefile.in (tree-data-ref.o): Depend on $(PARAMS_H).
* tree-data-ref.c (find_data_references_in_loop): Make static.
Bail out for too many datarefs in a loop.
* tree-data-ref.h (find_data_references_in_loop): Remove declaration.
* tree-predcom.c (tree_predictive_commoning_loop): Bail out when
compute_data_dependences_for_loop returns false.
* tree-parloops.c (loop_parallel_p): Likewise.
* params.def (PARAM_DATADEPS_MAX_DATAREFS_IN_LOOP): New param.


diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f450d3e..43295aa 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2598,7 +2598,7 @@ tree-scalar-evolution.o : tree-scalar-evolution.c 
$(CONFIG_H) $(SYSTEM_H) \

$(TREE_PASS_H) $(PARAMS_H) gt-tree-scalar-evolution.h
 tree-data-ref.o : tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
gimple-pretty-print.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
-   $(TREE_PASS_H) langhooks.h tree-affine.h
+   $(TREE_PASS_H) langhooks.h tree-affine.h $(PARAMS_H)
 sese.o : sese.c sese.h $(CONFIG_H) $(SYSTEM_H) coretypes.h 
tree-pretty-print.h \

$(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) tree-pass.h value-prof.h
 graphite.o : graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h 
$(DIAGNOSTIC_CORE_H) \

diff --git a/gcc/params.def b/gcc/params.def
index 239b684..e50fa26 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -820,6 +820,12 @@ DEFPARAM (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION,
  maximum number of basic blocks per function to be analyzed by 
Graphite,
  100, 0, 0)

+/* Avoid data dependence analysis on very large loops.  */
+DEFPARAM (PARAM_DATADEPS_MAX_DATAREFS_IN_LOOP,
+ datadeps-max-datarefs-in-loop,
+ Maximum number of datarefs in loop for loop data dependence 
analysis,
+ 1000, 0, 0)
+
 /* Avoid doing loop invariant motion on very large loops.  */

 DEFPARAM (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP,
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index a0d86ec..5a7659a 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -85,6 +85,7 @@ along with GCC; see the file COPYING3.  If not see
 #include tree-pass.h
 #include langhooks.h
 #include tree-affine.h
+#include params.h

 static struct datadep_stats
 {
@@ -4338,7 +4339,7 @@ find_data_references_in_bb (struct loop *loop, 
basic_block bb,

TODO: This function should be made smarter so that it can handle address
arithmetic as if they were array accesses, etc.  */

-tree
+static tree
 find_data_references_in_loop (struct loop *loop,
  VEC (data_reference_p, heap) **datarefs)
 {
@@ -4351,7 +4352,9 @@ find_data_references_in_loop (struct loop *loop,
 {
   bb = bbs[i];

-  if (find_data_references_in_bb (loop, bb, datarefs) == chrec_dont_know)
+  if (find_data_references_in_bb (loop, bb, datarefs) == chrec_dont_know
+ || ((int) VEC_length (data_reference_p, *datarefs)
+  PARAM_VALUE (PARAM_DATADEPS_MAX_DATAREFS_IN_LOOP)))
 {
   free (bbs);
   return chrec_dont_know;
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index 0f12962..66258ab 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -394,8 +394,6 @@ extern bool compute_data_dependences_for_loop (struct 
loop *, bool,

 extern bool compute_data_dependences_for_bb (basic_block, bool,
  VEC (data_reference_p, heap) **,
  VEC (ddr_p, heap) **);
-extern tree find_data_references_in_loop (struct loop *,
-  VEC (data_reference_p, heap) **);
 extern void print_direction_vector (FILE *, lambda_vector, int);
 extern void print_dir_vectors (FILE *, VEC (lambda_vector, heap) *, int);
 extern void print_dist_vectors (FILE *, VEC (lambda_vector, heap) *, int);
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 339ddcc..c5b7655 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -387,8 +387,14 @@ loop_parallel_p (struct loop *loop, struct obstack * 
parloop_obstack)

   datarefs = VEC_alloc (data_reference_p, heap, 10);
   dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10);
   loop_nest = VEC_alloc (loop_p, heap, 3);
-  compute_data_dependences_for_loop (loop, true, 

[PATCH] Fix PR 48374

2012-01-25 Thread Andrey Belevantsev

Hello,

This patch fixes another problem with sel-sched not happy having bbs with 
zero successors.  Bootstrapped and tested on x86_64/linux.


Again, this is not a regression as __builtin_unreachable did not exist 
before sel-sched, but the patch is very safe and obvious.  It is my fault 
not committing this earlier (the patch in the audit trail was created in 
April 2011).  What do release managers think?


Andrey

gcc/
2012-01-25  Andrey Belevantsev  a...@ispras.ru

PR rtl-optimization/48374
* sel-sched-ir.h (get_all_loop_exits): Check for zero successors.

testsuite/
2012-01-25  Andrey Belevantsev  a...@ispras.ru

PR rtl-optimization/48374
* gcc.dg/pr48374.c: New test.

diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index c8f8be6..ede08e4 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -1119,7 +1119,8 @@ get_all_loop_exits (basic_block bb)
   /* If bb is empty, and we're skipping to loop exits, then
  consider bb as a possible gate to the inner loop now.  */
   while (sel_bb_empty_or_nop_p (bb)
- in_current_region_p (bb))
+ in_current_region_p (bb)
+ EDGE_COUNT (bb-succs)  0)
 {
   bb = single_succ (bb);

diff --git a/gcc/testsuite/gcc.dg/pr48374.c b/gcc/testsuite/gcc.dg/pr48374.c
new file mode 100644
index 000..24826d5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr48374.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
+/* { dg-options -O -fschedule-insns2 -fsel-sched-pipelining 
-fsel-sched-pipelining-outer-loops -fselective-scheduling2 --param 
max-sched-extend-regions-iters=2  } */

+
+void foo (int y)
+{
+  switch (y)
+{
+case 3:
+case 5:
+case 7:
+case 11:
+  break;
+default:
+  __builtin_unreachable ();
+}
+}
+



Re: [PATCH] Fix PR 51389

2012-01-25 Thread Richard Guenther
2012/1/25 Andrey Belevantsev a...@ispras.ru:
 Hello,

 In this PR data dependence analysis goes wild by trying to process 20k
 datarefs, so the patch limits the number of datarefs per loop we handle to
 1000 via a param.  On the way find_data_references_in_loop is made static
 and predcom/parloops are fixed for compute_data_dependences_for_loop
 returning false.

 Bootstrapped and tested on x86_64-linux, no testcase as it is really a
 memory hog.  Strictly speaking, this could be a regression only from the
 time when -O3 didn't have predcom/vectorization turned on by default, so --
 ok for trunk or 4.8?  Branches?

You limit the number of data references we find - but that isn't really
the scalability issue (it's linear in the number of stmts).  It's really
compute_all_dependences that hits the quadraticness, thus _that_
function should fail instead (I realize it doesn't return any success/failure
state yet, but the number of callers is limited).

Btw, new params need documentation in doc/invoke.texi.

The tree-predcom.c and tree-parloops.c changes are ok for trunk anyway.

Thanks,
Richard.

 Andrey

 2012-01-25  Andrey Belevantsev  a...@ispras.ru

        PR middle-end/51389

        * Makefile.in (tree-data-ref.o): Depend on $(PARAMS_H).
        * tree-data-ref.c (find_data_references_in_loop): Make static.
        Bail out for too many datarefs in a loop.
        * tree-data-ref.h (find_data_references_in_loop): Remove declaration.
        * tree-predcom.c (tree_predictive_commoning_loop): Bail out when
        compute_data_dependences_for_loop returns false.
        * tree-parloops.c (loop_parallel_p): Likewise.
        * params.def (PARAM_DATADEPS_MAX_DATAREFS_IN_LOOP): New param.


 diff --git a/gcc/Makefile.in b/gcc/Makefile.in
 index f450d3e..43295aa 100644
 --- a/gcc/Makefile.in
 +++ b/gcc/Makefile.in
 @@ -2598,7 +2598,7 @@ tree-scalar-evolution.o : tree-scalar-evolution.c
 $(CONFIG_H) $(SYSTEM_H) \
    $(TREE_PASS_H) $(PARAMS_H) gt-tree-scalar-evolution.h
  tree-data-ref.o : tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    gimple-pretty-print.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
 -   $(TREE_PASS_H) langhooks.h tree-affine.h
 +   $(TREE_PASS_H) langhooks.h tree-affine.h $(PARAMS_H)
  sese.o : sese.c sese.h $(CONFIG_H) $(SYSTEM_H) coretypes.h
 tree-pretty-print.h \
    $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) tree-pass.h value-prof.h
  graphite.o : graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h
 $(DIAGNOSTIC_CORE_H) \
 diff --git a/gcc/params.def b/gcc/params.def
 index 239b684..e50fa26 100644
 --- a/gcc/params.def
 +++ b/gcc/params.def
 @@ -820,6 +820,12 @@ DEFPARAM (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION,
          maximum number of basic blocks per function to be analyzed by
 Graphite,
          100, 0, 0)

 +/* Avoid data dependence analysis on very large loops.  */
 +DEFPARAM (PARAM_DATADEPS_MAX_DATAREFS_IN_LOOP,
 +         datadeps-max-datarefs-in-loop,
 +         Maximum number of datarefs in loop for loop data dependence
 analysis,
 +         1000, 0, 0)
 +
  /* Avoid doing loop invariant motion on very large loops.  */

  DEFPARAM (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP,
 diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
 index a0d86ec..5a7659a 100644
 --- a/gcc/tree-data-ref.c
 +++ b/gcc/tree-data-ref.c
 @@ -85,6 +85,7 @@ along with GCC; see the file COPYING3.  If not see
  #include tree-pass.h
  #include langhooks.h
  #include tree-affine.h
 +#include params.h

  static struct datadep_stats
  {
 @@ -4338,7 +4339,7 @@ find_data_references_in_bb (struct loop *loop,
 basic_block bb,
    TODO: This function should be made smarter so that it can handle address
    arithmetic as if they were array accesses, etc.  */

 -tree
 +static tree
  find_data_references_in_loop (struct loop *loop,
                              VEC (data_reference_p, heap) **datarefs)
  {
 @@ -4351,7 +4352,9 @@ find_data_references_in_loop (struct loop *loop,
     {
       bb = bbs[i];

 -      if (find_data_references_in_bb (loop, bb, datarefs) ==
 chrec_dont_know)
 +      if (find_data_references_in_bb (loop, bb, datarefs) ==
 chrec_dont_know
 +         || ((int) VEC_length (data_reference_p, *datarefs)
 +              PARAM_VALUE (PARAM_DATADEPS_MAX_DATAREFS_IN_LOOP)))
         {
           free (bbs);
           return chrec_dont_know;
 diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
 index 0f12962..66258ab 100644
 --- a/gcc/tree-data-ref.h
 +++ b/gcc/tree-data-ref.h
 @@ -394,8 +394,6 @@ extern bool compute_data_dependences_for_loop (struct
 loop *, bool,
  extern bool compute_data_dependences_for_bb (basic_block, bool,
                                              VEC (data_reference_p, heap)
 **,
                                              VEC (ddr_p, heap) **);
 -extern tree find_data_references_in_loop (struct loop *,
 -                                          VEC (data_reference_p, heap) **);
  extern void print_direction_vector (FILE *, lambda_vector, int);
  extern void 

Re: [PATCH] Fix PR 48374

2012-01-25 Thread Richard Guenther
2012/1/25 Andrey Belevantsev a...@ispras.ru:
 Hello,

 This patch fixes another problem with sel-sched not happy having bbs with
 zero successors.  Bootstrapped and tested on x86_64/linux.

 Again, this is not a regression as __builtin_unreachable did not exist
 before sel-sched, but the patch is very safe and obvious.  It is my fault
 not committing this earlier (the patch in the audit trail was created in
 April 2011).  What do release managers think?

Looks fine for me.

Richard.

 Andrey

 gcc/
 2012-01-25  Andrey Belevantsev  a...@ispras.ru

        PR rtl-optimization/48374
        * sel-sched-ir.h (get_all_loop_exits): Check for zero successors.

 testsuite/
 2012-01-25  Andrey Belevantsev  a...@ispras.ru

        PR rtl-optimization/48374
        * gcc.dg/pr48374.c: New test.

 diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
 index c8f8be6..ede08e4 100644
 --- a/gcc/sel-sched-ir.h
 +++ b/gcc/sel-sched-ir.h
 @@ -1119,7 +1119,8 @@ get_all_loop_exits (basic_block bb)
   /* If bb is empty, and we're skipping to loop exits, then
      consider bb as a possible gate to the inner loop now.  */
   while (sel_bb_empty_or_nop_p (bb)
 -         in_current_region_p (bb))
 +         in_current_region_p (bb)
 +         EDGE_COUNT (bb-succs)  0)
     {
       bb = single_succ (bb);

 diff --git a/gcc/testsuite/gcc.dg/pr48374.c b/gcc/testsuite/gcc.dg/pr48374.c
 new file mode 100644
 index 000..24826d5
 --- /dev/null
 +++ b/gcc/testsuite/gcc.dg/pr48374.c
 @@ -0,0 +1,17 @@
 +/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
 +/* { dg-options -O -fschedule-insns2 -fsel-sched-pipelining
 -fsel-sched-pipelining-outer-loops -fselective-scheduling2 --param
 max-sched-extend-regions-iters=2  } */
 +
 +void foo (int y)
 +{
 +  switch (y)
 +    {
 +    case 3:
 +    case 5:
 +    case 7:
 +    case 11:
 +      break;
 +    default:
 +      __builtin_unreachable ();
 +    }
 +}
 +



Re: [PATCH] Fix PR 51389

2012-01-25 Thread Andrey Belevantsev

On 25.01.2012 16:38, Richard Guenther wrote:

2012/1/25 Andrey Belevantseva...@ispras.ru:

Hello,

In this PR data dependence analysis goes wild by trying to process20k
datarefs, so the patch limits the number of datarefs per loop we handle to
1000 via a param.  On the way find_data_references_in_loop is made static
and predcom/parloops are fixed for compute_data_dependences_for_loop
returning false.

Bootstrapped and tested on x86_64-linux, no testcase as it is really a
memory hog.  Strictly speaking, this could be a regression only from the
time when -O3 didn't have predcom/vectorization turned on by default, so --
ok for trunk or 4.8?  Branches?


You limit the number of data references we find - but that isn't really
the scalability issue (it's linear in the number of stmts).  It's really
compute_all_dependences that hits the quadraticness, thus _that_
function should fail instead (I realize it doesn't return any success/failure
state yet, but the number of callers is limited).
Sure, I've just had the impression that the datarefs vector is no use 
without the dependencies themselves.  The possibility of making 
find_data_references_in_loop static also kind of hints in this direction. 
Anyways, I don't have any problem with fixing compute_all_dependences instead.



Btw, new params need documentation in doc/invoke.texi.

Bah, I convinced myself params.def was the only documentation :-)


The tree-predcom.c and tree-parloops.c changes are ok for trunk anyway.

I will commit them separately.

Andrey


Re: PR lto/51698 and the state of LTO + transactional memory

2012-01-25 Thread Aldy Hernandez



Second, it seems that by design, LTO prefers builtins to user-provided
versions of them.  In particular, lto_symtab_prevailing_decl() stipulates
that builtins are their own prevailing decl.  So even if we lowered TM
before LTO streaming, user provided builtins wouldn't be preferred (and thus
inlined) as we would expect into application code.


Hmm, so you say you have sth like

void *memcpy(void *dst, void *src, size_t n) { ...implementation... }
void foo()
{
   memcpy (...);
}

and expect it to be inlined from the supplied body instead of using the
builtin expander?


Yes.  Ultimately we want to do exactly that with TM instrumented code.


I think we could make this work ... at least under a sort-of ODR, that
all bodies (from different TUs) and the builtin have the same behavior.

Mind to file an enhancement bug?  Does it work without LTO?


Without LTO the memcpy gets inlined correctly.  This is what I am using:

houston:/build/t/gcc$ cat a.c
char *dst, *src;

void *memcpy(void *, const void *, __SIZE_TYPE__);

main()
{
  memcpy(dst, src, 123);
}
houston:/build/t/gcc$ cat b.c
extern int putchar(int);

void *memcpy(void *dst,
 const void *src,
 __SIZE_TYPE__ n)
{
  putchar(13);
}
houston:/build/t/gcc$ ./xgcc -B./ -flto -O3 a.c b.c -save-temps -o a.out

However, with LTO, somewhere around constant propagation (ccp2), we 
decide the memcpy is no longer needed and remove it altogether.  So it 
looks like the builtin was preferred.


I will file an enhancement PR with the above example.

Thanks for looking into this.


Re: PR lto/51698 and the state of LTO + transactional memory

2012-01-25 Thread Aldy Hernandez

On 01/24/12 17:24, Richard Henderson wrote:

On 01/25/2012 10:16 AM, Aldy Hernandez wrote:

The attached patch fixes the ICE in the PR, though it won't do what
the user ultimately wants to do, given the limitations described.
Perhaps we could create another PR and tag it with an enhancement
request.


An enhancement request pr sounds good.


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


Ok.


Tests revealed minor mismatches in other parts of the testsuite, which I 
have fixed below.


I would like another approval, just in case you disagree with the way I 
changed the dummy declarations in the LTO testsuite.


Sorry for the noise, I thought I had it all done :).

Tested on x86-64 Linux.
PR lto/51698
* builtin-types.def: (BT_CONST_DOUBLE_PTR): New.
(BT_FN_VOID_PTR_CONST_PTR_SIZE): New.
(BT_FN_VOID_PTR_INT_SIZE): New.
(BT_FN_UINT_UINT_VAR): Remove.
(BT_FN_UINT32_UINT32_VAR): New.
(BT_FN_DOUBLE_VPTR): Remove.
(BT_FN_DOUBLE_CONST_DOUBLE_PTR): New.
* gtm-builtins.def (_ITM_abortTransaction): Set return type to
void.
(_ITM_changeTransactionMode): Same.
(_ITM_memmoveRtWt): Change return type to void.
(_ITM_memcpyRtWt): Same.
(_ITM_memsetW): Same.
(_ITM_RaRD): Change types to double.
(_ITM_RD): Same.
(_ITM_RaWD): Same.
(_ITM_RfWD): Same.
* builtins.def (DEF_TM_BUILTIN): Set BOTH_P to true.
testsuite/
PR lto/51698
* gcc.dg/lto/trans-mem-4_0.c: New.
* gcc.dg/lto/trans-mem-4_1.c: New.
* gcc.dg/lto/trans-mem-2_0.c: Provide correct argument types for
TM builtins.
* gcc.dg/lto/trans-mem-1_0.c: Require stdint_types.
* gcc.dg/lto/trans-mem-1_1.c: Provide correct argument types for
TM builtins.
* gcc.dg/lto/trans-mem-3_0.c: Require stdint_types.
* gcc.dg/lto/trans-mem-3_1.c: Provide correct argument types for
TM builtins.

Index: testsuite/gcc.dg/lto/trans-mem-2_0.c
===
--- testsuite/gcc.dg/lto/trans-mem-2_0.c(revision 183474)
+++ testsuite/gcc.dg/lto/trans-mem-2_0.c(working copy)
@@ -1,17 +1,19 @@
 /* { dg-lto-options {{-flto -fgnu-tm}} } */
 /* { dg-lto-do link } */
+/* { dg-require-effective-target stdint_types } */
+
+#include stdint.h
 
 extern void foobar() __attribute__((transaction_callable));
 
-#define dummy(func) \
-  __attribute__((noinline,noclone,used)) void func() { asm (); }
+#define noinline __attribute__((noinline,noclone,used))
 
-dummy(_ITM_beginTransaction)
-dummy(_ITM_commitTransaction)
-dummy(_ITM_WU4)
-dummy(_ITM_WU8)
-dummy(_ITM_registerTMCloneTable)
-dummy(_ITM_deregisterTMCloneTable)
+noinline uint32_t _ITM_beginTransaction(uint32_t a, ...) { asm(); }
+noinline void _ITM_commitTransaction (void) { asm(); }
+noinline void _ITM_WU4 (void *a, uint32_t b) { asm(); }
+noinline void _ITM_WU8 (void *a, uint64_t b) { asm(); }
+noinline void _ITM_registerTMCloneTable (void) { asm(); }
+noinline void _ITM_deregisterTMCloneTable (void) { asm(); }
 
 main()
 {
Index: testsuite/gcc.dg/lto/trans-mem-4_0.c
===
--- testsuite/gcc.dg/lto/trans-mem-4_0.c(revision 0)
+++ testsuite/gcc.dg/lto/trans-mem-4_0.c(revision 0)
@@ -0,0 +1,12 @@
+/* { dg-lto-options {{-flto -fgnu-tm}} } */
+/* { dg-lto-do link } */
+/* { dg-require-effective-target stdint_types } */
+
+extern void foo() __attribute__((transaction_safe));
+
+int main()
+{
+  __transaction_atomic {
+  foo();
+  }
+}
Index: testsuite/gcc.dg/lto/trans-mem-4_1.c
===
--- testsuite/gcc.dg/lto/trans-mem-4_1.c(revision 0)
+++ testsuite/gcc.dg/lto/trans-mem-4_1.c(revision 0)
@@ -0,0 +1,14 @@
+#include stdint.h
+
+__attribute__((transaction_safe))
+void foo() 
+{
+}
+
+uint32_t _ITM_beginTransaction(uint32_t prop, ...)
+{
+}
+
+void __builtin__ITM_commitTransaction (void)
+{
+}
Index: testsuite/gcc.dg/lto/trans-mem-1_0.c
===
--- testsuite/gcc.dg/lto/trans-mem-1_0.c(revision 183474)
+++ testsuite/gcc.dg/lto/trans-mem-1_0.c(working copy)
@@ -1,5 +1,6 @@
 /* { dg-lto-options {{-flto -fgnu-tm}} } */
 /* { dg-lto-do link } */
+/* { dg-require-effective-target stdint_types } */
 
 int i;
 
Index: testsuite/gcc.dg/lto/trans-mem-3_0.c
===
--- testsuite/gcc.dg/lto/trans-mem-3_0.c(revision 183474)
+++ testsuite/gcc.dg/lto/trans-mem-3_0.c(working copy)
@@ -1,5 +1,6 @@
 /* { dg-lto-options {{-flto}} } */
 /* { dg-lto-do link } */
+/* { dg-require-effective-target stdint_types } */
 
 /* Test that we can build one object file with -fgnu-tm
(trans-mem-3_1.c), but do the final link of all objects without
Index: 

[patch, testsuite] require target lto in gcc.dg/tm/lto-1.c

2012-01-25 Thread Greta Yorsh
The new test gcc.dg/tm/lto-1.c fails in configurations where lto support is
disabled. 

This patch adds the missing target requirement to the test:
/* { dg-require-effective-target lto } */

Checked on qemu for arm-none-eabi configured with and without --disable-lto.

gcc/testsuite/ChangeLog

2012-01-25  Greta Yorsh  greta.yo...@arm.com

* gcc.dg/tm/lto-1.c: Require lto support in target.


test-lto.patch
Description: Binary data


[PATCH] Fix VN value-numbering with VIEW_CONVERT_EXPRs

2012-01-25 Thread Richard Guenther

VN ops comparison code value-numbers

  VIEW_CONVERT_EXPRstruct iterator(__thing_31).._M_node

and

  __thing_31-_M_node

the same because it fails to check for *__thing_31 vs. __thing_31.

Bootstrap  regtest pending on x86_64.

Richard.

2012-01-25  Richard Guenther  rguent...@suse.de

* tree-ssa-sccvn.c (vn_reference_eq): Also compare if both
bases are dereferenced.

Index: gcc/tree-ssa-sccvn.c
===
--- gcc/tree-ssa-sccvn.c(revision 183514)
+++ gcc/tree-ssa-sccvn.c(working copy)
@@ -556,6 +556,7 @@ vn_reference_eq (const void *p1, const v
  tem1.type = TREE_TYPE (tem1.op0);
  tem1.opcode = TREE_CODE (tem1.op0);
  vro1 = tem1;
+ deref1 = false;
}
   if (deref2  vro2-opcode == ADDR_EXPR)
{
@@ -564,7 +565,10 @@ vn_reference_eq (const void *p1, const v
  tem2.type = TREE_TYPE (tem2.op0);
  tem2.opcode = TREE_CODE (tem2.op0);
  vro2 = tem2;
+ deref2 = false;
}
+  if (deref1 != deref2)
+   return false;
   if (!vn_reference_op_eq (vro1, vro2))
return false;
   ++j;


Re: [v3] libstdc++/49829

2012-01-25 Thread Matthias Klose

On 25.01.2012 06:26, Benjamin Kosnik wrote:




this breaks builds configured with --enable-libstdcxx-debug.


confirmed


  Tried
the following (not yet working) fix.


OK. The attached is closer, but still not quite there.


one step further, to avoid the endless recursion in the install-debug target. 
unsure if that is the right approach. the install now works, but the debug 
library is now built in the install step, not in the build step.


  Matthias
Index: src/Makefile.am
===
--- src/Makefile.am (revision 183514)
+++ src/Makefile.am (working copy)
@@ -172,13 +172,23 @@
 # 1 debug library
 # 2 supra-convenience library
 if GLIBCXX_BUILD_DEBUG
-all-local: libstdc++convenience.la build_debug
-install-data-local: install_debug
+STAMP_DEBUG = build-debug
+STAMP_INSTALL_DEBUG = install-debug
+CLEAN_DEBUG = debug
 else
-all-local: libstdc++convenience.la
-install-data-local:
+STAMP_DEBUG =
+STAMP_INSTALL_DEBUG =
+CLEAN_DEBUG =
 endif
 
+all-local-once: libstdc++convenience.la $(STAMP_DEBUG)
+install-data-local-once: $(STAMP_INSTALL_DEBUG)
+
+all-local: all-local-once
+install-data-local: install-data-local-once
+clean-local:
+   rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
+
 # Make a non-installed convenience library, so that --disable-static
 # may work.
 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
@@ -188,13 +198,13 @@
fi; \
echo `date`  stamp-libstdc++convenience;
 
-debugdir = debug
-
-# Build a set of debug objects here.
+# Build a debug variant.
 # Take care to fix all possibly-relative paths.
+debugdir = ${glibcxx_builddir}/src/debug
 stamp-debug:
if test ! -d ${debugdir}; then \
  mkdir -p ${debugdir}; \
+ for d in $(SUBDIRS); do mkdir -p  ${debugdir}/$$d; done; \
  (cd ${debugdir}; \
  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
  -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
@@ -202,16 +212,27 @@
  -e 's/VPATH = \.\./VPATH = ..\/../' \
  -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
  -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
- -e 's/all-local: build_debug/all-local:/' \
- -e 's/install-data-local: install_debug/install-data-local:/' \
-  ../Makefile  Makefile) ; \
+ -e 's/all-local: all-local-once/all-local:/' \
+ -e 's/install-data-local: 
install-data-local-once/install-data-local:/' \
+  ../Makefile  Makefile ; \
+ for d in . $(SUBDIRS); do \
+ sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
+ -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
+ -e 's/srcdir = \.\./srcdir = ..\/../' \
+ -e 's/VPATH = \.\./VPATH = ..\/../' \
+ -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
+ -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
+  ../$$d/Makefile  $$d/Makefile ; \
+ done) ; \
fi; \
echo `date`  stamp-debug;
 
-build_debug: stamp-debug
-   (cd ${debugdir}  $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
+build-debug: stamp-debug
+   (cd ${debugdir}  $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' libstdc++.la)
 
-# Install debug library here.
-install_debug:
-   (cd ${debugdir}  $(MAKE) \
-   toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
+# Install debug library.
+install-debug: stamp-debug
+   (if [ $$(basename $(CURDIR)) != debug ]; then \
+ cd ${debugdir}  $(MAKE) \
+ toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install; \
+   fi)


Re: [PATCH] Fix PR 51389

2012-01-25 Thread Richard Guenther
2012/1/25 Andrey Belevantsev a...@ispras.ru:
 On 25.01.2012 16:38, Richard Guenther wrote:

 2012/1/25 Andrey Belevantseva...@ispras.ru:

 Hello,

 In this PR data dependence analysis goes wild by trying to process20k
 datarefs, so the patch limits the number of datarefs per loop we handle
 to
 1000 via a param.  On the way find_data_references_in_loop is made static
 and predcom/parloops are fixed for compute_data_dependences_for_loop
 returning false.

 Bootstrapped and tested on x86_64-linux, no testcase as it is really a
 memory hog.  Strictly speaking, this could be a regression only from the
 time when -O3 didn't have predcom/vectorization turned on by default, so
 --
 ok for trunk or 4.8?  Branches?


 You limit the number of data references we find - but that isn't really
 the scalability issue (it's linear in the number of stmts).  It's really
 compute_all_dependences that hits the quadraticness, thus _that_
 function should fail instead (I realize it doesn't return any
 success/failure
 state yet, but the number of callers is limited).

 Sure, I've just had the impression that the datarefs vector is no use
 without the dependencies themselves.  The possibility of making
 find_data_references_in_loop static also kind of hints in this direction.
 Anyways, I don't have any problem with fixing compute_all_dependences
 instead.

I'd prefer that.

 Btw, new params need documentation in doc/invoke.texi.

 Bah, I convinced myself params.def was the only documentation :-)


 The tree-predcom.c and tree-parloops.c changes are ok for trunk anyway.

 I will commit them separately.

Thanks,
Richard.

 Andrey


Re: PR lto/51698 and the state of LTO + transactional memory

2012-01-25 Thread Richard Guenther
On Wed, Jan 25, 2012 at 2:00 PM, Aldy Hernandez al...@redhat.com wrote:

 Second, it seems that by design, LTO prefers builtins to user-provided
 versions of them.  In particular, lto_symtab_prevailing_decl() stipulates
 that builtins are their own prevailing decl.  So even if we lowered TM
 before LTO streaming, user provided builtins wouldn't be preferred (and
 thus
 inlined) as we would expect into application code.


 Hmm, so you say you have sth like

 void *memcpy(void *dst, void *src, size_t n) { ...implementation... }
 void foo()
 {
   memcpy (...);
 }

 and expect it to be inlined from the supplied body instead of using the
 builtin expander?


 Yes.  Ultimately we want to do exactly that with TM instrumented code.


 I think we could make this work ... at least under a sort-of ODR, that
 all bodies (from different TUs) and the builtin have the same behavior.

 Mind to file an enhancement bug?  Does it work without LTO?


 Without LTO the memcpy gets inlined correctly.  This is what I am using:

 houston:/build/t/gcc$ cat a.c
 char *dst, *src;

 void *memcpy(void *, const void *, __SIZE_TYPE__);

 main()
 {
  memcpy(dst, src, 123);
 }
 houston:/build/t/gcc$ cat b.c
 extern int putchar(int);

 void *memcpy(void *dst,
             const void *src,
             __SIZE_TYPE__ n)
 {
  putchar(13);
 }
 houston:/build/t/gcc$ ./xgcc -B./ -flto -O3 a.c b.c -save-temps -o a.out

Of course that's an invalid testcase ;)  GCC correctly assumed that your
memcpy has the same kind of side-effects as __builtin_memcpy.  So
you can't observe, in a valid runtime testcase, which copy chose.

;)

Richard.

 However, with LTO, somewhere around constant propagation (ccp2), we decide
 the memcpy is no longer needed and remove it altogether.  So it looks like
 the builtin was preferred.

 I will file an enhancement PR with the above example.

 Thanks for looking into this.


Re: PR lto/51698 and the state of LTO + transactional memory

2012-01-25 Thread Aldy Hernandez

On 01/25/12 08:23, Richard Guenther wrote:

On Wed, Jan 25, 2012 at 2:00 PM, Aldy Hernandezal...@redhat.com  wrote:



Second, it seems that by design, LTO prefers builtins to user-provided
versions of them.  In particular, lto_symtab_prevailing_decl() stipulates
that builtins are their own prevailing decl.  So even if we lowered TM
before LTO streaming, user provided builtins wouldn't be preferred (and
thus
inlined) as we would expect into application code.



Hmm, so you say you have sth like

void *memcpy(void *dst, void *src, size_t n) { ...implementation... }
void foo()
{
   memcpy (...);
}

and expect it to be inlined from the supplied body instead of using the
builtin expander?



Yes.  Ultimately we want to do exactly that with TM instrumented code.



I think we could make this work ... at least under a sort-of ODR, that
all bodies (from different TUs) and the builtin have the same behavior.

Mind to file an enhancement bug?  Does it work without LTO?



Without LTO the memcpy gets inlined correctly.  This is what I am using:

houston:/build/t/gcc$ cat a.c
char *dst, *src;

void *memcpy(void *, const void *, __SIZE_TYPE__);

main()
{
  memcpy(dst, src, 123);
}
houston:/build/t/gcc$ cat b.c
extern int putchar(int);

void *memcpy(void *dst,
 const void *src,
 __SIZE_TYPE__ n)
{
  putchar(13);
}
houston:/build/t/gcc$ ./xgcc -B./ -flto -O3 a.c b.c -save-temps -o a.out


Of course that's an invalid testcase ;)  GCC correctly assumed that your
memcpy has the same kind of side-effects as __builtin_memcpy.  So
you can't observe, in a valid runtime testcase, which copy chose.


Ah!  What do you suggest as a testcase?


Re: PR lto/51698 and the state of LTO + transactional memory

2012-01-25 Thread Richard Guenther
On Wed, Jan 25, 2012 at 3:27 PM, Aldy Hernandez al...@redhat.com wrote:
 On 01/25/12 08:23, Richard Guenther wrote:

 On Wed, Jan 25, 2012 at 2:00 PM, Aldy Hernandezal...@redhat.com  wrote:


 Second, it seems that by design, LTO prefers builtins to user-provided
 versions of them.  In particular, lto_symtab_prevailing_decl()
 stipulates
 that builtins are their own prevailing decl.  So even if we lowered TM
 before LTO streaming, user provided builtins wouldn't be preferred (and
 thus
 inlined) as we would expect into application code.



 Hmm, so you say you have sth like

 void *memcpy(void *dst, void *src, size_t n) { ...implementation... }
 void foo()
 {
   memcpy (...);
 }

 and expect it to be inlined from the supplied body instead of using the
 builtin expander?



 Yes.  Ultimately we want to do exactly that with TM instrumented code.


 I think we could make this work ... at least under a sort-of ODR, that
 all bodies (from different TUs) and the builtin have the same behavior.

 Mind to file an enhancement bug?  Does it work without LTO?



 Without LTO the memcpy gets inlined correctly.  This is what I am using:

 houston:/build/t/gcc$ cat a.c
 char *dst, *src;

 void *memcpy(void *, const void *, __SIZE_TYPE__);

 main()
 {
  memcpy(dst, src, 123);
 }
 houston:/build/t/gcc$ cat b.c
 extern int putchar(int);

 void *memcpy(void *dst,
             const void *src,
             __SIZE_TYPE__ n)
 {
  putchar(13);
 }
 houston:/build/t/gcc$ ./xgcc -B./ -flto -O3 a.c b.c -save-temps -o a.out


 Of course that's an invalid testcase ;)  GCC correctly assumed that your
 memcpy has the same kind of side-effects as __builtin_memcpy.  So
 you can't observe, in a valid runtime testcase, which copy chose.

 Ah!  What do you suggest as a testcase?

I don't see anything suitable for inclusion in the testsuite.  Yours certainly
does it for development - simply make src and dst volatile.

Richard.


Re: [PATCH] Handle non-volatile GIMPLE_ASM in get_references_in_stmt (PR tree-optimization/51987)

2012-01-25 Thread Jakub Jelinek
On Wed, Jan 25, 2012 at 01:18:28PM +0100, Richard Guenther wrote:
 Yes, that's ok with me.  For the rest you can file an enhancement PR.

Ok, here is what I've committed, and I'll file the PR momentarily.

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

PR tree-optimization/51987
* tree-data-ref.c (get_references_in_stmt): Handle references in
non-volatile GIMPLE_ASM.

* gcc.target/i386/pr51987.c: New test.

--- gcc/tree-data-ref.c.jj  2012-01-25 13:30:51.563590373 +0100
+++ gcc/tree-data-ref.c 2012-01-25 13:34:12.323973880 +0100
@@ -1,5 +1,5 @@
 /* Data references and dependences detectors.
-   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Sebastian Pop p...@cri.ensmp.fr
 
@@ -4185,7 +4185,7 @@ get_references_in_stmt (gimple stmt, VEC
   if ((stmt_code == GIMPLE_CALL
 !(gimple_call_flags (stmt)  (ECF_CONST | ECF_PURE)))
   || (stmt_code == GIMPLE_ASM
-  gimple_asm_volatile_p (stmt)))
+  (gimple_asm_volatile_p (stmt) || gimple_vuse (stmt
 clobbers_memory = true;
 
   if (!gimple_vuse (stmt))
--- gcc/testsuite/gcc.target/i386/pr51987.c.jj  2012-01-24 23:32:44.887896707 
+0100
+++ gcc/testsuite/gcc.target/i386/pr51987.c 2012-01-24 23:34:26.289296794 
+0100
@@ -0,0 +1,33 @@
+/* PR tree-optimization/51987 */
+/* { dg-do run { target { ! { ia32 } } } } */
+/* { dg-options -O3 } */
+
+extern void abort (void);
+union U { unsigned long long l; struct { unsigned int l, h; } i; };
+
+__attribute__((noinline, noclone)) void
+foo (char *x, char *y)
+{
+  int i;
+  for (i = 0; i  64; i++)
+{
+  union U u;
+  asm (movl %1, %k0; salq $32, %0 : =r (u.l) : r (i));
+  x[i] = u.i.h;
+  union U v;
+  asm (movl %1, %k0; salq $32, %0 : =r (v.l) : r (i));
+  y[i] = v.i.h;
+}
+}
+
+int
+main ()
+{
+  char a[64], b[64];
+  int i;
+  foo (a, b);
+  for (i = 0; i  64; i++)
+if (a[i] != i || b[i] != i)
+  abort ();
+  return 0;
+}


Jakub


[patch] avoid '//' prefixes when sysroot is set to '/'

2012-01-25 Thread Matthias Klose
when setting sysroot to / (for whatever reason), then search directories and 
headers start with a double-slash, as seen with gcc -v.


#include ... search starts here:
#include ... search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include
 //usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
 //usr/include/x86_64-linux-gnu
 //usr/include
End of search list.

LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/://lib/x86_64-linux-gnu/://lib/../lib/://usr/lib/x86_64-linux-gnu/://usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../://lib/://usr/lib/

This can end up in generation for dependency files, and other files parsing the 
output. The solution I came up with is to check for sysroot set to '/' and 
special case this in two places. Afaics, there are no other places.


With the patch, both the include paths and the library paths start with a single 
slash. No regressions seen running the testsuite on x86_64-linux-gnu.


  Matthias
2012-01-24  Matthias Klose  d...@ubuntu.com

* gcc.c (add_sysrooted_prefix): Don't prefix with the system root,
  if it is the root directory.
* incpath.c (add_standard_paths): Likewise.

Index: gcc/incpath.c
===
--- gcc/incpath.c   (revision 183421)
+++ gcc/incpath.c   (working copy)
@@ -166,7 +166,10 @@
 
  /* Should this directory start with the sysroot?  */
  if (sysroot  p-add_sysroot)
-   str = concat (sysroot, p-fname, NULL);
+   if (IS_DIR_SEPARATOR (*sysroot)  sysroot[1] == '\0')
+ str = concat (p-fname, NULL);
+   else
+ str = concat (sysroot, p-fname, NULL);
  else if (!p-add_sysroot  relocated
!filename_ncmp (p-fname, cpp_PREFIX, cpp_PREFIX_len))
{
Index: gcc/gcc.c
===
--- gcc/gcc.c   (revision 183421)
+++ gcc/gcc.c   (working copy)
@@ -2443,7 +2443,9 @@
   if (!IS_ABSOLUTE_PATH (prefix))
 fatal_error (system path %qs is not absolute, prefix);
 
-  if (target_system_root)
+  if (target_system_root 
+   !IS_DIR_SEPARATOR (*target_system_root)
+   target_system_root[1] != '\0')
 {
   if (target_sysroot_suffix)
  prefix = concat (target_sysroot_suffix, prefix, NULL);


Fix PR48794 some more

2012-01-25 Thread Michael Matz
Hi,

so, the below adjusted testcase from PR48794 still fails for the same 
reasons (regions still referenced from RESX being removed).  I was split 
minds about if that's a new bug or just an extension of the old bug, so I 
hijacked the old PR.  In any case, remove_unreachable_handlers_no_lp needs 
similar handling like remove_unreachable_handlers.

Patch fixes the segfault and is currently in regstrapping on x86_64-linux.  
Okay for trunk?


Ciao,
Michael.

PR tree-optimization/48794
* tree-eh.c (remove_unreachable_handlers_no_lp): Don't remove
regions referenced from RESX/EH_DISPATCH.

testsuite/
* gfortran.dg/gomp/pr48794-2.f90: New testcase.

Index: tree-eh.c
===
--- tree-eh.c   (revision 183524)
+++ tree-eh.c   (working copy)
@@ -3617,14 +3617,44 @@ remove_unreachable_handlers_no_lp (void)
 {
   eh_region r;
   int i;
+  sbitmap r_reachable;
+  basic_block bb;
+
+  r_reachable = sbitmap_alloc (VEC_length (eh_region, cfun-eh-region_array));
+  sbitmap_zero (r_reachable);
+
+  FOR_EACH_BB (bb)
+{
+  gimple_stmt_iterator gsi;
+
+  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (gsi))
+   {
+ gimple stmt = gsi_stmt (gsi);
+ /* Avoid removing regions referenced from RESX/EH_DISPATCH.  */
+ switch (gimple_code (stmt))
+   {
+   case GIMPLE_RESX:
+ SET_BIT (r_reachable, gimple_resx_region (stmt));
+ break;
+   case GIMPLE_EH_DISPATCH:
+ SET_BIT (r_reachable, gimple_eh_dispatch_region (stmt));
+ break;
+   default:
+ break;
+   }
+   }
+}
 
   for (i = 1; VEC_iterate (eh_region, cfun-eh-region_array, i, r); ++i)
-if (r  r-landing_pads == NULL  r-type != ERT_MUST_NOT_THROW)
+if (r  r-landing_pads == NULL  r-type != ERT_MUST_NOT_THROW
+!TEST_BIT (r_reachable, i))
   {
if (dump_file)
  fprintf (dump_file, Removing unreachable region %d\n, i);
remove_eh_handler (r);
   }
+
+  sbitmap_free (r_reachable);
 }
 
 /* Undo critical edge splitting on an EH landing pad.  Earlier, we
Index: testsuite/gfortran.dg/gomp/pr48794-2.f90
===
--- testsuite/gfortran.dg/gomp/pr48794-2.f90(revision 0)
+++ testsuite/gfortran.dg/gomp/pr48794-2.f90(revision 0)
@@ -0,0 +1,16 @@
+! PR tree-optimization/48794
+! { dg-do compile }
+! { dg-options -Os -fopenmp -fexceptions -fno-tree-ccp -fno-tree-copy-prop }
+
+  integer, allocatable :: a(:)
+  integer :: b(48)
+  logical :: l
+  if (allocated (a)) then
+call abort
+call bla(b)
+  end if
+!$omp parallel private (a) reduction (.or.:l)
+  do i = 1, 7
+  end do
+!$omp end parallel
+end


Re: [patch, testsuite] require target lto in gcc.dg/tm/lto-1.c

2012-01-25 Thread Richard Earnshaw
On 25/01/12 14:10, Greta Yorsh wrote:
 The new test gcc.dg/tm/lto-1.c fails in configurations where lto support is
 disabled. 
 
 This patch adds the missing target requirement to the test:
 /* { dg-require-effective-target lto } */
 
 Checked on qemu for arm-none-eabi configured with and without --disable-lto.
 
 gcc/testsuite/ChangeLog
 
 2012-01-25  Greta Yorsh  greta.yo...@arm.com
 
   * gcc.dg/tm/lto-1.c: Require lto support in target.=
 
 
 test-lto.patch
 
 

OK

R.




Ping #1: [Patch,wwwdocs,AVR]: AVR release notes

2012-01-25 Thread Georg-Johann Lay
http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01020.html

Georg-Johann Lay wrote:
 Adding AVR-specific release notes to wwwdocs/htdocs/gcc-4.7/changes.html
 
 Ok?
 
 Johann
 



[PATCH] Fix libstdc++ build (PR bootstrap/51985)

2012-01-25 Thread Jakub Jelinek
Hi!

Apparently $(inst_sources) is included in libc__98convenience_la_SOURCES and
libc__98_la_SOURCES twice, once directly, once through $(host_sources_extra)
included in $(sources).  On x86_64-linux and others it causes just lots
of bloat (libstdc++.a is much bigger, as several objects are there twice,
and libstdc++.so.6 contains bigger .debug_* sections), but reportedly on
other targets it results in build failures.

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

I've verified abilists before Benjamin's change, after that without this
patch and with this patch and the changes are ok (the only changes are some
GLOBAL - UNIQUE changes caused by Benjamin's patch, with this patch no
abilist changes at all).

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

PR bootstrap/51985
* src/c++98/Makefile.am (libc__98_la_SOURCES,
libc__98convenience_la_SOURCES): Remove $(inst_sources).
* src/c++98/Makefile.in: Regenerated.

--- libstdc++-v3/src/c++98/Makefile.am.jj   2012-01-25 13:04:07.0 
+0100
+++ libstdc++-v3/src/c++98/Makefile.am  2012-01-25 13:59:04.560221970 +0100
@@ -156,8 +156,8 @@ sources = \
 vpath % $(top_srcdir)/src/c++98
 vpath % $(top_srcdir)
 
-libc__98_la_SOURCES = $(sources) $(inst_sources)
-libc__98convenience_la_SOURCES = $(sources)  $(inst_sources)
+libc__98_la_SOURCES = $(sources)
+libc__98convenience_la_SOURCES = $(sources)
 
 # Use special rules for the deprecated source files so that they find
 # deprecated include files.
--- libstdc++-v3/src/c++98/Makefile.in.jj   2012-01-25 13:04:07.0 
+0100
+++ libstdc++-v3/src/c++98/Makefile.in  2012-01-25 13:59:51.549947625 +0100
@@ -114,10 +114,10 @@ am__objects_6 = bitmap_allocator.lo pool
math_stubs_long_double.lo stdexcept.lo strstream.lo tree.lo \
istream.lo streambuf.lo valarray.lo $(am__objects_1) \
$(am__objects_5)
-am_libc__98_la_OBJECTS = $(am__objects_6) $(am__objects_2)
+am_libc__98_la_OBJECTS = $(am__objects_6)
 libc__98_la_OBJECTS = $(am_libc__98_la_OBJECTS)
 libc__98convenience_la_LIBADD =
-am_libc__98convenience_la_OBJECTS = $(am__objects_6) $(am__objects_2)
+am_libc__98convenience_la_OBJECTS = $(am__objects_6)
 libc__98convenience_la_OBJECTS = $(am_libc__98convenience_la_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp =
@@ -423,8 +423,8 @@ sources = \
${host_sources} \
${host_sources_extra}
 
-libc__98_la_SOURCES = $(sources) $(inst_sources)
-libc__98convenience_la_SOURCES = $(sources)  $(inst_sources)
+libc__98_la_SOURCES = $(sources)
+libc__98convenience_la_SOURCES = $(sources)
 
 # Use special rules for the deprecated source files so that they find
 # deprecated include files.

Jakub


Re: Fix PR48794 some more

2012-01-25 Thread Michael Matz
Hi,

On Wed, 25 Jan 2012, Michael Matz wrote:

 so, the below adjusted testcase from PR48794 still fails for the same 
 reasons (regions still referenced from RESX being removed).  I was split 
 minds about if that's a new bug or just an extension of the old bug, so 
 I hijacked the old PR.  In any case, remove_unreachable_handlers_no_lp 
 needs similar handling like remove_unreachable_handlers.
 
 Patch fixes the segfault and is currently in regstrapping on x86_64-linux.  
 Okay for trunk?

Actually, resx/eh_dispatch always are the last BB statements, so the loop 
doesn't need to look at all statements in a BB, making it quite somewhat 
faster.  Consider the tree-eh.c to be looking like so:

Index: tree-eh.c
===
--- tree-eh.c   (revision 183524)
+++ tree-eh.c   (working copy)
@@ -3617,14 +3617,40 @@ remove_unreachable_handlers_no_lp (void)
 {
   eh_region r;
   int i;
+  sbitmap r_reachable;
+  basic_block bb;
+
+  r_reachable = sbitmap_alloc (VEC_length (eh_region, cfun-eh-region_array));
+  sbitmap_zero (r_reachable);
+
+  FOR_EACH_BB (bb)
+{
+  gimple stmt = last_stmt (bb);
+  if (stmt)
+   /* Avoid removing regions referenced from RESX/EH_DISPATCH.  */
+   switch (gimple_code (stmt))
+ {
+ case GIMPLE_RESX:
+   SET_BIT (r_reachable, gimple_resx_region (stmt));
+   break;
+ case GIMPLE_EH_DISPATCH:
+   SET_BIT (r_reachable, gimple_eh_dispatch_region (stmt));
+   break;
+ default:
+   break;
+ }
+}

   for (i = 1; VEC_iterate (eh_region, cfun-eh-region_array, i, r); ++i)
-if (r  r-landing_pads == NULL  r-type != ERT_MUST_NOT_THROW)
+if (r  r-landing_pads == NULL  r-type != ERT_MUST_NOT_THROW
+!TEST_BIT (r_reachable, i))
   {
if (dump_file)
  fprintf (dump_file, Removing unreachable region %d\n, i);
remove_eh_handler (r);
   }
+
+  sbitmap_free (r_reachable);
 }

 /* Undo critical edge splitting on an EH landing pad.  Earlier, we


Ciao,
Michael.


Re: incorrect composite_type result for pointers with mode

2012-01-25 Thread Joseph S. Myers
On Wed, 25 Jan 2012, Tristan Gingold wrote:

 2012-01-25  Tristan Gingold  ging...@adacore.com
 
   * c-typeck.c (composite_type): Keep mode for pointers.

OK.

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


Re: RFA: tree.c PATCH for c++/51992 (TARGET_EXPR in LTO stream)

2012-01-25 Thread Jakub Jelinek
On Wed, Jan 25, 2012 at 11:29:58AM -0500, Jason Merrill wrote:
 The problem here turns out to be that when free_lang_data_in_cgraph
 tries to find all the decls and types in a function, it doesn't
 catch a type that only appears in the fntype of a GIMPLE_CALL.  This
 patch fixes the bug; is there a better way to handle it?

Well, fntype isn't a gimple_op, so the generic code below it doesn't handle
it.  So I think it is fine.

 Tested x86_64-pc-linux-gnu, OK for trunk?

Yes.

 commit 9febd1e3a2af987ecd1a62417b8948f679550254
 Author: Jason Merrill ja...@redhat.com
 Date:   Wed Jan 25 11:14:30 2012 -0500
 
   PR c++/51992
   * tree.c (find_decls_types_in_node): Walk gimple_call_fntype.

Jakub


[Patch, Fortran] PR 51987 - Fix setting of f2k_derived - and thus fix CLASS-based TBP

2012-01-25 Thread Tobias Burnus

Dear all,

seemingly it can sometimes happen that fclass gets created but the 
fclass-f2k_derived is not set. This patch now sets it explicitly, if unset.


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

Tobias

PS: I am still looking for someone to review my rather straight-forward 
patch at http://gcc.gnu.org/ml/fortran/2012-01/msg00197.html
2012-01-25  Tobias Burnus  bur...@net-b.de

	PR fortran/51995
	* class.c (gfc_build_class_symbol): Ensure that
	fclass-f2k_derived is set.

2012-01-25  Tobias Burnus  bur...@net-b.de

	PR fortran/51995
	* gfortran.dg/typebound_proc_25.f90: New.

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 5e5de14..92cfef7 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -421,6 +421,8 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr,
   c-attr.access = ACCESS_PRIVATE;
   c-attr.pointer = 1;
 }
+  else if (!fclass-f2k_derived)
+fclass-f2k_derived = fclass-components-ts.u.derived-f2k_derived;
 
   /* Since the extension field is 8 bit wide, we can only have
  up to 255 extension levels.  */
--- /dev/null	2012-01-23 08:22:38.999666895 +0100
+++ gcc/gcc/testsuite/gfortran.dg/typebound_proc_25.f90	2012-01-25 14:31:02.0 +0100
@@ -0,0 +1,110 @@
+! { dg-do compile }
+!
+! PR fortran/51995
+!
+! Contributed by jilf...@yahoo.com
+!
+
+MODULE factory_pattern
+
+  TYPE CFactory
+ PRIVATE
+ CHARACTER(len=20) :: factory_type  !! Descriptive name for database
+ CLASS(Connection), POINTER :: connection_type !! Which type of database ?
+   CONTAINS!! Note 'class' not 'type' !
+ PROCEDURE :: init !! Constructor
+ PROCEDURE :: create_connection!! Connect to database
+ PROCEDURE :: finalize !! Destructor
+  END TYPE CFactory
+
+  TYPE, ABSTRACT :: Connection
+   CONTAINS
+ PROCEDURE(generic_desc), DEFERRED, PASS(self) :: description
+  END TYPE Connection
+
+  ABSTRACT INTERFACE
+ SUBROUTINE generic_desc(self)
+   IMPORT :: Connection
+   CLASS(Connection), INTENT(in) :: self
+ END SUBROUTINE generic_desc
+  END INTERFACE
+
+  !! An Oracle connection
+  TYPE, EXTENDS(Connection) :: OracleConnection
+   CONTAINS
+ PROCEDURE, PASS(self) :: description = oracle_desc
+  END TYPE OracleConnection
+
+  !! A MySQL connection
+  TYPE, EXTENDS(Connection) :: MySQLConnection
+   CONTAINS
+ PROCEDURE, PASS(self) :: description = mysql_desc
+  END TYPE MySQLConnection
+
+CONTAINS
+
+  SUBROUTINE init(self, string)
+CLASS(CFactory), INTENT(inout) :: self
+CHARACTER(len=*), INTENT(in) :: string
+self%factory_type = TRIM(string)
+self%connection_type = NULL()!! pointer is nullified
+  END SUBROUTINE init
+
+  SUBROUTINE finalize(self)
+CLASS(CFactory), INTENT(inout) :: self
+DEALLOCATE(self%connection_type)  !! Free the memory
+NULLIFY(self%connection_type)
+  END SUBROUTINE finalize
+
+  FUNCTION create_connection(self)  RESULT(ptr)
+CLASS(CFactory) :: self
+CLASS(Connection), POINTER :: ptr
+
+IF(self%factory_type == Oracle) THEN
+   IF(ASSOCIATED(self%connection_type))   DEALLOCATE(self%connection_type)
+   ALLOCATE(OracleConnection :: self%connection_type)
+   ptr = self%connection_type
+ELSEIF(self%factory_type == MySQL) THEN
+   IF(ASSOCIATED(self%connection_type))   DEALLOCATE(self%connection_type)
+   ALLOCATE(MySQLConnection :: self%connection_type)
+   ptr = self%connection_type
+END IF
+
+  END FUNCTION create_connection
+
+  SUBROUTINE oracle_desc(self)
+CLASS(OracleConnection), INTENT(in) :: self
+WRITE(*,'(A)') You are now connected with Oracle
+  END SUBROUTINE oracle_desc
+
+  SUBROUTINE mysql_desc(self)
+CLASS(MySQLConnection), INTENT(in) :: self
+WRITE(*,'(A)')  You are now connected with MySQL
+  END SUBROUTINE mysql_desc
+end module
+
+
+  PROGRAM main
+   USE factory_pattern
+
+   IMPLICIT NONE
+
+   TYPE(CFactory) :: factory
+   CLASS(Connection), POINTER :: db_connect = NULL()
+
+   CALL factory%init(Oracle)
+   db_connect = factory%create_connection()   !! Create Oracle DB
+   CALL db_connect%description()
+
+   !! The same factory can be used to create different connections
+   CALL factory%init(MySQL)  !! Create MySQL DB
+
+   !! 'connect' is a 'class' pointer. So can be used for either Oracle or MySQL
+   db_connect = factory%create_connection()
+   CALL db_connect%description()
+
+   CALL factory%finalize()! Destroy the object
+
+  END PROGRAM main
+
+! { dg-final { cleanup-modules factory_pattern } }


Re: FW: patch to fix PR21617

2012-01-25 Thread Vladimir Makarov

On 01/23/2012 06:32 AM, Igor Zamyatin wrote:

Unfortunately patch doesn't help neither for separate EEMBC_2_0 tests
nor for the whole benchmark.

Do you want me to do some debugging here?

For now I am out of ideas how to fix the PR in alternative way without 
some performance degradation on SPEC or EEMBC.


Any reduced test case from EEMBC where I can see performance degradation 
might help me too.




Re: [patch] Fix mismatched #pragma GCC visibility

2012-01-25 Thread Dave Korn
On 25/01/2012 03:27, Rafael Ávila de Espíndola wrote:

 Sorry, one more case that gcc accepts where it is not clear what the
 result should be:
 
 -
 #pragma GCC visibility push(protected)
 
 int x;
 class  __attribute__((visibility(hidden))) foo {
   static int a;
 #pragma GCC visibility pop
   static int b;
 };
 int y;
 
 int foo::a;
 int foo::b;
 -
 
 Should this be reject (as happens with namespaces)? If not what is the
 expected result? Currently we get
 
 x - protected
 y - default
 a - hidden
 b - hidden

  According to the manual:

  In C++, `#pragma GCC visibility' affects only namespace-scope
  declarations.  Class members and template specializations are not
  affected; if you want to override the visibility for a particular
  member or instantiation, you must use an attribute.

  Looks like it's working to me.

cheers,
  DaveK



Re: [Patch, Fortran] PR 51987 - Fix setting of f2k_derived - and thus fix CLASS-based TBP

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

On Wed, Jan 25, 2012 at 5:38 PM, Tobias Burnus bur...@net-b.de wrote:
 Dear all,

 seemingly it can sometimes happen that fclass gets created but the
 fclass-f2k_derived is not set. This patch now sets it explicitly, if unset.

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

OK for trunk.

I think that this lack of an f2k_derived explains one of my earlier
fixes to typebound operators.  I was puzzled about why I had to check
the current namespace with the generic name in order to resolve for a
specific procedure.  I'll put it as one of my TODOs.

Thanks

Paul

 PS: I am still looking for someone to review my rather straight-forward
 patch at http://gcc.gnu.org/ml/fortran/2012-01/msg00197.html

Forward me the message and I will do the honours.


RE: [Patch,AVR]: Rename address spaces

2012-01-25 Thread Weddington, Eric


 -Original Message-
 From: Georg-Johann Lay [mailto:a...@gjlay.de]
 Sent: Wednesday, January 25, 2012 4:02 AM
 To: gcc-patches@gcc.gnu.org
 Cc: Denis Chertykov; Weddington, Eric; Joerg Wunsch
 Subject: [Patch,AVR]: Rename address spaces
 
 This patch renames the named address spaces from their initial draft
names
 to
 their final names as proposed by several developers, amongst them
Eric.
 
 * Using __flash will make porting to/from other compilers easier.
 * __flash is more descriptive than the meaningless __pgm.
 * __pgm might lead to confusion with the pgm_ macros from avr-libc.
 
 The 24-bit address space is named differently: It's renamed to __memx
to
 point
 out its difference to the other spaces that only address flash.
 
 The patch not only renames the address spaces (which would just change
the
 7
 strings in avr.c:avr_addrspace) but also renames some identifiers,
 function
 names, enums etc. so that they are kept in sync with the new names is
most
 places.
 
 Ok for trunk?

Please commit, and thanks for renaming the spaces. :-)

Eric Weddington


Re: [Patch,AVR]: Rename address spaces

2012-01-25 Thread Joerg Wunsch
As Georg-Johann Lay wrote:

 Ok for trunk?

Fine with me, too!

-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


Re: [patch, arm, testsuite] fix regression in test di-longlong64-sync-withldrexd.c

2012-01-25 Thread Mike Stump
On Jan 25, 2012, at 7:35 AM, Greta Yorsh wrote:
 The test gcc.target/arm/di-longlong64-sync-withldrexd.c fails on
 arm-none-eabi target, because gcc generates 48 LDREXD and 48 STREXD
 instructions instead of the expected 46.
 
 FAIL: gcc.target/arm/di-longlong64-sync-withldrexd.c scan-assembler-times
 tldrexd 46
 FAIL: gcc.target/arm/di-longlong64-sync-withldrexd.c scan-assembler-times
 tstrexd 46

 The regression PASS-FAIL was introduced for target arm-none-eabi in the
 first week of November 2011.

Gosh, that seems like a long time to notice and adjust the testcase for a port 
that seems popular enough and has a nice representation around here.  :-(

* gcc.target/arm/di-longlong64-sync-withldrexd.c:

Please say slightly more than this.

Also, if you mean to ask for a review, please include an Ok?  in there.

I'll assume you meant to ask for a review.  Ok.  If you aren't absolutely sure 
about the codegen or have an doubts, please ping an arm person for review of 
the codegen.


RE: [patch, arm, testsuite] fix regression in test di-longlong64-sync-withldrexd.c

2012-01-25 Thread Greta Yorsh
On 25 January 2012, at 18:14, Mike Stump wrote:
 On Jan 25, 2012, at 7:35 AM, Greta Yorsh wrote:
  The test gcc.target/arm/di-longlong64-sync-withldrexd.c fails on
  arm-none-eabi target, because gcc generates 48 LDREXD and 48 STREXD
  instructions instead of the expected 46.
 
  FAIL: gcc.target/arm/di-longlong64-sync-withldrexd.c scan-assembler-
 times
  tldrexd 46
  FAIL: gcc.target/arm/di-longlong64-sync-withldrexd.c scan-assembler-
 times
  tstrexd 46
 
  The regression PASS-FAIL was introduced for target arm-none-eabi in
 the
  first week of November 2011.
 
 Gosh, that seems like a long time to notice and adjust the testcase for
 a port that seems popular enough and has a nice representation around
 here.  :-(
 
 * gcc.target/arm/di-longlong64-sync-withldrexd.c:
 
 Please say slightly more than this.

I'm sorry. Here is the full entry:

   * gcc.target/arm/di-longlong64-sync-withldrexd.c: Accept
 new code generated for __sync_lock_release.
 
 Also, if you mean to ask for a review, please include an Ok?  in there.
 
 I'll assume you meant to ask for a review.  
 Ok.  If you aren't
 absolutely sure about the codegen or have an doubts, please ping an arm
 person for review of the codegen.

Copying an arm person as well as the author of r18, which introduced the
change in __sync_lock_release. 

Thank you,
Greta





Go patch committed: Always lower subexpressions of lowered expressions

2012-01-25 Thread Ian Lance Taylor
This patch to the Go frontend always lowers subexpressions of lowered
expressions.  This ensures that all parts of an expression are lowered.
Without this change, comparisons of struct fields embedded within
structs were not handled correctly.  They would be passed to the backend
as an EQ_EXPR of the struct, which failed if some of the fields required
a more complex comparison (e.g., strings).  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r be2e13389165 go/gogo.cc
--- a/go/gogo.cc	Tue Jan 24 15:24:58 2012 -0800
+++ b/go/gogo.cc	Wed Jan 25 10:52:19 2012 -0800
@@ -1520,6 +1520,8 @@
   this-inserter_, this-iota_value_);
   if (enew == e)
 	break;
+  if (enew-traverse_subexpressions(this) == TRAVERSE_EXIT)
+	return TRAVERSE_EXIT;
   *pexpr = enew;
 }
   return TRAVERSE_SKIP_COMPONENTS;


[v3, committed] Add dg-require-*s to various tests

2012-01-25 Thread Richard Sandiford
This patch adds dg-require-time to tests that require a system clock
and dg-require-fileio to tests that perform file I/O.

Tested on mipsisa64-elf and applied as (I hope) obvious.

Richard


libstdc++-v3/
* testsuite/20_util/system_clock/1.cc: Add dg-require-time.
* testsuite/22_locale/time_put/put/wchar_t/12439_1.cc: Likewise.
* testsuite/22_locale/time_put/put/wchar_t/12439_2.cc: Likewise.
* testsuite/22_locale/time_put/put/wchar_t/12439_3.cc: Likewise.
* testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc: Add
dg-require-fileio.
* testsuite/27_io/basic_istream/seekg/wchar_t/fstream.cc: Likewise.
* testsuite/27_io/basic_istream/tellg/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_istream/tellg/wchar_t/fstream.cc: Likewise.
* testsuite/27_io/basic_ostream/seekp/wchar_t/2346-fstream.cc:
Likewise.
* testsuite/27_io/basic_ostream/tellp/wchar_t/1.cc: Likewise.

Index: libstdc++-v3/testsuite/20_util/system_clock/1.cc
===
--- libstdc++-v3/testsuite/20_util/system_clock/1.cc2012-01-25 
18:50:10.0 +
+++ libstdc++-v3/testsuite/20_util/system_clock/1.cc2012-01-25 
18:50:15.0 +
@@ -1,5 +1,6 @@
 // { dg-options -std=gnu++0x }
 // { dg-require-cstdint  }
+// { dg-require-time  }
 
 // Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation
 //
Index: libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
===
--- libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
2012-01-25 18:50:09.0 +
+++ libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
2012-01-25 18:50:15.0 +
@@ -15,6 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // http://www.gnu.org/licenses/.
 
+// { dg-require-time  }
+
 // 22.2.5.3.1 time_put members
 
 #include locale
Index: libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
===
--- libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
2012-01-25 18:50:10.0 +
+++ libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
2012-01-25 18:50:15.0 +
@@ -15,6 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // http://www.gnu.org/licenses/.
 
+// { dg-require-time  }
+
 // 22.2.5.3.1 time_put members
 
 #include locale
Index: libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
===
--- libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
2012-01-25 18:50:10.0 +
+++ libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
2012-01-25 18:50:15.0 +
@@ -15,6 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // http://www.gnu.org/licenses/.
 
+// { dg-require-time  }
+
 // 22.2.5.3.1 time_put members
 
 #include locale
Index: libstdc++-v3/testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc
===
--- libstdc++-v3/testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc   
2012-01-25 18:50:09.0 +
+++ libstdc++-v3/testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc   
2012-01-25 18:50:15.0 +
@@ -20,6 +20,7 @@
 // { dg-do run { xfail arm*-*-elf arm*-*-eabi } }
 
 // { dg-require-binary-io  }
+// { dg-require-fileio  }
 
 // 27.6.1.3 unformatted input functions
 // @require@ %-*.tst %-*.txt
Index: libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/fstream.cc
===
--- libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/fstream.cc 
2012-01-25 18:50:09.0 +
+++ libstdc++-v3/testsuite/27_io/basic_istream/seekg/wchar_t/fstream.cc 
2012-01-25 18:50:15.0 +
@@ -15,6 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // http://www.gnu.org/licenses/.
 
+// { dg-require-fileio  }
+
 // 27.6.1.3 unformatted input functions
 // NB: ostream has a particular seeks category. Adopt this for istreams too.
 // @require@ %-*.tst %-*.txt
Index: libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/1.cc
===
--- libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/1.cc   
2012-01-25 18:50:09.0 +
+++ libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/1.cc   
2012-01-25 18:50:15.0 +
@@ -15,6 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // http://www.gnu.org/licenses/.
 
+// { dg-require-fileio  }
+
 // 27.6.1.3 unformatted input functions
 // NB: ostream has a particular seeks category. Adopt this for istreams too.
 // @require@ %-*.tst %-*.txt
Index: 

Re: RFA: fix PR 51649

2012-01-25 Thread Tom Tromey
 Jakub == Jakub Jelinek ja...@redhat.com writes:

Jakub Well, even bad debugging experience problems would be very undesirable
Jakub if we generated wrong debug info and everybody compiled it into their
Jakub sources.  But pretty-printers stay on the side, it is just a matter of
Jakub updating the python scripts and there is no need to recompile already
Jakub compiled/linked programs/libraries.  So if properly tested, I think
Jakub this could go in.

I tested them against gdb 7.3, 7.4 and trunk; configured both ways (with
--enable-symvers=gnu-versioned-namespace and the other way).

I also hacked the test suite so I could try gdb 7.2 (normally this is
rejected) and this worked as well as could be expected (7.2 had some
formatting issues leading to test suite failures -- but really it still
worked ok).

This patch also adds some test cases.

Unless you have other tests to suggest, I am going to say that it has
been sufficiently tested and check it in on Friday.

thanks,
Tom


[MIPS, committed] Fix handling of small-data asm operands

2012-01-25 Thread Richard Sandiford
The testcase for PR 51933 was failing on mipsisa64-elf because md_reorg
changed a symbolic small-data asm operand into a LO_SUM.

Tested on mipsisa64-elf and applied.

Richard


gcc/
* config/mips/mips.c: Don't process ASM_OPERANDS.

Index: gcc/config/mips/mips.c
===
--- gcc/config/mips/mips.c  2012-01-25 18:53:22.0 +
+++ gcc/config/mips/mips.c  2012-01-25 18:53:59.0 +
@@ -3101,7 +3101,10 @@ mips_small_data_pattern_1 (rtx *loc, voi
 {
   enum mips_symbol_context context;
 
-  if (GET_CODE (*loc) == LO_SUM)
+  /* Ignore things like g constraints in asms.  We make no particular
+ guarantee about which symbolic constants are acceptable as asm operands
+ versus which must be forced into a GPR.  */
+  if (GET_CODE (*loc) == LO_SUM || GET_CODE (*loc) == ASM_OPERANDS)
 return -1;
 
   if (MEM_P (*loc))


Re: [v3, committed] Add dg-require-*s to various tests

2012-01-25 Thread Paolo Carlini
Hi,

 Tested on mipsisa64-elf and applied as (I hope) obvious.

Sure obvious, in this case. In general, when tweaking the testsuite with the 
goal of disabling some tests, I would recommend also double checking that 
nothing gets inadvertently disabled on different targets, eg, run the testsuite 
on x86_64-linux too. 

Paolo


Go patch committed: Handle a few more test lines

2012-01-25 Thread Ian Lance Taylor
I somehow missed a few test lines in the updated Go testsuite, causing
the tests to be marked as unsupported.  This patch updates the driver to
handle them.  Fortunately they all pass.  Ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2012-01-25  Ian Lance Taylor  i...@google.com

* go.test/go-test.exp (go-gc-tests): Handle a few more test
lines.


Index: go.test/go-test.exp
===
--- go.test/go-test.exp	(revision 183529)
+++ go.test/go-test.exp	(working copy)
@@ -448,6 +448,7 @@ proc go-gc-tests { } {
 	go-torture-execute $test
 	file delete core [glob -nocomplain core.*]
 	} elseif { $test_line == // \$G \$D/\$F.go  \$L \$F.\$A  ./\$A.out 21 | cmp - \$D/\$F.out \
+		   || $test_line == // \$G \$F.go  \$L \$F.\$A  ./\$A.out 21 | cmp - \$D/\$F.out \
 		   || $test_line == // (\$G \$D/\$F.go  \$L \$F.\$A  ./\$A.out 21 | cmp - \$D/\$F.out) } {
 	# This is an execution test for which we need to check the
 	# program output.
@@ -493,7 +494,8 @@ proc go-gc-tests { } {
 		   || [string match // \$G \$F.go || echo BUG* \
 			   $test_line] \
 		   || [string match // ! \$G \$D/\$F.go  echo BUG* \
-			   $test_line] } {
+			   $test_line] \
+		   || $test_line == // echo bug395 is broken  # takes 90+ seconds to break } {
 	# This is a vanilla compile test.
 	set dg-do-what-default assemble
 	go-dg-runtest $test -w $DEFAULT_GOCFLAGS
@@ -854,11 +856,17 @@ proc go-gc-tests { } {
 	}
 	file delete $ofile0 $ofile1 $ofile2 $output_file
 	set runtests $hold_runtests
-	} elseif { $test_line == // \$G \$D/import2.go  \$G \$D/\$F\.go } {
+	} elseif { $test_line == // \$G \$D/import2.go  \$G \$D/\$F\.go \
+		   || $test_line == // \$G \$D/recursive1.go  \$G \$D/\$F.go } {
+	if { $test_line == // \$G \$D/import2.go  \$G \$D/\$F\.go } {
+		set name1 import2.go
+	} elseif { $test_line == // \$G \$D/recursive1.go  \$G \$D/\$F.go } {
+		set name1 recursive1.go
+	}
 	set hold_runtests $runtests
 	set runtests go-test.exp
 	set dg-do-what-default assemble
-	regsub /\[^/\]*$ $test /import2.go file1
+	regsub /\[^/\]*$ $test /${name1} file1
 	dg-test -keep-output $file1 -O -w $DEFAULT_GOCFLAGS
 	set ofile1 [file rootname [file tail $file1]].o
 	dg-test $test -O -w $DEFAULT_GOCFLAGS


Re: Keep static VTA locs in cselib tables only

2012-01-25 Thread Richard Sandiford
Richard Sandiford rdsandif...@googlemail.com writes:
 Alexandre Oliva aol...@redhat.com writes:
 On Nov 25, 2011, Jakub Jelinek ja...@redhat.com wrote:
 The numbers I got with your patch (RTL checking) are below, seems
 the cumulative numbers other than 100% are all bigger with patched stage2,
 which means unfortunately debug info quality degradation.

 Not really.  I found some actual degradation after finally getting back
 to it.  In some cases, I failed to reset NO_LOC_P, and this caused
 expressions that depended on it to resort to alternate values or end up
 unset.  In other cases, we created different cselib values for debug
 temps and implicit ptrs, and merging them at dataflow confluences no
 longer found a common value because the common value was in cselib's
 static equivalence table.  I've fixed (and added an assertion to catch)
 left-over NO_LOC_Ps, and arranged for values created for debug exprs,
 implicit ptr, entry values and parameter refs to be preserved across
 basic blocks as constants within cselib.

 With that, the debug info we get is a strict improvement in terms of
 coverage, even though a bunch of .o files still display a decrease in
 100% coverage.  In the handful files I examined, the patched compiler
 was emitting a loc list without full coverage, while the original
 compiler was emitting a single loc expr, that implicitly got full
 coverage even though AFAICT it should really cover a narrower range.
 Full coverage was a false positive, and less-than-100% coverage in these
 cases is not a degradation, but rather an improvement.

 Now, the reason why we emit additional expressions now is that the new
 algorithm is more prone to emitting different (and better) expressions
 when entering basic block, because we don't try as hard as before to
 keep on with the same location expression.  Instead we recompute all the
 potentially-changed expressions, which will tend to select better
 expressions if available.

 Otherwise the patch looks good to me.

 Thanks.  After the updated comparison data below, you can find the patch
 I'm checking in, followed by the small interdiff from the previous
 patch.


 Happy GNU Year! :-)


 The results below can be reproduced with r182723.

 stage1 sources are patched, stage2 and stage3 aren't, so
 stage2 is built with a patched compiler, stage3 isn't.

 $ wc -l obj-{x86_64,i686}-linux-gnu/stage[23]-gcc/cc1plus.ev
   100784 obj-x86_64-linux-gnu/stage2-gcc/cc1plus.ev
   102406 obj-x86_64-linux-gnu/stage3-gcc/cc1plus.ev
33275 obj-i686-linux-gnu/stage2-gcc/cc1plus.ev
33944 obj-i686-linux-gnu/stage3-gcc/cc1plus.ev

 $ wc -l obj-{x86_64,i686}-linux-gnu/stage[23]-gcc/cc1plus.csv
523647 obj-x86_64-linux-gnu/stage2-gcc/cc1plus.csv
523536 obj-x86_64-linux-gnu/stage3-gcc/cc1plus.csv
521276 obj-i686-linux-gnu/stage2-gcc/cc1plus.csv
521907 obj-i686-linux-gnu/stage3-gcc/cc1plus.csv

 $ diff -yW80 obj-x86_64-linux-gnu/stage[23]-gcc/cc1plus.ls
 cov%samples cumul   cov%samples cumul
 0.0 150949/30%  150949/30%| 0.0 150980/30%  150980/30%
 0..56234/1% 157183/31%| 0..56254/1% 157234/31%
 6..10   5630/1% 162813/32%| 6..10   5641/1% 162875/32%
 11..15  4675/0% 167488/33%| 11..15  4703/0% 167578/33%
 16..20  5041/1% 172529/34%| 16..20  5044/1% 172622/34%
 21..25  5435/1% 177964/35%| 21..25  5466/1% 178088/35%
 26..30  4249/0% 182213/36%| 26..30  4269/0% 182357/36%
 31..35  4666/0% 186879/37%| 31..35  4674/0% 187031/37%
 36..40  6939/1% 193818/38%| 36..40  6982/1% 194013/38%
 41..45  7824/1% 201642/40%| 41..45  7859/1% 201872/40%
 46..50  8538/1% 210180/42%| 46..50  8536/1% 210408/42%
 51..55  7585/1% 217765/43%| 51..55  7611/1% 218019/43%
 56..60  6088/1% 223853/44%| 56..60  6108/1% 224127/44%
 61..65  5545/1% 229398/45%| 61..65  5574/1% 229701/46%
 66..70  7151/1% 236549/47%| 66..70  7195/1% 236896/47%
 71..75  8068/1% 244617/49%| 71..75  8104/1% 245000/49%
 76..80  18852/3%263469/52%| 76..80  18879/3%263879/52%
 81..85  11958/2%275427/55%| 81..85  11954/2%275833/55%
 86..90  15201/3%290628/58%| 86..90  15145/3%290978/58%
 91..95  16814/3%307442/61%| 91..95  16727/3%307705/61%
 96..99  17121/3%324563/65%| 96..99  16991/3%324696/65%
 100 174515/34%  499078/100%   | 100 173994/34%  498690/100%

 $ diff -yW80 obj-i686-linux-gnu/stage[23]-gcc/cc1plus.ls
 cov%samples cumul   cov%samples cumul
 0.0 145453/27%  145453/27%| 0.0 145480/27%  145480/27%
 0..56594/1% 152047/29%| 0..56603/1% 152083/29%
 6..10   5664/1% 157711/30%| 6..10   5671/1% 157754/30%
 11..15  4982/0% 162693/31%| 11..15  4997/0% 162751/31%
 16..20  6155/1% 

[Patch] PR51374: combine.c and volatile correctness

2012-01-25 Thread Georg-Johann Lay
This patch fixes PR51374 by more strictly updating mem_last_set.
Sloppy handling of mem_last_set can lead to error in volatile correctness
because combine then is allowed to drag one volatile access over an other
volatile thing (volatile access, asm volatile, unspec_volatile...).

As explained in the source comment, any volatile might change memory, even a
volatile read.

Moreover, writes of the shape (set (zero_extract (mem ... update mem_last_set.

combine still optimizes volatile insn like the SFR bit accesses in the PR
example if that does not require to drag one volatile over an other.

Tested without regressions on i686-pc-linux-gnu

Ok to apply?

Johann

PR rtl-optimization/51374
* combine.c (record_dead_and_set_regs_1): Update mem_last_set
when reading from volatile memory or writing to mem via zero
extract.

Index: combine.c
===
--- combine.c	(revision 183472)
+++ combine.c	(working copy)
@@ -12365,7 +12365,24 @@ record_dead_and_set_regs_1 (rtx dest, co
   else if (MEM_P (dest)
 	   /* Ignore pushes, they clobber nothing.  */
 	! push_operand (dest, GET_MODE (dest)))
-mem_last_set = DF_INSN_LUID (record_dead_insn);
+{
+  mem_last_set = DF_INSN_LUID (record_dead_insn);
+}
+  else if (ZERO_EXTRACT == GET_CODE (dest)
+MEM_P (XEXP (dest, 0)))
+{
+  mem_last_set = DF_INSN_LUID (record_dead_insn);
+}
+
+  /* Even reading a volatile memory location might change memory.
+ One example is reading an SFR that contains a latch or that belong to
+ a part of a communication unit where reading a FIFO register sets some
+ status or busy bits located elsewhere.  */
+
+  if (volatile_refs_p (PATTERN (record_dead_insn)))
+{
+  mem_last_set = DF_INSN_LUID (record_dead_insn);
+}
 }
 
 /* Update the records of when each REG was most recently set or killed


Re: PR lto/51698 and the state of LTO + transactional memory

2012-01-25 Thread Richard Henderson
On 01/26/2012 12:36 AM, Aldy Hernandez wrote:
 I would like another approval, just in case you disagree with the way I 
 changed the dummy declarations in the LTO testsuite.

Still ok.


r~


[PATCH] Assume PATTERN is always non-NULL in sched-deps.c (PR middle-end/51986)

2012-01-25 Thread Jakub Jelinek
Hi!

This PR is about a warning that rev may be used uninitialized when
sched_get_condition_with_rev_uncached is inlined into its caller.
It in fact may be used uninitialized if PATTERN (insn) is ever NULL.
But IMNSHO everything in the compiler assumes that PATTERN of an insn
is always non-NULL, so IMHO instead of just moving the
if (rev) *rev = false; hunk above the test we should just remove this test.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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

PR middle-end/51986
* sched-deps.c (sched_get_condition_with_rev_uncached): Don't test
for pat == 0.

--- gcc/sched-deps.c.jj 2011-12-01 11:45:06.0 +0100
+++ gcc/sched-deps.c2012-01-25 15:27:49.523165701 +0100
@@ -521,9 +521,6 @@ sched_get_condition_with_rev_uncached (c
   rtx pat = PATTERN (insn);
   rtx src;
 
-  if (pat == 0)
-return 0;
-
   if (rev)
 *rev = false;
 

Jakub


Re: [MIPS, committed] Fix handling of small-data asm operands

2012-01-25 Thread Richard Sandiford
Richard Sandiford rdsandif...@googlemail.com writes:
 The testcase for PR 51933 was failing on mipsisa64-elf because md_reorg
 changed a symbolic small-data asm operand into a LO_SUM.

 Tested on mipsisa64-elf and applied.

 Richard


 gcc/
   * config/mips/mips.c: Don't process ASM_OPERANDS.

...now with added function name.

Richard


[PATCH, RFC, PR18589] Enhance tree-ssa-reassoc to optimize repeated factors

2012-01-25 Thread William J. Schmidt
PR18589 identifies missed optimization opportunities for multiplies with
repeated factors, whether explicitly repeated or produced by a
__builtin_pow or __builtin_powi call.  This patch, proposed for 4.8,
expands such built-in calls to expose the base factors, pre-multiplies
repeated factors together, and builds new __builtin_powi calls where
appropriate.

This is done only in the first reassociation pass, so that the
__builtin_powi expansion done during pass_cse_sincos can produce the
optimal number of multiplies from the built-in calls.  I had to create a
separate pass variable to permit this (splitting pass_reassoc into
pass_early_reassoc and pass_late_reassoc).  Surprisingly, this only
affected one test in the regression suite.

Again, this is proposed for 4.8, so I am only looking for comments at
this time.

Thanks,
Bill


gcc:

2012-01-25  Bill Schmidt  wschm...@linux.vnet.ibm.com

* tree-pass.h: Replace pass_reassoc with pass_early_reassoc and
pass_late_reassoc.
* passes.c (init_optimization_passes): Change pass_reassoc calls to
pass_early_reassoc and pass_late_reassoc.
* tree-ssa-reassoc.c (reassociate_stats): Add two fields.
(early_reassoc): New static var.
(MAX_POW_EXPAND): New #define'd constant.
(linear_expand_pow_common): New function.
(linear_expand_powi): Likewise.
(linear_expand_pow): Likewise.
(break_up_subtract_bb): Attempt to expand __builtin_pow[i].
(repeat_factor_d): New struct and associated typedefs.
(repeat_factor_vec): New static vector variable.
(compare_repeat_factors): New function.
(get_reassoc_pow_ssa_name): Likewise.
(attempt_builtin_powi): Likewise.
(reassociate_bb): Attempt to reconstitute __builtin_powi calls, and
multiply their results by any leftover reassociated factors.
(fini_reassoc): Two new calls to statistics_counter_event.
(execute_early_reassoc): New function.
(execute_late_reassoc): Likewise.
(pass_early_reassoc): Replace pass_reassoc, renamed to reassoc1,
call execute_early_reassoc.
(pass_late_reassoc): New gimple_opt_pass named reassoc2 that calls
execute_late_reassoc.

gcc/testsuite:

2012-01-25  Bill Schmidt  wschm...@linux.vnet.ibm.com

* gcc.dg/pr46309.c: Change -fdump-tree-reassoc-details to
-fdump-tree-reassoc[12]-details.
* gcc.dg/tree-ssa/pr18589-1.c: New test.
* gcc.dg/tree-ssa/pr18589-2.c: Likewise.
* gcc.dg/tree-ssa/pr18589-3.c: Likewise.
* gcc.dg/tree-ssa/pr18589-4.c: Likewise.
* gcc.dg/tree-ssa/pr18589-5.c: Likewise.
* gcc.dg/tree-ssa/pr18589-6.c: Likewise.
* gcc.dg/tree-ssa/pr18589-7.c: Likewise.
* gcc.dg/tree-ssa/pr18589-8.c: Likewise.


Index: gcc/tree-pass.h
===
--- gcc/tree-pass.h (revision 183444)
+++ gcc/tree-pass.h (working copy)
@@ -440,7 +440,8 @@ extern struct gimple_opt_pass pass_copy_prop;
 extern struct gimple_opt_pass pass_vrp;
 extern struct gimple_opt_pass pass_uncprop;
 extern struct gimple_opt_pass pass_return_slot;
-extern struct gimple_opt_pass pass_reassoc;
+extern struct gimple_opt_pass pass_early_reassoc;
+extern struct gimple_opt_pass pass_late_reassoc;
 extern struct gimple_opt_pass pass_rebuild_cgraph_edges;
 extern struct gimple_opt_pass pass_remove_cgraph_callee_edges;
 extern struct gimple_opt_pass pass_build_cgraph_edges;
Index: gcc/testsuite/gcc.dg/pr46309.c
===
--- gcc/testsuite/gcc.dg/pr46309.c  (revision 183444)
+++ gcc/testsuite/gcc.dg/pr46309.c  (working copy)
@@ -1,6 +1,6 @@
 /* PR tree-optimization/46309 */
 /* { dg-do compile } */
-/* { dg-options -O2 -fdump-tree-reassoc-details } */
+/* { dg-options -O2 -fdump-tree-reassoc1-details 
-fdump-tree-reassoc2-details } */
 /* The transformation depends on BRANCH_COST being greater than 1
(see the notes in the PR), so try to force that.  */
 /* { dg-additional-options -mtune=octeon2 { target mips*-*-* } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/pr18589-4.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/pr18589-4.c   (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/pr18589-4.c   (revision 0)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options -O3 -ffast-math -fdump-tree-optimized } */
+
+double baz (double x, double y, double z, double u)
+{
+  return x * x * y * y * y * z * z * z * z * u;
+}
+
+/* { dg-final { scan-tree-dump-times  \\*  7 optimized } } */
+/* { dg-final { cleanup-tree-dump optimized } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/pr18589-5.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/pr18589-5.c   (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/pr18589-5.c   (revision 0)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */

[PATCH] Fix -gdwarf-4 -fdebug-types-section cloning (PR debug/51950)

2012-01-25 Thread Jakub Jelinek
Hi!

As detailed in the PR, when copy_decls_walk uses clone_tree,
it enters just the clone node of tag into the hash table and not
any children.  On the testcase in that PR this DIE (DW_TAG_subroutine_type)
contains DW_AT_object_pointer attribute which refers to its child node
(DW_TAG_formal_parameter).   As the child has been just cloned, but not
added to the hash table, when copy_decls_walk adjusts attributes of
the DW_TAG_subroutine_type clone, it doesn't find that the child
DW_TAG_formal_parameter has been cloned and creates a new clone and
adjusts DW_AT_object_pointer to point to that.  It then goes on to attempt
to clone its ancestors, but the parent is already in the hash table,
so just adds this second DW_TAG_formal_parameter as another child
of that.

Fixed by adding all the children DIE clones to the hash table.
IMHO they can't appear in the hash table before (checked now with
an assert), because otherwise we'd have cloned the ancestors too.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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

PR debug/51950
* dwarf2out.c (clone_tree_hash): New function.
(copy_decls_walk): Use it instead of clone_tree.

--- gcc/dwarf2out.c.jj  2012-01-23 18:23:45.0 +0100
+++ gcc/dwarf2out.c 2012-01-25 18:32:24.026350399 +0100
@@ -7406,6 +7406,32 @@ copy_ancestor_tree (dw_die_ref unit, dw_
   return copy;
 }
 
+/* Like clone_tree, but additionally enter all the children into
+   the hash table decl_table.  */
+
+static dw_die_ref
+clone_tree_hash (dw_die_ref die, htab_t decl_table)
+{
+  dw_die_ref c;
+  dw_die_ref clone = clone_die (die);
+  struct decl_table_entry *entry;
+  void **slot = htab_find_slot_with_hash (decl_table, die,
+ htab_hash_pointer (die), INSERT);
+  /* Assert that DIE isn't in the hash table yet.  If it would be there
+ before, the ancestors would be necessarily there as well, therefore
+ clone_tree_hash wouldn't be called.  */
+  gcc_assert (*slot == HTAB_EMPTY_ENTRY);
+  entry = XCNEW (struct decl_table_entry);
+  entry-orig = die;
+  entry-copy = clone;
+  *slot = entry;
+
+  FOR_EACH_CHILD (die, c,
+ add_child_die (clone, clone_tree_hash (c, decl_table)));
+
+  return clone;
+}
+
 /* Walk the DIE and its children, looking for references to incomplete
or trivial types that are unmarked (i.e., that are not in the current
type_unit).  */
@@ -7442,7 +7468,11 @@ copy_decls_walk (dw_die_ref unit, dw_die
   else
 {
   dw_die_ref parent = unit;
-  dw_die_ref copy = clone_tree (targ);
+ dw_die_ref copy = clone_die (targ);
+
+ FOR_EACH_CHILD (targ, c,
+ add_child_die (copy,
+clone_tree_hash (c, decl_table)));
 
   /* Make sure the cloned tree is marked as part of the
  type unit.  */

Jakub


Re: [PATCH] Assume PATTERN is always non-NULL in sched-deps.c (PR middle-end/51986)

2012-01-25 Thread Vladimir Makarov

On 01/25/2012 03:10 PM, Jakub Jelinek wrote:

Hi!

This PR is about a warning that rev may be used uninitialized when
sched_get_condition_with_rev_uncached is inlined into its caller.
It in fact may be used uninitialized if PATTERN (insn) is ever NULL.
But IMNSHO everything in the compiler assumes that PATTERN of an insn
is always non-NULL, so IMHO instead of just moving the
if (rev) *rev = false; hunk above the test we should just remove this test.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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

PR middle-end/51986
* sched-deps.c (sched_get_condition_with_rev_uncached): Don't test
for pat == 0.

--- gcc/sched-deps.c.jj 2011-12-01 11:45:06.0 +0100
+++ gcc/sched-deps.c2012-01-25 15:27:49.523165701 +0100
@@ -521,9 +521,6 @@ sched_get_condition_with_rev_uncached (c
rtx pat = PATTERN (insn);
rtx src;

-  if (pat == 0)
-return 0;
-
if (rev)
  *rev = false;


Ok.  Thanks, Jakub.


Re: [Patch, Fortran] PR 51987 - Fix setting of f2k_derived - and thus fix CLASS-based TBP

2012-01-25 Thread Tobias Burnus

Dear all, dear Paul,

Dominique pointed out that the patch does not fully work and that one 
gets an ICE:

  internal compiler error: in gfc_release_symbol, at fortran/symbol.c:2531

For some odd reason, it didn't occur for my build, which had some 
unrelated patch applied. I have not understood why it worked with the 
unrelated patch. However, I do understand why it fails.


But with valgrind, I see it in all my builds. Fixed by the following 
patch. (Fixes the patch, valgrind shows now error and the test case 
still works.)


I will commit it as obvious after it regtesting it.

Sorry for the breakage.

Tobias

PS: I do now do the same as for if (fclass = NULL); while I do not 
quite understand why it works with gfc_get_namespace (NULL, 0), it does.


Index: class.c
===
--- class.c (Revision 183533)
+++ class.c (Arbeitskopie)
@@ -422,7 +422,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
   c-attr.pointer = 1;
 }
   else if (!fclass-f2k_derived)
-fclass-f2k_derived = fclass-components-ts.u.derived-f2k_derived;
+fclass-f2k_derived = gfc_get_namespace (NULL, 0);

   /* Since the extension field is 8 bit wide, we can only have
  up to 255 extension levels.  */




Re: [patch, arm, testsuite] fix regression in test di-longlong64-sync-withldrexd.c

2012-01-25 Thread Richard Henderson
On 01/26/2012 02:35 AM, Greta Yorsh wrote:
 Before the change, __sync_lock_release expanded into STRD, storing DI value 0.

The most important question is: Is STRD guaranteed to perform the store
atomically?  (And conversely, does LDRD perform the load atomically?)

If so (even for a subset of arch revisions going forward), then the
correct solution is to define atomic_{load,store}di patterns.

If not, then your patch is correct.


r~


libgo patch committed: Update to weekly.2012-01-15

2012-01-25 Thread Ian Lance Taylor
I have committed a patch to update libgo to the weekly.2012-01-15
release.  As usual I have not included the entire patch in this e-mail
message, just the changes to files that are specific to gccgo.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r d24c6bfbe9f1 libgo/MERGE
--- a/libgo/MERGE	Wed Jan 25 10:52:47 2012 -0800
+++ b/libgo/MERGE	Wed Jan 25 11:52:42 2012 -0800
@@ -1,4 +1,4 @@
-4a8268927758
+354b17404643
 
 The first line of this file holds the Mercurial revision number of the
 last merge done from the master library sources.
diff -r d24c6bfbe9f1 libgo/Makefile.am
--- a/libgo/Makefile.am	Wed Jan 25 10:52:47 2012 -0800
+++ b/libgo/Makefile.am	Wed Jan 25 11:52:42 2012 -0800
@@ -188,7 +188,7 @@
 toolexeclibgocryptoopenpgp_DATA = \
 	crypto/openpgp/armor.gox \
 	crypto/openpgp/elgamal.gox \
-	crypto/openpgp/error.gox \
+	crypto/openpgp/errors.gox \
 	crypto/openpgp/packet.gox \
 	crypto/openpgp/s2k.gox
 
@@ -235,6 +235,7 @@
 	exp/ebnf.gox \
 	$(exp_inotify_gox) \
 	exp/norm.gox \
+	exp/proxy.gox \
 	exp/spdy.gox \
 	exp/sql.gox \
 	exp/ssh.gox \
@@ -669,17 +670,25 @@
 if LIBGO_IS_LINUX
 go_net_cgo_file = go/net/cgo_linux.go
 go_net_sock_file = go/net/sock_linux.go
+go_net_sockopt_file = go/net/sockopt_linux.go
+go_net_sockoptip_file = go/net/sockoptip_linux.go
 else
 if LIBGO_IS_IRIX
 go_net_cgo_file = go/net/cgo_linux.go
 go_net_sock_file = go/net/sock_linux.go
+go_net_sockopt_file = go/net/sockopt_linux.go
+go_net_sockoptip_file = go/net/sockoptip_linux.go
 else
 if LIBGO_IS_SOLARIS
 go_net_cgo_file = go/net/cgo_linux.go
 go_net_sock_file = go/net/sock_linux.go
+go_net_sockopt_file = go/net/sockopt_linux.go
+go_net_sockoptip_file = go/net/sockoptip_linux.go
 else
 go_net_cgo_file = go/net/cgo_bsd.go
 go_net_sock_file = go/net/sock_bsd.go
+go_net_sockopt_file = go/net/sockopt_bsd.go
+go_net_sockoptip_file = go/net/sockoptip_bsd.go
 endif
 endif
 endif
@@ -728,6 +737,10 @@
 	$(go_net_sendfile_file) \
 	go/net/sock.go \
 	$(go_net_sock_file) \
+	go/net/sockopt.go \
+	$(go_net_sockopt_file) \
+	go/net/sockoptip.go \
+	$(go_net_sockoptip_file) \
 	go/net/tcpsock.go \
 	go/net/tcpsock_posix.go \
 	go/net/udpsock.go \
@@ -890,8 +903,7 @@
 go_testing_files = \
 	go/testing/benchmark.go \
 	go/testing/example.go \
-	go/testing/testing.go \
-	go/testing/wrapper.go
+	go/testing/testing.go
 
 go_time_files = \
 	go/time/format.go \
@@ -1061,8 +1073,8 @@
 	go/crypto/openpgp/armor/encode.go
 go_crypto_openpgp_elgamal_files = \
 	go/crypto/openpgp/elgamal/elgamal.go
-go_crypto_openpgp_error_files = \
-	go/crypto/openpgp/error/error.go
+go_crypto_openpgp_errors_files = \
+	go/crypto/openpgp/errors/errors.go
 go_crypto_openpgp_packet_files = \
 	go/crypto/openpgp/packet/compressed.go \
 	go/crypto/openpgp/packet/encrypted_key.go \
@@ -1142,6 +1154,7 @@
 go_encoding_xml_files = \
 	go/encoding/xml/marshal.go \
 	go/encoding/xml/read.go \
+	go/encoding/xml/typeinfo.go \
 	go/encoding/xml/xml.go
 
 go_exp_ebnf_files = \
@@ -1157,6 +1170,11 @@
 	go/exp/norm/readwriter.go \
 	go/exp/norm/tables.go \
 	go/exp/norm/trie.go
+go_exp_proxy_files = \
+	go/exp/proxy/direct.go \
+	go/exp/proxy/per_host.go \
+	go/exp/proxy/proxy.go \
+	go/exp/proxy/socks5.go
 go_exp_spdy_files = \
 	go/exp/spdy/read.go \
 	go/exp/spdy/types.go \
@@ -1173,7 +1191,7 @@
 	go/exp/ssh/doc.go \
 	go/exp/ssh/messages.go \
 	go/exp/ssh/server.go \
-	go/exp/ssh/server_shell.go \
+	go/exp/ssh/server_terminal.go \
 	go/exp/ssh/session.go \
 	go/exp/ssh/tcpip.go \
 	go/exp/ssh/transport.go
@@ -1210,7 +1228,8 @@
 	go/go/doc/doc.go \
 	go/go/doc/example.go \
 	go/go/doc/exports.go \
-	go/go/doc/filter.go
+	go/go/doc/filter.go \
+	go/go/doc/reader.go
 go_go_parser_files = \
 	go/go/parser/interface.go \
 	go/go/parser/parser.go
@@ -1461,8 +1480,15 @@
 # Define ForkExec and Exec.
 if LIBGO_IS_RTEMS
 syscall_exec_file = go/syscall/exec_stubs.go
+syscall_exec_os_file =
+else
+if LIBGO_IS_LINUX
+syscall_exec_file = go/syscall/exec_unix.go
+syscall_exec_os_file = go/syscall/exec_linux.go
 else
 syscall_exec_file = go/syscall/exec_unix.go
+syscall_exec_os_file = go/syscall/exec_bsd.go
+endif
 endif
 
 # Define Wait4.
@@ -1573,6 +1599,7 @@
 	go/syscall/syscall.go \
 	$(syscall_syscall_file) \
 	$(syscall_exec_file) \
+	$(syscall_exec_os_file) \
 	$(syscall_wait_file) \
 	$(syscall_sleep_file) \
 	$(syscall_errstr_file) \
@@ -1720,7 +1747,7 @@
 	crypto/xtea.lo \
 	crypto/openpgp/armor.lo \
 	crypto/openpgp/elgamal.lo \
-	crypto/openpgp/error.lo \
+	crypto/openpgp/errors.lo \
 	crypto/openpgp/packet.lo \
 	crypto/openpgp/s2k.lo \
 	crypto/x509/pkix.lo \
@@ -1743,6 +1770,7 @@
 	encoding/xml.lo \
 	exp/ebnf.lo \
 	exp/norm.lo \
+	exp/proxy.lo \
 	exp/spdy.lo \
 	exp/sql.lo \
 	exp/ssh.lo \
@@ -2578,15 +2606,15 @@
 	@$(CHECK)
 .PHONY: crypto/openpgp/elgamal/check
 
-@go_include@ crypto/openpgp/error.lo.dep
-crypto/openpgp/error.lo.dep: $(go_crypto_openpgp_error_files)
+@go_include@ crypto/openpgp/errors.lo.dep

Re: [patch tree-eh]: Fix bootstrap issue for libjava for 32-bit mingw target

2012-01-25 Thread Richard Henderson
On 01/26/2012 05:44 AM, Kai Tietz wrote:
 the following patch fixes a bootstrap issue for libjava (compile of
 verify.cc ICEs).  It is caused by the assumption that a GIMPLE_COND
 lhs side has always a type.  This isn't necessarily true, but it has
 by default boolean_type_node as type.

A perfectly valid assumption.  The Java front end must have forgotten
to set the type (to at least void_type_node).


r~


Re: [patch tree-eh]: Fix bootstrap issue for libjava for 32-bit mingw target

2012-01-25 Thread Andrew Pinski
On Wed, Jan 25, 2012 at 12:58 PM, Richard Henderson r...@redhat.com wrote:
 On 01/26/2012 05:44 AM, Kai Tietz wrote:
 the following patch fixes a bootstrap issue for libjava (compile of
 verify.cc ICEs).  It is caused by the assumption that a GIMPLE_COND
 lhs side has always a type.  This isn't necessarily true, but it has
 by default boolean_type_node as type.

 A perfectly valid assumption.  The Java front end must have forgotten
 to set the type (to at least void_type_node).

verify.cc is a C++ code so it is the C++ front-end.

Thanks,
Andrew Pinski


Re: [Patch, Fortran] PR 51987 - Fix setting of f2k_derived - and thus fix CLASS-based TBP

2012-01-25 Thread Steve Kargl
On Wed, Jan 25, 2012 at 09:27:51PM +0100, Tobias Burnus wrote:
 Dear all, dear Paul,
 
 Dominique pointed out that the patch does not fully work and that one 
 gets an ICE:
   internal compiler error: in gfc_release_symbol, at fortran/symbol.c:2531
 
 For some odd reason, it didn't occur for my build, which had some 
 unrelated patch applied. I have not understood why it worked with the 
 unrelated patch. However, I do understand why it fails.
 
 But with valgrind, I see it in all my builds. Fixed by the following 
 patch. (Fixes the patch, valgrind shows now error and the test case 
 still works.)
 
 I will commit it as obvious after it regtesting it.
 

JFYI, the patch fixes the ICE.

-- 
Steve


libgo patch committed: Update to weekly.2012-01-20

2012-01-25 Thread Ian Lance Taylor
I have committed a patch to libgo to update to the weekly.2012-01-20
release.  As usual this e-mail message only includes changes to files
specific to gccgo.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r dd654495ccfb libgo/MERGE
--- a/libgo/MERGE	Wed Jan 25 11:55:19 2012 -0800
+++ b/libgo/MERGE	Wed Jan 25 13:45:23 2012 -0800
@@ -1,4 +1,4 @@
-354b17404643
+9f2be4fbbf69
 
 The first line of this file holds the Mercurial revision number of the
 last merge done from the master library sources.
diff -r dd654495ccfb libgo/Makefile.am
--- a/libgo/Makefile.am	Wed Jan 25 11:55:19 2012 -0800
+++ b/libgo/Makefile.am	Wed Jan 25 13:45:23 2012 -0800
@@ -197,6 +197,16 @@
 toolexeclibgocryptox509_DATA = \
 	crypto/x509/pkix.gox
 
+toolexeclibgodatabasedir = $(toolexeclibgodir)/database
+
+toolexeclibgodatabase_DATA = \
+	database/sql.gox
+
+toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
+
+toolexeclibgodatabasesql_DATA = \
+	database/sql/driver.gox
+
 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
 
 toolexeclibgodebug_DATA = \
@@ -237,15 +247,10 @@
 	exp/norm.gox \
 	exp/proxy.gox \
 	exp/spdy.gox \
-	exp/sql.gox \
 	exp/ssh.gox \
 	exp/terminal.gox \
-	exp/types.gox
-
-toolexeclibgoexpsqldir = $(toolexeclibgoexpdir)/sql
-
-toolexeclibgoexpsql_DATA = \
-	exp/sql/driver.gox
+	exp/types.gox \
+	exp/utf8string.gox
 
 toolexeclibgogodir = $(toolexeclibgodir)/go
 
@@ -717,6 +722,7 @@
 	go/net/dnsclient_unix.go \
 	go/net/dnsconfig.go \
 	go/net/dnsmsg.go \
+	go/net/doc.go \
 	$(go_net_newpollserver_file) \
 	go/net/fd.go \
 	$(go_net_fd_os_file) \
@@ -793,6 +799,7 @@
 go_os_files = \
 	$(go_os_dir_file) \
 	go/os/dir.go \
+	go/os/doc.go \
 	go/os/env.go \
 	go/os/error.go \
 	go/os/error_posix.go \
@@ -1005,7 +1012,8 @@
 go_crypto_ecdsa_files = \
 	go/crypto/ecdsa/ecdsa.go
 go_crypto_elliptic_files = \
-	go/crypto/elliptic/elliptic.go
+	go/crypto/elliptic/elliptic.go \
+	go/crypto/elliptic/p224.go
 go_crypto_hmac_files = \
 	go/crypto/hmac/hmac.go
 go_crypto_md4_files = \
@@ -1094,6 +1102,14 @@
 go_crypto_x509_pkix_files = \
 	go/crypto/x509/pkix/pkix.go
 
+go_database_sql_files = \
+	go/database/sql/convert.go \
+	go/database/sql/sql.go
+
+go_database_sql_driver_files = \
+	go/database/sql/driver/driver.go \
+	go/database/sql/driver/types.go
+
 go_debug_dwarf_files = \
 	go/debug/dwarf/buf.go \
 	go/debug/dwarf/const.go \
@@ -1179,9 +1195,6 @@
 	go/exp/spdy/read.go \
 	go/exp/spdy/types.go \
 	go/exp/spdy/write.go
-go_exp_sql_files = \
-	go/exp/sql/convert.go \
-	go/exp/sql/sql.go
 go_exp_ssh_files = \
 	go/exp/ssh/channel.go \
 	go/exp/ssh/cipher.go \
@@ -1205,10 +1218,8 @@
 	go/exp/types/gcimporter.go \
 	go/exp/types/types.go \
 	go/exp/types/universe.go
-
-go_exp_sql_driver_files = \
-	go/exp/sql/driver/driver.go \
-	go/exp/sql/driver/types.go
+go_exp_utf8string_files = \
+	go/exp/utf8string/string.go
 
 go_go_ast_files = \
 	go/go/ast/ast.go \
@@ -1467,7 +1478,6 @@
 go_unicode_utf16_files = \
 	go/unicode/utf16/utf16.go
 go_unicode_utf8_files = \
-	go/unicode/utf8/string.go \
 	go/unicode/utf8/utf8.go
 
 # Define Syscall and Syscall6.
@@ -1751,6 +1761,8 @@
 	crypto/openpgp/packet.lo \
 	crypto/openpgp/s2k.lo \
 	crypto/x509/pkix.lo \
+	database/sql.lo \
+	database/sql/driver.lo \
 	debug/dwarf.lo \
 	debug/elf.lo \
 	debug/gosym.lo \
@@ -1772,11 +1784,10 @@
 	exp/norm.lo \
 	exp/proxy.lo \
 	exp/spdy.lo \
-	exp/sql.lo \
 	exp/ssh.lo \
 	exp/terminal.lo \
 	exp/types.lo \
-	exp/sql/driver.lo \
+	exp/utf8string.lo \
 	html/template.lo \
 	go/ast.lo \
 	go/build.lo \
@@ -2646,6 +2657,26 @@
 	@$(CHECK)
 .PHONY: crypto/x509/pkix/check
 
+@go_include@ database/sql.lo.dep
+database/sql.lo.dep: $(go_database_sql_files)
+	$(BUILDDEPS)
+database/sql.lo: $(go_database_sql_files)
+	$(BUILDPACKAGE)
+database/sql/check: $(CHECK_DEPS)
+	@$(MKDIR_P) database/sql
+	@$(CHECK)
+.PHONY: database/sql/check
+
+@go_include@ database/sql/driver.lo.dep
+database/sql/driver.lo.dep: $(go_database_sql_driver_files)
+	$(BUILDDEPS)
+database/sql/driver.lo: $(go_database_sql_driver_files)
+	$(BUILDPACKAGE)
+database/sql/driver/check: $(CHECK_DEPS)
+	@$(MKDIR_P) database/sql/driver
+	@$(CHECK)
+.PHONY: database/sql/driver/check
+
 @go_include@ debug/dwarf.lo.dep
 debug/dwarf.lo.dep: $(go_debug_dwarf_files)
 	$(BUILDDEPS)
@@ -2856,16 +2887,6 @@
 	@$(CHECK)
 .PHONY: exp/spdy/check
 
-@go_include@ exp/sql.lo.dep
-exp/sql.lo.dep: $(go_exp_sql_files)
-	$(BUILDDEPS)
-exp/sql.lo: $(go_exp_sql_files)
-	$(BUILDPACKAGE)
-exp/sql/check: $(CHECK_DEPS)
-	@$(MKDIR_P) exp/sql
-	@$(CHECK)
-.PHONY: exp/sql/check
-
 @go_include@ exp/ssh.lo.dep
 exp/ssh.lo.dep: $(go_exp_ssh_files)
 	$(BUILDDEPS)
@@ -2896,6 +2917,16 @@
 	@$(CHECK)
 .PHONY: exp/types/check
 
+@go_include@ exp/utf8string.lo.dep
+exp/utf8string.lo.dep: $(go_exp_utf8string_files)
+	$(BUILDDEPS)
+exp/utf8string.lo: $(go_exp_utf8string_files)
+	$(BUILDPACKAGE)
+exp/utf8string/check: $(CHECK_DEPS)
+	@$(MKDIR_P) exp/utf8string
+	@$(CHECK)

Re: Fix PR48794 some more

2012-01-25 Thread Richard Henderson
On 01/26/2012 03:04 AM, Michael Matz wrote:
 Actually, resx/eh_dispatch always are the last BB statements, so the loop 
 doesn't need to look at all statements in a BB, making it quite somewhat 
 faster.  Consider the tree-eh.c to be looking like so:

For the record, is this without optimization or something?

A region without a landing pad is unreachable.  Thus I'd normally
expect the region's blocks, including the offending RESX referencing
the region, to be deleted as dead code.

Otherwise, this second patch is ok.


r~


Re: [Patch, Fortran] PR 51987 - Fix setting of f2k_derived - and thus fix CLASS-based TBP

2012-01-25 Thread Tobias Burnus

Steve Kargl wrote:

On Wed, Jan 25, 2012 at 09:27:51PM +0100, Tobias Burnus wrote:

I will commit it as obvious after it regtesting it.

JFYI, the patch fixes the ICE.


Yes, it does - and it also regtested. I committed it as Rev. 183541.

Tobias


Re: [trans-mem] Do not instrument thread locals

2012-01-25 Thread Richard Henderson
On 01/25/2012 01:30 PM, Patrick Marlier wrote:
 From my point of view, no. When it is a thread local, it should not
 be shared to someone else. If the thread dies, what happens to the
 thread local variable? Should it be discarded completely and this
 piece of memory never reallocated? Even if the programmer take care
 of this situation, does it make sense to share a thread local to
 other threads?

No, Andi has a point.  It's no more invalid than sharing a variable
off the local stack with another thread.  All that's required is that
the foreign thread not keep the pointer permanently; that the use of
the tls variable end before the thread ends.

And it's entirely likely that I'd thought of exactly that two years
ago when the DECL_THREAD_LOCAL test was omitted from that bit of code,
but I failed to add a comment.

I guess this patch needs to be reverted...


r~


Go testsuite patch committed: Remove of a couple of accidental files

2012-01-25 Thread Ian Lance Taylor
I committed a patch to remove a couple of object files from the Go
testsuite.  I committed this by accident--they should not have gone in.

Dtest/bench/go1/_testmain.6
Dtest/bench/go1/_gotest_.6

Ian


Merge from trunk to gccgo branch

2012-01-25 Thread Ian Lance Taylor
I have merged trunk revision 183540 to the gccgo branch.

Ian


Re: [trans-mem] Do not instrument thread locals

2012-01-25 Thread Andi Kleen
 And it's entirely likely that I'd thought of exactly that two years
 ago when the DECL_THREAD_LOCAL test was omitted from that bit of code,
 but I failed to add a comment.
 
 I guess this patch needs to be reverted...

It may be still a valid optimization, but only if you know there
is no escapes of a static thread variable. But I didn't think
this is known at this point.

I suspect this would require adding another pass for this later in the 
optimization pipeline.

-Andi

-- 
a...@linux.intel.com -- Speaking for myself only.


libgo patch committed: Correct typo in mksysinfo.sh

2012-01-25 Thread Ian Lance Taylor
This libgo patch corrects a typo in mksysinfo.sh.  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r b0964b26024e libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Wed Jan 25 13:47:12 2012 -0800
+++ b/libgo/mksysinfo.sh	Wed Jan 25 17:06:38 2012 -0800
@@ -250,7 +250,7 @@
   echo const PTRACE_O_MASK = 0x7f  ${OUT}
 fi
 if ! grep '^const _PTRACE_GETEVENTMSG' ${OUT}  /dev/null 21; then
-  echo const _PTRACE_GETEVENTMSG = 0x4201  ${OUT}
+  echo const PTRACE_GETEVENTMSG = 0x4201  ${OUT}
 fi
 if ! grep '^const PTRACE_EVENT_FORK' ${OUT}  /dev/null 21; then
   echo const PTRACE_EVENT_FORK = 1  ${OUT}


Merge from trunk to gccgo branch

2012-01-25 Thread Ian Lance Taylor
I've merged trunk revision 183549 onto the gccgo branch.

Ian


[patch] Add new DW_AT and DW_FORM codes for Fission

2012-01-25 Thread Cary Coutant
I'd like to add these new DW_AT and DW_FORM codes for the Fission project:

   http://gcc.gnu.org/wiki/DebugFission

We're currently working on the Fission implementation in GCC, gold,
and binutils, but I'd like to at least lay claim to the actual values
to prevent overlap with any other extensions that someone might start
working on.

In GCC, we're working on the (git-only) google/debugfission branch.
We'll be sending gold and binutils patches soon.

Any objections? Is this OK for trunk in binutils and gcc trees?

-cary


* include/dwarf2.h (enum dwarf_form): Add Fission extensions.
(enum dwarf_attribute): Likewise.


commit 269b973ca77ee01fec83a7bad204eecde73ca9c1
Author: Cary Coutant ccout...@google.com
Date:   Sat Nov 5 01:17:06 2011 -0700

Add new DW_AT and DW_FORM codes for Fission.

diff --git a/include/dwarf2.h b/include/dwarf2.h
index 37cb83f..69656e6 100644
--- a/include/dwarf2.h
+++ b/include/dwarf2.h
@@ -188,7 +188,11 @@ enum dwarf_form
 DW_FORM_sec_offset = 0x17,
 DW_FORM_exprloc = 0x18,
 DW_FORM_flag_present = 0x19,
-DW_FORM_ref_sig8 = 0x20
+DW_FORM_ref_sig8 = 0x20,
+/* Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
+DW_FORM_GNU_ref_index = 0x70,
+DW_FORM_GNU_addr_index = 0x71,
+DW_FORM_GNU_str_index = 0x72
   };

 /* Attribute names and codes.  */
@@ -368,6 +372,13 @@ enum dwarf_attribute
 DW_AT_GNU_all_source_call_sites = 0x2118,
 /* Section offset into .debug_macro section.  */
 DW_AT_GNU_macros = 0x2119,
+/* Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
+DW_AT_GNU_dwo_name = 0x2130,
+DW_AT_GNU_dwo_id = 0x2131,
+DW_AT_GNU_ref_base = 0x2132,
+DW_AT_GNU_addr_base = 0x2133,
+DW_AT_GNU_pubnames = 0x2134,
+DW_AT_GNU_pubtypes = 0x2135,
 /* VMS extensions.  */
 DW_AT_VMS_rtnbeg_pd_address = 0x2201,
 /* GNAT extensions.  */


Re: [4.7][google] Adding a new option -fstack-protector-strong. (issue 5461043)

2012-01-25 Thread 沈涵
Hi, David and Rong, thanks a lot! Modified code uploaded as patch 8
and is also included at the end of email body.

Ref - http://codereview.appspot.com/5461043

Regards,
-Han

== Patch start
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 6d31e90..131c1b9 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1524,15 +1524,39 @@ estimated_stack_frame_size (struct cgraph_node *node)
   return size;
 }

+/* Helper routine to check if a record or union contains an array field. */
+
+static int
+record_or_union_type_has_array_p (const_tree tree_type)
+{
+  tree fields = TYPE_FIELDS (tree_type);
+  tree f;
+
+  for (f = fields; f; f = DECL_CHAIN (f))
+{
+  if (TREE_CODE (f) == FIELD_DECL)
+   {
+ tree field_type = TREE_TYPE (f);
+ if (RECORD_OR_UNION_TYPE_P (field_type))
+   return record_or_union_type_has_array_p (field_type);
+ if (TREE_CODE (field_type) == ARRAY_TYPE)
+   return 1;
+   }
+}
+  return 0;
+}
+
 /* Expand all variables used in the function.  */

 static void
 expand_used_vars (void)
 {
   tree var, outer_block = DECL_INITIAL (current_function_decl);
+  referenced_var_iterator rvi;
   VEC(tree,heap) *maybe_local_decls = NULL;
   unsigned i;
   unsigned len;
+  int gen_stack_protect_signal = 0;

   /* Compute the phase of the stack frame for this function.  */
   {
@@ -1565,6 +1589,23 @@ expand_used_vars (void)
}
 }

+  FOR_EACH_REFERENCED_VAR (cfun, var, rvi)
+if (!is_global_var (var))
+  {
+   tree var_type = TREE_TYPE (var);
+   /* Examine local referenced variables that have their addresses taken,
+  contain an array, or are arrays.  */
+   if (TREE_CODE (var) == VAR_DECL
+(TREE_CODE (var_type) == ARRAY_TYPE
+   || TREE_ADDRESSABLE (var)
+   || (RECORD_OR_UNION_TYPE_P (var_type)
+record_or_union_type_has_array_p (var_type
+ {
+   ++gen_stack_protect_signal;
+   break;
+ }
+  }
+
   /* At this point all variables on the local_decls with TREE_USED
  set are not associated with any block scope.  Lay them out.  */

@@ -1655,11 +1696,18 @@ expand_used_vars (void)
dump_stack_var_partition ();
 }

-  /* There are several conditions under which we should create a
- stack guard: protect-all, alloca used, protected decls present.  */
-  if (flag_stack_protect == 2
-  || (flag_stack_protect
-  (cfun-calls_alloca || has_protected_decls)))
+  /* Create stack guard, if
+ a) -fstack-protector-all - always;
+ b) -fstack-protector-strong - if there are arrays, memory
+ references to local variables, alloca used, or protected decls present;
+ c) -fstack-protector - if alloca used, or protected decls present  */
+  if (flag_stack_protect == 3  /* -fstack-protector-all  */
+  || (flag_stack_protect == 2  /* -fstack-protector-strong  */
+  (gen_stack_protect_signal || cfun-calls_alloca
+ || has_protected_decls))
+  || (flag_stack_protector == 1  /* -fstack-protector  */
+  (cfun-calls_alloca
+ || has_protected_decls)))
 create_stack_guard ();

   /* Assign rtl to each variable based on these partitions.  */
diff --git a/gcc/common.opt b/gcc/common.opt
index ec1dbd1..b79b8cc 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1835,8 +1835,12 @@ fstack-protector
 Common Report Var(flag_stack_protect, 1)
 Use propolice as a stack protection method

-fstack-protector-all
+fstack-protector-strong
 Common Report RejectNegative Var(flag_stack_protect, 2)
+Use a smart stack protection method for certain functions
+
+fstack-protector-all
+Common Report RejectNegative Var(flag_stack_protect, 3)
 Use a stack protection method for every function

 fstack-usage
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index e3d3789..607a7a5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -400,8 +400,8 @@ Objective-C and Objective-C++ Dialects}.
 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
 -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol
--fstack-protector-all -fstrict-aliasing -fstrict-overflow @gol
--fthread-jumps -ftracer -ftree-bit-ccp @gol
+-fstack-protector-strong -fstack-protector-all -fstrict-aliasing @gol
+-fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
@@ -8443,6 +8443,12 @@ functions with buffers larger than 8 bytes.
The guards are initialized
 when a function is entered and then checked when the function exits.
 If a guard check fails, an error message is printed and the program exits.

+@item -fstack-protector-strong
+@opindex fstack-protector-strong
+Like @option{-fstack-protector} but includes 

[pph] Identifier binding fixes. (issue5572065)

2012-01-25 Thread Lawrence Crowl
This change fixes some problems in reconstructing the identifier bindings.
In particular, it removes extra binding creations, handle new bindings better,
identifies already present bindings, and adds some assertions.

Improve debug dump for bindings.

One old test is now passing.  One old test is 2/3 passing.  Two new tests are
passing.  Two old tests are now failing.  These are identical strange failures
with the __sync_fetch_and_add builtin.  The function declaration seems to be
losing its return type.


Index: gcc/testsuite/ChangeLog.pph

* g++.dg/pph/x0samename3.h: New passing.
* g++.dg/pph/x1samename.cc: New passing.
* g++.dg/pph/x4samename.cc: Mark passing.
* g++.dg/pph/x4resolve1.cc: Change passing assembler diff code.
* g++.dg/pph/x4resolve2.cc: Change passing assembler diff code.
* g++.dg/pph/x6dynarray3.cc: Remove two bogus errors.
* g++.dg/pph/x5dynarray7.h: Add one bogus error.
* g++.dg/pph/x6dynarray6.h: Add one bogus error.

2012-01-24   Lawrence Crowl  cr...@google.com

Index: gcc/cp/ChangeLog.pph

2012-01-25   Lawrence Crowl  cr...@google.com

* pph-core.c (pph_dump_tree_name): Refactor.
(pph_dump_overload_names): New.
(pph_dump_one_binding): New.
(pph_dump_bindings_for_id): New.
(pph_dump_bindings_for_decl): New.
(pph_dump_chain): Dump builtins at -fpph-debug=5.  Remove unneeded
'next' variable.
(pph_dump_binding): Likewise.
(pph_loaded): Clarify purpose of global state dump.
* name-lookup.c (pph_debug_binding_inaction): Remove redundant output.
(pph_set_identifier_bindings): Removed.
(pph_set_chain_identifier_bindings): Removed.
(pph_set_namespace_bindings): Removed.
(pph_set_identifier_binding): New.  Refactored from
pph_set_namespace_bindings.  Fixes some identifer binding issues.
(pph_set_namespace_decl_binding): New. Refactored from
pph_set_namespace_bindings.
(pph_set_chain_namespace_bindings): Use pph_set_namespace_decl_binding
instead of pph_set_namespace_bindings.
(pph_set_global_identifier_bindings): Remove bad calls to
pph_set_chain_identifier_bindings.


Index: gcc/testsuite/g++.dg/pph/x4samename.cc
===
--- gcc/testsuite/g++.dg/pph/x4samename.cc  (revision 183499)
+++ gcc/testsuite/g++.dg/pph/x4samename.cc  (working copy)
@@ -1,6 +1,3 @@
-// { dg-bogus x4samename.cc:11:18: error: expected unqualified-id before '=' 
token  { xfail *-*-* } 0 }
-// { dg-bogus x4samename.cc:12:43: error: cannot convert 'const char.' to 
'double' for argument '1' to 'int func.double.'  { xfail *-*-* } 0 }
-
 #include x0samename2.h
 #include x0samename1.h
 
Index: gcc/testsuite/g++.dg/pph/x4resolve1.cc
===
--- gcc/testsuite/g++.dg/pph/x4resolve1.cc  (revision 183499)
+++ gcc/testsuite/g++.dg/pph/x4resolve1.cc  (working copy)
@@ -1,4 +1,4 @@
-// pph asm xwant 03374
+// pph asm xwant 53261
 // This test produces overload differences because the declaration and
 // call orders are different between pph and textual parsing.
 
Index: gcc/testsuite/g++.dg/pph/x6dynarray3.cc
===
--- gcc/testsuite/g++.dg/pph/x6dynarray3.cc (revision 183499)
+++ gcc/testsuite/g++.dg/pph/x6dynarray3.cc (working copy)
@@ -1,5 +1,3 @@
-// { dg-bogus a0dynarray-dfn1b.hi:22:5: error: no suitable 'operator delete 
 { xfail *-*-* } 0 }
-// { dg-bogus a0dynarray-dfn2b.hi:13:9: error: no suitable 'operator delete 
 { xfail *-*-* } 0 }
 // { dg-bogus a0dynarray-dcl3.hi:11:60: error: call of overloaded 'operator 
new  { xfail *-*-* } 0 }
 
 #include x5dynarray3.h
Index: gcc/testsuite/g++.dg/pph/x4resolve2.cc
===
--- gcc/testsuite/g++.dg/pph/x4resolve2.cc  (revision 183499)
+++ gcc/testsuite/g++.dg/pph/x4resolve2.cc  (working copy)
@@ -1,4 +1,4 @@
-// pph asm xwant 37643
+// pph asm xwant 33894
 // This test produces overload differences because the declaration and
 // call orders are different between pph and textual parsing.
 
Index: gcc/testsuite/g++.dg/pph/x6dynarray6.h
===
--- gcc/testsuite/g++.dg/pph/x6dynarray6.h  (revision 183499)
+++ gcc/testsuite/g++.dg/pph/x6dynarray6.h  (working copy)
@@ -1,3 +1,5 @@
+// { dg-bogus atomicity.h:48:45: error: void value not ignored as it ought to 
be  { xfail *-*-* } 0 }
+
 #ifndef X6DYNARRAY6_H
 #define X6DYNARRAY6_H
 
Index: gcc/testsuite/g++.dg/pph/x5dynarray7.h
===
--- gcc/testsuite/g++.dg/pph/x5dynarray7.h  (revision 183499)
+++ gcc/testsuite/g++.dg/pph/x5dynarray7.h  (working copy)
@@ -1,3 +1,5 @@
+// { dg-bogus atomicity.h:48:45: 

Re: [4.7][google] Adding a new option -fstack-protector-strong. (issue 5461043)

2012-01-25 Thread davidxl

ok for google branches with the above changes. Please continue to seek
upstream approval.

David


http://codereview.appspot.com/5461043/diff/19001/gcc/doc/invoke.texi
File gcc/doc/invoke.texi (right):

http://codereview.appspot.com/5461043/diff/19001/gcc/doc/invoke.texi#newcode403
gcc/doc/invoke.texi:403: +-fstack-protector-strong -fstack-protector-all
-fstrict-aliasing @gol
Switch the order of -fstack-protector-all and -fstack-proctor-strong (in
alphabetic order)

http://codereview.appspot.com/5461043/diff/19001/gcc/doc/invoke.texi#newcode8446
gcc/doc/invoke.texi:8446: +@item -fstack-protector-strong
Move this item after -fstack-protector-all

http://codereview.appspot.com/5461043/


libgo patch committed: Always define IPV6_TCLASS

2012-01-25 Thread Ian Lance Taylor
The GNU/Linux specific support in the net package uses the constant
IPV6_TCLASS.  This patch to libgo/mksysinfo.sh ensures that the constant
is defined even on older GNU/Linux systems.  Bootstrapped on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 2a1bceb2bd18 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Wed Jan 25 17:07:11 2012 -0800
+++ b/libgo/mksysinfo.sh	Wed Jan 25 21:41:38 2012 -0800
@@ -192,7 +192,7 @@
   sed -e 's/^\(const \)_\(SHUT[^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
 
 # The net package requires some const definitions.
-for m in IPV6_V6ONLY IPPROTO_IPV6 IPV6_JOIN_GROUP IPV6_LEAVE_GROUP; do
+for m in IPV6_V6ONLY IPPROTO_IPV6 IPV6_JOIN_GROUP IPV6_LEAVE_GROUP IPV6_TCLASS; do
   if ! grep ^const $m  ${OUT} /dev/null 21; then
 echo const $m = 0  ${OUT}
   fi


Merge trunk to gccgo branch again

2012-01-25 Thread Ian Lance Taylor
I have now merged trunk revision 183552 onto the gccgo branch.

Ian