Re: RFA: one more version of the patch for PR61360

2014-10-03 Thread Uros Bizjak
On Thu, Oct 2, 2014 at 10:13 PM, Vladimir Makarov vmaka...@redhat.com wrote:

 I guess we achieved the consensus about the following patch to fix
 PR61360

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

 The patch was successfully bootstrapped and tested (w/wo
 -march=amdfam10) on x86/x86-64.

 Is it ok to commit to trunk?


 I've tested your patch and unfortunately it doesn't work:

 In file included from
 /var/tmp/moz-build-dir/js/src/shell/Unified_cpp_js_src_shell0.cpp:15:0:
 /var/tmp/mozilla-central/js/src/shell/js.cpp: In function ‘void
 Process(JSContext*, JSObject*, const char*, bool)’:
 /var/tmp/mozilla-central/js/src/shell/js.cpp:592:1: internal compiler
 error: in lra_update_insn_recog_data, at lra.c:1221
   }
   ^
 0xa9d9ec lra_update_insn_recog_data(rtx_insn*)
  ../../gcc/gcc/lra.c:1220
 0xab450f eliminate_regs_in_insn
  ../../gcc/gcc/lra-eliminations.c:1077
 0xab450f process_insn_for_elimination
  ../../gcc/gcc/lra-eliminations.c:1344
 0xab450f lra_eliminate(bool, bool)
  ../../gcc/gcc/lra-eliminations.c:1408
 0xa9f2da lra(_IO_FILE*)
  ../../gcc/gcc/lra.c:2270
 0xa5d659 do_reload
  ../../gcc/gcc/ira.c:5311
 0xa5d659 execute
  ../../gcc/gcc/ira.c:5470


 Testcase is attached:

   % g++ -c -march=amdfam10 -w -O2 js.ii
 js.ii: In function ‘void RunFile(C)’:
 js.ii:64:1: internal compiler error: in lra_update_insn_recog_data, at
 lra.c:1221


 Thanks for reporting this, Marcus.  The problem now is in
 optimize_function_for_size_p.  It is false, when we define and cache enable
 attributes at early stages (instantation of virtual regs) and true later.

 It is returning us to the same problem.  I believe that we should not have
 enable attributes depending on optimization options or on the current
 running pass if we don't want the current solution in the trunk (with
 recog_init).  Setting right value for optimize_function_for_size_p does not
 solve the problem as we can have different options for different functions
 in the same compilation file.

 So minimal solution would be removing optimize_function_for_size_p from the
 attribute definition.  But I guess we could remove all condition.
 Unfortunately, Ganesh did not post is it really beneficial to switch off
 this alternative for AMD CPUs even if AMD optimization guide recommends it.

I propose to split the pattern into size-optimized and normal pattern.
The patch implements this proposal.

Uros.
Index: i386.md
===
--- i386.md (revision 215797)
+++ i386.md (working copy)
@@ -4766,6 +4766,38 @@
 }
 })
 
+(define_insn *floatSWI48:modeMODEF:mode2_sse_size
+  [(set (match_operand:MODEF 0 register_operand =f,x,x)
+   (float:MODEF
+ (match_operand:SWI48 1 nonimmediate_operand m,r,m)))]
+  SSE_FLOAT_MODE_P (MODEF:MODEmode)  TARGET_SSE_MATH
+optimize_function_for_size_p (cfun)
+ @
+   fild%Z1\t%1
+   %vcvtsi2MODEF:ssemodesuffixSWI48:rex64suffix\t{%1, %d0|%d0, %1}
+   %vcvtsi2MODEF:ssemodesuffixSWI48:rex64suffix\t{%1, %d0|%d0, %1}
+  [(set_attr type fmov,sseicvt,sseicvt)
+   (set_attr prefix orig,maybe_vex,maybe_vex)
+   (set_attr mode MODEF:MODE)
+   (set (attr prefix_rex)
+ (if_then_else
+   (and (eq_attr prefix maybe_vex)
+   (match_test SWI48:MODEmode == DImode))
+   (const_string 1)
+   (const_string *)))
+   (set_attr unit i387,*,*)
+   (set_attr athlon_decode *,double,direct)
+   (set_attr amdfam10_decode *,vector,double)
+   (set_attr bdver1_decode *,double,direct)
+   (set_attr fp_int_src true)
+   (set (attr enabled)
+ (cond [(eq_attr alternative 0)
+  (symbol_ref TARGET_MIX_SSE_I387
+X87_ENABLE_FLOAT (MODEF:MODEmode,
+SWI48:MODEmode))
+   ]
+   (const_int 1)))])
+
 (define_insn *floatSWI48:modeMODEF:mode2_sse
   [(set (match_operand:MODEF 0 register_operand =f,x,x)
(float:MODEF
@@ -4795,16 +4827,9 @@
 X87_ENABLE_FLOAT (MODEF:MODEmode,
 SWI48:MODEmode))
 (eq_attr alternative 1)
-  /* ??? For sched1 we need constrain_operands to be able to
- select an alternative.  Leave this enabled before RA.  */
-  (symbol_ref TARGET_INTER_UNIT_CONVERSIONS
-   || optimize_function_for_size_p (cfun)
-   || !(reload_completed
-|| reload_in_progress
-|| lra_in_progress))
+  (symbol_ref TARGET_INTER_UNIT_CONVERSIONS)
]
-   (symbol_ref true)))
-   ])
+   (const_int 1)))])
 
 (define_insn *floatSWI48x:modeMODEF:mode2_i387
   [(set (match_operand:MODEF 0 register_operand =f)


[PING][PATCH] Support for BIT_FIELD_REF in asan.c

2014-10-03 Thread Marat Zakirov


On 09/26/2014 12:55 PM, Marat Zakirov wrote:

Hi all!

Here's a patch which instruments byte-aligned BIT_FIELD_REFs. During 
GCC asan-bootstrap and Linux kernel build I didn't find any cases 
where BIT_FIELD_REF is not 8 bits aligned. But I do not have 
sufficient confidence to replace current return if BIT_FIELD_REF is 
misaligned to assert.


Ok to commit?

--Marat


gcc/ChangeLog:

2014-09-19  Marat Zakirov  m.zaki...@samsung.com

	* asan.c (instrument_derefs): BIT_FIELD_REF added.

gcc/testsuite/ChangeLog:

2014-09-19  Marat Zakirov  m.zaki...@samsung.com

	* c-c++-common/asan/bitfield-5.c: New test.

diff --git a/gcc/asan.c b/gcc/asan.c
index cf5de27..451af33 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1705,6 +1705,7 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
 case INDIRECT_REF:
 case MEM_REF:
 case VAR_DECL:
+case BIT_FIELD_REF:
   break;
   /* FALLTHRU */
 default:
diff --git a/gcc/testsuite/c-c++-common/asan/bitfield-5.c b/gcc/testsuite/c-c++-common/asan/bitfield-5.c
new file mode 100644
index 000..eb5e9e9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/bitfield-5.c
@@ -0,0 +1,24 @@
+/* Check BIT_FIELD_REF.  */
+
+/* { dg-do run } */
+/* { dg-shouldfail asan } */
+
+struct A
+{
+  int y : 20;
+  int x : 13;
+};
+
+int __attribute__ ((noinline, noclone))
+f (void *p) {
+  return ((struct A *)p)-x != 0;
+}
+
+int
+main ()
+{
+  int a = 0;
+  return f (a);
+}
+
+/* { dg-output ERROR: AddressSanitizer: stack-buffer-overflow } */



Re: [PATCH] palignr improvement (PR target/62128)

2014-10-03 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 11:48:27AM +0200, Jakub Jelinek wrote:
 Tested with
 GCC_TEST_RUN_EXPENSIVE=1 make -k check-gcc \
 RUNTESTFLAGS='--target_board=unix/-mavx2 dg-torture.exp=vshuf*.c'
 on x86_64-linux, ok for trunk if it passes bootstrap?
 
 As for the previous testcase with distilled pr52252-atom.c permutations,
 f1/f4 is now vpunpcklbw/vpunpckhbw/vperm2i128, f2 2x vpshufb/vpermq/vpor,
 f3/f5/f6 vperm2i128/vpalignr, suggestions how to improve that?
 
 2014-10-02  Jakub Jelinek  ja...@redhat.com
 
   PR target/62128
   * config/i386/i386.c (expand_vec_perm_palignr): If op1, op0 order
   of palignr arguments can't be used due to min 0 or max - min
   too high, try also op0, op1 order of palignr arguments.
 
   * gcc.dg/torture/vshuf-16.inc (TESTS): Add 2 new permutations.
   * gcc.dg/torture/vshuf-32.inc (TESTS): Add 5 new permutations.

Now successfully bootstrapped/regtested on x86_64-linux and i686-linux
(without ada, as that doesn't bootstrap right now, Honza is looking into
that).  Ok for trunk?

 --- gcc/config/i386/i386.c.jj 2014-10-02 09:18:50.0 +0200
 +++ gcc/config/i386/i386.c2014-10-02 11:17:29.792953321 +0200
 @@ -43298,8 +43298,8 @@ static bool
  expand_vec_perm_palignr (struct expand_vec_perm_d *d, bool 
 single_insn_only_p)
  {
unsigned i, nelt = d-nelt;
 -  unsigned min, max;
 -  bool in_order, ok;
 +  unsigned min, max, minswap, maxswap;
 +  bool in_order, ok, swap = false;
rtx shift, target;
struct expand_vec_perm_d dcopy;
  
 @@ -43309,20 +43309,40 @@ expand_vec_perm_palignr (struct expand_v
 (!TARGET_AVX2 || GET_MODE_SIZE (d-vmode) != 32))
  return false;
  
 -  min = 2 * nelt, max = 0;
 +  min = 2 * nelt;
 +  max = 0;
 +  minswap = 2 * nelt;
 +  maxswap = 0;
for (i = 0; i  nelt; ++i)
  {
unsigned e = d-perm[i];
 +  unsigned eswap = d-perm[i] ^ nelt;
if (GET_MODE_SIZE (d-vmode) == 32)
 - e = (e  ((nelt / 2) - 1)) | ((e  nelt)  1);
 + {
 +   e = (e  ((nelt / 2) - 1)) | ((e  nelt)  1);
 +   eswap = e ^ (nelt / 2);
 + }
if (e  min)
   min = e;
if (e  max)
   max = e;
 +  if (eswap  minswap)
 + minswap = eswap;
 +  if (eswap  maxswap)
 + maxswap = eswap;
  }
if (min == 0
|| max - min = (GET_MODE_SIZE (d-vmode) == 32 ? nelt / 2 : nelt))
 -return false;
 +{
 +  if (d-one_operand_p
 +   || minswap == 0
 +   || maxswap - minswap = (GET_MODE_SIZE (d-vmode) == 32
 +? nelt / 2 : nelt))
 + return false;
 +  swap = true;
 +  min = minswap;
 +  max = maxswap;
 +}
  
/* Given that we have SSSE3, we know we'll be able to implement the
   single operand permutation after the palignr with pshufb for
 @@ -43332,6 +43352,13 @@ expand_vec_perm_palignr (struct expand_v
  return true;
  
dcopy = *d;
 +  if (swap)
 +{
 +  dcopy.op0 = d-op1;
 +  dcopy.op1 = d-op0;
 +  for (i = 0; i  nelt; ++i)
 + dcopy.perm[i] ^= nelt;
 +}
  
in_order = true;
for (i = 0; i  nelt; ++i)
 @@ -43365,14 +43392,16 @@ expand_vec_perm_palignr (struct expand_v
if (GET_MODE_SIZE (d-vmode) == 16)
  {
target = gen_reg_rtx (TImode);
 -  emit_insn (gen_ssse3_palignrti (target, gen_lowpart (TImode, d-op1),
 -   gen_lowpart (TImode, d-op0), shift));
 +  emit_insn (gen_ssse3_palignrti (target, gen_lowpart (TImode, 
 dcopy.op1),
 +   gen_lowpart (TImode, dcopy.op0), shift));
  }
else
  {
target = gen_reg_rtx (V2TImode);
 -  emit_insn (gen_avx2_palignrv2ti (target, gen_lowpart (V2TImode, 
 d-op1),
 -gen_lowpart (V2TImode, d-op0), shift));
 +  emit_insn (gen_avx2_palignrv2ti (target,
 +gen_lowpart (V2TImode, dcopy.op1),
 +gen_lowpart (V2TImode, dcopy.op0),
 +shift));
  }
  
dcopy.op0 = dcopy.op1 = gen_lowpart (d-vmode, target);
 --- gcc/testsuite/gcc.dg/torture/vshuf-16.inc.jj  2012-03-20 
 08:51:25.0 +0100
 +++ gcc/testsuite/gcc.dg/torture/vshuf-16.inc 2014-10-02 11:29:13.906821725 
 +0200
 @@ -23,7 +23,9 @@ T (19,  15, 14, 13, 12, 11, 10, 9, 8, 7,
  T (20,   0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23) \
  T (21,   8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31) \
  T (22,   1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0) \
 -T (23,   14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 15)
 +T (23,   14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 15) \
 +T (24,   22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 4, 5) \
 +T (25,   6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)
  #define EXPTESTS \
  T (116,  28, 13, 27, 11, 21, 1, 5, 22, 29, 14, 15, 6, 3, 10, 16, 30) \
  T (117,  22, 26, 1, 13, 29, 3, 

Re: [PATCH] palignr improvement (PR target/62128)

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 8:52 AM, Jakub Jelinek ja...@redhat.com wrote:

 Tested with
 GCC_TEST_RUN_EXPENSIVE=1 make -k check-gcc \
 RUNTESTFLAGS='--target_board=unix/-mavx2 dg-torture.exp=vshuf*.c'
 on x86_64-linux, ok for trunk if it passes bootstrap?

 As for the previous testcase with distilled pr52252-atom.c permutations,
 f1/f4 is now vpunpcklbw/vpunpckhbw/vperm2i128, f2 2x vpshufb/vpermq/vpor,
 f3/f5/f6 vperm2i128/vpalignr, suggestions how to improve that?

 2014-10-02  Jakub Jelinek  ja...@redhat.com

   PR target/62128
   * config/i386/i386.c (expand_vec_perm_palignr): If op1, op0 order
   of palignr arguments can't be used due to min 0 or max - min
   too high, try also op0, op1 order of palignr arguments.

   * gcc.dg/torture/vshuf-16.inc (TESTS): Add 2 new permutations.
   * gcc.dg/torture/vshuf-32.inc (TESTS): Add 5 new permutations.

 Now successfully bootstrapped/regtested on x86_64-linux and i686-linux
 (without ada, as that doesn't bootstrap right now, Honza is looking into
 that).  Ok for trunk?

OK.

Thanks,
Uros.


Re: [PATCH] Add libstdc++ baseline_symbols for aarch64

2014-10-03 Thread Andreas Schwab
Christophe Lyon christophe.l...@linaro.org writes:

 I've looked at debug info from dejagnu, and it really seems that
 abi_check is called with no argument, hence the error.

 What am I doing wrong?

That must be something unrelated, hidden since that test was never run
before.  testsuite/libstdc++-abi/abi.exp clearly runs abi_check with the
right arguments:

set result [${tool}_load ./abi_check \
[list --check-verbose current_symbols.txt \
 baseline_symbols.txt]]

Does it work if you run it manually?

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


[committed] Spelling fix in the vectorizer

2014-10-03 Thread Jakub Jelinek
Hi!

Got surprised by seeing vect_suffle3* variable names in the dumps,
fixed thusly, committed as obvious to trunk.

2014-10-03  Jakub Jelinek  ja...@redhat.com

* tree-vect-data-refs.c (vect_permute_load_chain,
vect_shift_permute_load_chain): Fix a typo in temporary var names,
suffle3 to shuffle3.

--- gcc/tree-vect-data-refs.c.jj2014-09-25 10:12:08.0 +0200
+++ gcc/tree-vect-data-refs.c   2014-10-03 10:10:42.347620552 +0200
@@ -5185,7 +5185,7 @@ vect_permute_load_chain (vectree dr_ch
  /* Create interleaving stmt (low part of):
 low = VEC_PERM_EXPR first_vect, second_vect2, {k, 3 + k, 6 + k,
 ...}  */
- data_ref = make_temp_ssa_name (vectype, NULL, vect_suffle3_low);
+ data_ref = make_temp_ssa_name (vectype, NULL, vect_shuffle3_low);
  perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
first_vect, second_vect,
perm3_mask_low);
@@ -5196,7 +5196,7 @@ vect_permute_load_chain (vectree dr_ch
  ...}  */
  first_vect = data_ref;
  second_vect = dr_chain[2];
- data_ref = make_temp_ssa_name (vectype, NULL, vect_suffle3_high);
+ data_ref = make_temp_ssa_name (vectype, NULL, vect_shuffle3_high);
  perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
first_vect, second_vect,
perm3_mask_high);
@@ -5538,7 +5538,7 @@ vect_shift_permute_load_chain (vectree
 
   for (k = 0; k  3; k++)
{
- data_ref = make_temp_ssa_name (vectype, NULL, vect_suffle3);
+ data_ref = make_temp_ssa_name (vectype, NULL, vect_shuffle3);
  perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
dr_chain[k], dr_chain[k],
perm3_mask);

Jakub


[committed] OpenMP task shared() fix (PR libgomp/61200)

2014-10-03 Thread Jakub Jelinek
Hi!

This patch fixes a problem where after processing some omp parallel
with shared clause on some non-addressable var (where we decide to
use copy-in/out for it) we process omp task with shared clause on the
same var and for task shared vars we can't use copy-in/out ever, thus
have to force it addressable and we ICE because copy-in/out is not expected
for addressable vars.  The runtime testcase shows that we actually must
not use copy-in/out in that case, otherwise we introduce data races where
there weren't in the source originally.

Fixed by deferring the layout of the record types for parallel/task regions
until all of scan_omp is processed, and before the layout testing for this
case and adjusting vars from copy-in/out to by reference passing if needed.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to
trunk/4.9.

2014-10-03  Jakub Jelinek  ja...@redhat.com

PR libgomp/61200
* omp-low.c (taskreg_contexts): New variable.
(scan_omp_parallel): Push newly created context into taskreg_contexts
vector and move record layout code to finish_taskreg_scan.
(scan_omp_task): Likewise.
(finish_taskreg_scan): New function.
(execute_lower_omp): Call finish_taskreg_scan on all taskreg_contexts
vector elements and release it.

* c-c++-common/gomp/pr61200.c: New test.

* testsuite/libgomp.c/pr61200.c: New test.

--- gcc/omp-low.c.jj2014-09-29 07:20:40.0 +0200
+++ gcc/omp-low.c   2014-10-02 18:39:47.542770018 +0200
@@ -204,6 +204,7 @@ static int taskreg_nesting_level;
 static int target_nesting_level;
 static struct omp_region *root_omp_region;
 static bitmap task_shared_vars;
+static vecomp_context * taskreg_contexts;
 
 static void scan_omp (gimple_seq *, omp_context *);
 static tree scan_omp_1_op (tree *, int *, void *);
@@ -2097,6 +2098,7 @@ scan_omp_parallel (gimple_stmt_iterator
 }
 
   ctx = new_omp_context (stmt, outer_ctx);
+  taskreg_contexts.safe_push (ctx);
   if (taskreg_nesting_level  1)
 ctx-is_nested = true;
   ctx-field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
@@ -2116,11 +2118,6 @@ scan_omp_parallel (gimple_stmt_iterator
 
   if (TYPE_FIELDS (ctx-record_type) == NULL)
 ctx-record_type = ctx-receiver_decl = NULL;
-  else
-{
-  layout_type (ctx-record_type);
-  fixup_child_record_type (ctx);
-}
 }
 
 /* Scan an OpenMP task directive.  */
@@ -2131,7 +2128,6 @@ scan_omp_task (gimple_stmt_iterator *gsi
   omp_context *ctx;
   tree name, t;
   gimple stmt = gsi_stmt (*gsi);
-  location_t loc = gimple_location (stmt);
 
   /* Ignore task directives with empty bodies.  */
   if (optimize  0
@@ -2142,6 +2138,7 @@ scan_omp_task (gimple_stmt_iterator *gsi
 }
 
   ctx = new_omp_context (stmt, outer_ctx);
+  taskreg_contexts.safe_push (ctx);
   if (taskreg_nesting_level  1)
 ctx-is_nested = true;
   ctx-field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
@@ -2179,8 +2176,71 @@ scan_omp_task (gimple_stmt_iterator *gsi
   t = build_int_cst (long_integer_type_node, 1);
   gimple_omp_task_set_arg_align (stmt, t);
 }
+}
+
+
+/* If any decls have been made addressable during scan_omp,
+   adjust their fields if needed, and layout record types
+   of parallel/task constructs.  */
+
+static void
+finish_taskreg_scan (omp_context *ctx)
+{
+  if (ctx-record_type == NULL_TREE)
+return;
+
+  /* If any task_shared_vars were needed, verify all
+ OMP_CLAUSE_SHARED clauses on GIMPLE_OMP_{PARALLEL,TASK}
+ statements if use_pointer_for_field hasn't changed
+ because of that.  If it did, update field types now.  */
+  if (task_shared_vars)
+{
+  tree c;
+
+  for (c = gimple_omp_taskreg_clauses (ctx-stmt);
+  c; c = OMP_CLAUSE_CHAIN (c))
+   if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED)
+ {
+   tree decl = OMP_CLAUSE_DECL (c);
+
+   /* Global variables don't need to be copied,
+  the receiver side will use them directly.  */
+   if (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)))
+ continue;
+   if (!bitmap_bit_p (task_shared_vars, DECL_UID (decl))
+   || !use_pointer_for_field (decl, ctx))
+ continue;
+   tree field = lookup_field (decl, ctx);
+   if (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE
+TREE_TYPE (TREE_TYPE (field)) == TREE_TYPE (decl))
+ continue;
+   TREE_TYPE (field) = build_pointer_type (TREE_TYPE (decl));
+   TREE_THIS_VOLATILE (field) = 0;
+   DECL_USER_ALIGN (field) = 0;
+   DECL_ALIGN (field) = TYPE_ALIGN (TREE_TYPE (field));
+   if (TYPE_ALIGN (ctx-record_type)  DECL_ALIGN (field))
+ TYPE_ALIGN (ctx-record_type) = DECL_ALIGN (field);
+   if (ctx-srecord_type)
+ {
+   tree sfield = lookup_sfield (decl, ctx);
+   TREE_TYPE (sfield) = TREE_TYPE 

Re: [PATCH] Avoid ICE in LRA for calls with multiple return values

2014-10-03 Thread Ilya Enkovich
On 03 Oct 00:05, Ilya Enkovich wrote:
 2014-10-02 22:30 GMT+04:00 Jeff Law l...@redhat.com:
  On 10/02/14 08:30, Ilya Enkovich wrote:
 
  Hi,
 
  This patch adds a check for call destination register for a call return
  value optimization based on REG_RETURNED note.  This solves some ICE issues
  for MPX codes.
 
  Bootstrapped and tested on linux-x86_64.  OK for trunk?
 
  Thanks,
  Ilya
  --
  2014-10-02  Ilya Enkovich  ilya.enkov...@intel.com
 
  * lra-constraints.c (inherit_in_ebb): Handle calls with
  multiple return values.
  * caller-save.c (save_call_clobbered_regs): Likewise.
 
  This is fine.  Please put a comment before the new if (REG_P (...)))
  conditional which notes that a CALL_INSN may have multiple return values
  expressed in an EXPR_LIST.  That way if someone looks at this code a few
  years down the line, they'll know exactly why the code checks REG_P rather
  than just using the result blindly.
 
  Did this fix all the multiple-return issues you encountered?
 
 With this fix almost all benchmarks compile successfully but there is
 still one ICE in LRA.  I described it in MPX ABI thread.
 
 Ilya
 
 
  Jeff
 

Here is a vestion to be committed.

Ilya
--
2014-10-02  Ilya Enkovich  ilya.enkov...@intel.com

* lra-constraints.c (inherit_in_ebb): Handle calls with
multiple return values.
* caller-save.c (save_call_clobbered_regs): Likewise.


diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index 11df2ec..e28facb 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -879,8 +879,13 @@ save_call_clobbered_regs (void)
  if (GET_CODE (pat) == PARALLEL)
pat = XVECEXP (pat, 0, 0);
  dest = SET_DEST (pat);
- newpat = gen_rtx_SET (VOIDmode, cheap, copy_rtx (dest));
- chain = insert_one_insn (chain, 0, -1, newpat);
+ /* For multiple return values dest is PARALLEL.
+Currently we handle only single return value case.  */
+ if (REG_P (dest))
+   {
+ newpat = gen_rtx_SET (VOIDmode, cheap, copy_rtx (dest));
+ chain = insert_one_insn (chain, 0, -1, newpat);
+   }
}
}
   last = chain;
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 5f68399..f1642f3 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -5348,16 +5348,21 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
  if (GET_CODE (pat) == PARALLEL)
pat = XVECEXP (pat, 0, 0);
  dest = SET_DEST (pat);
- start_sequence ();
- emit_move_insn (cheap, copy_rtx (dest));
- restore = get_insns ();
- end_sequence ();
- lra_process_new_insns (curr_insn, NULL, restore,
-Inserting call parameter restore);
- /* We don't need to save/restore of the pseudo from
-this call.  */
- usage_insns[regno].calls_num = calls_num;
- bitmap_set_bit (check_only_regs, regno);
+ /* For multiple return values dest is PARALLEL.
+Currently we handle only single return value case.  */
+ if (REG_P (dest))
+   {
+ start_sequence ();
+ emit_move_insn (cheap, copy_rtx (dest));
+ restore = get_insns ();
+ end_sequence ();
+ lra_process_new_insns (curr_insn, NULL, restore,
+Inserting call parameter 
restore);
+ /* We don't need to save/restore of the pseudo from
+this call.  */
+ usage_insns[regno].calls_num = calls_num;
+ bitmap_set_bit (check_only_regs, regno);
+   }
}
}
  to_inherit_num = 0;


Re: [PATCH, i386, Pointer Bounds Checker 18/x] Expand instrumented builtin function calls

2014-10-03 Thread Ilya Enkovich
Since we still don't have a final decision about how instrumented builtin 
functions would look like, I replace this patch with a new one which assumes we 
don't instrument them for now.  It only has an additional init for va_start and 
also makes sure there is no instrumented builtin calls.  All instrumented 
builtins related codes will go into a separate series.

Thanks,
Ilya
--
2014-10-03  Ilya Enkovich  ilya.enkov...@intel.com

* builtins.c: Include tree-chkp.h and rtl-chkp.h.
(std_expand_builtin_va_start): Init bounds for va_list.
(expand_builtin): Do not allow instrumented calls.


diff --git a/gcc/builtins.c b/gcc/builtins.c
index 78ac91f..f0bb55a 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -59,6 +59,8 @@ along with GCC; see the file COPYING3.  If not see
 #include builtins.h
 #include ubsan.h
 #include cilk.h
+#include tree-chkp.h
+#include rtl-chkp.h
 
 
 static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t));
@@ -4319,6 +4321,13 @@ std_expand_builtin_va_start (tree valist, rtx nextarg)
 {
   rtx va_r = expand_expr (valist, NULL_RTX, VOIDmode, EXPAND_WRITE);
   convert_move (va_r, nextarg, 0);
+
+  /* We do not have any valid bounds for the pointer, so
+ just store zero bounds for it.  */
+  if (chkp_function_instrumented_p (current_function_decl))
+chkp_expand_bounds_reset_for_mem (valist,
+ make_tree (TREE_TYPE (valist),
+nextarg));
 }
 
 /* Expand EXP, a call to __builtin_va_start.  */
