Add polymorphic call context propagation to ipa-prop

2014-10-02 Thread Jan Hubicka
Hi,
this patch makes ipa-prop to use ipa-polymorphic-call-context infrastructure
for forward propagation (in a very minimal and simple way). 

At the moment only static type info is propagated and it is used only
speculatively because I will need to update dynamic type change code to deal
with more general setting than in the old binfo propagation code. I want to do
it incrementally.  The basic problem is that the old binfo code wasmostly built
around idea that all bases are primary bases and one class may contain other
only as a base (not as field).

Martin, I get out of range ICEs in controlled uses code and thus
I added an extra check, see FIXME bellow. Could you, please, help
me to fix that correctly?

THe patch also does not add necessary propagation into ipa-cp and thus
devirtualizatoin happens only during inlining and is not appropriately
hinted.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

Honza

* ipa-prop.h (ipa_get_controlled_uses): Add hack to avoid ICE
when speculation is added.
(ipa_edge_args): Add polymorphic_call_contexts.
(ipa_get_ith_polymorhic_call_context): New accesor.
(ipa_make_edge_direct_to_target): Add SPECULATIVE parameter.
(ipa_print_node_jump_functions_for_edge): Print contexts.
(ipa_compute_jump_functions_for_edge): Compute contexts.
(update_jump_functions_after_inlining): Update contexts.
(ipa_make_edge_direct_to_target): Add SPECULATIVE argument;
update dumping; add speculative edge creation.
(try_make_edge_direct_virtual_call): Add CTX_PTR parameter; handle
context updating.
(update_indirect_edges_after_inlining): Pass down context.
(ipa_edge_duplication_hook): Duplicate contexts.
(ipa_write_node_info): Stream out contexts.
(ipa_read_node_info): Stream in contexts.
* ipa-devirt.c (type_all_derivations_known_p): Avoid ICE on non-ODR
types.
(try_speculative_devirtualization): New function.
* ipa-utils.h (try_speculative_devirtualization): Declare.
Index: ipa-prop.h
===
--- ipa-prop.h  (revision 215792)
+++ ipa-prop.h  (working copy)
@@ -432,7 +432,10 @@ ipa_set_param_used (struct ipa_node_para
 static inline int
 ipa_get_controlled_uses (struct ipa_node_params *info, int i)
 {
-  return info->descriptors[i].controlled_uses;
+  /* FIXME: introducing speuclation causes out of bounds access here.  */
+  if (info->descriptors.length () > (unsigned)i)
+return info->descriptors[i].controlled_uses;
+  return IPA_UNDESCRIBED_USE;
 }
 
 /* Set the controlled counter of a given parameter.  */
@@ -479,6 +482,7 @@ struct GTY(()) ipa_edge_args
 {
   /* Vector of the callsite's jump function of each parameter.  */
   vec *jump_functions;
+  vec *polymorphic_call_contexts;
 };
 
 /* ipa_edge_args access functions.  Please use these to access fields that
@@ -502,6 +506,16 @@ ipa_get_ith_jump_func (struct ipa_edge_a
   return &(*args->jump_functions)[i];
 }
 
+/* Returns a pointer to the polymorphic call context for the ith argument.
+   NULL if contexts are not computed.  */
+static inline struct ipa_polymorphic_call_context *
+ipa_get_ith_polymorhic_call_context (struct ipa_edge_args *args, int i)
+{
+  if (!args->polymorphic_call_contexts)
+return NULL;
+  return &(*args->polymorphic_call_contexts)[i];
+}
+
 /* Types of vectors holding the infos.  */
 
 /* Vector where the parameter infos are actually stored. */
@@ -585,7 +599,8 @@ tree ipa_get_indirect_edge_target (struc
   vec ,
   vec ,
   vec );
-struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, 
tree);
+struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
+   bool speculative = false);
 tree ipa_binfo_from_known_type_jfunc (struct ipa_jump_func *);
 tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
 
Index: ipa-prop.c
===
--- ipa-prop.c  (revision 215792)
+++ ipa-prop.c  (working copy)
@@ -364,6 +364,8 @@ ipa_print_node_jump_functions_for_edge (
  fprintf (f, "\n");
}
}
+  if (IPA_EDGE_REF (cs)->polymorphic_call_contexts)
+   ipa_get_ith_polymorhic_call_context (IPA_EDGE_REF (cs), i)->dump (f);
 }
 }
 
@@ -1876,10 +1878,13 @@ ipa_compute_jump_functions_for_edge (str
   struct ipa_edge_args *args = IPA_EDGE_REF (cs);
   gimple call = cs->call_stmt;
   int n, arg_num = gimple_call_num_args (call);
+  bool useful_context = false;
 
   if (arg_num == 0 || args->jump_functions)
 return;
   vec_safe_grow_cleared (args->jump_functions, arg_num);
+  if (flag_devirtualize)
+vec_safe_grow_cleared (args->polymorphic_call_contexts, arg_num);
 
   if (gimple_call_internal_p (call))
  

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

2014-10-02 Thread Markus Trippelsdorf
On 2014.09.26 at 16:31 -0400, Vladimir Makarov 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
Please submit a full bug report,

-- 
Markus


Re: Ответ: [PATCH 1/2, x86] Add palignr support for AVX2.

2014-10-02 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 11:15:10AM +0400, Evgeny wrote:
> Hold on. The patch has a conflict with previously approved here.

Which?

In any case, I've already committed the patch.

That said, if what you care now about is pr52252-atom.c with -O2
-ftree-vectorize -mavx2, let's look at all the permutations it needs
below.  The patch I've committed improved f3, from
3x vpshufb + 2x vpermq + 2x vpor into vperm2i128 $33 + vpalignr $11,
left other permutations as is.

So, do you have suggestions on what insns we should use for the other
permutations?  Then we can figure out how to best achieve that.
Note that with dozens of permutation instructions in the ISA the
computational complexity of finding optimal sequence might be too
expensive.

typedef unsigned char V __attribute__ ((vector_size (32)));
V a, b, c;

void
f1 (void)
{
  c = __builtin_shuffle (a, b, (V) { 0, 32, 1, 33, 2, 34, 3, 35, 4, 36, 5, 37, 
6, 38, 7, 39, 8, 40, 9, 41, 10, 42, 11, 43, 12, 44, 13, 45, 14, 46, 15, 47 });
}

void
f2 (void)
{
  c = __builtin_shuffle (a, b, (V) { 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 1, 
4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 2, 5, 8, 11, 14, 17, 20, 23, 26, 29 });
}

void
f3 (void)
{
  c = __builtin_shuffle (a, b, (V) { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 
41, 42 });
}

void
f4 (void)
{
  c = __builtin_shuffle (a, b, (V) { 16, 48, 17, 49, 18, 50, 19, 51, 20, 52, 
21, 53, 22, 54, 23, 55, 24, 56, 25, 57, 26, 58, 27, 59, 28, 60, 29, 61, 30, 62, 
31, 63 });
}

void
f5 (void)
{
  c = __builtin_shuffle (a, b, (V) { 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 
51, 52 });
}

void
f6 (void)
{
  c = __builtin_shuffle (a, b, (V) { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 
52, 53 });
}

Jakub


Re: Ответ: [PATCH 1/2, x86] Add palignr support for AVX2.

2014-10-02 Thread Richard Biener
On October 2, 2014 9:50:45 AM CEST, Jakub Jelinek  wrote:
>On Thu, Oct 02, 2014 at 11:15:10AM +0400, Evgeny wrote:
>> Hold on. The patch has a conflict with previously approved here.
>
>Which?
>
>In any case, I've already committed the patch.
>
>That said, if what you care now about is pr52252-atom.c with -O2
>-ftree-vectorize -mavx2, let's look at all the permutations it needs
>below.  The patch I've committed improved f3, from
>3x vpshufb + 2x vpermq + 2x vpor into vperm2i128 $33 + vpalignr $11,
>left other permutations as is.
>
>So, do you have suggestions on what insns we should use for the other
>permutations?  Then we can figure out how to best achieve that.
>Note that with dozens of permutation instructions in the ISA the
>computational complexity of finding optimal sequence might be too
>expensive.

I always wondered if we can use some form of a compressed table to store all 
permutations and compute that statically by some means (at build time or even 
checked into the repo).  But yes, the complexity is quite high...

Also note the recent bug I filed about using whole-vector shifts for special 
permutes so we can get rid of VEC_LSHIFT_EXPR.

Richard.

>typedef unsigned char V __attribute__ ((vector_size (32)));
>V a, b, c;
>
>void
>f1 (void)
>{
>c = __builtin_shuffle (a, b, (V) { 0, 32, 1, 33, 2, 34, 3, 35, 4, 36,
>5, 37, 6, 38, 7, 39, 8, 40, 9, 41, 10, 42, 11, 43, 12, 44, 13, 45, 14,
>46, 15, 47 });
>}
>
>void
>f2 (void)
>{
>c = __builtin_shuffle (a, b, (V) { 0, 3, 6, 9, 12, 15, 18, 21, 24, 27,
>30, 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 2, 5, 8, 11, 14, 17, 20,
>23, 26, 29 });
>}
>
>void
>f3 (void)
>{
>c = __builtin_shuffle (a, b, (V) { 11, 12, 13, 14, 15, 16, 17, 18, 19,
>20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
>38, 39, 40, 41, 42 });
>}
>
>void
>f4 (void)
>{
>c = __builtin_shuffle (a, b, (V) { 16, 48, 17, 49, 18, 50, 19, 51, 20,
>52, 21, 53, 22, 54, 23, 55, 24, 56, 25, 57, 26, 58, 27, 59, 28, 60, 29,
>61, 30, 62, 31, 63 });
>}
>
>void
>f5 (void)
>{
>c = __builtin_shuffle (a, b, (V) { 21, 22, 23, 24, 25, 26, 27, 28, 29,
>30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
>48, 49, 50, 51, 52 });
>}
>
>void
>f6 (void)
>{
>c = __builtin_shuffle (a, b, (V) { 22, 23, 24, 25, 26, 27, 28, 29, 30,
>31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
>49, 50, 51, 52, 53 });
>}
>
>   Jakub




Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-02 Thread Ed Smith-Rowland

On 10/02/2014 02:51 AM, Ed Smith-Rowland wrote:

On 10/01/2014 11:28 AM, Jonathan Wakely wrote:

On 02/09/14 10:24 +0100, Jonathan Wakely wrote:

On 01/09/14 21:46 -0400, Ed Smith-Rowland wrote:

Index: include/bits/stl_function.h
===
--- include/bits/stl_function.h(revision 214680)
+++ include/bits/stl_function.h(working copy)
@@ -217,6 +217,10 @@
   };

#if __cplusplus > 201103L
+
+#define __cpp_lib_transparent_operators 201210
+#define __cpp_lib_generic_associative_lookup 201304


The generic associative lookup feature is not supported.


Index: testsuite/experimental/feat-lib-fund.cc
===
--- testsuite/experimental/feat-lib-fund.cc(revision 0)
+++ testsuite/experimental/feat-lib-fund.cc(working copy)
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++14" }
+// { dg-do compile }
+
+#include 
+#include 
+
+#if !__has_include()
+#  error ""
+#endif
+
+//#if !__has_include()
+//#  error ""
+//#endif
+
+//#if !__has_include()
+//#  error ""
+//#endif


This can be uncommented,  is available.

OK with those changes.


Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?



OK,

Here is the patch.

Built and tested on x86_64-linux.

OK?

Ed

FWIW, I remember a svn tree corruption while getting this patch ready.
I should have retested everything in the new tree.
Sorry everyone!


Here is a front-end test patch.
Built and tested on x86_64-linux.
OK?
Ed

2014-10-02  Edward Smith-Rowland  <3dw...@verizon.net>

* g++.dg/cpp1y/feat-cxx98-neg.C: Fix double negative thinko and
add many more tests.

Index: g++.dg/cpp1y/feat-cxx98-neg.C
===
--- g++.dg/cpp1y/feat-cxx98-neg.C   (revision 215793)
+++ g++.dg/cpp1y/feat-cxx98-neg.C   (working copy)
@@ -1,6 +1,99 @@
 // { dg-do compile { target c++98_only } }
 // { dg-options "-ansi" }
 
-#ifdef __cpp_runtime_arrays
+#ifndef __cpp_runtime_arrays
 #  error "__cpp_runtime_arrays" // { dg-error "error" }
 #endif
+
+#ifndef __cpp_unicode_characters
+#  error "__cpp_unicode_characters" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_raw_strings
+#  error "__cpp_raw_strings" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_unicode_literals
+#  error "__cpp_unicode_literals" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_user_defined_literals
+#  error "__cpp_user_defined_literals" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_lambdas
+#  error "__cpp_lambdas" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_constexpr
+#  error "__cpp_constexpr" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_static_assert
+#  error "__cpp_static_assert" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_decltype
+#  error "__cpp_decltype" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_attributes
+#  error "__cpp_attributes" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_rvalue_reference
+#  error "__cpp_rvalue_reference" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_variadic_templates
+#  error "__cpp_variadic_templates" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_alias_templates
+#  error "__cpp_alias_templates" // { dg-error "error" }
+#endif
+
+// C++14
+
+// C++98 gets binary literals.
+//#ifndef __cpp_binary_literals
+//#  error "__cpp_binary_literals"
+//#endif
+
+#ifndef __cpp_init_captures
+#  error "__cpp_init_captures" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_generic_lambdas
+#  error "__cpp_generic_lambdas" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_decltype_auto
+#  error "__cpp_decltype_auto" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_return_type_deduction
+#  error "__cpp_return_type_deduction" // { dg-error "error" }
+#endif
+
+//  Aggregate initializers not in yet.
+//#ifdef __cpp_aggregate_nsdmi
+//#  error "__cpp_aggregate_nsdmi"
+//#endif
+
+#ifndef __cpp_variable_templates
+#  error "__cpp_variable_templates" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_digit_separators
+#  error "__cpp_digit_separators" // { dg-error "error" }
+#endif
+
+#ifndef __cpp_attribute_deprecated
+#  error "__cpp_attribute_deprecated" // { dg-error "error" }
+#endif
+
+//  Sized deallocation not in yet.
+//#ifdef __cpp_sized_deallocation
+//#  error "__cpp_sized_deallocation"
+//#endif


Re: [PATCH, i386, Pointer Bounds Checker 30/x] Size relocation

