Re: mt-mep using EXTRA_TARGET_HOST_ALL_MODULES?

2011-03-25 Thread Paolo Bonzini

On 03/24/2011 08:43 PM, Joseph S. Myers wrote:

On Thu, 24 Mar 2011, Paolo Bonzini wrote:


One thing I wonder is if we can
kill the toplevel support for building lots of miscellaneous tools that
aren't in the gcc or src trees and that aren't libraries used by tools in
those trees (such as the support for dropping a GMP source tree into a GCC
source tree) either.  There are plenty of packaging systems out there, but
I'm not convinced it's any longer useful for this toplevel build/configure
code to care about building autoconf, send-pr, rcs or guile, for example.


Not sure about that.  For sure, people are using in-tree GMP.


My question is really whether people are using *any* of the following
in-tree (in a way that wouldn't better be served by either some other
package management system, or by their maintaining a local fork of the GCC
or src tree): bison byacc flex m4 texinfo ash autoconf automake bash bzip2
dejagnu diff dosutils fastjar fileutils findutils find gawk gettext libelf
gnuserv gzip hello indent libiconv libtool make mmalloc patch perl prms
rcs release recode sed send-pr shellutils tar textutils time uudecode
wdiff zip expect guile target-gperf target-examples target-qthreads.


We can categorize them further this way:

* May in principle be in use (or be put to some use for libelf):
fastjar libelf

* Maybe turn it into a build tool, and it may even make sense:
dejagnu

* Also present as build modules, host module makes little sense though:
bison byacc flex m4 texinfo

* Maybe turn them into build tools, but it wouldn't make much sense:
autoconf automake libtool

* Probably present only for historical reasons (Cygnus distributions):
ash bash bzip2 diff dosutils findutils gawk gettext gzip hello indent 
libiconv make patch rcs recode sed tar time uudecode wdiff expect guile


* Obsolete:
fileutils find mmalloc shellutils textutils

* Why?!?
target-gperf

* Doesn't use Autoconf, so it's already broken:
zip perl

* What's this?
gnuserv prms release send-pr target-examples target-qthreads


I have no idea what is target-qthreads, but I take it from you that it's 
not in src.


I believe every host module except the one in the first two bullets 
should go; and even then I'm saving dejagnu only in preparation for 
turning it into a build module.  I wouldn't remove build modules yet.


Paolo


Re: Remove old host cases from toplevel configure

2011-03-25 Thread Paolo Bonzini

On 03/24/2011 08:49 PM, Joseph S. Myers wrote:

Related to that point, I notice a piece of code starting "we might need to
use some other shell than /bin/sh for running subshells" that tries to
determine a shell on Windows hosts.  It's autoconf's job to find a
suitable shell, so if this code is still relevant I think there's
something missing in autoconf.


That code is dead because

  if test x${CONFIG_SHELL} = x ; then

will never be true.

Paolo


Re: More toplevel configure.ac pruning

2011-03-25 Thread Paolo Bonzini

On 03/24/2011 09:12 PM, Joseph S. Myers wrote:

-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello 
indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl 
time ash bash bzip2 prms gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello 
indent m4 rcs recode sed shellutils tar textutils uudecode wdiff guile perl time ash bash 
bzip2 prms gnuserv target-gperf"


Removing the whole native_only stuff is preapproved.

These days, if you really really want to drop sed or tar in-tree, you 
want it to be built.  Whether to keep these modules is another story, 
but this can go in the meanwhile.



* Disabling byacc based on host CPU architecture is clearly wrong.


This was probably a workaround for some compiler bug (but an odd 
workaround even then...).


Paolo


[PING^2]: For unreviewed patches

2011-03-25 Thread Kai Tietz
Ping for following patches

[patch libcpp]: Improve handling of DOS-filenames and -paths
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00742.html

[patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00824.html

Kai


Re: Tighten ARM's CANNOT_CHANGE_MODE_CLASS

2011-03-25 Thread Richard Sandiford
Richard Earnshaw  writes:
> On Thu, 2011-03-24 at 15:40 +, Richard Sandiford wrote:
>> gcc/
>>  * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Restrict FPA_REGS
>>  case to VFPv1.
>> 
>
> GCC doesn't support VFPv1 (see the all_fpus table), and I don't think
> many chips based on that ever escaped into the wild world, so I'm not
> worried about trying to add that now.
>
> So it's probably safe to just kill that check for VFP entirely.

Even better. :-)  How does this look?  Tested on arm-linux-gnueabi,
no regressions.

Richard


gcc/
* config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Restrict FPA_REGS
case to VFPv1.

Index: gcc/config/arm/arm.h
===
--- gcc/config/arm/arm.h2011-03-24 17:21:52.0 +
+++ gcc/config/arm/arm.h2011-03-24 18:39:09.0 +
@@ -1167,12 +1167,10 @@ #define IRA_COVER_CLASSES   
 \
 }
 
 /* FPA registers can't do subreg as all values are reformatted to internal
-   precision.  VFP registers may only be accessed in the mode they
-   were set.  */
-#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)  \
-  (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)  \
-   ? reg_classes_intersect_p (FPA_REGS, (CLASS))   \
- || reg_classes_intersect_p (VFP_REGS, (CLASS))\
+   precision.  */
+#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)  \
+  (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)  \
+   ? reg_classes_intersect_p (FPA_REGS, (CLASS))   \
: 0)
 
 /* The class value for index registers, and the one for base regs.  */


Re: [patch middle-end c c++]: Optimize cost of comp_type_attributes

2011-03-25 Thread Jason Merrill

On 03/24/2011 08:44 PM, Kai Tietz wrote:

+static bool
+attribute_value_equal (const_tree attr1, const_tree attr2)
+{
+  if (attr1 == attr2)
+return true;


I still think this test should be comparing TREE_VALUEs.

Jason


Re: [patch middle-end c c++]: Optimize cost of comp_type_attributes

2011-03-25 Thread Kai Tietz
2011/3/25 Jason Merrill :
> On 03/24/2011 08:44 PM, Kai Tietz wrote:
>>
>> +static bool
>> +attribute_value_equal (const_tree attr1, const_tree attr2)
>> +{
>> +  if (attr1 == attr2)
>> +    return true;
>
> I still think this test should be comparing TREE_VALUEs.
>
> Jason
>

Ok, it makes sense to check here for value indentity instead of
identity of list-node. Thanks. Updated patch attached.

Kai
Index: gcc/gcc/c-typeck.c
===
--- gcc.orig/gcc/c-typeck.c 2011-03-25 09:27:47.101196700 +0100
+++ gcc/gcc/c-typeck.c  2011-03-25 09:35:35.038738400 +0100
@@ -1079,7 +1079,7 @@ comptypes_internal (const_tree type1, co
 return 1;
 
   /* 1 if no need for warning yet, 2 if warning cause has been seen.  */
-  if (!(attrval = targetm.comp_type_attributes (t1, t2)))
+  if (!(attrval = comp_type_attributes (t1, t2)))
  return 0;
 
   /* 1 if no need for warning yet, 2 if warning cause has been seen.  */
Index: gcc/gcc/cp/decl.c
===
--- gcc.orig/gcc/cp/decl.c  2011-03-25 09:27:47.102196700 +0100
+++ gcc/gcc/cp/decl.c   2011-03-25 09:35:35.090745000 +0100
@@ -1012,8 +1012,8 @@ decls_match (tree newdecl, tree olddecl)
types_match =
  compparms (p1, p2)
  && (TYPE_ATTRIBUTES (TREE_TYPE (newdecl)) == NULL_TREE
- || targetm.comp_type_attributes (TREE_TYPE (newdecl),
-  TREE_TYPE (olddecl)) != 0);
+ || comp_type_attributes (TREE_TYPE (newdecl),
+  TREE_TYPE (olddecl)) != 0);
}
   else
types_match = 0;
Index: gcc/gcc/cp/search.c
===
--- gcc.orig/gcc/cp/search.c2011-03-25 09:27:47.103196700 +0100
+++ gcc/gcc/cp/search.c 2011-03-25 09:35:35.145752000 +0100
@@ -1897,7 +1897,7 @@ check_final_overrider (tree overrider, t
 }
 
   /* Check for conflicting type attributes.  */
-  if (!targetm.comp_type_attributes (over_type, base_type))
+  if (!comp_type_attributes (over_type, base_type))
 {
   error ("conflicting type attributes specified for %q+#D", overrider);
   error ("  overriding %q+#D", basefn);
Index: gcc/gcc/cp/typeck.c
===
--- gcc.orig/gcc/cp/typeck.c2011-03-25 09:27:47.110196700 +0100
+++ gcc/gcc/cp/typeck.c 2011-03-25 09:35:35.164754400 +0100
@@ -1338,7 +1338,7 @@ structural_comptypes (tree t1, tree t2,
   /* If we get here, we know that from a target independent POV the
  types are the same.  Make sure the target attributes are also
  the same.  */
-  return targetm.comp_type_attributes (t1, t2);
+  return comp_type_attributes (t1, t2);
 }
 
 /* Return true if T1 and T2 are related as allowed by STRICT.  STRICT
Index: gcc/gcc/gimple.c
===
--- gcc.orig/gcc/gimple.c   2011-03-25 09:27:47.112196700 +0100
+++ gcc/gcc/gimple.c2011-03-25 09:35:35.206259700 +0100
@@ -3615,7 +3615,7 @@ gimple_types_compatible_p_1 (tree t1, tr
 state, sccstack, sccstate, sccstate_obstack))
goto different_types;
 
-  if (!targetm.comp_type_attributes (t1, t2))
+  if (!comp_type_attributes (t1, t2))
goto different_types;
 
   if (TYPE_ARG_TYPES (t1) == TYPE_ARG_TYPES (t2))
Index: gcc/gcc/tree-ssa.c
===
--- gcc.orig/gcc/tree-ssa.c 2011-03-25 09:27:47.113196700 +0100
+++ gcc/gcc/tree-ssa.c  2011-03-25 09:35:35.231762900 +0100
@@ -1438,7 +1438,7 @@ useless_type_conversion_p (tree outer_ty
 
   /* Defer to the target if necessary.  */
   if (TYPE_ATTRIBUTES (inner_type) || TYPE_ATTRIBUTES (outer_type))
-   return targetm.comp_type_attributes (outer_type, inner_type) != 0;
+   return comp_type_attributes (outer_type, inner_type) != 0;
 
   return true;
 }
Index: gcc/gcc/tree.c
===
--- gcc.orig/gcc/tree.c 2011-03-25 09:31:02.378615000 +0100
+++ gcc/gcc/tree.c  2011-03-25 10:48:15.141401100 +0100
@@ -4287,7 +4287,7 @@ build_type_attribute_qual_variant (tree
 its canonical type, we will need to use structural equality
 checks for this type. */
   if (TYPE_STRUCTURAL_EQUALITY_P (ttype)
-  || !targetm.comp_type_attributes (ntype, ttype))
+  || !comp_type_attributes (ntype, ttype))
SET_TYPE_STRUCTURAL_EQUALITY (ntype);
   else if (TYPE_CANONICAL (ntype) == ntype)
TYPE_CANONICAL (ntype) = TYPE_CANONICAL (ttype);
@@ -4300,6 +4300,75 @@ build_type_attribute_qual_variant (tree
   return ttype;
 }
 
+/* Compare two attributes for their value identity.  Return true if the
+   attribute values are known to be equal; otherwise return false.
+*/
+
+static bool
+at

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Richard Guenther
On Fri, Mar 25, 2011 at 12:57 AM, Andrew MacLeod  wrote:
>> On Thu, 24 Mar 2011, Aldy Hernandez wrote:
>>
>>> This work is independent of the C++ memory model.  It is just to prevent
>>> the
>>> optimizers from introducing new data races due to code movement. This
>>> initial
>>> pass is just to make the optimizations data race safe so that if you have
>>> a
>>> program which is proven to be free of data races, you can run the
>>> optimizers
>>> and it will still be data race free after the optimizers have been run.
>>>
>>> See the following summary by Andrew (which in turn is based on a paper by
>>> Hans
>>> Boehm):
>>>
>>> http://gcc.gnu.org/wiki/Atomic/GCCMM/DataRaces
>>
>> But hoisting global in this case doesn't result in a data race, since the
>> loop always accesses global and contains no synchronisation code.  If it
>> were only accessed conditionally, as in the examples under "Avoiding
>> Speculation" on that page, then there would be a race in hoisting it, but
>> not for the code you gave; any data races with the hoisting would still
>> have been present without it.
>>
> My fault for not being specific about it... I tend to just use data race as
> a catch all for all these types of things when talking about them with Aldy.
>
> the testcase should have      for (x=0; x< limit; x++)  sum[x] = global;
> rather than x<5,  so that its not a known loop count.
>
> The hoisted load is then not allowed as it become a speculative load of
> 'global' on the main path which would not otherwise have been there. When
> the value of limit < 0, this can cause a load race detection on systems with
> either a software or hardware data race detector.

But speculative loads are never a problem.  So I'd like to avoid cluttering
GCC code with stuff to avoid them.  I honestly don't care about diagnostic
tools that fail to see if a value read is used or not.

Richard.

> It can be allowed as long as the load happens inside a guard for the loop,
> but I dont think we are that sophisticated yet.
>
> Bottom line is these flags are to prevent the introduction of loads of
> globals on code paths which didn't have had them before.
>
> Andrew
>
>
>


Re: [patch middle-end c c++]: Optimize cost of comp_type_attributes

2011-03-25 Thread Jason Merrill

OK.

Jason


Re: [v3] Fix negative_binomial_distribution

2011-03-25 Thread Paolo Carlini
... tweaking the fix like this makes for slightly faster repeated calls 
(spares a division) and also makes clearer that we had a plain typo p / 
(1 - p) for (1 - p) / p, grrr.. Double checked Devroye in the meanwhile.


Committed to mainline, will be in 4.6.1.

Paolo.

///
2011-03-25  Paolo Carlini  

* include/bits/random.h (negative_binomial_distribution<>::
negative_binomial_distribution(_IntType, double),
negative_binomial_distribution<>::
negative_binomial_distribution(const param_type&)): Tweak
construction of _M_gd.
* include/bits/random.tcc (negative_binomial_distribution<>::
operator()): Adjust.
Index: include/bits/random.tcc
===
--- include/bits/random.tcc (revision 171411)
+++ include/bits/random.tcc (working copy)
@@ -1075,7 +1075,7 @@
   return __is;
 }
 
-  // This is Leger's algorithm.
+  // This is Leger's algorithm, also in Devroye, Ch. X, Example 1.5.
   template
 template
   typename negative_binomial_distribution<_IntType>::result_type
@@ -1085,8 +1085,7 @@
const double __y = _M_gd(__urng);
 
// XXX Is the constructor too slow?
-   std::poisson_distribution __poisson(__y * (1.0 - p())
-/ p());
+   std::poisson_distribution __poisson(__y);
return __poisson(__urng);
   }
 
@@ -1100,10 +1099,10 @@
typedef typename std::gamma_distribution::param_type
  param_type;

-   const double __y = _M_gd(__urng, param_type(__p.k(), 1.0));
+   const double __y =
+ _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
 
-   std::poisson_distribution __poisson(__y * (1.0 - __p.p())
-/ __p.p() );
+   std::poisson_distribution __poisson(__y);
return __poisson(__urng);
   }
 
Index: include/bits/random.h
===
--- include/bits/random.h   (revision 171411)
+++ include/bits/random.h   (working copy)
@@ -3804,12 +3804,12 @@
 
   explicit
   negative_binomial_distribution(_IntType __k = 1, double __p = 0.5)
-  : _M_param(__k, __p), _M_gd(__k, 1.0)
+  : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p)
   { }
 
   explicit
   negative_binomial_distribution(const param_type& __p)
-  : _M_param(__p), _M_gd(__p.k(), 1.0)
+  : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p())
   { }
 
   /**


[PATCH] Remove -O0 special casing in the stmt verifier

2011-03-25 Thread Richard Guenther

Not necessary anymore.

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

Richard.

2011-03-25  Richard Guenther  

* tree-cfg.c (verify_gimple_assign_unary): Drop special casing
of complex types at -O0.
(verify_gimple_assign_binary): Likewise.
(verify_gimple_assign_ternary): Likewise.

Index: gcc/tree-cfg.c
===
--- gcc/tree-cfg.c  (revision 171405)
+++ gcc/tree-cfg.c  (working copy)
@@ -3193,9 +3193,7 @@ verify_gimple_assign_unary (gimple stmt)
   tree rhs1 = gimple_assign_rhs1 (stmt);
   tree rhs1_type = TREE_TYPE (rhs1);
 
-  if (!is_gimple_reg (lhs)
-  && !(optimize == 0
-  && TREE_CODE (lhs_type) == COMPLEX_TYPE))
+  if (!is_gimple_reg (lhs))
 {
   error ("non-register as LHS of unary operation");
   return true;
@@ -3351,9 +3349,7 @@ verify_gimple_assign_binary (gimple stmt
   tree rhs2 = gimple_assign_rhs2 (stmt);
   tree rhs2_type = TREE_TYPE (rhs2);
 
-  if (!is_gimple_reg (lhs)
-  && !(optimize == 0
-  && TREE_CODE (lhs_type) == COMPLEX_TYPE))
+  if (!is_gimple_reg (lhs))
 {
   error ("non-register as LHS of binary operation");
   return true;
@@ -3618,9 +3614,7 @@ verify_gimple_assign_ternary (gimple stm
   tree rhs3 = gimple_assign_rhs3 (stmt);
   tree rhs3_type = TREE_TYPE (rhs3);
 
-  if (!is_gimple_reg (lhs)
-  && !(optimize == 0
-  && TREE_CODE (lhs_type) == COMPLEX_TYPE))
+  if (!is_gimple_reg (lhs))
 {
   error ("non-register as LHS of ternary operation");
   return true;


Re: [PATCH 1/4] Remove cgraph_node function and fixup all callers

2011-03-25 Thread Martin Jambor
Hi,

On Wed, Mar 23, 2011 at 10:08:53AM +0100, Jan Hubicka wrote:
> > 2011-03-18  Martin Jambor  
> > 
> > * cgraph.h (cgraph_node): Remove function declaration.
> > (cgraph_create_node): Declare.
> > (cgraph_get_create_node): Likewise.
> > (cgraph_do_get_node): New function.
> > 
> > * cgraph.c (cgraph_create_node): Renamed to cgraph_create_node_1.
> > Updated all callers.
> > (cgraph_node): Renamed to cgraph_create_node, assert that a node for
> > the decl does not already exist.  Call cgraph_get_create_node instead
> > of cgraph_node.
> > (cgraph_get_create_node): New function.
> > (cgraph_same_body_alias): Update comment.
> > (cgraph_set_call_stmt): Call cgraph_do_get_node instead of cgraph_node.
> > (cgraph_update_edges_for_call_stmt): Likewise.
> > (cgraph_clone_edge): Likewise.
> > (cgraph_create_virtual_clone): Likewise.
> > (cgraph_set_call_stmt): Call cgraph_get_create_node instead of
> > cgraph_node.
> > (cgraph_local_info): Call cgraph_get_node instead of cgraph_node,
> > handle NULL return value.
> > (cgraph_global_info): Likewise.
> > (cgraph_rtl_info): Likewise.
> > (cgraph_add_new_function): Call cgraph_create_node or
> > cgraph_get_create_node instead of cgraph_node.
> > 
> > * cgraphbuild.c (record_reference): Call cgraph_get_create_node
> > instead of cgraph_node.
> > (record_eh_tables): Likewise.
> > (mark_address): Likewise.
> > (mark_load): Likewise.
> > (build_cgraph_edges): Call cgraph_get_node and cgraph_get_create_node
> > instead of cgraph_node.
> > (rebuild_cgraph_edges): Likewise.
> > (cgraph_rebuild_references): Call cgraph_get_node instead of
> > cgraph_node.
> > (remove_cgraph_callee_edges): Likewise.
> > 
> > * cgraphunit.c (cgraph_finalize_function): Call cgraph_get_create_node
> > instead of cgraph_node.
> > (cgraph_mark_if_needed): Call cgraph_get_node instead of cgraph_node.
> > (verify_cgraph_node): Likewise.
> > (cgraph_analyze_functions): Likewise.
> > (cgraph_preserve_function_body_p): Likewise.
> > (save_inline_function_body): Likewise.
> > (save_inline_function_body): Likewise.
> > (cgraph_copy_node_for_versioning): Call cgraph_create_node instead of
> > cgraph_node.
> > 
> > * tree-inline.c (copy_bb): Call cgraph_get_node instead of cgraph_node.
> > (estimate_num_insns): Likewise and handle returned NULL.
> > (optimize_inline_calls): Call cgraph_get_node instead of cgraph_node.
> > (tree_function_versioning): Call cgraph_do_get_node instead of
> > cgraph_node.
> > 
> > * lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Call
> > cgraph_create_node instead of cgraph_node.
> > 
> > * c-decl.c (finish_function): Call cgraph_get_create_node instead
> > of cgraph_node.
> > * c-family/c-gimplify.c (c_genericize): Likewise.
> > * lto-cgraph.c (input_node): Likewise.
> > * lto-streamer-in.c (input_function): Likewise.
> > 
> > * except.c (set_nothrow_function_flags): Call cgraph_get_node instead
> > of cgraph_node.
> > * final.c (rest_of_clean_state): Likewise.
> > * gimple-iterator.c (update_call_edge_frequencies): Likewise.
> > * passes.c (pass_init_dump_file): Likewise.
> > (execute_all_ipa_transforms): Likewise.
> > (function_called_by_processed_nodes_p): Likewise.
> > * predict.c (maybe_hot_frequency_p): Likewise.
> > (probably_never_executed_bb_p): Likewise.
> > (compute_function_frequency): Likewise.
> > * tree-nested.c (check_for_nested_with_variably_modified): Likewise.
> > (unnest_nesting_tree_1): Likewise.
> > (lower_nested_functions): Likewise.
> > * tree-optimize.c (execute_fixup_cfg): Likewise.
> > (tree_rest_of_compilation): Likewise.
> > * tree-optimize.c (execute_fixup_cfg): Likewise.
> > (tree_rest_of_compilation): Likewise.
> > * tree-profile.c (gimple_gen_ic_func_profiler): Likewise.
> > * tree-sra.c (ipa_early_sra): Likewise.
> > * tree-ssa-loop-ivopts.c (computation_cost): Likewise.
> > * config/i386/i386.c (ix86_compute_frame_layout): Likewise.
> > * ipa.c (record_cdtor_fn): Likewise.
> > * ipa-inline.c (cgraph_early_inlining): Likewise.
> > (compute_inline_parameters_for_current): Likewise.
> > * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise.
> > * ipa-pure-const.c (local_pure_const): Likewise.
> > * ipa-split.c (split_function): Likewise.
> > (split_function): Likewise.
> > (execute_split_functions): Likewise.
> > 
> > * lto-streamer-in.c (lto_read_body): Call cgraph_do_get_node instead
> > of cgraph_node.
> > * omp-low.c (new_omp_context): Likewise.
> > (create_task_copyfn): Likewise.
> > * tree-emutls.c (lower_emutls_function_body): Likewise.
> > * ipa-struct-reorg.c (update_cgraph_with_malloc_call): Likewise.
> > * ipa-type-escape.c (check_call): Likewise.
> > * matrix-reo

Re: [patch middle-end c c++]: Optimize cost of comp_type_attributes

2011-03-25 Thread Kai Tietz
2011/3/25 Jason Merrill :
> OK.
>
> Jason
>

Committed at revision 171445.

Thanks,
Kai


Re: [testsuite, build] Convert boehm-gc testsuite to DejaGnu (PR boehm-gc/11412)

2011-03-25 Thread Paolo Bonzini

On 03/21/2011 01:59 PM, Rainer Orth wrote:

diff -r 8efcb4b03d45 boehm-gc/Makefile.am
--- a/boehm-gc/Makefile.am  Sun Mar 20 14:28:11 2011 +0100
+++ b/boehm-gc/Makefile.am  Sun Mar 20 21:37:14 2011 +0100
@@ -4,10 +4,10 @@
  ## files that should be in the distribution are not mentioned in this
  ## Makefile.am.

-AUTOMAKE_OPTIONS = cygnus subdir-objects
+AUTOMAKE_OPTIONS = foreign subdir-objects
  ACLOCAL_AMFLAGS = -I .. -I ../config

-SUBDIRS = include
+SUBDIRS = include testsuite

  noinst_LTLIBRARIES = libgcjgc.la libgcjgc_convenience.la

@@ -35,7 +35,7 @@

  # Include THREADLIBS here to ensure that the correct versions of
  # linuxthread semaphore functions get linked:
-libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS) $(UNWINDLIBS)
+libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS)
  libgcjgc_la_DEPENDENCIES = $(addobjs)
  libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath 
$(toolexeclibdir)
  libgcjgc_la_LINK = $(LINK) $(libgcjgc_la_LDFLAGS)
@@ -43,48 +43,11 @@
  libgcjgc_convenience_la_LIBADD = $(addobjs)
  libgcjgc_convenience_la_DEPENDENCIES = $(addobjs)

-AM_CXXFLAGS = $(GC_CFLAGS)
-AM_CFLAGS = $(GC_CFLAGS)
+AM_CXXFLAGS = $(GC_CFLAGS) $(THREADCFLAGS)
+AM_CFLAGS = $(GC_CFLAGS) $(THREADCFLAGS)
  AM_LDFLAGS = $(shell $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
  override CFLAGS := $(filter-out $(O0_CFLAGS), $(CFLAGS)) $(O0_CFLAGS)

-test_ldadd = libgcjgc.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
-
-check_PROGRAMS = gctest
-gctest_SOURCES = tests/test.c
-gctest_LDADD = $(test_ldadd)
-gctest_LDFLAGS = -shared-libgcc
-gctest_LINK = $(LINK) $(gctest_LDFLAGS)
-TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc
-TESTS = gctest
-
-TESTS += leaktest$(EXEEXT)
-check_PROGRAMS += leaktest
-leaktest_SOURCES = tests/leak_test.c
-leaktest_LDADD = $(test_ldadd)
-leaktest_LDFLAGS = -shared-libgcc
-leaktest_LINK = $(LINK) $(leaktest_LDFLAGS)
-
-TESTS += middletest$(EXEEXT)
-check_PROGRAMS += middletest
-middletest_SOURCES = tests/middle.c
-middletest_LDADD = $(test_ldadd)
-middletest_LDFLAGS = -shared-libgcc
-middletest_LINK = $(LINK) $(middletest_LDFLAGS)
-
-TESTS += staticrootstest$(EXEEXT)
-check_PROGRAMS += staticrootstest
-staticrootstest_SOURCES = tests/staticrootstest.c
-staticrootstest_LDADD = $(test_ldadd) libstaticrootslib.la
-staticrootstest_LDFLAGS = -shared-libgcc
-staticrootstest_LINK = $(LINK) $(staticrootstest_LDFLAGS)
-check_LTLIBRARIES = libstaticrootslib.la
-libstaticrootslib_la_SOURCES = tests/staticrootslib.c
-libstaticrootslib_la_LIBADD = libgcjgc_convenience.la
-libstaticrootslib_la_LDFLAGS = -version-info 1:2:0 -no-undefined \
-   -rpath /nowhere -shared-libgcc
-libstaticrootslib_la_DEPENDENCIES = libgcjgc_convenience.la
-
  ## FIXME: we shouldn't have to do this, but automake forces us to.
  .s.lo:
  ## We use -Wp,-P to strip #line directives.  Irix `as' chokes on
@@ -116,7 +79,6 @@
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"EXPECT=$(EXPECT)" \
-   "RUNTEST=$(RUNTEST)" \


Leave this line here, and replace the definitions of EXPECT and RUNTEST 
in boehm-gc/testsuite/Makefile.am with this:


EXPECT = expect

Automake will provide a definition of RUNTEST on its own.  I know this 
is likely cut-and-paste. :)  I'll reply that mine is cut-and-paste from 
libstdc++-v3/testsuite/Makefile.am.



diff -r 8efcb4b03d45 boehm-gc/configure.ac
--- a/boehm-gc/configure.ac Sun Mar 20 14:28:11 2011 +0100
+++ b/boehm-gc/configure.ac Sun Mar 20 21:37:14 2011 +0100
@@ -123,6 +123,7 @@
  )

  AM_CPPFLAGS="-I`cd $srcdir&&  ${PWDCMD-pwd}`/include"
+THREADCFLAGS=
  THREADLIBS=
  case "$THREADS" in
   no | none | single)
@@ -163,9 +164,9 @@
   *-*-hpux10*)
AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
;;
-  *-*-kfreebsd*-gnu)
+ *-*-kfreebsd*-gnu)
 AC_DEFINE(GC_FREEBSD_THREADS)
-   INCLUDES="$INCLUDES -pthread"
+   THREADCFLAGS=-pthread
 THREADDLLIBS=-pthread


Please change this THREADLIBS since you're at it.

Otherwise, build parts are okay.

Paolo



[PATCH] Fix DW_OP_GNU_entry_value handling in .debug_loc duplicate removal

2011-03-25 Thread Jakub Jelinek
Hi!

While working on a patch I'll post momentarily, I've noticed two
issues:
1) DW_OP_GNU_entry_value wasn't being handled by
   hash_loc_operands/compare_loc_operands, which means different entry
   values could be considered the same and a wrong location list
   could be used; the entry value patch was written way before that
   optimization has been added and I just forgot to adjust entry value
   patch when I've added that optimization
2) comparing GET_MODE_BITSIZE measured in bits with DWARF2_ADDR_SIZE
   measured in bytes is certainly wrong

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

2011-03-25  Jakub Jelinek  

* dwarf2out.c (mem_loc_descriptor) : Compare
mode size instead of bitsize with DWARF2_ADDR_SIZE.
(hash_loc_operands, compare_loc_operands): Handle
DW_OP_GNU_entry_value.

--- gcc/dwarf2out.c.jj  2011-03-23 17:15:49.0 +0100
+++ gcc/dwarf2out.c 2011-03-24 11:16:07.0 +0100
@@ -14311,8 +14311,8 @@ mem_loc_descriptor (rtx rtl, enum machin
  && ((unsigned) INTVAL (XEXP (rtl, 1))
  + (unsigned) INTVAL (XEXP (rtl, 2))
  <= GET_MODE_BITSIZE (GET_MODE (rtl)))
- && GET_MODE_BITSIZE (GET_MODE (rtl)) <= DWARF2_ADDR_SIZE
- && GET_MODE_BITSIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE)
+ && GET_MODE_SIZE (GET_MODE (rtl)) <= DWARF2_ADDR_SIZE
+ && GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE)
{
  int shift, size;
  op0 = mem_loc_descriptor (XEXP (rtl, 0), mode,
@@ -23125,6 +23125,9 @@ hash_loc_operands (dw_loc_descr_ref loc,
 case DW_OP_GNU_implicit_pointer:
   hash = iterative_hash_object (val2->v.val_int, hash);
   break;
+case DW_OP_GNU_entry_value:
+  hash = hash_loc_operands (val1->v.val_loc, hash);
+  break;
 
 default:
   /* Other codes have no operands.  */