@@ -5824,6 +5833,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum 
machine_mode mode,
}
 }
 
+  gcc_assert (!CALL_WITH_BOUNDS_P (exp));
+
   switch (fcode)
 {
 CASE_FLT_FN (BUILT_IN_FABS):
@@ -6841,7 +6852,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum 
machine_mode mode,
 case BUILT_IN_CHKP_GET_PTR_UBOUND:
   /* We allow user CHKP builtins if Pointer Bounds
 Checker is off.  */
-  if (!flag_check_pointer_bounds)
+  if (!chkp_function_instrumented_p (current_function_decl))
{
  if (fcode == BUILT_IN_CHKP_SET_PTR_BOUNDS
  || fcode == BUILT_IN_CHKP_NARROW_PTR_BOUNDS


Re: [PATCH] Add libstdc++ baseline_symbols for aarch64

2014-10-03 Thread Christophe Lyon
On 3 October 2014 09:55, Andreas Schwab sch...@linux-m68k.org wrote:
 Christophe Lyon christophe.l...@linaro.org writes:

 I've looked at debug info from dejagnu, and it really seems that
 abi_check is called with no argument, hence the error.

 What am I doing wrong?

 That must be something unrelated, hidden since that test was never run
 before.  testsuite/libstdc++-abi/abi.exp clearly runs abi_check with the
 right arguments:

 set result [${tool}_load ./abi_check \
 [list --check-verbose current_symbols.txt \
  baseline_symbols.txt]]

Yes, I have seen that, but my dejagnu traces have this:
[...]
call_remote  download arm-sim current_symbols.txt current_symbols.txt
[...]
call_remote  load arm-sim ./abi_check {--check-verbose
current_symbols.txt baseline_symbols.txt} {}
[...]
call_remote  spawn arm-sim ./abi_check
[...]
spawning command  /XXX/qemu-wrapper.sh ./abi_check

so at some point the arguments are discarded.

In my site.exp, I have

   set target_list { arm-sim }
   global SIM
   set SIM /XXX/qemu-wrapper.sh

Not sure why I have this arm-sim here.
Maybe that's the reason for the problem I am seeing.


 Does it work if you run it manually?


Yes, manually I get this:
[list of symbols etc...]
 libstdc++-v3 check-abi Summary 

# of added symbols:  136
# of missing symbols:0
# of undesignated symbols:   2
# of incompatible symbols:   136

using: baseline_symbols.txt

*** EXIT code 1

 Andreas.

 --
 Andreas Schwab, sch...@linux-m68k.org
 GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
 And now for something completely different.


[PING 2] Enhance array types debug info. for Ada

2014-10-03 Thread Pierre-Marie de Rodat

On 09/17/2014 04:38 PM, Pierre-Marie de Rodat wrote:

Ping for https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00206.html

Adding a few maintainers in copy... Thanks in advance!


Should I enhance something in this patch set in order to make the review 
easier? Thanks!


--
Pierre-Marie de Rodat


[PATCH, Pointer Bounds Checker 39/x] Avoid instrumented __builtin_unreachable calls

2014-10-03 Thread Ilya Enkovich
Hi,

This patch avoids generation of __builtin_unreachable calls marked as 
instrumented.  It follows paradigma of no instrumented builtin calls (and 
passes corresponding assert in expand_builtin from patch #18).

Thanks,
Ilya
--
2014-10-01  Ilya Enkovich  ilya.enkov...@intel.com

* cgraphunit.c (walk_polymorphic_call_targets): Do not mark
generated call to __builtin_unreachable as with_bounds.
* ipa.c (walk_polymorphic_call_targets): Likewise.


diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index af90a79..d5e0075 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -866,6 +866,11 @@ walk_polymorphic_call_targets (hash_setvoid * 
*reachable_call_targets,
 
  edge-make_direct (target);
  edge-redirect_call_stmt_to_callee ();
+
+ /* Call to __builtin_unreachable shouldn't be instrumented.  */
+ if (!targets.length ())
+   gimple_call_set_with_bounds (edge-call_stmt, false);
+
  if (symtab-dump_file)
{
  fprintf (symtab-dump_file,
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 78f251a..7fc3429 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -209,7 +209,13 @@ walk_polymorphic_call_targets (hash_setvoid * 
*reachable_call_targets,
  if (inline_summary_vec)
inline_update_overall_summary (node);
  else if (edge-call_stmt)
-   edge-redirect_call_stmt_to_callee ();
+   {
+ edge-redirect_call_stmt_to_callee ();
+
+ /* Call to __builtin_unreachable shouldn't be instrumented.  */
+ if (!targets.length ())
+   gimple_call_set_with_bounds (edge-call_stmt, false);
+   }
}
 }
 }


Re: [PATCH] Enhance array types debug info. for Ada

2014-10-03 Thread Jakub Jelinek
On Wed, Sep 03, 2014 at 10:36:21AM +0200, Pierre-Marie de Rodat wrote:
 --- a/gcc/dwarf2out.c
 +++ b/gcc/dwarf2out.c
 @@ -17359,18 +17359,36 @@ static void
  gen_descr_array_type_die (tree type, struct array_descr_info *info,
 dw_die_ref context_die)
  {
 -  dw_die_ref scope_die = scope_die_for (type, context_die);
 +  dw_die_ref scope_die;
dw_die_ref array_die;
int dim;
  
 +  /* Instead of producing a dedicated DW_TAG_array_type DIE for this type, 
 let
 + the circuitry wrap the main variant with DIEs for qualifiers (for
 + instance: DW_TAG_const_type, ...).  */
 +  if (type != TYPE_MAIN_VARIANT (type))
 +{
 +  gen_type_die (TYPE_MAIN_VARIANT (type), context_die);
 +  return;
 +}

I don't like this, can you explain why?  I'd say that if you only want
to see TYPE_MAIN_VARIANT here, it should be responsibility of the callers
to ensure that.

 @@ -19941,7 +19991,8 @@ gen_type_die_with_usage (tree type, dw_die_ref 
 context_die,
/* If this is an array type with hidden descriptor, handle it first.  */
if (!TREE_ASM_WRITTEN (type)
 lang_hooks.types.get_array_descr_info
 -   lang_hooks.types.get_array_descr_info (type, info)
 +   lang_hooks.types.get_array_descr_info (type,
 + init_array_descr_info (info))

Just memset it to 0 instead?
 +  enum array_descr_ordering ordering;
tree element_type;
tree base_decl;
tree data_location;
tree allocated;
tree associated;
 +

Why the extra vertical space?
struct array_descr_dimen
  {

 From 0d683ca8c1fcf8d780928f1cd629e7a99651c9c0 Mon Sep 17 00:00:00 2001
 From: Pierre-Marie de Rodat dero...@adacore.com
 Date: Wed, 3 Sep 2014 09:46:25 +0200
 Subject: [PATCH 2/5] Enable the array descr language hook for all DWARF
  versions
 
   * dwarf2out.c (gen_type_die_with_usage): Enable the array lang-hook
   even when (dwarf_version  3  dwarf_strict).
   (gen_descr_array_die): Do not output DW_AT_data_locationn,
   DW_AT_associated, DW_AT_allocated and DW_AT_byte_stride DWARF
   attributes when (dwarf_version  3  dwarf_strict).

This patch sounds very wrong.  DW_OP_push_object_address is not in DWARF2
either, and that is the basis of all the fields, so there is really nothing
you can really output correctly for DWARF2.  It isn't the default on sane
targets, where GCC defaults to DWARF4 these days, so why bother?
  #include real.h
  #include function.h/* For pass_by_reference.  */
 +#include dwarf2out.h
  
  #include ada.h
  #include adadecode.h
 @@ -626,6 +627,64 @@ gnat_type_max_size (const_tree gnu_type)
return max_unitsize;
  }
  
 +/* Provide information in INFO for debug output about the TYPE array type.
 +   Return whether TYPE is handled.  */
 +
 +static bool
 +gnat_get_array_descr_info (const_tree type, struct array_descr_info *info)
 +{
 +  bool convention_fortran_p;
 +  tree index_type;
 +
 +  const_tree dimen, last_dimen;
 +  int i;
 +
 +  if (TREE_CODE (type) != ARRAY_TYPE
 +  || !TYPE_DOMAIN (type)
 +  || !TYPE_INDEX_TYPE (TYPE_DOMAIN (type)))
 +return false;
 +
 +  /* Count how many dimentions this array has.  */
 +  for (i = 0, dimen = type; ; ++i, dimen = TREE_TYPE (dimen))
 +if (i  0
 +  (TREE_CODE (dimen) != ARRAY_TYPE
 + || !TYPE_MULTI_ARRAY_P (dimen)))
 +  break;
 +  info-ndimensions = i;
 +  convention_fortran_p = TYPE_CONVENTION_FORTRAN_P (type);
 +
 +  /* TODO??? For row major ordering, we probably want to emit nothing and
 + instead specify it as the default in Dw_TAG_compile_unit.  */
 +  info-ordering = (convention_fortran_p
 + ? array_descr_ordering_column_major
 + : array_descr_ordering_row_major);
 +  info-base_decl = NULL_TREE;
 +  info-data_location = NULL_TREE;
 +  info-allocated = NULL_TREE;
 +  info-associated = NULL_TREE;
 +
 +  for (i = (convention_fortran_p ? info-ndimensions - 1 : 0),
 +   dimen = type;
 +
 +   0 = i  i  info-ndimensions;
 +
 +   i += (convention_fortran_p ? -1 : 1),
 +   dimen = TREE_TYPE (dimen))
 +{
 +  /* We are interested in the stored bounds for the debug info.  */
 +  index_type = TYPE_INDEX_TYPE (TYPE_DOMAIN (dimen));
 +
 +  info-dimen[i].bounds_type = index_type;
 +  info-dimen[i].lower_bound = TYPE_MIN_VALUE (index_type);
 +  info-dimen[i].upper_bound = TYPE_MAX_VALUE (index_type);
 +  last_dimen = dimen;
 +}
 +
 +  info-element_type = TREE_TYPE (last_dimen);
 +
 +  return true;
 +}
 +
  /* GNU_TYPE is a subtype of an integral type.  Set LOWVAL to the low bound
 and HIGHVAL to the high bound, respectively.  */
  
 @@ -916,6 +975,8 @@ gnat_init_ts (void)
  #define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size
  #undef  LANG_HOOKS_TYPES_COMPATIBLE_P
  #define LANG_HOOKS_TYPES_COMPATIBLE_Pgnat_types_compatible_p
 +#undef  LANG_HOOKS_GET_ARRAY_DESCR_INFO
 +#define LANG_HOOKS_GET_ARRAY_DESCR_INFO  

Re: [PATCH] Enhance array types debug info. for Ada

2014-10-03 Thread Jakub Jelinek
On Fri, Oct 03, 2014 at 11:18:48AM +0200, Jakub Jelinek wrote:
  gcc/fortran/
  * trans-types.c (gfc_get_array_descr_info): Use PLACEHOLDER_EXPR nodes
  instead of VAR_DECL ones in type-related expressions.  Remove base_decl
  initialization.
 
 Ugh, I must say I don't like PLACEHOLDER_EXPRs at all.

What kind of more complex expressions do you need and why?

Jakub


Re: [PATCH, DOC]: New value 'default' for --enable-languages

2014-10-03 Thread Martin Liška

On 08/21/2014 01:57 PM, Martin Liška wrote:

Ping.

There was no explicit agreement that I can commit the change to trunk?

Thanks,
Martin

On 07/30/2014 08:19 PM, Martin Liška wrote:

On 07/30/2014 06:38 PM, Mike Stump wrote:

On Jul 30, 2014, at 6:20 AM, Richard Biener richard.guent...@gmail.com wrote:

On Wed, Jul 30, 2014 at 3:19 PM, Richard Biener
richard.guent...@gmail.com wrote:

On Wed, Jul 30, 2014 at 1:37 PM, Martin Liška mli...@suse.cz wrote:

Hello,
   as discussed in previous thread
(https://gcc.gnu.org/ml/gcc-patches/2014-07/msg02010.html), I would like to
add more intuitive behavior for --enable-languages configure option.

It works for me, but as I'm currently always testing all,ada,obj-c++ how
can I easily continue to do that - that is, not test go?  ;)

Of course with default,ada,obj-c++ ... stupid me.

In time, we’ll have a all,!go….  :-)

Does 'go' mean that the patch is ready for trunk :D ?

Martin





PING^2.

Thank you,
Martin


Re: std::is_final for gcc-4.9 branch.

2014-10-03 Thread Jonathan Wakely
On 3 October 2014 06:03, Ed Smith-Rowland wrote:
 Built and tested clean on x86_64-linux.

 OK?

 Ed


The changelog just says Add for testsuite_tr1.h, I assume it should
say something like Add FinalType

OK with that change, thanks.
2014-10-03  Edward Smith-Rowland  3dw...@verizon.net

* include/std/type_traits: Add is_final type trait for C++14.
* testsuite/util/testsuite_tr1.h: Add 
* testsuite/20_util/is_final/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/is_final/requirements/typedefs.cc: New.
* testsuite/20_util/is_final/value.cc: New.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust.

Index: include/std/type_traits
===
--- include/std/type_traits (revision 215826)
+++ include/std/type_traits (working copy)
@@ -634,6 +634,14 @@
 : public integral_constantbool, __is_polymorphic(_Tp)
 { };
 
+#if __cplusplus  201103L
+  /// is_final
+  templatetypename _Tp
+struct is_final
+: public integral_constantbool, __is_final(_Tp)
+{ };
+#endif
+
   /// is_abstract
   templatetypename _Tp
 struct is_abstract
Index: testsuite/20_util/declval/requirements/1_neg.cc
===
--- testsuite/20_util/declval/requirements/1_neg.cc (revision 215826)
+++ testsuite/20_util/declval/requirements/1_neg.cc (working copy)
@@ -19,7 +19,7 @@
 // with this library; see the file COPYING3.  If not see
 // http://www.gnu.org/licenses/.
 
-// { dg-error static assertion failed  { target *-*-* } 2036 }
+// { dg-error static assertion failed  { target *-*-* } 2044 }
 
 #include utility
 
Index: testsuite/20_util/is_final/requirements/explicit_instantiation.cc
===
--- testsuite/20_util/is_final/requirements/explicit_instantiation.cc   
(revision 0)
+++ testsuite/20_util/is_final/requirements/explicit_instantiation.cc   
(working copy)
@@ -0,0 +1,29 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// http://www.gnu.org/licenses/.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include type_traits
+
+namespace std
+{
+  typedef short test_type;
+  template struct is_finaltest_type;
+}
Index: testsuite/20_util/is_final/requirements/typedefs.cc
===
--- testsuite/20_util/is_final/requirements/typedefs.cc (revision 0)
+++ testsuite/20_util/is_final/requirements/typedefs.cc (working copy)
@@ -0,0 +1,34 @@
+// { dg-options -std=gnu++14 }
+// { dg-do compile }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// http://www.gnu.org/licenses/.
+
+// 
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include type_traits
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::is_finalint test_type;
+  typedef test_type::value_type   value_type;
+  typedef test_type::type type;
+  typedef test_type::type::value_type type_value_type;
+  typedef test_type::type::type   type_type;
+}
Index: testsuite/20_util/is_final/value.cc
===
--- testsuite/20_util/is_final/value.cc (revision 0)
+++ testsuite/20_util/is_final/value.cc (working copy)
@@ 

Re: Fix for FAIL: tmpdir-gcc.dg-struct-layout-1/t028 c_compat_x_tst.o compile, (internal compiler error)

2014-10-03 Thread Richard Sandiford
David Sherwood david.sherw...@arm.com writes:
 Hi Andreas,

 OK, I will fix this.

I installed David's patch below as obvious.  Tested on x86_64-linux-gnu.

Thanks,
Richard


gcc/
2014-10-03  David Sherwood  david.sherw...@arm.com

* ira-int.h (ira_allocno): Mark hard_regno as signed.

Index: gcc/ira-int.h
===
--- gcc/ira-int.h   2014-09-30 09:04:23.602162410 +0100
+++ gcc/ira-int.h   2014-10-03 11:09:21.986634891 +0100
@@ -318,7 +318,7 @@ struct ira_allocno
  number (0, ...) - 2.  Value -1 is used for allocnos spilled by the
  reload (at this point pseudo-register has only one allocno) which
  did not get stack slot yet.  */
-  int hard_regno : 16;
+  signed int hard_regno : 16;
   /* Allocnos with the same regno are linked by the following member.
  Allocnos corresponding to inner loops are first in the list (it
  corresponds to depth-first traverse of the loops).  */



Re: [PATCH i386 AVX512] [60/n] Update 128bit ashrv insn pattern.

2014-10-03 Thread Kirill Yukhin
Hello Uroš,
On 29 Sep 09:54, Uros Bizjak wrote:
  +(define_expand vashrv2di3mask_name
  +  [(set (match_operand:V2DI 0 register_operand)
  +   (ashiftrt:V2DI
  + (match_operand:V2DI 1 register_operand)
  + (match_operand:V2DI 2 nonimmediate_operand)))]
  +  TARGET_XOP || TARGET_AVX512VL
  +{
  +  if (!TARGET_XOP)
 
 This condition is wrong. Please re-test the patch.
Great catch! Didn't tested whole i386.exp, so XOP tests didn't run.
Fixed. Patch in the bottom. XOP tests are now pass.
Is it ok for trunk now?

--
Thanks, K

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 625a2e0..63fc7b5 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -498,7 +498,6 @@
 (define_mode_iterator VI12_128 [V16QI V8HI])
 (define_mode_iterator VI14_128 [V16QI V4SI])
 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
-(define_mode_iterator VI128_128 [V16QI V8HI V2DI])
 (define_mode_iterator VI24_128 [V8HI V4SI])
 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
 (define_mode_iterator VI48_128 [V4SI V2DI])
@@ -15720,17 +15719,36 @@
  (match_operand:VI48_256 2 nonimmediate_operand)))]
   TARGET_AVX2)
 
-(define_expand vashrmode3
-  [(set (match_operand:VI128_128 0 register_operand)
-   (ashiftrt:VI128_128
- (match_operand:VI128_128 1 register_operand)
- (match_operand:VI128_128 2 nonimmediate_operand)))]
-  TARGET_XOP
+(define_expand vashrmode3mask_name
+  [(set (match_operand:VI12_128 0 register_operand)
+   (ashiftrt:VI12_128
+ (match_operand:VI12_128 1 register_operand)
+ (match_operand:VI12_128 2 nonimmediate_operand)))]
+  TARGET_XOP || (TARGET_AVX512BW  TARGET_AVX512VL)
 {
-  rtx neg = gen_reg_rtx (MODEmode);
-  emit_insn (gen_negmode2 (neg, operands[2]));
-  emit_insn (gen_xop_shamode3 (operands[0], operands[1], neg));
-  DONE;
+  if (TARGET_XOP)
+{
+  rtx neg = gen_reg_rtx (MODEmode);
+  emit_insn (gen_negmode2 (neg, operands[2]));
+  emit_insn (gen_xop_shamode3 (operands[0], operands[1], neg));
+  DONE;
+}
+})
+
+(define_expand vashrv2di3mask_name
+  [(set (match_operand:V2DI 0 register_operand)
+   (ashiftrt:V2DI
+ (match_operand:V2DI 1 register_operand)
+ (match_operand:V2DI 2 nonimmediate_operand)))]
+  TARGET_XOP || TARGET_AVX512VL
+{
+  if (TARGET_XOP)
+{
+  rtx neg = gen_reg_rtx (V2DImode);
+  emit_insn (gen_negv2di2 (neg, operands[2]));
+  emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
+  DONE;
+}
 })
 
 (define_expand vashrv4si3


Re: [PATCH i386 AVX512] [61/n] Update FP logic insn patterns.

2014-10-03 Thread Kirill Yukhin
Hello Uroš,
On 29 Sep 10:00, Uros Bizjak wrote:
  +  /* There is no vandnp[sd] in avx512f.  Use vpandn[qd].  */
  +  if (!TARGET_AVX512DQ)
 
 All other patterns also have mask_applied  condition here. Is
 the above condition correct?
I think this is correct since in this pattern we use AVX-512 only modes
in iterator, so no chance to emit anything else but EVEX insn.
In say, previous pattern we use modes are enabled for previous ISA extensions,
so we emit this hack when masking (AVX-512 specific feature) is used.

--
Thanks, K


Re: [PATCH i386 AVX512] [62/n] Add vpmaddubsw,vdbpsadbw insn patterns.

2014-10-03 Thread Kirill Yukhin
Hello Uroš,
On 29 Sep 10:08, Uros Bizjak wrote:
 On Fri, Sep 26, 2014 at 4:09 PM, Kirill Yukhin kirill.yuk...@gmail.com 
 wrote:
  +(define_insn avx512bw_pmaddubsw512modemask_name
  +  [(set (match_operand:VI2_AVX512VL 0 register_operand =v)
  +  (unspec:VI2_AVX512VL
  +[(match_operand:dbpsadbwmode 1 register_operand v)
  + (match_operand:dbpsadbwmode 2 nonimmediate_operand vm)]
  + UNSPEC_PMADDUBSW512))]
  +   TARGET_AVX512BW
  +   vpmaddubsw\t{%2, %1, %0mask_operand3|%0mask_operand3, %1, %2};
  +  [(set_attr type sseiadd)
  +   (set_attr prefix evex)
  +   (set_attr mode XI)])
  +
 Can the one above be described using standard RTX, perhaps something
 similar to avx2_pmaddubsw256?
Definetely, it can. We didn't do that because final pattern will be
twice as long as 256-bit variant resulting to 96 (!) lines and I think
in near future auto-vect won't pick MADD at all.
But if you think that it will be better to have explicit RTX, I ready to do 
that!

--
Thanks, K


Re: [PATCH i386 AVX512] [60/n] Update 128bit ashrv insn pattern.

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 12:26 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote:
 Hello Uroš,
 On 29 Sep 09:54, Uros Bizjak wrote:
  +(define_expand vashrv2di3mask_name
  +  [(set (match_operand:V2DI 0 register_operand)
  +   (ashiftrt:V2DI
  + (match_operand:V2DI 1 register_operand)
  + (match_operand:V2DI 2 nonimmediate_operand)))]
  +  TARGET_XOP || TARGET_AVX512VL
  +{
  +  if (!TARGET_XOP)

 This condition is wrong. Please re-test the patch.
 Great catch! Didn't tested whole i386.exp, so XOP tests didn't run.
 Fixed. Patch in the bottom. XOP tests are now pass.
 Is it ok for trunk now?

OK.

Thanks,
Uros.


Re: [PATCH i386 AVX512] [61/n] Update FP logic insn patterns.

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 12:49 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote:
 Hello Uroš,
 On 29 Sep 10:00, Uros Bizjak wrote:
  +  /* There is no vandnp[sd] in avx512f.  Use vpandn[qd].  */
  +  if (!TARGET_AVX512DQ)

 All other patterns also have mask_applied  condition here. Is
 the above condition correct?
 I think this is correct since in this pattern we use AVX-512 only modes
 in iterator, so no chance to emit anything else but EVEX insn.
 In say, previous pattern we use modes are enabled for previous ISA extensions,
 so we emit this hack when masking (AVX-512 specific feature) is used.

Thanks for the explanation, the patch is OK.

Thanks,
Uros.


Re: [PATCH i386 AVX512] [62/n] Add vpmaddubsw,vdbpsadbw insn patterns.

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 1:03 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote:
 Hello Uroš,
 On 29 Sep 10:08, Uros Bizjak wrote:
 On Fri, Sep 26, 2014 at 4:09 PM, Kirill Yukhin kirill.yuk...@gmail.com 
 wrote:
  +(define_insn avx512bw_pmaddubsw512modemask_name
  +  [(set (match_operand:VI2_AVX512VL 0 register_operand =v)
  +  (unspec:VI2_AVX512VL
  +[(match_operand:dbpsadbwmode 1 register_operand v)
  + (match_operand:dbpsadbwmode 2 nonimmediate_operand vm)]
  + UNSPEC_PMADDUBSW512))]
  +   TARGET_AVX512BW
  +   vpmaddubsw\t{%2, %1, %0mask_operand3|%0mask_operand3, %1, %2};
  +  [(set_attr type sseiadd)
  +   (set_attr prefix evex)
  +   (set_attr mode XI)])
  +
 Can the one above be described using standard RTX, perhaps something
 similar to avx2_pmaddubsw256?
 Definetely, it can. We didn't do that because final pattern will be
 twice as long as 256-bit variant resulting to 96 (!) lines and I think
 in near future auto-vect won't pick MADD at all.
 But if you think that it will be better to have explicit RTX, I ready to do 
 that!

Uh, no. Let's be reasonable, and put only a comment explaining the
situation, as in case of sse2_avx2_psadbw.

Uros.


Re: [RFC, RFH PATCH, i386] Fix gcc.target/i386/pr61403.c FAIL with -mavx2

2014-10-03 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 08:34:40PM +0200, Uros Bizjak wrote:
 Index: i386.c
 ===
 --- i386.c  (revision 215802)
 +++ i386.c  (working copy)
 @@ -43407,8 +43407,10 @@ expand_vec_perm_pblendv (struct expand_vec_perm_d
   AVX and AVX2 as they require more than 2 instructions.  */
if (d-one_operand_p)
  return false;
 -  if (TARGET_SSE4_1  GET_MODE_SIZE (vmode) == 16)
 +  if (TARGET_AVX2  GET_MODE_SIZE (vmode) == 32)
  ;
 +  else if (TARGET_SSE4_1  GET_MODE_SIZE (vmode) == 16)
 +;
else
  return false;
 
 --cut here--
 
 The comment above expand_vec_perm_pblendv claims that:
 
   /* Use the same checks as in expand_vec_perm_blend, but skipping
  AVX and AVX2 as they require more than 2 instructions.  */

The comment is mostly right though, I'd say as they sometimes require
more than 2 instructions.

 BTW: I have no access to avx2 target, so I can't test the patch with a
 runtime tests. OTOH, it doesn't ICE for GCC_TEST_RUN_EXPENSIVE=1 make
 check-gcc RUNTESTFLAGS='--target_board=unix/-mavx2
 dg-torture.exp=vshuf*.c'.

Even the expensive testsuite has very limited coverage.
As I wanted to prove your patch will ICE, I wrote following generator:

#ifndef ITYPE
#define ITYPE TYPE
#endif
#define S2(X) #X
#define S(X) S2(X)

int
main ()
{
  int i, j, nelt = 32 / sizeof (TYPE);
  printf (
typedef  S(TYPE)  V __attribute__ ((vector_size (32)));\n
typedef  S(ITYPE)  VI __attribute__ ((vector_size (32)));\n
V a, b, c;\n
\n
#define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) m); 
}\n
#define S(n, m...) T(n, m)\n);
  for (i = 0; i  10; i++)
{
  printf (S (__LINE__, { );
  for (j = 0; j  nelt; j++)
{
  int k = random ()  3;
  int v = j;
  if (k  1)
v = ((k  2) ? nelt : 0) + (random ()  (nelt - 1));
  printf (%d%s, v, j  (nelt - 1) ? ,  :  })\n);
}
}
}

which can be compiled e.g. with
-DTYPE=char
-DTYPE=short
-DTYPE=int
-DTYPE=long
-DTYPE=float -DITYPE=int
-DTYPE=double -DITYPE=long
and then in each case generate 10 tests (sort -u on it plus manual fixup
can decrease that, for the V4DI/V4DF cases substantially).  The first one
triggered almost immediately an ICE, added to vshuf-32.inc (non-expensive).

With the following updated patch all those generated testcases don't ICE
(-mavx2 for the first four, -mavx for the last two).

Also tested with
GCC_TEST_RUN_EXPENSIVE=1 make check-gcc 
RUNTESTFLAGS='--target_board=unix/-mavx2 dg-torture.exp=vshuf*.c'

The pr61403.c testcase can be simplified into:
typedef float V __attribute__ ((vector_size (32)));
typedef int VI __attribute__ ((vector_size (32)));
V a, b, c;

#define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) m); }
T (0, { 0, 1, 2, 3, 4, 5, 10, 13 })
T (1, { 0, 1, 2, 3, 4, 8, 11, 14 })
T (2, { 0, 1, 2, 3, 4, 9, 12, 15 })
T (3, { 0, 13, 2, 3, 14, 5, 6, 15 })
T (4, { 0, 1, 8, 3, 4, 9, 6, 7 })
T (5, { 0, 3, 11, 0, 4, 12, 0, 5 })
T (6, { 0, 3, 6, 9, 12, 15, 0, 0 })
T (7, { 0, 8, 0, 1, 9, 0, 2, 10 })
T (8, { 10, 1, 2, 11, 4, 5, 12, 7 })
T (9, { 13, 0, 6, 14, 0, 7, 15, 0 })
T (10, { 1, 4, 7, 10, 13, 0, 0, 0 })
T (11, { 2, 5, 8, 11, 14, 0, 0, 0 })
permutations, where both your and my patch optimize
foo{0,1,2,3,4,8}.

2014-10-03  Jakub Jelinek  ja...@redhat.com
Uros Bizjak  ubiz...@gmail.com

PR tree-optimization/61403
* config/i386/i386.c (expand_vec_perm_palignr): Fix a spelling
error in comment.  Also optimize 256-bit vectors for AVX2
or AVX (floating vectors only), provided the first permutation
can be performed in one insn.

* gcc.dg/torture/vshuf-32.inc: Add a new test 29.

--- gcc/config/i386/i386.c.jj   2014-10-03 09:26:14.0 +0200
+++ gcc/config/i386/i386.c  2014-10-03 12:39:24.040185310 +0200
@@ -43422,7 +43422,7 @@ expand_vec_perm_palignr (struct expand_v
 
 /* A subroutine of ix86_expand_vec_perm_const_1.  Try to simplify
the permutation using the SSE4_1 pblendv instruction.  Potentially
-   reduces permutaion from 2 pshufb and or to 1 pshufb and pblendv.  */
+   reduces permutation from 2 pshufb and or to 1 pshufb and pblendv.  */
 
 static bool
 expand_vec_perm_pblendv (struct expand_vec_perm_d *d)
@@ -43432,11 +43432,14 @@ expand_vec_perm_pblendv (struct expand_v
   enum machine_mode vmode = d-vmode;
   bool ok;
 
-  /* Use the same checks as in expand_vec_perm_blend, but skipping
- AVX and AVX2 as they require more than 2 instructions.  */
+  /* Use the same checks as in expand_vec_perm_blend.  */
   if (d-one_operand_p)
 return false;
-  if (TARGET_SSE4_1  GET_MODE_SIZE (vmode) == 16)
+  if (TARGET_AVX2  GET_MODE_SIZE (vmode) == 32)
+;
+  else if (TARGET_AVX  (vmode == V4DFmode || vmode == V8SFmode))
+;
+  else if (TARGET_SSE4_1  GET_MODE_SIZE (vmode) == 16)
 ;
   else
 return false;
@@ -43458,7 +43461,7 @@ expand_vec_perm_pblendv (struct 

[PATCH] gcc.dg/gomp/ cleanup

2014-10-03 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/gomp/ directory.
See https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02656.html for more info.

Tested on x86_64-linux: vanilla results == results with this patch ==
results with this patch and gnu11 as a default.

Applying to trunk.

2014-10-03  Marek Polacek  pola...@redhat.com

* gcc.dg/gomp/appendix-a/a.35.4.c: Fix implicit declarations.
* gcc.dg/gomp/appendix-a/a.35.5.c: Likewise.
* gcc.dg/gomp/appendix-a/a.35.6.c: Likewise.
* gcc.dg/gomp/asm-1.c: Likewise.
* gcc.dg/gomp/for-1.c: Likewise.
* gcc.dg/gomp/empty.c: Fix defaulting to int.
* gcc.dg/gomp/sharing-3.c: Likewise.
* gcc.dg/gomp/udr-3.c: Use -std=gnu89.

diff --git gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c 
gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c
index 5bb6b80..8562fca 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 
+void work (int, int);
+
 void
 wrong4 (int n)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c 
gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c
index 7b4aee1..90d2966 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 
+void work (int, int);
+
 void
 wrong5 (int n)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c 
gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c
index d18188b..6260be7 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 
+void work (int, int);
+
 void
 wrong6 (int n)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c 
gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c
index ced31f3..2b428c0 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c
@@ -2,6 +2,8 @@
 /* { dg-do compile } */
 /* { dg-options -O2 -fopenmp } */
 
+extern int omp_get_thread_num (void);
+
 void
 foo (void)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/empty.c 
gcc/gcc/testsuite/gcc.dg/gomp/empty.c
index 6a21c04..c7aba8f 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/empty.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/empty.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options -O -fopenmp -fdump-tree-ompexp } */
 
+int
 main()
 {
 #pragma omp parallel
diff --git gcc/gcc/testsuite/gcc.dg/gomp/for-1.c 
gcc/gcc/testsuite/gcc.dg/gomp/for-1.c
index 384293e..80e0d0b 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/for-1.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/for-1.c
@@ -1,6 +1,8 @@
 /* { dg-do compile } */
 /* { dg-options -fopenmp -fshow-column } */
 
+void baz (int);
+
 void foo (int j, int k)
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c 
gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c
index 36f72e3..4a30198 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c
@@ -3,6 +3,7 @@
 #define N   50
 #define CHUNKSIZE   5
 
+int
 main ()
 {
   int i, chunk;
diff --git gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c 
gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c
index bdfcce1..96450cd 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options -fopenmp } */
+/* { dg-options -fopenmp -std=gnu89 } */
 
 struct S { int s; };
 struct T { int t; };

Marek


Re: [RFC, RFH PATCH, i386] Fix gcc.target/i386/pr61403.c FAIL with -mavx2

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 1:11 PM, Jakub Jelinek ja...@redhat.com wrote:
 On Thu, Oct 02, 2014 at 08:34:40PM +0200, Uros Bizjak wrote:
 Index: i386.c
 ===
 --- i386.c  (revision 215802)
 +++ i386.c  (working copy)
 @@ -43407,8 +43407,10 @@ expand_vec_perm_pblendv (struct expand_vec_perm_d
   AVX and AVX2 as they require more than 2 instructions.  */
if (d-one_operand_p)
  return false;
 -  if (TARGET_SSE4_1  GET_MODE_SIZE (vmode) == 16)
 +  if (TARGET_AVX2  GET_MODE_SIZE (vmode) == 32)
  ;
 +  else if (TARGET_SSE4_1  GET_MODE_SIZE (vmode) == 16)
 +;
else
  return false;

 --cut here--

 The comment above expand_vec_perm_pblendv claims that:

   /* Use the same checks as in expand_vec_perm_blend, but skipping
  AVX and AVX2 as they require more than 2 instructions.  */

 The comment is mostly right though, I'd say as they sometimes require
 more than 2 instructions.

 BTW: I have no access to avx2 target, so I can't test the patch with a
 runtime tests. OTOH, it doesn't ICE for GCC_TEST_RUN_EXPENSIVE=1 make
 check-gcc RUNTESTFLAGS='--target_board=unix/-mavx2
 dg-torture.exp=vshuf*.c'.

 Even the expensive testsuite has very limited coverage.
 As I wanted to prove your patch will ICE, I wrote following generator:

 #ifndef ITYPE
 #define ITYPE TYPE
 #endif
 #define S2(X) #X
 #define S(X) S2(X)

 int
 main ()
 {
   int i, j, nelt = 32 / sizeof (TYPE);
   printf (
 typedef  S(TYPE)  V __attribute__ ((vector_size (32)));\n
 typedef  S(ITYPE)  VI __attribute__ ((vector_size (32)));\n
 V a, b, c;\n
 \n
 #define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) 
 m); }\n
 #define S(n, m...) T(n, m)\n);
   for (i = 0; i  10; i++)
 {
   printf (S (__LINE__, { );
   for (j = 0; j  nelt; j++)
 {
   int k = random ()  3;
   int v = j;
   if (k  1)
 v = ((k  2) ? nelt : 0) + (random ()  (nelt - 1));
   printf (%d%s, v, j  (nelt - 1) ? ,  :  })\n);
 }
 }
 }

 which can be compiled e.g. with
 -DTYPE=char
 -DTYPE=short
 -DTYPE=int
 -DTYPE=long
 -DTYPE=float -DITYPE=int
 -DTYPE=double -DITYPE=long
 and then in each case generate 10 tests (sort -u on it plus manual fixup
 can decrease that, for the V4DI/V4DF cases substantially).  The first one
 triggered almost immediately an ICE, added to vshuf-32.inc (non-expensive).

 With the following updated patch all those generated testcases don't ICE
 (-mavx2 for the first four, -mavx for the last two).

 Also tested with
 GCC_TEST_RUN_EXPENSIVE=1 make check-gcc 
 RUNTESTFLAGS='--target_board=unix/-mavx2 dg-torture.exp=vshuf*.c'

I have had some problems testing with TARGET_AVX part of the change
and /-mavx tests. I assume that your patch survives these tests.

 The pr61403.c testcase can be simplified into:
 typedef float V __attribute__ ((vector_size (32)));
 typedef int VI __attribute__ ((vector_size (32)));
 V a, b, c;

 #define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) m); 
 }
 T (0, { 0, 1, 2, 3, 4, 5, 10, 13 })
 T (1, { 0, 1, 2, 3, 4, 8, 11, 14 })
 T (2, { 0, 1, 2, 3, 4, 9, 12, 15 })
 T (3, { 0, 13, 2, 3, 14, 5, 6, 15 })
 T (4, { 0, 1, 8, 3, 4, 9, 6, 7 })
 T (5, { 0, 3, 11, 0, 4, 12, 0, 5 })
 T (6, { 0, 3, 6, 9, 12, 15, 0, 0 })
 T (7, { 0, 8, 0, 1, 9, 0, 2, 10 })
 T (8, { 10, 1, 2, 11, 4, 5, 12, 7 })
 T (9, { 13, 0, 6, 14, 0, 7, 15, 0 })
 T (10, { 1, 4, 7, 10, 13, 0, 0, 0 })
 T (11, { 2, 5, 8, 11, 14, 0, 0, 0 })
 permutations, where both your and my patch optimize
 foo{0,1,2,3,4,8}.

 2014-10-03  Jakub Jelinek  ja...@redhat.com
 Uros Bizjak  ubiz...@gmail.com

 PR tree-optimization/61403
 * config/i386/i386.c (expand_vec_perm_palignr): Fix a spelling
 error in comment.  Also optimize 256-bit vectors for AVX2
 or AVX (floating vectors only), provided the first permutation
 can be performed in one insn.

 * gcc.dg/torture/vshuf-32.inc: Add a new test 29.

OK if the patch bootstraps and regtests without problems.

Thanks,
Uros.


[patch] Use abi_tag attribute on std::list

2014-10-03 Thread Jonathan Wakely

This is the patch I intend to commit to make std::list::size() O(1) as
required by C++11.

This is an ABI change, so std::list will get tagged with
abi_tag(cxx11) so that it mangles differently.

I took a different approach to the way O(1) size() was implemented
(and then reverted) for GCC 4.7.0, because I didn't like updating the
size when node are (de)allocated. Instead this patch adjusts the size
when nodes are added or removed from the list, rather then when
they're allocated.

Instead of littering the code with #if checks I added new
_M_xxx_size() members that can be called unconditionally when
modifying the list, but they do nothing when there's no size member.
This means there's only a single #if condition added to std::list by
this patch.

There will be another patch coming soon to add C++11 allocator support
to std::list, and another to add a non-COW std::string using abi_tag.

I don't yet know what we should do about the
--enable-symvers=gnu-versioned-namespace configuration, maybe we
should move the soname for that option to libstdc++.so.8 and have
_GLIBCXX_USE_CXX11_ABI=1 and _GLIBCXX_DEFAULT_ABI_TAG= set always,
so that the versioned-namespace configuration always gets the new ABI
and doesn't need to use the tag (because using that configuration
already implies you're not interested in ABI compatibility). I'd
prefer not to have versioned-namespace-with-new-abi and
versioned-namespace-without-new-abi configurations, given that we don't
know if anyone's even using versioned namespaces for anything serious.

Tested x86_64-linux, with --disable-libstdcxx-cxx11-abi and without.
commit 160dfb8b15ca20581634c235c75293712072f622
Author: Jonathan Wakely jwak...@redhat.com
Date:   Thu Aug 7 01:13:17 2014 +0100

	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI): Define.
	* configure.ac: Use GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI.
	* configure: Regenerate.
	* include/Makefile.am (stamp-cxx11-abi): New target.
	(c++config.h): Set _GLIBCXX_USE_CXX11_ABI macro.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Add _GLIBCXX_USE_CXX11_ABI placeholder and
	define _GLIBCXX_DEFAULT_ABI_TAG.
	* include/bits/list.tcc (list::emplace(const_iterator, _Args...)):
	Increment size.
	(list::emplace(const_iterator, const value_type)): Likewise.
	(list::merge(list), list::merge(list, _StrictWeakOrdering)): Adjust
	list sizes.
	* include/bits/stl_list.h (_List_base, list): Add ABI tag macro.
	(_List_base::_M_size): New data member in cxx11 ABI mode.
	(_List_base::_S_distance(_List_node_base*, _List_node_base*)): New
	function.
	(_List_base::_M_get_size(), _List_base::_M_set_size(size_t),
	_List_base::_M_inc_size(size_t), _List_base::_M_dec_size(size_t),
	_List_base::_M_distance, _List_base::_M_node_count): New functions for
	accessing list size correctly for the ABI mode.
	(_List_base::_List_base(_List_base)): Copy size and reset source.
	(_List_base::_M_init()): Initialize size member.
	(list::size()): Use _List_base::_M_node_count.
	(list::swap(list)): Swap sizes.
	(list::splice(iterator, list)): Update sizes.
	(list::splice(iterator, list, iterator)): Likewise.
	(list::insert(iterator, const value_type)): Update size.
	(list::insert(iterator, _Args...)): Likewise.
	(list::_M_erase(iterator)): Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Adjust.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Adjust.
	* testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
	Adjust.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
	Adjust.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 2650a5a..0229609 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3831,6 +3831,25 @@ AC_DEFUN([GLIBCXX_CHECK_SDT_H], [
   AC_MSG_RESULT($glibcxx_cv_sys_sdt_h)
 ])
 
+dnl
+dnl Check if the user wants the new C++11-conforming ABI.
+dnl
+dnl --disable-libstdcxx-cxx11-abi will use old ABI for all types.
+dnl
+dnl Defines:
+dnl  _GLIBCXX_USE_ABI_TAG (always defined, either to 1 or 0)
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI], [
+  AC_ARG_ENABLE([libstdcxx-cxx11-abi],
+AC_HELP_STRING([--disable-libstdcxx-cxx11-abi],
+		   [disable the C++11-conforming ABI]),,
+		   [enable_libstdcxx_cxx11_abi=yes])
+  if test x$enable_libstdcxx_cxx11_abi != xyes; then
+AC_MSG_NOTICE([C++11-conforming ABI is disabled])
+  fi
+  GLIBCXX_CONDITIONAL(ENABLE_CXX11_ABI, test $enable_libstdcxx_cxx11_abi = yes)
+])
+
 # Macros from the top-level gcc directory.
 m4_include([../config/gc++filt.m4])
 m4_include([../config/tls.m4])
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 1de0f6c..eb826e4 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -365,6 +365,8 @@ 

[PATCH] Disable __asan_init for KASan

2014-10-03 Thread Yury Gribov

Hi all,

This patch disables generation of asan_init calls for KASan as discussed 
in https://lkml.org/lkml/2014/9/26/711


Bootstrapped and regtested no x64. Ok to commit?

-Y
commit 91c015e54687666f4abf6745f33c2eee8e569d17
Author: Yury Gribov y.gri...@samsung.com
Date:   Fri Oct 3 11:53:38 2014 +0400

2014-10-03  Yury Gribov  y.gri...@samsung.com

gcc/
	* asan.c (asan_finish_file): Disable __asan_init calls for KASan;
	don't emit empty ctors.

diff --git a/gcc/asan.c b/gcc/asan.c
index f520eab..247661a 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2400,8 +2400,11 @@ asan_finish_file (void)
  nor after .LASAN* array.  */
   flag_sanitize = ~SANITIZE_ADDRESS;
 
-  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
-  append_to_statement_list (build_call_expr (fn, 0), asan_ctor_statements);
+  if (flag_sanitize  SANITIZE_USER_ADDRESS)
+{
+  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
+  append_to_statement_list (build_call_expr (fn, 0), asan_ctor_statements);
+}
   FOR_EACH_DEFINED_VARIABLE (vnode)
 if (TREE_ASM_WRITTEN (vnode-decl)
 	 asan_protect_global (vnode-decl))
@@ -2438,7 +2441,7 @@ asan_finish_file (void)
   DECL_INITIAL (var) = ctor;
   varpool_node::finalize_decl (var);
 
-  fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
+  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
   tree gcount_tree = build_int_cst (pointer_sized_int_node, gcount);
   append_to_statement_list (build_call_expr (fn, 2,
 		 build_fold_addr_expr (var),
@@ -2453,8 +2456,9 @@ asan_finish_file (void)
   cgraph_build_static_cdtor ('D', dtor_statements,
  MAX_RESERVED_INIT_PRIORITY - 1);
 }
-  cgraph_build_static_cdtor ('I', asan_ctor_statements,
-			 MAX_RESERVED_INIT_PRIORITY - 1);
+  if (asan_ctor_statements)
+cgraph_build_static_cdtor ('I', asan_ctor_statements,
+			   MAX_RESERVED_INIT_PRIORITY - 1);
   flag_sanitize |= SANITIZE_ADDRESS;
 }
 


Re: [PATCH] Disable __asan_init for KASan

2014-10-03 Thread Jakub Jelinek
On Fri, Oct 03, 2014 at 05:07:01PM +0400, Yury Gribov wrote:
 Hi all,
 
 This patch disables generation of asan_init calls for KASan as discussed in
 https://lkml.org/lkml/2014/9/26/711
 
 Bootstrapped and regtested no x64. Ok to commit?

Ok, thanks.

 commit 91c015e54687666f4abf6745f33c2eee8e569d17
 Author: Yury Gribov y.gri...@samsung.com
 Date:   Fri Oct 3 11:53:38 2014 +0400
 
 2014-10-03  Yury Gribov  y.gri...@samsung.com
 
 gcc/
   * asan.c (asan_finish_file): Disable __asan_init calls for KASan;
   don't emit empty ctors.

Jakub


Re: [PATCH] Disable __asan_init for KASan

2014-10-03 Thread Dmitry Vyukov
Looks good to me

On Fri, Oct 3, 2014 at 5:07 PM, Yury Gribov y.gri...@samsung.com wrote:
 Hi all,

 This patch disables generation of asan_init calls for KASan as discussed in
 https://lkml.org/lkml/2014/9/26/711

 Bootstrapped and regtested no x64. Ok to commit?

 -Y

 commit 91c015e54687666f4abf6745f33c2eee8e569d17
 Author: Yury Gribov y.gri...@samsung.com
 Date:   Fri Oct 3 11:53:38 2014 +0400

 2014-10-03  Yury Gribov  y.gri...@samsung.com

 gcc/
 * asan.c (asan_finish_file): Disable __asan_init calls for KASan;
 don't emit empty ctors.

 diff --git a/gcc/asan.c b/gcc/asan.c
 index f520eab..247661a 100644
 --- a/gcc/asan.c
 +++ b/gcc/asan.c
 @@ -2400,8 +2400,11 @@ asan_finish_file (void)
   nor after .LASAN* array.  */
flag_sanitize = ~SANITIZE_ADDRESS;

 -  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
 -  append_to_statement_list (build_call_expr (fn, 0),
 asan_ctor_statements);
 +  if (flag_sanitize  SANITIZE_USER_ADDRESS)
 +{
 +  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
 +  append_to_statement_list (build_call_expr (fn, 0),
 asan_ctor_statements);
 +}
FOR_EACH_DEFINED_VARIABLE (vnode)
  if (TREE_ASM_WRITTEN (vnode-decl)
  asan_protect_global (vnode-decl))
 @@ -2438,7 +2441,7 @@ asan_finish_file (void)
DECL_INITIAL (var) = ctor;
varpool_node::finalize_decl (var);

 -  fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
 +  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
tree gcount_tree = build_int_cst (pointer_sized_int_node, gcount);
append_to_statement_list (build_call_expr (fn, 2,
  build_fold_addr_expr (var),
 @@ -2453,8 +2456,9 @@ asan_finish_file (void)
cgraph_build_static_cdtor ('D', dtor_statements,
  MAX_RESERVED_INIT_PRIORITY - 1);
  }
 -  cgraph_build_static_cdtor ('I', asan_ctor_statements,
 -MAX_RESERVED_INIT_PRIORITY - 1);
 +  if (asan_ctor_statements)
 +cgraph_build_static_cdtor ('I', asan_ctor_statements,
 +  MAX_RESERVED_INIT_PRIORITY - 1);
flag_sanitize |= SANITIZE_ADDRESS;
  }




[PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Mark Wielaard
A debugger not knowing whether a special member function was explicitly
defaulted, implicitly declared or explicitly defined seems less confusion
than not knowing whether it was deleted. But there are some subtle cases
where knowing whether a constructor was user defined or explicitly
defaulted do matter for whether the default constructor might have been
implicitly generated. So like the deleted case this patch introduces
a new attribute DW_AT_GNU_defaulted that gets attached to the function
declaration. Note that since this is for declarations we explicitly
test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
definitions that use = default; outside the class body.

gcc/ChangeLog

* dwarf2out.c (gen_subprogram_die): When a member function is
declared default then add a DW_AT_GNU_defaulted attribute.
* langhooks.h (struct lang_hooks_for_decls): Add
function_decl_defaulted_p langhook.
* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.

gcc/cp/ChangeLog

* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
(cp_function_decl_defaulted_p): New prototype.
* cp-objcp-common.c (cp_function_defaulted_p): New function.

gcc/testsuite/ChangeLog

* g++.dg/debug/dwarf2/defaulted-member-function.C: New testcase.

include/ChangeLog

* dwarf2.def (DW_AT_GNU_defaulted): New attribute.
---
 gcc/ChangeLog   | 10 ++
 gcc/cp/ChangeLog|  7 +++
 gcc/cp/cp-objcp-common.c| 10 ++
 gcc/cp/cp-objcp-common.h|  3 +++
 gcc/dwarf2out.c |  6 ++
 gcc/langhooks-def.h |  2 ++
 gcc/langhooks.h |  3 +++
 gcc/testsuite/ChangeLog |  5 +
 .../g++.dg/debug/dwarf2/defaulted-member-function.C | 17 +
 include/ChangeLog   |  5 +
 include/dwarf2.def  |  2 ++
 11 files changed, 70 insertions(+)
 create mode 100644 
gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function.C

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc3287b..255b1b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2014-10-03  Mark Wielaard  m...@redhat.com
+
+   PR debug/63240
+   * dwarf2out.c (gen_subprogram_die): When a member function is
+   declared default then add a DW_AT_GNU_defaulted attribute.
+   * langhooks.h (struct lang_hooks_for_decls): Add
+   function_decl_defaulted_p langhook.
+   * langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+   (LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.
+
 2014-10-02  Mark Wielaard  m...@redhat.com
 
PR debug/63239
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 921f95c..d88bcd8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-03  Mark Wielaard  m...@redhat.com
+
+   PR debug/63240
+   * cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+   (cp_function_decl_defaulted_p): New prototype.
+   * cp-objcp-common.c (cp_function_defaulted_p): New function.
+
 2014-10-02  Mark Wielaard  m...@redhat.com
 
PR debug/63239
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 0d144ef..5516671 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -178,6 +178,16 @@ cp_function_decl_deleted_p (tree decl)
   DECL_DELETED_FN (decl));
 }
 
+/* Return true if DECL is defaulted in the class body.  */
+
+bool
+cp_function_decl_defaulted_p (tree decl)
+{
+  return (decl
+  DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
+  DECL_DEFAULTED_IN_CLASS_P (decl));
+}
+
 /* Stubs to keep c-opts.c happy.  */
 void
 push_file_scope (void)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index c289774..348874f 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -28,6 +28,7 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, 
tsubst_flags_t,
 
 extern bool cp_function_decl_explicit_p (tree decl);
 extern bool cp_function_decl_deleted_p (tree decl);
+extern bool cp_function_decl_defaulted_p (tree decl);
 extern void cp_common_init_ts (void);
 
 /* Lang hooks that are shared between C++ and ObjC++ are defined here.  Hooks
@@ -134,6 +135,8 @@ extern void cp_common_init_ts (void);
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
 #undef LANG_HOOKS_FUNCTION_DECL_DELETED_P
 #define LANG_HOOKS_FUNCTION_DECL_DELETED_P cp_function_decl_deleted_p
+#undef LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P
+#define LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P cp_function_decl_defaulted_p
 #undef 

[PATCH 1/2] PR debug/63239 Add DWARF representation for C++11 deleted member function.

2014-10-03 Thread Mark Wielaard
Currently we output a declaration of the explicitly deleted function
in DWARF. That seems wrong. An alternative to adding an attribute would
be to just not output the declaration. But that is also confusing since
then it looks precisely the same as an class that has that special
function implicitly defined, since we don't output a declaration for
such implicitly defined special functions either. So this implementation
defines a new attribute DW_AT_GNU_deleted that gets added to the
declaration.

include/ChangeLog

* dwarf2.def (DW_AT_GNU_deleted): New attribute.

gcc/ChangeLog

* dwarf2out.c (gen_subprogram_die): When a member function is
explicitly deleted then add a DW_AT_GNU_deleted attribute.
* langhooks.h (struct lang_hooks_for_decls): Add
function_decl_deleted_p langhook.
* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DELETED_P): Define.
(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DELETED_P.

gcc/cp/ChangeLog

* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DELETED_P): Define.
(cp_function_decl_deleted_p): New prototype.
* cp-objcp-common.c (cp_function_deleted_p): New function.

gcc/testsuite/ChangeLog

* g++.dg/debug/dwarf2/deleted-member-function.C: New testcase.
---
 gcc/ChangeLog   | 10 ++
 gcc/cp/ChangeLog|  7 +++
 gcc/cp/cp-objcp-common.c| 10 ++
 gcc/cp/cp-objcp-common.h|  3 +++
 gcc/dwarf2out.c |  6 ++
 gcc/langhooks-def.h |  2 ++
 gcc/langhooks.h |  3 +++
 gcc/testsuite/ChangeLog |  5 +
 .../g++.dg/debug/dwarf2/deleted-member-function.C   | 17 +
 include/ChangeLog   |  5 +
 include/dwarf2.def  |  2 ++
 11 files changed, 70 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/deleted-member-function.C

diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 0c50f40..0d144ef 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -168,6 +168,16 @@ cp_function_decl_explicit_p (tree decl)
   DECL_NONCONVERTING_P (decl));
 }
 
+/* Return true if DECL is deleted special member function.  */
+
+bool
+cp_function_decl_deleted_p (tree decl)
+{
+  return (decl
+  DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
+  DECL_DELETED_FN (decl));
+}
+
 /* Stubs to keep c-opts.c happy.  */
 void
 push_file_scope (void)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 246800e..c289774 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -27,6 +27,7 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, 
tsubst_flags_t,
 tree, bool);
 
 extern bool cp_function_decl_explicit_p (tree decl);
+extern bool cp_function_decl_deleted_p (tree decl);
 extern void cp_common_init_ts (void);
 
 /* Lang hooks that are shared between C++ and ObjC++ are defined here.  Hooks
@@ -131,6 +132,8 @@ extern void cp_common_init_ts (void);
 #define LANG_HOOKS_GIMPLIFY_EXPR cp_gimplify_expr
 #undef LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
+#undef LANG_HOOKS_FUNCTION_DECL_DELETED_P
+#define LANG_HOOKS_FUNCTION_DECL_DELETED_P cp_function_decl_deleted_p
 #undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
 #define LANG_HOOKS_OMP_PREDETERMINED_SHARING cxx_omp_predetermined_sharing
 #undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index b5fcfa4..11544d8 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18299,6 +18299,12 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
   (dwarf_version = 3 || !dwarf_strict))
add_AT_flag (subr_die, DW_AT_explicit, 1);
 
+ /* If this is a C++11 deleted special function member then generate
+a DW_AT_GNU_deleted attribute.  */
+ if (lang_hooks.decls.function_decl_deleted_p (decl)
+  (! dwarf_strict))
+   add_AT_flag (subr_die, DW_AT_GNU_deleted, 1);
+
  /* The first time we see a member function, it is in the context of
 the class to which it belongs.  We make sure of this by emitting
 the class first.  The next time is the definition, which is
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index e77d2d9..e5ae3e3 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -203,6 +203,7 @@ extern tree lhd_make_node (enum tree_code);
 #define LANG_HOOKS_PUSHDECLpushdecl
 #define LANG_HOOKS_GETDECLSgetdecls
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P hook_bool_tree_false
+#define LANG_HOOKS_FUNCTION_DECL_DELETED_P hook_bool_tree_false
 #define 

[patch] libstdc++/63449 remove outdated documentation

2014-10-03 Thread Jonathan Wakely

I think after 12 years it's safe to say that alternative version ain't
gonna happen.

Committed to trunk.


commit 14a8726815925137217b4282cf89460c547e7248
Author: Jonathan Wakely jwak...@redhat.com
Date:   Fri Oct 3 14:28:44 2014 +0100

	PR libstdc++/63449
	* doc/xml/manual/containers.xml: Remove outdated section.
	* doc/html/*: Regenerate.

index ec2cb21..434a306 100644
--- a/libstdc++-v3/doc/xml/manual/containers.xml
+++ b/libstdc++-v3/doc/xml/manual/containers.xml
@@ -72,26 +72,6 @@
   /section
 /section
 
-section xml:id=containers.sequences.vector xreflabel=vectorinfotitlevector/title/info
-?dbhtml filename=vector.html?
-  
-  para
-  /para
-  section xml:id=sequences.vector.management xreflabel=Space Overhead ManagementinfotitleSpace Overhead Management/title/info
-
-   para
- In link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://gcc.gnu.org/ml/libstdc++/2002-04/msg00105.html;this
- message to the list/link, Daniel Kostecky announced work on an
- alternate form of codestd::vector/code that would support
- hints on the number of elements to be over-allocated.  The design
- was also described, along with possible implementation choices.
-   /para
-   para
- The first two alpha releases were announced link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://gcc.gnu.org/ml/libstdc++/2002-07/msg00048.html;here/link
- and link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://gcc.gnu.org/ml/libstdc++/2002-07/msg00111.html;here/link.
-   /para
-
-  /section/section
 /section
 
 !-- Sect1 02 : Associative --


Re: [PATCH,i386] Fix adxintrin on mingw.

2014-10-03 Thread Ilya Tocar
On 02 Oct 07:41, H.J. Lu wrote:
 On Thu, Oct 2, 2014 at 7:29 AM, Ilya Tocar tocarip.in...@gmail.com wrote:
  Hi,
 
  sizeof (long) == 4 on windows, so we should use long long as param type.
  Patch below does it.
 
 The same is true for x32.  Can you add a testcase to show it
 fails on x32 without the fix?


This could only be done with runtime test.
I've had troubles running sde (emulator) on x32 enabled system,
but replacing long long with int in intrinsic signature will cause
adx-addcarryx64-2.c to fail under sde on 64 bits. I believe it will
also fail on sde+{win,x32} or real hardware, when it's available.

  Ok for trunk?
 
  2014-10-02  Ilya Tocar  ilya.to...@intel.com
 
  * config/i386/adxintrin.h (_subborrow_u64): Use long long for param
  type.
  (_addcarry_u64): Ditto.
  (_addcarryx_u64): Ditto.
 
  ---
   gcc/config/i386/adxintrin.h | 12 ++--
   1 file changed, 6 insertions(+), 6 deletions(-)
 
  diff --git a/gcc/config/i386/adxintrin.h b/gcc/config/i386/adxintrin.h
  index 8f2c01a..00a9b86 100644
  --- a/gcc/config/i386/adxintrin.h
  +++ b/gcc/config/i386/adxintrin.h
  @@ -55,24 +55,24 @@ _addcarryx_u32 (unsigned char __CF, unsigned int __X,
   #ifdef __x86_64__
   extern __inline unsigned char
   __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  -_subborrow_u64 (unsigned char __CF, unsigned long __X,
  -   unsigned long __Y, unsigned long long *__P)
  +_subborrow_u64 (unsigned char __CF, unsigned long long __X,
  +   unsigned long long __Y, unsigned long long *__P)
   {
   return __builtin_ia32_sbb_u64 (__CF, __Y, __X, __P);
   }
 
   extern __inline unsigned char
   __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  -_addcarry_u64 (unsigned char __CF, unsigned long __X,
  -  unsigned long __Y, unsigned long long *__P)
  +_addcarry_u64 (unsigned char __CF, unsigned long long __X,
  +  unsigned long long __Y, unsigned long long *__P)
   {
   return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P);
   }
 
   extern __inline unsigned char
   __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  -_addcarryx_u64 (unsigned char __CF, unsigned long __X,
  -   unsigned long __Y, unsigned long long *__P)
  +_addcarryx_u64 (unsigned char __CF, unsigned long long __X,
  +   unsigned long long __Y, unsigned long long *__P)
   {
   return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P);
   }
  --
  1.8.3.1
 
 
 
 
 -- 
 H.J.


Re: __intN patch 3/5: main __int128 - __intN conversion.

2014-10-03 Thread Jason Merrill

On 10/02/2014 02:00 PM, DJ Delorie wrote:

Ah, good point.  In which case I don't see what this code is trying to
accomplish relative to falling through to the prefer the unsigned one
code below.  Shall we just remove it?


I don't know for sure.  There was __int128 code there, I replaced it
with the same code, so as to avoid any functional differences on
mainstream targets.

I imagine the code is there for when __int128 is the same size as some
other types besides long long.


But if __int128 happened to be the same size as long the code was wrong. 
 Well, I suppose it could be there to prefer __int128 to 
intTI_type_node.  I guess let's move the intN handling below the code 
for (u)long and add support for unsigned extended integers like there is 
for both long and long long.


Jason



Re: [debug-early] do not add location info/etc to abstract instances

2014-10-03 Thread Jason Merrill

On 10/02/2014 03:24 PM, Aldy Hernandez wrote:

If you are ok with this incremental patch, I will push it to the branch.


Looks good.  In general I don't think you need to wait for approval 
before checking something in on your own branch.  :)


Jason



[PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Andi Kleen
From: Andi Kleen a...@linux.intel.com

Add calls for several illegal Cilk cases to the C++ frontend.
C++ usually doesn't ICE unlike C on illegal cilk, but it's
better to match C in what is allowed and what is not.

if (_Cilk_spawn ...) is still not errored, but at least it doesn't ICE.

gcc/cp/:

2014-09-30  Andi Kleen  a...@linux.intel.com

* semantics.c (finish_goto_stmt): Call check_no_cilk.
(finish_while_stmt_cond): Dito.
(finish_do_stmt): Dito.
(finish_for_cond): Dito.
(finish_switch_cond): Dito.
---
 gcc/cp/semantics.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7569826..e7ff223 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -621,6 +621,10 @@ finish_goto_stmt (tree destination)
 TREE_USED (destination) = 1;
   else
 {
+  if (check_no_cilk (destination,
+Cilk array notation cannot be used as a computed goto expression,
+%_Cilk_spawn% statement cannot be used as a computed goto 
expression))
+   destination = error_mark_node;
   destination = mark_rvalue_use (destination);
   if (!processing_template_decl)
{
@@ -792,6 +796,10 @@ begin_while_stmt (void)
 void
 finish_while_stmt_cond (tree cond, tree while_stmt, bool ivdep)
 {
+  if (check_no_cilk (cond,
+  Cilk array notation cannot be used as a condition for while statement,
+  %_Cilk_spawn% statement cannot be used as a condition for while 
statement))
+cond = error_mark_node;
   cond = maybe_convert_cond (cond);
   finish_cond (WHILE_COND (while_stmt), cond);
   begin_maybe_infinite_loop (cond);
@@ -847,6 +855,10 @@ finish_do_body (tree do_stmt)
 void
 finish_do_stmt (tree cond, tree do_stmt, bool ivdep)
 {
+  if (check_no_cilk (cond,
+  Cilk array notation cannot be used as a condition for a do-while statement,
+  %_Cilk_spawn% statement cannot be used as a condition for a do-while 
statement))
+cond = error_mark_node;
   cond = maybe_convert_cond (cond);
   end_maybe_infinite_loop (cond);
   if (ivdep  cond != error_mark_node)
@@ -956,6 +968,10 @@ finish_for_init_stmt (tree for_stmt)
 void
 finish_for_cond (tree cond, tree for_stmt, bool ivdep)
 {
+  if (check_no_cilk (cond,
+Cilk array notation cannot be used in a condition for a for-loop,
+%_Cilk_spawn% statement cannot be used in a condition for a 
for-loop))
+cond = error_mark_node;
   cond = maybe_convert_cond (cond);
   finish_cond (FOR_COND (for_stmt), cond);
   begin_maybe_infinite_loop (cond);
@@ -1118,6 +1134,12 @@ void
 finish_switch_cond (tree cond, tree switch_stmt)
 {
   tree orig_type = NULL;
+
+  if (check_no_cilk (cond,
+   Cilk array notation cannot be used as a condition for switch 
statement,
+   %_Cilk_spawn% statement cannot be used as a condition for switch 
statement))
+cond = error_mark_node;
+
   if (!processing_template_decl)
 {
   /* Convert the condition to an integer or enumeration type.  */
-- 
2.1.1



Updated cilk error patches

2014-10-03 Thread Andi Kleen
This version addresses the localization problem pointed out by Joseph.
No other changes. I only reposted the two changed patches in the patchkit,
the others have already been approved.

Passes bootstrap and test suite on x86_64-linux.

-Andi



[PATCH 1/2] Error out for Cilk_spawn or array expression in forbidden places

2014-10-03 Thread Andi Kleen
From: Andi Kleen a...@linux.intel.com

_Cilk_spawn or Cilk array expressions are only allowed on their own,
but not in for(), if(), switch, do, while, goto, etc.
The C parser didn't always check for that, which lead to ICEs earlier
for invalid code.

Add a generic helper that checks this and call it where needed
in the C frontend.

I chose to allow spawn/array for for init and increment expressions.
While the Cilk spec could be interpreted to forbid it there too
there didn't seem any reason to not allow it.

One dark corner is spawn, array in statement expressions not at
the end. Right now that's forbidden too.

gcc/c-family/:

2014-09-30  Andi Kleen  a...@linux.intel.com

PR c/60804
* c-common.h (check_no_cilk): Declare.
* cilk.c (get_error_location): New function.
(check_no_cilk): Dito.

gcc/c/:

2014-09-30  Andi Kleen  a...@linux.intel.com

PR c/60804
* c-parser.c (c_parser_statement_after_labels): Call
check_no_cilk.
(c_parser_if_statement): Dito.
(c_parser_switch_statement): Dito.
(c_parser_while_statement): Dito.
(c_parser_do_statement): Dito.
(c_parser_for_statement): Dito.
* c-typeck.c (c_finish_loop): Dito.
---
 gcc/c-family/c-common.h |  2 ++
 gcc/c-family/cilk.c | 39 
 gcc/c/c-parser.c| 67 -
 gcc/c/c-typeck.c|  8 ++
 4 files changed, 82 insertions(+), 34 deletions(-)

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 1e3477f..bd47860 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1395,4 +1395,6 @@ extern tree cilk_install_body_pedigree_operations (tree);
 extern void cilk_outline (tree, tree *, void *);
 extern bool contains_cilk_spawn_stmt (tree);
 extern tree cilk_for_number_of_iterations (tree);
+extern bool check_no_cilk (tree, const char *, const char *,
+  location_t loc = UNKNOWN_LOCATION);
 #endif /* ! GCC_C_COMMON_H */
diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c
index 5b6684a..d7f1bb7 100644
--- a/gcc/c-family/cilk.c
+++ b/gcc/c-family/cilk.c
@@ -1312,3 +1312,42 @@ contains_cilk_spawn_stmt (tree expr)
   return walk_tree (expr, contains_cilk_spawn_stmt_walker, NULL, NULL)
 != NULL_TREE;
 }
+
+/* Return a error location for EXPR if LOC is not set.  */
+
+static location_t
+get_error_location (tree expr, location_t loc)
+{
+  if (loc == UNKNOWN_LOCATION)
+{
+  if (TREE_CODE (expr) == MODIFY_EXPR)
+expr = TREE_OPERAND (expr, 0);
+  loc = EXPR_LOCATION (expr);
+}
+  return loc;
+}
+
+/* Check that no array notation or spawn statement is in EXPR.
+   If not true generate an error at LOC for ARRAY_GMSGID or
+   SPAWN_MSGID.  */
+
+bool
+check_no_cilk (tree expr, const char *array_msgid, const char *spawn_msgid,
+ location_t loc)
+{
+  if (!flag_cilkplus)
+return false;
+  if (contains_array_notation_expr (expr))
+{
+  loc = get_error_location (expr, loc);
+  error_at (loc, array_msgid);
+  return true;
+}
+  if (walk_tree (expr, contains_cilk_spawn_stmt_walker, NULL, NULL))
+{
+  loc = get_error_location (expr, loc);
+  error_at (loc, spawn_msgid);
+  return true;
+}
+  return false;
+}
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 0d159fd..6c45d6a 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -4926,6 +4926,11 @@ c_parser_statement_after_labels (c_parser *parser)
 
  c_parser_consume_token (parser);
  val = c_parser_expression (parser);
+ if (check_no_cilk (val.value,
+Cilk array notation cannot be used as a 
computed goto expression,
+%_Cilk_spawn% statement cannot be used as a 
computed goto expression,
+loc))
+   val.value = error_mark_node;
  val = convert_lvalue_to_rvalue (loc, val, false, true);
  stmt = c_finish_goto_ptr (loc, val.value);
}
@@ -4979,8 +4984,15 @@ c_parser_statement_after_labels (c_parser *parser)
{
  struct c_expr expr = c_parser_expression (parser);
  expr = convert_lvalue_to_rvalue (loc, expr, false, false);
- expr.value = c_fully_fold (expr.value, false, NULL);
- stmt = objc_build_throw_stmt (loc, expr.value);
+ if (check_no_cilk (expr.value,
+Cilk array notation cannot be used for a throw expression,
+%_Cilk_spawn% statement cannot be used for a throw 
expression))
+   expr.value = error_mark_node;
+ else
+   {
+ expr.value = c_fully_fold (expr.value, false, NULL);
+ stmt = objc_build_throw_stmt (loc, expr.value);
+   }
  goto expect_semicolon;
}
  break;
@@ -5163,6 +5175,11 @@ 

Re: [debug-early] do not add location info/etc to abstract instances

2014-10-03 Thread Aldy Hernandez
I know It just makes me feel better to know we're in agreement. Old habits 
die hard I guess ;-).

On Oct 3, 2014 7:08 AM, Jason Merrill ja...@redhat.com wrote:

 On 10/02/2014 03:24 PM, Aldy Hernandez wrote: 
  If you aOn 10/02/2014 03:24 PM, Aldy Hernandez wrote:
 If you are ok with this incremental patch, I will push it to the branch.

Looks good.  In general I don't think you need to wait for approval 
before checking something in on your own branch.  :)

Jason



Re: [debug-early] C++: emit early debug info for all globals, not just statics

2014-10-03 Thread Jason Merrill

On 10/02/2014 02:21 PM, Aldy Hernandez wrote:

Actually, I think we/I need to rethink this whole globals thing.
Currently we're early dumping global *_DECLs, and hoping dwarf2out
recursion will also pick up types and any derivatives from the *_DECLs,
but taking a closer look I've noticed a lot of things are not being
dumped early.

For instance:


 foo()
 {
   typedef int ITYPE;
   ITYPE var = 5;
 }

For the above code, var's DIE gets outputted _after_ the compilation
proper has been run here:

   if (! declaration  outer_scope  TREE_CODE (outer_scope) !=
ERROR_MARK
(!DECL_STRUCT_FUNCTION (decl)
   || DECL_STRUCT_FUNCTION (decl)-gimple_df))
 ...
 ...
 decls_for_scope (outer_scope, subr_die, 0);

I think we should be outputting DIEs for locals at the end of parsing,
so my patch going through level-names IMO is wrong.  We should be
dumping all *_DECLs created by the FE, not just globally scoped ones.


The way to dump locals is by recursion.  If the current process isn't 
hitting these, that's a bug, but I don't think it means we need to 
fundamentally change the approach.  Why aren't we hitting that 
decls_for_scope when we early dump foo?



Another example currently not being dumped early is...

 function()
 {
   class Local {
   public:
 void loc_foo (void) { }
   };

   Local l;
   l.loc_foo ();
 }

...since loc_foo() is not in level-names.


Again, dumping function() should imply dumping Local and its members.

Jason



[PATCH v2] SPARC: add mcpu=leon3v7 target

2014-10-03 Thread Daniel Hellstrom
The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7.

 * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
 * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
 * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
   handle leon3v7 as leon3
 * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
 * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
 * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
 * config/sparc/sparc.md (cpu): add leon3v7
 * config/sparc/sparc.opt (enum processor_type): Add leon3v7
---
 gcc/config.gcc|5 +++-
 gcc/config/sparc/leon.md  |   14 ++--
 gcc/config/sparc/sparc-opts.h |1 +
 gcc/config/sparc/sparc.c  |3 ++
 gcc/config/sparc/sparc.h  |   44 +++--
 gcc/config/sparc/sparc.md |1 +
 gcc/config/sparc/sparc.opt|3 ++
 gcc/doc/invoke.texi   |   16 +++---
 8 files changed, 56 insertions(+), 31 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 605efc0..199e387 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3065,6 +3065,9 @@ if test x$with_cpu = x ; then
*-leon[3-9]*)
  with_cpu=leon3
  ;;
+   *-leon[3-9]v7*)
+ with_cpu=leon3v7
+ ;;
*)
  with_cpu=`echo ${target} | sed 's/-.*$//'`
  ;;