2014-10-02 Thread Ilya Enkovich
On 01 Oct 19:57, Uros Bizjak wrote:
> On Wed, Oct 1, 2014 at 7:02 PM, Ilya Enkovich  wrote:
> > 2014-10-01 19:17 GMT+04:00 Uros Bizjak :
> >> On Wed, Oct 1, 2014 at 4:10 PM, Ilya Enkovich  
> >> wrote:
> >>
>  +;; Return true if size of VALUE can be stored in a sign
>  +;; extended immediate field.
>  +(define_predicate "x86_64_immediate_size_operand"
>  +  (match_code "symbol_ref")
>  +{
>  +  if (!TARGET_64BIT)
>  +return true;
>  +
>  +  /* For 64 bit target we may assume size of object fits
>  + immediate only when code model guarantees that.  */
>  +  return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL);
>  +})
>  +
> >>>
> >>> This predicate causes bootstrap error:
> >>> predicates.md:362:38: error: unused parameter 'op' 
> >>> [-Werror=unused-parameter]
> >>
> >> Huh? How is this predicate different from e.g.
> >>
> >> (define_predicate "compare_operator"
> >>   (match_code "compare"))
> >>
> >> ?
> >>
> >> Can you please show generated code from gcc/insn-preds.c?
> >>
> >> Uros.
> >
> > It is different because it has a code block which is used to generate
> > additional function. Here is what generated for the predicate:
> >
> > static inline int
> > x86_64_immediate_size_operand_1 (rtx op, enum machine_mode mode
> > ATTRIBUTE_UNUSED)
> > {
> >   if (!TARGET_64BIT)
> > return true;
> >
> >   /* For 64 bit target we may assume size of object fits
> >  immediate only when code model guarantees that.  */
> >   return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL);
> > }
> >
> > int
> > x86_64_immediate_size_operand (rtx op, enum machine_mode mode 
> > ATTRIBUTE_UNUSED)
> > {
> >   return ((GET_CODE (op) == SYMBOL_REF) && (
> > (x86_64_immediate_size_operand_1 (op, mode && (
> > (mode == VOIDmode || GET_MODE (op) == mode));
> > }
> 
> Well,
> 
> --cut here--
> (define_predicate "x86_64_immediate_size_operand"
>   (and (match_code "symbol_ref")
>(ior (not (match_test "TARGET_64BIT"))
> (and (match_test ("ix86_cmodel == CM_SMALL"))
>  (match_test ("ix86_cmodel == CM_KERNEL"))
> --cut here--
> 
> Uros.

Thanks for a workaround.  Below is a modified version passing bootstrap.

Ilya
--
2014-10-01  Ilya Enkovich  

* config/i386/i386.md (UNSPEC_SIZEOF): New.
(move_size_reloc_): New.
* config/i386/predicates.md (symbol_operand): New.
(x86_64_immediate_size_operand): New.


diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 65990b1..1901023 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -79,6 +79,7 @@
   UNSPEC_PLTOFF
   UNSPEC_MACHOPIC_OFFSET
   UNSPEC_PCREL
+  UNSPEC_SIZEOF
 
   ;; Prologue support
   UNSPEC_STACK_ALLOC
@@ -18789,6 +18790,21 @@
   "bndstx\t{%2, %3|%3, %2}"
   [(set_attr "type" "mpxst")])
 
+(define_insn "move_size_reloc_"
+  [(set (match_operand:SWI48 0 "register_operand" "=r")
+   (unspec:SWI48
+[(match_operand:SWI48 1 "symbol_operand")]
+UNSPEC_SIZEOF))]
+  "TARGET_MPX"
+{
+  if (x86_64_immediate_size_operand (operands[1], VOIDmode))
+return "mov{l}\t{%1@SIZE, %k0|%k0, %1@SIZE}";
+  else
+return "movabs{q}\t{%1@SIZE, %0|%0, %1@SIZE}";
+}
+  [(set_attr "type" "imov")
+   (set_attr "mode" "")])
+
 (include "mmx.md")
 (include "sse.md")
 (include "sync.md")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index fea7754..1875339 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -124,6 +124,10 @@
(match_test "TARGET_64BIT")
(match_test "REGNO (op) > BX_REG")))
 
+;; Return true if VALUE is symbol reference
+(define_predicate "symbol_operand"
+  (match_code "symbol_ref"))
+
 ;; Return true if VALUE can be stored in a sign extended immediate field.
 (define_predicate "x86_64_immediate_operand"
   (match_code "const_int,symbol_ref,label_ref,const")
@@ -336,6 +340,14 @@
   return false;
 })
 
+;; Return true if size of VALUE can be stored in a sign
+;; extended immediate field.
+(define_predicate "x86_64_immediate_size_operand"
+  (and (match_code "symbol_ref")
+   (ior (not (match_test "TARGET_64BIT"))
+   (ior (match_test ("ix86_cmodel == CM_SMALL"))
+(match_test ("ix86_cmodel == CM_KERNEL"))
+
 ;; Return true if OP is general operand representable on x86_64.
 (define_predicate "x86_64_general_operand"
   (if_then_else (match_test "TARGET_64BIT")


[RFC] costs and it's use in assign_reg_parm

2014-10-02 Thread Ramana Radhakrishnan

Hi,

   I've been digging into why on AArch64 we generate pretty bad code 
for the following testcase.


void g2(float, float, float, float, float, float, float, float);

void f2a(void)
{
   float x0 = 1.0, x1 = 2.0, x2 = 3.0, x3 = 4.0, x4 = 5.0, x5 = 6.0, x6 
= 7.0, x7 = 8.0;
   float x8 = 0.5, x9 = 1.5, x10 = 2.5, x11 = 0.25, x12 = 0.125, x13 = 
3.5, x14 = 0.75, x15 = 1.25;


   g2(x0, x1, x2, x3, x4, x5, x6, x7);
   g2(x8, x9, x10, x11, x12, x13, x14, x15);
   g2(x0, x1, x2, x3, x4, x5, x6, x7);
   g2(x8, x9, x10, x11, x12, x13, x14, x15);
}

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.


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.


The same can be achieved with removing the fpconst case in 
aarch64.c:rtx_costs but ...


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.


Some of you might ask what's the impact on other backends, I still need 
to do the due diligence there with various test programs but my 
expectation based on reading the code is that a sample of backends (x86, 
mips, aarch64 and powerpc) handle the reg-reg move cost with a "set" 
already and I would expect the same to be in line with other costs. 
AArch32 does not but I'll take care of that in a follow up.


Longer term should we move towards cleaning up such magic numbers from 
the mid-end and that would make for a more maintainable compiler IMHO.


Thoughts ?

Lightly tested with the testcase and nothing more.


regards
Ramana



2a:
fmovs23, 8.0e+0
fmovs22, 7.0e+0
fmovs21, 6.0e+0
fmovs20, 5.0e+0
fmovs19, 4.0e+0
fmovs18, 3.0e+0
fmovs17, 2.0e+0
fmovs16, 1.0e+0
stp x29, x30, [sp, -112]!
fmovs7, s23
fmovs6, s22
add x29, sp, 0
fmovs5, s21
fmovs4, s20
stp d8, d9, [sp, 16]
fmovs3, s19
stp d10, d11, [sp, 32]
fmovs2, s18
stp d12, d13, [sp, 48]
fmovs1, s17
stp d14, d15, [sp, 64]
fmovs0, s16
fmovs15, 1.25e+0
fmovs14, 7.5e-1
fmovs13, 3.5e+0
fmovs12, 1.25e-1
fmovs11, 2.5e-1
fmovs10, 2.5e+0
fmovs9, 1.5e+0
fmovs8, 5.0e-1
str s23, [x29, 80]
str s22, [x29, 84]
str s21, [x29, 88]
str s20, [x29, 92]
str s19, [x29, 96]
str s18, [x29, 100]
str s17, [x29, 104]
str s16, [x29, 108]
bl  g2
fmovs7, s15
fmovs6, s14
fmovs5, s13
fmovs4, s12
fmovs3, s11
fmovs2, s10
fmovs1, s9
fmovs0, s8
bl  g2
ldr s23, [x29, 80]




TO

f2a:
stp x29, x30, [sp, -16]!
fmovs7, 8.0e+0
add x29, sp, 0
fmovs6, 7.0e+0
fmovs5, 6.0e+0
fmovs4, 5.0e+0
fmovs3, 4.0e+0
fmovs2, 3.0e+0
fmovs1, 2.0e+0
fmovs0, 1.0e+0
bl  g2
fmovs7, 1.25e+0
fmovs6, 7.5e-1
fmovs5, 3.5e+0
fmovs4, 1.25e-1
fmovs3, 2.5e-1
fmovs2, 2.5e+0
fmovs1, 1.5e+0
fmovs0, 5.0e-1
bl  g2
fmovs7, 8.0e+0
fmovs6, 7.0e+0
fmovs5, 6.0e+0
fmovs4, 5.0e+0
fmovs3, 4.0e+0
fmovs2, 3.0e+0
fmovs1, 2.0e+0
fmovs0, 1.0e+0
bl  g2
ldp x29, x30, [sp], 16
fmovs7, 1.25e+0
f

Re: std::regex: inserting std::wregex to std::vector loses some std::wregex values

2014-10-02 Thread Jonathan Wakely

On 01/10/14 23:44 -0700, Tim Shen wrote:

This just copies but we could still make it slightly more efficient by
moving _M_original_str (then resetting __rhs to an empty state).

 basic_regex(basic_regex&& __rhs)
 : _M_flags(__rhs._M_flags), _M_original_str(std::move(_M_original_str))
 {
   this->imbue(__rhs.getloc());
   __rhs._M_automaton.reset();
 }

This is only slightly more efficient, and still needs to allocate
memory for the NFA, so I'm not sure if it's worth it. Your call.


Yes let's do it. Done.


Because imbue() returns the old locale you can swap them like this:

   imbue(__rhs.imbue(getloc()));



Done.


Looks good - thanks.


Re: [PATCH] Improve prepare_shrink_wrap to sink more instructions

2014-10-02 Thread Andrew Pinski
On Fri, Sep 19, 2014 at 1:43 PM, Jeff Law  wrote:
> On 09/15/14 08:33, Jiong Wang wrote:
>>
>>
>> Jeff,
>>
>>   thanks, I partially understand your meaning here.
>>
>>take the function "ira_implicitly_set_insn_hard_regs" in ira-lives.c
>> for example,
>>
>>when generating address rtl, gcc will automatically generate "const"
>> operator to prefix
>>the address expression, like the following. so a simple CONSTANT_P
>> check is enough in
>>case there is no embedded register.
>>
>>(insn 309 310 308 3 (set (reg:DI 44 r15 [orig:94 ivtmp.674 ] [94])
>>  (const:DI (plus:DI (symbol_ref:DI ("recog_data") [flags 0x40]
>> )
>>  (const_int 480 [0x1e0] -1
>>
>>
>>but for architecture like aarch64, the following instruction
>> sequences to forming address
>>may be generated
>>
>> (insn 73 14 74 4 (set (reg/f:DI 20 x20 [99])
>>  (high:DI (symbol_ref:DI ("global_a") [flags 0xc0]  > 0x7ff755a60900 stats>))) 35 {*movdi_aarch64}
>>   (expr_list:REG_EQUIV (high:DI (symbol_ref:DI ("global_a") [flags
>> 0xc0]  ))
>>  (nil)))
>>
>> (insn 17 30 25 5 (set (reg/f:DI 4 x4 [83])
>>  (lo_sum:DI (reg/f:DI 20 x20 [99])
>>  (symbol_ref:DI ("global_a") [flags 0xc0]  > 0x7ff755a60900 stats>))) {add_losym_di}
>>   (expr_list:REG_EQUIV (symbol_ref:DI ("global_a") [flags 0xc0]
>> )
>>  (nil)))
>>
>>   while CONSTANT_P could not catch the latter lo_sum case, as the
>> RTX_CLASS of lo_sum is RTX_OBJ not RTX_CONST_OBJ,
>
> Hmm, it's been ~15 years since I regularly worked on a target that uses
> HIGH/LO_SUM, I thought we wrapped the LO_SUM expression inside a CONST as
> well, but reading the docs for CONST, that clearly isn't the case.

Could we add a check for lo_sum since it is an RTX_OBJ rather than
RTX_COMM_ARITH or RTX_BIN_ARITH?
I am testing the patch for that to fix the above issue.  It shows up
with the testcase Jiong added but only with -mabi=ilp32 enabled.

Thanks,
Andrew Pinski

>
> Sorry for that.  Can you (re) send your current patch for this for review?
>
> Jeff


Re: [PATCH C++] - SD-6 Implementation Part 3 - .

2014-10-02 Thread Jonathan Wakely

On 02/10/14 02:51 -0400, Ed Smith-Rowland wrote:

On 10/01/2014 11:28 AM, Jonathan Wakely wrote:

Ed, the commit at http://gcc.gnu.org/r215752 doesn't have the
corrections I asked for above and causes a number of test failures,
could you look into it please?



OK,

Here is the patch.

Built and tested on x86_64-linux.

OK?


Yes, the library change is OK, thanks for the quick fix.


Re: [ping*2] define CROSS = @CROSS@ in gcc/Makefile.in

2014-10-02 Thread Olivier Hainque

On Sep 30, 2014, at 6:48 PM, Jeff Law wrote:

>>> * Makefile.in (CROSS): Define, to @CROSS@.

> OK.
> Jeff


 Thanks Jeff :-)



[PATCH] palignr improvement (PR target/62128)

2014-10-02 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 09:50:45AM +0200, Jakub Jelinek wrote:
> On Thu, Oct 02, 2014 at 11:15:10AM +0400, Evgeny wrote:
> > Hold on. The patch has a conflict with previously approved here.
> 
> Which?
> 
> In any case, I've already committed the patch.
> 
> That said, if what you care now about is pr52252-atom.c with -O2
> -ftree-vectorize -mavx2, let's look at all the permutations it needs
> below.  The patch I've committed improved f3, from
> 3x vpshufb + 2x vpermq + 2x vpor into vperm2i128 $33 + vpalignr $11,
> left other permutations as is.

So, looking at that testcase, I see a very easy improvement implemented below.
For palignr, we were only trying one order of arguments to palignr, but the
order of those arguments is significant, and if we try the other order too,
also the f5 and f6 functions can now be emitted as vperm2i128 + vpalignr.
It even handles
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 4, 5
V16QImode permutation using single palignr insn, previously we only handled
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21.

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  

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.

--- gcc/config/i386/i386.c.jj   2014-10-02 09:18:50.0 +0200
+++ gcc/config/i386/i386.c  2014-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.jj2012-03-20 
08:51:25.0 +0100
+

Re: [PATCH, i386, Pointer Bounds Checker 30/x] Size relocation

2014-10-02 Thread Uros Bizjak
On Thu, Oct 2, 2014 at 10:23 AM, Ilya Enkovich  wrote:

> 2014-10-01  Ilya Enkovich  
>
> * config/i386/i386.md (UNSPEC_SIZEOF): New.
> (move_size_reloc_): New.
> * config/i386/predicates.md (symbol_operand): New.
> (x86_64_immediate_size_operand): New.

OK with a trivial adjustment.

Thanks,
Uros.

> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
> index 65990b1..1901023 100644
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -79,6 +79,7 @@
>UNSPEC_PLTOFF
>UNSPEC_MACHOPIC_OFFSET
>UNSPEC_PCREL
> +  UNSPEC_SIZEOF
>
>;; Prologue support
>UNSPEC_STACK_ALLOC
> @@ -18789,6 +18790,21 @@
>"bndstx\t{%2, %3|%3, %2}"
>[(set_attr "type" "mpxst")])
>
> +(define_insn "move_size_reloc_"
> +  [(set (match_operand:SWI48 0 "register_operand" "=r")
> +   (unspec:SWI48
> +[(match_operand:SWI48 1 "symbol_operand")]
> +UNSPEC_SIZEOF))]
> +  "TARGET_MPX"
> +{
> +  if (x86_64_immediate_size_operand (operands[1], VOIDmode))
> +return "mov{l}\t{%1@SIZE, %k0|%k0, %1@SIZE}";
> +  else
> +return "movabs{q}\t{%1@SIZE, %0|%0, %1@SIZE}";
> +}
> +  [(set_attr "type" "imov")
> +   (set_attr "mode" "")])
> +
>  (include "mmx.md")
>  (include "sse.md")
>  (include "sync.md")
> diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
> index fea7754..1875339 100644
> --- a/gcc/config/i386/predicates.md
> +++ b/gcc/config/i386/predicates.md
> @@ -124,6 +124,10 @@
> (match_test "TARGET_64BIT")
> (match_test "REGNO (op) > BX_REG")))
>
> +;; Return true if VALUE is symbol reference
> +(define_predicate "symbol_operand"
> +  (match_code "symbol_ref"))
> +
>  ;; Return true if VALUE can be stored in a sign extended immediate field.
>  (define_predicate "x86_64_immediate_operand"
>(match_code "const_int,symbol_ref,label_ref,const")
> @@ -336,6 +340,14 @@
>return false;
>  })
>
> +;; Return true if size of VALUE can be stored in a sign
> +;; extended immediate field.
> +(define_predicate "x86_64_immediate_size_operand"
> +  (and (match_code "symbol_ref")
> +   (ior (not (match_test "TARGET_64BIT"))
> +   (ior (match_test ("ix86_cmodel == CM_SMALL"))
> +(match_test ("ix86_cmodel == CM_KERNEL"))

Uh yes, I did a trivial thinko. Please note that above (ior) can be
rewritten with a multiple arguments:

(define_predicate "x86_64_immediate_size_operand"
  (and (match_code "symbol_ref")
   (ior (not (match_test "TARGET_64BIT"))
   (match_test "ix86_cmodel == CM_SMALL")
   (match_test "ix86_cmodel == CM_KERNEL"

Also, there were unneded parenthesis for match_test removed.

>  ;; Return true if OP is general operand representable on x86_64.
>  (define_predicate "x86_64_general_operand"
>(if_then_else (match_test "TARGET_64BIT")


[wwwdocs] Add feature-testing macros and std::is_final to gcc-5/changes.html

2014-10-02 Thread Jonathan Wakely

Note Ed's recent changes. Committed to CVS.
Index: htdocs/gcc-5/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.12
diff -u -r1.12 changes.html
--- htdocs/gcc-5/changes.html	1 Oct 2014 08:28:35 -	1.12
+++ htdocs/gcc-5/changes.html	2 Oct 2014 10:09:23 -
@@ -83,6 +83,9 @@
   Excessive template instantiation depth is now a fatal error. This
   prevents excessive diagnostics that usually do not help to identify the
   problem.
+  G++ and libstdc++ now implement the feature-testing macros from
+http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations";>Feature-testing
+recommendations for C++.
 
 
   Runtime Library (libstdc++)
@@ -95,6 +98,12 @@
  support for std::aligned_union;
   
 
+https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2014";>
+  Improved experimental support for C++14, including:
+  
+ std::is_final type trait; 
+  
+
 An implementation of std::experimental::any.
 New random number distributions logistic_distribution and
   uniform_on_sphere_distribution as extensions.


Re: [wwwdocs] Add feature-testing macros and std::is_final to gcc-5/changes.html

2014-10-02 Thread Jonathan Wakely

On 02/10/14 11:12 +0100, Jonathan Wakely wrote:

Note Ed's recent changes. Committed to CVS.


And fix a markup error that I expected xmllint to catch :-(
Index: htdocs/gcc-5/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.13
diff -u -r1.13 changes.html
--- htdocs/gcc-5/changes.html	2 Oct 2014 10:12:04 -	1.13
+++ htdocs/gcc-5/changes.html	2 Oct 2014 10:13:08 -
@@ -102,7 +102,7 @@
   Improved experimental support for C++14, including:
   
  std::is_final type trait; 
-  
+  
 
 An implementation of std::experimental::any.
 New random number distributions logistic_distribution and


Fix hard_regno bitfield in IRA allocno struct

2014-10-02 Thread David Sherwood
Hi,

At the request of Andreas Schwab I have fixed the hard_regno bitfield
in the allocno structure as signed integers need to be explicitly marked as
signed in bitfields.

Cheers,
Dave.

gcc/ChangeLog:

2014-10-02  David Sherwood  

* ira-int.h: (ira_allocno) Make hard_regno explicitly signed


rb2484.patch
Description: Binary data


Re: [patch] Do not generate useless integral conversions

2014-10-02 Thread Eric Botcazou
[This is an old discussion about useless integral conversions introduced 
behind the back of the front-end by the routines in convert.c]

> I don't like re-introducing that inconsistency.

OK.

> Maybe instead make convert.c do if (!TYPE_UNSIGNED) unsigned_type_for ()
> instead?  I notice that all callers of [un]signed_type_for are in
> "premature" optimizations convert.c performs (that better should be done
> in fold-const.c).

Yes, that works for me too, patch attached, it makes sure convert_to_integer 
only fiddles with the type when strictly necessary.  Tested on x86-64/Linux.


2014-10-02  Eric Botcazou  

* convert.c (convert_to_integer): Do not introduce useless conversions
between integral types.


-- 
Eric BotcazouIndex: convert.c
===
--- convert.c	(revision 215656)
+++ convert.c	(working copy)
@@ -746,8 +746,9 @@ convert_to_integer (tree type, tree expr
 		/* Can't do arithmetic in enumeral types
 		   so use an integer type that will hold the values.  */
 		if (TREE_CODE (typex) == ENUMERAL_TYPE)
-		  typex = lang_hooks.types.type_for_size
-		(TYPE_PRECISION (typex), TYPE_UNSIGNED (typex));
+		  typex
+		= lang_hooks.types.type_for_size (TYPE_PRECISION (typex),
+		  TYPE_UNSIGNED (typex));
 
 		/* But now perhaps TYPEX is as wide as INPREC.
 		   In that case, do nothing special here.
@@ -788,9 +789,15 @@ convert_to_integer (tree type, tree expr
 			&& (ex_form == PLUS_EXPR
 || ex_form == MINUS_EXPR
 || ex_form == MULT_EXPR)))
-		  typex = unsigned_type_for (typex);
+		  {
+			if (!TYPE_UNSIGNED (typex))
+			  typex = unsigned_type_for (typex);
+		  }
 		else
-		  typex = signed_type_for (typex);
+		  {
+			if (TYPE_UNSIGNED (typex))
+			  typex = signed_type_for (typex);
+		  }
 		return convert (type,
 fold_build2 (ex_form, typex,
 		 convert (typex, arg0),
@@ -805,7 +812,19 @@ convert_to_integer (tree type, tree expr
 	  /* This is not correct for ABS_EXPR,
 	 since we must test the sign before truncation.  */
 	  {
-	tree typex = unsigned_type_for (type);
+	/* Do the arithmetic in type TYPEX,
+	   then convert result to TYPE.  */
+	tree typex = type;
+
+	/* Can't do arithmetic in enumeral types
+	   so use an integer type that will hold the values.  */
+	if (TREE_CODE (typex) == ENUMERAL_TYPE)
+	  typex
+		= lang_hooks.types.type_for_size (TYPE_PRECISION (typex),
+		  TYPE_UNSIGNED (typex));
+
+	if (!TYPE_UNSIGNED (typex))
+	  typex = unsigned_type_for (typex);
 	return convert (type,
 			fold_build1 (ex_form, typex,
 	 convert (typex,


[PATCH] gcc.dg/tree-ssa/ cleanup

2014-10-02 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/tree-ssa/ directory.
It is quite large, but trivial - mostly only missing declarations
and defaulting to int.  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.

Ok for trunk?

2014-10-02  Marek Polacek  

* gcc.dg/tree-ssa/20030530-2.c: Add function declarations.
* gcc.dg/tree-ssa/20030708-1.c: Likewise.
* gcc.dg/tree-ssa/20030709-2.c: Likewise.
* gcc.dg/tree-ssa/20030710-1.c: Likewise.
* gcc.dg/tree-ssa/20030711-1.c: Likewise.
* gcc.dg/tree-ssa/20030711-2.c: Likewise.
* gcc.dg/tree-ssa/20030711-3.c: Likewise.
* gcc.dg/tree-ssa/20030728-1.c: Likewise.
* gcc.dg/tree-ssa/20030731-1.c: Likewise.
* gcc.dg/tree-ssa/20030731-2.c: Likewise.
* gcc.dg/tree-ssa/20030807-1.c: Likewise.
* gcc.dg/tree-ssa/20030807-3.c: Likewise.
* gcc.dg/tree-ssa/20030807-7.c: Likewise.
* gcc.dg/tree-ssa/20030807-9.c: Likewise.
* gcc.dg/tree-ssa/20030814-2.c: Likewise.
* gcc.dg/tree-ssa/20030814-3.c: Likewise.
* gcc.dg/tree-ssa/20030814-4.c: Likewise.
* gcc.dg/tree-ssa/20030814-5.c: Likewise.
* gcc.dg/tree-ssa/20030820-1.c: Likewise.
* gcc.dg/tree-ssa/20030820-2.c: Likewise.
* gcc.dg/tree-ssa/20030821-1.c: Likewise.
* gcc.dg/tree-ssa/20030917-1.c: Likewise.
* gcc.dg/tree-ssa/20030917-2.c: Likewise.
* gcc.dg/tree-ssa/20031022-1.c: Likewise.
* gcc.dg/tree-ssa/20040209-1.c: Likewise.
* gcc.dg/tree-ssa/20040211-1.c: Likewise.
* gcc.dg/tree-ssa/alias-13.c: Likewise.
* gcc.dg/tree-ssa/alias-28.c: Likewise.
* gcc.dg/tree-ssa/asm-3.c: Likewise.
* gcc.dg/tree-ssa/coalesce-1.c: Likewise.
* gcc.dg/tree-ssa/foldstring-1.c: Likewise.
* gcc.dg/tree-ssa/forwprop-25.c: Likewise.
* gcc.dg/tree-ssa/forwprop-26.c: Likewise.
* gcc.dg/tree-ssa/isolate-3.c: Likewise.
* gcc.dg/tree-ssa/isolate-5.c: Likewise.
* gcc.dg/tree-ssa/loadpre7.c: Likewise.
* gcc.dg/tree-ssa/pr22117.c: Likewise.
* gcc.dg/tree-ssa/pr23744.c: Likewise.
* gcc.dg/tree-ssa/pr24117.c: Likewise.
* gcc.dg/tree-ssa/pr24840.c: Likewise.
* gcc.dg/tree-ssa/pr25734.c: Likewise.
* gcc.dg/tree-ssa/pr33723.c: Likewise.
* gcc.dg/tree-ssa/pr33920.c: Likewise.
* gcc.dg/tree-ssa/pr34146-2.c: Likewise.
* gcc.dg/tree-ssa/pr34146.c: Likewise.
* gcc.dg/tree-ssa/pr38385.c: Likewise.
* gcc.dg/tree-ssa/pr49642-1.c: Likewise.
* gcc.dg/tree-ssa/pr49642-2.c: Likewise.
* gcc.dg/tree-ssa/pr59597.c: Likewise.
* gcc.dg/tree-ssa/sra-1.c: Likewise.
* gcc.dg/tree-ssa/sra-2.c: Likewise.
* gcc.dg/tree-ssa/sra-5.c: Likewise.
* gcc.dg/tree-ssa/sra-6.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-10.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-31.c: Likewise.
* gcc.dg/tree-ssa/ssa-dom-thread-4.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-14.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-29.c: Likewise.
* gcc.dg/tree-ssa/ssa-vrp-thread-1.c: Likewise.
* gcc.dg/tree-ssa/vrp46.c: Likewise.
* gcc.dg/tree-ssa/vrp56.c: Likewise.
* gcc.dg/tree-ssa/vrp67.c: Likewise.
* gcc.dg/tree-ssa/vrp72.c: Likewise.
* gcc.dg/tree-ssa/vrp73.c: Likewise.
* gcc.dg/tree-ssa/vrp75.c: Likewise.
* gcc.dg/tree-ssa/20030611-1.c: Fix defaulting to int.
* gcc.dg/tree-ssa/20030703-1.c: Likewise.
* gcc.dg/tree-ssa/20030729-1.c: Likewise.
* gcc.dg/tree-ssa/20030807-11.c: Likewise.
* gcc.dg/tree-ssa/20030917-3.c: Likewise.
* gcc.dg/tree-ssa/20040121-1.c: Likewise.
* gcc.dg/tree-ssa/20040216-1.c: Likewise.
* gcc.dg/tree-ssa/20040302-1.c: Likewise.
* gcc.dg/tree-ssa/20040319-1.c: Likewise.
* gcc.dg/tree-ssa/20040326-2.c: Likewise.
* gcc.dg/tree-ssa/20040729-1.c: Likewise.
* gcc.dg/tree-ssa/attr-alias-2.c: Likewise.
* gcc.dg/tree-ssa/cunroll-1.c: Likewise.
* gcc.dg/tree-ssa/cunroll-3.c: Likewise.
* gcc.dg/tree-ssa/cunroll-5.c: Likewise.
* gcc.dg/tree-ssa/foldconst-4.c: Likewise.
* gcc.dg/tree-ssa/foldconst-5.c: Likewise.
* gcc.dg/tree-ssa/ifc-4.c: Likewise.
* gcc.dg/tree-ssa/ifc-6.c: Likewise.
* gcc.dg/tree-ssa/inline-10.c: Likewise.
* gcc.dg/tree-ssa/inline-9.c: Likewise.
* gcc.dg/tree-ssa/ipa-cp-1.c: Likewise.
* gcc.dg/tree-ssa/ipa-split-5.c: Likewise.
* gcc.dg/tree-ssa/local-pure-const.c: Likewise.
* gcc.dg/tree-ssa/nonzero-1.c: Likewise.
* gcc.dg/tree-ssa/pr23434.c: Likewise.
* gcc.dg/tree-ssa/pr33922.c: Likewise.
* gcc.dg/t

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

2014-10-02 Thread Markus Trippelsdorf
On 2014.10.02 at 09:17 +0200, Markus Trippelsdorf wrote:
> On 2014.09.26 at 16:31 -0400, Vladimir Makarov 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

-- 
Markus
void printf(...);
class A;
template 
class B;
class C {
 public:
  template 
  C(S);
};
template 
class D {
 public:
  void m_fn1(int);
};

template <>
class B : public D {};

typedef bool (*JSNative)(int *, unsigned, A *);
class F {
 public:
  B m_fn2();
};
struct G {
  JSNative a;
};
struct H {
  H(int, int, int);
};
class I {
 public:
  int m_fn3();
};
class J {
 public:
  enum Result {};
  H helpOption;
  int usage;
  int ver;
  int descr;
  int descrWidth;
  int helpWidth;
  int nextArgument;
  int restArgument;
  J(int)
  : helpOption('h', 0, 0),
usage(ver),
descr(descrWidth),
helpWidth(nextArgument),
restArgument() {}
  Result m_fn4();
  int m_fn5();
};

class OffThreadState {
 public:
  int m_fn6();
} d;
int f, h;
long PRMJ_Now();
static void RunFile(C) {
  long a = PRMJ_Now();
  printf(double(a) / 0);
}

static void Process(int, int) { RunFile(0); }

bool Now(int *, unsigned, A *) {
  F b;
  double c = PRMJ_Now();
  b.m_fn2().m_fn1(c);
}

int InitWatchdog();
G e{Now};
static int Shell() {
  I g;
  if (g.m_fn3()) Process(0, 0);
  if (f) Process(0, 0);
}

main() {
  J i(0);
  switch (i.m_fn4())
  case 0:
  return 0;
  if (i.m_fn5()) return 0;
  if (h) return 0;
  if (d.m_fn6()) return 0;
  if (InitWatchdog()) return 0;
  Shell();
}


Re: [PATCH] gcc.dg/tree-ssa/ cleanup

2014-10-02 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 01:30:21PM +0200, Marek Polacek wrote:
> This patch is a cleanup of tests in gcc.dg/tree-ssa/ directory.
> It is quite large, but trivial - mostly only missing declarations
> and defaulting to int.  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.
> 
> Ok for trunk?

Wouldn't it be worthwhile to avoid such changes for dozen or two randomly
selected testcases from these and instead add -std=gnu89 for them?
Just making sure we don't get rid of all the tests for non-prototyped call
and/or defaulting to int.

Jakub


Re: [PATCH] Implement -fsanitize=object-size

2014-10-02 Thread Jakub Jelinek
On Thu, Sep 11, 2014 at 07:47:51PM +0200, Marek Polacek wrote:
> So, how does this look now?

Looks much better.

There are some nits I'd change, like:
1) no need not to handle bitfields
2) IMHO it should handle PARM_DECL and RESULT_DECL alongside of VAR_DECL
3) decl_p IMHO should use just DECL_P
4) it doesn't make sense to build ADDR_EXPR if you are never going to use
   it

Attaching some (incomplete) testcase I've used to look at the
implementation, e.g. f1 is for testing how it plays together with
-fsanitize=bounds (perhaps, maybe as a follow-up, we could optimize by
looking for UBSAN_BOUNDS call with expected arguments in a few statements
before array access (e.g. remember last UBSAN_BOUNDS seen in the same
basic block) if inner is DECL_P), f2 to show a case which -fsanitize=bounds
doesn't instrument, but -fsanitize=object-size should, f3/f4 the same with
PARM_DECL, f5/f6 unsuccessful attempt for RESULT_DECL, f7/f8 bitfield
tests, f9 something where __bos is folded very early (already before objsz1
pass), f10 where __bos is folded during objsz1 pass.
If you want to turn parts of that testcase into real /ubsan/ tests, go
ahead.  Other than that, if you are fine with following changes, can you
incorporate them into the patch and retest?

Thanks.

--- gcc/ubsan.c.jj  2014-10-02 12:26:30.0 +0200
+++ gcc/ubsan.c 2014-10-02 12:57:40.131267225 +0200
@@ -1421,11 +1421,21 @@ instrument_object_size (gimple_stmt_iter
 
   switch (TREE_CODE (t))
 {
-case ARRAY_REF:
 case COMPONENT_REF:
+  if (TREE_CODE (t) == COMPONENT_REF
+ && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1)) != NULL_TREE)
+   {
+ tree repr = DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1));
+ t = build3 (COMPONENT_REF, TREE_TYPE (repr), TREE_OPERAND (t, 0),
+ repr, NULL_TREE);
+   }
+  break;
+case ARRAY_REF:
 case INDIRECT_REF:
 case MEM_REF:
 case VAR_DECL:
+case PARM_DECL:
+case RESULT_DECL:
   break;
 default:
   return;
@@ -1446,8 +1456,7 @@ instrument_object_size (gimple_stmt_iter
   || bitsize != size_in_bytes * BITS_PER_UNIT)
 return;
 
-  bool decl_p = VAR_P (inner) || TREE_CODE (inner) == PARM_DECL
-   || TREE_CODE (inner) == RESULT_DECL;
+  bool decl_p = DECL_P (inner);
   tree base = decl_p ? inner : TREE_OPERAND (inner, 0);
   tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t);
 
@@ -1464,14 +1473,15 @@ instrument_object_size (gimple_stmt_iter
break;
 }
 
-  if (!POINTER_TYPE_P (TREE_TYPE (base)) && !VAR_P (base))
+  if (!POINTER_TYPE_P (TREE_TYPE (base)) && !DECL_P (base))
 return;
 
   tree sizet;
-  tree base_addr = build1 (ADDR_EXPR,
-  build_pointer_type (TREE_TYPE (base)), base);
-  unsigned HOST_WIDE_INT size = compute_builtin_object_size (decl_p ? base_addr
-   : base, 0);
+  tree base_addr = base;
+  if (decl_p)
+base_addr = build1 (ADDR_EXPR,
+   build_pointer_type (TREE_TYPE (base)), base);
+  unsigned HOST_WIDE_INT size = compute_builtin_object_size (base_addr, 0);
   if (size != (unsigned HOST_WIDE_INT) -1)
 sizet = build_int_cst (sizetype, size);
   else if (optimize)
@@ -1479,7 +1489,7 @@ instrument_object_size (gimple_stmt_iter
   /* Generate __builtin_object_size call.  */
   sizet = builtin_decl_explicit (BUILT_IN_OBJECT_SIZE);
   
-  sizet = build_call_expr_loc (loc, sizet, 2, decl_p ? base_addr : base,
+  sizet = build_call_expr_loc (loc, sizet, 2, base_addr,
   integer_zero_node);
   sizet = force_gimple_operand_gsi (gsi, sizet, false, NULL_TREE, true,
GSI_SAME_STMT);
@@ -1492,8 +1502,7 @@ instrument_object_size (gimple_stmt_iter
   /* ptr + sizeof (*ptr) - base */
   t = fold_build2 (MINUS_EXPR, sizetype,
   fold_convert (pointer_sized_int_node, ptr),
-  fold_convert (pointer_sized_int_node,
-decl_p ? base_addr : base));
+  fold_convert (pointer_sized_int_node, base_addr));
   t = fold_build2 (PLUS_EXPR, sizetype, t, TYPE_SIZE_UNIT (type));
 
   /* Perhaps we can omit the check.  */


Jakub
struct T { char d[8]; int e; };
struct T t = { "abcdefg", 1 };
#ifdef __cplusplus
struct C { C () : d("abcdefg"), e(1) {} C (const C &x) { __builtin_memcpy (d, 
x.d, 8); e = x.e; } ~C () {} char d[8]; int e; };
#endif
struct U { int a : 5; int b : 19; int c : 8; };
struct S { struct U d[10]; };
struct S s;

int
f1 (int i)
{
  return t.d[i];
}

int
f2 (int i)
{
  char *p = t.d;
  p += i;
  return *p;
}

int
f3 (struct T x, int i)
{
  return x.d[i];
}

int
f4 (struct T x, int i)
{
  char *p = x.d;
  p += i;
  return *p;
}

#ifdef __cplusplus
struct C
f5 (int i)
{
  struct C x;
  x.d[i] = 'z';
  return x;
}

struct C
f6 (int i)
{
  struct C x;
  char *p = x

Re: [C++ Patch/RFC] PR 53025

2014-10-02 Thread Paolo Carlini

Hi,

On 10/02/2014 05:22 AM, Jason Merrill wrote:

On 10/01/2014 12:31 PM, Paolo Carlini wrote:

in this issue Daniel argued that the value of a noexcept expression
should not depend on constructor elision.


I'm open to that, but I don't think it's at all clear in the standard.
Ok. Personally, I find the analysis in the audit trail rather 
convincing. In practice, clang++ definitely agrees, likewise 
SolarisStudio. Current EDG seems inconsistent, the templated and 
non-templated cases are handled differently.



Then, in the audit trail Marc
tentatively suggested something like the parser.c hunk below, which just
disables our -felide-constructors optimization when parsing the noexcept
expression. Over the last couple of days, I had a look, noticed that in
any case we still have to handle templates, thus the pt.c hunk, and also
that maybe we can avoid completely disabling -felide-constructors in
noexcept expressions when we know for sure that the constructor at issue
doen't throw: for that in call.s I'm further abusing the
flag_elide_constructors global, in terms of using a special value of 2
when flag_elide_constructor is found == 1 when handling the expression.
The below passes testing, anyway.


Why do we want to avoid completely disabling -felide-constructors, 
since it's an unevaluated context anyway?

Agreed.
If you're going to mess with this flag you need to save/restore it in 
push/pop_to_top_level as well.
I see. But then if we have to do take care of that I find much more 
clean to just add a global?!? In any case, if I understand correctly the 
logic at the end of push_to_top_level, it would be tricky to reset the 
flag to a sensible value (by default would be 1, but the user may have 
passed -fno-elide-constructors on the command line).


The below passes testing.

Thanks!
Paolo.


Index: cp/call.c
===
--- cp/call.c   (revision 215797)
+++ cp/call.c   (working copy)
@@ -7251,7 +7251,11 @@ build_over_call (struct z_candidate *cand, int fla
 /* Do things the hard way.  */;
   else if (cand->num_convs == 1 
&& (DECL_COPY_CONSTRUCTOR_P (fn) 
-   || DECL_MOVE_CONSTRUCTOR_P (fn)))
+   || DECL_MOVE_CONSTRUCTOR_P (fn))
+  /* It's unsafe to elide the constructor when handling
+ a noexcept-expression, it may evaluate to the wrong
+ value (c++/53025).  */
+  && cp_noexcept_operand == 0)
 {
   tree targ;
   tree arg = argarray[num_artificial_parms_for (fn)];
Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 215797)
+++ cp/cp-tree.h(working copy)
@@ -1058,6 +1058,7 @@ struct GTY(()) saved_scope {
 
   int unevaluated_operand;
   int inhibit_evaluation_warnings;
+  int noexcept_operand;
   /* If non-zero, implicit "omp declare target" attribute is added into the
  attribute lists.  */
   int omp_declare_target_attribute;
@@ -4399,6 +4400,10 @@ extern int comparing_specializations;
 
 extern int cp_unevaluated_operand;
 
+/* Nonzero if we are parsing the operand of a noexcept operator.  */
+
+extern int cp_noexcept_operand;
+
 /* in pt.c  */
 
 /* These values are used for the `STRICT' parameter to type_unification and
Index: cp/name-lookup.c
===
--- cp/name-lookup.c(revision 215797)
+++ cp/name-lookup.c(working copy)
@@ -6139,6 +6139,7 @@ push_to_top_level (void)
   s->function_decl = current_function_decl;
   s->unevaluated_operand = cp_unevaluated_operand;
   s->inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
+  s->noexcept_operand = cp_noexcept_operand;
   s->x_stmt_tree.stmts_are_full_exprs_p = true;
 
   scope_chain = s;
@@ -6149,6 +6150,7 @@ push_to_top_level (void)
   push_class_stack ();
   cp_unevaluated_operand = 0;
   c_inhibit_evaluation_warnings = 0;
+  cp_noexcept_operand = 0;
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
 }
 
@@ -6182,6 +6184,7 @@ pop_from_top_level_1 (void)
   current_function_decl = s->function_decl;
   cp_unevaluated_operand = s->unevaluated_operand;
   c_inhibit_evaluation_warnings = s->inhibit_evaluation_warnings;
+  cp_noexcept_operand = s->noexcept_operand;
 }
 
 /* Wrapper for pop_from_top_level_1.  */
Index: cp/parser.c
===
--- cp/parser.c (revision 215797)
+++ cp/parser.c (working copy)
@@ -259,6 +259,9 @@ static FILE *cp_lexer_debug_stream;
sizeof, typeof, or alignof.  */
 int cp_unevaluated_operand;
 
+/* Nonzero if we are parsing the operand of a noexcept operator.  */
+int cp_noexcept_operand;
+
 /* Dump up to NUM tokens in BUFFER to FILE starting with token
START_TOKEN.  If START_TOKEN is NULL, the dump starts with the
first token in BUFFER.  If NUM is 0, dump all the tokens.  If
@@ -7156,7 +7159,9 @@ cp_parser_unary_expression (cp_parser *pa

Re: [PATCH] gcc.dg/tree-ssa/ cleanup

2014-10-02 Thread Marek Polacek
On Thu, Oct 02, 2014 at 01:34:20PM +0200, Jakub Jelinek wrote:
> Wouldn't it be worthwhile to avoid such changes for dozen or two randomly
> selected testcases from these and instead add -std=gnu89 for them?
> Just making sure we don't get rid of all the tests for non-prototyped call
> and/or defaulting to int.

Yeah, probably, thanks.

The following uses -std=gnu89 for ~15 tests.

2014-10-02  Marek Polacek  

* gcc.dg/tree-ssa/20030731-1.c: Use -std=gnu89.
* gcc.dg/tree-ssa/20030729-1.c: Likewise.
* gcc.dg/tree-ssa/20030807-8.c: Likewise.
* gcc.dg/tree-ssa/20040326-1.c: Likewise.
* gcc.dg/tree-ssa/vrp27.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise.
* gcc.dg/tree-ssa/ssa-dom-thread-4.c: Likewise.
* gcc.dg/tree-ssa/20040302-1.c: Likewise.
* gcc.dg/tree-ssa/vrp09.c: Likewise.
* gcc.dg/tree-ssa/inline-7.c: Likewise.
* gcc.dg/tree-ssa/attr-alias.c: Likewise.
* gcc.dg/tree-ssa/loadpre8.c: Likewise.
* gcc.dg/tree-ssa/20041008-1.c: Likewise.
* gcc.dg/tree-ssa/20030917-1.c: Likewise.
* gcc.dg/tree-ssa/20030917-2.c: Likewise.
* gcc.dg/tree-ssa/20030530-2.c: Add function declarations.
* gcc.dg/tree-ssa/20030708-1.c: Likewise.
* gcc.dg/tree-ssa/20030709-2.c: Likewise.
* gcc.dg/tree-ssa/20030710-1.c: Likewise.
* gcc.dg/tree-ssa/20030711-1.c: Likewise.
* gcc.dg/tree-ssa/20030711-2.c: Likewise.
* gcc.dg/tree-ssa/20030711-3.c: Likewise.
* gcc.dg/tree-ssa/20030728-1.c: Likewise.
* gcc.dg/tree-ssa/20030731-2.c: Likewise.
* gcc.dg/tree-ssa/20030807-1.c: Likewise.
* gcc.dg/tree-ssa/20030807-3.c: Likewise.
* gcc.dg/tree-ssa/20030807-7.c: Likewise.
* gcc.dg/tree-ssa/20030807-9.c: Likewise.
* gcc.dg/tree-ssa/20030814-2.c: Likewise.
* gcc.dg/tree-ssa/20030814-3.c: Likewise.
* gcc.dg/tree-ssa/20030814-4.c: Likewise.
* gcc.dg/tree-ssa/20030814-5.c: Likewise.
* gcc.dg/tree-ssa/20030820-1.c: Likewise.
* gcc.dg/tree-ssa/20030820-2.c: Likewise.
* gcc.dg/tree-ssa/20030821-1.c: Likewise.
* gcc.dg/tree-ssa/20031022-1.c: Likewise.
* gcc.dg/tree-ssa/20040209-1.c: Likewise.
* gcc.dg/tree-ssa/20040211-1.c: Likewise.
* gcc.dg/tree-ssa/alias-13.c: Likewise.
* gcc.dg/tree-ssa/alias-28.c: Likewise.
* gcc.dg/tree-ssa/asm-3.c: Likewise.
* gcc.dg/tree-ssa/coalesce-1.c: Likewise.
* gcc.dg/tree-ssa/foldstring-1.c: Likewise.
* gcc.dg/tree-ssa/forwprop-25.c: Likewise.
* gcc.dg/tree-ssa/forwprop-26.c: Likewise.
* gcc.dg/tree-ssa/isolate-3.c: Likewise.
* gcc.dg/tree-ssa/isolate-5.c: Likewise.
* gcc.dg/tree-ssa/loadpre7.c: Likewise.
* gcc.dg/tree-ssa/pr22117.c: Likewise.
* gcc.dg/tree-ssa/pr23744.c: Likewise.
* gcc.dg/tree-ssa/pr24117.c: Likewise.
* gcc.dg/tree-ssa/pr24840.c: Likewise.
* gcc.dg/tree-ssa/pr25734.c: Likewise.
* gcc.dg/tree-ssa/pr33723.c: Likewise.
* gcc.dg/tree-ssa/pr33920.c: Likewise.
* gcc.dg/tree-ssa/pr34146-2.c: Likewise.
* gcc.dg/tree-ssa/pr34146.c: Likewise.
* gcc.dg/tree-ssa/pr38385.c: Likewise.
* gcc.dg/tree-ssa/pr49642-1.c: Likewise.
* gcc.dg/tree-ssa/pr49642-2.c: Likewise.
* gcc.dg/tree-ssa/pr59597.c: Likewise.
* gcc.dg/tree-ssa/sra-1.c: Likewise.
* gcc.dg/tree-ssa/sra-2.c: Likewise.
* gcc.dg/tree-ssa/sra-5.c: Likewise.
* gcc.dg/tree-ssa/sra-6.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-10.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-31.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-14.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-29.c: Likewise.
* gcc.dg/tree-ssa/ssa-vrp-thread-1.c: Likewise.
* gcc.dg/tree-ssa/vrp46.c: Likewise.
* gcc.dg/tree-ssa/vrp56.c: Likewise.
* gcc.dg/tree-ssa/vrp67.c: Likewise.
* gcc.dg/tree-ssa/vrp72.c: Likewise.
* gcc.dg/tree-ssa/vrp73.c: Likewise.
* gcc.dg/tree-ssa/vrp75.c: Likewise.
* gcc.dg/tree-ssa/20030611-1.c: Fix defaulting to int.
* gcc.dg/tree-ssa/20030703-1.c: Likewise.
* gcc.dg/tree-ssa/20030807-11.c: Likewise.
* gcc.dg/tree-ssa/20030917-3.c: Likewise.
* gcc.dg/tree-ssa/20040121-1.c: Likewise.
* gcc.dg/tree-ssa/20040216-1.c: Likewise.
* gcc.dg/tree-ssa/20040319-1.c: Likewise.
* gcc.dg/tree-ssa/20040326-2.c: Likewise.
* gcc.dg/tree-ssa/20040729-1.c: Likewise.
* gcc.dg/tree-ssa/attr-alias-2.c: Likewise.
* gcc.dg/tree-ssa/cunroll-1.c: Likewise.
* gcc.dg/tree-ssa/cunroll-3.c: Likewise.
* gcc.dg/tree-ssa/cunroll-5.c: Likewise.
* gcc.dg/tree-ssa/foldconst-4.c: Likewise.
* gcc.dg/tree-ssa/foldconst-5.c: Likewise.
* gcc.dg/tree-ssa/ifc-4.c: Likewise.
* gcc.dg/tree-ssa/ifc-6.c: Likewise.
  

[PATCH] gcc.dg/torture/ cleanup

2014-10-02 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/torture 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/torture/pr24626-2.c: Add function declarations.  Fix
defaulting to int.
* gcc.dg/torture/pr28814.c: Likewise.
* gcc.dg/torture/pr57036-1.c: Likewise.
* gcc.dg/torture/inline-1.c: Add function declarations.
* gcc.dg/torture/pr24626-1.c: Likewise.
* gcc.dg/torture/pr24626-3.c: Likewise.
* gcc.dg/torture/pr25947-1.c: Likewise.
* gcc.dg/torture/pr27409.c: Likewise.
* gcc.dg/torture/pr38948.c: Likewise.
* gcc.dg/torture/pr44807.c: Likewise.
* gcc.dg/torture/pr49603.c: Likewise.
* gcc.dg/torture/pr45865.c: Likewise.
* gcc.dg/torture/pr51071-2.c: Likewise.
* gcc.dg/torture/pr51801.c: Likewise.
* gcc.dg/torture/pr52720.c: Likewise.
* gcc.dg/torture/pr55124.c: Likewise.
* gcc.dg/torture/pr55238.c: Likewise.
* gcc.dg/torture/pr55687.c: Likewise.
* gcc.dg/torture/pr55888.c: Likewise.
* gcc.dg/torture/pr57036-2.c: Likewise.
* gcc.dg/torture/pr57147-3.c: Likewise.
* gcc.dg/torture/pr57584.c: Likewise.
* gcc.dg/torture/pr59993.c: Likewise.
* gcc.dg/torture/pr58079.c: Likewise.
* gcc.dg/torture/va-arg-25.c: Likewise.
* gcc.dg/torture/vector-2.c: Likewise.
* gcc.dg/torture/stackalign/nested-3.c: Likewise.
* gcc.dg/torture/pr31254.c: Fix defaulting to int.
* gcc.dg/torture/pr43781.c: Likewise.
* gcc.dg/torture/pr52912.c: Likewise.
* gcc.dg/torture/pr59139.c: Likewise.
* gcc.dg/torture/pr55890-1.c: Likewise.
* gcc.dg/torture/pr55890-2.c: Likewise.
* gcc.dg/torture/pr59164.c: Likewise.
* gcc.dg/torture/pr57393-2.c: Likewise.
* gcc.dg/torture/stackalign/comp-goto-1.c: Likewise.
* gcc.dg/torture/stackalign/non-local-goto-4.c: Likewise.
* gcc.dg/torture/stackalign/non-local-goto-5.c: Likewise.
* gcc.dg/torture/pr35227.c: Use -std=gnu89.  Fix defaulting to int.
* gcc.dg/torture/stackalign/builtin-apply-4.c: Use -fgnu89-inline.

diff --git gcc/gcc/testsuite/gcc.dg/torture/inline-1.c 
gcc/gcc/testsuite/gcc.dg/torture/inline-1.c
index c7144ca..30bf91e 100644
--- gcc/gcc/testsuite/gcc.dg/torture/inline-1.c
+++ gcc/gcc/testsuite/gcc.dg/torture/inline-1.c
@@ -4,6 +4,7 @@
and the eh info. */
 /* PR tree-opt/30385 */
 
+int f (void);
 static inline void g(int t)
 {
  int a;
diff --git gcc/gcc/testsuite/gcc.dg/torture/pr24626-1.c 
gcc/gcc/testsuite/gcc.dg/torture/pr24626-1.c
index 331c55e..eb04795 100644
--- gcc/gcc/testsuite/gcc.dg/torture/pr24626-1.c
+++ gcc/gcc/testsuite/gcc.dg/torture/pr24626-1.c
@@ -2,6 +2,8 @@
 
 typedef long
 (*bla)(int *node);
+void T(int *);
+long F3(void *);
 
 static long F2(void *tree, long blk, bla after_node_func)
 {
diff --git gcc/gcc/testsuite/gcc.dg/torture/pr24626-2.c 
gcc/gcc/testsuite/gcc.dg/torture/pr24626-2.c
index e48d3b3..541c8c5 100644
--- gcc/gcc/testsuite/gcc.dg/torture/pr24626-2.c
+++ gcc/gcc/testsuite/gcc.dg/torture/pr24626-2.c
@@ -22,7 +22,12 @@ typedef enum { MU_REMOVE, MU_RENAME, MU_OPEN } mu_action;
 typedef struct __dbpginfo {
 u_int8_t type;
 } PAGE;
+int __db_cursor ();
+int __memp_fget ();
+int __db_free ();
+int __db_c_close ();
 int __db_master_update(mdbp, sdbp, txn, subdb, type, action, newname, flags)
+  int txn, subdb, type, action, newname, flags;
   DB *mdbp, *sdbp;
 {
 DB_ENV *dbenv;
diff --git gcc/gcc/testsuite/gcc.dg/torture/pr24626-3.c 
gcc/gcc/testsuite/gcc.dg/torture/pr24626-3.c
index 7780682..41decab 100644
--- gcc/gcc/testsuite/gcc.dg/torture/pr24626-3.c
+++ gcc/gcc/testsuite/gcc.dg/torture/pr24626-3.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 
 long fff(int*);
+void T(int*);
 
 long F2(int *node)
 {
diff --git gcc/gcc/testsuite/gcc.dg/torture/pr25947-1.c 
gcc/gcc/testsuite/gcc.dg/torture/pr25947-1.c
index 8af6f8d..89d1ed0 100644
--- gcc/gcc/testsuite/gcc.dg/torture/pr25947-1.c
+++ gcc/gcc/testsuite/gcc.dg/torture/pr25947-1.c
@@ -6,6 +6,7 @@ extern char *rl_line_buffer;
 extern int rl_point;
 extern int rl_end;
 static const char *vi_motion = " hl^$0ftFT;,%wbeWBE|";
+void rl_vi_end_word (int, int);
 void
 rl_vi_complete (int ignore, int key)
 {
diff --git gcc/gcc/testsuite/gcc.dg/torture/pr27409.c 
gcc/gcc/testsuite/gcc.dg/torture/pr27409.c
index 430e6c8..4bfae43 100644
--- gcc/gcc/testsuite/gcc.dg/torture/pr27409.c
+++ gcc/gcc/testsuite/gcc.dg/torture/pr27409.c
@@ -10,6 +10,7 @@ struct {
 int g;
 } my_struct;
 
+void foo (thang_t *);
 void function(int blaz)
 {
   thang_t *fp = &my_struct.f;
diff --git gcc/gcc/testsuite/gcc.dg/torture/pr28814.c 
gcc/gcc/testsuite/gcc.dg/torture/pr28814.c
index cc3c9f6..d896b43 100644
--- gcc/gcc/te

[PATCH] gcc.dg/tm/ cleanup

2014-10-02 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/tm/ 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/tm/20091013.c: Fix defaulting to int.
* gcc.dg/tm/20091221.c: Likewise.
* gcc.dg/tm/debug-1.c: Likewise.
* gcc.dg/tm/irrevocable-1.c: Likewise.
* gcc.dg/tm/irrevocable-2.c: Likewise.
* gcc.dg/tm/irrevocable-3.c: Likewise.
* gcc.dg/tm/irrevocable-4.c: Likewise.
* gcc.dg/tm/memopt-1.c: Likewise.
* gcc.dg/tm/pr52173-1.c: Likewise.
* gcc.dg/tm/props-1.c: Likewise.
* gcc.dg/tm/props-2.c: Likewise.
* gcc.dg/tm/props-3.c: Likewise.
* gcc.dg/tm/20100125.c: Fix implicit declarations.
* gcc.dg/tm/memopt-11.c: Likewise.
* gcc.dg/tm/memopt-12.c: Likewise.
* gcc.dg/tm/memopt-16.c: Likewise.
* gcc.dg/tm/memopt-3.c: Likewise.
* gcc.dg/tm/memopt-4.c: Likewise.
* gcc.dg/tm/memopt-5.c: Likewise.
* gcc.dg/tm/memopt-6.c: Likewise.
* gcc.dg/tm/wrap-4.c: Likewise.

diff --git gcc/gcc/testsuite/gcc.dg/tm/20091013.c 
gcc/gcc/testsuite/gcc.dg/tm/20091013.c
index d9b3b0e..3c67a82 100644
--- gcc/gcc/testsuite/gcc.dg/tm/20091013.c
+++ gcc/gcc/testsuite/gcc.dg/tm/20091013.c
@@ -4,6 +4,7 @@
 extern long ringo(long int);
 int g,i;
 
+void
 f()
 {
   __transaction_relaxed {
diff --git gcc/gcc/testsuite/gcc.dg/tm/20091221.c 
gcc/gcc/testsuite/gcc.dg/tm/20091221.c
index 1d75d15..4751f2b 100644
--- gcc/gcc/testsuite/gcc.dg/tm/20091221.c
+++ gcc/gcc/testsuite/gcc.dg/tm/20091221.c
@@ -4,6 +4,7 @@
 int i;
 extern void virgin () __attribute__((transaction_pure));
 
+void
 foo()
 {
__transaction_atomic {
diff --git gcc/gcc/testsuite/gcc.dg/tm/20100125.c 
gcc/gcc/testsuite/gcc.dg/tm/20100125.c
index 3f1dd10..3b3d2b9 100644
--- gcc/gcc/testsuite/gcc.dg/tm/20100125.c
+++ gcc/gcc/testsuite/gcc.dg/tm/20100125.c
@@ -3,6 +3,7 @@
 
 /* Test that the call to george() doesn't end up inside the transaction.  */
 
+void george (void);
 int trxn;
 
 void set_remove(int * val)
diff --git gcc/gcc/testsuite/gcc.dg/tm/debug-1.c 
gcc/gcc/testsuite/gcc.dg/tm/debug-1.c
index 01acfae..bccc0b3 100644
--- gcc/gcc/testsuite/gcc.dg/tm/debug-1.c
+++ gcc/gcc/testsuite/gcc.dg/tm/debug-1.c
@@ -5,11 +5,11 @@
 
 int a,b, c, z;
 
-testing(){
+void testing(){
 c=9;
 }
 
-main() {
+int main() {
b = 9898;
__transaction_relaxed {
z = c;
diff --git gcc/gcc/testsuite/gcc.dg/tm/irrevocable-1.c 
gcc/gcc/testsuite/gcc.dg/tm/irrevocable-1.c
index 60f6291..9f9fe3a 100644
--- gcc/gcc/testsuite/gcc.dg/tm/irrevocable-1.c
+++ gcc/gcc/testsuite/gcc.dg/tm/irrevocable-1.c
@@ -4,8 +4,9 @@
 int global;
 int george;
 
-extern crap() __attribute__((transaction_unsafe));
+extern void crap() __attribute__((transaction_unsafe));
 
+void
 foo()
 {
__transaction_relaxed {
diff --git gcc/gcc/testsuite/gcc.dg/tm/irrevocable-2.c 
gcc/gcc/testsuite/gcc.dg/tm/irrevocable-2.c
index 17ac8a5..9b1127f 100644
--- gcc/gcc/testsuite/gcc.dg/tm/irrevocable-2.c
+++ gcc/gcc/testsuite/gcc.dg/tm/irrevocable-2.c
@@ -7,6 +7,7 @@
 int global;
 int george;
 
+void
 foo()
 {
__transaction_relaxed {
diff --git gcc/gcc/testsuite/gcc.dg/tm/irrevocable-3.c 
gcc/gcc/testsuite/gcc.dg/tm/irrevocable-3.c
index fdf3e52..9a9903c 100644
--- gcc/gcc/testsuite/gcc.dg/tm/irrevocable-3.c
+++ gcc/gcc/testsuite/gcc.dg/tm/irrevocable-3.c
@@ -3,6 +3,7 @@
 
 extern void bar(void) __attribute__((transaction_callable));
 
+void
 foo()
 {
__transaction_relaxed {
diff --git gcc/gcc/testsuite/gcc.dg/tm/irrevocable-4.c 
gcc/gcc/testsuite/gcc.dg/tm/irrevocable-4.c
index 72075df..ee48f82 100644
--- gcc/gcc/testsuite/gcc.dg/tm/irrevocable-4.c
+++ gcc/gcc/testsuite/gcc.dg/tm/irrevocable-4.c
@@ -4,7 +4,7 @@
 void orig(void);
 void xyz(void) __attribute__((transaction_wrap (orig)));
 
-
+void
 foo()
 {
__transaction_relaxed {
diff --git gcc/gcc/testsuite/gcc.dg/tm/memopt-1.c 
gcc/gcc/testsuite/gcc.dg/tm/memopt-1.c
index c5ac5ce..ac88ebd 100644
--- gcc/gcc/testsuite/gcc.dg/tm/memopt-1.c
+++ gcc/gcc/testsuite/gcc.dg/tm/memopt-1.c
@@ -2,10 +2,11 @@
 /* { dg-options "-fgnu-tm -O -fdump-tree-tmmemopt" } */
 
 long g, xxx, yyy;
-extern george() __attribute__((transaction_safe));
-extern ringo(long int) __attribute__((transaction_safe));
+extern void george() __attribute__((transaction_safe));
+extern void ringo(long int) __attribute__((transaction_safe));
 int i;
 
+void
 f()
 {
   __transaction_relaxed {
diff --git gcc/gcc/testsuite/gcc.dg/tm/memopt-11.c 
gcc/gcc/testsuite/gcc.dg/tm/memopt-11.c
index 36aa664..0c96f0e 100644
--- gcc/gcc/testsuite/gcc.dg/tm/memopt-11.c
+++ gcc/gcc/testsuite/gcc.dg/tm/memopt-11.c
@@ -3,6 +3,7 @@
 
 extern int something(void) __attribute__((transaction_safe));
 extern void *malloc (__SIZE_TYPE__) __att

[PATCH, i386, Pointer Bounds Checker 38/x] Avoid warning for missed IPA_REF_CHKP in switch

2014-10-02 Thread Ilya Enkovich
Hi,

Seems some new warnings appeared lately and now I see a bootstrap failure for 
mpx branch due to missing IPA_REF_CHKP case in switch statement in 
process_references function.  This function handles varpool_nodes which cannot 
have references of this kind.  This patch fixes a warning.

Thanks,
Ilya
--
2014-10-01  Ilya Enkovich  

* ipa.c (process_references): Support IPA_REF_CHKP.


diff --git a/gcc/ipa.c b/gcc/ipa.c
index 39ee815..78f251a 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -637,6 +637,8 @@ process_references (varpool_node *vnode,
process_references (dyn_cast (ref->referring), written,
address_taken, read, explicit_refs);
break;
+  case IPA_REF_CHKP:
+   gcc_unreachable ();
   }
 }
 


Re: [PATCH, i386, Pointer Bounds Checker 38/x] Avoid warning for missed IPA_REF_CHKP in switch

2014-10-02 Thread Marek Polacek
On Thu, Oct 02, 2014 at 05:29:15PM +0400, Ilya Enkovich wrote:
> Hi,
> 
> Seems some new warnings appeared lately and now I see a bootstrap failure for 
> mpx branch due to missing IPA_REF_CHKP case in switch statement in 
> process_references function.  This function handles varpool_nodes which 
> cannot have references of this kind.  This patch fixes a warning.

Yeah, -Wswitch now works even with enum bit-fields, and use in ipa_ref
is an enum bit-fields.

> 2014-10-01  Ilya Enkovich  
> 
>   * ipa.c (process_references): Support IPA_REF_CHKP.
 
Probably s/Support/Handle/.
 
> diff --git a/gcc/ipa.c b/gcc/ipa.c
> index 39ee815..78f251a 100644
> --- a/gcc/ipa.c
> +++ b/gcc/ipa.c
> @@ -637,6 +637,8 @@ process_references (varpool_node *vnode,
>   process_references (dyn_cast (ref->referring), written,
>   address_taken, read, explicit_refs);
>   break;
> +  case IPA_REF_CHKP:
> + gcc_unreachable ();

Looks ok.

Marek


[PING][PATCH] Warn about unclosed pragma omp declare target.

2014-10-02 Thread Ilya Tocar
Ping.
On 15 Aug 16:26, Ilya Tocar wrote:
> Ping.
> 
> On 29 Jul 18:45, Ilya Tocar wrote:
> > Hi,
> > 
> > As discussed here in https://gcc.gnu.org/ml/gcc/2014-01/msg00189.html
> > Gcc should complain about pragma omp declare target without
> > corresponding pragma omp end declare target. This patch adds a warning
> > for those cases.
> > Bootstraps/passes make-check.
> > Ok for trunk?
> > 
> > ChangeLog:
> > 
> > 2014-07-29  Ilya Tocar  
> > 
> > * c-decl.c (omp_declare_target_location_stack): New.
> > * c-lang.h (omp_declare_target_location_stack): Declare.
> > * c-parser.c (warn_unclosed_pragma_omp_target): New.
> > (c_parser_translation_unit): Call it.
> > (c_parser_omp_declare_target): Remeber location.
> > (c_parser_omp_end_declare_target): Forget location.
> > 
> > And ChangeLog for testsuite:
> > 
> > 2014-07-29  Ilya Tocar  
> > 
> > * gcc.dg/gomp//target-3.c: New testcase.
> > 
> > ---
> >  gcc/c/c-decl.c   |  3 +++
> >  gcc/c/c-lang.h   |  3 +++
> >  gcc/c/c-parser.c | 22 +-
> >  gcc/testsuite/gcc.dg/gomp/target-3.c | 33 +
> >  4 files changed, 60 insertions(+), 1 deletion(-)
> >  create mode 100644 gcc/testsuite/gcc.dg/gomp/target-3.c
> > 
> > diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
> > index 2a4b439..2dd5b2c 100644
> > --- a/gcc/c/c-decl.c
> > +++ b/gcc/c/c-decl.c
> > @@ -158,6 +158,9 @@ enum machine_mode c_default_pointer_mode = VOIDmode;
> >  /* If non-zero, implicit "omp declare target" attribute is added into the
> > attribute lists.  */
> >  int current_omp_declare_target_attribute;
> > +
> > +/* Holds locations of currently open "omp declare target" pragmas.  */
> > +vec omp_declare_target_location_stack;
> >  
> >  /* Each c_binding structure describes one binding of an identifier to
> > a decl.  All the decls in a scope - irrespective of namespace - are
> > diff --git a/gcc/c/c-lang.h b/gcc/c/c-lang.h
> > index e974906..cef995c 100644
> > --- a/gcc/c/c-lang.h
> > +++ b/gcc/c/c-lang.h
> > @@ -59,4 +59,7 @@ struct GTY(()) language_function {
> > attribute lists.  */
> >  extern GTY(()) int current_omp_declare_target_attribute;
> >  
> > +/* Holds locations of currently open "omp declare target" pragmas.  */
> > +extern vec omp_declare_target_location_stack;
> > +
> >  #endif /* ! GCC_C_LANG_H */
> > diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
> > index e32bf04..0b96fe9 100644
> > --- a/gcc/c/c-parser.c
> > +++ b/gcc/c/c-parser.c
> > @@ -1255,6 +1255,8 @@ static bool c_parser_cilk_verify_simd (c_parser *, 
> > enum pragma_context);
> >  static tree c_parser_array_notation (location_t, c_parser *, tree, tree);
> >  static tree c_parser_cilk_clause_vectorlength (c_parser *, tree, bool);
> >  
> > +static void warn_unclosed_pragma_omp_target ();
> > +
> >  /* Parse a translation unit (C90 6.7, C99 6.9).
> >  
> > translation-unit:
> > @@ -1290,6 +1292,8 @@ c_parser_translation_unit (c_parser *parser)
> > }
> >while (c_parser_next_token_is_not (parser, CPP_EOF));
> >  }
> > +
> > +  warn_unclosed_pragma_omp_target ();
> >  }
> >  
> >  /* Parse an external declaration (C90 6.7, C99 6.9).
> > @@ -13068,8 +13072,10 @@ c_finish_omp_declare_simd (c_parser *parser, tree 
> > fndecl, tree parms,
> >  static void
> >  c_parser_omp_declare_target (c_parser *parser)
> >  {
> > +  location_t loc = c_parser_peek_token (parser)->location;
> >c_parser_skip_to_pragma_eol (parser);
> >current_omp_declare_target_attribute++;
> > +  omp_declare_target_location_stack.safe_push (loc);
> >  }
> >  
> >  static void
> > @@ -13104,7 +13110,10 @@ c_parser_omp_end_declare_target (c_parser *parser)
> >  error_at (loc, "%<#pragma omp end declare target%> without 
> > corresponding "
> >"%<#pragma omp declare target%>");
> >else
> > -current_omp_declare_target_attribute--;
> > +{
> > +  current_omp_declare_target_attribute--;
> > +  omp_declare_target_location_stack.pop ();
> > +}
> >  }
> >  
> >  
> > @@ -14267,4 +14276,15 @@ c_parser_array_notation (location_t loc, c_parser 
> > *parser, tree initial_index,
> >return value_tree;
> >  }
> >  
> > +static void
> > +warn_unclosed_pragma_omp_target ()
> > +{
> > +  int i;
> > +  for (i = 0; i < current_omp_declare_target_attribute; i++)
> > +warning_at (omp_declare_target_location_stack[i], 0,
> > +   "%<#pragma omp declare target%> without corresponding "
> > +   "%<#pragma omp end declare target%>");
> > +  omp_declare_target_location_stack.release ();
> > +}
> > +
> >  #include "gt-c-c-parser.h"
> > diff --git a/gcc/testsuite/gcc.dg/gomp/target-3.c 
> > b/gcc/testsuite/gcc.dg/gomp/target-3.c
> > new file mode 100644
> > index 000..d50604f
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.dg/gomp/target-3.c
> > @@ -0,0 +1,33 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-fopenmp" } */
> > +
> > +#pragma omp

[PATCH] gcc.dg/vect/ cleanup

2014-10-02 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/vect/ 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/vect/pr24049.c: Fix implicit declarations.
* gcc.dg/vect/pr37730.c: Likewise.
* gcc.dg/vect/pr52870.c: Likewise.
* gcc.dg/vect/pr60092-2.c: Likewise.
* gcc.dg/vect/pr60092.c: Likewise.
* gcc.dg/vect/vect-reduc-sad.c: Likewise.
* gcc.dg/vect/pr26359.c: Fix defaulting to int.
* gcc.dg/vect/pr31041.c: Likewise.
* gcc.dg/vect/pr32216.c: Likewise.
* gcc.dg/vect/pr32224.c: Likewise.
* gcc.dg/vect/pr32366.c: Likewise.
* gcc.dg/vect/pr33866.c: Likewise.
* gcc.dg/vect/pr43430-2.c: Likewise.
* gcc.dg/vect/pr43842.c: Likewise.
* gcc.dg/vect/vect-1.c: Likewise.
* gcc.dg/vect/vect-1-big-array.c: Likewise.
* gcc.dg/vect/vect-93.c: Likewise.
* gcc.dg/vect/pr28952.c: Fix implicit declarations and
defaulting to int.

diff --git gcc/gcc/testsuite/gcc.dg/vect/pr24049.c 
gcc/gcc/testsuite/gcc.dg/vect/pr24049.c
index ee03fe3..a7798bd 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr24049.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr24049.c
@@ -1,6 +1,8 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -ftree-vectorize --param ggc-min-heapsize=0 --param 
ggc-min-expand=0" } */
 
+void unscrunch (unsigned char *, int *);
+
 int DES_CBCUpdate(unsigned char * output, int len)
 {
   int work[2];
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr26359.c 
gcc/gcc/testsuite/gcc.dg/vect/pr26359.c
index 7a0cb0d..cf74388 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr26359.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr26359.c
@@ -4,6 +4,7 @@
 
 int a[256], b[256], c[256];
 
+void
 foo () {
   int i;
 
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr28952.c 
gcc/gcc/testsuite/gcc.dg/vect/pr28952.c
index 7305e60..fb54aed 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr28952.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr28952.c
@@ -15,6 +15,8 @@ struct packet_spaceship_info
 {
   char structure[32 + 1];
 };
+void lsend_packet_spaceship_info (struct packet_spaceship_info *);
+void
 send_spaceship_info (void)
 {
   int j;
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr31041.c 
gcc/gcc/testsuite/gcc.dg/vect/pr31041.c
index 361b358..ad8d119 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr31041.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr31041.c
@@ -9,6 +9,7 @@ struct UNewTrie
   int index[(0x11 >> 1)];
 };
 typedef struct UNewTrie UNewTrie;
+void
 utrie_open_3_4 ()
 {
   UNewTrie *trie;
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr32216.c 
gcc/gcc/testsuite/gcc.dg/vect/pr32216.c
index cf27441..b15f739 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr32216.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr32216.c
@@ -3,6 +3,7 @@
 
 unsigned int wlookup2[203];
 
+void
 SetSoundVariables (int x)
 {
   for (x = 1; x < 32; x++)
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr32224.c 
gcc/gcc/testsuite/gcc.dg/vect/pr32224.c
index 6f3a36b..df9728f 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr32224.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr32224.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 typedef unsigned long int *mp_ptr;
 typedef const unsigned long int *mp_srcptr;
+void
 gmpz_export (void *data)
 {
   mp_srcptr zp;
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr32366.c 
gcc/gcc/testsuite/gcc.dg/vect/pr32366.c
index e83d579..7ea0c97 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr32366.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr32366.c
@@ -3,6 +3,7 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target vect_float } */
 
+void
 stream_test (void)
 {
   static float input[20];
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr33866.c 
gcc/gcc/testsuite/gcc.dg/vect/pr33866.c
index 8adb2e7..c869226 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr33866.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr33866.c
@@ -8,7 +8,7 @@ typedef struct
 }
 fill_iter_info;
 
-extern H5Diterate (fill_iter_info *);
+extern int H5Diterate (fill_iter_info *);
 
 void test_select_fill_hyper_simple (long *offset)
 {
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr37730.c 
gcc/gcc/testsuite/gcc.dg/vect/pr37730.c
index 876f549..1f03584 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr37730.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr37730.c
@@ -1,6 +1,8 @@
 /* PR middle-end/37730 */
 /* { dg-do compile } */
 
+void sdp_seq_alloc (void *);
+
 void
 add_opush (void)
 {
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr43430-2.c 
gcc/gcc/testsuite/gcc.dg/vect/pr43430-2.c
index 16f53da..bc37f11 100644
--- gcc/gcc/testsuite/gcc.dg/vect/pr43430-2.c
+++ gcc/gcc/testsuite/gcc.dg/vect/pr43430-2.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target vect_int } */
 typedef unsigned char uint8_t;
+int
 vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
 {
   int score = 0;
diff --git gcc/gcc/testsuite/gcc.dg/vect/pr43842.c 
gcc/gcc/testsuite/gcc.dg/vect/

Re: [PATCH, i386, Pointer Bounds Checker 38/x] Avoid warning for missed IPA_REF_CHKP in switch

2014-10-02 Thread Ilya Enkovich
On 02 Oct 15:34, Marek Polacek wrote:
> On Thu, Oct 02, 2014 at 05:29:15PM +0400, Ilya Enkovich wrote:
> > Hi,
> > 
> > Seems some new warnings appeared lately and now I see a bootstrap failure 
> > for mpx branch due to missing IPA_REF_CHKP case in switch statement in 
> > process_references function.  This function handles varpool_nodes which 
> > cannot have references of this kind.  This patch fixes a warning.
> 
> Yeah, -Wswitch now works even with enum bit-fields, and use in ipa_ref
> is an enum bit-fields.
> 
> > 2014-10-01  Ilya Enkovich  
> > 
> > * ipa.c (process_references): Support IPA_REF_CHKP.
>  
> Probably s/Support/Handle/.
>  
> > diff --git a/gcc/ipa.c b/gcc/ipa.c
> > index 39ee815..78f251a 100644
> > --- a/gcc/ipa.c
> > +++ b/gcc/ipa.c
> > @@ -637,6 +637,8 @@ process_references (varpool_node *vnode,
> > process_references (dyn_cast (ref->referring), written,
> > address_taken, read, explicit_refs);
> > break;
> > +  case IPA_REF_CHKP:
> > +   gcc_unreachable ();
> 
> Looks ok.
> 
>   Marek

Thanks for looking inot it.  Here is a version with modified ChangeLog.

Ilya
--
2014-10-02  Ilya Enkovich  

* ipa.c (process_references): Handle IPA_REF_CHKP.


diff --git a/gcc/ipa.c b/gcc/ipa.c
index 39ee815..78f251a 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -637,6 +637,8 @@ process_references (varpool_node *vnode,
process_references (dyn_cast (ref->referring), written,
address_taken, read, explicit_refs);
break;
+  case IPA_REF_CHKP:
+   gcc_unreachable ();
   }
 }
 


Re: [PATCH, i386, Pointer Bounds Checker 30/x] Size relocation

2014-10-02 Thread Ilya Enkovich
On 02 Oct 11:49, Uros Bizjak wrote:
> On Thu, Oct 2, 2014 at 10:23 AM, Ilya Enkovich  wrote:
> 
> > 2014-10-01  Ilya Enkovich  
> >
> > * config/i386/i386.md (UNSPEC_SIZEOF): New.
> > (move_size_reloc_): New.
> > * config/i386/predicates.md (symbol_operand): New.
> > (x86_64_immediate_size_operand): New.
> 
> OK with a trivial adjustment.
> 
> Thanks,
> Uros.
> 
> > diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
> > index 65990b1..1901023 100644
> > --- a/gcc/config/i386/i386.md
> > +++ b/gcc/config/i386/i386.md
> > @@ -79,6 +79,7 @@
> >UNSPEC_PLTOFF
> >UNSPEC_MACHOPIC_OFFSET
> >UNSPEC_PCREL
> > +  UNSPEC_SIZEOF
> >
> >;; Prologue support
> >UNSPEC_STACK_ALLOC
> > @@ -18789,6 +18790,21 @@
> >"bndstx\t{%2, %3|%3, %2}"
> >[(set_attr "type" "mpxst")])
> >
> > +(define_insn "move_size_reloc_"
> > +  [(set (match_operand:SWI48 0 "register_operand" "=r")
> > +   (unspec:SWI48
> > +[(match_operand:SWI48 1 "symbol_operand")]
> > +UNSPEC_SIZEOF))]
> > +  "TARGET_MPX"
> > +{
> > +  if (x86_64_immediate_size_operand (operands[1], VOIDmode))
> > +return "mov{l}\t{%1@SIZE, %k0|%k0, %1@SIZE}";
> > +  else
> > +return "movabs{q}\t{%1@SIZE, %0|%0, %1@SIZE}";
> > +}
> > +  [(set_attr "type" "imov")
> > +   (set_attr "mode" "")])
> > +
> >  (include "mmx.md")
> >  (include "sse.md")
> >  (include "sync.md")
> > diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
> > index fea7754..1875339 100644
> > --- a/gcc/config/i386/predicates.md
> > +++ b/gcc/config/i386/predicates.md
> > @@ -124,6 +124,10 @@
> > (match_test "TARGET_64BIT")
> > (match_test "REGNO (op) > BX_REG")))
> >
> > +;; Return true if VALUE is symbol reference
> > +(define_predicate "symbol_operand"
> > +  (match_code "symbol_ref"))
> > +
> >  ;; Return true if VALUE can be stored in a sign extended immediate field.
> >  (define_predicate "x86_64_immediate_operand"
> >(match_code "const_int,symbol_ref,label_ref,const")
> > @@ -336,6 +340,14 @@
> >return false;
> >  })
> >
> > +;; Return true if size of VALUE can be stored in a sign
> > +;; extended immediate field.
> > +(define_predicate "x86_64_immediate_size_operand"
> > +  (and (match_code "symbol_ref")
> > +   (ior (not (match_test "TARGET_64BIT"))
> > +   (ior (match_test ("ix86_cmodel == CM_SMALL"))
> > +(match_test ("ix86_cmodel == CM_KERNEL"))
> 
> Uh yes, I did a trivial thinko. Please note that above (ior) can be
> rewritten with a multiple arguments:
> 
> (define_predicate "x86_64_immediate_size_operand"
>   (and (match_code "symbol_ref")
>(ior (not (match_test "TARGET_64BIT"))
>(match_test "ix86_cmodel == CM_SMALL")
>(match_test "ix86_cmodel == CM_KERNEL"
> 
> Also, there were unneded parenthesis for match_test removed.
> 
> >  ;; Return true if OP is general operand representable on x86_64.
> >  (define_predicate "x86_64_general_operand"
> >(if_then_else (match_test "TARGET_64BIT")

Thanks for comments!  Here is adjusted version.

Ilya
--
2014-10-02  Ilya Enkovich  

* config/i386/i386.md (UNSPEC_SIZEOF): New.
(move_size_reloc_): New.
* config/i386/predicates.md (symbol_operand): New.
(x86_64_immediate_size_operand): New.


diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 65990b1..1901023 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -79,6 +79,7 @@
   UNSPEC_PLTOFF
   UNSPEC_MACHOPIC_OFFSET
   UNSPEC_PCREL
+  UNSPEC_SIZEOF
 
   ;; Prologue support
   UNSPEC_STACK_ALLOC
@@ -18789,6 +18790,21 @@
   "bndstx\t{%2, %3|%3, %2}"
   [(set_attr "type" "mpxst")])
 
+(define_insn "move_size_reloc_"
+  [(set (match_operand:SWI48 0 "register_operand" "=r")
+   (unspec:SWI48
+[(match_operand:SWI48 1 "symbol_operand")]
+UNSPEC_SIZEOF))]
+  "TARGET_MPX"
+{
+  if (x86_64_immediate_size_operand (operands[1], VOIDmode))
+return "mov{l}\t{%1@SIZE, %k0|%k0, %1@SIZE}";
+  else
+return "movabs{q}\t{%1@SIZE, %0|%0, %1@SIZE}";
+}
+  [(set_attr "type" "imov")
+   (set_attr "mode" "")])
+
 (include "mmx.md")
 (include "sse.md")
 (include "sync.md")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index fea7754..3aebe2b 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -124,6 +124,10 @@
(match_test "TARGET_64BIT")
(match_test "REGNO (op) > BX_REG")))
 
+;; Return true if VALUE is symbol reference
+(define_predicate "symbol_operand"
+  (match_code "symbol_ref"))
+
 ;; Return true if VALUE can be stored in a sign extended immediate field.
 (define_predicate "x86_64_immediate_operand"
   (match_code "const_int,symbol_ref,label_ref,const")
@@ -336,6 +340,14 @@
   return false;
 })
 
+;; Return true if size of VALUE can be stored in a sign
+;; extended immediate field.
+(define_predicate "x86_64_immediate_size_operand"
+  (and (match_code

Re: [PATCH, Pointer Bounds Checker 19/x] Support bounds in expand

2014-10-02 Thread Ilya Enkovich
On 24 Sep 12:29, Ilya Enkovich wrote:
> 2014-09-24 0:58 GMT+04:00 Jeff Law :
> > On 06/05/14 08:46, Ilya Enkovich wrote:
> >>
> >> 2014-06-05  Ilya Enkovich  
> >>
> >> * calls.c: Include tree-chkp.h, rtl-chkp.h, bitmap.h.
> >> (arg_data): Add fields special_slot, pointer_arg and
> >> pointer_offset.
> >> (store_bounds): New.
> >> (emit_call_1): Propagate instrumentation flag for CALL.
> >> (initialize_argument_information): Compute pointer_arg,
> >> pointer_offset and special_slot for pointer bounds arguments.
> >> (finalize_must_preallocate): Preallocate when storing bounds
> >> in bounds table.
> >> (compute_argument_addresses): Skip pointer bounds.
> >> (expand_call): Store bounds into tables separately.  Return
> >> result joined with resulting bounds.
> >> * cfgexpand.c: Include tree-chkp.h, rtl-chkp.h.
> >> (expand_call_stmt): Propagate bounds flag for CALL_EXPR.
> >> (expand_return): Add returned bounds arg.  Handle returned bounds.
> >> (expand_gimple_stmt_1): Adjust to new expand_return signature.
> >> (gimple_expand_cfg): Reset rtx bounds map.
> >> * expr.c: Include tree-chkp.h, rtl-chkp.h.
> >> (expand_assignment): Handle returned bounds.
> >> (store_expr_with_bounds): New.  Replaces store_expr with new
> >> bounds
> >> target argument.  Handle bounds returned by calls.
> >> (store_expr): Now wraps store_expr_with_bounds.
> >> * expr.h (store_expr_with_bounds): New.
> >> * function.c: Include tree-chkp.h, rtl-chkp.h.
> >> (bounds_parm_data): New.
> >> (use_register_for_decl): Do not registerize decls used for bounds
> >> stores and loads.
> >> (assign_parms_augmented_arg_list): Add bounds of the result
> >> structure pointer as the second argument.
> >> (assign_parm_find_entry_rtl): Mark bounds are never passed on
> >> the stack.
> >> (assign_parm_is_stack_parm): Likewise.
> >> (assign_parm_load_bounds): New.
> >> (assign_bounds): New.
> >> (assign_parms): Load bounds and determine a location for
> >> returned bounds.
> >> (diddle_return_value_1): New.
> >> (diddle_return_value): Handle returned bounds.
> >> * function.h (rtl_data): Add field for returned bounds.
> >>
> >>
> >> diff --git a/gcc/calls.c b/gcc/calls.c
> >> index e1dc8eb..5fbbe9f 100644
> >> --- a/gcc/calls.c
> >> +++ b/gcc/calls.c
> >> @@ -44,11 +44,14 @@ along with GCC; see the file COPYING3.  If not see
> >>   #include "tm_p.h"
> >>   #include "timevar.h"
> >>   #include "sbitmap.h"
> >> +#include "bitmap.h"
> >>   #include "langhooks.h"
> >>   #include "target.h"
> >>   #include "cgraph.h"
> >>   #include "except.h"
> >>   #include "dbgcnt.h"
> >> +#include "tree-chkp.h"
> >> +#include "rtl-chkp.h"
> >>
> >>   /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits.  */
> >>   #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
> >> @@ -76,6 +79,15 @@ struct arg_data
> >> /* If REG is a PARALLEL, this is a copy of VALUE pulled into the
> >> correct
> >>form for emit_group_move.  */
> >> rtx parallel_value;
> >> +  /* If value is passed in neither reg nor stack, this field holds a
> >> number
> >> + of a special slot to be used.  */
> >> +  rtx special_slot;
> >
> > I really dislike "special_slot" and the comment here.  The comment that it's
> > neither a reg nor stack is just bogus.  What hardware resource does
> > "special_slot" refer to?  It's a register, but one that we do not typically
> > expose.  Let's at least clarify the comment and then we'll see if something
> > other than "special_slot" as a name makes sense.  Yes, I realize this is a
> > bit of bikeshedding, but when the comments/terminology is confusing, the
> > code becomes even harder to understand.
> 
> Special slot is not a register.  When bounds are passed in a register
> then everything work as if we pass any other argument in a register.
> Special slot is used when we are out of bounds registers and pass
> bounds for pointer passed in a register.  It doesn't refer to any
> hardware resource.  In MPX ABI we state that special Bounds Table
> entries (related to stack pointer value (and lower) right before a
> call) are used.  In software implementation it also may be some other
> places like vars in TLS.
> 
> >
> > I'm a bit concerned that this is exposing more details of the MPX
> > implementation than is advisable to the front/middle end.  On the other
> > hand, I'd expect any other implementation that seeks to work in a
> > transparent manner is going to have many of the same implementation
> > properties as we see with MPX, so perhaps it's not a major problem.
> 
> I'm trying to not introduce any hardware dependencies into middle end.
> Several months ago I created a simple prototype of generic target
> suppor

Re: [wwwdocs] Add feature-testing macros and std::is_final to gcc-5/changes.html

2014-10-02 Thread Ed Smith-Rowland

On 10/02/2014 06:14 AM, Jonathan Wakely wrote:

On 02/10/14 11:12 +0100, Jonathan Wakely wrote:

Note Ed's recent changes. Committed to CVS.


And fix a markup error that I expected xmllint to catch :-(
Thank you! I tried to do this and couldn't for permissions.  I'm 
probably not doing it right.


Anyway, the real thing I wanted to suggest is we put a line for C-family 
about the availability of __has_include and __has_include_next.  We 
could mention clang has it.


Thanks,

Ed



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

2014-10-02 Thread Jason Merrill

On 10/01/2014 11:52 PM, DJ Delorie wrote:

It seems like the int128 code here was broken and this is continuing
that brokenness.  Extended integer types have integer conversion rank
corresponding to their bitsize, so int128 should have higher rank than
long long, but here it was being checked after long long, and your code
also follows the long long code.  Also, we should be checking for both
signed and unsigned variants.


In this case, we know that the two types are the same bitsize.


True, when __int128 is the same size as long long it has lower rank. 
But it isn't always the same size; specifically, in the x32 ABI long 
long is 64 bits.  So we definitely need to deal with extended integer 
types larger than long long.



If you plan to allow __intN with sizes between those of int and long
long, they need to have the appropriate intermediate conversion rank for
their size.


But... we don't know the bit sizes at the gcc source level, we only
know them by iterating the array.  We'd have to iterate the array at
evey step to see if it's between bitsize N and M, or add the standard
types to some array, or add the __intN variants to integer_types[] and
re-sort i_t[].


Right.


However, doing that introduces the __intN types to
*everything* that uses integer_types[].  I was hesitant to add
nonstandard types to the standard promotion rules.


The C++ standard says that extended integer types participate in the 
usual arithmetic conversions.  If I add a 32-bit int and an __int48, the 
usual arithmetic conversions should convert the int to __int48.


I don't mind if you deal with this by asserting that extended integer 
types never fall between int and long long rather than actually trying 
to support it.


Extended integer types larger than long long also participate in 
enumeral promotion if needed, but I think your changes to 
c_common_type_for_size handle that.



Basically I think the integral conversion code in cp_common_type ought
to be rewritten to work on integer_types rather than naming specific types.


That would be the "re-sort it" option.


-  'n',  /* itk_int128 */
-  'o',  /* itk_unsigned_int128  */
+  /* __intN types are handled separately */


Where are they mangled now?  I also don't see any mangling tests.


They mangle as Inn like I20 or I128 (that might be the wrong letter,
but the syntax is like that).  It surprised me that there was a case
for "other unknown types", but there's a case for it :-)


Ah, I see that 'n' and 'o' for __int128 are handled further down in 
write_builtin_type. And we do have mangling tests for that 
(g++.dg/abi/mangle43.C).


We still need mangling tests for __int20, though.

Jason



Re: [wwwdocs] Add feature-testing macros and std::is_final to gcc-5/changes.html

2014-10-02 Thread Jonathan Wakely

On 02/10/14 10:09 -0400, Ed Smith-Rowland wrote:

On 10/02/2014 06:14 AM, Jonathan Wakely wrote:

On 02/10/14 11:12 +0100, Jonathan Wakely wrote:

Note Ed's recent changes. Committed to CVS.


And fix a markup error that I expected xmllint to catch :-(
Thank you! I tried to do this and couldn't for permissions.  I'm 
probably not doing it right.


If I remember my cvs-fu you need CVS_RHS=ssh and use
CVSROOT=:ext:$u...@gcc.gnu.org:/cvs/gcc (with your sourceware.org
username as $USER) and then it should work over SSH just like svn and
git.

Anyway, the real thing I wanted to suggest is we put a line for 
C-family about the availability of __has_include and 
__has_include_next.  We could mention clang has it.


Good idea, I'm happy to commit a patch if you can prepare something.



Re: [C++ Patch/RFC] PR 53025

2014-10-02 Thread Jason Merrill

On 10/02/2014 08:11 AM, Paolo Carlini wrote:

+/* Nonzero if we are parsing the operand of a noexcept operator.  */
+
+extern int cp_noexcept_operand;


Rather than add a global variable, let's look it up in scope_chain 
directly, like current_namespace and such.


Jason



Re: [PATCH, i386, Pointer Bounds Checker 33/x] MPX ABI

2014-10-02 Thread Ilya Enkovich
On 01 Oct 14:57, Vladimir Makarov wrote:
> On 2014-09-25 5:46 AM, Ilya Enkovich wrote:
> >2014-09-25 1:51 GMT+04:00 Ilya Enkovich :
> >>2014-09-24 23:09 GMT+04:00 Jeff Law :
> >>>On 09/24/14 07:13, Ilya Enkovich wrote:
> 
> I tried to generate PARALLEL with all regs set by call.  Here is a
> memset call I got:
> 
> (call_insn 23 22 24 2 (set (parallel [
>   (expr_list:REG_DEP_TRUE (reg:DI 0 ax)
>   (const_int 0 [0]))
>   (expr_list:REG_DEP_TRUE (reg:BND64 77 bnd0)
>   (const_int 0 [0]))
>   (expr_list:REG_DEP_TRUE (reg:BND64 78 bnd1)
>   (const_int 0 [0]))
>   ])
>   (call/j (mem:QI (symbol_ref:DI ("memset") [flags 0x41]
> >>>
> >>>[ snip ]
> >>>Looks good.  This is the approved way to handle multiple results of a call.
> >>>
> 
> During register allocation LRA generated a weird move instruction:
> 
> (insn 63 0 0 (set (reg/f:DI 100)
>   (parallel [
>   (expr_list:REG_DEP_TRUE (reg:DI 0 ax)
>   (const_int 0 [0]))
>   (expr_list:REG_DEP_TRUE (reg:BND64 77 bnd0)
>   (const_int 0 [0]))
>   (expr_list:REG_DEP_TRUE (reg:BND64 78 bnd1)
>   (const_int 0 [0]))
>   ])) -1
>    (nil))
> 
> Which caused ICE later in LRA.  This move happens because of
> REG_RETURNED (reg/f:DI 100) (see condition in inherit_in_ebb at
> lra-constraints.c:5312).  Thus this code in LRA doesn't accept
> PARALLEL dest for calls.
> >>>
> >>>This is a bug in LRA then.  Multiple return values aren't heavily used, so
> >>>I'm not surprised that its handling was missed in LRA.
> >>>
> >>>The question now is how to bundle things together in such a way as to make
> >>>it easy for Vlad to reproduce and fix this in LRA.
> >>>
> >>>Jeff
> >>
> >>I suppose it should be easy to reproduce using the same test case I
> >>use and some speudo patch which adds fake return values (e.g. xmm6 and
> >>xmm7) to calls.  Will try to make some minimal patch and test Vlad
> >>could work with.
> >>
> >>Ilya
> >
> >I couldn't reproduce the problem on a small test but chrome build
> >shows a lot of errors.  Due to the nature of the problem test's size
> >shouldn't matter, so I attach patch which emulates situation with
> >bounds regs (but uses xmm5 and xmm6 instead of bnd0 and bnd1) with a
> >preprocessed chrome file.
> >
> 
> The problem is in code introduced by Bernd in IRA and caller-saves.c
> in 2012.  It is basically an optimization for functions returning
> always the same result as one argument (e.g. memcpy returning 1st
> argument).
> 
> There are two possible solutions.  First one is to prohibit the
> optimizations when there is a parallel in SET.  Second one is to go
> deeper if the call result is guaranteed in the first element which
> is true for the patch.
> 
> For the first solution, the patch would be
> 
> Index: lra-constraints.c
> ===
> --- lra-constraints.c   (revision 215748)
> +++ lra-constraints.c   (working copy)
> @@ -5348,16 +5348,19 @@
>   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);
> + 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;
> 
> 
> For the second solution, the patch is
> 
> 
> Index: lra-constraints.c
> ===
> --- lra-constraints.c   (revision 215748)
> +++ lra-constraints.c   (working copy)

[PATCH,i386] Fix adxintrin on mingw.

2014-10-02 Thread Ilya Tocar
Hi,

sizeof (long) == 4 on windows, so we should use long long as param type.
Patch below does it.
Ok for trunk?

2014-10-02  Ilya Tocar  

* 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



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

2014-10-02 Thread Ilya Enkovich
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  

* 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..f983165 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -879,8 +879,11 @@ 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);
+ 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..cd54abd 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -5348,16 +5348,19 @@ 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);
+ 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] Fix adxintrin on mingw.

2014-10-02 Thread H.J. Lu
On Thu, Oct 2, 2014 at 7:29 AM, Ilya Tocar  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?

> Ok for trunk?
>
> 2014-10-02  Ilya Tocar  
>
> * 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-02 Thread Jason Merrill

On 10/02/2014 10:22 AM, Jason Merrill wrote:

Extended integer types larger than long long also participate in
enumeral promotion if needed, but I think your changes to
c_common_type_for_size handle that.


...and it seems we currently don't support enums with underlying type 
larger than long long, though that would be nice to fix and adding 
extended integer types to integer_types[] would fix it.


Jason



Re: [PATCH 0/10] OpenACC 2.0 support for libgomp

2014-10-02 Thread Julian Brown
Hi,

On Wed, 24 Sep 2014 14:32:31 +0200
Jakub Jelinek  wrote:

> On Tue, Sep 23, 2014 at 07:17:25PM +0100, Julian Brown wrote:
> > The upcoming patch series constitutes our current (still
> > in-progress) implementation of run-time support for OpenACC 2.0 in
> > libgomp. We've tried to build on top of the (also currently WIP)
> > support for OpenMP 4.0's "target" construct, sharing code where
> > possible: because of this, I've also prepared versions of (a fairly
> > minimal, hopefully correct set of) prerequisite patches that apply
> > to current mainline (and were previously on the gomp 4.0 branch),
> > although in many cases we weren't the original authors of those.
> > 
> > Other parts of the OpenACC support for GCC are being sent upstream
> > concurrently with this runtime support (and are co-dependent with
> > it), so unfortunately, though the main part of the implementation
> > (part 7/10) works on our internal branch, I haven't yet been able
> > to convincingly test the series I'm about to post upstream. However
> > this code will be useful to others who are posting their bits of
> > OpenACC support upstream, so perhaps it'd be useful to commit it
> > anyway (we have to start somewhere!).
> 
> Just random comments about all the 10 patches:

Thanks for your comments -- I'm planning to address the things you've
bought up, but will probably change tack a little and do that work on
the gomp-4_0-branch (rather than working directly on mainline). That
way I can (hopefully) send incremental patches rather than working
entirely locally then sending another over-sized patch.

> Cache the return value?  Also, I must say I'm not particularly excited
> about different plugins not supporting both OpenMP 4.0 and OpenACC 2.0
> offloading.  Why is that needed?

For now, because OpenACC supports some stuff that (AFAIK!) OpenMP
doesn't, such as asynchronous execution. The eventual plan is for the
plugin interface to be generic, but we're not there yet.

> +  /* Make sure all the CUDA functions are there if any of them
> are.  */
> +  if (optional_present && optional_present != optional_total)
> +   {
> + err = "plugin missing OpenACC CUDA handler function";
> + goto out;
> +   }
> 
> So, any plugin that doesn't support CUDA will not support OpenACC?
> I hoped OpenACC would not be so tied to one particular HW...

The intention was for that section to allow zero CUDA handling
functions, or all of them. For better or worse, OpenACC defines a few
APIs which are target-specific (for NVidia, AMD, Intel so far, IIRC).
An OpenACC application doesn't have to use any of those, of course.

> that is not how ChangeLog entries should look like, if a line is not
> starting with ( after the tab, it should not contain extra spaces
> after the tab, so move Use these. and hack. (and in other spots)
> two columns to the left.

That was merely a copy/paste error of some sort, apologies.

Thanks,

Julian


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

2014-10-02 Thread Joseph S. Myers
On Wed, 1 Oct 2014, Andi Kleen wrote:

> +/* Check that no array notation or spawn statement is in EXPR.
> +   If not true gemerate an error at LOC for WHAT.  */
> +
> +bool
> +check_no_cilk (tree expr, const char *what, location_t loc)
> +{
> +  if (!flag_cilkplus)
> +return false;
> +  if (contains_array_notation_expr (expr))
> +{
> +  loc = get_error_location (expr, loc);
> +  error_at (loc, "Cilk array notation cannot be used %s", what);
> +  return true;
> +}
> +  if (walk_tree (&expr, contains_cilk_spawn_stmt_walker, NULL, NULL))
> +{
> +  loc = get_error_location (expr, loc);
> +  error_at (loc, "%<_Cilk_spawn%> statement cannot be used %s", what);

You need to pass two complete error messages to this function for i18n 
purposes, rather than building up messages from sentence fragments.  If 
you call them e.g. array_gmsgid and spawn_gmsgid they should both get 
extracted by exgettext for translation.

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


[PATCH 4/n] OpenMP 4.0 offloading infrastructure: lto-wrapper

2014-10-02 Thread Ilya Verbin
Hello,

With this patch lto-wrapper performs invocation of mkoffload tool for each
offload target.  This tool should be provided by the corresponding offload
compiler.  It will compile IR from .gnu.offload_lto_* sections into offload
target code and embed the resultant code (offload image) into the new host's
object file.

Bootstrapped and regtested on top of patch 3.  Is it OK for trunk?

Thanks,
  -- Ilya


2014-10-02  Ilya Verbin  
Bernd Schmidt  
Andrey Turetskiy  
Michael Zolotukhin  

gcc/
* gcc.c (spec_host_machine, accel_dir_suffix): New variables.
(process_command): Tweak path construction for the possibility
of being configured as an offload compiler.
(main): Likewise.  Look up specs in just_machine_suffix only if not
ACCEL_COMPILER.  Construct OFFLOAD_TARGET_NAMES environment variable if
we have OFFLOAD_TARGETS.
* lto-wrapper.c (OFFLOAD_TARGET_NAMES_ENV): Define.
(offload_names, offloadbegin, offloadend): New static variables.
(free_array_of_ptrs, parse_env_var, access_check, compile_offload_image)
(compile_images_for_offload_targets, copy_file, find_offloadbeginend):
New static functions.
(run_gcc): Determine whether offload sections are present.  If so, run
compile_images_for_offload_targets and return the names of new generated
objects to linker.  If there are offload sections, but no LTO sections,
then return the copies of input objects without link-time recompilation.
lto-plugin/
* lto-plugin.c (OFFLOAD_SECTION, OFFLOAD_SECTION_LEN): Define.
(struct plugin_objfile): Add new field "offload".
(process_offload_section): New static function.
(claim_file_handler): Claim file if it contains offload sections.

---

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 47c4e28..82509a8 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -157,6 +157,7 @@ static const char *const spec_version = 
DEFAULT_TARGET_VERSION;
 /* The target machine.  */
 
 static const char *spec_machine = DEFAULT_TARGET_MACHINE;
+static const char *spec_host_machine = DEFAULT_REAL_TARGET_MACHINE;
 
 /* Nonzero if cross-compiling.
When -b is used, the value comes from the `specs' file.  */
@@ -1296,6 +1297,9 @@ static const char *const standard_startfile_prefix_2
relative to the driver.  */
 static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
 
+/* A prefix to be used when this is an accelerator compiler.  */
+static const char *const accel_dir_suffix = ACCEL_DIR_SUFFIX;
+
 /* Subdirectory to use for locating libraries.  Set by
set_multilib_dir based on the compilation options.  */
 
@@ -4122,15 +4126,15 @@ process_command (unsigned int decoded_options_count,
 }
 
   gcc_assert (!IS_ABSOLUTE_PATH (tooldir_base_prefix));
-  tooldir_prefix2 = concat (tooldir_base_prefix, spec_machine,
+  tooldir_prefix2 = concat (tooldir_base_prefix, spec_host_machine,
dir_separator_str, NULL);
 
   /* Look for tools relative to the location from which the driver is
  running, or, if that is not available, the configured prefix.  */
   tooldir_prefix
 = concat (gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix,
- spec_machine, dir_separator_str,
- spec_version, dir_separator_str, tooldir_prefix2, NULL);
+ spec_host_machine, dir_separator_str, spec_version,
+ accel_dir_suffix, dir_separator_str, tooldir_prefix2, NULL);
   free (tooldir_prefix2);
 
   add_prefix (&exec_prefixes,
@@ -6878,8 +6882,8 @@ main (int argc, char **argv)
 
   /* Read specs from a file if there is one.  */
 
-  machine_suffix = concat (spec_machine, dir_separator_str,
-  spec_version, dir_separator_str, NULL);
+  machine_suffix = concat (spec_host_machine, dir_separator_str, spec_version,
+  accel_dir_suffix, dir_separator_str, NULL);
   just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
 
   specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true);
@@ -6889,16 +6893,17 @@ main (int argc, char **argv)
   else
 init_spec ();
 
+#ifndef ACCEL_COMPILER
   /* We need to check standard_exec_prefix/just_machine_suffix/specs
  for any override of as, ld and libraries.  */
   specs_file = (char *) alloca (strlen (standard_exec_prefix)
   + strlen (just_machine_suffix) + sizeof ("specs"));
-
   strcpy (specs_file, standard_exec_prefix);
   strcat (specs_file, just_machine_suffix);
   strcat (specs_file, "specs");
   if (access (specs_file, R_OK) == 0)
 read_specs (specs_file, true, false);
+#endif
 
   /* Process any configure-time defaults specified for the command line
  options, via OPTION_DEFAULT_SPECS.  */
@@ -7077,8 +7082,9 @@ main (int argc, char **argv)
 
   /* If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake.  */
   if (gcc_exec_prefix)
-gcc_exec_prefix = conc

Re: feature-testing macros for 4.9

2014-10-02 Thread Jason Merrill

On 10/02/2014 10:58 AM, Ed Smith-Rowland wrote:

We've had a request from someone that we include SD-6 feature testing
for gcc-4.9.
It seems rather heavy for a backport but it might make maintainers of
large C++ libraries happy ;-) and it might make sense as people migrate
from 4.9 to 5.0 to see what we've added.


I'm open to that.

Jason




Re: feature-testing macros for 4.9

2014-10-02 Thread Jonathan Wakely
The library macros are safe and can't cause any issues, so I'm happy for them 
to go on the branch.

I can think of at least two that aren't implemented on the branch: 
 and the std::is_final trait (although I'd be OK with the 
trait going on the branch too).



- Original Message -
From: "Jason Merrill" 
To: "Ed Smith-Rowland" <3dw...@verizon.net>, "Jonathan Wakely" 

Cc: gcc-patches@gcc.gnu.org, "thiago macieira" 
Sent: Thursday, 2 October, 2014 4:40:03 PM
Subject: Re: feature-testing macros for 4.9

On 10/02/2014 10:58 AM, Ed Smith-Rowland wrote:
> We've had a request from someone that we include SD-6 feature testing
> for gcc-4.9.
> It seems rather heavy for a backport but it might make maintainers of
> large C++ libraries happy ;-) and it might make sense as people migrate
> from 4.9 to 5.0 to see what we've added.

I'm open to that.

Jason




Re: [PATCH] Redesign jump threading profile updates

2014-10-02 Thread Teresa Johnson
On Wed, Oct 1, 2014 at 10:02 PM, Teresa Johnson  wrote:
> On Wed, Oct 1, 2014 at 3:46 PM, Steve Ellcey  wrote:
>> On Wed, 2014-10-01 at 13:04 -0700, Teresa Johnson wrote:
>>
>>> 2014-10-01  Teresa Johnson  
>>>
>>> * tree-ssa-threadupdate.c (freqs_to_counts_path): Scale frequencies
>>> up when synthesizing counts to avoid rounding errors.
>>
>> I tried this patch on my MIPS toolchain build but GCC is still failing
>> while building glibc.
>>
>> iconv_open.c: In function 'iconv_open':
>> iconv_open.c:32:1: error: verify_flow_info: Wrong probability of edge
>> 14->18 -920374544
>>  iconv_open (const char *tocode, const char *fromcode)
>>  ^
>> iconv_open.c:32:1: error: verify_flow_info: Wrong probability of edge
>> 14->19 -903724544
>> iconv_open.c:32:1: internal compiler error: verify_flow_info failed
>> 0x626a70 verify_flow_info()
>> /scratch/sellcey/repos/nightly/src/gcc/gcc/cfghooks.c:260
>> 0x9f36e4 cleanup_tree_cfg_noloop
>> /scratch/sellcey/repos/nightly/src/gcc/gcc/tree-cfgcleanup.c:765
>> 0x9f36e4 cleanup_tree_cfg()
>> /scratch/sellcey/repos/nightly/src/gcc/gcc/tree-cfgcleanup.c:814
>> 0x8eeff4 execute_function_todo
>> /scratch/sellcey/repos/nightly/src/gcc/gcc/passes.c:1704
>> 0x8efb23 execute_todo
>> /scratch/sellcey/repos/nightly/src/gcc/gcc/passes.c:1808
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> Please include the complete backtrace with any bug report.
>> See  for instructions.
>>
>
> Will take a look. In case I can't reproduce it with the aarch64
> cross-compiler or x86_64, can you give me the preprocessed source? And
> also the instructions for how to configure for MIPS.

Hi Steve,

Please do send me the preprocessed source and if possible also
instructions for configuring a MIPS cross-compiler. I haven't been
able to reproduce this with either x86_64 or the aarch64
cross-compiler I built yesterday. But I can't reproduce Christophe's
failure either with my aarch64-configured glibc, so my version or
headers must be different.

Thanks!
Teresa

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



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


Re: [PATCH] Redesign jump threading profile updates

2014-10-02 Thread Steve Ellcey
On Wed, 2014-10-01 at 22:02 -0700, Teresa Johnson wrote:

> Will take a look. In case I can't reproduce it with the aarch64
> cross-compiler or x86_64, can you give me the preprocessed source? And
> also the instructions for how to configure for MIPS.
> 
> Teresa

Never mind, I messed up the patch when applying it.  It looks good on
MIPS now.  I haven't done a complete build and test but the ICE went
away when I re-applied the patch.

Steve Ellcey
sell...@mips.com



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

2014-10-02 Thread Jason Merrill

On 10/01/2014 05:31 PM, Aldy Hernandez wrote:

+  for (tree t = level->names; t; t = TREE_CHAIN(t))
+if (TREE_CODE (t) != TYPE_DECL
+   && TREE_CODE (t) != PARM_DECL
+   && !DECL_IS_BUILTIN (t))
+  debug_hooks->early_global_decl (t);


What does this do for templates?  I think we don't want to send a 
template off to early_global_decl, but rather walk through its 
specializations and emit them.


Why do you need to check for PARM_DECL?  There shouldn't be any 
PARM_DECL at namespace scope.


Why do you want to skip TYPE_DECL?  I think we should leave the decision 
about whether to emit a typedef to the debugging back end.


Jason



Re: [libgo, arm64] Future of reflection

2014-10-02 Thread Richard Henderson
On 10/01/2014 03:08 PM, Ian Lance Taylor wrote:
>>  func TestMakeFunc(t *testing.T) {
>> switch runtime.GOARCH {
>> case "amd64", "386":
>> default:
>> t.Skip("MakeFunc not implemented for " + runtime.GOARCH)
>> }
> 
> Wait, what sources are you looking at?  I took that out on July 19.

Err.. too many different ones, apparently.  Sorry for the confusion.

> Partly historical reasons.  I wrote the x86 support because I didn't
> know that libffi had closures.  But then even using closures, the x86
> support looks a lot nicer: it doesn't have to call mmap.  All the mmap
> stuff is elegant and is necessary for C style function pointers, but
> it's not necessary for Go func values since they carry their own
> closures anyhow.  So, yes, I think we should write direct
> implementations for other targets that we care about.

Ok.  I'd forgotten about the extra mmap overhead implied by libffi closures.


r~


Re: Why doesn't include ?

2014-10-02 Thread Jonathan Wakely

On 17/09/14 16:55 +0200, Marc Glisse wrote:

On Wed, 17 Sep 2014, Jonathan Wakely wrote:


Our  only includes , not  as required by
26.8 [c.math] paragraph 1.

Is that intentional?


Probably not (I don't know), but if you change it, please include 
 instead of the nonsensical (and equivalent) . I 
hope we can deprecate that one at some point, I would even be in favor 
of adding a #warning to it asking why on earth the user decided to 
include it.


Done, with the attached patch. Tested x86_64-linux, committed to
trunk.

commit 0e4f9dd61315305e717fce692b63927430de8062
Author: Jonathan Wakely 
Date:   Thu Oct 2 12:22:14 2014 +0100

	* include/c_global/ctgmath: Include .
	* testsuite/26_numerics/headers/ctgmath/complex.cc: New.
	* doc/xml/manual/status_cxx2011.xml: Update.
	* doc/html/manual/status.html: Regenerate.

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index b986cad..5b36556 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -2049,13 +2049,10 @@ particular release.
   
 
 
-  
   26.8
   C Library
-  Partial
-   doesn't include
-
-  
+  Y
+  
 
 
   
diff --git a/libstdc++-v3/include/c_global/ctgmath b/libstdc++-v3/include/c_global/ctgmath
index df36263..e05ede5 100644
--- a/libstdc++-v3/include/c_global/ctgmath
+++ b/libstdc++-v3/include/c_global/ctgmath
@@ -35,6 +35,7 @@
 #  include 
 #else
 #  include 
+#  include 
 #endif
 
 #endif 
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/complex.cc b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/complex.cc
new file mode 100644
index 000..160dc1b
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/complex.cc
@@ -0,0 +1,23 @@
+// 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
+// .
+
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+#include 
+
+std::complex d;


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

2014-10-02 Thread Jason Merrill

On 09/30/2014 02:43 PM, Aldy Hernandez wrote:

+  if (parm_die
+  /* Make sure the function to which this parameter belongs to is
+not an abstract instance.  If it is, we can't reuse anything.
+We must create a new DW_TAG_formal_parameter with a
+corresponding DW_AT_abstract_origin.  */
+  && !get_AT (context_die, DW_AT_abstract_origin))


Can we use the same test here that we do later in this function, namely 
origin && origin != node?



-  if (origin != NULL && origin != decl)
+  if (origin != NULL && (origin != decl || old_die))


Don't we want to go back to "if (origin != NULL)" here too?

Jason



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

2014-10-02 Thread Jason Merrill

On 10/02/2014 11:53 AM, Jason Merrill wrote:

On 09/30/2014 02:43 PM, Aldy Hernandez wrote:

+  if (parm_die
+  /* Make sure the function to which this parameter belongs to is
+ not an abstract instance.  If it is, we can't reuse anything.
+ We must create a new DW_TAG_formal_parameter with a
+ corresponding DW_AT_abstract_origin.  */
+  && !get_AT (context_die, DW_AT_abstract_origin))


Can we use the same test here that we do later in this function, namely
origin && origin != node?


Or, rather, just "if (origin)".

Jason



Re: [PATCH] Redesign jump threading profile updates

2014-10-02 Thread Teresa Johnson
On Thu, Oct 2, 2014 at 8:45 AM, Steve Ellcey  wrote:
> On Wed, 2014-10-01 at 22:02 -0700, Teresa Johnson wrote:
>
>> Will take a look. In case I can't reproduce it with the aarch64
>> cross-compiler or x86_64, can you give me the preprocessed source? And
>> also the instructions for how to configure for MIPS.
>>
>> Teresa
>
> Never mind, I messed up the patch when applying it.  It looks good on
> MIPS now.  I haven't done a complete build and test but the ICE went
> away when I re-applied the patch.

Ok, phew. =) Thanks for the update.

Jeff or Honza, did the patch look ok for trunk? Regression tests pass.

Thanks,
Teresa

>
> Steve Ellcey
> sell...@mips.com
>



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


Re: [PATCH] Fix PR63422 to handle profile insanities

2014-10-02 Thread Teresa Johnson
On Wed, Oct 1, 2014 at 10:03 AM, Xinliang David Li  wrote:
> Probably need to file a bug to track the copyrename2 problem.

I have filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63443 to track this.

>
> David
>
> On Wed, Oct 1, 2014 at 9:59 AM, Teresa Johnson  wrote:
>> This patch removes some asserts my jump threading patch r215739 added.
>> An upstream pass (copyrename2) is introducing some bogus profile
>> counts, so we can't assert that counts are 0 when there is no profile
>> data for the function.
>>
>> Tested on testcase attached to PR63422. Currently running gcc
>> regression tests for x86_64-unknown-linux-gnu. Ok for trunk if that
>> passes?

Regression tests pass, ok for trunk?

Thanks,
Teresa

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


[jit] Implement documentation targets within jit/Make-lang.in

2014-10-02 Thread David Malcolm
On Tue, 2014-09-23 at 23:27 +, Joseph S. Myers wrote:
[...]
> Shouldn't the jit.pdf, jit.install-html etc. Make-lang.in hooks actually 
> build / install the documentation for this JIT?
[...]

I've committed the following to the branch dmalcolm/jit:

This patch implements the documentation targets:
  * jit.info
  * jit.install-info
  * jit.dvi
  * jit.pdf
  * jit.install-pdf
  * jit.install-html
  * jit.html
within jit/Make-lang.in, and adds detection of "sphinx-build" to the gcc
configure script.

It uses sphinx (if available) to generate the HTML jit documentation, with
texinfo as a fallback, and texinfo for the other formats.

gcc/ChangeLog.jit:
* configure.ac (doc_build_sys): New variable, set to "sphinx" if
sphinx is installed, falling back to "texinfo" otherwise.
* configure: Regenerate.
* Makefile.in (doc_build_sys): New.

gcc/jit/ChangeLog.jit:
* Make-lang.in (jit.info): Implement.
(jit.install-info): Implement.
(jit.dvi): Implement.
(jit.pdf): Implement in terms of new target "jit.texinfo.pdf".
(jit.install-pdf): Likewise for new target
"jit.texinfo.install-pdf".
(jit.install-html): Implement in terms of
"jit.$(doc_build_sys).install-html" to redirect to new targets
"jit.sphinx.install-html" or "jit.texinfo.install-html".
(jit.html): Implement in terms of "jit.$(doc_build_sys).html" to
redirect to new targets "jit.sphinx.html" or "jit.texinfo.html".
(JIT_TEXI_FILES): New variable.
(jit.texinfo.html): New target.
(jit.texinfo.install-html): New target.
(jit.texinfo.pdf): New target.
(jit.texinfo.install-pdf): New target.
(SPHINX_BUILD_DIR): New variable.
(jit.sphinx.html): New target.
(jit_htmldir): New variable.
(jit.sphinx.install-html): New target.
(jit.sphinx.pdf): New target.
---
 gcc/Makefile.in  |   5 ++
 gcc/configure|  46 +++-
 gcc/configure.ac |   4 ++
 gcc/jit/Make-lang.in | 148 ---
 4 files changed, 194 insertions(+), 9 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f56fa96..ae2c6e5 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -310,6 +310,11 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell 
touch $(2)) \
  $(shell expr $(range) + 
$(write_entries_to_file_split) - 1), $(1))" \
 | tr ' ' '\012' >> $(2)))
 
+# The jit documentation looks better if built with sphinx, but can be
+# built with texinfo if sphinx is not available.
+# configure sets "doc_build_sys" to "sphinx" or "texinfo" accordingly
+doc_build_sys=@doc_build_sys@
+
 # 
 # UNSORTED
 # 
diff --git a/gcc/configure b/gcc/configure
index c1922ac..0eccf67 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -743,6 +743,7 @@ CXXDEPMODE
 DEPDIR
 am__leading_dot
 CXXCPP
+doc_build_sys
 AR
 NM
 BISON
@@ -8062,6 +8063,47 @@ fi
 
 fi
 
+# The jit documentation looks better if built with sphinx, but can be
+# built with texinfo if sphinx is not available.
+# Set "doc_build_sys" to "sphinx" or "texinfo" accordingly.
+# Extract the first word of "sphinx-build", so it can be a program name with 
args.
+set dummy sphinx-build; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_doc_build_sys+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$doc_build_sys"; then
+  ac_cv_prog_doc_build_sys="$doc_build_sys" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x 
"$as_dir/$ac_word$ac_exec_ext"; }; then
+ac_cv_prog_doc_build_sys="sphinx"
+$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" 
>&5
+break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_doc_build_sys" && ac_cv_prog_doc_build_sys="texinfo"
+fi
+fi
+doc_build_sys=$ac_cv_prog_doc_build_sys
+if test -n "$doc_build_sys"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doc_build_sys" >&5
+$as_echo "$doc_build_sys" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 
 # 
 # Checks for C headers
@@ -18035,7 +18077,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18038 "configure"
+#line 18080 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18141,7 +18183,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18144 "configure"
+#line 18186 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN

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

2014-10-02 Thread DJ Delorie

> The C++ standard says that extended integer types participate in the 
> usual arithmetic conversions.  If I add a 32-bit int and an __int48, the 
> usual arithmetic conversions should convert the int to __int48.

Except the code you're referring to isn't part of that conversion.  It
only handles types that are the same size, not different sizes, and as
I said the __intN types are never the same size as standard types
(except __int128) so there are no conversions to worry about - in the
code you're referring to.

In the common parts of the MI the __intN types are handled separately,
in each case where i_t[] is referenced.

> We still need mangling tests for __int20, though.

The test would only pass for msp430x (and fail for msp430, which is
the same target back-end).  Do I need to redo the big patch, or would
a separate one suffice?



Re: [C++ Patch/RFC] PR 53025

2014-10-02 Thread Paolo Carlini

Hi,

On 10/02/2014 04:26 PM, Jason Merrill wrote:

On 10/02/2014 08:11 AM, Paolo Carlini wrote:

+/* Nonzero if we are parsing the operand of a noexcept operator.  */
+
+extern int cp_noexcept_operand;


Rather than add a global variable, let's look it up in scope_chain 
directly, like current_namespace and such.
I see, thanks (I'm not very familiar with scope_chain). Thus something 
like the below? It passes testing.


Thanks again,
Paolo.

/
Index: cp/call.c
===
--- cp/call.c   (revision 215801)
+++ cp/call.c   (working copy)
@@ -7251,7 +7251,11 @@ build_over_call (struct z_candidate *cand, int fla
 /* Do things the hard way.  */;
   else if (cand->num_convs == 1 
&& (DECL_COPY_CONSTRUCTOR_P (fn) 
-   || DECL_MOVE_CONSTRUCTOR_P (fn)))
+   || DECL_MOVE_CONSTRUCTOR_P (fn))
+  /* It's unsafe to elide the constructor when handling
+ a noexcept-expression, it may evaluate to the wrong
+ value (c++/53025).  */
+  && cp_noexcept_operand == 0)
 {
   tree targ;
   tree arg = argarray[num_artificial_parms_for (fn)];
Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 215801)
+++ cp/cp-tree.h(working copy)
@@ -1058,6 +1058,7 @@ struct GTY(()) saved_scope {
 
   int unevaluated_operand;
   int inhibit_evaluation_warnings;
+  int noexcept_operand;
   /* If non-zero, implicit "omp declare target" attribute is added into the
  attribute lists.  */
   int omp_declare_target_attribute;
@@ -1124,6 +1125,10 @@ struct GTY(()) saved_scope {
 
 #define local_specializations scope_chain->x_local_specializations
 
+/* Nonzero if we are parsing the operand of a noexcept operator.  */
+
+#define cp_noexcept_operand scope_chain->noexcept_operand
+
 /* A list of private types mentioned, for deferred access checking.  */
 
 extern GTY(()) struct saved_scope *scope_chain;
Index: cp/name-lookup.c
===
--- cp/name-lookup.c(revision 215801)
+++ cp/name-lookup.c(working copy)
@@ -6139,6 +6139,7 @@ push_to_top_level (void)
   s->function_decl = current_function_decl;
   s->unevaluated_operand = cp_unevaluated_operand;
   s->inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
+  s->noexcept_operand = scope_chain ? cp_noexcept_operand : 0;
   s->x_stmt_tree.stmts_are_full_exprs_p = true;
 
   scope_chain = s;
@@ -6182,6 +6183,7 @@ pop_from_top_level_1 (void)
   current_function_decl = s->function_decl;
   cp_unevaluated_operand = s->unevaluated_operand;
   c_inhibit_evaluation_warnings = s->inhibit_evaluation_warnings;
+  cp_noexcept_operand = s->noexcept_operand;
 }
 
 /* Wrapper for pop_from_top_level_1.  */
Index: cp/parser.c
===
--- cp/parser.c (revision 215801)
+++ cp/parser.c (working copy)
@@ -7156,7 +7156,9 @@ cp_parser_unary_expression (cp_parser *parser, boo
 
++cp_unevaluated_operand;
++c_inhibit_evaluation_warnings;
+   ++cp_noexcept_operand;
expr = cp_parser_expression (parser);
+   --cp_noexcept_operand;
--c_inhibit_evaluation_warnings;
--cp_unevaluated_operand;
 
Index: cp/pt.c
===
--- cp/pt.c (revision 215801)
+++ cp/pt.c (working copy)
@@ -14769,11 +14769,13 @@ tsubst_copy_and_build (tree t,
   op1 = TREE_OPERAND (t, 0);
   ++cp_unevaluated_operand;
   ++c_inhibit_evaluation_warnings;
+  ++cp_noexcept_operand;
   op1 = tsubst_copy_and_build (op1, args, complain, in_decl,
   /*function_p=*/false,
   /*integral_constant_expression_p=*/false);
   --cp_unevaluated_operand;
   --c_inhibit_evaluation_warnings;
+  --cp_noexcept_operand;
   RETURN (finish_noexcept_expr (op1, complain));
 
 case MODOP_EXPR:
Index: testsuite/g++.dg/cpp0x/noexcept23.C
===
--- testsuite/g++.dg/cpp0x/noexcept23.C (revision 0)
+++ testsuite/g++.dg/cpp0x/noexcept23.C (working copy)
@@ -0,0 +1,14 @@
+// PR c++/53025
+// { dg-do compile { target c++11 } }
+
+struct A {
+  A() noexcept {}
+  A(const A&) noexcept(false) {}
+};
+
+void a(A) noexcept {}
+
+void f()
+{
+  static_assert(!noexcept(a(A{})), "");
+}
Index: testsuite/g++.dg/cpp0x/noexcept24.C
===
--- testsuite/g++.dg/cpp0x/noexcept24.C (revision 0)
+++ testsuite/g++.dg/cpp0x/noexcept24.C (working copy)
@@ -0,0 +1,22 @@
+// PR c++/53025
+// { dg-do compile { target c++11 } }
+
+template
+struct A {
+  A() noexcept {}
+  A(const A&) noexcept(false) {}
+};
+
+template
+void a(A) noexcept {}
+
+template
+void f()
+{
+  static_assert(!noexce

Re: parallel check output changes?

2014-10-02 Thread Segher Boessenkool
On Wed, Sep 24, 2014 at 10:54:57AM -0400, Andrew MacLeod wrote:
> Is this suppose to be resolved now?  I'm still seeing some issues with a 
> branch cut from mainline from yesterday.

Confirmed.  The following patch works for me, and Andrew has tested it
as well.  The comment it removes isn't valid before the patch either.

Okay for mainline?


Segher


2014-10-02  Segher Boessenkool  

contrib/
* dg-extract-results.py (output_variation): Always sort if do_sum.


diff --git a/contrib/dg-extract-results.py b/contrib/dg-extract-results.py
index fafd38e..7db5e64 100644
--- a/contrib/dg-extract-results.py
+++ b/contrib/dg-extract-results.py
@@ -495,15 +495,7 @@ class Prog:
key = attrgetter ('name')):
 sys.stdout.write ('Running ' + harness.name + ' ...\n')
 if self.do_sum:
-# Keep the original test result order if there was only
-# one segment for this harness.  This is needed for
-# unsorted.exp, which has unusual test names.  Otherwise
-# sort the tests by test filename.  If there are several
-# subtests for the same test filename (such as 'compilation',
-# 'test for excess errors', etc.) then keep the subtests
-# in the original order.
-if len (harness.segments) > 1:
-harness.results.sort()
+harness.results.sort()
 for (key, line) in harness.results:
 sys.stdout.write (line)
 else:


[PATCH] gcc.dg/noncompile/ cleanup

2014-10-02 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/noncompile/ 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/noncompile/20020130-1.c: Use -std=gnu89.
* gcc.dg/noncompile/20050120-1.c: Likewise.
* gcc.dg/noncompile/old-style-parm-2.c: Likewise.
* gcc.dg/noncompile/920616-2.c: Fix defaulting to int.
* gcc.dg/noncompile/930301-1.c: Likewise.
* gcc.dg/noncompile/930622-1.c: Likewise.
* gcc.dg/noncompile/930622-2.c: Likewise.
* gcc.dg/noncompile/950825-1.c: Likewise.
* gcc.dg/noncompile/invalid_asm.c: Likewise.
* gcc.dg/noncompile/scope.c: Likewise.
* gcc.dg/noncompile/va-arg-1.c: Likewise.
* gcc.dg/noncompile/920923-1.c: Fix implicit declarations.
* gcc.dg/noncompile/971104-1.c: Likewise.

diff --git gcc/gcc/testsuite/gcc.dg/noncompile/20020130-1.c 
gcc/gcc/testsuite/gcc.dg/noncompile/20020130-1.c
index d820e06..61669b9 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/20020130-1.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/20020130-1.c
@@ -1,5 +1,6 @@
 /* Test for ICE when using typedef for bad type.  */
 /* Origin: Joseph Myers .  */
+/* { dg-options "-std=gnu89" } */
 
 void
 foo (void)
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/20050120-1.c 
gcc/gcc/testsuite/gcc.dg/noncompile/20050120-1.c
index 4af84b6..7d8f7fa 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/20050120-1.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/20050120-1.c
@@ -1,6 +1,6 @@
 /* PR c/18946 */
 /* { dg-do compile } */
-/* { dg-options "-Wshadow" } */
+/* { dg-options "-Wshadow -std=gnu89" } */
 
 void bar (void)
 {
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/920616-2.c 
gcc/gcc/testsuite/gcc.dg/noncompile/920616-2.c
index 25f5943..e43d009 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/920616-2.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/920616-2.c
@@ -1 +1 @@
-f(void a,...){}/* { dg-error "has incomplete type" } */
+void f(void a,...){}   /* { dg-error "has incomplete type" } */
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/920923-1.c 
gcc/gcc/testsuite/gcc.dg/noncompile/920923-1.c
index ccd1dc3..1cb140e 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/920923-1.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/920923-1.c
@@ -22,6 +22,12 @@ struct PTP {
 typedef struct PTP (u.p_tablep);/* { dg-error "expected" } */
 int pfree=0;
 int pcount=0;
+int Level1 ();
+int Level2 ();
+void enlarge_hash_table ();
+int fill_item_entry ();
+int __eprintf ();
+void build_ptables ();
 
 void
 mmu_walk_find(va)
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/930301-1.c 
gcc/gcc/testsuite/gcc.dg/noncompile/930301-1.c
index afabd15..b36f00f 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/930301-1.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/930301-1.c
@@ -1,4 +1,5 @@
 struct a *q;
+void
 f()
 {
   q++; /* { dg-error "pointer to" } */
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/930622-1.c 
gcc/gcc/testsuite/gcc.dg/noncompile/930622-1.c
index 835e072..93567a9 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/930622-1.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/930622-1.c
@@ -1,3 +1,4 @@
+void
 f ()
 {
   double b;
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/930622-2.c 
gcc/gcc/testsuite/gcc.dg/noncompile/930622-2.c
index 5e02d89..f289bf8 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/930622-2.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/930622-2.c
@@ -1,3 +1,4 @@
+void
 f ()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/950825-1.c 
gcc/gcc/testsuite/gcc.dg/noncompile/950825-1.c
index 43dca2f..4e3d6fb 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/950825-1.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/950825-1.c
@@ -1,3 +1,4 @@
+int
 main()
 {
 return (struct x) {{y: 0}};   /* { dg-error 
"extra|near|excess|incompatible|invalid" } */
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/971104-1.c 
gcc/gcc/testsuite/gcc.dg/noncompile/971104-1.c
index 722b71c..39e00c6 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/971104-1.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/971104-1.c
@@ -14,6 +14,9 @@ union semun {
 };
 static union semun semctl_arg;
 static int semid;
+int semop(int semid, struct sembuf *sops, unsigned nsops);
+void error (const char *);
+int semctl(int semid, int semnum, int cmd, ...);
 static void up(int sem){
   struct sembuf sb;
   sb.sem_num = (unsigned short) sem;
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c 
gcc/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c
index d1d4b36..fdb0296 100644
--- gcc/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c
+++ gcc/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c
@@ -1,4 +1,5 @@
 /* { dg-options "-ffat-lto-objects" } */
+void
 asm_invalid_register_name()
 {
   asm("":::"this_is_an_invalid_register_name");/* { dg-error "unknown 
register" } */
diff --git gcc/gcc/testsuite/gcc.dg/noncompile/old

[PATCH] gcc.dg/tree-prof/ cleanup

2014-10-02 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/tree-prof/ 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/tree-prof/crossmodule-indircall-1.c: Fix defaulting to int.
* gcc.dg/tree-prof/crossmodule-indircall-1a.c: Likewise.
* gcc.dg/tree-prof/merge_block.c: Likewise.
* gcc.dg/tree-prof/peel-1.c: Likewise.
* gcc.dg/tree-prof/stringop-1.c: Likewise.
* gcc.dg/tree-prof/stringop-2.c: Likewise.
* gcc.dg/tree-prof/unroll-1.c: Likewise.
* gcc.dg/tree-prof/update-cunroll-2.c: Likewise.
* gcc.dg/tree-prof/val-prof-1.c: Likewise.
* gcc.dg/tree-prof/val-prof-2.c: Likewise.
* gcc.dg/tree-prof/val-prof-3.c: Likewise.
* gcc.dg/tree-prof/val-prof-4.c: Likewise.
* gcc.dg/tree-prof/val-prof-5.c: Likewise.
* gcc.dg/tree-prof/val-prof-6.c: Likewise.
* gcc.dg/tree-prof/cmpsf-1.c: Likewise.
* gcc.dg/tree-prof/inliner-1.c: Use -fgnu89-inline.  Fix defaulting
to int.

diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c
index 67a76c9..58109d5 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c
@@ -5,6 +5,7 @@
 int a;
 extern void (*p[2])(int n);
 void abort (void);
+int
 main()
 { int i;
 
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c
index a94195c..568cfa9 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c
@@ -33,6 +33,7 @@ sub(int i)
 __attribute__ ((externally_visible))
 void (*p[2])(int)={add, sub};
 #else
+int
 main()
 {
   return 0;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c
index e44887b..d95ff6b 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fgnu89-inline" } */
 int a;
 int b[100];
 void abort (void);
@@ -21,6 +21,7 @@ hot_function ()
   abort ();
 }
 
+int
 main ()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/merge_block.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/merge_block.c
index 62f7f22..d8cfb21 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/merge_block.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/merge_block.c
@@ -9,6 +9,7 @@ int t()
break;
return i;
 }
+int
 main ()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/peel-1.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/peel-1.c
index 65f0c56..eb19966 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/peel-1.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/peel-1.c
@@ -12,6 +12,7 @@ t()
   return 1;
   abort ();
 }
+int
 main()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
index f730613..7fcefb7 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
@@ -3,6 +3,7 @@ int a[1000];
 int b[1000];
 int size=1;
 int max=1;
+int
 main()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c
index 47ebfb0..0489aee 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c
@@ -7,6 +7,7 @@ int max=1;
 /* We allow short memcpy()s for MIPS16.  */
 int __attribute__((nomips16))
 #endif
+int
 main()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c
index 0663b12..c5fcad3 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c
@@ -12,6 +12,7 @@ t()
   return 1;
   abort ();
 }
+int
 main()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c
index d559b92..dc481c7 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c
@@ -10,6 +10,7 @@ int t()
break;
return i;
 }
+int
 main ()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c
index d6f603e..e3e15a8 100644
--- gcc/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c
+++ gcc/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c
@@ -2,6 +2,7 @@
 int a[1000];
 int b = 256;
 int c = 257;
+int
 main ()
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c 
gcc/gcc/testsuite/gcc.dg/tree-prof/val-

Re: parallel check output changes?

2014-10-02 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 11:47:39AM -0500, Segher Boessenkool wrote:
> On Wed, Sep 24, 2014 at 10:54:57AM -0400, Andrew MacLeod wrote:
> > Is this suppose to be resolved now?  I'm still seeing some issues with a 
> > branch cut from mainline from yesterday.
> 
> Confirmed.  The following patch works for me, and Andrew has tested it
> as well.  The comment it removes isn't valid before the patch either.
> 
> Okay for mainline?
> 
> 
> Segher
> 
> 
> 2014-10-02  Segher Boessenkool  
> 
> contrib/
>   * dg-extract-results.py (output_variation): Always sort if do_sum.

Ok, thanks.

> --- a/contrib/dg-extract-results.py
> +++ b/contrib/dg-extract-results.py
> @@ -495,15 +495,7 @@ class Prog:
> key = attrgetter ('name')):
>  sys.stdout.write ('Running ' + harness.name + ' ...\n')
>  if self.do_sum:
> -# Keep the original test result order if there was only
> -# one segment for this harness.  This is needed for
> -# unsorted.exp, which has unusual test names.  Otherwise
> -# sort the tests by test filename.  If there are several
> -# subtests for the same test filename (such as 'compilation',
> -# 'test for excess errors', etc.) then keep the subtests
> -# in the original order.
> -if len (harness.segments) > 1:
> -harness.results.sort()
> +harness.results.sort()
>  for (key, line) in harness.results:
>  sys.stdout.write (line)
>  else:

Jakub


[jit] Merger of trunk r215803 into jit branch

2014-10-02 Thread David Malcolm
I've merged the last ~3 weeks of changes of svn trunk to the git branch
dmalcolm/jit, pushing it as
dbfbacdbbf727e8ab3a8cff2d5650d8000de0449.

Specifically, this is from trunk r215803 aka
68874c5d021dd6b8b740ffd23960e46e333270b5 (2014-10-02) bringing in all
changes since r215090 aka65d8ffc239855f020a53c9ca5309642fec98ce9a
(2014-09-09).

With this I see jit.sum has: # of expected passes 4663 and no failures.




[PATCHv5] Vimrc config with GNU formatting

2014-10-02 Thread Yury Gribov

On 09/17/2014 09:08 PM, Yury Gribov wrote:
> On 09/16/2014 08:38 PM, Yury Gribov wrote:
>> Hi all,
>>
>> This is the third version of the patch. A list of changes since last
>> version:
>> * move config to contrib so that it's _not_ enabled by default (current
>> score is 2/1 in favor of no Vim config by default)
>> * update Makefile.in to make .local.vimrc if developer asks for it
>> * disable autoformatting for flex files
>> * fix filtering of non-GNU sources (libsanitizer)
>> * added some small fixes in cinoptions based on feedback from community
>>
>> As noted by Richard, the config does not do a good job of formatting
>> unbound {} blocks e.g.
>> void
>> foo ()
>> {
>>int x;
>>  {
>>// I'm an example of bad bad formatting
>>  }
>> }
>> but it seems to be the best we can get with Vim's cindent
>> (and I don't think anyone seriously considers writing a custom
>> indentexpr).
>>
>> Ok to commit?
>
> New vesion with support for another popular local .vimrc plugin.

Hi all,

Here is a new vesion of vimrc patch. Hope I got email settings right 
this time.


Changes since v4:
* fixed and enhanced docs
* added support for .lvimrc in Makefile
* minor fixes in cinoptions and formatoptions (reported by Segher)
* removed shiftwidth settings (as it does not really relate to code 
formatting)


-Y

commit 3f560e9dd16a5e914b6f2ba82edffe13dfde944c
Author: Yury Gribov 
Date:   Thu Oct 2 15:50:52 2014 +0400

2014-10-02  Laurynas Biveinis  
	Yury Gribov  

Vim config with GNU formatting.

contrib/
	* vimrc: New file.

/
	* .gitignore: Added .local.vimrc and .lvimrc.
	* Makefile.tpl (vimrc, .lvimrc, .local.vimrc): New targets.
	* Makefile.in: Regenerate.

diff --git a/.gitignore b/.gitignore
index e9b56be..ab97ac6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,9 @@ POTFILES
 TAGS
 TAGS.sub
 
+.local.vimrc
+.lvimrc
+
 .gdbinit
 .gdb_history
 
diff --git a/Makefile.in b/Makefile.in
index d6105b3..f3a34af 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2384,6 +2384,18 @@ mail-report-with-warnings.log: warning.log
 	chmod +x $@
 	echo If you really want to send e-mail, run ./$@ now
 
+# Local Vim config
+
+$(srcdir)/.local.vimrc:
+	$(LN_S) $(srcdir)/contrib/vimrc $@
+
+$(srcdir)/.lvimrc:
+	$(LN_S) $(srcdir)/contrib/vimrc $@
+
+vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
+
+.PHONY: vimrc
+
 # Installation targets.
 
 .PHONY: install uninstall
diff --git a/Makefile.tpl b/Makefile.tpl
index f7c7e38..b98930c 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -867,6 +867,18 @@ mail-report-with-warnings.log: warning.log
 	chmod +x $@
 	echo If you really want to send e-mail, run ./$@ now
 
+# Local Vim config
+
+$(srcdir)/.local.vimrc:
+	$(LN_S) $(srcdir)/contrib/vimrc $@
+
+$(srcdir)/.lvimrc:
+	$(LN_S) $(srcdir)/contrib/vimrc $@
+
+vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
+
+.PHONY: vimrc
+
 # Installation targets.
 
 .PHONY: install uninstall
diff --git a/contrib/vimrc b/contrib/vimrc
new file mode 100644
index 000..34e8f35
--- /dev/null
+++ b/contrib/vimrc
@@ -0,0 +1,45 @@
+" Code formatting settings for Vim.
+"
+" To enable this for GCC files by default, you can either source this file
+" in your .vimrc via autocmd:
+"   :au BufNewFile,BufReadPost path/to/gcc/* :so path/to/gcc/contrib/vimrc
+" or source the script manually for each newly opened file:
+"   :so contrib/vimrc
+" You could also use numerous plugins that enable local vimrc e.g.
+" mbr's localvimrc or thinca's vim-localrc (but note that the latter
+" is much less secure). To install local vimrc config, run
+"   $ make vimrc
+" from GCC build folder.
+" 
+" Copyright (C) 2014 Free Software Foundation, Inc.
+"
+" This program 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 of the License, or
+" (at your option) any later version.
+"
+" This program 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 program.  If not, see .
+
+function! SetStyle()
+  let l:fname = expand("%:p")
+  if stridx(l:fname, 'libsanitizer') != -1
+return
+  endif
+  let l:ext = fnamemodify(l:fname, ":e")
+  let l:c_exts = ['c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java']
+  if index(l:c_exts, l:ext) != -1
+setlocal cindent
+setlocal softtabstop=2
+setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,f0,h2,p4,t0,+2,(0,u0,w1,m0
+setlocal textwidth=80
+setlocal formatoptions-=ro formatoptions+=cqlt
+  endif
+endfunction
+
+call SetStyle()


Re: [PATCH] Provide global var location info for asan

2014-10-02 Thread Jakub Jelinek
On Wed, Sep 24, 2014 at 12:38:05PM +0200, Jakub Jelinek wrote:
> Ok for trunk?
> 
> 2014-09-24  Jakub Jelinek  
> 
>   * ubsan.h (ubsan_get_source_location): New prototype.
>   * ubsan.c (ubsan_source_location_type): New variable.
>   Function renamed to ...
>   (ubsan_get_source_location_type): ... this.  Cache
>   return value in ubsan_source_location_type variable.
>   (ubsan_source_location, ubsan_create_data): Use
>   ubsan_get_source_location_type instead of
>   ubsan_source_location_type.
>   * asan.c (asan_protect_global): Don't protect globals
>   with ubsan_get_source_location_type () type.
>   (asan_add_global): Provide global decl location info
>   if possible.

Ping?

Jakub


Re: feature-testing macros for 4.9

2014-10-02 Thread Thiago Macieira
On Thursday 02 October 2014 11:42:35 Jonathan Wakely wrote:
> The library macros are safe and can't cause any issues, so I'm happy for
> them to go on the branch.
> 
> I can think of at least two that aren't implemented on the branch:
>  and the std::is_final trait (although I'd be OK with the
> trait going on the branch too).

I'd also appreciate that the core language macros be defined too in 4.9. The 
patch I had submitted was based on 4.9 and tried to be the least intrusive as 
possible.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



Re: [C++ Patch/RFC] PR 53025

2014-10-02 Thread Jason Merrill

On 10/02/2014 12:44 PM, Paolo Carlini wrote:

+  s->noexcept_operand = scope_chain ? cp_noexcept_operand : 0;
s->x_stmt_tree.stmts_are_full_exprs_p = true;

scope_chain = s;
@@ -6182,6 +6183,7 @@ pop_from_top_level_1 (void)
current_function_decl = s->function_decl;
cp_unevaluated_operand = s->unevaluated_operand;
c_inhibit_evaluation_warnings = s->inhibit_evaluation_warnings;
+  cp_noexcept_operand = s->noexcept_operand;


The benefit of putting it in scope_chain directly is that you don't need 
to change anything here.  OK without these changes.


Jason



Re: [PATCH] Improve prepare_shrink_wrap to sink more instructions

2014-10-02 Thread Jiong Wang


On 02/10/14 09:49, Andrew Pinski wrote:

On Fri, Sep 19, 2014 at 1:43 PM, Jeff Law  wrote:

On 09/15/14 08:33, Jiong Wang wrote:


Jeff,

   thanks, I partially understand your meaning here.

take the function "ira_implicitly_set_insn_hard_regs" in ira-lives.c
for example,

when generating address rtl, gcc will automatically generate "const"
operator to prefix
the address expression, like the following. so a simple CONSTANT_P
check is enough in
case there is no embedded register.

(insn 309 310 308 3 (set (reg:DI 44 r15 [orig:94 ivtmp.674 ] [94])
  (const:DI (plus:DI (symbol_ref:DI ("recog_data") [flags 0x40]
)
  (const_int 480 [0x1e0] -1


but for architecture like aarch64, the following instruction
sequences to forming address
may be generated

(insn 73 14 74 4 (set (reg/f:DI 20 x20 [99])
  (high:DI (symbol_ref:DI ("global_a") [flags 0xc0]  ))) 35 {*movdi_aarch64}
   (expr_list:REG_EQUIV (high:DI (symbol_ref:DI ("global_a") [flags
0xc0]  ))
  (nil)))

(insn 17 30 25 5 (set (reg/f:DI 4 x4 [83])
  (lo_sum:DI (reg/f:DI 20 x20 [99])
  (symbol_ref:DI ("global_a") [flags 0xc0]  ))) {add_losym_di}
   (expr_list:REG_EQUIV (symbol_ref:DI ("global_a") [flags 0xc0]
)
  (nil)))

   while CONSTANT_P could not catch the latter lo_sum case, as the
RTX_CLASS of lo_sum is RTX_OBJ not RTX_CONST_OBJ,

Hmm, it's been ~15 years since I regularly worked on a target that uses
HIGH/LO_SUM, I thought we wrapped the LO_SUM expression inside a CONST as
well, but reading the docs for CONST, that clearly isn't the case.

Could we add a check for lo_sum since it is an RTX_OBJ rather than
RTX_COMM_ARITH or RTX_BIN_ARITH?


thanks, agree, that's exactly what I want to catch, while missed it during the 
patch re-write. I was been stupid!
anyway, I think we need to solve pr63404, 
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02568.html firstly, as it's a 
correctness regression.

--
Jiong


I am testing the patch for that to fix the above issue.  It shows up
with the testcase Jiong added but only with -mabi=ilp32 enabled.

Thanks,
Andrew Pinski


Sorry for that.  Can you (re) send your current patch for this for review?

Jeff





Re: [PATCH] gcc.dg/tree-prof/ cleanup

2014-10-02 Thread Jeff Law

On 10/02/14 11:01, Marek Polacek wrote:

This patch is a cleanup of tests in gcc.dg/tree-prof/ 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/tree-prof/crossmodule-indircall-1.c: Fix defaulting to int.
* gcc.dg/tree-prof/crossmodule-indircall-1a.c: Likewise.
* gcc.dg/tree-prof/merge_block.c: Likewise.
* gcc.dg/tree-prof/peel-1.c: Likewise.
* gcc.dg/tree-prof/stringop-1.c: Likewise.
* gcc.dg/tree-prof/stringop-2.c: Likewise.
* gcc.dg/tree-prof/unroll-1.c: Likewise.
* gcc.dg/tree-prof/update-cunroll-2.c: Likewise.
* gcc.dg/tree-prof/val-prof-1.c: Likewise.
* gcc.dg/tree-prof/val-prof-2.c: Likewise.
* gcc.dg/tree-prof/val-prof-3.c: Likewise.
* gcc.dg/tree-prof/val-prof-4.c: Likewise.
* gcc.dg/tree-prof/val-prof-5.c: Likewise.
* gcc.dg/tree-prof/val-prof-6.c: Likewise.
* gcc.dg/tree-prof/cmpsf-1.c: Likewise.
* gcc.dg/tree-prof/inliner-1.c: Use -fgnu89-inline.  Fix defaulting
to int.

OK.
Jeff



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

2014-10-02 Thread Jason Merrill

On 10/02/2014 12:41 PM, DJ Delorie wrote:

The C++ standard says that extended integer types participate in the
usual arithmetic conversions.  If I add a 32-bit int and an __int48, the
usual arithmetic conversions should convert the int to __int48.


Except the code you're referring to isn't part of that conversion.  It
only handles types that are the same size, not different sizes


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?



The test would only pass for msp430x (and fail for msp430, which is
the same target back-end).  Do I need to redo the big patch, or would
a separate one suffice?


Separate is fine.

Jason



Re: [PATCH] gcc.dg/noncompile/ cleanup

2014-10-02 Thread Jeff Law

On 10/02/14 10:48, Marek Polacek wrote:

This patch is a cleanup of tests in gcc.dg/noncompile/ 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/noncompile/20020130-1.c: Use -std=gnu89.
* gcc.dg/noncompile/20050120-1.c: Likewise.
* gcc.dg/noncompile/old-style-parm-2.c: Likewise.
* gcc.dg/noncompile/920616-2.c: Fix defaulting to int.
* gcc.dg/noncompile/930301-1.c: Likewise.
* gcc.dg/noncompile/930622-1.c: Likewise.
* gcc.dg/noncompile/930622-2.c: Likewise.
* gcc.dg/noncompile/950825-1.c: Likewise.
* gcc.dg/noncompile/invalid_asm.c: Likewise.
* gcc.dg/noncompile/scope.c: Likewise.
* gcc.dg/noncompile/va-arg-1.c: Likewise.
* gcc.dg/noncompile/920923-1.c: Fix implicit declarations.
* gcc.dg/noncompile/971104-1.c: Likewise.

OK.
Jeff



Re: parallel check output changes?

2014-10-02 Thread Richard Sandiford
Segher Boessenkool  writes:
> On Wed, Sep 24, 2014 at 10:54:57AM -0400, Andrew MacLeod wrote:
>> Is this suppose to be resolved now?  I'm still seeing some issues with a 
>> branch cut from mainline from yesterday.
>
> Confirmed.  The following patch works for me, and Andrew has tested it
> as well.  The comment it removes isn't valid before the patch either.

I get the impression from a short dismissal like that that this script
is pretty hated :-(.  Remember that originally the script was trying to
make the result of combining separate .sum files the same as the .sum
file you'd get for -j1.  As Jakub said upthread, that's a lost cause
with the new approach to parallel testing, but I think the comment was
valid while matching -j1 was still a goal.

Thanks,
Richard


Go patch committed: Fix symbol name adjustments to match go tool

2014-10-02 Thread Ian Lance Taylor
In the go tool, when converting the pkgpath argument to use for a symbol
name, everything except alphanumeric characters is converted to an
underscore character.  This is PR 61880.  This patch from Alexander
Shopov changes the Go frontend to match, so that the symbol names
generated by the cgo tool come out the same.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 82a9d752ff1f go/gogo.cc
--- a/go/gogo.cc	Thu Oct 02 10:53:01 2014 -0700
+++ b/go/gogo.cc	Thu Oct 02 10:54:51 2014 -0700
@@ -258,10 +258,7 @@
   char c = s[i];
   if ((c >= 'a' && c <= 'z')
 	  || (c >= 'A' && c <= 'Z')
-	  || (c >= '0' && c <= '9')
-	  || c == '_'
-	  || c == '.'
-	  || c == '$')
+	  || (c >= '0' && c <= '9'))
 	;
   else
 	s[i] = '_';


Re: [PATCH, i386, Pointer Bounds Checker 38/x] Avoid warning for missed IPA_REF_CHKP in switch

2014-10-02 Thread Jeff Law

On 10/02/14 07:49, Ilya Enkovich wrote:

On 02 Oct 15:34, Marek Polacek wrote:

On Thu, Oct 02, 2014 at 05:29:15PM +0400, Ilya Enkovich wrote:

Hi,

Seems some new warnings appeared lately and now I see a bootstrap failure for 
mpx branch due to missing IPA_REF_CHKP case in switch statement in 
process_references function.  This function handles varpool_nodes which cannot 
have references of this kind.  This patch fixes a warning.


Yeah, -Wswitch now works even with enum bit-fields, and use in ipa_ref
is an enum bit-fields.


2014-10-01  Ilya Enkovich  

* ipa.c (process_references): Support IPA_REF_CHKP.


Probably s/Support/Handle/.


diff --git a/gcc/ipa.c b/gcc/ipa.c
index 39ee815..78f251a 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -637,6 +637,8 @@ process_references (varpool_node *vnode,
process_references (dyn_cast (ref->referring), written,
address_taken, read, explicit_refs);
break;
+  case IPA_REF_CHKP:
+   gcc_unreachable ();


Looks ok.

Marek


Thanks for looking inot it.  Here is a version with modified ChangeLog.

Ilya
--
2014-10-02  Ilya Enkovich  

* ipa.c (process_references): Handle IPA_REF_CHKP.

OK.
Jeff



Re: [PATCH] gcc.dg/vect/ cleanup

2014-10-02 Thread Jeff Law

On 10/02/14 07:39, Marek Polacek wrote:

This patch is a cleanup of tests in gcc.dg/vect/ 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.

Ok?

2014-10-02  Marek Polacek  

* gcc.dg/vect/pr24049.c: Fix implicit declarations.
* gcc.dg/vect/pr37730.c: Likewise.
* gcc.dg/vect/pr52870.c: Likewise.
* gcc.dg/vect/pr60092-2.c: Likewise.
* gcc.dg/vect/pr60092.c: Likewise.
* gcc.dg/vect/vect-reduc-sad.c: Likewise.
* gcc.dg/vect/pr26359.c: Fix defaulting to int.
* gcc.dg/vect/pr31041.c: Likewise.
* gcc.dg/vect/pr32216.c: Likewise.
* gcc.dg/vect/pr32224.c: Likewise.
* gcc.dg/vect/pr32366.c: Likewise.
* gcc.dg/vect/pr33866.c: Likewise.
* gcc.dg/vect/pr43430-2.c: Likewise.
* gcc.dg/vect/pr43842.c: Likewise.
* gcc.dg/vect/vect-1.c: Likewise.
* gcc.dg/vect/vect-1-big-array.c: Likewise.
* gcc.dg/vect/vect-93.c: Likewise.
* gcc.dg/vect/pr28952.c: Fix implicit declarations and
defaulting to int.

OK.

In fact, I think I'll just go ahead and pre-approve the other patches of 
this nature.



Jeff



Re: Go patch committed: Fix symbol name adjustments to match go tool

2014-10-02 Thread Ian Lance Taylor
On Thu, Oct 2, 2014 at 10:56 AM, Ian Lance Taylor  wrote:
> In the go tool, when converting the pkgpath argument to use for a symbol
> name, everything except alphanumeric characters is converted to an
> underscore character.  This is PR 61880.  This patch from Alexander
> Shopov changes the Go frontend to match, so that the symbol names
> generated by the cgo tool come out the same.  Bootstrapped and ran Go
> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Forgot to say: also committing to 4.9 branch.

Ian


Re: parallel check output changes?

2014-10-02 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 06:46:19PM +0100, Richard Sandiford wrote:
> Segher Boessenkool  writes:
> > On Wed, Sep 24, 2014 at 10:54:57AM -0400, Andrew MacLeod wrote:
> >> Is this suppose to be resolved now?  I'm still seeing some issues with a 
> >> branch cut from mainline from yesterday.
> >
> > Confirmed.  The following patch works for me, and Andrew has tested it
> > as well.  The comment it removes isn't valid before the patch either.
> 
> I get the impression from a short dismissal like that that this script
> is pretty hated :-(.  Remember that originally the script was trying to

No, it is certainly appreciated that it speeded up the processing.

> make the result of combining separate .sum files the same as the .sum
> file you'd get for -j1.  As Jakub said upthread, that's a lost cause
> with the new approach to parallel testing, but I think the comment was
> valid while matching -j1 was still a goal.

I'm sorry for invalidating those assumptions.  Indeed, before my recent
changes, all tests for the same testcase name were run serially by the same
job.  If we wanted to preserve that property, we could e.g. store the
results of gcc_parallel_test_run_p in some tcl array with testcase as the
key, and after the
if { $gcc_runtest_parallelize_enable == 0 } {
return 1
}
test add a test if we've been asked about a particular testcase already,
just return what we've returned before.  Perhaps accompany that with
lowering the granularity (e.g. from 10 to 5).

Jakub


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

2014-10-02 Thread DJ Delorie

> 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.


Re: [PATCH 1/5] Fix error location for cilk error message

2014-10-02 Thread Jeff Law

On 10/01/14 22:26, Andi Kleen wrote:

From: Andi Kleen 

Output the correct location for an existing cilk error message.

gcc/c-family/:

2014-09-28  Andi Kleen  

* cilk.c (recognize_spawn): Use expression location
for error message.'

OK.
Jeff



Re: [PATCH 4/5] Fix some of the existing Cilk tests for the new errors.

2014-10-02 Thread Jeff Law

On 10/01/14 22:26, Andi Kleen wrote:

From: Andi Kleen 

gcc/testsuite/:

2014-09-30  Andi Kleen  

* c-c++-common/cilk-plus/AN/misc.c (main): Handle
new cilk errors.

OK.
Jeff



Re: [PATCH 3/5] Add test cases for all the new cilk errors

2014-10-02 Thread Jeff Law

On 10/01/14 22:26, Andi Kleen wrote:

From: Andi Kleen 

gcc/testsuite/:

2014-09-30  Andi Kleen  

* c-c++-common/cilk-plus/CK/errors.c: New test.

OK.
Jeff



Re: [C++ Patch/RFC] PR 53025

2014-10-02 Thread Paolo Carlini

Hi,

On 10/02/2014 07:37 PM, Jason Merrill wrote:

On 10/02/2014 12:44 PM, Paolo Carlini wrote:

+  s->noexcept_operand = scope_chain ? cp_noexcept_operand : 0;
s->x_stmt_tree.stmts_are_full_exprs_p = true;

scope_chain = s;
@@ -6182,6 +6183,7 @@ pop_from_top_level_1 (void)
current_function_decl = s->function_decl;
cp_unevaluated_operand = s->unevaluated_operand;
c_inhibit_evaluation_warnings = s->inhibit_evaluation_warnings;
+  cp_noexcept_operand = s->noexcept_operand;


The benefit of putting it in scope_chain directly is that you don't 
need to change anything here.  OK without these changes.

Oh, nice. Then I'm going to apply the below and resolve the bug.

Thanks,
Paolo.

///
/cp
2014-10-02  Paolo Carlini  

PR c++/53025
* cp-tree.h (struct saved_scope): Add noexcept_operand.
(cp_noexcept_operand): Define.
* call.c (build_over_call): Use it.
* parser.c (cp_parser_unary_expression, [RID_NOEXCEPT]): Likewise.
* pt.c (tsubst_copy_and_build, [NOEXCEPT_EXPR]): Likewise.

/testsuite
2014-10-02  Paolo Carlini  

PR c++/53025
* g++.dg/cpp0x/noexcept23.C: New.
* g++.dg/cpp0x/noexcept24.C: Likewise.
Index: cp/call.c
===
--- cp/call.c   (revision 215801)
+++ cp/call.c   (working copy)
@@ -7251,7 +7251,11 @@ build_over_call (struct z_candidate *cand, int fla
 /* Do things the hard way.  */;
   else if (cand->num_convs == 1 
&& (DECL_COPY_CONSTRUCTOR_P (fn) 
-   || DECL_MOVE_CONSTRUCTOR_P (fn)))
+   || DECL_MOVE_CONSTRUCTOR_P (fn))
+  /* It's unsafe to elide the constructor when handling
+ a noexcept-expression, it may evaluate to the wrong
+ value (c++/53025).  */
+  && cp_noexcept_operand == 0)
 {
   tree targ;
   tree arg = argarray[num_artificial_parms_for (fn)];
Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 215801)
+++ cp/cp-tree.h(working copy)
@@ -1058,6 +1058,7 @@ struct GTY(()) saved_scope {
 
   int unevaluated_operand;
   int inhibit_evaluation_warnings;
+  int noexcept_operand;
   /* If non-zero, implicit "omp declare target" attribute is added into the
  attribute lists.  */
   int omp_declare_target_attribute;
@@ -1124,6 +1125,10 @@ struct GTY(()) saved_scope {
 
 #define local_specializations scope_chain->x_local_specializations
 
+/* Nonzero if we are parsing the operand of a noexcept operator.  */
+
+#define cp_noexcept_operand scope_chain->noexcept_operand
+
 /* A list of private types mentioned, for deferred access checking.  */
 
 extern GTY(()) struct saved_scope *scope_chain;
Index: cp/parser.c
===
--- cp/parser.c (revision 215801)
+++ cp/parser.c (working copy)
@@ -7156,7 +7156,9 @@ cp_parser_unary_expression (cp_parser *parser, boo
 
++cp_unevaluated_operand;
++c_inhibit_evaluation_warnings;
+   ++cp_noexcept_operand;
expr = cp_parser_expression (parser);
+   --cp_noexcept_operand;
--c_inhibit_evaluation_warnings;
--cp_unevaluated_operand;
 
Index: cp/pt.c
===
--- cp/pt.c (revision 215801)
+++ cp/pt.c (working copy)
@@ -14769,11 +14769,13 @@ tsubst_copy_and_build (tree t,
   op1 = TREE_OPERAND (t, 0);
   ++cp_unevaluated_operand;
   ++c_inhibit_evaluation_warnings;
+  ++cp_noexcept_operand;
   op1 = tsubst_copy_and_build (op1, args, complain, in_decl,
   /*function_p=*/false,
   /*integral_constant_expression_p=*/false);
   --cp_unevaluated_operand;
   --c_inhibit_evaluation_warnings;
+  --cp_noexcept_operand;
   RETURN (finish_noexcept_expr (op1, complain));
 
 case MODOP_EXPR:
Index: testsuite/g++.dg/cpp0x/noexcept23.C
===
--- testsuite/g++.dg/cpp0x/noexcept23.C (revision 0)
+++ testsuite/g++.dg/cpp0x/noexcept23.C (working copy)
@@ -0,0 +1,14 @@
+// PR c++/53025
+// { dg-do compile { target c++11 } }
+
+struct A {
+  A() noexcept {}
+  A(const A&) noexcept(false) {}
+};
+
+void a(A) noexcept {}
+
+void f()
+{
+  static_assert(!noexcept(a(A{})), "");
+}
Index: testsuite/g++.dg/cpp0x/noexcept24.C
===
--- testsuite/g++.dg/cpp0x/noexcept24.C (revision 0)
+++ testsuite/g++.dg/cpp0x/noexcept24.C (working copy)
@@ -0,0 +1,22 @@
+// PR c++/53025
+// { dg-do compile { target c++11 } }
+
+template
+struct A {
+  A() noexcept {}
+  A(const A&) noexcept(false) {}
+};
+
+template
+void a(A) noexcept {}
+
+template
+void f()
+{
+  static_assert(!noexcept(a(A{})), "");
+}
+
+void g()
+{
+  f();
+}


Re: RFA: RTL typesafety improvements for ira.c

2014-10-02 Thread Jeff Law

On 10/01/14 17:27, David Malcolm wrote:

On Wed, 2014-10-01 at 16:34 -0600, Jeff Law wrote:

This was inspired by a discussion with Felix who was making changes in
this area.

Basically this promotes the "init_insns" field within struct equivalence
from an rtx to an rtx_insn_list.

The only thing that's really interesting here is the old code exploits
the fact that we could put any RTX in the list by shoving const0_rtx
into the init_insns list as a marker to indicate we've already
determined the relevant pseudo must not have an equivalence.

Thus we could have the following objects in the init_insns field:

NULL
const0_rtx
INSN_LIST ...

This patch uses INSN_LIST (NULL_RTX, NULL) as the special marker.  Thus
the only two things that would exist in the init_insns field would be
NULL or an INSN_LIST.  Goodness.

Rather than stash away the special marker INSN_LIST into a global
variable or something similar, we instead to do a two step check for the
marker.  First verify that the insn_list field is non-NULL, then look at
the first insn in the list and see if that is NULL.

Bootstrapped and regression tested on i686-unknown-linux-gnu and
x86_64-unknown-linux-gnu.

Ok for the trunk?



[...]


* ira.c (struct equivalence): Promote INIT_INSNs field to
an rtx_insn_list.  Add comments.
(no_equiv): Promote LIST to an rtx_insn_list.  Update
testing for and creating the special marker.  Use methods
to extract the insn and next pointers.
(update_equiv_regs): Update test for special marker in the
INIT_INSNs list.

diff --git a/gcc/ira.c b/gcc/ira.c

[...]


@@ -3258,9 +3266,9 @@ no_equiv (rtx reg, const_rtx store ATTRIBUTE_UNUSED,
  return;
ira_reg_equiv[regno].defined_p = false;
ira_reg_equiv[regno].init_insns = NULL;
-  for (; list; list =  XEXP (list, 1))
+  for (; list; list = list->next ())
  {
-  rtx insn = XEXP (list, 0);
+  rtx insn = list->insn ();
remove_note (insn, find_reg_note (insn, REG_EQUIV, NULL_RTX));


FWIW, presumably "insn" here also can now be an rtx_insn *?

Yes.  I'll update that.  Thanks.

Jeff



Re: [C++ Patch] Add default arguments to cp_parser_assignment_expression and cp_parser_constant_expression

2014-10-02 Thread Jason Merrill

On 08/19/2014 08:18 AM, Paolo Carlini wrote:

-   /*non_constant_p=*/&dummy);
+   &dummy);


Why remove the comment?

The rest of the patch is OK.

Jason



Re: [PATCH] gcc.dg/vect/ cleanup

2014-10-02 Thread Marek Polacek
On Thu, Oct 02, 2014 at 11:58:37AM -0600, Jeff Law wrote:
> In fact, I think I'll just go ahead and pre-approve the other patches of
> this nature.

Thanks.  I have a bunch of similar patches that just need proper CL
entries, but they're of the same nature: missing declarations,
defaulting to int, gnu89 inline.

Even with these patches in, we'll still keep several dozens of test
that are using -std=gnu89, so we'll have some testing of functions
that don't have a return type specified/have missing forward
declarations/use gnu89 inline.

Marek


Re: [C++ Patch] Add default arguments to cp_parser_assignment_expression and cp_parser_constant_expression

2014-10-02 Thread Paolo Carlini

Hi,

On 10/02/2014 08:03 PM, Jason Merrill wrote:

On 08/19/2014 08:18 AM, Paolo Carlini wrote:

- /*non_constant_p=*/&dummy);
+   &dummy);


Why remove the comment?
Oh well, the rationale was that normally we use that sort of comment 
only to explain integer literals, boolean literals. But I don't have a 
strong opinion ;)

The rest of the patch is OK.

Good, thanks!

Paolo.


Re: parallel check output changes?

2014-10-02 Thread Segher Boessenkool
On Thu, Oct 02, 2014 at 06:46:19PM +0100, Richard Sandiford wrote:
> Segher Boessenkool  writes:
> > On Wed, Sep 24, 2014 at 10:54:57AM -0400, Andrew MacLeod wrote:
> >> Is this suppose to be resolved now?  I'm still seeing some issues with a 
> >> branch cut from mainline from yesterday.
> >
> > Confirmed.  The following patch works for me, and Andrew has tested it
> > as well.  The comment it removes isn't valid before the patch either.
> 
> I get the impression from a short dismissal like that that this script
> is pretty hated :-(.

I meant that it isn't valid currently; it was valid before the parallelisation
patches.  It would be nice if we could reconstruct the original order somehow.
Without this patch the order is different every run though, and that makes
comparing testresults unworkable.


Segher


Re: [C++] Handle && || ! for simd vectors

2014-10-02 Thread Jason Merrill
OK.  Sorry for the delay, please feel free to ping patches as often as 
once a week.


Jason


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

2014-10-02 Thread Aldy Hernandez

On 10/02/14 08:46, Jason Merrill wrote:

On 10/01/2014 05:31 PM, Aldy Hernandez wrote:

+  for (tree t = level->names; t; t = TREE_CHAIN(t))
+if (TREE_CODE (t) != TYPE_DECL
+&& TREE_CODE (t) != PARM_DECL
+&& !DECL_IS_BUILTIN (t))
+  debug_hooks->early_global_decl (t);


What does this do for templates?  I think we don't want to send a
template off to early_global_decl, but rather walk through its
specializations and emit them.


Hmm, I'll look into this.


Why do you need to check for PARM_DECL?  There shouldn't be any
PARM_DECL at namespace scope.

Why do you want to skip TYPE_DECL?  I think we should leave the decision
about whether to emit a typedef to the debugging back end.


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.


This means that we'll need to clean up unreachable/unused DIEs after the 
flow graph has been built.


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, this seems like an 
argument for early dumping all *_DECLs directly from 
rest_of_decl_compilation() (as you've hinted) and then cleaning up 
unused DIEs after we have flow information.


Does this seem reasonable?

Aldy



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

2014-10-02 Thread Jeff Law

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  

* 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?

Jeff



Re: [patch] Do not generate useless integral conversions

2014-10-02 Thread Jeff Law

On 10/02/14 04:40, Eric Botcazou wrote:

[This is an old discussion about useless integral conversions introduced
behind the back of the front-end by the routines in convert.c]


I don't like re-introducing that inconsistency.


OK.


Maybe instead make convert.c do if (!TYPE_UNSIGNED) unsigned_type_for ()
instead?  I notice that all callers of [un]signed_type_for are in
"premature" optimizations convert.c performs (that better should be done
in fold-const.c).


Yes, that works for me too, patch attached, it makes sure convert_to_integer
only fiddles with the type when strictly necessary.  Tested on x86-64/Linux.


2014-10-02  Eric Botcazou  

* convert.c (convert_to_integer): Do not introduce useless conversions
between integral types.

OK.
Jeff



Re: Fix hard_regno bitfield in IRA allocno struct

2014-10-02 Thread Jeff Law

On 10/02/14 04:29, David Sherwood wrote:

Hi,

At the request of Andreas Schwab I have fixed the hard_regno bitfield
in the allocno structure as signed integers need to be explicitly marked as
signed in bitfields.

Cheers,
Dave.

gcc/ChangeLog:

2014-10-02  David Sherwood  

 * ira-int.h: (ira_allocno) Make hard_regno explicitly signed

OK.  Please install.
jeff


Re: [PATCH] Redesign jump threading profile updates

2014-10-02 Thread Jeff Law

On 10/01/14 14:04, Teresa Johnson wrote:

The block frequencies are very small in this case leading to rounding
errors when computing the edge frequency. The rounding error was then
propagated into the recomputed probabilities, leading to insanities in
the outgoing edge probabilities on the jump threading path. Eventually
during rtl expansion these insanities somehow caused an ICE.

(Before this patch the probabilities weren't even being updated,
leading to insanities in other cases where they needed to be updated.)

Specifically, in this case we had a block with frequency = 1. It had
two outgoing edges each with probability 50%. Because the
EDGE_FREQUENCY computation uses a rounding divide, the outgoing edge
frequencies were both computed as 1. Later use of these block and edge
frequencies to recompute the probability lead to both outgoing edges
getting 100%.

To address this, in the routine freqs_to_counts_path can simply scale
up the frequencies when recording them in the count field. I added a
scale by REG_BR_PROB_BASE. The largest count possible would therefore
be REG_BR_PROB_BASE * BB_FREQ_MAX which is 1 * 1 = 100mil
which safely fits in gcov_type.

Here is the patch I am testing. Confirmed it fixes the reported issue.
Currently bootstrapping and testing on x86_64-unknown-linux-gnu. Ok
for trunk if it passes?

(The whitespace is getting messed up when I copy the patch in here -
the indentations do line up in the patch.)

Thanks,
Teresa

2014-10-01  Teresa Johnson  

 * tree-ssa-threadupdate.c (freqs_to_counts_path): Scale frequencies
 up when synthesizing counts to avoid rounding errors.

OK.
jeff



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

2014-10-02 Thread Uros Bizjak
On Wed, Oct 1, 2014 at 9:03 PM, Uros Bizjak  wrote:

>> And now the expand_vec_perm_palignr improvement, tested
>> with GCC_TEST_RUN_EXPENSIVE=1 make check-gcc \
>> RUNTESTFLAGS='--target_board=unix/-mavx2 dg-torture.exp=vshuf*.c'
>> E.g.
>> typedef unsigned long long V __attribute__ ((vector_size (32)));
>> extern void abort (void);
>> V a, b, c, d;
>> void test_14 (void)
>> {
>>   V mask = { 6, 1, 3, 4 };
>>   int i;
>>   c = __builtin_shuffle (a, mask);
>>   d = __builtin_shuffle (a, b, mask);
>> }
>> (distilled from test 15 in vshuf-v4di.c) results in:
>> -   vmovdqa a(%rip), %ymm0
>> -   vpermq  $54, %ymm0, %ymm1
>> -   vpshufb .LC1(%rip), %ymm0, %ymm0
>> -   vmovdqa %ymm1, c(%rip)
>> -   vmovdqa b(%rip), %ymm1
>> -   vpshufb .LC0(%rip), %ymm1, %ymm1
>> -   vpermq  $78, %ymm1, %ymm1
>> -   vpor%ymm1, %ymm0, %ymm0
>> +   vmovdqa a(%rip), %ymm1
>> +   vpermq  $54, %ymm1, %ymm0
>> +   vmovdqa %ymm0, c(%rip)
>> +   vmovdqa b(%rip), %ymm0
>> +   vpalignr$8, %ymm1, %ymm0, %ymm0
>> +   vpermq  $99, %ymm0, %ymm0
>> vmovdqa %ymm0, d(%rip)
>> vzeroupper
>> ret
>> change (and two fewer .rodata constants).
>
> On a related note, I would like to point out that
> gcc.target/i386/pr61403.c also fails to generate blend insn with
> -mavx2. The new insn sequence includes lots of new vpshufb insns with
> memory access.

Following patch fixes the failure:

--cut here--
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.  */

However, I see a significant reduction in vpshufb and vpor
instructions (33->16 and 22->11), and 6 new vblendps insns.

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'".

Jakub, what do you think?

Uros.


Re: [PATCH] Fix PR63422 to handle profile insanities

2014-10-02 Thread Jeff Law

On 10/01/14 10:59, Teresa Johnson wrote:

This patch removes some asserts my jump threading patch r215739 added.
An upstream pass (copyrename2) is introducing some bogus profile
counts, so we can't assert that counts are 0 when there is no profile
data for the function.

Tested on testcase attached to PR63422. Currently running gcc
regression tests for x86_64-unknown-linux-gnu. Ok for trunk if that
passes?

Thanks,
Teresa

2014-10-01  Teresa Johnson  

 PR middle-end/63422
 * tree-ssa-threadupdate.c (freqs_to_counts_path): Remove
 asserts to handle incoming insanities.

OK.
Jeff



Re: [PATCH] Fix PR63422 to handle profile insanities

2014-10-02 Thread Jeff Law

On 10/01/14 11:03, Xinliang David Li wrote:

Probably need to file a bug to track the copyrename2 problem.

Yea, that would definitely be appreciated.

Jeff



Re: parallel check output changes?

2014-10-02 Thread Andrew MacLeod

On 10/02/2014 02:14 PM, Segher Boessenkool wrote:

On Thu, Oct 02, 2014 at 06:46:19PM +0100, Richard Sandiford wrote:

Segher Boessenkool  writes:

On Wed, Sep 24, 2014 at 10:54:57AM -0400, Andrew MacLeod wrote:

Is this suppose to be resolved now?  I'm still seeing some issues with a
branch cut from mainline from yesterday.

Confirmed.  The following patch works for me, and Andrew has tested it
as well.  The comment it removes isn't valid before the patch either.

I get the impression from a short dismissal like that that this script
is pretty hated :-(.

I meant that it isn't valid currently; it was valid before the parallelisation
patches.  It would be nice if we could reconstruct the original order somehow.
Without this patch the order is different every run though, and that makes
comparing testresults unworkable.




Doesn't this patch make it always sort?   And that should mean that -j1 
will be the same as -JN again... ? it won't be the same order as 
before the patches...  but I doubt that is important... not that I'm 
aware of anyway.


Andrew



Andrew


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

2014-10-02 Thread DJ Delorie

> > The test would only pass for msp430x (and fail for msp430, which is
> > the same target back-end).  Do I need to redo the big patch, or would
> > a separate one suffice?
> 
> Separate is fine.

Turns out it's mangled like this:

__int20 foo (__int20 a, unsigned __int20 b);

_Z3foou5int20u6uint20


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

2014-10-02 Thread Bill Schmidt
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  

* 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  

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


Index: gcc/config/rs6000/altivec.md
===
--- gcc/config/rs6000/altivec.md(revision 215689)
+++ gcc/config/rs6000/altivec.md(working copy)
@@ -2297,7 +2297,31 @@
   "dststt %0,%1,%2"
   [(set_attr "type" "vecsimple")])
 
-(define_insn "altivec_lvsl"
+(define_expand "altivec_lvsl"
+  [(use (match_operand:V16QI 0 "register_operand" ""))
+   (use (match_operand:V16QI 1 "memory_operand" ""))]
+  "TARGET_ALTIVEC"
+{
+  if (VECTOR_ELT_ORDER_BIG)
+emit_insn (gen_altivec_lvsl_direct (operands[0], operands[1]));
+  else
+{
+  int i;
+  rtx mask, perm[16], constv, vperm;
+  mask = gen_reg_rtx (V16QImode);
+  emit_insn (gen_altivec_lvsl_direct (mask, operands[1]));
+  for (i = 0; i < 16; ++i)
+perm[i] = GEN_INT (i);
+  constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm));
+  constv = force_reg (V16QImode, constv);
+  vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv),
+  UNSPEC_VPERM);
+  emit_insn (gen_rtx_SET (VOIDmode, operands[0], vperm));
+}
+  DONE;
+})
+
+(define_insn "altivec_lvsl_direct"
   [(set (match_operand:V16QI 0 "register_operand" "=v")
(unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")]
  UNSPEC_LVSL))]
@@ -2305,7 +2329,31 @@
   "lvsl %0,%y1"
   [(set_attr "type" "vecload")])
 
-(define_insn "altivec_lvsr"
+(define_expand "altivec_lvsr"
+  [(use (match_operand:V16QI 0 "register_operand" ""))
+   (use (match_operand:V16QI 1 "memory_operand" ""))]
+  "TARGET_ALTIVEC"
+{
+  if (VECTOR_ELT_ORDER_BIG)
+emit_insn (gen_altivec_lvsr_direct (operands[0], operands[1]));
+  else
+{
+  int i;
+  rtx mask, perm[16], constv, vperm;
+  mask = gen_reg_rtx (V16QImode);
+  emit_insn (gen_altivec_lvsr_direct (mask, operands[1]));
+  for (i = 0; i < 16; ++i)
+perm[i] = GEN_INT (i);
+  constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm));
+  constv = force_reg (V16QImode, constv);
+  vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv),
+  UNSPEC_VPERM);
+  emit_insn (gen_rtx_SET (VOIDmode, operands[0], vperm));
+}
+  DONE;
+})
+
+(define_insn "altivec_lvsr_direct"
   [(set (match_operand:V16QI 0 "register_operand" "=v")
(unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")]
  UNSPEC_LVSR))]
Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 215689)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -13898,8 +13898,8 @@ rs6000_expand_builtin (tree exp, rtx target, rtx s
 case ALTIVEC_BUILTIN_MASK_FOR_LOAD:
 case ALTIVEC_BUILTIN_MASK_FOR_STORE:
   {
-   int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr
-: (int) CODE_FOR_altivec_lvsl);
+   int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr_direct
+: (int) CODE_FOR_altivec_lvsl_direct);
enum machine_mode tmode = insn_data[icode].operand[0].mode;
enum machine_mode mode = insn_data[icode].operand[1].mode;
tree arg;
@@ -13927,7 +13927,6 @@ rs6000_expand_builtin (tree exp, rtx target, rtx s
|| ! (*insn_data[icode].operand[0].predicate) (target, tmode))
  target = gen_reg_rtx (tmode);
 
-   /*pat = gen_altivec_lvsr (target, op);*/
pat = GEN_FCN (icode) (target, op);
if (!pat)
  return 0;
Index: gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
===
--- gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c(working copy)
@@ -0,0 +1,21 @@
+/* Test expected code generation for lvsl and lvsr on little endian.
+   Note that lvsl and lvsr are each produced once, but the filename
+   causes them to appear twice in the file.  */
+
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-options "-O0 -Wno-deprecated" } */
+/* { dg-final { scan-assembler-times "lvsl" 2 } } */
+/* { dg-final { scan-assembler-times "lvsr" 2 } } */
+/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */
+/* { dg-final { scan-as

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

2014-10-02 Thread Aldy Hernandez

On 10/02/14 08:53, Jason Merrill wrote:

On 09/30/2014 02:43 PM, Aldy Hernandez wrote:

+  if (parm_die
+  /* Make sure the function to which this parameter belongs to is
+ not an abstract instance.  If it is, we can't reuse anything.
+ We must create a new DW_TAG_formal_parameter with a
+ corresponding DW_AT_abstract_origin.  */
+  && !get_AT (context_die, DW_AT_abstract_origin))


Can we use the same test here that we do later in this function, namely
origin && origin != node?


Actually yes.  But I think you mean "!origin", for the parm_die==true 
case anyhow.  So something like the following (as in the attached patch):


  /* If we have a previously generated DIE, use it, unless this is an
 abstract instance (origin != NULL), in which case we need a new
 DIE with a corresponding DW_AT_abstract_origin.  */
  bool reusing_die;
  if (parm_die && origin == NULL)
reusing_die = true;
  else
{
  parm_die = new_die (DW_TAG_formal_parameter, context_die, node);
  reusing_die = false;
}




-  if (origin != NULL && origin != decl)
+  if (origin != NULL && (origin != decl || old_die))


Don't we want to go back to "if (origin != NULL)" here too?


Sure.

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

Thanks for your comments.
Aldy
commit 96593217826a123b907c600c205fd46b012c77e4
Author: Aldy Hernandez 
Date:   Thu Oct 2 12:21:12 2014 -0700

* dwarf2out.c (gen_formal_parameter_die): Simplify check for
abstract instance.
(gen_subprogram_die): Same.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 6830abd..16998c5 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -17786,13 +17786,11 @@ gen_formal_parameter_die (tree node, tree origin, 
bool emit_name_p,
}
 }
 
+  /* If we have a previously generated DIE, use it, unless this is an
+ abstract instance (origin != NULL), in which case we need a new
+ DIE with a corresponding DW_AT_abstract_origin.  */
   bool reusing_die;
-  if (parm_die
-  /* Make sure the function to which this parameter belongs to is
-not an abstract instance.  If it is, we can't reuse anything.
-We must create a new DW_TAG_formal_parameter with a
-corresponding DW_AT_abstract_origin.  */
-  && !get_AT (context_die, DW_AT_abstract_origin))
+  if (parm_die && origin == NULL)
 reusing_die = true;
   else
 {
@@ -18349,7 +18347,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
   && debug_info_level > DINFO_LEVEL_TERSE)
 old_die = force_decl_die (decl);
 
-  if (origin != NULL && (origin != decl || old_die))
+  if (origin != NULL)
 {
   gcc_assert (!declaration || local_scope_p (context_die));
 


  1   2   >