Re: [patch, mips] Patch for new mips triplet - mips-mti-elf

2012-09-16 Thread Richard Sandiford
"Steve Ellcey "  writes:
> +#undef SYSROOT_SUFFIX_SPEC
> +#define SYSROOT_SUFFIX_SPEC \
> +
> "%{mips32:/mips32}%{mips64:/mips64}%{mips64r2:/mips64r2}%{mips16:/mips16}%{msoft-float:/sof}%{mel|EL:/el}%{mabi=64:/64}%{mabi=n32:/n32}"

This shouldn't be needed for *-elf targets.

> +/* This is idential to sde.h except for the ABI setting which defaults
> +   to 32 instead of n32 on 32 bit architectures and the addition of
> +   MIPS_ISA_SYNCI_SPEC.  */

SDE defaults to o32 (-mabi=32) for 32-bit targets and n32 for 64-bit targets.
I think that's what you'd want here too, otherwise the mips64 multilibs
are really no different from the mips32 ones.

> +  /* Remove a redundant -mfp64 for -mabi=n32; we want the !mfp64 \
> + multilibs.  There's no need to check whether the architecture   \
> + is 64-bit; cc1 will complain if it isn't.  */   \
> +  "%{mabi=n32: %

Re: [PATCH] Changes in mode switching

2012-09-16 Thread Richard Sandiford
Vladimir Yakovlev  writes:
> I reproduced the failure and found reason of it. I understood haw it
> resolve and now I need small changes only - additional argument of
> EMIT_MODE_SET. Is it good fo trunk?

I'm not sure I understand why you need to know the instruction.
The x86 code was:

+  if (mode == AVX_U128_CLEAN)
+   {
+ if (insn)
+   {
+ rtx pat = PATTERN(insn);
+ if (!is_vzeroupper(pat) && !is_vzeroall(pat))
+   ix86_emit_vzeroupper ();
+   }
+ else
+   ix86_emit_vzeroupper ();
+   }
+  break;

But the pass should already know via MODE_AFTER that the mode is set to
AVX_U128_CLEAN by vzeroupper and vzeroall.  Under what circumstances
do we think that we need to set the mode to AVX_U128_CLEAN immediately
before vzeroupper or vzeroall?

I'm probably making you repeat yourself here, sorry.

Richard


Ping^2: [PATCH 3/6] Thread pointer built-in functions, arm

2012-09-16 Thread Richard Sandiford
Second ping for the ARM part of Chung-Lin's __builtin_thread_pointer patch:

http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01914.html

I think this is the only part that hasn't been approved.

Thanks,
Richard


Re: [Patch, Fortran] Fix some issues found by Coverity's static-code analysis scan

2012-09-16 Thread Mikael Morin
On 15/09/2012 19:36, Tobias Burnus wrote:
> Hi Mikael,
> 
> thanks for your comments.
> 
> As a pre-script: Will you look at Paul's revised assignment patch - or
> should I do it?
I looked at it twice or so, and couldn't get the double temporary thing.
I'll get back to it.

> If you want to know the Coverity's diagnostic, you can also have access
> to GCC's Coverity scan results. Are you interested?
I have no plans to make anything out of them in the foreseeable future;
for later I don't know, why not.

> Thanks for the analysis. Will you create a patch?
> 
Attached. Tested against "*namelist*" and full regression test in
progress. OK?

Mikael



2012-09-16  Mikael Morin  

	* symbol.c (gfc_undo_symbols): Correctly undo namelists.

2012-09-16  Mikael Morin  

	* gfortran.dg/namelist_75.f90: New test.

Index: symbol.c
===
--- symbol.c	(révision 191341)
+++ symbol.c	(copie de travail)
@@ -2996,7 +2996,7 @@ gfc_undo_symbols (void)
 	{
 	  if (p->namelist_tail != old->namelist_tail)
 	{
-	  gfc_free_namelist (old->namelist_tail);
+	  gfc_free_namelist (old->namelist_tail->next);
 	  old->namelist_tail->next = NULL;
 	}
 	}



! { dg-do compile }
!
! Tests a write-after-free memory error fix in gfc_undo_symbols

program test_nml

  namelist /foo/ bar, baz
  namelist /foo/ wrong, ,  ! { dg-error "Syntax error in NAMELIST" }

end program test_nml




Re: [Patch, Fortran] Fix some issues found by Coverity's static-code analysis scan

2012-09-16 Thread Tobias Burnus

Mikael Morin wrote:

On 15/09/2012 19:36, Tobias Burnus wrote:

As a pre-script: Will you look at Paul's revised assignment patch - or
should I do it?

I looked at it twice or so, and couldn't get the double temporary thing.
I'll get back to it.


Thanks!


Thanks for the analysis. Will you create a patch?

Attached. Tested against "*namelist*" and full regression test in
progress. OK?


OK. Thanks for the patch.

Tobias


Re: Finish up PR rtl-optimization/44194

2012-09-16 Thread Richard Sandiford
Eric Botcazou  writes:
> This is the PR about the useless spilling to memory of structures that are 
> returned in registers.  It was essentially addressed last year by Easwaran 
> with 
> an enhancement of the RTL DSE pass, but Easwaran also noted that we still 
> spill 
> to memory in the simplest cases, e.g. gcc.dg/pr44194-1.c, because expand_call
> creates a temporary on the stack to store the value returned in registers...
>
> The attached patch solves this problem by copying the value into pseudos 
> instead by means of emit_group_move_into_temps.  This is sufficient to get 
> rid 
> of the remaining memory accesses for gcc.dg/pr44194-1.c on x86-64 for example,
> but not on strict-alignment platforms like SPARC64.

