[PATCH] IPA ICF: memory leak fix

2014-11-22 Thread Martin Liška
Hello.

Following patch removes memory leak that was introduced by very first IPA ICF 
patch.
I would like to thank David for hunting the leak.

Patch an bootstrap on x86_86-linux-pc and no regression is introduced.

Thanks,
Martin
From f959905e984a84d0353fb1e32ba83db2b6dfe4d2 Mon Sep 17 00:00:00 2001
From: mliska mli...@suse.cz
Date: Fri, 21 Nov 2014 16:04:06 +0100
Subject: [PATCH] IPA ICF: memory leak fix

gcc/ChangeLog:

2014-11-21  David Malcolm  dmalc...@redhat.com
	Martin Liska  mli...@suse.cz

	* ipa-icf.c (sem_function::equals_private): auto_vecint replaces
	int* allocated with XNEWVEC.
	(sem_function::bb_dict_test): Likewise.
	* ipa-icf.h: Likewise.
---
 gcc/ipa-icf.c | 15 ++-
 gcc/ipa-icf.h |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e0633e7..4a0fcfb 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -410,7 +410,6 @@ sem_function::equals_private (sem_item *item,
   basic_block bb1, bb2;
   edge e1, e2;
   edge_iterator ei1, ei2;
-  int *bb_dict = NULL;
   bool result = true;
   tree arg1, arg2;
 
@@ -489,8 +488,8 @@ sem_function::equals_private (sem_item *item,
   /* Basic block edges check.  */
   for (unsigned i = 0; i  bb_sorted.length (); ++i)
 {
-  bb_dict = XNEWVEC (int, bb_sorted.length () + 2);
-  memset (bb_dict, -1, (bb_sorted.length () + 2) * sizeof (int));
+  auto_vecint bb_dict;
+  bb_dict.safe_grow_cleared (bb_sorted.length () + 2);
 
   bb1 = bb_sorted[i]-bb;
   bb2 = m_compared_func-bb_sorted[i]-bb;
@@ -957,9 +956,15 @@ sem_function::icf_handled_component_p (tree t)
corresponds to TARGET.  */
 
 bool
-sem_function::bb_dict_test (int* bb_dict, int source, int target)
+sem_function::bb_dict_test (auto_vecint bb_dict, int source, int target)
 {
-  if (bb_dict[source] == -1)
+  /* bb_dict is cleared with zeros, so that source and target are
+ incremented. bb_dist is used to verify that edges in source and
+ target function correspond. */
+
+  source++;
+  target++;
+  if (bb_dict[source] == 0)
 {
   bb_dict[source] = target;
   return true;
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index 046e858..75db93a 100644
--- a/gcc/ipa-icf.h
+++ b/gcc/ipa-icf.h
@@ -275,7 +275,7 @@ private:
 
   /* Basic blocks dictionary BB_DICT returns true if SOURCE index BB
  corresponds to TARGET.  */
-  bool bb_dict_test (int* bb_dict, int source, int target);
+  bool bb_dict_test (auto_vecint bb_dict, int source, int target);
 
   /* Iterates all tree types in T1 and T2 and returns true if all types
  are compatible. If COMPARE_POLYMORPHIC is set to true,
-- 
2.1.2



[PATCH, i386 testsuite]: Add some missing requirements to avx512vl tests

2014-11-22 Thread Uros Bizjak
Hello!

2014-11-22  Uros Bizjak  ubiz...@gmail.com

* gcc.target/i386/avx512vl-vpermb-2.c: Require avx512vbmi.
* gcc.target/i386/avx512vl-vpermi2b-2.c: Ditto.
* gcc.target/i386/avx512vl-vpermt2b-2.c: Ditto.
* gcc.target/i386/avx512vl-vpmaddhuq-2.c: Require avx512ifma.
* gcc.target/i386/avx512vl-vpmaddluq-2.c: Ditto.
* gcc.target/i386/avx512vl-vpmultishiftqb-2.c: Ditto.

Tested on x86_64-linux-gnu and committed to mainline SVN.

Uros.
Index: gcc.target/i386/avx512vl-vpermb-2.c
===
--- gcc.target/i386/avx512vl-vpermb-2.c (revision 217951)
+++ gcc.target/i386/avx512vl-vpermb-2.c (working copy)
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options -O2 -mavx512vbmi -mavx512vl -DAVX512VL } */
 /* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512vbmi } */
 
 #define AVX512F_LEN 256
 #define AVX512F_LEN_HALF 128
Index: gcc.target/i386/avx512vl-vpermi2b-2.c
===
--- gcc.target/i386/avx512vl-vpermi2b-2.c   (revision 217951)
+++ gcc.target/i386/avx512vl-vpermi2b-2.c   (working copy)
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options -O2 -mavx512vbmi -mavx512vl -DAVX512VL } */
 /* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512vbmi } */
 
 #define AVX512F_LEN 256
 #define AVX512F_LEN_HALF 128
Index: gcc.target/i386/avx512vl-vpermt2b-2.c
===
--- gcc.target/i386/avx512vl-vpermt2b-2.c   (revision 217951)
+++ gcc.target/i386/avx512vl-vpermt2b-2.c   (working copy)
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options -O2 -mavx512vbmi -mavx512vl -DAVX512VL } */
 /* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512vbmi } */
 
 #define AVX512F_LEN 256
 #define AVX512F_LEN_HALF 128
Index: gcc.target/i386/avx512vl-vpmaddhuq-2.c
===
--- gcc.target/i386/avx512vl-vpmaddhuq-2.c  (revision 217951)
+++ gcc.target/i386/avx512vl-vpmaddhuq-2.c  (working copy)
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options -O2 -mavx512ifma -mavx512vl -DAVX512VL } */
 /* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512ifma } */
 
 #define AVX512F_LEN 256
 #define AVX512F_LEN_HALF 128
Index: gcc.target/i386/avx512vl-vpmaddluq-2.c
===
--- gcc.target/i386/avx512vl-vpmaddluq-2.c  (revision 217951)
+++ gcc.target/i386/avx512vl-vpmaddluq-2.c  (working copy)
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options -O2 -mavx512ifma -mavx512vl -DAVX512VL } */
 /* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512ifma } */
 
 #define AVX512F_LEN 256
 #define AVX512F_LEN_HALF 128
Index: gcc.target/i386/avx512vl-vpmultishiftqb-2.c
===
--- gcc.target/i386/avx512vl-vpmultishiftqb-2.c (revision 217951)
+++ gcc.target/i386/avx512vl-vpmultishiftqb-2.c (working copy)
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options -O2 -mavx512vbmi -mavx512vl -DAVX512VL } */
 /* { dg-require-effective-target avx512vl } */
+/* { dg-require-effective-target avx512vbmi } */
 
 #define AVX512F_LEN 256
 #define AVX512F_LEN_HALF 128


Re: [PATCH] IPA ICF: memory leak fix

2014-11-22 Thread Markus Trippelsdorf
On 2014.11.22 at 09:05 +0100, Martin Liška wrote:
 Hello.
 
 Following patch removes memory leak that was introduced by very first IPA ICF 
 patch.
 I would like to thank David for hunting the leak.
 
 Patch an bootstrap on x86_86-linux-pc and no regression is introduced.

I gave the patch a quick spin on gcc112:

*** Error in `/home/trippels/gcc_build_dir/./prev-gcc/lto1': free(): invalid 
next size (fast): 0x01000a5fc160 ***
=== Backtrace: =
/lib64/libc.so.6(+0xa3d9c)[0x3fff7b6b3d9c]
/lib64/libc.so.6(+0xaf0b4)[0x3fff7b6bf0b4]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN3vecIi7va_heap6vl_ptrE7releaseEv-0x1d4bc00)[0x1025dd88]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12sem_function14equals_privateEPNS_8sem_itemER8hash_mapIP11symtab_nodeS2_22default_hashmap_traitsE-0x9c083c)[0x116586bc]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12sem_function6equalsEPNS_8sem_itemER8hash_mapIP11symtab_nodeS2_22default_hashmap_traitsE-0x9c0578)[0x11658998]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf18sem_item_optimizer7executeEv-0x9b8774)[0x11660a84]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12pass_ipa_icf7executeEP8function-0x9b0314)[0x11668efc]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z16execute_one_passP8opt_pass-0x1647588)[0x1098a0a8]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z21execute_ipa_pass_listP8opt_pass-0x1644c2c)[0x1098ca7c]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z8lto_mainv-0x1df20e4)[0x101b494c]
/home/trippels/gcc_build_dir/./prev-gcc/lto1[0x10b599b8]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN6toplev4mainEiPPc-0x1e8be70)[0x101507b8]
/home/trippels/gcc_build_dir/./prev-gcc/lto1(main-0x1ec8d8c)[0x1015493c]
/lib64/libc.so.6(+0x447ac)[0x3fff7b6547ac]
/lib64/libc.so.6(__libc_start_main-0x19cbf4)[0x3fff7b6549d4]
=== Memory map: 
...

-- 
Markus


RE: [PATCHv4][MIPS] Implement O32 ABI extensions (GCC)

2014-11-22 Thread Matthew Fortune
Andrew Pinski pins...@gmail.com writes:
 On Wed, Nov 12, 2014 at 2:56 PM, Matthew Fortune
 matthew.fort...@imgtec.com wrote:
   Moore, Catherine catherine_mo...@mentor.com writes:
The patch looks good.   Please fix up these couple of nits prior to
committing.
  
   OK, thanks for the second read through. One further amendment
   below, I'll aim to commit later today.
  
 
  Yes, that's better.
 
  Committed as r217446
 
  Fingers crossed there will be no fallout from it but if there is I'll
  deal with it promptly.
 
 Most of the testcases fail if you are compiling for soft-float:
 FAIL: gcc.target/mips/call-clobbered-1.c   -O1   scan-assembler-times sdc1 2
 FAIL: gcc.target/mips/call-clobbered-1.c   -O1   scan-assembler-times ldc1 4
 ...
 FAIL: gcc.target/mips/call-clobbered-2.c   -O1   scan-assembler-times lwc1 4
 FAIL: gcc.target/mips/call-clobbered-2.c   -O1   scan-assembler-times swc1 2
 ...
 
 FAIL: gcc.target/mips/call-clobbered-3.c   -O1   scan-assembler-times lwc1 5
 FAIL: gcc.target/mips/call-clobbered-3.c   -O1   scan-assembler-times swc1 3
 ...
 FAIL: gcc.target/mips/call-clobbered-4.c   -Os   scan-assembler-times lwc1 4
 FAIL: gcc.target/mips/call-clobbered-4.c   -Os   scan-assembler-times swc1 2
 ...
 FAIL: gcc.target/mips/call-saved-4.c   -O0   scan-assembler \$f20
 FAIL: gcc.target/mips/call-saved-4.c   -O0   scan-assembler \$f22
 FAIL: gcc.target/mips/call-saved-4.c   -O0   scan-assembler \$f24
 FAIL: gcc.target/mips/call-saved-4.c   -O0   scan-assembler \$f26
 FAIL: gcc.target/mips/call-saved-4.c   -O0   scan-assembler \$f28
 FAIL: gcc.target/mips/call-saved-4.c   -O0   scan-assembler \$f30
 
 
 FAIL: gcc.target/mips/call-saved-5.c   -O0   scan-assembler \$f20
 FAIL: gcc.target/mips/call-saved-5.c   -O0   scan-assembler \$f22
 FAIL: gcc.target/mips/call-saved-5.c   -O0   scan-assembler \$f24
 FAIL: gcc.target/mips/call-saved-5.c   -O0   scan-assembler \$f26
 FAIL: gcc.target/mips/call-saved-5.c   -O0   scan-assembler \$f28
 FAIL: gcc.target/mips/call-saved-5.c   -O0   scan-assembler \$f30
 ...
 FAIL: gcc.target/mips/movdf-1.c   -O1   scan-assembler-times ldc1 1
 ...
 FAIL: gcc.target/mips/movdf-2.c   -O1   scan-assembler mthc1
 FAIL: gcc.target/mips/movdf-2.c   -O1   scan-assembler mtc1
 ...
 FAIL: gcc.target/mips/movdf-3.c   -O1   scan-assembler-times mtc1 2
 ...

Thanks Andrew. I'll take a look, getting these tests to be usable in all the 
hardfloat
configs took such a long time that I have clearly not run the single or soft 
float
configs.

My intention was to make mips.exp intelligent enough to know that -mfp*
imply -mdouble-float and -mhard-float which should resolve this. I would also
add -msingle-float support but single-float has been ignored for a number of
tests so I'll look at that separately. It will take a couple of days to go 
through
the configs to make sure I don’t break the tests for hard-float configs with the
change.

Matthew


Re: [PATCH x86] Increase PARAM_MAX_COMPLETELY_PEELED_INSNS when branch is costly

2014-11-22 Thread Eric Botcazou
 OK. Looks like a good performance vs. codesize tradeoff.

Yes, but IMO this should be done in the generic code, unrolling small loops is 
profitable on most architectures.

-- 
Eric Botcazou


Re: C++ PATCH for c++/63657 (missed unused reference warning)

2014-11-22 Thread Paolo Carlini

On 11/22/2014 03:18 AM, Jason Merrill wrote:
The earlier fix for 38958 was too broad; we don't want to suppress the 
unused warning for all references to type with non-trivial destructor, 
just references bound to a temporary.

Thanks!

Paolo.


Re: [PATCH x86] Increase PARAM_MAX_COMPLETELY_PEELED_INSNS when branch is costly

2014-11-22 Thread Uros Bizjak
On Sat, Nov 22, 2014 at 10:49 AM, Eric Botcazou ebotca...@adacore.com wrote:
 OK. Looks like a good performance vs. codesize tradeoff.

 Yes, but IMO this should be done in the generic code, unrolling small loops is
 profitable on most architectures.

Yeah, but after a couple of pings for a generic change, we went the target way.

Uros.


Re: [PATCH, combine] Try REG_EQUAL for nonzero_bits

2014-11-22 Thread Eric Botcazou
 The patch tries to use REG_EQUAL to get more precise info for nonzero_bits,
 which helps to remove unnecessary zero_extend.
 
 Here is an example when compiling Coremark, we have rtx like,
 
 (insn 1244 386 388 47 (set (reg:SI 263 [ D.5767 ])
 (reg:SI 384 [ D.5767 ])) 786 {*thumb2_movsi_insn}
  (expr_list:REG_EQUAL (zero_extend:SI (mem:QI (reg/v/f:SI 271 [ memblock
 ]) [0 *memblock_13(D)+0 S1 A8]))
 (nil)))
 
 from reg:SI 384, we can only know it is a 32-bit value. But from
 REG_EQUAL, we can know it is an 8-bit value. Then for the following rtx seq,
 
 (insn 409 407 410 50 (set (reg:SI 308)
 (plus:SI (reg:SI 263 [ D.5767 ])
 (const_int -48 [0xffd0]))) core_state.c:170 4
 {*arm_addsi3}
  (nil))
 (insn 410 409 411 50 (set (reg:SI 309)
 (zero_extend:SI (subreg:QI (reg:SI 308) 0))) core_state.c:170 812
 {thumb2_zero_extendqisi2_v6}
  (expr_list:REG_DEAD (reg:SI 308)
 (nil)))
 
 the zero_extend for r309 can be optimized by combine pass.

This sounds like a good idea.

 2014-11-21  Zhenqiang Chen  zhenqiang.c...@arm.com
 
   * combine.c (set_nonzero_bits_and_sign_copies): Try REG_EQUAL note.
 
 diff --git a/gcc/combine.c b/gcc/combine.c
 index 6a7d16b..68a883b 100644
 --- a/gcc/combine.c
 +++ b/gcc/combine.c
 @@ -1713,7 +1713,15 @@ set_nonzero_bits_and_sign_copies (rtx x, const_rtx
 set, void *data)
 
 /* Don't call nonzero_bits if it cannot change anything.  */
 if (rsp-nonzero_bits != ~(unsigned HOST_WIDE_INT) 0)
 - rsp-nonzero_bits |= nonzero_bits (src, nonzero_bits_mode);
 + {
 +   rtx reg_equal = insn ? find_reg_note (insn, REG_EQUAL,
 NULL_RTX)
 +  : NULL_RTX;
 +   if (reg_equal)
 + rsp-nonzero_bits |= nonzero_bits (XEXP (reg_equal, 0),
 +nonzero_bits_mode);
 +   else
 + rsp-nonzero_bits |= nonzero_bits (src, nonzero_bits_mode);
 + }
 num = num_sign_bit_copies (SET_SRC (set), GET_MODE (x));
 if (rsp-sign_bit_copies == 0
 
 || rsp-sign_bit_copies  num)

Use find_reg_equal_equiv_note instead.  Are you sure that this won't yield 
inferior results in very peculiar cases?  IOW, why not use both sources?

Note that 'src' is massaged just above if SHORT_IMMEDIATES_SIGN_EXTEND is 
defined so we should probably do it for the note datum too, for example by 
factoring the code into a function and invoking it.

Why not do the same for num_sign_bit_copies?

-- 
Eric Botcazou


Re: [PATCH, PR 63551] Use proper type in evaluate_conditions_for_known_args

2014-11-22 Thread Martin Jambor
Hi,

On Fri, Nov 21, 2014 at 09:18:03PM +0100, Richard Biener wrote:
 On November 21, 2014 9:07:50 PM CET, Martin Jambor mjam...@suse.cz wrote:
 the testcase of PR 63551 passes a union between a signed and an
 unsigned integer between two functions as a parameter.  The caller
 initializes to an unsigned integer with the highest order bit set, the
 callee loads the data through the signed field and compares with zero.
 evaluate_conditions_for_known_args then wrongly evaluated the
 condition in these circumstances, which later on lead to insertion of
 builtin_unreachable and miscompilation.
 
 Fixed by fold_converting the known value first.  I use the type of the
 value in the condition which should do exactly the right thing because
 the value is taken from the corresponding gimple_cond statement in
 which types must match.
 
 Bootstrapped and tested on x86_64-linux.  OK for trunk?
 
 I think you want to use fold_unary (VIEW_CONVERT,...) Here if you consider 
 the case with
 Int and float.  And fail if that returns NULL or not a constant.
 

You are of course right.  The following does exactly that.
Bootstrapped and tested on x86_64-linux on trunk and the 4.9 branch.
OK for both?

Thanks,

Martin


2014-11-21  Martin Jambor  mjam...@suse.cz

PR ipa/63551
* ipa-inline-analysis.c (evaluate_conditions_for_known_args): Convert
value of the argument to the type of the value in the condition.

testsuite/
* gcc.dg/ipa/pr63551.c: New test.


Index: src/gcc/ipa-inline-analysis.c
===
--- src.orig/gcc/ipa-inline-analysis.c
+++ src/gcc/ipa-inline-analysis.c
@@ -880,7 +880,10 @@ evaluate_conditions_for_known_args (stru
}
   if (c-code == IS_NOT_CONSTANT || c-code == CHANGED)
continue;
-  res = fold_binary_to_constant (c-code, boolean_type_node, val, c-val);
+  val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c-val), val);
+  res = val
+   ? fold_binary_to_constant (c-code, boolean_type_node, val, c-val)
+   : NULL;
   if (res  integer_zerop (res))
continue;
   clause |= 1  (i + predicate_first_dynamic_condition);
Index: src/gcc/testsuite/gcc.dg/ipa/pr63551.c
===
--- /dev/null
+++ src/gcc/testsuite/gcc.dg/ipa/pr63551.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options -Os } */
+
+union U
+{
+  unsigned int f0;
+  int f1;
+};
+
+int a, d;
+
+void
+fn1 (union U p)
+{
+  if (p.f1 = 0)
+if (a)
+  d = 0;
+}
+
+void
+fn2 ()
+{
+  d = 0;
+  union U b = { 4294967286 };
+  fn1 (b);
+}
+
+int
+main ()
+{
+  fn2 ();
+  return 0;
+}


Re: [PATCH x86] Increase PARAM_MAX_COMPLETELY_PEELED_INSNS when branch is costly

2014-11-22 Thread Eric Botcazou
 Yeah, but after a couple of pings for a generic change, we went the target
 way.

That's a bit of a shame, the 400 - 100 change was very likely tested only on 
x86-64 and nevetheless applied to the generic code, so the fix repairing the 
damages should also be applied to the generic code.

-- 
Eric Botcazou


Re: [PATCH, PR 63551] Use proper type in evaluate_conditions_for_known_args

2014-11-22 Thread Jakub Jelinek
On Sat, Nov 22, 2014 at 12:09:46PM +0100, Martin Jambor wrote:
 2014-11-21  Martin Jambor  mjam...@suse.cz
 
   PR ipa/63551
   * ipa-inline-analysis.c (evaluate_conditions_for_known_args): Convert
   value of the argument to the type of the value in the condition.
 
 testsuite/
   * gcc.dg/ipa/pr63551.c: New test.
 
 
 Index: src/gcc/ipa-inline-analysis.c
 ===
 --- src.orig/gcc/ipa-inline-analysis.c
 +++ src/gcc/ipa-inline-analysis.c
 @@ -880,7 +880,10 @@ evaluate_conditions_for_known_args (stru
   }
if (c-code == IS_NOT_CONSTANT || c-code == CHANGED)
   continue;
 -  res = fold_binary_to_constant (c-code, boolean_type_node, val, 
 c-val);
 +  val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c-val), val);

VCE should only be used if the sizes of the types are the same.
Is that always the case here?

Jakub


[Ada] Fix ICE on Ordered_Map and No_Streams restriction

2014-11-22 Thread Eric Botcazou
This is an ICE on the use of the pre-defined unit Ordered_Map in conjunction 
with the No_Streams restriction.  In this case, gigi builds a NULL_EXPR 
wrapping a call to the raise Program_Error routine, but it fails to gimplify 
it properly in gnat_gimplify_expr.

Tested on x86_64-suse-linux, applied on the mainline.


2014-11-22  Eric Botcazou  ebotca...@adacore.com

* gcc-interface/trans.c (gnat_gimplify_expr): Add 'type' variable.
case NULL_EXPR: Deal with unconstrained array types and use 'type'.
case ADDR_EXPR: Use 'type'.
case DECL_EXPR: Likewise.


2014-11-22  Eric Botcazou  ebotca...@adacore.com

* gnat.dg/specs/no_streams.ads: New test.


-- 
Eric BotcazouIndex: gcc-interface/trans.c
===
--- gcc-interface/trans.c	(revision 217961)
+++ gcc-interface/trans.c	(working copy)
@@ -7657,6 +7657,7 @@ gnat_gimplify_expr (tree *expr_p, gimple
 		gimple_seq *post_p ATTRIBUTE_UNUSED)
 {
   tree expr = *expr_p;
+  tree type = TREE_TYPE (expr);
   tree op;
 
   if (IS_ADA_STMT (expr))
@@ -7665,16 +7666,17 @@ gnat_gimplify_expr (tree *expr_p, gimple
   switch (TREE_CODE (expr))
 {
 case NULL_EXPR:
-  /* If this is for a scalar, just make a VAR_DECL for it.  If for
-	 an aggregate, get a null pointer of the appropriate type and
-	 dereference it.  */
-  if (AGGREGATE_TYPE_P (TREE_TYPE (expr)))
-	*expr_p = build1 (INDIRECT_REF, TREE_TYPE (expr),
-			  convert (build_pointer_type (TREE_TYPE (expr)),
-   integer_zero_node));
+  /* If this is an aggregate type, build a null pointer of the appropriate
+	 type and dereference it.  */
+  if (AGGREGATE_TYPE_P (type)
+	  || TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
+	*expr_p = build_unary_op (INDIRECT_REF, NULL_TREE,
+  convert (build_pointer_type (type),
+	   integer_zero_node));
+  /* Otherwise, just make a VAR_DECL.  */
   else
 	{
-	  *expr_p = create_tmp_var (TREE_TYPE (expr), NULL);
+	  *expr_p = create_tmp_var (type, NULL);
 	  TREE_NO_WARNING (*expr_p) = 1;
 	}
 
@@ -7697,7 +7699,7 @@ gnat_gimplify_expr (tree *expr_p, gimple
   if (TREE_CODE (op) == CONSTRUCTOR  TREE_CONSTANT (op))
 	{
 	  tree addr = build_fold_addr_expr (tree_output_constant_def (op));
-	  *expr_p = fold_convert (TREE_TYPE (expr), addr);
+	  *expr_p = fold_convert (type, addr);
 	  return GS_ALL_DONE;
 	}
 
@@ -7711,7 +7713,7 @@ gnat_gimplify_expr (tree *expr_p, gimple
 	 required if the type is passed by reference.  */
   if ((TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR)
 	   AGGREGATE_TYPE_P (TREE_TYPE (op))
-	   !AGGREGATE_TYPE_P (TREE_TYPE (expr)))
+	   !AGGREGATE_TYPE_P (type))
 	{
 	  tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), C);
 	  gimple_add_tmp_var (new_var);
-- { dg-do compile }

pragma Restrictions (No_Streams);

with Ada.Containers.Ordered_Maps;

package No_Streams is

  type Arr is new String (1..8);

  package My_Ordered_Map is new Ada.Containers.Ordered_Maps
  (Key_Type = Natural, Element_Type = Arr);

end No_Streams;


[Ada] Fix ICE on bounded string subtype in packed record type

2014-11-22 Thread Eric Botcazou
The compiler aborts on an extension of a tagged record type which contains a 
field whose type is a packed record type which in turn contains a field of a 
bounded string subtype.  Fixed by the attached tweak.

Tested on x86_64-suse-linux, applied on the mainline.


2014-11-22  Eric Botcazou  ebotca...@adacore.com

* gcc-interface/trans.c (Call_to_gnu): Strip unchecked conversions on
actuals of In parameters if the destination type is an unconstrained
composite type.

2014-11-22  Eric Botcazou  ebotca...@adacore.com

* gnat.dg/specs/pack11.ads: New test.


-- 
Eric Botcazou-- { dg-do compile }

with Ada.Strings.Bounded;

package Pack11 is

  package My_Strings is new Ada.Strings.Bounded.Generic_Bounded_Length (4);
  subtype My_Bounded_String is My_Strings.Bounded_String;

  type Rec1 is tagged null record;

  type Rec2 is record
S : My_Bounded_String;
  end record;
  pragma Pack (Rec2);

  type Rec3 is new Rec1 with record
R : Rec2;
  end record;

end Pack11;Index: gcc-interface/trans.c
===
--- gcc-interface/trans.c	(revision 217964)
+++ gcc-interface/trans.c	(working copy)
@@ -4016,9 +4016,10 @@ Call_to_gnu (Node_Id gnat_node, tree *gn
gnat_formal = Next_Formal_With_Extras (gnat_formal),
gnat_actual = Next_Actual (gnat_actual))
 {
+  Entity_Id gnat_formal_type = Etype (gnat_formal);
   tree gnu_formal = present_gnu_tree (gnat_formal)
 			? get_gnu_tree (gnat_formal) : NULL_TREE;
-  tree gnu_formal_type = gnat_to_gnu_type (Etype (gnat_formal));
+  tree gnu_formal_type = gnat_to_gnu_type (gnat_formal_type);
   const bool is_true_formal_parm
 	= gnu_formal  TREE_CODE (gnu_formal) == PARM_DECL;
   const bool is_by_ref_formal_parm
@@ -4031,13 +4032,16 @@ Call_to_gnu (Node_Id gnat_node, tree *gn
 	 address if it's passed by reference or as target of the back copy
 	 done after the call if it uses the copy-in/copy-out mechanism.
 	 We do it in the In case too, except for an unchecked conversion
-	 because it alone can cause the actual to be misaligned and the
-	 addressability test is applied to the real object.  */
+	 to an elementary type or a constrained composite type because it
+	 alone can cause the actual to be misaligned and the addressability
+	 test is applied to the real object.  */
   const bool suppress_type_conversion
 	= ((Nkind (gnat_actual) == N_Unchecked_Type_Conversion
-	 Ekind (gnat_formal) != E_In_Parameter)
+	 (Ekind (gnat_formal) != E_In_Parameter
+		|| (Is_Composite_Type (Underlying_Type (gnat_formal_type))
+		 !Is_Constrained (Underlying_Type (gnat_formal_type)
 	   || (Nkind (gnat_actual) == N_Type_Conversion
-	Is_Composite_Type (Underlying_Type (Etype (gnat_formal);
+	Is_Composite_Type (Underlying_Type (gnat_formal_type;
   Node_Id gnat_name = suppress_type_conversion
 			  ? Expression (gnat_actual) : gnat_actual;
   tree gnu_name = gnat_to_gnu (gnat_name), gnu_name_type;
@@ -4200,7 +4204,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gn
   if (Ekind (gnat_formal) != E_Out_Parameter
 	   Do_Range_Check (gnat_actual))
 	gnu_actual
-	  = emit_range_check (gnu_actual, Etype (gnat_formal), gnat_actual);
+	  = emit_range_check (gnu_actual, gnat_formal_type, gnat_actual);
 
   /* Unless this is an In parameter, we must remove any justified modular
 	 building from GNU_NAME to get an lvalue.  */

[Patch, option handling] optc-gen.awk - support || in EnabledBy()

2014-11-22 Thread Tobias Burnus

In fortran/*.opt, I'd like to use:

Fortran Var(warn_tabs) Warning EnabledBy(Wall || Wpedantic)

However, || is not supported by EnabledBy. This patch adds it. I 
checked that option.c remains the same after the patch.


I attached the patch twice: Once with -w -U16 to show the modification 
(minus re-indenting) and once with re-indenting.


OK for the trunk?

Tobias

gcc/
2014-11-22  Tobias Burnus net-b.de

* optc-gen.awk: Support || in EnabledBy.
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index ecb225c..0707db2 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -25,63 +25,84 @@
 # opt-read.awk.
 #
 # Usage: awk -f opt-functions.awk -f opt-read.awk -f optc-gen.awk \
 #[-v header_name=header.h]  inputfile  options.c
 
 # Dump that array of options into a C file.
 END {
 
 # Record first EnabledBy and LangEnabledBy uses.
 n_enabledby = 0;
 for (i = 0; i  n_langs; i++) {
 n_enabledby_lang[i] = 0;
 }
 for (i = 0; i  n_opts; i++) {
 enabledby_arg = opt_args(EnabledBy, flags[i]);
 if (enabledby_arg != ) {
+   if (index(enabledby_arg,   ) == 0) {
+   # Enabledby(arg) or Enabledby(arg1 || arg2 || arg3)
+   n_enabledby_names = split(enabledby_arg, enabledby_names,  \\|\\| );
+   for (j = 1; j = n_enabledby_names; j++) {
+enabledby_name = enabledby_names[j];
+enabledby_index = opt_numbers[enabledby_name];
+if (enabledby_index == ) {
+print #error Enabledby:  enabledby_name
+} else {
+condition = ;
+if (enables[enabledby_name] == ) {
+enabledby[n_enabledby] = enabledby_name;
+n_enabledby++;
+}
+enables[enabledby_name] = enables[enabledby_name] opts[i] ;;
+enablesif[enabledby_name] = enablesif[enabledby_name] condition ;;
+}
+   }
+   } else {
+# Enabledby(arg1  arg2)
 n_enabledby_names = split(enabledby_arg, enabledby_names,   );
 if (n_enabledby_names  2) {
 print #error EnabledBy (Wfoo  Wbar  Wbaz) not currently supported
 }
 for (j = 1; j = n_enabledby_names; j++) {
 enabledby_name = enabledby_names[j];
 enabledby_index = opt_numbers[enabledby_name];
 if (enabledby_index == ) {
 print #error Enabledby:  enabledby_name
 } else {
 condition = ;
 if (n_enabledby_names == 2) {
 opt_var_name_1 = search_var_name(enabledby_names[1], opt_numbers, opts, flags, n_opts);
 opt_var_name_2 = search_var_name(enabledby_names[2], opt_numbers, opts, flags, n_opts);
 if (opt_var_name_1 == ) {
 print #error  enabledby_names[1]  does not have a Var() flag
 }
 if (opt_var_name_2 == ) {
 print #error  enabledby_names[2]  does not have a Var() flag
 }
 condition = opts-x_ opt_var_name_1   opts-x_ opt_var_name_2;
 }
 if (enables[enabledby_name] == ) {
 enabledby[n_enabledby] = enabledby_name;
 n_enabledby++;
 }
 enables[enabledby_name] = enables[enabledby_name] opts[i] ;;
 enablesif[enabledby_name] = enablesif[enabledby_name] condition ;;
 }
 }
   }
+}
 
 enabledby_arg = opt_args(LangEnabledBy, flags[i]);
 if (enabledby_arg != ) {
 enabledby_langs = nth_arg(0, enabledby_arg);
 enabledby_name = nth_arg(1, enabledby_arg);
 enabledby_posarg = nth_arg(2, enabledby_arg);
 	enabledby_negarg = nth_arg(3, enabledby_arg);
 lang_enabled_by(enabledby_langs, enabledby_name, enabledby_posarg, enabledby_negarg);
 }
 }
 
 
 print /* This file is auto-generated by optc-gen.awk.  */
 print 
 n_headers = split(header_name, headers,  )
 for (i = 1; i = n_headers; i++)
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index ecb225c..0707db2 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -38,36 +38,57 @@ for (i = 0; i  n_langs; i++) {
 for (i = 0; i  n_opts; i++) {
 enabledby_arg = opt_args(EnabledBy, flags[i]);
 if (enabledby_arg != ) {
-n_enabledby_names = split(enabledby_arg, enabledby_names,   );
-if (n_enabledby_names  2) {
-print #error EnabledBy (Wfoo  Wbar  Wbaz) not currently supported
-}
-for (j = 1; j = n_enabledby_names; j++) {
-enabledby_name = enabledby_names[j];
-enabledby_index = opt_numbers[enabledby_name];
-if (enabledby_index == ) {
-print #error Enabledby:  

[PATCH] Work around in-tree gmp configure problems

2014-11-22 Thread Bernd Edlinger
Hi,

since r217627 we use an updated AutoMake missing script.  However that 
revealed a hidden
bug in gmp-4.3.2's (up to gmp-6.0.0a) configure script.  That is: an in-tree 
gmp/configure fails
now if flex is missing.  The gmp configure uses our missing flex script, and 
previously that emitted
an error message and created a dummy lex.yy.c, The new version of that script 
does no longer create
any lex.yy.c.

But also if flex is installed, the configure script sets M4=m4-not-needed, 
before calling flex,
which aborts, and leaves an empty lex.yy.c.  However chances are that the flex 
tool fails in a way
that there is no lex.yy.c at all, for instance under windows, or with a 
different version of flex.

Now the problem is, if the invocation of flex does not create at least an empty 
lex.yy.c the whole
gmp configuration fails, even though, flex is only needed for one demo example.

This patch adds LEX=touch lex.yy.c to the in-tree gmp configure script, which 
does in fact the
same thing as the flex tool when called under these conditions.

I have tested gmp-4.3.2 and gmp-6.0.0a in-tree and boot-strapped under 
x86_64-linux-gnu successfully.


OK for trunk?


Thanks
Bernd.
  2014-11-22  Bernd Edlinger  bernd.edlin...@hotmail.de

* Makefile.def (module=gmp): Work around in-tree gmp configure bug with
missing flex.
* Makefile.in: Regenerated.



patch-gmp.diff
Description: Binary data


Re: [committed] Update config/pa/linux-atomic.c to use new subword and double word atomic support

2014-11-22 Thread John David Anglin

On 22-Nov-14, at 2:25 AM, Richard Henderson wrote:


Probably better to use __builtin_trap, now that you've added it.
At least then the compiler knows there's no fallthrough from the
ABORT_INSTRUCTION path.


Good suggestion.  Added to my tree for testing.



Any chance someone wants to add this support to libatomic?
Currently pa is using the posix path, using locks.


Will take a look when I get a chance.

Dave
--
John David Anglin   dave.ang...@bell.net





[Patch, Fortran,committed] Re: Cosubscript issue

2014-11-22 Thread Tobias Burnus

On 19 November 2014 at 23:20, Tobias Burnus wrote:

Alessandro Fanfarillo wrote:

The sum of the three indexes, k, j and i returns a wrong image index.

Fixed as confirmed off list by the attached patch.

I intent to commit it as obvious once building and regtesting has 
finally finished.

Comments are nontheless welcome.


Took a while longer as it turned out that the test case didn't work for 
odd number of images. As testing showed, other compilers behave the same 
and codewise, I didn't understand:


+  if (MOD(num_images(),((P+1)*(Q+2))) .ge. 1) then
+ dim3_max = dim3_max+1
+  end if


And indeed, removing that code from the test case, it worked – and also the 
test program makes sense to me.

Hence, I have now committed the patch together with the fixed test case as Rev. 
217966.

Tobias

Index: gcc/fortran/ChangeLog
===
--- gcc/fortran/ChangeLog	(Revision 217965)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,7 @@
+2014-11-22  Tobias Burnus  bur...@net-b.de
+
+	* trans-expr.c (gfc_caf_get_image_index): Fix image calculation.
+
 2014-11-15  Tobias Burnus  bur...@net-b.de
 
 	* error.c (gfc_fatal_error_1): Renamed from gfc_fatal_error.
Index: gcc/fortran/trans-expr.c
===
--- gcc/fortran/trans-expr.c	(Revision 217965)
+++ gcc/fortran/trans-expr.c	(Arbeitskopie)
@@ -1518,8 +1518,8 @@ gfc_get_caf_token_offset (tree *token, tree *offse
 
 
 /* Convert the coindex of a coarray into an image index; the result is
-   image_num =  (idx(1)-lcobound(1)+1) + (idx(2)-lcobound(2)+1)*extent(1)
-  + (idx(3)-lcobound(3)+1)*extent(2) + ...  */
+   image_num =  (idx(1)-lcobound(1)+1) + (idx(2)-lcobound(2))*extent(1)
+  + (idx(3)-lcobound(3))*extend(1)*extent(2) + ...  */
 
 tree
 gfc_caf_get_image_index (stmtblock_t *block, gfc_expr *e, tree desc)
@@ -1553,8 +1553,10 @@ gfc_caf_get_image_index (stmtblock_t *block, gfc_e
 	if (i  ref-u.ar.dimen + ref-u.ar.codimen - 1)
 	  {
 	ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[i]);
-	extent = gfc_conv_array_extent_dim (lbound, ubound, NULL);
-	extent = fold_convert (integer_type_node, extent);
+	tmp = gfc_conv_array_extent_dim (lbound, ubound, NULL);
+	tmp = fold_convert (integer_type_node, tmp);
+	extent = fold_build2_loc (input_location, MULT_EXPR,
+  integer_type_node, extent, tmp);
 	  }
   }
   else
@@ -1575,10 +1577,12 @@ gfc_caf_get_image_index (stmtblock_t *block, gfc_e
 	  {
 	ubound = GFC_TYPE_ARRAY_UBOUND (TREE_TYPE (desc), i);
 	ubound = fold_convert (integer_type_node, ubound);
-	extent = fold_build2_loc (input_location, MINUS_EXPR,
+	tmp = fold_build2_loc (input_location, MINUS_EXPR,
   integer_type_node, ubound, lbound);
-	extent = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node,
-  extent, integer_one_node);
+	tmp = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node,
+   tmp, integer_one_node);
+	extent = fold_build2_loc (input_location, MULT_EXPR,
+  integer_type_node, extent, tmp);
 	  }
   }
   img_idx = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node,
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog	(Revision 217965)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,7 @@
+2014-11-22  Tobias Burnus  bur...@net-b.de
+
+	* gfortran.dg/coarray/cosubscript_1.f90: New.
+
 2014-11-22  Eric Botcazou  ebotca...@adacore.com
 
 	* gnat.dg/specs/pack11.ads: New test.
Index: gcc/testsuite/gfortran.dg/coarray/cosubscript_1.f90
===
--- gcc/testsuite/gfortran.dg/coarray/cosubscript_1.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/coarray/cosubscript_1.f90	(Arbeitskopie)
@@ -0,0 +1,66 @@
+! { dg-do run }
+!
+! From the HPCTools Group of University of Houston
+!
+! For a coindexed object, its cosubscript list determines the image
+! index in the same way that a subscript list determines the subscript
+! order value for an array element
+
+! Run at least with 3 images for the normal checking code
+! Modified to also accept a single or two images
+program cosubscript_test
+  implicit none
+  
+  integer, parameter :: X = 3, Y = 2
+  integer, parameter :: P = 1, Q = -1
+  integer :: me
+  integer :: i,j,k
+  
+  integer :: scalar[0:P, -1:Q, *]
+  
+  integer :: dim3_max, counter
+  logical :: is_err
+  
+  is_err = .false.
+  me = this_image()
+  scalar   = me
+  dim3_max = num_images() / ( (P+1)*(Q+2) )
+  
+  sync all
+
+  if (num_images() == 1) then
+k = 1
+j = -1
+i = 0
+if (scalar[i,j,k] /= this_image()) call abort
+stop OK
+  else if (num_images() == 2) then
+k = 1
+j = -1
+counter = 0
+do i = 0,P
+  counter = counter+1
+  if (counter /= scalar[i,j,k]) call abort()
+end do
+ 

[PATCH] Check for strtol, strtoul, strtoll and strtoull declarations

2014-11-22 Thread John David Anglin

This patch fixes PR other/63694.

Libiberty now contains implementations for strtol, strtoul, strtoll  
and strtoull.  On systems which
lack one or more of these functions, we need to check for their  
declaration in configure.  This results
in the correct defines being generated in config.h and auto-host.h.   
Then, the declarations for

these functions in libiberty.h are appropriated enabled.

Tested on hppa2.0w-hp-hpux11.11.

OK for trunk.

Dave
--
John David Anglin   dave.ang...@bell.net


libiberty ChangeLog:
2014-11-22  John David Anglin  dang...@gcc.gnu.org

PR other/63694
* configure.ac: Check for strtol, strtoul, strtoll and strtoull
declarations.
* configure: Regenerated.

gcc ChangeLog:
2014-11-22  John David Anglin  dang...@gcc.gnu.org

PR other/63694
* configure.ac: Check for strtol, strtoul, strtoll and strtoull
declarations.
* configure: Regenerated.
* config.in: Regenerated.

Index: libiberty/configure.ac
===
--- libiberty/configure.ac  (revision 217956)
+++ libiberty/configure.ac  (working copy)
@@ -678,6 +678,7 @@
   AC_CHECK_FUNCS($checkfuncs)
   AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, 
vsnprintf])
   AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk])
+  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
   AC_CHECK_DECLS([strverscmp])
   libiberty_NEED_DECLARATION(canonicalize_file_name)
 fi
Index: gcc/configure.ac
===
--- gcc/configure.ac(revision 217956)
+++ gcc/configure.ac(working copy)
@@ -1213,6 +1213,7 @@
 CXXFLAGS=$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC
 gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
stpcpy strnlen strsignal strstr strverscmp \
+   strtol strtoul strtoll strtoull \
errno snprintf vsnprintf vasprintf malloc realloc calloc \
free basename getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
 #include ansidecl.h


Re: [PATCH] Check for strtol, strtoul, strtoll and strtoull declarations

2014-11-22 Thread Jakub Jelinek
On Sat, Nov 22, 2014 at 09:40:58AM -0500, John David Anglin wrote:
 libiberty ChangeLog:
 2014-11-22  John David Anglin  dang...@gcc.gnu.org
 
   PR other/63694
   * configure.ac: Check for strtol, strtoul, strtoll and strtoull
   declarations.
   * configure: Regenerated.
 
 gcc ChangeLog:
 2014-11-22  John David Anglin  dang...@gcc.gnu.org
 
   PR other/63694
   * configure.ac: Check for strtol, strtoul, strtoll and strtoull
   declarations.
   * configure: Regenerated.
   * config.in: Regenerated.

Looks reasonable to me, but I'll defer it to Ian as libiberty maintainer.

 Index: libiberty/configure.ac
 ===
 --- libiberty/configure.ac(revision 217956)
 +++ libiberty/configure.ac(working copy)
 @@ -678,6 +678,7 @@
AC_CHECK_FUNCS($checkfuncs)
AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, 
 vsnprintf])
AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk])
 +  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
AC_CHECK_DECLS([strverscmp])
libiberty_NEED_DECLARATION(canonicalize_file_name)
  fi
 Index: gcc/configure.ac
 ===
 --- gcc/configure.ac  (revision 217956)
 +++ gcc/configure.ac  (working copy)
 @@ -1213,6 +1213,7 @@
  CXXFLAGS=$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC
  gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
   stpcpy strnlen strsignal strstr strverscmp \
 + strtol strtoul strtoll strtoull \
   errno snprintf vsnprintf vasprintf malloc realloc calloc \
   free basename getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[
  #include ansidecl.h


Jakub


Re: [PATCH] IPA ICF: memory leak fix

2014-11-22 Thread Martin Liška
On 11/22/2014 10:09 AM, Markus Trippelsdorf wrote:
 On 2014.11.22 at 09:05 +0100, Martin Liška wrote:
 Hello.

 Following patch removes memory leak that was introduced by very first IPA 
 ICF patch.
 I would like to thank David for hunting the leak.

 Patch an bootstrap on x86_86-linux-pc and no regression is introduced.
 
 I gave the patch a quick spin on gcc112:
 
 *** Error in `/home/trippels/gcc_build_dir/./prev-gcc/lto1': free(): invalid 
 next size (fast): 0x01000a5fc160 ***
 === Backtrace: =
 /lib64/libc.so.6(+0xa3d9c)[0x3fff7b6b3d9c]
 /lib64/libc.so.6(+0xaf0b4)[0x3fff7b6bf0b4]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN3vecIi7va_heap6vl_ptrE7releaseEv-0x1d4bc00)[0x1025dd88]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12sem_function14equals_privateEPNS_8sem_itemER8hash_mapIP11symtab_nodeS2_22default_hashmap_traitsE-0x9c083c)[0x116586bc]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12sem_function6equalsEPNS_8sem_itemER8hash_mapIP11symtab_nodeS2_22default_hashmap_traitsE-0x9c0578)[0x11658998]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf18sem_item_optimizer7executeEv-0x9b8774)[0x11660a84]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12pass_ipa_icf7executeEP8function-0x9b0314)[0x11668efc]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z16execute_one_passP8opt_pass-0x1647588)[0x1098a0a8]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z21execute_ipa_pass_listP8opt_pass-0x1644c2c)[0x1098ca7c]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z8lto_mainv-0x1df20e4)[0x101b494c]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1[0x10b599b8]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN6toplev4mainEiPPc-0x1e8be70)[0x101507b8]
 /home/trippels/gcc_build_dir/./prev-gcc/lto1(main-0x1ec8d8c)[0x1015493c]
 /lib64/libc.so.6(+0x447ac)[0x3fff7b6547ac]
 /lib64/libc.so.6(__libc_start_main-0x19cbf4)[0x3fff7b6549d4]
 === Memory map: 
 ...
 

