Re: [PATCH] Update ia64 libstdc++ baseline symbols

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 09:52:35AM +0200, Andreas Schwab wrote:
> Tested on ia64-suse-linux and installed as obvious.

Please don't add the TLS symbols in there, they aren't included
in any of the linux baselines so that there aren't failures in
--disable-tls configurations or when using too old binutils.

> @@ -3400,3 +3723,5 @@ OBJECT:96:_ZTVSt7collateIcE@@GLIBCXX_3.4
>  OBJECT:96:_ZTVSt7collateIwE@@GLIBCXX_3.4
>  OBJECT:96:_ZTVSt8messagesIcE@@GLIBCXX_3.4
>  OBJECT:96:_ZTVSt8messagesIwE@@GLIBCXX_3.4
> +TLS:8:_ZSt11__once_call@@GLIBCXX_3.4.11
> +TLS:8:_ZSt15__once_callable@@GLIBCXX_3.4.11

Jakub


[4.8] Backports from trunk for March

2014-04-10 Thread Jakub Jelinek
Hi!

I've committed several backports patches from trunk to 4.8 branch after
bootstrapping/regtesting them on x86_64-linux and i686-linux.

Jakub
2014-04-10  Jakub Jelinek  

Backport from mainline
2014-03-06  Jakub Jelinek  
Meador Inge  

PR target/58595
* config/arm/arm.c (arm_tls_symbol_p): Remove.
(arm_legitimize_address): Call legitimize_tls_address for any
arm_tls_referenced_p expression, handle constant addend.  Call it
before testing for !TARGET_ARM.
(thumb_legitimize_address): Don't handle arm_tls_symbol_p here.

2014-03-06  Jakub Jelinek  

PR target/58595
* gcc.dg/tls/pr58595.c: New test.

--- gcc/config/arm/arm.c(revision 208379)
+++ gcc/config/arm/arm.c(revision 208380)
@@ -235,7 +235,6 @@ static tree arm_gimplify_va_arg_expr (tr
 static void arm_option_override (void);
 static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
 static bool arm_cannot_copy_insn_p (rtx);
-static bool arm_tls_symbol_p (rtx x);
 static int arm_issue_rate (void);
 static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
 static bool arm_output_addr_const_extra (FILE *, rtx);
@@ -7336,6 +7335,32 @@ legitimize_tls_address (rtx x, rtx reg)
 rtx
 arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
 {
+  if (arm_tls_referenced_p (x))
+{
+  rtx addend = NULL;
+
+  if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS)
+   {
+ addend = XEXP (XEXP (x, 0), 1);
+ x = XEXP (XEXP (x, 0), 0);
+   }
+
+  if (GET_CODE (x) != SYMBOL_REF)
+   return x;
+
+  gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0);
+
+  x = legitimize_tls_address (x, NULL_RTX);
+
+  if (addend)
+   {
+ x = gen_rtx_PLUS (SImode, x, addend);
+ orig_x = x;
+   }
+  else
+   return x;
+}
+
   if (!TARGET_ARM)
 {
   /* TODO: legitimize_address for Thumb2.  */
@@ -7344,9 +7369,6 @@ arm_legitimize_address (rtx x, rtx orig_
   return thumb_legitimize_address (x, orig_x, mode);
 }
 
-  if (arm_tls_symbol_p (x))
-return legitimize_tls_address (x, NULL_RTX);
-
   if (GET_CODE (x) == PLUS)
 {
   rtx xop0 = XEXP (x, 0);
@@ -7459,9 +7481,6 @@ arm_legitimize_address (rtx x, rtx orig_
 rtx
 thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
 {
-  if (arm_tls_symbol_p (x))
-return legitimize_tls_address (x, NULL_RTX);
-
   if (GET_CODE (x) == PLUS
   && CONST_INT_P (XEXP (x, 1))
   && (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode)
@@ -7756,20 +7775,6 @@ thumb_legitimize_reload_address (rtx *x_
 
 /* Test for various thread-local symbols.  */
 
-/* Return TRUE if X is a thread-local symbol.  */
-
-static bool
-arm_tls_symbol_p (rtx x)
-{
-  if (! TARGET_HAVE_TLS)
-return false;
-
-  if (GET_CODE (x) != SYMBOL_REF)
-return false;
-
-  return SYMBOL_REF_TLS_MODEL (x) != 0;
-}
-
 /* Helper for arm_tls_referenced_p.  */
 
 static int
--- gcc/testsuite/gcc.dg/tls/pr58595.c  (revision 0)
+++ gcc/testsuite/gcc.dg/tls/pr58595.c  (revision 208380)
@@ -0,0 +1,28 @@
+/* PR target/58595 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-fpic" { target fpic } } */
+/* { dg-require-effective-target tls } */
+/* { dg-require-effective-target sync_int_long } */
+
+struct S { unsigned long a, b; };
+__thread struct S s;
+void bar (unsigned long *);
+
+__attribute__((noinline)) void
+foo (void)
+{
+  int i;
+  for (i = 0; i < 10; i++)
+__sync_fetch_and_add (&s.b, 1L);
+}
+
+int
+main ()
+{
+  s.b = 12;
+  foo ();
+  if (s.b != 22)
+__builtin_abort ();
+  return 0;
+}
2014-04-10  Jakub Jelinek  

Backport from mainline
2014-03-13  Jakub Jelinek  

PR middle-end/36282
* c-pragma.c (apply_pragma_weak): Only look at
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) if
DECL_ASSEMBLER_NAME_SET_P (decl).
(maybe_apply_pending_pragma_weaks): Exit early if
vec_safe_is_empty (pending_weaks) rather than only when
!pending_weaks.
(maybe_apply_pragma_weak): Likewise.  If !DECL_ASSEMBLER_NAME_SET_P,
set assembler name back to NULL afterwards.

* c-c++-common/pr36282-1.c: New test.
* c-c++-common/pr36282-2.c: New test.
* c-c++-common/pr36282-3.c: New test.
* c-c++-common/pr36282-4.c: New test.

--- gcc/c-family/c-pragma.c (revision 208556)
+++ gcc/c-family/c-pragma.c (revision 208557)
@@ -263,6 +263,7 @@ apply_pragma_weak (tree decl, tree value
 
   if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl)
   && !DECL_WEAK (decl) /* Don't complain about a redundant #pragma.  */
+  && DECL_ASSEMBLER_NAME_SET_P (decl)
   && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
 warning (OPT_Wpragmas, "applying #pragma weak %q+D after first use "
 "results in unspecified beha

[PATCH] Adjust hoist-register-pressure* testcases to work for S/390

2014-04-10 Thread Andreas Krebbel
Hi,

the hoist-register-pressure testcases currently fail on S/390 since
the rtl hoist pass requires that the expression to be hoisted can be
assigned without clobbering cc.  We do not have a 32 bit add which
does not clobber cc.

On 64 bit we might use load address if the operands are DImode.  On 31
bit we are out of luck.

The attached patch turns the int types into long for these testcases
and disables them for s390 31bit.

I've verified that they still succeed on power and x86_64.

Ok?

Bye,

-Andreas-


2014-04-10  Andreas Krebbel  

* gcc.dg/hoist-register-pressure-1.c: Replace int with long.
Disable asm scan for s390.
* gcc.dg/hoist-register-pressure-2.c: Likewise.
* gcc.dg/hoist-register-pressure-3.c: Likewise.

diff --git a/gcc/testsuite/gcc.dg/hoist-register-pressure-1.c 
b/gcc/testsuite/gcc.dg/hoist-register-pressure-1.c
index f5b5302..4aabcb7 100644
--- a/gcc/testsuite/gcc.dg/hoist-register-pressure-1.c
+++ b/gcc/testsuite/gcc.dg/hoist-register-pressure-1.c
@@ -1,14 +1,18 @@
 /* { dg-options "-Os -fdump-rtl-hoist" }  */
-/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" 
"hoist" { target { nonpic } } } } */
+/* The rtl hoist pass requires that the expression to be hoisted can
+   be assigned without clobbering cc.  For a PLUS rtx on S/390 this
+   requires a load address instruction which is fine on 64 bit but
+   cannot be used on 31 bit since it does a 31 bit add only.  */
+/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" 
"hoist" { target { { ! s390-*-* } && nonpic } } } } */
 /* { dg-final { cleanup-rtl-dump "hoist" } } */
 
 #define BUF 100
-int a[BUF];
+long a[BUF];
 
-void com (int);
-void bar (int);
+void com (long);
+void bar (long);
 
-int foo (int x, int y, int z)
+long foo (long x, long y, long z)
 {
   /* "x+y" won't be hoisted if "-fira-hoist-pressure" is disabled,
  because its rtx_cost is too small.  */
diff --git a/gcc/testsuite/gcc.dg/hoist-register-pressure-2.c 
b/gcc/testsuite/gcc.dg/hoist-register-pressure-2.c
index 30408f3..f1c927e 100644
--- a/gcc/testsuite/gcc.dg/hoist-register-pressure-2.c
+++ b/gcc/testsuite/gcc.dg/hoist-register-pressure-2.c
@@ -1,14 +1,18 @@
 /* { dg-options "-Os -fdump-rtl-hoist" }  */
-/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" 
"hoist" } } */
+/* The rtl hoist pass requires that the expression to be hoisted can
+   be assigned without clobbering cc.  For a PLUS rtx on S/390 this
+   requires a load address instruction which is fine on 64 bit but
+   cannot be used on 31 bit since it does a 31 bit add only.  */
+/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" 
"hoist" { target { ! s390-*-* } } } } */
 /* { dg-final { cleanup-rtl-dump "hoist" } } */
 
 #define BUF 100
-int a[BUF];
+long a[BUF];
 
-void com (int);
-void bar (int);
+void com (long);
+void bar (long);
 
-int foo (int x, int y, int z)
+long foo (long x, long y, long z)
 {
   /* "x+y" won't be hoisted if "-fira-hoist-pressure" is disabled,
  because its rtx_cost is too small.  */
diff --git a/gcc/testsuite/gcc.dg/hoist-register-pressure-3.c 
b/gcc/testsuite/gcc.dg/hoist-register-pressure-3.c
index b050f89..24abaa6 100644
--- a/gcc/testsuite/gcc.dg/hoist-register-pressure-3.c
+++ b/gcc/testsuite/gcc.dg/hoist-register-pressure-3.c
@@ -1,14 +1,18 @@
 /* { dg-options "-Os -fdump-rtl-hoist" }  */
-/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" 
"hoist" } } */
+/* The rtl hoist pass requires that the expression to be hoisted can
+   be assigned without clobbering cc.  For a PLUS rtx on S/390 this
+   requires a load address instruction which is fine on 64 bit but
+   cannot be used on 31 bit since it does a 31 bit add only.  */
+/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" 
"hoist" { target { ! s390-*-* } } } } */
 /* { dg-final { cleanup-rtl-dump "hoist" } } */
 
 #define BUF 100
-int a[BUF];
+long a[BUF];
 
-void com (int);
-void bar (int);
+void com (long);
+void bar (long);
 
-int foo (int x, int y, int z)
+long foo (long x, long y, long z)
 {
   /* "x+y" won't be hoisted if "-fira-hoist-pressure" is disabled,
  because its rtx_cost is too small.  */



[4.8] Reassoc fix (PR tree-optimization/60502)

2014-04-10 Thread Jakub Jelinek
Hi!

This backport didn't apply cleanly, because 4.8 doesn't have
build_all_ones_cst function.

So, either we can apply something like the patch below
(bootstrapped/regtested with the other backports), or as another
alternative I see backport the addition of build_minus_one_cst
and build_all_ones_cst functions (probably without adding any new
uses of those functions, just define in tree.c and declare in tree.h)
and then apply the r208507 change as is.

What do you prefer?

2014-04-10  Jakub Jelinek  

Backport from mainline
2014-03-12  Jakub Jelinek  
Marc Glisse  

PR tree-optimization/60502
* tree-ssa-reassoc.c (eliminate_not_pairs): Handle VECTOR_TYPE.

* gcc.c-torture/compile/pr60502.c: New test.

--- gcc/tree-ssa-reassoc.c  (revision 208506)
+++ gcc/tree-ssa-reassoc.c  (revision 208507)
@@ -785,8 +785,15 @@ eliminate_not_pairs (enum tree_code opco
  if (opcode == BIT_AND_EXPR)
oe->op = build_zero_cst (TREE_TYPE (oe->op));
  else if (opcode == BIT_IOR_EXPR)
-   oe->op = build_low_bits_mask (TREE_TYPE (oe->op),
- TYPE_PRECISION (TREE_TYPE (oe->op)));
+   {
+ tree type = TREE_TYPE (oe->op);
+ tree itype = type;
+ if (TREE_CODE (type) == VECTOR_TYPE)
+   itype = TREE_TYPE (type);
+ oe->op = build_low_bits_mask (itype, TYPE_PRECISION (itype));
+ if (TREE_CODE (type) == VECTOR_TYPE)
+   oe->op = build_vector_from_val (type, oe->op);
+   }
 
  reassociate_stats.ops_eliminated += ops->length () - 1;
  ops->truncate (0);
--- gcc/testsuite/gcc.c-torture/compile/pr60502.c   (revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/pr60502.c   (revision 208507)
@@ -0,0 +1,18 @@
+/* PR tree-optimization/60502 */
+
+typedef signed char v16i8 __attribute__ ((vector_size (16)));
+typedef unsigned char v16u8 __attribute__ ((vector_size (16)));
+
+void
+foo (v16i8 *x)
+{
+  v16i8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 
};
+  *x |= *x ^ m1;
+}
+
+void
+bar (v16u8 *x)
+{
+  v16u8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 
};
+  *x |= *x ^ m1;
+}

Jakub


[Patch PR debug/60655] Reject invalid constants in the backend.

2014-04-10 Thread Ramana Radhakrishnan

Hi,

This fixes the tail of PR60655 where there were still issues without 
-fdata-sections despite the fix in const_ok_for_output_1. For now, given 
the pressure to get 4.9 out of the door, it's probably best to handle 
this in the backend and reject constants that cannot be handled by GAS. 
For stage1 next we need to tighten the kinds of constants that 
var-tracking / const_ok_for_output_1 can handle but this is something we 
need to do across targets rather than leaving targets to deal with this.


I've tested this with bootstraps on AArch32 v7-a vfpv3-d16 thumb2 which 
is the typical distro configuration - testing came back clean.


Applied to trunk.

regards
Ramana

2014-04-10  Ramana Radhakrishnan  

PR debug/60655
* config/arm/arm.c (TARGET_CONST_NOT_OK_FOR_DEBUG_P): Define
(arm_const_not_ok_for_debug_p): Reject MINUS with SYM_REF's
ameliorating the cases where it can be.

2014-04-10  Ramana Radhakrishnan  

PR debug/60655
* gcc.c-torture/compile/pr60655-2.c: Copy from pr60655-1.c without
-fdata-sections.


--
Ramana Radhakrishnan
Principal Engineer
ARM Ltd.Index: ChangeLog
===
--- ChangeLog   (revision 209261)
+++ ChangeLog   (working copy)
@@ -1,3 +1,10 @@
+2014-04-10  Ramana Radhakrishnan  
+
+   PR debug/60655
+   * config/arm/arm.c (TARGET_CONST_NOT_OK_FOR_DEBUG_P): Define
+   (arm_const_not_ok_for_debug_p): Reject MINUS with SYM_REF's
+   ameliorating the cases where it can be.
+
 2014-04-09  David Edelsohn  
 
Revert
Index: testsuite/ChangeLog
===
--- testsuite/ChangeLog (revision 209261)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2014-04-10  Ramana Radhakrishnan  
+
+   PR debug/60655
+   * gcc.c-torture/compile/pr60655-2.c: Copy from pr60655-1.c without
+   -fdata-sections.
+
 2014-04-09  Steve Ellcey  
 
* gcc.dg/tree-ssa/ssa-ifcombine-13.c: Remove mips*-*-* from option
Index: testsuite/gcc.c-torture/compile/pr60655-2.c
===
--- testsuite/gcc.c-torture/compile/pr60655-2.c (revision 0)
+++ testsuite/gcc.c-torture/compile/pr60655-2.c (working copy)
@@ -0,0 +1,30 @@
+
+typedef unsigned char unit;
+typedef unit *unitptr;
+extern short global_precision;
+typedef __SIZE_TYPE__ size_t;
+extern void *memcpy (void *dest, const void *src, size_t n);
+
+short mp_compare(const unit* r1, const unit* r2)
+{
+  register short precision;
+  precision = global_precision;
+  (r1) = ((r1)+(precision)-1);
+  (r2) = ((r2)+(precision)-1);
+  do
+{ if (*r1 < *r2)
+   return(-1);
+  if (*((r1)--) > *((r2)--))
+   return(1);
+} while (--precision);
+}
+
+static unit modulus[((1280+(2*8))/8)];
+static unit d_data[((1280+(2*8))/8)*2];
+
+int upton_modmult (unitptr prod, unitptr multiplicand, unitptr multiplier)
+{
+ unitptr d = d_data;
+ while (mp_compare(d,modulus) > 0)
+   memcpy((void*)(prod), (const void*)(d), (global_precision));
+}
Index: config/arm/arm.c
===
--- config/arm/arm.c(revision 209261)
+++ config/arm/arm.c(working copy)
@@ -72,6 +72,7 @@ struct four_ints
 };
 
 /* Forward function declarations.  */
+static bool arm_const_not_ok_for_debug_p (rtx);
 static bool arm_lra_p (void);
 static bool arm_needs_doubleword_align (enum machine_mode, const_tree);
 static int arm_compute_static_chain_stack_bytes (void);
@@ -674,6 +675,9 @@ static const struct attribute_spec arm_a
 #undef TARGET_CAN_USE_DOLOOP_P
 #define TARGET_CAN_USE_DOLOOP_P can_use_doloop_if_innermost
 