Thanks for doing this.  It'll obviously help n32 and n64 long doubles too.

I hit one problem building libgfortran for mips64-linux-gnu.
The calls.c change was:

Index: calls.c
===
--- calls.c (revision 191198)
+++ calls.c (working copy)
@@ -3272,16 +3272,8 @@ expand_call (tree exp, rtx target, int i
   else if (GET_CODE (valreg) == PARALLEL)
{
  if (target == 0)
-   {
- /* This will only be assigned once, so it can be readonly.  */
- tree nt = build_qualified_type (rettype,
- (TYPE_QUALS (rettype)
-  | TYPE_QUAL_CONST));
-
- target = assign_temp (nt, 1, 1);
-   }
-
- if (! rtx_equal_p (target, valreg))
+   target = emit_group_move_into_temps (valreg);
+ else if (!rtx_equal_p (target, valreg))
emit_group_store (target, valreg, rettype,
  int_size_in_bytes (rettype));
 
  /* We can not support sibling calls for this case.  */
  sibcall_failure = 1;

But if we're trying to use a sibcall, we go through this loop twice,
and the second iteration has to cope with a PARALLEL target created
by the first.  How about the patch below?  Tested on mips64-linux-gnu,
where a full testrun looked good.

In some ways it's a bit silly to emit anything at all in the first iteration,
given that we then go on to set sibcall_failure.  It's not the kind of loop
we can just continue out of though.  Also, your patch probably means that
we only need to set sibcall_failure for the emit_group_store case,
although I've not tested that.

Richard


gcc/
* calls.c (expand_call): Use emit_group_move for PARALLEL->PARALLEL
moves.

Index: gcc/calls.c
===
--- gcc/calls.c 2012-09-15 11:15:46.0 +0100
+++ gcc/calls.c 2012-09-15 11:15:46.522857695 +0100
@@ -3273,7 +3273,13 @@ expand_call (tree exp, rtx target, int i
{
  if (target == 0)
target = emit_group_move_into_temps (valreg);
- else if (!rtx_equal_p (target, valreg))
+ else if (rtx_equal_p (target, valreg))
+   ;
+ else if (GET_CODE (target) == PARALLEL)
+   /* Handle the result of a emit_group_move_into_temps
+  call in the previous pass.  */
+   emit_group_move (target, valreg);
+ else
emit_group_store (target, valreg, rettype,
  int_size_in_bytes (rettype));
 


Re: [Patch, Fortran] PR 54387: [F03] Wrongly accepts non-proc result variable on the RHS of a proc-pointer assignment

2012-09-16 Thread Tobias Burnus

Am 15.09.2012 17:22, schrieb Janus Weil:

here is a small patch which fixes an accepts-invalid problem with
proc-pointer assignments. Regtested on x86_64-unknown-linux-gnu. Ok
for trunk?


OK. Thanks for the patch.

(Though, I am wondering whether the error message could be improved. We 
know that the RHS is not the procedure but the result variable; it might 
help the user if the message is a bit clearer. But you can also keep the 
current version.)


Tobias



2012-09-15  Janus Weil  

PR fortran/54387
* expr.c (gfc_check_pointer_assign): Check for result of embracing
function.

2012-09-15  Janus Weil  

PR fortran/54387
* gfortran.dg/proc_ptr_38.f90: New.




[Patch, Fortran] (3/n) Fix bit/logical bugs found by Coverity

2012-09-16 Thread Tobias Burnus
Committed as obvious (Rev. 191358) after building and successfully 
regtesting on x86-64-linux.


I collected some futher bugs in 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54599. There several 
additional ones, but many are bogus. I think the most common "defect" is 
that one dereferences a pointer and either before or afterwards one 
checks whether it is NULL. And there are several places where gfortran 
leaks memory.


Tobias
Index: gcc/fortran/ChangeLog
===
--- gcc/fortran/ChangeLog	(Revision 191357)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,10 @@
+2012-09-16  Tobias Burnus  
+
+	* trans-decl.c (gfc_generate_function_code): Fix
+	gfc_option.coarray check.
+	* trans-stmt.c (compute_inner_temp_size): Fix handling
+	of gfc_option.rtcheck.
+
 2012-09-16  Mikael Morin  
 
 	* symbol.c (gfc_undo_symbols): Correctly undo namelists.
Index: gcc/fortran/trans-decl.c
===
--- gcc/fortran/trans-decl.c	(Revision 191357)
+++ gcc/fortran/trans-decl.c	(Arbeitskopie)
@@ -5480,7 +5480,7 @@ gfc_generate_function_code (gfc_namespace * ns)
 }
   current_function_decl = old_context;
 
-  if (decl_function_context (fndecl) && !gfc_option.coarray == GFC_FCOARRAY_LIB
+  if (decl_function_context (fndecl) && gfc_option.coarray != GFC_FCOARRAY_LIB
   && has_coarray_vars)
 /* Register this function with cgraph just far enough to get it
added to our parent's nested function list.
Index: gcc/fortran/trans-stmt.c
===
--- gcc/fortran/trans-stmt.c	(Revision 191357)
+++ gcc/fortran/trans-stmt.c	(Arbeitskopie)
@@ -3132,7 +3132,7 @@ compute_inner_temp_size (gfc_expr *expr1, gfc_expr
 
   /* Calculate the bounds of the scalarization.  */
   save_flag = gfc_option.rtcheck;
-  gfc_option.rtcheck &= !GFC_RTCHECK_BOUNDS;
+  gfc_option.rtcheck &= ~GFC_RTCHECK_BOUNDS;
   gfc_conv_ss_startstride (&loop);
   gfc_option.rtcheck = save_flag;
   gfc_conv_loop_setup (&loop, &expr2->where);


FW: Wish we had a chance to meet...

2012-09-16 Thread Jacob Adopley
Please track this idiot down and stop it! This idiot is giving a bad rap to 
your organization! 
Thanks.
jacob k. adopley


From: java-ow...@gcc.gnu.org [java-ow...@gcc.gnu.org] on behalf of Reynalda 
Bonilla [gio6778sei...@yahoo.com]
Sent: Saturday, September 15, 2012 5:15 PM
To: j...@gcc.gnu.org
Subject: Wish we had a chance to meet...

Hello,
My name is Reynalda. You may think that it is pretty wired but anyway I search 
on the internet looking for interesting people and that is how I found you. I 
don't lose anything but I can acquire something doing this, right?)
I hope you are not afraid of things like that. So I found you, and I I don't 
know why but I think that u are an interesting person and also I'm sure that it 
will be an exciting meeting for both of us.
As you could already notice I am an open-minded, very sociable and kind-hearted 
person. I really enjoy travelling and meeting new people. It was like a short 
introduction and I will tell you more about myself when you reply. Now, please 
tell me something about yourself! What are you interesting in? What singles you 
out? What is special about you?
I hope you aren't going ignore it and you will answer the letter. Now the world 
is your oyster.)
Unfortunately I need to go now but I'll be waiting for your answer!
Talk to you later!
Reynalda




Re: Finish up PR rtl-optimization/44194

2012-09-16 Thread Eric Botcazou
> I hit one problem building libgfortran for mips64-linux-gnu.
> The calls.c change was:
> 
> Index: calls.c
> ===
> --- calls.c   (revision 191198)
> +++ calls.c   (working copy)
> @@ -3272,16 +3272,8 @@ expand_call (tree exp, rtx target, int i
>else if (GET_CODE (valreg) == PARALLEL)
>   {
> if (target == 0)
> - {
> -   /* This will only be assigned once, so it can be readonly.  */
> -   tree nt = build_qualified_type (rettype,
> -   (TYPE_QUALS (rettype)
> -| TYPE_QUAL_CONST));
> -
> -   target = assign_temp (nt, 1, 1);
> - }
> -
> -   if (! rtx_equal_p (target, valreg))
> + target = emit_group_move_into_temps (valreg);
> +   else if (!rtx_equal_p (target, valreg))
>   emit_group_store (target, valreg, rettype,
> int_size_in_bytes (rettype));
> 
> /* We can not support sibling calls for this case.  */
> sibcall_failure = 1;
> 
> But if we're trying to use a sibcall, we go through this loop twice,
> and the second iteration has to cope with a PARALLEL target created
> by the first.  How about the patch below?  Tested on mips64-linux-gnu,
> where a full testrun looked good.

Fine with me, thanks.  I'm a little puzzled that I didn't run into this myself.

> In some ways it's a bit silly to emit anything at all in the first
> iteration, given that we then go on to set sibcall_failure.  It's not the
> kind of loop we can just continue out of though.  Also, your patch
> probably means that we only need to set sibcall_failure for the
> emit_group_store case, although I've not tested that.

Good point, I'll give it a try.

-- 
Eric Botcazou


[PATCH] Fix missing EH updates in execute_cse_sincos (PR tree-optimization/54563)

2012-09-16 Thread Jakub Jelinek
Hi!

As discussed in the PR, this patch fixes the ICE by calling
gimple_purge_dead_eh_edges if the last stmt has been replaced by the pass.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Still, I think it would be nice if e.g. powf or cosl were throw() in C++, at
least if they are treated as builtins or at least in C++11 where they are
library functions.

2012-09-16  Jakub Jelinek  

PR tree-optimization/54563
* tree-ssa-math-opts.c (execute_cse_sincos): Call
gimple_purge_dead_eh_edges if last call has been changed.

* g++.dg/torture/pr54563.C: New test.

--- gcc/tree-ssa-math-opts.c.jj 2012-09-12 10:57:02.0 +0200
+++ gcc/tree-ssa-math-opts.c2012-09-14 21:03:05.546319590 +0200
@@ -1378,12 +1378,18 @@ execute_cse_sincos (void)
   FOR_EACH_BB (bb)
 {
   gimple_stmt_iterator gsi;
+  bool cleanup_eh = false;
 
   for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 {
  gimple stmt = gsi_stmt (gsi);
  tree fndecl;
 
+ /* Only the last stmt in a bb could throw, no need to call
+gimple_purge_dead_eh_edges if we change something in the middle
+of a basic block.  */
+ cleanup_eh = false;
+
  if (is_gimple_call (stmt)
  && gimple_call_lhs (stmt)
  && (fndecl = gimple_call_fndecl (stmt))
@@ -1421,6 +1427,7 @@ execute_cse_sincos (void)
  gimple_set_location (new_stmt, loc);
  unlink_stmt_vdef (stmt);
  gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
  if (gimple_vdef (stmt))
release_ssa_name (gimple_vdef (stmt));
}
@@ -1443,6 +1450,7 @@ execute_cse_sincos (void)
  gimple_set_location (new_stmt, loc);
  unlink_stmt_vdef (stmt);
  gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
  if (gimple_vdef (stmt))
release_ssa_name (gimple_vdef (stmt));
}
@@ -1460,6 +1468,7 @@ execute_cse_sincos (void)
  gimple_set_location (new_stmt, loc);
  unlink_stmt_vdef (stmt);
  gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
  if (gimple_vdef (stmt))
release_ssa_name (gimple_vdef (stmt));
}
@@ -1469,6 +1478,8 @@ execute_cse_sincos (void)
}
}
}
+  if (cleanup_eh)
+   cfg_changed |= gimple_purge_dead_eh_edges (bb);
 }
 
   statistics_counter_event (cfun, "sincos statements inserted",
--- gcc/testsuite/g++.dg/torture/pr54563.C.jj   2012-09-14 21:05:07.514702413 
+0200
+++ gcc/testsuite/g++.dg/torture/pr54563.C  2012-09-14 21:04:40.0 
+0200
@@ -0,0 +1,14 @@
+// PR tree-optimization/54563
+// { dg-do compile }
+
+extern "C" float powf (float, float);
+struct S { ~S (); };
+double bar ();
+double x;
+
+void
+foo ()
+{
+  S s;
+  x = powf (bar (), 2.);
+}

Jakub


[Patch, Fortran, OOP] PR 54594: Type-bound ASSIGNMENTs (elemental + array version) rejected as ambiguous

2012-09-16 Thread Janus Weil
Hi all,

here is an OOP patch for type-bound generics. The problem was that
specifics with polymorphic arguments of different ranks were wrongly
rejected as ambiguous, because 'gfc_compare_types' did not properly
handle CLASS arrays. The patch fixes this is regtests cleanly on
x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2012-09-16  Janus Weil  

PR fortran/54594
* interface.c (compare_type_rank): Handle CLASS arrays.

2012-09-16  Janus Weil  

PR fortran/54594
* gfortran.dg/typebound_generic_14.f03: New.


pr54594.diff
Description: Binary data


typebound_generic_14.f03
Description: Binary data


[committed] Adjust scan assembler check in gfortran.dg/bind_c_array_params_2.f90 for hppa*-*-hpux*

2012-09-16 Thread John David Anglin
This fixes the assembler scan on hppa*-*-hpux*.  Tested on hppa2.0w-hp-hpux11
and hppa64-hp-hpux11.11.  Committed to trunk.

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

2012-09-16  John David Anglin  

* gfortran.dg/bind_c_array_params_2.f90: Adjust scan-assembler-times
"myBindC" for hppa*-*-hpux*.

Index: gfortran.dg/bind_c_array_params_2.f90
===
--- gfortran.dg/bind_c_array_params_2.f90   (revision 191314)
+++ gfortran.dg/bind_c_array_params_2.f90   (working copy)
@@ -15,6 +15,7 @@
 call test(aa)
 end
 
-! { dg-final { scan-assembler-times "myBindC" 1 } }
+! { dg-final { scan-assembler-times "myBindC" 1 { target { ! { hppa*-*-hpux* } 
} } } }
+! { dg-final { scan-assembler-times "myBindC,%r2" 1 { target { hppa*-*-hpux* } 
} } }
 ! { dg-final { scan-tree-dump-times "test \\\(&parm\\." 1 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }


Re: [Patch, Fortran, OOP] PR 54594: Type-bound ASSIGNMENTs (elemental + array version) rejected as ambiguous

2012-09-16 Thread Tobias Burnus

Janus Weil wrote:

here is an OOP patch for type-bound generics. The problem was that
specifics with polymorphic arguments of different ranks were wrongly
rejected as ambiguous, because 'gfc_compare_types' did not properly
handle CLASS arrays. The patch fixes this is regtests cleanly on
x86_64-unknown-linux-gnu. Ok for trunk?


OK. Looks rather obvious to me. Thanks for fixing it quickly.

Tobias


2012-09-16  Janus Weil  

PR fortran/54594
* interface.c (compare_type_rank): Handle CLASS arrays.

2012-09-16  Janus Weil  

PR fortran/54594
* gfortran.dg/typebound_generic_14.f03: New.




[committed] Fix gnat.dg/lto15.adb on hppa

2012-09-16 Thread John David Anglin
Tested on hppa2.0w-hp-hpux11.11 and committed to trunk.

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

2012-09-16  John David Anglin  

PR testsuite/54007
* gnat.dg/lto15.adb: Require lto.

Index: gnat.dg/lto15.adb
===
--- gnat.dg/lto15.adb   (revision 191314)
+++ gnat.dg/lto15.adb   (working copy)
@@ -1,5 +1,6 @@
 -- { dg-do compile }
 -- { dg-options "-O -flto -g" }
+-- { dg-require-effective-target lto }
 
 package body Lto15 is
 


[committed] Fix g++.dg/debug/dwarf2/nested-3.C to handle hppa assembler comment

2012-09-16 Thread John David Anglin
This adjusts the regexp to work on hppa.  Tested on hppa2.0w-hp-hpux11.11
and hppa64-hp-hpux11.11.  Committed to trunk.

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

2012-09-16  John David Anglin  

PR debug/54460
* g++.dg/debug/dwarf2/nested-3.C: Add hppa assembler comment character
to scary regexp.

Index: g++.dg/debug/dwarf2/nested-3.C
===
--- g++.dg/debug/dwarf2/nested-3.C  (revision 191314)
+++ g++.dg/debug/dwarf2/nested-3.C  (working copy)
@@ -59,4 +59,4 @@
 //
 // Hence the scary regexp:
 //
-// { dg-final { scan-assembler "\[^\n\r\]*\\(DIE \\(0x(\[0-9a-f\]+)\\) 
DW_TAG_namespace\\)\[\n\r\]+\[^\n\r\]*\"thread\[\^\n\r]+\[\n\r\]+(\[^\n\r\]*\[\n\r\]+)+\[^\n\r\]*\\(DIE
 \\(0x(\[0-9a-f\]+)\\) 
DW_TAG_class_type\\)(\[\n\r\]+\[^\n\r\]*)+\"Executor\[^\n\r\]+\[\n\r\]+\[^\n\r\]*DW_AT_declaration\[\n\r\]+\[^\n\r\]*DW_AT_signature\[^#/!|@\]*\[#/!|@\]
 
\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_subprogram\\)\[\n\r\]+(\[^\n\r\]*\[\n\r\]+)+\[^\n\r\]*\"CurrentExecutor\[^\n\r\]+\[\n\r\]+(\[^\n\r\]*\[\n\r\]+)+(\[^\n\r\]*\[\n\r\]+)+\[^\n\r\]*end
 of children of DIE 0x\\3\[\n\r]+\[^\n\r\]*end of children of DIE 