@@ -23282,6 +23285,8 @@ compare_loc_operands (dw_loc_descr_ref x
 && valx1->val_class == valy1->val_class
 && valx1->v.val_die_ref.die == valy1->v.val_die_ref.die
 && valx2->v.val_int == valy2->v.val_int;
+case DW_OP_GNU_entry_value:
+  return compare_loc_operands (valx1->v.val_loc, valy1->v.val_loc);
 default:
   /* Other codes have no operands.  */
   return true;

Jakub


Re: mt-mep using EXTRA_TARGET_HOST_ALL_MODULES?

2011-03-25 Thread Joseph S. Myers
On Fri, 25 Mar 2011, Paolo Bonzini wrote:

> > My question is really whether people are using *any* of the following
> > in-tree (in a way that wouldn't better be served by either some other
> > package management system, or by their maintaining a local fork of the GCC
> > or src tree): bison byacc flex m4 texinfo ash autoconf automake bash bzip2
> > dejagnu diff dosutils fastjar fileutils findutils find gawk gettext libelf
> > gnuserv gzip hello indent libiconv libtool make mmalloc patch perl prms
> > rcs release recode sed send-pr shellutils tar textutils time uudecode
> > wdiff zip expect guile target-gperf target-examples target-qthreads.
> 
> We can categorize them further this way:
> 
> * May in principle be in use (or be put to some use for libelf):
> fastjar libelf
> 
> * Maybe turn it into a build tool, and it may even make sense:
> dejagnu

dejagnu and expect used to have copies in the src tree but they were 
removed a long time ago, so I think of the rules for them both as a 
legacy (and I think those two go together).  If they are removed, gcc 
subdirectory code supporting in-tree runtest and expect could be removed 
as well (it's quite possible other subdirectories in the gcc and src trees 
also have support for various components in-tree, that could be removed).

> * Also present as build modules, host module makes little sense though:
> bison byacc flex m4 texinfo

texinfo used to have a copy in the GCC tree but was removed a long time 
ago; the src tree deliberately only has a copy of texinfo.tex in the 
toplevel texinfo directory.  So I think of the rules for it as a legacy.  
I don't see m4 as useful as a build tool (rather, it's used by autoconf), 
nor the use of having both byacc and bison, and while build tools bison 
and flex could be used I doubt the real utility of building them in tree.

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


Re: More toplevel configure.ac pruning

2011-03-25 Thread Joseph S. Myers
On Fri, 25 Mar 2011, Paolo Bonzini wrote:

> On 03/24/2011 09:12 PM, Joseph S. Myers wrote:
> > -native_only="autoconf automake libtool fileutils find gawk gettext gzip
> > hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff
> > target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
> > +native_only="autoconf automake libtool fileutils find gawk gettext gzip
> > hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff guile
> > perl time ash bash bzip2 prms gnuserv target-gperf"
> 
> Removing the whole native_only stuff is preapproved.

What about my patch your just replied to as a first (or Nth) step?

> These days, if you really really want to drop sed or tar in-tree, you want it
> to be built.  Whether to keep these modules is another story, but this can go
> in the meanwhile.

I was certainly thinking that in any case it makes sense to remove all the 
cases that disable various of these tools on various hosts and targets, on 
much the same basis: if you add something not in gcc or src to your source 
tree, you want it built.

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


Re: mt-mep using EXTRA_TARGET_HOST_ALL_MODULES?

2011-03-25 Thread Paolo Bonzini

On 03/25/2011 11:59 AM, Joseph S. Myers wrote:

* Maybe turn it into a build tool, and it may even make sense:
dejagnu


dejagnu and expect used to have copies in the src tree but they were
removed a long time ago, so I think of the rules for them both as a
legacy (and I think those two go together).  If they are removed, gcc
subdirectory code supporting in-tree runtest and expect could be removed
as well (it's quite possible other subdirectories in the gcc and src trees
also have support for various components in-tree, that could be removed).


The subdirectory code supporting in-tree runtest should be moved to the 
toplevel anyway.  Adding in-tree expect as a build module makes little 
sense, though.  It has a further dependency on tcl so it's not like your 
reaching the bottom of the chain.



* Also present as build modules, host module makes little sense though:
bison byacc flex m4 texinfo


texinfo used to have a copy in the GCC tree but was removed a long time
ago; the src tree deliberately only has a copy of texinfo.tex in the
toplevel texinfo directory.


This doesn't matter.  You could in principle drop an out-of-tree texinfo 
directory and use its makeinfo to build GCC.



So I think of the rules for it as a legacy.


Actually support for in-tree build tools is quite recent (2005-ish).


I don't see m4 as useful as a build tool (rather, it's used by autoconf),


It's used by libgfortran too.


nor the use of having both byacc and bison, and while build tools bison
and flex could be used I doubt the real utility of building them in tree.


I agree that byacc can be dropped.  I just wouldn't drop 
flex/bison/m4/texinfo right now.  I would like to separate removal of 
obsolete Cygnus-tree remnants, from removal of features that we just 
don't care about anymore.  Building bison as a host module is the 
former; building bison as a build module is the latter.


Paolo


Re: [testsuite, ada] Convert ACATS to DejaGnu (PR testsuite/37703)

2011-03-25 Thread Rainer Orth
Mark Mitchell  writes:

> On 2/1/2011 6:24 PM, Joseph S. Myers wrote:
>
>> For the general issue: a slow test appears to have served its purpose by 
>> showing up a (target-specific) bug in the compiler. 
>
> Indeed.  However, that doesn't justify having lots of slow tests.  What
> it does justify is investigating the reasons behind a slow test before
> turning it off and/or simplifying it.
>
> Here is what I suggest as a policy.
>
> If a test takes longer than 30 seconds to execute (including both
> compilation and execution of the generated program) on ordinary
> workstation hardware, in a native configuration, then the test should be
> investigated.  If the problem is generic (i.e., not specific to a
> particular host or target) and nobody is actively developing a patch to
> solve the problem, then the test should be flagged as "expensive" and
> only when run when the user explicitly requests "expensive" testing.  If
> the slow execution is considered unreasonable then a PR should be filed,
> just as for any other bug.
>
> I realize that "ordinary workstation hardware" is not a well-defined
> term.  But, there's no need to specify this policy with a high degree of
> rigor; when there is a question, we can use our usual processes for
> reaching consensus, and err on the side of leaving the test as
> "inexpensive".
>
> This policy would help to eliminate the small handful of tests that take
> completely disproportionate amounts of time to execute.

If agreement on this policy could be reached, it would be good if it
could be documented somewhere on gcc.gnu.org.  I haven't found a good
place for that, though.

There's just another such set of expensive tests

testsuite/48283 gcc.dg/graphite/block-[3478].c timeouts

and

middle-end/31827limits-exprparen.c: Pid 2297 received a SIGSEGV for 
stack growth failure

has excessive stack space requirements.

Thanks.
Rainer

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


Re: More toplevel configure.ac pruning

2011-03-25 Thread Paolo Bonzini

On 03/25/2011 12:03 PM, Joseph S. Myers wrote:

>  Removing the whole native_only stuff is preapproved.


What about my patch your just replied to as a first (or Nth) step?


Sure, if I didn't write an explicit okay that was just a mistake. :)

Paolo


Re: Tighten ARM's CANNOT_CHANGE_MODE_CLASS

2011-03-25 Thread Richard Earnshaw

On Fri, 2011-03-25 at 09:28 +, Richard Sandiford wrote:
> Richard Earnshaw  writes:
> > On Thu, 2011-03-24 at 15:40 +, Richard Sandiford wrote:
> >> gcc/
> >>* config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Restrict FPA_REGS
> >>case to VFPv1.
> >> 
> >
> > GCC doesn't support VFPv1 (see the all_fpus table), and I don't think
> > many chips based on that ever escaped into the wild world, so I'm not
> > worried about trying to add that now.
> >
> > So it's probably safe to just kill that check for VFP entirely.
> 
> Even better. :-)  How does this look?  Tested on arm-linux-gnueabi,
> no regressions.
> 
> Richard
> 
> 
> gcc/
>   * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Restrict FPA_REGS
>   case to VFPv1.
> 

I think adding a comment that VFPv1 would require a restriction but that
that isn't supported would be useful.  Then if the worst happens it will
be one less bug to go track down.

OK with that change.

R.





Re: More toplevel configure.ac pruning

2011-03-25 Thread Joseph S. Myers
On Fri, 25 Mar 2011, Paolo Bonzini wrote:

> Removing the whole native_only stuff is preapproved.
> 
> These days, if you really really want to drop sed or tar in-tree, you want it
> to be built.  Whether to keep these modules is another story, but this can go
> in the meanwhile.

This patch removes native_only, and removes code disabling various 
components (not in gcc or src) on various hosts or targets, on the basis 
you give that if you put such a component in tree you want it to be built 
(which I think applies even for any that are kept as build components).  
OK to commit?

Remark: disabling "newlib" (as opposed to target-newlib) for a host seems 
odd, as does disabling "libffi".  So maybe the code disabling directories 
for host can be simplified even more.

2011-03-25  Joseph Myers  

* configure.ac (native_only): Remove.
(i[[3456789]]86-*-msdosdjgpp*): Don't disable expect dejagnu
send-pr uudecode guile gnuserv on host.
(x86_64-*-mingw*): Don't disable expect dejagnu autoconf automake
send-pr rcs guile perl texinfo libtool on host.
(i[[3456789]]86-*-mingw32*): Don't disable expect dejagnu autoconf
automake send-pr rcs guile perl texinfo libtool on host.
(*-*-cygwin*, *-*-netbsd*): Remove host cases.
(*-*-kaos*): Don't disable target-examples target-gperf on target.
(alpha*-dec-osf*): Don't disable fileutils on target.
(sh*-*-pe|mips*-*-pe|*arm-wince-pe): Don't disable target-examples
texinfo send-pr expect dejagnu on target.
(arm-*-elf* | arm*-*-eabi*, arm*-*-linux-gnueabi): Don't disable
target-qthreads on target.
(hppa*-hp-hpux11*, hppa*-*-*): Don't disable shellutils on target.
(ia64*-*-elf*, ia64*-*-*vms*): Don't disable mmalloc on target.
(i[[3456789]]86-w64-mingw*, i[[3456789]]86-*-mingw*,
x86_64-*-mingw*): Don't disable expect on target.
(*-*-cygwin*): Don't disable target-gperf on target.
(powerpc*-*-winnt* | powerpc*-*-pe*): Don't disable make expect
gnuserv on target.
(powerpcle-*-solaris*): Don't disable make expect gnuserv on
target.
* configure: Regenerate.

Index: configure.ac
===
--- configure.ac(revision 171446)
+++ configure.ac(working copy)
@@ -207,8 +207,7 @@
 # run only in the target environment
 #
 # note: any program that *uses* libraries that are in the "target_libraries"
-# list belongs in this list.  those programs are also very likely
-# candidates for the "native_only" list which follows
+# list belongs in this list.
 #
 target_tools="target-examples target-gperf target-rda"
 
@@ -296,17 +295,12 @@
   *)  echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
 esac
 
-# Some tools are only suitable for building in a "native" situation.
-# Remove these if host!=target.  
-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello 
indent m4 rcs recode sed shellutils tar textutils uudecode wdiff guile perl 
time ash bash bzip2 prms gnuserv target-gperf"
-
-# Similarly, some are only suitable for cross toolchains.
+# Some are only suitable for cross toolchains.
 # Remove these if host=target.
 cross_only="target-libgloss target-newlib target-opcodes"
 
 case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;
-  yes) skipdirs="${skipdirs} ${native_only}" ;;
 esac
 
 # If both --with-headers and --with-libs are specified, default to
@@ -427,20 +421,14 @@
 
 case "${host}" in
   i[[3456789]]86-*-msdosdjgpp*)
-noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile 
itcl gnuserv libffi"
+noconfigdirs="$noconfigdirs tcl tk itcl libffi"
 ;;
   x86_64-*-mingw*)
-noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs 
guile perl texinfo libtool newlib"
+noconfigdirs="$noconfigdirs newlib"
 ;;
   i[[3456789]]86-*-mingw32*)
-noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs 
guile perl texinfo libtool newlib"
+noconfigdirs="$noconfigdirs newlib"
 ;;
-  *-*-cygwin*)
-noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl"
-;;
-  *-*-netbsd*)
-noconfigdirs="$noconfigdirs rcs"
-;;
 esac
 
 
@@ -580,7 +568,7 @@
   *-*-kaos*)
 # Remove unsupported stuff on all kaOS configurations.
 skipdirs="target-libiberty ${libgcj} target-libstdc++-v3"
-skipdirs="$skipdirs target-libobjc target-examples target-gperf"
+skipdirs="$skipdirs target-libobjc"
 skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc 
target-zlib"
 noconfigdirs="$noconfigdirs target-libgloss"
 ;;
@@ -616,9 +604,9 @@
 ;;
   alpha*-dec-osf*)
 # ld works, but does not support shared libraries.
-# newlib is not 64 bit ready.  I'm not sure about fileutils.
+# newlib is not 64 bit ready.
 # gas doesn't generate exception information.
-   

Re: More toplevel configure.ac pruning

2011-03-25 Thread Paolo Bonzini

On 03/25/2011 12:33 PM, Joseph S. Myers wrote:

This patch removes native_only, and removes code disabling various
components (not in gcc or src) on various hosts or targets, on the basis
you give that if you put such a component in tree you want it to be built
(which I think applies even for any that are kept as build components).
OK to commit?


Yes.


Remark: disabling "newlib" (as opposed to target-newlib) for a host seems
odd, as does disabling "libffi".  So maybe the code disabling directories
for host can be simplified even more.


Yes, newlib and libffi should never be built as host modules anyway.

$ grep all-newlib ../../Makefile.in
$

Paolo


[PATCH] fix PR bootstrap/48282

2011-03-25 Thread Nathan Froyd
I've applied the obvious patch below to fix PR bootstrap/48282.

-Nathan

PR bootstrap/4828
Revert:
2011-03-24  Nathan Froyd  

* function.c (instantiate_virtual_regs): Use FOR_EACH_BB and
FOR_BB_INSNS_SAFE to iterate through insns.  Re-indent.
(pass_instantiate_virtual_regs): Require PROP_cfglayout.
* passes.c (init_optimization_passes): Move
pass_instantiate_virtual_regs after pass_into_cfg_layout_mode.

