[PATCH] New check and updates in check_GNU_style script

2014-07-20 Thread Yury Gribov

Hi all,

Attached patch adds new check (all blocks of 8 spaces are replaced with 
tabs) to contrib/check_GNU_style.sh. It also changes the script to allow 
reading patches from stdin and improves the "Dot, space, space, new 
sentence." check.


-Y
commit 4bc624dcd778e8317a4de620b266c05b55577aad
Author: Yury Gribov 
Date:   Mon Jul 21 10:12:24 2014 +0400

2014-07-21  Yury Gribov  

	check_GNU_style.sh: Support patches coming from stdin,
	check that spaces are converted to tabs and make double-space
	check more precice.

diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
index ef8fdda..d61dc96 100755
--- a/contrib/check_GNU_style.sh
+++ b/contrib/check_GNU_style.sh
@@ -23,6 +23,8 @@ usage() {
 check_GNU_style.sh [patch]...
 
 Checks the patches for some of the GNU style formatting problems.
+When FILE is -, read standard input.
+
 Please note that these checks are not always accurate, and
 complete.  The reference documentation of the GNU Coding Standards
 can be found here: http://www.gnu.org/prep/standards_toc.html
@@ -35,19 +37,22 @@ EOF
 
 test $# -eq 0 && usage
 
+inp=check_GNU_style.inp
 tmp=check_GNU_style.tmp
 
 # Remove $tmp on exit and various signals.
-trap "rm -f $tmp" 0
-trap "rm -f $tmp ; exit 1" 1 2 3 5 9 13 15
+trap "rm -f $inp $tmp" 0
+trap "rm -f $inp $tmp ; exit 1" 1 2 3 5 9 13 15
+
+grep -nH '^+' $* \
+	| grep -v ':+++' \
+	> $inp
 
 # Grep
 g (){
 msg="$1"
 arg="$2"
-shift 2
-grep -nH '^+' $* \
-	| grep -v ':+++' \
+cat $inp \
 	| egrep --color=always -- "$arg" \
 	> $tmp && printf "\n$msg\n"
 cat $tmp
@@ -58,9 +63,7 @@ ag (){
 msg="$1"
 arg1="$2"
 arg2="$3"
-shift 3
-grep -nH '^+' $* \
-	| grep -v ':+++' \
+cat $inp \
 	| egrep --color=always -- "$arg1" \
 	| egrep --color=always -- "$arg2" \
 	> $tmp && printf "\n$msg\n"
@@ -72,9 +75,7 @@ vg (){
 msg="$1"
 varg="$2"
 arg="$3"
-shift 3
-grep -nH '^+' $* \
-	| grep -v ':+++' \
+cat $inp \
 	| egrep -v -- "$varg" \
 	| egrep --color=always -- "$arg" \
 	> $tmp && printf "\n$msg\n"
@@ -83,9 +84,7 @@ vg (){
 
 col (){
 msg="$1"
-shift 1
-grep -nH '^+' $* \
-	| grep -v ':+++' \
+cat $inp \
 	| cut -f 2 -d '+' \
 	| awk '{ if (length ($0) > 80) print $0 }' \
 	> $tmp
@@ -95,30 +94,32 @@ col (){
 fi
 }
 
-col 'Lines should not exceed 80 characters.' $*
+col 'Lines should not exceed 80 characters.'
+
+g 'Blocks of 8 spaces should be replaced with tabs.' \
+' {8}'
 
 g 'Trailing whitespace.' \
-'[[:space:]]$' $*
+'[[:space:]]$'
 
 g 'Space before dot.' \
-'[[:alnum:]][[:blank:]]+\.' $*
+'[[:alnum:]][[:blank:]]+\.'
 
 g 'Dot, space, space, new sentence.' \
-'[[:alnum:]]\.([[:blank:]]|[[:blank:]]{3,})[[:alnum:]]' $*
+'[[:alnum:]]\.([[:blank:]]|[[:blank:]]{3,})[A-Z0-9]'
 
 g 'Dot, space, space, end of comment.' \
-'[[:alnum:]]\.([[:blank:]]{0,1}|[[:blank:]]{3,})\*/' $*
+'[[:alnum:]]\.([[:blank:]]{0,1}|[[:blank:]]{3,})\*/'
 
 g 'Sentences should end with a dot.  Dot, space, space, end of the comment.' \
-'[[:alnum:]][[:blank:]]*\*/' $*
+'[[:alnum:]][[:blank:]]*\*/'
 
 vg 'There should be exactly one space between function name and parentheses.' \
-'\#define' '[[:alnum:]]([^[:blank:]]|[[:blank:]]{2,})\(' $*
+'\#define' '[[:alnum:]]([^[:blank:]]|[[:blank:]]{2,})\('
 
 g 'There should be no space before closing parentheses.' \
-'[[:graph:]][[:blank:]]+\)' $*
+'[[:graph:]][[:blank:]]+\)'
 
 ag 'Braces should be on a separate line.' \
-'\{' 'if[[:blank:]]\(|while[[:blank:]]\(|switch[[:blank:]]\(' $*
-
+'\{' 'if[[:blank:]]\(|while[[:blank:]]\(|switch[[:blank:]]\('
 


RE: Re: [MIPS r5900] libgcc floating point fixes

2014-07-20 Thread Matthew Fortune
"Jürgen Urban" writes:
> > "Jürgen Urban"  writes:
> > > Hello Richard,
> > >
> > > > "Jürgen Urban"  writes:
> > Is this something you
> > have recently developed outside of the mainline kernel or does it already
> exist.
> > I'm not aware of such logic in the MIPS kernel yet.
> 
> Yes, this is developed in my kernel which currently is still based on Linux
> 2.6.35.4. I added a TIF_R5900FPU flag to thread_info.h. I plan that this
> will get part of the mainline kernel. As the patch is too large to get
> accepted, I need to change the binutils, so that sync.p will be added after
> or before the right instruction automatically.

Is the TIF_R5900FPU flag to do something more than just change the register
model used by the FPU emulator or does it do something more/less? I'm afraid
I don’t know the significance of the sync.p.

> > > double the FPU emulator gets activated. Currently it only checks whether
> the
> > > architecture is mips r5900 or not. For non r5900 the FPU emulator is
> > > activated. It seems that we also need to add something to the ELF file
> to
> > > specify the 32 bit or 64 bit for float. It would be good when it is not
> at a
> > > so complicated position as the soft vs hard float flag, because it needs
> to
> > > be read by the kernel when starting a ELF file. This way it would also
> be
> >
> > I have a series of patches that will add this kind of support to the MIPS
> > ABI in the coming weeks for similar reasons but relating to O32 and
> double-float
> > ABI extensions. You will be able to directly hang off the changes once I
> commit
> > (testing is taking some time). There should be no need for extra changes
> to
> > gcc or binutils to get the information you need. Kernel changes to respond
> > to new ABI information are also in progress and will be easily extendable.
> >
> > > possible to emulate the r5900 FPU on a TX79 system. The TX79 is the same
> as
> > > r5900, but the FPU is 64 bit and compliant to IEEE 754.
> > >
> > > > Note that this won't really be correct for r5900 anyway because of its
> > > > non-IEEE FPU.  E.g. the soft-float routines will treat 0x7f80 as
> > > > infinity and 0x7fff as a NaN, whereas for r5900 they should be
> treated
> > > > as normal numbers.
> > >
> > > The code looked like it uses the configured floating point configuration
> for
> > > hard float, but you are right the conversion is not working in these
> cases.
> > >
> > > I think there is no problem with the second part of the patch which
> disables
> > > t-mips16 for r5900. So could you commit the last part of the patch?
> >
> > Are you looking to add support for a single-float FPU to a number of
> > packages as part of this? One thing that comes to mind would be libffi but
> the
> > double-precision ABIs are assumed to be the only ones used in Linux in a
> number
> > of places. Just trying to get a feel for your end goal out of curiosity.
> 
> The libffi doesn't look like that there is a change needed for floating
> point.

Libffi and most other hand crafted code for linux are written to follow the
standard double-precision O32/N32 ABI. The single-precision variants are
link-incompatible as they change the calling convention. I.e. when you pass
a double-precision value using a single-precision calling-convention then it
gets passed in GPRs instead of FPRs.

> It is possible that it needs a change for TImode or for 2 or 3 of the other
> co-processors which are currently not under discussion.
> The long term plan is to have 32 bit floating point operations compliant to
> IEEE 754 with ABI o32 and n32. Everything should stay inside gcc, libgcc and
> the kernel (i.e. Linux or PS2SDK). I want to fix it at the lowest level and
> not in any high level library.

Due to the calling convention change you won't be able to restrict the work
to just the toolchain and kernel. MIPS linux theoretically supports two ABI
extensions 'hard-float (double-precision)' and soft-float. I have a feeling
that the soft-float extension is not supported everywhere but may be a better
start point for what you want to achieve, i.e. use a soft-float calling
convention but add support for using FPU instructions at the same time. This
would be akin to arm's softfp float-abi.

> Fixes for high level libraries should also be
> high level (dmult vs __FLT_MAX_EXP__); i.e. there should be no change in a
> different package which is specific for MIPS. The type double should stay
> double and is handled without a problem when the FPU is 32 bit in ABI o32.
> The problem is only with the single/double conversion functions and the ABI
> n32.

I didn't quite follow why you specifically say n32 in the last sentence...
What is harder to fix about n32 than o32?

Thanks,
Matthew


Re: a new libgcov interface: __gcov_dump_all

2014-07-20 Thread Nathan Sidwell

On 07/20/14 21:38, Xinliang David Li wrote:

The gcov_info chain is not duplicated -- there is already one chain
(linking only modules of the library) per shared library in current
implementation.  My change does not affect underlying behavior at all
-- it merely introduces a new interface to access private dumper
methods associated with shared libs.


ah, got it.  thanks for clarifying.  Can't help thinking gcov_init should be 
doing this, and wondering about dlload/dlclose.  Let me think


nathan


Re: [PATCH, 4.9/4.10] Profile based option tuning

2014-07-20 Thread Pengfei Yuan
Sorry, tabs seems converted to spaces automatically.
Please use the attachment instead.

2014-07-21 13:13 GMT+08:00 Pengfei Yuan <0xcool...@gmail.com>:
> Hi,
>
> This patch tunes optimization options based on profile data:
> * Disable PGO options if profile is not available or empty.
> * Optimize for size if profile is available but empty.
>
> Here is an experiment on Firefox PGO build:
>
>   CPU   Intel Core i7-4770
>   RAM   32 GB
>   OSDebian sid amd64
>   Firefox sourcemozilla-central, changeset 4bafe35cfb65
>   Compiler  GCC 4.9.2 20140721 (prerelease)
>
> Result:
>
> Size of libxul.so  |  Octane benchmark score
>   PGO w/o this patch67206232  32440.4 +/- 0.35%
>   PGO w/  this patch66604312  32765.8 +/- 0.56%
>
> With this patch, the size of PGO-built libxul.so decreases by 0.9% and the
> performance improves slightly.
>
> Regards,
>
> Yuan Pengfei
> Peking University


gcc.patch
Description: Binary data


[PATCH, 4.9/4.10] Profile based option tuning

2014-07-20 Thread Pengfei Yuan
Hi,

This patch tunes optimization options based on profile data:
* Disable PGO options if profile is not available or empty.
* Optimize for size if profile is available but empty.

Here is an experiment on Firefox PGO build:

  CPU   Intel Core i7-4770
  RAM   32 GB
  OSDebian sid amd64
  Firefox sourcemozilla-central, changeset 4bafe35cfb65
  Compiler  GCC 4.9.2 20140721 (prerelease)

Result:

Size of libxul.so  |  Octane benchmark score
  PGO w/o this patch67206232  32440.4 +/- 0.35%
  PGO w/  this patch66604312  32765.8 +/- 0.56%

With this patch, the size of PGO-built libxul.so decreases by 0.9% and the
performance improves slightly.

Regards,

Yuan Pengfei
Peking University


gcc/ChangeLog:

* coverage.c (coverage_check): New function.
* coverage.h (coverage_check): New function.
* toplev.c (profile_based_option_override): New function.
(process_options): Add profile based option tuning.


diff --git a/gcc/coverage.c b/gcc/coverage.c
index 4c06fa4..205bee5 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1128,6 +1128,75 @@ coverage_obj_finish (vec *ctor)
   varpool_finalize_decl (gcov_info_var);
 }

+/* Check the profile data file.
+   Return -1 if the file is not available or corrupted,
+   0 if the file is available and all counters are zero,
+   1 otherwise.  */
+
+int
+coverage_check (const char *filename)
+{
+  int ret = 0;
+  int len = strlen (filename);
+  int prefix_len = 0;
+  gcov_unsigned_t tag;
+  char *data_filename;
+
+  if (!profile_data_prefix && !IS_ABSOLUTE_PATH (filename))
+profile_data_prefix = getpwd ();
+
+  if (profile_data_prefix)
+prefix_len = strlen (profile_data_prefix);
+
+  data_filename = XNEWVEC (char, len + strlen (GCOV_DATA_SUFFIX)
+   + prefix_len + 2);
+
+  if (profile_data_prefix)
+{
+  memcpy (data_filename, profile_data_prefix, prefix_len);
+  data_filename[prefix_len++] = '/';
+}
+  memcpy (data_filename + prefix_len, filename, len);
+  strcpy (data_filename + prefix_len + len, GCOV_DATA_SUFFIX);
+
+  if (!gcov_open (data_filename, 1))
+return -1;
+  if (!gcov_magic (gcov_read_unsigned (), GCOV_DATA_MAGIC)
+  || gcov_read_unsigned () != GCOV_VERSION)
+{
+  gcov_close ();
+  return -1;
+}
+  gcov_read_unsigned ();
+
+  while ((tag = gcov_read_unsigned ()))
+{
+  gcov_unsigned_t length = gcov_read_unsigned ();
+  gcov_position_t offset = gcov_position ();
+
+  if (GCOV_TAG_IS_COUNTER (tag))
+{
+  unsigned n_counts = GCOV_TAG_COUNTER_NUM (length);
+  unsigned ix;
+
+  for (ix = 0; ix != n_counts; ix++)
+if (gcov_read_counter ())
+  ret = 1;
+}
+  gcov_sync (offset, length);
+
+  if (gcov_is_error ())
+{
+  ret = -1;
+  break;
+}
+}
+
+  gcov_close ();
+
+  return ret;
+}
+
 /* Perform file-level initialization. Read in data file, generate name
of notes file.  */

diff --git a/gcc/coverage.h b/gcc/coverage.h
index 81f87a6..51d1119 100644
--- a/gcc/coverage.h
+++ b/gcc/coverage.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see

 #include "gcov-io.h"

+extern int coverage_check (const char *);
 extern void coverage_init (const char *);
 extern void coverage_finish (void);

diff --git a/gcc/toplev.c b/gcc/toplev.c
index d646faf..b0c3906 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1222,6 +1222,77 @@ init_alignments (void)
   align_functions_log = floor_log2 (align_functions * 2 - 1);
 }

+/* Override options based on profile.  */
+
+static void
+profile_based_option_override (void)
+{
+  int status;
+  const char *name = aux_base_name;
+
+  if (!flag_branch_probabilities)
+return;
+
+  if (!name)
+{
+  char *newname;
+  if (!main_input_filename)
+return;
+  newname = xstrdup (lbasename (main_input_filename));
+  strip_off_ending (newname, strlen (newname));
+  name = newname;
+}
+
+  status = coverage_check (name);
+  if (status > 0)
+return;
+
+  /* Profile data file is valid and all profile counters are zero.
+ Prefer optimizing code size.  */
+  if (status == 0)
+{
+  optimize = 2;
+  optimize_size = 1;
+  maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1,
+ param_values, global_options_set.x_param_values);
+
+  /* Ignore coverage mismatch since all counters are zero.  */
+  diagnostic_classify_diagnostic (global_dc, OPT_Wcoverage_mismatch,
+  DK_IGNORED, UNKNOWN_LOCATION);
+}
+
+  if (!flag_profile_use)
+return;
+
+  /* Disable optimization options for PGO.  */
+  if (!global_options_set.x_flag_profile_values)
+flag_profile_values = false;
+  if (!global_options_set.x_flag_unroll_loops)
+flag_unroll_loops = false;
+  if (!global_options_set.x_flag_peel_loops)
+flag_peel_loops = false;
+  if (!global_options_set.x_flag_trac

Fix RTL load motion bug with -fnon-call-exceptions

2014-07-20 Thread Eric Botcazou
We have a testcase that is miscompiled at -O3 by our GCC 4.9-based compiler, 
although it isn't by the pristine GCC 4.9 compiler.  You need a specific 
combination of events (aggressive inlining, -fnon-call-exceptions, memory 
accesses marked MEM_NOTRAP_P) which causes RTL load motion to wrongly delete a 
MEM_NOTRAP_P load because there is another load from the same address but 
without MEM_NOTRAP_P, the root cause being that simple_mem will return true 
for the former but false for the latter.  Setting MEM_NOTRAP_P is a best 
effort thing so not setting it should not lead to wrong code.

Tested on x86-64/Linux, applied on the mainline.


2014-07-20  Eric Botcazou  

* cse.c (exp_equiv_p) : For GCSE, return 0 for expressions with
different trapping status if -fnon-call-exceptions is enabled.


-- 
Eric BotcazouIndex: cse.c
===
--- cse.c	(revision 212833)
+++ cse.c	(working copy)
@@ -2687,6 +2687,13 @@ exp_equiv_p (const_rtx x, const_rtx y, i
 	 the same attributes share the same mem_attrs data structure.  */
 	  if (MEM_ATTRS (x) != MEM_ATTRS (y))
 	return 0;
+
+	  /* If we are handling exceptions, we cannot consider two expressions
+	 with different trapping status as equivalent, because simple_mem
+	 might accept one and reject the other.  */
+	  if (cfun->can_throw_non_call_exceptions
+	  && (MEM_NOTRAP_P (x) != MEM_NOTRAP_P (y)))
+	return 0;
 	}
   break;
 

Fix ICE on unaligned assignment of return value

2014-07-20 Thread Eric Botcazou
This is a regression present on mainline and 4.9 branch and visible e.g. on 
SPARC64: the code dealing with values returned in PARALLEL fails to handle the 
case of an unaligned target if the mode is an integral mode and not BLKmode.

Tested on SPARC64/Solaris and x86-64/Linux, applied on mainline and 4.9 branch 
as obvious.


2014-07-20  Eric Botcazou  

* expr.c (store_field): Handle VOIDmode for calls that return values
in multiple locations.


2014-07-20  Eric Botcazou  

* gnat.dg/pack20.ad[sb]: New test.
* gnat.dg/pack20_pkg.ads: New helper.


-- 
Eric BotcazouIndex: expr.c
===
--- expr.c	(revision 212833)
+++ expr.c	(working copy)
@@ -6581,7 +6581,7 @@ store_field (rtx target, HOST_WIDE_INT b
 	{
 	  HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
 	  rtx temp_target;
-	  if (mode == BLKmode)
+	  if (mode == BLKmode || mode == VOIDmode)
 	mode = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
 	  temp_target = gen_reg_rtx (mode);
 	  emit_group_store (temp_target, temp, TREE_TYPE (exp), size);package body Pack20 is

   procedure Proc (A : Rec) is
  Local : Rec := A;
   begin
  Modify (Local.Fixed);
   end;

end Pack20;-- { dg-do compile }

with Pack20_Pkg; use Pack20_Pkg;

package Pack20 is

   type Rec is record
  Simple_Type  : Integer;
  Fixed: String_Ptr;
   end record;
   pragma Pack (Rec);

   procedure Proc (A : Rec);

end Pack20;package Pack20_Pkg is

   type String_Ptr is access all String;

   procedure Modify (Fixed : in out String_Ptr);

end Pack20_Pkg;

Re: a new libgcov interface: __gcov_dump_all

2014-07-20 Thread Xinliang David Li
The gcov_info chain is not duplicated -- there is already one chain
(linking only modules of the library) per shared library in current
implementation.  My change does not affect underlying behavior at all
-- it merely introduces a new interface to access private dumper
methods associated with shared libs.

David



On Sun, Jul 20, 2014 at 12:42 PM, Nathan Sidwell  wrote:
> On 07/18/14 22:41, Xinliang David Li wrote:
>>
>> Hi, the following patch implements a new dumper interface to allow
>> dumping of profile data for all instrumented shared libraries.
>>
>> For good reasons, existing libgcov implements the dumping on a
>> per-shared library basis (i.e., gcov_exit is hidden, gcov_list is file
>> static). This allows each shared library's profile data to be dumped
>> independently with separate summary data. The downside is that there
>> is no interface that can be invoked to dump profile data for all
>> shared modules.
>
>
> This seems like useful functionality, but I don't think this is the right
> way to do this.  You're duplicating the gcov info object chain.  Why can't
> you expose gcov_list from gcov-driver.c (possibly with a different name, of
> course?
>
> nathan


Go patch committed: Error for vars that are set but not used

2014-07-20 Thread Ian Lance Taylor
This patch improves the Go frontend to give an error for any variables
that are set but not used.  This matches the behaviour of the gc Go
compiler.  This Go language spec does not require this, but it is
permitted as an implementation restriction, and it seems like a good
idea to make the compilers compatible.  This required changing one test
in the testsuite; I've sent a patch to the master testsuite with this
change (https://codereview.appspot.com/116050043).  Bootstrapped and ran
updated Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

Index: gcc/go/gofrontend/parse.cc
===
--- gcc/go/gofrontend/parse.cc	(revision 212872)
+++ gcc/go/gofrontend/parse.cc	(working copy)
@@ -2115,8 +2115,8 @@ Parse::simple_var_decl_or_assignment(con
 	  for (Typed_identifier_list::const_iterator p = til.begin();
 	   p != til.end();
 	   ++p)
-	exprs->push_back(this->id_to_expression(p->name(),
-		p->location()));
+	exprs->push_back(this->id_to_expression(p->name(), p->location(),
+		true));
 
 	  Expression_list* more_exprs =
 	this->expression_list(NULL, true, may_be_composite_lit);
@@ -2509,7 +2509,10 @@ Parse::operand(bool may_be_sink, bool* i
 	}
 	  case Named_object::NAMED_OBJECT_VAR:
 	  case Named_object::NAMED_OBJECT_RESULT_VAR:
-	this->mark_var_used(named_object);
+	// Any left-hand-side can be a sink, so if this can not be
+	// a sink, then it must be a use of the variable.
+	if (!may_be_sink)
+	  this->mark_var_used(named_object);
 	return Expression::make_var_reference(named_object, location);
 	  case Named_object::NAMED_OBJECT_SINK:
 	if (may_be_sink)
@@ -2724,7 +2727,7 @@ Parse::composite_lit(Type* type, int dep
 	  Gogo* gogo = this->gogo_;
 	  val = this->id_to_expression(gogo->pack_hidden_name(identifier,
   is_exported),
-	   location);
+	   location, false);
 	  is_name = true;
 	}
 	  else
@@ -3241,7 +3244,8 @@ Parse::call(Expression* func)
 // Return an expression for a single unqualified identifier.
 
 Expression*
-Parse::id_to_expression(const std::string& name, Location location)
+Parse::id_to_expression(const std::string& name, Location location,
+			bool is_lhs)
 {
   Named_object* in_function;
   Named_object* named_object = this->gogo_->lookup(name, &in_function);
@@ -3260,7 +3264,8 @@ Parse::id_to_expression(const std::strin
   return Expression::make_const_reference(named_object, location);
 case Named_object::NAMED_OBJECT_VAR:
 case Named_object::NAMED_OBJECT_RESULT_VAR:
-  this->mark_var_used(named_object);
+  if (!is_lhs)
+	this->mark_var_used(named_object);
   return Expression::make_var_reference(named_object, location);
 case Named_object::NAMED_OBJECT_SINK:
   return Expression::make_sink(location);
@@ -5025,7 +5030,7 @@ Parse::send_or_recv_stmt(bool* is_send,
 
 	  *val = this->id_to_expression(gogo->pack_hidden_name(recv_var,
 			   is_rv_exported),
-	recv_var_loc);
+	recv_var_loc, true);
 	  saw_comma = true;
 	}
   else
@@ -5727,6 +5732,13 @@ Parse::verify_not_sink(Expression* expr)
   error_at(expr->location(), "cannot use _ as value");
   expr = Expression::make_error(expr->location());
 }
+
+  // If this can not be a sink, and it is a variable, then we are
+  // using the variable, not just assigning to it.
+  Var_expression* ve = expr->var_expression();
+  if (ve != NULL)
+this->mark_var_used(ve->named_object());
+
   return expr;
 }
 
Index: gcc/go/gofrontend/parse.h
===
--- gcc/go/gofrontend/parse.h	(revision 212872)
+++ gcc/go/gofrontend/parse.h	(working copy)
@@ -236,7 +236,7 @@ class Parse
 			 bool* is_type_switch, bool* is_parenthesized);
   Type* reassociate_chan_direction(Channel_type*, Location);
   Expression* qualified_expr(Expression*, Location);
-  Expression* id_to_expression(const std::string&, Location);
+  Expression* id_to_expression(const std::string&, Location, bool);
   void statement(Label*);
   bool statement_may_start_here();
   void labeled_stmt(const std::string&, Location);
Index: gcc/testsuite/go.test/test/shift1.go
===
--- gcc/testsuite/go.test/test/shift1.go	(revision 212872)
+++ gcc/testsuite/go.test/test/shift1.go	(working copy)
@@ -238,4 +238,6 @@ func _() {
 	z = (1. << s) << (1 << s)// ERROR "non-integer|type complex128"
 	z = (1. << s) << (1. << s)   // ERROR "non-integer|type complex128"
 	z = (1.1 << s) << (1.1 << s) // ERROR "invalid|truncated|complex128"
+
+	_, _, _ = x, y, z
 }


Re: a new libgcov interface: __gcov_dump_all

2014-07-20 Thread Nathan Sidwell

On 07/18/14 22:41, Xinliang David Li wrote:

Hi, the following patch implements a new dumper interface to allow
dumping of profile data for all instrumented shared libraries.

For good reasons, existing libgcov implements the dumping on a
per-shared library basis (i.e., gcov_exit is hidden, gcov_list is file
static). This allows each shared library's profile data to be dumped
independently with separate summary data. The downside is that there
is no interface that can be invoked to dump profile data for all
shared modules.


This seems like useful functionality, but I don't think this is the right way to 
do this.  You're duplicating the gcov info object chain.  Why can't you expose 
gcov_list from gcov-driver.c (possibly with a different name, of course?


nathan


[PATCH, rs6000, committed] Fix unspec typo

2014-07-20 Thread Bill Schmidt
Hi,

UNSPEC_VSLDOI was misspelled.  It bothered me.  I fixed it.

Regstrapped on powerpc64le-unknown-linux-gnu, committed as obvious.

Thanks,
Bill


2014-07-20  Bill Schmidt  

* config/rs6000/altivec.md (unspec enum):  Fix typo in
UNSPEC_VSLDOI.
(altivec_vsldoi_): Likewise.


Index: gcc/config/rs6000/altivec.md
===
--- gcc/config/rs6000/altivec.md(revision 212872)
+++ gcc/config/rs6000/altivec.md(working copy)
@@ -67,7 +67,7 @@
UNSPEC_VCTSXS
UNSPEC_VLOGEFP
UNSPEC_VEXPTEFP
-   UNSPEC_VLSDOI
+   UNSPEC_VSLDOI
UNSPEC_VUNPACK_HI_SIGN
UNSPEC_VUNPACK_LO_SIGN
UNSPEC_VUNPACK_HI_SIGN_DIRECT
@@ -2077,7 +2077,7 @@
 (unspec:VM [(match_operand:VM 1 "register_operand" "v")
(match_operand:VM 2 "register_operand" "v")
(match_operand:QI 3 "immediate_operand" "i")]
- UNSPEC_VLSDOI))]
+ UNSPEC_VSLDOI))]
   "TARGET_ALTIVEC"
   "vsldoi %0,%1,%2,%3"
   [(set_attr "type" "vecperm")])




libgo patch committed: Remove unused variable

2014-07-20 Thread Ian Lance Taylor
This patch from Peter Collingbourne removes an unused variable from
libgo.  The variable is set but never used, and gccgo was not giving an
error about such cases.  I will shortly commit a gccgo patch to detect
this case.  This patch bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r cc0233176c9b libgo/go/reflect/value.go
--- a/libgo/go/reflect/value.go	Sun Jul 20 08:12:13 2014 -0700
+++ b/libgo/go/reflect/value.go	Sun Jul 20 12:19:22 2014 -0700
@@ -434,13 +434,12 @@
 	// Get function pointer, type.
 	t := v.typ
 	var (
-		fn   unsafe.Pointer
-		rcvr Value
-		rcvrtype *rtype
+		fn   unsafe.Pointer
+		rcvr Value
 	)
 	if v.flag&flagMethod != 0 {
 		rcvr = v
-		rcvrtype, t, fn = methodReceiver(op, v, int(v.flag)>>flagMethodShift)
+		_, t, fn = methodReceiver(op, v, int(v.flag)>>flagMethodShift)
 	} else if v.flag&flagIndir != 0 {
 		fn = *(*unsafe.Pointer)(v.ptr)
 	} else {


Re: [Patch] PR55189 enable -Wreturn-type by default

2014-07-20 Thread Sylvestre Ledru
Joseph, ping :)

(I know you were in holidays)

S

On 07/07/2014 19:17, Sylvestre Ledru wrote:
> Hello,
>
> On 17/06/2014 19:41, Joseph S. Myers wrote:
>> On Tue, 17 Jun 2014, Sylvestre Ledru wrote:
>>
>>> OK. I will do that.
>>> We should test the following:
>>> * default => run just -Wreturn-type
>>> * -Wreturn-type => Run both
>>> * -Wreturn-type + -Wmissing-return => Run both
>>> * -Wno-return-type + -Wmissing-return => Run just the second one
>>> * -Wno-return-type + -Wno-missing-return => Run none
>>> Do you see any other?
>> That looks like the right things to test, if there are no changes for 
>> anything other than those options.
> Here it is:
> https://github.com/sylvestre/gcc/commit/db8aaac91aa09fd1ec1cc8974586aec45a221e71
>
> Is that what you expected?
>
>>> Besides that, are you OK with my changes? (with the tests updated)
>> The tests are key to reviewing whether the code changes actually do the 
>> right thing.
> Right.
>
> Thanks again for your help and comments, it is really appreciated,
> Sylvestre
>



RE: Re: [MIPS r5900] libgcc floating point fixes

2014-07-20 Thread Jürgen Urban
> "Jürgen Urban"  writes:
> > Hello Richard,
> > 
> > > "Jürgen Urban"  writes:
> > > > The problem happens with the r5900 hard float configurations, e.g.:
> > > > configure --target=mipsel-linux-gnu --with-float=hard --with-fpu=single
> > > > --with-arch=r5900
> > > > I created the attached patch which fixes this problem for r5900 and
> > > > another problem explained later.
> > > > The fixed code generates the following code which should be correct
> > > > (mipsr5900el-ps2-elf):
> > > >
> > > > 00105440 <__extendsfdf2>:
> > > >   105440:   27bdffc8addiu   sp,sp,-56
> > > >   105444:   27a40028addiu   a0,sp,40
> > > >   105448:   27a50018addiu   a1,sp,24
> > > >   10544c:   afbf0034sw  ra,52(sp)
> > > >   105450:   0c0417b5jal 105ed4 <__unpack_f>
> > > >   105454:   e7ac0028swc1$f12,40(sp)
> > > >   105458:   8fa20024lw  v0,36(sp)
> > > >   10545c:   8fa40018lw  a0,24(sp)
> > > >   105460:   8fa5001clw  a1,28(sp)
> > > >   105464:   8fa60020lw  a2,32(sp)
> > > >   105468:   00021882srl v1,v0,0x2
> > > >   10546c:   00021780sll v0,v0,0x1e
> > > >   105470:   afa20010sw  v0,16(sp)
> > > >   105474:   0c041789jal 105e24 <__make_dp>
> > > >   105478:   afa30014sw  v1,20(sp)
> > > >   10547c:   8fbf0034lw  ra,52(sp)
> > > >   105480:   03e8jr  ra
> > > >   105484:   27bd0038addiu   sp,sp,56
> > > >
> > > > The default targets mipsr5900el and mips64r5900el are not affected by
> > > > the problem, because soft float is the default.
> > > >
> > > > It also seems that the same problem occurs with the following
> > configuration:
> > > > configure --target=mipsel-linux-gnu --with-float=hard --with-fpu=single
> > > > I expected that this combination should work and a problem should
> > > > already be detected. Can somebody confirm that the problem also occurs
> > > > with default mipsel?
> > >
> > > Although that configuration is in theory supported by GCC (said like that
> > > because I don't know the state of the glibc support for single-float),
> > > I don't think anyone uses it for any target other than r5900.  But you're
> > > right that this is a --with-fpu=single thing rather than an r5900 thing,
> > > so I don't think the patch is correct.  It should be keyed off whether
> > > the target is single-float or double-float, which you can test by
> > > checking whether the preprocessor macro __mips_single_float is defined.
> > 
> > Checking these macros seem to be too late, because it needs to be known at
> > configure time and not at build time. The libgcc doesn't seem to be very
> 
> I believe the suggestion is to add some code to configure.ac to detect a
> single-float configuration like the hard-float is detected and update your
> patch accordingly with no need to reference r5900 at all:
> 
> case ${host} in
> mips*-*-*)
>   AC_CACHE_CHECK([whether the target is hard-float],
>  [libgcc_cv_mips_hard_float],
>  [AC_COMPILE_IFELSE(
> [#ifndef __mips_hard_float
>  #error FOO
>  #endif],
> [libgcc_cv_mips_hard_float=yes],
> [libgcc_cv_mips_hard_float=no])])
> esac

I will check if I get something working.

> > flexible. It doesn't seem to provide different libraries for single and
> 
> Single and double float would need to be supported as multilibs, it is 
> generally
> assumed that all libraries in the same folder follow a compatible ABI. Single
> and double float ABIs are inherently incompatible.
> 
> > double float. The Linux kernel on the PS2 has support to switch between
> > single and double float. For single float the hardware FPU is used and for
> 
> Just to confirm... The kernel has special handling for an ELF using r5900 arch
> and then checks to see if it is single or double float?

Yes, for checking for r5900 I have an implementation. I don't have an 
implementation for single and double float detection.

> Is this something you
> have recently developed outside of the mainline kernel or does it already 
> exist.
> I'm not aware of such logic in the MIPS kernel yet.

Yes, this is developed in my kernel which currently is still based on Linux 
2.6.35.4. I added a TIF_R5900FPU flag to thread_info.h. I plan that this will 
get part of the mainline kernel. As the patch is too large to get accepted, I 
need to change the binutils, so that sync.p will be added after or before the 
right instruction automatically.

> > double the FPU emulator gets activated. Currently it only checks whether the
> > architecture is mips r5900 or not. For non r5900 the FPU emulator is
> > activated. It seems that we also need to add something to the ELF file to
> > specify the 32 bit or 64 bit for float. It would be good when it is not at a
> > so complicated position as the soft vs hard float flag, becaus

[PING] Re: Abstract incremental hashing

2014-07-20 Thread Andi Kleen
Andi Kleen  writes:

> This patchkit abstracts incremental hashing in tree.c and lto.c 
> to make it easier to plug in new and more efficient hash algorithms.
> Right now it uses the old hash algorithms. So it's just a cleanup.
>
> Passes bootstrap and testing on x86_64-linux.

Ping! Could someone review/approve this please?

The patchkit touches quite a few places in tree.c/lto.c and if ok
I would prefer to commit it relatively quickly to avoid conflicting
with other changes.

Thanks,

-Andi


Go testsuite patch committed: compiledir fix

2014-07-20 Thread Ian Lance Taylor
This patch to the Go testsuite driver adds support for having multiple
files in a single package for a compiledir test.  Ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2014-07-20  Ian Lance Taylor  

* go.test/go-test.exp (go-gc-tests): Support multiple files in one
package for compiledir tests.


Index: go-test.exp
===
--- go-test.exp	(revision 212213)
+++ go-test.exp	(working copy)
@@ -651,13 +651,17 @@ proc go-gc-tests { } {
 	set runtests "go-test.exp"
 	set dg-do-what-default "assemble"
 	set dir "[file rootname $test].dir"
-	set del {}
-	foreach f [lsort [glob "$dir/*.go"]] {
-		dg-test -keep-output $f "-O" "-w $DEFAULT_GOCFLAGS"
-		lappend del "[file rootname [file tail $f]].o"
-	}
-	foreach f $del {
-		file delete $f
+	set files [lsort [glob "$dir/*.go"]]
+	set packages [go-find-packages $test $name $files]
+	if { [llength $packages] > 0 } {
+		set del [list]
+		foreach p $packages {
+		dg-test -keep-output [lindex $p 1] "[lrange $p 2 end] -O" "-w $DEFAULT_GOCFLAGS"
+		lappend del "[file rootname [file tail [lindex $p 1]]].o"
+		}
+		foreach f $del {
+		file delete $f
+		}
 	}
 	set runtests $hold_runtests
 	} elseif { $test_line == "// rundir" } {


Go patch committed: Don't merge dot-import names

2014-07-20 Thread Ian Lance Taylor
This patch to the Go frontend fixes it so that a name included because
of a dot import (import . "package") is not merged with the same name
defined in an earlier file.  Without this patch, the Go compiler would
incorrectly accept code that used a name defined by a dot import in a
later file.  I've sent out a change to add a test to the master
testsuite: http://codereview.appspot.com/11843 .  For this patch,
bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 0e313c250b05 go/gogo.cc
--- a/go/gogo.cc	Sun Jul 20 08:08:44 2014 -0700
+++ b/go/gogo.cc	Sun Jul 20 08:11:43 2014 -0700
@@ -473,7 +473,7 @@
 		 bindings->begin_declarations();
 	   p != bindings->end_declarations();
 	   ++p)
-	this->add_named_object(p->second);
+	this->add_dot_import_object(p->second);
 	}
   else if (ln == "_")
 	package->set_uses_sink_alias();
@@ -1968,11 +1968,32 @@
   return Named_object::make_sink();
 }
 
-// Add a named object.
+// Add a named object for a dot import.
 
 void
-Gogo::add_named_object(Named_object* no)
-{
+Gogo::add_dot_import_object(Named_object* no)
+{
+  // If the name already exists, then it was defined in some file seen
+  // earlier.  If the earlier name is just a declaration, don't add
+  // this name, because that will cause the previous declaration to
+  // merge to this imported name, which should not happen.  Just add
+  // this name to the list of file block names to get appropriate
+  // errors if we see a later definition.
+  Named_object* e = this->package_->bindings()->lookup(no->name());
+  if (e != NULL && e->package() == NULL)
+{
+  if (e->is_unknown())
+	e = e->resolve();
+  if (e->package() == NULL
+	  && (e->is_type_declaration()
+	  || e->is_function_declaration()
+	  || e->is_unknown()))
+	{
+	  this->add_file_block_name(no->name(), no->location());
+	  return;
+	}
+}
+
   this->current_bindings()->add_named_object(no);
 }
 
diff -r 0e313c250b05 go/gogo.h
--- a/go/gogo.h	Sun Jul 20 08:08:44 2014 -0700
+++ b/go/gogo.h	Sun Jul 20 08:11:43 2014 -0700
@@ -397,7 +397,7 @@
   // Add a named object to the current namespace.  This is used for
   // import . "package".
   void
-  add_named_object(Named_object*);
+  add_dot_import_object(Named_object*);
 
   // Add an identifier to the list of names seen in the file block.
   void
diff -r 0e313c250b05 go/import.cc
--- a/go/import.cc	Sun Jul 20 08:08:44 2014 -0700
+++ b/go/import.cc	Sun Jul 20 08:11:43 2014 -0700
@@ -431,7 +431,7 @@
   Typed_identifier tid(name, type, this->location_);
   Named_object* no = this->package_->add_constant(tid, expr);
   if (this->add_to_globals_)
-this->gogo_->add_named_object(no);
+this->gogo_->add_dot_import_object(no);
 }
 
 // Import a type.
@@ -464,7 +464,7 @@
   Named_object* no;
   no = this->package_->add_variable(name, var);
   if (this->add_to_globals_)
-this->gogo_->add_named_object(no);
+this->gogo_->add_dot_import_object(no);
 }
 
 // Import a function into PACKAGE.  PACKAGE is normally
@@ -518,7 +518,7 @@
 {
   no = package->add_function_declaration(name, fntype, loc);
   if (this->add_to_globals_)
-	this->gogo_->add_named_object(no);
+	this->gogo_->add_dot_import_object(no);
 }
   return no;
 }