0x\\1\[\n\r]+" } }
+// { dg-final { scan-assembler "\[^\n\r\]*\\(DIE \\(0x(\[0-9a-f\]+)\\) 
DW_TAG_namespace\\)\[\n\r\]+\[^\n\r\]*\"thread\[\^\n\r]+\[\n\r\]+(\[^\n\r\]*\[\n\r\]+)+\[^\n\r\]*\\(DIE
 \\(0x(\[0-9a-f\]+)\\) 
DW_TAG_class_type\\)(\[\n\r\]+\[^\n\r\]*)+\"Executor\[^\n\r\]+\[\n\r\]+\[^\n\r\]*DW_AT_declaration\[\n\r\]+\[^\n\r\]*DW_AT_signature\[^#;/!|@\]*\[#;/!|@\]
 
\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_subprogram\\)\[\n\r\]+(\[^\n\r\]*\[\n\r\]+)+\[^\n\r\]*\"CurrentExecutor\[^\n\r\]+\[\n\r\]+(\[^\n\r\]*\[\n\r\]+)+(\[^\n\r\]*\[\n\r\]+)+\[^\n\r\]*end
 of children of DIE 0x\\3\[\n\r]+\[^\n\r\]*end of children of DIE 
0x\\1\[\n\r]+" } }