Index: function.c
===
--- function.c  (revision 171446)
+++ function.c  (working copy)
@@ -1883,7 +1883,7 @@ instantiate_decls (tree fndecl)
 static unsigned int
 instantiate_virtual_regs (void)
 {
-  basic_block bb;
+  rtx insn;
 
   /* Compute the offsets to use for this function.  */
   in_arg_offset = FIRST_PARM_OFFSET (current_function_decl);
@@ -1901,40 +1901,33 @@ instantiate_virtual_regs (void)
 
   /* Scan through all the insns, instantiating every virtual register still
  present.  */
-  FOR_EACH_BB (bb)
-{
-  rtx insn, curr;
-
-  FOR_BB_INSNS_SAFE (bb, insn, curr)
-   {
- if (INSN_P (insn))
-   {
- /* These patterns in the instruction stream can never be 
recognized.
-Fortunately, they shouldn't contain virtual registers either.  
*/
- if (GET_CODE (PATTERN (insn)) == USE
- || GET_CODE (PATTERN (insn)) == CLOBBER
- || GET_CODE (PATTERN (insn)) == ADDR_VEC
- || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
- || GET_CODE (PATTERN (insn)) == ASM_INPUT)
-   continue;
- else if (DEBUG_INSN_P (insn))
-   for_each_rtx (&INSN_VAR_LOCATION (insn),
- instantiate_virtual_regs_in_rtx, NULL);
- else
-   instantiate_virtual_regs_in_insn (insn);
+  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+if (INSN_P (insn))
+  {
+   /* These patterns in the instruction stream can never be recognized.
+  Fortunately, they shouldn't contain virtual registers either.  */
+   if (GET_CODE (PATTERN (insn)) == USE
+   || GET_CODE (PATTERN (insn)) == CLOBBER
+   || GET_CODE (PATTERN (insn)) == ADDR_VEC
+   || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
+   || GET_CODE (PATTERN (insn)) == ASM_INPUT)
+ continue;
+   else if (DEBUG_INSN_P (insn))
+ for_each_rtx (&INSN_VAR_LOCATION (insn),
+   instantiate_virtual_regs_in_rtx, NULL);
+   else
+ instantiate_virtual_regs_in_insn (insn);
 
- if (INSN_DELETED_P (insn))
-   continue;
+   if (INSN_DELETED_P (insn))
+ continue;
 
- for_each_rtx (®_NOTES (insn), instantiate_virtual_regs_in_rtx, 
NULL);
+   for_each_rtx (®_NOTES (insn), instantiate_virtual_regs_in_rtx, NULL);
 
- /* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE. 
 */
- if (CALL_P (insn))
-   for_each_rtx (&CALL_INSN_FUNCTION_USAGE (insn),
- instantiate_virtual_regs_in_rtx, NULL);
-   }
-   }
-}
+   /* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE.  */
+   if (CALL_P (insn))
+ for_each_rtx (&CALL_INSN_FUNCTION_USAGE (insn),
+   instantiate_virtual_regs_in_rtx, NULL);
+  }
 
   /* Instantiate the virtual registers in the DECLs for debugging purposes.  */
   instantiate_decls (current_function_decl);
@@ -1970,7 +1963,7 @@ struct rtl_opt_pass pass_instantiate_vir
   NULL, /* next */
   0,/* static_pass_number */
   TV_NONE,  /* tv_id */
-  PROP_cfglayout,   /* properties_required */
+  0,/* properties_required */
   0,/* properties_provided */
   0,/* properties_destroyed */
   0,/* todo_flags_start */
Index: passes.c
===
--- passes.c(revision 171446)
+++ passes.c(working copy)
@@ -956,8 +956,8 @@ init_optimization_passes (void)
   NEXT_PASS (pass_rtl_eh);
   NEXT_PASS (pass_initial_value_sets);
   NEXT_PASS (pass_unshare_all_rtl);
-  NEXT_PASS (pass_into_cfg_layout_mode);
   NEXT_PASS (pass_instantiate_virtual_regs);
+  NEXT_PASS (pass_into_cfg_layout_mode);
   NEXT_PASS (pass_jump2);
   NEXT_PASS (pass_lower_subreg);
   NEXT_PASS (pass_df_initialize_opt);


[PATCH] small refactoring in fold-const.c

2011-03-25 Thread Nathan Froyd
The patch below just moves the pattern:

  x = EXPR_LOCATION (t)
  if (x == UNKNOWN_LOCATION)
x = loc

into its own function.

Tested on x86_64-unknown-linux-gnu.  OK to commit?

* fold-const.c (expr_location_or): New function.
(fold_truth_not_expr): Call it.

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9baa9eb..35c1085 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -141,6 +141,15 @@ static tree fold_not_const (const_tree, tree);
 static tree fold_relational_const (enum tree_code, tree, tree, tree);
 static tree fold_convert_const (enum tree_code, tree, tree);
 
+/* Return EXPR_LOCATION of T if it is not UNKNOWN_LOCATION.
+   Otherwise, return LOC.  */
+
+static location_t
+expr_location_or (tree t, location_t loc)
+{
+  location_t tloc = EXPR_LOCATION (t);
+  return tloc != UNKNOWN_LOCATION ? tloc : loc;
+}
 
 /* Similar to protected_set_expr_location, but never modify x in place,
if location can and needs to be set, unshare it.  */
@@ -3079,23 +3088,15 @@ fold_truth_not_expr (location_t loc, tree arg)
   return constant_boolean_node (integer_zerop (arg), type);
 
 case TRUTH_AND_EXPR:
-  loc1 = EXPR_LOCATION (TREE_OPERAND (arg, 0));
-  loc2 = EXPR_LOCATION (TREE_OPERAND (arg, 1));
-  if (loc1 == UNKNOWN_LOCATION)
-   loc1 = loc;
-  if (loc2 == UNKNOWN_LOCATION)
-   loc2 = loc;
+  loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
+  loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
   return build2_loc (loc, TRUTH_OR_EXPR, type,
 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
 
 case TRUTH_OR_EXPR:
-  loc1 = EXPR_LOCATION (TREE_OPERAND (arg, 0));
-  loc2 = EXPR_LOCATION (TREE_OPERAND (arg, 1));
-  if (loc1 == UNKNOWN_LOCATION)
-   loc1 = loc;
-  if (loc2 == UNKNOWN_LOCATION)
-   loc2 = loc;
+  loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
+  loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
   return build2_loc (loc, TRUTH_AND_EXPR, type,
 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
@@ -3115,23 +3116,15 @@ fold_truth_not_expr (location_t loc, tree arg)
   TREE_OPERAND (arg, 1));
 
 case TRUTH_ANDIF_EXPR:
-  loc1 = EXPR_LOCATION (TREE_OPERAND (arg, 0));
-  loc2 = EXPR_LOCATION (TREE_OPERAND (arg, 1));
-  if (loc1 == UNKNOWN_LOCATION)
-   loc1 = loc;
-  if (loc2 == UNKNOWN_LOCATION)
-   loc2 = loc;
+  loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
+  loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
   return build2_loc (loc, TRUTH_ORIF_EXPR, type,
 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
 
 case TRUTH_ORIF_EXPR:
-  loc1 = EXPR_LOCATION (TREE_OPERAND (arg, 0));
-  loc2 = EXPR_LOCATION (TREE_OPERAND (arg, 1));
-  if (loc1 == UNKNOWN_LOCATION)
-   loc1 = loc;
-  if (loc2 == UNKNOWN_LOCATION)
-   loc2 = loc;
+  loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
+  loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
   return build2_loc (loc, TRUTH_ANDIF_EXPR, type,
 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
@@ -3144,12 +3137,8 @@ fold_truth_not_expr (location_t loc, tree arg)
tree arg1 = TREE_OPERAND (arg, 1);
tree arg2 = TREE_OPERAND (arg, 2);
 
-   loc1 = EXPR_LOCATION (TREE_OPERAND (arg, 1));
-   loc2 = EXPR_LOCATION (TREE_OPERAND (arg, 2));
-   if (loc1 == UNKNOWN_LOCATION)
- loc1 = loc;
-   if (loc2 == UNKNOWN_LOCATION)
- loc2 = loc;
+   loc1 = expr_location_or (TREE_OPERAND (arg, 1), loc);
+   loc2 = expr_location_or (TREE_OPERAND (arg, 2), loc);
 
/* A COND_EXPR may have a throw as one operand, which
   then has void type.  Just leave void operands
@@ -3162,17 +3151,13 @@ fold_truth_not_expr (location_t loc, tree arg)
   }
 
 case COMPOUND_EXPR:
-  loc1 = EXPR_LOCATION (TREE_OPERAND (arg, 1));
-  if (loc1 == UNKNOWN_LOCATION)
-   loc1 = loc;
+  loc1 = expr_location_or (TREE_OPERAND (arg, 1), loc);
   return build2_loc (loc, COMPOUND_EXPR, type,
 TREE_OPERAND (arg, 0),
 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 1)));
 
 case NON_LVALUE_EXPR:
-  loc1 = EXPR_LOCATION (TREE_OPERAND (arg, 0));
-  if (loc1 == UNKNOWN_LOCATION)
-   loc1 = loc;
+  loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
   return invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0));
 
 CASE_CONVERT:
@@ -3182,9 +3167,7 @@ fold_truth_not_expr (locati

Re: [PATCH] small refactoring in fold-const.c

2011-03-25 Thread Diego Novillo
On Fri, Mar 25, 2011 at 07:52, Nathan Froyd  wrote:

>        * fold-const.c (expr_location_or): New function.
>        (fold_truth_not_expr): Call it.

OK.

Diego.


Re: [PATCH][ARM] Discourage use of NEON on Cortex-A8

2011-03-25 Thread Andrew Stubbs

On 24/03/11 13:22, Richard Earnshaw wrote:

OK


Committed, thanks.

Andrew


Re: More toplevel configure.ac pruning

2011-03-25 Thread Rainer Orth
"Joseph S. Myers"  writes:

>   (powerpcle-*-solaris*): Don't disable make expect gnuserv on
>   target.

As I happen to see this: Solaris/PowerPC is ancient history by now
(2.5.1, 2.6, I believe).  This can probably go.

Rainer

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


Re: Cleaning up expand optabs code

2011-03-25 Thread Georg-Johann Lay
Andreas Krebbel schrieb:
> On 03/22/2011 06:48 PM, Richard Henderson wrote:
> 
>> Ok.  Watch out for other target problems this week.

libgcc fails to build for avr (SVN 171446)

../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c: In function
'__negdi2':
../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c:68:17:
internal compiler error: in maybe_gen_insn, at  optabs.c:7123

Target: avr
Configured with: ../../gcc.gnu.org/trunk/configure --target=avr
--prefix=/local/gnu/install/gcc-4.6 --enable-languages=c,c++
--disable-libssp --disable-libada --disable-nls --disable-shared

Attached the source where it crashes; compile with -S -Os

Building last 4.7 snapshot + avr backend from HEAD works fine.

Johann






















typedef int ptrdiff_t;

typedef unsigned int size_t;

typedef int wchar_t;







extern void *malloc (size_t);



extern void free (void *);



extern int atexit (void (*)(void));



extern void abort (void) __attribute__ ((__noreturn__));



extern size_t strlen (const char *);



extern void *memcpy (void *, const void *, size_t);



extern void *memset (void *, int, size_t);



extern int filename_cmp (const char *s1, const char *s2);


extern int filename_ncmp (const char *s1, const char *s2,
 size_t n);




struct _dont_use_rtx_here_;
struct _dont_use_rtvec_here_;
union _dont_use_tree_here_;











enum debug_info_type
{
  NO_DEBUG,
  DBX_DEBUG,
  SDB_DEBUG,
  DWARF2_DEBUG,
  XCOFF_DEBUG,
  VMS_DEBUG,
  VMS_AND_DWARF2_DEBUG

};

enum debug_info_levels
{
  DINFO_LEVEL_NONE,
  DINFO_LEVEL_TERSE,
  DINFO_LEVEL_NORMAL,
  DINFO_LEVEL_VERBOSE
};

enum debug_info_usage
{
  DINFO_USAGE_DFN,
  DINFO_USAGE_DIR_USE,
  DINFO_USAGE_IND_USE,
  DINFO_USAGE_NUM_ENUMS
};

enum debug_struct_file
{
  DINFO_STRUCT_FILE_NONE,
  DINFO_STRUCT_FILE_BASE,

  DINFO_STRUCT_FILE_SYS,

  DINFO_STRUCT_FILE_ANY
};





enum symbol_visibility
{
  VISIBILITY_DEFAULT,
  VISIBILITY_PROTECTED,
  VISIBILITY_HIDDEN,
  VISIBILITY_INTERNAL
};



enum ira_algorithm
{
  IRA_ALGORITHM_CB,
  IRA_ALGORITHM_PRIORITY
};


enum ira_region
{
  IRA_REGION_ONE,
  IRA_REGION_ALL,
  IRA_REGION_MIXED
};


enum excess_precision
{
  EXCESS_PRECISION_DEFAULT,
  EXCESS_PRECISION_FAST,
  EXCESS_PRECISION_STANDARD
};


enum graph_dump_types
{
  no_graph = 0,
  vcg
};


enum stack_check_type
{

  NO_STACK_CHECK = 0,



  GENERIC_STACK_CHECK,




  STATIC_BUILTIN_STACK_CHECK,



  FULL_BUILTIN_STACK_CHECK
};




enum warn_strict_overflow_code
{



  WARN_STRICT_OVERFLOW_ALL = 1,




  WARN_STRICT_OVERFLOW_CONDITIONAL = 2,


  WARN_STRICT_OVERFLOW_COMPARISON = 3,


  WARN_STRICT_OVERFLOW_MISC = 4,


  WARN_STRICT_OVERFLOW_MAGNITUDE = 5
};


enum fp_contract_mode {
  FP_CONTRACT_OFF = 0,
  FP_CONTRACT_ON = 1,
  FP_CONTRACT_FAST = 2
};


enum vect_verbosity_levels {
  REPORT_NONE,
  REPORT_VECTORIZED_LOCATIONS,
  REPORT_UNVECTORIZED_LOCATIONS,
  REPORT_COST,
  REPORT_ALIGNMENT,
  REPORT_DR_DETAILS,
  REPORT_BAD_FORM_LOOPS,
  REPORT_OUTER_LOOPS,
  REPORT_SLP,
  REPORT_DETAILS,

  MAX_VERBOSITY_LEVEL
};


enum opt_code
{
  OPT = 0,

  OPT__help = 27,
  OPT__help_ = 28,

  OPT__output_pch_ = 58,

  OPT__param = 60,

  OPT__sysroot_ = 90,
  OPT__target_help = 91,

  OPT__version = 101,


  OPT_A = 104,
  OPT_B = 105,
  OPT_C = 106,
  OPT_CC = 107,
  OPT_D = 108,
  OPT_E = 109,
  OPT_F = 110,
  OPT_H = 111,
  OPT_I = 112,
  OPT_J = 113,
  OPT_L = 114,
  OPT_M = 115,
  OPT_MD = 116,
  OPT_MF = 117,
  OPT_MG = 118,
  OPT_MM = 119,
  OPT_MMD = 120,
  OPT_MP = 121,
  OPT_MQ = 122,
  OPT_MT = 123,
  OPT_N = 124,
  OPT_O = 125,
  OPT_Ofast = 126,
  OPT_Os = 127,
  OPT_P = 128,
  OPT_Q = 129,
  OPT_Qn = 130,
  OPT_Qy = 131,
  OPT_R = 132,
  OPT_S = 133,
  OPT_T = 134,
  OPT_Tbss = 135,
  OPT_Tdata = 136,
  OPT_Ttext = 137,
  OPT_U = 138,

  OPT_Wa_ = 140,
  OPT_Wabi = 141,
  OPT_Waddress = 142,
  OPT_Waggregate_return = 143,
  OPT_Waliasing = 144,
  OPT_Walign_commons = 145,
  OPT_Wall = 146,
  OPT_Wampersand = 147,
  OPT_Warray_bounds = 148,
  OPT_Warray_temporaries = 149,
  OPT_Wassign_intercept = 150,
  OPT_Wattributes = 151,
  OPT_Wbad_function_cast = 152,
  OPT_Wbuiltin_macro_redefined = 153,
  OPT_Wc___compat = 154,
  OPT_Wc__0x_compat = 155,
  OPT_Wcast_align = 156,
  OPT_Wcast_qual = 157,
  OPT_Wchar_subscripts = 158,
  OPT_Wcharacter_truncation = 159,
  OPT_Wclobbered = 160,
  OPT_Wcomment = 161,

  OPT_Wconversion = 163,
  OPT_Wconversion_extra = 164,
  OPT_Wconversion_null = 165,
  OPT_Wcoverage_mismatch = 166,
  OPT_Wcpp = 167,
  OPT_Wctor_dtor_privacy = 168,
  OPT_Wdeclaration_after_statement = 169,
  OPT_Wdeprecated = 170,
  OPT_Wdeprecated_declarations = 171,
  OPT_Wdisabled_optimization = 172,
  OPT_Wdiv_by_zero = 173,
  OPT_Wdouble_promotion = 174,
  OPT_Weffc__ = 175,
  OPT_Wempty_body = 176,
  OPT_Wendif_labels = 177,
  OPT_Wenum_compare = 178,
  OPT_Werror = 179,

  OPT_Werror_ = 181,
  OPT_Wextra = 182,
  OPT_Wfatal_errors = 183,
  OPT_Wfloat_equal = 184,
  OPT_Wformat = 185,
  OPT_Wformat_contains_nul = 186,
  OPT

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Aldy Hernandez



But hoisting global in this case doesn't result in a data race, since the
loop always accesses global and contains no synchronisation code.  If it
were only accessed conditionally, as in the examples under "Avoiding
Speculation" on that page, then there would be a race in hoisting it, but
not for the code you gave; any data races with the hoisting would still
have been present without it.


My fault for not being specific about it... I tend to just use data race as
a catch all for all these types of things when talking about them with Aldy.


Arghh... I took Andrew's testcase unmodified, and assumed it did not 
conform to the model.  Sorry for the confusion.



the testcase should have  for (x=0; x<  limit; x++)  sum[x] = global;
rather than x<5,  so that its not a known loop count.


And in this variant, we no longer have a data race.  The load from 
global is guarded by the limit check.



But speculative loads are never a problem.  So I'd like to avoid cluttering
GCC code with stuff to avoid them.  I honestly don't care about diagnostic
tools that fail to see if a value read is used or not.


Frankly, I agree.  The standard (and the aforementioned paper) says that 
load data races are disallowed...


"If we had hypothetical hardware (or a virtual machine) that aborted the 
program when a race was detected, compilers would not be allowed to 
introduce potentially racing loads... even if the result of the load 
were unused would change the semantics of the program. Although such 
environments are not commonplace, they have certainly been proposed, and 
may well turn out to be very useful."


...but, if there's no hardware for it, I see no need for spending time 
on this.  Do y'all agree, so I can drop this witch hunt?


In which case, unfortunately, all the tests I had from Andrew (that 
actually trigger) are load data races.  So I'll have to hunt for invalid 
speculative stores instead.


Back to the drawing board.

Thanks folks.


[testsuite] Mark gcc.dg/graphite/block-[3478].c as expensive (PR testsuite/48283)

2011-03-25 Thread Rainer Orth
As discussed in the PR, I'd like to skip the 4 very expensive
gcc.dg/graphite/block-?.c tests for now.

Tested with the appropriate runtest invocation with and without
GCC_TEST_RUN_EXPENSIVE set.

Ok for mainline?

Rainer


2011-03-25  Rainer Orth  

PR testsuite/48283
* gcc.dg/graphite/block-3.c: Add dg-require-effective-target
run_expensive_tests.
* gcc.dg/graphite/block-4.c: Likewise.
* gcc.dg/graphite/block-7.c: Likewise.
* gcc.dg/graphite/block-8.c: Likewise.

diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-3.c
--- a/gcc/testsuite/gcc.dg/graphite/block-3.c   Fri Mar 25 13:14:48 2011 +0100
+++ b/gcc/testsuite/gcc.dg/graphite/block-3.c   Fri Mar 25 13:55:25 2011 +0100
@@ -1,4 +1,5 @@
 /* { dg-require-effective-target size32plus } */
+/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
 /* { dg-timeout-factor 4.0 } */
 
 #define DEBUG 0
diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-4.c
--- a/gcc/testsuite/gcc.dg/graphite/block-4.c   Fri Mar 25 13:14:48 2011 +0100
+++ b/gcc/testsuite/gcc.dg/graphite/block-4.c   Fri Mar 25 13:55:25 2011 +0100
@@ -1,4 +1,5 @@
 /* { dg-require-effective-target size32plus } */
+/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
 
 #define DEBUG 0
 #if DEBUG
diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-7.c
--- a/gcc/testsuite/gcc.dg/graphite/block-7.c   Fri Mar 25 13:14:48 2011 +0100
+++ b/gcc/testsuite/gcc.dg/graphite/block-7.c   Fri Mar 25 13:55:25 2011 +0100
@@ -1,4 +1,5 @@
 /* { dg-require-effective-target size32plus } */
+/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
 
 #define DEBUG 0
 #if DEBUG
diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-8.c
--- a/gcc/testsuite/gcc.dg/graphite/block-8.c   Fri Mar 25 13:14:48 2011 +0100
+++ b/gcc/testsuite/gcc.dg/graphite/block-8.c   Fri Mar 25 13:55:25 2011 +0100
@@ -1,4 +1,5 @@
 /* { dg-require-effective-target size32plus } */
+/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
 
 #define DEBUG 0
 #if DEBUG

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


Re: Cleaning up expand optabs code

2011-03-25 Thread Georg-Johann Lay
Georg-Johann Lay schrieb:
> Andreas Krebbel schrieb:
>> On 03/22/2011 06:48 PM, Richard Henderson wrote:
>>
>>> Ok.  Watch out for other target problems this week.
> 
> libgcc fails to build for avr (SVN 171446)
> 
> ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c: In function
> '__negdi2':
> ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c:68:17:
> internal compiler error: in maybe_gen_insn, at  optabs.c:7123

p.s.: some additional info

(gdb) set args -quiet -v -iprefix
/local/gnu/build/gcc-4.6-avr/gcc/../lib/gcc/avr/4.7.0/ -isystem
/mnt/nfs/home/georg/gnu/build/gcc-4.6-avr/gcc/include -isystem
/mnt/nfs/home/georg/gnu/build/gcc-4.6-avr/gcc/include-fixed
libgcc2-negdi2.c -quiet -dumpbase libgcc2-negdi2.c -auxbase
libgcc2-negdi2 -Os -version -o libgcc2-negdi2.s
(gdb) cd ~/test
(gdb) r
GNU C (GCC) version 4.7.0 20110325 (experimental) (avr)
compiled by GNU C version 4.3.2 [gcc-4_3-branch revision 141291], GMP
version 5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

Breakpoint 1, fancy_abort (file=0x87ee230
"../../../gcc.gnu.org/trunk/gcc/optabs.c", line=7123,
function=0x87ee585 "maybe_gen_insn") at
../../../gcc.gnu.org/trunk/gcc/diagnostic.c:893
(gdb) bt
#0  fancy_abort (file=0x87ee230
"../../../gcc.gnu.org/trunk/gcc/optabs.c", line=7123,
function=0x87ee585 "maybe_gen_insn") at
../../../gcc.gnu.org/trunk/gcc/diagnostic.c:893
#1  0x0837a86a in maybe_gen_insn (icode=CODE_FOR_setmemhi, nops=6,
ops=0xbfffdfcc) at ../../../gcc.gnu.org/trunk/gcc/optabs.c:7123
#2  0x0837a91f in maybe_expand_insn (icode=CODE_FOR_setmemhi, nops=6,
ops=0xbfffdfcc) at ../../../gcc.gnu.org/trunk/gcc/optabs.c:7155
#3  0x08241122 in set_storage_via_setmem (object=0xb7dfcc60,
size=0xb7d682f8, val=0xb7d682b8, align=,
expected_align=, expected_size=-1) at
../../../gcc.gnu.org/trunk/gcc/expr.c:2730
#4  0x082567d5 in clear_storage_hints (object=0xb7dfcc60,
size=0xb7d682f8, method=BLOCK_OP_NORMAL, expected_align=0,
expected_size=-1) at ../../../gcc.gnu.org/trunk/gcc/expr.c:2575
#5  0x0825691f in clear_storage (object=0xb7dfcc60, size=0xb7d682f8,
method=BLOCK_OP_NORMAL) at ../../../gcc.gnu.org/trunk/gcc/expr.c:2590
#6  0x0825aa83 in store_constructor (exp=0xb7dfaca8,
target=0xb7dfcc60, cleared=0, size=8) at
../../../gcc.gnu.org/trunk/gcc/expr.c:5188
#7  0x0825b6fe in expand_constructor (exp=0xb7dfaca8,
target=0xb7dfcc60, modifier=EXPAND_NORMAL, avoid_temp_mem=0 '\0') at
../../../gcc.gnu.org/trunk/gcc/expr.c:7092
#8  0x0824dade in expand_expr_real_1 (exp=0xb7dfaca8,
target=0xb7dfcc60, tmode=BLKmode, modifier=EXPAND_NORMAL,
alt_rtl=0xbfffe35c) at ../../../gcc.gnu.org/trunk/gcc/expr.c:8655
#9  0x08245d52 in store_expr (exp=0xb7dfaca8, target=0xb7dfcc60,
call_param_p=0, nontemporal=0 '\0') at
../../../gcc.gnu.org/trunk/gcc/expr.c:4645
#10 0x08257949 in expand_assignment (to=0xb7e2a1e0, from=0xb7dfaca8,
nontemporal=5 '\005') at ../../../gcc.gnu.org/trunk/gcc/expr.c:4433
#11 0x081a61aa in expand_gimple_stmt (stmt=0xb7e237e0) at
../../../gcc.gnu.org/trunk/gcc/cfgexpand.c:1971
#12 0x081a7200 in expand_gimple_basic_block (bb=0xb7ddf3c0) at
../../../gcc.gnu.org/trunk/gcc/cfgexpand.c:3645
#13 0x081a8a65 in gimple_expand_cfg () at
../../../gcc.gnu.org/trunk/gcc/cfgexpand.c:4128
#14 0x08395334 in execute_one_pass (pass=0x88742e0) at
../../../gcc.gnu.org/trunk/gcc/passes.c:1554
#15 0x0839562d in execute_pass_list (pass=0x88742e0) at
../../../gcc.gnu.org/trunk/gcc/passes.c:1609
#16 0x08475baa in tree_rest_of_compilation (fndecl=0xb7e21180) at
../../../gcc.gnu.org/trunk/gcc/tree-optimize.c:422
#17 0x08615bc6 in cgraph_expand_function (node=0xb7e2c000) at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1576
#18 0x08618c59 in cgraph_optimize () at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1635
#19 0x0861915d in cgraph_finalize_compilation_unit () at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1096
#20 0x080b6590 in c_write_global_declarations () at
../../../gcc.gnu.org/trunk/gcc/c-decl.c:9879
#21 0x08411fae in toplev_main (argc=19, argv=0xbfffe874) at
../../../gcc.gnu.org/trunk/gcc/toplev.c:591
#22 0x08152372 in main (argc=Cannot access memory at address 0x1
) at ../../../gcc.gnu.org/trunk/gcc/main.c:36
(gdb) frame 1
#1  0x0837a86a in maybe_gen_insn (icode=CODE_FOR_setmemhi, nops=6,
ops=0xbfffdfcc) at ../../../gcc.gnu.org/trunk/gcc/optabs.c:7123
(gdb) p nops
$1 = 6
(gdb) p insn_data[(int) icode].n_operands
$2 = 5 '\005'
(gdb) p *ops
$3 = {type = EXPAND_FIXED, unsigned_p = 0, unused = 0, mode =
VOIDmode, value = 0xb7dfcc60}
(gdb) p ops -> value
$4 = (rtx) 0xb7dfcc60
(gdb) pr
(mem/s/c:BLK (reg/f:HI 37 virtual-stack-vars) [2 w+0 S8 A8])
(gdb) p icode
$5 = CODE_FOR_setmemhi
(gdb) Quit
(gdb)


Re: [testsuite] Mark gcc.dg/graphite/block-[3478].c as expensive (PR testsuite/48283)

2011-03-25 Thread Richard Guenther
On Fri, 25 Mar 2011, Rainer Orth wrote:

> As discussed in the PR, I'd like to skip the 4 very expensive
> gcc.dg/graphite/block-?.c tests for now.
> 
> Tested with the appropriate runtest invocation with and without
> GCC_TEST_RUN_EXPENSIVE set.
> 
> Ok for mainline?

Ok.

Thanks,
Richard.

>   Rainer
> 
> 
> 2011-03-25  Rainer Orth  
> 
>   PR testsuite/48283
>   * gcc.dg/graphite/block-3.c: Add dg-require-effective-target
>   run_expensive_tests.
>   * gcc.dg/graphite/block-4.c: Likewise.
>   * gcc.dg/graphite/block-7.c: Likewise.
>   * gcc.dg/graphite/block-8.c: Likewise.
> 
> diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-3.c
> --- a/gcc/testsuite/gcc.dg/graphite/block-3.c Fri Mar 25 13:14:48 2011 +0100
> +++ b/gcc/testsuite/gcc.dg/graphite/block-3.c Fri Mar 25 13:55:25 2011 +0100
> @@ -1,4 +1,5 @@
>  /* { dg-require-effective-target size32plus } */
> +/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
>  /* { dg-timeout-factor 4.0 } */
>  
>  #define DEBUG 0
> diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-4.c
> --- a/gcc/testsuite/gcc.dg/graphite/block-4.c Fri Mar 25 13:14:48 2011 +0100
> +++ b/gcc/testsuite/gcc.dg/graphite/block-4.c Fri Mar 25 13:55:25 2011 +0100
> @@ -1,4 +1,5 @@
>  /* { dg-require-effective-target size32plus } */
> +/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
>  
>  #define DEBUG 0
>  #if DEBUG
> diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-7.c
> --- a/gcc/testsuite/gcc.dg/graphite/block-7.c Fri Mar 25 13:14:48 2011 +0100
> +++ b/gcc/testsuite/gcc.dg/graphite/block-7.c Fri Mar 25 13:55:25 2011 +0100
> @@ -1,4 +1,5 @@
>  /* { dg-require-effective-target size32plus } */
> +/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
>  
>  #define DEBUG 0
>  #if DEBUG
> diff -r b0b1c1c481d3 gcc/testsuite/gcc.dg/graphite/block-8.c
> --- a/gcc/testsuite/gcc.dg/graphite/block-8.c Fri Mar 25 13:14:48 2011 +0100
> +++ b/gcc/testsuite/gcc.dg/graphite/block-8.c Fri Mar 25 13:55:25 2011 +0100
> @@ -1,4 +1,5 @@
>  /* { dg-require-effective-target size32plus } */
> +/* { dg-require-effective-target run_expensive_tests }  PR testsuite/48283 */
>  
>  #define DEBUG 0
>  #if DEBUG
> 
> 

-- 
Richard Guenther 
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex


Re: More toplevel configure.ac pruning

2011-03-25 Thread Joseph S. Myers
On Fri, 25 Mar 2011, Rainer Orth wrote:

> "Joseph S. Myers"  writes:
> 
> > (powerpcle-*-solaris*): Don't disable make expect gnuserv on
> > target.
> 
> As I happen to see this: Solaris/PowerPC is ancient history by now
> (2.5.1, 2.6, I believe).  This can probably go.

It appears there's still some bfd, ld and newlib support for this target.  
If that goes, then I think the toplevel code can indeed go away.  (My 
model is: if a target isn't supported by GCC there's no need for any 
toplevel configure code to disable GCC directories for that target, but 
nor does it matter if it falls into a default case that does disable such 
directories, and likewise if there's no src repository support for a 
target then toplevel doesn't need to disable src directories for it.  So I 
will be removing GCC directory references from cases for targets not 
supported by GCC.)

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


[PATCH] Baby-step for cleaning up the gimple verifier(s)

2011-03-25 Thread Richard Guenther

This merges the machinery for verify_stmts and verify_types_in_gimple_*.
A step in the direction to merge the various verifications we do
on gimple.  A further step would move the calls to verify_expr to
appropriate places when verifying stmts instead of walking all ops.

The goal is still that the core verifiers work on all forms of gimple,
properly guarding/extending parts with IL properties is also on the
list of things to do.  So is dropping conditionalizing/separating
type checking.

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

Richard.

2011-03-25  Richard Guenther  

* tree-flow.h (verify_stmts): Rename to verify_gimple_in_cfg.
(verify_types_in_gimple_seq): Rename to verify_gimple_in_seq.
(verify_gimple): Remove.
* tree-cfg.c (verify_gimple_call): Merge verification
from verify_stmts.
(verify_gimple_phi): Merge verification from verify_stmts.
(verify_gimple_label): New function.
(verify_types_in_gimple_seq_2): Rename to verify_gimple_in_seq_2.
(verify_types_in_gimple_seq): Rename to verify_gimple_in_seq.
(verify_stmt): Merge into verify_gimple_in_cfg and callees.
(verify_stmts): Rename to verify_gimple_in_cfg.
(verify_gimple_in_cfg): New function.
* passes.c (execute_function_todo): Call verify_gimple_in_cfg.
* tree-ssa.c (verify_ssa): Likewise.
* gimplify.c (gimplify_body): Call verify_gimple_in_seq.

