Re: [PATCH 01/18] stop using rtx_insn_list in reorg.c

2016-04-25 Thread Bernd Schmidt

On 04/20/2016 08:22 AM, tbsaunde+...@tbsaunde.org wrote:

-  rtx_insn_list *merged_insns = 0;
+  auto_vec merged_insns;


I see Jeff has already acked this, but some of the expressions here are 
getting unwieldy. can we maybe shorten some of this using typedefs?



Bernd


Re: Please include ada-hurd.diff upstream (try2)

2016-04-25 Thread Svante Signell
On Tue, 2016-04-19 at 10:29 +0200, Arnaud Charlet wrote:
> > 
> > The updated attachment was included in message
> > https://gcc.gnu.org/ml/gcc-patches/2016-03/msg01659.html
> You should just put a FSF copyright on s-osinte-gnu.adb
> 
> OK with this change.

Is replacing

+-- Copyright (C) 1991-1994, Florida State University--
+-- Copyright (C) 1995-2014, AdaCore --
+--  Copyright (C) 2015-2016, Free Software Foundation, Inc. --

with only

+--  Copyright (C) 2015-2016, Free Software Foundation, Inc. --

OK?


Re: IRA costs tweaks, PR 56069

2016-04-25 Thread Bernd Schmidt

On 03/02/2016 10:53 PM, Vladimir Makarov wrote:



The patch is ok for me.  But I'd wait for GCC7.  People are sensitive to
their code performance degradation.  Even in most cases the patch
improves performance, in some case it can worsen code and people might
fill new PRs after such change.


I've retested now, and it turns out that it turns two guality/sra-1.c 
tests into UNSUPPORTED. Apparently a variable is now destructively 
overwritten. Is that something we worry about (I'm inclined to think no)?



Bernd


Re: C, C++: New warning for memset without multiply by elt size

2016-04-25 Thread Bernd Schmidt

On 04/22/2016 03:57 PM, Jason Merrill wrote:

This looks good, but can we move the code into c-common rather than
duplicate it?


That would be this patch. Also passes testing on x86_64-linux.


Bernd
	* doc/invoke.texi (Warning Options): Add -Wmemset-elt-size.
	(-Wmemset-elt-size): New item.
c-family/
	* c.opt (Wmemset-elt-size): New option.
	* c-common.c (warn_for_memset): New function.
	* c-common.h (warn_for_memset): Declare.
c/
	* c-parser.c (c_parser_postfix_expression_after_primary): Call
	warn_for_memset instead of warning directly here.
cp/
	* parser.c (cp_parser_postfix_expression): Call
	warn_for_memset instead of warning directly here.
testsuite/
	* c-c++-common/memset-array.c: New test.

Index: gcc/c/c-parser.c
===
--- gcc/c/c-parser.c	(revision 235384)
+++ gcc/c/c-parser.c	(working copy)
@@ -8282,18 +8282,15 @@ c_parser_postfix_expression_after_primar
 	  expr.value, exprlist,
 	  sizeof_arg,
 	  sizeof_ptr_memacc_comptypes);
-	  if (warn_memset_transposed_args
-	  && TREE_CODE (expr.value) == FUNCTION_DECL
+	  if (TREE_CODE (expr.value) == FUNCTION_DECL
 	  && DECL_BUILT_IN_CLASS (expr.value) == BUILT_IN_NORMAL
 	  && DECL_FUNCTION_CODE (expr.value) == BUILT_IN_MEMSET
-	  && vec_safe_length (exprlist) == 3
-	  && integer_zerop ((*exprlist)[2])
-	  && (literal_zero_mask & (1 << 2)) != 0
-	  && (!integer_zerop ((*exprlist)[1])
-		  || (literal_zero_mask & (1 << 1)) == 0))
-	warning_at (expr_loc, OPT_Wmemset_transposed_args,
-			"% used with constant zero length parameter; "
-			"this could be due to transposed parameters");
+	  && vec_safe_length (exprlist) == 3)
+	{
+	  tree arg0 = (*exprlist)[0];
+	  tree arg2 = (*exprlist)[2];
+	  warn_for_memset (expr_loc, arg0, arg2, literal_zero_mask);
+	}
 
 	  start = expr.get_start ();
 	  finish = parser->tokens_buf[0].get_finish ();