+#undef TARGET_CONST_NOT_OK_FOR_DEBUG_P
+#define TARGET_CONST_NOT_OK_FOR_DEBUG_P arm_const_not_ok_for_debug_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Obstack for minipool constant handling.  */
@@ -31116,4 +31120,46 @@ arm_asan_shadow_offset (void)
   return (unsigned HOST_WIDE_INT) 1 << 29;
 }
 
+
+/* This is a temporary fix for PR60655.  Ideally we need
+   to handle most of these cases in the generic part but
+   currently we reject minus (..) (sym_ref).  We try to 
+   ameliorate the case with minus (sym_ref1) (sym_ref2)
+   where they are in the same section.  */
+
+static bool
+arm_const_not_ok_for_debug_p (rtx p)
+{
+  tree decl_op0 = NULL;
+  tree decl_op1 = NULL;
+
+  if (GET_CODE (p) == MINUS)
+{
+  if (GET_CODE (XEXP (p, 1)) == SYMBOL_REF)
+   {
+ decl_op1 = SYMBOL_REF_DECL (XEXP (p, 1));
+ if (decl_op1
+ && GET_CODE (XEXP (p, 0)) == SYMBOL_REF
+ && (decl_op0 = SYMBOL_REF_DECL (XEXP (p, 0
+   {
+ if ((TREE_CODE (decl_op1) == VAR_DECL
+  || TREE_CODE (decl_op1) == CONST_DECL)
+ && (TREE_CODE (decl_op0) == VAR_DECL
+ || TREE_CODE (decl_op0) == CONST_DECL))
+   return (get_variable_section (decl

Re: [PATCH] Update ia64 libstdc++ baseline symbols

2014-04-10 Thread Andreas Schwab
Jakub Jelinek  writes:

> On Thu, Apr 10, 2014 at 09:52:35AM +0200, Andreas Schwab wrote:
>> Tested on ia64-suse-linux and installed as obvious.
>
> Please don't add the TLS symbols in there, they aren't included
> in any of the linux baselines

Actually, there are some:

libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt
libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt
libstdc++-v3/config/abi/post/mips64-linux-gnu/32/baseline_symbols.txt
libstdc++-v3/config/abi/post/mips64-linux-gnu/64/baseline_symbols.txt
libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt
libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt
libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt
libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt

Should they all be removed (including the solaris ones)?

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH] Update ia64 libstdc++ baseline symbols

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 10:15:59AM +0200, Andreas Schwab wrote:
> Jakub Jelinek  writes:
> 
> > On Thu, Apr 10, 2014 at 09:52:35AM +0200, Andreas Schwab wrote:
> >> Tested on ia64-suse-linux and installed as obvious.
> >
> > Please don't add the TLS symbols in there, they aren't included
> > in any of the linux baselines
> 
> Actually, there are some:
> 
> libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt
> libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt
> libstdc++-v3/config/abi/post/mips64-linux-gnu/32/baseline_symbols.txt
> libstdc++-v3/config/abi/post/mips64-linux-gnu/64/baseline_symbols.txt
> libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt
> libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
> libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt
> libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt
> libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt
> 
> Should they all be removed (including the solaris ones)?

I'd say so, perhaps with the exception of Solaris where I'd leave that to
the target maintainer to decide.

The other alternative is to have the TLS symbols included everywhere and add
some magic to the abi checking scripts/proglet which would detect the
emulated TLS configuration and not error out if the TLS symbols disappear,
probably better long term, but supposedly too late for 4.9 for now.

Jakub


Re: [4.8] Reassoc fix (PR tree-optimization/60502)

2014-04-10 Thread Richard Biener
On April 10, 2014 10:02:29 AM CEST, Jakub Jelinek  wrote:
>Hi!
>
>This backport didn't apply cleanly, because 4.8 doesn't have
>build_all_ones_cst function.
>
>So, either we can apply something like the patch below
>(bootstrapped/regtested with the other backports), or as another
>alternative I see backport the addition of build_minus_one_cst
>and build_all_ones_cst functions (probably without adding any new
>uses of those functions, just define in tree.c and declare in tree.h)
>and then apply the r208507 change as is.
>
>What do you prefer?

Backport the two functions.

Richard.

>2014-04-10  Jakub Jelinek  
>
>   Backport from mainline
>   2014-03-12  Jakub Jelinek  
>   Marc Glisse  
>
>   PR tree-optimization/60502
>   * tree-ssa-reassoc.c (eliminate_not_pairs): Handle VECTOR_TYPE.
>
>   * gcc.c-torture/compile/pr60502.c: New test.
>
>--- gcc/tree-ssa-reassoc.c (revision 208506)
>+++ gcc/tree-ssa-reassoc.c (revision 208507)
>@@ -785,8 +785,15 @@ eliminate_not_pairs (enum tree_code opco
> if (opcode == BIT_AND_EXPR)
>   oe->op = build_zero_cst (TREE_TYPE (oe->op));
> else if (opcode == BIT_IOR_EXPR)
>-  oe->op = build_low_bits_mask (TREE_TYPE (oe->op),
>-TYPE_PRECISION (TREE_TYPE (oe->op)));
>+  {
>+tree type = TREE_TYPE (oe->op);
>+tree itype = type;
>+if (TREE_CODE (type) == VECTOR_TYPE)
>+  itype = TREE_TYPE (type);
>+oe->op = build_low_bits_mask (itype, TYPE_PRECISION (itype));
>+if (TREE_CODE (type) == VECTOR_TYPE)
>+  oe->op = build_vector_from_val (type, oe->op);
>+  }
> 
> reassociate_stats.ops_eliminated += ops->length () - 1;
> ops->truncate (0);
>--- gcc/testsuite/gcc.c-torture/compile/pr60502.c  (revision 0)
>+++ gcc/testsuite/gcc.c-torture/compile/pr60502.c  (revision 208507)
>@@ -0,0 +1,18 @@
>+/* PR tree-optimization/60502 */
>+
>+typedef signed char v16i8 __attribute__ ((vector_size (16)));
>+typedef unsigned char v16u8 __attribute__ ((vector_size (16)));
>+
>+void
>+foo (v16i8 *x)
>+{
>+  v16i8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
>-1, -1 };
>+  *x |= *x ^ m1;
>+}
>+
>+void
>+bar (v16u8 *x)
>+{
>+  v16u8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
>-1, -1 };
>+  *x |= *x ^ m1;
>+}
>
>   Jakub




Re: [PATCH] Update ia64 libstdc++ baseline symbols

2014-04-10 Thread Andreas Schwab
Jakub Jelinek  writes:

> I'd say so, perhaps with the exception of Solaris where I'd leave that to
> the target maintainer to decide.

Done.

> The other alternative is to have the TLS symbols included everywhere and add
> some magic to the abi checking scripts/proglet which would detect the
> emulated TLS configuration and not error out if the TLS symbols disappear,
> probably better long term, but supposedly too late for 4.9 for now.

Filed as bug 60806 so that it won't be forgotten (unfortunately there is
no 4.10 target milestone yet).

Andreas.

* config/abi/post/alpha-linux-gnu/baseline_symbols.txt: Remove TLS
symbols.
* config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Likewise.
* config/abi/post/mips64-linux-gnu/baseline_symbols.txt: Likewise.

diff --git a/libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt 
b/libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt
index c62f4db..e518a0a 100644
--- a/libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt
@@ -4026,5 +4026,3 @@ OBJECT:96:_ZTVSt12ctype_bynameIcE@@GLIBCXX_3.4
 OBJECT:96:_ZTVSt5ctypeIcE@@GLIBCXX_3.4
 
OBJECT:96:_ZTVSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE@@GLIBCXX_3.4
 
OBJECT:96:_ZTVSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE@@GLIBCXX_3.4
-TLS:8:_ZSt11__once_call@@GLIBCXX_3.4.11
-TLS:8:_ZSt15__once_callable@@GLIBCXX_3.4.11
diff --git a/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt 
b/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt
index 168a7b4..6ff97c7 100644
--- a/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt
@@ -3723,5 +3723,3 @@ OBJECT:96:_ZTVSt7collateIcE@@GLIBCXX_3.4
 OBJECT:96:_ZTVSt7collateIwE@@GLIBCXX_3.4
 OBJECT:96:_ZTVSt8messagesIcE@@GLIBCXX_3.4
 OBJECT:96:_ZTVSt8messagesIwE@@GLIBCXX_3.4
-TLS:8:_ZSt11__once_call@@GLIBCXX_3.4.11
-TLS:8:_ZSt15__once_callable@@GLIBCXX_3.4.11
diff --git a/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt 
b/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt
index e7e2bc5..ce247a9 100644
--- a/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt
@@ -3671,5 +3671,3 @@ OBJECT:8:_ZTTSi@@GLIBCXX_3.4
 OBJECT:8:_ZTTSo@@GLIBCXX_3.4
 OBJECT:8:_ZTTSt13basic_istreamIwSt11char_traitsIwEE@@GLIBCXX_3.4
 OBJECT:8:_ZTTSt13basic_ostreamIwSt11char_traitsIwEE@@GLIBCXX_3.4
-TLS:4:_ZSt11__once_call@@GLIBCXX_3.4.11
-TLS:4:_ZSt15__once_callable@@GLIBCXX_3.4.11
diff --git a/libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt 
b/libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt
index 8c1075d..fa2fda3 100644
--- a/libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt
@@ -3745,5 +3745,3 @@ OBJECT:8:_ZTTSi@@GLIBCXX_3.4
 OBJECT:8:_ZTTSo@@GLIBCXX_3.4
 OBJECT:8:_ZTTSt13basic_istreamIwSt11char_traitsIwEE@@GLIBCXX_3.4
 OBJECT:8:_ZTTSt13basic_ostreamIwSt11char_traitsIwEE@@GLIBCXX_3.4
-TLS:4:_ZSt11__once_call@@GLIBCXX_3.4.11
-TLS:4:_ZSt15__once_callable@@GLIBCXX_3.4.11
-- 
1.9.1

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


[PATCH wwwdocs] Changes for ARM / AArch64 backends 4.9

2014-04-10 Thread Ramana Radhakrishnan
4.9 changes for ARM / AArch64. Sorry it's taken me a while to get this 
out but better late than never :)


Ok ?

Ramana
--
Ramana Radhakrishnan
Principal Engineer
ARM Ltd.Index: htdocs/gcc-4.9/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/changes.html,v
retrieving revision 1.64
diff -a -u -r1.64 changes.html
--- htdocs/gcc-4.9/changes.html 22 Mar 2014 14:20:02 -  1.64
+++ htdocs/gcc-4.9/changes.html 9 Apr 2014 15:00:01 -
@@ -437,6 +437,96 @@
 
 New Targets and Target Specific Improvements
 
+AArch64
+   
+  The ARMv8-A crypto and CRC instructions are now supported through
+   intrinsics. These are enabled when the architecture supports these
+   and are available through the -march=armv8-a+crc
+   and -march=armv8-a+crypto options.
+ 
+  Initial support for ILP32 has now been added to the
+   compiler. This is now available through the command line option
+   -mabi=ilp32. Support for ILP32 is
+   considered experimental as the ABI specification is still beta.
+ 
+  Coverage of more of the ISA including the SIMD extensions has
+   been added. The Advanced SIMD intrinsics have also been improved.
+ 
+  The new local register allocator (LRA) is now on by default
+   for the AArch64 backend.
+ 
+  The REE (Redundant extension elimination) pass has now been enabled
+   by default for the AArch64 backend.
+ 
+  Tuning for the Cortex-A53 and Cortex-A57 has been improved.
+ 
+  Initial big.LITTLE tuning support for the combination of Cortex-A57
+   and Cortex-A53 was added through the -mcpu=cortex-a57.cortex-a53
+option.
+ 
+  A number of structural changes have been made to both the ARM
+   and AArch64 backends to facilitate improved code-generation.
+ 
+   
+
+ARM
+ 
+   Use of Advanced SIMD (Neon) for 64-bit scalar computations has been
+   disabled by default. This was found to generate better code in only
+   a small number of cases. It can be turned back on with the
+   -mneon-for-64bits option.
+  
+  Further support for the ARMv8-A architecture, notably implementing
+   the restriction around IT blocks in the Thumb32 instruction set has
+   been added. The -mrestrict-it option can be used with
+   -march=armv7-a or the -march=armv7ve options
+   to make code generation fully compatible with the deprecated 
instructions
+   in ARMv8-A.
+ 
+  Support has now been added for the ARMv7ve variant of the
+   architecture. This can be used by the -march=armv7ve 
option.
+ 
+  The ARMv8-A crypto and CRC instructions are now supported through
+   intrinsics and are available through the -march=armv8-a+crc
+   and mfpu=crypto-neon-fp-armv8 options.
+ 
+  LRA is now on by default for the ARM target. This can be turned off
+   using the -mno-lra option. This option is purely
+   transitionary command line option and will be removed in a future
+   release. We are interested in any bug reports regarding functional and
+   performance regressions with LRA.
+ 
+  A new option -mslow-flash-data to improve performance
+   of programs fetching data on slow flash memory has now been
+   introduced for the ARMv7-M profile cores.
+ 
+  A new option -mpic-data-is-text-relative for targets
+   that allows data segments to be relative to text segments has
+   been added. This is on by default for all targets except VxWorks RTP.
+ 
+  A number of infrastructural changes have been made to both the ARM
+   and AArch64 backends to facilitate improved code-generation.
+ 
+  GCC now supports Cortex-A12 and the Cortex-R7 through the
+   -mcpu=cortex-a12 and -mcpu=cortex-r7 options.
+ 
+  GCC now has tuning for the Cortex-A57 and Cortex-A53
+   through the -mcpu=cortex-a57 and -mcpu=cortex-a53
+options.
+ 
+  Initial big.LITTLE tuning support for the combination of Cortex-A57
+   and Cortex-A53 was added through the -mcpu=cortex-a57.cortex-a53
+option. Similar support was added for the combination of
+   Cortex-A15 and Cortex-A7 through the -mcpu=cortex-a15.cortex-a7
+option.
+ 
+  Further performance optimizations for the Cortex-A15 and the
+   Cortex-M4 have been added.
+ 
+ A number of code generation improvements for Thumb2 to reduce code
+   size when compiling for the M-profile processors.
+ 
+ 
 IA-32/x86-64
   
 Intel AVX-512 support was added to GCC.  That includes inline

Re: [PATCH] Update ia64 libstdc++ baseline symbols

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 10:42:28AM +0200, Andreas Schwab wrote:
> Jakub Jelinek  writes:
> 
> > I'd say so, perhaps with the exception of Solaris where I'd leave that to
> > the target maintainer to decide.
> 
> Done.
> 
> > The other alternative is to have the TLS symbols included everywhere and add
> > some magic to the abi checking scripts/proglet which would detect the
> > emulated TLS configuration and not error out if the TLS symbols disappear,
> > probably better long term, but supposedly too late for 4.9 for now.
> 
> Filed as bug 60806 so that it won't be forgotten (unfortunately there is
> no 4.10 target milestone yet).

Thanks.  The reason for missing 4.10 target milestone is that we should
discuss what the next version will be, 4.10, 5.0, something else.
Though, supposedly some target milestone can be created and it could be just
renamed later on.

Jakub


Re: FW: [PATCH, FORTRAN] Class Name Clash

2014-04-10 Thread Tobias Burnus
Bernd Edlinger wrote:
> this patch fixes a recently discovered name-clash in gfc_build_class_symbol.
>
> Fortunately it is quite easy to fix: just make sure that the class names of 
> target
> classes end with "_t", and target array classes end with "[0-9]t".
> This trick makes all names unique again.

One thing which in general doesn't make it as simple is that it breaks the ABI 
for
polymorphic variables.

However, as I have already broken the ABI for polymorphic variables in order to
support finalization (= destructors), doing another ABI breakage is no problem.

As we do break the ABI, we also switched to compressed .mod files - hence, most
code simply won't compile without recompiling the modules. Hence, there is no
problem form that side and the the ABI notice at
http://gcc.gnu.org/gcc-4.9/changes.html#fortran
should be sufficient.

Side note: I would really like if we could manage to create a GCC/gfortran
version 4.x which is .mod-ABI compatible with 4.(x-1) but so far we failed to
do so. And with the new array descriptor looming, either 4.9++ or 4.9+2 will
break the ABI again.

> I hope it is not too late, and this can still go into 4.9.0.
> Boot-Strapped without any regressions on x86_64-unknown-linux-gnu.

Regarding the patch: As Fortran is case insensitive, gfortran always stores
identifiers as lower case. Thus, using something uppercase prevents problems.

You also cannot blindly append characters as the values are fixed sized.

Would it do to replace the existant appended "p" (pointer) and "a" (allocatable)
by "P" and "A"? I think that should work as well and avoids the other issues.

Tobias


Re: [PATCH] Update ia64 libstdc++ baseline symbols

2014-04-10 Thread Rainer Orth
Andreas Schwab  writes:

> Jakub Jelinek  writes:
>
>> I'd say so, perhaps with the exception of Solaris where I'd leave that to
>> the target maintainer to decide.
>
> Done.

I'd leave them in the solaris2.10 baselines: there are no non-TLS
toolchains there, and I'd rather know if TLS support somehow goes
missing.

Thanks.
Rainer

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


RE: [PATCH, FORTRAN] Class Name Clash

2014-04-10 Thread Bernd Edlinger
Hi Tobias,

On Thu, 10 Apr 2014 10:50:24, Tobias Burnus wrote:
>
> Bernd Edlinger wrote:
>> this patch fixes a recently discovered name-clash in gfc_build_class_symbol.
>>
>> Fortunately it is quite easy to fix: just make sure that the class names of 
>> target
>> classes end with "_t", and target array classes end with "[0-9]t".
>> This trick makes all names unique again.
>
> One thing which in general doesn't make it as simple is that it breaks the 
> ABI for
> polymorphic variables.
>
> However, as I have already broken the ABI for polymorphic variables in order 
> to
> support finalization (= destructors), doing another ABI breakage is no 
> problem.
>
> As we do break the ABI, we also switched to compressed .mod files - hence, 
> most
> code simply won't compile without recompiling the modules. Hence, there is no
> problem form that side and the the ABI notice at
> http://gcc.gnu.org/gcc-4.9/changes.html#fortran
> should be sufficient.
>
> Side note: I would really like if we could manage to create a GCC/gfortran
> version 4.x which is .mod-ABI compatible with 4.(x-1) but so far we failed to
> do so. And with the new array descriptor looming, either 4.9++ or 4.9+2 will
> break the ABI again.
>
>> I hope it is not too late, and this can still go into 4.9.0.
>> Boot-Strapped without any regressions on x86_64-unknown-linux-gnu.
>
> Regarding the patch: As Fortran is case insensitive, gfortran always stores
> identifiers as lower case. Thus, using something uppercase prevents problems.
>
> You also cannot blindly append characters as the values are fixed sized.
>
> Would it do to replace the existant appended "p" (pointer) and "a" 
> (allocatable)
> by "P" and "A"? I think that should work as well and avoids the other issues.
>

I thought about that, too. But it is likely that the pattern for array of 
target class
"__class_%s_%d_%d" will eventually clash with the non-array target class 
"__class_%s"

If the class name is something like "test_1_1"

And I tried of course, to create an example that exceeds the name length, but 
that turned
out to be impossible, because get_unique_hashed_string keeps the string length 
small:

  /* If string is too long, use hash value in hex representation (allow for
 extra decoration, cf. gfc_build_class_symbol & gfc_find_derived_vtab).
 We need space to for 15 characters "__class_" + symbol name + "_%d_%da",
 where %d is the (co)rank which can be up to n = 15.  */

Thus for long names, the sting is replaced by sprintf (string, "%X", h);

(which may contain uppercase A-F).

This means that we should not have problems with the buffer length for
the target classes.

I think at least the pattern __class_%s_%d_%d needs to be replaced by something
like __class_%s_%d_%dT.

Would you prefer to change the letters to a->A p->P, and add an uppercase T to 
the
target array pattern, while keeping the name of the normal target class as it 
is?

If yes, I can change the patch accordingly. Please advise.

Thanks
Bernd.

> Tobias
  

Re: [PATCH, FORTRAN] Class Name Clash

2014-04-10 Thread Tobias Burnus
Hi Bernd,

On Thu, Apr 10, 2014 at 11:20:47AM +0200, Bernd Edlinger wrote:
> I thought about that, too. But it is likely that the pattern for array of 
> target class
> "__class_%s_%d_%d" will eventually clash with the non-array target class 
> "__class_%s"

which proves that I am too sleep deprieved to properly read the patch ...

> Would you prefer to change the letters to a->A p->P, and add an uppercase T 
> to the
> target array pattern, while keeping the name of the normal target class as it 
> is?

No re-reading the orginal patch, I think it is okay. Thanks!
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00376.html


Tobias


gcc/doc/*texi patch ping

2014-04-10 Thread Tobias Burnus
I would like to ping the patch:
   http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01673.html

It's a syntax issue: It simply makes no sense to have a @menu item
which points to @nodes which are at the same or higher level
than the section in which the @menu is.

Newer makeinfo rightfully complain about this.

Tobias


[Committed] S/390: Fix htm-builtins-compile-1 for 31 bit

2014-04-10 Thread Andreas Krebbel
Hi,

the htm-builtins-compile-1.c fails on 31 bit due to compile warnings.

Fixed with the attached patch.

Bye,

-Andreas-


2014-04-10  Andreas Krebbel  

* gcc.target/s390/htm-builtins-compile-1.c: Replace long long with
long.

diff --git a/gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c 
b/gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c
index c1b98e2..982a748 100644
--- a/gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c
+++ b/gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c
@@ -27,8 +27,8 @@ foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t 
*mem64)
   cc = __builtin_tbegin ((void *)0x12345678);
   cc = __builtin_tbegin (tdb);
   cc = __builtin_tbegin (&global_tdb);
-  cc = __builtin_tbegin ((void *)(long long)(reg + 0x12345678));
-  cc = __builtin_tbegin ((void *)(long long)(reg));
+  cc = __builtin_tbegin ((void *)(long)(reg + 0x12345678));
+  cc = __builtin_tbegin ((void *)(long)(reg));
 
   __builtin_tbegin_nofloat ((void *)0);
   __builtin_tbegin_nofloat ((void *)-9);
@@ -36,8 +36,8 @@ foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t 
*mem64)
   cc = __builtin_tbegin_nofloat ((void *)0x12345678);
   cc = __builtin_tbegin_nofloat (tdb);
   cc = __builtin_tbegin_nofloat (&global_tdb);
-  cc = __builtin_tbegin_nofloat ((void *)(long long)(reg + 0x12345678));
-  cc = __builtin_tbegin_nofloat ((void *)(long long)(reg));
+  cc = __builtin_tbegin_nofloat ((void *)(long)(reg + 0x12345678));
+  cc = __builtin_tbegin_nofloat ((void *)(long)(reg));
 
   __builtin_tbegin_retry ((void *)0, 0);
   cc = __builtin_tbegin_retry ((void *)0, 1);
@@ -50,9 +50,9 @@ foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t 
*mem64)
   cc = __builtin_tbegin_retry (&global_tdb, 42);
   cc = __builtin_tbegin_retry ((void *)0x12345678, global);
   cc = __builtin_tbegin_retry (
- (void *)(long long) (reg + 0x12345678), global + 1);
+ (void *)(long) (reg + 0x12345678), global + 1);
   cc = __builtin_tbegin_retry (
- (void *)(long long)(reg), global - 1);
+ (void *)(long)(reg), global - 1);
 
   __builtin_tbegin_retry_nofloat ((void *)0, 0);
   cc = __builtin_tbegin_retry_nofloat ((void *)0, 1);
@@ -65,9 +65,9 @@ foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t 
*mem64)
   cc = __builtin_tbegin_retry_nofloat (&global_tdb, 42);
   cc = __builtin_tbegin_retry_nofloat ((void *)0x12345678, global);
   cc = __builtin_tbegin_retry_nofloat (
- (void *)(long long) (reg + 0x12345678), global + 1);
+ (void *)(long) (reg + 0x12345678), global + 1);
   cc = __builtin_tbegin_retry_nofloat (
- (void *)(long long)(reg), global - 1);
+ (void *)(long)(reg), global - 1);
 
   __builtin_tbeginc ();
 



[PATCH][AArch64][4.8] Wire up TARGET_SIMD and TARGET_FLOAT properly

2014-04-10 Thread Kyrill Tkachov

Hi all,

This is the 4.8 version of the patch posted at:
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00315.html

TARGET_CRYPTO was not defined in 4.8 therefore that hunk is removed.
Ok for the 4.8 branch?

Thanks,
Kyrill

2014-04-10  Kyrylo Tkachov  

* config/aarch64/aarch64.h (TARGET_SIMD): Take AARCH64_ISA_SIMD
into account.
(TARGET_FLOAT): Take AARCH64_ISA_FP into account.diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index c3efd2a..19ac5eb 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -73,9 +73,9 @@
 #define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN)
 
 /* AdvSIMD is supported in the default configuration, unless disabled by
-   -mgeneral-regs-only.  */
-#define TARGET_SIMD !TARGET_GENERAL_REGS_ONLY
-#define TARGET_FLOAT !TARGET_GENERAL_REGS_ONLY
+   -mgeneral-regs-only or the +nosimd extension.  */
+#define TARGET_SIMD (!TARGET_GENERAL_REGS_ONLY && AARCH64_ISA_SIMD)
+#define TARGET_FLOAT (!TARGET_GENERAL_REGS_ONLY && AARCH64_ISA_FP)
 
 #define UNITS_PER_WORD		8
 

Re: [PATCH] Fix PR c++/60764

2014-04-10 Thread Jason Merrill

On 04/09/2014 05:27 PM, Marc Glisse wrote:

The doc for the "format" attribute says clearly:

"Since non-static C++ methods have an implicit this argument, the
arguments of such methods should be counted from two, not one, when
giving values for string-index and first-to-check."


Ah.  That seems wrong to me, but if it's already documented that way I 
guess we shouldn't change it.



It would be strange to count arguments differently for different
attributes.


Agreed.

The patch is OK for after 4.9 branches.

Jason



Re: RFA: Testsuite PATCH to add support for dlopen tests

2014-04-10 Thread Ramana Radhakrishnan
On Tue, Apr 8, 2014 at 6:28 PM, Steve Ellcey  wrote:
> On Tue, 2014-04-08 at 10:10 +0200, Dominique Dhumieres wrote:
>> > richi asked for a testcase for 60731, and since we didn't already
>> > have support for tests using dlopen, I had to add it.
>> > Does this approach make sense?
>>
>> r209187 causes thousands of g++ test failures. AFAICT the failing tests are 
>> those with no
>> explicit 'dg-do compile' directive which are now trying to give an 
>> executable while
>> before r209187 they were using -S. On x86_64-apple-darwin13 the tests now 
>> fail with
>>
>> Undefined symbols for architecture ...
>>
>> TIA
>>
>> Dominique
>
> I am seeing failures on MIPS bare iron as well.  This toolchain does not
> support shared libraries and before the change it was not using '-fPIC
> -shared' during C++ compilations.  Now it is and that causes GCC to
> generate an error message.

I see failures from last night on aarch64-none-elf and arm-none-eabi
(both bare-metal) configurations even after moving up to dejagnu
1.5.1. If this can't be fixed easily should we consider reverting this
patch in the interest of getting sane test results on bare-metal
targets before the release ?

Should we also update the prereqs page to say dejagnu 1.5.1 ?
(http://gcc.gnu.org/install/prerequisites.html)

regards
Ramana

>
> Steve Ellcey
>


Re: [PATCH][C++] Fix PR60761, diagnostics in clones

2014-04-10 Thread Jakub Jelinek
On Wed, Apr 09, 2014 at 02:10:04PM -0400, Jason Merrill wrote:
> On 04/09/2014 04:21 AM, Richard Biener wrote:
> >>The names of the in-charge and not-in-charge constructor clones are
> >>complete_ctor_identifier and base_ctor_identifier (and dtor for
> >>destructors); you could check for those.
> >
> >I was more asking for how we present those To the user in diagnostics. I 
> >wanted to use a consistent 'quoting' style. If using  is fine then 
> >I'll just stick to that.
> 
> I think saying  and  would be helpful for
> distinguishing them.

My preference for 4.9 would be just print the abstract name
and nothing else and for stage1 improve that to make it clear
what is a clone (and with what kind of changes), what is which cdtor etc.

Thus, I've bootstrapped/regtested this version on x86_64-linux and
i686-linux, is this ok to everybody for now?

2014-04-10  Richard Biener  
Jakub Jelinek  

PR ipa/60761
* error.c (dump_decl) : If
DECL_LANG_SPECIFIC is NULL, but DECL_ABSTRACT_ORIGIN is not,
recurse on DECL_ABSTRACT_ORIGIN instead of printing
.

--- gcc/cp/error.c.jj   2014-03-03 08:24:14.0 +0100
+++ gcc/cp/error.c  2014-04-10 12:10:39.065707779 +0200
@@ -1145,7 +1145,12 @@ dump_decl (cxx_pretty_printer *pp, tree
 
 case FUNCTION_DECL:
   if (! DECL_LANG_SPECIFIC (t))
-   pp_string (pp, M_(""));
+   {
+ if (DECL_ABSTRACT_ORIGIN (t))
+   dump_decl (pp, DECL_ABSTRACT_ORIGIN (t), flags);
+ else
+   pp_string (pp, M_(""));
+   }
   else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
dump_global_iord (pp, t);
   else


Jakub


Re: RFA: Testsuite PATCH to add support for dlopen tests

2014-04-10 Thread Rainer Orth
Ramana Radhakrishnan  writes:

> On Tue, Apr 8, 2014 at 6:28 PM, Steve Ellcey  wrote:
>> On Tue, 2014-04-08 at 10:10 +0200, Dominique Dhumieres wrote:
>>> > richi asked for a testcase for 60731, and since we didn't already
>>> > have support for tests using dlopen, I had to add it.
>>> > Does this approach make sense?
>>>
>>> r209187 causes thousands of g++ test failures. AFAICT the failing tests
>>> are those with no
>>> explicit 'dg-do compile' directive which are now trying to give an
>>> executable while
>>> before r209187 they were using -S. On x86_64-apple-darwin13 the tests
>>> now fail with
>>>
>>> Undefined symbols for architecture ...
>>>
>>> TIA
>>>
>>> Dominique
>>
>> I am seeing failures on MIPS bare iron as well.  This toolchain does not
>> support shared libraries and before the change it was not using '-fPIC
>> -shared' during C++ compilations.  Now it is and that causes GCC to
>> generate an error message.
>
> I see failures from last night on aarch64-none-elf and arm-none-eabi
> (both bare-metal) configurations even after moving up to dejagnu
> 1.5.1. If this can't be fixed easily should we consider reverting this
> patch in the interest of getting sane test results on bare-metal
> targets before the release ?

I think we should.  I didn't have a change to look into this yet.

> Should we also update the prereqs page to say dejagnu 1.5.1 ?
> (http://gcc.gnu.org/install/prerequisites.html)

We can consider doing so *after* the release, but please not so late in
the game.

Rainer

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


[PATCH] Fix ICE with -flto -fno-use-linker-plugin (PR lto/60567)

2014-04-10 Thread Jakub Jelinek
Hi!

As Honza has determined, the problem on this testcase is that
forced_by_abi flag wasn't propagated from thunk's target to the thunk
(in this case the thunk's target was forced_by_abi = true, while the
thunk mistakenly didn't have that flag set).
The following patch copies that flag in the C++ FE, another alternative
is to do that in cgraph_add_thunk function (apparently only called by
use_thunk, thus practically the same spot, or it can be done in
function_and_variable_visibility.

I've bootstrapped/regtested this version on x86_64-linux and i686-linux,
ok for trunk?

2014-04-10  Jan Hubicka  
Jakub Jelinek  

PR lto/60567
* method.c (use_thunk): Copy forced_by_abi flag from funcn to
thunk_node.

* g++.dg/lto/pr60567_0.C: New test.

--- gcc/cp/method.c.jj  2014-03-27 08:06:11.0 +0100
+++ gcc/cp/method.c 2014-04-10 12:06:42.691968389 +0200
@@ -387,6 +387,7 @@ use_thunk (tree thunk_fndecl, bool emit_
   thunk_node = cgraph_add_thunk (funcn, thunk_fndecl, function,
 this_adjusting, fixed_offset, virtual_value,
 virtual_offset, alias);
+  thunk_node->forced_by_abi = funcn->forced_by_abi;
   if (DECL_ONE_ONLY (function))
 symtab_add_to_same_comdat_group (thunk_node,
 funcn);
--- gcc/testsuite/g++.dg/lto/pr60567_0.C.jj 2014-04-10 12:04:07.227797680 
+0200
+++ gcc/testsuite/g++.dg/lto/pr60567_0.C2014-04-10 12:06:18.063099605 
+0200
@@ -0,0 +1,23 @@
+// PR lto/60567
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -fno-use-linker-plugin } } }
+// { dg-extra-ld-options "-r -nostdlib" }
+
+#pragma implementation
+struct S {};
+
+#pragma interface
+struct T
+{
+  virtual void foo (const S &) = 0;
+};
+
+struct U
+{
+  virtual void bar (const S &) = 0;
+};
+
+struct V : public T, public U
+{
+  virtual void bar (const S &) {}
+};

Jakub


Re: [PATCH] Fix for PR libstdc++/60758

2014-04-10 Thread Alexey Merzlyakov

On 09.04.2014 15:12, Ramana Radhakrishnan wrote:

On 04/09/14 09:07, Alexey Merzlyakov wrote:

On 04.04.2014 14:44, Alexey Merzlyakov wrote:

Hi all,

Here is a patch, that fixes infinite backtraces in __cxa_end_cleanup().
The Bugzilla entry for
this:http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60758

The __cxa_end_cleanup() does not save/restore LR in function
header/footer and does not provide any unwind info,


So, your patch saves / restores LR to allow the prologue parser in GDB 
to get this right and still doesn't provide unwind info. It would be 
better to make that work correctly as well while you are here by 
providing the appropriate cfi directives.



which causes problems with GDB and other tools (e.g. unwind code in
libgcc, libbacktrace, etc.).

Best regards,
Merzlyakov Alexey

2014-04-03  Alexey Merzlyakov 

 PR libstdc++/60758
 * libsupc++/eh_arm.cc (__cxa_end_cleanup): Add LR save/restore.

diff --git a/libstdc++-v3/libsupc++/eh_arm.cc
b/libstdc++-v3/libsupc++/eh_arm.cc
index aa453dd..ead1e61 100644
--- a/libstdc++-v3/libsupc++/eh_arm.cc
+++ b/libstdc++-v3/libsupc++/eh_arm.cc
@@ -206,9 +206,9 @@ asm ("  .pushsection .text.__cxa_end_cleanup\n"
  ".type __cxa_end_cleanup, \"function\"\n"
  ".thumb_func\n"
  "__cxa_end_cleanup:\n"
-"push\t{r1, r2, r3, r4}\n"
+"push\t{r1, r2, r3, r4, lr}\n"


So if you are doing that please replace r4 by lr ? r4 is a callee save 
register and is purely used here to keep stack alignment to 64 bits. 
Not doing that isn't ideal here even though things will work because 
__cxa_end_cleanup is part of this.



  "bl\t__gnu_end_cleanup\n"
-"pop\t{r1, r2, r3, r4}\n"
+"pop\t{r1, r2, r3, r4, lr}\n"
  "bl\t_Unwind_Resume @ Never returns\n"
  ".popsection\n");
  #else
@@ -216,9 +216,9 @@ asm ("  .pushsection .text.__cxa_end_cleanup\n"
  ".global __cxa_end_cleanup\n"
  ".type __cxa_end_cleanup, \"function\"\n"
  "__cxa_end_cleanup:\n"
-"stmfd\tsp!, {r1, r2, r3, r4}\n"
+"stmfd\tsp!, {r1, r2, r3, r4, lr}\n"


and likewise.


  "bl\t__gnu_end_cleanup\n"
-"ldmfd\tsp!, {r1, r2, r3, r4}\n"
+"ldmfd\tsp!, {r1, r2, r3, r4, lr}\n"
  "bl\t_Unwind_Resume @ Never returns\n"
  ".popsection\n");
  #endif



Forgot to mention:
the patch has been tested on ARM - no regressions.


And by that what do you mean ?

arm-eabi , arm-linux-gnueabi(hf) with / without Neon, ARM state / 
Thumb state ?




regards
Ramana



Best regards,
Merzlyakov Alexey






Ok, got it. The patch fixed accordingly:
* Restored proper stack alignment.
* Added unwinding directives.

Updated patch re-tested again on arm-linux-gnueabi(sf):
$ arm-linux-gnueabi-gcc -v
  Using built-in specs.
  COLLECT_GCC=./arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/home/alexey.merzlyakov/arm/libexec/gcc/arm-linux-gnueabi/4.9.0/lto-wrapper
  Target: arm-linux-gnueabi
  Configured with: ../gcc-src/configure --host=i686-pc-linux-gnu 
--target=arm-linux-gnueabi --prefix=/home/alexey.merzlyakov/arm 
--with-sysroot=/home/alexey.merzlyakov/arm/arm-linux-gnueabi/sys-root 
--disable-libmudflap --disable-libssp --with-mode=arm --with-fpu=vfpv3 
--with-cpu=cortex-a15 --with-tune=cortex-a15 --with-float=softfp 
--disable-libatomic --disable-libgomp --enable-languages=c,c++ 
--with-gmp=/home/alexey.merzlyakov/arm 
--with-mpfr=/home/alexey.merzlyakov/arm 
--with-mpc=/home/alexey.merzlyakov/arm

  Thread model: posix
  gcc version 4.9.0 20140403 (experimental) (GCC)

Is this enough or should I test other platforms?

Best regards,
Merzlyakov Alexey

2014-04-03  Alexey Merzlyakov 

PR libstdc++/60758
* libsupc++/eh_arm.cc (__cxa_end_cleanup): Change r4 to lr in 
save/restore.


diff --git a/libstdc++-v3/libsupc++/eh_arm.cc 
b/libstdc++-v3/libsupc++/eh_arm.cc

index aa453dd..f49ad4f 100644
--- a/libstdc++-v3/libsupc++/eh_arm.cc
+++ b/libstdc++-v3/libsupc++/eh_arm.cc
@@ -199,27 +199,34 @@ asm (".global __cxa_end_cleanup\n"
 "nop5\n");
 #else
 // Assembly wrapper to call __gnu_end_cleanup without clobbering r1-r3.
-// Also push r4 to preserve stack alignment.
+// Additionally push lr to preserve stack alignment and to allow
+// backtracing.
 #ifdef __thumb__
 asm ("  .pushsection .text.__cxa_end_cleanup\n"
 ".global __cxa_end_cleanup\n"
 ".type __cxa_end_cleanup, \"function\"\n"
 ".thumb_func\n"
 "__cxa_end_cleanup:\n"
-"push\t{r1, r2, r3, r4}\n"
+".fnstart\n"
+"push\t{r1, r2, r3, lr}\n"
+".save\t{r1, r2, r3, lr}\n"
 "bl\t__gnu_end_cleanup\n"
-"pop\t{r1, r2, r3, r4}\n"
+"pop\t{r1, r2, r3, lr}\n"
 "bl\t_Unwind_Resume @ Never returns\n"
+".fnend\n"
 ".popsection\n");
 #else
 asm ("  .pushsection .text.__cxa_end_cleanup\n"
 ".global __cxa_end_cleanup\n"
 ".type __cxa_end_cleanup, \"function\"\n"
 "__cxa_end_cleanup:\n"
-"stmfd\tsp!, {r1, r2, r3, r4}\n"
+".fnstart\n"
+"stmfd\tsp!, {r1, r2, r3, lr}\n"
+".save\t{r1, r2, r3, lr}\n"
 "bl\t__gnu_end_cleanup\n"
-"ldmfd\tsp!, {r1, r2, r3,

Re: RFA: Testsuite PATCH to add support for dlopen tests

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 03:23:43PM +0200, Rainer Orth wrote:
> > I see failures from last night on aarch64-none-elf and arm-none-eabi
> > (both bare-metal) configurations even after moving up to dejagnu
> > 1.5.1. If this can't be fixed easily should we consider reverting this
> > patch in the interest of getting sane test results on bare-metal
> > targets before the release ?
> 
> I think we should.  I didn't have a change to look into this yet.

I agree, a DSO testing framework can be tested in stage1 and once it is
stable, perhaps even backported to 4.9.1, but the single test doesn't seem
to be worth the hassle for 4.9.0 right now.

Jakub


Re: [PATCH] Fix ICE with -flto -fno-use-linker-plugin (PR lto/60567)

2014-04-10 Thread Jason Merrill

On 04/10/2014 09:27 AM, Jakub Jelinek wrote:

The following patch copies that flag in the C++ FE, another alternative
is to do that in cgraph_add_thunk function (apparently only called by
use_thunk, thus practically the same spot, or it can be done in
function_and_variable_visibility.


I think Honza and I agreed yesterday to copy it in 
function_and_variable_visibility.


Jason



[PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage

2014-04-10 Thread Zamyatin, Igor
Hi!

This fixes ICE on inappropriate usage of Cilk_sync keyword.

Bootstrapped/regtested on x86_64. Ok for trunk?


Thanks,
Igor


gcc/ChangeLog:

2014-04-10  Igor Zamyatin  

  PR c++/60189
  * cp/parser.c (cp_parser_postfix_expression): Make sure only
  semicolon can go after Cilk_sync.

gcc/testsuite/ChangeLog:

2014-04-10  Igor Zamyatin  

  PR c++/60189
  * c-c++-common/cilk-plus/CK/invalid_sync.cс: New test.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7bea3d2..95f9c93 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -5835,20 +5835,33 @@ cp_parser_postfix_expression (cp_parser *parser, bool 
address_p, bool cast_p,
  }
    break;
   }
-  
+
 case RID_CILK_SYNC:
-  if (flag_cilkplus)
-   { 
- tree sync_expr = build_cilk_sync ();
- SET_EXPR_LOCATION (sync_expr, 
-    cp_lexer_peek_token (parser->lexer)->location);
- finish_expr_stmt (sync_expr);
-   }
-  else
-   error_at (token->location, "-fcilkplus must be enabled to use" 
-     " %<_Cilk_sync%>");
-  cp_lexer_consume_token (parser->lexer);
-  break;
+  {
+   cp_lexer_consume_token (parser->lexer);
+   if (flag_cilkplus)
+ {
+   token = cp_lexer_peek_token (parser->lexer);
+   if (token->type != CPP_SEMICOLON)
+ {
+   error_at (token->location, "%<_Cilk_sync%> must be followed"
+ " by semicolon");
+   postfix_expression = error_mark_node;
+   break;
+ }
+   tree sync_expr = build_cilk_sync ();
+   SET_EXPR_LOCATION (sync_expr,
+  cp_lexer_peek_token (parser->lexer)->location);
+   finish_expr_stmt (sync_expr);
+ }
+   else
+ {
+   error_at (token->location, "-fcilkplus must be enabled to use"
+ " %<_Cilk_sync%>");
+   postfix_expression = error_mark_node;
+ }
+   break;
+  }

 case RID_BUILTIN_SHUFFLE:
   {
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.сc 
b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cс
new file mode 100644
index 000..e7bec68
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cс
@@ -0,0 +1,9 @@
+/* PR c/60189 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+    _Cilk_sync return; /* { dg-error " '_Cilk_sync' must be followed by 
semicolon" } */
+    return 0;
+}


Re: [PATCH, PR60467, Cilk+] Fix for ICE with incorrect Cilk_spawn usage

2014-04-10 Thread Rainer Orth
"Zamyatin, Igor"  writes:

> gcc/ChangeLog:
>
> 2014-04-10  Igor Zamyatin  
>
>   PR middle-end/60467
>   * c-family/cilk.c (cilk_set_spawn_marker): Remove FUNCTION_DECL
>   as possible argument for Cilk_spawn.

Both c-family (and cp in your other patch) have their own ChangeLog
files.

Rainer

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


[PATCH, PR60467, Cilk+] Fix for ICE with incorrect Cilk_spawn usage

2014-04-10 Thread Zamyatin, Igor
Hi!

This patch filters out another incorrect usage of Cilk_spawn keyword.

Bootstrapped/regtested on x86_64. Ok for trunk?


Thanks,
Igor

gcc/ChangeLog:

2014-04-10  Igor Zamyatin  

  PR middle-end/60467
  * c-family/cilk.c (cilk_set_spawn_marker): Remove FUNCTION_DECL
  as possible argument for Cilk_spawn.

gcc/testsuite/ChangeLog:

2014-04-10  Igor Zamyatin  

  PR middle-end/60467
  * c-c++-common/cilk-plus/CK/invalid_spawns.c: Add new invalid
  case to check.

diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c
index 6a7bf4f..bf549ad 100644
--- a/gcc/c-family/cilk.c
+++ b/gcc/c-family/cilk.c
@@ -99,7 +99,6 @@ cilk_set_spawn_marker (location_t loc, tree fcall)
it.  */
 return false; 
   else if (TREE_CODE (fcall) != CALL_EXPR
-  && TREE_CODE (fcall) != FUNCTION_DECL
   /* In C++, TARGET_EXPR is generated when we have an overloaded
  '=' operator.  */
   && TREE_CODE (fcall) != TARGET_EXPR)
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c 
b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
index ba9e619..5b43be7 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
@@ -8,6 +8,7 @@ int main (void)
 {
   int x; 
 
+  _Cilk_spawn foo; /* { dg-error "only function calls can be spawned" } */
   _Cilk_spawn x; /* { dg-error "only function calls can be spawned" } */
   return x;
 }


RE: [PATCH, PR60467, Cilk+] Fix for ICE with incorrect Cilk_spawn usage

2014-04-10 Thread Zamyatin, Igor
Resending with correct Changelog. 

Is it OK?

Thanks,
Igor

gcc/c-family/ChangeLog:

2014-04-10  Igor Zamyatin  

  PR middle-end/60467
  * cilk.c (cilk_set_spawn_marker): Remove FUNCTION_DECL
  as possible argument for Cilk_spawn.

gcc/testsuite/ChangeLog:

2014-04-10  Igor Zamyatin  

  PR middle-end/60467
  * c-c++-common/cilk-plus/CK/invalid_spawns.c: Add new invalid
  case to check.

diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c
index 6a7bf4f..bf549ad 100644
--- a/gcc/c-family/cilk.c
+++ b/gcc/c-family/cilk.c
@@ -99,7 +99,6 @@ cilk_set_spawn_marker (location_t loc, tree fcall)
it.  */
 return false; 
   else if (TREE_CODE (fcall) != CALL_EXPR
-  && TREE_CODE (fcall) != FUNCTION_DECL
   /* In C++, TARGET_EXPR is generated when we have an overloaded
  '=' operator.  */
   && TREE_CODE (fcall) != TARGET_EXPR)
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c 
b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
index ba9e619..5b43be7 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
@@ -8,6 +8,7 @@ int main (void)
 {
   int x; 
 
+  _Cilk_spawn foo; /* { dg-error "only function calls can be spawned" } */
   _Cilk_spawn x; /* { dg-error "only function calls can be spawned" } */
   return x;
 }

> -Original Message-
> From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
> ow...@gcc.gnu.org] On Behalf Of Zamyatin, Igor
> Sent: Thursday, April 10, 2014 5:55 PM
> To: GCC Patches (gcc-patches@gcc.gnu.org)
> Cc: Iyer, Balaji V; Jakub Jelinek (ja...@redhat.com)
> Subject: [PATCH, PR60467, Cilk+] Fix for ICE with incorrect Cilk_spawn usage
> 
> Hi!
> 
> This patch filters out another incorrect usage of Cilk_spawn keyword.
> 
> Bootstrapped/regtested on x86_64. Ok for trunk?
> 
> 
> Thanks,
> Igor
> 


Re: [PATCH, PR60467, Cilk+] Fix for ICE with incorrect Cilk_spawn usage

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 02:20:42PM +, Zamyatin, Igor wrote:
> Resending with correct Changelog. 
> 
> Is it OK?
> 
> Thanks,
> Igor
> 
> gcc/c-family/ChangeLog:
> 
> 2014-04-10  Igor Zamyatin  
> 
>   PR middle-end/60467
>   * cilk.c (cilk_set_spawn_marker): Remove FUNCTION_DECL
>   as possible argument for Cilk_spawn.
> 
> gcc/testsuite/ChangeLog:
> 
> 2014-04-10  Igor Zamyatin  
> 
>   PR middle-end/60467
>   * c-c++-common/cilk-plus/CK/invalid_spawns.c: Add new invalid
>   case to check.

Ok.

Jakub


RE: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage

2014-04-10 Thread Zamyatin, Igor
Resending with correct Changelog

Is it OK?

Thanks,
Igor

gcc/cp/ChangeLog:

2014-04-10  Igor Zamyatin  

PR c++/60189
* parser.c (cp_parser_postfix_expression): Make sure only
semicolon can go after Cilk_sync.

gcc/testsuite/ChangeLog:

2014-04-10  Igor Zamyatin  

PR c++/60189
* c-c++-common/cilk-plus/CK/invalid_sync.cс: New test.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7bea3d2..95f9c93 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -5835,20 +5835,33 @@ cp_parser_postfix_expression (cp_parser *parser, bool 
address_p, bool cast_p,
  }
break;
   }
-  
+
 case RID_CILK_SYNC:
-  if (flag_cilkplus)
-   { 
- tree sync_expr = build_cilk_sync ();
- SET_EXPR_LOCATION (sync_expr, 
-cp_lexer_peek_token (parser->lexer)->location);
- finish_expr_stmt (sync_expr);
-   }
-  else
-   error_at (token->location, "-fcilkplus must be enabled to use" 
- " %<_Cilk_sync%>");
-  cp_lexer_consume_token (parser->lexer);
-  break;
+  {
+   cp_lexer_consume_token (parser->lexer);
+   if (flag_cilkplus)
+ {
+   token = cp_lexer_peek_token (parser->lexer);
+   if (token->type != CPP_SEMICOLON)
+ {
+   error_at (token->location, "%<_Cilk_sync%> must be followed"
+ " by semicolon");
+   postfix_expression = error_mark_node;
+   break;
+ }
+   tree sync_expr = build_cilk_sync ();
+   SET_EXPR_LOCATION (sync_expr,
+  cp_lexer_peek_token (parser->lexer)->location);
+   finish_expr_stmt (sync_expr);
+ }
+   else
+ {
+   error_at (token->location, "-fcilkplus must be enabled to use"
+ " %<_Cilk_sync%>");
+   postfix_expression = error_mark_node;
+ }
+   break;
+  }

 case RID_BUILTIN_SHUFFLE:
   {
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.сc 
b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cс
new file mode 100644
index 000..e7bec68
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cс
@@ -0,0 +1,9 @@
+/* PR c/60189 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+_Cilk_sync return; /* { dg-error " '_Cilk_sync' must be followed by 
semicolon" } */
+return 0;
+}

> -Original Message-
> From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
> ow...@gcc.gnu.org] On Behalf Of Zamyatin, Igor
> Sent: Thursday, April 10, 2014 5:56 PM
> To: GCC Patches (gcc-patches@gcc.gnu.org)
> Cc: Iyer, Balaji V; Jakub Jelinek (ja...@redhat.com)
> Subject: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage
> 
> Hi!
> 
> This fixes ICE on inappropriate usage of Cilk_sync keyword.
> 
> Bootstrapped/regtested on x86_64. Ok for trunk?
> 
> 
> Thanks,
> Igor
> 
> 


Re: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 02:23:16PM +, Zamyatin, Igor wrote:
> 2014-04-10  Igor Zamyatin  
> 
> PR c++/60189
> * parser.c (cp_parser_postfix_expression): Make sure only
> semicolon can go after Cilk_sync.
> 
> gcc/testsuite/ChangeLog:
> 
> 2014-04-10  Igor Zamyatin  
> 
> PR c++/60189
> * c-c++-common/cilk-plus/CK/invalid_sync.cс: New test.

CCing Jason as this is a C++ FE change.

> --- a/gcc/cp/parser.c
> +++ b/gcc/cp/parser.c
> @@ -5835,20 +5835,33 @@ cp_parser_postfix_expression (cp_parser *parser, bool 
> address_p, bool cast_p,
>   }
> break;
>}
> -  
> +
>  case RID_CILK_SYNC:
> -  if (flag_cilkplus)
> -   { 
> - tree sync_expr = build_cilk_sync ();
> - SET_EXPR_LOCATION (sync_expr, 
> -cp_lexer_peek_token (parser->lexer)->location);
> - finish_expr_stmt (sync_expr);
> -   }
> -  else
> -   error_at (token->location, "-fcilkplus must be enabled to use" 
> - " %<_Cilk_sync%>");
> -  cp_lexer_consume_token (parser->lexer);
> -  break;
> +  {

I don't see the point of adding the extra {} around the whole case,
there is no varaible declared at that point.

Other than that it looks good to me, but I'll defer the review to Jason.

> +   cp_lexer_consume_token (parser->lexer);
> +   if (flag_cilkplus)
> + {
> +   token = cp_lexer_peek_token (parser->lexer);
> +   if (token->type != CPP_SEMICOLON)
> + {
> +   error_at (token->location, "%<_Cilk_sync%> must be followed"
> + " by semicolon");
> +   postfix_expression = error_mark_node;
> +   break;
> + }
> +   tree sync_expr = build_cilk_sync ();
> +   SET_EXPR_LOCATION (sync_expr,
> +  cp_lexer_peek_token (parser->lexer)->location);
> +   finish_expr_stmt (sync_expr);
> + }
> +   else
> + {
> +   error_at (token->location, "-fcilkplus must be enabled to use"
> + " %<_Cilk_sync%>");
> +   postfix_expression = error_mark_node;
> + }
> +   break;
> +  }

Jakub


Re: [PATCH v7?] PR middle-end/60281

2014-04-10 Thread lin zuojian
Hi Bernd,
Post stations are not that 90's,and they charge.It took me $30 to
post the file to USA.It's so inconvenient and expensive  that I can't 
send a scaned version.
--
Regards
lin zuojian

On Wed, Apr 09, 2014 at 06:47:56PM +0800, lin zuojian wrote:
> Hi Bernd,
> I am asking them if they would accept a scaned image version.Post
> station is so 90's
> --
> Regards
> lin zuojian


Re: [PATCH, FORTRAN] Class Name Clash

2014-04-10 Thread Tobias Burnus
Hi Bernd,

On Thu, Apr 10, 2014 at 11:54:52AM +0200, Tobias Burnus wrote:
> No re-reading the orginal patch, I think it is okay. Thanks!
> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00376.html


Thanks for the commit. However, can you also fix the ChangeLog?
You used gcc/ChangeLog but the proper file is gcc/fortran/ChangeLog
(without "fortran/" prefix).

And while you are there: Can you also move your changelog item for
PR60191.

Thanks!

Tobias


Re: [PATCH][C++] Fix PR60761, diagnostics in clones

2014-04-10 Thread Richard Biener
On April 10, 2014 3:19:42 PM CEST, Jakub Jelinek  wrote:
>On Wed, Apr 09, 2014 at 02:10:04PM -0400, Jason Merrill wrote:
>> On 04/09/2014 04:21 AM, Richard Biener wrote:
>> >>The names of the in-charge and not-in-charge constructor clones are
>> >>complete_ctor_identifier and base_ctor_identifier (and dtor for
>> >>destructors); you could check for those.
>> >
>> >I was more asking for how we present those To the user in
>diagnostics. I wanted to use a consistent 'quoting' style. If using
> is fine then I'll just stick to that.
>> 
>> I think saying  and  would be helpful for
>> distinguishing them.
>
>My preference for 4.9 would be just print the abstract name
>and nothing else and for stage1 improve that to make it clear
>what is a clone (and with what kind of changes), what is which cdtor
>etc.
>
>Thus, I've bootstrapped/regtested this version on x86_64-linux and
>i686-linux, is this ok to everybody for now?

Works for me.

Richard.

>2014-04-10  Richard Biener  
>   Jakub Jelinek  
>
>   PR ipa/60761
>   * error.c (dump_decl) : If
>   DECL_LANG_SPECIFIC is NULL, but DECL_ABSTRACT_ORIGIN is not,
>   recurse on DECL_ABSTRACT_ORIGIN instead of printing
>   .
>
>--- gcc/cp/error.c.jj  2014-03-03 08:24:14.0 +0100
>+++ gcc/cp/error.c 2014-04-10 12:10:39.065707779 +0200
>@@ -1145,7 +1145,12 @@ dump_decl (cxx_pretty_printer *pp, tree
> 
> case FUNCTION_DECL:
>   if (! DECL_LANG_SPECIFIC (t))
>-  pp_string (pp, M_(""));
>+  {
>+if (DECL_ABSTRACT_ORIGIN (t))
>+  dump_decl (pp, DECL_ABSTRACT_ORIGIN (t), flags);
>+else
>+  pp_string (pp, M_(""));
>+  }
>   else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
>   dump_global_iord (pp, t);
>   else
>
>
>   Jakub




Re: [PATCH] PR debug/16063. Add DW_AT_type to DW_TAG_enumeration.

2014-04-10 Thread Tom Tromey
> "Mark" == Mark Wielaard  writes:

Mark> Add a new lang-hook that provides the underlying base type of an
Mark> ENUMERAL_TYPE. Including implementations for C and C++. Use this
Mark> enum_underlying_base_type lang-hook in dwarf2out.c to add a DW_AT_type
Mark> base type reference to a DW_TAG_enumeration.

Just FYI - I sent a patch for gdb to use this information.
I'll probably put it in before the gcc change goes in, on the theory
that when the gcc change goes in, nobody will have to wait to debug.
However it would be nice to be assured that the gcc change is ok in
principle first.

Tom


Re: Patch ping

2014-04-10 Thread DJ Delorie

> But ubsan is a new feature in 4.9, and it is a bootstrap failure
> with that feature.

I will leave it up to the release manager to decide if they want this
non-regression patch applied before the branch, then.

> This is for the host libiberty only, and only when gcc is configured
> a certain way.  The intent is to have libiberty that is going to be
> linked into all the build and host tools instrumented, so that we
> actually catch bugs in libiberty or bugs in host/build tools calling
> libiberty functions as much as possible, but for the lto-plugin,
> which is dlopened by the linker which we don't have a control on, we
> need host libiberty without the address sanitization because
> otherwise it would only work properly if the linker itself has been
> address sanitized.

So, if libiberty isn't built with sanitization, it would still *work*
but not be instrumented?


Re: [PATCH][C++] Fix PR60761, diagnostics in clones

2014-04-10 Thread Jason Merrill

On 04/10/2014 09:19 AM, Jakub Jelinek wrote:

Thus, I've bootstrapped/regtested this version on x86_64-linux and
i686-linux, is this ok to everybody for now?


OK.

Jason



Re: [PING] [PATCH] Fix PR rtl-optimization/pr60663

2014-04-10 Thread Jakub Jelinek
On Tue, Apr 01, 2014 at 11:41:12AM +0800, Zhenqiang Chen wrote:
> Ping?
> 
> Bootstrap and no make check regression on X86-64.
> 
> Bootstrap on ARM. In ARM regression test, some new PASS and FAIL of
> debug info check for gcc.dg/guality/pr36728-1.c and
> gcc.dg/guality/pr36728-2.c since register allocation result is
> different with the patch. There is no real new FAIL due to the patch.

> > --- a/gcc/cse.c
> > +++ b/gcc/cse.c
> > @@ -4280,6 +4280,19 @@ find_sets_in_insn (rtx insn, struct set **psets)
> > ;
> >   else if (GET_CODE (SET_SRC (y)) == CALL)
> > ;
> > + else if (GET_CODE (SET_SRC (y)) == ASM_OPERANDS)
> > +   {
> > + if (i + 1 < lim)
> > +   {
> > + rtx n = XVECEXP (x, 0, i + 1);
> > + /* For inline assemble with multiple outputs, we can 
> > not
> > +handle the SET separately.  Refer PR60663.  */
> > + if (GET_CODE (n) == SET
> > + && GET_CODE (SET_SRC (n)) == ASM_OPERANDS)
> > +   break;
> > +   }
> > + sets[n_sets++].rtl = y;
> > +   }
> >   else
> > sets[n_sets++].rtl = y;
> > }

This doesn't look like a correct fix.  First of all, it will not handle
many of the cases where we should not break the inline asm appart,
e.g. if you have:
int
foo (void)
{
  unsigned i;
  asm ("%0" : "=r" (i) : : "r5");
  return i;
}
then it will still happily drop the clobber on the floor.
But also, e.g. volatile asm or asm goto which is even stronger reason
not to fiddle with it too much, isn't handled by not adding the sets in
find_sets_in_insn, but rather just setting src_volatile flag.
So, I'd say a better fix than this is something like following patch
(untested yet, but fixes the testcase).

Or, fix up the insane arm costs for ASM_OPERANDS:
case ASM_OPERANDS:
  /* Just a guess.  Cost one insn per input.  */
  *cost = COSTS_N_INSNS (ASM_OPERANDS_INPUT_LENGTH (x));
  return true;
I don't think this heuristics is even close to reality most of the
time, more importantly, for no inputs, just outputs and clobbers it means
*cost = 0; and that is why ARM is supposedly the only target now where CSE
thinks it is worthwhile to break all inline asms without inputs appart.

2014-04-10  Jakub Jelinek  

PR rtl-optimization/60663
* cse.c (cse_insn): Set src_volatile on ASM_OPERANDS in
PARALLEL.

* gcc.target/arm/pr60663.c: New test.

--- gcc/cse.c.jj2014-03-12 10:13:41.0 +0100
+++ gcc/cse.c   2014-04-10 17:21:27.517330918 +0200
@@ -4642,6 +4642,13 @@ cse_insn (rtx insn)
  && REGNO (dest) >= FIRST_PSEUDO_REGISTER)
sets[i].src_volatile = 1;
 
+  /* Also do not record result of a non-volatile inline asm with
+more than one result or with clobbers, we do not want CSE to
+break the inline asm apart.  */
+  else if (GET_CODE (src) == ASM_OPERANDS
+  && GET_CODE (x) == PARALLEL)
+   sets[i].src_volatile = 1;
+
 #if 0
   /* It is no longer clear why we used to do this, but it doesn't
 appear to still be needed.  So let's try without it since this
--- gcc/testsuite/gcc.target/arm/pr60663.c.jj   2014-04-10 17:30:04.392608591 
+0200
+++ gcc/testsuite/gcc.target/arm/pr60663.c  2014-04-10 17:29:25.0 
+0200
@@ -0,0 +1,11 @@
+/* PR rtl-optimization/60663 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=armv7-a" } */
+
+int
+foo (void)
+{
+  unsigned i, j;
+  asm ("%0 %1" : "=r" (i), "=r" (j));
+  return i;
+}


Jakub


[Fortran-caf, patch, committed] Prepare for communication with coindexed arrays in expressions

2014-04-10 Thread Tobias Burnus
This patch adds the support for coindexed arrays in expressions (or the 
RHS of assignments) to the single-image implementation of the library. 
Additionally, it adds the required function definitions to the compiler.


Missing is adding the intrinsic in resolve.c – and converting it into 
code in trans-intrinsic.c. I have a draft patch for it, but I still need 
to fix something and clean up the patch.


Committed to the branch as Rev. 209279

Tobias
 gcc/fortran/ChangeLog.fortran-caf |8 
 gcc/fortran/gfortran.h|1 
 gcc/fortran/intrinsic.c   |   10 -
 gcc/fortran/trans-decl.c  |7 +++
 gcc/fortran/trans.h   |1 
 libgfortran/ChangeLog.fortran-caf |5 ++
 libgfortran/caf/libcaf.h  |2 +
 libgfortran/caf/single.c  |   69 --
 8 files changed, 99 insertions(+), 4 deletions(-)

Index: gcc/fortran/ChangeLog.fortran-caf
===
--- gcc/fortran/ChangeLog.fortran-caf	(Revision 209226)
+++ gcc/fortran/ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,3 +1,11 @@
+2014-04-10  Tobias Burnus  
+
+	* trans.h (gfor_fndecl_caf_remote_get_desc): Declare variables.
+	* trans-decl.c (gfor_fndecl_caf_remote_get_desc): Define it.
+	(gfc_build_builtin_function_decls_desc): Initialize it.
+	* gfortran.h (gfc_isym_id): Add GFC_ISYM_CAF_GET.
+	* intrinsic.c (add_functions): Add internal-only caf_get.
+
 2014-04-08  Tobias Burnus  
 
 	* trans.h (gfor_fndecl_caf_remote_get): Declare variables.
Index: gcc/fortran/gfortran.h
===
--- gcc/fortran/gfortran.h	(Revision 209226)
+++ gcc/fortran/gfortran.h	(Arbeitskopie)
@@ -323,6 +323,7 @@
   GFC_ISYM_CHDIR,
   GFC_ISYM_CHMOD,
   GFC_ISYM_CMPLX,
+  GFC_ISYM_CAF_GET,
   GFC_ISYM_CAF_SEND,
   GFC_ISYM_COMMAND_ARGUMENT_COUNT,
   GFC_ISYM_COMPILER_OPTIONS,
Index: gcc/fortran/intrinsic.c
===
--- gcc/fortran/intrinsic.c	(Revision 209226)
+++ gcc/fortran/intrinsic.c	(Arbeitskopie)
@@ -2994,6 +2994,14 @@
 	 x, BT_UNKNOWN, 0, REQUIRED);
 		
   make_generic ("loc", GFC_ISYM_LOC, GFC_STD_GNU);
+
+  /* The following function is internally used for coarray libray functions.
+ "make_from_module" makes it inaccessible for external users.  */
+  add_sym_2 (GFC_PREFIX ("caf_get"), GFC_ISYM_CAF_GET, CLASS_IMPURE, ACTUAL_NO,
+ BT_REAL, dr, GFC_STD_GNU, NULL, NULL, NULL,
+	 x, BT_REAL, dr, REQUIRED,
+	 "async", BT_LOGICAL, dl,  REQUIRED);
+  make_from_module();
 }
 
 
@@ -3209,7 +3217,7 @@
 	  "fptr", BT_UNKNOWN, 0, REQUIRED, INTENT_OUT);
   make_from_module();
 
-  /* The following function is internally used for coarray libray functions.
+  /* The following subroutine is internally used for coarray libray functions.
  "make_from_module" makes it inaccessible for external users.  */
   add_sym_3s (GFC_PREFIX ("caf_send"), GFC_ISYM_CAF_SEND, CLASS_IMPURE,
 	  BT_UNKNOWN, 0, GFC_STD_GNU, NULL, NULL, NULL,
Index: gcc/fortran/trans-decl.c
===
--- gcc/fortran/trans-decl.c	(Revision 209226)
+++ gcc/fortran/trans-decl.c	(Arbeitskopie)
@@ -126,6 +126,7 @@
 tree gfor_fndecl_caf_register;
 tree gfor_fndecl_caf_deregister;
 tree gfor_fndecl_caf_remote_get;
+tree gfor_fndecl_caf_remote_get_desc;
 tree gfor_fndecl_caf_send;
 tree gfor_fndecl_caf_send_desc;
 tree gfor_fndecl_caf_send_desc_scalar;
@@ -3270,6 +3271,12 @@
 	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	size_type_node, boolean_type_node);
 
+  gfor_fndecl_caf_remote_get_desc
+	= gfc_build_library_function_decl_with_spec (
+	   get_identifier (PREFIX("caf_get_desc")), "R..RW.", void_type_node, 6,
+	   pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
+	   pvoid_type_node, boolean_type_node);
+
   gfor_fndecl_caf_send = gfc_build_library_function_decl_with_spec (
 	get_identifier (PREFIX("caf_send")), "R..R..", void_type_node, 6,
 	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
Index: gcc/fortran/trans.h
===
--- gcc/fortran/trans.h	(Revision 209226)
+++ gcc/fortran/trans.h	(Arbeitskopie)
@@ -701,6 +701,7 @@
 extern GTY(()) tree gfor_fndecl_caf_register;
 extern GTY(()) tree gfor_fndecl_caf_deregister;
 extern GTY(()) tree gfor_fndecl_caf_remote_get;
+extern GTY(()) tree gfor_fndecl_caf_remote_get_desc;
 extern GTY(()) tree gfor_fndecl_caf_send;
 extern GTY(()) tree gfor_fndecl_caf_send_desc;
 extern GTY(()) tree gfor_fndecl_caf_send_desc_scalar;
Index: libgfortran/ChangeLog.fortran-caf
===
--- libgfortran/ChangeLog.fortran-caf	(Revision 209226)
+++ libgfortran/ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2014-04-10  Tobias Burnus  
+
+	* caf/libcaf.h (_gfort

[PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together

2014-04-10 Thread Zamyatin, Igor
Hi!

This patches fixes the ICE when array notation is used along with Cilk_spawn. 
We need to expand AN's loop using other routine for creating temporary 
variables.

Bootstrapped/regtested on x86_64. 
Also it introduces no new failures and fixes couple of ICE for CilkPlus 
Conformance suite which could be found here 
(https://www.cilkplus.org/download#open-specification)

Ok for trunk?

Thanks,
Igor

gcc/c/Changelog:

2014-04-10  Igor Zamyatin  
 
PR middle-end/60469
* c-array-notation.c (fix_builtin_array_notation_fn): Use
create_tmp_var instead build_decl for creating temps.
(build_array_notation_expr): Likewise.
(fix_conditional_array_notations_1): Likewise.
(fix_array_notation_expr): Likewise.
(fix_array_notation_call_expr): Likewise.

gcc/testsuite/ChangeLog:

2014-04-10  Igor Zamyatin  
 
PR middle-end/60469
* c-c++-common/cilk-plus/CK/pr60469.c: New test.


diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 6a5631c..e8db6aa 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -70,6 +70,7 @@
 #include "coretypes.h"
 #include "tree.h"
 #include "c-tree.h"
+#include "gimple-expr.h"
 #include "tree-iterator.h"
 #include "opts.h"
 #include "c-family/c-common.h"
@@ -282,8 +283,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree 
*new_var)
 
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
- integer_type_node);
+  an_loop_info[ii].var = create_tmp_var(integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -781,8 +781,7 @@ build_array_notation_expr (location_t location, tree lhs, 
tree lhs_origtype,
   for (ii = 0; ii < lhs_rank; ii++)
 if (lhs_an_info[0][ii].is_vector)
   {
-   lhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-  integer_type_node);
+   lhs_an_loop_info[ii].var = create_tmp_var(integer_type_node, NULL);
lhs_an_loop_info[ii].ind_init = build_modify_expr
  (location, lhs_an_loop_info[ii].var,
   TREE_TYPE (lhs_an_loop_info[ii].var), NOP_EXPR,
@@ -793,8 +792,7 @@ build_array_notation_expr (location_t location, tree lhs, 
tree lhs_origtype,
 {
   /* When we have a polynomial, we assume that the indices are of type 
 integer.  */
-  rhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  rhs_an_loop_info[ii].var = create_tmp_var(integer_type_node, NULL);
   rhs_an_loop_info[ii].ind_init = build_modify_expr
(location, rhs_an_loop_info[ii].var,
 TREE_TYPE (rhs_an_loop_info[ii].var), NOP_EXPR,
@@ -970,8 +968,7 @@ fix_conditional_array_notations_1 (tree stmt)
   cilkplus_extract_an_triplets (array_list, list_size, rank, &an_info);
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var(integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -1067,8 +1064,7 @@ fix_array_notation_expr (location_t location, enum 
tree_code code,
   loop_init = push_stmt_list ();
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var(integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -1163,8 +1159,7 @@ fix_array_notation_call_expr (tree arg)
 }
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var(integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR, location,
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c 
b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
new file mode 100644
index 000..61e8014
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
@@ -0,0 +1,15 @@
+/* middle-end/PR60469 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+void foo() {}
+
+#define ALEN 1024
+
+int main(int argc, char* argv[])
+{
+  int b[ALEN];
+  b[:] = 100;
+  _Cilk_spawn foo();
+  return 0;
+}


Re: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together

2014-04-10 Thread Rainer Orth
"Zamyatin, Igor"  writes:

> diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c 
> b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
> new file mode 100644
> index 000..61e8014
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
> @@ -0,0 +1,15 @@
> +/* middle-end/PR60469 */

Formatting error: PR middle-end/60469

Rainer

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


Re: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 05:19:33PM +, Zamyatin, Igor wrote:
> @@ -282,8 +283,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree 
> *new_var)
>  
>for (ii = 0; ii < rank; ii++)
>  {
> -  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
> - integer_type_node);
> +  an_loop_info[ii].var = create_tmp_var(integer_type_node, NULL);

Please fix up formatting (space before left paren), many times
in the patch.

Ok with those changes.

Looking at it, I'd question if integer_type_node is the right type for the
iterators, I'd say signed_size_type_node or something similar shouldn't be
used instead, otherwise I'm afraid if you have array notations for >= 2GB
arrays on 64-bit targets it might misbehave.
But that is definitely something for stage1, not 4.9 right now.

Jakub


Re: [PATCH] PR debug/16063. Add DW_AT_type to DW_TAG_enumeration.

2014-04-10 Thread Cary Coutant
> However it would be nice to be assured that the gcc change is ok in
> principle first.

The DWARF bits are fine with me.

-cary


RE: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together

2014-04-10 Thread Zamyatin, Igor
Fixed patch is below.

Just out of curiosity - why do you think this patch is not for 4.9?

Thanks,
Igor

gcc/c/Changelog:

2014-04-10  Igor Zamyatin  
 
PR middle-end/60469
* c-array-notation.c (fix_builtin_array_notation_fn): Use
create_tmp_var instead build_decl for creating temps.
(build_array_notation_expr): Likewise.
(fix_conditional_array_notations_1): Likewise.
(fix_array_notation_expr): Likewise.
(fix_array_notation_call_expr): Likewise.

gcc/testsuite/ChangeLog:

2014-04-10  Igor Zamyatin  
 
PR middle-end/60469
* c-c++-common/cilk-plus/CK/pr60469.c: New test.

diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 6a5631c..2aa3637 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -70,6 +70,7 @@
 #include "coretypes.h"
 #include "tree.h"
 #include "c-tree.h"
+#include "gimple-expr.h"
 #include "tree-iterator.h"
 #include "opts.h"
 #include "c-family/c-common.h"
@@ -282,8 +283,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree 
*new_var)
 
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
- integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (long_integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -781,8 +781,8 @@ build_array_notation_expr (location_t location, tree lhs, 
tree lhs_origtype,
   for (ii = 0; ii < lhs_rank; ii++)
 if (lhs_an_info[0][ii].is_vector)
   {
-   lhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-  integer_type_node);
+   lhs_an_loop_info[ii].var = create_tmp_var (long_integer_type_node,
+  NULL);
lhs_an_loop_info[ii].ind_init = build_modify_expr
  (location, lhs_an_loop_info[ii].var,
   TREE_TYPE (lhs_an_loop_info[ii].var), NOP_EXPR,
@@ -793,8 +793,8 @@ build_array_notation_expr (location_t location, tree lhs, 
tree lhs_origtype,
 {
   /* When we have a polynomial, we assume that the indices are of type 
 integer.  */
-  rhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  rhs_an_loop_info[ii].var = create_tmp_var (long_integer_type_node,
+NULL);
   rhs_an_loop_info[ii].ind_init = build_modify_expr
(location, rhs_an_loop_info[ii].var,
 TREE_TYPE (rhs_an_loop_info[ii].var), NOP_EXPR,
@@ -970,8 +970,7 @@ fix_conditional_array_notations_1 (tree stmt)
   cilkplus_extract_an_triplets (array_list, list_size, rank, &an_info);
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (long_integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -1067,8 +1066,7 @@ fix_array_notation_expr (location_t location, enum 
tree_code code,
   loop_init = push_stmt_list ();
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (long_integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -1163,8 +1161,7 @@ fix_array_notation_call_expr (tree arg)
 }
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (long_integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR, location,
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c 
b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
new file mode 100644
index 000..ca0cf7f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c
@@ -0,0 +1,15 @@
+/* PR middle-end/60469 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+void foo() {}
+
+#define ALEN 1024
+
+int main(int argc, char* argv[])
+{
+  int b[ALEN];
+  b[:] = 100;
+  _Cilk_spawn foo();
+  return 0;
+



> -Original Message-
> From: Jakub Jelinek [mailto:ja...@redhat.com]
> Sent: Thursday, April 10, 2014 9:29 PM
> To: Zamyatin, Igor
> Cc: GCC Patches (gcc-patches@gcc.g

Re: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 06:16:22PM +, Zamyatin, Igor wrote:
> Fixed patch is below.
> 
> Just out of curiosity - why do you think this patch is not for 4.9?

The one with just create_tmp_var (integer_type_node, NULL); is
for 4.9.
For the iterator var changes, I guess one needs to analyze all the types
used for array annocations, and not just in C FE, but also C++ FE, plus
really it should be size_type_node or signed_size_type_node
or ssizetype, not long_type_node, that can differ, long could be
still wider or narrower than size_t/ssize_t.

Jakub


Re: Patch ping

2014-04-10 Thread Tobias Burnus

DJ Delorie wrote:

>This is for the host libiberty only, and only when gcc is configured
>a certain way.  The intent is to have libiberty that is going to be
>linked into all the build and host tools instrumented, so that we
>actually catch bugs in libiberty or bugs in host/build tools calling
>libiberty functions as much as possible, but for the lto-plugin,
>which is dlopened by the linker which we don't have a control on, we
>need host libiberty without the address sanitization because
>otherwise it would only work properly if the linker itself has been
>address sanitized.


So, if libiberty isn't built with sanitization, it would still*work*
but not be instrumented?


That's my understanding. However, currently, without the patch the 
sanitizer is also used with the LTO plugin, which breaks the build with 
--with-build-config=bootstrap-ubsan,bootstrap-asan.


Always building libiberty without UBSAN/ASAN even when the 
bootstrap-asan/ubsan option has been used, would be an option. However, 
if one also sanitizes libiberty, one has the chance to find bugs also in 
that library.


Tobias

PS: I found the out-of-bounds checking of ASAN and the integer overflow 
checks of UBSAN very helpful for the program I use at work.


[committed] Fix IPA thunk handling (PR lto/60567)

2014-04-10 Thread Jakub Jelinek
Hi!

Honza has acked this patch on IRC, so I've committed it to trunk after
bootstrap/regtest on x86_64-linux and i686-linux.

2014-04-10  Jan Hubicka  
Jakub Jelinek  

PR lto/60567
* ipa.c (function_and_variable_visibility): Copy forced_by_abi flag from
decl_node to node.

* g++.dg/lto/pr60567_0.C: New test.

--- gcc/ipa.c.jj2014-04-10 12:17:06.0 +0200
+++ gcc/ipa.c   2014-04-10 16:27:41.546991476 +0200
@@ -1032,6 +1032,7 @@ function_and_variable_visibility (bool w
   == DECL_COMDAT_GROUP (decl_node->decl));
  gcc_checking_assert (node->same_comdat_group);
}
+ node->forced_by_abi = decl_node->forced_by_abi;
  if (DECL_EXTERNAL (decl_node->decl))
DECL_EXTERNAL (node->decl) = 1;
}
--- gcc/testsuite/g++.dg/lto/pr60567_0.C.jj 2014-04-10 12:04:07.227797680 
+0200
+++ gcc/testsuite/g++.dg/lto/pr60567_0.C2014-04-10 12:06:18.063099605 
+0200
@@ -0,0 +1,23 @@
+// PR lto/60567
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -fno-use-linker-plugin } } }
+// { dg-extra-ld-options "-r -nostdlib" }
+
+#pragma implementation
+struct S {};
+
+#pragma interface
+struct T
+{
+  virtual void foo (const S &) = 0;
+};
+
+struct U
+{
+  virtual void bar (const S &) = 0;
+};
+
+struct V : public T, public U
+{
+  virtual void bar (const S &) {}
+};

Jakub


Re: [Fortran-caf, patch, committed] Prepare for communication with coindexed arrays in expressions

2014-04-10 Thread Tobias Burnus

Tobias Burnus wrote:
Missing is adding the intrinsic in resolve.c – and converting it into 
code in trans-intrinsic.c. I have a draft patch for it, but I still 
need to fix something and clean up the patch.


I have now also committed a patch, which moves the existing code higher 
up in the file; I need caf_get_image_index for the next patch - and its 
function has to come before
Index: ChangeLog.fortran-caf
===
--- ChangeLog.fortran-caf	(Revision 209279)
+++ ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,5 +1,10 @@
 2014-04-10  Tobias Burnus  
 
+	* trans-intrinsic.c (caf_get_image_index, conv_caf_send):
+	Move functions up in the code.
+
+2014-04-10  Tobias Burnus  
+
 	* trans.h (gfor_fndecl_caf_remote_get_desc): Declare variables.
 	* trans-decl.c (gfor_fndecl_caf_remote_get_desc): Define it.
 	(gfc_build_builtin_function_decls_desc): Initialize it.
Index: trans-intrinsic.c
===
--- trans-intrinsic.c	(Revision 209278)
+++ trans-intrinsic.c	(Arbeitskopie)
@@ -925,6 +925,215 @@
 }
 
 
+/* 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) + ...  */
+
+static tree
+caf_get_image_index (stmtblock_t *block, gfc_expr *e, tree desc)
+{
+  gfc_ref *ref;
+  tree lbound, ubound, extent, tmp, img_idx;
+  gfc_se se;
+  int i;
+
+  for (ref = e->ref; ref; ref = ref->next)
+if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0)
+  break;
+  gcc_assert (ref != NULL);
+
+  img_idx = integer_zero_node;
+  extent = integer_one_node;
+  if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)))
+for (i = ref->u.ar.dimen; i < ref->u.ar.dimen + ref->u.ar.codimen; i++)
+  {
+	gfc_init_se (&se, NULL);
+	gfc_conv_expr_type (&se, ref->u.ar.start[i], integer_type_node);
+	gfc_add_block_to_block (block, &se.pre);
+	lbound = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[i]);
+	tmp = fold_build2_loc (input_location, MINUS_EXPR,
+			   integer_type_node, se.expr,
+			   fold_convert(integer_type_node, lbound));
+	tmp = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node,
+			   tmp, integer_one_node);
+	tmp = fold_build2_loc (input_location, MULT_EXPR, integer_type_node,
+			   extent, tmp);
+	img_idx = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node,
+   img_idx, tmp);
+	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);
+	  }
+  }
+  else
+for (i = ref->u.ar.dimen; i < ref->u.ar.dimen + ref->u.ar.codimen; i++)
+  {
+	gfc_init_se (&se, NULL);
+	gfc_conv_expr_type (&se, ref->u.ar.start[i], integer_type_node);
+	gfc_add_block_to_block (block, &se.pre);
+	lbound = GFC_TYPE_ARRAY_LBOUND (TREE_TYPE (desc), i);
+	lbound = fold_convert (integer_type_node, lbound);
+	tmp = fold_build2_loc (input_location, MINUS_EXPR,
+			   integer_type_node, se.expr, lbound);
+	tmp = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node,
+			   tmp, integer_one_node);
+	tmp = fold_build2_loc (input_location, MULT_EXPR, integer_type_node,
+			   extent, tmp);
+	img_idx = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node,
+   img_idx, tmp);
+	if (i < ref->u.ar.dimen + ref->u.ar.codimen - 1)
+	  {
+	ubound = GFC_TYPE_ARRAY_UBOUND (TREE_TYPE (desc), i);
+	ubound = fold_convert (integer_type_node, ubound);
+	extent = 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);
+	  }
+  }
+  return img_idx;
+}
+
+
+/* Send data to a remove coarray.  */
+
+static tree
+conv_caf_send (gfc_code *code) {
+  gfc_expr *lhs_expr, *rhs_expr, *async_expr;
+  gfc_se lhs_se, rhs_se, async_se;
+  stmtblock_t block;
+  tree caf_decl, token, offset, image_index, tmp, size;
+
+  gcc_assert (gfc_option.coarray == GFC_FCOARRAY_LIB);
+
+  lhs_expr = code->ext.actual->expr;
+  rhs_expr = code->ext.actual->next->expr;
+  async_expr = code->ext.actual->next->next->expr;
+  gfc_init_block (&block);
+
+  /* LHS: The coarray.  */
+
+  gfc_init_se (&lhs_se, NULL);
+  if (lhs_expr->rank)
+{
+  gfc_conv_expr_descriptor (&lhs_se, lhs_expr);
+  lhs_se.expr = gfc_build_addr_expr (NULL_TREE, lhs_se.expr);
+}
+  else
+{
+  lhs_se.want_pointer = 1;
+  gfc_conv_expr_reference (&lhs_se, lhs_expr);
+}
+  gfc_add_block_to_block (&block, &lhs_se.pre);
+
+  caf_decl = gfc_get_tree_for_caf_expr (lhs_expr);
+  if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
+  image_index = caf_ge

Re: [PING] [PATCH] Fix PR rtl-optimization/pr60663

2014-04-10 Thread Richard Henderson
On 04/10/2014 09:10 AM, Jakub Jelinek wrote:
> 2014-04-10  Jakub Jelinek  
> 
>   PR rtl-optimization/60663
>   * cse.c (cse_insn): Set src_volatile on ASM_OPERANDS in
>   PARALLEL.
> 
>   * gcc.target/arm/pr60663.c: New test.

Ok if it passes.

But you're right that ARM backend needs that rtx_costs change too.


r~


RE: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together

2014-04-10 Thread Zamyatin, Igor
> -Original Message-
> From: Jakub Jelinek [mailto:ja...@redhat.com]
> Sent: Thursday, April 10, 2014 10:21 PM
> To: Zamyatin, Igor
> Cc: GCC Patches (gcc-patches@gcc.gnu.org); Iyer, Balaji V
> Subject: Re: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array
> Notation together
> 
> On Thu, Apr 10, 2014 at 06:16:22PM +, Zamyatin, Igor wrote:
> > Fixed patch is below.
> >
> > Just out of curiosity - why do you think this patch is not for 4.9?
> 
> The one with just create_tmp_var (integer_type_node, NULL); is for 4.9.

Got it, thanks.

> For the iterator var changes, I guess one needs to analyze all the types used
> for array annocations, and not just in C FE, but also C++ FE, plus really it
> should be size_type_node or signed_size_type_node or ssizetype, not
> long_type_node, that can differ, long could be still wider or narrower than
> size_t/ssize_t.

Agree, that will be a next step. 

So below is the patch for 4.9 trunk.

Thanks,
Igor

gcc/c/Changelog:

2014-04-10  Igor Zamyatin  
 
PR middle-end/60469
* c-array-notation.c (fix_builtin_array_notation_fn): Use
create_tmp_var instead build_decl for creating temps.
(build_array_notation_expr): Likewise.
(fix_conditional_array_notations_1): Likewise.
(fix_array_notation_expr): Likewise.
(fix_array_notation_call_expr): Likewise.

gcc/testsuite/ChangeLog:

2014-04-10  Igor Zamyatin  
 
PR middle-end/60469
* c-c++-common/cilk-plus/CK/pr60469.c: New test.

diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 6a5631c..0ac6ba8 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -70,6 +70,7 @@
 #include "coretypes.h"
 #include "tree.h"
 #include "c-tree.h"
+#include "gimple-expr.h"
 #include "tree-iterator.h"
 #include "opts.h"
 #include "c-family/c-common.h"
@@ -282,8 +283,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree 
*new_var)
 
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
- integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -781,8 +781,8 @@ build_array_notation_expr (location_t location, tree lhs, 
tree lhs_origtype,
   for (ii = 0; ii < lhs_rank; ii++)
 if (lhs_an_info[0][ii].is_vector)
   {
-   lhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-  integer_type_node);
+   lhs_an_loop_info[ii].var = create_tmp_var (integer_type_node,
+  NULL);
lhs_an_loop_info[ii].ind_init = build_modify_expr
  (location, lhs_an_loop_info[ii].var,
   TREE_TYPE (lhs_an_loop_info[ii].var), NOP_EXPR,
@@ -793,8 +793,8 @@ build_array_notation_expr (location_t location, tree lhs, 
tree lhs_origtype,
 {
   /* When we have a polynomial, we assume that the indices are of type 
 integer.  */
-  rhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  rhs_an_loop_info[ii].var = create_tmp_var (integer_type_node,
+NULL);
   rhs_an_loop_info[ii].ind_init = build_modify_expr
(location, rhs_an_loop_info[ii].var,
 TREE_TYPE (rhs_an_loop_info[ii].var), NOP_EXPR,
@@ -970,8 +970,7 @@ fix_conditional_array_notations_1 (tree stmt)
   cilkplus_extract_an_triplets (array_list, list_size, rank, &an_info);
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -1067,8 +1066,7 @@ fix_array_notation_expr (location_t location, enum 
tree_code code,
   loop_init = push_stmt_list ();
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (integer_type_node, NULL);
   an_loop_info[ii].ind_init =
build_modify_expr (location, an_loop_info[ii].var,
   TREE_TYPE (an_loop_info[ii].var), NOP_EXPR,
@@ -1163,8 +1161,7 @@ fix_array_notation_call_expr (tree arg)
 }
   for (ii = 0; ii < rank; ii++)
 {
-  an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE,
-integer_type_node);
+  an_loop_info[ii].var = create_tmp_var (integer_type_node,

Ping: [PATCH, PR 60556] Fix ICE on platforms with signed pointer extension.

2014-04-10 Thread Steve Ellcey
Patch ping.  This is not a regression as I can reproduce it on GCC 4.8.*
but it is an ICE on legal C code.  Any chance of having it approved for
4.9?

Steve Ellcey
sell...@mips.com


On Thu, 2014-03-20 at 09:48 -0700, Steve Ellcey wrote:
> This patch fixes pr60556, a GCC ICE.  The problem is in convert_move where,
> if we are trying to put a 32 bit address into a 64 bit destination we
> can wind up calling emit_move_insn with NULL_RTX as a source.
> 
> The problem comes when creating fill_value.  If unsignedp is false
> then we call emit_store_flag to set fill_value.  If lowfrom is a symbol
> reference then emit_store_flag returns NULL_RTX (because symbol references
> are constant) and we wind up calling emit_move_insn with NULL_RTX as a
> source and getting an ICE.
> 
> My fix is to check for a symbol reference up where we are already 
> checking for memory references and force the symbol into a register
> before calling emit_store_flag.  This will prevent emit_store_flag
> from returning NULL_RTX.  In theory we could force the symbol
> reference into a register only if unsignedp is false, but I think
> it is cleaner to always put the symbol reference into a register.
> 
> Tested on mips-mti-linux-gnu with no regressions.
> 
> OK for checkin?
> 
> Steve Ellcey
> sell...@mips.com
> 
> 
> 2014-03-20  Steve Ellcey  
> 
>   PR middle-end/60556
>   * expr.c (convert_move): Force symbol references into register.
> 
> 
> diff --git a/gcc/expr.c b/gcc/expr.c
> index be62c53..d065588 100644
> --- a/gcc/expr.c
> +++ b/gcc/expr.c
> @@ -533,7 +533,8 @@ convert_move (rtx to, rtx from, int unsignedp)
>   conversion sequence might require several references to it and we
>   must ensure we're getting the same value every time.  */
>  
> -  if (MEM_P (from) || reg_overlap_mentioned_p (to, from))
> +  if (MEM_P (from) || GET_CODE (from) == SYMBOL_REF
> +   || reg_overlap_mentioned_p (to, from))
>   from = force_reg (from_mode, from);
>  
>/* Get a copy of FROM widened to a word, if necessary.  */
> 
> 
> 
> 2014-03-20  Steve Ellcey  
> 
>   PR middle-end/60556
>   gcc.dg/pr60556.c: New.
> 
> 
> diff --git a/gcc/testsuite/gcc.dg/pr60556.c b/gcc/testsuite/gcc.dg/pr60556.c
> new file mode 100644
> index 000..3b5bbe5
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr60556.c
> @@ -0,0 +1,7 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +
> +int g (int);
> +unsigned long long f(void) {
> + return (unsigned long long)(long)&g;
> +}





Re: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together

2014-04-10 Thread Jakub Jelinek
On Thu, Apr 10, 2014 at 07:55:26PM +, Zamyatin, Igor wrote:
> So below is the patch for 4.9 trunk.

Ok, thanks.
> 
> Thanks,
> Igor
> 
> gcc/c/Changelog:
> 
> 2014-04-10  Igor Zamyatin  
>  
>   PR middle-end/60469
>   * c-array-notation.c (fix_builtin_array_notation_fn): Use
>   create_tmp_var instead build_decl for creating temps.
>   (build_array_notation_expr): Likewise.
>   (fix_conditional_array_notations_1): Likewise.
>   (fix_array_notation_expr): Likewise.
>   (fix_array_notation_call_expr): Likewise.
> 
> gcc/testsuite/ChangeLog:
> 
> 2014-04-10  Igor Zamyatin  
>  
>   PR middle-end/60469
>   * c-c++-common/cilk-plus/CK/pr60469.c: New test.

Jakub


RE: [PATCH, FORTRAN] Class Name Clash

2014-04-10 Thread Bernd Edlinger
Hi,

On Thu, 10 Apr 2014 17:15:16, Tobias Burnus wrote:
>
> Hi Bernd,
>
> On Thu, Apr 10, 2014 at 11:54:52AM +0200, Tobias Burnus wrote:
>> No re-reading the orginal patch, I think it is okay. Thanks!
>> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00376.html
>
>
> Thanks for the commit. However, can you also fix the ChangeLog?
> You used gcc/ChangeLog but the proper file is gcc/fortran/ChangeLog
> (without "fortran/" prefix).
>
> And while you are there: Can you also move your changelog item for
> PR60191.
>
> Thanks!
>
> Tobias

Done,

Thanks
Bernd.

Re: [RFC][PATCH][MIPS] Patch to enable LRA for MIPS backend

2014-04-10 Thread Richard Sandiford
Richard Sandiford  writes:
> Robert Suchanek  writes:
>> I'm not particularly happy with this either. This was an attempt to fix an 
>> ICE for 
>> the following RTL (gcc.dg/torture/asm-subreg-1.c compiled with -mips32r2 
>> -mips16 -O1):
>>
>> (insn 9 8 0 2 (asm_operands/v ("") ("") 0 [
>> (mem/v/j/c:HI (lo_sum:SI (const:SI (unspec:SI [
>> (const_int 0 [0])
>> ] UNSPEC_GP))
>> (symbol_ref:SI ("_const_32") [flags 0x6]  > 0x7f50acd17558 _const_32>)) [0 _const_32+0 S2 A32])]
>>  [(asm_input:HI ("X") (null):0)]
>>  [] asm-subreg-1.c:13) asm-subreg-1.c:13 -1 (nil))
>>
>> Any suggestions to handle this case?
>
> Thanks for the pointer.  I think this shows a more fundamental problem
> with the handling of "X" constraints.  With something like:
>
> void
> foo (int **x, int y, int z)
> {
>   int *ptr = *x + y * z / 11;
>   __asm__ __volatile__ ("" : : "X" (*ptr));
> }
>
> the entire expression gets treated as a MEM address, which neither
> reload nor LRA can handle.  And with something like that, it isn't
> obvious what class all the registers in the address should have.
> With a sufficiently-complicated expression you could run out of registers.
>
> So perhaps we should limit the propagation to things that
> decompose_mem_address can handle.

Even that might be too loose, since invalid scales will need to be reloaded
as a multiplication or shift, and there's no guarantee that the target
can do that without clobbering the flags.  So maybe we should do something
like the patch below.

Alternatively we could stick to the decompose_mem_address-based check
above and teach LRA to keep invalid addresses for 'X'.  The problem then
is that we might ICE while printing the operand.

Thanks,
Richard


gcc/
* recog.c (asm_operand_ok): Tighten MEM validity for 'X'.

gcc/testsuite/
* gcc.dg/torture/asm-x-constraint-1.c: New test.

Index: gcc/recog.c
===
--- gcc/recog.c 2014-04-10 21:18:02.778009424 +0100
+++ gcc/recog.c 2014-04-10 21:18:02.996011570 +0100
@@ -1840,7 +1840,11 @@ asm_operand_ok (rtx op, const char *cons
  break;
 
case 'X':
- result = 1;
+ /* Still enforce memory requirements for non-constant addresses,
+since we can't reload MEMs with completely arbitrary addresses.  */
+ result = (!MEM_P (op)
+   || CONSTANT_P (XEXP (op, 0))
+   || memory_operand (op, VOIDmode));
  break;
 
case 'g':
Index: gcc/testsuite/gcc.dg/torture/asm-x-constraint-1.c
===
--- /dev/null   2014-04-10 19:40:00.640011981 +0100
+++ gcc/testsuite/gcc.dg/torture/asm-x-constraint-1.c   2014-04-10 
21:19:05.405623027 +0100
@@ -0,0 +1,6 @@
+void
+foo (int **x, int y, int z)
+{
+  int *ptr = *x + y * z / 11;
+  __asm__ __volatile__ ("foo %0" : : "X" (*ptr));
+}


[GOOGLE] Fix incorrect detection of recursive calls during LIPO IPA inlining

2014-04-10 Thread Teresa Johnson
This patch fixes an issue where self-recursive calls were missed
during ipa inlining in LIPO compiles, since the resolved nodes were
not checked. When a self-recursive call was inlined incorrectly,
ipa_inline redirected the edge to the resolved node, leading to
a cycle in the cgraph that wasn't expected and resulted in an
infinite loop in estimate_calls_size_and_time.

Also fix an inconsistency in the declaration of include_all_aux
that was exposed when l-ipo.h was included in cgraph.

Google ref b/13912450.

Bootstrapped and tested. Ok for google/4_8?

Thanks,
Teresa

2014-04-10  Teresa Johnson  

* cgraph.h (cgraph_edge_recursive_p): Check the resolved
node in LIPO compiles.
* l-ipo.h (include_all_aux): Fix declaration that didn't
match definition.
* Makefile.in (CGRAPH_H): Include l-ipo.h.

Index: cgraph.h
===
--- cgraph.h(revision 209280)
+++ cgraph.h(working copy)
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "basic-block.h"
 #include "function.h"
 #include "ipa-ref.h"
+#include "l-ipo.h"

 /* Symbol table consists of functions and variables.
TODO: add labels, constant pool and aliases.  */
@@ -1388,10 +1389,15 @@ static inline bool
 cgraph_edge_recursive_p (struct cgraph_edge *e)
 {
   struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL);
+  struct cgraph_node *caller = e->caller;
   if (e->caller->global.inlined_to)
-return e->caller->global.inlined_to->symbol.decl == callee->symbol.decl;
-  else
-return e->caller->symbol.decl == callee->symbol.decl;
+caller = e->caller->global.inlined_to;
+  if (L_IPO_COMP_MODE && cgraph_pre_profiling_inlining_done)
+{
+  callee = cgraph_lipo_get_resolved_node (callee->symbol.decl);
+  caller = cgraph_lipo_get_resolved_node (caller->symbol.decl);
+}
+  return (caller->symbol.decl == callee->symbol.decl);
 }

 /* Return true if the TM_CLONE bit is set for a given FNDECL.  */
Index: l-ipo.h
===
--- l-ipo.h (revision 209280)
+++ l-ipo.h (working copy)
@@ -44,7 +44,7 @@ extern unsigned primary_module_id;

 /* Current module id.  */
 extern unsigned current_module_id;
-extern unsigned include_all_aux;
+extern bool include_all_aux;
 extern struct gcov_module_info **module_infos;
 extern int is_last_module (unsigned mod_id);

Index: Makefile.in
===
--- Makefile.in (revision 209280)
+++ Makefile.in (working copy)
@@ -904,7 +904,8 @@ CFGLOOP_H = cfgloop.h $(BASIC_BLOCK_H) double-int.
 IPA_UTILS_H = ipa-utils.h $(TREE_H) $(CGRAPH_H)
 IPA_REFERENCE_H = ipa-reference.h $(BITMAP_H) $(TREE_H)
 CGRAPH_H = cgraph.h $(VEC_H) $(TREE_H) $(BASIC_BLOCK_H) $(FUNCTION_H) \
-   cif-code.def ipa-ref.h ipa-ref-inline.h $(LINKER_PLUGIN_API_H) is-a.h
+   cif-code.def ipa-ref.h ipa-ref-inline.h $(LINKER_PLUGIN_API_H) is-a.h \
+   l-ipo.h
 DF_H = df.h $(BITMAP_H) $(REGSET_H) sbitmap.h $(BASIC_BLOCK_H) \
alloc-pool.h $(TIMEVAR_H)
 VALTRACK_H = valtrack.h $(BITMAP_H) $(DF_H) $(RTL_H) $(BASIC_BLOCK_H) \


-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [GOOGLE] Fix incorrect detection of recursive calls during LIPO IPA inlining

2014-04-10 Thread Xinliang David Li
Looks good to me.

David

On Thu, Apr 10, 2014 at 2:04 PM, Teresa Johnson  wrote:
> This patch fixes an issue where self-recursive calls were missed
> during ipa inlining in LIPO compiles, since the resolved nodes were
> not checked. When a self-recursive call was inlined incorrectly,
> ipa_inline redirected the edge to the resolved node, leading to
> a cycle in the cgraph that wasn't expected and resulted in an
> infinite loop in estimate_calls_size_and_time.
>
> Also fix an inconsistency in the declaration of include_all_aux
> that was exposed when l-ipo.h was included in cgraph.
>
> Google ref b/13912450.
>
> Bootstrapped and tested. Ok for google/4_8?
>
> Thanks,
> Teresa
>
> 2014-04-10  Teresa Johnson  
>
> * cgraph.h (cgraph_edge_recursive_p): Check the resolved
> node in LIPO compiles.
> * l-ipo.h (include_all_aux): Fix declaration that didn't
> match definition.
> * Makefile.in (CGRAPH_H): Include l-ipo.h.
>
> Index: cgraph.h
> ===
> --- cgraph.h(revision 209280)
> +++ cgraph.h(working copy)
> @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "basic-block.h"
>  #include "function.h"
>  #include "ipa-ref.h"
> +#include "l-ipo.h"
>
>  /* Symbol table consists of functions and variables.
> TODO: add labels, constant pool and aliases.  */
> @@ -1388,10 +1389,15 @@ static inline bool
>  cgraph_edge_recursive_p (struct cgraph_edge *e)
>  {
>struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, 
> NULL);
> +  struct cgraph_node *caller = e->caller;
>if (e->caller->global.inlined_to)
> -return e->caller->global.inlined_to->symbol.decl == callee->symbol.decl;
> -  else
> -return e->caller->symbol.decl == callee->symbol.decl;
> +caller = e->caller->global.inlined_to;
> +  if (L_IPO_COMP_MODE && cgraph_pre_profiling_inlining_done)
> +{
> +  callee = cgraph_lipo_get_resolved_node (callee->symbol.decl);
> +  caller = cgraph_lipo_get_resolved_node (caller->symbol.decl);
> +}
> +  return (caller->symbol.decl == callee->symbol.decl);
>  }
>
>  /* Return true if the TM_CLONE bit is set for a given FNDECL.  */
> Index: l-ipo.h
> ===
> --- l-ipo.h (revision 209280)
> +++ l-ipo.h (working copy)
> @@ -44,7 +44,7 @@ extern unsigned primary_module_id;
>
>  /* Current module id.  */
>  extern unsigned current_module_id;
> -extern unsigned include_all_aux;
> +extern bool include_all_aux;
>  extern struct gcov_module_info **module_infos;
>  extern int is_last_module (unsigned mod_id);
>
> Index: Makefile.in
> ===
> --- Makefile.in (revision 209280)
> +++ Makefile.in (working copy)
> @@ -904,7 +904,8 @@ CFGLOOP_H = cfgloop.h $(BASIC_BLOCK_H) double-int.
>  IPA_UTILS_H = ipa-utils.h $(TREE_H) $(CGRAPH_H)
>  IPA_REFERENCE_H = ipa-reference.h $(BITMAP_H) $(TREE_H)
>  CGRAPH_H = cgraph.h $(VEC_H) $(TREE_H) $(BASIC_BLOCK_H) $(FUNCTION_H) \
> -   cif-code.def ipa-ref.h ipa-ref-inline.h $(LINKER_PLUGIN_API_H) is-a.h
> +   cif-code.def ipa-ref.h ipa-ref-inline.h $(LINKER_PLUGIN_API_H) is-a.h 
> \
> +   l-ipo.h
>  DF_H = df.h $(BITMAP_H) $(REGSET_H) sbitmap.h $(BASIC_BLOCK_H) \
> alloc-pool.h $(TIMEVAR_H)
>  VALTRACK_H = valtrack.h $(BITMAP_H) $(DF_H) $(RTL_H) $(BASIC_BLOCK_H) \
>
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [DOC PATCH] Rewrite docs for inline asm

2014-04-10 Thread dw
Hans-Peter Nilsson: Did you have any follow up here?  Or did this 
response (below) address all your concerns?


I have made some minor corrections since this post:

- "make dvi" now builds my text without errors (can't say this for the 
rest of extend.texi).
- All (instead of nearly all) the asm-related subjects are now in the 
same menu.

- Minor cleanup of asm prototype for Extended Asm.

Before re-posting this ~60k patch, I thought I'd wait to see if you (or 
anyone else) had any final comments.  If you want to see a 
human-readable version with all the current updates, it's at:


http://www.LimeGreenSocks.com/gcc/Using-Assembly-Language-with-C.html

The first two sections on this menu ("Basic Asm" & "Extended Asm") 
contain all the new text.  The last four sections were just moved from 
elsewhere to this menu to group all asm-related items together.


If there are no more comments by this time tomorrow, I'll re-post the 
"final" patch.


Thanks,
dw

On 4/8/2014 10:29 PM, dw wrote:


On 4/8/2014 4:17 PM, Hans-Peter Nilsson wrote:

On Fri, 4 Apr 2014, dw wrote:

Problem description:
The existing documentation does an inadequate job of describing gcc's
implementation of the "asm" keyword.  This has led to a great deal of
confusion as people struggle to understand how it works. This entire 
section
requires a rewrite that provides a structured layout and detailed 
descriptions

of each of the parameters along with examples.

ChangeLog:
2014-04-03 David Wohlferd (limegreenso...@yahoo.com)
Andrew Haley (a...@redhat.com)
Richard Sandiford (rdsandif...@googlemail.com)

* extend.texi: Completely rewrite inline asm section / 
minor reorg

of asm-related sections

(No other feedback since friday?)


Most people who had input probably responded in the RFD on the GCC 
list (http://gcc.gnu.org/ml/gcc/2014-02/msg00511.html).


I haven't heard from the doc maintainers yet, but I understand that at 
least one of them is out of town.



Thanks for doing this!


Thank you for the response and the feedback.


There are some *minor* issues, like two-spaces-after-"." which
(IIRC) makes a semantic difference in texinfo,


I wasn't aware this was a thing.  All those years of typing classes 
make this habit hard to break.  Doing a search, it appears my changes 
aren't the only place in extend.texi that does this. I've fixed mine.



and missing use
of texinfo markup like @emph{not} instead of NOT.


Hmm.  If this is a standards thing, I suppose I should.  Looks like I 
only did it twice (and both in the same paragraph).  Fixed.



Also, in the
ChangeLog is the first of many overly long lines.  Please keep
lines shorter than 80 chars like the rest of extend.texi,
somewhere between 70-79 chars?


Sorry.  Again, I didn't know this was a thing.  texinfo doesn't seem 
to mind, and the html pages I was generating didn't seem to care either.


I've fixed most of this.  There are a couple of places I need someone 
who is better at texinfo/formatting to help me out.



Also, code snippets in texinfo
should use GNU formatting, including comments (full sentences
with capitalization and full stop).


I've fixed up the things I can see, but I'm no expert in GNU 
formatting.  If there's more, I'll need someone to tell me what is 
needed.



Also,

+   : [d] "=rm" (d)
+   : [e] "rm" (*e)
+   : );

That last bit, the ": )" (empty last operand part) shouldn't be
in the documentation.  I'm not even sure it *should* work
(apparently it does, perhaps by accident).


I'd be tempted to debate this one, but I think I'm just going to 
change it instead.  Worms, cans, fixed.



The general bits seems like a big improvement, but what worries
me is the deleted text.  For example, the aspects of "Explicit
Reg Vars" when *directly feeding an asm* and how to write them
to avoid the named registers being call-clobbered between
assignment and the asm.  (Don't confuse this with the
asm-clobber operands which I think you covered fine.)  Those
details are maybe not thoughtfully described, but they can't be
just plainly removed as they also serve as gcc specification;
definitions as to what works and doesn't work!  (I don't know if
that was the only occurrence.)


I don't believe that section you are talking about was actually 
deleted, but has instead been moved (along with "Asm Labels" and "Size 
of an asm").  Looking at the new docs, instead of those sections being 
buried with the ~60 other items like in the old docs 
(http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/C-Extensions.html), 
(nearly) all the asm-related subjects got moved here 
(http://www.LimeGreenSocks.com/gcc/Using-Assembly-Language-with-C.html). 
That's what the "minor reorg of asm-related sections" was about.



Also, do we really want to document the trick in
  "m" ((@{ struct @{ char x[10]; @} *p = (void *) ptr ; *p; @}))
(note: reformatted GNU-style and confusing @{ @} dropped)
IIRC this is from Linux, but I don't think GCC ever promised the
described sema

[gcc-4.8-branch] path to fix PR60769

2014-04-10 Thread Vladimir Makarov

  The following patch fixes

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60769

  The patch was bootstrapped and tested on x86/x86-64.

  Committed as rev. 209285.

2014-04-10  Vladimir Makarov  

PR rtl-optimization/60769
* lra-constraints.c (simplify_operand_subreg): Force reload of
paradoxical subreg if it is not in the class contents.

2014-04-10  Vladimir Makarov  

PR rtl-optimization/60769
* g++.dg/pr60769.C: New.
Index: lra-constraints.c
===
--- lra-constraints.c   (revision 209283)
+++ lra-constraints.c   (working copy)
@@ -1156,6 +1156,8 @@ simplify_operand_subreg (int nop, enum m
   enum machine_mode mode;
   rtx reg, new_reg;
   rtx operand = *curr_id->operand_loc[nop];
+  enum reg_class regclass;
+  enum op_type type;
 
   before = after = NULL_RTX;
 
@@ -1164,6 +1166,7 @@ simplify_operand_subreg (int nop, enum m
 
   mode = GET_MODE (operand);
   reg = SUBREG_REG (operand);
+  type = curr_static_id->operand[nop].type;
   /* If we change address for paradoxical subreg of memory, the
  address might violate the necessary alignment or the access might
  be slow.  So take this into consideration.  We should not worry
@@ -1236,6 +1239,55 @@ simplify_operand_subreg (int nop, enum m
 "Inserting subreg reload");
   return true;
 }
+  /* Force a reload for a paradoxical subreg. For paradoxical subreg,
+ IRA allocates hardreg to the inner pseudo reg according to its mode
+ instead of the outermode, so the size of the hardreg may not be enough
+ to contain the outermode operand, in that case we may need to insert
+ reload for the reg. For the following two types of paradoxical subreg,
+ we need to insert reload:
+ 1. If the op_type is OP_IN, and the hardreg could not be paired with
+other hardreg to contain the outermode operand
+(checked by in_hard_reg_set_p), we need to insert the reload.
+ 2. If the op_type is OP_OUT or OP_INOUT.  */
+  else if (REG_P (reg)
+  && REGNO (reg) >= FIRST_PSEUDO_REGISTER
+  && (hard_regno = lra_get_regno_hard_regno (REGNO (reg))) >= 0
+  && (hard_regno_nregs[hard_regno][GET_MODE (reg)]
+  < hard_regno_nregs[hard_regno][mode])
+  && (regclass = lra_get_allocno_class (REGNO (reg)))
+  && (type != OP_IN
+  || !in_hard_reg_set_p (reg_class_contents[regclass],
+ mode, hard_regno)))
+{
+  /* The class will be defined later in curr_insn_transform.  */
+  enum reg_class rclass
+   = (enum reg_class) targetm.preferred_reload_class (reg, ALL_REGS);
+  rtx subreg;
+  
+  new_reg = lra_create_new_reg_with_unique_value (mode, reg, rclass,
+ "paradoxical subreg");
+  PUT_MODE (new_reg, mode);
+  subreg = simplify_gen_subreg (GET_MODE (reg), new_reg, mode, 0);
+  if (type != OP_OUT)
+   {
+ push_to_sequence (before);
+ lra_emit_move (subreg, reg);
+ before = get_insns ();
+ end_sequence ();
+   }
+  if (type != OP_IN)
+   {
+ start_sequence ();
+ lra_emit_move (reg, subreg);
+ emit_insn (after);
+ after = get_insns ();
+ end_sequence ();
+   }
+  SUBREG_REG (operand) = new_reg;
+  lra_process_new_insns (curr_insn, before, after,
+ "Inserting paradoxical subreg reload");
+  return true;
+}
   return false;
 }
 
Index: testsuite/g++.dg/pr60769.C
===
--- testsuite/g++.dg/pr60769.C  (revision 0)
+++ testsuite/g++.dg/pr60769.C  (working copy)
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+template  void fun(T);
+struct B {};
+struct R {
+  int *x;
+  B f;
+};
+R v(int &, R);
+void rfun(R &);
+struct A {
+  void m_fn2(R p1) {
+R a = p1;
+rfun(p1);
+fun(this);
+fun(a);
+  }
+};
+struct J {
+  A ep;
+  A ap;
+  int c2a;
+  void m_fn1(R &p2) {
+R d, e, b;
+v(c2a, p2);
+e = v(c2a, b);
+ap.m_fn2(e);
+v(c2a, p2);
+d = v(c2a, b);
+ep.m_fn2(d);
+  }
+};
+struct N {
+  int &p_;
+  J cfo;
+};
+void fn3(N&n) {
+  R h;
+  n.cfo.m_fn1(h);
+}
+extern N &c;
+void fn1() { fn3(c); }


Fix indirect call profiling for COMDAT symbols

2014-04-10 Thread Jan Hubicka
Hi,
while looking into firefox profiles, I noticed that we miss devirtualizations
to comdat symbols, because we manage to get different profile_id in each
unit.  This is easily fixed by the following patch that makes profiled_id
to by crc32 of the symbol name in this case.

Bootstrapped/regtested x86_64-linux, tested with firefox, will
commit it tomorrow.

* coverage.c (coverage_compute_profile_id): Make stable for
global symbols
* ipa-utils.c (ipa_merge_profiles): Merge profile_id.
* lto/lto-symtab.c (lto_cgraph_replace_node): Don't re-merge
tp_first_run.
Index: coverage.c
===
--- coverage.c  (revision 209170)
+++ coverage.c  (working copy)
@@ -555,18 +555,31 @@ coverage_compute_lineno_checksum (void)
 unsigned
 coverage_compute_profile_id (struct cgraph_node *n)
 {
-  expanded_location xloc
-= expand_location (DECL_SOURCE_LOCATION (n->decl));
-  unsigned chksum = xloc.line;
+  unsigned chksum;
 
-  chksum = coverage_checksum_string (chksum, xloc.file);
-  chksum = coverage_checksum_string
-(chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl)));
-  if (first_global_object_name)
-chksum = coverage_checksum_string
-  (chksum, first_global_object_name);
-  chksum = coverage_checksum_string
-(chksum, aux_base_name);
+  /* Externally visible symbols have unique name.  */
+  if (TREE_PUBLIC (n->decl) || DECL_EXTERNAL (n->decl))
+{
+  /* Do not use coverage_checksum_string here; we really want unique
+symbol name id.  */
+  chksum = crc32_string
+   (0, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl)));
+}
+  else
+{
+  expanded_location xloc
+   = expand_location (DECL_SOURCE_LOCATION (n->decl));
+
+  chksum = xloc.line;
+  chksum = coverage_checksum_string (chksum, xloc.file);
+  chksum = coverage_checksum_string
+   (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl)));
+  if (first_global_object_name)
+   chksum = coverage_checksum_string
+ (chksum, first_global_object_name);
+  chksum = coverage_checksum_string
+   (chksum, aux_base_name);
+}
 
   /* Non-negative integers are hopefully small enough to fit in all targets.  
*/
   return chksum & 0x7fff;
Index: ipa-utils.c
===
--- ipa-utils.c (revision 209170)
+++ ipa-utils.c (working copy)
@@ -660,6 +660,21 @@ ipa_merge_profiles (struct cgraph_node *
   if (dst->tp_first_run > src->tp_first_run && src->tp_first_run)
 dst->tp_first_run = src->tp_first_run;
 
+  if (src->profile_id)
+{
+  if (!dst->profile_id)
+   dst->profile_id = src->profile_id;
+  else
+   {
+if (src->profile_id != dst->profile_id)
+  {
+dump_cgraph_node (stderr, src);
+dump_cgraph_node (stderr, dst);
+  }
+gcc_assert (src->profile_id == dst->profile_id);
+   }
+}
+
   if (!dst->count)
 return;
   if (cgraph_dump_file)
Index: lto/lto-symtab.c
===
--- lto/lto-symtab.c(revision 209170)
+++ lto/lto-symtab.c(working copy)
@@ -91,12 +91,6 @@ lto_cgraph_replace_node (struct cgraph_n
   if (node->decl != prevailing_node->decl)
 cgraph_release_function_body (node);
 
-  /* Time profile merging */
-  if (node->tp_first_run)
-prevailing_node->tp_first_run = prevailing_node->tp_first_run ?
-  MIN (prevailing_node->tp_first_run, node->tp_first_run) :
-  node->tp_first_run;
-
   /* Finally remove the replaced node.  */
   cgraph_remove_node (node);
 }


Free inline summaries before WPA streaming

2014-04-10 Thread Jan Hubicka
Hi,
this one liner should save some WPA streaming memory by throwing out the
inline info that is no longer needed after partitioning.

Bootstrapped/regtested x86_64-linux, tested with Firefox, will commit
it tomorrow.
* lto/lto.c: Include ipa-inline.h
(do_whole_program_analysis): Free inline summary.
Index: lto/lto.c
===
--- lto/lto.c   (revision 209170)
+++ lto/lto.c   (working copy)
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3.
 #include "data-streamer.h"
 #include "context.h"
 #include "pass_manager.h"
+#include "ipa-inline.h"
 
 
 /* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver.  
*/
@@ -3273,6 +3278,10 @@ do_whole_program_analysis (void)
   else
 lto_balanced_map ();
 
+  /* Inline summaries are needed for balanced partitioning.  Free them now so
+ the memory can be used for streamer caches.  */
+  inline_free_summary ();
+
   /* AUX pointers are used by partitioning code to bookkeep number of
  partitions symbol is in.  This is no longer needed.  */
   FOR_EACH_SYMBOL (node)


Re: [PATCH] LeakSanitizer testsuite

2014-04-10 Thread Yury Gribov

This patch adds initial set of tests and dg infrastructure for
LeakSanitizer runtime.


Are you sure we need testsuite for something that doesn't have a GCC code
generation counterpart at all?


That's a valid point. We want this in GCC because
(1) support for cross-compilation and cross-testing in LLVM LSan is much 
less mature so testing non-Intel platforms there is PITA
(2) even though the code itself is the same, the build scripts and 
compilation options are GCC-specific so it may make sense to test these


As an example of (2), we currently don't have lsan_preinit.o so static 
liblsan isn't fully supported.


We understand that these may or may not be important for other community 
members so will accept either decision.


-Y


Avoid unnecesary GGC runs during LTO

2014-04-10 Thread Jan Hubicka

Hi,
while looking into -ftime-report, I noticed that ggc can take up to 10% of WPA 
memory
while it does almost nothing: it is run just after streaming that explicitly
frees memory that becomes unreachable.  The first GGC run usually saves at
most 1% of memory and then it is never run again.
I believe this ought to also help in case we get into swap, since ltranses will
also ggc less.

Bootstrapped/regtested x86_64-linux, OK?

Honza

* lto.c (read_cgraph_and_symbols): Grow ggc memory after streaming.
* ggc.h (ggc_grow): New function.
* ggc-none.c (ggc_grow): New function.
* ggc-page.c (ggc_grow): Likewise.
Index: ggc.h
===
--- ggc.h   (revision 209170)
+++ ggc.h   (working copy)
@@ -225,6 +225,9 @@ extern const char *ggc_alloc_string_stat
function is called, not during allocations.  */
 extern void ggc_collect(void);
 
+/* Assume that all GGC memory is reachable and grow the limits for next 
collection. */
+extern void ggc_grow (void);
+
 /* Register an additional root table.  This can be useful for some
plugins.  Does nothing if the passed pointer is NULL. */
 extern void ggc_register_root_tab (const struct ggc_root_tab *);
Index: lto/lto.c
===
--- lto/lto.c   (revision 209170)
+++ lto/lto.c   (working copy)
@@ -2999,6 +3000,10 @@ read_cgraph_and_symbols (unsigned nfiles
   gimple_canonical_types = NULL;
   delete canonical_type_hash_cache;
   canonical_type_hash_cache = NULL;
+
+  /* At this stage we know that majority of GGC memory is reachable.  
+ Growing the limits prevents unnecesary invocation of GGC.  */
+  ggc_grow ();
   ggc_collect ();
 
   /* Set the hooks so that all of the ipa passes can read in their data.  */
Index: ggc-none.c
===
--- ggc-none.c  (revision 209170)
+++ ggc-none.c  (working copy)
@@ -63,3 +63,8 @@ ggc_free (void *p)
 {
   free (p);
 }
+
+void
+ggc_grow (void)
+{
+}
Index: ggc-page.c
===
--- ggc-page.c  (revision 209170)
+++ ggc-page.c  (working copy)
@@ -2095,6 +2095,19 @@ ggc_collect (void)
 fprintf (G.debug_file, "END COLLECTING\n");
 }
 
+/* Assume that all GGC memory is reachable and grow the limits for next 
collection. */
+
+void
+ggc_grow (void)
+{
+#ifndef ENABLE_CHECKING
+  G.allocated_last_gc = MAX (G.allocated_last_gc,
+G.allocated);
+#endif
+  if (!quiet_flag)
+fprintf (stderr, " {GC start %luk} ", (unsigned long) G.allocated / 1024);
+}
+
 /* Print allocation statistics.  */
 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
  ? (x) \


[PATCH, FORTRAN] Fix PR fortran/60718

2014-04-10 Thread Bernd Edlinger
Hi,

this patch fixes the last failed fortran test case on arm-linux-gnueabihf:
select_type_4.f90, which did always fail at -O2 and above.

It was caused by a strict aliasing violation, when passing a value of the type
"class(x),pointer" to a formal procedure parameter of the type 
"class(x),target".

The patch resolves this, by creating a temporary value of type "class(x),target"
which can be passed to the procedure without violating the strict aliasing 
rules.

Boot-strapped and regression-tested without any regressions
on x86_64-unknown-linux-gnu and arm-linux-gnueabihf.

OK for trunk?


Thanks
Bernd.
  2014-04-11  Bernd Edlinger  

PR fortran/60718
* trans-expr.c (gfc_conv_procedure_call): Fix a strict aliasing
violation when passing a class object to a formal parameter which has
the target attribute set.



patch-pr60718.diff
Description: Binary data