Index: gcc/tree-flow.h
===
*** gcc/tree-flow.h.orig2011-03-25 13:02:20.0 +0100
--- gcc/tree-flow.h 2011-03-25 13:07:55.0 +0100
*** extern basic_block label_to_block_fn (st
*** 426,434 
  #define label_to_block(t) (label_to_block_fn (cfun, t))
  extern void notice_special_calls (gimple);
  extern void clear_special_calls (void);
! extern void verify_stmts (void);
! extern void verify_gimple (void);
! extern void verify_types_in_gimple_seq (gimple_seq);
  extern tree gimple_block_label (basic_block);
  extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
  extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
--- 426,433 
  #define label_to_block(t) (label_to_block_fn (cfun, t))
  extern void notice_special_calls (gimple);
  extern void clear_special_calls (void);
! extern void verify_gimple_in_seq (gimple_seq);
! extern void verify_gimple_in_cfg (struct function *);
  extern tree gimple_block_label (basic_block);
  extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
  extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
Index: gcc/tree-cfg.c
===
*** gcc/tree-cfg.c.orig 2011-03-25 13:02:20.0 +0100
--- gcc/tree-cfg.c  2011-03-25 14:39:27.0 +0100
*** static bool
*** 3116,3126 
  verify_gimple_call (gimple stmt)
  {
tree fn = gimple_call_fn (stmt);
!   tree fntype;
unsigned i;
  
!   if (TREE_CODE (fn) != OBJ_TYPE_REF
!   && !is_gimple_val (fn))
  {
error ("invalid function in gimple call");
debug_generic_stmt (fn);
--- 3116,3125 
  verify_gimple_call (gimple stmt)
  {
tree fn = gimple_call_fn (stmt);
!   tree fntype, fndecl;
unsigned i;
  
!   if (!is_gimple_call_addr (fn))
  {
error ("invalid function in gimple call");
debug_generic_stmt (fn);
*** verify_gimple_call (gimple stmt)
*** 3135,3140 
--- 3134,3150 
return true;
  }
  
+fndecl = gimple_call_fndecl (stmt);
+if (fndecl
+&& TREE_CODE (fndecl) == FUNCTION_DECL
+&& DECL_LOOPING_CONST_OR_PURE_P (fndecl)
+&& !DECL_PURE_P (fndecl)
+&& !TREE_READONLY (fndecl))
+  {
+error ("invalid pure const state for function");
+return true;
+  }
+ 
if (gimple_call_lhs (stmt)
&& (!is_gimple_lvalue (gimple_call_lhs (stmt))
  || verify_types_in_gimple_reference (gimple_call_lhs (stmt), true)))
*** verify_gimple_switch (gimple stmt)
*** 3985,4030 
  }
  
  
- /* Verify the contents of a GIMPLE_PHI.  Returns true if there is a problem,
-and false otherwise.  */
- 
- static bool
- verify_gimple_phi (gimple stmt)
- {
-   tree type = TREE_TYPE (gimple_phi_result (stmt));
-   unsigned i;
- 
-   if (TREE_CODE (gimple_phi_result (stmt)) != SSA_NAME)
- {
-   error ("invalid PHI result");
-   return true;
- }
- 
-   for (i = 0; i < gimple_phi_num_args (stmt); i++)
- {
-   tree arg = gimple_phi_arg_def (stmt, i);
-   if ((is_gimple_reg (gimple_phi_result (stmt))
-  && !is_gimple_val (arg))
- || (!is_gimple_reg (gimple_phi_result (stmt))
- && !is_gimple_addressable (arg)))
-   {
- error ("invalid PHI argument");
- debug_generic_stmt (arg);
- retur

PowerPC64 reload failure with misaligned fp load

2011-03-25 Thread Alan Modra
Compiler errors like the following have plagued powerpc64 gcc for a
long time.

error: insn does not satisfy its constraints:
(insn 43020 13791 13792 1245 _thread.c:8306 (set (reg:DF 12 12)
(mem:DF (plus:DI (reg:DI 3 3 [orig:4092 D.11951 ] [4092])
(const_int 15 [0xf])) [0 S8 A64])) 388 {*movdf_hardfloat64} 

They tend to appear when there is high register pressure and
misaligned doubles.  Often the reason the memory is misaligned is due
to user error, for example, compiling generated code full of macros
highly optimized for some other architecture.  So people fix their
error and this sort of compiler bug doesn't get much attention.

I spent some time in gdb yesterday looking at what goes wrong in
reload for this insn.  First time in calculate_needs_all_insns we see

(insn 11358 11553 11359 1256 _thread.c:8306 (set (reg/v:DF 12 12 [orig:4065 
___F64V1 ] [4065])
(mem:DF (plus:DI (reg:DI 15 15 [orig:4062 D.10743 ] [4062])
(const_int 15 [0xf])) [16 S8 A64])) 388 {*movdf_hardfloat64} 
(nil))

Reload correctly chooses the r,Y alternative of movdf_hardfloat64 and
also correctly notices the address in the mem doesn't match the Y
constraint so reloads the address.  All good so far.

However, some spills are needed and r12 gets chosen as a spill reg.
Next time in calculate_needs_all_insns we see

(insn 11358 11553 11359 1256 _thread.c:8306 (set (reg/v:DF 4065 [ ___F64V1 ])
(mem:DF (plus:DI (reg:DI 15 15 [orig:4062 D.10743 ] [4062])
(const_int 15 [0xf])) [16 S8 A64])) 388 {*movdf_hardfloat64} 
(nil))

Notice we are back to a pseudo for the set dest.  reg_renumber[4065]
is -1 and reg_equiv_mem[4065] is a stack slot.
(mem/c:DF (plus:DI (reg/f:DI 1 1)
(const_int 112 [0x70])) [19 %sfp+112 S8 A64])
No surprises there.

The problem is that the stack slot perfectly matches the Y constraint,
and we see reload choosing the Y,r alternative of movdf_hardfloat64 as
this happens to give a better "losers" value than the r,Y alternative.
This is a bit weird considering the original instruction was a load
and now we're matching a store, but reasonable when you realize that
what reload is looking at now is really a mem->mem move.
But of course now 
(mem:DF (plus:DI (reg:DI 15 15 [orig:4062 D.10743 ] [4062])
(const_int 15 [0xf])) [16 S8 A64])
needs to be reloaded to a reg, and this is attempted with a general
reg.  Reload assumes that this reload is OK, but really hasn't made
any progress at all!

How to fix this?  Well, stack slots need to stay matching the Y
constraint since we obviously need to load and store fp values in
stack slots.  I don't think adding '?' to the first constraint is a
solution as then the problem would reappear on fp stores to misaligned
mem.  The only solution I see is a secondary reload to fix up invalid
offset addresses.

Much of the following patch is based on Michael Meissner's support for
vector reloads.  The predicates.md change teaches the predicate used
by the "Y" constraint to check cmodel medium addresses in case such
addresses should ever be generated with invalid offsets.
Bootstrapped and regression tested powerpc64-linux. OK mainline?

* config/rs6000/predicates.md (word_offset_memref_op): Handle
cmodel medium addresses.
* config/rs6000/rs6000.c (rs6000_secondary_reload): Handle misaligned
64-bit gpr loads and stores.
(rs6000_secondary_reload_ppc64): New function.
* config/rs6000/rs6000-protos.h: Declare it.
* config/rs6000/rs6000.md (reload_di_store, reload_di_load): New.

Index: gcc/config/rs6000/predicates.md
===
--- gcc/config/rs6000/predicates.md (revision 171446)
+++ gcc/config/rs6000/predicates.md (working copy)
@@ -435,9 +435,12 @@ (define_predicate "word_offset_memref_op
 op = XEXP (op, 0);
   else if (GET_CODE (op) == PRE_MODIFY)
 op = XEXP (op, 1);
+  else if (GET_CODE (op) == LO_SUM
+  && GET_CODE (XEXP (op, 0)) == REG
+  && GET_CODE (XEXP (op, 1)) == CONST)
+op = XEXP (XEXP (op, 1), 0);
 
   return (GET_CODE (op) != PLUS
- || ! REG_P (XEXP (op, 0))
  || GET_CODE (XEXP (op, 1)) != CONST_INT
  || INTVAL (XEXP (op, 1)) % 4 == 0);
 })
Index: gcc/config/rs6000/rs6000-protos.h
===
--- gcc/config/rs6000/rs6000-protos.h   (revision 171446)
+++ gcc/config/rs6000/rs6000-protos.h   (working copy)
@@ -79,6 +79,7 @@ extern bool (*rs6000_cannot_change_mode_
enum machine_mode,
enum reg_class);
 extern void rs6000_secondary_reload_inner (rtx, rtx, rtx, bool);
+extern void rs6000_secondary_reload_ppc64 (rtx, rtx, rtx, bool);
 extern int paired_emit_vector_cond_expr (rtx, rtx, rtx,
  rtx, rtx, rtx);
 extern void paired_expand_vector_mo

PR 47487 powerpc64 ICE building libgo

2011-03-25 Thread Alan Modra
Bootstrapped etc. powerpc64-linux.  OK mainline?

PR target/47487
* config/rs6000/rs6000.c (rs6000_output_function_epilogue): Support
GNU Go in traceback table.

Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 171446)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -22061,10 +22150,11 @@ rs6000_output_function_epilogue (FILE *f
 use language_string.
 C is 0.  Fortran is 1.  Pascal is 2.  Ada is 3.  C++ is 9.
 Java is 13.  Objective-C is 14.  Objective-C++ isn't assigned
-a number, so for now use 9.  LTO isn't assigned a number either,
-so for now use 0.  */
+a number, so for now use 9.  LTO and Go aren't assigned numbers
+either, so for now use 0.  */
   if (! strcmp (language_string, "GNU C")
- || ! strcmp (language_string, "GNU GIMPLE"))
+ || ! strcmp (language_string, "GNU GIMPLE")
+ || ! strcmp (language_string, "GNU Go"))
i = 0;
   else if (! strcmp (language_string, "GNU F77")
   || ! strcmp (language_string, "GNU Fortran"))

-- 
Alan Modra
Australia Development Lab, IBM


Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Michael Matz
Hi,

On Fri, 25 Mar 2011, Aldy Hernandez wrote:

> > But speculative loads are never a problem.  So I'd like to avoid 
> > cluttering GCC code with stuff to avoid them.  I honestly don't care 
> > about diagnostic tools that fail to see if a value read is used or 
> > not.
> 
> Frankly, I agree.  The standard (and the aforementioned paper) says that 
> load data races are disallowed...
> 
> "If we had hypothetical hardware (or a virtual machine) that aborted the
> program when a race was detected, compilers would not be allowed to introduce
> potentially racing loads... even if the result of the load were unused would
> change the semantics of the program. Although such environments are not
> commonplace, they have certainly been proposed, and may well turn out to be
> very useful."
> 
> ...but, if there's no hardware for it, I see no need for spending time on
> this.

Even if there was such (IMO useless) hardware, or somebody would waste his 
time in writing such (equally useless) virtual machine that can detect 
fabricated problems somebody invented for some standard that never are 
going to be problems in the real world, we shouldn't feel obliged to 
uglify GCC for that.

(OTOH my opinion about the new c++ memory model is known ;) )


Ciao,
Michael.


[testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5

2011-03-25 Thread Rainer Orth
The new gcc.dg/torture/pr47917.c test currently fails the execution test
on IRIX 6.5.  To get a C99-conformant snprintf, one needs to include
 with _XOPEN_SOURCE defined as 500.  The following patch does
this.

Tested with the appropriate runtest invocations on mips-sgi-irix6.5 and
i386-pc-solaris2.11.

Ok for mainline?

Rainer


2011-03-25  Rainer Orth  

* gcc.dg/torture/pr47917.c: Add -D_XOPEN_SOURCE=500 to dg-options
for mips-sgi-irix6.5.
Replace snprintf prototype by .

diff -r b835af6cfe0b gcc/testsuite/gcc.dg/torture/pr47917.c
--- a/gcc/testsuite/gcc.dg/torture/pr47917.cThu Mar 24 20:35:54 2011 +0100
+++ b/gcc/testsuite/gcc.dg/torture/pr47917.cFri Mar 25 16:21:55 2011 +0100
@@ -1,11 +1,12 @@
 /* { dg-do run } */
 /* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 } } */
 /* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
 /* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */
 
 /* PR middle-end/47917 */
 
-extern int snprintf (char *, __SIZE_TYPE__, const char *, ...);
+#include 
 extern int memcmp (const void *, const void *, __SIZE_TYPE__);
 extern void abort (void);
 
-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/25/11 09:20, Michael Matz wrote:

> Even if there was such (IMO useless) hardware, or somebody would waste his 
> time in writing such (equally useless) virtual machine that can detect 
> fabricated problems somebody invented for some standard that never are 
> going to be problems in the real world, we shouldn't feel obliged to 
> uglify GCC for that.
> 
> (OTOH my opinion about the new c++ memory model is known ;) )
I'm not going to chime in on this specific problem; however, it is worth
noting that many of the issues raised by the C++0x memory model also
affect the linux kernel.

In fact, it was the realization that the kernel guys are fighting
closely related issues with data races that bumped the priority of the
memory model work to a level that we (Red Hat) felt it was necessary to
start pushing these issues upstream now.

jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNjLUOAAoJEBRtltQi2kC7FTkIAKtk5XF1auo5IPtpYJ1G8Yo8
EjW0a8hMcWFM0lWVt6+t9qStBcSCT35W9XYtWf4EmX+2HX6Hs3+KJIOoKXboqM0j
oA05YuQHHGqX2Br9jqlmocfB3E0qW+aCJLi3hu/nJWlMTUbOlf5BXF9sc0Q0Veio
oGwF8aMoXG1IXQJ5nq4SU03n6lrBWn7x/4vyQCesdEMzzeOL2/LN0i2FBdZkXXNj
xK8+R5uKni/pO5V/mKbm4l0ExRLmgO2iyxiTQO/jGlwfS1EnR4Zj2NiWHlXgWH2B
o55zGtfy1xNSONGdTAKwFHk3ShvmatRvZZxX5A+M3NlPBpbF0CHL1la+XaSZkZ8=
=ZlUI
-END PGP SIGNATURE-


Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Jakub Jelinek
On Fri, Mar 25, 2011 at 09:30:22AM -0600, Jeff Law wrote:
> I'm not going to chime in on this specific problem; however, it is worth
> noting that many of the issues raised by the C++0x memory model also
> affect the linux kernel.

But what they are seeing are certainly store data races, not load races,
because no hw they care about (or no hw at all?) detects the latter.
Having options to avoid store data races is useful not just for C++0x memory
model compliance and Linux kernel, but e.g. for OpenMP too.

> In fact, it was the realization that the kernel guys are fighting
> closely related issues with data races that bumped the priority of the
> memory model work to a level that we (Red Hat) felt it was necessary to
> start pushing these issues upstream now.

Jakub


Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5

2011-03-25 Thread Richard Guenther
On Fri, Mar 25, 2011 at 4:27 PM, Rainer Orth
 wrote:
> The new gcc.dg/torture/pr47917.c test currently fails the execution test
> on IRIX 6.5.  To get a C99-conformant snprintf, one needs to include
>  with _XOPEN_SOURCE defined as 500.  The following patch does
> this.
>
> Tested with the appropriate runtest invocations on mips-sgi-irix6.5 and
> i386-pc-solaris2.11.
>
> Ok for mainline?

Ok.

Thanks,
Richard.

>        Rainer
>
>
> 2011-03-25  Rainer Orth  
>
>        * gcc.dg/torture/pr47917.c: Add -D_XOPEN_SOURCE=500 to dg-options
>        for mips-sgi-irix6.5.
>        Replace snprintf prototype by .
>
> diff -r b835af6cfe0b gcc/testsuite/gcc.dg/torture/pr47917.c
> --- a/gcc/testsuite/gcc.dg/torture/pr47917.c    Thu Mar 24 20:35:54 2011 +0100
> +++ b/gcc/testsuite/gcc.dg/torture/pr47917.c    Fri Mar 25 16:21:55 2011 +0100
> @@ -1,11 +1,12 @@
>  /* { dg-do run } */
>  /* { dg-options "-std=c99" } */
> +/* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 } } 
> */
>  /* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
>  /* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */
>
>  /* PR middle-end/47917 */
>
> -extern int snprintf (char *, __SIZE_TYPE__, const char *, ...);
> +#include 
>  extern int memcmp (const void *, const void *, __SIZE_TYPE__);
>  extern void abort (void);
>
> --
> -
> Rainer Orth, Center for Biotechnology, Bielefeld University
>


Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Richard Guenther
On Fri, Mar 25, 2011 at 4:33 PM, Jakub Jelinek  wrote:
> On Fri, Mar 25, 2011 at 09:30:22AM -0600, Jeff Law wrote:
>> I'm not going to chime in on this specific problem; however, it is worth
>> noting that many of the issues raised by the C++0x memory model also
>> affect the linux kernel.
>
> But what they are seeing are certainly store data races, not load races,
> because no hw they care about (or no hw at all?) detects the latter.
> Having options to avoid store data races is useful not just for C++0x memory
> model compliance and Linux kernel, but e.g. for OpenMP too.

And we have in the past removed code that created store data races
anyway.  There is nothing new here.

As stated multiple times in the past things get "interesting" when you
look at non-x86 hardware.

Richard.


Re: [patch i386 windows]: Introduce call-abi for 32-bit mingw and make callee_pop_aggregate_return attribute by default on for 32-bit mingw target

2011-03-25 Thread Richard Henderson
On 03/24/2011 10:35 AM, Kai Tietz wrote:
>   * config/i386/cygming.h (DWARF_FRAME_REGISTERS): Adjust comment.
>   (STACK_BOUNDARY): Check for bit-ness in case of MS_ABI.
>   * config/i386/i386.c (ix86_conditional_register_usage): Adjust
>   comment and use macro TARGET_64BIT_MS_ABI instead.
>   (ix86_keep_aggregate_return_pointer): Optimize for 64-bit case
>   and change default behavior for 32-bit MS_ABI.
>   (ix86_reg_parm_stack_space): Check additionally for bit-ness.
>   (ix86_function_type_abi): Allow check for ms_abi/sysv_abi for
>   32-bit, too.
>   (ix86_cfun_abi): Likewise.
>   (ix86_maybe_switch_abi): Adjust comment.
>   (init_cumulative_args): Check for bit-ness in MS_ABI case.
>   (ix86_gimplify_va_arg): Check just for not TARGET_64BIT_MS_ABI
>   instead of checking for SYSV_ABI.
>   (ix86_nsaved_sseregs): Likewise.
>   (ix86_compute_frame_layout): Set only for 64-bit MS_ABI alignment
>   to 16 bytes.
>   (ix86_expand_call): Use TARGET_64BIT_MS_ABI macro.
>   * config/i386.h (TARGET_32BIT_MS_ABI): New macro.
>   (ACCUMULATE_OUTGOING_ARGS): Check explicit for 64-bit MS_ABI.
>   (OUTGOING_REG_PARM_STACK_SPACE): Likewise.
>   * config/mingw32.h (DEFAULT_ABI): Change default always to MS_ABI.

Ok.


r~


[Patch] muldi3 for bfin

2011-03-25 Thread Henderson, Stuart
The attached patch adds the muldi3 function for bfin.


2011-03-25  Stuart Henderson  

From Bernd Schmidt
* config/bfin/t-bfin (LIB1ASMFUNCS): Add muldi3 and umulsi3_highpart.
* config/bfin/t-bfin-elf (LIB1ASMFUNCS): Add muldi3.
* config/bfin/t-bfin-linux (LIB1ASMFUNCS): Add muldi3.
* config/bfin/t-bfin-uclinux (LIB1ASMFUNCS): Add muldi3.
* config/bfin/lib1funcs.asm (___muldi3): New function.


I don't have write permissions.

Thanks,
Stu



upstream.patch
Description: upstream.patch


C++ PATCH to add -std=c++03

2011-03-25 Thread Jason Merrill
Since the most recent C++ standard is officially dated 2003 
(representing the 1998 standard adjusted by the 2003 technical 
corrigendum) we really ought to support -std=c++03, meaning the same 
thing as -std=c++98 since we don't attempt to distinguish between the two.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 170711238aced11aa20095caebd1fe4c9e4f7b55
Author: Jason Merrill 
Date:   Wed Mar 23 11:09:19 2011 +0100

* c.opt: Add -std=c++03.

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 0061ec5..4c4727f 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1137,7 +1137,11 @@ Remap file names when including files
 
 std=c++98
 C++ ObjC++
-Conform to the ISO 1998 C++ standard
+Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum
+
+std=c++03
+C++ ObjC++ Alias(std=c++98)
+Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum
 
 std=c++0x
 C++ ObjC++


[pph] Add streaming hooks (issue4271074)

2011-03-25 Thread Diego Novillo

This patch adds streamer hooks for writing and reading trees. It is
still very much WIP.  In particular, the hooks for reading and writing
may change.

These callbacks are called from lto_write_tree and lto_read_tree after
the common fields in the tree have been processed.  They are
responsible from writing any fields that the common code may not have
processed.  I have defined callbacks for gimple and moved the code
that was causing problem with the pph streamer.

Fields not processed by common code are documented by each handler.
As I start testing more FE trees, I will find out what other
gimple-specific bits are in the current lto-streamer* functions.
Those are candidates for the call backs.

Richi, Michael, Jan, while this is very incomplete, it shows the
initial idea I had earlier this week.  Feel free to poke holes in it.
I expect to change it substantially in the next few weeks.  Once I
have something I'm content with, I'll send you a more complete patch
with better documentation for discussion.

This setup should also make it easy to strip things out of gimple that
we do not want to write in LTO files, but are needed when streaming
ASTs.  Over time, I expect most of the existing tree pickling to move
into the FE call backs.

Tested on x86_64.  Committed to the branch.


Diego.

cp/ChangeLog.pph

2011-03-25  Diego Novillo  

* pph-streamer.c (pph_stream_hooks_init): New.
(pph_stream_open): Call it.


ChangeLog.pph
2011-03-25  Diego Novillo  

* lto-streamer-in.c (lto_reader_init): Rename from
lto_init_reader.  Update all users.
If streamer_hooks.reader_init exists, call it.
Move gimple-specific initialization ...
(gimple_streamer_init_reader): ... to this new function.
(lto_input_ts_decl_common_tree_pointers): Document unhandled fields.
Do not handle DECL_INITIAL.
(lto_input_ts_decl_non_common_tree_pointers): Document
unhandled fields.
Do not handle DECL_SAVED_TREE.
(lto_read_tree): If streamer_hooks.read_tree is defined, call
it.
(gimple_streamer_read_tree): New.  Handle DECL_INITIAL.
(gimple_streamer_reader_init): Rename from
gimple_streamer_init_reader.  Update all users.
* lto-streamer-out.c (lto_writer_init): Make extern.
(lto_output): Call gimple_streamer_hooks_init.
(lto_output_ts_decl_common_tree_pointers): Document unhandled fields.
Do not handle DECL_INITIAL.
(lto_output_ts_decl_non_common_tree_pointers): Document
unhandled fields.
Do not handle DECL_SAVED_TREE.
(lto_write_tree): If streamer_hooks.write_tree is defined,
call it.
(gimple_streamer_write_tree): New.  Handle DECL_INITIAL and
DECL_SAVED_TREE.
* lto-streamer.c (gimple_streamer_hooks_init): New.
(streamer_hooks): New.
(streamer_hooks_init): New.
* lto-streamer.h (lto_streamer_hooks): Declare.
(streamer_hooks): Declare
(streamer_hooks_init): Declare
(gimple_streamer_hooks_init): Declare.
(gimple_streamer_init_reader): Declare.
(lto_writer_init): Declare.
(struct output_block): Forward declare.
(struct lto_input_block): Likewise.
(struct data_in): Likewise.


lto/ChangeLog.pph

2011-03-25  Diego Novillo  

* lto.c (lto_main): Call gimple_streamer_hooks_init.




diff --git a/gcc/cp/pph-streamer.c b/gcc/cp/pph-streamer.c
index cca42e6..07438bd 100644
--- a/gcc/cp/pph-streamer.c
+++ b/gcc/cp/pph-streamer.c
@@ -137,6 +137,17 @@ pph_stream_init_write (pph_stream *stream)
 }
 
 
+/* Initialize all the streamer hooks used for streaming ASTs.  */
+
+static void
+pph_streamer_hooks_init (void)
+{
+  lto_streamer_hooks *h = streamer_hooks_init ();
+  h->reader_init = NULL;
+  h->writer_init = NULL;
+}
+
+
 /* Create a new PPH stream to be stored on the file called NAME.
MODE is passed to fopen directly.  */
 
@@ -150,6 +161,7 @@ pph_stream_open (const char *name, const char *mode)
   f = fopen (name, mode);
   if (f)
 {
+  pph_streamer_hooks_init ();
   stream = XCNEW (pph_stream);
   stream->file = f;
   stream->name = xstrdup (name);
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index d2f0075..5d2761e 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -1983,7 +1983,11 @@ lto_input_ts_decl_minimal_tree_pointers (struct 
lto_input_block *ib,
 
 /* Read all pointer fields in the TS_DECL_COMMON structure of EXPR from
input block IB.  DATA_IN contains tables and descriptors for the
-   file being read.  */
+   file being read.
+
+   Fields that should be handled by a callback:
+   DECL_INITIAL
+   DECL_ABSTRACT_ORIGIN.  */
 
 static void
 lto_input_ts_decl_common_tree_pointers (struct lto_input_block *ib,
@@ -1991,12 +1995,8 @@ lto_input_ts_decl_common_tree_pointers (struct 
lto_input_block *ib,
 {
   DECL_SIZE (expr) = lto_input_tree (ib, data_in);
   

[patch] Fix gcc.dg/vect/vect-cselim-1.c - PR target/48287

2011-03-25 Thread Ira Rosen

Hi,

gcc.dg/vect/vect-cselim-1.c contains misaligned loads and is therefore not
vectorizable on targets that don't support misaligned data accesses. This
patch adds an xfail for such targets.

Tested on powerpc64-suse-linux, and tested by Rainer on
sparc-sun-solaris2.10.
Committed as obvious.

Ira

testsuite/ChangeLog

PR target/48287
* gcc.dg/vect/vect-cselim-1.c: Fail for vect_no_align.


Index: vect-cselim-1.c
===
--- vect-cselim-1.c (revision 171381)
+++ vect-cselim-1.c (working copy)
@@ -82,5 +82,5 @@
   return 0;
 }

-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect"  { xfail vect_no_align } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */



C++ PATCH for c++/48289 (-pedantic breaks std::move)

2011-03-25 Thread Jason Merrill
The problem here was that we were improperly treating 
static_cast::type&&>(x) as an lvalue because 
the dereference was inside a NON_DEPENDENT_EXPR, which we always treat 
as an lvalue.  That seems like a bad assumption, but we can fix this bug 
simply by moving the dereference outside.


Tested x86_64-pc-linux-gnu, applied to trunk and 4.5, will apply to 4.6 
after 4.6.0.
commit 91300f260ac2bb684e62e28a1e63b8646d1d49cc
Author: Jason Merrill 
Date:   Fri Mar 25 11:16:54 2011 +0100

PR c++/48289
* pt.c (build_non_dependent_expr): Keep dereferences outside the
NON_DEPENDENT_EXPR.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c8c1010..9032dd9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18846,24 +18846,17 @@ build_non_dependent_expr (tree expr)
   TREE_OPERAND (expr, 0),
   build_non_dependent_expr (TREE_OPERAND (expr, 1)));
 
+  /* Keep dereferences outside the NON_DEPENDENT_EXPR so lvalue_kind
+ doesn't need to look inside.  */
+  if (TREE_CODE (expr) == INDIRECT_REF && REFERENCE_REF_P (expr))
+return convert_from_reference (build_non_dependent_expr
+  (TREE_OPERAND (expr, 0)));
+
   /* If the type is unknown, it can't really be non-dependent */
   gcc_assert (TREE_TYPE (expr) != unknown_type_node);
 
-  /* Otherwise, build a NON_DEPENDENT_EXPR.
-
- REFERENCE_TYPEs are not stripped for expressions in templates
- because doing so would play havoc with mangling.  Consider, for
- example:
-
-   template  void f() { g(); }
-
- In the body of "f", the expression for "g" will have
- REFERENCE_TYPE, even though the standard says that it should
- not.  The reason is that we must preserve the syntactic form of
- the expression so that mangling (say) "f" inside the body of
- "f" works out correctly.  Therefore, the REFERENCE_TYPE is
- stripped here.  */
-  return build1 (NON_DEPENDENT_EXPR, non_reference (TREE_TYPE (expr)), expr);
+  /* Otherwise, build a NON_DEPENDENT_EXPR.  */
+  return build1 (NON_DEPENDENT_EXPR, TREE_TYPE (expr), expr);
 }
 
 /* ARGS is a vector of expressions as arguments to a function call.
diff --git a/gcc/testsuite/g++.dg/cpp0x/move1.C 
b/gcc/testsuite/g++.dg/cpp0x/move1.C
new file mode 100644
index 000..12e363a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/move1.C
@@ -0,0 +1,15 @@
+// { dg-options "-std=c++0x -pedantic-errors" }
+
+#include 
+
+class A { };
+
+static void g ( A && ) { }
+
+template < class T > class B {
+public:
+ void f ( ) {
+  A a;
+  g ( std :: move ( a ) );
+ }
+};


Re: [patch i386 windows]: Introduce call-abi for 32-bit mingw and make callee_pop_aggregate_return attribute by default on for 32-bit mingw target

2011-03-25 Thread Kai Tietz
2011/3/25 Richard Henderson :
> On 03/24/2011 10:35 AM, Kai Tietz wrote:
>>       * config/i386/cygming.h (DWARF_FRAME_REGISTERS): Adjust comment.
>>       (STACK_BOUNDARY): Check for bit-ness in case of MS_ABI.
>>       * config/i386/i386.c (ix86_conditional_register_usage): Adjust
>>       comment and use macro TARGET_64BIT_MS_ABI instead.
>>       (ix86_keep_aggregate_return_pointer): Optimize for 64-bit case
>>       and change default behavior for 32-bit MS_ABI.
>>       (ix86_reg_parm_stack_space): Check additionally for bit-ness.
>>       (ix86_function_type_abi): Allow check for ms_abi/sysv_abi for
>>       32-bit, too.
>>       (ix86_cfun_abi): Likewise.
>>       (ix86_maybe_switch_abi): Adjust comment.
>>       (init_cumulative_args): Check for bit-ness in MS_ABI case.
>>       (ix86_gimplify_va_arg): Check just for not TARGET_64BIT_MS_ABI
>>       instead of checking for SYSV_ABI.
>>       (ix86_nsaved_sseregs): Likewise.
>>       (ix86_compute_frame_layout): Set only for 64-bit MS_ABI alignment
>>       to 16 bytes.
>>       (ix86_expand_call): Use TARGET_64BIT_MS_ABI macro.
>>       * config/i386.h (TARGET_32BIT_MS_ABI): New macro.
>>       (ACCUMULATE_OUTGOING_ARGS): Check explicit for 64-bit MS_ABI.
>>       (OUTGOING_REG_PARM_STACK_SPACE): Likewise.
>>       * config/mingw32.h (DEFAULT_ABI): Change default always to MS_ABI.
>
> Ok.
>
>
> r~

Committed at revision 171459.

Thanks,
Kai


Re: [PATCH] Fix DW_OP_GNU_entry_value handling in .debug_loc duplicate removal

2011-03-25 Thread Richard Henderson
On 03/25/2011 03:59 AM, Jakub Jelinek wrote:
>   * dwarf2out.c (mem_loc_descriptor) : Compare
>   mode size instead of bitsize with DWARF2_ADDR_SIZE.
>   (hash_loc_operands, compare_loc_operands): Handle
>   DW_OP_GNU_entry_value.

Ok.


r~


C++ PATCH for core issue 1135 (virtual and exception-specifications with default)

2011-03-25 Thread Jason Merrill
The resolution of core issue 1135 allows defaulted functions to be 
declared virtual or with an exception specification that matches the one 
on an implicit declaration; this patch implements that.


Tested x86_64-pc-linux-gnu, applied to trunk.
commit c0337ba692c6eadc1d63b96a80b71ac1d59b0e51
Author: Jason Merrill 
Date:   Fri Mar 25 16:04:09 2011 +0100

Core 1135
* method.c (defaulted_late_check): Check for exception spec mismatch.
(defaultable_fn_check): Allow exception spec and virtual.
* class.c (check_for_override): A virtual dtor is non-trivial.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 1325260..adae51f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2474,6 +2474,8 @@ check_for_override (tree decl, tree ctype)
   if (!DECL_VINDEX (decl))
DECL_VINDEX (decl) = error_mark_node;
   IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1;
+  if (DECL_DESTRUCTOR_P (decl))
+   TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype) = true;
 }
 }
 
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 0366988..386a818 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1554,6 +1554,12 @@ defaulted_late_check (tree fn)
   if (DECL_DEFAULTED_IN_CLASS_P (fn))
 {
   tree eh_spec = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (implicit_fn));
+  if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn))
+ && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)),
+eh_spec, ce_normal))
+   error ("function %q+D defaulted on its first declaration "
+  "with an exception-specification that differs from "
+  "the implicit declaration %q#D", fn, implicit_fn);
   TREE_TYPE (fn) = build_exception_variant (TREE_TYPE (fn), eh_spec);
   if (DECL_DECLARED_CONSTEXPR_P (implicit_fn))
/* Hmm...should we do this for out-of-class too? Should it be OK to
@@ -1619,14 +1625,7 @@ defaultable_fn_check (tree fn)
break;
  }
   if (TYPE_BEING_DEFINED (DECL_CONTEXT (fn)))
-   {
- if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)))
-   error ("function %q+D defaulted on its first declaration "
-  "must not have an exception-specification", fn);
- if (DECL_VIRTUAL_P (fn))
-   error ("%qD declared virtual cannot be defaulted in the class "
-  "body", fn);
-   }
+   /* Defer checking.  */;
   else if (!processing_template_decl)
defaulted_late_check (fn);
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted15.C 
b/gcc/testsuite/g++.dg/cpp0x/defaulted15.C
index 4c5b11c..0a47c20 100644
--- a/gcc/testsuite/g++.dg/cpp0x/defaulted15.C
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted15.C
@@ -54,5 +54,5 @@ struct G: public F
 
 struct H
 {
-  virtual ~H() = default;  // { dg-error "declared virtual" }
+  virtual ~H() = default;
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted22.C 
b/gcc/testsuite/g++.dg/cpp0x/defaulted22.C
new file mode 100644
index 000..61e9d32
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted22.C
@@ -0,0 +1,23 @@
+// Test that a virtual defaulted constructor is still virtual.
+// { dg-do run }
+// { dg-options -std=c++0x }
+
+int r = 1;
+
+struct A
+{
+  virtual ~A() = default;
+};
+
+struct B: A
+{
+  ~B() noexcept { r = 0; }
+};
+
+A* ap = new B();
+
+int main()
+{
+  delete ap;
+  return r;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted23.C 
b/gcc/testsuite/g++.dg/cpp0x/defaulted23.C
new file mode 100644
index 000..5b4438d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted23.C
@@ -0,0 +1,27 @@
+// Test for checking of exception specifications on defaulted fns
+// { dg-options -std=c++0x }
+
+struct A
+{
+  A() noexcept = default;
+};
+
+struct B
+{
+  B() throw (int) = default; // { dg-error "exception-specification that 
differs from the implicit declaration" }
+};
+
+struct C
+{
+  C() throw (int) { }
+};
+
+struct D: C
+{
+  D() throw (int) = default;
+};
+
+struct E
+{
+  E() = default;
+};


[PATCH] Better .debug_aranges fix (PR debug/48253, take 2)

2011-03-25 Thread Jakub Jelinek
On Thu, Mar 24, 2011 at 06:08:01PM +0100, Jason Merrill wrote:
> This ought to cut down on the number of cases we have to handle in
> all the different places in dwarf2out that deal with this stuff.
> 
> Does that make sense to you?

Here is updated patch, it is quite larger than the last one, because
I found a few more broken things, in particular in both DW_AT_frame_base
location list and variable location lists we'd for
-freorder-blocks-and-partition happily have a range starting in one of the
partitions and ending in the other partition.  If the second partition
ends up being linked after the first one, it just means the range covers
also lots of unrelated stuff, but if second partition is linked first,
we end up with a range with start being above end.

Ok for trunk if it passes bootstrap/regtest?

2011-03-25  Jakub Jelinek  

PR debug/48253
* dwarf2out.c (struct dw_fde_struct): Remove dw_fde_hot_section_label,
dw_fde_hot_section_end_label, dw_fde_unlikely_section_label,
dw_fde_unlikely_section_end_label, cold_in_std_section and
dw_fde_switched_cold_to_hot fields.  Add dw_fde_second_begin,
dw_fde_second_end and second_in_std_section fields.
(output_fde): Use dw_fde_second_{begin,end} if second is
true, otherwise dw_fde_{begin,end}.
(dwarf2out_begin_prologue): Stop initializing removed dw_fde_struct
fields, initialize new fields.  Initialize in_std_section
unconditionally from the first partition.
(dwarf2out_end_epilogue): Don't override dw_fde_end when
dw_fde_switched_sections.
(dwarf2out_switch_text_section): Stop initializing removed
dw_fde_struct fields, initialize new fields, initialize
also dw_fde_end here.  Set dw_fde_switch_cfi even when
dwarf2out_do_cfi_asm ().  Call var_location_switch_text_section.
(struct var_loc_list_def): Add last_before_switch field.
(arange_table, arange_table_allocated, arange_table_in_use,
ARANGE_TABLE_INCREMENT, add_arange): Removed.
(size_of_aranges): Count !in_std_section and !second_in_std_section
hunks in fdes, instead of looking at arange_table_in_use.
(output_aranges): Add aranges_length argument, don't call
size_of_aranges here.  Instead of using aranges_table*
emit ranges for fdes when !in_std_section resp.
!second_in_std_section.
(dw_loc_list): Break ranges crossing section switch.
(convert_cfa_to_fb_loc_list): Likewise.  If switched sections,
use dw_fde_second_end instead of dw_fde_end as end of last
range.
(gen_subprogram_die): Don't call add_arange.  Use
dw_fde_{begin,end} for first partition and if switched
section dw_fde_second_{begin,end} for the second.
!fde->dw_fde_switched_cold_to_hot instead of fde->in_std_section.
(var_location_switch_text_section_1,
var_location_switch_text_section): New functions.
(dwarf2out_begin_function): Initialize cold_text_section even
when function_section () isn't text_section.
(prune_unused_types): Don't walk arange_table.
(dwarf2out_finish): Don't needlessly test
flag_reorder_blocks_and_partition when testing cold_text_section_used.
If info_section_emitted, call size_of_aranges and if it indicates
non-empty .debug_aranges, call output_aranges with the computed
size.  Stop using removed dw_fde_struct fields, use
dw_fde_{begin,end} for first partition and dw_fde_second_{begin,end}
for second.

--- gcc/dwarf2out.c.jj  2011-03-25 11:24:06.0 +0100
+++ gcc/dwarf2out.c 2011-03-25 15:19:00.0 +0100
@@ -302,10 +302,8 @@ typedef struct GTY(()) dw_fde_struct {
   const char *dw_fde_end;
   const char *dw_fde_vms_end_prologue;
   const char *dw_fde_vms_begin_epilogue;
-  const char *dw_fde_hot_section_label;
-  const char *dw_fde_hot_section_end_label;
-  const char *dw_fde_unlikely_section_label;
-  const char *dw_fde_unlikely_section_end_label;
+  const char *dw_fde_second_begin;
+  const char *dw_fde_second_end;
   dw_cfi_ref dw_fde_cfi;
   dw_cfi_ref dw_fde_switch_cfi; /* Last CFI before switching sections.  */
   HOST_WIDE_INT stack_realignment;
@@ -324,13 +322,11 @@ typedef struct GTY(()) dw_fde_struct {
   unsigned drap_reg_saved: 1;
   /* True iff dw_fde_begin label is in text_section or cold_text_section.  */
   unsigned in_std_section : 1;
-  /* True iff dw_fde_unlikely_section_label is in text_section or
+  /* True iff dw_fde_second_begin label is in text_section or
  cold_text_section.  */
-  unsigned cold_in_std_section : 1;
+  unsigned second_in_std_section : 1;
   /* True iff switched sections.  */
   unsigned dw_fde_switched_sections : 1;
-  /* True iff switching from cold to hot section.  */
-  unsigned dw_fde_switched_cold_to_hot : 1;
 }
 dw_fde_node;
 
@@ -3628,28 +3624,8 @@ output_fde (dw_fde_ref fde, bool for_eh,
 dw2_asm_

Re: [patch][ARM] Fix 16-bit -> 64-bit multiply and accumulate

2011-03-25 Thread Andrew Stubbs

On 28/01/11 15:20, Richard Earnshaw wrote:


On Fri, 2011-01-28 at 15:13 +, Andrew Stubbs wrote:

On 28/01/11 14:12, Richard Earnshaw wrote:

So what happens to a variation of your testcase:

long long foolong (long long x, short *a, short *b)
 {
 return x + (long long)*a * (long long)*b;
 }

With your patch?  This should generate identical code to your original
test-case.



The patch has no effect on that testcase - it's broken in some other
way, I think, and the same with and without my patch:

  ldrsh   r3, [r3, #0]
  ldrsh   r2, [r2, #0]
  push{r4, r5}
  asrsr4, r3, #31
  asrsr5, r2, #31
  mul r4, r2, r4
  mla r4, r3, r5, r4
  umull   r2, r3, r2, r3
  addsr3, r4, r3
  addsr0, r0, r2
  adc r1, r1, r3
  pop {r4, r5}
  bx  lr

Hmmm, that probably doesn't add anything useful to the discussion. :(

I'll add that one to the todo list ...

Andrew



Ouch!  I though that used to work :-(



I looked at this one again, but on a second inspection I'm not sure 
there's much wrong with it?


When I wrote the above I thought that there was a 64-bit multiply 
instruction, but now I look more closely I see there isn't, hence the 
above. It does two 16-bit loads, sign-extends the inputs to 64-bit, does 
a 64-bit -> 64-bit multiply, and then adds 'x'.


Can the umull/add/add/adc be optimized using umlal? It's too late on a 
Friday to workout what's going on with the carries 


Also, I don't fully understand why the compiler can't just disregard the 
casts and use maddhidi4? Isn't that mathematically equivalent in this case?


When you say it used to work, what did it use to look like?

Thanks

Andrew


[PATCH] Really make copyprop propagate constants

2011-03-25 Thread Richard Guenther

Back last year I made copyprop also propagate constants (if a copy
chain ultimatively ends in a constant).  At least I thought so, but
it turns out I missed a piece.

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

Richard.

2011-03-25  Richard Guenther  

* tree-ssa-copy.c (stmt_may_generate_copy): Copies from constants
also generate copies.
(fini_copy_prop): Handle constant values properly.

Index: gcc/tree-ssa-copy.c
===
*** gcc/tree-ssa-copy.c (revision 171450)
--- gcc/tree-ssa-copy.c (working copy)
*** stmt_may_generate_copy (gimple stmt)
*** 315,322 
/* Otherwise, the only statements that generate useful copies are
   assignments whose RHS is just an SSA name that doesn't flow
   through abnormal edges.  */
!   return (gimple_assign_rhs_code (stmt) == SSA_NAME
! && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt)));
  }
  
  
--- 315,323 
/* Otherwise, the only statements that generate useful copies are
   assignments whose RHS is just an SSA name that doesn't flow
   through abnormal edges.  */
!   return ((gimple_assign_rhs_code (stmt) == SSA_NAME
!  && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt)))
! || is_gimple_min_invariant (gimple_assign_rhs1 (stmt)));
  }
  
  
*** fini_copy_prop (void)
*** 771,776 
--- 772,778 
 of the representative to the first solution we find if
 it doesn't have one already.  */
if (copy_of[i].value != var
+ && TREE_CODE (copy_of[i].value) == SSA_NAME
  && POINTER_TYPE_P (TREE_TYPE (var))
  && SSA_NAME_PTR_INFO (var)
  && !SSA_NAME_PTR_INFO (copy_of[i].value))


Improve jump threading #1 of N

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I've been doing some research into improving certain aspects of our
warnings, particularly removing false positives from the warnings which
require dataflow information.  I think it's reasonably well known that
many of the false positives occur due to unexecutable edges remaining in
the CFG.

Long term I think we're going to need a more structured approach to path
isolation and I'm still pondering exactly what that might look like.

In the mean time one thing is clear the current jump threading is quite
important for eliminating many of the unexecutable edges in the CFG.
Furthermore, the cases I'm looking at require us capture more of the
secondary effects of jump threading.

Let's consider this CFG (from a routine in cfgexpand.c)


   A
  / \
 B   C
 |  / \
 | D   E
 | |  / \
 | | F   G
  \| |
\|
 H
/ \
   I   J
  / \
 L   M
 |  / \
 | N   O
 | |  / \
 | | P   Q
  \| |
\|
 R


As it turns out some blocks have the same condition (A,I), (C,M), (E,O).
 But because of the merge block H, no threading is possible.  I've got
patches which let us copy H into B, D & F.  That exposes the jump
threads B->L, D->M and F->M.  Unfortunately, we need another iteration
of jump threading to then thread D->N and F->O and then another
iteration to thread F->P with the net result looking something like this:


   A
  / \
BH'L C
 |  / \
 |DH'N E
 | |  / \
 | |FH'P G
  \| |
\|
 R



I don't think anyone is going to argue for a return to the iterated DOM
approach we had in the past.  Luckily we can often pick up the secondary
effects by looking deeper into the CFG when we do find a threading
opportunity.  ie, when we discover D->I->M, go ahead and look at M and
see if we can thread through it to N or O and so-on.

That turns out to be relatively easy and cheap if we restrict the form
of M so that we don't need to create a duplicate of M (which ties back
to our long term need for a more structured approach to path isolation).

The attached patch allows us to capture some of these secondary effects
by looking at the destination of a threadable jump to see if it is yet
another conditional with a statically computable destination.

Bootstrapped and regression tested on x86_64-unknown-linux-gnu.  Trivial
testcase included :-)  OK for trunk?


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNjMM7AAoJEBRtltQi2kC7mtAH/2yC58nNaW1ZZP6OQFztNTHo
nyRAIjS7NxT8Sal84cRwfaAgND74VesVUs8EgYY9G7brHWihBWYqZ8gRjRp2VJqA
EM9IIScKgYqM5/2+41Iy2yGY3yMksOpVPX3LZfCHWKW0PIycpmHnLglGUSU33rbr
8EtVbv3PuXn6OnqYqA5onCmLiI4YRapLnF+iNvH3r5DI4EJKPweLPBygye/aDI+F
DCZl9zCKfdrKvvkA81o1+f2CQPC9507w2B1MZBM3uXRJGETrLTNKiyIDyciq2OG+
SR2e72co/zbUTU1HQlpkL5nCEl4xn8fYmZQlaZjp3OypkY86vI5YnStjPKjnc2w=
=z6nn
-END PGP SIGNATURE-
* tree-ssa-threadupdate.c (redirect_edges): Call
create_edge_and_update_destination_phis as needed.
(create_edge_and_update_destination_phis): Accept new BB argument.
All callers updated.
(thread_block): Do not update the profile when threading around
intermediate blocks.
(thread_single_edge): Likewise.
(determine_bb_domination_status): If BB is not a successor of the
loop header, return NONDOMINATING.
(register_jump_thread): Note when we register a jump thread around
an intermediate block.
* tree-ssa-threadedge.c (thread_around_empty_block): New function.
(thread_across_edge): Use it.

* gcc.dg/tree-ssa/ssa-dom-thread-3.c: New test.

Index: tree-ssa-threadupdate.c
===
*** tree-ssa-threadupdate.c (revision 171364)
--- tree-ssa-threadupdate.c (working copy)
*** lookup_redirection_data (edge e, edge in
*** 304,317 
 destination.  */
  
  static void
! create_edge_and_update_destination_phis (struct redirection_data *rd)
  {
!   edge e = make_edge (rd->dup_block, rd->outgoing_edge->dest, EDGE_FALLTHRU);
gimple_stmt_iterator gsi;
  
rescan_loop_exit (e, true, false);
e->probability = REG_BR_PROB_BASE;
!   e->count = rd->dup_block->count;
e->aux = rd->outgoing_edge->aux;
  
/* If there are any PHI nodes at the destination of the outgoing edge
--- 304,318 
 destination.  */
  
  static void
! create_edge_and_update_destination_phis (struct redirection_data *rd,
!basic_block bb)
  {
!   edge e = make_edge (bb, rd->outgoing_edge->dest, EDGE_FALLTHRU);
gimple_stmt_iterator gsi;
  
rescan_loop_exit (e, true, false);
e->probability = REG_BR_PROB_BASE;
!   e->count = bb

Re: mt-mep using EXTRA_TARGET_HOST_ALL_MODULES?

2011-03-25 Thread DJ Delorie

> dejagnu and expect used to have copies in the src tree but they were
> removed a long time ago, so I think of the rules for them both as a
> legacy (and I think those two go together).

Our tree has dejagnu in it; it's an excellent way to store baseboards
for ports we're working on or supporting.


Re: [RFC PATCH] Typed DWARF stack

2011-03-25 Thread Roland McGrath
It's been a while since I read Cary's proposal, and I am no longer
likely to do much work of my own in this area.  So I'll just respond at
the high level.

I like very much the essential notion of the stack being of typed
entities with no specification of how the consumer actually implements
it.  In particular, this also brings implicit-pointer into the fold as a
new type of a stack element, i.e. "imaginary pointer".  Obviously only
the operations that amount to addition/subtraction with an integer
actually make sense on such a stack element.  This makes the second
operand of DW_OP(GNU_)implicit_pointer superfluous (and hence the common
case of zero a byte smaller), since nonzero cases can just be followed
by an appropriate DW_OP_plus_uconst or suchlike.

To make clear that this should be supported, the specification wording
would have to be somewhat more abstract than suggesting that a union of
target bit-pattern types of various sizes would suffice.  But it does
not seem much of a stretch to me, and IMHO it's most appropriate that
DWARF not say very much about consumer implementation.

This is more of a stretch, but IMHO it would also make sense to exploit
this "typed" concept to roll in the distinction between values and
locations.  This notion is not very well-formed, but perhaps worth
investigating.  That is, one could consider DW_OP_reg* a stack operation
that pushes the location in a register.  Implicitly, traditional
operations push the location in an address.  But DW_OP_stack_value
"pops" the address location and "pushes" the address literal as a value.
If the TOS at the end of an expression is a location, then it's a
mutable location, otherwise it's a value.  When an expression is used in
a value-only context (DW_AT_frame_base, etc.) then TOS addresses are
always (identity-)converted integer values and TOS registers are always
fetched values.  This way of thinking is natural to me, and it makes the
DW_AT_frame_base specification a natural and straightforward instance of
a general thing rather than being a one-off special case.  But perhaps
it is too convoluted for other people.


As to encoding, I have a fancy idea that I discussed off the cuff at the
Summit with Jakub and Richard, and still quite like, though I haven't
fleshed it out any more than I did then.  I hope to inspire someone else
to actually want to implement it.  It's rather more ambitious than the
things that Jakub will just add while the rest of us sleep, so I
wouldn't suggest that such DW_OP_GNU_* extensions be delayed for this
plan.  But perhaps it can become coherent enough and get done enough to
seriously propose it for DWARF 5.

The basic notion is extreme extensibility for DWARF operations, done in
a way that could yield in practice even smaller encodings that we get
today, while supporting an arbitrarily larger vocabulary of operations.
It's modelled on the DIE encoding, using abbrevs.

Add a section ".debug_opabbrev".  A chunk of this would be pointed to by
a CU's DW_AT_op_list attribute--or it could be a CU header field, but
there's not much reason to go that route, except perhaps if such a CU
would always be version=5 anyway so as to make old consumers know that
they don't know how to inerpret expressions therein.  (It seems very
unlikely that any .debug_frame/.eh_frame DW_CFA_*expression would ever
need to go beyond the DWARF 4 operation vocabuluary.  But if they do,
that header could be likewise extended with a .{debug,eh}_opabbrev
pointer.  Though that's pretty clearly beyond the pale for introspective
in-process .eh_frame decoding.)  The presence of this attribute signals
that this opabbrev table controls the interpretation of all expressions
found in that CU (i.e. in its DW_FORM_exprloc attributes and in any
.debug_loc lists it points to).

The opabbrev table is much like the DIE abbrev table.  It maps an opcode
to an operation and a list of operand encodings.  Each operand is
indicated by a DW_FORM_* encoding and the list terminated with zero, as
with DIE abbrevs.  For generality, opcodes would be ULEB128 and that
seems fine since any one CU using more than 127 seems like an outlier.
But if real-world CU's might not too infrequently use 128-255 different
opcodes, then a table header byte could give the encoding of opcodes
too, so it might be DW_FORM_data1 instead to optimize the packing of
such a case.

I'm somewhat undecided on how best to encode operations in an opabbrev
table.  My first instinct is towards easy extensibility, by encoding
each as a pair of DW_FORM_strp, being "family" and "operation".
(Perhaps for compactness a table would contain several runs of
subtables, each subtable using a single family string with only the
operation string in each subtable element that defines a particular
opcode.)  Then family is either unspecified and conventional (perhaps
instead called "vendor", but I prefer "family" so as to indicate side
standards on common families), or perhaps a domain name, reverse domain
name, or 

Re: [PATCH, 4.7] Have all inlining destinations "analyzed"

2011-03-25 Thread Jan Hubicka
> Ping.
> 
> Thanks,
> 
> Martin
> 
> --
> On Sat, Mar 19, 2011 at 01:48:36AM +0100, Martin Jambor wrote:
> 
> Hi,
> 
> On Fri, Mar 11, 2011 at 03:30:53PM +0100, Jan Hubicka wrote:
> > > Index: src/gcc/cgraph.c
> > > ===
> > > --- src.orig/gcc/cgraph.c
> > > +++ src/gcc/cgraph.c
> > > @@ -2495,11 +2495,11 @@ cgraph_add_new_function (tree fndecl, bo
> > >case CGRAPH_STATE_FINISHED:
> > >   /* At the very end of compilation we have to do all the work up
> > >  to expansion.  */
> > > + node = cgraph_node (fndecl);
> > > + cgraph_analyze_function (node);
> > >   push_cfun (DECL_STRUCT_FUNCTION (fndecl));
> > >   current_function_decl = fndecl;
> > >   gimple_register_cfg_hooks ();
> > > - if (!lowered)
> > > -  tree_lowering_passes (fndecl);
> > 
> > The analysis shoud happent in cgraph_process_new_functions that
> > should be called after every IPA pass.
> 
> I'm not sure I understand.  Since cgraph_state is in
> CGRAPH_STATE_FINISHED, new functions are not added to cgraph_new_nodes
> linked list to be picked up by cgraph_process_new_functions.  If you

Hmm, I missed it is FINISHED stage.  This is OK then.
> are wondering why cgraph_state has that value because mudflap passes
> are early passes and so that should not happen if the function was
> invoked from them, the explanation is simple, it is not invoked from
> them.  Instead this is some part of mudflap finalization invoked
> directly from toplev.c:
> 
> #0  fancy_abort (file=0xe07230 "/home/mjambor/icln/src/gcc/tree-inline.c", 
> line=4206,
> function=0xe08860 "optimize_inline_calls") at 
> /home/mjambor/icln/src/gcc/diagnosti
> c.c:892   
> 
> #1  0x00a4ce05 in optimize_inline_calls (fn=0x75237f00)   
> 
> at /home/mjambor/icln/src/gcc/tree-inline.c:4206  
>   
> #2  0x00a1d802 in cgraph_early_inlining ()
> 
> at /home/mjambor/icln/src/gcc/ipa-inline.c:1757   
>   
> #3  0x00756ccf in execute_one_pass (pass=0x1255a00)   
> 
> at /home/mjambor/icln/src/gcc/passes.c:1556   
>   
> #4  0x00756fc5 in execute_pass_list (pass=0x1255a00)
> at /home/mjambor/icln/src/gcc/passes.c:1611
> #5  0x00a08518 in cgraph_add_new_function (fndecl=0x75237f00, 
> lowered=0 '\000')
> at /home/mjambor/icln/src/gcc/cgraph.c:2505
> #6  0x00a342bf in cgraph_build_static_cdtor_1 (which=73 'I', 
> body=0x753e0820,
> priority=, final=0 '\000') at 
> /home/mjambor/icln/src/gcc/ipa.c:1593
> #7  0x004e2683 in mudflap_finish_file ()

It would be prettier if this all happent earlier and from PM control.  I see
that mudflap_2 is currently done quite late and apparently whatever fnish_file
constructs depends on mudflap_2.  My understanding is that it should pretty
much work same way if it was moved post early optimization and this finish_file
became small IPA pass just after early passes.  But this is independent of the
issue above. 

> at /home/mjambor/icln/src/gcc/tree-mudflap.c:1366
> #8  0x007fe3f9 in compile_file (argc=34, argv=0x7fffddf8)
> at /home/mjambor/icln/src/gcc/toplev.c:601
> #9  do_compile (argc=34, argv=0x7fffddf8) at 
> /home/mjambor/icln/src/gcc/toplev.c:1900
> #10 toplev_main (argc=34, argv=0x7fffddf8) at 
> /home/mjambor/icln/src/gcc/toplev.c:1963
> 
> > I don't think we should move
> > analysis here nor we should drop the !lowered path (even if it is
> > unused currently, cgraph_add_new_function is supposed to work on
> > unlowered functions).
> 
> I'm not really dropping that path.  cgraph_analyze_function calls
> cgraph_lower_function which calls tree_lowering_passes.  It even calls
> lower_nested_functions and, perhaps more importantly, sets
> node->lowered to true.  But I see that lowered is actually a function
> parameter that we should honor so I adjusted my patch slightly to do
> that.

Hmm, seems fine.
> 
> 2011-03-18  Martin Jambor  
> 
>   * tree-inline.c (expand_call_inline): Do not check that destination
>   node is analyzed.
>   (optimize_inline_calls): Assert that destination node is analyzed.
>   * cgraph.c (cgraph_add_new_function): Call cgraph_analyze_function, do
>   not call tree_lowering_passes.
>   * cgraph.h (cgraph_analyze_function): Declare.
>   * cgraphunit.c (cgraph_analyze_function): Make public.
OK. Thanks.
Honza


Re: [PATCH 1/4] Remove cgraph_node function and fixup all callers

2011-03-25 Thread Jan Hubicka
> > Seems OK, however..
> 
> To what extent is this an approval? :-)

Approval only after you convince me on the questions bellow.

> 
> > > Index: src/gcc/gimplify.c
> > > ===
> > > --- src.orig/gcc/gimplify.c   2011-03-19 01:16:24.0 +0100
> > > +++ src/gcc/gimplify.c2011-03-19 01:54:42.0 +0100
> > > @@ -959,11 +959,11 @@ copy_if_shared (tree *tp)
> > >  static void
> > >  unshare_body (tree *body_p, tree fndecl)
> > >  {
> > > -  struct cgraph_node *cgn = cgraph_node (fndecl);
> > > +  struct cgraph_node *cgn = cgraph_get_node (fndecl);
> > >  
> > >copy_if_shared (body_p);
> > >  
> > > -  if (body_p == &DECL_SAVED_TREE (fndecl))
> > > +  if (cgn && body_p == &DECL_SAVED_TREE (fndecl))
> > 
> > The non-NULL check is here because of gimplification happening
> > before cgraph construction?
> 
> One of my notes I took during development says: "unshare_body can
> request a non-existing cgraph_node if called from
> finalize_size_functions in stor-layout.c."  And a quick test yesterday
> revealed that it can be also called when generating profile
> (create_coverage->cgraph_build_static_cdtor_1->gimplify_function_tree).
> So it's basically corner cases.

Hmm, so indeeed it is gimplificaiton before cgraph is updated. OK then.
> 
> > > Index: src/gcc/passes.c
> > > ===
> > > --- src.orig/gcc/passes.c 2011-03-19 01:16:23.0 +0100
> > > +++ src/gcc/passes.c  2011-03-19 01:54:42.0 +0100
> > > @@ -1344,7 +1344,7 @@ pass_init_dump_file (struct opt_pass *pa
> > >if (dump_file && current_function_decl)
> > >   {
> > > const char *dname, *aname;
> > > -   struct cgraph_node *node = cgraph_node (current_function_decl);
> > > +   struct cgraph_node *node = cgraph_get_node (current_function_decl);
> > 
> > Don't you want cgraph_do_get_node on those places that will ICE anyway?
> 
> No, the other way round.  I only used cgraph_do_get_node when it would
> not ICE immediately but might later, like when the result was passed
> to a caller or stored in some data structure for later use.  However
> using it here is certainly possible, if you like.

Hmm, OK.  The mutiplicity of cgraph accesstors is bit confusing.  For future
development I would preffer if people don't really need to worry about those
except for very corner cases (i.e. cgraph construction).

I would like to have one most common way to get cgraph node that is used
thorough backend.  I think it should be cgraph_do_get_node since in the backend
all functions that matters should be in cgraph.
> 
> > > Index: src/gcc/tree-ssa-alias.c
> > > ===
> > > --- src.orig/gcc/tree-ssa-alias.c 2011-03-19 01:16:23.0 +0100
> > > +++ src/gcc/tree-ssa-alias.c  2011-03-19 01:54:42.0 +0100
> > > @@ -1246,14 +1246,15 @@ ref_maybe_used_by_call_p_1 (gimple call,
> > >  
> > >/* Check if base is a global static variable that is not read
> > >   by the function.  */
> > > -  if (TREE_CODE (base) == VAR_DECL
> > > +  if (callee != NULL_TREE
> > > +  && TREE_CODE (base) == VAR_DECL
> > 
> > Why non-NULL tests are needed here?  It seems that at the time
> > cgraph is created we should have nodes for all accessible functions.
> 
> Almost.  We do not have a node for __builtin_GOMP_parallel_start when
> we examine a call from dse_possible_dead_store_p.  It would be nice in
> general if OMP made call graph nodes for its new functions in some
> more defined manner.  At this point it relies on cgraphbuild.c and
> apparently even that is sometimes not enough.  Should I add a FIXME
> here?
> 
> The failing tests are gcc.dg/autopar/reduc-1.c and
> gcc.dg/autopar/reduc-2.c.


Yes, please add FIXME.  It is better to fix incrementally, but I gor previously 
troubles
with GOMP requiring or not requiring cgraph nodes to be present for interesting 
reasons
(i.e. I have to disable unreachable node removal before GOMP is ready).  We 
need to
clean this up.
> 
> > 
> > What I wonder about is that we have similar API for annotations.  Here we 
> > have
> > var_ann_t for type name
> > var_ann (var) for what cgraph_get_node is
> > get_var_ann (var) for what cgraph_get_create_node is
> > create_var_ann (var) for hwat cgraph_create_node is.
> > 
> > So we may want to be consistent here. I never had problem with overlaping
> > struct and function obvoiusly, but if people disagree, what about:
> > 
> > cgraph_create_node = crate node and aborts if already exist
> > cgraph_get_node = return node or create noe
> > cgraph_maybe_get_node = return node or NULL
> > cgraph_do_get_node = return node and abort if NULL.
> > 
> > We may later even want to introduce our popular cgraph_node_d/cgraph_node_t 
> > and rename back cgraph_do_get_node to cgraph_node,
> > since it is is the most common accestor.
> > I would preffer to do that incrementally so 

[PATCH] Better .debug_aranges fix (PR debug/48253, take 3)

2011-03-25 Thread Jakub Jelinek
On Fri, Mar 25, 2011 at 05:17:07PM +0100, Jakub Jelinek wrote:
> On Thu, Mar 24, 2011 at 06:08:01PM +0100, Jason Merrill wrote:
> > This ought to cut down on the number of cases we have to handle in
> > all the different places in dwarf2out that deal with this stuff.
> > 
> > Does that make sense to you?
> 
> Here is updated patch, it is quite larger than the last one, because

Actually, I now realize I've missed the request to also remove
dw_fde_switched_sections bitfield, which can be replaced with
dw_fde_second_begin != NULL test.

Done below:

2011-03-25  Jakub Jelinek  

PR debug/48253
* dwarf2out.c (struct dw_fde_struct): Remove dw_fde_hot_section_label,
dw_fde_hot_section_end_label, dw_fde_unlikely_section_label,
dw_fde_unlikely_section_end_label, cold_in_std_section,
dw_fde_switched_sections and dw_fde_switched_cold_to_hot fields.
Add dw_fde_second_begin, dw_fde_second_end and second_in_std_section
fields.
(output_fde): Use dw_fde_second_{begin,end} if second is
true, otherwise dw_fde_{begin,end}.
(output_call_frame_info): Test dw_fde_second_begin != NULL
instead of dw_fde_switched_sections.
(dwarf2out_begin_prologue): Stop initializing removed dw_fde_struct
fields, initialize new fields.  Initialize in_std_section
unconditionally from the first partition.
(dwarf2out_end_epilogue): Don't override dw_fde_end when
dw_fde_second_begin is non-NULL.
(dwarf2out_switch_text_section): Stop initializing removed
dw_fde_struct fields, initialize new fields, initialize
also dw_fde_end here.  Set dw_fde_switch_cfi even when
dwarf2out_do_cfi_asm ().  Call var_location_switch_text_section.
(struct var_loc_list_def): Add last_before_switch field.
(arange_table, arange_table_allocated, arange_table_in_use,
ARANGE_TABLE_INCREMENT, add_arange): Removed.
(size_of_aranges): Count !in_std_section and !second_in_std_section
hunks in fdes, instead of looking at arange_table_in_use.
(output_aranges): Add aranges_length argument, don't call
size_of_aranges here.  Instead of using aranges_table*
emit ranges for fdes when !in_std_section resp.
!second_in_std_section.
(dw_loc_list): Break ranges crossing section switch.
(convert_cfa_to_fb_loc_list): Likewise.  If switched sections,
use dw_fde_second_end instead of dw_fde_end as end of last
range.
(gen_subprogram_die): Don't call add_arange.  Use
dw_fde_{begin,end} for first partition and if switched
section dw_fde_second_{begin,end} for the second.
(var_location_switch_text_section_1,
var_location_switch_text_section): New functions.
(dwarf2out_begin_function): Initialize cold_text_section even
when function_section () isn't text_section.
(prune_unused_types): Don't walk arange_table.
(dwarf2out_finish): Don't needlessly test
flag_reorder_blocks_and_partition when testing cold_text_section_used.
If info_section_emitted, call size_of_aranges and if it indicates
non-empty .debug_aranges, call output_aranges with the computed
size.  Stop using removed dw_fde_struct fields, use
dw_fde_{begin,end} for first partition and dw_fde_second_{begin,end}
for second.

--- gcc/dwarf2out.c.jj  2011-03-25 11:24:06.0 +0100
+++ gcc/dwarf2out.c 2011-03-25 17:45:05.0 +0100
@@ -302,10 +302,8 @@ typedef struct GTY(()) dw_fde_struct {
   const char *dw_fde_end;
   const char *dw_fde_vms_end_prologue;
   const char *dw_fde_vms_begin_epilogue;
-  const char *dw_fde_hot_section_label;
-  const char *dw_fde_hot_section_end_label;
-  const char *dw_fde_unlikely_section_label;
-  const char *dw_fde_unlikely_section_end_label;
+  const char *dw_fde_second_begin;
+  const char *dw_fde_second_end;
   dw_cfi_ref dw_fde_cfi;
   dw_cfi_ref dw_fde_switch_cfi; /* Last CFI before switching sections.  */
   HOST_WIDE_INT stack_realignment;
@@ -324,13 +322,9 @@ typedef struct GTY(()) dw_fde_struct {
   unsigned drap_reg_saved: 1;
   /* True iff dw_fde_begin label is in text_section or cold_text_section.  */
   unsigned in_std_section : 1;
-  /* True iff dw_fde_unlikely_section_label is in text_section or
+  /* True iff dw_fde_second_begin label is in text_section or
  cold_text_section.  */
-  unsigned cold_in_std_section : 1;
-  /* True iff switched sections.  */
-  unsigned dw_fde_switched_sections : 1;
-  /* True iff switching from cold to hot section.  */
-  unsigned dw_fde_switched_cold_to_hot : 1;
+  unsigned second_in_std_section : 1;
 }
 dw_fde_node;
 
@@ -3628,28 +3622,8 @@ output_fde (dw_fde_ref fde, bool for_eh,
 dw2_asm_output_offset (DWARF_OFFSET_SIZE, section_start_label,
   debug_frame_section, "FDE CIE offset");
 
-  if (!fde->dw_fde_switched_sections)
-{
-  begin =

Re: [testsuite, build] Convert boehm-gc testsuite to DejaGnu (PR boehm-gc/11412)

2011-03-25 Thread Rainer Orth
Paolo Bonzini  writes:

>> @@ -116,7 +79,6 @@
>>  "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
>>  "SHELL=$(SHELL)" \
>>  "EXPECT=$(EXPECT)" \
>> -"RUNTEST=$(RUNTEST)" \
>
> Leave this line here, and replace the definitions of EXPECT and RUNTEST in
> boehm-gc/testsuite/Makefile.am with this:
>
> EXPECT = expect
>
> Automake will provide a definition of RUNTEST on its own.  I know this is
> likely cut-and-paste. :)  I'll reply that mine is cut-and-paste from
> libstdc++-v3/testsuite/Makefile.am.

... which is fine since it's shorter :-)

>> @@ -163,9 +164,9 @@
>>*-*-hpux10*)
>>  AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
>>  ;;
>> -  *-*-kfreebsd*-gnu)
>> + *-*-kfreebsd*-gnu)
>>  AC_DEFINE(GC_FREEBSD_THREADS)
>> -   INCLUDES="$INCLUDES -pthread"
>> +   THREADCFLAGS=-pthread
>>  THREADDLLIBS=-pthread
>
> Please change this THREADLIBS since you're at it.

Done.

> Otherwise, build parts are okay.

Thanks.  I've retested the resulting patch with a java-only bootstrap on
i386-pc-solaris2.10 and installed on mainline.

I expect there will be problems on some targets, but we'll never know
until this is checked in for wider exposure.

Thanks to all of you who helped me on this journey with comments,
testing and advice.

Rainer

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


[Patch, libgFortran] Fix MinGW64 compile warning

2011-03-25 Thread Tobias Burnus

The attached patch fixes a compiler warning on MinGW64

../../../../../build/gcc/src/libgfortran/io/unix.c:51:0: warning: 
"lseek" redefined [enabled by default]


which is due to MinGW64 now supporting LFS. (Seemingly, using a similar 
define as libgfortran.) The following patch should fix the issue.


Thanks for Kai for suggestions and testing the patch on MinGW64. The 
goal is that it also works with older MinGW64 and with 32bit MinGW, but 
that has not been tested ...


OK for the trunk?

Tobias
2011-03-25  Tobias Burnus  

	* unix.c: Adapt stat defines now that MinGW64 supports LFS.

Index: libgfortran/io/unix.c
===
--- libgfortran/io/unix.c	(Revision 171454)
+++ libgfortran/io/unix.c	(Arbeitskopie)
@@ -48,11 +48,17 @@
 #define WIN32_LEAN_AND_MEAN
 #include 
 
+#if !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64
+#undef lseek
 #define lseek _lseeki64
+#undef fstat
 #define fstat _fstati64
+#undef stat
 #define stat _stati64
-typedef struct _stati64 gfstat_t;
+#endif
 
+typedef struct stat gfstat_t;
+
 #ifndef HAVE_WORKING_STAT
 static uint64_t
 id_from_handle (HANDLE hFile)


Re: [testsuite, build] Convert boehm-gc testsuite to DejaGnu (PR boehm-gc/11412)

2011-03-25 Thread Rainer Orth
I meant to include the final patch.  Here it is.

Rainer


2011-03-25  Rainer Orth  

PR boehm-gc/11412
* configure.ac (THREADCFLAGS): New variable.
Use it instead of INCLUDES, AM_CPPFLAGS.
<*-*-kfreebsd*-gnu> (THREADDLLIBS): Rename to THREADLIBS.
Remove DG/UX support.
(AC_CONFIG_FILES): Add testsuite/Makefile.
* Makefile.am (AUTOMAKE_OPTIONS): Use foreign instead of cygnus.
(SUBDIRS): Add testsuite.
(libgcjgc_la_LIBADD): Remove $(UNWINDLIBS).
(AM_CXXFLAGS): Add $(THREADCFLAGS).
(AM_CFLAGS): Likewise.
Remove TESTS related variables.
* Makefile.in: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.am: New file.
* testsuite/Makefile.in: New file.
* testsuite/lib/boehm-gc.exp: New file.
* testsuite/config/default.exp: New file.
* testsuite/boehm-gc.c/c.exp: New file.
* testsuite/boehm-gc.lib/lib.exp: New file.
* tests/test.c: Move ...
* testsuite/boehm-gc.c/gctest.c: ... here.
* tests/leak_test.c, tests/middle.c, tests/thread_leak_test.c,
tests/trace_test.c: Move ...
* testsuite/boehm-gc.c: ... here.
* testsuite/boehm-gc.c/trace_test.c: Skip everywhere.
* tests/staticrootslib.c, tests/staticrootstest.c: Move ...
* testsuite/boehm-gc.lib: ... here.
* testsuite/boehm-gc.lib/staticrootstest.c: Use dg-add-shlib
staticrootslib.c.
* tests/test_cpp.cc: Move ...
* testsuite/boehm-gc.c++: ... here.

Index: boehm-gc/configure.ac
===
--- boehm-gc/configure.ac   (revision 171465)
+++ boehm-gc/configure.ac   (working copy)
@@ -123,6 +123,7 @@
 )
 
 AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
+THREADCFLAGS=
 THREADLIBS=
 case "$THREADS" in
  no | none | single)
@@ -163,21 +164,21 @@
  *-*-hpux10*)
AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
;;
-  *-*-kfreebsd*-gnu)
+ *-*-kfreebsd*-gnu)
AC_DEFINE(GC_FREEBSD_THREADS)
-   INCLUDES="$INCLUDES -pthread"
-   THREADDLLIBS=-pthread
+   THREADCFLAGS=-pthread
+   THREADLIBS=-pthread
AC_DEFINE(_REENTRANT)
  if test "${enable_parallel_mark}" = yes; then
  AC_DEFINE(PARALLEL_MARK)
fi
AC_DEFINE(THREAD_LOCAL_ALLOC)
AC_DEFINE(USE_COMPILER_TLS, 1,[use tls for boehm])
-   ;;
+   ;;
  *-*-freebsd*)
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
AC_DEFINE(GC_FREEBSD_THREADS,1,[support FreeBSD threads])
-   AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
+   THREADCFLAGS=-pthread
THREADLIBS=-pthread
;;
  *-*-solaris2.8*)
@@ -218,7 +219,7 @@
  # May want to enable it in other cases, too.
  # Measurements havent yet been done.
fi
-   AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
+   THREADCFLAGS=-pthread
THREADLIBS="-lpthread -lrt"
;;
 esac
@@ -228,20 +229,6 @@
 dnl Old wine getenv may not return NULL for missing entry.
 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
 ;;
- dgux386)
-THREADS=dgux386
-AC_MSG_RESULT($THREADLIBS)
-# Use pthread GCC  switch
-THREADLIBS=-pthread
-if test "${enable_parallel_mark}" = yes; then
-AC_DEFINE(PARALLEL_MARK,1)
-fi
-AC_DEFINE(THREAD_LOCAL_ALLOC,1)
-AC_DEFINE(GC_DGUX386_THREADS,1,[support for DB/UX on I386 threads])
-AC_DEFINE(DGUX_THREADS,1,[No description])
-# Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
-AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
-;;
  aix)
 THREADS=posix
 THREADLIBS=-lpthread
