Re: [PATCH 2/2] Enable elimination of zext/sext

2014-07-14 Thread Bernhard Reutner-Fischer

On 14 July 2014 04:58:17 Kugan kugan.vivekanandara...@linaro.org wrote:


On 11/07/14 22:47, Richard Biener wrote:
 On Fri, Jul 11, 2014 at 1:52 PM, Kugan
 kugan.vivekanandara...@linaro.org wrote:
 Thanks foe the review and suggestions.

 On 10/07/14 22:15, Richard Biener wrote:
 On Mon, Jul 7, 2014 at 8:55 AM, Kugan 
kugan.vivekanandara...@linaro.org wrote:


 [...]


 For -fwrapv, it is due to how PROMOTE_MODE is defined in arm back-end.
 In the test-case, a function (which has signed char return type) returns
 -1 in one of the paths. ARM PROMOTE_MODE changes that to 255 and relies
 on zero/sign extension generated by RTL again for the correct value. I
 saw some other targets also defining similar think. I am therefore
 skipping removing zero/sign extension if the ssa variable can be set to
 negative integer constants.

 Hm?  I think you should rather check that you are removing a
 sign-/zero-extension - PROMOTE_MODE tells you if it will sign- or
 zero-extend.  Definitely

 +  /* In some architectures, negative integer constants are truncated and
 + sign changed with target defined PROMOTE_MODE macro. This will impact
 + the value range seen here and produce wrong code if zero/sign 
extensions

 + are eliminated. Therefore, return false if this SSA can have negative
 + integers.  */
 +  if (is_gimple_assign (stmt)
 +   (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_unary))
 +{
 +  tree rhs1 = gimple_assign_rhs1 (stmt);
 +  if (TREE_CODE (rhs1) == INTEGER_CST
 +  !TYPE_UNSIGNED (TREE_TYPE (ssa))
 +  tree_int_cst_compare (rhs1, integer_zero_node) == -1)
 +   return false;

 looks completely bogus ... (an unary op with a constant operand?)
 instead you want to do sth like

 I see that unary op with a constant operand is not possible in gimple.
 What I wanted to check here is any sort of constant loads; but seems
 that will not happen in gimple. Is PHI statements the only possible
 statements where we will end up with such constants.

 No, in theory you can have

   ssa_1 = -1;

 but that's not unary but a GIMPLE_SINGLE_RHS and thus
 gimple_assign_rhs_code (stmt) == INTEGER_CST.

   mode = TYPE_MODE (TREE_TYPE (ssa));
   rhs_uns = TYPE_UNSIGNED (TREE_TYPE (ssa));
   PROMOTE_MODE (mode, rhs_uns, TREE_TYPE (ssa));

 instead of initializing rhs_uns from ssas type.  That is, if
 PROMOTE_MODE tells you to promote _not_ according to ssas sign then
 honor that.

 This is triggered in pr43017.c in function foo for arm-none-linux-gnueabi.

 where, the gimple statement that cause this looks like:
 .
   # _3 = PHI _17(7), -1(2)
 bb43:
   return _3;

 ARM PROMOTE_MODE changes the sign for integer constants only and hence
 looking at the variable with PROMOTE_MODE is not changing the sign in
 this case.

 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
   if (GET_MODE_CLASS (MODE) == MODE_INT \
GET_MODE_SIZE (MODE)  4)  \
 {   \
   if (MODE == QImode)   \
 UNSIGNEDP = 1;  \
   else if (MODE == HImode)  \
 UNSIGNEDP = 1;  \
   (MODE) = SImode;  \
 }

 Where does it only apply for constants?  It applies to all QImode and
 HImode entities.

oops, sorry. I don’t know what I was thinking or looking at when I wrote
that :( It indeed fixes my problems. Thanks for that.

Here is the modified patch. Bootstrapped and regression tested for
86_64-unknown-linux-gnu and arm-none-linux-gnueabi with no new regressions.


Is this OK?

Thanks,
Kugan


gcc/

2014-07-14  Kugan Vivekanandarajah  kug...@linaro.org

* calls.c (precompute_arguments): Check is_promoted_for_type
and set the promoted mode.
(is_promoted_for_type): New function.


Don't we name predicates more like promoted_for_type_p?

Thanks,

(expand_expr_real_1): Check is_promoted_for_type
and set the promoted mode.
* expr.h (is_promoted_for_type): New function definition.
* cfgexpand.c (expand_gimple_stmt_1): Call emit_move_insn if
SUBREG is promoted with SRP_SIGNED_AND_UNSIGNED.


gcc/testsuite
2014-07-14  Kugan Vivekanandarajah  kug...@linaro.org

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




Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH, testsuite] Reliably prune GCC notes in C++ compat suite

2014-07-17 Thread Bernhard Reutner-Fischer

On 17 July 2014 02:51:14 Ulrich Weigand uweig...@de.ibm.com wrote:


Hello,

in testing the rs6000 ABI patches I noted a weird effect: usually, the
-Wpsabi warning notes are ignored in the compat test suites, so we get
a clean test run anyway.

However, when running the C++ version of the struct-layout-1.exp case
*alone* (using RUNTESTFLAGS=struct-layout-1.exp), suddenly tests are
failing because of those extra notes.  This does *not* happen with
the C version of that suite ...

It turns out that that pruning those notes is supposed to happen
from within gcc-defs.exp:${tool}_check_compile:
if { [info proc ${tool}-dg-prune] !=  } {
global target_triplet
set gcc_output [${tool}-dg-prune $target_triplet $gcc_output]
}

However, the g++-dg-prune routine is defined in g++-dg.exp, which
is never included from g++.dg/compat/struct-layout-1.exp (directly
or indirectly).  Now, when running the full suite, that file would
have been loaded by some earlier g++.dg .exp file, so everything
works out.  But when running struct-layout-1.exp stand-alone, the
g++-dg-prune routine is never defined and thus silently no pruning
takes place.

To fix this, the following patch simply loads g++-dg.exp directly
from g++.dg/compat/struct-layout-1.exp.

Tested on powerpc64-linux and powerpc64le-linux.

OK for mainline (and 4.8/4.9 once the rs6000 ABI patches are
backported there)?


Mike,
On a related note:
https://gcc.gnu.org/ml/fortran/2012-03/msg00094.html
The libdirs was applied to dejagnu some time ago, so once we can require 
that version (anytime now) we could apply the patch referenced above.

Also see BUG: in the URL above for another missing load_lib.

Thanks,


Bye,
Ulrich


gcc/testsuite/ChangeLog:

* g++.dg/compat/struct-layout-1.exp: Load g++-dg.exp


Index: gcc-4_9-branch/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
===
--- gcc-4_9-branch.orig/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
+++ gcc-4_9-branch/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
@@ -89,6 +89,9 @@ proc compat-use-tst-compiler { } {
 # This must be done after the compat-use-*-compiler definitions.
 load_lib compat.exp

+# Provide the g++-dg-prune routine (gcc-dp.exp is loaded by compat.exp)
+load_lib g++-dg.exp
+
 g++_init

 # Save variables for the C++ compiler under test, which each test will

--
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  ulrich.weig...@de.ibm.com





Sent with AquaMail for Android
http://www.aqua-mail.com




Re: Add used_by_single_function flag for static variables

2014-11-13 Thread Bernhard Reutner-Fischer
Honza,

On 23 June 2014 06:24, Jan Hubicka hubi...@ucw.cz wrote:

 --- lto-cgraph.c(revision 211881)
 +++ lto-cgraph.c(working copy)
 @@ -614,6 +614,7 @@ lto_output_varpool_node (struct lto_simp
   /* in_other_partition.  */
  }
bp_pack_value (bp, node-tls_model, 3);
 +  bp_pack_value (bp, node-used_by_single_function, 1);
streamer_write_bitpack (bp);

group = node-get_comdat_group ();
 @@ -1275,6 +1276,7 @@ input_varpool_node (struct lto_file_decl
if (node-alias  !node-analyzed  node-weakref)
  node-alias_target = get_alias_symbol (node-decl);
node-tls_model = (enum tls_model)bp_unpack_value (bp, 3);
 +  node-used_by_single_function = (enum tls_model)bp_unpack_value (bp, 1);
group = read_identifier (ib);

Let's please remove the (wrong) cast to tls_model for the
used_by_single_function bit.
PS: lto-cgraph should seemingly be switched to use bp_unpack_enum(), no?
PPS: input_ref() speculative setting should also remove the wrong enum
ipa_ref_use cast.
I better stop reading here ;)
cheers,


Re: Add used_by_single_function flag for static variables

2014-11-14 Thread Bernhard Reutner-Fischer
On 14 November 2014 00:44, Jan Hubicka hubi...@ucw.cz wrote:
 Honza,

 On 23 June 2014 06:24, Jan Hubicka hubi...@ucw.cz wrote:

  --- lto-cgraph.c(revision 211881)
  +++ lto-cgraph.c(working copy)
  @@ -614,6 +614,7 @@ lto_output_varpool_node (struct lto_simp
/* in_other_partition.  */
   }
 bp_pack_value (bp, node-tls_model, 3);
  +  bp_pack_value (bp, node-used_by_single_function, 1);
 streamer_write_bitpack (bp);
 
 group = node-get_comdat_group ();
  @@ -1275,6 +1276,7 @@ input_varpool_node (struct lto_file_decl
 if (node-alias  !node-analyzed  node-weakref)
   node-alias_target = get_alias_symbol (node-decl);
 node-tls_model = (enum tls_model)bp_unpack_value (bp, 3);
  +  node-used_by_single_function = (enum tls_model)bp_unpack_value (bp, 
  1);
 group = read_identifier (ib);

 Let's please remove the (wrong) cast to tls_model for the
 used_by_single_function bit.

 Yep, it is obiovus pasto :)

 PS: lto-cgraph should seemingly be switched to use bp_unpack_enum(), no?

 Yes, in genral lto-cgraph needs a lot of cleanups (most of that code was
 written in early LTO days and needs a rewrite, it just never broke badly 
 enough
 to force it), I will try to schedule these early next stage 1.

 PPS: input_ref() speculative setting should also remove the wrong enum
 ipa_ref_use cast.
 I better stop reading here ;)
 Hehe, just go ahead and keep me posted ;)

lto_output_node does not really like
bp_pack_enum (bp, node_frequency, 2+1, node-frequency);
though. I'll try to have a look in the evening.

btw, i've seen that struct symtab_node has two huge gaps, 30bit and 4bytes
[initially meant to play around with a simple pahole-like plugin to
point those out].
So i started to play around in layout_struct to automatically reorder
member elts to fill
eventual gaps, just to see how/if offsetof and addressof and ada break
if i put a
2D packing step there.
But that raises the question if we have hit-rate data, perhaps in
profile-mode?, for struct
member-access yet? Would be nice to be able to weight the hotter
members higher, towards
the start of the struct. Even neglecting ABI concerns, I fear this
obvious idea is a bit
more time-consuming than i'd like it to be..


[PATCH] testsuite: Error out with meaningful message in target-supports

2014-10-01 Thread Bernhard Reutner-Fischer
Hi,

It would be handy to see the reason(s) why target-supports errors out.
I have been using this patch for a while now and it helps tremendously
to quickly grok why a test isn't being run.

In the meantime a couple of new tests were added (cas_char, cas_int, ...)
and i'd be happy to follow-up adjusting the new tests iff this patch was
accepted.

Ok for the trunk?

TIA and cheers,

Bernhard Reutner-Fischer (1):
  testsuite: error out with tested condition instead of FOO

 gcc/testsuite/lib/target-supports.exp | 68 +--
 1 file changed, 34 insertions(+), 34 deletions(-)

-- 
2.1.0



[PATCH] testsuite: error out with tested condition instead of FOO

2014-10-01 Thread Bernhard Reutner-Fischer
Use the (abbreviated) proprocessor condition for #error instead of FOO
so one can see the test issued.

gcc/testsuite/ChangeLog