@@ -3749,7 +3752,7 @@ case ${target} in
case ${val} in
 | sparc | sparcv9 | sparc64 \
| v7 | cypress \
-   | v8 | supersparc | hypersparc | leon | leon3 \
+   | v8 | supersparc | hypersparc | leon | leon3 | leon3v7 
\
| sparclite | f930 | f934 | sparclite86x \
| sparclet | tsc701 \
| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
diff --git a/gcc/config/sparc/leon.md b/gcc/config/sparc/leon.md
index b511397..e8050fa 100644
--- a/gcc/config/sparc/leon.md
+++ b/gcc/config/sparc/leon.md
@@ -29,11 +29,11 @@
 
 ;; Use a double reservation to work around the load pipeline hazard on UT699.
 (define_insn_reservation leon3_load 1
-  (and (eq_attr cpu leon3) (eq_attr type load,sload))
+  (and (eq_attr cpu leon3,leon3v7) (eq_attr type load,sload))
   leon_memory*2)
 
 (define_insn_reservation leon_store 2
-  (and (eq_attr cpu leon,leon3) (eq_attr type store))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type store))
   leon_memory*2)
 
 ;; This describes Gaisler Research's FPU
@@ -44,21 +44,21 @@
 (define_cpu_unit grfpu_ds grfpu)
 
 (define_insn_reservation leon_fp_alu 4
-  (and (eq_attr cpu leon,leon3) (eq_attr type fp,fpcmp,fpmul))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fp,fpcmp,fpmul))
   grfpu_alu, nothing*3)
 
 (define_insn_reservation leon_fp_divs 16
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivs))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivs))
   grfpu_ds*14, nothing*2)
 
 (define_insn_reservation leon_fp_divd 17
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivd))
   grfpu_ds*15, nothing*2)
 
 (define_insn_reservation leon_fp_sqrts 24
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrts))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrts))
   grfpu_ds*22, nothing*2)
 
 (define_insn_reservation leon_fp_sqrtd 25
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrtd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrtd))
   grfpu_ds*23, nothing*2)