@@ -255,6 +242,7 @@
 AC_MSG_ERROR($THREADS is an unknown thread package)
 ;;
 esac
+AC_SUBST(THREADCFLAGS)
 AC_SUBST(THREADLIBS)
 
 case "$host" in
@@ -455,22 +443,6 @@
 AC_SUBST(addlibs)
 AC_SUBST(addtests)
 
-#
-# Check for AViiON Machines running DGUX
-#
-ac_is_dgux=no
-AC_CHECK_HEADER(sys/dg_sys_info.h, [ac_is_dgux=yes])
-
-AC_MSG_CHECKING(if host is AViiON running DGUX)
-AC_MSG_RESULT($ac_is_dgux)
-## :GOTCHA: we do not check anything but sys/dg_sys_info.h
-if test $ac_is_dgux = yes; then
-if test "$enable_full_debug" = "yes"; then
-GC_CFLAGS="$GC_CFLAGS -mstandard"
-fi
-GC_CFLAGS="$GC_CFLAGS -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend"
-fi
-
 dnl As of 4.13a2, the collector will not properly work on Solaris when
 dnl built with gcc and -O.  So we remove -O in the appropriate case.
 dnl Not needed anymore on Solaris.
@@ -513,9 +485,6 @@
AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
AC_DEFINE(SAVE_CALL_COUNT, 8, [number of call frames saved with objects 
allocated through the debugging interface])
   ;;
