RE: [Ping][PATCH, libstdc++-v3] Enable to cross-test libstdc++ on simulator

2012-04-06 Thread Terry Guo
> -Original Message-
> From: Paolo Carlini [mailto:paolo.carl...@oracle.com]
> Sent: Wednesday, March 28, 2012 9:15 AM
> To: Terry Guo
> Cc: gcc-patches@gcc.gnu.org; libstd...@gcc.gnu.org; r...@cebitec.uni-
> Bielefeld.DE; mikest...@comcast.net; Richard Earnshaw; 'Paolo Bonzini'
> Subject: Re: [Ping][PATCH, libstdc++-v3] Enable to cross-test libstdc++
> on simulator
> 
> On 03/28/2012 03:15 AM, Terry Guo wrote:
> > Hello,
> >
> > Thanks Paolo Carlini for pointing out that I should put code changes
> in
> > Makefile.am. This updated patch addresses this issue. Is it OK to
> trunk?
> Sure, thanks.
> 

This patch was committed into trunk at March 28. And I just verified that it
also works for gcc 4.7 branch and 4.6 branch. So can I back port it to 4.7
and 4.6 branch?

BR,
Terry




[PATCH] Caret diagnostics

2012-04-06 Thread Manuel López-Ibáñez
A simple implementation of caret diagnostics.

In the testsuite, pruning the caret output does not always work
because of several known deficiencies of DejaGNU, thus in some places
I disable the caret explicitly.

Bootstrapped and regression tested on x86_64-unknown-gnu-linux with
enable-languages=all,ada and -m32/-m64.

OK to commit?


2012-04-05  Manuel López-Ibáñez  

PR 24985
libstdc++-v3/
* testsuite/lib/prune.exp: Handle caret.
libmudflap/
* testsuite/lib/libmudflap.exp: Handle caret.
gcc/
* diagnostic.h (show_caret): Declare.
* diagnostic.c (diagnostic_initialize): Initialize to false.
(diagnostic_show_locus): New.
(diagnostic_report_diagnostic): Call it.
* input.c (read_line): New.
(location_get_source_line): New.
* input.h (location_get_source_line): Declare.
* toplev.c (general_init): Initialize show_caret from options.
* testsuite/lib/prune.exp: Add -fno-diagnostics-show-caret.
* testsuite/gcc.dg/torture/tls/tls.exp: Add -fno-diagnostics-show-caret.
* dwarf2out.c (gen_producer_string): Handle fdiagnostics-show-caret.
* opts.c (common_handle_option): Likewise.
* common.opt (fdiagnostics-show-caret): New option.


caret-diagnostics-20120406.diff
Description: Binary data


Re: [C11-atomic] [patch] gimple atomic statements

2012-04-06 Thread Richard Sandiford
Richard Guenther  writes:
>> They can affect shared memory in some ways like a call, but don't have many
>> of the other attributes of call.  They are really more like an assignment or
>> other operation with arbitrary shared memory side effects.  I do hope to be
>> able to teach the optimizers the directionality of the memory model
>> restrictions.  ie, ACQUIRE is only a barrier to hoisting shared memory
>> code...  stores can be moved downward past this mode. RELEASE is only a
>> barrier to sinking code.   RELAXED is no barrier at all to code motion.  In
>> fact, a relaxed store is barely different than a real store... but there is
>> a slight difference so we can't make it a normal store :-P.
>>
>> By teaching the other parts of the compiler about a GIMPLE_ ATOMIC, we could
>> hopefully lessen their impact eventually.
>
> Ok.  I suppose having a GIMPLE_ATOMIC is fine then.

Just for my own education really, but: does this mean that there'd
be unnecessary pessimisation in representing the thing as a call?
The interleaved load/store internal fns are really assignments too,
so if calls aren't right for that kind of operation, maybe we need
to replace the internal fns with something else.  Or at least come
up with some new call properties.

Which is a roundabout way of wondering what the main difficulties
would be in attaching things like directionality to a call.

Not arguing for anything here, just an onlooker wanting to understand. :-)

(BTW, it sounds like restricting memory accesses to GIMPLE_ASSIGN
might cause trouble for the interleave load/store stuff too.)

Richard


Re: [PATCH] doc: Fix typo: mno-lsc -> mno-llsc

2012-04-06 Thread Richard Sandiford
Matt Turner  writes:
> 2012-04-04  Matt Turner  
>
>   gcc/
>   * doc/install.texi: Correct typo "-mno-lsc" -> "-mno-llsc".

Thanks, applied to trunk, 4.7, 4.6 and 4.5.

Richard



C++ PATCH for c++/52596 (C++11 ICE with qualified-id in template)

2012-04-06 Thread Jason Merrill
Since in C++11 the things you can do with an lvalue are no longer a 
superset of the things you can do with an rvalue (specifically, you 
can't bind one to an rvalue reference) we can't just conservatively 
assume that an expression is an lvalue in a template and then get a 
better answer later.  So we've started looking into NON_DEPENDENT_EXPR 
in lvalue_kind.  But that breaks on this testcase; when we encounter a 
qualified-id in a template we build up a SCOPE_REF for it even though we 
know what it refers to so that we can do access control at instantiation 
time, and lvalue_kind didn't know how to deal with that.


For 4.8 I'm fixing this by changing the second operand of the SCOPE_REF 
to be the decl found by lookup, as the instantiation code already knows 
what to do with that.  For 4.7 I'm just conservatively assuming it's a 
regular lvalue; it has to be an lvalue because it's something with a 
name, and if it's a field it's a member of *this, which is an lvalue. 
It might be a bit-field, but bit-field semantics are a strict subset of 
normal lvalue semantics, so this is OK.


Tested x86_64-pc-linux-gnu, applying to trunk and 4.7.
commit 8710fe66438bef24c30444eec07c7a8d6661
Author: Jason Merrill 
Date:   Thu Apr 5 14:41:25 2012 -0400

	PR c++/52596
	* semantics.c (finish_non_static_data_member): In templates, pass
	the decl to build_qualified_name.
	* tree.c (lvalue_kind) [SCOPE_REF]: Handle FIELD_DECL.

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 65b771f..9bdd2ee 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1590,7 +1590,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
   else if (processing_template_decl)
 return build_qualified_name (TREE_TYPE (decl),
  qualifying_scope,
- DECL_NAME (decl),
+ decl,
  /*template_p=*/false);
   else
 {
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 992c22a..b5a360f 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -151,8 +151,14 @@ lvalue_kind (const_tree ref)
   /* A scope ref in a template, left as SCOPE_REF to support later
 	 access checking.  */
 case SCOPE_REF:
-  gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE(ref)));
-  return lvalue_kind (TREE_OPERAND (ref, 1));
+  gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE (ref)));
+  {
+	tree op = TREE_OPERAND (ref, 1);
+	if (TREE_CODE (op) == FIELD_DECL)
+	  return (DECL_C_BIT_FIELD (op) ? clk_bitfield : clk_ordinary);
+	else
+	  return lvalue_kind (op);
+  }
 
 case MAX_EXPR:
 case MIN_EXPR:
diff --git a/gcc/testsuite/g++.dg/template/qualified-id5.C b/gcc/testsuite/g++.dg/template/qualified-id5.C
new file mode 100644
index 000..3126d33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/qualified-id5.C
@@ -0,0 +1,17 @@
+// PR c++/52596
+
+struct msgpack_zone_finalizer_array {
+int* tail;
+};
+struct msgpack_zone {
+msgpack_zone_finalizer_array finalizer_array;
+};
+struct zone : public msgpack_zone {
+template  T* allocate();
+
+};
+template 
+T* zone::allocate()
+{
+  --msgpack_zone::finalizer_array.tail;
+}
commit 078e78553f6e1a3727dedf10ab2825c96552e86d
Author: Jason Merrill 
Date:   Thu Apr 5 14:41:25 2012 -0400

	PR c++/52596
	* tree.c (lvalue_kind): Treat a deferred access control SCOPE_REF
	as an lvalue.

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 2bb2801..9129a7e 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -150,8 +150,14 @@ lvalue_kind (const_tree ref)
   /* A scope ref in a template, left as SCOPE_REF to support later
 	 access checking.  */
 case SCOPE_REF:
-  gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE(ref)));
-  return lvalue_kind (TREE_OPERAND (ref, 1));
+  {
+	tree op = TREE_OPERAND (ref, 1);
+	/* The member must be an lvalue; assume it isn't a bit-field.  */
+	if (TREE_CODE (op) == IDENTIFIER_NODE)
+	  return clk_ordinary;
+	gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE (ref)));
+	return lvalue_kind (op);
+  }
 
 case MAX_EXPR:
 case MIN_EXPR:
diff --git a/gcc/testsuite/g++.dg/template/qualified-id5.C b/gcc/testsuite/g++.dg/template/qualified-id5.C
new file mode 100644
index 000..3126d33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/qualified-id5.C
@@ -0,0 +1,17 @@
+// PR c++/52596
+
+struct msgpack_zone_finalizer_array {
+int* tail;
+};
+struct msgpack_zone {
+msgpack_zone_finalizer_array finalizer_array;
+};
+struct zone : public msgpack_zone {
+template  T* allocate();
+
+};
+template 
+T* zone::allocate()
+{
+  --msgpack_zone::finalizer_array.tail;
+}


Re: [Ping][PATCH, libstdc++-v3] Enable to cross-test libstdc++ on simulator

2012-04-06 Thread Mike Stump
On Apr 6, 2012, at 12:50 AM, Terry Guo wrote:
> This patch was committed into trunk at March 28. And I just verified that it
> also works for gcc 4.7 branch and 4.6 branch. So can I back port it to 4.7
> and 4.6 branch?

Ok.  As always please be on the lookout for any problems.


PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM

2012-04-06 Thread H.J. Lu
Hi,

With ptr_mode = SImode and Pmode == DImode, given

(note 21 8 17 2 (expr_list:REG_DEP_TRUE (concat:SI (reg:SI 5 di) 
(subreg:SI (plus:DI (reg/f:DI 16 argp)
(const_int -20 [0xffec])) 0)) 
(nil)) NOTE_INSN_CALL_ARG_LOCATION)

when

(plus:DI (reg/f:DI 16 argp)
(const_int -20 [0xffec]))

reaches mem_loc_descriptor:

   case PLUS: 
plus: 
  if (is_based_loc (rtl) 
  && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
  && GET_MODE_CLASS (mode) == MODE_INT)
mem_loc_result = based_loc_descr (XEXP (rtl, 0),
  INTVAL (XEXP (rtl, 1)),
  VAR_INIT_STATUS_INITIALIZED);
  else  

it fails "GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE" since mode is DImode
and DWARF2_ADDR_SIZE is 4.  arg_pointer_rtx and frame_pointer_rtx are
special cases.  They should be allowed for based_loc_descr even if their
mode sizes > DWARF2_ADDR_SIZE.  OK for trunk?

Thanks.


H.J.

gcc/

2012-04-06  H.J. Lu  

PR debug/52857
* dwarf2out.c (mem_loc_descriptor): Assert dbx_reg_number !=
INVALID_REGNUM for DW_OP_GNU_regval_type.  Allow
arg_pointer_rtx and frame_pointer_rtx for based_loc_descr.

gcc/testsuite/

2012-04-06  H.J. Lu  

PR debug/52857
* gcc.target/i386/pr52857.c: New.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ca88fc5..ab20683 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11661,6 +11661,7 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
  ))
{
  dw_die_ref type_die;
+ unsigned int dbx_regno;
 
  if (dwarf_strict)
break;
@@ -11670,8 +11671,10 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
 GET_MODE_CLASS (mode) == MODE_INT);
  if (type_die == NULL)
break;
+ dbx_regno = dbx_reg_number (rtl);
+ gcc_assert (dbx_regno != INVALID_REGNUM);
  mem_loc_result = new_loc_descr (DW_OP_GNU_regval_type,
- dbx_reg_number (rtl), 0);
+ dbx_regno, 0);
  mem_loc_result->dw_loc_oprnd2.val_class = dw_val_class_die_ref;
  mem_loc_result->dw_loc_oprnd2.v.val_die_ref.die = type_die;
  mem_loc_result->dw_loc_oprnd2.v.val_die_ref.external = 0;
@@ -11927,7 +11930,9 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
 case PLUS:
 plus:
   if (is_based_loc (rtl)
- && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
+ && (GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
+ || XEXP (rtl, 0) == arg_pointer_rtx
+ || XEXP (rtl, 0) == frame_pointer_rtx)
  && GET_MODE_CLASS (mode) == MODE_INT)