diff --git a/gcc/config/sparc/sparc-opts.h b/gcc/config/sparc/sparc-opts.h
index b5e9761..c35bee4 100644
--- a/gcc/config/sparc/sparc-opts.h
+++ b/gcc/config/sparc/sparc-opts.h
@@ -31,6 +31,7 @@ enum processor_type {
   PROCESSOR_HYPERSPARC,
   PROCESSOR_LEON,
   PROCESSOR_LEON3,
+  PROCESSOR_LEON3V7,
   PROCESSOR_SPARCLITE,
   PROCESSOR_F930,
   PROCESSOR_F934,
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e9b2bcf..7f3c43e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1125,6 +1125,7 @@ sparc_option_override (void)
 { TARGET_CPU_hypersparc, PROCESSOR_HYPERSPARC },
 { TARGET_CPU_leon, PROCESSOR_LEON },
 { TARGET_CPU_leon3, PROCESSOR_LEON3 },
+{ TARGET_CPU_leon3v7, PROCESSOR_LEON3V7 },
 { TARGET_CPU_sparclite, PROCESSOR_F930 },
 { TARGET_CPU_sparclite86x, PROCESSOR_SPARCLITE86X },
 { TARGET_CPU_sparclet, PROCESSOR_TSC701 },
@@ -1153,6 +1154,7 @@ sparc_option_override (void)

Re: [PATCH 1/2] PR debug/63239 Add DWARF representation for C++11 deleted member function.

2014-10-03 Thread Jason Merrill

OK.

Jason


Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-10-03 Thread Daniel Hellstrom

Hi,


On 10/02/2014 11:22 PM, Eric Botcazou wrote:

[Sorry for the long delay]


The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7 target. This
is also a problem for binaries aiming to be compatible with all LEON3/4
processors.

  * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
  * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
  * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
handle leon3v7 as leon3
  * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
  * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
  * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
  * config/sparc/sparc.md (cpu): add leon3v7
  * config/sparc/sparc.opt (enum processor_type): Add leon3v7

OK for all branches (it should apply everywhere I think).


I have sent an updated patch just now. In case -Aleon does not exist it should 
select -Av7 instead of -Av8.


I don't remember if I already asked... does Aeroflex/Gaisler have a copyright
assignment on file for GCC?  If so, do you also want to have SVN write access?

Yes, we have. Just verified that with the FSF. It would be a nice for us to 
have write access to the sparc parts.

Thanks!
Daniel



Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Jason Merrill

On 10/03/2014 09:12 AM, Mark Wielaard wrote:

A debugger not knowing whether a special member function was explicitly
defaulted, implicitly declared or explicitly defined seems less confusion
than not knowing whether it was deleted. But there are some subtle cases
where knowing whether a constructor was user defined or explicitly
defaulted do matter for whether the default constructor might have been
implicitly generated.


Can you elaborate?


So like the deleted case this patch introduces
a new attribute DW_AT_GNU_defaulted that gets attached to the function
declaration. Note that since this is for declarations we explicitly
test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
definitions that use = default; outside the class body.


Hmm, I'm dubious about this choice.  How do you expect a consumer to use 
this information?


Jason



[PATCH] 512-bit gcc.dg/torture/vshuf*.c

2014-10-03 Thread Jakub Jelinek
Hi!

This patch extends the gcc.dg/torture/ testsuite for
512-bit vectors.  Tested with
GCC_TEST_RUN_EXPENSIVE=1 make -j32 check-gcc \
RUNTESTFLAGS='--target_board=unix\{-mavx2,-mavx,-mavx512f,-mavx512bw/-mavx512vl\}
 dg-torture.exp=vshuf*.c'
(of course with expected AVX512* execution test failures,
as I don't have hw and didn't bother with simulator).

As before in vshuf-{8,16,32}.inc, some of the permutations
are hand written (subset in the TESTS portion), the rest
are random permutations.

Ok for trunk?

2014-10-03  Jakub Jelinek  ja...@redhat.com

* gcc.dg/torture/vshuf-v8df.c: New test.
* gcc.dg/torture/vshuf-v8di.c: New test.
* gcc.dg/torture/vshuf-v16sf.c: New test.
* gcc.dg/torture/vshuf-v16si.c: New test.
* gcc.dg/torture/vshuf-v32hi.c: New test.
* gcc.dg/torture/vshuf-v64qi.c: New test.
* gcc.dg/torture/vshuf-64.inc: New file.

--- gcc/testsuite/gcc.dg/torture/vshuf-v8df.c.jj2014-10-03 
13:18:43.426977162 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v8df.c   2014-10-03 13:19:47.434750993 
+0200
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options -DEXPENSIVE { target run_expensive_tests } } */
+/* { dg-options -fno-common { target hppa*-*-hpux* } } */
+/* { dg-skip-if  { ! run_expensive_tests } { * } { -O2 } } */
+/* { dg-skip-if  { ! run_expensive_tests } { -flto } {  } } */
+
+#if __SIZEOF_DOUBLE__ == 8  __SIZEOF_LONG_LONG__ == 8
+typedef double V __attribute__((vector_size(64)));
+typedef unsigned long long VI __attribute__((vector_size(64)));
+#else
+#define UNSUPPORTED
+#endif
+
+#include vshuf-8.inc
+#include vshuf-main.inc
--- gcc/testsuite/gcc.dg/torture/vshuf-v8di.c.jj2014-10-03 
13:18:46.672915313 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v8di.c   2014-10-03 13:18:57.098712816 
+0200
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options -DEXPENSIVE { target run_expensive_tests } } */
+/* { dg-options -fno-common { target hppa*-*-hpux* } } */
+/* { dg-skip-if  { ! run_expensive_tests } { * } { -O2 } } */
+/* { dg-skip-if  { ! run_expensive_tests } { -flto } {  } } */
+
+#if __SIZEOF_LONG_LONG__ == 8
+typedef unsigned long long V __attribute__((vector_size(64)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#include vshuf-8.inc
+#include vshuf-main.inc
--- gcc/testsuite/gcc.dg/torture/vshuf-v16sf.c.jj   2014-10-03 
13:17:33.941306619 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v16sf.c  2014-10-03 13:18:12.593567509 
+0200
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options -DEXPENSIVE { target run_expensive_tests } } */
+/* { dg-options -fno-common { target hppa*-*-hpux* } } */
+/* { dg-skip-if  { ! run_expensive_tests } { * } { -O2 } } */
+/* { dg-skip-if  { ! run_expensive_tests } { -flto } {  } } */
+
+#if __SIZEOF_FLOAT__ == 4
+typedef float V __attribute__((vector_size(64)));
+# if __SIZEOF_INT__ == 4
+typedef unsigned int VI __attribute__((vector_size(64)));
+# elif __SIZEOF_LONG__ == 4
+typedef unsigned long VI __attribute__((vector_size(64)));
+# else
+#  define UNSUPPORTED
+# endif
+#else
+# define UNSUPPORTED
+#endif
+
+#include vshuf-16.inc
+#include vshuf-main.inc
--- gcc/testsuite/gcc.dg/torture/vshuf-v16si.c.jj   2014-10-03 
13:17:02.140916184 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v16si.c  2014-10-03 13:17:21.690538486 
+0200
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options -DEXPENSIVE { target run_expensive_tests } } */
+/* { dg-options -fno-common { target hppa*-*-hpux* } } */
+/* { dg-skip-if  { ! run_expensive_tests } { * } { -O2 } } */
+/* { dg-skip-if  { ! run_expensive_tests } { -flto } {  } } */
+
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(64)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(64)));
+typedef V VI;
+#else
+# define UNSUPPORTED
+#endif
+
+#include vshuf-16.inc
+#include vshuf-main.inc
--- gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c.jj   2014-10-03 
13:16:01.866074615 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c  2014-10-03 13:16:22.112685369 
+0200
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-options -DEXPENSIVE { target run_expensive_tests } } */
+/* { dg-options -fno-common { target hppa*-*-hpux* } } */
+/* { dg-skip-if  { ! run_expensive_tests } { * } { -O2 } } */
+/* { dg-skip-if  { ! run_expensive_tests } { -flto } {  } } */
+
+typedef unsigned short V __attribute__((vector_size(64)));
+typedef V VI;
+
+#include vshuf-32.inc
+#include vshuf-main.inc
--- gcc/testsuite/gcc.dg/torture/vshuf-v64qi.c.jj   2014-10-03 
14:11:11.961659185 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v64qi.c  2014-10-03 14:11:21.0 
+0200
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-options -DEXPENSIVE { target run_expensive_tests } } */
+/* { dg-options -fno-common { target hppa*-*-hpux* } } */
+/* { dg-skip-if  { ! run_expensive_tests } { * } { -O2 } } */
+/* { dg-skip-if  { ! run_expensive_tests } { -flto } {  } } */
+
+typedef unsigned char V 

Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Marc Glisse