-  i[3456]86-*-dgux*)
-   AC_DEFINE(MAKE_BACK_GRAPH,1)
-  ;;
 esac 
   fi])
 
@@ -547,5 +516,5 @@
 
 AC_CONFIG_HEADERS([include/gc

Re: Cleaning up expand optabs code

2011-03-25 Thread Richard Henderson
On 03/25/2011 05:41 AM, Georg-Johann Lay wrote:
>> On 03/22/2011 06:48 PM, Richard Henderson wrote:
>>
>>> Ok.  Watch out for other target problems this week.
> 
> libgcc fails to build for avr (SVN 171446)
> 
> ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c: In function
> '__negdi2':
> ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c:68:17:
> internal compiler error: in maybe_gen_insn, at  optabs.c:7123

This is due to a miscommunication between the middle-end and the backend
about how many arguments the setmemhi pattern takes.

(define_expand "setmemhi"
  [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
   (match_operand 2 "const_int_operand" ""))
  (use (match_operand:HI 1 "const_int_operand" ""))
  (use (match_operand:HI 3 "const_int_operand" "n"))
  (clobber (match_scratch:HI 4 ""))
  (clobber (match_dup 5))])]

The match_scratch is counted in .n_operands, which makes the count of
operands not equal 4, so we assume 6 operands are necessary.  We can
fix this for the special case of avr by only assuming 6 operands when
there are in fact 6 operands, but of course this could fail just as
easily if there were two scratches.

All of which suggests that optional arguments to a named optab is a
mistake that ought to be rectified.

I plan to commit the following after bootstrap and check.


r~
diff --git a/gcc/expr.c b/gcc/expr.c
index 4db1c77..0a95aa7 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1299,11 +1299,10 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, 
unsigned int align,
  /* The check above guarantees that this size conversion is valid.  */
  create_convert_operand_to (&ops[2], size, mode, true);
  create_integer_operand (&ops[3], align / BITS_PER_UNIT);
- if (nops != 4)
+ if (nops == 6)
{
  create_integer_operand (&ops[4], expected_align / BITS_PER_UNIT);
  create_integer_operand (&ops[5], expected_size);
- nops = 6;
}
  if (maybe_expand_insn (code, nops, ops))
{
@@ -2721,11 +2720,10 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, 
unsigned int align,
  create_convert_operand_to (&ops[1], size, mode, true);
  create_convert_operand_from (&ops[2], val, byte_mode, true);
  create_integer_operand (&ops[3], align / BITS_PER_UNIT);
- if (nops != 4)
+ if (nops == 6)
{
  create_integer_operand (&ops[4], expected_align / BITS_PER_UNIT);
  create_integer_operand (&ops[5], expected_size);
- nops = 6;
}
  if (maybe_expand_insn (code, nops, ops))
return true;


go patch committed: Give error on label defined but not used

2011-03-25 Thread Ian Lance Taylor
The Go language says that it is an error to define a label but not use
it.  This patch adds that error to the gccgo frontend.  The patch
includes some changes to the testsuite to avoid new errors.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r aaba6044d772 go/gogo.cc
--- a/go/gogo.cc	Thu Mar 24 22:02:30 2011 -0700
+++ b/go/gogo.cc	Fri Mar 25 10:27:55 2011 -0700
@@ -1463,6 +1463,7 @@
   Check_types_traverse(Gogo* gogo)
 : Traverse(traverse_variables
 	   | traverse_constants
+	   | traverse_functions
 	   | traverse_statements
 	   | traverse_expressions),
   gogo_(gogo)
@@ -1475,6 +1476,9 @@
   constant(Named_object*, bool);
 
   int
+  function(Named_object*);
+
+  int
   statement(Block*, size_t* pindex, Statement*);
 
   int
@@ -1542,6 +1546,16 @@
   return TRAVERSE_CONTINUE;
 }
 
+// There are no types to check in a function, but this is where we
+// issue warnings about labels which are defined but not referenced.
+
+int
+Check_types_traverse::function(Named_object* no)
+{
+  no->func_value()->check_labels();
+  return TRAVERSE_CONTINUE;
+}
+
 // Check that types are valid in a statement.
 
 int