Hello.

Thank you for testing, problem is that I should grow the vector by 1, because 
'0' is used as NULL value.

Please try my fixed patch.

Thanks,
Martin
From 7280e2c8de246c72d2608b5c58590f4fabaf6234 Mon Sep 17 00:00:00 2001
From: mliska mli...@suse.cz
Date: Fri, 21 Nov 2014 16:04:06 +0100
Subject: [PATCH] IPA ICF: memory leak fix

gcc/ChangeLog:

2014-11-21  David Malcolm  dmalc...@redhat.com
	Martin Liska  mli...@suse.cz

	* ipa-icf.c (sem_function::equals_private): auto_vecint replaces
	int* allocated with XNEWVEC.
	(sem_function::bb_dict_test): Likewise.
	* ipa-icf.h: Likewise.
---
 gcc/ipa-icf.c | 18 +-
 gcc/ipa-icf.h |  2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e0633e7..c8060bf 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -410,7 +410,6 @@ sem_function::equals_private (sem_item *item,
   basic_block bb1, bb2;
   edge e1, e2;
   edge_iterator ei1, ei2;
-  int *bb_dict = NULL;
   bool result = true;
   tree arg1, arg2;
 
@@ -489,8 +488,11 @@ sem_function::equals_private (sem_item *item,
   /* Basic block edges check.  */
   for (unsigned i = 0; i  bb_sorted.length (); ++i)
 {
-  bb_dict = XNEWVEC (int, bb_sorted.length () + 2);
-  memset (bb_dict, -1, (bb_sorted.length () + 2) * sizeof (int));
+  auto_vecint bb_dict;
+  /* Size of bb_dict is number of basic blocks plus
+ 2 for entry and exit block and plus one because
+	 '0' is used as NULL value.  */
+  bb_dict.safe_grow_cleared (bb_sorted.length () + 3);
 
   bb1 = bb_sorted[i]-bb;
   bb2 = m_compared_func-bb_sorted[i]-bb;
@@ -957,9 +959,15 @@ sem_function::icf_handled_component_p (tree t)
corresponds to TARGET.  */
 
 bool
-sem_function::bb_dict_test (int* bb_dict, int source, int target)
+sem_function::bb_dict_test (auto_vecint bb_dict, int source, int target)
 {
-  if (bb_dict[source] == -1)
+  /* bb_dict is cleared with zeros, so that source and target are
+ incremented. bb_dist is used to verify that edges in source and
+ target function correspond. */
+
+  source++;
+  target++;
+  if (bb_dict[source] == 0)
 {
   bb_dict[source] = target;
   return true;
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index 046e858..75db93a 100644
--- a/gcc/ipa-icf.h
+++ b/gcc/ipa-icf.h
@@ -275,7 +275,7 @@ private:
 
   /* Basic blocks dictionary BB_DICT returns true if SOURCE index BB
  corresponds to TARGET.  */
-  bool bb_dict_test (int* bb_dict, int source, int target);
+  bool bb_dict_test (auto_vecint bb_dict, int source, int target);
 
   /* Iterates all tree types in T1 and T2 and returns true if all types
  are compatible. If COMPARE_POLYMORPHIC is set to true,
-- 
2.1.2



[SH][committed] FIx PR 63986

2014-11-22 Thread Oleg Endo
Hi,

The attached patch fixes PR 63986.
Tested with
make -k check RUNTESTFLAGS=--target_board=sh-sim\{-m4/-ml,-m4/-mb}
and no new failures.  Committed as r217968.

Cheers,
Oleg

gcc/ChangeLog:
PR target/63986
PR target/51244
* config/sh/sh.c (sh_is_logical_t_store_expr,
sh_try_omit_signzero_extend): Use rtx_insn* for insn argument.
(sh_split_movrt_negc_to_movt_xor): New function.
(sh_find_set_of_reg): Move to ...
* config/sh/sh-protos.h (sh_find_set_of_reg): ... here and convert
to template function.
(set_of_reg): Use rtx_insn* for insn member.
(sh_is_logical_t_store_expr, sh_try_omit_signzero_extend): Use
rtx_insn* for insn argument.
* config/sh/sh.md (movrt_negc, *movrt_negc): Split into movt-xor
sequence using new sh_split_movrt_negc_to_movt_xor function.
(movrt_xor): Allow also for SH2A.
(*movt_movrt): Delete insns and splits.

Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 217957)
+++ gcc/config/sh/sh.md	(working copy)
@@ -11445,13 +11445,21 @@
   DONE;
 })
 
-(define_insn movrt_negc
+(define_insn_and_split movrt_negc
   [(set (match_operand:SI 0 arith_reg_dest =r)
-	(xor:SI (match_operand:SI 1 t_reg_operand ) (const_int 1)))
+	(xor:SI (match_operand:SI 1 t_reg_operand) (const_int 1)))
(set (reg:SI T_REG) (const_int 1))
(use (match_operand:SI 2 arith_reg_operand r))]
   TARGET_SH1
   negc	%2,%0
+   1
+  [(const_int 0)]
+{
+  if (sh_split_movrt_negc_to_movt_xor (curr_insn, operands))
+DONE;
+  else
+FAIL;
+}
   [(set_attr type arith)])
 
 ;; The -1 constant will not be CSE-ed for the *movrt_negc pattern, but the
@@ -11460,17 +11468,25 @@
 ;; generating a pseudo reg before reload.
 (define_insn_and_split *movrt_negc
   [(set (match_operand:SI 0 arith_reg_dest =r)
-	(xor:SI (match_operand:SI 1 t_reg_operand ) (const_int 1)))
+	(xor:SI (match_operand:SI 1 t_reg_operand) (const_int 1)))
(clobber (match_scratch:SI 2 =r))
(clobber (reg:SI T_REG))]
   TARGET_SH1  ! TARGET_SH2A
   #
-   reload_completed
-  [(set (match_dup 2) (const_int -1))
-   (parallel
-   [(set (match_dup 0) (xor:SI (match_dup 1) (const_int 1)))
-	(set (reg:SI T_REG) (const_int 1))
-	(use (match_dup 2))])])
+   1
+  [(const_int 0)]
+{
+  if (sh_split_movrt_negc_to_movt_xor (curr_insn, operands))
+DONE;
+  else if (reload_completed)
+{
+  emit_move_insn (operands[2], gen_int_mode (-1, SImode));
+  emit_insn (gen_movrt_negc (operands[0], operands[1], operands[2]));
+  DONE;
+}
+  else
+FAIL;
+})
 
 ;; Store the negated T bit in a reg using r0 and xor.  This one doesn't
 ;; clobber the T bit, which is useful when storing the T bit and the
@@ -11481,45 +11497,12 @@
   [(set (match_operand:SI 0 arith_reg_dest =z)
 	(xor:SI (match_operand:SI 1 t_reg_operand) (const_int 1)))
(use (reg:SI T_REG))]
-  TARGET_SH1  !TARGET_SH2A
+  TARGET_SH1
   #
reload_completed
   [(set (match_dup 0) (reg:SI T_REG))
(set (match_dup 0) (xor:SI (match_dup 0) (const_int 1)))])
 
-;; Store the T bit and the negated T bit in two regs in parallel.  There is
-;; no real insn to do that, but specifying this pattern will give combine
-;; some opportunities.
-(define_insn_and_split *movt_movrt
-  [(parallel [(set (match_operand:SI 0 arith_reg_dest)
-		   (match_operand:SI 1 negt_reg_operand))
-	  (set (match_operand:SI 2 arith_reg_dest)
-		   (match_operand:SI 3 t_reg_operand))])]
-  TARGET_SH1
-  #
-   1
-  [(const_int 0)]
-{
-  rtx i = TARGET_SH2A
-	  ? gen_movrt (operands[0], get_t_reg_rtx ())
-	  : gen_movrt_xor (operands[0], get_t_reg_rtx ());
-  
-  emit_insn (i);
-  emit_insn (gen_movt (operands[2], get_t_reg_rtx ()));
-  DONE;
-})
-
-(define_insn_and_split *movt_movrt
-  [(parallel [(set (match_operand:SI 0 arith_reg_dest)
-		   (match_operand:SI 1 t_reg_operand))
-	  (set (match_operand:SI 2 arith_reg_dest)
-		   (match_operand:SI 3 negt_reg_operand))])]
-  TARGET_SH1
-  #
-   1
-  [(parallel [(set (match_dup 2) (match_dup 3))
-	  (set (match_dup 0) (match_dup 1))])])
-
 ;; Use negc to store the T bit in a MSB of a reg in the following way:
 ;;	T = 1: 0x8000 - reg
 ;;	T = 0: 0x7FFF - reg
Index: gcc/config/sh/sh-protos.h
===
--- gcc/config/sh/sh-protos.h	(revision 217957)
+++ gcc/config/sh/sh-protos.h	(working copy)
@@ -165,7 +165,7 @@
 {
   /* The insn where sh_find_set_of_reg stopped looking.
  Can be NULL_RTX if the end of the insn list was reached.  */
-  rtx insn;
+  rtx_insn* insn;
 
   /* The set rtx of the specified reg if found, NULL_RTX otherwise.  */
   const_rtx set_rtx;
@@ -175,9 +175,47 @@
   rtx set_src;
 };
 
-extern set_of_reg sh_find_set_of_reg (rtx reg, rtx insn, rtx_insn *(*stepfunc)(rtx));
-extern bool sh_is_logical_t_store_expr (rtx op, rtx insn);
-extern rtx sh_try_omit_signzero_extend (rtx 

Re: [PATCH] Check for strtol, strtoul, strtoll and strtoull declarations

2014-11-22 Thread John David Anglin

On 22-Nov-14, at 9:50 AM, Jakub Jelinek wrote:


On Sat, Nov 22, 2014 at 09:40:58AM -0500, John David Anglin wrote:

libiberty ChangeLog:
2014-11-22  John David Anglin  dang...@gcc.gnu.org

PR other/63694
* configure.ac: Check for strtol, strtoul, strtoll and strtoull
declarations.
* configure: Regenerated.


I should have mentioned that config.in in libiberty doesn't need to be  
regenerated.


Dave
--
John David Anglin   dave.ang...@bell.net





Re: [PATCH] Work around in-tree gmp configure problems

2014-11-22 Thread Jan-Benedict Glaw
Hi!

On Sat, 2014-11-22 14:33:29 +0100, Bernd Edlinger bernd.edlin...@hotmail.de 
wrote:
 since r217627 we use an updated AutoMake missing script.  However
 that revealed a hidden bug in gmp-4.3.2's (up to gmp-6.0.0a)
 configure script.  That is: an in-tree gmp/configure fails now if
 flex is missing.  The gmp configure uses our missing flex script,
 and previously that emitted an error message and created a dummy
 lex.yy.c, The new version of that script does no longer create any
 lex.yy.c.
[...]
 This patch adds LEX=touch lex.yy.c to the in-tree gmp configure
 script, which does in fact the same thing as the flex tool when
 called under these conditions.
 
 I have tested gmp-4.3.2 and gmp-6.0.0a in-tree and boot-strapped
 under x86_64-linux-gnu successfully.
[...]
 2014-11-22  Bernd Edlinger  bernd.edlin...@hotmail.de
 
   * Makefile.def (module=gmp): Work around in-tree gmp configure
   bug with missing flex.
   * Makefile.in: Regenerated.

Bernd and I discussed that patch; I'm all for it! Looks like that's
the least-ugly thing we'd possibly come up with.

MfG, JBG

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
Signature of:  Fortschritt bedeutet, einen Schritt so zu machen,
the second  :   daß man den nächsten auch noch machen kann.


signature.asc
Description: Digital signature


[SH][committed] Fix PR 63783

2014-11-22 Thread Oleg Endo
Hi,

The attached patch fixes PR 63783.
Tested on trunk with
make -k check RUNTESTFLAGS=--target_board=sh-sim\{-m4/-ml,-m4/-mb}
and no new failures.
Tested on 4.9 branch with make all-gcc and verifying that the
problematic test case is OK.

Committed on trunk as r217969 and on 4.9 branch as r217970.

Cheers,
Oleg

gcc/ChangeLog:
PR target/63783
PR target/51244
* config/sh/sh_treg_combine.cc (sh_treg_combine::make_not_reg_insn):
Do not emit bitwise not insn.  Emit logical not insn sequence instead.
Adjust related comments throughout the file.

gcc/testsuite/ChangeLog:
PR target/63783
PR target/51244
* gcc.target/sh/torture/pr63783-1.c: New.
* gcc.target/sh/torture/pr63783-2.c: New.
* gcc.target/sh/pr51244-20.c: Adjust.
* gcc.target/sh/pr51244-20-sh2a.c: Adjust.
Index: gcc/config/sh/sh_treg_combine.cc
===
--- gcc/config/sh/sh_treg_combine.cc	(revision 217823)
+++ gcc/config/sh/sh_treg_combine.cc	(working copy)
@@ -95,14 +95,17 @@
 
 In [bb 4] elimination of the comparison would require inversion of the branch
 condition and compensation of other BBs.
-Instead an inverting reg-move can be used:
+Instead the comparison in [bb 3] can be replaced with the comparison in [bb 5]
+by using a reg-reg move.  In [bb 4] a logical not is used to compensate the
+inverted condition.
 
 [bb 3]
 (set (reg:SI 167) (reg:SI 173))
 - bb 5
 
 [BB 4]
-(set (reg:SI 167) (not:SI (reg:SI 177)))
+(set (reg:SI 147 t) (eq:SI (reg:SI 177) (const_int 0)))
+(set (reg:SI 167) (reg:SI 147 t))
 - bb 5
 
 [bb 5]
@@ -231,9 +234,9 @@
   and replace the comparisons in the BBs with reg-reg copies to get the
   operands in place (create new pseudo regs).
 
-- If the cstores differ, try to apply the special case
-(eq (reg) (const_int 0)) - inverted = (not (reg)).
-  for the subordinate cstore types and eliminate the dominating ones.
+- If the cstores differ and the comparison is a test against zero,
+  use reg-reg copies for the dominating cstores and logical not cstores
+  for the subordinate cstores.
 
 - If the comparison types in the BBs are not the same, or the first approach
   doesn't work out for some reason, try to eliminate the comparison before the
@@ -576,7 +579,8 @@
   bool can_extend_ccreg_usage (const bb_entry e,
 			   const cbranch_trace trace) const;
 
-  // Create an insn rtx that is a negating reg move (not operation).
+  // Create an insn rtx that performs a logical not (test != 0) on the src_reg
+  // and stores the result in dst_reg.
   rtx make_not_reg_insn (rtx dst_reg, rtx src_reg) const;
 
   // Create an insn rtx that inverts the ccreg.
@@ -907,12 +911,32 @@
 rtx
 sh_treg_combine::make_not_reg_insn (rtx dst_reg, rtx src_reg) const
 {
-  // This will to go through expanders and may output multiple insns
-  // for multi-word regs.
+  // On SH we can do only SImode and DImode comparisons.
+  if (! (GET_MODE (src_reg) == SImode || GET_MODE (src_reg) == DImode))
+return NULL;
+
+  // On SH we can store the ccreg into an SImode or DImode reg only.
+  if (! (GET_MODE (dst_reg) == SImode || GET_MODE (dst_reg) == DImode))
+return NULL;
+
   start_sequence ();
-  expand_simple_unop (GET_MODE (dst_reg), NOT, src_reg, dst_reg, 0);
+
+  emit_insn (gen_rtx_SET (VOIDmode, m_ccreg,
+			  gen_rtx_fmt_ee (EQ, SImode, src_reg, const0_rtx)));
+
+  if (GET_MODE (dst_reg) == SImode)
+emit_move_insn (dst_reg, m_ccreg);
+  else if (GET_MODE (dst_reg) == DImode)
+{
+  emit_move_insn (gen_lowpart (SImode, dst_reg), m_ccreg);
+  emit_move_insn (gen_highpart (SImode, dst_reg), const0_rtx);
+}
+  else
+gcc_unreachable ();
+
   rtx i = get_insns ();
   end_sequence ();
+
   return i;
 }
 
@@ -1095,7 +1119,12 @@
   // There is one special case though, where an integer comparison
   // (eq (reg) (const_int 0))
   // can be inverted with a sequence
-  // (eq (not (reg)) (const_int 0))
+  // (set (t) (eq (reg) (const_int 0))
+  // (set (reg) (t))
+  // (eq (reg) (const_int 0))
+  //
+  // FIXME: On SH2A it might be better to use the nott insn in this case,
+  // i.e. do the try_eliminate_cstores approach instead.
   if (inv_cstore_count != 0  cstore_count != 0)
 {
   if (make_not_reg_insn (comp_op0, comp_op0) == NULL_RTX)
Index: gcc/testsuite/gcc.target/sh/pr51244-20.c
===
--- gcc/testsuite/gcc.target/sh/pr51244-20.c	(revision 217823)
+++ gcc/testsuite/gcc.target/sh/pr51244-20.c	(working copy)
@@ -1,15 +1,15 @@
 /* Check that the SH specific sh_treg_combine RTL optimization pass works as
expected.  On SH2A the expected insns are slightly different, see
-   pr51244-21.c.  */
+   pr51244-20-sh2a.c.  */
 /* { dg-do compile }  */
 /* { dg-options -O2 } */
 /* { dg-skip-if  { sh*-*-* } { -m5* -m2a* } {  } } */
-/* { dg-final { 

Re: [PATCH] IPA ICF: memory leak fix

2014-11-22 Thread Markus Trippelsdorf
On 2014.11.22 at 16:04 +0100, Martin Liška wrote:
 On 11/22/2014 10:09 AM, Markus Trippelsdorf wrote:
  On 2014.11.22 at 09:05 +0100, Martin Liška wrote:
 
  Following patch removes memory leak that was introduced by very first IPA 
  ICF patch.
  I would like to thank David for hunting the leak.
 
  Patch an bootstrap on x86_86-linux-pc and no regression is introduced.
  
  I gave the patch a quick spin on gcc112:
  
  *** Error in `/home/trippels/gcc_build_dir/./prev-gcc/lto1': free(): 
  invalid next size (fast): 0x01000a5fc160 ***
  === Backtrace: =
  /lib64/libc.so.6(+0xa3d9c)[0x3fff7b6b3d9c]
  /lib64/libc.so.6(+0xaf0b4)[0x3fff7b6bf0b4]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN3vecIi7va_heap6vl_ptrE7releaseEv-0x1d4bc00)[0x1025dd88]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12sem_function14equals_privateEPNS_8sem_itemER8hash_mapIP11symtab_nodeS2_22default_hashmap_traitsE-0x9c083c)[0x116586bc]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12sem_function6equalsEPNS_8sem_itemER8hash_mapIP11symtab_nodeS2_22default_hashmap_traitsE-0x9c0578)[0x11658998]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf18sem_item_optimizer7executeEv-0x9b8774)[0x11660a84]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN7ipa_icf12pass_ipa_icf7executeEP8function-0x9b0314)[0x11668efc]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z16execute_one_passP8opt_pass-0x1647588)[0x1098a0a8]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z21execute_ipa_pass_listP8opt_pass-0x1644c2c)[0x1098ca7c]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_Z8lto_mainv-0x1df20e4)[0x101b494c]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1[0x10b599b8]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(_ZN6toplev4mainEiPPc-0x1e8be70)[0x101507b8]
  /home/trippels/gcc_build_dir/./prev-gcc/lto1(main-0x1ec8d8c)[0x1015493c]
  /lib64/libc.so.6(+0x447ac)[0x3fff7b6547ac]
  /lib64/libc.so.6(__libc_start_main-0x19cbf4)[0x3fff7b6549d4]
  === Memory map: 
  ...
  
 
 Thank you for testing, problem is that I should grow the vector by 1, because 
 '0' is used as NULL value.
 
 Please try my fixed patch.

This one survives bootstrap-lto. Thanks.

-- 
Markus


Re: Fix vectorizer conditions on updating alignment

2014-11-22 Thread H.J. Lu
On Thu, Jun 12, 2014 at 3:14 PM, Jan Hubicka hubi...@ucw.cz wrote:
 Hi,
 while updating vect_can_force_dr_alignment_p for section API I noticed the
 predicate is bit confused about when it can update the alignment.

 We need to check that decl_binds_to_current_def_p and in case we compile
 a partition also that the symbol is not homed in other partition.
 Previous code was wrong i.e. for COMDATs, weaks or -fpic.

 Also when having an alias, only way to promote the alignment is to bump
 up alignment of target.

 On the other hand comment about DECL_IN_CONSTANT_POOL seems confused - we have
 no sharing across partitions. I assume it was old hack and removed it.

 I also see no reason for disregarding DECL_PRESERVE - we only update
 alignment that should not disturb whatever magic user does. But I kept
 it.

 We probably should separate the logic into symtab predicate - it just checks 
 if
 we can change definition of variable to meet our needs. I can do that
 incrementally.

 Bootstrapped/regtested x86_64-linux, comitted.

 Honza

 * tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Reorg
 to use symtab and decl_binds_to_current_def_p
 * tree-vectorizer.c (increase_alignment): Increase alignment
 of alias target, too.

It caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64028

H.J.


Re: Fix vectorizer conditions on updating alignment

2014-11-22 Thread Richard Biener
On November 22, 2014 6:38:03 PM CET, H.J. Lu hjl.to...@gmail.com wrote:
On Thu, Jun 12, 2014 at 3:14 PM, Jan Hubicka hubi...@ucw.cz wrote:
 Hi,
 while updating vect_can_force_dr_alignment_p for section API I
noticed the
 predicate is bit confused about when it can update the alignment.

 We need to check that decl_binds_to_current_def_p and in case we
compile
 a partition also that the symbol is not homed in other partition.
 Previous code was wrong i.e. for COMDATs, weaks or -fpic.

 Also when having an alias, only way to promote the alignment is to
bump
 up alignment of target.

 On the other hand comment about DECL_IN_CONSTANT_POOL seems confused
- we have
 no sharing across partitions. I assume it was old hack and removed
it.

It's quite recent and it will break Ada iirc.

Richard.


 I also see no reason for disregarding DECL_PRESERVE - we only update
 alignment that should not disturb whatever magic user does. But I
kept
 it.

 We probably should separate the logic into symtab predicate - it just
checks if
 we can change definition of variable to meet our needs. I can do that
 incrementally.

 Bootstrapped/regtested x86_64-linux, comitted.

 Honza

 * tree-vect-data-refs.c (vect_can_force_dr_alignment_p):
Reorg
 to use symtab and decl_binds_to_current_def_p
 * tree-vectorizer.c (increase_alignment): Increase alignment
 of alias target, too.

It caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64028

H.J.




Re: [PATCH, PR 63551] Use proper type in evaluate_conditions_for_known_args

2014-11-22 Thread Richard Biener
On November 22, 2014 12:45:58 PM CET, Jakub Jelinek ja...@redhat.com wrote:
On Sat, Nov 22, 2014 at 12:09:46PM +0100, Martin Jambor wrote:
 2014-11-21  Martin Jambor  mjam...@suse.cz
 
  PR ipa/63551
  * ipa-inline-analysis.c (evaluate_conditions_for_known_args):
Convert
  value of the argument to the type of the value in the condition.
 
 testsuite/
  * gcc.dg/ipa/pr63551.c: New test.
 
 
 Index: src/gcc/ipa-inline-analysis.c
 ===
 --- src.orig/gcc/ipa-inline-analysis.c
 +++ src/gcc/ipa-inline-analysis.c
 @@ -880,7 +880,10 @@ evaluate_conditions_for_known_args (stru
  }
if (c-code == IS_NOT_CONSTANT || c-code == CHANGED)
  continue;
 -  res = fold_binary_to_constant (c-code, boolean_type_node,
val, c-val);
 +  val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c-val), val);

VCE should only be used if the sizes of the types are the same.
Is that always the case here?

I hope so. But I also think it will simply not fold otherwise?

Richard.

   Jakub




Re: [PATCH x86] Increase PARAM_MAX_COMPLETELY_PEELED_INSNS when branch is costly

2014-11-22 Thread Richard Biener
On November 22, 2014 12:24:22 PM CET, Eric Botcazou ebotca...@adacore.com 
wrote:
 Yeah, but after a couple of pings for a generic change, we went the
target
 way.

That's a bit of a shame, the 400 - 100 change was very likely tested
only on 
x86-64 and nevetheless applied to the generic code, so the fix
repairing the 
damages should also be applied to the generic code.

A patch to bump the generic limit is OK.

Targets that dont want it can reduce it in target specific code.

Richard.




[PATCH, ciklplus]: Use -ffloat-store for 32bit x86 in cilk-plus/AN/builtin_fn_{custom,mutating}.c

2014-11-22 Thread Uros Bizjak
Hello!

These two tests fix PR target/63847 [1], where x87 excess precision
causes testcase to fail. The problem was triggered by -fpic, please
see the PR for analysis.

The patch adds -ffloat-store for 32bit x86 target, a standard and well
tested solution for this problem.

2014-11-22  Uros Bizjak  ubiz...@gmail.com

PR target/63847
* c-c++-common/cilk-plus/AN/builtin_fn_custom.c: Add -ffloat-store
for 32bit x86 targets.
* c-c++-common/cilk-plus/AN/builtin_fn_mutating.c: Ditto.

The patch was tested on x86_64-linux-gnu/-m32 {,-fpic}.

OK for mainline?

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63847

Uros.
Index: c-c++-common/cilk-plus/AN/builtin_fn_custom.c
===
--- c-c++-common/cilk-plus/AN/builtin_fn_custom.c   (revision 217961)
+++ c-c++-common/cilk-plus/AN/builtin_fn_custom.c   (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options -fcilkplus } */
+/* { dg-additional-options -ffloat-store { target { { i?86-*-* x86_64-*-* } 
 ilp32 } } } */
 
 #define NUMBER 100
 #if HAVE_IO
Index: c-c++-common/cilk-plus/AN/builtin_fn_mutating.c
===
--- c-c++-common/cilk-plus/AN/builtin_fn_mutating.c (revision 217961)
+++ c-c++-common/cilk-plus/AN/builtin_fn_mutating.c (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options -fcilkplus } */
+/* { dg-additional-options -ffloat-store { target { { i?86-*-* x86_64-*-* } 
 ilp32 } } } */
 
 #define NUMBER 100
 #if HAVE_IO


Re: [PATCH x86] Increase PARAM_MAX_COMPLETELY_PEELED_INSNS when branch is costly

2014-11-22 Thread Uros Bizjak
On Sat, Nov 22, 2014 at 7:38 PM, Richard Biener
richard.guent...@gmail.com wrote:
 On November 22, 2014 12:24:22 PM CET, Eric Botcazou ebotca...@adacore.com 
 wrote:
 Yeah, but after a couple of pings for a generic change, we went the
target
 way.

That's a bit of a shame, the 400 - 100 change was very likely tested
only on
x86-64 and nevetheless applied to the generic code, so the fix
repairing the
damages should also be applied to the generic code.

 A patch to bump the generic limit is OK.

 Targets that dont want it can reduce it in target specific code.

I have committed the attached patch:

2014-11-22  Uros Bizjak  ubiz...@gmail.com

* params.def (PARAM_MAX_COMPLETELY_PEELED_INSNS): Increase to 200.
* config/i386/i386.c (ix86_option_override_internal): Do not increase
PARAM_MAX_COMPLETELY_PEELED_INSNS.

Bootstrapped on x86_64-linux-gnu.

Uros.
Index: params.def
===
--- params.def  (revision 217961)
+++ params.def  (working copy)
@@ -303,7 +303,7 @@ DEFPARAM(PARAM_MAX_PEEL_BRANCHES,
 DEFPARAM(PARAM_MAX_COMPLETELY_PEELED_INSNS,
max-completely-peeled-insns,
The maximum number of insns of a completely peeled loop,
-   100, 0, 0)
+   200, 0, 0)
 /* The maximum number of peelings of a single loop that is peeled completely.  
*/
 DEFPARAM(PARAM_MAX_COMPLETELY_PEEL_TIMES,
max-completely-peel-times,
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 217961)
+++ config/i386/i386.c  (working copy)
@@ -4142,12 +4142,6 @@ ix86_option_override_internal (bool main_args_p,
 opts-x_param_values,
 opts_set-x_param_values);
 
-  /* Increase full peel max insns parameter for x86.  */
-  maybe_set_param_value (PARAM_MAX_COMPLETELY_PEELED_INSNS,
-200,
-opts-x_param_values,
-opts_set-x_param_values);
-
   /* Enable sw prefetching at -O3 for CPUS that prefetching is helpful.  */
   if (opts-x_flag_prefetch_loop_arrays  0
HAVE_prefetch


Re: [Patch] Improving jump-thread pass for PR 54742

2014-11-22 Thread Jeff Law

On 11/18/14 15:19, Sebastian Pop wrote:

The regions that we duplicate start inside a loop and stay inside the same loop,
and the jump threading path is not allowed to go in deeper nested loops.

The reason why we need to modify the sese duplication function is that the sese
region that we need to duplicate starts at an arbitrary place inside the loop,
whereas the current user of the sese duplication function tree-ssa-loop-ch.c:245
starts at the edge entering the loop and exits at the latch edge.


I'll leave the rest to Jeff but it looks good to me from an overall
structure.


Thanks for your review.

Sebastian

PS: Patch passed bootstrap and regtest on x86_64-linux.

PS: I have run some perf analysis with the patch:
- on a bootstrap of GCC I see 3209 FSM jump threads
- libpng and libjpeg contain FSM jump threads, the perf increase is in the 1%
   (measured on simulators and reduced data sets)
- coremark gets jump threaded (as expected)
- I'm setting up the llvm test-suite and I will report perf differences
So that's *far* more jump threads than I would expect this to find in a 
bootstrap of GCC -- like 3 orders of magnitude more than I'd expect to find.


I haven't dug deep, but the first level analysis is not encouraging.

Basically I used the trunk compiler with and without your patch to build 
gcc-4.7.3's cc1 (4.7.3 simply because that's what I last used this 
testing framework).  So that gives me two cc1s that I then use to 
compile a bunch of .i files under valgrind's (cachegrind) control.


valgrind --tool=cachegrind --cache-sim=no --branch-sim=yes ..

That gives me two hunks of data for each input file I test. 
Specifically I get the dynamic number of instructions and the dynamic 
number of branches executed.


For jump threading those values correspond directly to the effect we're 
looking for -- a reduction in dynamic conditional jumps and a reduction 
in dynamic instructions executed.  Typically the change in dynamic 
instructions executed is 2-3X the change in dynamic conditional jumps -- 
which makes sense as removing the conditional jump usually means we 
remove a comparison and possibly some setup code as well.


Consistently with your patch those values get worse.   Across the entire 
set of .i files I get


For the trunk:

instructions:1339016494968
branches: 243568982489

With your patch:

instructions:1339739533291
branches: 243806615986


So that's 723038323 more instructions and 237633497 more branches after 
installing your patch.  While we're looking a just under .1% regression 
in dynamic branches, that's a terrible result for this work.


I'm not sure if the threads you're optimizing are somehow hiding other 
jump threading opportunities or somehow hiding CSE-able jump conditions, 
mucking up a loop structure or something else but something very bad is 
happening here.


If I put Steve's patch through the same testing I get:

instructions:1339006760834
branches: 243565768224

Which you'll note is a *very* slight decrease of 3214265 dynamic 
branches as 9734134 total instructions executed.


So I think we need to dig deeper into why the branching behaviour of GCC 
gets noticeably worse with your patch when it should be as good as or 
better than without your patch.


I know when i was analyzing the last update to this code, I found cases 
where we're much better off taking the shorter jump threading path 
without a joiner rather than preferring the long path with a joiner. 
IIRC, the issue was that if we selected the joiner path, then the 
duplication would create another jump threading opportunity (the 
original, shorter path without a join) that wouldn't be seen until the 
next pass of jump threading.


Jeff




Re: [PATCH] Check for strtol, strtoul, strtoll and strtoull declarations

2014-11-22 Thread Ian Lance Taylor
Jakub Jelinek ja...@redhat.com writes:

 On Sat, Nov 22, 2014 at 09:40:58AM -0500, John David Anglin wrote:
 libiberty ChangeLog:
 2014-11-22  John David Anglin  dang...@gcc.gnu.org
 
  PR other/63694
  * configure.ac: Check for strtol, strtoul, strtoll and strtoull
  declarations.
  * configure: Regenerated.
 
 gcc ChangeLog:
 2014-11-22  John David Anglin  dang...@gcc.gnu.org
 
  PR other/63694
  * configure.ac: Check for strtol, strtoul, strtoll and strtoull
  declarations.
  * configure: Regenerated.
  * config.in: Regenerated.

 Looks reasonable to me, but I'll defer it to Ian as libiberty maintainer.

This is OK.

Thanks.

Ian


Re: [Patch, option handling] optc-gen.awk - support || in EnabledBy()

2014-11-22 Thread Manuel López-Ibáñez
For what is worth, the patch looks good to me, except that the form
EnabledBy(@var{opt} || @var{opt2} needs documentation in
doc/options.texi.

Perhaps it could be more condensed as (untested!):

Index: optc-gen.awk
===
--- optc-gen.awk(revision 217510)
+++ optc-gen.awk(working copy)
@@ -38,8 +38,16 @@
 for (i = 0; i  n_opts; i++) {
 enabledby_arg = opt_args(EnabledBy, flags[i]);
 if (enabledby_arg != ) {
-n_enabledby_names = split(enabledby_arg, enabledby_names,   );
-if (n_enabledby_names  2) {
+logical_and = index(enabledby_arg,   );
+if (logical_and != 0) {
+# EnabledBy(arg1  arg2)
+split_sep =   ;
+} else {
+# EnabledBy(arg) or EnabledBy(arg1 || arg2 || arg3)
+split_sep =  \\|\\| ;
+}
+n_enabledby_names = split(enabledby_arg, enabledby_names, split_sep);
+if (logical_and != 0  n_enabledby_names  2) {
 print #error EnabledBy (Wfoo  Wbar  Wbaz) not
currently supported
 }
 for (j = 1; j = n_enabledby_names; j++) {
@@ -49,7 +57,7 @@
 print #error Enabledby:  enabledby_name
 } else {
 condition = ;
-if (n_enabledby_names == 2) {
+if (logical_and != 0) {
 opt_var_name_1 =
search_var_name(enabledby_names[1], opt_numbers, opts, flags, n_opts);
 opt_var_name_2 =
search_var_name(enabledby_names[2], opt_numbers, opts, flags, n_opts);
 if (opt_var_name_1 == ) {

If I recall correctly, there are several -W* flags in common.opt and
c-family/c.opt that benefit from this cleanup (Wpointer-sign being
one). It would be nice to convert them to the new format together with
the patch.

A version handling LangEnabledBy(Lang, Wx || Wy) should be fairly
similar and probably even more useful, if you wish to fix also that.

Cheers,

Manuel.


[Committed/AARCH64] Fix gcc.target/aarch64/test_frame_*.c testcases after ccmp patches

2014-11-22 Thread Andrew Pinski
Hi,
  After the conditional compare patches, the some of the
gcc.target/aarch64/test_frame_*.c testcases start to fail.  This was
due to no longer duplicating simple_return and causing the epilogue to
be duplicated.

This changes the testcases to expect the non duplicated epilogue.

Committed as obvious after a test of aarch64-elf.

Thanks,
Andrew Pinski

ChangeLog:
* gcc.target/aarch64/test_frame_1.c: Expect only two loads of x30 (in
the epilogue).
* gcc.target/aarch64/test_frame_6.c: Likewise.
* gcc.target/aarch64/test_frame_2.c: Expect only one pair load of x30
and x19 (in the epilogue).
* gcc.target/aarch64/test_frame_4.c: Likewise.
* gcc.target/aarch64/test_frame_7.c: Likewise.
Index: testsuite/gcc.target/aarch64/test_frame_1.c
===
--- testsuite/gcc.target/aarch64/test_frame_1.c (revision 217974)
+++ testsuite/gcc.target/aarch64/test_frame_1.c (working copy)
@@ -14,6 +14,6 @@ t_frame_pattern (test1, 200, )
 t_frame_run (test1)
 
 /* { dg-final { scan-assembler-times str\tx30, \\\[sp, -\[0-9\]+\\\]! 2 } } 
*/
-/* { dg-final { scan-assembler-times ldr\tx30, \\\[sp\\\], \[0-9\]+ 3 } } */
+/* { dg-final { scan-assembler-times ldr\tx30, \\\[sp\\\], \[0-9\]+ 2 } } */
 
 /* { dg-final { cleanup-saved-temps } } */
Index: testsuite/gcc.target/aarch64/test_frame_2.c
===
--- testsuite/gcc.target/aarch64/test_frame_2.c (revision 217974)
+++ testsuite/gcc.target/aarch64/test_frame_2.c (working copy)
@@ -15,6 +15,6 @@ t_frame_run (test2)
 
 
 /* { dg-final { scan-assembler-times stp\tx19, x30, \\\[sp, -\[0-9\]+\\\]! 1 
} } */
-/* { dg-final { scan-assembler-times ldp\tx19, x30, \\\[sp\\\], \[0-9\]+ 2 } 
} */
+/* { dg-final { scan-assembler-times ldp\tx19, x30, \\\[sp\\\], \[0-9\]+ 1 } 
} */
 
 /* { dg-final { cleanup-saved-temps } } */
Index: testsuite/gcc.target/aarch64/test_frame_4.c
===
--- testsuite/gcc.target/aarch64/test_frame_4.c (revision 217974)
+++ testsuite/gcc.target/aarch64/test_frame_4.c (working copy)
@@ -14,6 +14,6 @@ t_frame_pattern (test4, 400, x19)
 t_frame_run (test4)
 
 /* { dg-final { scan-assembler-times stp\tx19, x30, \\\[sp, -\[0-9\]+\\\]! 1 
} } */
-/* { dg-final { scan-assembler-times ldp\tx19, x30, \\\[sp\\\], \[0-9\]+ 2 } 
} */
+/* { dg-final { scan-assembler-times ldp\tx19, x30, \\\[sp\\\], \[0-9\]+ 1 } 
} */
 
 /* { dg-final { cleanup-saved-temps } } */
Index: testsuite/gcc.target/aarch64/test_frame_6.c
===
--- testsuite/gcc.target/aarch64/test_frame_6.c (revision 217974)
+++ testsuite/gcc.target/aarch64/test_frame_6.c (working copy)
@@ -15,6 +15,6 @@ t_frame_pattern (test6, 700, )
 t_frame_run (test6)
 
 /* { dg-final { scan-assembler-times str\tx30, \\\[sp, -\[0-9\]+\\\]! 2 } } 
*/
-/* { dg-final { scan-assembler-times ldr\tx30, \\\[sp\\\], \[0-9\]+ 3 } } */
+/* { dg-final { scan-assembler-times ldr\tx30, \\\[sp\\\], \[0-9\]+ 2 } } */
 
 /* { dg-final { cleanup-saved-temps } } */
Index: testsuite/gcc.target/aarch64/test_frame_7.c
===
--- testsuite/gcc.target/aarch64/test_frame_7.c (revision 217974)
+++ testsuite/gcc.target/aarch64/test_frame_7.c (working copy)
@@ -15,6 +15,6 @@ t_frame_pattern (test7, 700, x19)
 t_frame_run (test7)
 
 /* { dg-final { scan-assembler-times stp\tx19, x30, \\\[sp, -\[0-9\]+\\\]! 1 
} } */
-/* { dg-final { scan-assembler-times ldp\tx19, x30, \\\[sp\\\], \[0-9\]+ 2 } 
} */
+/* { dg-final { scan-assembler-times ldp\tx19, x30, \\\[sp\\\], \[0-9\]+ 1 } 
} */
 
 /* { dg-final { cleanup-saved-temps } } */


[PATCH/AARCH64] v2 Add aligning of functions/loops/jumps

2014-11-22 Thread Andrew Pinski
Hi,
  This is just a rebase of
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01615.html as requested
by https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01736.html.  Nothing
has changed in it.

OK?  Built and tested on aarch64-elf with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

* config/aarch64/aarch64-protos.h (tune_params): Add align field.
* config/aarch64/aarch64.c (generic_tunings): Specify align.
(cortexa53_tunings): Likewise.
(cortexa57_tunings): Likewise.
(thunderx_tunings): Likewise.
(aarch64_override_options): Set align_loops, align_jumps,
align_functions based on what the tuning struct.
Index: config/aarch64/aarch64-protos.h
===
--- config/aarch64/aarch64-protos.h (revision 217974)
+++ config/aarch64/aarch64-protos.h (working copy)
@@ -170,6 +170,7 @@ struct tune_params
   const struct cpu_vector_cost *const vec_costs;
   const int memmov_cost;
   const int issue_rate;
+  const int align;
 };
 
 HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned);
Index: config/aarch64/aarch64.c
===
--- config/aarch64/aarch64.c(revision 217974)
+++ config/aarch64/aarch64.c(working copy)
@@ -314,7 +314,8 @@ static const struct tune_params generic_
   generic_regmove_cost,
   generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (align, 2),
 };
 
 static const struct tune_params cortexa53_tunings =
@@ -324,7 +325,8 @@ static const struct tune_params cortexa5
   cortexa53_regmove_cost,
   generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (align, 8),
 };
 
 static const struct tune_params cortexa57_tunings =
@@ -334,7 +336,8 @@ static const struct tune_params cortexa5
   cortexa57_regmove_cost,
   cortexa57_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 3)
+  NAMED_PARAM (issue_rate, 3),
+  NAMED_PARAM (align, 8),
 };
 
 static const struct tune_params thunderx_tunings =
@@ -344,7 +347,8 @@ static const struct tune_params thunderx
   thunderx_regmove_cost,
   generic_vector_cost,
   NAMED_PARAM (memmov_cost, 6),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (align, 8),
 };
 
 /* A processor implementing AArch64.  */
@@ -6727,6 +6731,18 @@ aarch64_override_options (void)
 #endif
 }
 
+  /* If not opzimizing for size, set the default
+ alignment to what the target wants */
+  if (!optimize_size)
+{
+  if (align_loops = 0)
+   align_loops = aarch64_tune_params-align;
+  if (align_jumps = 0)
+   align_jumps = aarch64_tune_params-align;
+  if (align_functions = 0)
+   align_functions = aarch64_tune_params-align;
+}
+
   aarch64_override_options_after_change ();
 }
 


[PATCH v2] gcc/c-family/c-cppbuiltin.c: Let buffer enough to print host wide integer value

2014-11-22 Thread Chen Gang
The original length 18 is not enough for HOST_WIDE_INT printing, need
use 20 instead of.

Also need additional bytes for printing related prefix and suffix, and
define the related macro in hwint.h.

It passes testsuite under fedora 20 x86_64-unknown-linux-gnu.


2014-11-23  Chen Gang gang.chen.5...@gmail.com 

* c-family/c-cppbuiltin.c (builtin_define_with_int_value): Let
buffer enough to print host wide integer value.
---
 gcc/c-family/c-cppbuiltin.c | 30 +++---
 gcc/hwint.h |  6 ++
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index c571d1b..88a717b 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1366,15 +1366,31 @@ static void
 builtin_define_with_int_value (const char *macro, HOST_WIDE_INT value)
 {
   char *buf;
-  size_t mlen = strlen (macro);
-  size_t vlen = 18;
-  size_t extra = 2; /* space for = and NUL.  */
+  size_t vlen = 20; /* maximize value length: -9223372036854775807 */
+  size_t extra = 6; /* space for =, NUL, (, ), and L L. */
+
+  gcc_assert (wi::fits_to_tree_p(value, integer_type_node));
 
-  buf = (char *) alloca (mlen + vlen + extra);
-  memcpy (buf, macro, mlen);
-  buf[mlen] = '=';
-  sprintf (buf + mlen + 1, HOST_WIDE_INT_PRINT_DEC, value);
+  buf = (char *) alloca (strlen(macro) + vlen + extra);
 
+  if (value = 0)
+{
+  sprintf (buf, %s=HOST_WIDE_INT_PRINT_DEC%s,
+  macro, value,
+  value = HOST_INT_MAX
+  ? 
+  : value = HOST_LONG_MAX
+? L : LL);
+}
+  else
+{
+  sprintf (buf, %s=(HOST_WIDE_INT_PRINT_DEC%s),
+  macro, value,
+  value  HOST_INT_MIN
+  ? 
+  : value  HOST_LONG_MIN
+? L : LL);
+}
   cpp_define (parse_in, buf);
 }
 
diff --git a/gcc/hwint.h b/gcc/hwint.h
index fd961fd..3aecba3 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -225,6 +225,12 @@ exact_log2 (unsigned HOST_WIDE_INT x)
 
 #endif /* GCC_VERSION = 3004 */
 
+#define HOST_INT_MIN (int) ((unsigned int) 1  (HOST_BITS_PER_INT - 1))
+#define HOST_INT_MAX (~(HOST_INT_MIN))
+
+#define HOST_LONG_MIN (long) ((unsigned long) 1  (HOST_BITS_PER_LONG - 1))
+#define HOST_LONG_MAX (~(HOST_LONG_MIN))
+
 #define HOST_WIDE_INT_MIN (HOST_WIDE_INT) \
   ((unsigned HOST_WIDE_INT) 1  (HOST_BITS_PER_WIDE_INT - 1))
 #define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN))
-- 
1.9.3


[PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2014-11-22 Thread Chen Gang
According to the next code, 'pretty_name' may need additional bytes more
than 16 (may have unlimited length for array type). These is a easy way
for it: use 'pretty_print' for 'pretty_name'.

And not all integers are fit into tree_to_uhwi(), so also need
'wide_int' for it.

Let the code meet 2 white spaces alignment coding styles (originally,
some of code is 1 white space alignment).

It passes testsuite under fedora 20 x86)64-unknown-linux-gnu.


2014-11-23  Chen Gang  gang.chen.5...@gmail.com

* ubsan.c (ubsan_type_descriptor): Use 'pretty_print' for
'pretty_name' to avoid memory overflow.
---
 gcc/ubsan.c | 63 +
 1 file changed, 34 insertions(+), 29 deletions(-)

diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index b3d5343..3fceff7 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -369,7 +369,7 @@ ubsan_type_descriptor (tree type, enum ubsan_print_style 
pstyle)
   tree dtype = ubsan_get_type_descriptor_type ();
   tree type2 = type;
   const char *tname = NULL;
-  char *pretty_name;
+  pretty_printer pretty_name;
   unsigned char deref_depth = 0;
   unsigned short tkind, tinfo;
 
@@ -408,54 +408,58 @@ ubsan_type_descriptor (tree type, enum ubsan_print_style 
pstyle)
 /* We weren't able to determine the type name.  */
 tname = unknown;
 
-  /* Decorate the type name with '', '*', struct, or union.  */
-  pretty_name = (char *) alloca (strlen (tname) + 16 + deref_depth);
   if (pstyle == UBSAN_PRINT_POINTER)
 {
-  int pos = sprintf (pretty_name, '%s%s%s%s%s%s%s,
-TYPE_VOLATILE (type2) ? volatile  : ,
-TYPE_READONLY (type2) ? const  : ,
-TYPE_RESTRICT (type2) ? restrict  : ,
-TYPE_ATOMIC (type2) ? _Atomic  : ,
-TREE_CODE (type2) == RECORD_TYPE
-? struct 
-: TREE_CODE (type2) == UNION_TYPE
-  ? union  : , tname,
-deref_depth == 0 ?  :  );
+  pp_printf (pretty_name, '%s%s%s%s%s%s%s,
+TYPE_VOLATILE (type2) ? volatile  : ,
+TYPE_READONLY (type2) ? const  : ,
+TYPE_RESTRICT (type2) ? restrict  : ,
+TYPE_ATOMIC (type2) ? _Atomic  : ,
+TREE_CODE (type2) == RECORD_TYPE
+? struct 
+: TREE_CODE (type2) == UNION_TYPE
+  ? union  : , tname,
+deref_depth == 0 ?  :  );
   while (deref_depth--  0)
-pretty_name[pos++] = '*';
-  pretty_name[pos++] = '\'';
-  pretty_name[pos] = '\0';
+   pp_star (pretty_name);
+  pp_quote (pretty_name);
 }
   else if (pstyle == UBSAN_PRINT_ARRAY)
 {
   /* Pretty print the array dimensions.  */
   gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
   tree t = type;
-  int pos = sprintf (pretty_name, '%s , tname);
+  pp_printf (pretty_name, '%s , tname);
   while (deref_depth--  0)
-pretty_name[pos++] = '*';
+   pp_star (pretty_name);
   while (TREE_CODE (t) == ARRAY_TYPE)
{
- pretty_name[pos++] = '[';
+ pp_left_bracket (pretty_name);
  tree dom = TYPE_DOMAIN (t);
  if (dom  TREE_CODE (TYPE_MAX_VALUE (dom)) == INTEGER_CST)
-   pos += sprintf (pretty_name[pos], HOST_WIDE_INT_PRINT_DEC,
+   {
+ if (tree_fits_uhwi_p (TYPE_MAX_VALUE (dom))
+  tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1 != 0)
+   pp_printf (pretty_name, HOST_WIDE_INT_PRINT_DEC,
tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1);
+ else
+   pp_wide_int(pretty_name,
+   wi::add (wi::to_widest (TYPE_MAX_VALUE (dom)), 1),
+   TYPE_SIGN (TREE_TYPE (dom)));
+   }
  else
/* ??? We can't determine the variable name; print VLA unspec.  */
-   pretty_name[pos++] = '*';
- pretty_name[pos++] = ']';
+   pp_star (pretty_name);
+ pp_right_bracket (pretty_name);
  t = TREE_TYPE (t);
}
-  pretty_name[pos++] = '\'';
-  pretty_name[pos] = '\0';
+  pp_quote (pretty_name);
 
- /* Save the tree with stripped types.  */
- type = t;
+  /* Save the tree with stripped types.  */
+  type = t;
 }
   else
-sprintf (pretty_name, '%s', tname);
+pp_printf (pretty_name, '%s', tname);
 
   switch (TREE_CODE (type))
 {
@@ -492,8 +496,9 @@ ubsan_type_descriptor (tree type, enum ubsan_print_style 
pstyle)
   DECL_IGNORED_P (decl) = 1;
   DECL_EXTERNAL (decl) = 0;
 
-  size_t len = strlen (pretty_name);
-  tree str = build_string (len + 1, pretty_name);
+  const char *tmp = pp_formatted_text (pretty_name);
+  size_t len = strlen (tmp);
+  tree str = build_string (len + 1, tmp);
   TREE_TYPE (str) = build_array_type (char_type_node,
   

[PATCH] Improve shrink wrap for lo_sum

2014-11-22 Thread Andrew Pinski
Hi,
  As discussed at
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00997.html, this is the
one line patch which improves shrink wrapping for lo_sum.

OK?  Bootstrapped and tested on x86_64 and built and tested for
aarch64-elf with no regressions.  It fixes shrink_wrap_symbol_ref_1.c
which was failing with -mabi=ilp32.

Thanks,
Andrew

ChangeLog:
* shrink-wrap.c (move_insn_for_shrink_wrap): Allow LO_SUM also.
diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
index aae6643..3392cdb 100644
--- a/gcc/shrink-wrap.c
+++ b/gcc/shrink-wrap.c
@@ -248,6 +248,7 @@ move_insn_for_shrink_wrap (basic_block bb, rtx_insn *insn,
case SUBREG:
case STRICT_LOW_PART:
case PC:
+   case LO_SUM:
  /* Ok.  Continue.  */
  break;
 


[PATCH/TopLevel] Fix compiling libgo with a combined sources

2014-11-22 Thread Andrew Pinski
Hi,
  The problem here is here is that OBJCOPY is not being set to the
newly built objcopy when compiling libgo.  This patch adds
OBJCOPY_FOR_TARGET to the toplevel configure/Makefile so that when
libgo is compiled OBJCOPY is set to OBJCOPY_FOR_TARGET.

I noticed this issue when building an aarch64 cross compile on an
older system where objcopy did not understand aarch64.

OK?  Bootstrapped and tested on x86_64 with no regressions.  Also
tested with a combined build for a cross compiler to
aarch64-linux-gnu.

Thanks,
Andrew Pinski


* Makefile.def (flags_to_pass): Pass OBJCOPY_FOR_TARGET also.
* Makefile.tpl (HOST_EXPORTS): Add OBJCOPY_FOR_TARGET.
(BASE_TARGET_EXPORTS): Add OBJCOPY.
(OBJCOPY_FOR_TARGET): New variable.
(EXTRA_TARGET_FLAGS): Add OBJCOPY.
* Makefile.in: Regenerate.
* configure.ac: Check for already installed target objcopy.
Also GCC_TARGET_TOOL on objcopy.
* configure: Regenerate.
From 09f04f392049c0c3777f74f5e1cab29ca7357810 Mon Sep 17 00:00:00 2001
From: Andrew Pinski apin...@cavium.com
Date: Tue, 14 Oct 2014 23:14:58 -0700
Subject: [PATCH] 2014-10-14  Andrew Pinski  apin...@cavium.com

* Makefile.def (flags_to_pass): Pass OBJCOPY_FOR_TARGET also.
* Makefile.tpl (HOST_EXPORTS): Add OBJCOPY_FOR_TARGET.
(BASE_TARGET_EXPORTS): Add OBJCOPY.
(OBJCOPY_FOR_TARGET): New variable.
(EXTRA_TARGET_FLAGS): Add OBJCOPY.
* Makefile.in: Regenerate.
* configure.ac: Check for already installed target objcopy.
Also GCC_TARGET_TOOL on objcopy.
* configure: Regenerate.
---
 Makefile.def |1 +
 Makefile.in  |5 +
 Makefile.tpl |4 +
 configure|  276 ++
 configure.ac |2 +


diff --git a/Makefile.def b/Makefile.def
index 239ad36..a8ebe1a 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -280,6 +280,7 @@ flags_to_pass = { flag= LIBCFLAGS_FOR_TARGET ; };
 flags_to_pass = { flag= LIBCXXFLAGS_FOR_TARGET ; };
 flags_to_pass = { flag= NM_FOR_TARGET ; };
 flags_to_pass = { flag= OBJDUMP_FOR_TARGET ; };
+flags_to_pass = { flag= OBJCOPY_FOR_TARGET ; };
 flags_to_pass = { flag= RANLIB_FOR_TARGET ; };
 flags_to_pass = { flag= READELF_FOR_TARGET ; };
 flags_to_pass = { flag= STRIP_FOR_TARGET ; };
diff --git a/Makefile.in b/Makefile.in
index d6105b3..d34796d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -213,6 +213,7 @@ HOST_EXPORTS = \
LD_FOR_TARGET=$(LD_FOR_TARGET); export LD_FOR_TARGET; \
NM_FOR_TARGET=$(NM_FOR_TARGET); export NM_FOR_TARGET; \
OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET); export OBJDUMP_FOR_TARGET; \
+   OBJCOPY_FOR_TARGET=$(OBJCOPY_FOR_TARGET); export OBJCOPY_FOR_TARGET; \
RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET); export RANLIB_FOR_TARGET; \
READELF_FOR_TARGET=$(READELF_FOR_TARGET); export READELF_FOR_TARGET; \
TOPLEVEL_CONFIGURE_ARGUMENTS=$(TOPLEVEL_CONFIGURE_ARGUMENTS); export 
TOPLEVEL_CONFIGURE_ARGUMENTS; \
@@ -287,6 +288,7 @@ BASE_TARGET_EXPORTS = \
LIPO=$(LIPO_FOR_TARGET); export LIPO; \
NM=$(COMPILER_NM_FOR_TARGET); export NM; \
OBJDUMP=$(OBJDUMP_FOR_TARGET); export OBJDUMP; \
+   OBJCOPY=$(OBJCOPY_FOR_TARGET); export OBJCOPY; \
RANLIB=$(RANLIB_FOR_TARGET); export RANLIB; \
READELF=$(READELF_FOR_TARGET); export READELF; \
STRIP=$(STRIP_FOR_TARGET); export STRIP; \
@@ -539,6 +541,7 @@ LD_FOR_TARGET=@LD_FOR_TARGET@
 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
 NM_FOR_TARGET=@NM_FOR_TARGET@
 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
+OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
 READELF_FOR_TARGET=@READELF_FOR_TARGET@
 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
@@ -758,6 +761,7 @@ BASE_FLAGS_TO_PASS = \
LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET) \
NM_FOR_TARGET=$(NM_FOR_TARGET) \
OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET) \
+   OBJCOPY_FOR_TARGET=$(OBJCOPY_FOR_TARGET) \
RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET) \
READELF_FOR_TARGET=$(READELF_FOR_TARGET) \
STRIP_FOR_TARGET=$(STRIP_FOR_TARGET) \
@@ -855,6 +859,7 @@ EXTRA_TARGET_FLAGS = \
'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
'NM=$(COMPILER_NM_FOR_TARGET)' \
'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
+   'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
'RANLIB=$$(RANLIB_FOR_TARGET)' \
'READELF=$$(READELF_FOR_TARGET)' \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
diff --git a/Makefile.tpl b/Makefile.tpl
index f7c7e38..959dcb9 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -216,6 +216,7 @@ HOST_EXPORTS = \
LD_FOR_TARGET=$(LD_FOR_TARGET); export LD_FOR_TARGET; \
NM_FOR_TARGET=$(NM_FOR_TARGET); export NM_FOR_TARGET; \
OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET); export OBJDUMP_FOR_TARGET; \
+   OBJCOPY_FOR_TARGET=$(OBJCOPY_FOR_TARGET); export OBJCOPY_FOR_TARGET; \
RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET); export 

[Comitted/c++ testsuite] Fix initlist-lifetime*.C on some simulators

2014-11-22 Thread Andrew Pinski
Hi,
  On some simulators (Octeon simple-exec) argc can be greater than 2.
This causes  initlist-lifetime1.C and  initlist-lifetime2.C to fail.
To fix this, I use a volatile variable.

Committed as obvious after testing on x86_64.

Thanks,
Andrew Pinski

* g++.dg/cpp0x/initlist-lifetime1.C: Fix testcase where
argc is always greater than 1 (octeon simulator).
* g++.dg/cpp0x/initlist-lifetime2.C: Likewise.
Index: testsuite/g++.dg/cpp0x/initlist-lifetime1.C
===
--- testsuite/g++.dg/cpp0x/initlist-lifetime1.C (revision 217978)
+++ testsuite/g++.dg/cpp0x/initlist-lifetime1.C (working copy)
@@ -23,9 +23,11 @@ struct B {
   const AL alr;
 };
 
+volatile bool always_false = false;
+
 int main(int argc, const char** argv)
 {
-  do_throw = (argc  1);   // always false, but optimizer can't tell
+  do_throw = always_false; // always false, but optimizer can't tell
   AL ar[] = {{1,2},{3,4}};
   B b = {{5,6},{7,8}};
   AL3 al3 = {{{1},{2},{3}}};
Index: testsuite/g++.dg/cpp0x/initlist-lifetime2.C
===
--- testsuite/g++.dg/cpp0x/initlist-lifetime2.C (revision 217978)
+++ testsuite/g++.dg/cpp0x/initlist-lifetime2.C (working copy)
@@ -53,9 +53,11 @@ struct D {
   D() { ok = true; }
 };
 
+volatile bool always_false = false;
+
 int main(int argc, const char** argv)
 {
-  do_throw = (argc  1);   // always false, but optimizer can't tell
+  do_throw = always_false; // always false, but optimizer can't tell
   ok = false;
   C c;
   ok = false;


Merging configure bits with Binutils

2014-11-22 Thread Jan-Benedict Glaw
Hi!

This is my current patch series for GCC to merge all the config bits
from Binutils. It's not yet testet, but I'd like to post it early to
get feedback. That way, I hope to not forget something obvious.

MfG, JBG

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
Signature of:  GDB has a 'break' feature; why doesn't it have 'fix' too?
the second  :


signature.asc
Description: Digital signature


[PATCH RFC 3/4] Merge the ./config directory between GCC and Binutils

2014-11-22 Thread Jan-Benedict Glaw
This pulls in the missing Binutils pieces into the ./config
directory. Contains these missing Binutils changes:

2014-08-14  Alan Modra  amo...@gmail.com

* plugins.m4: Test for dlfcn.h or windows.h here to set default
for --enable-plugins.  Report error if someone tries to enable
plugins on a host we don't support.

2014-08-19  Alan Modra  amo...@gmail.com

* plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
LIBS via AC_SEARCH_LIBS.
---
 config/plugins.m4 | 26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/config/plugins.m4 b/config/plugins.m4
index 7ee8412..513c690 100644
--- a/config/plugins.m4
+++ b/config/plugins.m4
@@ -1,11 +1,21 @@
 AC_DEFUN([AC_PLUGINS],
 [
-AC_ARG_ENABLE([plugins],
-AS_HELP_STRING([--enable-plugins], [Enable support for plugins (defaults no)]),
-[case ${enableval} in
-  yes | ) plugins=yes ;;
-  no) plugins=no ;;
-  *) plugins=yes ;;
- esac],
-[plugins=no])
+  maybe_plugins=no
+  AC_CHECK_HEADERS([dlfcn.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
+  AC_CHECK_HEADERS([windows.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
+
+  AC_ARG_ENABLE([plugins],
+AS_HELP_STRING([--enable-plugins], [Enable support for plugins]),
+[case ${enableval} in
+  no) plugins=no ;;
+  *) plugins=yes
+ if test $maybe_plugins != yes ; then
+  AC_MSG_ERROR([Building with plugin support requires a host that 
supports dlopen.])
+fi ;;
+ esac],
+[plugins=$maybe_plugins]
+  )
+  if test $plugins = yes; then
+AC_SEARCH_LIBS([dlopen], [dl])
+  fi
 ])
-- 
1.8.3.2



signature.asc
Description: Digital signature


[PATCH RFC 1/4] Merge ./configure.ac with Binutils

2014-11-22 Thread Jan-Benedict Glaw
GCC and Binutils had a common ./configure.ac after this commit:

commit 08d081652f50df83f7e9768f8dbb7a99b0df50a2
Author: sandra sandra@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Wed May 14 23:20:59 2014 +

2014-05-14  Sandra Loosemore  san...@codesourcery.com

* configure.ac (target_makefile_frag): Set for nios2-*-elf*.
* configure: Regenerated.

config/
* mt-nios2-elf: New file.

Based on that file version, all GCC and Binutils commits to this file were
applied. This pulls in the following missing Binutils changes to configure.ac:

2014-07-21  Joel Sherrill  joel.sherr...@oarcorp.com

Disable gdb for or1k*-*-* until supported
* configure.ac (or1k*-*-*): Disable gdb.
* configure: Regenerated.

2014-07-27  Joel Sherrill joel.sherr...@oarcorp.com

GDB not supported for or1k*-*-rtems*
* configure.ac (or1k*-*-rtems*): gdb not supported.  The ordering
of the stanzas results in this not being caught by or1k*-*-* later.
* configure. Regenerated.

2014-09-06  Kuan-Lin Chen  kuanlinche...@gmail.com

* configure: Disable gdb for nds32*-*-* until supported.
* configure.ac: Disable gdb for nds32*-*-* until supported.

2014-09-12  Andrew Bennett  andrew.benn...@imgtec.com

* configure.ac: Add mips*-img-elf* target triple.
* configure: Regenerate.
---
 ChangeLog|  4 
 configure.ac | 14 --
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8fe60c7..240c8ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-22  Jan-Benedict Glaw  jbg...@lug-owl.de
+
+   * configure.ac: Merge with Binutils.
+
 2014-11-21  Ilya Verbin  ilya.ver...@intel.com
 
* Makefile.in: Regenerate.
diff --git a/configure.ac b/configure.ac
index b27fb1d..fd1bdf0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1010,6 +1010,10 @@ case ${target} in
 ;;
   *-*-rtems*)
 noconfigdirs=$noconfigdirs target-libgloss
+# this is not caught below because this stanza matches earlier
+case $target in
+  or1k*-*-*) noconfigdirs=$noconfigdirs gdb ;;
+esac
 ;;
 # The tpf target doesn't support gdb yet.
   *-*-tpf*)
@@ -1185,7 +1189,7 @@ case ${target} in
   microblaze*)
 noconfigdirs=$noconfigdirs gprof
 ;;
-  mips*-sde-elf* | mips*-mti-elf*)
+  mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
 if test x$with_newlib = xyes; then
   noconfigdirs=$noconfigdirs gprof
 fi