On Fri, 3 Oct 2014, Jonathan Wakely wrote:


This is the patch I intend to commit to make std::list::size() O(1) as
required by C++11.

This is an ABI change, so std::list will get tagged with
abi_tag(cxx11) so that it mangles differently.


Assuming a future where we have both _GLIBCXX_ABI_TAG_CXX11 and 
_GLIBCXX_ABI_TAG_CXX17, I don't really see how _GLIBCXX_DEFAULT_ABI_TAG
is supposed to work. We don't want to define _GLIBCXX_DEFAULT_ABI_TAG to 
_GLIBCXX_ABI_TAG_CXX17 and suddenly have std::list change mangling. Should 
it be called _GLIBCXX_DEFAULT_ABI_TAG_CXX11, meaning 
_GLIBCXX_ABI_TAG_CXX11_IF_ENABLED_AND_NOTHING_OTHERWISE?


Defining a dummy _M_distance in the old abi case is a bit strange (we 
could protect the single use with #if _GLIBCXX_USE_CXX11_ABI), but why 
not...


Do you mind if I move (in a future patch once yours is committed) _M_size 
into _M_impl::_M_node as suggested in PR 61347?


--
Marc Glisse


Re: [patch] libstdc++/63449 remove outdated documentation

2014-10-03 Thread Jonathan Wakely

On 03/10/14 14:36 +0100, Jonathan Wakely wrote:

I think after 12 years it's safe to say that alternative version ain't
gonna happen.

Committed to trunk.


Here's the patch for the 4.8 and 4.9 branches, which also updates the
notes on std::list::size() being O(N) (in the words of Whitney
Houston, it's not right but it's okay).

commit d7a5af3dfd44681e8073209a87d8376496dd647f
Author: Jonathan Wakely jwak...@redhat.com
Date:   Fri Oct 3 15:21:09 2014 +0100

	PR libstdc++/63449
	* doc/xml/manual/containers.xml: Remove outdated section. Update
	std::list notes.
	* doc/html/*: Regenerate.

diff --git a/libstdc++-v3/doc/xml/manual/containers.xml b/libstdc++-v3/doc/xml/manual/containers.xml
index 9fea0f7..ba8b087 100644
--- a/libstdc++-v3/doc/xml/manual/containers.xml
+++ b/libstdc++-v3/doc/xml/manual/containers.xml
@@ -25,8 +25,9 @@
   section xml:id=sequences.list.size xreflabel=list::size() is O(n)infotitlelist::size() is O(n)/title/info
 
para
- Yes it is, and that's okay.  This is a decision that we preserved
- when we imported SGI's STL implementation.  The following is
+ Yes it is, and that was okay until the 2011 edition of the C++ standard.
+ In future GCC will change it to O(1) but O(N) was a decision that we
+ preserved when we imported SGI's STL implementation.  The following is
  quoted from link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://www.sgi.com/tech/stl/FAQ.html;their FAQ/link:
/para
blockquote
@@ -72,26 +73,6 @@
   /section
 /section
 
-section xml:id=containers.sequences.vector xreflabel=vectorinfotitlevector/title/info
-?dbhtml filename=vector.html?
-  
-  para
-  /para
-  section xml:id=sequences.vector.management xreflabel=Space Overhead ManagementinfotitleSpace Overhead Management/title/info
-
-   para
- In link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://gcc.gnu.org/ml/libstdc++/2002-04/msg00105.html;this
- message to the list/link, Daniel Kostecky announced work on an
- alternate form of codestd::vector/code that would support
- hints on the number of elements to be over-allocated.  The design
- was also described, along with possible implementation choices.
-   /para
-   para
- The first two alpha releases were announced link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://gcc.gnu.org/ml/libstdc++/2002-07/msg00048.html;here/link
- and link xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=http://gcc.gnu.org/ml/libstdc++/2002-07/msg00111.html;here/link.
-   /para
-
-  /section/section
 /section
 
 !-- Sect1 02 : Associative --


Re: [gomp4] Offload option handling

2014-10-03 Thread Andrey Turetskiy
On Wed, Sep 17, 2014 at 5:11 PM, Andrey Turetskiy
andrey.turets...@gmail.com wrote:
 On Wed, Sep 17, 2014 at 3:19 PM, Bernd Schmidt ber...@codesourcery.com 
 wrote:
 I have no objections to supporting a -ftarget-options switch. I had posted a
 patch a while ago that looked somewhat similar, but also contained an
 automatic translation step from things like -march=x86_64 to a generic
 -foffload-abi=lp64. I still think such a mechanism is desirable.

 I'm going to apply your patch on '-ftarget-options' stuff and check if
 it works together.

I've applied your option patch on our offload branch (w/o
'-ftarget-options' switch yet) and it seems to be working fine.
However the patch looks a bit unfinished:

@@ -440,7 +554,11 @@ access_check (const char *name, int mode

 static char*
 prepare_target_image (const char *target, const char *compiler_path,
-  unsigned in_argc, char *in_argv[])
+  unsigned in_argc, char *in_argv[],
+  struct cl_decoded_option *compiler_opts,
+  unsigned int compiler_opt_count,
+  struct cl_decoded_option * /*linker_opts */,
+  unsigned int /*linker_opt_count*/)
 {
   const char **argv;
   struct obstack argv_obstack;
@@ -469,8 +587,6 @@ prepare_target_image (const char *target
   /* Generate temp file name.  */
   filename = make_temp_file (.target.o);

-  /* --  */
-  /* Run gcc for target.  */
   obstack_init (argv_obstack);
   obstack_ptr_grow (argv_obstack, compiler);
   obstack_ptr_grow (argv_obstack, -o);
@@ -479,6 +595,8 @@ prepare_target_image (const char *target
   for (i = 1; i  in_argc; ++i)
 if (strncmp (in_argv[i], -fresolution=, sizeof (-fresolution=) - 1))
   obstack_ptr_grow (argv_obstack, in_argv[i]);
+
+  append_compiler_options (argv_obstack, compiler_opts, compiler_opt_count);
   obstack_ptr_grow (argv_obstack, NULL);

   argv = XOBFINISH (argv_obstack, const char **);

   argv = XOBFINISH (argv_obstack, char **);

What do you suppose to do with 'linker_opts'?
Do you want to call 'append_linker_options (argv_obstack,
linker_opts, linker_opt_count, false)'? That would explain why you
have 'include_target_options' argument in the function.

-- 
Best regards,
Andrey Turetskiy


[PATCH] Small pre-AVX512F optimization

2014-10-03 Thread Jakub Jelinek
Hi!

I've noticed that expand_vec_perm_1 completely uselessly builds GC garbage
(CONST_VECTOR at least) when AVX512F isn't enabled at all.

Ok to just call it for AVX512F?

Even better would be to check the modes first too depending on target
(AVX512F will only handle V{8D,16S}{I,F}mode, AVX512BW would handle
also V32HImode (not yet implemented?), AVX512VL could handle
V{2D,4D,4S,8S}{I,F}mode (not yet implemented?, though is there any
const permutation not handled yet earlier?), and AVX512VL+AVX512BW
could handle V{8,16}HImode (not yet implemented?) before creating a
CONST_VECTOR.

2014-10-03  Jakub Jelinek  ja...@redhat.com

* config/i386/i386.c (ix86_expand_vec_perm_vpermi2): Fix up formatting.
(ix86_expand_vec_perm): Only call ix86_expand_vec_perm_vpermi2 if
TARGET_AVX512F.
(expand_vec_perm_1): Likewise.

--- gcc/config/i386/i386.c.jj   2014-10-03 12:39:24.0 +0200
+++ gcc/config/i386/i386.c  2014-10-03 15:21:11.697445333 +0200
@@ -21373,21 +21373,23 @@ ix86_expand_vec_perm_vpermi2 (rtx target
 {
 case V16SImode:
   emit_insn (gen_avx512f_vpermi2varv16si3 (target, op0,
- force_reg (V16SImode, mask),
- op1));
+  force_reg (V16SImode, mask),
+  op1));
   return true;
 case V16SFmode:
   emit_insn (gen_avx512f_vpermi2varv16sf3 (target, op0,
- force_reg (V16SImode, mask),
- op1));
+  force_reg (V16SImode, mask),
+  op1));
   return true;
 case V8DImode:
   emit_insn (gen_avx512f_vpermi2varv8di3 (target, op0,
-force_reg (V8DImode, mask), op1));
+ force_reg (V8DImode, mask),
+ op1));
   return true;
 case V8DFmode:
   emit_insn (gen_avx512f_vpermi2varv8df3 (target, op0,
-force_reg (V8DImode, mask), op1));
+ force_reg (V8DImode, mask),
+ op1));
   return true;
 default:
   return false;
@@ -21414,7 +21416,8 @@ ix86_expand_vec_perm (rtx operands[])
   e = GET_MODE_UNIT_SIZE (mode);
   gcc_assert (w = 64);
 
-  if (ix86_expand_vec_perm_vpermi2 (target, op0, mask, op1))
+  if (TARGET_AVX512F
+   ix86_expand_vec_perm_vpermi2 (target, op0, mask, op1))
 return;
 
   if (TARGET_AVX2)
@@ -43231,17 +43234,20 @@ expand_vec_perm_1 (struct expand_vec_per
 return true;
 
   /* Try the AVX512F vpermi2 instructions.  */
-  rtx vec[64];
-  enum machine_mode mode = d-vmode;
-  if (mode == V8DFmode)
-mode = V8DImode;
-  else if (mode == V16SFmode)
-mode = V16SImode;
-  for (i = 0; i  nelt; ++i)
-vec[i] = GEN_INT (d-perm[i]);
-  rtx mask = gen_rtx_CONST_VECTOR (mode, gen_rtvec_v (nelt, vec));
-  if (ix86_expand_vec_perm_vpermi2 (d-target, d-op0, mask, d-op1))
-return true;
+  if (TARGET_AVX512F)
+{
+  rtx vec[64];
+  enum machine_mode mode = d-vmode;
+  if (mode == V8DFmode)
+   mode = V8DImode;
+  else if (mode == V16SFmode)
+   mode = V16SImode;
+  for (i = 0; i  nelt; ++i)
+   vec[i] = GEN_INT (d-perm[i]);
+  rtx mask = gen_rtx_CONST_VECTOR (mode, gen_rtvec_v (nelt, vec));
+  if (ix86_expand_vec_perm_vpermi2 (d-target, d-op0, mask, d-op1))
+   return true;
+}
 
   return false;
 }

Jakub


Re: [gomp4] OpenACC wait directive

2014-10-03 Thread Cesar Philippidis
On 09/24/2014 12:18 AM, Ilmir Usmanov wrote:
 Hi Cesar!
 
 Thank you for the patch!
 
 On 24.09.2014 02:29, Cesar Philippidis wrote:
 This patch adds support for the async clause in the wait directive in
 fortran. It should be pretty straight forward. The fortran FE already
 supports the wait directive, but the async clause was introduced to the
 wait directive in OpenACC 2.0 and that was missing in gomp-4_0-branch.
 Yes, I've mostly focused on spec. ver. 1.0.
 
 Is this OK for gomp-4_0-branch?
 No, it isn't. According to the spec and this presentation:
 http://www.pgroup.com/lit/presentations/cea-3.pdf (See slide 1-35)
 it is possible to write construction like:
 !$acc wait(1) async(2)
 However, your patch doesn't support this. Also, don't forget to check
 whether a queue waits itself (for example, wait(1) async(1)).
 In addition, it breaks current support of the directive (for example,
 wait(1)).

Sorry for the delay. I encountered some problems with the runtime in our
internal branch, and that slowed things down a bit.

Anyway, you are correct, I broke the optional argument to wait in the
previous patch. This new patch addresses that and it also make the wait
construct conform with OpenACC 2.0. Specifically,

  !$acc wait (1, 2) async (3)