@@ -2744,7 +2758,7 @@
 	}
   else
 	{
-	  error_at(location, "redefinition of label %qs",
+	  error_at(location, "label %qs already defined",
 		   Gogo::message_name(label_name).c_str());
 	  inform(label->location(), "previous definition of %qs was here",
 		 Gogo::message_name(label_name).c_str());
@@ -2764,17 +2778,36 @@
   if (!ins.second)
 {
   // The label was already in the hash table.
-  return ins.first->second;
+  Label* label = ins.first->second;
+  label->set_is_used();
+  return label;
 }
   else
 {
   gcc_assert(ins.first->second == NULL);
   Label* label = new Label(label_name);
   ins.first->second = label;
+  label->set_is_used();
   return label;
 }
 }
 
+// Warn about labels that are defined but not used.
+
+void
+Function::check_labels() const
+{
+  for (Labels::const_iterator p = this->labels_.begin();
+   p != this->labels_.end();
+   p++)
+{
+  Label* label = p->second;
+  if (!label->is_used())
+	error_at(label->location(), "label %qs defined and not used",
+		 Gogo::message_name(label->name()).c_str());
+}
+}
+
 // Swap one function with another.  This is used when building the
 // thunk we use to call a function which calls recover.  It may not
 // work for any other case.
diff -r aaba6044d772 go/gogo.h
--- a/go/gogo.h	Thu Mar 24 22:02:30 2011 -0700
+++ b/go/gogo.h	Fri Mar 25 10:27:55 2011 -0700
@@ -882,6 +882,10 @@
   Label*
   add_label_reference(const std::string& label_name);
 
+  // Warn about labels that are defined but not used.
+  void
+  check_labels() const;
+
   // Whether this function calls the predeclared recover function.
   bool
   calls_recover() const
@@ -2090,7 +2094,7 @@
 {
  public:
   Label(const std::string& name)
-: name_(name), location_(0), decl_(NULL)
+: name_(name), location_(0), is_used_(false), decl_(NULL)
   { }
 
   // Return the label's name.
@@ -2103,6 +2107,16 @@
   is_defined() const
   { return this->location_ != 0; }
 
+  // Return whether the label has been used.
+  bool
+  is_used() const
+  { return this->is_used_; }
+
+  // Record that the label is used.
+  void
+  set_is_used()
+  { this->is_used_ = true; }
+
   // Return the location of the definition.
   source_location
   location() const
@@ -2130,6 +2144,8 @@
   // The location of the definition.  This is 0 if the label has not
   // yet been defined.
   source_location location_;
+  // Whether the label has been used.
+  bool is_used_;
   // The LABEL_DECL.
   tree decl_;
 };
diff -r aaba6044d772 go/parse.cc
--- a/go/parse.cc	Thu Mar 24 22:02:30 2011 -0700
+++ b/go/parse.cc	Fri Mar 25 10:27:55 2011 -0700
@@ -3112,7 +3112,7 @@
 // LABEL is the label of this statement if it has one.
 
 void
-Parse::statement(const Label* label)
+Parse::statement(Label* label)
 {
   const Token* token = this->peek_token();
   switch (token->classification())
@@ -3288,6 +3288,10 @@
 
   if (!this->statement_may_start_here())
 {
+  // Mark the label as used to avoid a useless error about an
+  // unused label.
+  label->set_is_used();
+
   error_at(location, "missing statement after label");
   this->unget_token(Token::make_operator_token(OPERATOR_SEMICOLON,
 		   location));
@@ -3774,7 +3778,7 @@
 // TypeSwitchGuard = [ identifier ":=" ] Expression "." "(" "type" ")" .
 
 void
-Parse::switch_stat(const Label* label)
+Parse::switch_stat(Label* label)
 {
   gcc_assert(this->peek_token()->is_keyword(KEYWORD_SWITCH));
   source_location location = this->location();
@@ -3873,7 +3877,7 @@
 //   "{" { ExprCaseClause } "}"
 
 Statement*
-Parse::expr_switch_body(const Label* label, Expression* switch_val,
+Parse::expr_switch_body(Label* label, Expression* switch_val,
 			source_location location)
 {
   Switch_statement* st

Re: [PATCH 3/6] Allow jumps in epilogues

2011-03-25 Thread Bernd Schmidt
On 03/23/2011 06:19 PM, Richard Henderson wrote:
> In general, with shrink-wrapping, we can have essentially arbitrary
> differences in unwind info between blocks that are sequential.

So, while that isn't the case just yet with the current shrink-wrapping
patch, it seems I will either have to make dwarf2out fully general, or
ensure that basic blocks occur in only a certain order (the prologue
must be written out only after all basic blocks that can be executed
before or without reaching it).

I don't know much about the unwinding code. I'm currently thinking about
writing out a cfi_remember_state at the start of the function, restoring
that clean state when necessary at the start of a new block and emitting
the necessary directives to reach the correct state. What directives
should I expect to be required? Can I get by just with cfi_offset and
cfi_def_cfa_offset, or will something else be necessary?


Bernd


Re: [RFC PATCH] Typed DWARF stack

2011-03-25 Thread Cary Coutant
> This patch on top of
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01224.html
> and
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01723.html
> implements parts of Cary's typed DWARF stack proposal:
> http://www.dwarfstd.org/doc/040408.1.html

I haven't looked at the patch yet, but this sounds great; thanks for
doing this! I think that with an actual implementation in place and
some experience with it, there's a better chance at getting this
adopted into DWARF 5, even though I was unsuccessful at getting it
accepted for DWARF 4.

-cary


Re: Cleaning up expand optabs code

2011-03-25 Thread Richard Sandiford
Richard Henderson  writes:
> This is due to a miscommunication between the middle-end and the backend
> about how many arguments the setmemhi pattern takes.
>
> (define_expand "setmemhi"
>   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
>(match_operand 2 "const_int_operand" ""))
>   (use (match_operand:HI 1 "const_int_operand" ""))
>   (use (match_operand:HI 3 "const_int_operand" "n"))
>   (clobber (match_scratch:HI 4 ""))
>   (clobber (match_dup 5))])]
>
> The match_scratch is counted in .n_operands, which makes the count of
> operands not equal 4, so we assume 6 operands are necessary.  We can
> fix this for the special case of avr by only assuming 6 operands when
> there are in fact 6 operands, but of course this could fail just as
> easily if there were two scratches.
>
> All of which suggests that optional arguments to a named optab is a
> mistake that ought to be rectified.
>
> I plan to commit the following after bootstrap and check.

Thanks.  I think it needs to be s/!= 4/>= 6/ though, so that
match_scratches still work when 6 operands really are passed in.

Fully agreed on the optional args thing.  Or maybe insn_data should
have a separate "num_args" field.

Richard


[PATCH] Simple cgraph_node() -> cgraph_get_node() conversions

2011-03-25 Thread Martin Jambor
Hi,

The following is a part of
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01204.html - specifically
it contains all the simple conversions of calls to cgraph_node to
cgraph_get_node.  Simple in the sense that checks whether the return
value is not NULL are not necessary (or they are sometimes already
present... doh).

I have developed and tested this patch on top of
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01673.html which is still
pending approval.

I have bootstrapped and tested it on x86-64-linux (and the previous
big patch was tested on a few more platforms, I will do that again
with the more complex parts).  Is this OK for trunk now?

Thanks,

Martin


2011-03-25  Martin Jambor  

* except.c (set_nothrow_function_flags): Call cgraph_get_node instead
of cgraph_node.
* final.c (rest_of_clean_state): Likewise.
* gimple-iterator.c (update_call_edge_frequencies): Likewise.
* passes.c (pass_init_dump_file): Likewise.
(execute_all_ipa_transforms): Likewise.
(function_called_by_processed_nodes_p): Likewise.
* predict.c (maybe_hot_frequency_p): Likewise.
(probably_never_executed_bb_p): Likewise.
(compute_function_frequency): Likewise.
* tree-nested.c (check_for_nested_with_variably_modified): Likewise.
(unnest_nesting_tree_1): Likewise.
(lower_nested_functions): Likewise.
* tree-optimize.c (execute_fixup_cfg): Likewise.
(tree_rest_of_compilation): Likewise.
* tree-profile.c (gimple_gen_ic_func_profiler): Likewise.
* tree-sra.c (ipa_early_sra): Likewise.
* tree-ssa-loop-ivopts.c (computation_cost): Likewise.
* config/i386/i386.c (ix86_compute_frame_layout): Likewise.
* ipa.c (record_cdtor_fn): Likewise.
* ipa-inline.c (cgraph_early_inlining): Likewise.
(compute_inline_parameters_for_current): Likewise.
* ipa-prop.c (ipa_make_edge_direct_to_target): Likewise.
* ipa-pure-const.c (local_pure_const): Likewise.
* ipa-split.c (split_function): Likewise.
(execute_split_functions): Likewise.
* cgraphbuild.c (build_cgraph_edges): Likewise.
(rebuild_cgraph_edges): Likewise.
(cgraph_rebuild_references): Likewise.  
(remove_cgraph_callee_edges): Likewise.
* cgraphunit.c (cgraph_mark_if_needed): Likewise.
(verify_cgraph_node): Likewise.
(cgraph_analyze_functions): Likewise.
(cgraph_preserve_function_body_p): Likewise.
(save_inline_function_body): Likewise.
(save_inline_function_body): Likewise.
* tree-inline.c (copy_bb): Likewise.
(optimize_inline_calls): Likewise.



Index: src/gcc/except.c
===
--- src.orig/gcc/except.c
+++ src/gcc/except.c
@@ -1879,11 +1879,11 @@ set_nothrow_function_flags (void)
  }
   }
   if (crtl->nothrow
-  && (cgraph_function_body_availability (cgraph_node
+  && (cgraph_function_body_availability (cgraph_get_node
 (current_function_decl))
   >= AVAIL_AVAILABLE))
 {
-  struct cgraph_node *node = cgraph_node (current_function_decl);
+  struct cgraph_node *node = cgraph_get_node (current_function_decl);
   struct cgraph_edge *e;
   for (e = node->callers; e; e = e->next_caller)
 e->can_throw_external = false;
Index: src/gcc/final.c
===
--- src.orig/gcc/final.c
+++ src/gcc/final.c
@@ -4364,7 +4364,7 @@ rest_of_clean_state (void)
   else
{
  const char *aname;
- struct cgraph_node *node = cgraph_node (current_function_decl);
+ struct cgraph_node *node = cgraph_get_node (current_function_decl);
 
  aname = (IDENTIFIER_POINTER
   (DECL_ASSEMBLER_NAME (current_function_decl)));
Index: src/gcc/gimple-iterator.c
===
--- src.orig/gcc/gimple-iterator.c
+++ src/gcc/gimple-iterator.c
@@ -84,7 +84,7 @@ update_call_edge_frequencies (gimple_seq
   to avoid calling them if we never see any calls.  */
if (cfun_node == NULL)
  {
-   cfun_node = cgraph_node (current_function_decl);
+   cfun_node = cgraph_get_node (current_function_decl);
bb_freq = (compute_call_stmt_bb_frequency
   (current_function_decl, bb));
  }
Index: src/gcc/passes.c
===
--- src.orig/gcc/passes.c
+++ src/gcc/passes.c
@@ -1342,7 +1342,7 @@ pass_init_dump_file (struct opt_pass *pa
   if (dump_file && current_function_decl)
{
  const char *dname, *aname;
- struct cgraph_node *node = cgraph_node (current_function_decl);
+ struct cgraph_node *node = cgraph_get_node (current_function_decl);
  dname = lang_hooks.decl_pri

Re: [Patch, Fortran] PR 48174+45304: No varags if interface is known

2011-03-25 Thread Tobias Burnus

Dear Paul,

Paul Richard Thomas wrote:

Why did Jakub's patch for PR45304 not fix this? He visited the fix in
your patch upon build_library_function_decl_1 and
gfc_get_intrinsic_lib_fndecl.


Well, my patch is in a way a follow up to Jakub's. His patch only fixed 
the library call definitions and the (in gfc_get_function_type) ensured 
that for decl with formal arguments and for the main function the void 
list is added.


Thus, no void list was added if there was no formal arglist. Well, this 
patch changes this to still add the void list, if it is known that there 
are no arguments.



Should trans-decl.c(create_function_arglist) have received the same treatment?


I don't think so - though I might be wrong.

Committed as Rev. 171519.

Tobias


Re: [Patch, Fortran] PR 48174+45304: No varags if interface is known

2011-03-25 Thread Tobias Burnus

Dear Bob,

Bob Deen wrote:
Our code does not declare these routines to Fortran, therefore the 
procedure interface is unknown and this patch "should" not bother 
anything.


Well, it also affects:

  SUBROUTINE foo()
  END SUBROUTINE foo
and
  REAL FUNCTION bar()
  END FUNCTION bar

that is procedures without arguments, including functions which do not 
return an argument. However, without looking at the debug output 
(DWARF), it should not be visible for the generated program - and it 
should not cause any issues.


But for the related issue... deducing the interface from usage is 
likely to break things badly in my case (and doesn't sound very robust 
in any case).  Unless I'm misunderstanding the application of the issue?


I think deducing the interface should work fine; I think C does the 
same, if no prototype has been specified.


I am not sure what it means for your test case [1], thus, one probably 
should test it before. However, no patch to address that issue exists, 
yet. I have added your test program as comment to PR 44471 [2]


[1] http://gcc.gnu.org/ml/fortran/2010-05/msg00330.html
[2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44471

Tobias


Re: Tighten ARM's CANNOT_CHANGE_MODE_CLASS

2011-03-25 Thread Richard Sandiford
Richard Earnshaw  writes:
>> gcc/
>>  * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Restrict FPA_REGS
>>  case to VFPv1.
>> 
>
> I think adding a comment that VFPv1 would require a restriction but that
> that isn't supported would be useful.  Then if the worst happens it will
> be one less bug to go track down.
>
> OK with that change.

Thanks.  Here's what I installed.

Richard


gcc/
* config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Restrict FPA_REGS
case to VFPv1.

Index: gcc/config/arm/arm.h
===
--- gcc/config/arm/arm.h2011-03-25 18:19:45.0 +
+++ gcc/config/arm/arm.h2011-03-25 18:26:13.0 +
@@ -1167,12 +1167,12 @@ #define IRA_COVER_CLASSES   
 \
 }
 
 /* FPA registers can't do subreg as all values are reformatted to internal
-   precision.  VFP registers may only be accessed in the mode they
-   were set.  */
-#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)  \
-  (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)  \
-   ? reg_classes_intersect_p (FPA_REGS, (CLASS))   \
- || reg_classes_intersect_p (VFP_REGS, (CLASS))\
+   precision.  In VFPv1, VFP registers could only be accessed in the mode
+   they were set, so subregs would be invalid there too.  However, we don't
+   support VFPv1 at the moment, and the restriction was lifted in VFPv2.  */
+#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)  \
+  (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)  \
+   ? reg_classes_intersect_p (FPA_REGS, (CLASS))   \
: 0)
 
 /* The class value for index registers, and the one for base regs.  */


Re: Cleaning up expand optabs code

2011-03-25 Thread Richard Sandiford
Richard Sandiford  writes:
> Richard Henderson  writes:
>> This is due to a miscommunication between the middle-end and the backend
>> about how many arguments the setmemhi pattern takes.
>>
>> (define_expand "setmemhi"
>>   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
>>(match_operand 2 "const_int_operand" ""))
>>   (use (match_operand:HI 1 "const_int_operand" ""))
>>   (use (match_operand:HI 3 "const_int_operand" "n"))
>>   (clobber (match_scratch:HI 4 ""))
>>   (clobber (match_dup 5))])]
>>
>> The match_scratch is counted in .n_operands, which makes the count of
>> operands not equal 4, so we assume 6 operands are necessary.  We can
>> fix this for the special case of avr by only assuming 6 operands when
>> there are in fact 6 operands, but of course this could fail just as
>> easily if there were two scratches.
>>
>> All of which suggests that optional arguments to a named optab is a
>> mistake that ought to be rectified.
>>
>> I plan to commit the following after bootstrap and check.
>
> Thanks.  I think it needs to be s/!= 4/>= 6/ though, so that
> match_scratches still work when 6 operands really are passed in.

Er, >= 4 even...

Richard


Re: Cleaning up expand optabs code

2011-03-25 Thread Richard Sandiford
Richard Sandiford  writes:
> Er, >= 4 even...

Or not,  *sigh*.  Time I went home...

Richard




Re: Scheduler cleanups, 2/N

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/24/11 07:09, Bernd Schmidt wrote:
> This prints a bit more information in debugging dumps. Bootstrapped and
> tested on i686-linux.
>
OK.
jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNjN9YAAoJEBRtltQi2kC7bokIAJCxFKpr7DzWCZZmXpb19JkY
MHSTK3EYpugF7J4cjq3Png60cwZqdBSjWruVbLIpO1jwVrLHkAoZjuu/7EDaSDW6
zFVLPAdD2wf9ZFtK3o8Rbd93tksyZGxqX4RTZGmbuXnqfCYDJmTLpwRmXCAVzBnB
O4BcaC/Ziy4dwT5D7L+E8B7zr6bPE4dLeIXpd8JJjGRJNWpWRRiJX9ZGDiHbGeRm
Fg5I+jjimng02g7jG+28isR8GWXL1byCXzDHL/aX/l4oxid+Lj2ULxbW6TNT8EPS
hJgqItPcqcIukT1NDGos8awK6HBaoThcPXtHbzxSvDNIYKjBP3qLlgYcDyUlPkg=
=U0C5
-END PGP SIGNATURE-


Re: Scheduler cleanups, 4/N

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/24/11 07:14, Bernd Schmidt wrote:
> We have a mechanism to prevent the scheduler from touching certain
> blocks; this is used by modulo scheduling. sched-ebb does not honor this
> flag currently; this patch fixes it. Bootstrapped and tested on
> i686-linux (pointlessly... but it's also used in our local tree for a
> new target, TI C6X).
OK.
Jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNjN+NAAoJEBRtltQi2kC7msMIAIARUmWJGlRbdnhTVtHw9svk
mNVQw5Se1BCzjDjERcuH8nZ2J0RcejNQWSCfYOBjGW3u5bzqYNPsjFkMj4TXCH3N
az7EAlj6uw6IcqnOL2HsoH89zMDNp5bUanKmlUDznTyaDAutYL+LAp3if5EbBFn8
C6LQHJDlnmYYmZohW3aYyJ+mGKhA3gODFJsWt7uWKuPEjedHY8Jztuc72gSavHo2
qxPze59QyHkC9VaTPdt7wYgsA2UtNmbNIfZIVluutXBKQGXC5xEHszbS16OvcK/v
RS9dQVpNZlfQVz+V6iLywET0/OM9leOHQRTAGwx4g9ffLuBOiAXrjW2Dbj6gclg=
=NmoH
-END PGP SIGNATURE-


Re: Scheduler cleanups, 5/5

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/24/11 07:19, Bernd Schmidt wrote:
> We can currently select an insn to be scheduled, only to find out that
> it's not actually valid at the current time, either due to state
> conflicts or being an asm with something else already scheduled in the
> same cycle. Not only is this pointless, it causes problem with the
> sched_reorder logic in the TI C6X port (which will be submitted later).
> The solution is to prune the ready list earlier. More code is moved out
> of the schedule_block main loop, which is IMO always a good thing.
> 
> Bootstrapped and tested (a slightly earlier version with an unused
> variable) on i686-linux; I also verified that there are no changes in
> code generation on any of my testcases.
OK.
Jeff

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNjOBTAAoJEBRtltQi2kC7TKwH/i5NH93tC1y9LVzCoc0Gk9oj
FvuxaUSeoGrSvliGCw5Zdw1CJFtPBWOVWGHsVpcYzVIRSGy8i4v9N9COteWVNfZ0
pVKSrr+b4FcVBDzcEoi6e/BN/SlNo7C9grdmmDMeePguNBsf00XVptdwvSfC8Cil
osqnlVvoQX1Fi2D3updBHqCcTmCe6Aug59tXaZ9k8dOKv7+8NfVeKSygnbjtr3Yk
sqo8Iuog95LYo/LmDz9hqpRaMkkH5iBXgaoQEvSRYb66Kpa2TIhmSokj1xx6Ndq1
rYyEgJPHPLHxQFqIGDZpSKaHh0gPmvZqIWy0lZdsxZS4ZqQb4KYW+cw46OtSN4w=
=A++W
-END PGP SIGNATURE-


Re: [PING^2]: For unreviewed patches

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/25/11 02:48, Kai Tietz wrote:
> Ping for following patches
> 
> [patch libcpp]: Improve handling of DOS-filenames and -paths
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00742.html
> 
> [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00824.html
OK for both.

Thanks,
Jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNjOFOAAoJEBRtltQi2kC7KN0H/R0Hk6Yo13Qjef68dZgg7c9z
yv+6t4EK2+zlQ+lNi8jf4xwAovtfH7T0IltpQFeryv6nEhGRLh+M4X0zhKmIQlJs
zH9/Ey1mNFfDzbzxE5Ki9Eh+1sdYuzDuP2n3hpsU1DorMYfPi9ilVN+U/5kmu/FB
tlKk0e48Q0WjuA0irV9aMEBQkVuk90Sq/TyeJ6tsCnCOKu7AjQsgtA8cKGo1nkAh
eUcGYF5SgUB+DPzWr48HuR3ygF9QQNNuur2zu6qTMPl0KGeoBPVYRP9qZdsVYbTw
WkYiaX9M77IN24bBqz22mfTaC8l1A/4levRdegBRcH2/WbRCxhR+gqGPmVKm7mg=
=8WvV
-END PGP SIGNATURE-


Re: Cleaning up expand optabs code

2011-03-25 Thread Richard Henderson
On 03/25/2011 10:51 AM, Richard Sandiford wrote:
> Thanks.  I think it needs to be s/!= 4/>= 6/ though, so that
> match_scratches still work when 6 operands really are passed in.

For the record, I audited all setmem and movmem patterns.

There are is only one that uses 6 operands: i386.
There are two that use 4 operands, but have 1 scratch: avr, pdp11.
All the rest have exactly 4 operands.

I'll leave the test as == 6 for now.

> Fully agreed on the optional args thing.  Or maybe insn_data should
> have a separate "num_args" field.

This is sounds like a good thing.

It's probably worth doing some checking in some genfoo (opinit?) that
the named patterns have exactly the number of operands expected.


r~


Re: [PING^2]: For unreviewed patches

2011-03-25 Thread Kai Tietz
2011/3/25 Jeff Law :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 03/25/11 02:48, Kai Tietz wrote:
>> Ping for following patches
>>
>> [patch libcpp]: Improve handling of DOS-filenames and -paths
>> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00742.html
>>
>> [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues
>> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00824.html
> OK for both.
>
> Thanks,
> Jeff

Committed at revision 171521 and revision 171522.

Thanks,
Kai


go patch committed: Avoid double error on negative shift count

2011-03-25 Thread Ian Lance Taylor
This patch to the Go frontend avoids a double error when there is a
negative shift count.  We used to give a negative shift count error
followed by an overflow error.  This just gives the former.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 31aaf6e2aa75 go/expressions.cc
--- a/go/expressions.cc	Fri Mar 25 10:32:02 2011 -0700
+++ b/go/expressions.cc	Fri Mar 25 12:20:47 2011 -0700
@@ -5747,7 +5747,13 @@
 	  if (this->right_->integer_constant_value(true, val, &type))
 	{
 	  if (mpz_sgn(val) < 0)
-		this->report_error(_("negative shift count"));
+		{
+		  this->report_error(_("negative shift count"));
+		  mpz_set_ui(val, 0);
+		  source_location rloc = this->right_->location();
+		  this->right_ = Expression::make_integer(&val, right_type,
+			  rloc);
+		}
 	}
 	  mpz_clear(val);
 	}


Re: PR 47487 powerpc64 ICE building libgo

2011-03-25 Thread David Edelsohn
On Fri, Mar 25, 2011 at 11:15 AM, Alan Modra  wrote:
> Bootstrapped etc. powerpc64-linux.  OK mainline?
>
>        PR target/47487
>        * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Support
>        GNU Go in traceback table.

Okay.

Thanks, David


Re: PowerPC64 reload failure with misaligned fp load

2011-03-25 Thread David Edelsohn
On Fri, Mar 25, 2011 at 11:09 AM, Alan Modra  wrote:

> Much of the following patch is based on Michael Meissner's support for
> vector reloads.  The predicates.md change teaches the predicate used
> by the "Y" constraint to check cmodel medium addresses in case such
> addresses should ever be generated with invalid offsets.
> Bootstrapped and regression tested powerpc64-linux. OK mainline?
>
>        * config/rs6000/predicates.md (word_offset_memref_op): Handle
>        cmodel medium addresses.
>        * config/rs6000/rs6000.c (rs6000_secondary_reload): Handle misaligned
>        64-bit gpr loads and stores.
>        (rs6000_secondary_reload_ppc64): New function.
>        * config/rs6000/rs6000-protos.h: Declare it.
>        * config/rs6000/rs6000.md (reload_di_store, reload_di_load): New.

Okay with me.

Want to give Uli a heads up in case he has any additional comments.

Thanks, David


[PATCH] Don't use mempcpy in libquadmath

2011-03-25 Thread Jakub Jelinek
Hi!

I've been removing mempcpy uses from libquadmath and replacing them with
memcpy + increment, but apparently missed removing one letter in one case.
Without a mempcpy prototype on targets that don't have mempcpy apparently
gcc just warns, but optimizes it into memcpy anyway, so no big harm was
done.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk,
queued for 4.6.1.

2011-03-25  Jakub Jelinek  

* printf/printf_fp.c (__quadmath_printf_fp): Use memcpy instead of
mempcpy.

--- libquadmath/printf/printf_fp.c.jj   2011-02-17 10:10:01.0 +0100
+++ libquadmath/printf/printf_fp.c  2011-03-25 17:36:51.0 +0100
@@ -1197,7 +1197,7 @@ __quadmath_printf_fp (struct __quadmath_
if (*copywc == decimalwc)
  memcpy (cp, decimal, decimal_len), cp += decimal_len;
else if (*copywc == thousands_sepwc)
- mempcpy (cp, thousands_sep, thousands_sep_len), cp += 
thousands_sep_len;
+ memcpy (cp, thousands_sep, thousands_sep_len), cp += 
thousands_sep_len;
else
  *cp++ = (char) *copywc;
}

Jakub


More static checking fixes (unused LHS assignments)

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

var-tracking (and other modules) have a habit of assigning values to
objects, then never using the values.  We still need the RHS side effect
in these cases, so the assignment was deleted leaving just the RHS as a
statement.

Fixed thusly for var-tracking.c.  Bootstrapped and regression tested on
x86_64-unknown-linux-gnu.  OK for trunk?



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNjPjvAAoJEBRtltQi2kC7fZsH/RhZLjm0SvzhOdc+1UPt9aM4
yQqwmcIp4+JaEJC97yB29WrheKKwMuCl0KagzH9J/ffX6m66nYpjUXRcEear
t7CNIIi/IrbknsIFfNM11rAEJgZXKX1tADTCT2lHGCoIWykyLf8tXcgALYZKObqS
agp7GGN8kXZXh5uWrI66Wbp/7jE5IiN14Y7IjV1C1mwdjhYc8WfJckbX+zpJwjTu
09q2ERAgLd7EdvMO90l2DURNCaLornnhTwwiOuAHlkx/tX4+YUFpnvDM9UPrb4eU
AvX322G5ACwok0JJBfSUeIjjolr5y6hh4eboRIqodkS9lC1OOX++xMrn4Z1JnBI=
=GkwR
-END PGP SIGNATURE-
* var-tracking.c (canonicalize_values_mark): Delete unused
lhs assignment.
(canonicalize_values_star, set_variable_part): Likewise.
(clobber_variable_part, delete_variable_part): Likewise.

Index: var-tracking.c
===
*** var-tracking.c  (revision 171351)
--- var-tracking.c  (working copy)
*** canonicalize_values_mark (void **slot, v
*** 3117,3124 
decl_or_value odv = dv_from_value (node->loc);
void **oslot = shared_hash_find_slot_noinsert (set->vars, odv);
  
!   oslot = set_slot_part (set, val, oslot, odv, 0,
!  node->init, NULL_RTX);
  
VALUE_RECURSED_INTO (node->loc) = true;
  }
--- 3117,3124 
decl_or_value odv = dv_from_value (node->loc);
void **oslot = shared_hash_find_slot_noinsert (set->vars, odv);
  
!   set_slot_part (set, val, oslot, odv, 0,
!  node->init, NULL_RTX);
  
VALUE_RECURSED_INTO (node->loc) = true;
  }
*** canonicalize_values_star (void **slot, v
*** 3329,3336 
}
  
if (val)
! cslot = set_slot_part (set, val, cslot, cdv, 0,
!  VAR_INIT_STATUS_INITIALIZED, NULL_RTX);
  
slot = clobber_slot_part (set, cval, slot, 0, NULL);
  
--- 3329,3336 
}
  
if (val)
! set_slot_part (set, val, cslot, cdv, 0,
!  VAR_INIT_STATUS_INITIALIZED, NULL_RTX);
  
slot = clobber_slot_part (set, cval, slot, 0, NULL);
  
*** canonicalize_vars_star (void **slot, voi
*** 3401,3407 
  
slot = set_slot_part (set, cval, slot, dv, 0,
node->init, node->set_src);
!   slot = clobber_slot_part (set, cval, slot, 0, node->set_src);
  
return 1;
  }
--- 3401,3407 
  
slot = set_slot_part (set, cval, slot, dv, 0,
node->init, node->set_src);
!   clobber_slot_part (set, cval, slot, 0, node->set_src);
  
return 1;
  }
*** set_variable_part (dataflow_set *set, rt
*** 7038,7044 
if (!slot)
slot = shared_hash_find_slot_unshare (&set->vars, dv, iopt);
  }
!   slot = set_slot_part (set, loc, slot, dv, offset, initialized, set_src);
  }
  
  /* Remove all recorded register locations for the given variable part
--- 7038,7044 
if (!slot)
slot = shared_hash_find_slot_unshare (&set->vars, dv, iopt);
  }
!   set_slot_part (set, loc, slot, dv, offset, initialized, set_src);
  }
  
  /* Remove all recorded register locations for the given variable part
*** clobber_variable_part (dataflow_set *set
*** 7119,7125 
if (!slot)
  return;
  
!   slot = clobber_slot_part (set, loc, slot, offset, set_src);
  }
  
  /* Delete the part of variable's location from dataflow set SET.  The
--- 7119,7125 
if (!slot)
  return;
  
!   clobber_slot_part (set, loc, slot, offset, set_src);
  }
  
  /* Delete the part of variable's location from dataflow set SET.  The
*** delete_variable_part (dataflow_set *set,
*** 7218,7224 
if (!slot)
  return;
  
!   slot = delete_slot_part (set, loc, slot, offset);
  }
  
  /* Structure for passing some other parameters to function
--- 7218,7224 
if (!slot)
  return;
  
!   delete_slot_part (set, loc, slot, offset);
  }
  
  /* Structure for passing some other parameters to function


[pph] Add hooks for writing/reading ASTs (1/2) (issue4306053)

2011-03-25 Thread Diego Novillo
Add pph_stream_write_tree and pph_stream_read_tree callbacks.
Make them handle DECL_SAVED_TREE.  This produces several new
failures since it exposes more unhandled trees.

Committed on pph branch.  Fixes for the introduced failures coming up
in the next patch.


cp/ChangeLog.pph
2011-03-25  Diego Novillo  

* cp/pph-streamer.c (pph_stream_init_write):

ChangeLog.pph
2011-03-25  Diego Novillo  

* lto-streamer-in.c (lto_input_ts_decl_minimal_tree_pointers):
(lto_input_ts_decl_common_tree_pointers):
* a/gcc/lto-streamer-out.c (lto_output_tree_ref):
(lto_output_ts_decl_minimal_tree_pointers):
(lto_output_ts_decl_common_tree_pointers):
* a/gcc/lto-streamer.h (typedef):
(extern):

diff --git a/gcc/cp/pph-streamer.c b/gcc/cp/pph-streamer.c
index 07438bd..af9602c 100644
--- a/gcc/cp/pph-streamer.c
+++ b/gcc/cp/pph-streamer.c
@@ -137,14 +137,40 @@ pph_stream_init_write (pph_stream *stream)
 }
 
 
+/* Callback for writing ASTs to a stream.  This writes all the fields
+   that are not processed by default by the common tree pickler.
+   OB and REF_P are as in lto_write_tree.  EXPR is the tree to write.  */
+
+static void
+pph_stream_write_tree (struct output_block *ob, tree expr, bool ref_p)
+{
+  if (TREE_CODE (expr) == FUNCTION_DECL)
+lto_output_tree_or_ref (ob, DECL_SAVED_TREE (expr), ref_p);
+}
+
+
+/* Callback for reading ASTs from a stream.  This reads all the fields
+   that are not processed by default by the common tree pickler.
+   IB, DATA_IN are as in lto_read_tree.  EXPR is the partially materialized
+   tree.  */
+
+static void
+pph_stream_read_tree (struct lto_input_block *ib, struct data_in *data_in,
+ tree expr)
+{
+  if (TREE_CODE (expr) == FUNCTION_DECL)
+DECL_SAVED_TREE (expr) = lto_input_tree (ib, data_in);
+}
+
+
 /* Initialize all the streamer hooks used for streaming ASTs.  */
 
 static void
 pph_streamer_hooks_init (void)
 {
   lto_streamer_hooks *h = streamer_hooks_init ();
-  h->reader_init = NULL;
-  h->writer_init = NULL;
+  h->write_tree = pph_stream_write_tree;
+  h->read_tree = pph_stream_read_tree;
 }
 
 
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 5d2761e..9574d77 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -1983,11 +1983,7 @@ lto_input_ts_decl_minimal_tree_pointers (struct 
lto_input_block *ib,
 
 /* Read all pointer fields in the TS_DECL_COMMON structure of EXPR from
input block IB.  DATA_IN contains tables and descriptors for the
-   file being read.
-
-   Fields that should be handled by a callback:
-   DECL_INITIAL
-   DECL_ABSTRACT_ORIGIN.  */
+   file being read.  */
 
 static void
 lto_input_ts_decl_common_tree_pointers (struct lto_input_block *ib,
@@ -2020,10 +2016,7 @@ lto_input_ts_decl_common_tree_pointers (struct 
lto_input_block *ib,
 
 /* Read all pointer fields in the TS_DECL_NON_COMMON structure of
EXPR from input block IB.  DATA_IN contains tables and descriptors for the
-   file being read.
-
-   Fields that should be handled by a callback:
-   DECL_SAVED_TREE.  */
+   file being read.  */
 
 static void
 lto_input_ts_decl_non_common_tree_pointers (struct lto_input_block *ib,
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 81beb07..e8390ed 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -743,7 +743,7 @@ lto_output_tree_ref (struct output_block *ob, tree expr)
 /* If REF_P is true, emit a reference to EXPR in output block OB,
otherwise emit the physical representation of EXPR in OB.  */
 
-static inline void
+void
 lto_output_tree_or_ref (struct output_block *ob, tree expr, bool ref_p)
 {
   if (ref_p)
@@ -835,11 +835,7 @@ lto_output_ts_decl_minimal_tree_pointers (struct 
output_block *ob, tree expr,
 
 /* Write all pointer fields in the TS_DECL_COMMON structure of EXPR to
output block OB.  If REF_P is true, write a reference to EXPR's
-   pointer fields.
-
-   Fields that should be handled by a callback:
-   DECL_INITIAL
-   DECL_ABSTRACT_ORIGIN.  */
+   pointer fields.  */
 
 static void
 lto_output_ts_decl_common_tree_pointers (struct output_block *ob, tree expr,
@@ -871,10 +867,7 @@ lto_output_ts_decl_common_tree_pointers (struct 
output_block *ob, tree expr,
 
 /* Write all pointer fields in the TS_DECL_NON_COMMON structure of
EXPR to output block OB.  If REF_P is true, write a reference to EXPR's
-   pointer fields.
-
-   Fields that should be handled by a callback:
-   DECL_SAVED_TREE.  */
+   pointer fields.  */
 
 static void
 lto_output_ts_decl_non_common_tree_pointers (struct output_block *ob,
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 8ab0714..b58bb62 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -60,7 +60,17 @@ typedef struct lto_streamer_hooks {
   /* Called by lto_write_tree after writing all the common parts of
  a tree.  If defined, the callback is in charge of writing all
  the fields that lto_wri

[pph] Add hooks for writing/reading ASTs (2/2) (issue4275081)

2011-03-25 Thread Diego Novillo
Handle STATEMENT_LIST and add hooks for writing non-pointer values
into bitpacks.

This patch fixes most of the failures in pph.exp (only 14 remain).  We
now handle STATEMENT_LIST properly.

The patch also introduces hooks for writing/reading non pointer values
from trees.

Tested on x86_64.  Committed to pph.

cp/ChangeLog.pph
2011-03-25  Diego Novillo  

* Make-lang.in (cp/pph-streamer.o): Add dependency on
tree-iterator.h.
* pph-streamer.c: Include tree-iterator.h
(pph_stream_write_tree): Handle STATEMENT_LIST.
(pph_stream_read_tree): Likewise.
(pph_is_streamable): New.
(pph_stream_pack_value_fields): New.
(pph_stream_unpack_valude_fields): New.
(pph_stream_hooks_init): Rename from pph_streamer_hooks_init.
Fill in callbacks for name, is_streamable, pack_value_fields
and unpack_value_fields;
(pph_stream_open):

ChangeLog.pph
2011-03-25  Diego Novillo  

* lto-streamer-in.c (unpack_value_fields): Remove checks for
TS_SSA_NAME, TS_STATEMENT_LIST and TS_OMP_CLAUSE.
Call streamer_hooks.unpack_value_fields if defined.
* lto-streamer-out.c (pack_value_fields): Remove checks for
TS_SSA_NAME, TS_STATEMENT_LIST and TS_OMP_CLAUSE.
Call streamer_hooks.pack_value_fields if defined.
(lto_output_tree_header): Call streamer_hooks.is_streamable
if defined.
* lto-streamer.c (gimple_streamer_hooks_init): Assign hooks
for name and is_streamable.
(lto_is_streamable): Move from ...
* lto-streamer.h: ... here.
(lto_streamer_hooks): Add field name, pack_value_fields,
unpack_value_fields and is_streamable.
(lto_stream_as_builtin_p):

diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 7f21322..70548c6 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -336,4 +336,4 @@ cp/pph.o: cp/pph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h 
$(CPPLIB_H) \
$(CXX_PARSER_H) $(CXX_PPH_H) $(CXX_PPH_STREAMER_H)
 cp/pph-streamer.o: cp/pph-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_H) tree-pretty-print.h $(LTO_STREAMER_H) $(CXX_PPH_STREAMER_H) \
-   $(CXX_PPH_H) $(TREE_PASS_H) version.h cppbuiltin.h
+   $(CXX_PPH_H) $(TREE_PASS_H) version.h cppbuiltin.h tree-iterator.h
diff --git a/gcc/cp/pph-streamer.c b/gcc/cp/pph-streamer.c
index af9602c..d2790fc 100644
--- a/gcc/cp/pph-streamer.c
+++ b/gcc/cp/pph-streamer.c
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tree.h"
 #include "langhooks.h"
+#include "tree-iterator.h"
 #include "tree-pretty-print.h"
 #include "lto-streamer.h"
 #include "pph-streamer.h"
@@ -146,6 +147,21 @@ pph_stream_write_tree (struct output_block *ob, tree expr, 
bool ref_p)
 {
   if (TREE_CODE (expr) == FUNCTION_DECL)
 lto_output_tree_or_ref (ob, DECL_SAVED_TREE (expr), ref_p);
+  else if (TREE_CODE (expr) == STATEMENT_LIST)
+{
+  tree_stmt_iterator i;
+  unsigned num_stmts;
+
+  /* Compute and write the number of statements in the list.  */
+  for (num_stmts = 0, i = tsi_start (expr); !tsi_end_p (i); tsi_next (&i))
+   num_stmts++;
+
+  lto_output_sleb128_stream (ob->main_stream, num_stmts);
+
+  /* Write the statements.  */
+  for (i = tsi_start (expr); !tsi_end_p (i); tsi_next (&i))
+   lto_output_tree_or_ref (ob, tsi_stmt (i), ref_p);
+}
 }
 
 
@@ -160,17 +176,64 @@ pph_stream_read_tree (struct lto_input_block *ib, struct 
data_in *data_in,
 {
   if (TREE_CODE (expr) == FUNCTION_DECL)
 DECL_SAVED_TREE (expr) = lto_input_tree (ib, data_in);
+  else if (TREE_CODE (expr) == STATEMENT_LIST)
+{
+  HOST_WIDE_INT i, num_trees = lto_input_sleb128 (ib);
+  for (i = 0; i < num_trees; i++)
+   {
+ tree stmt = lto_input_tree (ib, data_in);
+ append_to_statement_list (stmt, &expr);
+   }
+}
+}
+
+
+/* Return true if the given tree T is streamable.  */
+
+static bool
+pph_is_streamable (tree t ATTRIBUTE_UNUSED)
+{
+  /* We accept most trees.  */
+  return TREE_CODE (t) != SSA_NAME
+&& (TREE_CODE (t) < OMP_PARALLEL
+|| TREE_CODE (t) > OMP_CRITICAL);
+}
+
+
+/* Callback for packing value fields in ASTs.  BP is the bitpack 
+   we are packing into.  EXPR is the tree to pack.  */
+
+static void
+pph_stream_pack_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSED,
+ tree expr ATTRIBUTE_UNUSED)
+{
+  /* Do nothing for now.  */
+}
+
+
+/* Callback for unpacking value fields in ASTs.  BP is the bitpack 
+   we are unpacking from.  EXPR is the tree to unpack.  */
+
+static void
+pph_stream_unpack_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSED,
+   tree expr ATTRIBUTE_UNUSED)
+{
+  /* Do nothing for now.  */
 }
 
 
 /* Initialize all the streamer hooks used for streaming ASTs.  */
 
 static void
-pph_streamer_hooks_init (void)
+pph_stream_hooks_init (void)
 {
   

Re: PowerPC64 reload failure with misaligned fp load

2011-03-25 Thread Ulrich Weigand
David Edelsohn wrote:
> On Fri, Mar 25, 2011 at 11:09 AM, Alan Modra  wrote:
> 
> > Much of the following patch is based on Michael Meissner's support for
> > vector reloads. =A0The predicates.md change teaches the predicate used
> > by the "Y" constraint to check cmodel medium addresses in case such
> > addresses should ever be generated with invalid offsets.
> > Bootstrapped and regression tested powerpc64-linux. OK mainline?
> >
> > =A0 =A0 =A0 =A0* config/rs6000/predicates.md (word_offset_memref_op): Han=
> dle
> > =A0 =A0 =A0 =A0cmodel medium addresses.
> > =A0 =A0 =A0 =A0* config/rs6000/rs6000.c (rs6000_secondary_reload): Handle=
>  misaligned
> > =A0 =A0 =A0 =A064-bit gpr loads and stores.
> > =A0 =A0 =A0 =A0(rs6000_secondary_reload_ppc64): New function.
> > =A0 =A0 =A0 =A0* config/rs6000/rs6000-protos.h: Declare it.
> > =A0 =A0 =A0 =A0* config/rs6000/rs6000.md (reload_di_store, reload_di_load=
> ): New.
> 
> Okay with me.
> 
> Want to give Uli a heads up in case he has any additional comments.

Looks good to me, except ...

+  mem = change_address (mem, VOIDmode, scratch_or_premodify);

Maybe replace_equiv_address instead, to avoid losing the memory
attribute information (alignment, alias set, ...)?

Bye,
Ulrich

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


Go patch committed: clean up handling of undefined types

2011-03-25 Thread Ian Lance Taylor
While parsing, the Go frontend has to not consider an undefined type to
be an error, since it might be defined later.  After parsing is
complete, an undefined type is an error in most cases, except perhaps
for a reference to an imported variable that is not actually used.  This
patch tries to clean up the handling of undefined types by treating them
as error types when they have to be defined.  The main effect of this
change in practice is to avoid additional error messages.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

diff -r 8abc3b3b94c8 go/expressions.cc
--- a/go/expressions.cc	Fri Mar 25 12:21:40 2011 -0700
+++ b/go/expressions.cc	Fri Mar 25 13:38:47 2011 -0700
@@ -205,17 +205,9 @@
   if (lhs_type == rhs_type)
 return rhs_tree;
 
-  if (lhs_type->is_error_type() || rhs_type->is_error_type())
+  if (lhs_type->is_error() || rhs_type->is_error())
 return error_mark_node;
 
-  if (lhs_type->is_undefined() || rhs_type->is_undefined())
-{
-  // Make sure we report the error.
-  lhs_type->base();
-  rhs_type->base();
-  return error_mark_node;
-}
-
   if (rhs_tree == error_mark_node || TREE_TYPE(rhs_tree) == error_mark_node)
 return error_mark_node;
 
@@ -2628,7 +2620,7 @@
 void
 Const_expression::check_for_init_loop()
 {
-  if (this->type_ != NULL && this->type_->is_error_type())
+  if (this->type_ != NULL && this->type_->is_error())
 return;
 
   if (this->seen_)
@@ -2647,7 +2639,7 @@
 
   if (find_named_object.found())
 {
-  if (this->type_ == NULL || !this->type_->is_error_type())
+  if (this->type_ == NULL || !this->type_->is_error())
 	{
 	  this->report_error(_("constant refers to itself"));
 	  this->type_ = Type::make_error_type();
@@ -2661,7 +2653,7 @@
 void
 Const_expression::do_check_types(Gogo*)
 {
-  if (this->type_ != NULL && this->type_->is_error_type())
+  if (this->type_ != NULL && this->type_->is_error())
 return;
 
   this->check_for_init_loop();
@@ -3311,14 +3303,8 @@
   Type* expr_type = this->expr_->type();
   std::string reason;
 
-  if (type->is_error_type()
-  || type->is_undefined()
-  || expr_type->is_error_type()
-  || expr_type->is_undefined())
-{
-  // Make sure we emit an error for an undefined type.
-  type->base();
-  expr_type->base();
+  if (type->is_error() || expr_type->is_error())
+{
   this->set_is_error();
   return;
 }
@@ -4027,7 +4013,7 @@
 Unary_expression::do_check_types(Gogo*)
 {
   Type* type = this->expr_->type();
-  if (type->is_error_type())
+  if (type->is_error())
 {
   this->set_is_error();
   return;
@@ -5447,9 +5433,9 @@
   {
 	Type* left_type = this->left_->type();
 	Type* right_type = this->right_->type();
-	if (left_type->is_error_type())
+	if (left_type->is_error())
 	  return left_type;
-	else if (right_type->is_error_type())
+	else if (right_type->is_error())
 	  return right_type;
 	else if (!Type::are_compatible_for_binop(left_type, right_type))
 	  {
@@ -5688,7 +5674,7 @@
 
   Type* left_type = this->left_->type();
   Type* right_type = this->right_->type();
-  if (left_type->is_error_type() || right_type->is_error_type())
+  if (left_type->is_error() || right_type->is_error())
 {
   this->set_is_error();
   return;
@@ -7001,7 +6987,7 @@
   if (arg == NULL)
 	return false;
   Type* arg_type = arg->type();
-  if (arg_type->is_error_type() || arg_type->is_undefined())
+  if (arg_type->is_error())
 	return false;
   if (arg_type->is_abstract())
 	return false;
@@ -7354,8 +7340,7 @@
   return false;
 }
   if (args->front()->is_error_expression()
-  || args->front()->type()->is_error_type()
-  || args->front()->type()->is_undefined())
+  || args->front()->type()->is_error())
 {
   this->set_is_error();
   return false;
@@ -7389,7 +7374,7 @@
 	  arg_type = arg_type->points_to();
 	if (this->code_ == BUILTIN_CAP)
 	  {
-		if (!arg_type->is_error_type()
+		if (!arg_type->is_error()
 		&& arg_type->array_type() == NULL
 		&& arg_type->channel_type() == NULL)
 		  this->report_error(_("argument must be array or slice "
@@ -7397,7 +7382,7 @@
 	  }
 	else
 	  {
-		if (!arg_type->is_error_type()
+		if (!arg_type->is_error()
 		&& !arg_type->is_string_type()
 		&& arg_type->array_type() == NULL
 		&& arg_type->map_type() == NULL
@@ -7429,7 +7414,7 @@
 		 ++p)
 	  {
 		Type* type = (*p)->type();
-		if (type->is_error_type()
+		if (type->is_error()
 		|| type->is_string_type()
 		|| type->integer_type() != NULL
 		|| type->float_type() != NULL
@@ -7493,7 +7478,7 @@
 	  }
 	Type* arg1_type = args->front()->type();
 	Type* arg2_type = args->back()->type();
-	if (arg1_type->is_error_type() || arg2_type->is_error_type())
+	if (arg1_type->is_error() || arg2_type->is_error())
 	  break;
 
 	Type* e1;
@@ -7568,9 +7553,9 @@
 	else if (args->size() > 2)
 	  this->report_error(_("too many

Re: regex issue

2011-03-25 Thread Jonathan Wakely
On 25 March 2011 22:38, Jonathan Wakely wrote:
> The tests are invalid. There were preconditions added to match_results
> member functions recently, which we now check in debug mode, and those
> tests violate them.
>
> I'll deal with it, thanks for testing it.
>

2011-03-25  Jonathan Wakely  

* testsuite/28_regex/match_results/ctors/char/default.cc: Do not call
members which require a fully established result state.
* testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.

Tested x86_64-linux.

Committed to trunk, will apply to 4.6 branch shortly as well.
Index: testsuite/28_regex/match_results/ctors/char/default.cc
===
--- testsuite/28_regex/match_results/ctors/char/default.cc  (revision 
171367)
+++ testsuite/28_regex/match_results/ctors/char/default.cc  (working copy)
@@ -2,7 +2,7 @@
 
 // 2009-06-10  Stephen M. Webb  
 //
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -29,18 +29,18 @@ void test01()
 {
   bool test __attribute__((unused)) = true;
 
-   std::cmatch cm;
+  std::cmatch cm;
   VERIFY( cm.size() == 0 );
-  VERIFY( cm.str() == std::cmatch::string_type() );
+  VERIFY( !cm.ready() );
 }
 
 void test02()
 {
   bool test __attribute__((unused)) = true;
 
-   std::smatch sm;
+  std::smatch sm;
   VERIFY( sm.size() == 0 );
-  VERIFY( sm.str() == std::smatch::string_type() );
+  VERIFY( !sm.ready() );
 }
 
 int
@@ -49,4 +49,4 @@ main()
   test01();
   test02();
   return 0;
-};
+}
Index: testsuite/28_regex/match_results/ctors/wchar_t/default.cc
===
--- testsuite/28_regex/match_results/ctors/wchar_t/default.cc   (revision 
171367)
+++ testsuite/28_regex/match_results/ctors/wchar_t/default.cc   (working copy)
@@ -2,7 +2,7 @@
 
 // 2009-06-05  Stephen M. Webb  
 //
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -29,18 +29,18 @@ void test01()
 {
   bool test __attribute__((unused)) = true;
 
-   std::wcmatch cm;
+  std::wcmatch cm;
   VERIFY( cm.size() == 0 );
-  VERIFY( cm.str() == std::wcmatch::string_type() );
+  VERIFY( !cm.ready() );
 }
 
 void test02()
 {
   bool test __attribute__((unused)) = true;
 
-   std::wsmatch sm;
+  std::wsmatch sm;
   VERIFY( sm.size() == 0 );
-  VERIFY( sm.str() == std::wsmatch::string_type() );
+  VERIFY( !sm.ready() );
 }
 
 int
@@ -49,4 +49,4 @@ main()
   test01();
   test02();
   return 0;
-};
+}


Re: [4.7] Avoid global state in sparc_handle_option

2011-03-25 Thread Eric Botcazou
> 2011-03-24  Joseph Myers  
>
>   * config/sparc/sparc-opts.h: New.
>   * config/sparc/sparc.c (sparc_handle_option, sparc_select,
>   sparc_cpu, fpu_option_set, TARGET_HANDLE_OPTION): Remove.
>   (sparc_option_override): Store processor_type enumeration rather
>   than string in cpu_default.  Remove name and enumeration from
>   cpu_table.  Directly default -mcpu then default -mtune from -mcpu
>   without using sparc_select.  Use target_flags_explicit instead of
>   fpu_option_set.
>   * config/sparc/sparc.h (enum processor_type): Move to
>   sparc-opts.h.
>   (sparc_cpu, struct sparc_cpu_select, sparc_select): Remove.
>   * config/sparc/sparc.opt (config/sparc/sparc-opts.h): New
>   HeaderInclude entry.
>   (mcpu=, mtune=): Use Var and Enum.
>   (sparc_processor_type): New Enum and EnumValue entries.

This is OK, thanks.

-- 
Eric Botcazou


[v3] implement LWG issues 1514, 2030, 2031

2011-03-25 Thread Jonathan Wakely
2011-03-25  Jonathan Wakely  

* include/std/future (future::share): Add.
(packaged_task::result_type): Remove as per LWG 2030.
(packaged_task::packaged_task): Remove redundant constructors, as per
LWG 1514.
* testsuite/30_threads/future/members/share.cc: New.
* testsuite/30_threads/packaged_task/requirements/typedefs.cc: Remove.


Tested x86_64-linux, committed to trunk.
Index: include/std/future
===
--- include/std/future  (revision 171367)
+++ include/std/future  (working copy)
@@ -618,6 +618,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 typename _Base_type::_Reset __reset(*this);
 return std::move(this->_M_get_result()._M_value());
   }
+
+  shared_future<_Res> share();
 };
  
   /// Partial specialization for future
@@ -659,6 +661,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 typename _Base_type::_Reset __reset(*this);
 return this->_M_get_result()._M_get();
   }
+
+  shared_future<_Res&> share();
 };
 
   /// Explicit specialization for future
@@ -700,6 +704,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 typename _Base_type::_Reset __reset(*this);
 this->_M_get_result();
   }
+
+  shared_future share();
 };
 
 
@@ -844,6 +850,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 : _M_state(std::move(__uf._M_state))
 { }
 
+  template
+inline shared_future<_Res>
+future<_Res>::share()
+{ return shared_future<_Res>(std::move(*this)); }
+
+  template
+inline shared_future<_Res&>
+future<_Res&>::share()
+{ return shared_future<_Res&>(std::move(*this)); }
+
+  inline shared_future
+  future::share()
+  { return shared_future(std::move(*this)); }
 
   /// Primary template for promise
   template
@@ -1198,32 +1217,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   shared_ptr<_State_type>   _M_state;
 
 public:
-  typedef _Res result_type;
-
   // Construction and destruction
   packaged_task() { }
 
   template
 explicit
-packaged_task(const _Fn& __fn)
-: _M_state(std::make_shared<_State_type>(__fn))
-{ }
-
-  template
-explicit
 packaged_task(_Fn&& __fn)
-: _M_state(std::make_shared<_State_type>(std::move(__fn)))
+: _M_state(std::make_shared<_State_type>(std::forward<_Fn>(__fn)))
 { }
 
-  explicit
-  packaged_task(_Res(*__fn)(_ArgTypes...))
-  : _M_state(std::make_shared<_State_type>(__fn))
-  { }
-
   template
 explicit
-packaged_task(allocator_arg_t __tag, const _Allocator& __a, _Fn __fn)
-: _M_state(std::allocate_shared<_State_type>(__a, std::move(__fn)))
+packaged_task(allocator_arg_t, const _Allocator& __a, _Fn&& __fn)
+: _M_state(std::allocate_shared<_State_type>(__a,
+ std::forward<_Fn>(__fn)))
 { }
 
   ~packaged_task()
Index: testsuite/30_threads/future/members/share.cc
===
--- testsuite/30_threads/future/members/share.cc(revision 0)
+++ testsuite/30_threads/future/members/share.cc(revision 0)
@@ -0,0 +1,73 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* 
*-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* 
*-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// .
+
+
+#include 
+#include 
+
+int value = 99;
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::promise p1;
+  std::future f1(p1.get_future());
+  std::shared_future f2 = f1.share();
+
+  p1.set_value(value);
+  VERIFY( f2.get() == value );
+}
+
+void test02()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::promise p1;
+  std::future f1(p1.get_future());
+  std::shared_future f2 = f1.share();
+
+  p1.set_value(value);
+ 

Re: PowerPC64 reload failure with misaligned fp load

2011-03-25 Thread Alan Modra
On Fri, Mar 25, 2011 at 09:36:04PM +0100, Ulrich Weigand wrote:
> Looks good to me, except ...
> 
> +  mem = change_address (mem, VOIDmode, scratch_or_premodify);
> 
> Maybe replace_equiv_address instead, to avoid losing the memory
> attribute information (alignment, alias set, ...)?

Yes, in fact replace_equiv_address_nv is even better.  (As witnessed
by the use of that function in reload.c, reload1.c.  We know
validating the address is just a waste of time, as is calling
update_temp_slot_address.)  I'll bootstrap and regtest again with that
change.

-- 
Alan Modra
Australia Development Lab, IBM


Re: More static checking fixes (unused LHS assignments)

2011-03-25 Thread Richard Henderson
On 03/25/2011 01:19 PM, Jeff Law wrote:
>   * var-tracking.c (canonicalize_values_mark): Delete unused
>   lhs assignment.
>   (canonicalize_values_star, set_variable_part): Likewise.
>   (clobber_variable_part, delete_variable_part): Likewise.


Ok.


r~


Re: Cleaning up expand optabs code

2011-03-25 Thread Richard Henderson
On 03/25/2011 11:49 AM, Richard Henderson wrote:
> On 03/25/2011 10:51 AM, Richard Sandiford wrote:
>> Thanks.  I think it needs to be s/!= 4/>= 6/ though, so that
>> match_scratches still work when 6 operands really are passed in.
> 
> For the record, I audited all setmem and movmem patterns.
> 
> There are is only one that uses 6 operands: i386.
> There are two that use 4 operands, but have 1 scratch: avr, pdp11.
> All the rest have exactly 4 operands.
> 
> I'll leave the test as == 6 for now.

I added a check to make sure that we don't get a 7 unexpectedly.

Committed as below.


r~
commit b52cb7196addd0e2bc281787a43dd9ce2b9b8cdc
Author: rth 
Date:   Fri Mar 25 23:17:26 2011 +

* expr.c (emit_block_move_via_movmem): Only use 6 operand variant
if there are exactly 6 operands.
(set_storage_via_setmem): Similarly.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171532 
138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e7983a2..040a83c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-25  Richard Henderson  
+
+   * expr.c (emit_block_move_via_movmem): Only use 6 operand variant
+   if there are exactly 6 operands.
+   (set_storage_via_setmem): Similarly.
+
 2011-03-25  Kai Tietz  
 
* collect2.c (write_c_file_stat): Handle backslash
diff --git a/gcc/expr.c b/gcc/expr.c
index 4db1c77..076b8d2 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1294,16 +1294,20 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, 
unsigned int align,
 that it doesn't fail the expansion because it thinks
 emitting the libcall would be more efficient.  */
  nops = insn_data[(int) code].n_operands;
+ /* ??? n_operands includes match_scratches; find some other
+way to select the 6 operand variant, or force all targets
+to have exactly 6 operands.  */
+ gcc_assert (nops >= 4 && nops <= 6);
+
  create_fixed_operand (&ops[0], x);
  create_fixed_operand (&ops[1], y);
  /* The check above guarantees that this size conversion is valid.  */
  create_convert_operand_to (&ops[2], size, mode, true);
  create_integer_operand (&ops[3], align / BITS_PER_UNIT);
- if (nops != 4)
+ if (nops == 6)
{
  create_integer_operand (&ops[4], expected_align / BITS_PER_UNIT);
  create_integer_operand (&ops[5], expected_size);
- nops = 6;
}
  if (maybe_expand_insn (code, nops, ops))
{
@@ -2716,16 +2720,20 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, 
unsigned int align,
  unsigned int nops;
 
  nops = insn_data[(int) code].n_operands;
+ /* ??? n_operands includes match_scratches; find some other
+way to select the 6 operand variant, or force all targets
+to have exactly 6 operands.  */
+ gcc_assert (nops >= 4 && nops <= 6);
+
  create_fixed_operand (&ops[0], object);
  /* The check above guarantees that this size conversion is valid.  */
  create_convert_operand_to (&ops[1], size, mode, true);
  create_convert_operand_from (&ops[2], val, byte_mode, true);
  create_integer_operand (&ops[3], align / BITS_PER_UNIT);
- if (nops != 4)
+ if (nops == 6)
{
  create_integer_operand (&ops[4], expected_align / BITS_PER_UNIT);
  create_integer_operand (&ops[5], expected_size);
- nops = 6;
}
  if (maybe_expand_insn (code, nops, ops))
return true;


Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)

2011-03-25 Thread Michael Matz
Hi,

[sorry for breaking the threading I've deleted the mails I'm answering 
already]

In any case, citing from 
  http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01250.html

> Here's the patch I came up with.  It is on top of the previous one, so 
> if we want to backport to 4.6 later, both are necessary.
> 
> It also fixes a typo in the in_tree_ld case, which can never have 
> worked.
> 
> Tested by i386-pc-solaris2.11 bootstraps with either Sun ld or gld 2.21, 
> and by configuring with Sun ld --with-plugin-ld=gld-2.21 and obvserving 
> HAVE_LTO_PLUGIN being set to 1.
...
> @@ -3207,6 +3207,10 @@
>  elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a 
> "$ld_vers_minor" -eq 20; then
>gcc_cv_lto_plugin=1
>  fi
> +  elif test x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" != x"$gcc_cv_ld"; then
> +# Allow -fuse-linker-plugin if plugin linker differs from
> +# default/specified linker.
> +gcc_cv_lto_plugin=1
>fi
>  fi

And this '1' is a problem.  Even if I specify 
--with-plugin-ld=some-good-ld (i.e. it can be reasonably assumed that I 
know what I'm doing) the above forces me to still have to use 
-fuse-linker-plugin when I really want to use it.  This is because the 
introduction of three levels of HAVE_LTO_PLUGIN: 0 (-fuse-linker-plugin 
not allowed), 1 (allowed but not default for -flto), 2 (allowed and 
default to on with -flto).

I think if the plugin linker is different from the normal linker we should 
set HAVE_LTO_PLUGIN to 2.


Ciao,
Michael.


Re: [PATCH 3/6] Allow jumps in epilogues

2011-03-25 Thread Richard Henderson
On 03/25/2011 10:34 AM, Bernd Schmidt wrote:
> I don't know much about the unwinding code. I'm currently thinking about
> writing out a cfi_remember_state at the start of the function, restoring
> that clean state when necessary at the start of a new block and emitting
> the necessary directives to reach the correct state. What directives
> should I expect to be required? Can I get by just with cfi_offset and
> cfi_def_cfa_offset, or will something else be necessary?

Yes, several things: register, expression, gnu_args_size, perhaps a few more.

I think the ideal thing would be a pass while the cfg is still extant that
captures the unwind info into notes; these can be recorded at basic block
boundaries, so that they persist until the end of compilation.

So long as late late compilation passes continue to not move frame-related
insns across basic block boundaries, we should be fine.

Irritatingly, the exact place to locate this pass is difficult to pin down.
Immediately before md_reorg is the last place we have the cfg.  But we do
strange things in, e.g. ia64 where we rebuild the cfg and run sched_ebb
during md_reorg.

Of course, ia64 is a bad example because its unwind info is target-specific,
and quite a lot of the possible benefit of shrink wrapping is lost via the
register windowing.

I'm willing to work with you on the problem of cfg-aware unwind info.  We
have needed this for a really long time; there are existing bugs related 
to exception handling and !ACCUMULATE_OUTGOING_ARGS that would be fixed by
this.


r~


Go patch committed: Correctly parse case <-c <- v

2011-03-25 Thread Ian Lance Taylor
This patch to the Go frontend correctly parses
select {
case <-c <- v:
}
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 51340e536e48 go/parse.cc
--- a/go/parse.cc	Fri Mar 25 13:39:15 2011 -0700
+++ b/go/parse.cc	Fri Mar 25 18:57:25 2011 -0700
@@ -4375,17 +4375,25 @@
   // send or receive expression.  If SAW_COMMA is true, then *VAL is
   // set and we just read a comma.
 
-  if (!saw_comma && this->peek_token()->is_op(OPERATOR_CHANOP))
+  Expression* e;
+  if (saw_comma || !this->peek_token()->is_op(OPERATOR_CHANOP))
+e = this->expression(PRECEDENCE_NORMAL, true, true, NULL);
+  else
 {
   // case <-c:
   *is_send = false;
   this->advance_token();
   *channel = this->expression(PRECEDENCE_NORMAL, false, true, NULL);
-  return true;
+
+  // The next token should be ':'.  If it is '<-', then we have
+  // case <-c <- v:
+  // which is to say, send on a channel received from a channel.
+  if (!this->peek_token()->is_op(OPERATOR_CHANOP))
+	return true;
+
+  e = Expression::make_receive(*channel, (*channel)->location());
 }
 
-  Expression* e = this->expression(PRECEDENCE_NORMAL, true, true, NULL);
-
   if (this->peek_token()->is_op(OPERATOR_EQ))
 {
   if (!this->advance_token()->is_op(OPERATOR_CHANOP))


Go patch committed: better error setting const to nil

2011-03-25 Thread Ian Lance Taylor
This patch to the Go frontend gives a better error message when setting
a const to nil.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r d04de877d993 go/gogo.cc
--- a/go/gogo.cc	Fri Mar 25 22:31:14 2011 -0700
+++ b/go/gogo.cc	Fri Mar 25 22:41:02 2011 -0700
@@ -1527,7 +1527,9 @@
   && !ctype->is_boolean_type()
   && !ctype->is_string_type())
 {
-  if (!ctype->is_error())
+  if (ctype->is_nil_type())
+	error_at(constant->location(), "const initializer cannot be nil");
+  else if (!ctype->is_error())
 	error_at(constant->location(), "invalid constant type");
   constant->set_error();
 }


  1   2   >