@@ -1208,10 +1212,16 @@ case ${target} in
   mips*-*-*)
 noconfigdirs=$noconfigdirs gprof
 ;;
+  nds32*-*-*)
+noconfigdirs=$noconfigdirs gdb
+;;
   nvptx*-*-*)
 # nvptx is just a compiler
 noconfigdirs=$noconfigdirs target-libssp target-libstdc++-v3 
target-libobjc
 ;;
+  or1k*-*-*)
+noconfigdirs=$noconfigdirs gdb
+;;
   sh-*-* | sh64-*-*)
 case ${target} in
   sh*-*-elf)
@@ -2454,7 +2464,7 @@ case ${target} in
   spu-*-*)
 target_makefile_frag=config/mt-spu
 ;;
-  mips*-sde-elf* | mips*-mti-elf*)
+  mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
 target_makefile_frag=config/mt-sde
 ;;
   mipsisa*-*-elfoabi*)
-- 
1.8.3.2



signature.asc
Description: Digital signature


[PATCH RFC 2/4] Merge ./config/ChangeLog with missing entries from Binutils

2014-11-22 Thread Jan-Benedict Glaw
---
 config/ChangeLog | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/config/ChangeLog b/config/ChangeLog
index ab3a773..2cbc885 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -26,11 +26,22 @@
* isl.m4 (ISL_CHECK_VERSION): Check link of isl library
for cross_compiling.
 
