Re: [patch, Fortran] Fix PR 55593

2012-12-09 Thread Thomas Koenig

Hi Janus,


2012/12/8 Thomas Koenig :



Because undeclared is not declared, the resolution doesn't happen,
and resolved_sym is NULL.  This is OK because an error has been
raised about this anyway;


good, if it only happens when an error has been raised, I think your
patch is ok.


Committed as revision 194329.

Thanks for the review!

Thomas




Re: [PATCH i386]: Enable push/pop in pro/epilogue for modern CPUs

2012-12-09 Thread Uros Bizjak
Hello!

> I noticed in prologue/epilogue, GCC prefers to use MOVs followed by a
> SP adjustment instead of a sequence of pushes/pops. The preference to
> the MOVs are good for old CPU micro-architectures (before pentium-4,
> K10), because it breaks the data dependency.  In modern
> micro-architecture, push/pop is implemented using a mechanism called
> stack engine. The data dependency is removed by the hardware, and
> push/pop becomes very cheap (1 uOp, 1 cycle latency), and they are
> smaller. There is no longer the need to avoid using them.   This is
> also what ICC does.

> 2012-12-08  Xinliang David Li  
>* config/i386/i386.c: Eanble push/pop in pro/epilogue for moderen 
> CPUs.

s/moderen/modern

OK for mainline SVN.

Thanks,
Uros.


Fix scan-assembler in libstdc++ testsuite

2012-12-09 Thread Andreas Schwab
testname-for-summary in gcc/testsuite/lib/target-supports-dg.exp caches
testname_with_flags and depends on dg-test to reset it after each test
source file.  The wrapper in the libstdc++ didn't do that, causing
dg-scan-assembler to look at the wrong file.  Installed as obvious.

Andreas.

* testsuite/lib/libstdc++.exp (dg-test): Unset testname_with_flags
after running the test.

diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index b3be88f..10b9738 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -389,15 +389,22 @@ if { [info procs saved-dg-test] == [list] } {
 proc dg-test { args } {
global additional_prunes
global errorInfo
+   global testname_with_flags
 
if { [ catch { eval saved-dg-test $args } errmsg ] } {
set saved_info $errorInfo
set additional_prunes ""
+   if [info exists testname_with_flags] {
+   unset testname_with_flags
+   }
unset_timeout_vars
error $errmsg $saved_info
}
set additional_prunes ""
unset_timeout_vars
+   if [info exists testname_with_flags] {
+   unset testname_with_flags
+   }
 }
 }
 
-- 
1.8.0.1

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [Patch, Fortran] PR55343 - Fix ICE with renaming of symbols of intrinsic modules

2012-12-09 Thread Tobias Burnus

Janus Weil wrote:
Sorry, I don't get it. Wrong PR number? It sounds related, but the 
test case is very different from the one in the PR ...?!?


Sorry, I copied the PR number from the wrong PR. (I had opened the other 
PR because they are similar.)


The patch is for PR 55197, only.

Tobias


Re: [patch stmt.c]: 6 of 7 Fix of PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32

2012-12-09 Thread NightStrike
On Sat, Dec 1, 2012 at 11:13 PM, Kai Tietz  wrote:
> Ping
>
> 2012/11/29 Kai Tietz :
>> Hello,
>>
>> this trivial patch fixes a bootstrap issue on LLP64 hosts.
>>
>> ChangeLog
>>
>> 2012-11-29 Kai Tietz
>>
>> PR target/53912
>> * stmt.c (compute_cases_per_edge): Cast from pointer via intptr_t.
>> (expand_case): Likewise.
>>
>> Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
>> x86_64-unknown-gnu-linux. Ok for apply?
>>
>> Regards,
>> Kai
>>
>> Index: stmt.c
>> ===
>> --- stmt.c  (Revision 193925)
>> +++ stmt.c  (Arbeitskopie)
>> @@ -2061,7 +2061,7 @@ compute_cases_per_edge (gimple stmt)
>>tree lab = CASE_LABEL (elt);
>>basic_block case_bb = label_to_block_fn (cfun, lab);
>>edge case_edge = find_edge (bb, case_bb);
>> -  case_edge->aux = (void *)((long)(case_edge->aux) + 1);
>> +  case_edge->aux = (void *)((intptr_t)(case_edge->aux) + 1);
>>  }
>>  }
>>
>> @@ -2176,7 +2176,7 @@ expand_case (gimple stmt)
>>edge case_edge = find_edge (bb, case_bb);
>>case_list = add_case_node (
>>case_list, low, high, lab,
>> -  case_edge->probability / (long)(case_edge->aux),
>> +  case_edge->probability / (intptr_t)(case_edge->aux),
>>case_node_pool);
>>  }
>>pointer_set_destroy (seen_labels);