should behave as ex[ected.

If you look at gfc_trans_oacc_wait_directive, you'll note that a call to
GOACC_wait is emitted for the wait directive. Since I had to add a
runtime library stub for that builtin function, I decided to go ahead an
include the c front end bits.

Is this patch OK for gomp-4_0-branch? Julian is working on working on a
more complete implementation of the runtime. The runtime stub that I
included is only temporary.

Cesar

2014-10-02  Cesar Philippidis  ce...@codesourcery.com
	James Norris  jnor...@codesourcery.com
	Thomas Schwinge  tho...@codesourcery.com

	gcc/
	* builtin-types.def (BT_FN_VOID_INT_PTR_INT): Define.
	* oacc-builtins.def (DEF_GOACC_BUILTIN): Define.
	* omp-low.c (scan_sharing_clauses): Update handling of
	OMP_CLAUSE_ASYNC and OMP_CLAUSE_WAIT.
	(expand_oacc_offload): Likewise.
	(expand_omp_target): Likewise.

	gcc/c-family/
	* c-common.h (c_finish_oacc_wait): Declare.
	* c-omp.c (c_finish_oacc_wait): New function.
	* c-pragma.c (oacc_pragmas): Add an entry for wait.
	* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_WAIT.
	(enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ASYNC and
	PRAGMA_OMP_CLAUSE_WAIT.

	gcc/c/
	* c-parser.c (c_parser_omp_clause_name): Handle async and wait.
	(c_parser_oacc_integer_list): New function.
	(c_parser_oacc_int_list_parens): New function.
	(c_parser_oacc_clause_async): New function.
	(c_parser_oacc_clause_wait): New function.
	(c_parser_oacc_all_clauses): Handle PRAGMA_OMP_CLAUSE_ASYNC and
	PRAGMA_OMP_CLAUSE_WAIT.
	(OACC_KERNELS_CLAUSE_MASK): Add async and wait clauses.
	(OACC_PARALLEL_CLAUSE_MASK): Likewise.
	(OACC_UPDATE_CLAUSE_MASK): Likewise.
	(OACC_WAIT_CLAUSE_MASK): New define.
	(c_parser_oacc_wait): New function.
	(c_parser_omp_construct): Handle PRAGMA_OACC_WAIT.
	* c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_ASYNC and
	OMP_CLAUSE_WAIT.

	gcc/fortran/
	* gfortran.h (struct gfc_omp_clauses): Remove non_clause_wait_expr.
	* dump-parse-tree.c (show_omp_clauses): Likewise.
	* openmp.c (gfc_free_omp_clauses): Likewise.
	(gfc_match_omp_clauses): Update handling of async.
	(OACC_WAIT_CLAUSE_MASK): New define.
	(gfc_match_oacc_wait): Make the wait directive comply with OpenACC 2.0.
	(resolve_omp_clauses): Use resolve_oacc_scalar_in_expr inspect
	arguments to the wait clause.
	(resolve_oacc_wait): Remove.
	(gfc_resolve_oacc_directive): Handle EXEC_OACC_WAIT with
	resolve_omp_clauses.
	* trans-openmp.c (gfc_trans_omp_clauses): Update handling of OpenACC
	wait arguments.
	(gfc_trans_oacc_wait_directive): New function.
	(gfc_trans_oacc_directive): Use it.
	* types.def (BT_FN_VOID_INT_PTR_INT): Define.

	gcc/testsuite/
	* c-c++-common/goacc/asyncwait-1.c: New test.
	* gfortran.dg/goacc/asyncwait-1.f95: New test.
	* gfortran.dg/goacc/asyncwait-2.f95: New test.
	* gfortran.dg/goacc/asyncwait-3.f95: New test.
	* gfortran.dg/goacc/asyncwait-4.f95: New test.

	libgomp/
	* libgomp.map (GOACC_2.0): Add GOACC_wait.
	* libgomp_g.h (GOACC_wait): Declare.
	* oacc-parallel.c (GOACC_wait): Define.


diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index 7c294af..094b3a8 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -358,6 +358,8 @@ DEF_FUNCTION_TYPE_3 (BT_FN_VOID_PTR_INT_SIZE,
 		 BT_VOID, BT_PTR, BT_INT, BT_SIZE)
 DEF_FUNCTION_TYPE_3 (BT_FN_VOID_PTR_INT_INT,
 		 BT_VOID, BT_PTR, BT_INT, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_INT_PTR_INT,
+		 BT_VOID, BT_INT, BT_PTR, BT_INT)
 DEF_FUNCTION_TYPE_3 (BT_FN_VOID_CONST_PTR_PTR_SIZE,
 		 BT_VOID, BT_CONST_PTR, BT_PTR, BT_SIZE)
 DEF_FUNCTION_TYPE_3 (BT_FN_INT_STRING_CONST_STRING_VALIST_ARG,
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 5ec79a0..a03b3ab 100644
--- a/gcc/c-family/c-common.h

Re: [PATCH] Small pre-AVX512F optimization

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 4:32 PM, Jakub Jelinek ja...@redhat.com wrote:
 Hi!

 I've noticed that expand_vec_perm_1 completely uselessly builds GC garbage
 (CONST_VECTOR at least) when AVX512F isn't enabled at all.

 Ok to just call it for AVX512F?

OK.

 Even better would be to check the modes first too depending on target
 (AVX512F will only handle V{8D,16S}{I,F}mode, AVX512BW would handle
 also V32HImode (not yet implemented?), AVX512VL could handle
 V{2D,4D,4S,8S}{I,F}mode (not yet implemented?, though is there any
 const permutation not handled yet earlier?), and AVX512VL+AVX512BW
 could handle V{8,16}HImode (not yet implemented?) before creating a
 CONST_VECTOR.

AVX512BW and AVX512VL are currently moving targets, I propose to look
at this issue once all changes are committed to the repository.

 2014-10-03  Jakub Jelinek  ja...@redhat.com

 * config/i386/i386.c (ix86_expand_vec_perm_vpermi2): Fix up 
 formatting.
 (ix86_expand_vec_perm): Only call ix86_expand_vec_perm_vpermi2 if
 TARGET_AVX512F.
 (expand_vec_perm_1): Likewise.

OK.

Thanks,
Uros.


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Mark Wielaard
On Fri, 2014-10-03 at 10:17 -0400, Jason Merrill wrote:
 On 10/03/2014 09:12 AM, Mark Wielaard wrote:
  A debugger not knowing whether a special member function was explicitly
  defaulted, implicitly declared or explicitly defined seems less confusion
  than not knowing whether it was deleted. But there are some subtle cases
  where knowing whether a constructor was user defined or explicitly
  defaulted do matter for whether the default constructor might have been
  implicitly generated.
 
 Can you elaborate?

Say you have a user defined copy constructor. The DWARF consumer will
see the declaration and can assume the class won't have a default
constructor (unless that one is explicitly declared too). But currently
the DWARF consumer cannot know whether that move constructor was really
a user defined. If it was declared with = default; then it will see the
move constructor and erroneously conclude that it was user defined and
so the class won't have a default constructor generated for it. Having
the defaulted attribute on the declaration makes clear that the special
function member wasn't in fact user defined. This is because gcc doesn't
output implicit special member function declarations.

  So like the deleted case this patch introduces
  a new attribute DW_AT_GNU_defaulted that gets attached to the function
  declaration. Note that since this is for declarations we explicitly
  test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
  definitions that use = default; outside the class body.
 
 Hmm, I'm dubious about this choice.  How do you expect a consumer to use 
 this information?

In two ways. First simply to let the debugger more accurately show the
declaration of the class. Just like one uses = default; in their source
code to be explicit about the fact that the special member function was
really desired. It would be nice if the debugger could provide the same
source information.

Secondly, as described above. There is a difference between = default;
on the declaration and on the implementation definition. If the out of
class definition of a special member function has an = default; then the
in class declaration cannot have it. That means that a = default; on the
out of class definition actually means that the function is user defined
(it just happens to be defined by the default implementation). While a =
default; on the in class declaration means it explicitly isn't user
defined. The consumer can use this information to deduce which implicit
member functions are available.

Cheers,

Mark


[RFC PATCH] Enable V32HI/V64QI const permutations

2014-10-03 Thread Jakub Jelinek
Hi!

Just to stress the new testcases some more, I've enabled the
vec_perm_const{32hi,64qi} patterns.
Got several ICEs in expand_vec_perm_broadcast_1,
on the final gcc_unreachable () in the function.  That function
is only called if it couldn't be broadcasted in a single insn,
which I believe for TARGET_AVX512BW must be always possible.
Shall I look at this, or do you plan to address this in the near future?

2014-10-03  Jakub Jelinek  ja...@redhat.com

* config/i386/sse.md (VEC_PERM_CONST): Add V32HI and V64QI
for TARGET_AVX512BW.

--- gcc/config/i386/sse.md.jj   2014-09-26 10:33:18.0 +0200
+++ gcc/config/i386/sse.md  2014-10-03 15:03:44.170446452 +0200
@@ -10386,7 +10386,8 @@ (define_mode_iterator VEC_PERM_CONST
(V8SI TARGET_AVX) (V4DI TARGET_AVX)
(V32QI TARGET_AVX2) (V16HI TARGET_AVX2)
(V16SI TARGET_AVX512F) (V8DI TARGET_AVX512F)
-   (V16SF TARGET_AVX512F) (V8DF TARGET_AVX512F)])
+   (V16SF TARGET_AVX512F) (V8DF TARGET_AVX512F)
+   (V32HI TARGET_AVX512BW) (V64QI TARGET_AVX512BW)])
 
 (define_expand vec_perm_constmode
   [(match_operand:VEC_PERM_CONST 0 register_operand)

Jakub


Re: [PATCH]Add aarch64 to list of targets that support gold

2014-10-03 Thread Diego Novillo
On Thu, Sep 18, 2014 at 7:05 PM, Jing Yu jin...@google.com wrote:

 2014-09-18  Jing Yu  jin...@google.com
   * configure.ac: Add aarch64 to list of targets that support gold.
   * configure: Regenerate.

OK.

Thanks. Diego.


Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Jonathan Wakely

On 03/10/14 16:25 +0200, Marc Glisse wrote:

On Fri, 3 Oct 2014, Jonathan Wakely wrote:


This is the patch I intend to commit to make std::list::size() O(1) as
required by C++11.

This is an ABI change, so std::list will get tagged with
abi_tag(cxx11) so that it mangles differently.


Assuming a future where we have both _GLIBCXX_ABI_TAG_CXX11 and 
_GLIBCXX_ABI_TAG_CXX17, I don't really see how 
_GLIBCXX_DEFAULT_ABI_TAG
is supposed to work. We don't want to define _GLIBCXX_DEFAULT_ABI_TAG 
to _GLIBCXX_ABI_TAG_CXX17 and suddenly have std::list change mangling. 


True.

Should it be called _GLIBCXX_DEFAULT_ABI_TAG_CXX11, meaning 
_GLIBCXX_ABI_TAG_CXX11_IF_ENABLED_AND_NOTHING_OTHERWISE?


I suppose so ... or _GLIBCXX_MAYBE_ABI_TAG_CXX11 ?

Defining a dummy _M_distance in the old abi case is a bit strange (we 
could protect the single use with #if _GLIBCXX_USE_CXX11_ABI), but why 
not...


Yeah, I was trying to minimise the preprocessor conditionals, but
maybe that's one step too far.

Do you mind if I move (in a future patch once yours is committed) 
_M_size into _M_impl::_M_node as suggested in PR 61347?


Gah, that's where I had it until earlier this week, and I looked at it
and wondered why it was in the _List_impl class (because you only need
one member in there to benefit from the empty base-class
optimisation).

I will move it back there, since I already have that code on another
branch, so there's no point making you change the code to match
something I've already got!

Thanks for your useful comments (as always).


Re: [PATCH,i386] Fix adxintrin on mingw.

2014-10-03 Thread H.J. Lu
On Fri, Oct 3, 2014 at 6:46 AM, Ilya Tocar tocarip.in...@gmail.com wrote:
 On 02 Oct 07:41, H.J. Lu wrote:
 On Thu, Oct 2, 2014 at 7:29 AM, Ilya Tocar tocarip.in...@gmail.com wrote:
  Hi,
 
  sizeof (long) == 4 on windows, so we should use long long as param type.
  Patch below does it.

 The same is true for x32.  Can you add a testcase to show it
 fails on x32 without the fix?


 This could only be done with runtime test.
 I've had troubles running sde (emulator) on x32 enabled system,
 but replacing long long with int in intrinsic signature will cause
 adx-addcarryx64-2.c to fail under sde on 64 bits. I believe it will
 also fail on sde+{win,x32} or real hardware, when it's available.


Can we scan the assembly output for the wrong instruction?

-- 
H.J.


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Jason Merrill

On 10/03/2014 10:35 AM, Mark Wielaard wrote:

Say you have a user defined copy constructor. The DWARF consumer will
see the declaration and can assume the class won't have a default
constructor (unless that one is explicitly declared too). But currently
the DWARF consumer cannot know whether that move constructor was really
a user defined. If it was declared with = default; then it will see the
move constructor and erroneously conclude that it was user defined and
so the class won't have a default constructor generated for it.


That's not erroneous, a declaration with =default still suppresses the 
default constructor.  If there is no user-declared constructor for 
class X, a constructor having no parameters is implicitly declared as 
defaulted.


user-declared includes declarations that are defaulted in the class 
body.  user-provided is the category that does not include such 
declarations.


Jason



[PATCH] gcc.c: Split up the driver's main into smaller functions

2014-10-03 Thread David Malcolm
The main function for the driver in gcc.c has grown from ~200 lines
in its original form (way back in r262) to ~1000 lines today, with a
dozen locals (if we include the params).

The following patch splits it up into 15 smaller functions, moving the
various locals into the places where they're needed, so we can easily
see e.g where argc/argv get read vs written.

The functions are private methods of a new driver class to give an
extra level of encapsualation beyond just being static in gcc.c, and so
that we can hide some state as member data inside the driver instance.

Turning them into named functions/methods also makes it easier to talk
about the different phases of main, and put breakpoints on them.

Bootstrappedregrtested on x86_64-unknown-linux-gnu (Fedora 20).

OK for trunk?

gcc/ChangeLog:
* gcc.c (class driver): New class.
(main): Reimplement in terms of driver::main, moving most of the
locals to be locals within individual methods of class driver.
The remaining locals explicit_link_files, decoded_options and
decoded_options_count are used by multiple driver:: methods, and
so become member data.  Doing so isolates the argc/argv reads and
writes.  Replace goto out with a special exit code from
new method driver::prepare_infiles.  Split out the old
implementation of main into the following...
(driver::main): New function, corresponding to the old main
implementation.
(driver::set_progname): New function, taken from the old
main implementation.
(driver::expand_at_files): Likewise.
(driver::decode_argv): Likewise.
(driver::global_initializations): Likewise.
(driver::build_multilib_strings): Likewise.
(driver::set_up_specs): Likewise.
(driver::putenv_COLLECT_GCC): Likewise.
(driver::maybe_putenv_COLLECT_LTO_WRAPPER): Likewise.
(driver::handle_unrecognized_options): Likewise.
(driver::maybe_print_and_exit): Likewise.
(driver::prepare_infiles): Likewise.
(driver::do_spec_on_infiles): Likewise.
(driver::maybe_run_linker): Likewise.
(driver::final_actions): Likewise.
(driver::get_exit_code): Likewise.
---
 gcc/gcc.c | 243 +-
 1 file changed, 208 insertions(+), 35 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 47c4e28..9139263 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6724,49 +6724,139 @@ compare_files (char *cmpfile[])
   return ret;
 }
 
-extern int main (int, char **);
+/* The top-level main within the driver would be ~1000 lines long.
+   This class breaks it up into smaller functions and contains some
+   state shared by them.  */
 
-int
-main (int argc, char **argv)
+class driver
 {
-  size_t i;
-  int value;
-  int linker_was_run = 0;
-  int lang_n_infiles = 0;
-  int num_linker_inputs = 0;
+ public:
+  int main (int argc, char **argv);
+
+ private:
+  void set_progname (const char *argv0) const;
+  void expand_at_files (int *argc, char ***argv) const;
+  void decode_argv (int argc, const char **argv);
+  void global_initializations () const;
+  void build_multilib_strings () const;
+  void set_up_specs () const;
+  void putenv_COLLECT_GCC (const char *argv0) const;
+  void maybe_putenv_COLLECT_LTO_WRAPPER () const;
+  void handle_unrecognized_options () const;
+  int maybe_print_and_exit () const;
+  bool prepare_infiles ();
+  void do_spec_on_infiles () const;
+  void maybe_run_linker (const char *argv0) const;
+  void final_actions () const;
+  int get_exit_code () const;
+
+ private:
   char *explicit_link_files;
-  char *specs_file;
-  char *lto_wrapper_file;
-  const char *p;
-  struct user_specs *uptr;
-  char **old_argv = argv;
   struct cl_decoded_option *decoded_options;
   unsigned int decoded_options_count;
+};
+
+/* Implement the top-level main within the driver in terms of
+   driver::main.  */
+
+extern int main (int, char **);
 
-  p = argv[0] + strlen (argv[0]);
-  while (p != argv[0]  !IS_DIR_SEPARATOR (p[-1]))
+int
+main (int argc, char **argv)
+{
+  driver d;
+
+  if (0)
+{
+  int i;
+  for (i = 0; i  argc; i++)
+   printf (argc[%i]: %s\n, i, argv[i]);
+}
+
+  return d.main (argc, argv);
+}
+
+/* driver::main is implemented as a series of driver:: method calls.  */
+
+int
+driver::main (int argc, char **argv)
+{
+  bool early_exit;
+
+  set_progname (argv[0]);
+  expand_at_files (argc, argv);
+  decode_argv (argc, const_cast const char ** (argv));
+  global_initializations ();
+  build_multilib_strings ();
+  set_up_specs ();
+  putenv_COLLECT_GCC (argv[0]);
+  maybe_putenv_COLLECT_LTO_WRAPPER ();
+  handle_unrecognized_options ();
+
+  if (!maybe_print_and_exit ())
+return 0;
+
+  early_exit = prepare_infiles ();
+  if (early_exit)
+return get_exit_code ();
+
+  do_spec_on_infiles ();
+  maybe_run_linker (argv[0]);
+  final_actions ();
+  return get_exit_code ();
+}
+
+/* 

Go patch committed: Don't confuse fields and promoted methods

2014-10-03 Thread Ian Lance Taylor
This patch from Tim Shen fixes a bug in the Go frontend in which a
promoted method could be used even if there was a field of the same
name.  This fixes http://golang.org/issue/4365 .  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r c9d064a071c9 go/types.cc
--- a/go/types.cc	Fri Oct 03 08:11:52 2014 -0700
+++ b/go/types.cc	Fri Oct 03 08:12:08 2014 -0700
@@ -9387,9 +9387,14 @@
 Type::finalize_methods(Gogo* gogo, const Type* type, Location location,
 		   Methods** all_methods)
 {
-  *all_methods = NULL;
+  *all_methods = new Methods();
   std::vectorconst Named_type* seen;
-  Type::add_methods_for_type(type, NULL, 0, false, false, seen, all_methods);
+  Type::add_methods_for_type(type, NULL, 0, false, false, seen, *all_methods);
+  if ((*all_methods)-empty())
+{
+  delete *all_methods;
+  *all_methods = NULL;
+}
   Type::build_stub_methods(gogo, type, *all_methods, location);
 }
 
@@ -9408,7 +9413,7 @@
 			   bool is_embedded_pointer,
 			   bool needs_stub_method,
 			   std::vectorconst Named_type** seen,
-			   Methods** methods)
+			   Methods* methods)
 {
   // Pointer types may not have methods.
   if (type-points_to() != NULL)
@@ -9457,15 +9462,12 @@
  unsigned int depth,
  bool is_embedded_pointer,
  bool needs_stub_method,
- Methods** methods)
+ Methods* methods)
 {
   const Bindings* local_methods = nt-local_methods();
   if (local_methods == NULL)
 return;
 
-  if (*methods == NULL)
-*methods = new Methods();
-
   for (Bindings::const_declarations_iterator p =
 	 local_methods-begin_declarations();
p != local_methods-end_declarations();
@@ -9476,7 +9478,7 @@
 			  || !Type::method_expects_pointer(no));
   Method* m = new Named_method(no, field_indexes, depth, is_value_method,
    (needs_stub_method || depth  0));
-  if (!(*methods)-insert(no-name(), m))
+  if (!methods-insert(no-name(), m))
 	delete m;
 }
 }
@@ -9492,7 +9494,7 @@
 bool is_embedded_pointer,
 bool needs_stub_method,
 std::vectorconst Named_type** seen,
-Methods** methods)
+Methods* methods)
 {
   // Look for anonymous fields in TYPE.  TYPE has fields if it is a
   // struct.
@@ -9530,13 +9532,35 @@
   sub_field_indexes-next = field_indexes;
   sub_field_indexes-field_index = i;
 
+  Methods tmp_methods;
   Type::add_methods_for_type(fnt, sub_field_indexes, depth + 1,
  (is_embedded_pointer || is_pointer),
  (needs_stub_method
   || is_pointer
   || i  0),
  seen,
- methods);
+ tmp_methods);
+  // Check if there are promoted methods that conflict with field names and
+  // don't add them to the method map.
+  for (Methods::const_iterator p = tmp_methods.begin();
+	   p != tmp_methods.end();
+	   ++p)
+	{
+	  bool found = false;
+	  for (Struct_field_list::const_iterator fp = fields-begin();
+	   fp != fields-end();
+	   ++fp)
+	{
+	  if (fp-field_name() == p-first)
+		{
+		  found = true;
+		  break;
+		}
+	}
+	  if (!found 
+	  !methods-insert(p-first, p-second))
+	delete p-second;
+	}
 }
 }
 
@@ -9548,7 +9572,7 @@
 Type::add_interface_methods_for_type(const Type* type,
  const Method::Field_indexes* field_indexes,
  unsigned int depth,
- Methods** methods)
+ Methods* methods)
 {
   const Interface_type* it = type-interface_type();
   if (it == NULL)
@@ -9558,9 +9582,6 @@
   if (imethods == NULL)
 return;
 
-  if (*methods == NULL)
-*methods = new Methods();
-
   for (Typed_identifier_list::const_iterator pm = imethods-begin();
pm != imethods-end();
++pm)
@@ -9576,7 +9597,7 @@
   fntype = fntype-copy_with_receiver(const_castType*(type));
   Method* m = new Interface_method(pm-name(), pm-location(), fntype,
    field_indexes, depth);
-  if (!(*methods)-insert(pm-name(), m))
+  if (!methods-insert(pm-name(), m))
 	delete m;
 }
 }
diff -r c9d064a071c9 go/types.h
--- a/go/types.h	Fri Oct 03 08:11:52 2014 -0700
+++ b/go/types.h	Fri Oct 03 08:12:08 2014 -0700
@@ -384,6 +384,10 @@
   find(const std::string name) const
   { return this-methods_.find(name); }
 
+  bool
+  empty() const
+  { return this-methods_.empty(); }
+
  private:
   Method_map methods_;
 };
@@ -1228,24 +1232,24 @@
   add_methods_for_type(const Type* type, const Method::Field_indexes*,
 		   unsigned int depth, bool, bool,
 		   std::vectorconst Named_type**,
-		   Methods**);
+		   Methods*);
 
   static void
   add_local_methods_for_type(const Named_type* type,
 			 const Method::Field_indexes*,
-			 unsigned int depth, bool, bool, Methods**);
+			 unsigned int depth, bool, bool, Methods*);
 
   static void
   add_embedded_methods_for_type(const Type* type,
 const Method::Field_indexes*,
 unsigned int depth, bool, bool,
 std::vectorconst Named_type**,
-Methods**);
+Methods*);
 
   

Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Jonathan Wakely

On 03/10/14 15:49 +0100, Jonathan Wakely wrote:

On 03/10/14 16:25 +0200, Marc Glisse wrote:
Do you mind if I move (in a future patch once yours is committed) 
_M_size into _M_impl::_M_node as suggested in PR 61347?


Gah, that's where I had it until earlier this week, and I looked at it
and wondered why it was in the _List_impl class (because you only need
one member in there to benefit from the empty base-class
optimisation).

I will move it back there, since I already have that code on another
branch, so there's no point making you change the code to match
something I've already got!


Marc, this is the relative diff to go back to what I had earlier, with
the size in the _List_impl in case you want to aply it locally (the
dg-error tests are off-by-one with this patch)

diff --git a/libstdc++-v3/include/bits/stl_list.h 
b/libstdc++-v3/include/bits/stl_list.h
index 3a56daf..4dbdaf0 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -333,6 +333,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   : public _Node_alloc_type
   {
__detail::_List_node_base _M_node;
+#if _GLIBCXX_USE_CXX11_ABI
+   size_t_M_size;
+
+   // return the stored size
+   size_t _M_node_count() const { return _M_size; }
+#else
+   // count the number of nodes
+   size_t _M_node_count() const
+   { return _S_distance(_M_node._M_next, std::__addressof(_M_node)); }
+#endif
+
_List_impl()
: _Node_alloc_type(), _M_node()
{ }
@@ -350,24 +361,27 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   _List_impl _M_impl;
 
-#if _GLIBCXX_USE_CXX11_ABI
-  size_t_M_size;
+  _List_node_Tp*
+  _M_get_node()
+  { return _M_impl._Node_alloc_type::allocate(1); }
+
+  void
+  _M_put_node(_List_node_Tp* __p) _GLIBCXX_NOEXCEPT
+  { _M_impl._Node_alloc_type::deallocate(__p, 1); }
 
-  size_t _M_get_size() const { return _M_size; }
+#if _GLIBCXX_USE_CXX11_ABI
+  size_t _M_get_size() const { return _M_impl._M_size; }
 
-  void _M_set_size(size_t __n) { _M_size = __n; }
+  void _M_set_size(size_t __n) { _M_impl._M_size = __n; }
 
-  void _M_inc_size(size_t __n) { _M_size += __n; }
+  void _M_inc_size(size_t __n) { _M_impl._M_size += __n; }
 
-  void _M_dec_size(size_t __n) { _M_size -= __n; }
+  void _M_dec_size(size_t __n) { _M_impl._M_size -= __n; }
 
   size_t
   _M_distance(const __detail::_List_node_base* __first,
  const __detail::_List_node_base* __last) const
   { return _S_distance(__first, __last); }
-
-  // return the stored size
-  size_t _M_node_count() const { return _M_size; }
 #else
   // dummy implementations used when the size is not stored
   size_t _M_get_size() const { return 0; }
@@ -375,23 +389,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   void _M_inc_size(size_t) { }
   void _M_dec_size(size_t) { }
   size_t _M_distance(const void*, const void*) const { return 0; }
-
-  // count the number of nodes
-  size_t _M_node_count() const
-  {
-   return _S_distance(_M_impl._M_node._M_next,
-  std::__addressof(_M_impl._M_node));
-  }
 #endif
 
-  _List_node_Tp*
-  _M_get_node()
-  { return _M_impl._Node_alloc_type::allocate(1); }
-
-  void
-  _M_put_node(_List_node_Tp* __p) _GLIBCXX_NOEXCEPT
-  { _M_impl._Node_alloc_type::deallocate(__p, 1); }
-
   public:
   typedef _Alloc allocator_type;
 
@@ -941,7 +940,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   /**  Returns the number of elements in the %list.  */
   size_type
   size() const _GLIBCXX_NOEXCEPT
-  { return this-_M_node_count(); }
+  { return this-_M_impl._M_node_count(); }
 
   /**  Returns the size() of the largest possible %list.  */
   size_type


Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Marc Glisse

On Fri, 3 Oct 2014, Jonathan Wakely wrote:


Marc, this is the relative diff to go back to what I had earlier, with
the size in the _List_impl in case you want to aply it locally (the
dg-error tests are off-by-one with this patch)


Thanks. For PR 61347, to avoid offsetof, I will actually need to 
change:


- __detail::_List_node_base _M_node;
- size_t _M_size;
+ _List_nodesize_t _M_node;

and store the size in _M_node._M_data. Since I will have to touch it 
anyway, don't feel forced to move it to _M_impl.


--
Marc Glisse


Re: [PATCH] remove score-* support

2014-10-03 Thread Jeff Law

On 10/03/14 08:50, tsaund...@mozilla.com wrote:

From: Trevor Saunders tsaund...@mozilla.com

Hi,

It was obsoleted back in 2011, so we're good to remove it.

bootstrapped + regtested x86_64-unknown-linux-gnu, and checked configure 
doesn't recognize score-elf. Ok?

Trev

libgcc/ChangeLog:

2014-09-10  Trevor Saunders  tsaund...@mozilla.com

* config.host: Remove support for score-*.

contrib/ChangeLog:

2014-09-10  Trevor Saunders  tsaund...@mozilla.com

* compare-all-tests: Don't test score-*.
* config-list.mk: Likewise.

gcc/ChangeLog:

2014-09-10  Trevor Saunders  tsaund...@mozilla.com

* common/config/score/score-common.c: Remove.
* config.gcc: Remove support for score-*.
* config/score/constraints.md: Remove.
* config/score/elf.h: Remove.
* config/score/predicates.md: Remove.
* config/score/score-conv.h: Remove.
* config/score/score-generic.md: Remove.
* config/score/score-modes.def: Remove.
* config/score/score-protos.h: Remove.
* config/score/score.c: Remove.
* config/score/score.h: Remove.
* config/score/score.md: Remove.
* config/score/score.opt: Remove.
* doc/md.texi: Don't document score-*.

OK.
Jeff



Re: [PATCH, Pointer Bounds Checker 39/x] Avoid instrumented __builtin_unreachable calls

2014-10-03 Thread Jeff Law

On 10/03/14 03:01, Ilya Enkovich wrote:

Hi,

This patch avoids generation of __builtin_unreachable calls marked as 
instrumented.  It follows paradigma of no instrumented builtin calls (and 
passes corresponding assert in expand_builtin from patch #18).

Thanks,
Ilya
--
2014-10-01  Ilya Enkovich  ilya.enkov...@intel.com

* cgraphunit.c (walk_polymorphic_call_targets): Do not mark
generated call to __builtin_unreachable as with_bounds.
* ipa.c (walk_polymorphic_call_targets): Likewise.
OK.  However, if we find many more generated calls to builtins that need 
to be marked this way, then we'll probably want to put the logic into 
the expander code rather than hacking up each instance individually.


jeff



libgo patch committed: Fix reflection of variadic methods

2014-10-03 Thread Ian Lance Taylor
This patch from Michael Hudson-Doyle fixes PR 61877 which is about using
reflection to get a variadic method value.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 9a2ca32c libgo/go/reflect/all_test.go
--- a/libgo/go/reflect/all_test.go	Fri Oct 03 08:13:20 2014 -0700
+++ b/libgo/go/reflect/all_test.go	Fri Oct 03 08:50:04 2014 -0700
@@ -1543,7 +1543,17 @@
 	fv := MakeFunc(TypeOf(fn), func(in []Value) []Value { return in[1:2] })
 	ValueOf(fn).Elem().Set(fv)
 
-	r := fv.Call([]Value{ValueOf(1), ValueOf(2), ValueOf(3)})[0].Interface().([]int)
+	r := fn(1, 2, 3)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf(Call returned [%v, %v]; want 2, 3, r[0], r[1])
+	}
+
+	r = fn(1, []int{2, 3}...)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf(Call returned [%v, %v]; want 2, 3, r[0], r[1])
+	}
+
+	r = fv.Call([]Value{ValueOf(1), ValueOf(2), ValueOf(3)})[0].Interface().([]int)
 	if r[0] != 2 || r[1] != 3 {
 		t.Errorf(Call returned [%v, %v]; want 2, 3, r[0], r[1])
 	}
@@ -1552,6 +1562,17 @@
 	if r[0] != 2 || r[1] != 3 {
 		t.Errorf(Call returned [%v, %v]; want 2, 3, r[0], r[1])
 	}
+
+	f := fv.Interface().(func(int, ...int) []int)
+
+	r = f(1, 2, 3)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf(Call returned [%v, %v]; want 2, 3, r[0], r[1])
+	}
+	r = f(1, []int{2, 3}...)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf(Call returned [%v, %v]; want 2, 3, r[0], r[1])
+	}
 }
 
 type Point struct {
@@ -1569,6 +1590,24 @@
 	return p.x*p.x*scale + p.y*p.y*scale
 }
 
+// This will be index 2.
+func (p Point) GCMethod(k int) int {
+	runtime.GC()
+	return k + p.x
+}
+
+// This will be index 3.
+func (p Point) TotalDist(points ...Point) int {
+	tot := 0
+	for _, q := range points {
+		dx := q.x - p.x
+		dy := q.y - p.y
+		tot += dx*dx + dy*dy // Should call Sqrt, but it's just a test.
+
+	}
+	return tot
+}
+
 func TestMethod(t *testing.T) {
 	// Non-curried method of type.
 	p := Point{3, 4}
@@ -1751,6 +1790,37 @@
 	}
 }
 
+func TestVariadicMethodValue(t *testing.T) {
+	p := Point{3, 4}
+	points := []Point{{20, 21}, {22, 23}, {24, 25}}
+	want := int64(p.TotalDist(points[0], points[1], points[2]))
+
+	// Curried method of value.
+	tfunc := TypeOf((func(...Point) int)(nil))
+	v := ValueOf(p).Method(3)
+	if tt := v.Type(); tt != tfunc {
+		t.Errorf(Variadic Method Type is %s; want %s, tt, tfunc)
+	}
+	i := ValueOf(v.Interface()).Call([]Value{ValueOf(points[0]), ValueOf(points[1]), ValueOf(points[2])})[0].Int()
+	if i != want {
+		t.Errorf(Variadic Method returned %d; want %d, i, want)
+	}
+	i = ValueOf(v.Interface()).CallSlice([]Value{ValueOf(points)})[0].Int()
+	if i != want {
+		t.Errorf(Variadic Method CallSlice returned %d; want %d, i, want)
+	}
+
+	f := v.Interface().(func(...Point) int)
+	i = int64(f(points[0], points[1], points[2]))
+	if i != want {
+		t.Errorf(Variadic Method Interface returned %d; want %d, i, want)
+	}
+	i = int64(f(points...))
+	if i != want {
+		t.Errorf(Variadic Method Interface Slice returned %d; want %d, i, want)
+	}
+}
+
 // Reflect version of $GOROOT/test/method5.go
 
 // Concrete types implementing M method.
@@ -3718,11 +3788,6 @@
 	f.Call([]Value{})
 }
 