+2014-08-19  Alan Modra  amo...@gmail.com
+
+   * plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
+   LIBS via AC_SEARCH_LIBS.
+
 2014-08-18 Roman Gareev  gareevro...@gmail.com
 
* cloog.m4: Remove the path to isllibs from clooglibs.
* isl.m4: Add paths to islinc, isllibs.
 
+2014-08-14  Alan Modra  amo...@gmail.com
+
+   * plugins.m4: Test for dlfcn.h or windows.h here to set default
+   for --enable-plugins.  Report error if someone tries to enable
+   plugins on a host we don't support.
+
 2014-07-26  Uros Bizjak  ubiz...@gmail.com
 
PR target/47230
@@ -45,6 +56,10 @@
PR target/43538
* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
 
+2013-12-07  Mike Frysinger  vap...@gentoo.org
+
+   * acinclude.m4: Remove +x file mode.
+
 2013-11-29  Marek Polacek  pola...@redhat.com
 
* bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Remove -lpthread -ldl.
-- 
1.8.3.2



signature.asc
Description: Digital signature


[PATCH RFC 4/4] Regenerate ./configure

2014-11-22 Thread Jan-Benedict Glaw
2014-11-22  Jan-Benedict Glaw  jbg...@lug-owl.de

* configure: Regenerate.
---
 ChangeLog |  4 
 configure | 14 --
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 240c8ac..b7392bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-11-22  Jan-Benedict Glaw  jbg...@lug-owl.de
 