Ping x2


Re: [patch stmt.c]: Fix SjLj exception handling

2012-12-09 Thread NightStrike
On Sat, Dec 1, 2012 at 12:28 PM, Steven Bosscher  wrote:
> On Sat, Dec 1, 2012 at 10:59 PM, Kai Tietz wrote:
>> Hi,
>>
>> recent 4,8 has regressions in g++.old-deja/g++.eh for the catch*.C
>> tests, if exception-mechanism is SjLj.  This is due an off by one
>> failure in an decreasing loop.
>>
>> ChangeLog
>>
>> 2012-12-01  Kai Tietz
>>
>> * stmt.c (expand_sjlj_dispatch_table): Fix off by one.
>>
>> Tested for i686-w64-mingw32, x86_64-unknown-linux-gnu.  Ok for apply?
>>
>> Regards,
>> Kai
>>
>>
>> Index: stmt.c
>> ===
>> --- stmt.c  (Revision 193985)
>> +++ stmt.c  (Arbeitskopie)
>> @@ -2282,7 +2282,7 @@ expand_sjlj_dispatch_table (rtx dispatch_index,
>>tree range = maxval;
>>rtx default_label = gen_label_rtx ();
>>
>> -  for (int i = ncases - 1; i > 0; --i)
>> +  for (int i = ncases - 1; i >= 0; --i)
>> {
>>   tree elt = dispatch_table[i];
>>   tree low = CASE_LOW (elt);
>
>
> I can't approve this, but it's obvious. The "normal" switch expander
> (expand_case) expects the default case in slot 0, but the SJLJ
> dispatch table doesn't have a default case.
>
> Ciao!
> Steven

Ping.


Re: [patch print-tree.c]: 5 of 7 Fix of PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32

2012-12-09 Thread NightStrike
On Sat, Dec 1, 2012 at 11:12 PM, Kai Tietz  wrote:
> Ping
>
> 2012/11/29 Kai Tietz :
>> Hello,
>>
>> this trivial patch fixes a bootstrap issue on LLP64 hosts.
>>
>> ChangeLog
>>
>> 2012-11-29 Kai Tietz
>>
>> PR target/53912
>> * print-tree.c (print_node): Cast from pointer via uintptr_t.
>>
>> Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
>> x86_64-unknown-gnu-linux. Ok for apply?
>>
>> Regards,
>> Kai
>>
>> Index: print-tree.c
>> ===
>> --- print-tree.c(Revision 193925)
>> +++ print-tree.c(Arbeitskopie)
>> @@ -255,7 +255,7 @@ print_node (FILE *file, const char *prefix, tree n
>>/* Allow this function to be called if the table is not there.  */
>>if (table)
>>  {
>> -  hash = ((unsigned long) node) % HASH_SIZE;
>> +  hash = ((uintptr_t) node) % HASH_SIZE;
>>
>>/* If node is in the table, just mention its address.  */
>>for (b = table[hash]; b; b = b->next)

Ping.


Re: [PATCH i386]: Enable push/pop in pro/epilogue for modern CPUs

2012-12-09 Thread Дмитрий Дьяченко
s/Eanble/Enable/


Thanks,
Dmitry

2012/12/9 Uros Bizjak :
> Hello!
>
>> I noticed in prologue/epilogue, GCC prefers to use MOVs followed by a
>> SP adjustment instead of a sequence of pushes/pops. The preference to
>> the MOVs are good for old CPU micro-architectures (before pentium-4,
>> K10), because it breaks the data dependency.  In modern
>> micro-architecture, push/pop is implemented using a mechanism called
>> stack engine. The data dependency is removed by the hardware, and
>> push/pop becomes very cheap (1 uOp, 1 cycle latency), and they are
>> smaller. There is no longer the need to avoid using them.   This is
>> also what ICC does.
>
>> 2012-12-08  Xinliang David Li  
>>* config/i386/i386.c: Eanble push/pop in pro/epilogue for moderen 
>> CPUs.
>
> s/moderen/modern
>
> OK for mainline SVN.
>
> Thanks,
> Uros.


[committed] Defined MAP_FAILED in gcc.dg/20050826-1.c and gcc.dg/20050826-1.c if not defined

2012-12-09 Thread John David Anglin
This fixes gcc.dg/20030711-1.c and gcc.dg/20050826-1.c on HP-UX 10.

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-12-09  John David Anglin  

* gcc.dg/20030711-1.c: Define MAP_FAILED if not defined.
* gcc.dg/20050826-1.c: Likewise.

Index: gcc.dg/20030711-1.c
===
--- gcc.dg/20030711-1.c (revision 194272)
+++ gcc.dg/20030711-1.c (working copy)
@@ -11,6 +11,9 @@
 #ifndef MAP_ANON
 #define MAP_ANON 0
 #endif
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
 #include 
 
 void __attribute__((noinline)) test (const char *p)
Index: gcc.dg/20050826-1.c
===
--- gcc.dg/20050826-1.c (revision 194272)
+++ gcc.dg/20050826-1.c (working copy)
@@ -12,6 +12,9 @@
 #ifndef MAP_ANON
 #define MAP_ANON 0
 #endif
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
 #include 
 
 struct Flags {


[PATCH, alpha]: Fix PR55344, Cross compiling for alpha-linux fails because doesn't exist

2012-12-09 Thread Uros Bizjak
Hello!

2012-12-09  Uros Bizjak  

* config/alpha/linux-unwind.h: Disable when inhibit_libc is defined.

Bootstrapped and regression tested on alphaev68-pc-linux-gnu,
committed to mainline and 4.7.

Uros.
Index: config/alpha/linux-unwind.h
===
--- config/alpha/linux-unwind.h (revision 194329)
+++ config/alpha/linux-unwind.h (working copy)
@@ -22,6 +22,7 @@
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 .  */
 
+#ifndef inhibit_libc
 /* Do code reading to identify a signal frame, and set the frame
state data appropriately.  See unwind-dw2.c for the structs.  */
 
@@ -97,3 +98,4 @@
  || pc[1] == 0x201f015f))  /* lda $0,NR_rt_sigreturn */
 _Unwind_SetSignalFrame (context, 1);
 }
+#endif


[committed] Fix gcc.dg/torture/pr47917.c on *-*-hpux10*

2012-12-09 Thread John David Anglin
This fixes fail on *-*-hpux10*.  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-12-09  John David Anglin  

* gcc.dg/torture/pr47917.c: Change "dg-xfail-if" to "dg-xfail-run-if"
for *-*-hpux10*.

Index: gcc.dg/torture/pr47917.c
===
--- gcc.dg/torture/pr47917.c(revision 194055)
+++ gcc.dg/torture/pr47917.c(working copy)
@@ -3,7 +3,7 @@
 /* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target *-*-solaris2.9 } } */
 /* { dg-options "-std=gnu99" { target *-*-hpux* } } */
 /* { dg-additional-options "-D__USE_MINGW_ANSI_STDIO=1" { target *-*-mingw* } 
} */
-/* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
+/* { dg-xfail-run-if "no C99 snprintf function" { *-*-hpux10* } } */
 /* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */
 
 /* PR middle-end/47917 */


[committed] xfail hooray4 test in gcc.dg/ipa/iinline-4.c on 32-bit hppa

2012-12-09 Thread John David Anglin
Discussion is in PR.  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-12-09  John David Anglin  

PR middle-end/54470
* gcc.dg/ipa/iinline-4.c: xfail hooray4 test on 32-bit hppa*-*-*.

Index: gcc.dg/ipa/iinline-4.c
===
--- gcc.dg/ipa/iinline-4.c  (revision 194325)
+++ gcc.dg/ipa/iinline-4.c  (working copy)
@@ -214,7 +214,7 @@
 /* { dg-final { scan-ipa-dump "hooray1\[^\\n\]*inline copy in test1"  "inline" 
 } } */
 /* { dg-final { scan-ipa-dump "hooray2\[^\\n\]*inline copy in test2"  "inline" 
 } } */
 /* { dg-final { scan-ipa-dump "hooray3\[^\\n\]*inline copy in test3"  "inline" 
 } } */
-/* { dg-final { scan-ipa-dump "hooray4\[^\\n\]*inline copy in test4"  "inline" 
 } } */
+/* { dg-final { scan-ipa-dump "hooray4\[^\\n\]*inline copy in test4"  "inline" 
 { xfail { { hppa*-*-* } && { ! lp64 } } } } } */
 /* { dg-final { scan-ipa-dump "hooray5\[^\\n\]*inline copy in test5"  "inline" 
 } } */
 /* { dg-final { scan-ipa-dump "hooray6\[^\\n\]*inline copy in test6"  "inline" 
 } } */
 /* { dg-final { scan-ipa-dump "hooray7\[^\\n\]*inline copy in test7"  "inline" 
 } } */


[committed] Fix gcc.misc-tests/gcov-12.c test on hpux10

2012-12-09 Thread John David Anglin
The dg order is wrong.  As a result, dg-require-weak is ignored and
test fails on hpux10 which doesn't have weak.

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-12-09  John David Anglin  

* gcc.misc-tests/gcov-12.c: Fix dg order.

Index: gcc.misc-tests/gcov-12.c
===
--- gcc.misc-tests/gcov-12.c(revision 194055)
+++ gcc.misc-tests/gcov-12.c(working copy)
@@ -1,8 +1,8 @@
 /* Test gcov weak ellision.  */
 
+/* { dg-do run { target native } } */
+/* { dg-require-weak "" } */
 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
-/* { dg-require-weak "" } */
-/* { dg-do run { target native } } */
 
 int __attribute__ ((weak)) weak ()
 {


[PATCH, libbacktrace] Fix build on hpux10

2012-12-09 Thread John David Anglin
HP-UX 10 doesn't define MAP_FAILED.  Patch fixes build.  Tested on
hppa1.1-hp-hpux10.20 and hppa2.0w-hp-hpux11.11.

OK for trunk?

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

2012-12-09  John David Anglin  

* mmapio.c: Define MAP_FAILED if not defined.

Index: mmapio.c
===
--- mmapio.c(revision 194272)
+++ mmapio.c(working copy)
@@ -40,6 +40,10 @@
 #include "backtrace.h"
 #include "internal.h"
 
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
 /* This file implements file views and memory allocation when mmap is
available.  */
 


[Patch,Fortran] reset dynamic type with MOVE_ALLOC (was: Re: [Patch, Fortran] Small patch for calls to gfc_deallocate_scalar_with_status)

2012-12-09 Thread Tobias Burnus

Janus Weil wrote:

>The expr to al->expr change is to pass a BT_CLASS instead of a
>BT_DERIVED. And the NULL to gfc_lval_expr_from_sym change allows to access
>var->_vtab->_final for a BT_CLASS deferred variable.

It seems that both of them will not have any effect right now, but are
useful only as preparation for FINAL, right?


I think that's true. I wanted to claim that it also fixes the following, 
but it doesn't:


 class(t), allocatable :: a, b, c
 allocate (t2 :: a)
 call move_alloc (from=a, to=b)

"a" should not only be deallocated but same_type_as(a,c) should be true, 
i.e. one has to reset the "a->_vtab" pointer to the declared type.


A follow-up patch which fixes this is attached.

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

Tobias
2012-12-09  Tobias Burnus  

	* trans-intrinsic.c (conv_intrinsic_move_alloc): Set dynamic
	type of the FROM variable to the declared type.

2012-12-09  Tobias Burnus  

	* gfortran.dg/move_alloc_14.f90: New.

diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 504a9f3..4f74c3f 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -7338,6 +7338,8 @@ conv_intrinsic_move_alloc (gfc_code *code)
   /* Set _vptr.  */
   if (to_expr->ts.type == BT_CLASS)
 	{
+	  gfc_symbol *vtab;
+
 	  gfc_free_expr (to_expr2);
 	  gfc_init_se (&to_se, NULL);
 	  to_se.want_pointer = 1;
@@ -7346,23 +7348,31 @@ conv_intrinsic_move_alloc (gfc_code *code)
 
 	  if (from_expr->ts.type == BT_CLASS)
 	{
+	  vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
+	  gcc_assert (vtab);
+
 	  gfc_free_expr (from_expr2);
 	  gfc_init_se (&from_se, NULL);
 	  from_se.want_pointer = 1;
 	  gfc_add_vptr_component (from_expr);
 	  gfc_conv_expr (&from_se, from_expr);
-	  tmp = from_se.expr;
+	  gfc_add_modify_loc (input_location, &block, to_se.expr,
+  fold_convert (TREE_TYPE (to_se.expr),
+  from_se.expr));
+
+  /* Reset _vptr component to declared type.  */
+	  tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
+	  gfc_add_modify_loc (input_location, &block, from_se.expr,
+  fold_convert (TREE_TYPE (from_se.expr), tmp));
 	}
 	  else
 	{
-	  gfc_symbol *vtab;
 	  vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
 	  gcc_assert (vtab);
 	  tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
+	  gfc_add_modify_loc (input_location, &block, to_se.expr,
+  fold_convert (TREE_TYPE (to_se.expr), tmp));
 	}
-
-	  gfc_add_modify_loc (input_location, &block, to_se.expr,
-			  fold_convert (TREE_TYPE (to_se.expr), tmp));
 	}
 
   return gfc_finish_block (&block);
@@ -7371,6 +7381,8 @@ conv_intrinsic_move_alloc (gfc_code *code)
   /* Update _vptr component.  */
   if (to_expr->ts.type == BT_CLASS)
 {
+  gfc_symbol *vtab;
+
   to_se.want_pointer = 1;
   to_expr2 = gfc_copy_expr (to_expr);
   gfc_add_vptr_component (to_expr2);
@@ -7378,22 +7390,31 @@ conv_intrinsic_move_alloc (gfc_code *code)
 
   if (from_expr->ts.type == BT_CLASS)
 	{
+	  vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
+	  gcc_assert (vtab);
+
 	  from_se.want_pointer = 1;
 	  from_expr2 = gfc_copy_expr (from_expr);
 	  gfc_add_vptr_component (from_expr2);
 	  gfc_conv_expr (&from_se, from_expr2);
-	  tmp = from_se.expr;
+	  gfc_add_modify_loc (input_location, &block, to_se.expr,
+			  fold_convert (TREE_TYPE (to_se.expr),
+			  from_se.expr));
+
+	  /* Reset _vptr component to declared type.  */
+	  tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
+	  gfc_add_modify_loc (input_location, &block, from_se.expr,
+			  fold_convert (TREE_TYPE (from_se.expr), tmp));
 	}
   else
 	{
-	  gfc_symbol *vtab;
 	  vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
 	  gcc_assert (vtab);
 	  tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
+	  gfc_add_modify_loc (input_location, &block, to_se.expr,
+			  fold_convert (TREE_TYPE (to_se.expr), tmp));
 	}
 
-  gfc_add_modify_loc (input_location, &block, to_se.expr,
-			  fold_convert (TREE_TYPE (to_se.expr), tmp));
   gfc_free_expr (to_expr2);
   gfc_init_se (&to_se, NULL);
 
@@ -7449,7 +7470,7 @@ conv_intrinsic_move_alloc (gfc_code *code)
   /* Move the pointer and update the array descriptor data.  */
   gfc_add_modify_loc (input_location, &block, to_se.expr, from_se.expr);
 
-  /* Set "to" to NULL.  */
+  /* Set "from" to NULL.  */
   tmp = gfc_conv_descriptor_data_get (from_se.expr);
   gfc_add_modify_loc (input_location, &block, tmp,
 		  fold_convert (TREE_TYPE (tmp), null_pointer_node));
diff --git a/gcc/testsuite/gfortran.dg/move_alloc_14.f90 b/gcc/testsuite/gfortran.dg/move_alloc_14.f90
new file mode 100644
index 000..bc5e491
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/move_alloc_14.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+!
+! Ensure that move_alloc for CLASS 

[PATCH, libbacktrace] Don't call __sync_lock_test_and_set if we don't have sync functions

2012-12-09 Thread John David Anglin
On hppa*-*-hpux*, we don't have sync functions.  However,
__sync_lock_test_and_set is called in backtrace_alloc and
backtrace_free.  This causes an abort before ICE proccessing
is fully complete.

hppa64 is an ELF target and backtraces are nominally supported.

The attached change avoids calling __sync_lock_test_and_set
if we don't have sync functions.  As a result, the memory is
leaked.

This fixes the btest failure.

OK for trunk?

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

2012-12-09  John David Anglin  

* mmap.c: Define HAVE_SYNC_FUNCTIONS if not defined.
(backtrace_alloc): Don't call __sync_lock_test_and_set if we don't
have sync functions.
(backtrace_free): Likewise.

Index: mmap.c
===
--- mmap.c  (revision 194055)
+++ mmap.c  (working copy)
@@ -49,6 +49,10 @@
 #define MAP_ANONYMOUS MAP_ANON
 #endif
 
+#ifndef HAVE_SYNC_FUNCTIONS
+#define HAVE_SYNC_FUNCTIONS 0
+#endif
+
 /* A list of free memory blocks.  */
 
 struct backtrace_freelist_struct
@@ -96,7 +100,7 @@
  using mmap.  __sync_lock_test_and_set returns the old state of
  the lock, so we have acquired it if it returns 0.  */
 
-  if (!__sync_lock_test_and_set (&state->lock_alloc, 1))
+  if (HAVE_SYNC_FUNCTIONS && !__sync_lock_test_and_set (&state->lock_alloc, 1))
 {
   for (pp = &state->freelist; *pp != NULL; pp = &(*pp)->next)
{
@@ -158,7 +162,7 @@
  If we can't acquire the lock, just leak the memory.
  __sync_lock_test_and_set returns the old state of the lock, so we
  have acquired it if it returns 0.  */
-  if (!__sync_lock_test_and_set (&state->lock_alloc, 1))
+  if (HAVE_SYNC_FUNCTIONS && !__sync_lock_test_and_set (&state->lock_alloc, 1))
 {
   backtrace_free_locked (state, addr, size);
 


[PATCH, libbacktrace] Find executable on ia64 and 64-bit hppa hpux

2012-12-09 Thread John David Anglin
The getexecname function is not availble on HP-UX.  This patch provides
an alternative techique to obtain the executable path on HP-UX ELF targets.
These have the dlget and dlgetname calls.  I believe that this requires
the dld.sl library be linked with the application which is the normal
case.

With this change and the other libbacktrace fixes that I previously
posted, libbacktrace now works on hppa64-hp-hpux11.11.  Don't have
an ia64 system, so I can't test there.

There is an alternative technique available using the pstat interface
in HP-UX 11.11 and later.  It's also possible to use the pstat interface
and a file system walk on earlier HP-UX versions.  However, this is
painfully slow on large file systems.  It would probably be better to
use argv[0] and some additional checks.

32-bit hppa*-*-hpux* uses the SOM object format.  Don't know how
hard it would be to port libbacktrace to it.  As a result,
BACKTRACE_SUPPORTED is 0.  However, libbacktrace is still called
and fails in finding the executable.  For example,

/test/gnu/gcc/gcc/gcc/testsuite/g++.dg/pr48660.C:16:18: internal compiler error:
 in simplify_subreg, at simplify-rtx.c:5682
 libbacktrace could not find executable to open
 Please submit a full bug report,with preprocessed source if appropriate.

Not sure what would happen if libbacktrace found the executable.

OK for trunk?

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

2012-12-09  John David Anglin  

* fileline.c (getexecname): Define to getexecname_hpux on ia64 and
64-bit hppa hpux.
(getexecname_hpux): New.

Index: fileline.c
===
--- fileline.c  (revision 194325)
+++ fileline.c  (working copy)
@@ -42,8 +42,23 @@
 #include "internal.h"
 
 #ifndef HAVE_GETEXECNAME
+#if defined(__hpux) && (defined(__ia64) || defined(_LP64))
+#include 
+#define getexecname getexecname_hpux
+
+static char *
+getexecname_hpux (void)
+{
+  struct load_module_desc desc;
+
+  dlget(-2, &desc, sizeof(desc));
+  return dlgetname(&desc, sizeof(desc), NULL, 0, 0);
+}
+
+#else
 #define getexecname() NULL
 #endif
+#endif
 
 /* Initialize the fileline information from the executable.  Returns 1
on success, 0 on failure.  */


Re: [Fortran, (RFC) patch] PR49110/51055 Assignment to alloc. deferred-length character vars

2012-12-09 Thread David Edelsohn
There has been no progress on this bug for over two months.  I have
opened PR fortran/55636.  This must be fixed before GCC 4.8 ships.

Thanks, David

On Thu, Oct 4, 2012 at 5:04 PM, Janus Weil  wrote:
> Hi all,
>
 Btw, note that we are using a double underscore scheme in other places
 (like __class, __vtab, __vtype, etc). I have even used an '@' in one
 place, namely (hidden) procedure pointer results ("ppr@"). Is there a
 need to unify all those cases?
>>>
>>>
>>> It think it would be useful to unify those. Are you volunteering?
>>
>> yeah, why not ;)
>>
>> Attached is a draft patch (not regtested), which adds a macro
>> GFC_PREFIX (in gfortran.h) to prepend "_F" to the cases included in
>> Tobias' earlier patch as well as the OOP-related stuff and procedure
>> pointer results. It also bumps the module version.
>>
>> Any comments so far? (Of course the name of the macro can be debated.
>> I just tried to keep it short for now.)
>
> unfortunately my previous patch regressed on the proc_ptr_result test
> cases (due to problems with implicit typing of symbols with leading
> underscores, which also were the reason for using a suffix instead of
> a prefix for proc-ptr results in the first place). So I have taken out
> the 'ppr' parts, leaving only Tobias' original cases and the OOP
> stuff, which at least should be regression-free now.
>
> There are some more double-underscore cases which one could also
> change into the new _F convention. Should I keep going in this
> direction, or should we rather restrict this to the "leading dot"
> cases for now? I guess this is a question of how much ABI breaking we
> are willing to take. Opinions?
>
> Cheers,
> Janus


Re: [Fortran, (RFC) patch] PR49110/51055 Assignment to alloc. deferred-length character vars

2012-12-09 Thread Steve Kargl
On Sun, Dec 09, 2012 at 07:48:44PM -0500, David Edelsohn wrote:
> There has been no progress on this bug for over two months.  I have
> opened PR fortran/55636.  This must be fixed before GCC 4.8 ships.
> 

Somethings are hard to fix.  They are especially hard to
fix when one relies on volunteers, who are doing the 
best that they can with the limited amount of time 
that they have.

PS: You forgot to attach your patch that fixes this problem.

-- 
Steve


[patch] libgcc unwind-arm.h: mark arguments as unused

2012-12-09 Thread Matthias Klose
This was seen and fixed on trunk building libbacktrace on arm:
http://gcc.gnu.org/ml/gcc-patches/2012-10/msg00628.html

I see this now cross building libgo targeting arm on the 4.7 branch. Ok to
backport to the 4.7 branch?

  Matthias
2012-10-07  Matthias Klose  

* config/arm/unwind-arm.h (__gnu_unwind_24bit): Mark parameters
as unused.
(_Unwind_decode_typeinfo_ptr): Mark base as unused.

--- libgcc/config/arm/unwind-arm.h~
+++ libgcc/config/arm/unwind-arm.h
@@ -39,7 +39,8 @@
 #endif
   /* Decode an R_ARM_TARGET2 relocation.  */
   static inline _Unwind_Word
-  _Unwind_decode_typeinfo_ptr (_Unwind_Word base, _Unwind_Word ptr)
+  _Unwind_decode_typeinfo_ptr (_Unwind_Word base __attribute__ ((unused)),
+   _Unwind_Word ptr)
 {
   _Unwind_Word tmp;
 
@@ -65,7 +66,9 @@
 }
 
   static inline _Unwind_Reason_Code
-  __gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact)
+  __gnu_unwind_24bit (_Unwind_Context * context __attribute__ ((unused)),
+  _uw data __attribute__ ((unused)),
+  int compact __attribute__ ((unused)))
 {
   return _URC_FAILURE;
 }


[patch] [libstdc++] Fix build failure with --enable-libstdcxx-debug

2012-12-09 Thread Matthias Klose
Seen with a x86_64 x arm x arm cross build and --enable-libstdcxx-debug. The
../config.h should not be hard-coded. Using the macro guarantees that the
rewritten macros for the debug builds are used. However I fail to see why the
unpatched version does work for the native build.

Ok for the trunk and the 4.7 branch?

  Matthias




Re: application/xml mime-type in recent libstdc++ doc changes

2012-12-09 Thread Matthias Klose
ping

Am 12.10.2012 15:26, schrieb Matthias Klose:
> Hi,
> 
> libstdc++-v3/doc/xsl/customization.xsl.in is marked as
> 
>   svn:mime-type = application/xml
> 
> at least on the 4.7 branch, having some unexpected outcome for svn diff.
> If this was unintended, could you change the svn:mime-type back to text?
> 
> Thanks, Matthias
>