mem_loc_result = based_loc_descr (XEXP (rtl, 0),
  INTVAL (XEXP (rtl, 1)),
diff --git a/gcc/testsuite/gcc.target/i386/pr52857.c 
b/gcc/testsuite/gcc.target/i386/pr52857.c
new file mode 100644
index 000..16fd78f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr52857.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-g -O -mx32 -maddress-mode=long" } */
+
+extern void get_BID128 (int *);
+void 
+__bid128_div (void)
+{
+  int res;
+  get_BID128 (&res);
+}


Re: [PATCH] Caret diagnostics

2012-04-06 Thread Mike Stump
On Apr 6, 2012, at 1:11 AM, Manuel López-Ibáñez wrote:
> A simple implementation of caret diagnostics.
> 
> In the testsuite, pruning the caret output does not always work
> because of several known deficiencies of DejaGNU, thus in some places
> I disable the caret explicitly.
> 
> Bootstrapped and regression tested on x86_64-unknown-gnu-linux with
> enable-languages=all,ada and -m32/-m64.
> 
> OK to commit?

Could someone take Objective-C++ for a spin?  It builds and runs pretty 
quickly, non-bootstrap is fine.

The testsuite changes are fine, though, it feels like you're missing the main 
prune routine?

Nice work, love to see it go in.


Re: [PATCH] Caret diagnostics

2012-04-06 Thread Manuel López-Ibáñez
On 6 April 2012 15:42, Mike Stump  wrote:
> On Apr 6, 2012, at 1:11 AM, Manuel López-Ibáñez wrote:
>> A simple implementation of caret diagnostics.
>>
>> In the testsuite, pruning the caret output does not always work
>> because of several known deficiencies of DejaGNU, thus in some places
>> I disable the caret explicitly.
>>
>> Bootstrapped and regression tested on x86_64-unknown-gnu-linux with
>> enable-languages=all,ada and -m32/-m64.
>>
>> OK to commit?
>
> Could someone take Objective-C++ for a spin?  It builds and runs pretty 
> quickly, non-bootstrap is fine.
>
> The testsuite changes are fine, though, it feels like you're missing the main 
> prune routine?

I didn't change the prune routine because it doesn't work reliably
(because of DejaGNU problems PR12096 and PR30612 and others mentioned
in PR24985). That is why I set -fno-diagnostics-show-caret there.
Other places that have their own prune routines didn't show any
problems, so I prune the output instead of adding
-fno-diagnostics-show-caret to every command.

> Nice work, love to see it go in.

Thanks,

Manuel.


[SH] Cleanup sh-protos.h

2012-04-06 Thread Oleg Endo
Hi,

The attached patch removes unneeded forward declarations from
sh-protos.h.
Tested with 'make all-gcc'.

OK?

Cheers,
Oleg

ChangeLog:

* config/sh/sh-protos.h (fp_int_operand, symbol_ref_operand,
general_movsrc_operand, general_movdst_operand,
arith_reg_operand, fp_arith_reg_operand, arith_operand,
arith_reg_or_0_operand, logical_operand, fpscr_operand,
fpul_operand, commutative_float_operator, 
noncommutative_float_operator, expand_fp_branch,
sh_handle_pragma): Remove.
Index: gcc/config/sh/sh-protos.h
===
--- gcc/config/sh/sh-protos.h	(revision 186184)
+++ gcc/config/sh/sh-protos.h	(working copy)
@@ -55,7 +55,6 @@
 extern int sh_loop_align (rtx);
 extern bool fp_zero_operand (rtx);
 extern bool fp_one_operand (rtx);
-extern int fp_int_operand (rtx);
 extern rtx get_fpscr_rtx (void);
 extern bool sh_legitimate_index_p (enum machine_mode, rtx);
 extern bool sh_legitimize_reload_address (rtx *, enum machine_mode, int, int);
@@ -93,26 +92,13 @@
 extern void fixup_addr_diff_vecs (rtx);
 extern int get_dest_uid (rtx, int);
 extern void final_prescan_insn (rtx, rtx *, int);
-extern int symbol_ref_operand (rtx, enum machine_mode);
 extern enum tls_model tls_symbolic_operand (rtx, enum machine_mode);
 extern bool system_reg_operand (rtx, enum machine_mode);
-extern int general_movsrc_operand (rtx, enum machine_mode);
-extern int general_movdst_operand (rtx, enum machine_mode);
-extern int arith_reg_operand (rtx, enum machine_mode);
-extern int fp_arith_reg_operand (rtx, enum machine_mode);
-extern int arith_operand (rtx, enum machine_mode);
-extern int arith_reg_or_0_operand (rtx, enum machine_mode);
-extern int logical_operand (rtx, enum machine_mode);
-extern int fpscr_operand (rtx, enum machine_mode);
-extern int fpul_operand (rtx, enum machine_mode);
-extern int commutative_float_operator (rtx, enum machine_mode);
-extern int noncommutative_float_operator (rtx, enum machine_mode);
 extern bool reg_unused_after (rtx, rtx);
 extern void expand_sf_unop (rtx (*)(rtx, rtx, rtx), rtx *);
 extern void expand_sf_binop (rtx (*)(rtx, rtx, rtx, rtx), rtx *);
 extern void expand_df_unop (rtx (*)(rtx, rtx, rtx), rtx *);
 extern void expand_df_binop (rtx (*)(rtx, rtx, rtx, rtx), rtx *);
-extern void expand_fp_branch (rtx (*)(void), rtx (*)(void));
 extern int sh_insn_length_adjustment (rtx);
 extern bool sh_can_redirect_branch (rtx, rtx);
 extern void sh_expand_unop_v2sf (enum rtx_code, rtx, rtx);
@@ -123,7 +109,6 @@
 #endif /* RTX_CODE */
 
 extern const char *output_jump_label_table (void);
-extern int sh_handle_pragma (int (*)(void), void (*)(int), const char *);
 extern rtx get_fpscr_rtx (void);
 extern int sh_media_register_for_return (void);
 extern void sh_expand_prologue (void);


[SH] Replace 'high_life_started' with 'reload_in_progress'

2012-04-06 Thread Oleg Endo
Hi,

The attached patch removes the 'high_life_started' macro and replaces
its use with 'reload_in_progress'.

Tested with 'make all-gcc'.
OK?

Cheers,
Oleg

ChangeLog:

* config/sh/sh.h (high_life_started): Remove
* config/sh/predicates.md (general_movdst_operand): Use
'reload_in_progress' instead of 'high_life_started'.
* config/sh/sh.md (divsi_inv_call, *divsi_inv_call_combine,
divsi_inv_fp): Likewise.
Index: gcc/config/sh/predicates.md
===
--- gcc/config/sh/predicates.md	(revision 186182)
+++ gcc/config/sh/predicates.md	(working copy)
@@ -453,7 +453,7 @@
 return 0;
   if (mode == DImode && TARGET_SHMEDIA && GET_CODE (op) == SUBREG
   && GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))) < 8
-  && ! (high_life_started || reload_completed))
+  && ! (reload_in_progress || reload_completed))
 return 0;
 
   if ((mode == QImode || mode == HImode)
Index: gcc/config/sh/sh.h
===
--- gcc/config/sh/sh.h	(revision 186182)
+++ gcc/config/sh/sh.h	(working copy)
@@ -2482,7 +2482,4 @@
 2:\n" TEXT_SECTION_ASM_OP);
 #endif /* (defined CRT_BEGIN || defined CRT_END) && ! __SHMEDIA__ */
 
-/* FIXME: middle-end support for highpart optimizations is missing.  */
-#define high_life_started reload_in_progress
-
 #endif /* ! GCC_SH_H */
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 186184)
+++ gcc/config/sh/sh.md	(working copy)
@@ -1991,7 +1991,7 @@
(use (match_operand:SI 3 "register_operand" "r"))]
   "TARGET_SHMEDIA"
   "#"
-  "&& (high_life_started || reload_completed)"
+  "&& (reload_in_progress || reload_completed)"
   [(set (match_dup 0) (match_dup 3))]
   ""
   [(set_attr "highpart" "must_split")])
@@ -2021,7 +2021,7 @@
 	 UNSPEC_DIV_INV_M3))]
   "TARGET_SHMEDIA"
   "#"
-  "&& (high_life_started || reload_completed)"
+  "&& (reload_in_progress || reload_completed)"
   [(pc)]
 {
   const char *name = sh_divsi3_libfunc;
@@ -2643,7 +2643,7 @@
(clobber (match_operand:DF 8 "register_operand" "=r"))]
   "TARGET_SHMEDIA_FPU"
   "#"
-  "&& (high_life_started || reload_completed)"
+  "&& (reload_in_progress || reload_completed)"
   [(set (match_dup 0) (match_dup 3))]
   ""
   [(set_attr "highpart" "must_split")])


ignore non-portable warning for PR50722

2012-04-06 Thread Mike Stump
The suggestion was made in the PR to use -w; found this by testing on such a 
target, and didn't want to endlessly add systems to the skip list.

2012-04-06  Mike Stump  

PR testsuite/50722
* gcc.dg/pr49994-3.c: Use -w to squelch non-portable warnings.


Index: gcc.dg/pr49994-3.c
===
--- gcc.dg/pr49994-3.c  (revision 186111)
+++ gcc.dg/pr49994-3.c  (working copy)
@@ -1,8 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fsched2-use-superblocks -g" } */
+/* { dg-options "-O2 -fsched2-use-superblocks -g -w" } */
 /* { dg-options "-O2 -fsched2-use-superblocks -g -mbackchain" { target 
s390*-*-* } } */
 /* { dg-require-effective-target scheduling } */
-/* { dg-skip-if "PR testsuite/50722" { ia64-*-*-* hppa*-*-* *-*-hpux* } } */
 
 void *
 foo (int offset)
Index: ChangeLog
===
--- ChangeLog   (revision 186193)
+++ ChangeLog   (working copy)
@@ -1,3 +1,8 @@
+2012-04-06  Mike Stump  
+
+   PR testsuite/50722
+   * gcc.dg/pr49994-3.c: Use -w to squelch non-portable warnings.
+
 2012-04-05  Jason Merrill  
 
PR c++/52596


[SH] Make prepare_move_operands return void

2012-04-06 Thread Oleg Endo
Hi,

The 'prepare_move_operands' function currently always returns 0, which
makes checking its return value (e.g. in sh.md) useless.  The attached
patch makes 'prepare_move_operands' return void and removes the return
value checks.

Tested with 'make all-gcc'.
OK?

Cheers,
Oleg

ChangeLog:

* config/sh/sh-protos.h (prepare_move_operands): Return void
instead of int.
* config/sh/sh.c (prepare_move_operands): Likewise.
* config/sh/sh.md: Remove return value checks of
prepare_move_operands.
Index: gcc/config/sh/sh-protos.h
===
--- gcc/config/sh/sh-protos.h	(revision 186184)
+++ gcc/config/sh/sh-protos.h	(working copy)
@@ -65,7 +65,7 @@
 extern void emit_df_insn (rtx);
 extern void output_pic_addr_const (FILE *, rtx);
 extern bool expand_block_move (rtx *);
-extern int prepare_move_operands (rtx[], enum machine_mode mode);
+extern void prepare_move_operands (rtx[], enum machine_mode mode);
 extern enum rtx_code prepare_cbranch_operands (rtx *, enum machine_mode mode,
 	   enum rtx_code comparison);
 extern void expand_cbranchsi4 (rtx *operands, enum rtx_code comparison, int);
Index: gcc/config/sh/sh.c
===
--- gcc/config/sh/sh.c	(revision 186185)
+++ gcc/config/sh/sh.c	(working copy)
@@ -1601,7 +1601,7 @@
 /* Prepare operands for a move define_expand; specifically, one of the
operands must be in a register.  */
 
-int
+void
 prepare_move_operands (rtx operands[], enum machine_mode mode)
 {
   if ((mode == SImode || mode == DImode)
@@ -1763,8 +1763,6 @@
 	  operands[1] = op1;
 	}
 }
-
-  return 0;
 }
 
 enum rtx_code
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 186184)
+++ gcc/config/sh/sh.md	(working copy)
@@ -5337,8 +5337,7 @@
 	(match_operand:SI 1 "general_movsrc_operand" ""))]
   ""
 {
-  if (prepare_move_operands (operands, SImode))
-DONE;
+  prepare_move_operands (operands, SImode);
 })
 
 (define_expand "ic_invalidate_line"
@@ -5447,8 +5446,7 @@
 	(match_operand:QI 1 "general_operand" ""))]
   ""
 {
-  if (prepare_move_operands (operands, QImode))
-DONE;
+  prepare_move_operands (operands, QImode);
 })
 
 ;; If movqi_reg_reg is specified as an alternative of movqi, movqi will be
@@ -5614,8 +5612,7 @@
 	(match_operand:HI 1 "general_movsrc_operand"  ""))]
   ""
 {
-  if (prepare_move_operands (operands, HImode))
-DONE;
+  prepare_move_operands (operands, HImode);
 })
 
 (define_expand "reload_inhi"
@@ -5982,8 +5979,7 @@
 	(match_operand:DI 1 "general_movsrc_operand" ""))]
   ""
 {
-  if (prepare_move_operands (operands, DImode))
-DONE;
+  prepare_move_operands (operands, DImode);
 })
 
 (define_insn "movdf_media"
@@ -6571,8 +6567,7 @@
 	(match_operand:DF 1 "general_movsrc_operand" ""))]
   ""
 {
-  if (prepare_move_operands (operands, DFmode))
-DONE;
+  prepare_move_operands (operands, DFmode);
   if (TARGET_SHMEDIA)
 {
   if (TARGET_SHMEDIA_FPU)
@@ -6618,8 +6613,7 @@
 	(match_operand:V2SF 1 "nonimmediate_operand" ""))]
   "TARGET_SHMEDIA_FPU"
 {
-  if (prepare_move_operands (operands, V2SFmode))
-DONE;
+  prepare_move_operands (operands, V2SFmode);
 })
 
 (define_expand "addv2sf3"
@@ -6700,8 +6694,7 @@
 	(match_operand:V4SF 1 "general_operand" ""))]
   "TARGET_SHMEDIA_FPU"
 {
-  if (prepare_move_operands (operands, V4SFmode))
-DONE;
+  prepare_move_operands (operands, V4SFmode);
 })
 
 (define_insn_and_split "*movv16sf_i"
@@ -6748,8 +6741,7 @@
 	(match_operand:V16SF 1 "nonimmediate_operand" "f,m,f"))]
   "TARGET_SHMEDIA_FPU"
 {
-  if (prepare_move_operands (operands, V16SFmode))
-DONE;
+  prepare_move_operands (operands, V16SFmode);
 })
 
 (define_insn "movsf_media"
@@ -6921,8 +6913,7 @@
 (match_operand:SF 1 "general_movsrc_operand" ""))]
   ""
 {
-  if (prepare_move_operands (operands, SFmode))
-DONE;
+  prepare_move_operands (operands, SFmode);
   if (TARGET_SHMEDIA)
 {
   if (TARGET_SHMEDIA_FPU)
@@ -11774,8 +11765,7 @@
 	(match_operand:V8QI 1 "general_movsrc_operand" ""))]
   "TARGET_SHMEDIA"
 {
-  if (prepare_move_operands (operands, V8QImode))
-DONE;
+  prepare_move_operands (operands, V8QImode);
 })
 
 (define_insn "movv8qi_i"
@@ -11867,8 +11857,7 @@
 	(match_operand:V2HI 1 "general_movsrc_operand" ""))]
   "TARGET_SHMEDIA"
 {
-  if (prepare_move_operands (operands, V2HImode))
-DONE;
+  prepare_move_operands (operands, V2HImode);
 })
 
 (define_insn "movv2hi_i"
@@ -11895,8 +11884,7 @@
 	(match_operand:V4HI 1 "general_movsrc_operand" ""))]
   "TARGET_SHMEDIA"
 {
-  if (prepare_move_operands (operands, V4HImode))
-DONE;
+  prepare_move_operands (operands, V4HImode);
 })
 
 (define_insn "movv4hi_i"
@@ -11920,8 +11908,7 @@
 	(match_operand:V2SI 1 "general_movsrc_operand" ""))]
   "TARGET_SHMEDIA"
 {
-  if (prepare_move_operands (operands, V2SImode))
-  DONE;
+  prepare_m

Re: [RS6000] Stack tie fix.

2012-04-06 Thread Olivier Hainque
Hello Alan,

On Apr 6, 2012, at 02:32 , Alan Modra wrote:
[...]
> In the epilogue, the previous frame read must be prevented from moving after
> the stack adjust.  If the adjacent write/read uses r1 as a base reg,
> then we don't need a stack tie at all.

Right

> Writes/reads further away won't be reordered over the adjacent
> write/read.  At least, I've never seen gcc do so, even with older
> versions known to have bugs in aliasing analysis.

 Ah, I hadn't understood that there was this implicit assumption.
 I understand better that part of the logic then. (would be worth
 a comment IMHO) Thanks!

> (Hah!  In writing this, I remember why I took out that assert.  What
> happens prior to the tie in the prologue is of no concern.)

 :-)

 I have been able to verify that your patch helps our previously
 failing case, starting from the svn rev and failure mode analyzed per 
 http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01156.html.

 We get through the same compiler circuits, down to base_alias_check
 now with

  x = (unspec:SI [
(reg/f:SI 1 1)
(reg/f:SI 31 31)
(reg:SI 11 11)
] UNSPEC_TIE)

 instead of (reg:SI 1).

 x_base is now null and such that we rapidly conclude that "we don't
 know anything about aliasing", so the outer mem accesses are declared
 conflicting.

 Have you discovered where the problem you are still observing
 is coming from (with another case on 4.4) ? I was planning to look
 into it and realized that maybe you were already doing so.

 Thanks much for your feedback,

 Olivier




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

2012-04-06 Thread Pascal Obry

Back on this! It turn out that this breaks the shared Ada runtime.
Indeed, exported variables on Ada packages in a DLLs are only accessible
when linking against DLL (thanks to runtime pseudo reloc).

With the patch applied it is not possible to build any Ada application
using the shared runtime. This is a very serious problem, the patch
should be reverted.

Sorry for not having remembered before about this and why linking
against DLL was so important!

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


Re: [PATCH] Dissociate store_expr's temp from exp so that it is not marked as addressable