+   * configure: Regenerate.
+
+2014-11-22  Jan-Benedict Glaw  jbg...@lug-owl.de
+
* configure.ac: Merge with Binutils.
 
 2014-11-21  Ilya Verbin  ilya.ver...@intel.com
diff --git a/configure b/configure
index 96225b5..9e6684c 100755
--- a/configure
+++ b/configure
@@ -3656,6 +3656,10 @@ case ${target} in
 ;;
   *-*-rtems*)
 noconfigdirs=$noconfigdirs target-libgloss
+# this is not caught below because this stanza matches earlier
+case $target in
+  or1k*-*-*) noconfigdirs=$noconfigdirs gdb ;;
+esac
 ;;
 # The tpf target doesn't support gdb yet.
   *-*-tpf*)
@@ -3831,7 +3835,7 @@ case ${target} in
   microblaze*)
 noconfigdirs=$noconfigdirs gprof
 ;;
-  mips*-sde-elf* | mips*-mti-elf*)
+  mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
 if test x$with_newlib = xyes; then
   noconfigdirs=$noconfigdirs gprof
 fi
@@ -3854,10 +3858,16 @@ case ${target} in
   mips*-*-*)
 noconfigdirs=$noconfigdirs gprof
 ;;
+  nds32*-*-*)
+noconfigdirs=$noconfigdirs gdb
+;;
   nvptx*-*-*)
 # nvptx is just a compiler
 noconfigdirs=$noconfigdirs target-libssp target-libstdc++-v3 
target-libobjc
 ;;
+  or1k*-*-*)
+noconfigdirs=$noconfigdirs gdb
+;;
   sh-*-* | sh64-*-*)
 case ${target} in
   sh*-*-elf)
@@ -6801,7 +6811,7 @@ case ${target} in
   spu-*-*)
 target_makefile_frag=config/mt-spu
 ;;
-  mips*-sde-elf* | mips*-mti-elf*)
+  mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
 target_makefile_frag=config/mt-sde
 ;;
   mipsisa*-*-elfoabi*)
-- 
1.8.3.2



signature.asc
Description: Digital signature