2012-12-01  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* lib/target-supports.exp: error out with preprocessor condition
instead of FOO everywhere.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/testsuite/lib/target-supports.exp | 68 +--
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index bce1b83..3724d9e 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -865,7 +865,7 @@ proc check_effective_target_hard_float { } {
 if { [istarget mips*-*-*] } {
return [check_no_compiler_messages hard_float assembly {
#if (defined __mips_soft_float || defined __mips16)
-   #error FOO
+   #error __mips_soft_float || __mips16
#endif
}]
 }
@@ -877,7 +877,7 @@ proc check_effective_target_hard_float { } {
return 0
# return [check_no_compiler_messages hard_float assembly {
#if defined __RX_64_BIT_DOUBLES__
-   #error FOO
+   #error __RX_64_BIT_DOUBLES__
#endif
# }]
 }
@@ -893,7 +893,7 @@ proc check_effective_target_hard_float { } {
 proc check_effective_target_mips64 { } {
 return [check_no_compiler_messages mips64 assembly {
#ifndef __mips64
-   #error FOO
+   #error !__mips64
#endif
 }]
 }
@@ -904,7 +904,7 @@ proc check_effective_target_mips64 { } {
 proc check_effective_target_nomips16 { } {
 return [check_no_compiler_messages nomips16 object {
#ifndef __mips
-   #error FOO
+   #error !__mips
#else
/* A cheap way of testing for -mflip-mips16.  */
void foo (void) { asm (addiu $20,$20,1); }
@@ -927,12 +927,12 @@ proc add_options_for_mips16_attribute { flags } {
 proc check_effective_target_mips16_attribute { } {
 return [check_no_compiler_messages mips16_attribute assembly {
#ifdef PIC
-   #error FOO
+   #error PIC
#endif
#if defined __mips_hard_float \
 (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
 (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
-   #error FOO
+   #error __mips_hard_float  (!_ABIO32 || !_ABIO64)
#endif
 } [add_options_for_mips16_attribute ]]
 }
@@ -961,7 +961,7 @@ proc check_effective_target_mips_llsc { } {
 # Otherwise assume LL/SC support for everything but MIPS I.
 return [check_no_compiler_messages mips_llsc assembly {
#if __mips == 1
-   #error FOO
+   #error __mips == 1
#endif
 }]
 }
@@ -975,7 +975,7 @@ proc check_effective_target_mips_rel { } {
 return [check_no_compiler_messages mips_rel object {
#if (defined _ABIN32  _MIPS_SIM == _ABIN32) \
|| (defined _ABI64  _MIPS_SIM == _ABI64)
-   #error FOO
+   #error _ABIN32  (_ABIN32 || _ABI64)
#endif
 }]
 }
@@ -988,7 +988,7 @@ proc check_effective_target_mips_eabi { } {
 }
 return [check_no_compiler_messages mips_eabi object {
#ifndef __mips_eabi
-   #error FOO
+   #error !__mips_eabi
#endif
 }]
 }
@@ -998,7 +998,7 @@ proc check_effective_target_mips_eabi { } {
 proc check_effective_target_nonpic { } {
 return [check_no_compiler_messages nonpic assembly {
#if __PIC__
-   #error FOO
+   #error __PIC__
#endif
 }]
 }
@@ -1617,7 +1617,7 @@ proc check_effective_target_broken_cplxf_arg { } {
 proc check_effective_target_ti_c67x { } {
 return [check_no_compiler_messages ti_c67x assembly {
#if !defined(_TMS320C6700)
-   #error FOO
+   #error !_TMS320C6700
#endif
 }]
 }
@@ -1626,7 +1626,7 @@ proc check_effective_target_ti_c67x { } {
 proc check_effective_target_ti_c64xp { } {
 return [check_no_compiler_messages ti_c64xp assembly {
#if !defined(_TMS320C6400_PLUS)
-   #error FOO
+   #error !_TMS320C6400_PLUS
#endif
 }]
 }
@@ -1721,8 +1721,8 @@ proc check_effective_target_objc2 { } {
#ifdef __OBJC2__
int dummy[1];
#else
-   #error
-   #endif 
+   #error !__OBJC2__
+   #endif
 }]
 }
 
@@ -1731,8 +1731,8 @@ proc check_effective_target_next_runtime { } {
#ifdef __NEXT_RUNTIME__
int dummy[1];
#else
-   #error
-   #endif 
+   #error !__NEXT_RUNTIME__
+   #endif
 }]
 }
 
@@ -2244,7 +2244,7 @@ proc check_effective_target_vect_simd_clones { } {
 proc check_effective_target_aarch64_big_endian { } {
 return [check_no_compiler_messages aarch64_big_endian assembly {
#if !defined(__aarch64__) || !defined(__AARCH64EB__)
-   #error FOO
+   #error !__aarch64__ || !__AARCH64EB__
#endif
 }]
 }
@@ -2262,7 +2262,7 @@ proc

Re: [PATCH] testsuite: Error out with meaningful message in target-supports

2014-10-01 Thread Bernhard Reutner-Fischer
On 1 October 2014 14:21, Mike Stump mikest...@comcast.net wrote:
 On Oct 1, 2014, at 2:10 AM, Bernhard Reutner-Fischer rep.dot@gmail.com 
 wrote:
 It would be handy to see the reason(s) why target-supports errors out.

 Ok for the trunk?

 Ok.

Installed as r215759.
Thanks!


Re: [PATCH 1/2] Error out for Cilk_spawn or array expression in forbidden places

2014-10-03 Thread Bernhard Reutner-Fischer
On 3 October 2014 16:08:57 CEST, Andi Kleen a...@firstfloor.org wrote:
From: Andi Kleen a...@linux.intel.com

   (check_no_cilk): Dito.

I'm just curious, but isn't the english term ditto (im österreichischen ugs. 
detto, think latin idem) ?



Re: [PATCH] Indirect-call topn targets profiler (instrumentation)

2014-10-07 Thread Bernhard Reutner-Fischer
On 6 October 2014 22:31:18 CEST, Jan Hubicka hubi...@ucw.cz wrote:
 

 Is it ok to commit these two patches now?

Yes, it is OK, thanks!

I do not see documentation of the new parameter added to doc in the ChangeLog?
Also, I would not abbreviate indir in the param name.

Thanks,



Re: Fix PR ipa/60315 (inliner explosion)

2014-03-26 Thread Bernhard Reutner-Fischer

On 26 March 2014 03:17:11 Jan Hubicka hubi...@ucw.cz wrote:


Hi,


Just 2 nits, cannot comment on the patch itself.
s/clonning/cloning/g as usual :)
And the content of the testcase is duplicated.

Thanks,

this patch fixes compile time issue in the testcase that is caused by fact 
that the inliner
is repeatedly inlining into an call it earlier proved to be unreachable.  
The analysis part
knows that such calls are not accounted into overall function summaries, 
but the transform
part sees them merely as cold calls and thus it attempts to do inlining for 
size.
This patch makes analysis part to practively redirect all known to be 
unreachable

calls to BUILTIN_UNREAHABLE.

Doing so uncovered the bug in ipa-pure-const I fixed earlier and also another
but in set_cond_stmt_execution_predicate where invert_tree_comparison is
called and the condition is used further. The function returns ERROR_MARK 
for FP

comparsions in some cases (though I think it should not since there seems to
be no toher way to invert comparsion without this and we have the unordered 
codes).

This concide with ipa-inline-analysis.c internal use of ERROR_MARK and leads to
inconsistent predicates.

Bootstrapped/regtested x86_64-linux, comitted.

PR ipa/60315
* cif-code.def (UNREACHABLE) New code.
* ipa-inline.c (inline_small_functions): Skip edges to 
__builtlin_unreachable.
(estimate_edge_growth): Allow edges to __builtlin_unreachable.
* ipa-inline-analysis.c (edge_set_predicate): Redirect edges with false
predicate to __bulitin_unreachable.
(set_cond_stmt_execution_predicate): Fix issue when 
invert_tree_comparison
returns ERROR_MARK.
* ipa-pure-const.c (propagate_pure_const, propagate_nothrow): Do not
propagate to inline clones.
* cgraph.c (verify_edge_corresponds_to_fndecl): Allow redirection
to unreachable.
* ipa-cp.c (create_specialized_node): Be ready for new node to appear.
* cgraphclones.c (cgraph_clone_node): If call destination is already
ureachable, do not redirect it back.
* tree-inline.c (fold_marked_statements): Hanlde calls becoming
unreachable.

* testsuite/g++.dg/torture/pr60315.C: New testcase.
Index: cif-code.def
===
--- cif-code.def(revision 208829)
+++ cif-code.def(working copy)
@@ -127,3 +127,7 @@ DEFCIFCODE(USES_COMDAT_LOCAL, CIF_FINAL_
 /* We can't inline because of mismatched caller/callee attributes.  */
 DEFCIFCODE(ATTRIBUTE_MISMATCH, CIF_FINAL_NORMAL,
   N_(function attribute mismatch))
+
+/* We proved that the call is unreachable.  */
+DEFCIFCODE(UNREACHABLE, CIF_FINAL_NORMAL,
+  N_(unreachable))
Index: cgraphclones.c
===
--- cgraphclones.c  (revision 208829)
+++ cgraphclones.c  (working copy)
@@ -238,8 +238,12 @@ cgraph_clone_node (struct cgraph_node *n
   FOR_EACH_VEC_ELT (redirect_callers, i, e)
 {
   /* Redirect calls to the old version node to point to its new
-version.  */
-  cgraph_redirect_edge_callee (e, new_node);
+version.  The only exception is when the edge was proved to
+be unreachable during the clonning procedure.  */
+  if (!e-callee
+ || DECL_BUILT_IN_CLASS (e-callee-decl) != BUILT_IN_NORMAL
+ || DECL_FUNCTION_CODE (e-callee-decl) != BUILT_IN_UNREACHABLE)
+cgraph_redirect_edge_callee (e, new_node);
 }


Index: ipa-inline.c
===
--- ipa-inline.c(revision 208829)
+++ ipa-inline.c(working copy)
@@ -1685,7 +1685,7 @@ inline_small_functions (void)
   edge = (struct cgraph_edge *) fibheap_extract_min (edge_heap);
   gcc_assert (edge-aux);
   edge-aux = NULL;
-  if (!edge-inline_failed)
+  if (!edge-inline_failed || !edge-callee-analyzed)
continue;

   /* Be sure that caches are maintained consistent.
Index: ipa-inline.h
===
--- ipa-inline.h(revision 208829)
+++ ipa-inline.h(working copy)
@@ -285,7 +285,8 @@ static inline int
 estimate_edge_growth (struct cgraph_edge *edge)
 {
 #ifdef ENABLE_CHECKING
-  gcc_checking_assert (inline_edge_summary (edge)-call_stmt_size);
+  gcc_checking_assert (inline_edge_summary (edge)-call_stmt_size
+  || !edge-callee-analyzed);
 #endif
   return (estimate_edge_size (edge)
  - inline_edge_summary (edge)-call_stmt_size);
Index: testsuite/g++.dg/torture/pr60315.C
===
--- testsuite/g++.dg/torture/pr60315.C  (revision 0)
+++ testsuite/g++.dg/torture/pr60315.C  (revision 0)
@@ -0,0 +1,32 @@
+// { dg-do compile }
+struct Base {
+virtual int f() = 0;
+};
+
+struct Derived : public Base {
+virtual int f() final 

Re: [Patch, Fortran] PRs 60495/58880: Fix issues with finalization expressions

2014-04-05 Thread Bernhard Reutner-Fischer
On Sat, Apr 05, 2014 at 12:16:23AM +0200, Tobias Burnus wrote:
 This patch ensures that the finalization expression is generated and that
 use-associated finalizers are properly accessed.
 
 Build and regtested on x86-64-gnu-linux.
 OK for the trunk?
 
 Tobias

 2014-04-04  Tobias Burnus  bur...@net-b.de
 
   PR fortran/58880
   PR fortran/60495
   * resolve.c (gfc_resolve_finalizers): Ensure that vtables
   and finalization wrappers are generated.
   * trans.c (gfc_build_final_call): Ensure that use_assoc
   is set for the finalization wrapper when applicable.
 
 2014-04-04  Tobias Burnus  bur...@net-b.de
 
   PR fortran/58880
   PR fortran/60495
   * gfortran.dg/finalize_25.f90: New.
 
 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
 index 6e23e57..38755fe 100644
 --- a/gcc/fortran/resolve.c
 +++ b/gcc/fortran/resolve.c
 @@ -11200,15 +11200,36 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
 the requirements of the standard for procedures used as finalizers.  */
  
  static bool
 -gfc_resolve_finalizers (gfc_symbol* derived)
 +gfc_resolve_finalizers (gfc_symbol* derived, bool *finalizable)
  {
gfc_finalizer* list;
gfc_finalizer** prev_link; /* For removing wrong entries from the list.  */
bool result = true;
bool seen_scalar = false;
 +  gfc_symbol *vtab;
 +  gfc_component *c;
  
 +  /* Return early when not finalizable. Additionally, ensure that 
 derived-type
 + components have a their finalizables resolved.  */
if (!derived-f2k_derived || !derived-f2k_derived-finalizers)
 -return true;
 +{
 +  bool has_final = false;
 +  for (c = derived-components; c; c = c-next)
 + if (c-ts.type == BT_DERIVED
 +  !c-attr.pointer  !c-attr.proc_pointer  
 !c-attr.allocatable)
 +   {
 + bool has_final2 = false;
 + if (!gfc_resolve_finalizers (c-ts.u.derived, has_final))
 +   return false;  /* Error.  */
 + has_final = has_final || has_final2;

debugging-leftover? What's the purpose of has_final2?
Did you mean has_final |= true i.e. has_final = true here?
What am i missing? :)

thanks,
 +   }
 +  if (!has_final)
 + {
 +   if (finalizable)
 + *finalizable = false;
 +   return true;
 + }
 +}
  
/* Walk over the list of finalizer-procedures, check them, and if any one
   does not fit in with the standard's definition, print an error and 
 remove
 @@ -11330,12 +11351,15 @@ gfc_resolve_finalizers (gfc_symbol* derived)
   /* Remove wrong nodes immediately from the list so we don't risk any
  troubles in the future when they might fail later expectations.  */
  error:
 - result = false;
   i = list;
   *prev_link = list-next;
   gfc_free_finalizer (i);
 + result = false;
  }
  
 +  if (result == false)
 +return false;
 +
/* Warn if we haven't seen a scalar finalizer procedure (but we know there
   were nodes in the list, must have been for arrays.  It is surely a good
   idea to have a scalar version there if there's something to finalize.  
 */
 @@ -11344,8 +11368,14 @@ error:
 defined at %L, suggest also scalar one,
derived-name, derived-declared_at);
  
 -  gfc_find_derived_vtab (derived);
 -  return result;
 +  vtab = gfc_find_derived_vtab (derived);
 +  c = vtab-ts.u.derived-components-next-next-next-next-next;
 +  gfc_set_sym_referenced (c-initializer-symtree-n.sym);
 +
 +  if (finalizable)
 +*finalizable = true;
 +
 +  return true;
  }
  
  
 @@ -12513,7 +12543,7 @@ resolve_fl_derived (gfc_symbol *sym)
  return false;
  
/* Resolve the finalizer procedures.  */
 -  if (!gfc_resolve_finalizers (sym))
 +  if (!gfc_resolve_finalizers (sym, NULL))
  return false;
  
if (sym-attr.is_class  sym-ts.u.derived == NULL)
 diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
 index 5961c26..9ea859e 100644
 --- a/gcc/fortran/trans.c
 +++ b/gcc/fortran/trans.c
 @@ -869,6 +869,9 @@ gfc_build_final_call (gfc_typespec ts, gfc_expr 
 *final_wrapper, gfc_expr *var,
gcc_assert (final_wrapper-expr_type == EXPR_VARIABLE);
gcc_assert (var);
  
 +  if (final_wrapper-symtree-n.sym-module)
 +final_wrapper-symtree-n.sym-attr.use_assoc = 1;
 +
gfc_start_block (block);
gfc_init_se (se, NULL);
gfc_conv_expr (se, final_wrapper);
 diff --git a/gcc/testsuite/gfortran.dg/finalize_25.f90 
 b/gcc/testsuite/gfortran.dg/finalize_25.f90
 new file mode 100644
 index 000..73dc568
 --- /dev/null
 +++ b/gcc/testsuite/gfortran.dg/finalize_25.f90
 @@ -0,0 +1,55 @@
 +! { dg-do run }
 +!
 +! PR fortran/58880
 +! PR fortran/60495
 +!
 +! Contributed by Andrew Benson and Janus Weil
 +!
 +
 +module gn
 +  implicit none
 +  type sl
 + integer, allocatable, dimension(:) :: lv
 +   contains
 + final :: sld
 +  end type
 +  type :: nde
 + type(sl) :: r
 +  end type nde
 +
 +  integer :: cnt = 0
 +
 +contains
 +
 +  subroutine sld(s)
 +

Re: [PATCH 2/3] libstdc++-v3: ::tmpnam depends on uClibc SUSV4_LEGACY

2014-04-08 Thread Bernhard Reutner-Fischer
On 20 December 2013 13:16, Bernhard Reutner-Fischer
rep.dot@gmail.com wrote:
 On 13 November 2013 18:56, Jonathan Wakely jwakely@gmail.com wrote:
 On 13 November 2013 09:22, Bernhard Reutner-Fischer wrote:
 On 11 November 2013 12:30, Jonathan Wakely jwakely@gmail.com wrote:
 How does __UCLIBC_SUSV4_LEGACY__ get defined?  We'd have a problem if
 users defined that at configure time but not later when using the
 library.
 That would be defined by uClibc's configury, but the latest
 commit-6f2faa2 i attached does not mention this anymore, but does
 the check in a libc-agnostic manner?

 Yes, but I was concerned about whether the value of that macro can
 change between configuring libstdc++ and users compiling code using
 libstdc++.  If it could change (e.g. by users compiling with
 -D_POSIX_C_SOURCE=200112L or some other feature test macro) then the
 value of _GLIBCXX_USE_TMPNAM (which doesn't change) would be
 unreliable and we could end up with a using ::tmpnam in the library
 that causes errors when users compile.

 If it's set when configuring uClibc then it is a constant for a given
 libstdc++ installation, so the value of _GLIBCXX_USE_TMPNAM is
 reliable.  In that case your change is OK to commit (with or without
 the XYZ change) - thanks.

 It is a constant, yes. I will push this after another round of regtests
 against current trunk as time permits.

Just rebased and saw that sje committed this as svn r207009 for me
since i apparently forgot..
Thanks!


Re: [PATCH 2/3] libstdc++-v3: ::tmpnam depends on uClibc SUSV4_LEGACY

2014-04-14 Thread Bernhard Reutner-Fischer
Jonathan,

I see that you filed LWG 2249 (gets() removal), may i ask you to take
care of the tmpnam removal, too?
The reasoning would be exactly the same as for gets().

TIA  cheers,

http://wg21.cmeerw.net/lwg/issue2249


Re: [PATCH] [CLEANUP] Mark locally-used functions static

2014-04-14 Thread Bernhard Reutner-Fischer

On 14 April 2014 16:50:51 Patrick Palka patr...@parcs.ath.cx wrote:


Hi everyone,

This patch marks static a bunch of locally-used, non-debug functions
within the GCC sources.  Doing so addresses a subset of the warnings emitted
when compiling the GCC sources with -Wmissing-declarations.

I bootstrapped and regtested this change on x86_64-unknown-linux-gnu.

2014-04-13  Patrick Palka  patr...@parcs.ath.cx




gcc/fortran/
* class.c (gfc_intrinsic_hash_value): Make static.
* trans-expr.c (gfc_conv_intrinsic_to_class): Likewise.



Please CC Fortran@ for Fortran FE patches.
Functions in the Fortran FE should lose their gfc_ prefix upon being made 
static.


Thanks,


diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 346aee6..75a3fe6 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -526,7 +526,7 @@ gfc_hash_value (gfc_symbol *sym)

 /* Assign a hash value for an intrinsic type. The algorithm is that of 
 SDBM.  */


-unsigned int
+static unsigned int
 gfc_intrinsic_hash_value (gfc_typespec *ts)
 {
   unsigned int hash = 0;
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 30931a3..a7583cb 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -546,7 +546,7 @@ class_scalar_coarray_to_class (gfc_se *parmse, gfc_expr *e,

 /* Takes an intrinsic type expression and returns the address of a temporary
class object of the 'declared' type.  */
-void
+static void
 gfc_conv_intrinsic_to_class (gfc_se *parmse, gfc_expr *e,
 gfc_typespec class_ts)
 {



Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] Add a new option -fmerge-bitfields (patch / doc inside)

2014-04-16 Thread Bernhard Reutner-Fischer
On 16 April 2014 13:38, Zoran Jovanovic zoran.jovano...@imgtec.com wrote:
 Hello,
 This is new patch version.

The comment from the previous iteration still holds true:

 +@item -fbitfield-merge

you are talking about '-fmerge-bitfields' up until here.
Please fix all occurances of bitfield-merge, both in the docs as well
as in the gcc.dg/tree-ssa/bitfldmrg2.c testcase -- how did that pass anyway
as that option is presumably not recognized? :)

thanks,


[PATCH 0/3] libsanitizer libc conditionals

2014-04-17 Thread Bernhard Reutner-Fischer
Respun. First two patches are for gcc, the last one is for upstream
LLVM.

The gcc part was bootstrapped and regtested on x86_64-unknown-linux-gnu
without regressions and bootstrapped on x86_64-unknown-linux-uclibc to
verify that the configury works as expected and that the library links
without errors. These two patches are essentially backports of the
LLVM bits in patch #3.

The LLVM part was compiled on x86_64 (X86_64 ?) against glibc and
verified that the configury picks up the previously hard-coded values
both with configure  make as well as with cmake  make.

LLVM'er, please install the LLVM bits.

Ok for trunk?


Bernhard Reutner-Fischer (3):
  libsanitizer: Fix !statfs64 builds
  libsanitizer: add conditionals for libc
  [LLVM] [sanitizer] add conditionals for libc

 libsanitizer/asan/Makefile.am  |   6 +
 libsanitizer/asan/Makefile.in  |  17 +-
 libsanitizer/config.h.in   |  60 +
 libsanitizer/configure | 281 -
 libsanitizer/configure.ac  |  38 +++
 libsanitizer/interception/interception_linux.cc|   2 +
 libsanitizer/interception/interception_linux.h |   8 +
 libsanitizer/lsan/Makefile.am  |   6 +
 libsanitizer/lsan/Makefile.in  |  11 +-
 libsanitizer/sanitizer_common/Makefile.am  |   5 +
 libsanitizer/sanitizer_common/Makefile.in  |  18 +-
 .../sanitizer_common_interceptors.inc  | 100 +++-
 .../sanitizer_platform_interceptors.h  |   4 +-
 .../sanitizer_platform_limits_linux.cc |   2 +
 .../sanitizer_platform_limits_posix.cc |  44 +++-
 .../sanitizer_platform_limits_posix.h  |  27 +-
 .../sanitizer_common/sanitizer_posix_libcdep.cc|   7 +
 libsanitizer/tsan/Makefile.am  |   6 +
 libsanitizer/tsan/Makefile.in  |  11 +-
 19 files changed, 619 insertions(+), 34 deletions(-)

-- 
1.9.1



[PATCH 1/3] libsanitizer: Fix !statfs64 builds

2014-04-17 Thread Bernhard Reutner-Fischer
libsanitizer/ChangeLog
2014-04-02  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* configure.ac: Check for sizeof(struct statfs64).
* configure, config.h.in: Regenerate.
* sanitizer_common/sanitizer_platform_interceptors.h
(SANITIZER_INTERCEPT_STATFS64): Make conditional on
SIZEOF_STRUCT_STATFS64 being not 0.
* sanitizer_common/sanitizer_platform_limits_linux.cc
(namespace __sanitizer): Make unsigned
struct_statfs64_sz conditional on SANITIZER_INTERCEPT_STATFS64.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 libsanitizer/config.h.in   |  9 +++
 libsanitizer/configure | 69 ++
 libsanitizer/configure.ac  | 15 +
 .../sanitizer_platform_interceptors.h  |  4 +-
 .../sanitizer_platform_limits_linux.cc |  2 +
 5 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/libsanitizer/config.h.in b/libsanitizer/config.h.in
index e4b2786..4bd6a7f 100644
--- a/libsanitizer/config.h.in
+++ b/libsanitizer/config.h.in
@@ -61,12 +61,18 @@
 /* Define to 1 if you have the sys/mman.h header file. */
 #undef HAVE_SYS_MMAN_H
 
+/* Define to 1 if you have the sys/statfs.h header file. */
+#undef HAVE_SYS_STATFS_H
+
 /* Define to 1 if you have the sys/stat.h header file. */
 #undef HAVE_SYS_STAT_H
 
 /* Define to 1 if you have the sys/types.h header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the sys/vfs.h header file. */
+#undef HAVE_SYS_VFS_H
+
 /* Define to 1 if you have the unistd.h header file. */
 #undef HAVE_UNISTD_H
 
@@ -107,6 +113,9 @@
 /* The size of `short', as computed by sizeof. */
 #undef SIZEOF_SHORT
 
+/* The size of `struct statfs64', as computed by sizeof. */
+#undef SIZEOF_STRUCT_STATFS64
+
 /* The size of `void *', as computed by sizeof. */
 #undef SIZEOF_VOID_P
 
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 5e4840f..c636212 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -15463,6 +15463,75 @@ _ACEOF
 
 
 
+for ac_header in sys/statfs.h
+do :
+  ac_fn_c_check_header_mongrel $LINENO sys/statfs.h 
ac_cv_header_sys_statfs_h $ac_includes_default
+if test x$ac_cv_header_sys_statfs_h = xyes; then :
+  cat confdefs.h _ACEOF
+#define HAVE_SYS_STATFS_H 1
+_ACEOF
+
+fi
+
+done
+
+if test $ac_cv_header_sys_statfs_h = no; then
+  for ac_header in sys/vfs.h
+do :
+  ac_fn_c_check_header_mongrel $LINENO sys/vfs.h ac_cv_header_sys_vfs_h 
$ac_includes_default
+if test x$ac_cv_header_sys_vfs_h = xyes; then :
+  cat confdefs.h _ACEOF
+#define HAVE_SYS_VFS_H 1
+_ACEOF
+
+fi
+
+done
+
+fi
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) = 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking size of struct statfs64 5
+$as_echo_n checking size of struct statfs64...  6; }
+if test ${ac_cv_sizeof_struct_statfs64+set} = set; then :
+  $as_echo_n (cached)  6
+else
+  if ac_fn_c_compute_int $LINENO (long int) (sizeof (struct statfs64)) 
ac_cv_sizeof_struct_statfs64
+#ifdef HAVE_SYS_STATFS_H
+# include sys/statfs.h
+#endif
+#ifdef HAVE_SYS_VFS_H
+# include sys/vfs.h
+#endif
+
+; then :
+
+else
+  if test $ac_cv_type_struct_statfs64 = yes; then
+ { { $as_echo $as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd': 5
+$as_echo $as_me: error: in \`$ac_pwd': 2;}
+{ as_fn_set_status 77
+as_fn_error cannot compute sizeof (struct statfs64)
+See \`config.log' for more details. $LINENO 5; }; }
+   else
+ ac_cv_sizeof_struct_statfs64=0
+   fi
+fi
+
+fi
+{ $as_echo $as_me:${as_lineno-$LINENO}: result: 
$ac_cv_sizeof_struct_statfs64 5
+$as_echo $ac_cv_sizeof_struct_statfs64 6; }
+
+
+
+cat confdefs.h _ACEOF
+#define SIZEOF_STRUCT_STATFS64 $ac_cv_sizeof_struct_statfs64
+_ACEOF
+
+
+
 if test ${multilib} = yes; then
   multilib_arg=--enable-multilib
 else
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index e672131..746c216 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -78,6 +78,21 @@ AC_SUBST(enable_static)
 
 AC_CHECK_SIZEOF([void *])
 
+dnl Careful, this breaks on glibc for e.g. dirent.d_ino being 64bit
+dnl AC_SYS_LARGEFILE
+AC_CHECK_HEADERS(sys/statfs.h)
+if test $ac_cv_header_sys_statfs_h = no; then
+  AC_CHECK_HEADERS(sys/vfs.h)
+fi
+AC_CHECK_SIZEOF([struct statfs64],[],[
+#ifdef HAVE_SYS_STATFS_H
+# include sys/statfs.h
+#endif
+#ifdef HAVE_SYS_VFS_H
+# include sys/vfs.h
+#endif
+])
+
 if test ${multilib} = yes; then
   multilib_arg=--enable-multilib
 else
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h 
b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
index f37d84b..b9ebd5c 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/libsanitizer/sanitizer_common

[PATCH 2/3] libsanitizer: add conditionals for libc

2014-04-17 Thread Bernhard Reutner-Fischer
Conditionalize usage of dlvsym(), nanosleep(), usleep();
Conditionalize layout of struct sigaction and type of it's member
sa_flags.
Conditionalize glob_t members gl_closedir, gl_readdir, gl_opendir,
gl_flags, gl_lstat, gl_stat.
Check for availability of glob.h for use with above members.
Check for availability of netrom/netrom.h, sys/ustat.h (for obsolete
ustat() function), utime.h (for obsolete utime() function), wordexp.h.
Determine size of sigset_t instead of hardcoding it.

libsanitizer/ChangeLog

2014-04-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* configure.ac (AC_CHECK_HEADERS): Add time.h, wordexp.h,
glob.h, netrom/netrom.h, sys/ustat.h.
(AC_CHECK_MEMBERS): Check GNU extension glob_t members.
(AC_CHECK_SIZEOF): Determine size of sigset_t.
(HAVE_STRUCT_SIGACTION_SA_MASK_LAST,
STRUCT_SIGACTION_SA_FLAGS_TYPE): New.
(AC_CHECK_FUNCS): Add usleep, nanosleep, dlvsym.
* configure, config.h.in: Regenerate.
* asan/Makefile.am, lsan/Makefile.am, tsan/Makefile.am,
sanitizer_common/Makefile.am (AM_CXXFLAGS): Include config.h,
add include search directory.
* asan/Makefile.in, lsan/Makefile.in, tsan/Makefile.in,
sanitizer_common/Makefile.in: Regenerate.
* interception/interception_linux.h,
interception/interception_linux.cc,
sanitizer_common/sanitizer_common_interceptors.inc,
sanitizer_common/sanitizer_platform_limits_posix.cc,
sanitizer_common/sanitizer_platform_limits_posix.h,
sanitizer_common/sanitizer_posix_libcdep.cc: Use config.h's new
defines.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 libsanitizer/asan/Makefile.am  |   6 +
 libsanitizer/asan/Makefile.in  |  17 +-
 libsanitizer/config.h.in   |  51 +
 libsanitizer/configure | 212 -
 libsanitizer/configure.ac  |  23 +++
 libsanitizer/interception/interception_linux.cc|   2 +
 libsanitizer/interception/interception_linux.h |   8 +
 libsanitizer/lsan/Makefile.am  |   6 +
 libsanitizer/lsan/Makefile.in  |  11 +-
 libsanitizer/sanitizer_common/Makefile.am  |   5 +
 libsanitizer/sanitizer_common/Makefile.in  |  18 +-
 .../sanitizer_common_interceptors.inc  | 100 +-
 .../sanitizer_platform_limits_posix.cc |  44 -
 .../sanitizer_platform_limits_posix.h  |  27 ++-
 .../sanitizer_common/sanitizer_posix_libcdep.cc|   7 +
 libsanitizer/tsan/Makefile.am  |   6 +
 libsanitizer/tsan/Makefile.in  |  11 +-
 17 files changed, 521 insertions(+), 33 deletions(-)

diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 3f07a83..851774c 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -9,6 +9,12 @@ DEFS += -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT
 endif
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic 
-Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti 
-fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+AM_CXXFLAGS += -include $(top_builddir)/config.h
+if LIBBACKTRACE_SUPPORTED
+# backtrace-rename.h is included from config.h, provide -I dir for it
+AM_CXXFLAGS += -I $(top_srcdir)
+endif
+
 ACLOCAL_AMFLAGS = -I $(top_srcdir) -I $(top_srcdir)/config
 
 toolexeclib_LTLIBRARIES = libasan.la
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 273eb4b..a9b889d 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -37,8 +37,10 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 @USING_MAC_INTERPOSE_TRUE@am__append_1 = -DMAC_INTERPOSE_FUNCTIONS 
-DMISSING_BLOCKS_SUPPORT
-@USING_MAC_INTERPOSE_FALSE@am__append_2 = 
$(top_builddir)/interception/libinterception.la
-@LIBBACKTRACE_SUPPORTED_TRUE@am__append_3 = 
$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
+# backtrace-rename.h is included from config.h, provide -I dir for it
+@LIBBACKTRACE_SUPPORTED_TRUE@am__append_2 = -I $(top_srcdir)
+@USING_MAC_INTERPOSE_FALSE@am__append_3 = 
$(top_builddir)/interception/libinterception.la
+@LIBBACKTRACE_SUPPORTED_TRUE@am__append_4 = 
$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la
 subdir = asan
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -86,8 +88,8 @@ LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libasan_la_DEPENDENCIES =  \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
-   $(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \
-   $(am__append_3) $(am__DEPENDENCIES_1)
+   $(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_3

[PATCH 3/3] [LLVM] [sanitizer] add conditionals for libc

2014-04-17 Thread Bernhard Reutner-Fischer
Conditionalize usage of dlvsym(), nanosleep(), usleep();
Conditionalize layout of struct sigaction and type of it's member
sa_flags.
Conditionalize glob_t members gl_closedir, gl_readdir, gl_opendir,
gl_flags, gl_lstat, gl_stat.
Check for availability of glob.h for use with above members.
Check for availability of netrom/netrom.h, sys/ustat.h (for obsolete
ustat() function), utime.h (for obsolete utime() function), wordexp.h.
Determine size of sigset_t instead of hardcoding it.
Determine size of struct statfs64, if available.

Leave defaults to match what glibc expects but probe them for uClibc.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 CMakeLists.txt |  58 +++
 cmake/Modules/CompilerRTUtils.cmake|  15 ++
 cmake/Modules/FunctionExistsNotStub.cmake  |  56 +++
 lib/interception/interception_linux.cc |   2 +
 lib/interception/interception_linux.h  |   9 ++
 .../sanitizer_common_interceptors.inc  | 101 +++-
 .../sanitizer_platform_limits_posix.cc |  44 -
 .../sanitizer_platform_limits_posix.h  |  27 +++-
 lib/sanitizer_common/sanitizer_posix_libcdep.cc|   9 ++
 make/platform/clang_linux.mk   | 180 +
 make/platform/clang_linux_test_libc.c  |  68 
 11 files changed, 561 insertions(+), 8 deletions(-)
 create mode 100644 cmake/Modules/FunctionExistsNotStub.cmake
 create mode 100644 make/platform/clang_linux_test_libc.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1a7a1f..af8073e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -330,6 +330,64 @@ if(APPLE)
 -isysroot ${IOSSIM_SDK_DIR})
 endif()
 
+set(ct_c ${COMPILER_RT_SOURCE_DIR}/make/platform/clang_linux_test_libc.c)
+check_include_file(sys/ustat.h HAVE_SYS_USTAT_H)
+check_include_file(utime.h HAVE_UTIME_H)
+check_include_file(wordexp.h HAVE_WORDEXP_H)
+check_include_file(glob.h HAVE_GLOB_H)
+include(FunctionExistsNotStub)
+check_function_exists_not_stub(${ct_c} nanosleep HAVE_NANOSLEEP)
+check_function_exists_not_stub(${ct_c} usleep HAVE_USLEEP)
+include(CheckTypeSize)
+# check for sizeof sigset_t
+set(oCMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES})
+set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} signal.h)
+check_type_size(sigset_t SIZEOF_SIGSET_T BUILTIN_TYPES_ONLY)
+if(EXISTS HAVE_SIZEOF_SIGSET_T)
+  set(SIZEOF_SIGSET_T ${HAVE_SIZEOF_SIGSET_T})
+endif()
+set(CMAKE_EXTRA_INCLUDE_FILES ${oCMAKE_EXTRA_INCLUDE_FILES})
+# check for sizeof struct statfs64
+set(oCMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES})
+check_include_file(sys/statfs.h HAVE_SYS_STATFS_H)
+check_include_file(sys/vfs.h HAVE_SYS_VFS_H)
+if(HAVE_SYS_STATFS_H)
+  set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} sys/statfs.h)
+endif()
+if(HAVE_SYS_VFS_H)
+  set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} sys/vfs.h)
+endif()
+# Have to pass _LARGEFILE64_SOURCE otherwise there is no struct statfs64.
+# We forcefully enable LFS to retain glibc legacy behaviour herein.
+set(oCMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
+set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} 
-D_LARGEFILE64_SOURCE)
+check_type_size(struct statfs64 SIZEOF_STRUCT_STATFS64)
+if(EXISTS HAVE_SIZEOF_STRUCT_STATFS64)
+  set(SIZEOF_STRUCT_STATFS64 ${HAVE_SIZEOF_STRUCT_STATFS64})
+else()
+  set(CMAKE_REQUIRED_DEFINITIONS ${oCMAKE_REQUIRED_DEFINITIONS})
+endif()
+set(CMAKE_EXTRA_INCLUDE_FILES ${oCMAKE_EXTRA_INCLUDE_FILES})
+# do not set(CMAKE_REQUIRED_DEFINITIONS ${oCMAKE_REQUIRED_DEFINITIONS})
+# it back here either way.
+include(CheckStructHasMember)
+check_struct_has_member(glob_t gl_flags glob.h HAVE_GLOB_T_GL_FLAGS)
+check_struct_has_member(glob_t gl_closedir glob.h HAVE_GLOB_T_GL_CLOSEDIR)
+check_struct_has_member(glob_t gl_readdir glob.h HAVE_GLOB_T_GL_READDIR)
+check_struct_has_member(glob_t gl_opendir glob.h HAVE_GLOB_T_GL_OPENDIR)
+check_struct_has_member(glob_t gl_lstat glob.h HAVE_GLOB_T_GL_LSTAT)
+check_struct_has_member(glob_t gl_stat glob.h HAVE_GLOB_T_GL_STAT)
+
+# folks seem to have an aversion to configure_file? So be it..
+foreach(x HAVE_SYS_USTAT_H HAVE_UTIME_H HAVE_WORDEXP_H HAVE_GLOB_H
+HAVE_NANOSLEEP HAVE_USLEEP SIZEOF_SIGSET_T SIZEOF_STRUCT_STATFS64
+HAVE_GLOB_T_GL_FLAGS HAVE_GLOB_T_GL_CLOSEDIR
+HAVE_GLOB_T_GL_READDIR HAVE_GLOB_T_GL_OPENDIR
+HAVE_GLOB_T_GL_LSTAT HAVE_GLOB_T_GL_STAT)
+def_undef_string(${x} SANITIZER_COMMON_CFLAGS)
+endforeach()
+
+
 # Architectures supported by Sanitizer runtimes. Specific sanitizers may
 # support only subset of these (e.g. TSan works on x86_64 only).
 filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
diff --git a/cmake/Modules/CompilerRTUtils.cmake 
b/cmake/Modules/CompilerRTUtils.cmake
index e22e775..3a0beec 100644
--- a/cmake/Modules/CompilerRTUtils.cmake
+++ b/cmake/Modules/CompilerRTUtils.cmake
@@ -59,3 +59,18 @@ macro(append_no_rtti_flag list

Re: [PATCH 3/3] [LLVM] [sanitizer] add conditionals for libc

2014-04-17 Thread Bernhard Reutner-Fischer
On 17 April 2014 16:07, Konstantin Serebryany
konstantin.s.serebry...@gmail.com wrote:
 Hi,

 If you are trying to modify the libsanitizer files, please read here:
 https://code.google.com/p/address-sanitizer/wiki/HowToContribute

I read that, thanks. Patch 3/3 is for current compiler-rt git repo,
please install it there, i do not have write access to the LLVM nor
compiler-rt trees.
TIA,

 --kcc

 On Thu, Apr 17, 2014 at 5:49 PM, Bernhard Reutner-Fischer
 rep.dot@gmail.com wrote:
 Conditionalize usage of dlvsym(), nanosleep(), usleep();
 Conditionalize layout of struct sigaction and type of it's member
 sa_flags.
 Conditionalize glob_t members gl_closedir, gl_readdir, gl_opendir,
 gl_flags, gl_lstat, gl_stat.
 Check for availability of glob.h for use with above members.
 Check for availability of netrom/netrom.h, sys/ustat.h (for obsolete
 ustat() function), utime.h (for obsolete utime() function), wordexp.h.
 Determine size of sigset_t instead of hardcoding it.
 Determine size of struct statfs64, if available.

 Leave defaults to match what glibc expects but probe them for uClibc.

 Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
 ---
  CMakeLists.txt |  58 +++
  cmake/Modules/CompilerRTUtils.cmake|  15 ++
  cmake/Modules/FunctionExistsNotStub.cmake  |  56 +++
  lib/interception/interception_linux.cc |   2 +
  lib/interception/interception_linux.h  |   9 ++
  .../sanitizer_common_interceptors.inc  | 101 +++-
  .../sanitizer_platform_limits_posix.cc |  44 -
  .../sanitizer_platform_limits_posix.h  |  27 +++-
  lib/sanitizer_common/sanitizer_posix_libcdep.cc|   9 ++
  make/platform/clang_linux.mk   | 180 
 +
  make/platform/clang_linux_test_libc.c  |  68 
  11 files changed, 561 insertions(+), 8 deletions(-)
  create mode 100644 cmake/Modules/FunctionExistsNotStub.cmake
  create mode 100644 make/platform/clang_linux_test_libc.c

 diff --git a/CMakeLists.txt b/CMakeLists.txt
 index e1a7a1f..af8073e 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -330,6 +330,64 @@ if(APPLE)
  -isysroot ${IOSSIM_SDK_DIR})
  endif()

 +set(ct_c ${COMPILER_RT_SOURCE_DIR}/make/platform/clang_linux_test_libc.c)
 +check_include_file(sys/ustat.h HAVE_SYS_USTAT_H)
 +check_include_file(utime.h HAVE_UTIME_H)
 +check_include_file(wordexp.h HAVE_WORDEXP_H)
 +check_include_file(glob.h HAVE_GLOB_H)
 +include(FunctionExistsNotStub)
 +check_function_exists_not_stub(${ct_c} nanosleep HAVE_NANOSLEEP)
 +check_function_exists_not_stub(${ct_c} usleep HAVE_USLEEP)
 +include(CheckTypeSize)
 +# check for sizeof sigset_t
 +set(oCMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES})
 +set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} signal.h)
 +check_type_size(sigset_t SIZEOF_SIGSET_T BUILTIN_TYPES_ONLY)
 +if(EXISTS HAVE_SIZEOF_SIGSET_T)
 +  set(SIZEOF_SIGSET_T ${HAVE_SIZEOF_SIGSET_T})
 +endif()
 +set(CMAKE_EXTRA_INCLUDE_FILES ${oCMAKE_EXTRA_INCLUDE_FILES})
 +# check for sizeof struct statfs64
 +set(oCMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES})
 +check_include_file(sys/statfs.h HAVE_SYS_STATFS_H)
 +check_include_file(sys/vfs.h HAVE_SYS_VFS_H)
 +if(HAVE_SYS_STATFS_H)
 +  set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} sys/statfs.h)
 +endif()
 +if(HAVE_SYS_VFS_H)
 +  set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} sys/vfs.h)
 +endif()
 +# Have to pass _LARGEFILE64_SOURCE otherwise there is no struct statfs64.
 +# We forcefully enable LFS to retain glibc legacy behaviour herein.
 +set(oCMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
 +set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} 
 -D_LARGEFILE64_SOURCE)
 +check_type_size(struct statfs64 SIZEOF_STRUCT_STATFS64)
 +if(EXISTS HAVE_SIZEOF_STRUCT_STATFS64)
 +  set(SIZEOF_STRUCT_STATFS64 ${HAVE_SIZEOF_STRUCT_STATFS64})
 +else()
 +  set(CMAKE_REQUIRED_DEFINITIONS ${oCMAKE_REQUIRED_DEFINITIONS})
 +endif()
 +set(CMAKE_EXTRA_INCLUDE_FILES ${oCMAKE_EXTRA_INCLUDE_FILES})
 +# do not set(CMAKE_REQUIRED_DEFINITIONS ${oCMAKE_REQUIRED_DEFINITIONS})
 +# it back here either way.
 +include(CheckStructHasMember)
 +check_struct_has_member(glob_t gl_flags glob.h HAVE_GLOB_T_GL_FLAGS)
 +check_struct_has_member(glob_t gl_closedir glob.h HAVE_GLOB_T_GL_CLOSEDIR)
 +check_struct_has_member(glob_t gl_readdir glob.h HAVE_GLOB_T_GL_READDIR)
 +check_struct_has_member(glob_t gl_opendir glob.h HAVE_GLOB_T_GL_OPENDIR)
 +check_struct_has_member(glob_t gl_lstat glob.h HAVE_GLOB_T_GL_LSTAT)
 +check_struct_has_member(glob_t gl_stat glob.h HAVE_GLOB_T_GL_STAT)
 +
 +# folks seem to have an aversion to configure_file? So be it..
 +foreach(x HAVE_SYS_USTAT_H HAVE_UTIME_H HAVE_WORDEXP_H HAVE_GLOB_H
 +HAVE_NANOSLEEP HAVE_USLEEP SIZEOF_SIGSET_T SIZEOF_STRUCT_STATFS64
 +HAVE_GLOB_T_GL_FLAGS HAVE_GLOB_T_GL_CLOSEDIR
 +HAVE_GLOB_T_GL_READDIR

Re: [PATCH 3/3] [LLVM] [sanitizer] add conditionals for libc

2014-04-17 Thread Bernhard Reutner-Fischer
On 17 April 2014 16:51:23 Konstantin Serebryany 
konstantin.s.serebry...@gmail.com wrote:



On Thu, Apr 17, 2014 at 6:27 PM, Bernhard Reutner-Fischer
rep.dot@gmail.com wrote:
 On 17 April 2014 16:07, Konstantin Serebryany
 konstantin.s.serebry...@gmail.com wrote:
 Hi,

 If you are trying to modify the libsanitizer files, please read here:
 https://code.google.com/p/address-sanitizer/wiki/HowToContribute

 I read that, thanks. Patch 3/3 is for current compiler-rt git repo,
 please install it there, i do not have write access to the LLVM nor
 compiler-rt trees.

I can commit your patch to llvm tree only after you follow the process
described on that page.
Sorry, this is a hard rule.


What part of the process do you think I did not follow?

I made a patch for compiler-rt, sent it to llvm-comm...@cs.uiuc.edu then 
provided the corresponding GCC parts, along a backport of the new bits that 
I expect to be overwritten once you do a new merge, leaving just the GCC 
configuy bits. This is how I read the wiki page you cite.


Please tell me what you expect me to do differently?

Thanks,


--kcc



Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH 3/3] [LLVM] [sanitizer] add conditionals for libc

2014-04-23 Thread Bernhard Reutner-Fischer
On 17 April 2014 19:01, Konstantin Serebryany
konstantin.s.serebry...@gmail.com wrote:
 On Thu, Apr 17, 2014 at 8:45 PM, Bernhard Reutner-Fischer
 rep.dot@gmail.com wrote:
 On 17 April 2014 16:51:23 Konstantin Serebryany
 konstantin.s.serebry...@gmail.com wrote:

 On Thu, Apr 17, 2014 at 6:27 PM, Bernhard Reutner-Fischer
 rep.dot@gmail.com wrote:
  On 17 April 2014 16:07, Konstantin Serebryany
  konstantin.s.serebry...@gmail.com wrote:
  Hi,
 
  If you are trying to modify the libsanitizer files, please read here:
  https://code.google.com/p/address-sanitizer/wiki/HowToContribute
 
  I read that, thanks. Patch 3/3 is for current compiler-rt git repo,
  please install it there, i do not have write access to the LLVM nor
  compiler-rt trees.

 I can commit your patch to llvm tree only after you follow the process
 described on that page.
 Sorry, this is a hard rule.


 What part of the process do you think I did not follow?

 I made a patch for compiler-rt, sent it to llvm-comm...@cs.uiuc.edu then
 provided the corresponding GCC parts, along a backport of the new bits that
 I expect to be overwritten once you do a new merge, leaving just the GCC
 configuy bits. This is how I read the wiki page you cite.

 Please tell me what you expect me to do differently?

 First, I did not notice that you've sent it to llvm-commits because it
 was also sent to the gcc list (unusual thing to happen)
 and got filtered into the gcc part of my mail. Sorry.
 But second, the patch is far from trivial and you should not expect us
 to commit it w/o a careful review,
 so here comes another part of the wiki: For non-trivial patches
 please use Phabricator -- this will help us reply faster.

http://reviews.llvm.org/D3464

thanks,


Re: Use resolution info to get rid of weak symbols

2014-05-24 Thread Bernhard Reutner-Fischer

On 18 May 2014 21:38:47 Jan Hubicka hubi...@ucw.cz wrote:


Hi,
this patch makes GCC to use resolution info to turn COMDAT and WEAK
symbols into regular symbols based on feedback given by linker plugin.
If resolution says that given symbol is prevailing, it is possible
to turn them into normal symbols, while when resolution says it
is prevailed, it is possible to turn them into external symbols.

Doing so makes rest of the backend to work smoother on them.
We previously did this transformation partly for functions, this patch
just makes it to happen for variables too and implements the second
part (turning the symbol into external definition).

Bootstrapped/regtested x86_64-linux and tested with libreoffice
build.  Will commit it shortly.

* ipa.c (update_visibility_by_resolution_info): New function.
(function_and_variable_visibility): Use it.
Index: ipa.c
===
--- ipa.c   (revision 210522)
+++ ipa.c   (working copy)
@@ -978,6 +978,50 @@ can_replace_by_local_alias (symtab_node
   !symtab_can_be_discarded (node));
 }

+/* In LTO we can remove COMDAT groups and weak symbols.
+   Either turn them into normal symbols or external symbol depending on +  
 resolution info.  */

+
+static void
+update_visibility_by_resolution_info (symtab_node * node)
+{
+  bool define;
+
+  if (!node-externally_visible
+  || (!DECL_WEAK (node-decl)  !DECL_ONE_ONLY (node-decl))
+  || node-resolution == LDPR_UNKNOWN)
+return;
+
+  define = (node-resolution == LDPR_PREVAILING_DEF_IRONLY
+   || node-resolution == LDPR_PREVAILING_DEF
+   || node-resolution == LDPR_PREVAILING_DEF_IRONLY_EXP);
+
+  /* The linker decisions ought to agree in the whole group.  */
+  if (node-same_comdat_group)
+for (symtab_node *next = node-same_comdat_group;
+next != node; next = next-same_comdat_group)
+  gcc_assert (!node-externally_visible


really !node-externally_visible and not !next-externally_visible ?

Above you already returned if !node-externally_visible ...

Thanks,


+ || define == (next-resolution == LDPR_PREVAILING_DEF_IRONLY
+   || next-resolution == LDPR_PREVAILING_DEF
+   || next-resolution == 
LDPR_PREVAILING_DEF_IRONLY_EXP));
+
+  if (node-same_comdat_group)
+for (symtab_node *next = node-same_comdat_group;
+next != node; next = next-same_comdat_group)
+  {
+   DECL_COMDAT_GROUP (next-decl) = NULL;
+   DECL_WEAK (next-decl) = false;
+   if (next-externally_visible
+!define)
+ DECL_EXTERNAL (next-decl) = true;
+  }
+  DECL_COMDAT_GROUP (node-decl) = NULL;
+  DECL_WEAK (node-decl) = false;
+  if (!define)
+DECL_EXTERNAL (node-decl) = true;
+  symtab_dissolve_same_comdat_group_list (node);
+}
+
 /* Mark visibility of all functions.

A local function is one whose calls can occur only in the current
@@ -1116,38 +1160,7 @@ function_and_variable_visibility (bool w
DECL_EXTERNAL (node-decl) = 1;
}

-  /* If whole comdat group is used only within LTO code, we can 
dissolve it,

-we handle the unification ourselves.
-We keep COMDAT and weak so visibility out of DSO does not change.
-Later we may bring the symbols static if they are not exported.  */
-  if (DECL_ONE_ONLY (node-decl)
-  (node-resolution == LDPR_PREVAILING_DEF_IRONLY
- || node-resolution == LDPR_PREVAILING_DEF_IRONLY_EXP))
-   {
- symtab_node *next = node;
-
- if (node-same_comdat_group)
-   for (next = node-same_comdat_group;
-next != node;
-next = next-same_comdat_group)
- if (next-externally_visible
-  (next-resolution != LDPR_PREVAILING_DEF_IRONLY
-  next-resolution != LDPR_PREVAILING_DEF_IRONLY_EXP))
-   break;
- if (node == next)
-   {
- if (node-same_comdat_group)
-   for (next = node-same_comdat_group;
-next != node;
-next = next-same_comdat_group)
-   {
- DECL_COMDAT_GROUP (next-decl) = NULL;
- DECL_WEAK (next-decl) = false;
-   }
- DECL_COMDAT_GROUP (node-decl) = NULL;
- symtab_dissolve_same_comdat_group_list (node);
-   }
-   }
+  update_visibility_by_resolution_info (node);
 }
   FOR_EACH_DEFINED_FUNCTION (node)
 {
@@ -1234,6 +1247,7 @@ function_and_variable_visibility (bool w
symtab_dissolve_same_comdat_group_list (vnode);
  vnode-resolution = LDPR_PREVAILING_DEF_IRONLY;
}
+  update_visibility_by_resolution_info (vnode);
 }

   if (dump_file)



Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH, libgfortran] Add overflow check to xmalloc

2014-06-14 Thread Bernhard Reutner-Fischer



 On Tue, May 20, 2014 at 12:42 AM, Janne Blomqvist
 blomqvist.ja...@gmail.com wrote:
 On Thu, May 15, 2014 at 1:00 AM, Janne Blomqvist
 blomqvist.ja...@gmail.com wrote:
 Hi,

 a common malloc() pattern is malloc(num_foo * sizeof(foo_t), that
 is, create space for an array of type foo_t with num_foo elements.
 There is a slight danger here in that the multiplication can overflow
 and wrap around, and then the caller thinks it has a larger array than
 what malloc has actually created. The attached patch changes the
 libgfortran xmalloc() function to have an API similar to calloc() with
 two arguments, and the implementation checks for wraparound.

 Hello,

 attached is an updated patch which instead introduces a new function,
 xmallocarray, with the overflow check, and leaves the existing xmalloc
 as is. Thus avoiding the extra checking in the common case where one
 of the arguments to xmallocarray would be 1.

 Tested on x86_64-unknown-linux-gnu, Ok for trunk?



I would prefer if xcmalloc would not be named xmallocarray.

Thanks,

Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH, libgfortran] Add overflow check to xmalloc

2014-06-16 Thread Bernhard Reutner-Fischer

On 16 June 2014 08:20:09 Janne Blomqvist blomqvist.ja...@gmail.com wrote:


On Sun, Jun 15, 2014 at 8:23 AM, Bernhard Reutner-Fischer
rep.dot@gmail.com wrote:

  On Tue, May 20, 2014 at 12:42 AM, Janne Blomqvist
  blomqvist.ja...@gmail.com wrote:
  On Thu, May 15, 2014 at 1:00 AM, Janne Blomqvist
  blomqvist.ja...@gmail.com wrote:
  Hi,
 
  a common malloc() pattern is malloc(num_foo * sizeof(foo_t), that
  is, create space for an array of type foo_t with num_foo elements.
  There is a slight danger here in that the multiplication can overflow
  and wrap around, and then the caller thinks it has a larger array
  than
  what malloc has actually created. The attached patch changes the
  libgfortran xmalloc() function to have an API similar to calloc()
  with
  two arguments, and the implementation checks for wraparound.
 
  Hello,
 
  attached is an updated patch which instead introduces a new function,
  xmallocarray, with the overflow check, and leaves the existing xmalloc
  as is. Thus avoiding the extra checking in the common case where one
  of the arguments to xmallocarray would be 1.
 
  Tested on x86_64-unknown-linux-gnu, Ok for trunk?
 


 I would prefer if xcmalloc would not be named xmallocarray.

Hmm, never heard of that one before, but I have no particular


Great, I fat-fingered it, meant xcalloc.


preference wrt the naming of the function. Ok with that rename?



--
Janne Blomqvist




Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH, libgfortran] Add overflow check to xmalloc

2014-06-16 Thread Bernhard Reutner-Fischer
On 16 June 2014 09:39, Janne Blomqvist blomqvist.ja...@gmail.com wrote:
 On Mon, Jun 16, 2014 at 10:01 AM, Bernhard Reutner-Fischer
 rep.dot@gmail.com wrote:
 On 16 June 2014 08:20:09 Janne Blomqvist blomqvist.ja...@gmail.com wrote:

 On Sun, Jun 15, 2014 at 8:23 AM, Bernhard Reutner-Fischer
 rep.dot@gmail.com wrote:
 
   On Tue, May 20, 2014 at 12:42 AM, Janne Blomqvist
   blomqvist.ja...@gmail.com wrote:
   On Thu, May 15, 2014 at 1:00 AM, Janne Blomqvist
   blomqvist.ja...@gmail.com wrote:
   Hi,
  
   a common malloc() pattern is malloc(num_foo * sizeof(foo_t),
   that
   is, create space for an array of type foo_t with num_foo elements.
   There is a slight danger here in that the multiplication can
   overflow
   and wrap around, and then the caller thinks it has a larger array
   than
   what malloc has actually created. The attached patch changes the
   libgfortran xmalloc() function to have an API similar to calloc()
   with
   two arguments, and the implementation checks for wraparound.
  
   Hello,
  
   attached is an updated patch which instead introduces a new
   function,
   xmallocarray, with the overflow check, and leaves the existing
   xmalloc
   as is. Thus avoiding the extra checking in the common case where
   one
   of the arguments to xmallocarray would be 1.
  
   Tested on x86_64-unknown-linux-gnu, Ok for trunk?
  
 
 
  I would prefer if xcmalloc would not be named xmallocarray.

 Hmm, never heard of that one before, but I have no particular


 Great, I fat-fingered it, meant xcalloc.

 Ah well, we already have xcalloc, which is a calloc() wrapper. The
 intention of the new function here is to be a malloc() wrapper, but
 with an overflow check. There is no need to zero the memory, hence
 calloc() is not appropriate.

I see. So i suppose your v2 patch is fine then.

cheers,


Re: Bug 61407 - Build errors on latest OS X 10.10 Yosemite with Xcode 6 on GCC 4.8.3

2014-06-17 Thread Bernhard Reutner-Fischer

On 17 June 2014 13:10:07 Илья Михальцов morph...@gmail.com wrote:


index 892ba35..39f795f 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -572,20 +572,31 @@ find_subframework_header (cpp_reader *pfile, const 
char *header, cpp_dir **dirp)


 /* Return the value of darwin_macosx_version_min suitable for the
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
-   so '10.4.2' becomes 1040.  The lowest digit is always zero.
-   Print a warning if the version number can't be understood.  */
+   so '10.4.2' becomes 1040 and '10.10.0' becomes 101000.  The lowest
+   digit is always zero. Print a warning if the version number
+   can't be understood.  */
 static const char *
 version_as_macro (void)
 {
-  static char result[] = 1000;
+  static char result[7] = 1000;
+  int minorDigitIdx;

   if (strncmp (darwin_macosx_version_min, 10., 3) != 0)
 goto fail;
   if (! ISDIGIT (darwin_macosx_version_min[3]))
 goto fail;
-  result[2] = darwin_macosx_version_min[3];
-  if (darwin_macosx_version_min[4] != '\0'
-   darwin_macosx_version_min[4] != '.')
+
+  minorDigitIdx = 3;
+  result[2] = darwin_macosx_version_min[minorDigitIdx++];
+  if (ISDIGIT(darwin_macosx_version_min[minorDigitIdx])) {
+/* Starting with 10.10 numeration for mactro changed */


What does mactro mean? macro?
Thanks,


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH, PR 61540] Do not ICE on impossible devirtualization

2014-06-18 Thread Bernhard Reutner-Fischer

On 18 June 2014 10:24:16 Martin Jambor mjam...@suse.cz wrote:

@@ -3002,10 +3014,8 @@ try_make_edge_direct_virtual_call (struct 
cgraph_edge *ie,


   if (target)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (possible_polymorphic_call_target_p
-(ie, cgraph_get_node (target)));
-#endif
+  if (!possible_polymorphic_call_target_p (ie, cgraph_get_node (target)))
+   return ipa_make_edge_direct_to_target (ie, target);
   return ipa_make_edge_direct_to_target (ie, target);
 }


The above looks odd. You return the same thing both conditionally and 
unconditionally?


Thanks,

   else




Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] Add alloc_align and assume_aligned attributes (PR middle-end/60092)

2014-02-07 Thread Bernhard Reutner-Fischer

On 6 February 2014 16:42:05 Jakub Jelinek ja...@redhat.com wrote:


Hi!

As discussed on IRC, this patch introduces two new attributes,
so that the C library (and other headers) have a way to
a) tell the compiler something about functions like aligned_alloc
   or memalign
b) tell the compiler the alignment of pointers returned say by malloc

Ok for trunk if bootstrap/regtest passes?



+/* Return the propagation value for functions with assume_aligned
+   or alloc_aligned attribute.  */
+
+static prop_value_t
+bit_value_alloc_assume_aligned_attribute (gimple stmt, tree attr,
+ prop_value_t ptrval,
+ bool alloc_aligned)
+{
+  tree lhs = gimple_call_lhs (stmt), align, misalign = NULL_TREE;
+  tree type = TREE_TYPE (lhs);
+  unsigned HOST_WIDE_INT aligni, misaligni = 0;
+  prop_value_t alignval;
+  double_int value, mask;
+  prop_value_t val;


Do we have an optimization that moves most of the above down..


+  if (ptrval.lattice_val == UNDEFINED)
+return ptrval;
+  gcc_assert ((ptrval.lattice_val == CONSTANT
+   TREE_CODE (ptrval.value) == INTEGER_CST)
+ || ptrval.mask.is_minus_one ());
+  if (TREE_VALUE (attr) == NULL_TREE)
+return ptrval;
+  attr = TREE_VALUE (attr);
+  align = TREE_VALUE (attr);
+  if (!tree_fits_uhwi_p (align))
+return ptrval;
+  aligni = tree_to_uhwi (align);
+  if (alloc_aligned)
+{
+  if (aligni == 0 || aligni  gimple_call_num_args (stmt))
+   return ptrval;
+  align = gimple_call_arg (stmt, aligni - 1);
+  if (!tree_fits_uhwi_p (align))
+   return ptrval;
+  aligni = tree_to_uhwi (align);
+}
+  if (aligni = 1
+  || (aligni  (aligni - 1)) != 0)
+return ptrval;
+  if (!alloc_aligned  TREE_CHAIN (attr)  TREE_VALUE (TREE_CHAIN (attr)))
+{
+  misalign = TREE_VALUE (TREE_CHAIN (attr));
+  if (!tree_fits_uhwi_p (misalign))
+   return ptrval;
+  misaligni = tree_to_uhwi (misalign);
+  if (misaligni = aligni)
+   return ptrval;
+}


.. here, btw? Or would one have to do that manually?
Just curious.
Thanks,


+  align = build_int_cst_type (type, -aligni);
+  alignval = get_value_for_expr (align, true);
+  bit_value_binop_1 (BIT_AND_EXPR, type, value, mask,
+type, value_to_double_int (ptrval), ptrval.mask,
+type, value_to_double_int (alignval), alignval.mask);
+  if (!mask.is_minus_one ())
+{
+  val.lattice_val = CONSTANT;
+  val.mask = mask;
+  gcc_assert ((mask.low  (aligni - 1)) == 0);
+  gcc_assert ((value.low  (aligni - 1)) == 0);
+  value.low |= misaligni;
+  /* ???  Delay building trees here.  */
+  val.value = double_int_to_tree (type, value);
+}
+  else
+{
+  val.lattice_val = VARYING;
+  val.value = NULL_TREE;
+  val.mask = double_int_minus_one;
+}
+  return val;
+}
+
 /* Evaluate statement STMT.
Valid only for assignments, calls, conditionals, and switches. */




Sent with AquaMail for Android
http://www.aqua-mail.com




Re: Warn about virtual table mismatches

2014-02-12 Thread Bernhard Reutner-Fischer

On 12 February 2014 07:27:59 Jan Hubicka hubi...@ucw.cz wrote:


 On 02/11/2014 07:54 PM, Jan Hubicka wrote:
 +/* Allow combining RTTI and non-RTTI is OK.  */
 You mean combining -frtti and -fno-rtti compiles?  Yes, that's fine,
 though you need to prefer the -frtti version in case code from that
 translation unit uses the RTTI info.

Is there some mechanism that linker will do so? At the moment we just chose 
variant
that would be selected by linker.  I can make the choice, but what happens 
with non-LTO?
 /aux/hubicka/firefox/accessible/src/generic/DocAccessible.cpp:1232:0: 
note: the first different method is �HandleAccEvent�

 I don't see where this note would come from in the patch.
 Sorry, diffed old tree

Index: ipa-devirt.c
===
--- ipa-devirt.c(revision 207702)
+++ ipa-devirt.c(working copy)
@@ -1675,6 +1675,132 @@
 }


+/* Compare two virtual tables, PREVAILING and VTABLE and output ODR
+   violation warings.  */
+
+void
+compare_virtual_tables (tree prevailing, tree vtable)
+{
+  tree init1 = DECL_INITIAL (prevailing), init2 = DECL_INITIAL (vtable);
+  tree val1 = NULL, val2 = NULL;
+  if (!DECL_VIRTUAL_P (prevailing))
+{
+  odr_violation_reported = true;
+  if (warning_at (DECL_SOURCE_LOCATION (prevailing), 0,
+declaration %D conflict with a virtual table,
+prevailing))
+   inform (DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT (vtable))),
+   a type defining the virtual table in another translation 
unit);
+  return;
+}
+  if (init1 == init2 || init2 == error_mark_node)
+return;
+  /* Be sure to keep virtual table contents even for external
+ vtables when they are available.  */
+  gcc_assert (init1  init1 != error_mark_node);
+  if (!init2  DECL_EXTERNAL (vtable))
+return;
+  if (init1  init2
+   CONSTRUCTOR_NELTS (init1) == CONSTRUCTOR_NELTS (init2))
+{
+  unsigned i;
+  tree field1, field2;
+  bool matched = true;
+
+  FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (init1),
+i, field1, val1)
+   {
+ gcc_assert (!field1);
+ field2 = CONSTRUCTOR_ELT (init2, i)-index;
+ val2 = CONSTRUCTOR_ELT (init2, i)-value;
+ gcc_assert (!field2);
+ if (val2 == val1)
+   continue;
+ if (TREE_CODE (val1) == NOP_EXPR)
+   val1 = TREE_OPERAND (val1, 0);
+ if (TREE_CODE (val2) == NOP_EXPR)
+   val2 = TREE_OPERAND (val2, 0);
+ /* Unwind
+ val addr_expr type pointer_type
+  readonly constant
+  arg 0 mem_ref type pointer_type __vtbl_ptr_type
+  readonly
+  arg 0 addr_expr type pointer_type
+  arg 0 var_decl _ZTCSd0_Si arg 1 integer_cst 24 */
+
+ while (TREE_CODE (val1) == TREE_CODE (val2)
+ (((TREE_CODE (val1) == MEM_REF
+  || TREE_CODE (val1) == POINTER_PLUS_EXPR)
+  (TREE_OPERAND (val1, 1))
+   == TREE_OPERAND (val2, 1))
+|| TREE_CODE (val1) == ADDR_EXPR))
+   {
+ val1 = TREE_OPERAND (val1, 0);
+ val2 = TREE_OPERAND (val2, 0);
+ if (TREE_CODE (val1) == NOP_EXPR)
+   val1 = TREE_OPERAND (val1, 0);
+ if (TREE_CODE (val2) == NOP_EXPR)
+   val2 = TREE_OPERAND (val2, 0);
+   }
+ if (val1 == val2)
+   continue;
+ if (TREE_CODE (val2) == ADDR_EXPR)
+   {
+ tree tmp = val1;
+ val1 = val2;
+ val2 = tmp;
+}
+ /* Combining RTTI and non-RTTI vtables is OK.
+??? Perhaps we can alsa (optionally) warn here?  */
+ if (TREE_CODE (val1) == ADDR_EXPR
+  TREE_CODE (TREE_OPERAND (val1, 0)) == VAR_DECL
+  !DECL_VIRTUAL_P (TREE_OPERAND (val1, 0))
+  integer_zerop (val2))
+   continue;
+ /* For some reason zeros gets NOP_EXPR wrappers.  */
+ if (integer_zerop (val1)
+  integer_zerop (val2))
+   continue;
+ /* Compare assembler names; this function is run during
+declaration merging.  */
+ if (DECL_P (val1)  DECL_P (val2)
+  DECL_ASSEMBLER_NAME (val1) == DECL_ASSEMBLER_NAME (val2))
+   continue;
+ matched = false;
+ break;
+   }
+  if (!matched)
+   {
+ odr_violation_reported = true;
+	  if (warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT 
(vtable))), 0,

+type %qD violates one definition rule,
+DECL_CONTEXT (vtable)))
+   {
+ inform (DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT 
(prevailing))),
+ a type with the same name but different virtual table is 

+

Re: [PATCH] Add a new option -ftree-bitfield-merge (patch / doc inside)

2014-03-12 Thread Bernhard Reutner-Fischer
On Sun, Mar 09, 2014 at 08:35:43PM +, Zoran Jovanovic wrote:
 Hello,
 This is new patch version. 
 Approach suggested by Richard Biener with lowering bit-field accesses instead 
 of modifying gimple trees is implemented.
 
 New command line option -fmerge-bitfields is introduced.
 
 Tested - passed gcc regression tests.
 
 Changelog -
 
 gcc/ChangeLog:
 2014-03-09 Zoran Jovanovic (zoran.jovano...@imgtec.com)
   * common.opt (fmerge-bitfields): New option.
   * doc/invoke.texi: Added reference to -fmerge-bitfields.

Present tense.

   * tree-sra.c (lower_bitfields): New function.
   Entry for (-fmerge-bitfields).
   (bfaccess::hash): New function.
   (bfaccess::equal): New function.
   (bfaccess::remove): New function.
   (bitfield_access_p): New function.
   (lower_bitfield_read): New function.
   (lower_bitfield_write): New function.
   (bitfield_stmt_access_pair_htab_hash): New function.
   (bitfield_stmt_access_pair_htab_eq): New function.
   (create_and_insert_access): New function.
   (get_bit_offset): New function.
   (get_merged_bit_field_size): New function.
   (add_stmt_access_pair): New function.
   (cmp_access): New function.
   * dwarf2out.c (simple_type_size_in_bits): moved to tree.c.

Present tense. Capital 'M'ove

   (field_byte_offset): declaration moved to tree.h, static removed.

Capital 'D'eclaration. These are supposed to be sentences. By removing
static you IMHO 'make extern'.

   * testsuite/gcc.dg/tree-ssa/bitfldmrg1.c: New test.
   * testsuite/gcc.dg/tree-ssa/bitfldmrg2.c: New test.
   * tree-ssa-sccvn.c (expressions_equal_p): moved to tree.c.

See above.

   * tree-ssa-sccvn.h (expressions_equal_p): declaration moved to tree.h.

Likewise.

   * tree.c (expressions_equal_p): moved from tree-ssa-sccvn.c.

See above.

   (simple_type_size_in_bits): moved from dwarf2out.c.

See above.

   * tree.h (expressions_equal_p): declaration added.

Ditto.

   (field_byte_offset): declaration added.

Ditto.

 
 Patch -
 
 diff --git a/gcc/common.opt b/gcc/common.opt
 index 661516d..3331d03 100644
 --- a/gcc/common.opt
 +++ b/gcc/common.opt
 @@ -2193,6 +2193,10 @@ ftree-sra
  Common Report Var(flag_tree_sra) Optimization
  Perform scalar replacement of aggregates
  
 +fmerge-bitfields
 +Common Report Var(flag_tree_bitfield_merge) Init(0) Optimization

Optimization but not enabled for any level. So, where would one
generally want this enabled? CSiBE numbers? SPEC you-name-it
improvements? size(1) improvements where? In GCC there is generally no
interest in the size(1) added to the collection itself, so let me ask
for size(1) and bloat(-o-meter) stats for gcc, cc1 and collect2, just
for the sake of it?

 +Merge loads and stores of consecutive bitfields
 +
  ftree-ter
  Common Report Var(flag_tree_ter) Optimization
  Replace temporary expressions in the SSA-normal pass
 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
 index 24bd76e..54bae56 100644
 --- a/gcc/doc/invoke.texi
 +++ b/gcc/doc/invoke.texi
 @@ -411,7 +411,7 @@ Objective-C and Objective-C++ Dialects}.
  -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol
  -fstack-protector-all -fstack-protector-strong -fstrict-aliasing @gol
  -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
 --ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
 +-fmerge-bitfields -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
  -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
  -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
  -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
 @@ -7807,6 +7807,11 @@ pointer alignment information.
  This pass only operates on local scalar variables and is enabled by default
  at @option{-O} and higher.  It requires that @option{-ftree-ccp} is enabled.
  
 +@item -fbitfield-merge

you are talking about '-fmerge-bitfields' up until here (except for
Subject. [Confusion starts here -- Subject: -ftree-bitfield-merge; sofar
Intro -fmerge-bitfields and ChangeLog -fmerge-bitfields]

 +@opindex fmerge-bitfields
 +Combines several adjacent bit-field accesses that copy values
 +from one memory location to another into one single bit-field access.
 +
  @item -ftree-ccp
  @opindex ftree-ccp
  Perform sparse conditional constant propagation (CCP) on trees.  This

 diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
 index 284d544..c6a19b2 100644
 --- a/gcc/tree-sra.c
 +++ b/gcc/tree-sra.c
 @@ -3462,10 +3462,608 @@ perform_intra_sra (void)
return ret;
  }
  
 +/* Bitfield access and hashtable support commoning same base and
 +   representative.  */
 +
 +struct bfaccess
 +{
 +  bfaccess (tree r):ref (r), r_count (1), w_count (1), merged (false),
 +modified (false), is_barrier (false), next (0), head_access (0)
 +  {
 +  }
 +
 +  tree ref;
 +  unsigned r_count;  /* Read counter.  */
 +  unsigned w_count;  /* Write counter.  */
 +
 +  /* hash_table support.  */
 +  typedef bfaccess value_type;
 +  typedef bfaccess compare_type;
 +  static inline hashval_t hash (const 

Re: [PATCH, ARM] PR62248 - Configure error with --with-fpu=fp-armv8

2014-08-27 Thread Bernhard Reutner-Fischer
On 27 August 2014 16:22:28 CEST, Yvan Roux yvan.r...@linaro.org wrote:
Committed on trunk at r214573, and I'll backport it on 4.9 branch.

s/true/:/

?
Thanks,




Re: [PATCH x86_64] Optimize access to globals in -fpie -pie builds with copy relocations

2014-09-03 Thread Bernhard Reutner-Fischer
On 2 September 2014 22:40:50 CEST, Richard Henderson r...@redhat.com wrote:
On 06/20/2014 05:17 PM, Sriraman Tallam wrote:
 Index: config/i386/i386.c
 ===
 --- config/i386/i386.c   (revision 211826)
 +++ config/i386/i386.c   (working copy)
 @@ -12691,7 +12691,9 @@ legitimate_pic_address_disp_p (rtx disp)
  return true;
  }
else if (!SYMBOL_REF_FAR_ADDR_P (op0)
 -SYMBOL_REF_LOCAL_P (op0)
 +(SYMBOL_REF_LOCAL_P (op0)
 +   || (TARGET_64BIT  ix86_copyrelocs  flag_pie
 +!SYMBOL_REF_FUNCTION_P (op0)))
  ix86_cmodel != CM_LARGE_PIC)
  return true;
break;

This is the wrong place to patch.

You ought to be adjusting SYMBOL_REF_LOCAL_P, by providing a modified
TARGET_BINDS_LOCAL_P.

Note in particular that I believe that you are doing the wrong thing
with weak
and COMMON symbols, in that you probably ought not force a copy reloc
there.

Note the complexity of default_binds_local_p_1, and the fact that all
you
really want to modify is

  /* If PIC, then assume that any global name can be overridden by
 symbols resolved from other modules.  */
  else if (shlib)
local_p = false;

near the bottom of that function.

Reminds me of PR32219 https://gcc.gnu.org/ml/gcc-patches/2010-03/msg00665.html
but admittedly that is not PIE imposed but still fails on current trunk..




Re: Vimrc config with GNU formatting

2014-09-04 Thread Bernhard Reutner-Fischer
On Thu, Sep 04, 2014 at 03:22:15PM +0200, Richard Biener wrote:
 On Thu, Sep 4, 2014 at 3:06 PM, Yury Gribov y.gri...@samsung.com wrote:
  Hi all,
 
  This patch adds a Vim config (.local.vimrc) to root folder. This would allow
  automatic setup of GNU formatting for C/C++/Java/Lex files in GCC (similar
  to what we already have for Emacs via .dir-locals.el). The formatting is
  borrowed from https://gcc.gnu.org/wiki/FormattingCodeForGCC
 
  Ok to commit?
 
 For some reason I use
 
 set shiftwidth=4
 set tabstop=8
 set autoindent
 set cinoptions={.5s,g0,p5,t0,(0,^-0.5s,n-0.5s
 
 I note some differences to your
 
 +  setlocal cinoptions=4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
 ...
 +  setlocal shiftwidth=2
 
 Not that I can parse any of the above without looking up vim docs ;)

Yuri,
Not sure from whom i borrowed this, perhaps even from you richi, but the
gcc_style.vim pasted in the mail below seems to be floating around ;)

https://gcc.gnu.org/ml/gcc-patches/2012-12/msg01228.html

This automatically applies the gcc style if the first 25 lines of the
file being opened contains the syndicated This file is part of GCC so
should transparently not set GNU style on foreign stuff like sanitizer.

HTH..
cheers,


Re: Vimrc config with GNU formatting

2014-09-05 Thread Bernhard Reutner-Fischer
On 5 September 2014 17:10, Yury Gribov y.gri...@samsung.com wrote:

 Now I don't quite like the idea of plugin:
 * .local.vimrc setting is more compatible with what we already have for
 Emacs
 * gcc_style.vim won't work for new files (it requires GCC license agreement)

true

 * gcc_style.vim enables GNU style globally, for all projects

How come? Please explain?

 IMHO localrc plugin is widespread enough that we can rely on it.

Sure.

 This automatically applies the gcc style if the first 25 lines of the
 file being opened contains the syndicated This file is part of GCC so
 should transparently not set GNU style on foreign stuff like sanitizer.


 But as I mentioned also disables formatting for all new files.

Yes, you could if match(expand('%:p:h'), gcc) != -1
or something like that but that's not pretty and robust either.

So I suppose the localrc idea is fine

cheers,


Re: [PATCH] gcc parallel make check

2014-09-11 Thread Bernhard Reutner-Fischer

On 11 September 2014 20:19:31 Jakub Jelinek ja...@redhat.com wrote:


On Thu, Sep 11, 2014 at 07:26:37PM +0200, Jakub Jelinek wrote:
 right now.  The patch below intends to serialize the content of the
 problematic *.exp tests (the first runtest to reach one of those will simply
 run all the tests from that *.exp file, others will skip it).

Forgotten patch below.  BTW, something will probably need to be done about
acats too, either similar approach or just splitting the chapters into
little more jobs, because otherwise in make -C check -j48 acats dominated
the testing time for me.



+   if [ -n $(check_p_subno) \
+-a -n $$GCC_RUNTEST_PARALLELIZE_DIR \
+-a -f $(TESTSUITEDIR)/$(check_p_tool)-parallel/finished ]; then \

test(1) -a and -o are obsolescent, please chain []  [] instead.

Thanks -a cheers ;)


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] gcc parallel make check

2014-09-13 Thread Bernhard Reutner-Fischer

On 12 September 2014 19:46:33 Mike Stump mikest...@comcast.net wrote:


On Sep 12, 2014, at 9:32 AM, Jakub Jelinek ja...@redhat.com wrote:
 Here is my latest version of the patch.

 With this patch I get identical test_summary output on make -k check
 (completely serial testing) and make -j48 -k check from toplevel directory.

 Major changes since last version:
 1) I've changed the granularity, now it does O_EXCL|O_CREAT attempt
   only every 10th runtest_file_p invocation

So, I’d love to see the numbers for 5 and 20 to double check that 10 is the 
right number to pick.  This sort of refinement is trivial post checkin.


 3) various other *.exp fails didn't use runtest_file_p, especially the
   gcc.misc-tests/ ones, tweaked those like struct-layout-1.exp or
   plugin.exp so that only the first runtest instance to encounter those
   runs all of the *.exp file serially

 Regtested on x86_64-linux, ok for trunk?

Ok.  Please be around after you apply it to try and sort out any major fallout.


Usage of $(or) and $(and) will bump GNU make prerequisite version from our 
current 3.80 to at least 3.82 (IIRC).


PS: for the numbers I had used addsuffix  rather than patsubst in the hopes 
that it avoids lots of regexp calls. Very minor not though.


Cheers,


If someone can check their target post checkin (or help out pre-checkin) 
and report back, that would be nice.  Times before and post checkin with 
core count -j setting would be nice.


I wonder if the libstdc++ problems can be sorted out merely by finding a 
way to sort them so the expensive ones come early (regexp - 0regexp for 
example).  Or, instead of sorting them by name, sort them by some other key 
(md5 per line).  The idea then would be that the chance of all regexp tests 
being in one group is 0.




Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] gcc parallel make check

2014-09-13 Thread Bernhard Reutner-Fischer

On 13 September 2014 02:04:51 Jakub Jelinek ja...@redhat.com wrote:


On Fri, Sep 12, 2014 at 04:42:25PM -0700, Mike Stump wrote:
 curious, when I run atomic.exp=stdatom\*.c:

   gcc.dg/atomic/atomic.exp completed in 30 seconds.

 atomic.exp=c\*.c takes 522 seconds with 3, 2, 5 and 4 being the worst 
offenders.


That's the
@if [ -z $(filter-out --target_board=%,$(filter-out 
--extra_opts%,$(RUNTESTFLAGS))) ] \

 [ $(filter -j, $(MFLAGS)) = -j ]; then \
i.e. if you specify anything in RUNTESTFLAGS other than --target_board= or
--extra_opts, it is not parallelized.  This was done previously because
parallelization required setting the flags to something different (manually
created *.exp list).  The first [] could


Yes, this is very inconvenient, especially in the light of -v in the 
runtestflags which should certainly not prohibit parallel execution.

See https://gcc.gnu.org/ml/gcc-patches/2013-11/msg00997.html
for how I would fix that.. (findstring empty instead of filter-out).

TIA,

perhaps be removed now, if one e.g.

RUNTESTFLAGS=atomic.exp etc. with sufficiently enough tests, parallelization
will be still worth it.  I've been worried about the quick cases where
parallelization is not beneficial, like make check-gcc \
RUNTESTFLAGS=dg.exp=pr60123.c or similar, but one doesn't usually pass -jN
in that case.  So yes, the
[ -z $(filter-out --target_board=%,$(filter-out 
--extra_opts%,$(RUNTESTFLAGS))) ]

can be dropped (not in libstdc++ though, there are abi.exp and
prettyprinters.exp still run serially, though even that could be handled the
struct-layout-1.exp way, of running it by the first instance to encounter
those with small changes in those *.exp files).

Jakub




Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] Avoid inter-test dependencies in gfortran.dg (PR fortran/56408)

2014-09-15 Thread Bernhard Reutner-Fischer

On 15 September 2014 19:49:03 Mike Stump mikest...@comcast.net wrote:


On Sep 15, 2014, at 9:13 AM, Jakub Jelinek ja...@redhat.com wrote:
 Here is an attempt to fix gfortran dg.exp testing in case of very
 fine-grained parallelization.

Ok.


Looks like the right approach, yes.
Many thanks for doing this!
Cheers,

Sent with AquaMail for Android
http://www.aqua-mail.com




[PATCH] validate_failures.py: also ignore .git

2012-12-04 Thread Bernhard Reutner-Fischer
contrib/ChangeLog:

2012-12-01  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* testsuite-management/validate_failures.py
(IsInterestingResult): Only strip line a second time if we did split.
Rephrase return statement while at it.
(CollectSumFiles): Also ignore .git directory.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 contrib/testsuite-management/validate_failures.py |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/contrib/testsuite-management/validate_failures.py 
b/contrib/testsuite-management/validate_failures.py
index 7844cb0..280fd23 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -194,11 +194,8 @@ def IsInterestingResult(line):
 return False
   if '|' in line:
 (_, line) = line.split('|', 1)
-  line = line.strip()
-  for result in _VALID_TEST_RESULTS:
-if line.startswith(result):
-  return True
-  return False
+line = line.strip()
+  return any(line.startswith(result) for result in _VALID_TEST_RESULTS)
 
 
 def ParseSummary(sum_fname):
@@ -240,8 +237,9 @@ def GetManifest(manifest_path):
 def CollectSumFiles(builddir):
   sum_files = []
   for root, dirs, files in os.walk(builddir):
-if '.svn' in dirs:
-  dirs.remove('.svn')
+for ignored in ('.svn', '.git'):
+  if ignored in dirs:
+dirs.remove(ignored)
 for fname in files:
   if fname.endswith('.sum'):
 sum_files.append(os.path.join(root, fname))
-- 
1.7.10.4



Re: [PATCH] validate_failures.py: also ignore .git

2012-12-04 Thread Bernhard Reutner-Fischer
On Tue, Dec 04, 2012 at 08:53:50AM -0500, Diego Novillo wrote:
On Tue, Dec 4, 2012 at 4:24 AM, Bernhard Reutner-Fischer
rep.dot@gmail.com wrote:
 contrib/ChangeLog:

 2012-12-01  Bernhard Reutner-Fischer  al...@gcc.gnu.org

 * testsuite-management/validate_failures.py
 (IsInterestingResult): Only strip line a second time if we did split.
 Rephrase return statement while at it.
 (CollectSumFiles): Also ignore .git directory.

OK.

applied to trunk as r194182
thanks!


Re: [PATCH] validate_failures.py: Fix performance regression

2012-12-13 Thread Bernhard Reutner-Fischer
On Fri, Dec 07, 2012 at 10:31:57AM -0500, Diego Novillo wrote:
On Thu, Dec 6, 2012 at 1:12 PM, Bernhard Reutner-Fischer
rep.dot@gmail.com wrote:

@@ -210,12 +211,12 @@ def IsInterestingResult(line):
   if '|' in line:
 (_, line) = line.split('|', 1)
 line = line.strip()
-  return any(line.startswith(result) for result in _VALID_TEST_RESULTS)
+  return bool(_VALID_TEST_RESULTS_REX.match(line))

I wonder why we care about '|' at all? Can you give an example where
this is of relevance?

Just asking because IIUC you throw away the beginning of the line until
the first pipe and try to match the remainder. Did you mean to do this
the other way round, throwing away the pipe and remainder instead?

I suspect that this function should just be
def IsInterestingResult(line):
  Return True if line is one of the summary lines we care about.
  return bool(_VALID_TEST_RESULTS_REX.match(line))

or, if there ever is a pipe in an interesting result
def IsInterestingResult(line):
  Return True if line is one of the summary lines we care about.
  if bool(_VALID_TEST_RESULTS_REX.match(line)):
if '|' in line:
  (line, _) = line.split('|', 1)
  line = line.strip()
return True
  return False


  def IsComment(line):
Return True if line is a comment.
 -  return line.startswith('#')
 +  return bool(re.matches(#, line))

startswith() is a better match here.

  def IsInclude(line):
Return True if line is an include of another file.
 -  return line.startswith(@include )
 +  return bool(re.matches(@include , line))

Likewise.

  def IsNegativeResult(line):
Return True if line should be removed from the expected results.
 -  return line.startswith(@remove )
 +  return bool(re.matches(@remove , line))

Likewise.

I dropped these 3.

TIA for clarification,


OK with those changes.


Diego.


Re: [PATCH] Use new dump scheme to emit loop unroll/peel summary info (issue6941070)

2012-12-20 Thread Bernhard Reutner-Fischer
On Mon, Dec 17, 2012 at 10:44:59PM -0800, Teresa Johnson wrote:
Index: tree-ssa-loop-ivcanon.c
===
--- tree-ssa-loop-ivcanon.c(revision 194516)
+++ tree-ssa-loop-ivcanon.c(working copy)
@@ -639,22 +639,24 @@ unloop_loops (bitmap loop_closed_ssa_invalidated,
 
 /* Tries to unroll LOOP completely, i.e. NITER times.
UL determines which loops we are allowed to unroll.
-   EXIT is the exit of the loop that should be eliminated.  
+   EXIT is the exit of the loop that should be eliminated.
MAXITER specfy bound on number of iterations, -1 if it is
-   not known or too large for HOST_WIDE_INT.  */
+   not known or too large for HOST_WIDE_INT. The location
+   LOCUS corresponding to the loop is used when emitting
+   a summary of the unroll to the dump file.  */
 
 static bool
 try_unroll_loop_completely (struct loop *loop,
   edge exit, tree niter,
   enum unroll_level ul,
-  HOST_WIDE_INT maxiter)
+  HOST_WIDE_INT maxiter,
+location_t locus)

whitespace damage?

Index: loop-unroll.c
===
--- loop-unroll.c  (revision 194516)
+++ loop-unroll.c  (working copy)
@@ -148,6 +148,61 @@ static void combine_var_copies_in_loop_exit (struc
basic_block);
 static rtx get_expansion (struct var_to_expand *);
 
+/* Emit a message summarizing the unroll or peel that will be
+   performed for LOOP, along with the loop's location LOCUS, if
+   appropriate given the dump or -fopt-info settings.  */
+
+static void
+report_unroll_peel(struct loop *loop, location_t locus)

missing space before (

contrib/check_GNU_style.sh generally says:
Dot, space, space, new sentence.
loop-dump.01.patch:223:+   not known or too large for HOST_WIDE_INT. The 
location
loop-dump.01.patch:514:+   * of the for or while statement, if possible. To do 
this, look

Dot, space, space, end of comment.
loop-dump.01.patch:504:+/* Return location corresponding to the loop control 
condition if possible. */
loop-dump.01.patch:541:+  /* Next check the latch, to see if it is non-empty. *
loop-dump.01.patch:555:+  /* If all else fails, simply return the current 
function location. */

There should be exactly one space between function name and parentheses.
loop-dump.01.patch:329:+report_unroll_peel(struct loop *loop, location_t locus)
loop-dump.01.patch:386:+  location_t locus = get_loop_location(loop);
loop-dump.01.patch:404:+  report_unroll_peel(loop, locus);
loop-dump.01.patch:412:+  location_t locus = get_loop_location(loop);
loop-dump.01.patch:429:+  report_unroll_peel(loop, locus);
loop-dump.01.patch:533:+  if ((exit = single_exit(loop)))

@@ -248,6 +305,7 @@ peel_loops_completely (int flags)
 
   if (loop-lpt_decision.decision == LPT_PEEL_COMPLETELY)
   {
+  report_unroll_peel(loop, locus);
 peel_loop_completely (loop);

whitespace damage? You seem to have this kind of whitespace error
throughout the patch. I take it you are aware of
http://gcc.gnu.org/wiki/FormattingCodeForGCC
and just forgot to have it on the machine you edited?

I seemingly have
$ cat ~/.vim/gcc_style.vim 
 put this plugin into ~/.vim/gcc_style.vim and source it into your ~/.vimrc via
 source ~/.vim/gcc_style.vim
if exists(g:loaded_gcc_style) || cp
  finish
endif
let g:loaded_gcc_style = 1

augroup gcc_style
  autocmd BufReadPost,FileReadPost * call s:maybe_gcc_style()
augroup END
if exists(*s:maybe_gcc_style)
  finish
endif
let s:cpo_save = cpo
set cpovim

function! s:maybe_gcc_style()
  let s:i = 1 + 0
  while s:i = line($)  s:i = 25
let s:line = getline(s:i)
if s:line =~ '^\s*This\sfile\sis\spart\sof\sGCC.*'
   gcc-mode
  set cino=:s,{s,n-s,2s,^-s
  set sw=2
  set sts=2
  set cindent
  set smartindent
  set autoindent
  break
else
  let s:i = s:i + 1
endif
  endwhile
endfunction

command! NoGCCstyle unlet! g:loaded_gcc_style | au! gcc_style
command! DoGCCstyle runtime gcc_style.vim
let cpo = s:cpo_save

Index: cfgloop.c
===
--- cfgloop.c  (revision 194516)
+++ cfgloop.c  (working copy)
@@ -1666,3 +1666,59 @@ loop_exits_from_bb_p (struct loop *loop, basic_blo
 
   return false;
 }
+
+/* Return location corresponding to the loop control condition if possible. */
+
+location_t
+get_loop_location (struct loop *loop)
+{
+  rtx insn = NULL;
+  struct niter_desc *desc = NULL;
+  edge exit;
+
+  /* For a for or while loop, we would like to return the location
+   * of the for or while statement, if possible. To do this, look
+   * for the branch guarding the loop back-edge.
+   */

IIRC there is not supposed to be a * in comments.

Other than these nits i like it (but cannot approve it).

thanks,


Re: [PATCH 1/2] Document HLE / RTM intrinsics

2013-01-12 Thread Bernhard Reutner-Fischer

On 12 January 2013 16:28:41 Andi Kleen a...@firstfloor.org wrote:

From: Andi Kleen a...@linux.intel.com



+Returns _XBEGIN_STARTED when the transaction
+started successfully (not this is not 0, so the constant has to be


not this is not 0? Or note?

Thanks,


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [committed] Add copyright update script to contrib/

2013-02-04 Thread Bernhard Reutner-Fischer
On 4 February 2013 20:42:55 Richard Sandiford 
rdsandif...@googlemail.com wrote:

...now that all the output has been approved.

Richard


contrib/
* update-copyright.pl: New file.

Index: contrib/update-copyright.pl
===
--- /dev/null   2013-01-15 19:11:41.843960094 +
+++ contrib/update-copyright.pl 2013-02-04 19:40:37.903547053 +
@@ -0,0 +1,766 @@
+#!/usr/bin/python


I find this slightly confusing ;)
Cheers,


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] validate_failures.py: Fix performance regression

2013-02-06 Thread Bernhard Reutner-Fischer
On Fri, Dec 07, 2012 at 10:31:57AM -0500, Diego Novillo wrote:
On Thu, Dec 6, 2012 at 1:12 PM, Bernhard Reutner-Fischer
rep.dot@gmail.com wrote:

  def IsComment(line):
Return True if line is a comment.
 -  return line.startswith('#')
 +  return bool(re.matches(#, line))

startswith() is a better match here.

  def IsInclude(line):
Return True if line is an include of another file.
 -  return line.startswith(@include )
 +  return bool(re.matches(@include , line))

Likewise.

  def IsNegativeResult(line):
Return True if line should be removed from the expected results.
 -  return line.startswith(@remove )
 +  return bool(re.matches(@remove , line))

Likewise.


OK with those changes.

Applied as r195811

thanks,


Re: PING Re: [PATCH] gfortran testsuite: implicitly cleanup-modules, part 2

2012-04-13 Thread Bernhard Reutner-Fischer
On Fri, Apr 13, 2012 at 06:57:44AM -0700, Mike Stump wrote:
On Apr 13, 2012, at 3:51 AM, Bernhard Reutner-Fischer wrote:
 Ping.

Before advancing, has the problem that Rainer pointed out on March 19th with 
your earlier patch been fixed?

I believe that it is fixed, yes. See r185688 and my follow up to him (
http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01498.html )


Re: [Fortran] Patch ping

2012-04-18 Thread Bernhard Reutner-Fischer
On Tue, Apr 17, 2012 at 12:47:48AM +0200, Tobias Burnus wrote:

Approved but not yet committed:

Bernhard:
- [PATCH] gfortran testsuite: implicitly cleanup-modules, part 2
  http://gcc.gnu.org/ml/fortran/2012-04/msg00065.html

Before actually pushing this, I ment to ask if we *want* to make
sure that we do not add superfluous cleanup-module calls in the
future (which would slow down testing needlessly)?

If so we would either have to manually reject occurances of those during
patch-review or install a warning or the like if there is an explicit
cleanup-modules call yielding the same set as the now automatically
determined set.

Since i have not yet looked into the automatic warning myself i would
have hoped that you would not add more explicit cleanup-module calls but
i guess this will not really work out, long-term :)

Thoughts?


Re: [Fortran] Patch ping

2012-05-15 Thread Bernhard Reutner-Fischer
On Fri, May 11, 2012 at 07:34:30PM +0200, Tobias Burnus wrote:
On 18 April 2012 at 18:57, Bernhard Reutner-Fischer wrote:
On Tue, Apr 17, 2012 at 12:47:48AM +0200, Tobias Burnus wrote:
Approved but not yet committed:
Bernhard:
- [PATCH] gfortran testsuite: implicitly cleanup-modules, part 2
  http://gcc.gnu.org/ml/fortran/2012-04/msg00065.html
Before actually pushing this, I ment to ask if we *want* to make
sure that we do not add superfluous cleanup-module calls in the
future (which would slow down testing needlessly)?

If so we would either have to manually reject occurances of those during
patch-review or install a warning or the like if there is an explicit
cleanup-modules call yielding the same set as the now automatically
determined set.

I would go for the manual method: As cleanup-modules is something
which developers tend to forget, I do not think that many patches
will include them. On then simply tries to reduce those by patch
review. - If patch developers do not see it in other files, the
chance is high that they do not even know (or remember) about that
feature in a few months.

And after some time (1/2 year, 1 year?), one can check whether a
spurious clean-up modules has slipped in - or whether some
cleanup-module is missing. I expect that there will be none or very,
very few cases.

I have committed this as r187521.

thanks,


Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-06-28 Thread Bernhard Reutner-Fischer
Rehi Janis,

Good to see you active again :)

Perhaps you want to pursue this? We'd need to suggest this to dejagnu,
have it in a release and bump the minimum required deja version of gcc.
So it may take time but IMO would be a worthwhile cleanup.
Or do you see a better way to handle this properly?

The first patch below is the dejagnu part, the other patch is the
corresponding follow-up for gcc.

cheers,
Bernhard

On Fri, Mar 16, 2012 at 03:59:58PM +0100, Bernhard Reutner-Fischer wrote:
On Fri, Mar 16, 2012 at 11:04:45AM +0100, Bernhard Reutner-Fischer wrote:

The underlying problem is that dejagnu's runtest.exp only allows for a
single libdir where it searches for includes -- see comment in
libgomp.exp and libitm.exp

While just adding more and more load_gcc_lib calls to users outside of
gcc/ is the easy way out, it is (IMHO) error prone (i ran make check
just in gcc and not in toplevel, fixed my script now).

It would be desirable if dejagnu would just find all the currently
load_gcc_lib'ed files on its own, via load_lib.
One could
- teach dejagnu to treat libdir as a list of paths

The attached works for me for a toplevel make -k check (double-checked
with individual make check in lib{gomp,itm}). I do not intend to pursue
this any further.

runtest.exp: add libdirs list for load_lib()

libgomp wants to load .exp files from ../gcc/testsuite/lib.
Instrument load_lib to be able to find the files.
Previously we used to have a helper proc that had to first load all
dependent .exp manually and then, again manually, the desired .exp.

2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org

   * runtest.exp (libdirs): New global list.
   (load_lib): Append libdirs to search_and_load_files directories.

diff --git a/runtest.exp b/runtest.exp
index 4bfed83..8e6a7de 100644
--- a/runtest.exp
+++ b/runtest.exp
@@ -589,7 +589,7 @@ proc lookfor_file { dir name } {
 # source tree, (up one or two levels), then in the current dir.
 #
 proc load_lib { file } {
-global verbose libdir srcdir base_dir execpath tool
+global verbose libdir libdirs srcdir base_dir execpath tool
 global loaded_libs
 
 if {[info exists loaded_libs($file)]} {
@@ -597,8 +597,11 @@ proc load_lib { file } {
 }
 
 set loaded_libs($file) 
-
-if { [search_and_load_file library file $file [list ../lib $libdir 
$libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib 
$execpath/lib . [file dirname [file dirname [file dirname 
$srcdir]]]/dejagnu/lib]] == 0 } {
+set search_dirs [list ../lib $libdir $libdir/lib [file dirname [file 
dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file 
dirname [file dirname $srcdir]]]/dejagnu/lib]
+if {[info exists libdirs]} {
+lappend search_dirs $libdirs
+}
+if { [search_and_load_file library file $file $search_dirs ] == 0 } {
   send_error ERROR: Couldn't find library file $file.\n
   exit 1
 }
@@ -652,6 +655,8 @@ set libdir   [file dirname $execpath]/dejagnu
 if {[info exists env(DEJAGNULIBS)]} {
 set libdir $env(DEJAGNULIBS)
 }
+# list of extra directories for load_lib
+set libdirs {}
 
 verbose Using $libdir to find libraries
 

libgomp/ChangeLog

2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org

   * testsuite/lib/libgomp.exp: Set libdirs. Remove now redundant
   manual inclusion of gfortran-dg's dependencies.

libitm/ChangeLog

2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org

   * testsuite/lib/libitm.exp: Set libdirs. Remove now redundant
   manual inclusion of gcc-dg's dependencies.


diff --git a/libgomp/testsuite/lib/libgomp.exp 
b/libgomp/testsuite/lib/libgomp.exp
index 02909f8..54e1e652 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -1,32 +1,12 @@
-# Damn dejagnu for not having proper library search paths for load_lib.
-# We have to explicitly load everything that gcc-dg.exp wants to load.
+global libdirs
+lappend libdirs $srcdir/../../gcc/testsuite/lib
 
-proc load_gcc_lib { filename } {
-global srcdir loaded_libs
+load_lib dg.exp
 
-load_file $srcdir/../../gcc/testsuite/lib/$filename
-set loaded_libs($filename) 
-}
+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!
+load_lib gcc-defs.exp
 
-load_lib dg.exp
-load_gcc_lib file-format.exp
-load_gcc_lib target-supports.exp
-load_gcc_lib target-supports-dg.exp
-load_gcc_lib scanasm.exp
-load_gcc_lib scandump.exp
-load_gcc_lib scanrtl.exp
-load_gcc_lib scantree.exp
-load_gcc_lib scanipa.exp
-load_gcc_lib prune.exp
-load_gcc_lib target-libpath.exp
-load_gcc_lib wrapper.exp
-load_gcc_lib gcc-defs.exp
-load_gcc_lib torture-options.exp
-load_gcc_lib timeout.exp
-load_gcc_lib timeout-dg.exp
-load_gcc_lib fortran-modules.exp
-load_gcc_lib gcc-dg.exp
-load_gcc_lib gfortran-dg.exp
+load_lib gfortran-dg.exp
 
 set dg-do-what-default run
 
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index f322ed5..1ac8f31

Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-06-28 Thread Bernhard Reutner-Fischer
On Thu, Jun 28, 2012 at 04:43:05PM -0700, Mike Stump wrote:
On Jun 28, 2012, at 3:27 PM, Bernhard Reutner-Fischer wrote:
 Perhaps you want to pursue this? We'd need to suggest this to dejagnu,

Actually, we have the technology, so that isn't necessary.  :-)  You can 
install replacements for any procs you want, not pretty, but... it does work.  
I think this is a more deterministic path forward than waiting for a mythical 
dejagnu release.  Also, we then can avoid the hassle of requiring a new 
dejagnu.

Wouldn't that mean that we have to completely replace proc load_lib?
But anyway.
Mike, it would be nice if you could fix
+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!

if you did not do that already -- TIA :)

That's under the assumption that one should be able to use the major
lib/*exp without including their pre-requisites first.

cheers,


Re: [patch][rfc] Clean up CFG dumping

2012-07-17 Thread Bernhard Reutner-Fischer
On Mon, Jul 16, 2012 at 09:55:30PM +0200, Steven Bosscher wrote:
On Mon, Jul 16, 2012 at 5:57 PM, Steven Bosscher stevenb@gmail.com wrote:
 Hello,

 There are comments in basic-block.h that advise to update certain
 parts of the compiler if a new edge flag or basic block flag is added:

 -/* Always update the table in cfg.c dump_edge_info.  */

 and

 -   Always update the table in cfg.c dump_bb_info.  */

 Apparently this is not enough, because there are more places where the
 BB flags are dumped. For instance, cfg.c:dump_cfg_bb_info does not
 handle BB_MODIFIED, BB_VISITED, and BB_IN_TRANSACTION, and
 dump_bb_info doesn't even exist in cfg.c (it's in cfgrtl.c). The flags
 also aren't documented very well in the code.

 Furthermore, there are multiple places where common  (i.e. IR
 agnostic) basic block information is dumped, with some functions
 taking TDF_* flags and others not, some functions taking a FILE as the
 first argument and others as the second argument, etc.  In short:
 Unnecessarily messy.

 The attached patch cleans up the worst of it:

 * A new file cfg-flags.def is used to define the BB_* and EDGE_*
 flags. The names are the full string of  the name of the flag in
 uppercase, that's a change from before. I can add a separate name
 field to DEF_EDGE_FLAG and DEF_BB_FLAG if necessary.

 * Now that there is dumpfile.h for the TDF_* masks, it's easier to use
 them everywhere. I have added one new flag to dump with the ;;
 prefix (I think it should be used in more places, but that's something
 for later, perhaps).

 * All basic block header/footer and edge dumping is consolidated in
 dump_edge_info and dump_bb_info. This affects GIMPLE dump the most,
 because it uses a different form of dumping for basic block
 predecessors and successors. I expect some fall-out in the test suite
 (patterns that no longer match) that I'll have to address before the
 patch is ready for mainline.

 * Slim RTL printing is better integrated: print_rtl_with_bb takes
 flags and uses dump_rtl_slim if TDF_SLIM is passed.  The same happens
 in rtl_dump_bb, which always dumps non-slim RTL without this patch.

 Bootstrapped on powerpc64-unknown-linux-gnu. Testing will probably
 reveal some test suite pattern mismatches, and I also still want to
 bootstraptest this on x86_64.
 I'd like to hear what people think of the cfg-flags.def change.

As it turns out, the test suite passes without new regressions on
powerpc64-unknown-linux-gnu and on x86_64-unknown-linux-gnu.
Apparently there aren't any patterns checking edge or bb info. Good
for me :-)

s/anem/name/g

 * tree-cfg.c (gimple_can_merge_blocks_p): Use EDGE_COMPLEX.

I take it you added EDGE_ABNORMAL_CALL on purpose?

 (dump_bb_info): Removed and re-incarnated in cfg.c.

+  if (flags  TDF_COMMENT)
+   fputs (;; , outf);

This emits an ugly trailing space, perhaps we can remove this now?

+ fprintf (outf, %s prev block , s_indent);
+ if (bb-prev_bb)
+   fprintf (outf, %d, , bb-prev_bb-index);
+ else
+   fprintf (outf, (nil), );
+ fprintf (outf, next block );
+ if (bb-next_bb)
+   fprintf (outf, %d, bb-next_bb-index);
+
+ fputs (, flags:, outf);

This looks like it could emit oddly spaced output, think
next block , flags:\n.
It would be nice to alway have the required spaces _before_ the
actual string in this function, imho.

cheers,


Re: [gimplefe] Construction of individual gimple statements for gimple_cond and gimple_label

2012-07-17 Thread Bernhard Reutner-Fischer
On Wed, Jul 11, 2012 at 10:51:02AM +0530, Sandeep Soni wrote:
The patch adds support for creating individual gimple statements for
the gimple_cond and gimple_label statements.

Diego, I need your help in generalizing to include all possible cases
of these statements.

Here is the ChangeLog

2012-07-10   Sandeep Soni soni.sande...@gmail.com

   * parser.c (gp_parse_expect_op1): Tidy. Returns tree operand.
   Update all callers.
   (gp_parse_expect_op2): Likewise.
   (gp_parse_expect_true_label): Tidy. Returns a label.
   Update all callers.
   (gp_parse_expect_false_label): Likewise.
   (gp_parse_cond_stmt): Tidy. Creates and returns a gimple cond
   statement.
   (gp_parse_label_stmt): Creates and returns the gimple label statement.


And the patch
Index: gcc/gimple/parser.c
===
--- gcc/gimple/parser.c(revision 188546)
+++ gcc/gimple/parser.c(working copy)

-static void
+static tree
 gp_parse_expect_op1 (gimple_parser *parser)
 {
   const gimple_token *next_token;
   next_token = gl_consume_token (parser-lexer);
+  tree op1 = NULL_TREE;

I'm curious if the coding conventions were relaxed to allow for variable
declarations that are not at the beginning of a function or scope?

You seem to do this pretty often in the gimplefe..

cheers,


Re: [PATCH 1/2] if-to-switch conversion pass

2012-07-18 Thread Bernhard Reutner-Fischer
On Tue, Jul 17, 2012 at 01:21:00PM +0200, Tom de Vries wrote:

 /* The root of the compilation pass tree, once constructed.  */
 extern struct opt_pass *all_passes, *all_small_ipa_passes, 
 *all_lowering_passes,
Index: gcc/tree-if-switch-conversion.c
===
--- /dev/null (new file)
+++ gcc/tree-if-switch-conversion.c (revision 0)

+/* Convert all trees in RANGES to TYPE.  */
+
+static bool
+convert_ranges (tree type, VEC (range, gc) *ranges)
+{
+  unsigned int ix;
+  range r;
+
+  for (ix = 0; VEC_iterate (range, ranges, ix, r); ix++)
+{
+  r-low = fold_convert (type, r-low);
+  if (TREE_TYPE (r-low) != type)
+  return false;
+
+  if (r-high == NULL_TREE)
+  continue;
+
+  r-high = fold_convert (type, r-high);
+  if (TREE_TYPE (r-low) != type)

low, not high? This is not immediately obvious to me, please explain?

+  return false;
+}
+
+  return true;
+}

+/* Analyze BB and store results in ifsc_info_def struct.  */
+
+static void
+analyze_bb (basic_block bb)
+{
+  gimple stmt = last_stmt (bb);
+  tree lhs, rhs, var, constant;
+  edge true_edge, false_edge;
+  enum tree_code cond_code;
+  VEC (range, gc) *ranges = NULL;
+  unsigned int nr_stmts = 0;
+  bool swap_edges = false;
+  tree low, high;
+
+  /* We currently only handle bbs with GIMPLE_COND.  */
+  if (!stmt || gimple_code (stmt) != GIMPLE_COND)
+return;
+
+  cond_code = gimple_cond_code (stmt);
+  switch (cond_code)
+{
+case EQ_EXPR:
+case NE_EXPR:
+case LE_EXPR:
+case GE_EXPR:
+  break;
+case LT_EXPR:
+case GT_EXPR:
+  /* Todo.  */
+  return;
+default:
+  return;
+}
+
+  lhs = gimple_cond_lhs (stmt);
+  rhs = gimple_cond_rhs (stmt);
+
+  /* The comparison needs to be against a constant.  */
+  if (!TREE_CONSTANT (lhs)
+   !TREE_CONSTANT (rhs))
+return;
+
+  /* Normalize comparison into (var cond_code constant).  */
+  var = TREE_CONSTANT (lhs) ? rhs : lhs;
+  constant = TREE_CONSTANT (lhs)? lhs : rhs;

missing space

[]
+/* Convert every if-chain in CHAINS into a switch statement.  */
+
+static void
+convert_chains (VEC (if_chain, gc) *chains)
+{
+  unsigned int ix;
+  if_chain chain;
+
+  if (VEC_empty (if_chain, chains))
+return;
+
+  for (ix = 0; VEC_iterate (if_chain, chains, ix, chain); ix++)

shouldn't this be FOR_EACH_VEC_ELT nowadays? Everywhere.
+{
+  if (dump_file)
+  dump_if_chain (chain);
+
+  convert_if_chain_to_switch (chain);
+
+  update_cfg (chain);
+}
+
+  /* Force recalculation of dominance info.  */
+  free_dominance_info (CDI_DOMINATORS);
+  free_dominance_info (CDI_POST_DOMINATORS);
+}

Index: gcc/Makefile.in
===
--- gcc/Makefile.in (revision 189508)
+++ gcc/Makefile.in (working copy)
@@ -1391,6 +1391,7 @@ OBJS = \
   tree-profile.o \
   tree-scalar-evolution.o \
   tree-sra.o \
+  tree-if-switch-conversion.o \
   tree-switch-conversion.o \
   tree-ssa-address.o \
   tree-ssa-alias.o \
@@ -3013,7 +3014,12 @@ tree-sra.o : tree-sra.c $(CONFIG_H) $(SY
$(IPA_PROP_H) $(DIAGNOSTIC_H) statistics.h $(TREE_DUMP_H) $(TIMEVAR_H) \
$(PARAMS_H) $(TARGET_H) $(FLAGS_H) \
$(DBGCNT_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H)
+tree-if-switch-conversion.o : tree-if-switch-conversion.c $(CONFIG_H) \
+$(SYSTEM_H) $(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) \
+$(TREE_INLINE_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
+$(GIMPLE_H) $(TREE_PASS_H) $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h 
\
+$(GGC_H) $(OBSTACK_H) $(PARAMS_H) $(CPPLIB_H) $(PARAMS_H)

I think this list needs updating.

Nice to see if improvements, finally! :)
TIA  cheers,


[PATCH 2/5] passes.texi: Fix typo in Full redundancy elimination

2012-02-23 Thread Bernhard Reutner-Fischer
gcc/ChangeLog

2012-02-23  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* doc/passes.texi (Full redundancy elimination): Fix typo.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/doc/passes.texi |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi
index 1fee7d9..8329ddd 100644
--- a/gcc/doc/passes.texi
+++ b/gcc/doc/passes.texi
@@ -393,7 +393,7 @@ in @file{tree-ssa-math-opts.c} and is described by
 @item Full redundancy elimination
 
 This is a simpler form of PRE that only eliminates redundancies that
-occur an all paths.  It is located in @file{tree-ssa-pre.c} and
+occur on all paths.  It is located in @file{tree-ssa-pre.c} and
 described by @code{pass_fre}.
 
 @item Loop optimization
-- 
1.7.9



[PATCH 3/5] tree-if-conv: Commentary typo fix

2012-02-23 Thread Bernhard Reutner-Fischer
gcc/ChangeLog:

2012-02-23  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* tree-if-conv (predicate_scalar_phi): Commentary typo fix.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/tree-if-conv.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index cdbbe5b..ca9503f 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1262,7 +1262,7 @@ find_phi_replacement_condition (struct loop *loop,
arguments.
 
For example,
- S1: A = PHI x1(1), x2(5)
+ S1: A = PHI x1(1), x2(5)
is converted into,
  S2: A = cond ? x1 : x2;
 
-- 
1.7.9



[PATCH 5/5] dump_file whitespace nitpicks

2012-02-23 Thread Bernhard Reutner-Fischer
gcc/ChangeLog:

2012-02-23  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* tree-into-ssa (update_ssa): Avoid trailing whitespace in
dump_file.
* tree-ssa-sccvn.c (print_scc): Ditto.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/tree-into-ssa.c  |4 ++--
 gcc/tree-ssa-sccvn.c |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 7eaed2a..6ca52c1 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -3519,9 +3519,9 @@ update_ssa (unsigned update_flags)
 
   if (dump_flags  TDF_DETAILS)
{
- fprintf (dump_file, Affected blocks: );
+ fprintf (dump_file, Affected blocks:);
  EXECUTE_IF_SET_IN_BITMAP (blocks_to_update, 0, i, bi)
-   fprintf (dump_file, %u , i);
+   fprintf (dump_file,  %u, i);
  fprintf (dump_file, \n);
}
 
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index fdebe47..ddb1ba6 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -2462,11 +2462,11 @@ print_scc (FILE *out, VEC (tree, heap) *scc)
   tree var;
   unsigned int i;
 
-  fprintf (out, SCC consists of: );
+  fprintf (out, SCC consists of:);
   FOR_EACH_VEC_ELT (tree, scc, i, var)
 {
-  print_generic_expr (out, var, 0);
   fprintf (out,  );
+  print_generic_expr (out, var, 0);
 }
   fprintf (out, \n);
 }
-- 
1.7.9



[PATCH 1/5] invoke.texi: remove duplicate pass-flag entries

2012-02-23 Thread Bernhard Reutner-Fischer
gcc/ChangeLog

2012-02-23  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* doc/invoke.texi (-fdse, -fdce): Remove duplicate entries.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/doc/invoke.texi |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 7562273..6cb80cb 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -356,8 +356,8 @@ Objective-C and Objective-C++ Dialects}.
 -fcompare-elim -fcprop-registers -fcrossjumping @gol
 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
 -fcx-limited-range @gol
--fdata-sections -fdce -fdce -fdelayed-branch @gol
--fdelete-null-pointer-checks -fdse -fdevirtualize -fdse @gol
+-fdata-sections -fdce -fdelayed-branch @gol
+-fdelete-null-pointer-checks -fdevirtualize -fdse @gol
 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} 
@gol
 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
-- 
1.7.9



Re: [PATCH 2/5] passes.texi: Fix typo in Full redundancy elimination

2012-02-23 Thread Bernhard Reutner-Fischer
On 23 February 2012 22:33, Joseph S. Myers jos...@codesourcery.com wrote:
 On Thu, 23 Feb 2012, Bernhard Reutner-Fischer wrote:

 gcc/ChangeLog

 2012-02-23  Bernhard Reutner-Fischer  al...@gcc.gnu.org

       * doc/passes.texi (Full redundancy elimination): Fix typo.

 Should be committed as obvious.

Presumably the same for the rest of these 5 obvious trivia that, btw,
were bootstrapped and successfully regtested on x86_64-linux-gnu with
--enable-languages=c,fortran,lto,c++ which i forgot to mention.


Re: [PATCH 3/5] tree-if-conv: Commentary typo fix

2012-02-24 Thread Bernhard Reutner-Fischer
On Thu, Feb 23, 2012 at 07:21:29PM +0100, Bernhard Reutner-Fischer wrote:
gcc/ChangeLog:

2012-02-23  Bernhard Reutner-Fischer  al...@gcc.gnu.org

   * tree-if-conv (predicate_scalar_phi): Commentary typo fix.

Applied to trunk as obvious as r184546.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/tree-if-conv.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index cdbbe5b..ca9503f 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1262,7 +1262,7 @@ find_phi_replacement_condition (struct loop *loop,
arguments.
 
For example,
- S1: A = PHI x1(1), x2(5)
+ S1: A = PHI x1(1), x2(5)
is converted into,
  S2: A = cond ? x1 : x2;
 
-- 
1.7.9



[PATCH 2/2] document gcc --help=common

2012-02-27 Thread Bernhard Reutner-Fischer
From: Bernhard Reutner-Fischer bernhard.reutner-fisc...@univie.ac.at

gcc/ChangeLog:
2010-01-03  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* gcc.c (display_help): Document --help=common and sort entries
alphabetically.

Signed-off-by: Bernhard Reutner-Fischer bernhard.reutner-fisc...@univie.ac.at
---
 gcc/gcc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 2fc3b21..1c408a4 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2976,7 +2976,7 @@ display_help (void)
   fputs (_(  -pass-exit-codes Exit with highest error code from a 
phase\n), stdout);
   fputs (_(  --help   Display this information\n), stdout);
   fputs (_(  --target-helpDisplay target specific command line 
options\n), stdout);
-  fputs (_(  
--help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]\n),
 stdout);
+  fputs (_(  
--help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...]\n),
 stdout);
   fputs (_(   Display specific types of command line 
options\n), stdout);
   if (! verbose_flag)
 fputs (_(  (Use '-v --help' to display command line options of 
sub-processes)\n), stdout);
-- 
1.7.9



[PATCH 1/2] install.texi: document language-specific check- shortcuts

2012-02-27 Thread Bernhard Reutner-Fischer
From: Bernhard Reutner-Fischer bernhard.reutner-fisc...@univie.ac.at

gcc/ChangeLog:

2009-07-29  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* gcc/doc/install.texi: Document check-$LANG specific shortcuts

Signed-off-by: Bernhard Reutner-Fischer bernhard.reutner-fisc...@univie.ac.at
---
 gcc/doc/install.texi |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 8a83d9b..334ba1f 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2530,7 +2530,10 @@ on a simulator as described at 
@uref{http://gcc.gnu.org/simtest-howto.html}.
 @section How can you run the testsuite on selected tests?
 
 In order to run sets of tests selectively, there are targets
-@samp{make check-gcc} and @samp{make check-g++}
+@samp{make check-gcc} and language specific @samp{make check-c},
+@samp{make check-c++}, @samp{make check-fortran}, @samp{make check-java},
+@samp{make check-ada}, @samp{make check-objc}, @samp{make check-obj-c++},
+@samp{make check-lto}
 in the @file{gcc} subdirectory of the object directory.  You can also
 just run @samp{make check} in a subdirectory of the object directory.
 
-- 
1.7.9



[PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-01 Thread Bernhard Reutner-Fischer
Hi,

By now we have quite some leftover modules in the testsuite, again.
Given that the previous suggestion in this thread -- to have a separate
script in contrib -- did not trigger any reaction, let me suggest the
patch below instead.

Teach the testsuite to cleanup the modules.
We do this by grepping for the module names and implicitly deleting them
when the test is finished. For the testcases that use modules from other
files we introduce a keep-modules procedure that keeps either all (,
i.e. empty list) or the given modules of the source file.

A follow-up patch would remove the now superfluous cleanup-module calls
in the remaining testcases. Since that patch is pretty big (~360k) i do
not intend to send it in but want to apply it straight to the repo (it's
just a sed '/cleanup-modules/d' on the testcases that do not occur in
the below patch).

Is it ok to reference ../doc in the ChangeLog entry below to keep the
documentation change associated with the script itself?


The patch was bootstrapped and regression tested using tcl-8.5 on
x86_64-linux-gnu with no new regressions.

Ok for trunk?
Thanks,

gcc/testsuite/ChangeLog:

2012-02-28  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* gfortran.fortran-torture/compile/compile.exp: Simplify.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* lib/gcc-dg.exp (cleanup-modules): Move to ..
* lib/fortran-modules.exp: .. this new file. Adjust users.
* ../doc/sourcebuild.texi (cleanup-modules, keep-modules): Update
documentation.
* lib/gfortran-dg.exp (gfortran-dg-runtest,
gfortran-dg-debug-runtest): Call cleanup-modules.
* lib/fortran-torture.exp (fortran-torture-execute,
fortran-torture): Likewise.
* gfortran.dg/coarray/caf.exp: Likewise.
* lib/lto.exp: Likewise.
* gfortran.dg/class_4a.f03: Adjust cleanup-modules and keep-modules.
* gfortran.dg/class_4b.f03: Likewise.
* gfortran.dg/class_4c.f03: Likewise.
* gfortran.dg/class_45a.f03: Likewise.
* gfortran.dg/binding_label_tests_10.f03: Likewise.
* gfortran.dg/binding_label_tests_10_main.f03: Likewise.
* gfortran.dg/binding_label_tests_11.f03: Likewise.
* gfortran.dg/binding_label_tests_11_main.f03: Likewise.
* gfortran.dg/binding_label_tests_13.f03: Likewise.
* gfortran.dg/binding_label_tests_13_main.f03: Likewise.
* gfortran.dg/test_common_binding_labels_2.f03: Likewise.
* gfortran.dg/test_common_binding_labels_2_main.f03: Likewise.
* gfortran.dg/test_common_binding_labels_3.f03: Likewise.
* gfortran.dg/test_common_binding_labels_3_main.f03: Likewise.
* gfortran.dg/whole_file_28.f90: Likewise.
* gfortran.dg/whole_file_29.f90: Likewise.
* gfortran.dg/whole_file_30.f90: Likewise.
* gfortran.dg/whole_file_31.f90: Likewise.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/doc/sourcebuild.texi   |   35 +++-
 .../gfortran.dg/binding_label_tests_10.f03 |3 +-
 .../gfortran.dg/binding_label_tests_10_main.f03|3 +-
 .../gfortran.dg/binding_label_tests_11.f03 |3 +-
 .../gfortran.dg/binding_label_tests_11_main.f03|3 +-
 .../gfortran.dg/binding_label_tests_13.f03 |1 +
 .../gfortran.dg/binding_label_tests_13_main.f03|3 +-
 gcc/testsuite/gfortran.dg/class_45a.f03|1 +
 gcc/testsuite/gfortran.dg/class_4a.f03 |1 +
 gcc/testsuite/gfortran.dg/class_4b.f03 |1 +
 gcc/testsuite/gfortran.dg/class_4c.f03 |3 +-
 gcc/testsuite/gfortran.dg/coarray/caf.exp  |3 +
 .../gfortran.dg/test_common_binding_labels_2.f03   |2 +-
 .../test_common_binding_labels_2_main.f03  |3 +-
 .../gfortran.dg/test_common_binding_labels_3.f03   |1 +
 .../test_common_binding_labels_3_main.f03  |3 +-
 gcc/testsuite/gfortran.dg/whole_file_28.f90|1 +
 gcc/testsuite/gfortran.dg/whole_file_29.f90|2 +-
 gcc/testsuite/gfortran.dg/whole_file_30.f90|1 +
 gcc/testsuite/gfortran.dg/whole_file_31.f90|2 +-
 .../gfortran.fortran-torture/compile/compile.exp   |   65 +-
 .../gfortran.fortran-torture/execute/execute.exp   |   65 +-
 gcc/testsuite/lib/fortran-modules.exp  |   98 
 gcc/testsuite/lib/fortran-torture.exp  |5 +
 gcc/testsuite/lib/gcc-dg.exp   |8 +--
 gcc/testsuite/lib/gfortran-dg.exp  |4 +
 gcc/testsuite/lib/lto.exp  |9 ++-
 27 files changed, 172 insertions(+), 157 deletions(-)
 create mode 100644 gcc/testsuite/lib/fortran-modules.exp

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index ea6fedb..fc6f3e6 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2107,8 +2107,39 @@ Removes

Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-15 Thread Bernhard Reutner-Fischer
On Tue, Mar 13, 2012 at 01:30:29PM -0700, Mike Stump wrote:
On Mar 13, 2012, at 9:38 AM, Bernhard Reutner-Fischer wrote:
 Could some of the testsuite maintainers please eyeball?

I've eyed it, the only thing that stood out was:

-foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.F]] {
-if ![runtest_file_p $runtests $testcase] then {
-  continue
-}
-fortran-torture $testcase
-}
-
-foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.f90]] {
-if ![runtest_file_p $runtests $testcase] then {
-  continue
-}
-fortran-torture $testcase
-}

which, I hope does what you want.

It replaces a manually unrolled loop with a loop over the
testcase-extensions and works as expected. Or did you mean something
else?

Assuming you like those parts, Ok.

committed as r185430.

Since it touches non-fortran, please watch for and respond to any problems it 
might cause.

Of course, as always.

PS: I saw that the cleanup-tree-dump is also a bit redundant.
When looking at e.g. gcc/testsuite/gcc.dg/pr52578.c one would think that
scan-tree-dump-times might be able to automagically collect which
dumpfiles to cleanup as last step in dg-final.

One could go one step further and even implicitly add the corresponding
dg-options according to the expected scan-tree-dump files although this
might not be worth it iff there are passes that may produce dump-files
different to their pass name (did not look if this is possible). One
would have to strip the pass-number off the dump-file for passes that
are run more than once, too. Just a thought..

Thanks and cheers,


Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-16 Thread Bernhard Reutner-Fischer
On Thu, Mar 15, 2012 at 08:35:47PM +0100, Jakub Jelinek wrote:
On Thu, Mar 15, 2012 at 05:56:32PM +0100, Bernhard Reutner-Fischer wrote:
 On Thu, Mar 15, 2012 at 04:57:12PM +0100, Richard Guenther wrote:
 On Thu, Mar 15, 2012 at 1:39 PM, Bernhard Reutner-Fischer
 rep.dot@gmail.com wrote:
 
  committed as r185430.
 
 You forgot to add fortran-modules.exp :(
 
 committed as r185439.
 I am very sorry for that..

Even with that file in, libgomp and libitm make check still fail,
can't find fortran-modules.exp.

I have committed the attached as r185460.

The underlying problem is that dejagnu's runtest.exp only allows for a
single libdir where it searches for includes -- see comment in
libgomp.exp and libitm.exp

While just adding more and more load_gcc_lib calls to users outside of
gcc/ is the easy way out, it is (IMHO) error prone (i ran make check
just in gcc and not in toplevel, fixed my script now).

It would be desirable if dejagnu would just find all the currently
load_gcc_lib'ed files on its own, via load_lib.
One could
- teach dejagnu to treat libdir as a list of paths
- symlink gcc/testsuite/lib/* into */testsuite/config (ugly)

for reference, dejagnu's load_lib currently searches in
../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib 
$srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname 
$srcdir]]]/dejagnu/lib
Index: libitm/ChangeLog
===
--- libitm/ChangeLog	(revision 185459)
+++ libitm/ChangeLog	(revision 185460)
@@ -1,3 +1,7 @@
+2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org
+
+	* testsuite/lib/libitm.exp: load fortran-modules.exp
+
 2012-03-14  Rainer Orth  r...@cebitec.uni-bielefeld.de
 
 	* configure.tgt (*-*-irix6*): Remove.
Index: libitm/testsuite/lib/libitm.exp
===
--- libitm/testsuite/lib/libitm.exp	(revision 185459)
+++ libitm/testsuite/lib/libitm.exp	(revision 185460)
@@ -38,6 +38,7 @@
 load_gcc_lib torture-options.exp
 load_gcc_lib timeout.exp
 load_gcc_lib timeout-dg.exp
+load_gcc_lib fortran-modules.exp
 load_gcc_lib gcc-dg.exp
 
 set dg-do-what-default run
Index: libgomp/ChangeLog
===
--- libgomp/ChangeLog	(revision 185459)
+++ libgomp/ChangeLog	(revision 185460)
@@ -1,3 +1,7 @@
+2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org
+
+	* testsuite/lib/libgomp.exp: load fortran-modules.exp
+
 2012-03-14  Rainer Orth  r...@cebitec.uni-bielefeld.de
 
 	* configure.tgt (mips-sgi-irix6*): Remove.
Index: libgomp/testsuite/lib/libgomp.exp
===
--- libgomp/testsuite/lib/libgomp.exp	(revision 185459)
+++ libgomp/testsuite/lib/libgomp.exp	(revision 185460)
@@ -24,6 +24,7 @@
 load_gcc_lib torture-options.exp
 load_gcc_lib timeout.exp
 load_gcc_lib timeout-dg.exp
+load_gcc_lib fortran-modules.exp
 load_gcc_lib gcc-dg.exp
 load_gcc_lib gfortran-dg.exp
 


Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-16 Thread Bernhard Reutner-Fischer
On Fri, Mar 16, 2012 at 11:04:45AM +0100, Bernhard Reutner-Fischer wrote:

The underlying problem is that dejagnu's runtest.exp only allows for a
single libdir where it searches for includes -- see comment in
libgomp.exp and libitm.exp

While just adding more and more load_gcc_lib calls to users outside of
gcc/ is the easy way out, it is (IMHO) error prone (i ran make check
just in gcc and not in toplevel, fixed my script now).

It would be desirable if dejagnu would just find all the currently
load_gcc_lib'ed files on its own, via load_lib.
One could
- teach dejagnu to treat libdir as a list of paths

The attached works for me for a toplevel make -k check (double-checked
with individual make check in lib{gomp,itm}). I do not intend to pursue
this any further.
runtest.exp: add libdirs list for load_lib()

libgomp wants to load .exp files from ../gcc/testsuite/lib.
Instrument load_lib to be able to find the files.
Previously we used to have a helper proc that had to first load all
dependent .exp manually and then, again manually, the desired .exp.

2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org

	* runtest.exp (libdirs): New global list.
	(load_lib): Append libdirs to search_and_load_files directories.

diff --git a/runtest.exp b/runtest.exp
index 4bfed83..8e6a7de 100644
--- a/runtest.exp
+++ b/runtest.exp
@@ -589,7 +589,7 @@ proc lookfor_file { dir name } {
 # source tree, (up one or two levels), then in the current dir.
 #
 proc load_lib { file } {
-global verbose libdir srcdir base_dir execpath tool
+global verbose libdir libdirs srcdir base_dir execpath tool
 global loaded_libs
 
 if {[info exists loaded_libs($file)]} {
@@ -597,8 +597,11 @@ proc load_lib { file } {
 }
 
 set loaded_libs($file) 
-
-if { [search_and_load_file library file $file [list ../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname $srcdir]]]/dejagnu/lib]] == 0 } {
+set search_dirs [list ../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname $srcdir]]]/dejagnu/lib]
+if {[info exists libdirs]} {
+lappend search_dirs $libdirs
+}
+if { [search_and_load_file library file $file $search_dirs ] == 0 } {
 	send_error ERROR: Couldn't find library file $file.\n
 	exit 1
 }
@@ -652,6 +655,8 @@ set libdir   [file dirname $execpath]/dejagnu
 if {[info exists env(DEJAGNULIBS)]} {
 set libdir $env(DEJAGNULIBS)
 }
+# list of extra directories for load_lib
+set libdirs {}
 
 verbose Using $libdir to find libraries
 
libgomp/ChangeLog

2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org

	* testsuite/lib/libgomp.exp: Set libdirs. Remove now redundant
	manual inclusion of gfortran-dg's dependencies.

libitm/ChangeLog

2012-03-16  Bernhard Reutner-Fischer  al...@gcc.gnu.org

	* testsuite/lib/libitm.exp: Set libdirs. Remove now redundant
	manual inclusion of gcc-dg's dependencies.


diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 02909f8..54e1e652 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -1,32 +1,12 @@
-# Damn dejagnu for not having proper library search paths for load_lib.
-# We have to explicitly load everything that gcc-dg.exp wants to load.
+global libdirs
+lappend libdirs $srcdir/../../gcc/testsuite/lib
 
-proc load_gcc_lib { filename } {
-global srcdir loaded_libs
+load_lib dg.exp
 
-load_file $srcdir/../../gcc/testsuite/lib/$filename
-set loaded_libs($filename) 
-}
+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!
+load_lib gcc-defs.exp
 
-load_lib dg.exp
-load_gcc_lib file-format.exp
-load_gcc_lib target-supports.exp
-load_gcc_lib target-supports-dg.exp
-load_gcc_lib scanasm.exp
-load_gcc_lib scandump.exp
-load_gcc_lib scanrtl.exp
-load_gcc_lib scantree.exp
-load_gcc_lib scanipa.exp
-load_gcc_lib prune.exp
-load_gcc_lib target-libpath.exp
-load_gcc_lib wrapper.exp
-load_gcc_lib gcc-defs.exp
-load_gcc_lib torture-options.exp
-load_gcc_lib timeout.exp
-load_gcc_lib timeout-dg.exp
-load_gcc_lib fortran-modules.exp
-load_gcc_lib gcc-dg.exp
-load_gcc_lib gfortran-dg.exp
+load_lib gfortran-dg.exp
 
 set dg-do-what-default run
 
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index f322ed5..1ac8f31 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -12,34 +12,15 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-# Damn dejagnu for not having proper library search paths for load_lib.
-# We have to explicitly load everything that gcc-dg.exp wants to load.
+global libdirs
+lappend libdirs $srcdir/../../gcc/testsuite/lib
 
-proc load_gcc_lib { filename } {
-global srcdir loaded_libs
+load_lib dg.exp

Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-22 Thread Bernhard Reutner-Fischer
On Mon, Mar 19, 2012 at 06:36:12PM +0100, Rainer Orth wrote:

Unfortunately, this patch creates a bogus warning in the libgomp
testsuite, which also shows up in mail-report.log:

WARNING: Line 30 includes unreadable file 
\`/vol/gcc/src/hg/trunk/local/libgomp/testsuite/libgomp.fortran/omp_lib.h'

fortran-modules.exp (list-module-names-1) assumes that included files
are relative to the source, but omp_lib.h is a generated file and lives
in $objdir, and is found at compile time via -I switches.

fortran-modules does not (currently) use include-dir search path logic
to find include files.

Besides, the message is less than helpful since it gives no indication
as to which files includes the missing one.

RUNTESTFLAGS='-v -v' (for example) shows the testcase that it currently
works on, as you know.

Please fix.

I have removed the unwarranted warning after successful (1) toplevel
regtesting and committed it as r185688.

The second part of the implicit cleanup-modules would be to remove
the now superfluous manual cleanup-modules calls.

Something like this, ran in the sourcedir removes those:
(cd gcc/testsuite  grep -rl cleanup-modules * | \
 egrep -v 
(\.exp|ChangeLog|\.svn|gfortran.dg/(class_4(a|b|c|5a).f03|binding_label_tests_1(0|1|1_main|3|3_main).f03|test_common_binding_labels_(2|2_main|3|3_main).f03|whole_file_(28|29|30|31).f90))
 | \
 while read f;do \
   sed -i -e ':crap' -e '/cleanup-modules/d' -e '/^\n*$/{$d;N;bcrap' -e '}' $f; 
\
 done)

1) Completely unrelated bug in the testsuite showed up as 2 regressions
in the above testing. I have filed that as gcc.gnu.org/PR52665


Re: [PATCH] Convert more passes to new dump framework

2013-08-31 Thread Bernhard Reutner-Fischer

On 30 August 2013 23:23:16 Teresa Johnson tejohn...@google.com wrote:

On Fri, Aug 30, 2013 at 1:30 PM, Xinliang David Li davi...@google.com wrote:
 On Fri, Aug 30, 2013 at 12:51 PM, Teresa Johnson tejohn...@google.com 
wrote:
 On Fri, Aug 30, 2013 at 9:27 AM, Xinliang David Li davi...@google.com 
wrote:

 Except that in this form, the dump will be extremely large and not
 suitable for very large applications.

 Yes. I did some measurements for both a fairly large source file that
 is heavily optimized with LIPO and for a simple toy example that has
 some inlining. For the large source file, the output from
 -fdump-ipa-inline=stderr was almost 100x the line count of the
 -fopt-info output. For the toy source file it was 43x. The size of the
 -details output was 250x and 100x, respectively. Which is untenable
 for a large app.

 The issue I am having here is that I want a more verbose message, not
 a more voluminous set of messages. Using either -fopt-info-all or
 -fdump-ipa-inline to provoke the more verbose inline message will give
 me a much greater volume of output.

 One compromise could be to emit the more verbose inliner message under
 a param (and a more concise foo inlined into bar by default with
 -fopt-info). Or we could do some variant of what David talks about
 below.

 something like --param=verbose-opt-info=1

Yes. Richard, would this be acceptable for now?

i.e. the inliner messages would be like:

-fopt-info:
   test.c:8:3: note: foobar inlined into foo with call count 9000
(the with call count X only when there is profile feedback)

-fopt-info --param=verbose-opt-info=1:
   test.c:8:3: note: foobar/0 (9000) inlined into foo/2 (1000)
with call count 9000 (via inline instance bar [3] (9000))
(again the call counts only emitted under profile feedback)


Assuming the [3] is order, please change that to match what the in liner 
uses, I.e. /3


Thanks





 Besides, we might also want to
 use the same machinery (dump_printf_loc etc) for dump file dumping.
 The current behavior of using '-details' to turn on opt-info-all
 messages for dump files are not desirable.

 Interestingly, this doesn't even work. When I do
 -fdump-ipa-inline-details=stderr (with my patch containing the inliner
 messages) I am not getting those inliner messages emitted to stderr.
 Even though in dumpfile.c details is set to (TDF_DETAILS |
 MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION | MSG_NOTE). I'm not
 sure why, but will need to debug this.

 It works for vectorizer pass.

Ok, let me see what is going on - I just confirmed that it is not
working for the loop unroller messages either.



 How about the following:

 1) add a new dump_kind modifier so that when that modifier is
 specified, the messages won't goto the alt_dumpfile (controlled by
 -fopt-info), but only to primary dump file. With this, the inline
 messages can be dumped via:

dump_printf_loc (OPT_OPTIMIZED_LOCATIONS | OPT_DUMP_FILE_ONLY, .)

 (you mean (MSG_OPTIMIZED_LOCATIONS | OPT_DUMP_FILE_ONLY) )


 Yes.

 Typically OR-ing together flags like this indicates dump under any of
 those conditions. But we could implement special handling for
 OPT_DUMP_FILE_ONLY, which in the above case would mean dump only to
 the primary dump file, and only under the other conditions specified
 in the flag (here under -optimized)



 2) add more flags in -fdump- support:

-fdump-ipa-inline-opt   -- turn on opt-info messages only
-fdump-ipa-inline-optall -- turn on opt-info-all messages

 According to the documentation (see the -fdump-tree- documentation on
 http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options),
 the above are already supposed to be there (-optimized, -missed, -note
 and -optall). However, specifying any of these gives a warning like:
cc1: warning: ignoring unknown option ‘optimized’ in
 ‘-fdump-ipa-inline’ [enabled by default]
 Probably because none is listed in the dump_options[] array in dumpfile.c.

 However, I don't think there is currently a way to use -fdump- options
 and *only* get one of these, as much of the current dump output is
 emitted whenever there is a dump_file defined. Until everything is
 migrated to the new framework it may be difficult to get this to work.

-fdump-tree-pre-ir -- turn on GIMPLE dump only
-fdump-tree-pre-details -- turn on everything (ir, optall, trace)

 With this, developers can really just use


 -fdump-ipa-inline-opt=stderr for inline messages.

 Yes, if we can figure out a good way to get this to work (i.e. only
 emit the optimized messages and not the rest of the dump messages).
 And unfortunately to get them all you need to specify
 -fdump-ipa-all-optimized -fdump-tree-all-optimized
 -fdump-rtl-all-optimized instead of just -fopt-info. Unless we can
 add -fdump-all-all-optimized.

 Having general support requires cleanup of all the old style  if
 (dump_file) fprintf (dump_file, ...) instances to be:

   if (dump_enabled_p ())
 dump_printf 

Re: Remove hash from remember_with_vars

2013-08-31 Thread Bernhard Reutner-Fischer

On 31 August 2013 19:15:46 Richard Biener rguent...@suse.de wrote:

Jan Hubicka hubi...@ucw.cz wrote:
Hi,
remember_with_vars walks trees that are read from file (now unique)
and looks for fields that can contain pointers to vars or functions and
if so, it records them to global hashtable for later fixup.
This is quite wasteful, because the hash is querried many times.
We can simply walk all fields in a tree and record the tree once
afterwards,
moreover since streaming knows when tree is newly constructed, we don't
need
hash.

Vectors do not allow deletable elements, but I think it makes no
difference:
the trees are all used from decl states.

Heh, indeed a cleanup possibility I missed.

Ok.


s/Trun/Turn/g
?
Thanks

Thanks,
Richard.

* lot.c (tree_with_vars): Turn into vector.
(MAYBE_REMEMBER_WITH_VARS): Change to...
(CHECK_VAR): ... this one.
(CHECK_NO_VAR): New macro.
(maybe_remember_with_vars_typed): Trun to ...
(mentions_vars_p_typed): ... this one.
(maybe_remember_with_vars_common): Trun to ...
(mentions_vars_p_comon): ... this one.
(maybe_remember_with_vars_decl_minimal): Trun to ...
(mentions_vars_p_decl_minmal): ... this one.
(maybe_remember_with_vars_decl_common): Trun to ...
(mentions_vars_p_decl_common): ... this one.
(maybe_remember_with_vars_decl_with_vis): Trun to ...
(mentions_vars_p_decl_with_vis): ... this one.
(maybe_remember_with_vars_decl_non_common): Trun to ...
(mentions_vars_p_decl_non_common): ... this one.
(maybe_remember_with_vars_function): Trun to ...
(mentions_vars_p_function): ... this one.
(maybe_remember_with_vars_field_decl): Trun to ...
(mentions_vars_p_field_decl): ... this one.
(maybe_remember_with_vars_type): Trun to ...
(mentions_vars_p_type): ... this one.
(maybe_remember_with_vars_binfo): Trun to ...
(mentions_vars_p_binfo): ... this one.
(maybe_remember_with_vars_constructor): Trun to ...
(mentions_vars_p_constructor): ... this one.
(maybe_remember_with_vars_expr): Trun to ...
(mentions_vars_p_expr): ... this one.
(maybe_remember_with_vars): Trun to ...
(mentions_vars_p): ... this one.
(lto_read_decls): Update.
(LTO_SET_PREVAIL): Do not call function for internal decls.
(lto_fixup_prevailing_decls): Update to match mentions_vars_p;
check that something was updated.
(lto_fixup_state): Do not care about internal decls.
(lto_fixup_decls): Update.
(read_cgraph_and_symbols): Update.



Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] Fixing improper conversion from sin() to sinf() in optimization mode.

2013-09-03 Thread Bernhard Reutner-Fischer

On 4 September 2013 00:17:00 Cong Hou co...@google.com wrote:

Could you please tell me how to check the precision of long double in
GCC on different platforms?


I did not follow your discussion but..
http://uclibc.org/~aldot/precision_check.f

Or something along those lines in your favourite language.
HTH..

Thank you!


Cong



Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] Enable non-complex math builtins from C99 for Bionic

2013-09-05 Thread Bernhard Reutner-Fischer

On 5 September 2013 13:02:29 Kirill Yukhin kirill.yuk...@gmail.com wrote:

Hello,
On 04 Sep 20:11, Maxim Kuvyrkov wrote:
 On 4/09/2013, at 7:43 PM, Alexander Ivchenko wrote:
 The patch is OK with definitions of OPTION_GLIBC, OPTION_UCLIBC and 
OPTION_BIONIC copied verbatim from gcc/config/l


Checked into main trunk: http://gcc.gnu.org/ml/gcc-cvs/2013-09/msg00137.html



Unless i am missing something crucial I am not really convinced that this 
bionic support stuff you guys are aiming at is proper, to be defensive..


uClibc has C99 math support optionally as well as other optional, 
nonstandard feature sets. Your patch does not seem to check (in a 
cross-compilable fashion, of course) if C99 math is supported in libc or 
not, thus regressing on uClibc with C99_MATH enabled.


Please revert this patch and handle your libc in a sensible manner as 
everyone else has to since years.. I.e. either be C99 complete or fixup 
your conditions, ideally in the public port.


Thanks,


--
Thanks, K



Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] Fix PR58554

2013-10-01 Thread Bernhard Reutner-Fischer

On 30 September 2013 14:19:01 Richard Biener rguent...@suse.de wrote:


This fixes PR58554, pattern recognition in loop distribution now
needs to check whether all stmts are unconditionally executed.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2013-09-30  Richard Biener  rguent...@suse.de

PR tree-optimization/58554
* tree-loop-distribution.c (classify_partition): Require unconditionally
executed stores for memcpy and memset recognition.
(tree_loop_distribution): Calculate dominance info.

* gcc.dg/torture/pr58554.c: New testcase.

Index: gcc/tree-loop-distribution.c



*** out:
*** 1719,1724 
--- 1723,1729 
{
  if (!cd)
{
+ calculate_dominance_info (CDI_DOMINATORS);
  calculate_dominance_info (CDI_POST_DOMINATORS);
  cd = new control_dependences (create_edge_list ());
  free_dominance_info (CDI_POST_DOMINATORS);


Don't you have to free CDI_DOMINATORS too now, somewhere?

Thanks,

Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [wide-int] int_traits tree

2013-10-19 Thread Bernhard Reutner-Fischer

On 18 October 2013 22:55:39 Jakub Jelinek ja...@redhat.com wrote:

On Fri, Oct 18, 2013 at 01:52:54PM -0700, Mike Stump wrote:
 On Oct 18, 2013, at 6:11 AM, Kenneth Zadeck zad...@naturalbridge.com wrote:
  Does this look ok?  Kenny, can you double check the cases, think I 
have them right, but?  a double check would be good.

  That works for me.
   i talked to mike about this last night, but did not follow up with 
an email until now.   The problem is that this code is wrong!!!   He is 
working to fix that and so i would expect something from him later 
(tomorrow for those in europe).

 Ok, updated the patch, here is what I checked in:

 diff --git a/gcc/wide-int.h b/gcc/wide-int.h
 index 2ff130b..738ae11 100644
 --- a/gcc/wide-int.h
 +++ b/gcc/wide-int.h
 @@ -185,7 +185,9 @@ along with GCC; see the file COPYING3.  If not see
   assuming t is a int_cst.
 -   Note that the bits above the precision are not defined and the
 +   Note, the bits past the precision up to the nearest HOST_WDE_INT

WIDE?


s/positve/positive/g
falls into the same category, without commenting on the patch itself.
Thanks,


Jakub




Sent with AquaMail for Android
http://www.aqua-mail.com




[RFC/CFT] auto-wipe dump files [was: Re: [committed] Fix up bb-slp-31.c testcase]

2013-10-30 Thread Bernhard Reutner-Fischer
 Hi!

 I've noticed that this testcase doesn't clean up after itself.
 Fixed thusly, committed as obvious to trunk.

This was nagging me last weekend.. ;)
What about automating this?

Manual part is attached.
The Adjust all callers below is too big to send to the list:
git grep -l -E (cleanup-.*-dump|cleanup-saved-temps) | \
egrep -v (ChangeLog|/lib/) | sed -e s|[^/]*$|| | sort | uniq | \
while read d;
do
  find $d -type f \
-exec sed -i -e /cleanup-[^-]*[-]*dump/d;/cleanup-saved-temps/d {} +
done


Full regstrap on x86_64-unknown-linux-gnu with no regressions with
trunk@204119 for
configure \
--enable-bootstrap \
--with-system-zlib \
--without-included-gettext \
--disable-werror \
--enable-link-mutex \
--enable-nls \
--enable-plugin \
--enable-__cxa_atexit \
--enable-debug \
--enable-checking=yes,rtl \
--enable-gather-detailed-mem-stats \
--enable-multilib \
--enable-multiarch \
--with-linker-hash-style=both \
--with-as=$BINU/as \
--with-ld=$BINU/ld.gold \
--enable-languages=c,c++,fortran,lto,go,objc,obj-c++ \
 make -k check -j4

Ok for trunk?
Comments?

Given the Fix comment delimiter hunks in the manual patch, i'd suggest
to add -Wcomment as default flags where possible to catch these early on
in the future.

gcc/testsuite/ChangeLog

2013-10-12  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* lib/gcc-dg.exp (cleanup-ipa-dump, cleanup-rtl-dump,
cleanup-tree-dump, cleanup-dump): Remove. Adjust all callers.
(schedule-cleanups): New proc.
(gcc-dg-test-1): Call it.
* lib/profopt.exp (profopt-execute): Likewise.
* g++.dg/cdce3.C: Adjust expected line numbers.
* gcc.dg/cdce1.c: Likewise.
* gcc.dg/cdce2.c: Likewise.
* gcc.dg/strlenopt-22.c: Fix comment delimiter.
* gcc.dg/strlenopt-24.c: Likewise.
* gcc.dg/tree-ssa/vrp26.c: Likewise.
* gcc.dg/tree-ssa/vrp28.c: Likewise.
* obj-c++.dg/encode-2.mm: Likewise.

libgomp/ChangeLog

2013-10-12  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* testsuite/libgomp.graphite/bounds.c: Adjust for
cleanup-tree-dump removal.
* testsuite/libgomp.graphite/force-parallel-1.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-2.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-3.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-4.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-5.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-6.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-7.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-8.c: Likewise.
* testsuite/libgomp.graphite/force-parallel-9.c: Likewise.
* testsuite/libgomp.graphite/pr41118.c: Likewise.


gcc/ChangeLog

2013-10-12  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* config/arm/neon-testgen.ml (emit_epilogue): Remove manual call
to cleanup-saved-temps.

gcc/doc/ChangeLog

2013-10-12  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* doc/sourcebuild.texi (Clean up generated test files): Expand
introduction.
(cleanup-ipa-dump, cleanup-rtl-dump, cleanup-tree-dump,
cleanup-saved-temps): Remove.
From dc181880947cbfb3d652c6d9530cea07cf8280d8 Mon Sep 17 00:00:00 2001
From: Bernhard Reutner-Fischer rep.dot@gmail.com
Date: Fri, 18 Oct 2013 21:08:49 +0200
Subject: [PATCH] auto-wipe dump files

---
 gcc/config/arm/neon-testgen.ml|   1 -
 gcc/doc/sourcebuild.texi  |  19 ++--
 gcc/testsuite/g++.dg/cdce3.C  |   5 +-
 gcc/testsuite/gcc.dg/cdce1.c  |   3 +-
 gcc/testsuite/gcc.dg/cdce2.c  |   3 +-
 gcc/testsuite/gcc.dg/strlenopt-22.c   |   3 +-
 gcc/testsuite/gcc.dg/strlenopt-24.c   |   3 +-
 gcc/testsuite/gcc.dg/tree-ssa/vrp26.c |   3 +-
 gcc/testsuite/gcc.dg/tree-ssa/vrp28.c |   3 +-
 gcc/testsuite/lib/dg-pch.exp  |  18 +++-
 gcc/testsuite/lib/gcc-dg.exp  | 160 --
 gcc/testsuite/lib/profopt.exp |   3 +
 gcc/testsuite/obj-c++.dg/encode-2.mm  |   3 +-
 13 files changed, 151 insertions(+), 76 deletions(-)

diff --git a/gcc/config/arm/neon-testgen.ml b/gcc/config/arm/neon-testgen.ml
index 543318b..4734ac0 100644
--- a/gcc/config/arm/neon-testgen.ml
+++ b/gcc/config/arm/neon-testgen.ml
@@ -139,7 +139,6 @@ let emit_epilogue chan features regexps =
  else
()
 );
-Printf.fprintf chan /* { dg-final { cleanup-saved-temps } } */\n
 
 (* Check a list of C types to determine which ones are pointers and which
ones are const.  *)
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 1a70916..7e0ebd9 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2145,13 +2145,17 @@ Check branch and/or call counts, in addition to line counts, in
 
 @subsubsection Clean up generated test files
 
+Usually the test-framework removes files that were generated during
+testing. If a testcase, for example, uses any

[PATCH C++/testsuite] Remove pchtest check objects and compile with current tool

2013-10-30 Thread Bernhard Reutner-Fischer
Hi,

The pch-init leaves check objects lying around, remove them.

While at it, i noticed that i was getting warnings from the check since
it was invoced with xg++ -nostdinc++ on C source (in one of the two
iterations the check is run -- once per tool).
My suggestion is to use the correct tool to perform the pch check. Does
that make sense to you?

Regstrapped (together with the auto-removal patch just sent) on
x86_64-unknown-linux-gnu with trunk@204119 without regressions.

Ok for trunk?

gcc/testsuite/ChangeLog

2013-10-12  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* lib/dg-pch.exp (pch-init): Remove pchtest check objects.
Compile pchtest with current tool.
diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp
index d82c669..41de454 100644
--- a/gcc/testsuite/lib/dg-pch.exp
+++ b/gcc/testsuite/lib/dg-pch.exp
@@ -18,6 +18,18 @@ load_lib copy-file.exp
 
 proc pch-init { args } {
 global pch_unsupported_debug pch_unsupported
+global tool
+
+set chk_content 
+set chk_lang c-header
+switch -- $tool {
+	g++ {
+		set chk_content // C++
+		set chk_lang c++-header
+	  }
+}
+append chk_content \nint i;
+set chk_lang -x $chk_lang
 
 if [info exists pch_unsupported_debug] {
 	error pch-init: pch_unsupported_debug is not empty as expected
@@ -26,20 +38,22 @@ proc pch-init { args } {
 	error pch-init: pch_unsupported is not empty as expected
 }
 
-set result [check_compile pchtest object int i; -g -x c-header]
+set result [check_compile pchtest object $chk_content -g $chk_lang]
 set pch_unsupported_debug \
 	[regexp debug format cannot be used with pre-compiled headers \
 		[lindex $result 0]]
+remove-build-file [lindex $result 1]
 
 set pch_unsupported 0
 if { $pch_unsupported_debug } {
 	verbose -log pch is unsupported with the debug info format
 
-	set result [check_compile pchtest object int i; -x c-header]
+	set result [check_compile pchtest object $chk_type $chk_lang]
 	set pch_unsupported \
 		[regexp debug format cannot be used with pre-compiled headers \
 			[lindex $result 0]]
 }
+remove-build-file [lindex $result 1]
 }
 
 proc pch-finish { args } {


Re: [PATCH C++/testsuite] Remove pchtest check objects and compile with current tool

2013-10-30 Thread Bernhard Reutner-Fischer
On 30 October 2013 22:47, Mike Stump mikest...@comcast.net wrote:
 On Oct 30, 2013, at 2:56 AM, Bernhard Reutner-Fischer rep.dot@gmail.com 
 wrote:
 - set result [check_compile pchtest object int i; -x c-header]
 + set result [check_compile pchtest object $chk_type $chk_lang]

 the patch uses chk_type, but, I can't find where it is being set?

hmz yea, that should read $chk_content

 Was there a significant purpose for the added C++ comment?  If not, can you 
 remove that?  If so, can you explain?

grep -A9 CONTENTS is gcc/testsuite/lib/target-supports.exp
# Assume by default that CONTENTS is C code.
# Otherwise, code should contain:
# // C++ for c++,
# ! Fortran for Fortran code,
# /* ObjC, for ObjC
# // ObjC++ for ObjC++
# and // Go for Go
# If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
# allow for ObjC/ObjC++ specific flags.
proc check_compile {basename type contents args} {

 Last question I have is the remove-build-file primitive.  I'm wondering on a 
 canadian cross, are the files left over on the build machine, the host 
 machine or both the build machine and the host machine?

I don't really remember, i didn't run canadian cross tests on remote
boxes since ages, TBH.

 I see people use remote_file build delete …, file_on_host delete and 
 remove-build-file.  Some folks even use the plain file delete.  I'd hate to 
 guess which one you need, it hurts my brain.  I think remove-build-file is 
 safe; just don't know if it is best.

remove-build-file certainly wipes it from everywhere so seems the safe bet.
But yes, for this specific pchtest.o's one could refine the delete to
the appropriate build or host. I would think that using plain delete
is wrong everywhere though.

 Anyone else want to weigh in?


Re: [RFC/CFT] auto-wipe dump files [was: Re: [committed] Fix up bb-slp-31.c testcase]

2013-10-31 Thread Bernhard Reutner-Fischer
On 31 October 2013 01:01, Mike Stump mikest...@comcast.net wrote:
 On Oct 30, 2013, at 2:41 AM, Bernhard Reutner-Fischer rep.dot@gmail.com 
 wrote:
 I've noticed that this testcase doesn't clean up after itself.

 This was nagging me last weekend.. ;)
 What about automating this?

 So, the idea sounds very nice.

 One thing that I worry about is the testing speed hit for people (test cases) 
 that don't need cleanups.  I don't know the speed hit of the code, so, don't 
 know how necessary it is to try and go faster.

 I was thinking the presence of a scan-tree-dump, would set a bit that said, 
 do a scan-tree-dump style cleanup.

Well, since the -fdump-* are the one to produce the dumps, i keyed the
cleanup off that.
Initially i had the idea to use an exact per-pass wiper but that
turned out to be too complicated for no real benefit.

 The common code then does, if cleanups needed, do cleanups

 The idea, most test cases don't do this, and don't need the big cleanup 
 routine to fire.  A scan-tree-dump would setup a cleanup tree dumps flags, 
 and then in the big cleanup routine, you have:

The cleanup routine would currently run 7 regexes on the incoming
compiler-flags which is supposedly pretty fast.
But yes, we could as well key off scan-dump. If we do that, i'd
suggest to simply wipe all potential dumps, regardless of the family
etc, like:
$ltrans\[0-9\]\[0-9\]\[0-9\][itr].*
What do you think?

 do cleanups()
 {
 if (need tree cleanups) do tree cleanups();
 if (need rtl cleanups) do rtl cleanups();
 }

 this way, we avoid randomly doing cleanups for things we don't need them for, 
 and avoid even asking if we need any cleanups, as we can have a global flag 
 that says if we need any extra, special cleanups.

 So, all that would be bad to do, if the speed hit is small…  Can you collect 
 with/without numbers and post them?  If you can, include user, sys and 
 elapsed.  You can run a subset of one testsuite, say, dg.exp, as 
 representative.

The pristine trunk, i.e. with manual cleanup was a couple of seconds
slower than with the patch (10s or 20s IIRC, let me measure this on an
idle box again now).
As you can see, the number of globs before and after the patch
decreases quite a lot, i guess the fact that we glob less is
responsible for the improved runtime. Let me double-check that,
though.

thanks,


Re: [PATCH C++/testsuite] Remove pchtest check objects and compile with current tool

2013-10-31 Thread Bernhard Reutner-Fischer
On 30 October 2013 23:22, Mike Stump mikest...@comcast.net wrote:
 On Oct 30, 2013, at 3:14 PM, Bernhard Reutner-Fischer rep.dot@gmail.com 
 wrote:
 On 30 October 2013 22:47, Mike Stump mikest...@comcast.net wrote:

 Was there a significant purpose for the added C++ comment?  If not, can you 
 remove that?  If so, can you explain?

 grep -A9 CONTENTS is gcc/testsuite/lib/target-supports.exp
 # Assume by default that CONTENTS is C code.
 # Otherwise, code should contain:
 # // C++ for c++,
 # ! Fortran for Fortran code,
 # /* ObjC, for ObjC
 # // ObjC++ for ObjC++
 # and // Go for Go
 # If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
 # allow for ObjC/ObjC++ specific flags.
 proc check_compile {basename type contents args} {

 Ah, but this is why I asked for a significant purpose?  The language of the 
 file selects the options (flags) allowed.  The language is set in your code.  
 I think it was part of trying different ways to fix it, but, it turned out to 
 be neither necessary or sufficient in the end.

Not sure about any significant purpose, no.
I found it odd that the check did not attempt to obtain a result
without knowingly provoking an odd warning, hence these chk_ stuff.
So, what do you want me to do? I want to delete the test objects and i
don't really care if remove-build-file overdoes it or not..
pch usually fails for my crosses anyway so is disabled in the first place :P

Are you saying that these CONTENT stuff should be nuked altogether
and/or the pchtest stanza be kept as is and/or the stanza be cut to
only fire for tool==g++ ?

thanks,


Re: [PATCH 1/3] libgcc: check for fenv.h in dfp configure check

2013-11-08 Thread Bernhard Reutner-Fischer
On 4 April 2013 23:01, Ian Lance Taylor i...@google.com wrote:
 On Thu, Apr 4, 2013 at 12:53 PM, Bernhard Reutner-Fischer
 rep.dot@gmail.com wrote:

 2013-03-24  Bernhard Reutner-Fischer  al...@gcc.gnu.org

 * configure.ac (libgcc_cv_dfp): Extend check to probe fenv.h
 availability.
 * configure: Regenerate

 This is OK.

Applied just now as r204562.
thanks,


Re: [PATCH 2/3] libstdc++-v3: ::tmpnam depends on uClibc SUSV4_LEGACY

2013-11-08 Thread Bernhard Reutner-Fischer
On 11 April 2013 14:18, Paolo Carlini paolo.carl...@oracle.com wrote:
 Hi,


 On 04/11/2013 02:04 PM, Bernhard Reutner-Fischer wrote:

 I would have expected that somebody would tell me that omitting ::tmpnam
 violates 27.9.2 cstdio from the spec but noone yelled at me yet?

 Frankly, I didn't because the targets I really care about aren't affected.
 The actual maintainers of this target should speak.

Attaching an updated patch that i was using since March (without
regressions) which takes Rainer's comments about _GLIBCXX_USE_TMPNAM
into account.
Ok for trunk?

libstdc++-v3/ChangeLog

2013-03-24  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* acinclude.m4 (GLIBCXX_CHECK_TMPNAM): New check for tmpnam
function.
* configure.ac: Use GLIBCXX_CHECK_TMPNAM.
* (configure, config.h.in): Regenerate.
* include/c_global/cstdio: Guard ::tmpnam with _GLIBCXX_USE_TMPNAM


commit-6f2faa2
Description: Binary data


Re: [PATCH] fixincludes: use $(FI) instead of fixincl@EXEEXT@

2013-11-08 Thread Bernhard Reutner-Fischer
On 4 April 2013 22:20, Bruce Korb bk...@gnu.org wrote:
 Except as noted below, fine by me.

 On 04/04/13 12:56, Bernhard Reutner-Fischer wrote:
 Bootstrapped and regtested on x86_64-unknown-linux-gnu and
 x86_64-mine-linux-uclibc without regressions, ok for trunk?

 fixincludes/ChangeLog:

 2013-04-04  Bernhard Reutner-Fischer  al...@gcc.gnu.org

   Makefile.in: Use $(FI) instead of fixincl@EXEEXT@.
   Cleanup whitespace while at it.

 Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
 ---
  fixincludes/Makefile.in |   10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

 diff --git a/fixincludes/Makefile.in b/fixincludes/Makefile.in
 index ce850ff..3dc869d 100644
 --- a/fixincludes/Makefile.in
 +++ b/fixincludes/Makefile.in
 @@ -131,7 +131,7 @@ fixinc.sh : fixinc.in mkfixinc.sh Makefile
  $(srcdir)/fixincl.x: @MAINT@ fixincl.tpl inclhack.def
   cd $(srcdir) ; $(SHELL) ./genfixes

 -mostlyclean :
 +mostlyclean:

 I see no reason for changing things.

dropped this hunk.

 But if you are going to clean up the colons, then they should
 be in columns (mostly 12 or 16).  This one is already in 12.

   rm -f *.o *-stamp $(AF) $(FI) *~ fixinc.sh

  clean: mostlyclean
 @@ -179,18 +179,18 @@ check : all

  install : all
   -rm -rf $(DESTDIR)$(itoolsdir)
 - $(mkinstalldirs) $(DESTDIR)$(itoolsdir)
 + $(mkinstalldirs) $(DESTDIR)$(itoolsdir)
   $(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include
   $(INSTALL_DATA) $(srcdir)/README-fixinc \
 $(DESTDIR)$(itoolsdatadir)/include/README
   $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh
 - $(INSTALL_PROGRAM) fixincl@EXEEXT@ \
 -   $(DESTDIR)$(itoolsdir)/fixincl@EXEEXT@
 + $(INSTALL_PROGRAM) $(FI) \
 +   $(DESTDIR)$(itoolsdir)/$(FI)

 This should now fit on a single line.

ok

   $(INSTALL_SCRIPT) mkheaders $(DESTDIR)$(itoolsdir)/mkheaders

  install-strip: install
   test -z '$(STRIP)' \
 -   || $(STRIP) $(DESTDIR)$(itoolsdir)/fixincl@EXEEXT@
 +   || $(STRIP) $(DESTDIR)$(itoolsdir)/$(FI)

changed this too to be on a single line now.

  .PHONY: all check install install-strip
  .PHONY: dvi pdf info html install-pdf install-info install-html

Changelog remains the same.
II was using the attached updated patch since April, ok for trunk?


commit-8788d7c
Description: Binary data


Re: [PATCH] RE: Testsuite / Cilk Plus: Include library path in compile flags in gcc.dg/cilk-plus/cilk-plus.exp

2013-11-08 Thread Bernhard Reutner-Fischer
On 6 November 2013 08:04, Jakub Jelinek ja...@redhat.com wrote:
 On Wed, Nov 06, 2013 at 02:24:01AM +, Iyer, Balaji V wrote:
 Fixed patch is attached. The responses to your question are given below. 
 Is this patch OK?

 Here is the ChangeLog entry:

 +2013-11-05  Balaji V. Iyer  balaji.v.i...@intel.com
 +
 +   * c-c++-common/cilk-plus/CK/fib.c: Reduced the iteration from
 +   40 to 30.  Replaced iteration variable with a #define.  Instead of
 +   returning non-zero value for error, called __builtin_abort ().  Fixed
 +   a bug of calling fib_serial in serial case instead of fib.
 +   * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise.
 +   * c-c++-common/cilk-plus/CK/fib_no_return.c: Likewise.
 +   * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise.
 +   * gcc.dg/cilk-plus/cilk-plus.exp: Removed duplicate/un-necessary
 +   compiler flag testing.

 Ok.
Balaji,
May i suggest you rephrase the .exp so it does not line-wrap and is
actually readable like in attached (untested) 01 or at least 00?

Thanks for your consideration..
Index: gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp
===
--- gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp	(revision 204561)
+++ gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp	(working copy)
@@ -25,31 +25,34 @@
 
 verbose $tool $libdir 1
 set library_var [get_multilibs]
-# Pointing the ld_library_path to the Cilk Runtime library binaries. 
+# Pointing the ld_library_path to the Cilk Runtime library binaries.
 set ld_library_path ${library_var}/libcilkrts/.libs
 
 set ALWAYS_CFLAGS 
 lappend ALWAYS_CFLAGS -L${library_var}/libcilkrts/.libs
 
 dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -fcilkplus  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -O1 -fcilkplus  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -O2 -fcilkplus  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -O3 -fcilkplus  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -g -fcilkplus  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -g -O2 -ftree-vectorize -fcilkplus  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -fcilkplus -std=c99  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -fcilkplus -O2 -std=c99  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -fcilkplus -O3 -std=c99  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]  -fcilkplus -g -O0 -std=c99  
 
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]]  -g -fcilkplus $ALWAYS_CFLAGS   
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]]  -O1 -fcilkplus $ALWAYS_CFLAGS  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]]  -O2 -std=c99 -fcilkplus $ALWAYS_CFLAGS  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]]  -O2 -ftree-vectorize -fcilkplus $ALWAYS_CFLAGS  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]]  -O3 -g -fcilkplus $ALWAYS_CFLAGS  
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]]  -O3 -flto -g -fcilkplus $ALWAYS_CFLAGS  
+set tests [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]]
 
+dg-runtest $tests  -fcilkplus  
+dg-runtest $tests  -O1 -fcilkplus  
+dg-runtest $tests  -O2 -fcilkplus  
+dg-runtest $tests  -O3 -fcilkplus  
+dg-runtest $tests  -g -fcilkplus  
+dg-runtest $tests  -g -O2 -ftree-vectorize -fcilkplus  
+dg-runtest $tests  -fcilkplus -std=c99  
+dg-runtest $tests  -fcilkplus -O2 -std=c99  
+dg-runtest $tests  -fcilkplus -O3 -std=c99  
+dg-runtest $tests  -fcilkplus -g -O0 -std=c99  
 
+set tests [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]]
 
+dg-runtest $tests  -g -fcilkplus $ALWAYS_CFLAGS   
+dg-runtest $tests  -O1 -fcilkplus $ALWAYS_CFLAGS  
+dg-runtest $tests  -O2 -std=c99 -fcilkplus $ALWAYS_CFLAGS  
+dg-runtest $tests  -O2 -ftree-vectorize -fcilkplus $ALWAYS_CFLAGS  
+dg-runtest $tests  -O3 -g -fcilkplus $ALWAYS_CFLAGS  
+dg-runtest $tests  -O3 -flto -g -fcilkplus $ALWAYS_CFLAGS  
+
 dg-finish
Index: gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp
===
--- gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp	(revision 204561)
+++ gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp	(working copy)
@@ -25,31 +25,40 @@
 
 verbose $tool $libdir 1
 set library_var [get_multilibs]
-# Pointing the ld_library_path to the Cilk Runtime library binaries. 
+# Pointing the ld_library_path to the Cilk Runtime library binaries.
 set ld_library_path ${library_var}/libcilkrts/.libs
 
 set ALWAYS_CFLAGS 
 lappend ALWAYS_CFLAGS -L${library_var}/libcilkrts/.libs
 
 dg-init
-dg-runtest [lsort [glob -nocomplain 

Re: [PATCH C++/testsuite] Remove pchtest check objects and compile with current tool

2013-11-09 Thread Bernhard Reutner-Fischer
On 1 November 2013 02:15, Mike Stump mikest...@comcast.net wrote:
 On Oct 31, 2013, at 1:47 AM, Bernhard Reutner-Fischer rep.dot@gmail.com 
 wrote:
 On 30 October 2013 23:22, Mike Stump mikest...@comcast.net wrote:
 On Oct 30, 2013, at 3:14 PM, Bernhard Reutner-Fischer 
 rep.dot@gmail.com wrote:
 On 30 October 2013 22:47, Mike Stump mikest...@comcast.net wrote:

 Was there a significant purpose for the added C++ comment?  If not, can 
 you remove that?  If so, can you explain?

 grep -A9 CONTENTS is gcc/testsuite/lib/target-supports.exp
 # Assume by default that CONTENTS is C code.
 # Otherwise, code should contain:
 # // C++ for c++,
 # ! Fortran for Fortran code,
 # /* ObjC, for ObjC
 # // ObjC++ for ObjC++
 # and // Go for Go
 # If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
 # allow for ObjC/ObjC++ specific flags.
 proc check_compile {basename type contents args} {

 Ah, but this is why I asked for a significant purpose?  The language of the 
 file selects the options (flags) allowed.  The language is set in your 
 code.  I think it was part of trying different ways to fix it, but, it 
 turned out to be neither necessary or sufficient in the end.

 Not sure about any significant purpose, no.

 Ok, then it can be safely removed.

 So, what do you want me to do?

 Remove the added comment…   and repost…

 Thanks.

Attached.

Ok for trunk?

gcc/testsuite/ChangeLog

2013-10-12  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* lib/dg-pch.exp (pch-init): Remove pchtest check objects.


Oh, and while double-checking the auto-wipe patch that i just
simplified, i encountered an inconvenient side-effect of checking
pristine trunk with plain
$ make -k check -j4
versus my local tree with
$ make -k check -j4 RUNTESTFLAGS=-v -v -v -v 

This bug/feature was added in a0d20ccbd97fde9c2af1f7345e3eb1313dea570f
aka svn r141337 .
From the sounds, if --target_board= is seen, then run specific test, serial.
Otherwise do the parallel stuff, i.e. check_DEJAGNU_normal_targets.
.
Still i want -v to not behave differently as not passing -v in
RUNTESTFLAGS especially regarding parallelism, so what about doing:
diff --git a/libstdc++-v3/testsuite/Makefile.am
b/libstdc++-v3/testsuite/Makefile.am
index 4c92fef..6edc410 100644
--- a/libstdc++-v3/testsuite/Makefile.am
+++ b/libstdc++-v3/testsuite/Makefile.am
@@ -108,7 +108,7 @@ $(check_DEJAGNU_normal_targets):
check-DEJAGNUnormal%: normal%/site.exp
 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
  AR=$(AR); export AR; \
  RANLIB=$(RANLIB); export RANLIB; \
- if [ -z $*$(filter-out --target_board=%, $(RUNTESTFLAGS)) ] \
+ if [ -z $*$findstring --target_board=,$(RUNTESTFLAGS)) ] \
  [ $(filter -j, $(MFLAGS)) = -j ]; then \
   $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \
   for idx in 0 1 2 3 4 5 6 7 8 9; do \

This may run non-parallel if somebody has RUNTESTFLAGS= -v -v
--target_board= but at least we don't have -v --verbose -d --debug in
the filter-out.
Mike?

Thanks,
diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp
index d82c669..7bc5c45 100644
--- a/gcc/testsuite/lib/dg-pch.exp
+++ b/gcc/testsuite/lib/dg-pch.exp
@@ -30,6 +30,7 @@ proc pch-init { args } {
 set pch_unsupported_debug \
[regexp debug format cannot be used with pre-compiled headers \
[lindex $result 0]]
+remove-build-file [lindex $result 1]
 
 set pch_unsupported 0
 if { $pch_unsupported_debug } {
@@ -40,6 +41,7 @@ proc pch-init { args } {
[regexp debug format cannot be used with pre-compiled headers 
\
[lindex $result 0]]
 }
+remove-build-file [lindex $result 1]
 }
 
 proc pch-finish { args } {


Re: [PATCH] Handle GIMPLE_ASSIGNs with different vuse in gimple_equal_p

2013-11-10 Thread Bernhard Reutner-Fischer
On Sat, Nov 09, 2013 at 05:30:00PM +0100, Tom de Vries wrote:
Richard,

Consider the test-case test.c:
...
int z;
int x;

void
f (int c, int d)
{
  if (c)
z = 5;
  else
{
  if (d)
   x = 4;
  z = 5;
}
}
...

Atm, we don't tail-merge the 'z = 5' blocks, because gimple_equal_p
returns false for the 'z = 5' statements. The relevant code is this:
...
  if (TREE_CODE (lhs1) != SSA_NAME
   TREE_CODE (lhs2) != SSA_NAME)
return (vn_valueize (gimple_vdef (s1))
== vn_valueize (gimple_vdef (s2)));
...
The vdefs of the 'z = 5' statements are different, because the
incoming vuses are different.

This patch handles GIMPLE_ASSIGNs with different vuse in
gimple_equal_p, by doing a structural comparison.

Bootstrapped and regtested on x86_64.

OK for trunk?

Thanks,
- Tom

2013-11-06  Tom de Vries  t...@codesourcery.com

   * tree-ssa-tail-merge.c (gimple_equal_p): Add test for structural
   equality for GIMPLE_ASSIGN.

   * gcc.dg/tail-merge-store.c: New test.

diff --git a/gcc/testsuite/gcc.dg/tail-merge-store.c 
b/gcc/testsuite/gcc.dg/tail-merge-store.c
new file mode 100644
index 000..1aefbdc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tail-merge-store.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options -O2 -ftree-tail-merge -fdump-tree-pre } */
+
+int z;
+int x;
+
+void
+f (int c, int d)
+{
+  if (c)
+z = 5;
+  else
+{
+  if (d)
+  x = 4;
+  z = 5;
+}
+}
+
+/* { dg-final { scan-tree-dump-times duplicate of 1 pre} } */
+/* { dg-final { scan-tree-dump-times z = 5 1 pre} } */
+/* { dg-final { cleanup-tree-dump pre } } */
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 98b5882..43516a7 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -1173,8 +1173,47 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple 
s2)
   lhs2 = gimple_get_lhs (s2);
   if (TREE_CODE (lhs1) != SSA_NAME
  TREE_CODE (lhs2) != SSA_NAME)
-  return (vn_valueize (gimple_vdef (s1))
-  == vn_valueize (gimple_vdef (s2)));
+  {
+/* If the vdef is the same, it's the same statement.  */
+if (vn_valueize (gimple_vdef (s1))
+== vn_valueize (gimple_vdef (s2)))
+  return true;
+
+/* If the vdef is not the same but the vuse is the same, it's not the
+   same stmt.  */
+if (vn_valueize (gimple_vuse (s1))
+== vn_valueize (gimple_vuse (s2)))
+  return false;
+/* If the vdef is not the same and the vuse is not the same, it might 
be
+   same stmt.  */
+
+/* Test for structural equality.  */
+if (gimple_assign_rhs_code (s1) != gimple_assign_rhs_code (s1)

typo, second one should be s2.
thanks,

+|| (gimple_assign_nontemporal_move_p (s1)
+!= gimple_assign_nontemporal_move_p (s2)))
+  return false;
+
+if (!operand_equal_p (lhs1, lhs2, 0))
+  return false;
+
+t1 = gimple_assign_rhs1 (s1);
+t2 = gimple_assign_rhs1 (s2);
+if (!gimple_operand_equal_value_p (t1, t2))
+  return false;
+
+t1 = gimple_assign_rhs2 (s1);
+t2 = gimple_assign_rhs2 (s2);
+if (!gimple_operand_equal_value_p (t1, t2))
+  return false;
+
+t1 = gimple_assign_rhs3 (s1);
+t2 = gimple_assign_rhs3 (s2);
+if (!gimple_operand_equal_value_p (t1, t2))
+  return false;
+
+/* Same structure.  */
+return true;
+  }
   else if (TREE_CODE (lhs1) == SSA_NAME
   TREE_CODE (lhs2) == SSA_NAME)
   return vn_valueize (lhs1) == vn_valueize (lhs2);



Re: [patch gcc]: Add executable-extension for exported-symbol-test in configure.ac

2013-11-10 Thread Bernhard Reutner-Fischer

On 10 November 2013 13:49:37 Kai Tietz ktiet...@googlemail.com wrote:

Hi,

this patch adds exeext to -rdynamic and exported symbol-check within
configure.ac.  By this this test will be preformed as intended on
targets with executable-extensions (nevertheless -rdynamics will still
fail for pe-coff targets).

ChangeLog

2013-11-10  Karlson2k  k...@narod.ru
Kai Tietz  kti...@redhat.com

PR plugins/52872
* configure.ac: Adding for exported symbols check
and for rdynamic-check executable-extension.
* configure: Regenerated.

Tested for i686-w64-mingw32, x86_64-w64-mingw32, and i686-pc-cygwin.
I will apply this patch soon, if there are no objections.

Regards,
Kai

Index: configure.ac
===
--- configure.ac(Revision 204461)
+++ configure.ac(Arbeitskopie)
@@ -5334,15 +5334,15 @@
   AC_MSG_CHECKING([for exported symbols])
   if test x$export_sym_check != x; then
 echo int main() {return 0;} int foobar() {return 0;}  conftest.c
-${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest  /dev/null 21
-if $export_sym_check conftest | grep foobar  /dev/null; then
+${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext 
/dev/null 21
+if $export_sym_check conftest$ac_exeext | grep foobar  /dev/null; then


grep -q


   : # No need to use a flag
   AC_MSG_RESULT([yes])
 else
   AC_MSG_RESULT([yes])
   AC_MSG_CHECKING([for -rdynamic])
-  ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest 
/dev/null 21
-  if $export_sym_check conftest | grep foobar  /dev/null; then
+  ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o
conftest$ac_exeext  /dev/null 21
+  if $export_sym_check conftest$ac_exeext | grep foobar  /dev/null; then


Ditto.
Thanks,

 plugin_rdynamic=yes
 pluginlibs=-rdynamic
   else




Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH 2/3] libstdc++-v3: ::tmpnam depends on uClibc SUSV4_LEGACY

2013-11-13 Thread Bernhard Reutner-Fischer
On 11 November 2013 12:30, Jonathan Wakely jwakely@gmail.com wrote:
 On 8 November 2013 10:29, Bernhard Reutner-Fischer wrote:
 On 04/11/2013 02:04 PM, Bernhard Reutner-Fischer wrote:

 I would have expected that somebody would tell me that omitting ::tmpnam
 violates 27.9.2 cstdio from the spec but noone yelled at me yet?

 std::tmpnam, like std::gets, should be killed with fire. If a target C
 library doesn't provide it then I have no problem is libstdc++ doesn't
 provide it either.

 Attaching an updated patch that i was using since March (without
 regressions) which takes Rainer's comments about _GLIBCXX_USE_TMPNAM
 into account.
 Ok for trunk?

 Thanks for following this up.

 I'm curious why you use tmpnam(NULL) rather than tmpnam(NULL) or
 tmpnam(something)?  Using the string literal NULL is a bit
 confusing (although not a problem.)

Yea, perhaps that's confusing, let's use XYZ instead.

 How does __UCLIBC_SUSV4_LEGACY__ get defined?  We'd have a problem if
 users defined that at configure time but not later when using the
 library.
That would be defined by uClibc's configury, but the latest
commit-6f2faa2 i attached does not mention this anymore, but does
the check in a libc-agnostic manner?


Re: [patch] set MULTIARCH_DIRNAME for multilib architectures

2013-11-27 Thread Bernhard Reutner-Fischer
On 27 November 2013 11:10, Aurelien Jarno aure...@debian.org wrote:
 On Thu, Jun 20, 2013 at 02:26:12PM +0200, Matthias Klose wrote:
 Am 13.06.2013 11:42, schrieb Richard Sandiford:
  Bernhard Reutner-Fischer rep.dot@gmail.com writes:
  On 12 June 2013 20:20:50 Richard Sandiford rdsandif...@googlemail.com 
  wrote:
  Matthias Klose d...@ubuntu.com writes:
  Index: config/mips/t-linux64
  ===
  --- config/mips/t-linux64(revision 200012)
  +++ config/mips/t-linux64(working copy)
  @@ -24,3 +24,13 @@
   ../lib32$(call
  if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
   ../lib$(call 
  if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
   ../lib64$(call
  if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
  +
  +ifneq (,$(findstring abin32,$(target)))
  +MULTIARCH_DIRNAME = $(call
  if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))
  +else
  +ifneq (,$(findstring abi64,$(target)))
  +MULTIARCH_DIRNAME = $(call
  if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
  +else
  +MULTIARCH_DIRNAME = $(call
  if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
  +endif
  +endif
 
  findstring seems a bit fragile for a full triple.  I think it would
  be better to have something similar to the current MIPS_SOFT definition:
 
  MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI,
  $(target_cpu_default)) $(filter soft, $(with_float))),soft)
 
  but for ABIs.  It could then also take with_abi into account.
  Maybe something like:
 
  MIPS_ABI = $(or $(with_abi), \
  $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
  $(target_cpu_default)), n32), \
  o32)
 
  (completely untested).
 
  Bikeshedding:
  Doko would know, but ISTR that $(or) did not exist in make-3.80 which is
  currently the minimum prerequisite, fwiw.
 
  Gah, that's a pity.  Thanks for the catch though.  Maybe firstword
  would be OK instead.
 
  I see I also fell into the usual ABI trap.  It wouldn't have affected
  the use in this patch, but the default ought to be 32 rather than o32.

 the define is in tm_defines, not target_cpu_default.

 MIPS_ABI = $(or $(with_abi), \
 $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
 $(tm_defines)), n32), \
  32)

 However I can't see yet how this should be used. Maybe Aurelian could come up
 with a tested version of this patch?


 How about the patch below?

 It first determines the ABI without using $(or), by looking (in this
 order) for $(with_abi), $(tm_defines) and $(target), defaulting to 32
 if none of the previous matches.

 Then the multiarch path is constructed from the ABI.

 Index: gcc/config/mips/t-linux64
 ===
 --- gcc/config/mips/t-linux64   (révision 205437)
 +++ gcc/config/mips/t-linux64   (copie de travail)
 @@ -24,3 +24,22 @@
 ../lib32$(call 
 if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
 ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
 ../lib64$(call 
 if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
 +
 +ifneq ($(with_abi),)
 +MIPS_ABI = $(with_abi)
 +endif
 +ifeq ($(MIPS_ABI),)
 +MIPS_ABI=$(if $(strip $(filter MIPS_ABI_DEFAULT=ABI_N32, $(tm_defines))),n32)
 +endif
 +ifeq ($(MIPS_ABI),)
 +MIPS_ABI = $(subst abi,,$(subst gnu,,$(lastword $(subst -, ,$(target)
 +endif
 +ifeq ($(MIPS_ABI),)
 +MIPS_ABI=32
 +endif
 +
 +ifeq ($(MIPS_ABI),32)
 +MULTIARCH_DIRNAME = $(call if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
 +else
 +MULTIARCH_DIRNAME = $(call 
 if_multiarch,mips64$(MIPS_EL)-linux-gnuabi$(MIPS_ABI)$(MIPS_SOFT))

hm, shouldn't this be gnueabi with an 'e'  or is that implied for n64 anyway?
just curious..
thanks,

 +endif

 --
 Aurelien Jarno  GPG: 1024D/F1BCDB73
 aurel...@aurel32.net http://www.aurel32.net


Re: [fortran] add __builtin_unreachable

2012-10-16 Thread Bernhard Reutner-Fischer

Hi,

s/imlpies/implied/


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] gcc-{ar,nm,ranlib}: Find binutils binaries relative to self

2012-10-18 Thread Bernhard Reutner-Fischer

On 18 October 2012 17:30:20 Meador Inge mead...@codesourcery.com wrote:

Ping ^ 2


Been a while but wasn't --with-build-sysroot for exactly this?


On 10/09/2012 09:44 PM, Meador Inge wrote:
 Ping.

 On 102012 03:45 PM, Meador Inge wrote:
 Hi All,

 Currently the gcc-{ar,nm,ranlib} utilities assume that binutils is in
 path when invoking the wrapped binutils program.  This goes against the
 accepted practice in GCC to find sub-programs relative to where the
 GCC binaries are stored and to not make assumptions about the PATH.

 This patch changes the gcc-{ar,nm,ranlib} utilities to do the same
 by factoring out some utility code for finding files from collect2.c.
 These functions are then leveraged to find the binutils programs.
 Note that similar code exist in gcc.c.  Perhaps one day everything
 can be merged to the file-find files.

 Tested for Windows and GNU/Linux hosts and i686-pc-linux-gnu and
 arm-none-eabi targets.



Sent with AquaMail for Android
http://www.aqua-mail.com




RE: [patch] cilkplus: Array notation for C patch

2013-04-30 Thread Bernhard Reutner-Fischer

On 30 April 2013 00:55:16 Joseph S. Myers jos...@codesourcery.com wrote:


 +  if (flag_enable_cilkplus  contains_array_notation_expr (cond))
 +{
 +  error_at (start_locus, array notation expression cannot be used 
in a 

 +  loop%'s condition);
 +  return;
 +}
 +  if (flag_enable_cilkplus  contains_array_notation_expr (incr)  0)
 +{
 +  error_at (start_locus, array notation expression cannot be used 
in a 

 +  loop's increment expression);
 +  return;
 +}

Use %' in the second error here, as you did in the first.


Or just delete this second error, it is dead code ATM (0).


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: section anchors and weak hidden symbols

2013-05-08 Thread Bernhard Reutner-Fischer

On 8 May 2013 15:11:18 Jan Hubicka hubi...@ucw.cz wrote:

 2013-05-08  Nathan Sidwell  nat...@codesourcery.com
gcc/
* varasm.c (default_use_anchors_for_symbol_p): Reject WEAK.
gcc/testsuite/
* gcc.dg/visibility-21.c: New.
 Index: gcc/varasm.c
 ===
 --- gcc/varasm.c   (revision 410150)
 +++ gcc/varasm.c   (working copy)
 @@ -6871,6 +6871,11 @@ default_use_anchors_for_symbol_p (const_
if (!targetm.binds_local_p (decl))
return false;
 +  /* Weak decls might be overridden, but could still be local to
 +   the module.  */
 +  if (DECL_WEAK (decl))
 +  return false;

With LTO we play more of similar tricks, by making use of the resolution file.
I.e. for COMMON and EXTERNAL.  Does it matter here?

I would preffer the renaming excercise, since the name confused me few times,
too and the other predicate would be useful for IPA code :)

Thanks a lot for looking into this!
Honza


Does this regress PR32219 ?
http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00665.html
I don't remember if the patch and test case were applied yet and don't have 
the sources at hand..


Thanks,


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] PR32219, weak hidden reference segfault

2013-05-09 Thread Bernhard Reutner-Fischer
On Thu, May 09, 2013 at 05:52:26PM +0800, Chung-Lin Tang wrote:

2013-05-09  Chung-Lin Tang  clt...@codesourcery.com

   PR target/32219
   * rtlanal.c (nonzero_address_p): Robustify checking by look
recursively into PIC constant offsets and (CONST (UNSPEC ...))
   expressions.

Index: rtlanal.c
===
--- rtlanal.c  (revision 198735)
+++ rtlanal.c  (working copy)
@@ -387,13 +387,22 @@ nonzero_address_p (const_rtx x)
   return false;
 
 case CONST:
-  return nonzero_address_p (XEXP (x, 0));
+  {
+  rtx base, offset;
+  /* Peel away any constant offsets from the base symbol.  */
+  split_const (CONST_CAST_RTX (x), base, offset);
+  return nonzero_address_p (base);
+  }
 
+case UNSPEC:
+  /* Reach for a contained symbol.  */
+  return nonzero_address_p (XVECEXP (x, 0, 0));
+
 case PLUS:
   /* Handle PIC references.  */
   if (XEXP (x, 0) == pic_offset_table_rtx
   CONSTANT_P (XEXP (x, 1)))
-  return true;
+  return nonzero_address_p (XEXP (x, 1));
   return false;
 
 case PRE_MODIFY:
Index: testsuite/gcc.dg/visibility-21.c
===
--- testsuite/gcc.dg/visibility-21.c   (revision 0)
+++ testsuite/gcc.dg/visibility-21.c   (revision 0)

Please put this into gcc.dg/torture/ instead to make sure it works on
all optimization levels.

@@ -0,0 +1,12 @@
+/* PR target/32219 */
+/* { dg-do run } */
+/* { dg-require-visibility  } */
+/* { dg-options -O1 -fPIC { target fpic } } */

I do not remember offhand if the whole test should
dg-require-effective-target fpic
+
+extern void f() __attribute__((weak,visibility(hidden)));
+int main()
+{
+  if (f)
+f();
+  return 0;
+}

Thanks for taking care of this PR!
Bernhard


Re: [patch] Small emit-rtl.c / reorg.c cleanup

2013-05-12 Thread Bernhard Reutner-Fischer

On 11 May 2013 21:29:53 Steven Bosscher stevenb@gmail.com wrote:

Hello,

This just removes one unused function, and moves two functions from
emit-rtl.c to reorg.c which is the only place where they're used.

Will commit in a few days, barring objections.

Ciao!
Steven


* rtl.h (next_label, skip_consecutive_labels, link_cc0_insns):
Remove prototypes.
* emit-rtl.c (next_label): Remove unused function.
(skip_consecutive_labels, link_cc0_insns): Move to ...
* reorg.c (skip_consecutive_labels, link_cc0_insns): ... here, the
only place where these functions are used.

s/./, and make them static./
?
Thanks,


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [rs6000] Add register save/restore routines for cross

2013-05-22 Thread Bernhard Reutner-Fischer

On 22 May 2013 16:36:52 David Edelsohn dje@gmail.com wrote:

On Wed, May 22, 2013 at 10:35 AM, Alan Modra amo...@gmail.com wrote:
 On Wed, May 22, 2013 at 10:05:47AM -0400, David Edelsohn wrote:
 Why does cross need the functions in libgcc and not provided by the linker?

 Only the ppc64 linker provides save/restore functions magically.

Okay, then the patch is okay.


Hmm. I cannot look right now, does that sound like a cure for PR53803 too?


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [Patch, Fortran] Better error messages for type/rank checks

2013-05-31 Thread Bernhard Reutner-Fischer

On 31 May 2013 15:57:25 Manfred Schwarb manfre...@gmx.ch wrote:

Am 31.05.2013 14:28, schrieb Janus Weil:
 Wouldn't it work to use the TIOCGWINSZ ioctl only if isatty() reports
 that we're outputting to a terminal?

 Good point. Updated patch attached, which imposes no limit if we're
 not outputting to a terminal (as suggested by Mikael).

 Ok for trunk, or am I missing anything else? (Testing welcome ...)


needs #include unistd.h for isatty(), perhaps.
Otherwise looks sane at first glance.


Perhaps see get_terminal_width_height() for inspiration (works for me)..

http://git.busybox.net/busybox/tree/libbb/xfuncs.c#n254

Cheers,


Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2013-06-07 Thread Bernhard Reutner-Fischer
On 29 June 2012 04:59, Mike Stump mikest...@comcast.net wrote:
 On Jun 28, 2012, at 5:15 PM, Bernhard Reutner-Fischer wrote:
 On Thu, Jun 28, 2012 at 04:43:05PM -0700, Mike Stump wrote:
 On Jun 28, 2012, at 3:27 PM, Bernhard Reutner-Fischer wrote:
 Perhaps you want to pursue this? We'd need to suggest this to dejagnu,

 Actually, we have the technology, so that isn't necessary.  :-)  You can 
 install replacements for any procs you want, not pretty, but... it does 
 work.  I think this is a more deterministic path forward than waiting for a 
 mythical dejagnu release.  Also, we then can avoid the hassle of requiring 
 a new dejagnu.

 Wouldn't that mean that we have to completely replace proc load_lib?

 Yes; worse, it is a cut-n-paste from dejagnu and can effectively rev lock us 
 to the current dejagnu release...  One can delegate, but I don't think any 
 pre or post processing in this case is enough to `fix' the issue, so it would 
 be a wholesale replacement.

Ben,

Would you accept something like the patch in the message below into dejagnu?
http://gcc.gnu.org/ml/fortran/2012-03/msg00094.html

Above patch was motivated by these (unpleasant) observations:
http://gcc.gnu.org/ml/fortran/2012-03/msg00092.html

thanks,

 But anyway.
 Mike, it would be nice if you could fix
 +# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load 
 gcc-defs!

 Sounds like a single line fix.  It is the testing of that fix that is the 
 annoying part.


Re: [GOOGLE] Avoid emitting duplicated weakref

2013-06-11 Thread Bernhard Reutner-Fischer
On 9 June 2013 05:31, Xinliang David Li davi...@google.com wrote:
 Guard also with L_IPO_COMP_MODE as this is lipo specific.

Sounds like this is the LIPO incarnation of http://gcc.gnu.org/PR31537

See the patch at http://gcc.gnu.org/PR31537#c9 for not adding the
alias in the first place (back then, honza may have changed that
recently on trunk).

Honza, Joseph,
Are there rules for handling weakrefs in some standard? If so, which ones?

Just curious..
Thanks,

 David

 On Sat, Jun 8, 2013 at 8:29 PM, Dehao Chen de...@google.com wrote:
 This patch fixes a bug when two weakref symbols are mapped to a same
 assembler name.

 Testing on going.

 OK for google branches if test is fine?

 Thanks,
 Dehao

 Index: gcc/varasm.c
 ===
 --- gcc/varasm.c (revision 199844)
 +++ gcc/varasm.c (working copy)
 @@ -5502,6 +5502,10 @@ do_assemble_alias (tree decl, tree target)
if (TREE_ASM_WRITTEN (decl))
  return;

 +  if (lookup_attribute (weakref, DECL_ATTRIBUTES (decl))
 +   TREE_ASM_WRITTEN (DECL_ASSEMBLER_NAME (decl)))
 +return;
 +
/* We must force creation of DECL_RTL for debug info generation, even 
 though
   we don't use it here.  */
make_decl_rtl (decl);


Re: [PATCH] PR32219, weak hidden reference segfault

2013-06-11 Thread Bernhard Reutner-Fischer
ping, CCing middle-end maintainers for review.

On 31 May 2013 10:13, Chung-Lin Tang clt...@codesourcery.com wrote:
 On 13/5/15 8:12 PM, Richard Sandiford wrote:
 Chung-Lin Tang clt...@codesourcery.com writes:
 On 13/5/10 6:37 PM, Richard Sandiford wrote:
 Chung-Lin Tang clt...@codesourcery.com writes:
 +case UNSPEC:
 +  /* Reach for a contained symbol.  */
 +  return nonzero_address_p (XVECEXP (x, 0, 0));

 I don't think this is safe.  UNSPECs really are unspecified :-),
 so we can't assume that (unspec X) is nonzero simply because X is.

 Attached is a modified patch (not yet tested but just for demonstration)
 with a more specific test, hopefully regarded as more safe.

 The point is in recognizing (const (unspec [symbol] XYZ)) offsets in PIC
 references, which seems quite idiomatic across all targets by now.

 I agree this is safer.  However, there used to be some ports that
 use (plus pic_offset_table_rtx (symbol_ref X)) -- i.e. without an unspec --
 to represent a PIC reference to X.  That always seemed semantically wrong,
 since you're not actually adding the address of X and the PIC register,
 but the patch wouldn't handle that case correctly.

 Well I can't help those targets then, but at least nothing will be
 changed for them by this patch. It will just continue to return 'true'.

 An alternative might be to remove the pic_offset_table_rtx case altogether
 and rely on targetm.delegitimize_address instead.  FWIW, I'd prefer that
 if it works, but it's not me you need to convince. :-)

 Like we discussed below, I think the direction should be towards making
 things more machine-independent, rather then pushing more into the backend.

 I would suggest that this probably means there should be a new, more
 specific construct in RTL to represent relocation values of this kind,
 instead of (const (unspec)) serving an unofficial role; possibly some
 real support for reasoning about PIC references could also be considered.

 Yeah, maybe we could try to introduce some target-independent knowledge
 of certain reloc types, a bit like the generic BFD_RELOC_*s in bfd.


 FWIW, I've ran tests on the newer patch on i686-linux, with no
 regressions. Testcase has been moved to gcc.dg/torture by recommendation
 of Bernhard. If any of the RTL maintainers can give an eye of merciful
 approval, this old PR could be resolved :)

 Thanks,
 Chung-Lin



Re: [patch] set MULTIARCH_DIRNAME for multilib architectures

2013-06-13 Thread Bernhard Reutner-Fischer

On 12 June 2013 20:20:50 Richard Sandiford rdsandif...@googlemail.com wrote:

Matthias Klose d...@ubuntu.com writes:
 Index: config/mips/t-linux64
 ===
 --- config/mips/t-linux64  (revision 200012)
 +++ config/mips/t-linux64  (working copy)
 @@ -24,3 +24,13 @@
  	../lib32$(call 
if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \

../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
 +
 +ifneq (,$(findstring abin32,$(target)))
 +MULTIARCH_DIRNAME = $(call 
if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))

 +else
 +ifneq (,$(findstring abi64,$(target)))
 +MULTIARCH_DIRNAME = $(call 
if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))

 +else
 +MULTIARCH_DIRNAME = $(call 
if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))

 +endif
 +endif

findstring seems a bit fragile for a full triple.  I think it would
be better to have something similar to the current MIPS_SOFT definition:

MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, 
$(target_cpu_default)) $(filter soft, $(with_float))),soft)


but for ABIs.  It could then also take with_abi into account.
Maybe something like:

MIPS_ABI = $(or $(with_abi), \
$(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
  $(target_cpu_default)), n32), \
o32)

(completely untested).


Bikeshedding:
Doko would know, but ISTR that $(or) did not exist in make-3.80 which is 
currently the minimum prerequisite, fwiw.



Sent with AquaMail for Android
http://www.aqua-mail.com




Re: [PATCH] Improve folding of bitwise ops feeding conditionals for single bit types

2013-06-19 Thread Bernhard Reutner-Fischer
On 19 June 2013 15:57, Jeff Law l...@redhat.com wrote:
 On 06/19/2013 01:02 AM, Chung-Ju Wu wrote:

 2013/6/19 Jeff Law l...@redhat.com:


  * gcc.dg/tree-ssa/forwprop-28.c: New test.


 In the gnu coding standard we have a space before
 the open-parentheses.  Would that be great to have
 testcase follow this convention as well? :)

 If so, then...

 No reason not to fix the test in this instance.  I'll make these updates
 before committing.

eh, nitpicking party ?

+   If a simplification is mode, return TRUE, else return FALSE.  */
+static bool
+simplify_bitwise_binary_boolean (gimple_stmt_iterator *gsi,

s/mode/made/

Sounds nice, otherwise!
thanks,


  1   2   3   4   5   6   7   8   9   >