2012-04-06 Thread Eric Botcazou
> 2012-04-03  Martin Jambor  
>
>   * expr.c (expand_expr_real_1): Pass type, not the expression, to
>   set_mem_attributes for a memory temporary.  Do not call the
>   function for temporaries with a different alias set.

The last sentence is unprecise, this would rather be: "Do not call the function 
for the memory temporary created for a bitfield".

I wonder whether we should simplify the bitfield case in the process.  Once we 
remove the call to set_mem_attributes, I think the

/* If the reference doesn't use the alias set of its type,
   we cannot create the temporary using that type.  */

is useless, so we could try to revert r122014 in the process.

-- 
Eric Botcazou


[lra] patch to bootstrap GCC with LRA on MIPS64EL

2012-04-06 Thread Vladimir Makarov
The following patch makes GCC bootstrap successful on mips64el with LRA 
usage.


Committed as rev. 186198.

2012-04-06  Vladimir Makarov 

* config/mips/mips.c: Include lra.h.
(mips_expand_fcc_reload): Add code for LRA.

* lra-int.h (lra_get_allocno_class, lra_create_new_reg): Move 
to ...


* lra.h: ... here.

* lra.c (collect_non_operand_hard_regs): Use REGMODE_NATURAL_SIZE.

* lra-assign.c (assign_by_spills): Set up changed_pseudo_bitmap
for pseudo got a hard reg.

Index: lra-assigns.c
===
--- lra-assigns.c	(revision 186168)
+++ lra-assigns.c	(working copy)
@@ -1142,7 +1142,6 @@ assign_by_spills (void)
   hard_regno = find_hard_regno_for (regno, &cost, -1);
   if (hard_regno >= 0)
 	{
-	  bitmap_set_bit (&changed_pseudo_bitmap, regno);
 	  assign_hard_regno (hard_regno, regno);
 	  /* We change allocation for non-reload pseudo on
 	 this iteration -- mark it for invalidation used
Index: lra.c
===
--- lra.c	(revision 186168)
+++ lra.c	(working copy)
@@ -828,7 +828,7 @@ collect_non_operand_hard_regs (rtx *x, l
   if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (op)))
 	{
 	  mode = GET_MODE (op);
-	  if (GET_MODE_SIZE (mode) >= UNITS_PER_WORD)
+	  if (GET_MODE_SIZE (mode) > REGMODE_NATURAL_SIZE (mode))
 	subreg_p = true;
 	}
 }
@@ -1480,7 +1480,7 @@ add_regs_to_insn_regno_info (lra_insn_re
   if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x)))
 	{
 	  mode = GET_MODE (x);
-	  if (GET_MODE_SIZE (mode) >= UNITS_PER_WORD)
+	  if (GET_MODE_SIZE (mode) > REGMODE_NATURAL_SIZE (mode))
 	subreg_p = true;
 	}
 }
Index: lra.h
===
--- lra.h	(revision 186168)
+++ lra.h	(working copy)
@@ -20,6 +20,18 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 .  */
 
+/* Return the allocno reg class of REGNO.  If it is a reload pseudo,
+   the pseudo should finally get hard register of the allocno
+   class.  */
+static inline enum reg_class
+lra_get_allocno_class (int regno)
+{
+  resize_reg_info ();
+  return reg_allocno_class (regno);
+}
+
+extern rtx lra_create_new_reg (enum machine_mode, rtx, enum reg_class,
+			   const char *);
 extern void lra_init_elimination (void);
 extern rtx lra_eliminate_regs (rtx, enum machine_mode, rtx);
 extern void lra (FILE *);
Index: lra-int.h
===
--- lra-int.h	(revision 186168)
+++ lra-int.h	(working copy)
@@ -38,16 +38,6 @@ lra_get_regno_hard_regno (int regno)
   return reg_renumber[regno];
 }
 
-/* Return the allocno reg class of REGNO.  If it is a reload pseudo,
-   the pseudo should finally get hard register of the allocno
-   class.  */
-static inline enum reg_class
-lra_get_allocno_class (int regno)
-{
-  resize_reg_info ();
-  return reg_allocno_class (regno);
-}
-
 typedef struct lra_live_range *lra_live_range_t;
 
 /* The structure describes program points where a given pseudo lives.
@@ -254,8 +244,6 @@ extern void lra_push_insn_and_update_ins
 
 extern rtx lra_create_new_reg_with_unique_value (enum machine_mode, rtx,
 		 enum reg_class, const char *);
-extern rtx lra_create_new_reg (enum machine_mode, rtx, enum reg_class,
-			   const char *);
 extern void lra_set_regno_unique_value (int);
 extern void lra_invalidate_insn_data (rtx);
 extern void lra_set_insn_deleted (rtx);
Index: config/mips/mips.c
===
--- config/mips/mips.c	(revision 186168)
+++ config/mips/mips.c	(working copy)
@@ -59,6 +59,7 @@ along with GCC; see the file COPYING3.
 #include "diagnostic.h"
 #include "target-globals.h"
 #include "opts.h"
+#include "lra.h"
 
 /* True if X is an UNSPEC wrapper around a SYMBOL_REF or LABEL_REF.  */
 #define UNSPEC_ADDRESS_P(X)	\