-func (p Point) GCMethod(k int) int {
-	runtime.GC()
-	return k + p.x
-}
-
 func TestReflectMethodTraceback(t *testing.T) {
 	p := Point{3, 4}
 	m := ValueOf(p).MethodByName(GCMethod)
diff -r 9a2ca32c libgo/go/reflect/makefunc.go
--- a/libgo/go/reflect/makefunc.go	Fri Oct 03 08:13:20 2014 -0700
+++ b/libgo/go/reflect/makefunc.go	Fri Oct 03 08:50:04 2014 -0700
@@ -117,29 +117,21 @@
 	ftyp := (*funcType)(unsafe.Pointer(t))
 	method := int(v.flag)  flagMethodShift
 
-	var code uintptr
-	var ffi *ffiData
+	fv := makeFuncImpl{
+		typ:ftyp,
+		method: method,
+		rcvr:   rcvr,
+	}
+
 	switch runtime.GOARCH {
 	case amd64, 386:
 		// Indirect Go func value (dummy) to obtain actual
 		// code address. (A Go func value is a pointer to a C
 		// function pointer. http://golang.org/s/go11func.)
 		dummy := makeFuncStub
-		code = **(**uintptr)(unsafe.Pointer(dummy))
+		fv.code = **(**uintptr)(unsafe.Pointer(dummy))
 	default:
-		code, ffi = makeFuncFFI(ftyp,
-			func(in []Value) []Value {
-m := rcvr.Method(method)
-return m.Call(in)
-			})
-	}
-
-	fv := makeFuncImpl{
-		code:   code,
-		typ:ftyp,
-		method: method,
-		rcvr:   rcvr,
-		ffi:ffi,
+		fv.code, fv.ffi = makeFuncFFI(ftyp, fv.call)
 	}
 
 	return Value{ft, unsafe.Pointer(fv), v.flagflagRO | flag(Func)flagKindShift | flagIndir}
@@ -160,28 +152,21 @@
 	t := typ.common()
 	ftyp := (*funcType)(unsafe.Pointer(t))
 
-	var code uintptr
-	var ffi *ffiData
+	impl := makeFuncImpl{
+		typ:ftyp,
+		method: -2,
+		rcvr:   v,
+	}
+
 	switch runtime.GOARCH {
 	case amd64, 386:
 		// Indirect Go func value (dummy) to obtain actual
 		// code address. (A Go func value is a pointer to a C
 		// function pointer. http://golang.org/s/go11func.)
 		dummy := makeFuncStub
-		code = **(**uintptr)(unsafe.Pointer(dummy))
+		impl.code = 

Re: [PATCH, i386, Pointer Bounds Checker 18/x] Expand instrumented builtin function calls

2014-10-03 Thread Jeff Law

On 10/03/14 02:47, Ilya Enkovich wrote:

Since we still don't have a final decision about how instrumented builtin 
functions would look like, I replace this patch with a new one which assumes we 
don't instrument them for now.  It only has an additional init for va_start and 
also makes sure there is no instrumented builtin calls.  All instrumented 
builtins related codes will go into a separate series.

Thanks,
Ilya
--
2014-10-03  Ilya Enkovich  ilya.enkov...@intel.com

* builtins.c: Include tree-chkp.h and rtl-chkp.h.
(std_expand_builtin_va_start): Init bounds for va_list.
(expand_builtin): Do not allow instrumented calls.
OK.  Obviously we'll want to return to the builtins at some point in the 
relatively new future ;-)


jeff



Re: [PATCH] Fix dupplicate declaration of ggc_realloc in gencondmd PR63429

2014-10-03 Thread Jeff Law

On 10/02/14 19:53, tsaund...@mozilla.com wrote:

From: Trevor Saunders trev.saund...@gmail.com

Hi,

If vec.h is included before ggc.h it forward declares ggc_realloc with
defaulted arguments.  This means ggc.h can not be included later because
it would lead to a second declaration of ggc_realloc with defaulted
arguments.  In generator programs vec.h can not include ggc.h because it
may not exist yet.  So generator programs must make sure they include
ggc.h before anything that includes vec.h.

bootstrapped + regtested x86_64-unknown-linux-gnu, and bootstrapped with
--enable-gather-detailed-mem-stats, ok?

Trev

gcc/ChangeLog:

2014-10-02  Trevor Saunders  tsaund...@mozilla.com

* genconditions.c: Directly include ggc.h before rtl.h.

OK.
jeff



Re: [PATCH] gcc.c: Split up the driver's main into smaller functions

2014-10-03 Thread Joseph S. Myers
On Fri, 3 Oct 2014, David Malcolm wrote:

 The main function for the driver in gcc.c has grown from ~200 lines
 in its original form (way back in r262) to ~1000 lines today, with a
 dozen locals (if we include the params).
 
 The following patch splits it up into 15 smaller functions, moving the
 various locals into the places where they're needed, so we can easily
 see e.g where argc/argv get read vs written.
 
 The functions are private methods of a new driver class to give an
 extra level of encapsualation beyond just being static in gcc.c, and so
 that we can hide some state as member data inside the driver instance.
 
 Turning them into named functions/methods also makes it easier to talk
 about the different phases of main, and put breakpoints on them.
 
 Bootstrappedregrtested on x86_64-unknown-linux-gnu (Fedora 20).
 
 OK for trunk?

OK, minus the if (0) code:

 +  if (0)
 +{
 +  int i;
 +  for (i = 0; i  argc; i++)
 + printf (argc[%i]: %s\n, i, argv[i]);
 +}

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


[gomp4] reduction bug fix

2014-10-03 Thread Cesar Philippidis
There is a reduction bug exposed in the following parallel block.

#pragma acc parallel copy(b[0:3][0:3]) copy(l)
{
#pragma acc loop collapse(2) reduction(+:l)
for (int i = 0; i  2; i++)
  for (int j = 0; j  2; j++)
if (b[i][j] != 16)
  l += 1;
}

Because i and j are local, the collapsed loop is lowered into something
as follows

#pragma acc parallel ...
{
  int i
  {
 int j
 {
#pragma acc loop ...

This is a problem because initialize_reduction_data originally expected
a GIMPLE_BIND at the very beginning of a parallel block. I also made the
assumption that collapse would create a single bind.

Looking at this some more, I may need revise initialize_reduction_data
to scan for multiple acc loops within a parallel block. E.g.,

#pragma acc parallel
{
#pragma acc loop reduction (+:foo)
  {
  }
...
#pragma acc loop reduction (-:bar)
  {
  }
}

I'll address this issue in a follow up patch.

This patch also includes a runtime test case. I won't apply it to
gomp-4_0-branch just yet. But I wanted to demonstrate a test case
nonetheless. Also, note that part of this patch also changes a comment.
I found some typos in the original comment, so I took the opportunity to
fix them, I hope.

Is this OK for gomp-4_0-branch?

Thanks,
Cesar
2014-10-02  Cesar Philippidis  ce...@codesourcery.com

	gcc/
	* omp-low.c (lower_reduction_clauses): Clarify comment.
	(process_reduction_data): Scan for nonempty bind statements at
	the beginning of parallel blocks.

	libgomp/
	* testsuite/libgomp.oacc-c/collapse-4.c: New test.


diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 3bb6a24..5c452c6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4434,10 +4434,10 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
 	  else
 	{
 	  /* The atomic add at the end of the sum creates unnecessary
-	 write contention on accelerators.  To work around that,
-	 create an array or vector_length and assign an element to
-	 each thread.  Later, in lower_omp_for (for openacc), the
-	 values of array will be combined.  */
+	 write contention on accelerators.  To work around this,
+	 create an array to store the partial reductions. Later, in
+	 lower_omp_for (for openacc), the values of array will be
+	 combined.  */
 
 	  tree t = NULL_TREE, array, nthreads;
 	  tree type = get_base_type (var);
@@ -10140,11 +10140,20 @@ process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
   gimple stmt;
 
   /* A collapse clause may have inserted a new bind block.  */
-  stmt = gimple_seq_first (*body);
-  if (stmt  gimple_code (stmt) == GIMPLE_BIND)
+  gsi = gsi_start (*body);
+  while (!gsi_end_p (gsi))
 {
-  inner = gimple_bind_body (gimple_seq_first (*body));
-  body = inner;
+  stmt = gsi_stmt (gsi);
+  if (gimple_code (stmt) == GIMPLE_BIND)
+	{
+	  inner = gimple_bind_body (stmt);
+	  body = inner;
+	  gsi = gsi_start (*body);
+	}
+  else if (gimple_code (stmt) == GIMPLE_OMP_FOR)
+	break;
+  else
+	gsi_next (gsi);
 }
 
   for (gsi = gsi_start (*body); !gsi_end_p (gsi); gsi_next (gsi))
diff --git a/libgomp/testsuite/libgomp.oacc-c/collapse-4.c b/libgomp/testsuite/libgomp.oacc-c/collapse-4.c
new file mode 100644
index 000..b08115a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c/collapse-4.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options -O2 -std=c99 } */
+
+#include string.h
+#include stdlib.h
+#include stdio.h
+
+int
+main (void)
+{
+  int i2, l = 0, r = 0;
+  int a[3][3][3];
+  int b[3][3];
+
+printf(a %p\n, a[0][0][0]);
+printf(i2 %p\n, i2);
+printf(l %p\n, l);
+printf(r %p\n, r);
+
+  memset (a, '\0', sizeof (a));
+  memset (b, '\0', sizeof (b));
+
+
+#pragma acc parallel copy(b[0:3][0:3]) copy(l)
+{
+#pragma acc loop collapse(2) reduction(+:l)
+	for (int i = 0; i  2; i++)
+	  for (int j = 0; j  2; j++)
+	if (b[i][j] != 16)
+		  l += 1;
+}
+
+  return 0;
+}


[google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Rong Xu
Hi,

This patch fixed a bug exposed in build kernel with fdo.

We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
the bb may already have a footer (in this case, a deleted label stmt).
We need to output this label because it's a user label and debug_info
has a reference to it.

Tested with problematic file and regression test.
Trunk may also have the same issue, but I need to work on a testcase.

Thanks,

-Rong
2014-10-02  Rong Xu  x...@google.com

* gcc/cfgrtl.c (emit_barrier_after_bb): Append footer instead of
overwriting.

Index: gcc/cfgrtl.c
===
--- gcc/cfgrtl.c(revision 215823)
+++ gcc/cfgrtl.c(working copy)
@@ -1453,7 +1453,20 @@ emit_barrier_after_bb (basic_block bb)
   gcc_assert (current_ir_type () == IR_RTL_CFGRTL
   || current_ir_type () == IR_RTL_CFGLAYOUT);
   if (current_ir_type () == IR_RTL_CFGLAYOUT)
-BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
+{
+  rtx insn = unlink_insn_chain (barrier, barrier);
+
+  if (BB_FOOTER (bb))
+   {
+  rtx footer_tail = BB_FOOTER (bb);
+  while (NEXT_INSN(footer_tail))
+footer_tail = NEXT_INSN (insn);
+ NEXT_INSN (footer_tail) = insn;
+ PREV_INSN (insn) = footer_tail;
+   }
+  else
+BB_FOOTER (bb) = insn;
+}
 }
 
 /* Like force_nonfallthru below, but additionally performs redirection


[GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Teresa Johnson
Adds handling in this block of code (new in gcc/4_9 and therefore
google/4_9) for LIPO fake edges for indirect calls, which don't have a
call_stmt set and cannot be redirected.

Passes regression tests, ok for google/4_9 branch?

Teresa

2014-10-03  Teresa Johnson  tejohn...@google.com

Google ref b/17378050
* ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
call edges.

Index: ipa.c
===
--- ipa.c   (revision 215830)
+++ ipa.c   (working copy)
@@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
   if (node-callers  can_replace_by_local_alias (node))
{
  struct cgraph_node *alias = cgraph
(symtab_nonoverwritable_alias (node));
+ struct cgraph_edge *e, *next_caller;

  if (alias  alias != node)
{
- while (node-callers)
+  for (e = node-callers; e; e = next_caller)
{
- struct cgraph_edge *e = node-callers;
+  next_caller = e-next_caller;
+ if (L_IPO_COMP_MODE  cgraph_is_fake_indirect_call_edge (e))
+   continue;

  cgraph_redirect_edge_callee (e, alias);
  if (gimple_has_body_p (e-caller-decl))


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


Re: [google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Xinliang David Li
This patch should be targeting trunk gcc?

David

On Fri, Oct 3, 2014 at 9:23 AM, Rong Xu x...@google.com wrote:
 Hi,

 This patch fixed a bug exposed in build kernel with fdo.

 We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
 the bb may already have a footer (in this case, a deleted label stmt).
 We need to output this label because it's a user label and debug_info
 has a reference to it.

 Tested with problematic file and regression test.
 Trunk may also have the same issue, but I need to work on a testcase.

 Thanks,

 -Rong


Re: [GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Xinliang David Li
The name 'e' is used for both outer scope edge and inner scope one.
This is confusing.

David


On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson tejohn...@google.com wrote:
 Adds handling in this block of code (new in gcc/4_9 and therefore
 google/4_9) for LIPO fake edges for indirect calls, which don't have a
 call_stmt set and cannot be redirected.

 Passes regression tests, ok for google/4_9 branch?

 Teresa

 2014-10-03  Teresa Johnson  tejohn...@google.com

 Google ref b/17378050
 * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
 call edges.

 Index: ipa.c
 ===
 --- ipa.c   (revision 215830)
 +++ ipa.c   (working copy)
 @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
if (node-callers  can_replace_by_local_alias (node))
 {
   struct cgraph_node *alias = cgraph
 (symtab_nonoverwritable_alias (node));
 + struct cgraph_edge *e, *next_caller;

   if (alias  alias != node)
 {
 - while (node-callers)
 +  for (e = node-callers; e; e = next_caller)
 {
 - struct cgraph_edge *e = node-callers;
 +  next_caller = e-next_caller;
 + if (L_IPO_COMP_MODE  cgraph_is_fake_indirect_call_edge 
 (e))
 +   continue;

   cgraph_redirect_edge_callee (e, alias);
   if (gimple_has_body_p (e-caller-decl))


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


Re: [PATCH] 512-bit gcc.dg/torture/vshuf*.c

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 4:25 PM, Jakub Jelinek ja...@redhat.com wrote:

 This patch extends the gcc.dg/torture/ testsuite for
 512-bit vectors.  Tested with
 GCC_TEST_RUN_EXPENSIVE=1 make -j32 check-gcc \
 RUNTESTFLAGS='--target_board=unix\{-mavx2,-mavx,-mavx512f,-mavx512bw/-mavx512vl\}
  dg-torture.exp=vshuf*.c'
 (of course with expected AVX512* execution test failures,
 as I don't have hw and didn't bother with simulator).

 As before in vshuf-{8,16,32}.inc, some of the permutations
 are hand written (subset in the TESTS portion), the rest
 are random permutations.

 Ok for trunk?

 2014-10-03  Jakub Jelinek  ja...@redhat.com

 * gcc.dg/torture/vshuf-v8df.c: New test.
 * gcc.dg/torture/vshuf-v8di.c: New test.
 * gcc.dg/torture/vshuf-v16sf.c: New test.
 * gcc.dg/torture/vshuf-v16si.c: New test.
 * gcc.dg/torture/vshuf-v32hi.c: New test.
 * gcc.dg/torture/vshuf-v64qi.c: New test.
 * gcc.dg/torture/vshuf-64.inc: New file.

Please note that -mavx512{bw,vl} are moving target ATM, quite some
patches are still pending.

That said, the patch is OK from x86 side, but a testsuite maintainer
should OK it.

Uros.


Re: [PING] Enhance array types debug info. for Ada

2014-10-03 Thread Jason Merrill

On 09/17/2014 10:38 AM, Pierre-Marie de Rodat wrote:

Patches 1-4 are OK.


+  bool pell_conversions = true;


I don't understand pell.  Do you mean strip?

Jason



Re: [google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Teresa Johnson
Yes, this needs to be fixed on trunk too. I looked at the history and
it has been this way (overwriting the footer) for years. It must be
uncommon to have this confluence of events.

Thanks,
Teresa

On Fri, Oct 3, 2014 at 9:28 AM, Xinliang David Li davi...@google.com wrote:
 This patch should be targeting trunk gcc?

 David

 On Fri, Oct 3, 2014 at 9:23 AM, Rong Xu x...@google.com wrote:
 Hi,

 This patch fixed a bug exposed in build kernel with fdo.

 We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
 the bb may already have a footer (in this case, a deleted label stmt).
 We need to output this label because it's a user label and debug_info
 has a reference to it.

 Tested with problematic file and regression test.
 Trunk may also have the same issue, but I need to work on a testcase.

 Thanks,

 -Rong



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


Re: [GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Teresa Johnson
On Fri, Oct 3, 2014 at 9:31 AM, Xinliang David Li davi...@google.com wrote:
 The name 'e' is used for both outer scope edge and inner scope one.

No, the declaration was moved from the inner scope to the outer scope.

Teresa

 This is confusing.

 David


 On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson tejohn...@google.com wrote:
 Adds handling in this block of code (new in gcc/4_9 and therefore
 google/4_9) for LIPO fake edges for indirect calls, which don't have a
 call_stmt set and cannot be redirected.

 Passes regression tests, ok for google/4_9 branch?

 Teresa

 2014-10-03  Teresa Johnson  tejohn...@google.com

 Google ref b/17378050
 * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
 call edges.

 Index: ipa.c
 ===
 --- ipa.c   (revision 215830)
 +++ ipa.c   (working copy)
 @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
if (node-callers  can_replace_by_local_alias (node))
 {
   struct cgraph_node *alias = cgraph
 (symtab_nonoverwritable_alias (node));
 + struct cgraph_edge *e, *next_caller;

   if (alias  alias != node)
 {
 - while (node-callers)
 +  for (e = node-callers; e; e = next_caller)
 {
 - struct cgraph_edge *e = node-callers;
 +  next_caller = e-next_caller;
 + if (L_IPO_COMP_MODE  cgraph_is_fake_indirect_call_edge 
 (e))
 +   continue;

   cgraph_redirect_edge_callee (e, alias);
   if (gimple_has_body_p (e-caller-decl))


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



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


C++ PATCH to start C++14 constexpr support

2014-10-03 Thread Jason Merrill

These patches implement a couple bits of the C++14 constexpr enhancements.

The first patch adds support for local variables in a constexpr function 
with intializers that can just be substituted into the return expression.


The second patch adds diagnostics for things that are still not 
permitted in a constexpr function.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 9bf3eee3ac0225c7aea376d85e51e5da987fc401
Author: Jason Merrill ja...@redhat.com
Date:   Thu Oct 2 15:51:03 2014 -0400

	* semantics.c (constexpr_fn_retval): Ignore declarations in C++14.
	(var_in_constexpr_fn): New.
	(cxx_eval_constant_expression): Look into DECL_INITIAL.
	(potential_constant_expression_1): Allow constexpr-local vars.

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index fe1651e..857af76 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5833,6 +5833,7 @@ extern tree maybe_constant_value (tree);
 extern tree maybe_constant_init (tree);
 extern bool is_sub_constant_expr (tree);
 extern bool reduced_constant_expression_p (tree);
+extern bool var_in_constexpr_fn (tree);
 extern void explain_invalid_constexpr_fn (tree);
 extern vectree cx_error_context (void);
 extern bool is_this_parameter (tree);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7569826..6c6a5c8 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -8018,6 +8018,8 @@ constexpr_fn_retval (tree body)
 case DECL_EXPR:
   if (TREE_CODE (DECL_EXPR_DECL (body)) == USING_DECL)
 	return NULL_TREE;
+  if (cxx_dialect = cxx14)
+	return NULL_TREE;
   return error_mark_node;
 
 case CLEANUP_POINT_EXPR:
@@ -9596,6 +9598,14 @@ cxx_eval_trinary_expression (const constexpr_call *call, tree t,
   return val;
 }
 
+bool
+var_in_constexpr_fn (tree t)
+{
+  tree ctx = DECL_CONTEXT (t);
+  return (cxx_dialect = cxx14  ctx  TREE_CODE (ctx) == FUNCTION_DECL
+	   DECL_DECLARED_CONSTEXPR_P (ctx));
+}
+
 /* Attempt to reduce the expression T to a constant value.
On failure, issue diagnostic and return error_mark_node.  */
 /* FIXME unify with c_fully_fold */
@@ -9635,6 +9645,11 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
   if (TREE_CODE (r) == TARGET_EXPR
 	   TREE_CODE (TARGET_EXPR_INITIAL (r)) == CONSTRUCTOR)
 	r = TARGET_EXPR_INITIAL (r);
+  if (DECL_P (r)  var_in_constexpr_fn (r)
+	   DECL_INITIAL (r))
+	r = cxx_eval_constant_expression (call, DECL_INITIAL (r),
+	  allow_non_constant, false,
+	  non_constant_p, overflow_p);
   if (DECL_P (r))
 	{
 	  if (!allow_non_constant)
@@ -10320,6 +10335,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
 
 case VAR_DECL:
   if (want_rval  !decl_constant_var_p (t)
+	   !var_in_constexpr_fn (t)
 	   !dependent_type_p (TREE_TYPE (t)))
 {
   if (flags  tf_error)
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-local1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-local1.C
new file mode 100644
index 000..39c3ee8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-local1.C
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++14 } }
+
+constexpr int f(int i) { int j = i+1; return j; }
+
+constexpr int i = f(41);
+
+#define SA(X) static_assert((X),#X)
+
+SA(i==42);

commit 239f96028401a2836208f21f3432c4be91265740
Author: Jason Merrill ja...@redhat.com
Date:   Fri Oct 3 06:15:02 2014 -0400

	* decl.c (start_decl): Complain about static/thread_local vars
	in constexpr function.
	(check_for_uninitialized_const_var): Also uninitialized vars.
	* parser.c (cp_parser_jump_statement): And gotos.
	(cp_parser_asm_operand_list): And asm.
	(cp_parser_try_block): And try.
	* semantics.c (ensure_literal_type_for_constexpr_object): And
	non-literal.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7856dd8..9c8ecc0 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4767,6 +4767,16 @@ start_decl (const cp_declarator *declarator,
   DECL_THIS_STATIC (decl) = 1;
 }
 
+  if (current_function_decl  VAR_P (decl)
+   DECL_DECLARED_CONSTEXPR_P (current_function_decl))
+{
+  if (DECL_THREAD_LOCAL_P (decl))
+	error (%qD declared %thread_local% in %constexpr% function,
+	   decl);
+  else if (TREE_STATIC (decl))
+	error (%qD declared %static% in %constexpr% function, decl);
+}
+
   if (!processing_template_decl  VAR_P (decl))
 start_decl_1 (decl, initialized);
 
@@ -5135,15 +5145,20 @@ check_for_uninitialized_const_var (tree decl)
  7.1.6 */
   if (VAR_P (decl)
TREE_CODE (type) != REFERENCE_TYPE
-   CP_TYPE_CONST_P (type)
+   (CP_TYPE_CONST_P (type) || var_in_constexpr_fn (decl))
!DECL_INITIAL (decl))
 {
   tree field = default_init_uninitialized_part (type);
   if (!field)
 	return;
 
-  permerror (DECL_SOURCE_LOCATION (decl),
-		 uninitialized const %qD, decl);
+  if (CP_TYPE_CONST_P (type))
+	permerror (DECL_SOURCE_LOCATION (decl),
+		   uninitialized const %qD, decl);
+  else
+	

Re: [GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Xinliang David Li
oops -- misread it :)

Ok.

David

On Fri, Oct 3, 2014 at 9:45 AM, Teresa Johnson tejohn...@google.com wrote:
 On Fri, Oct 3, 2014 at 9:31 AM, Xinliang David Li davi...@google.com wrote:
 The name 'e' is used for both outer scope edge and inner scope one.

 No, the declaration was moved from the inner scope to the outer scope.

 Teresa

 This is confusing.

 David


 On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson tejohn...@google.com wrote:
 Adds handling in this block of code (new in gcc/4_9 and therefore
 google/4_9) for LIPO fake edges for indirect calls, which don't have a
 call_stmt set and cannot be redirected.

 Passes regression tests, ok for google/4_9 branch?

 Teresa

 2014-10-03  Teresa Johnson  tejohn...@google.com

 Google ref b/17378050
 * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
 call edges.

 Index: ipa.c
 ===
 --- ipa.c   (revision 215830)
 +++ ipa.c   (working copy)
 @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
if (node-callers  can_replace_by_local_alias (node))
 {
   struct cgraph_node *alias = cgraph
 (symtab_nonoverwritable_alias (node));
 + struct cgraph_edge *e, *next_caller;

   if (alias  alias != node)
 {
 - while (node-callers)
 +  for (e = node-callers; e; e = next_caller)
 {
 - struct cgraph_edge *e = node-callers;
 +  next_caller = e-next_caller;
 + if (L_IPO_COMP_MODE  cgraph_is_fake_indirect_call_edge 
 (e))
 +   continue;

   cgraph_redirect_edge_callee (e, alias);
   if (gimple_has_body_p (e-caller-decl))


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



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


Re: [PATCH 1/2] Error out for Cilk_spawn or array expression in forbidden places

2014-10-03 Thread Jeff Law

On 10/03/14 08:08, Andi Kleen wrote:

From: Andi Kleen a...@linux.intel.com

_Cilk_spawn or Cilk array expressions are only allowed on their own,
but not in for(), if(), switch, do, while, goto, etc.
The C parser didn't always check for that, which lead to ICEs earlier
for invalid code.

Add a generic helper that checks this and call it where needed
in the C frontend.

I chose to allow spawn/array for for init and increment expressions.
While the Cilk spec could be interpreted to forbid it there too
there didn't seem any reason to not allow it.

One dark corner is spawn, array in statement expressions not at
the end. Right now that's forbidden too.

gcc/c-family/:

2014-09-30  Andi Kleen  a...@linux.intel.com

PR c/60804
* c-common.h (check_no_cilk): Declare.
* cilk.c (get_error_location): New function.
(check_no_cilk): Dito.

gcc/c/:

2014-09-30  Andi Kleen  a...@linux.intel.com

PR c/60804
* c-parser.c (c_parser_statement_after_labels): Call
check_no_cilk.
(c_parser_if_statement): Dito.
(c_parser_switch_statement): Dito.
(c_parser_while_statement): Dito.
(c_parser_do_statement): Dito.
(c_parser_for_statement): Dito.
* c-typeck.c (c_finish_loop): Dito.

OK.
Jeff



Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Paolo Carlini

Hi,

On 10/03/2014 04:08 PM, Andi Kleen wrote:

+  if (check_no_cilk (destination,
+Cilk array notation cannot be used as a computed goto expression,
+%_Cilk_spawn% statement cannot be used as a computed goto 
expression))
+   destination = error_mark_node;
Are you sure this kind of error messages will be automatically 
translated without helping the machinery by wrapping the string literals 
in G_() ?


Paolo.


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Siva Chandra
On Fri, Oct 3, 2014 at 7:17 AM, Jason Merrill ja...@redhat.com wrote:
 On 10/03/2014 09:12 AM, Mark Wielaard wrote:

 A debugger not knowing whether a special member function was explicitly
 defaulted, implicitly declared or explicitly defined seems less confusion
 than not knowing whether it was deleted. But there are some subtle cases
 where knowing whether a constructor was user defined or explicitly
 defaulted do matter for whether the default constructor might have been
 implicitly generated.


 Can you elaborate?

 So like the deleted case this patch introduces
 a new attribute DW_AT_GNU_defaulted that gets attached to the function
 declaration. Note that since this is for declarations we explicitly
 test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
 definitions that use = default; outside the class body.


 Hmm, I'm dubious about this choice.  How do you expect a consumer to use
 this information?

I apologize for gate crashing here...

Currently, there is no special attribute to indicate that a special
member function is declared = default. So, if you have a class
definition like this:

class A
{
public:
  A () {}
  ~A () = default;
  int a;
};

then, GDB sees the declaration of the destructor with no special
attributes (like DW_AT_artificial or similar) and thinks that the copy
constructor is user defined. Consequently, if there is a function
defined as:

A
make_a (int i)
{
  A a;
  a.a = i;

  return a;
}

Then, if a user invokes make_a at the GDB prompt, then GDB will
wrongly pass the pointer to the return value as a hidden first
parameter.

Question: Should special member functions declared = default be marked
DW_AT_artificial?

Thanks,
Siva Chandra


Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Andi Kleen
On Fri, Oct 03, 2014 at 07:10:05PM +0200, Paolo Carlini wrote:
 Hi,
 
 On 10/03/2014 04:08 PM, Andi Kleen wrote:
 +  if (check_no_cilk (destination,
 + Cilk array notation cannot be used as a computed goto expression,
 + %_Cilk_spawn% statement cannot be used as a computed goto 
 expression))
 +destination = error_mark_node;
 Are you sure this kind of error messages will be automatically
 translated without helping the machinery by wrapping the string
 literals in G_() ?

I have no idea, but there are lots of error_at() all over while
don't use _.  So I just follow precedence.

-Andi


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Siva Chandra
On Fri, Oct 3, 2014 at 10:13 AM, Siva Chandra sivachan...@google.com wrote:
 On Fri, Oct 3, 2014 at 7:17 AM, Jason Merrill ja...@redhat.com wrote:
 On 10/03/2014 09:12 AM, Mark Wielaard wrote:

 A debugger not knowing whether a special member function was explicitly
 defaulted, implicitly declared or explicitly defined seems less confusion
 than not knowing whether it was deleted. But there are some subtle cases
 where knowing whether a constructor was user defined or explicitly
 defaulted do matter for whether the default constructor might have been
 implicitly generated.


 Can you elaborate?

 So like the deleted case this patch introduces
 a new attribute DW_AT_GNU_defaulted that gets attached to the function
 declaration. Note that since this is for declarations we explicitly
 test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
 definitions that use = default; outside the class body.


 Hmm, I'm dubious about this choice.  How do you expect a consumer to use
 this information?

 I apologize for gate crashing here...

 Currently, there is no special attribute to indicate that a special
 member function is declared = default. So, if you have a class
 definition like this:

 class A
 {
 public:
   A () {}
   ~A () = default;
   int a;
 };

 then, GDB sees the declaration of the destructor with no special
 attributes (like DW_AT_artificial or similar) and thinks that the copy
 constructor is user defined.

Aww, sorry. I should have said destructor instead of copy constructor.


Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Paolo Carlini

Hi,

On 10/03/2014 07:13 PM, Andi Kleen wrote:

On Fri, Oct 03, 2014 at 07:10:05PM +0200, Paolo Carlini wrote:

Hi,

On 10/03/2014 04:08 PM, Andi Kleen wrote:

+  if (check_no_cilk (destination,
+Cilk array notation cannot be used as a computed goto expression,
+%_Cilk_spawn% statement cannot be used as a computed goto 
expression))
+   destination = error_mark_node;

Are you sure this kind of error messages will be automatically
translated without helping the machinery by wrapping the string
literals in G_() ?

I have no idea, but there are lots of error_at() all over while
don't use _.  So I just follow precedence.
The problem is, you are *not* calling error_at directly, you are using 
check_no_cilk and passing pointers. In fact, I think you actually do 
need G_, as in many other places of the front-end. If unsure, double check:


https://gcc.gnu.org/translation.html

Paolo.


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Mark Wielaard
On Fri, 2014-10-03 at 10:54 -0400, Jason Merrill wrote:
 user-declared includes declarations that are defaulted in the class 
 body.  user-provided is the category that does not include such 
 declarations.

O. Then I was indeed wrong and defaulted does not impact ABI at all.
At least that is one worry less for the abi checkers :)

In that case I think we should indeed not distinguish between
DECL_DEFAULTED_IN_CLASS_P and DECL_DEFAULTED_OUTSIDE_CLASS_P and just
use DECL_DEFAULTED_FN. Then the information provided is just that the
source indicates that the special member function has the default
implementation. Which still is useful to know for a consumer. If only to
show the debug users what the intention of the original source code was.

The following variant of the patch does that (and removes any mention of
out of class definitions).

Thanks,

Mark
From f72525e11d08ad49d208ab75c806326871d881d7 Mon Sep 17 00:00:00 2001
From: Mark Wielaard m...@redhat.com
Date: Fri, 3 Oct 2014 14:44:27 +0200
Subject: [PATCH] PR debug/63240 Add DWARF representation for C++11 defaulted
 member function.

gcc/ChangeLog

	* dwarf2out.c (gen_subprogram_die): When a member function is
	declared default then add a DW_AT_GNU_defaulted attribute.
	* langhooks.h (struct lang_hooks_for_decls): Add
	function_decl_defaulted_p langhook.
	* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
	(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.

gcc/cp/ChangeLog

	* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
	(cp_function_decl_defaulted_p): New prototype.
	* cp-objcp-common.c (cp_function_defaulted_p): New function.

gcc/testsuite/ChangeLog

	* g++.dg/debug/dwarf2/defaulted-member-function.C: New testcase.

include/ChangeLog

	* dwarf2.def (DW_AT_GNU_defaulted): New attribute.
---
 gcc/ChangeLog   | 10 ++
 gcc/cp/ChangeLog|  7 +++
 gcc/cp/cp-objcp-common.c| 10 ++
 gcc/cp/cp-objcp-common.h|  3 +++
 gcc/dwarf2out.c |  6 ++
 gcc/langhooks-def.h |  2 ++
 gcc/langhooks.h |  3 +++
 gcc/testsuite/ChangeLog |  5 +
 .../g++.dg/debug/dwarf2/defaulted-member-function.C | 17 +
 include/ChangeLog   |  5 +
 include/dwarf2.def  |  2 ++
 11 files changed, 70 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function.C

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc3287b..255b1b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2014-10-03  Mark Wielaard  m...@redhat.com
+
+	PR debug/63240
+	* dwarf2out.c (gen_subprogram_die): When a member function is
+	declared default then add a DW_AT_GNU_defaulted attribute.
+	* langhooks.h (struct lang_hooks_for_decls): Add
+	function_decl_defaulted_p langhook.
+	* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+	(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.
+
 2014-10-02  Mark Wielaard  m...@redhat.com
 
 	PR debug/63239
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 921f95c..d88bcd8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-03  Mark Wielaard  m...@redhat.com
+
+	PR debug/63240
+	* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+	(cp_function_decl_defaulted_p): New prototype.
+	* cp-objcp-common.c (cp_function_defaulted_p): New function.
+
 2014-10-02  Mark Wielaard  m...@redhat.com
 
 	PR debug/63239
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 0d144ef..e668183 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -178,6 +178,16 @@ cp_function_decl_deleted_p (tree decl)
 	   DECL_DELETED_FN (decl));
 }
 
+/* Return true if DECL is defaulted special member function.  */
+
+bool
+cp_function_decl_defaulted_p (tree decl)
+{
+  return (decl
+	   DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
+	   DECL_DEFAULTED_FN (decl));
+}
+
 /* Stubs to keep c-opts.c happy.  */
 void
 push_file_scope (void)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index c289774..348874f 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -28,6 +28,7 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
 
 extern bool cp_function_decl_explicit_p (tree decl);
 extern bool cp_function_decl_deleted_p (tree decl);
+extern bool cp_function_decl_defaulted_p (tree decl);
 extern void cp_common_init_ts (void);
 
 /* Lang hooks that are shared between C++ and ObjC++ are defined here.  Hooks
@@ -134,6 +135,8 @@ extern void cp_common_init_ts (void);
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
 #undef 

[C PATCH] Don't warn about gnu_inline functions without definitions (PR c/63453)

2014-10-03 Thread Marek Polacek
While looking into something else I noticed that we produce C99ish
inline function declared but never defined warning even for functions
marked as gnu_inline, if not in GNU89 or if -fgnu89-inline is not
in effect, because the warning was guarded only by !flag_gnu89_inline.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-10-03  Marek Polacek  pola...@redhat.com

PR c/63453
* c-decl.c (pop_scope): Don't warn about inline function declared
but never defined for functions marked with gnu_inline attribute.

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

diff --git gcc/c/c-decl.c gcc/c/c-decl.c
index b4995a6..ce5a8de 100644
--- gcc/c/c-decl.c
+++ gcc/c/c-decl.c
@@ -1177,7 +1177,8 @@ pop_scope (void)
  /* C99 6.7.4p6: a function with external linkage... declared
 with an inline function specifier ... shall also be defined
 in the same translation unit.  */
- if (!flag_gnu89_inline)
+ if (!flag_gnu89_inline
+  !lookup_attribute (gnu_inline, DECL_ATTRIBUTES (p)))
pedwarn (input_location, 0,
 inline function %q+D declared but never defined, p);
  DECL_EXTERNAL (p) = 1;
diff --git gcc/testsuite/gcc.dg/pr63453.c gcc/testsuite/gcc.dg/pr63453.c
index e69de29..e6337aa 100644
--- gcc/testsuite/gcc.dg/pr63453.c
+++ gcc/testsuite/gcc.dg/pr63453.c
@@ -0,0 +1,8 @@
+/* PR c/63453 */
+/* { dg-do compile } */
+/* { dg-options -std=gnu11 } */
+
+inline int fn1 (void); /* { dg-warning declared but never defined } */
+extern inline int fn2 (void); /* { dg-warning declared but never defined } */
+inline int __attribute__ ((gnu_inline)) fn3 (void);
+extern inline int __attribute__ ((gnu_inline)) fn4 (void);

Marek


Re: [PATCH, rs6000, libcpp] Revise search_line_fast to avoid old unaligned load sequences

2014-10-03 Thread David Edelsohn
On Mon, Sep 29, 2014 at 4:15 PM, Bill Schmidt
wschm...@linux.vnet.ibm.com wrote:
 Hi,

 The vec_lvsl and vec_lvsr interfaces are deprecated for little-endian
 Power, and really should not be used on big-endian Power either when the
 target CPU is power8 or above.  The lexer in libcpp currently makes use
 of these interfaces in search_line_fast().  This patch provides a new
 version of search_line_fast() that allows unaligned loads to be handled
 by the hardware.

 The new version is used when _ARCH_PWR8 and __ALTIVEC__ are defined.
 Otherwise, the older version may be used; however it is now restricted
 for use only on big-endian systems.  If we are targeting little-endian
 (which requires P8 or higher) and either Altivec support or Power8
 architecture support has been disabled, then we revert to a slower
 search routine.  This prevents ever using the deprecated instructions
 for little-endian code generation.

 I haven't added a new test case, as bootstrapping GCC is an excellent
 test of search_line_fast(), and that appears to be all we do at present
 for the existing implementations.

 Bootstrapped and tested on powerpc64le-unknown-linux-gnu and
 powerpc64-unknown-linux-gnu with no new regressions.  Is this ok for
 trunk?

 Thanks,
 Bill


 2014-09-29  Bill Schmidt  wschm...@linux.vnet.ibm.com

 * lex.c (search_line_fast): Add new version to be used for Power8
 and later targets when Altivec is enabled.  Restrict the existing
 Altivec version to big-endian systems so that lvsr is not used on
 little endian, where it is deprecated.  Remove LE-specific code
 from the now-BE-only version.

The code is POWER-specific.  It's okay with me.  The GCC front-end
maintainers do not seem to have any concerns or objections.

Thanks, David


Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Andi Kleen
 I have no idea, but there are lots of error_at() all over while
 don't use _.  So I just follow precedence.
 The problem is, you are *not* calling error_at directly, you are

According to Joseph it's ok because I named the arguments _msgid.

-Andi


[PATCH, RTX]: Additional fix for PR 57003

2014-10-03 Thread Uros Bizjak
Hello!

My r215428 change exposed another PR 57003 problem on x86_64. When
compiling gcc.target/i386/pr57003.c we refer to clobbered %rdi
register after the call to memcpy:

--- pr57003.s   2014-10-03 15:08:24.0 +0200
+++ pr57003_.s  2014-10-03 15:08:19.0 +0200
@@ -78,7 +78,7 @@
leaq-20(%rbx), %rdx
movq%rax, %rdi
callmemcpy
-   movq%rdi, c(%rip)
+   movq%rax, c(%rip)
 .L8:
movaps  (%rsp), %xmm6
movaps  16(%rsp), %xmm7
@@ -321,5 +321,5 @@
.byte   0xb
.align 8
 .LEFDE7:
-   .ident  GCC: (GNU) 5.0.0 20141002 (experimental) [trunk
revision 215797]
+   .ident  GCC: (GNU) 4.9.2 20141001 (prerelease)
[gcc-4_9-branch revision 215749]
.section.note.GNU-stack,,@progbits

The runtime failure happens only on CentOS5 (and not in Fedora20),
which supports findings in Comment #17 of the PR.

The difference is, that now we emit memcpy for MS_ABI-ELF_ABI
cross-ABI call as:

#(call_insn:TI 24 23 27 3 (set (reg:DI 0 ax)
#(call (mem:QI (symbol_ref:DI (memcpy) [flags 0x41]
function_decl 0x7fce6f586438 memcpy) [0 memcpy S1 A8])
#(const_int 0 [0]))) pr57003.c:32 661 {*call_value}
# (expr_list:REG_DEAD (reg:DI 5 di)
#(expr_list:REG_DEAD (reg:DI 4 si)
#(expr_list:REG_DEAD (reg:DI 1 dx)
#(expr_list:REG_UNUSED (reg:DI 0 ax)
#(expr_list:REG_RETURNED (reg/v/f:DI 2 cx [orig:87 e ] [87])
#(expr_list:REG_CALL_DECL (symbol_ref:DI
(memcpy) [flags 0x41] function_decl 0x7fce6f586438 memcpy)
#(expr_list:REG_EH_REGION (const_int 0 [0])
#(nil
#(expr_list (clobber (reg:TI 52 xmm15))
#(expr_list (clobber (reg:TI 51 xmm14))
#(expr_list (clobber (reg:TI 50 xmm13))
#(expr_list (clobber (reg:TI 49 xmm12))
#(expr_list (clobber (reg:TI 48 xmm11))
#(expr_list (clobber (reg:TI 47 xmm10))
#(expr_list (clobber (reg:TI 46 xmm9))
#(expr_list (clobber (reg:TI 45 xmm8))
#(expr_list (clobber (reg:TI 28 xmm7))
#(expr_list (clobber (reg:TI 27 xmm6))
#(expr_list (clobber (reg:DI 5 di))
#(expr_list (clobber
(reg:DI 4 si))
#(expr_list:DI
(set (reg:DI 0 ax)
#(reg:DI 5 di))
#(expr_list:DI
(use (reg:DI 5 di))
#
(expr_list:DI (use (reg:DI 4 si))
#
(expr_list:DI (use (reg:DI 1 dx))
#
(nil))

which is alternate, but equivalent form of what was generated previously:

#(call_insn:TI 24 23 27 3 (parallel [
#(set (reg:DI 0 ax)
#(call (mem:QI (symbol_ref:DI (memcpy) [flags 0x41]
function_decl 0x7fd91824a800 memcpy) [0 memcpy S1 A8])
#(const_int 0 [0])))
#(unspec [
#(const_int 0 [0])
#] UNSPEC_MS_TO_SYSV_CALL)
#(clobber (reg:DI 4 si))
#(clobber (reg:DI 5 di))
#(clobber (reg:TI 27 xmm6))
#(clobber (reg:TI 28 xmm7))
#(clobber (reg:TI 45 xmm8))
#(clobber (reg:TI 46 xmm9))
#(clobber (reg:TI 47 xmm10))
#(clobber (reg:TI 48 xmm11))
#(clobber (reg:TI 49 xmm12))
#(clobber (reg:TI 50 xmm13))
#(clobber (reg:TI 51 xmm14))
#(clobber (reg:TI 52 xmm15))
#]) pr57003.c:32 652 {*call_value_rex64_ms_sysv}
# (expr_list:REG_DEAD (reg:DI 5 di)
#(expr_list:REG_DEAD (reg:DI 4 si)
#(expr_list:REG_DEAD (reg:DI 1 dx)
#(expr_list:REG_RETURNED (reg/v/f:DI 2 cx [orig:87 e ] [87])
#(expr_list:REG_EH_REGION (const_int 0 [0])
#(nil))
#(expr_list:DI (set (reg:DI 0 ax)
#(reg:DI 5 di))
#(expr_list:DI (use (reg:DI 5 di))
#(expr_list:DI (use (reg:DI 4 si))
#(expr_list:DI (use (reg:DI 1 dx))
#(nil))

It looks that Jakub's patch, proposed in Comment #21 doesn't cover
alternative form, so it doesn't record clobbers properly.

Attached patch fixes this omission.

2014-10-03  Uros Bizjak  ubiz...@gmail.com

PR rtl-optimization/57003
* regcprop.c (copyprop_hardreg_forward_1): If ksvd.ignore_set_reg,
also check CALL_INSN_FUNCTION_USAGE for clobbers again after
killing regs_invalidated_by_call.

Tested on x86_64-linux-gnu {,-m32}.

OK for mainline and release branches?

Uros.
Index: regcprop.c
===
--- regcprop.c  (revision 215861)
+++ regcprop.c  (working copy)

Re: [PATCH] 512-bit gcc.dg/torture/vshuf*.c

2014-10-03 Thread Mike Stump
On Oct 3, 2014, at 9:40 AM, Uros Bizjak ubiz...@gmail.com wrote:
 Ok for trunk?
 
 2014-10-03  Jakub Jelinek  ja...@redhat.com

 That said, the patch is OK from x86 side, but a testsuite maintainer
 should OK it.

Ok.


Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Paolo Carlini

Hi,

On 10/03/2014 07:50 PM, Andi Kleen wrote:

I have no idea, but there are lots of error_at() all over while
don't use _.  So I just follow precedence.

The problem is, you are *not* calling error_at directly, you are

According to Joseph it's ok because I named the arguments _msgid.

Ok then, I didn't notice that. Sorry for the false alarm.

Paolo.


Re: [PATCH, rs6000] Generate LE code for vec_lvsl and vec_lvsr that is compatible with BE code

2014-10-03 Thread David Edelsohn
On Thu, Oct 2, 2014 at 3:20 PM, Bill Schmidt
wschm...@linux.vnet.ibm.com wrote:
 Hi,

 Here's a revised version of the patch that addresses Segher's comments.
 Bootstrapped and tested on powerpc64le-unknown-linux-gnu.  Ok for trunk?

 Thanks,
 Bill


 [gcc]

 2014-10-02  Bill Schmidt  wschm...@linux.vnet.ibm.com

 * altivec.md (altivec_lvsl): New define_expand.
 (altivec_lvsl_direct): Rename define_insn from altivec_lvsl.
 (altivec_lvsr): New define_expand.
 (altivec_lvsr_direct): Rename define_insn from altivec_lvsr.
 * rs6000.c (rs6000_expand_builtin): Change to use
 altivec_lvs[lr]_direct; remove commented-out code.

 [gcc/testsuite]

 2014-10-02  Bill Schmidt  wschm...@linux.vnet.ibm.com

 * gcc.target/powerpc/lvsl-lvsr.c: New test.

Okay.

Thanks, Segher, for providing a second set of eyes.

Thanks, David


Re: [PATCH, rs6000] Warn for deprecated use of vec_lvsl and vec_lvsr for little endian

2014-10-03 Thread David Edelsohn
On Mon, Sep 29, 2014 at 5:53 PM, Bill Schmidt
wschm...@linux.vnet.ibm.com wrote:
 Hi,

 The vec_lvsl and vec_lvsr interfaces are deprecated for little endian in
 the ELFv2 ABI document.  At the moment, these interfaces will produce
 incorrect code, and the only indication a programmer has of this is that
 his or her code does not function correctly.  This patch adds a warning
 message to inform the little endian programmer of the deprecated usage.

 The patch described in
 https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02580.html is a
 prerequisite for this patch, as otherwise the deprecation message causes
 bootstrap failure due to -Werror in the later stages.

 I feel the deprecation message is needed because, in a future patch, we
 plan to make vec_lvsl and vec_lvsr work so that BE code will run on LE
 without requiring code modifications.  However, code modifications are
 still desirable because the LE code, while correct, will be pretty poor.
 The deprecation message will encourage programmers to rewrite their code
 that makes use of vec_lvsl/lvsr.

 I've added a new test to demonstrate the message, and updated a number
 of tests to use -Wno-deprecated so the new message doesn't disturb them.

 Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
 regressions.  Is this ok for trunk?

 Thanks,
 Bill


 [gcc]

 2014-09-29  Bill Schmidt  wschm...@linux.vnet.ibm.com

 * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
 Issue a warning message when vec_lvsl or vec_lvsr is used with a
 little endian target.

 [gcc/testsuite]

 2014-09-29  Bill Schmidt  wschm...@linux.vnet.ibm.com

 * g++.dg/ext/altivec-2.C: Compile with -Wno-deprecated to avoid
 failing with the new warning message.
 * gcc.dg/vmx/3c-01a.c: Likewise.
 * gcc.dg/vmx/ops-long-1.c: Likewise.
 * gcc.dg/vmx/ops.c: Likewise.
 * gcc.target/powerpc/altivec-20.c: Likewise.
 * gcc.target/powerpc/altivec-6.c: Likewise.
 * gcc.target/powerpc/altivec-vec-merge.c: Likewise.
 * gcc.target/powerpc/vsx-builtin-8.c: Likewise.
 * gcc.target/powerpc/warn-lvsl-lvsr.c: New test.

Okay.

Thanks, David


Re: [gofrontend-dev] [PATCH 3/9] Gccgo port to s390[x] -- part I

2014-10-03 Thread Ian Lance Taylor
On Tue, Sep 9, 2014 at 5:51 AM, Dominik Vogt v...@linux.vnet.ibm.com wrote:
 The current Gccgo cannot handle 64 bit symbol tables on s390[x].
 The attached patch fixes that.

 gcc/go/ChangeLog
 2014-09-05  Dominik Vogt  v...@linux.vnet.ibm.com

 * gofrontend/import-archive.cc (interpret_header): Recognize 64-bit
 symbol tables (/SYM64/ ).

Thanks.  Committed.

Ian


Re: [RFC] costs and it's use in assign_reg_parm

2014-10-03 Thread Jeff Law

On 10/02/14 02:31, Ramana Radhakrishnan wrote:


And a couple of items caught my attention.

For one the backend doesn't set the costs of a reg-reg move to be the
same as a reg-const move. In the AArch64 backend the approach appears to
be in line with the documentation which is to set the costs of various
instructions relative to a fast integer instruction. The hack to
aarch64.c in the attached patch is for setting the cost properly for a
reg-reg move of the appropriate mode and is only for demonstration
purposes. I expect this to be replaced by an equivalent bit of code in
the backend to achieve the same thing.
rtx_cost and its friends have always been a problem and it's always felt 
like a design problem.   The true cost of something is so context 
dependent I'm not really sure how to build an API to do this in a sane way.



Regardless, the first thing I see when I look at the aarch64 rtx costing 
bits is that it rarely looks at modes.  So it's entirely possible that 
if floats/doubles have a higher cost than integers that it needs a bit 
of hacking to bring the result into line for non-integer modes.






However the code in precompute_register_parameters assumes that the
value is forced into a register if the set_src_cost of a constant is  
COSTS_N_INSNS(1). Now this appears to be checking the cost of a set of
an FP immediate constant to a register and the backend not unreasonably
sets it to an appropriate cost. Now to assume that this number should
always be less than 1 is really not appropriate.
Agreed. Also note there's a bit of a break in the model -- namely that 
we're comparing the cost of a particular operand vs the cost of insns. 
I've always found this to be, umm lame and a source of confusion when 
folks have been doing backend tuning.




Instead of putting in what's effectively a lie in the backend, should we
just be moving the midend to a world where all such numbers are compared
to costs from the backend rather than relying on magic numbers. The
costs comparison logic is similar to whats used in lower-subreg. The
thought was to move this to a common area (Richard Sandiford suggested
expmed.h in a private conversation) so that we had common APIs to check
the cost of a SET in this form rather than relying on the rtx_cost
interface.

Agreed.

Jeff


[jit] Fix memory leak within diagnostic.c

2014-10-03 Thread David Malcolm
Committed to branch dmalcolm/jit:

Running e.g. test-factorial.exe under valgrind shows that libgccjit.so
was leaking ~13.5KB of RAM per invocation of the compiler here:

==57074== 21,440 bytes in 4 blocks are definitely lost in loss record 896 of 907
==57074==at 0x4A0645D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==57074==by 0x58EFFC7: xmalloc (xmalloc.c:147)
==57074==by 0x58A9256: diagnostic_initialize(diagnostic_context*, int) 
(diagnostic.c:129)
==57074==by 0x4DF6062: toplev::main(int, char**) (toplev.c:1120)
==57074==by 0x4E09E13: gcc::jit::playback::context::compile() 
(internal-api.c:4987)
==57074==by 0x4E015C2: gcc::jit::recording::context::compile() 
(internal-api.c:878)
==57074==by 0x401CA4: test_jit (harness.h:188)
==57074==by 0x401D88: main (harness.h:230)
==57074==
==57074== 34,112 (256 direct, 33,856 indirect) bytes in 4 blocks are definitely 
lost in loss record 902 of 907
==57074==at 0x4A0645D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==57074==by 0x58EFFC7: xmalloc (xmalloc.c:147)
==57074==by 0x58A91D4: diagnostic_initialize(diagnostic_context*, int) 
(diagnostic.c:122)
==57074==by 0x4DF6062: toplev::main(int, char**) (toplev.c:1120)
==57074==by 0x4E09E13: gcc::jit::playback::context::compile() 
(internal-api.c:4987)
==57074==by 0x4E015C2: gcc::jit::recording::context::compile() 
(internal-api.c:878)
==57074==by 0x401CA4: test_jit (harness.h:188)
==57074==by 0x401D88: main (harness.h:230)

Fix it.

gcc/ChangeLog.jit:
* diagnostic.c (diagnostic_finish): Free the memory for
context-classify_diagnostic and context-printer, running the
destructor for the latter.
---
 gcc/diagnostic.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index b1b6366..642cbe3 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -177,6 +177,15 @@ diagnostic_finish (diagnostic_context *context)
 }
 
   diagnostic_file_cache_fini ();
+
+  XDELETEVEC (context-classify_diagnostic);
+  context-classify_diagnostic = NULL;
+
+  /* diagnostic_initialize allocates context-printer using XNEW
+ and placement-new.  */
+  context-printer-~pretty_printer ();
+  XDELETE (context-printer);
+  context-printer = NULL;
 }
 
 /* Initialize DIAGNOSTIC, where the message MSG has already been
-- 
1.7.11.7



[PATCH] middle-end: use dump_location instead of copy-pasted code

2014-10-03 Thread Manuel López-Ibáñez
There are some inconsistencies in the middle-end about how to dump a
location. The following patch makes all places (that I found) use
dump_location, and makes that function print also the column number.

While searching for possible callers, I noticed two cases where we use
expanded_location for no good reason.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/ChangeLog:

2014-10-03  Manuel López-Ibáñez  m...@gcc.gnu.org

* tree-pretty-print.c (dump_location): Make it extern. Dump also
the column.
* tree-pretty-print.h (dump_location): Declare.
* gimple-pretty-print.c (dump_gimple_phi): Use dump_location.
(pp_gimple_stmt_1): Likewise.
(dump_implicit_edges): Likewise.
* gimplify.c (gimplify_call_expr): Use LOCATION_FILE and
LOCATION_LINE.


gcc/testsuite/ChangeLog:

2014-10-03  Manuel López-Ibáñez  m...@gcc.gnu.org

* gcc.dg/tm/debug-1.c: Update regex.
* c-c++-common/raw-string-18.c: Update regex.
* c-c++-common/raw-string-19.c: Update regex.
Index: gcc/tree-pretty-print.c
===
--- gcc/tree-pretty-print.c (revision 215841)
+++ gcc/tree-pretty-print.c (working copy)
@@ -675,22 +675,24 @@ dump_omp_clauses (pretty_printer *buffer
 }
 
 
 /* Dump location LOC to BUFFER.  */
 
-static void
+void
 dump_location (pretty_printer *buffer, location_t loc)
 {
   expanded_location xloc = expand_location (loc);
 
   pp_left_bracket (buffer);
   if (xloc.file)
 {
   pp_string (buffer, xloc.file);
-  pp_string (buffer,  : );
+  pp_string (buffer, :);
 }
   pp_decimal_int (buffer, xloc.line);
+  pp_colon (buffer);
+  pp_decimal_int (buffer, xloc.column);
   pp_string (buffer, ] );
 }
 
 
 /* Dump lexical block BLOCK.  BUFFER, SPC and FLAGS are as in
Index: gcc/tree-pretty-print.h
===
--- gcc/tree-pretty-print.h (revision 215841)
+++ gcc/tree-pretty-print.h (working copy)
@@ -48,7 +48,8 @@ extern const char *op_symbol_code (enum
 extern void print_call_name (pretty_printer *, tree, int);
 extern void percent_K_format (text_info *);
 extern void pp_tree_identifier (pretty_printer *, tree);
 extern void dump_function_header (FILE *, tree, int);
 extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
+extern void dump_location (pretty_printer *buffer, location_t loc);
 
 #endif /* ! GCC_TREE_PRETTY_PRINT_H */