Index: gcc/c-family/c-common.c
===
--- gcc/c-family/c-common.c	(revision 235384)
+++ gcc/c-family/c-common.c	(working copy)
@@ -11767,6 +11767,49 @@ warn_for_div_by_zero (location_t loc, tr
 warning_at (loc, OPT_Wdiv_by_zero, "division by zero");
 }
 
+/* Warn for patterns where memset appears to be used incorrectly.  The
+   warning location should be LOC.  ARG0, and ARG2 are the first and
+   last arguments to the call, while LITERAL_ZERO_MASK has a 1 bit for
+   each argument that was a literal zero.  */
+
+void
+warn_for_memset (location_t loc, tree arg0, tree arg2,
+		 int literal_zero_mask)
+{
+  if (warn_memset_transposed_args
+  && integer_zerop (arg2)
+  && (literal_zero_mask & (1 << 2)) != 0
+  && (literal_zero_mask & (1 << 1)) == 0)
+warning_at (loc, OPT_Wmemset_transposed_args,
+		"% used with constant zero length "
+		"parameter; this could be due to transposed "
+		"parameters");
+
+  if (warn_memset_elt_size && TREE_CODE (arg2) == INTEGER_CST)
+{
+  STRIP_NOPS (arg0);
+  if (TREE_CODE (arg0) == ADDR_EXPR)
+	arg0 = TREE_OPERAND (arg0, 0);
+  tree type = TREE_TYPE (arg0);
+  if (TREE_CODE (type) == ARRAY_TYPE)
+	{
+	  tree elt_type = TREE_TYPE (type);
+	  tree domain = TYPE_DOMAIN (type);
+	  if (!integer_onep (TYPE_SIZE_UNIT (elt_type))
+	  && TYPE_MAXVAL (domain)
+	  && TYPE_MINVAL (domain)
+	  && integer_zerop (TYPE_MINVAL (domain))
+	  && integer_onep (fold_build2 (MINUS_EXPR, domain,
+	arg2,
+	TYPE_MAXVAL (domain
+	warning_at (loc, OPT_Wmemset_elt_size,
+			"% used with length equal to "
+			"number of elements without multiplication "
+			"with element size");
+	}
+}  
+}
+
 /* Subroutine of build_binary_op. Give warnings for comparisons
between signed and unsigned quantities that may fail. Do the
checking based on the original operand trees ORIG_OP0 and ORIG_OP1,
Index: gcc/c-family/c-common.h
===
--- gcc/c-family/c-common.h	(revision 235384)
+++ gcc/c-family/c-common.h	(working copy)
@@ -902,6 +902,7 @@ extern void c_parse_file (void);
 extern void c_parse_final_cleanups (void);
 
 extern void warn_for_omitted_condop (location_t, tree);
+extern void warn_for_memset (location_t, tree, tree, int);
 
 /* These macros provide convenient access to the various _STMT nodes.  */
 
Index: gcc/c-family/c.opt
===
--- gcc/c-family/c.opt	(revision 235384)
+++ gcc/c-family/c.opt	(working copy)
@@ -565,6 +565,10 @@ Wmemset-transposed-args
 C ObjC C++ ObjC++ Var(warn_memset_transposed_args) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
 Warn about suspicious calls to memset where the third argument is constant literal zero and the second is not.
 
+Wmemset-elt-size
+C ObjC C++ ObjC++ Var(warn_memset_elt_size) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about 

Re: [PATCH] Fix missed DSE opportunity with operator delete.

2016-04-25 Thread Bernd Schmidt

On 04/19/2016 10:48 PM, Mikhail Maltsev wrote:

On 04/18/2016 12:14 PM, Richard Biener wrote:


Enlarging tree_function_decl is bad.

Probably using 3 bits for malloc_flag, operator_new_flag and free_flag is
redundant. I packed the state into 2 bits.


Passes should get at the info via flags_from_decl_or_type () and a new
ECF_FREE.

Fixed.


I think we should also have a testcase that verifies that no DSE happens 
for something that has a destructor.



Bernd



PING: [PATCH] PR33661 Fix problem with register asm in templates

2016-04-25 Thread Andreas Krebbel
Hi Jason,

I recently did run into this again.  Could you please have a look?

https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00904.html

Thanks!

-Andreas-



<    1   2