Re: [committed] Fix gnat.dg/lto15.adb on hppa

2012-09-16 Thread Eric Botcazou
> Tested on hppa2.0w-hp-hpux11.11 and committed to trunk.

Thanks for fixing this.  The testcase is also on the 4.7 branch.

-- 
Eric Botcazou


Re: [Patch, fortran] PR46897 - [OOP] type-bound defined ASSIGNMENT(=) not used for derived type component in intrinsic assign

2012-09-16 Thread Tobias Burnus

Am 10.09.2012 20:58, schrieb Paul Richard Thomas:

Bootstrapped and regtested on FC9/x86_64 - OK for trunk?


The following test case doesn't work; it should print "Overloaded" - and 
does so with crayftn. But with your patch, it doesn't.


Tobias

module a_mod
  type :: a
   contains
 procedure :: a_ass
 generic :: assignment(=) => a_ass
  end type a

  type c
type(a) :: ta
  end type c

  type :: b
type(c) :: tc
  end type b

contains
  impure elemental subroutine a_ass(out, in)
class(a), intent(out) :: out
type(a), intent(in)  :: in
print *, "Overloaded"
  end subroutine a_ass
end module a_mod

program assign
  use a_mod
  type(b) :: tt
  type(b) :: tb1
  tt = tb1