Index: gcc/testsuite/gcc.dg/tm/debug-1.c
===
--- gcc/testsuite/gcc.dg/tm/debug-1.c   (revision 215841)
+++ gcc/testsuite/gcc.dg/tm/debug-1.c   (working copy)
@@ -17,10 +17,10 @@ int main() {
testing();
}
return 0;
 }
 
-/* { dg-final { scan-tree-dump-times : 13:.*b = 9898 1 tmmark } } */
-/* { dg-final { scan-tree-dump-times : 14:.*_ITM_beginTransaction 1 tmmark 
} } */
-/* { dg-final { scan-tree-dump-times : 15:.*ITM_WU. \\(z 1 tmmark } } */
-/* { dg-final { scan-tree-dump-times : 16:.*ITM_WU. \\(a 1 tmmark } } */
+/* { dg-final { scan-tree-dump-times :13:.*b = 9898 1 tmmark } } */
+/* { dg-final { scan-tree-dump-times :14:.*_ITM_beginTransaction 1 tmmark 
} } */
+/* { dg-final { scan-tree-dump-times :15:.*ITM_WU. \\(z 1 tmmark } } */
+/* { dg-final { scan-tree-dump-times :16:.*ITM_WU. \\(a 1 tmmark } } */
 /* { dg-final { cleanup-tree-dump tmmark } } */
Index: gcc/testsuite/c-c++-common/raw-string-18.c
===
--- gcc/testsuite/c-c++-common/raw-string-18.c  (revision 215841)
+++ gcc/testsuite/c-c++-common/raw-string-18.c  (working copy)
@@ -15,7 +15,7 @@ main ()
   extern void foo (); foo ();
   return 0;
 }
 
 /* Verify call to foo is on line 15.  */
-/* { dg-final { scan-tree-dump : 15\[]:]\[^\n\r]*foo optimized } } */
+/* { dg-final { scan-tree-dump c:15:\[^\n\r\]*foo optimized } } */
 /* { dg-final { cleanup-tree-dump optimized } } */
Index: gcc/testsuite/c-c++-common/raw-string-19.c
===
--- gcc/testsuite/c-c++-common/raw-string-19.c  (revision 215841)
+++ gcc/testsuite/c-c++-common/raw-string-19.c  (working copy)
@@ -15,8 +15,8 @@ main ()
   extern void foo (); foo ();
   return 0;
 }
 
 /* Verify call to foo is on line 15.  */
-/* { dg-final { scan-tree-dump : 15\[]:]\[^\n\r]*foo optimized } } */
+/* { dg-final { scan-tree-dump c:15:\[^\n\r\]*foo optimized } } */
 /* { dg-final { cleanup-tree-dump optimized } } */
 /* { dg-final { cleanup-saved-temps } } */
Index: gcc/gimple-pretty-print.c
===
--- gcc/gimple-pretty-print.c   (revision 215841)
+++ gcc/gimple-pretty-print.c   (working copy)
@@ -1832,25 +1832,11 @@ dump_gimple_phi (pretty_printer *buffer,
   pp_string (buffer,  = PHI );
 }
   for (i = 0; i  gimple_phi_num_args (phi); i++)
 {
   if ((flags  TDF_LINENO)  

Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Cary Coutant
 O. Then I was indeed wrong and defaulted does not impact ABI at all.
 At least that is one worry less for the abi checkers :)

As Siva mentioned, it does in fact impact the ABI. A class with a
non-trivial destructor is not a POD, and affects the calling
convention, so the debugger needs to know the difference. C++ ABI
reference here:

   http://mentorembedded.github.io/cxx-abi/abi.html#return-value

I've submitted a DWARF proposal to document the use of the
DW_AT_artificial attribute on a default copy constructor or
destructor.

-cary


Re: [PATCHv3][PING] Enable -fsanitize-recover for KASan

2014-10-03 Thread Alexey Samsonov
On Wed, Oct 1, 2014 at 10:58 PM, Jakub Jelinek ja...@redhat.com wrote:
 On Wed, Oct 01, 2014 at 04:21:29PM -0700, Alexey Samsonov wrote:
 Speaking of plain -f(no-)sanitize-recover - it would probably be
 better to change the semantics of this flag,
 so that -f(no-)?sanitize-recover means enable(disable) recovery for
 all sanitizers enabled at this point.
 That is, it would be pretty much like -Werror flag.

 For example,
 -fsanitize=undefined -fsanitize=address -fno-sanitize-recover
 would mean run UBSan and ASan and don't recover from errors.

 That would change behavior, e.g. for
 -fsanitize=undefined,address -fsanitize-recover
 would suddenly enable recovery from asan errors while previously
 they wouldn't be recovering.

 GCC has not shipped with the -fsanitize-recover flag yet (we have just
 vendor backport of it), so if you don't mind changing behavior for clang
 users, I can live with that.

Yes, I think so. -fsanitize-recover was not documented in Clang user manual.

  Would the default still be
 -fsanitize-recover=undefined,kernel-address -fno-sanitize-recover=address ?

Yes.

-- 
Alexey Samsonov, Mountain View, CA


  1   2   >