@@ -6664,11 +6665,26 @@ mips_expand_fcc_reload (rtx dest, rtx sr
   if (MEM_P (src))
 src = adjust_address (src, SFmode, 0);
   else if (REG_P (src) || GET_CODE (src) == SUBREG)
-src = gen_rtx_REG (SFmode, true_regnum (src));
-
-  fp1 = gen_rtx_REG (SFmode, REGNO (scratch));
-  fp2 = gen_rtx_REG (SFmode, REGNO (scratch) + MAX_FPRS_PER_FMT);
+{
+  if (! flag_lra)
+	src = gen_rtx_REG (SFmode, true_regnum (src));
+  else if (GET_MODE (src) != SFmode)
+	src = gen_rtx_SUBREG (SFmode,
+			  GET_CODE (src) == SUBREG ? SUBREG_REG (src) : src,
+			  0);
+}
 
+  if (flag_lra)
+{
+  enum reg_class rclass = lra_get_allocno_class (REGNO (scratch));
+  fp1 = lra_create_new_reg (SFmode, NULL_RTX, rclass, "new scratch");
+  fp2 = lra_create_new_reg (SFmode, NULL_RTX, rclass, "zero");
+}
+  else
+{
+  fp1 = gen_rtx_REG (SFmode, REGNO (scratch));
+  fp2 = gen_rtx_REG (SFmode, REGNO (scratch) + MAX_FPRS_PER

Re: [PATCH] Dissociate store_expr's temp from exp so that it is not marked as addressable

2012-04-06 Thread Eric Botcazou
> @@ -9870,7 +9871,14 @@ expand_expr_real_1 (tree exp, rtx target
>   if (op0 == orig_op0)
> op0 = copy_rtx (op0);
>
> - set_mem_attributes (op0, exp, 0);
> + /* If op0 is a temporary because of forcing to memory, pass only the
> +type to set_mem_attributes so that the original expression is never
> +marked as ADDRESSABLE through MEM_EXPR of the temporary.  */
> + if (mem_attrs_from_type)
> +   set_mem_attributes (op0, TREE_TYPE (exp), 0);

set_mem_attributes (op0, type, 0); is equivalent.

-- 
Eric Botcazou


Re: PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM

2012-04-06 Thread H.J. Lu
On Fri, Apr 6, 2012 at 6:30 AM, H.J. Lu  wrote:
> Hi,
>
> With ptr_mode = SImode and Pmode == DImode, given
>
> (note 21 8 17 2 (expr_list:REG_DEP_TRUE (concat:SI (reg:SI 5 di)
>        (subreg:SI (plus:DI (reg/f:DI 16 argp)
>                (const_int -20 [0xffec])) 0))
>    (nil)) NOTE_INSN_CALL_ARG_LOCATION)
>
> when
>
> (plus:DI (reg/f:DI 16 argp)
>    (const_int -20 [0xffec]))
>
> reaches mem_loc_descriptor:
>
>   case PLUS:
>    plus:
>      if (is_based_loc (rtl)
>          && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
>          && GET_MODE_CLASS (mode) == MODE_INT)
>        mem_loc_result = based_loc_descr (XEXP (rtl, 0),
>                                          INTVAL (XEXP (rtl, 1)),
>                                          VAR_INIT_STATUS_INITIALIZED);
>      else
>
> it fails "GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE" since mode is DImode
> and DWARF2_ADDR_SIZE is 4.  arg_pointer_rtx and frame_pointer_rtx are
> special cases.  They should be allowed for based_loc_descr even if their
> mode sizes > DWARF2_ADDR_SIZE.  OK for trunk?
>

I missed another place where arg_pointer_rtx and frame_pointer_rtx should
be allowed  for based_loc_descr.   Tested on Linux/ia32, Linux/x86-64 and
Linux/x32.  OK for trunk?

Thanks.


-- 
H.J.


gcc-pr52857-2.patch
Description: Binary data


Re: [PATCH] Compact SSA version namespace when releasing the freelist

2012-04-06 Thread Richard Guenther
On Thu, Apr 5, 2012 at 5:27 PM, Diego Novillo  wrote:
> On 4/5/12 6:13 AM, Richard Guenther wrote:
>>
>>
>> Currently we release the memory for released SSA names (which we keep
>> around on a freelist, mainly to try to keep the SSA version namespace
>> dense) after early optimizations.  This has the negative impact
>> (as documented) of permanently establishing holes in the SSA version
>> namespace.  The following patch fixes this in a simple way.
>>
>> Bootstrapped and tested on x86_64-unknown-linux-gnu.
>>
>> If you build fold-const.c with -O2 the distribution of released
>> ssa names / removed holes is as follows:
>>
>> 43 release_ssa "SSA names released" 34900
>> 43 release_ssa "SSA name holes removed" 34900
>
>
> Could you elaborate on what this output means?  What is 43?  What is 34900?

It's citing from -fdump-statistics-stats output, 43 is the pass number
of the 'release_ssa'
pass, 34900 is the sum of released ssa names per function.  Thus
overall we released
34900 SSA names during the compile of fold-const.c

>
>> which means we never have "trailing" released SSA names, all SSA
>> names on the freelist are for holes.  The following is the
>> distribution over releases happening per function:
>>
>> 43 release_ssa "SSA name holes removed == 0" 16
>> 43 release_ssa "SSA name holes removed == 1" 13
>
>
> Likewise here.  What does this output mean?

That's with changed statistics accounting, it's a histogram for the per-function
number SSA names that got released, thus for 16 functions we released zero
SSA names, for 13 functions one.

>
>
>> We seem to have quite some "dead" functions in fold-const.c ;)
>>
>> I didn't measure any off-noise memory/compile-time effect of this
>> patch though.
>
>
> I ask because I don't understand these two conclusions.  You're saying that
> we don't do a lot of this, so compile-time effects should be nil?

No, I'm saying despite some significant savings in SSA names namespace
we don't have too many sbitmaps (the SSA renamer has one) or walks over
the SSA name array.  And we definitely don't have ones that would exhibit
quadratic behavior in the size of the SSA name array.

Richard.

>
> Thanks.  Diego.


[PATCH] Fix PR tree-optimization/52870 (another crash in SLP pattern detection)

2012-04-06 Thread Ulrich Weigand
Hello,

PR 52870 is another crash in vectorizer pattern detection that was uncovered
by Ira's patch to enable patterns for SLP as well.

In this case, the problem is that vect_recog_widen_mult_pattern detects a
statement as part of a pattern, but that statement is actually outside of
the basic block SLP is currently working on.  This means the statement
has no stmt_vinfo allocated, and thus SLP crashes later on when operating
on the statement.

Note that in theory this could already have happened before that latest
patch, if vect_recog_widen_mult_pattern would have detected a statement
outside the current *loop*.  That is apparently much rarer, though.

The fix is to verify that the statement is actually part of the current
basic block or loop, as appropriate.  That same check is already performed
in various other pattern detection routines.

Tested on i686-linux and x86_64 with no regressions.

OK for mainline?

Bye,
Ulrich



ChangeLog:

gcc/
PR tree-optimization/52870
* tree-vect-patterns.c (vect_recog_widen_mult_pattern): Verify that
presumed pattern statement is within the same loop or basic block.

gcc/testsuite/
PR tree-optimization/52870
* gcc.dg/vect/pr52870.c: New test.


=== added file 'gcc/testsuite/gcc.dg/vect/pr52870.c'
--- gcc/testsuite/gcc.dg/vect/pr52870.c 1970-01-01 00:00:00 +
+++ gcc/testsuite/gcc.dg/vect/pr52870.c 2012-04-04 16:18:08 +
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vectorize" } */
+
+long
+test (int *x)
+{
+  unsigned long sx, xprec;
+
+  sx = *x >= 0 ? *x : -*x;
+
+  xprec = sx * 64;
+
+  if (sx < 16384)
+foo (sx);
+
+  return xprec;
+}

=== modified file 'gcc/tree-vect-patterns.c'
--- gcc/tree-vect-patterns.c2012-02-17 16:18:02 +
+++ gcc/tree-vect-patterns.c2012-04-04 16:18:08 +
@@ -564,6 +564,16 @@
   VEC (tree, heap) *dummy_vec;
   bool op1_ok;
   bool promotion;
+  loop_vec_info loop_vinfo;
+  struct loop *loop = NULL;
+  bb_vec_info bb_vinfo;
+  stmt_vec_info stmt_vinfo;
+
+  stmt_vinfo = vinfo_for_stmt (last_stmt);
+  loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
+  bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo);
+  if (loop_vinfo)
+loop = LOOP_VINFO_LOOP (loop_vinfo);
 
   if (!is_gimple_assign (last_stmt))
 return NULL;
@@ -635,6 +645,11 @@
   || gimple_assign_rhs_code (use_stmt) != NOP_EXPR)
 return NULL;
 
+  if (!gimple_bb (use_stmt)
+ || (loop && !flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
+ || (!loop && gimple_bb (use_stmt) != BB_VINFO_BB (bb_vinfo)))
+   return NULL;
+
   use_lhs = gimple_assign_lhs (use_stmt);
   use_type = TREE_TYPE (use_lhs);
   if (!INTEGRAL_TYPE_P (use_type)

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



[patch, fortran] Fix PR 52893

2012-04-06 Thread Thomas Koenig

Hello world,

after some time with a defective computer, I am back online.

Here is a fix for PR 52893 (which I just submitted, I wanted to
set a new record between bug posting and patch submissin :-), a
wrong-code regression for trunk and 4.7. Regression-tested.

OK for both?

Thomas

2012-04-06  Thomas Koenig  

PR fortran/52893
* frontend-passes.c:  Keep track of wether we are in an implicit
DO loop; do not do function elimination if we are.

2012-04-06  Thomas Koenig  

PR fortran/52893
* gfortran.dg/function_optimize_11.f90:  New test.
Index: frontend-passes.c
===
--- frontend-passes.c	(Revision 186190)
+++ frontend-passes.c	(Arbeitskopie)
@@ -70,6 +70,10 @@ static int forall_level;
 
 static bool in_omp_workshare;
 
+/* Keep track of iterators for array constructors.  */
+
+static int iterator_level;
+
 /* Entry point - run all passes for a namespace.  So far, only an
optimization pass is run.  */
 
@@ -179,6 +183,12 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtre
   if (forall_level > 0)
 return 0;
 
+  /* Function elimination inside an iterator could lead to functions
+ which depend on iterator variables being moved outside.  */
+
+  if (iterator_level > 0)
+return 0;
+
   /* If we don't know the shape at compile time, we create an allocatable
  temporary variable to hold the intermediate result, but only if
  allocation on assignment is active.  */
@@ -581,6 +591,7 @@ optimize_namespace (gfc_namespace *ns)
 
   current_ns = ns;
   forall_level = 0;
+  iterator_level = 0;
   in_omp_workshare = false;
 
   gfc_code_walker (&ns->code, convert_do_while, dummy_expr_callback, NULL);
@@ -1140,9 +1151,13 @@ gfc_expr_walker (gfc_expr **e, walk_expr_fn_t expr
 	for (c = gfc_constructor_first ((*e)->value.constructor); c;
 		 c = gfc_constructor_next (c))
 	  {
-		WALK_SUBEXPR (c->expr);
-		if (c->iterator != NULL)
+		if (c->iterator == NULL)
+		  WALK_SUBEXPR (c->expr);
+		else
 		  {
+		iterator_level ++;
+		WALK_SUBEXPR (c->expr);
+		iterator_level --;
 		WALK_SUBEXPR (c->iterator->var);
 		WALK_SUBEXPR (c->iterator->start);
 		WALK_SUBEXPR (c->iterator->end);
! { dg-do run }
! { dg-options "-ffrontend-optimize" }
! Do not move common functions out of implicit DO loop constructors.
program test
  integer, parameter :: N = 4
  integer, parameter :: dp=kind(1.d0)
  real(kind=dp), parameter :: pi=4*atan(1._dp)
  real(kind=dp), parameter :: eps = 1.e-14_dp
  real(kind=dp) :: h1(0:N-1), h2(0:N-1)
  integer i

  i = 1
  h1 = [(cos(2*pi*mod(i*k,N)/N),k=0,N/2), &
   & (sin(2*pi*mod(i*k,N)/N),k=1,N/2-1)]
  h2 = (/ 1._dp, 0._dp, -1._dp, 1._dp /)
  if (any(abs(h1 - h2) > eps)) call abort
end program test


Mirror gcc/contrib -> src/contrib? [was Re: [patch, gcc RFA] dg-extract-results.sh: Handle KFAILs.]

2012-04-06 Thread Doug Evans
On Thu, Mar 15, 2012 at 11:54 AM, Mike Stump  wrote:
> On Mar 15, 2012, at 11:09 AM, Pedro Alves wrote:
>> Still, kfail is standard DejaGnu, not a GDB invention.  It'd be nice not to
>> need to fork the script for this.
>
> The change is fine for the gcc tree.

Committed (to the gcc tree, already in gdb tree).
Thanks.

btw, is there any interest in mirroring gcc/contrib -> src/contrib?
[instead of gdb having its own copy in gdb/testsuite, it *could* use
the one in, e.g., src/contrib. I don't have a strong opinion.  I'm
just looking for others opinions, as the topic came up in another
context.]


Re: [SH] Replace 'high_life_started' with 'reload_in_progress'

2012-04-06 Thread Kaz Kojima
Oleg Endo  wrote:
> The attached patch removes the 'high_life_started' macro and replaces
> its use with 'reload_in_progress'.
> 
> Tested with 'make all-gcc'.
> OK?

OK.

Regards,
kaz


Re: [SH] Cleanup sh-protos.h

2012-04-06 Thread Kaz Kojima
Oleg Endo  wrote:
> The attached patch removes unneeded forward declarations from
> sh-protos.h.
> Tested with 'make all-gcc'.
> 
> OK?

OK.

Regards,
kaz


Re: [SH] Make prepare_move_operands return void

2012-04-06 Thread Kaz Kojima
Oleg Endo  wrote:
> The 'prepare_move_operands' function currently always returns 0, which
> makes checking its return value (e.g. in sh.md) useless.  The attached
> patch makes 'prepare_move_operands' return void and removes the return
> value checks.
> 
> Tested with 'make all-gcc'.
> OK?

OK.

Regards,
kaz


Re: [SH] Fold big/little endian word code with MSW and LSW

2012-04-06 Thread Oleg Endo
On Fri, 2012-04-06 at 10:46 +0900, Kaz Kojima wrote:
> From: Oleg Endo 
> >> Exposing three-letter macro MSW and LSW globally looks not
> >> a good idea to me.
> > 
> > Would 'HIGH_WORD' and 'LOW_WORD' be OK as an alternative?
> 
> Sounds better but still a bit too generic.  SH_{HIGH,LOW}_WORD
> would be Ok, though not so cool. 
> 

On a second thought, it might be better to simplify those cases in
the .md file, where low/high subregs are used by using 'gen_highpart'
and 'gen_lowpart' for example, instead of checking the endianness over
and over again.
I'm trying out a couple of things...

Cheers,
Oleg



Re: [PATCH] Caret diagnostics

2012-04-06 Thread Jason Merrill

On 04/06/2012 04:11 AM, Manuel López-Ibáñez wrote:

+++ gcc/testsuite/gcc.dg/torture/tls/tls.exp(working copy)
@@ -48,10 +48,10 @@ dg-init
 torture-init
 set-torture-options $TLS_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS

 # Main loop.
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
-$DEFAULT_CFLAGS
+"-fno-diagnostics-show-caret $DEFAULT_CFLAGS"


I don't think this is needed since you're already adding it to 
TEST_ALWAYS_FLAGS.  The tests pass without this for me.



+  int max_width = 80, right_margin = 10;


Let's not hardcode these numbers.  We should use getenv("COLUMNS") for 
the width if it's set; otherwise I would lean toward unlimited width. 
And I'm not sure why we need a right margin at all.



+  s = expand_location(diagnostic->location);
+  line = location_get_source_line (s);


Why not expand the location inside location_get_source_line?

Jason


Re: [PATCH] Caret diagnostics

2012-04-06 Thread Manuel López-Ibáñez
On 7 April 2012 00:04, Jason Merrill  wrote:
> On 04/06/2012 04:11 AM, Manuel López-Ibáńez wrote:
>>
>> +++ gcc/testsuite/gcc.dg/torture/tls/tls.exp    (working copy)
>> @@ -48,10 +48,10 @@ dg-init
>>  torture-init
>>  set-torture-options $TLS_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
>>
>>  # Main loop.
>>  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
>> -        $DEFAULT_CFLAGS
>> +        "-fno-diagnostics-show-caret $DEFAULT_CFLAGS"
>
>
> I don't think this is needed since you're already adding it to
> TEST_ALWAYS_FLAGS.  The tests pass without this for me.
>

Good. I will try without, but the output does not show the flag two
times, which make me think that tls.exp is not using
TEST_ALWAYS_FLAGS. But maybe I was looking at the wrong place.

>> +  int max_width = 80, right_margin = 10;
>
>
> Let's not hardcode these numbers.  We should use getenv("COLUMNS") for the

Fine, I'll try that.

> width if it's set; otherwise I would lean toward unlimited width. And I'm
> not sure why we need a right margin at all.

The right margin is because:

* We don't want to do wrapping. Otherwise the caret looks strange. So
either we cut long lines or we leave the maximum width unlimited.
* If we cut long lines, and the line is too long and the caret is too
close to the right margin, it is better to cut the line at the
beginning to show the part pointed by the caret within the maximum
width, with some margin to the right. That is, we don't want to show:

 very_very_long_line with something w
 ^
We want to show:

 long_line with something wrong on it
  ^


>> +  s = expand_location(diagnostic->location);
>> +  line = location_get_source_line (s);
>
>
> Why not expand the location inside location_get_source_line?

Well, we have to expand outside anyway, because I need the column
info, so it seemed a waste to expand twice. Do you have a strong
preference for expanding twice? I don't care so much either way.

Cheers,

Manuel.


Re: [google/gcc-4_6] Added dejagnu base line for x86_64-cros-linux-gnu. (issue 5990044)

2012-04-06 Thread jingyu

On 2012/04/06 00:35:12, asharif1 wrote:

On 2012/04/05 17:25:44, shenhan wrote:
> Hi Jing and Ahmad,
>
> This adds a new test base line for x86_64-cros-linux-gnu. Please

take a look.

>
> Thanks,
> Han



lgtm.


ok

http://codereview.appspot.com/5990044/


fix new warning

2012-04-06 Thread Mike Stump
This fixes a warning  Applied as obvious.


Index: ChangeLog
===
--- ChangeLog   (revision 186201)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2012-04-06  Mike Stump  
+
+   * gimple-fold.c (gimple_fold_stmt_to_constant_1): Avoid warning.
+
 2012-04-06  Oleg Endo  
 
* config/sh/sh.c (hi_const): Remove.
Index: gimple-fold.c
===
--- gimple-fold.c   (revision 186111)
+++ gimple-fold.c   (working copy)
@@ -2427,7 +2427,7 @@ gimple_fold_stmt_to_constant_1 (gimple s
  else if (TREE_CODE (rhs) == ADDR_EXPR
   && !is_gimple_min_invariant (rhs))
{
- HOST_WIDE_INT offset;
+ HOST_WIDE_INT offset = 0;
  tree base;
  base = get_addr_base_and_unit_offset_1 (TREE_OPERAND (rhs, 0),
  &offset,


Re: [PATCH] Caret diagnostics

2012-04-06 Thread Jason Merrill

On 04/06/2012 06:30 PM, Manuel López-Ibáñez wrote:

width if it's set; otherwise I would lean toward unlimited width. And I'm
not sure why we need a right margin at all.


The right margin is because:

>[snip]

Ah, I read "margin" and assumed it meant you were leaving blank space at 
the right side of the screen.  Now I understand.



Well, we have to expand outside anyway, because I need the column
info, so it seemed a waste to expand twice. Do you have a strong
preference for expanding twice? I don't care so much either way.


No, I guess it's fine this way.

Jason


Re: [patch] Fix PR52822 (stable_partition move-assigns object to itself) in trunk, 4.7, and 4.6

2012-04-06 Thread Jeffrey Yasskin
On Wed, Apr 4, 2012 at 11:09 PM, Paolo Carlini  wrote:
> Hi,
>
>> The attached patches fix http://gcc.gnu.org/PR52822, and have been
>> tested with `make check-c++` on linux-x86_64. The trunk patch applies
>> and tests cleanly on gcc-4_7-branch. The gcc-4_6-branch patch is
>> significantly simpler, as Paolo suggested on the bug.
>
> A few small issues.
>
> For the 4.6 version of the patch, you want to use std::__addressof, instead
> of simply &, which may be overloaded.
> And by the way what's wrong with just comparing the iterators?

Nothing's wrong with comparing the iterators. Switched.

> For the mainline/4.7 version, you want to cast __pred to bool:
> !bool(__pred(*__first)). Also, isn't clear to me why you have __local_len in
> __find_if_not_n instead of just working on __len (and in any case please
> prefer just __local_len as condition instead of the redundant __local_len !=
> 0; likewise in many other similar situations).

I was micro-optimizing, since the compiler might think __len is
modified in __pred if it doesn't inline enough. I've removed
__local_len, casted pred results to bool, and avoided !=0.

> Also, very minor nit, you will be touching the libstdc++-v3 Changelog thus
> no libstdc++-v3 prefixes in the ChangeLog entry.

Yep, done.


pr52822_gcc46.patch
Description: Binary data


pr52822_trunk.patch
Description: Binary data


[patch, committed] invoke.texi: clean up texinfo markup

2012-04-06 Thread Sandra Loosemore
This is another installment in my series of cleanups to invoke.texi.  
In this patch I have taken a break from nit-picking grammar and have 
nit-picked some Texinfo markup issues instead.

Since this is supposed to be a content-free patch, I went ahead and 
checked it in after inspecting the generated PDF manual.

-Sandra


2012-04-06  Sandra Loosemore  

gcc/
* doc/invoke.texi:  Clean up Texinfo markup throughout the file.
Use @option markup on command-line options.  Use @samp markup on
literal keywords to options.  Use @code markup on code fragments.
Use other markup in preference to quotation marks in the text.
Add markup to some passages without any.
Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi	(revision 186145)
+++ gcc/doc/invoke.texi	(working copy)
@@ -1494,8 +1494,8 @@ accepts:
 @cindex ISO support
 @item -ansi
 @opindex ansi
-In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
-equivalent to @samp{-std=c++98}.
+In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
+equivalent to @option{-std=c++98}.
 
 This turns off certain features of GCC that are incompatible with ISO
 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
@@ -1541,7 +1541,7 @@ The compiler can accept several base sta
 @samp{gnu90} or @samp{gnu++98}.  By specifying a base standard, the
 compiler will accept all programs following that standard and those
 using GNU extensions that do not contradict it.  For example,
-@samp{-std=c90} turns off certain features of GCC that are
+@option{-std=c90} turns off certain features of GCC that are
 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
 keywords, but not other GNU extensions that do not have a meaning in
 ISO C90, such as omitting the middle term of a @code{?:}
@@ -1551,8 +1551,8 @@ those features change the meaning of the
 strict-conforming programs may be rejected.  The particular standard
 is used by @option{-pedantic} to identify which features are GNU
 extensions given that version of the standard. For example
-@samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
-comments, while @samp{-std=gnu99 -pedantic} would not.
+@option{-std=gnu90 -pedantic} warns about C++ style @samp{//}
+comments, while @option{-std=gnu99 -pedantic} does not.
 
 A value for this option must be provided; possible values are
 
@@ -1966,7 +1966,7 @@ is 512.
 @item -fdeduce-init-list
 @opindex fdeduce-init-list
 Enable deduction of a template type parameter as
-std::initializer_list from a brace-enclosed initializer list, i.e.
+@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
 
 @smallexample
 template  auto forward(T t) -> decltype (realfn (t))
@@ -2436,7 +2436,7 @@ int i = @{ 2.2 @}; // error: narrowing f
 
 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
 
-With -std=c++11, @option{-Wno-narrowing} suppresses the diagnostic
+With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic
 required by the standard.  Note that this does not affect the meaning
 of well-formed code; narrowing conversions are still considered
 ill-formed in SFINAE context.
@@ -3284,7 +3284,7 @@ included in @option{-Wformat-nonliteral}
 @opindex Wformat=2
 @opindex Wno-format=2
 Enable @option{-Wformat} plus format checks not included in
-@option{-Wformat}.  Currently equivalent to @samp{-Wformat
+@option{-Wformat}.  Currently equivalent to @option{-Wformat
 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
 
 @item -Wnonnull
@@ -3627,8 +3627,8 @@ This warning is enabled by @option{-Wall
 All the above @option{-Wunused} options combined.
 
 In order to get a warning about an unused function parameter, you must
-either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
-@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
+either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
+@option{-Wunused}), or separately specify @option{-Wunused-parameter}.
 
 @item -Wuninitialized
 @opindex Wuninitialized
@@ -3722,7 +3722,7 @@ the warnings were only enabled by the @o
 @opindex Wpragmas
 Do not warn about misuses of pragmas, such as incorrect parameters,
 invalid syntax, or conflicts between pragmas.  See also
-@samp{-Wunknown-pragmas}.
+@option{-Wunknown-pragmas}.
 
 @item -Wstrict-aliasing
 @opindex Wstrict-aliasing
@@ -3741,13 +3741,13 @@ This option is only active when @option{
 It warns about code that might break the strict aliasing rules that the
 compiler is using for optimization.
 Higher levels correspond to higher accuracy (fewer false positives).
-Higher levels also correspond to more effort, similar to the way -O works.
-@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
-with n=3.
+Higher levels also correspond to more effort, similar to the way @option{-O} 
+works.
+@option{-Wstrict-a