end program assign


+ build_assignment (gfc_exec_op op, gfc_expr *expr1, gfc_expr *expr2, + 
gfc_component *comp1, gfc_component *comp2, locus loc)


For comp1/comp2, I am wondering whether one shouldn't add a
  gcc_assert ((comp1 && comp2) || (!comp1 && !comp2));


+ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)

Not that we make so much use of it, but its symbol could be a candidate 
for attr.artificial. (I don't know whether it should.)




Add Rice distribution to libstdc++

2012-09-16 Thread Ed Smith-Rowland
This adds the Rice distribution to the C++11  facility and a Gnu 
extension.


2012-09-14  Edward Smith-Rowland  <3dw...@verizon.net>

* include/ext/random: Add __gnu_cxx::rice_distribution<> class.
* include/ext/random.tcc: Add out-of-line functions for
__gnu_cxx::rice_distribution<>.
* testsuite/26_numerics/random/rice_distribution/
operators/equal.cc: New file.
* testsuite/26_numerics/random/rice_distribution/
operators/serialize.cc: New file.
* testsuite/26_numerics/random/rice_distribution/
operators/inequal.cc: New file.
* testsuite/26_numerics/random/rice_distribution/
cons/parms.cc: New file.
* testsuite/26_numerics/random/rice_distribution/
cons/default.cc: New file.
* testsuite/26_numerics/random/rice_distribution/
requirements/typedefs.cc: New file.
Index: include/ext/random
===
--- include/ext/random  (revision 191094)
+++ include/ext/random  (working copy)
@@ -532,16 +532,6 @@
{ this->__generate_impl(__f, __t, __urng, __p); }
 
   /**
-   * @brief Return true if two beta distributions have the same
-   *parameters and the sequences that would be generated
-   *are equal.
-   */
-  friend bool
-  operator==(const beta_distribution& __d1,
-const beta_distribution& __d2)
-  { return __d1.param() == __d2.param(); }
-
-  /**
* @brief Inserts a %beta_distribution random number distribution
* @p __x into the output stream @p __os.
*
@@ -582,13 +572,24 @@
 };
 
   /**
+   * @brief Return true if two beta distributions have the same
+   *parameters and the sequences that would be generated
+   *are equal.
+   */
+  template
+inline bool
+operator==(const __gnu_cxx::beta_distribution<_RealType>& __d1,
+  const __gnu_cxx::beta_distribution<_RealType>& __d2)
+{ return __d1.param() == __d2.param(); }
+
+  /**
* @brief Return true if two beta distributions are different.
*/
-   template
- inline bool
- operator!=(const __gnu_cxx::beta_distribution<_RealType>& __d1,
-   const __gnu_cxx::beta_distribution<_RealType>& __d2)
-{ return !(__d1 == __d2); }
+  template
+inline bool
+operator!=(const __gnu_cxx::beta_distribution<_RealType>& __d1,
+  const __gnu_cxx::beta_distribution<_RealType>& __d2)
+   { return !(__d1 == __d2); }
 
 
   /**
@@ -896,6 +897,249 @@
 { return !(__d1 == __d2); }
 
 
+  /**
+   * @brief A Rice continuous distribution for random numbers.
+   *
+   * The formula for the Rice probability density function is
+   * @f[
+   * p(x|\nu,\sigma) = \frac{x}{\sigma^2}
+   *   \exp\left(-\frac{x^2+\nu^2}{2\sigma^2}\right)
+   *   I_0\left(\frac{x \nu}{\sigma^2}\right)
+   * @f]
+   * where @f$I_0(z)@f$ is the modified Bessel function of the first kind
+   * of order 0 and @f$\nu >= 0@f$ and @f$\sigma > 0@f$.
+   *
+   * 
+   * Distribution Statistics
+   * Mean@f$\sqrt{\pi/2}L_{1/2}(-\nu^2/2\sigma^2)@f$
+   * Variance@f$2\sigma^2 + \nu^2
+   *   + 
(\pi\sigma^2/2)L^2_{1/2}(-\nu^2/2\sigma^2)@f$
+   * Range@f$[0, \infty)@f$
+   * 
+   * where @f$L_{1/2}(x)@f$ is the Laguerre polynomial of order 1/2.
+   */
+  template
+class
+rice_distribution
+{
+  static_assert(std::is_floating_point<_RealType>::value,
+   "template argument not a floating point type");
+public:
+  /** The type of the range of the distribution. */
+  typedef _RealType result_type;
+  /** Parameter type. */
+  struct param_type
+  {
+   typedef rice_distribution distribution_type;
+
+   param_type(result_type __nu = result_type(0),
+  result_type __sigma = result_type(1))
+   : _M_nu(__nu), _M_sigma(__sigma)
+   {
+ _GLIBCXX_DEBUG_ASSERT(_M_nu >= result_type(0));
+ _GLIBCXX_DEBUG_ASSERT(_M_sigma > result_type(0));
+   }
+
+   result_type
+   nu() const
+   { return _M_nu; }
+
+   result_type
+   sigma() const
+   { return _M_sigma; }
+
+   friend bool
+   operator==(const param_type& __p1, const param_type& __p2)
+   { return __p1._M_nu == __p2._M_nu
+  && __p1._M_sigma == __p2._M_sigma; }
+
+  private:
+   void _M_initialize();
+
+   result_type _M_nu;
+   result_type _M_sigma;
+  };
+
+  /**
+   * @brief Constructors.
+   */
+  explicit
+  rice_distribution(result_type __nu = result_type(0),
+   result_type __sigma = result_type(1))
+  : _M_param(__nu, __sigma),
+   _M_ndx(__nu, __sigma),
+   _M_ndy(result_type(0), __sigma)
+  { }
+
+  explicit
+  rice_distribution(const param_type& __p)
+  : _M_param(__p),
+   _M_ndx(__p.nu(), __p.sigma()),
+   _M

Re: [committed] Fix gnat.dg/lto15.adb on hppa

2012-09-16 Thread John David Anglin

On 16-Sep-12, at 1:27 PM, Eric Botcazou wrote:


Thanks for fixing this.  The testcase is also on the 4.7 branch.


I'm aware of that.  Will fix branch after the 4.7.2 release.

--
John David Anglin   dave.ang...@bell.net





Re: Add Rice distribution to libstdc++

2012-09-16 Thread Marc Glisse

On Sun, 16 Sep 2012, Ed Smith-Rowland wrote:

This adds the Rice distribution to the C++11  facility and a Gnu 
extension.


Hello,

libstdc++ not in copy?

The change to beta_distribution is not mentioned in the ChangeLog.

You don't appear to have a test like those added for PR 54376, and like 
Ulrich I find the operator== suspicious.


--
Marc Glisse


Re: [Patch, Fortran] PR 54387: [F03] Wrongly accepts non-proc result variable on the RHS of a proc-pointer assignment

2012-09-16 Thread Janus Weil
Hi,

>> here is a small patch which fixes an accepts-invalid problem with
>> proc-pointer assignments. Regtested on x86_64-unknown-linux-gnu. Ok
>> for trunk?
>
>
> OK. Thanks for the patch.
>
> (Though, I am wondering whether the error message could be improved. We know
> that the RHS is not the procedure but the result variable; it might help the
> user if the message is a bit clearer. But you can also keep the current
> version.)

thanks for the review. Committed as r191364 (with a slight rewording
of the error message).

Cheers,
Janus




>> 2012-09-15  Janus Weil  
>>
>> PR fortran/54387
>> * expr.c (gfc_check_pointer_assign): Check for result of embracing
>> function.
>>
>> 2012-09-15  Janus Weil  
>>
>> PR fortran/54387
>> * gfortran.dg/proc_ptr_38.f90: New.
>
>


Re: [Patch, Fortran, OOP] PR 54594: Type-bound ASSIGNMENTs (elemental + array version) rejected as ambiguous

2012-09-16 Thread Janus Weil
>> here is an OOP patch for type-bound generics. The problem was that
>> specifics with polymorphic arguments of different ranks were wrongly
>> rejected as ambiguous, because 'gfc_compare_types' did not properly
>> handle CLASS arrays. The patch fixes this is regtests cleanly on
>> x86_64-unknown-linux-gnu. Ok for trunk?
>
>
> OK. Looks rather obvious to me. Thanks for fixing it quickly.

Thanks. Committed as r191365.

Cheers,
Janus


Re: GCC 4.7.2 Status Report (2012-09-14), branch frozen

2012-09-16 Thread Jack Howarth
On Fri, Sep 14, 2012 at 05:05:05PM +0200, Jakub Jelinek wrote:
> The GCC 4.7 branch is now frozen for creating a first release candidate
> of the GCC 4.7.2 release.
> 
> All changes need explicit release manager approval until the final
> release of GCC 4.7.2 which should happen roughly one week after
> the release candidate if no issues show up with it.

   The backport of changes required to adjust FSF gcc to crt changes made
in Mountain Lion...

http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01181.html

were approved by the darwin maintainer...

http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01265.html

but never commited to the gcc-4_7-branch. Can we still get these into the gcc
4.7.2 release?
Thanks in advance.
Jack

> 
> 
> 
> Previous Report
> ===
> 
> http://gcc.gnu.org/ml/gcc/2012-06/msg00195.html


Re: Add Rice distribution to libstdc++

2012-09-16 Thread Paolo Carlini
Hi

>This adds the Rice distribution to the C++11  facility and a
>Gnu extension.

Thanks. I realize now that the features we have been adding to 
include/ext/random should be tested in testsuite/ext/random. If nobody beats me 
one of these days I will take care of the move.

Paolo




Re: Add Rice distribution to libstdc++

2012-09-16 Thread Paolo Carlini

On 09/16/2012 10:02 PM, Marc Glisse wrote:

On Sun, 16 Sep 2012, Ed Smith-Rowland wrote:

This adds the Rice distribution to the C++11  facility and a 
Gnu extension.


Hello,

libstdc++ not in copy?

The change to beta_distribution is not mentioned in the ChangeLog.

You don't appear to have a test like those added for PR 54376, and 
like Ulrich I find the operator== suspicious.
Indeed, please fix that, I thought it was clear by now: no inline 
template friends.


Thanks,
Paolo.


Re: Add Rice distribution to libstdc++

2012-09-16 Thread Ed Smith-Rowland

On 09/16/2012 06:29 PM, Paolo Carlini wrote:

On 09/16/2012 11:18 PM, Paolo Carlini wrote:

On 09/16/2012 10:02 PM, Marc Glisse wrote:

On Sun, 16 Sep 2012, Ed Smith-Rowland wrote:

This adds the Rice distribution to the C++11  facility and 
a Gnu extension.


Hello,

libstdc++ not in copy?

The change to beta_distribution is not mentioned in the ChangeLog.

You don't appear to have a test like those added for PR 54376, and 
like Ulrich I find the operator== suspicious.
Indeed, please fix that, I thought it was clear by now: no inline 
template friends.

I went ahead and fixed both the issues.

Thanks,
Paolo.

/

Thanks,
I'll make sure my other distributions do not have these defects.
Ed



Fix small paste-o in rice_distribution.

2012-09-16 Thread Ed Smith-Rowland
I initialized an adapted urng that was not needed or used in the 
rice_distribution extension.


2012-09-16  Edward Smith-Rowland  <3dw...@verizon.net>

* include/ext/random.tcc (__gnu_cxx::rice_distribution<>
::__generate_impl): Remove bogus _Adaptor usage.

Index: include/ext/random.tcc
===
--- include/ext/random.tcc  (revision 191367)
+++ include/ext/random.tcc  (working copy)
@@ -762,9 +762,6 @@
   {
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>)
 
-   std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
- __aurng(__urng);
-
while (__f != __t)
  {
typename std::normal_distribution::param_type


Go patch committed: Detect invalid import statements

2012-09-16 Thread Ian Lance Taylor
This patch to the Go compiler checks for invalid import filenames,
including checks for cases that are technically valid but likely to be
wrong.  This corresponds to the tests done by the gc Go compiler.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.  Will commit to 4.7 branch when it is open again.

Ian


2012-09-16  Ian Lance Taylor  

* Make-lang.in (go/gogo.o): Depend on filenames.h.


diff -r 773bab2333b6 go/gogo.cc
--- a/go/gogo.cc	Mon Sep 10 21:59:01 2012 -0700
+++ b/go/gogo.cc	Sun Sep 16 22:05:25 2012 -0700
@@ -6,6 +6,8 @@
 
 #include "go-system.h"
 
+#include "filenames.h"
+
 #include "go-c.h"
 #include "go-dump.h"
 #include "lex.h"
@@ -385,6 +387,57 @@
 		 bool is_local_name_exported,
 		 Location location)
 {
+  if (filename.empty())
+{
+  error_at(location, "import path is empty");
+  return;
+}
+
+  const char *pf = filename.data();
+  const char *pend = pf + filename.length();
+  while (pf < pend)
+{
+  unsigned int c;
+  int adv = Lex::fetch_char(pf, &c);
+  if (adv == 0)
+	{
+	  error_at(location, "import path contains invalid UTF-8 sequence");
+	  return;
+	}
+  if (c == '\0')
+	{
+	  error_at(location, "import path contains NUL");
+	  return;
+	}
+  if (c < 0x20 || c == 0x7f)
+	{
+	  error_at(location, "import path contains control character");
+	  return;
+	}
+  if (c == '\\')
+	{
+	  error_at(location, "import path contains backslash; use slash");
+	  return;
+	}
+  if (Lex::is_unicode_space(c))
+	{
+	  error_at(location, "import path contains space character");
+	  return;
+	}
+  if (c < 0x7f && strchr("!\"#$%&'()*,:;<=>?[]^`{|}", c) != NULL)
+	{
+	  error_at(location, "import path contains invalid character '%c'", c);
+	  return;
+	}
+  pf += adv;
+}
+
+  if (IS_ABSOLUTE_PATH(filename.c_str()))
+{
+  error_at(location, "import path cannot be absolute path");
+  return;
+}
+
   if (filename == "unsafe")
 {
   this->import_unsafe(local_name, is_local_name_exported, location);
diff -r 773bab2333b6 go/lex.cc
--- a/go/lex.cc	Mon Sep 10 21:59:01 2012 -0700
+++ b/go/lex.cc	Sun Sep 16 22:05:25 2012 -0700
@@ -1705,6 +1705,27 @@
   unsigned int stride;
 };
 
+// A table of whitespace characters--Unicode code points classified as
+// "Space", "C" locale whitespace characters, the "next line" control
+// character (0085), the line separator (2028), the paragraph
+// separator (2029), and the "zero-width non-break space" (feff).
+
+static const Unicode_range unicode_space[] =
+{
+  { 0x0009, 0x000d, 1 },
+  { 0x0020, 0x0020, 1 },
+  { 0x0085, 0x0085, 1 },
+  { 0x00a0, 0x00a0, 1 },
+  { 0x1680, 0x1680, 1 },
+  { 0x180e, 0x180e, 1 },
+  { 0x2000, 0x200a, 1 },
+  { 0x2028, 0x2029, 1 },
+  { 0x202f, 0x202f, 1 },
+  { 0x205f, 0x205f, 1 },
+  { 0x3000, 0x3000, 1 },
+  { 0xfeff, 0xfeff, 1 },
+};
+
 // A table of Unicode digits--Unicode code points classified as
 // "Digit".
 
@@ -2294,6 +2315,15 @@
 }
 }
 
+// Return whether C is a space character.
+
+bool
+Lex::is_unicode_space(unsigned int c)
+{
+  return Lex::is_in_unicode_range(c, unicode_space,
+  ARRAY_SIZE(unicode_space));
+}
+
 // Return whether C is a Unicode digit--a Unicode code point
 // classified as "Digit".
 
diff -r 773bab2333b6 go/lex.h
--- a/go/lex.h	Mon Sep 10 21:59:01 2012 -0700
+++ b/go/lex.h	Sun Sep 16 22:05:25 2012 -0700
@@ -375,6 +375,10 @@
   static int
   fetch_char(const char* str, unsigned int *value);
 
+  // Return whether C is a Unicode or "C" locale space character.
+  static bool
+  is_unicode_space(unsigned int c);
+
  private:
   ssize_t
   get_line();
diff -r 773bab2333b6 go/parse.cc
--- a/go/parse.cc	Mon Sep 10 21:59:01 2012 -0700
+++ b/go/parse.cc	Sun Sep 16 22:05:25 2012 -0700
@@ -5337,7 +5337,8 @@
 
   if (!token->is_string())
 {
-  error_at(this->location(), "missing import package name");
+  error_at(this->location(), "import statement not a string");
+  this->advance_token();
   return;
 }
 
Index: gcc/go/Make-lang.in
===
--- gcc/go/Make-lang.in	(revision 191279)
+++ gcc/go/Make-lang.in	(working copy)
@@ -289,10 +289,11 @@ go/gogo-tree.o: go/gofrontend/gogo-tree.
 	convert.h output.h $(DIAGNOSTIC_H) $(GO_TYPES_H) \
 	$(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_RUNTIME_H) \
 	go/gofrontend/backend.h $(GO_GOGO_H)
-go/gogo.o: go/gofrontend/gogo.cc $(GO_SYSTEM_H) $(GO_C_H) \
-	go/gofrontend/go-dump.h $(GO_LEX_H) $(GO_TYPES_H) $(GO_STATEMENTS_H) \
-	$(GO_EXPRESSIONS_H) go/gofrontend/dataflow.h $(GO_RUNTIME_H) \
-	$(GO_IMPORT_H) $(GO_EXPORT_H) go/gofrontend/backend.h $(GO_GOGO_H)
+go/gogo.o: go/gofrontend/gogo.cc $(GO_SYSTEM_H) \
+	$(srcdir)/../include/filenames.h $(GO_C_H) go/gofrontend/go-dump.h \
+	$(GO_LEX_H) $(GO_TYPES_H) $(GO_STATEMENTS_H) $(GO_EXPRESSIONS_H) \
+	go/gofrontend/dataflow.h $(GO_RUNTIME_H) $(GO_IMPORT_H) \
+	$(GO_EXPORT_H) go/gofrontend/backend.h $(GO_GOGO_H)
 go/impo