diff -r 0e313c250b05 go/unsafe.cc
--- a/go/unsafe.cc	Sun Jul 20 08:08:44 2014 -0700
+++ b/go/unsafe.cc	Sun Jul 20 08:11:43 2014 -0700
@@ -66,7 +66,7 @@
   fntype->set_is_builtin();
   no = bindings->add_function_declaration("Sizeof", package, fntype, bloc);
   if (add_to_globals)
-this->add_named_object(no);
+this->add_dot_import_object(no);
 
   // Offsetof.
   results = new Typed_identifier_list;
@@ -76,7 +76,7 @@
   fntype->set_is_builtin();
   no = bindings->add_function_declaration("Offsetof", package, fntype, bloc);
   if (add_to_globals)
-this->add_named_object(no);
+this->add_dot_import_object(no);
 
   // Alignof.
   results = new Typed_identifier_list;
@@ -86,7 +86,7 @@
   fntype->set_is_builtin();
   no = bindings->add_function_declaration("Alignof", package, fntype, bloc);
   if (add_to_globals)
-this->add_named_object(no);
+this->add_dot_import_object(no);
 
   if (!this->imported_unsafe_)
 {


libgo patch committed: Add missing import

2014-07-20 Thread Ian Lance Taylor
This patch from Peter Collingbourne adds a missing import to a libgo
test.  The Go frontend should have detected this error.  The patch for
that is forthcoming (http://codereview.appspot.com/116960043) and I am
adding a test case to the testsuite
(http://codereview.appspot.com/11843).  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r f75db1811715 libgo/go/runtime/runtime_test.go
--- a/libgo/go/runtime/runtime_test.go	Sun Jul 20 02:23:52 2014 -0700
+++ b/libgo/go/runtime/runtime_test.go	Sun Jul 20 08:08:27 2014 -0700
@@ -9,7 +9,7 @@
 	// "io/ioutil"
 	// "os"
 	// "os/exec"
-	// . "runtime"
+	. "runtime"
 	"runtime/debug"
 	// "strconv"
 	// "strings"


Re: [GSoC] Addition of ISL AST generation to Graphite

2014-07-20 Thread Tobias Grosser


On July 20, 2014 1:29:30 PM CEST, Roman Gareev  wrote:
>> I am not aware of any problems with isl 0.12 and would be surprised
>if such
>> problems exist. Are you?
>
>I'm not aware of them, too.
>
>> P.S: As Richard suggested, we may also want to forbid CLooG 0.17.
>
>I've attached the patch, which adds the requirement for ClooG 0.18.1.
>Is it fine for trunk?

Great. Yes, I think it's fine for trunk. 

Tobias 


>
>--
>   Cheers, Roman Gareev.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: [GSoC] A formatting issue.

2014-07-20 Thread Tobias Grosser


On July 20, 2014 1:39:08 PM CEST, Roman Gareev  wrote:
>This patch fixes a formatting issue related to the number of
>characters in the line. Is it fine for trunk?

Yes. 

That's an obvious fix. In case you feel a patch is obvious and it only touches 
graphite. Feel free to commit directly and to then send the patch for 
information to gcc-patches and to add me in cc. 

Thanks Tobias 


>
>--
>   Cheers, Roman Gareev.



[GSoC] A formatting issue.

2014-07-20 Thread Roman Gareev
This patch fixes a formatting issue related to the number of
characters in the line. Is it fine for trunk?

--
   Cheers, Roman Gareev.
2014-07-20  Roman Gareev  

gcc/
* graphite-isl-ast-to-gimple.c:
Fixes a formatting issue related to the number of characters in the
line.
Index: gcc/graphite-isl-ast-to-gimple.c
===
--- gcc/graphite-isl-ast-to-gimple.c(revision 212863)
+++ gcc/graphite-isl-ast-to-gimple.c(working copy)
@@ -464,7 +464,8 @@
 case isl_ast_op_lt:
   {
 // (iterator < ub) => (iterator <= ub - 1)
-isl_val *one = isl_val_int_from_si (isl_ast_expr_get_ctx (for_cond), 
1);
+isl_val *one =
+  isl_val_int_from_si (isl_ast_expr_get_ctx (for_cond), 1);
 isl_ast_expr *ub = isl_ast_expr_get_op_arg (for_cond, 1);
 res = isl_ast_expr_sub (ub, isl_ast_expr_from_val (one));
 break;


Re: [GSoC] Addition of ISL AST generation to Graphite

2014-07-20 Thread Roman Gareev
> I am not aware of any problems with isl 0.12 and would be surprised if such
> problems exist. Are you?

I'm not aware of them, too.

> P.S: As Richard suggested, we may also want to forbid CLooG 0.17.

I've attached the patch, which adds the requirement for ClooG 0.18.1.
Is it fine for trunk?

--
   Cheers, Roman Gareev.
2014-07-20  Roman Gareev  

* configure.ac: Accept only CLooG 0.18.1.
* configure: Regenerate.
Index: configure
===
--- configure   (revision 212861)
+++ configure   (working copy)
@@ -6031,8 +6031,8 @@
 CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${islinc} ${gmpinc}"
 LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${isllibs} ${gmplib}"
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.17.0 of 
CLooG" >&5
-$as_echo_n "checking for version 0.17.0 of CLooG... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.18.1 of 
CLooG" >&5
+$as_echo_n "checking for version 0.18.1 of CLooG... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include "cloog/version.h"
@@ -6040,50 +6040,8 @@
 main ()
 {
 #if CLOOG_VERSION_MAJOR != 0 \
-|| CLOOG_VERSION_MINOR != 17 \
-|| CLOOG_VERSION_REVISION < 0
-choke me
-   #endif
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gcc_cv_cloog=yes
-else
-  gcc_cv_cloog=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog" >&5
-$as_echo "$gcc_cv_cloog" >&6; }
-
-CFLAGS=$_cloog_saved_CFLAGS
-LDFLAGS=$_cloog_saved_LDFLAGS
-  fi
-
-
-if test "${gcc_cv_cloog}" = no ; then
-
-
-
-  if test "${ENABLE_CLOOG_CHECK}" = yes ; then
-_cloog_saved_CFLAGS=$CFLAGS
-_cloog_saved_LDFLAGS=$LDFLAGS
-
-CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${islinc} ${gmpinc}"
-LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${isllibs} ${gmplib}"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.18.0 of 
CLooG" >&5
-$as_echo_n "checking for version 0.18.0 of CLooG... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include "cloog/version.h"
-int
-main ()
-{
-#if CLOOG_VERSION_MAJOR != 0 \
 || CLOOG_VERSION_MINOR != 18 \
-|| CLOOG_VERSION_REVISION < 0
+|| CLOOG_VERSION_REVISION < 1
 choke me
#endif
   ;
@@ -6104,7 +6062,6 @@
   fi
 
 
-fi
 
 
 
Index: configure.ac
===
--- configure.ac(revision 212861)
+++ configure.ac(working copy)
@@ -1661,10 +1661,7 @@
 dnl with user input.
 CLOOG_INIT_FLAGS
 dnl The versions of CLooG that work for Graphite.
-CLOOG_CHECK_VERSION(0,17,0)
-if test "${gcc_cv_cloog}" = no ; then
-  CLOOG_CHECK_VERSION(0,18,0)
-fi
+CLOOG_CHECK_VERSION(0,18,1)
 
 dnl Only execute fail-action, if CLooG has been requested.
 CLOOG_IF_FAILED([


[C PATCH] Better location for implicit_decl_warning (PR c/61852)

2014-07-20 Thread Marek Polacek
implicit_decl_warning wasn't getting a location, so the column info
was poor.  It's easy to fix this up.

Bootstrapped/regtested on x86_64-linux, applying to trunk.

2014-07-20  Marek Polacek  

PR c/61852
* c-decl.c (implicit_decl_warning): Add location_t parameter.  Use it.
(implicitly_declare): Pass location to implicit_decl_warning.

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

diff --git gcc/c/c-decl.c gcc/c/c-decl.c
index 0ca2e0d..425fc58 100644
--- gcc/c/c-decl.c
+++ gcc/c/c-decl.c
@@ -2951,18 +2951,18 @@ pushdecl_top_level (tree x)
 }
 
 static void
-implicit_decl_warning (tree id, tree olddecl)
+implicit_decl_warning (location_t loc, tree id, tree olddecl)
 {
   if (warn_implicit_function_declaration)
 {
   bool warned;
 
   if (flag_isoc99)
-   warned = pedwarn (input_location, OPT_Wimplicit_function_declaration,
+   warned = pedwarn (loc, OPT_Wimplicit_function_declaration,
  "implicit declaration of function %qE", id);
   else
-   warned = warning (OPT_Wimplicit_function_declaration,
- G_("implicit declaration of function %qE"), id);
+   warned = warning_at (loc, OPT_Wimplicit_function_declaration,
+G_("implicit declaration of function %qE"), id);
   if (olddecl && warned)
locate_old_decl (olddecl);
 }
@@ -3015,7 +3015,7 @@ implicitly_declare (location_t loc, tree functionid)
 then recycle the old declaration but with the new type.  */
  if (!C_DECL_IMPLICIT (decl))
{
- implicit_decl_warning (functionid, decl);
+ implicit_decl_warning (loc, functionid, decl);
  C_DECL_IMPLICIT (decl) = 1;
}
  if (DECL_BUILT_IN (decl))
@@ -3052,7 +3052,7 @@ implicitly_declare (location_t loc, tree functionid)
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   C_DECL_IMPLICIT (decl) = 1;
-  implicit_decl_warning (functionid, 0);
+  implicit_decl_warning (loc, functionid, 0);
   asmspec_tree = maybe_apply_renaming_pragma (decl, /*asmname=*/NULL);
   if (asmspec_tree)
 set_user_assembler_name (decl, TREE_STRING_POINTER (asmspec_tree));
diff --git gcc/testsuite/gcc.dg/pr61852.c gcc/testsuite/gcc.dg/pr61852.c
index e69de29..f488aca 100644
--- gcc/testsuite/gcc.dg/pr61852.c
+++ gcc/testsuite/gcc.dg/pr61852.c
@@ -0,0 +1,10 @@
+/* PR c/61852 */
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-function-declaration" } */
+
+int
+f (int a)
+{
+  int b = a + a + a + ff (a); /* { dg-warning "23:implicit declaration of 
function" } */
+  return b;
+}

Marek


[PATCH, i386, PR61827] Fix fuse-caller-save-xmm.c test-case

2014-07-20 Thread Tom de Vries

Uros,

this patch fixes the problems in test-case 
gcc.target/i386/fuse-caller-save-xmm.c reported in PR 61827. I've removed the 
checks for cfi_def_cfa_offset, which were not robust enough for the different 
configurations.


Furthermore, I've:
- added checks for all insns that handle the xmm registers, to make sure we're
  actually using the xmm1 register.
- fixed the scan-assembler-not lines to allow both %esp and %rsp.
- removed main, which was really only intended for the
  fuse-caller-save-xmm-run.c test-case.

Tested with -m32 and -m64.

OK for trunk?

Thanks,
- Tom
2014-07-20  Tom de Vries  

	PR target/61827
	* gcc.target/i386/fuse-caller-save-xmm.c: Add checks for insns with xmm
	registers.  Remove cfi_def_cfa_offset checks.  Generalize checks
	containing %rsp.
	(main): Remove.

diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
index ff21f0c..3754b01 100644
--- a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
+++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
@@ -15,23 +15,12 @@ foo (v2df y)
   return y + bar (y);
 }
 
-int
-main (void)
-{
-  int success;
-  union {
-v2df v;
-double d[2];
-  } u;
-
-  u.v = foo ((v2df){ 5.0, 5.0});
-  success = (u.d[0] == 13.0
-	 && u.d[1] == 13.0);
-
-  return !success;
-}
+/* Check presence of all insns on xmm registers.  These checks are expected to
+   pass with both -fuse-caller-save and -fno-use-caller-save.  */
+/* { dg-final { scan-assembler-times "addpd\t\\.LC0.*, %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "addpd\t%xmm1, %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "movapd\t%xmm0, %xmm1" 1 } } */
 
-/* { dg-final { scan-assembler-not "movaps\t%xmm1, \\(%rsp\\)" } } */
-/* { dg-final { scan-assembler-not "movapd\t\\(%rsp\\), %xmm1" } } */
-/* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 16" 1 } } */
-/* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 32" 1 } } */
+/* Check absence of save/restore of xmm1 register.  */
+/* { dg-final { scan-assembler-not "movaps\t%xmm1, \\(%.sp\\)" } } */
+/* { dg-final { scan-assembler-not "movapd\t\\(%.sp\\), %xmm1" } } */


libgo patch committed: Mark varargs function no_split_stack for Clang

2014-07-20 Thread Ian Lance Taylor
This patch from Peter Collingbourne marks the varargs function
runtime_sprintf as no_split_stack when using Clang.  Apparently Clang
does not support split-stack for varargs function.  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r ca381cdd378c libgo/runtime/print.c
--- a/libgo/runtime/print.c	Sat Jul 19 14:35:30 2014 -0700
+++ b/libgo/runtime/print.c	Sun Jul 20 02:13:45 2014 -0700
@@ -76,9 +76,15 @@
 // x86-64. Note that signal handlers receive slightly less stack space than they
 // would normally do if they happen to be called while this function is being
 // run. If this turns out to be a problem we could consider increasing BACKOFF.
+
 void
 runtime_printf(const char *s, ...)
 __attribute__((no_split_stack));
+
+int32
+runtime_snprintf(byte *buf, int32 n, const char *s, ...)
+__attribute__((no_split_stack));
+
 #endif
 
 void