[PING^3] [PATCH] [AArch64, NEON] Improve vmulX intrinsics

2015-04-11 Thread Jiangjiji
Hi, 
  This is a ping for: https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00772.html
  Regtested with aarch64-linux-gnu on QEMU.
  This patch has no regressions for aarch64_be-linux-gnu big-endian target too. 
  OK for the trunk? 

Thanks.
Jiang jiji


--
Re: [PING^2] [PATCH] [AArch64, NEON] Improve vmulX intrinsics

Hi, Kyrill
  Thank you for your suggestion. 
  I fixed it and regtested with aarch64-linux-gnu on QEMU.
  This patch has no regressions for aarch64_be-linux-gnu big-endian target too. 
  OK for the trunk? 

Thanks.
Jiang jiji



Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 221393)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,38 @@
+2015-03-14  Felix Yang  
+   Jiji Jiang  
+
+   * config/aarch64/aarch64-simd.md (aarch64_mul_n,
+   aarch64_mull_n, aarch64_mull,
+   aarch64_simd_mull2_n, aarch64_mull2_n,
+   aarch64_mull_lane, aarch64_mull2_lane_internal,
+   aarch64_mull_laneq, aarch64_mull2_laneq_internal,
+   aarch64_smull2_lane, aarch64_umull2_lane,
+   aarch64_smull2_laneq, aarch64_umull2_laneq,
+   aarch64_fmulx, aarch64_fmulx, aarch64_fmulx_lane,
+   aarch64_pmull2v16qi, aarch64_pmullv8qi): New patterns.
+   * config/aarch64/aarch64-simd-builtins.def (vec_widen_smult_hi_,
+   vec_widen_umult_hi_, umull, smull, smull_n, umull_n, mul_n, smull2_n,
+   umull2_n, smull_lane, umull_lane, smull_laneq, umull_laneq, pmull,
+   umull2_lane, smull2_laneq, umull2_laneq, fmulx, fmulx_lane, pmull2,
+   smull2_lane): New builtins.
+   * config/aarch64/arm_neon.h (vmul_n_f32, vmul_n_s16, vmul_n_s32,
+   vmul_n_u16, vmul_n_u32, vmulq_n_f32, vmulq_n_f64, vmulq_n_s16,
+   vmulq_n_s32, vmulq_n_u16, vmulq_n_u32, vmull_high_lane_s16,
+   vmull_high_lane_s32, vmull_high_lane_u16, vmull_high_lane_u32,
+   vmull_high_laneq_s16, vmull_high_laneq_s32, vmull_high_laneq_u16,
+   vmull_high_laneq_u32, vmull_high_n_s16, vmull_high_n_s32,
+   vmull_high_n_u16, vmull_high_n_u32, vmull_high_p8, vmull_high_s8,
+   vmull_high_s16, vmull_high_s32, vmull_high_u8, vmull_high_u16,
+   vmull_high_u32, vmull_lane_s16, vmull_lane_s32, vmull_lane_u16,
+   vmull_lane_u32, vmull_laneq_s16, vmull_laneq_s32, vmull_laneq_u16,
+   vmull_laneq_u32, vmull_n_s16, vmull_n_s32, vmull_n_u16, vmull_n_u32,
+   vmull_p8, vmull_s8, vmull_s16, vmull_s32, vmull_u8, vmull_u16,
+   vmull_u32, vmulx_f32, vmulx_lane_f32, vmulxd_f64, vmulxq_f32,
+   vmulxq_f64, vmulxq_lane_f32, vmulxq_lane_f64, vmulxs_f32): Rewrite
+   using builtin functions.
+   * config/aarch64/iterators.md (UNSPEC_FMULX, UNSPEC_FMULX_LANE,
+   VDQF_Q): New unspec and int iterator.
+
 2015-03-12  Kyrylo Tkachov  
 
PR rtl-optimization/65235
Index: gcc/config/aarch64/arm_neon.h
===
--- gcc/config/aarch64/arm_neon.h   (revision 221393)
+++ gcc/config/aarch64/arm_neon.h   (working copy)
@@ -7580,671 +7580,6 @@ vmovn_u64 (uint64x2_t a)
   return result;
 }
 
-__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
-vmul_n_f32 (float32x2_t a, float32_t b)
-{
-  float32x2_t result;
-  __asm__ ("fmul %0.2s,%1.2s,%2.s[0]"
-   : "=w"(result)
-   : "w"(a), "w"(b)
-   : /* No clobbers */);
-  return result;
-}
-
-__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
-vmul_n_s16 (int16x4_t a, int16_t b)
-{
-  int16x4_t result;
-  __asm__ ("mul %0.4h,%1.4h,%2.h[0]"
-   : "=w"(result)
-   : "w"(a), "x"(b)
-   : /* No clobbers */);
-  return result;
-}
-
-__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
-vmul_n_s32 (int32x2_t a, int32_t b)
-{
-  int32x2_t result;
-  __asm__ ("mul %0.2s,%1.2s,%2.s[0]"
-   : "=w"(result)
-   : "w"(a), "w"(b)
-   : /* No clobbers */);
-  return result;
-}
-
-__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
-vmul_n_u16 (uint16x4_t a, uint16_t b)
-{
-  uint16x4_t result;
-  __asm__ ("mul %0.4h,%1.4h,%2.h[0]"
-   : "=w"(result)
-   : "w"(a), "x"(b)
-   : /* No clobbers */);
-  return result;
-}
-
-__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
-vmul_n_u32 (uint32x2_t a, uint32_t b)
-{
-  uint32x2_t result;
-  __asm__ ("mul %0.2s,%1.2s,%2.s[0]"
-   : "=w"(result)
-   : "w"(a), "w"(b)
-   : /* No clobbers */);
-  return result;
-}
-
-#define vmull_high_lane_s16(a, b, c)\
-  __extension__ \
-({  \
-   int16x4_t b_ = (b);  \
-   int16x8_t a_ = (a);  \
-   int32x4_t result;

Re: [patch] Fix shared_timed_mutex::try_lock_until() et al

2015-04-11 Thread Jonathan Wakely

On 08/04/15 20:11 +0100, Jonathan Wakely wrote:

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 5871716..39d6866 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -2,7 +2,8 @@

* include/std/shared_mutex (shared_timed_mutex): Add comments to
explain the logic.
-   (_M_n_readers): Rename to _S_n_readers.
+   (_Mutex): Remove redundant type.
+   (_M_n_readers): Rename to _S_max_readers.
(_M_write_entered, _M_readers): New convenience functions.
(lock, lock_shared, try_lock_shared, unlock_shared): Use convenience
functions. Use predicates with condition variables. Simplify bitwise
@@ -11,7 +12,8 @@
and call try_lock_until or try_shared_lock_until respectively.
(try_lock_until, try_shared_lock_until): Wait on the condition
variables until the specified time passes.
-   (unlock, unlock_shared): Add Debug Mode assertions.
+   (unlock): Add Debug Mode assertion.
+   (unlock_shared): Add Debug Mode assertion.
* testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: New.


This has been committed to trunk and 4.9 (because on the 4.9 branch we
only had the non-pthread_rwlock_t version with broken timed lock
functions).



Re: [patch] libstdc++/65499 make duration literals visible in std::chrono namespace

2015-04-11 Thread Jonathan Wakely

On 27/03/15 12:45 +, Jonathan Wakely wrote:

This is a tiny tweak to add a missing piece of C++14 support, the
duration literals should be usable via "using namespace std::chrono".
It doesn't affect anything in C++03 or C++11 mode so safe for trunk
now.

Tested x86_64-linux, committed to trunk.




commit 907f5e128d855d339829abbd1d314f382e3ae6fc
Author: Jonathan Wakely 
Date:   Thu Mar 26 20:12:36 2015 +

PR libstdc++/65499
* include/std/chrono: Add using-directive for literals to std::chrono.
* testsuite/20_util/duration/literals/65499.cc: New.


Also committed to the 4.9 branch.



Re: [patch] libstdc++/58038 libstdc++/60421 fix overflows in std::this_thread::sleep_for()

2015-04-11 Thread Jonathan Wakely

On 26/03/15 19:59 +, Jonathan Wakely wrote:

We have a couple of bugs where durations with unsigned representations
result in negative or huge time_t values, which result in not sleeping
at all or sleeping for billions of years (or merely for decades if you
have a 32-bit time_t).

This change simply returns early for time points in the past or
negative durations.

Tested x86_64-linux, powerpc64le-linux, committed to trunk.


Also committed to the 4.9 branch.


New French PO file for 'gcc' (version 5.1-b20150208)

2015-04-11 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the French team of translators.  The file is available at:

http://translationproject.org/latest/gcc/fr.po

(This file, 'gcc-5.1-b20150208.fr.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: [PATCH] Fix typo and miswordings in three error messages

2015-04-11 Thread Gerald Pfeifer
Hi Benno,

I tested your fixes on i386-unknown-freebsd10.1 -- you never
know, after some of these could have been reflected in some
test case for example -- and committed them on your behalf.

Sorry for none of us looking into this for so long.  If you
find further typos or phrases that need improvement, please
do not hestiate to let us know.  Providing patches, including
a ChangeLog entry as you have done, is even better!

Thank you,
Gerald

On Thu, 6 Feb 2014, Benno Schulenberg wrote:
> Updating a bit the Dutch translations of GCC's messages,
> I noticed the following mistakes in three msgids:
> 
>   "only displayed one"  ==>  "displayed only once"
>   "none class-method"  ==>  "non-class method"
>   "incorect"  ==>  "incorrect"
> 
> Below patch fixes those.  I'm not entirely sure about
> the second fix, but the "none" doesn't make any sense.
> When found okay, please apply.
> 
> 
> 2014-02-05  Benno Schulenberg  
> 
>   * gcov.c (find_source): Fix miswording in error message.
>   * config/i386/i386.c (ix86_handle_cconv_attribute): Likewise.
>   (ix86_expand_sse_comi_round): Fix typo in error message.
> 
> 
> Index: gcov.c
> ===
> --- gcov.c(revision 207551)
> +++ gcov.c(working copy)
> @@ -1141,7 +1141,7 @@
>if (!info_emitted)
>   {
> fnotice (stderr,
> -"(the message is only displayed one per source file)\n");
> +"(the message is displayed only once per source file)\n");
> info_emitted = 1;
>   }
>sources[idx].file_time = 0;
> Index: config/i386/i386.c
> ===
> --- config/i386/i386.c(revision 207551)
> +++ config/i386/i386.c(working copy)
> @@ -5446,7 +5446,7 @@
>else if (is_attribute_p ("thiscall", name))
>  {
>if (TREE_CODE (*node) != METHOD_TYPE && pedantic)
> - warning (OPT_Wattributes, "%qE attribute is used for none class-method",
> + warning (OPT_Wattributes, "%qE attribute is used for non-class method",
>name);
>if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node)))
>   {
> @@ -34230,7 +34230,7 @@
>  }
>if (INTVAL (op2) < 0 || INTVAL (op2) >= 32)
>  {
> -  error ("incorect comparison mode");
> +  error ("incorrect comparison mode");
>return const0_rtx;
>  }


Re: [patch, fortran, RFC] First steps towards inlining matmul

2015-04-11 Thread Thomas Koenig
OK, here is a new version.

There is now an option for setting a maximum on the array size,
which takes its default from the BLAS limit (if specified).

Currently, only setting the maximum size to zero as a way of
disabling the unrolling is supported.  I have done this in a
few test cases.

The bugs reported by Dominique have now been fixed.

Still to do:  Bounds checking (a rather big one), honoring the
maximum size, test cases, ChangeLog, some more comments to the code.

Anything else?

Regards

Thomas


Index: fortran/frontend-passes.c
===
--- fortran/frontend-passes.c	(Revision 221944)
+++ fortran/frontend-passes.c	(Arbeitskopie)
@@ -43,7 +43,11 @@ static void doloop_warn (gfc_namespace *);
 static void optimize_reduction (gfc_namespace *);
 static int callback_reduction (gfc_expr **, int *, void *);
 static void realloc_strings (gfc_namespace *);
-static gfc_expr *create_var (gfc_expr *);
+static gfc_expr *create_var (gfc_expr *, const char *vname=NULL);
+static int optimize_matmul_assign (gfc_code **, int *, void *);
+static gfc_code * create_do_loop (gfc_expr *, gfc_expr *, gfc_expr *,
+  locus *, gfc_namespace *, 
+  char *vname=NULL);
 
 /* How deep we are inside an argument list.  */
 
@@ -93,8 +97,24 @@ struct my_struct *evec;
 
 static bool in_assoc_list;
 
+/* Counter for temporary variables.  */
+
+static int var_num = 1;
+
+/* What sort of matrix we are dealing with when optimizing MATMUL.  */
+
+enum matrix_case { none=0, A2B2, A2B1, A1B2 };
+
+/* Keep track of the number of expressions we have inserted so far 
+   using create_var.  */
+
+int n_vars;
+
+void gfc_debug_expr (gfc_expr *);
+
 /* Entry point - run all passes for a namespace.  */
 
+
 void
 gfc_run_passes (gfc_namespace *ns)
 {
@@ -157,7 +177,7 @@ realloc_string_callback (gfc_code **c, int *walk_s
 return 0;
   
   current_code = c;
-  n = create_var (expr2);
+  n = create_var (expr2, "trim");
   co->expr2 = n;
   return 0;
 }
@@ -524,29 +544,11 @@ constant_string_length (gfc_expr *e)
 
 }
 
-/* Returns a new expression (a variable) to be used in place of the old one,
-   with an assignment statement before the current statement to set
-   the value of the variable. Creates a new BLOCK for the statement if
-   that hasn't already been done and puts the statement, plus the
-   newly created variables, in that block.  Special cases:  If the
-   expression is constant or a temporary which has already
-   been created, just copy it.  */
-
-static gfc_expr*
-create_var (gfc_expr * e)
+static gfc_namespace*
+insert_block ()
 {
-  char name[GFC_MAX_SYMBOL_LEN +1];
-  static int num = 1;
-  gfc_symtree *symtree;
-  gfc_symbol *symbol;
-  gfc_expr *result;
-  gfc_code *n;
   gfc_namespace *ns;
-  int i;
 
-  if (e->expr_type == EXPR_CONSTANT || is_fe_temp (e))
-return gfc_copy_expr (e);
-
   /* If the block hasn't already been created, do so.  */
   if (inserted_block == NULL)
 {
@@ -578,7 +580,37 @@ constant_string_length (gfc_expr *e)
   else
 ns = inserted_block->ext.block.ns;
 
-  sprintf(name, "__var_%d",num++);
+  return ns;
+}
+
+/* Returns a new expression (a variable) to be used in place of the old one,
+   with an optional assignment statement before the current statement to set
+   the value of the variable. Creates a new BLOCK for the statement if that
+   hasn't already been done and puts the statement, plus the newly created
+   variables, in that block.  Special cases: If the expression is constant or
+   a temporary which has already been created, just copy it.  */
+
+static gfc_expr*
+create_var (gfc_expr * e, const char *vname)
+{
+  char name[GFC_MAX_SYMBOL_LEN +1];
+  gfc_symtree *symtree;
+  gfc_symbol *symbol;
+  gfc_expr *result;
+  gfc_code *n;
+  gfc_namespace *ns;
+  int i;
+
+  if (e->expr_type == EXPR_CONSTANT || is_fe_temp (e))
+return gfc_copy_expr (e);
+
+  ns = insert_block ();
+
+  if (vname)
+snprintf (name, GFC_MAX_SYMBOL_LEN, "__var_%d_%s", var_num++, vname);
+  else
+snprintf (name, GFC_MAX_SYMBOL_LEN, "__var_%d", var_num++);
+
   if (gfc_get_sym_tree (name, ns, &symtree, false) != 0)
 gcc_unreachable ();
 
@@ -651,6 +683,7 @@ constant_string_length (gfc_expr *e)
   result->ref->type = REF_ARRAY;
   result->ref->u.ar.type = AR_FULL;
   result->ref->u.ar.where = e->where;
+  result->ref->u.ar.dimen = e->rank;
   result->ref->u.ar.as = symbol->ts.type == BT_CLASS
 			 ? CLASS_DATA (symbol)->as : symbol->as;
   if (warn_array_temporaries)
@@ -658,6 +691,7 @@ constant_string_length (gfc_expr *e)
 		 "Creating array temporary at %L", &(e->where));
 }
 
+
   /* Generate the new assignment.  */
   n = XCNEW (gfc_code);
   n->op = EXEC_ASSIGN;
@@ -666,6 +700,7 @@ constant_string_length (gfc_expr *e)
   n->expr1 = gfc_copy_expr (result);
   n->expr2 = e;
   *changed_statement = n;
+  n_vars ++;
 
   return result;
 }
@@ -724,7 +759,7 @@ cfe_expr_0 (gfc_expr **e, i

Re: [PATCH] Add vtable verification feature announcement to news on main page...

2015-04-11 Thread Gerald Pfeifer
On Fri, 10 Apr 2015, Caroline Tice wrote:
> I would appreciate it if you would do it.

Okay.  Here is the (somewhat shortened) patch I just committed.

Index: news.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/news.html,v
retrieving revision 1.145
diff -u -r1.145 news.html
--- news.html   5 Jul 2014 21:14:51 -   1.145
+++ news.html   11 Apr 2015 12:26:25 -
@@ -52,6 +52,13 @@
 [2013-09-12]
 A port for the TI MSP430 has been contributed by Red Hat Inc.
 
+The Vtable Verification Feature is now in GCC
+[2013-09-08]
+The http://gcc.gnu.org/wiki/vtv";>vtable verification
+branch has been merged into trunk.  This work was contributed by
+Caroline Tice, Luis Lozano and Geoff Pike of Google, and
+Benjamin Kosnik of Red Hat.
+
 Twitter and Google+ accounts
 [2013-08-08]
 GCC and the GNU Toolchain Project now have accounts on


Re: GNAT User's Guide /onlinedocs broken? (was: Broken links on gcc.gnu.org/onlinedocs)

2015-04-11 Thread Arnaud Charlet

>> The following links are broken at gcc.gnu.org/onlinedocs/4.9.2.  The 
>> corresponding 4.9.2-related links at gcc.gnu.org/onlinedocs are also broken:
>>GCC 4.9.2 GNAT User's Guide (/onlinedocs/gcc-4.9.2/gnat_ugn_unw/)
>>also in PDF (/onlinedocs/gcc-4.9.2/gnat_ugn_unw.pdf)
>>or Postscript (/onlinedocs/gcc-4.9.2/gnat_ugn_unw.ps.gz)
>>or an HTML tarball (/onlinedocs/gcc-4.9.2/gnat_ugn_unw-html.tar.gz)
> 
> This is not just broken for GCC 4.9.2, but GCC 4.8.4 as well:
> 
>  https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn_unw/
>  https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn_unw/
> 
> It does still work for GCC 4.9.1 and GCC 4.8.3:
> 
>  https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gnat_ugn_unw/
>  https://gcc.gnu.org/onlinedocs/gcc-4.8.3/gnat_ugn_unw/
> 
> 
> Arnaud, you updated maintainer-scripts update_web_docs_svn as
> follows last year, might this be related?
> 
>  2014-08-01  Arnaud Charlet  
> 
>* update_web_docs_svn: Simplify build of gnat_ugn.
> 
> Is the patch below a proper fix?

Your patch looks good to me.

> Index: index.html
> ===
> RCS file: /cvs/gcc/wwwdocs/htdocs/onlinedocs/index.html,v
> retrieving revision 1.147
> diff -u -r1.147 index.html
> --- index.html6 Feb 2015 22:27:38 -1.147
> +++ index.html10 Apr 2015 20:00:02 -
> @@ -53,12 +53,12 @@
>  
> href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_rm.ps.gz";>PostScript 
> or   
> href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_rm-html.tar.gz";>an
>  HTML tarball)
> -https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn_unw/";>GCC
> +https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn/";>GCC
>  4.9.2 GNAT User's Guide ( - 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn_unw.pdf";>also
> + href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn.pdf";>also
>  in PDF or  - 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn_unw.ps.gz";>PostScript
>  or  - 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn_unw-html.tar.gz";>an
> + 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn.ps.gz";>PostScript 
> or  + 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gnat_ugn-html.tar.gz";>an
>  HTML tarball)
>  href="https://gcc.gnu.org/onlinedocs/gcc-4.9.2/libstdc++/manual/";>GCC
>  4.9.2 Standard C++ Library Manual  ( @@ -137,12 +137,12 @@
>  
> href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_rm.ps.gz";>PostScript 
> or   
> href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_rm-html.tar.gz";>an
>  HTML tarball)
> -https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn_unw/";>GCC
> +https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn/";>GCC
>  4.8.4 GNAT User's Guide ( - 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn_unw.pdf";>also
> + href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn.pdf";>also
>  in PDF or  - 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn_unw.ps.gz";>PostScript
>  or  - 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn_unw-html.tar.gz";>an
> + 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn.ps.gz";>PostScript 
> or  + 
> href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gnat_ugn-html.tar.gz";>an
>  HTML tarball)
>  href="https://gcc.gnu.org/onlinedocs/gcc-4.8.4/libstdc++/manual/";>GCC
>  4.8.4 Standard C++ Library Manual  ( 


Re: [patch, fortran, RFC] First steps towards inlining matmul

2015-04-11 Thread Mikael Morin
Hello, I haven't looked at the patch in detail yet, but...

Le 11/04/2015 14:24, Thomas Koenig a écrit :
> Still to do:  Bounds checking (a rather big one),
... as you do a front-end to front-end transformation, you get bounds
checking for free, don't you?

Mikael


Re: GNAT User's Guide /onlinedocs broken? (was: Broken links on gcc.gnu.org/onlinedocs)

2015-04-11 Thread Gerald Pfeifer
On Sat, 11 Apr 2015, Arnaud Charlet wrote:
> Your patch looks good to me.

Thanks for the quick response, Arnaud.

It turns out we also had the same problem with mainline, just 
that gnat_ugn_unw/ still existed there in it's old version from
summer 2014.  

I have removed that stale copy on gcc.gnu.org and also applied 
the patch below to our onlinedocs/ index.

Gerald

Index: index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/onlinedocs/index.html,v
retrieving revision 1.148
diff -u -r1.148 index.html
--- index.html  11 Apr 2015 13:50:22 -  1.148
+++ index.html  11 Apr 2015 13:52:37 -
@@ -944,12 +944,12 @@
href="https://gcc.gnu.org/onlinedocs/gnat_rm.ps.gz";>PostScript 
or https://gcc.gnu.org/onlinedocs/gnat_rm-html.tar.gz";>an
HTML tarball)
-https://gcc.gnu.org/onlinedocs/gnat_ugn_unw/";>GNAT User's 
Guide
+https://gcc.gnu.org/onlinedocs/gnat_ugn/";>GNAT User's Guide
for Native Platforms / Unix and Windows (https://gcc.gnu.org/onlinedocs/gnat_ugn_unw.pdf";>also in
+   href="https://gcc.gnu.org/onlinedocs/gnat_ugn.pdf";>also in
PDF or https://gcc.gnu.org/onlinedocs/gnat_ugn_unw.ps.gz";>PostScript or https://gcc.gnu.org/onlinedocs/gnat_ugn_unw-html.tar.gz";>an
+   href="https://gcc.gnu.org/onlinedocs/gnat_ugn.ps.gz";>PostScript 
or https://gcc.gnu.org/onlinedocs/gnat_ugn-html.tar.gz";>an
HTML tarball)
 https://gcc.gnu.org/onlinedocs/gccgo/";>GCCGO Manual (https://gcc.gnu.org/onlinedocs/gccgo.pdf";>also in


Re: [PATCH, i386] Fix PR target/65671. Generate 32x4 extract even for DF in absence of AVX-512DQ.

2015-04-11 Thread Jakub Jelinek
On Thu, Apr 09, 2015 at 06:37:01PM +0400, Kirill Yukhin wrote:
> gcc/
>   * config/i386/sse.md: Generate vextract32x4 if AVX-512DQ
>   is disabled.
> 
> gcc/testsuite/
>   * gcc.target/i386/pr65671.c: New.

The testcase fails if gas doesn't have AVX512VL support (my only has
AVX512F).

Fixed thusly, committed as obvious.

2015-04-11  Jakub Jelinek  

PR target/65671
* gcc.target/i386/pr65671.c: Require avx512vl effective target.

--- gcc/testsuite/gcc.target/i386/pr65671.c.jj  2015-04-11 10:44:30.579838982 
+0200
+++ gcc/testsuite/gcc.target/i386/pr65671.c 2015-04-11 15:52:19.778368299 
+0200
@@ -1,6 +1,7 @@
 /* PR target/65671 */
 /* { dg-do assemble } */
 /* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target avx512vl } */
 /* { dg-options "-O2 -mavx512vl -ffixed-ymm16" } */
 
 #include 


Jakub


[C++ PATCH] Fix up cxx_eval_pointer_plus_expression (PR c++/65736)

2015-04-11 Thread Jakub Jelinek
Hi!

The following patch fixes a bunch of issues in
cxx_eval_pointer_plus_expression:
1) as it does STRIP_NOPS, the pointed type can change, and thus the
   op01 constant in p+ might not be divisible by the other type size
2) we should restore the original type, rather than returning expression
   of type after STRIP_NOPS
3) just in case, I've added a check TYPE_SIZE_UNIT is a constant

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

2015-04-11  Jakub Jelinek  

PR c++/65736
* constexpr.c (cxx_eval_pointer_plus_expression): Don't fold for VLAs,
don't fold if op01 isn't divisible by TYPE_SIZE_UNIT.  Convert
the expression to the original type at the end.

* g++.dg/cpp0x/pr65736.C: New test.

--- gcc/cp/constexpr.c.jj   2015-04-03 15:32:31.0 +0200
+++ gcc/cp/constexpr.c  2015-04-11 10:28:12.154482385 +0200
@@ -2929,6 +2929,7 @@ cxx_eval_pointer_plus_expression (const
  bool lval, bool *non_constant_p,
  bool *overflow_p)
 {
+  tree orig_type = TREE_TYPE (t);
   tree op00 = TREE_OPERAND (t, 0);
   tree op01 = TREE_OPERAND (t, 1);
   location_t loc = EXPR_LOCATION (t);
@@ -2945,7 +2946,9 @@ cxx_eval_pointer_plus_expression (const
   /* &A[i] p+ j => &A[i + j] */
   if (TREE_CODE (op00) == ARRAY_REF
   && TREE_CODE (TREE_OPERAND (op00, 1)) == INTEGER_CST
-  && TREE_CODE (op01) == INTEGER_CST)
+  && TREE_CODE (op01) == INTEGER_CST
+  && TYPE_SIZE_UNIT (TREE_TYPE (op00))
+  && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (op00))) == INTEGER_CST)
 {
   tree type = TREE_TYPE (op00);
   t = fold_convert_loc (loc, ssizetype, TREE_OPERAND (op00, 1));
@@ -2953,15 +2956,21 @@ cxx_eval_pointer_plus_expression (const
   /* Don't fold an out-of-bound access.  */
   if (!tree_int_cst_le (t, nelts))
return NULL_TREE;
+  op01 = cp_fold_convert (ssizetype, op01);
+  /* Don't fold if op01 can't be divided exactly by TYPE_SIZE_UNIT.
+constexpr int A[1]; ... (char *)&A[0] + 1 */
+  if (!integer_zerop (fold_build2_loc (loc, TRUNC_MOD_EXPR, sizetype,
+  op01, TYPE_SIZE_UNIT (type
+   return NULL_TREE;
   /* Make sure to treat the second operand of POINTER_PLUS_EXPR
 as signed.  */
-  op01 = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype,
- cp_fold_convert (ssizetype, op01),
+  op01 = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype, op01,
  TYPE_SIZE_UNIT (type));
   t = size_binop_loc (loc, PLUS_EXPR, op01, t);
   t = build4_loc (loc, ARRAY_REF, type, TREE_OPERAND (op00, 0),
  t, NULL_TREE, NULL_TREE);
   t = cp_build_addr_expr (t, tf_warning_or_error);
+  t = cp_fold_convert (orig_type, t);
   return cxx_eval_constant_expression (ctx, t, lval, non_constant_p,
   overflow_p);
 }
--- gcc/testsuite/g++.dg/cpp0x/pr65736.C.jj 2015-04-11 10:32:06.807729783 
+0200
+++ gcc/testsuite/g++.dg/cpp0x/pr65736.C2015-04-11 10:31:11.0 
+0200
@@ -0,0 +1,5 @@
+// PR c++/65736
+// { dg-do compile { target c++11 } }
+
+int a[1];  
   
+char *b[1] { (char *)&a[0] + 1 };

Jakub


[doc] Add Ira Rosen to doc/contrib.texi

2015-04-11 Thread Gerald Pfeifer
...as I had suggested and discussed with here in, umm, 2012.
Luckily my backlog really is going down now...  

Committed.

Gerald

2015-04-11  Gerald Pfeifer  

* doc/contrib.texi (Contributors): Add Ira Rosen.

Index: doc/contrib.texi
===
--- doc/contrib.texi(revision 222009)
+++ doc/contrib.texi(working copy)
@@ -800,6 +800,9 @@
 Ken Rose for fixes to GCC's delay slot filling code.
 
 @item
+Ira Rosen for her contributions to the auto-vectorizer.
+
+@item
 Paul Rubin wrote most of the preprocessor.
 
 @item


[PATCH] Fix a FSM threading ICE (PR tree-optimization/65735)

2015-04-11 Thread Jakub Jelinek
Hi!

On the following testcase, starting with r221675 aka PR65177 fix
we get ICE, because FSM discovery finds a path that includes the same blocks
multiple times, like:
 Registering FSM jump thread: (9, 4) incoming edge;  (4, 5)  (5, 12)  (12, 14)  
(14, 5)  (5, 12) nocopy; (5, 12) 
All these bbs belong to the same loop, with bb14 being the header and bb12
the latch.  And the copy_bbs/duplicate_thread_path don't seem to be really
prepared to duplicate the same basic block more than once.

fsm_find_control_statement_thread_paths has guard against recursion, but it
adds to the hash_set the PHI nodes.  On the testcase, bb5 is added to the
path first through one of the PHIs:
# c_3 = PHI 
# b_33 = PHI 
and the second time through the other PHI.

The following patch fixes that by adding to the has_set the basic blocks
containing the PHIs instead of the PHIs.

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

2015-04-11  Jakub Jelinek  

PR tree-optimization/65735
* tree-ssa-threadedge.c (fsm_find_control_statement_thread_paths):
Remove visited_phis argument, add visited_bbs, avoid recursing into the
same bb rather than just into the same phi node.
(thread_through_normal_block): Adjust caller.

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

--- gcc/tree-ssa-threadedge.c.jj2015-02-16 22:18:34.0 +0100
+++ gcc/tree-ssa-threadedge.c   2015-04-11 16:13:51.906916300 +0200
@@ -1015,7 +1015,7 @@ static int max_threaded_paths;
 
 static void
 fsm_find_control_statement_thread_paths (tree expr,
-hash_set *visited_phis,
+hash_set *visited_bbs,
 vec *&path,
 bool seen_loop_phi)
 {
@@ -1034,7 +1034,7 @@ fsm_find_control_statement_thread_paths
 return;
 
   /* Avoid infinite recursion.  */
-  if (visited_phis->add (def_stmt))
+  if (visited_bbs->add (var_bb))
 return;
 
   gphi *phi = as_a  (def_stmt);
@@ -1109,7 +1109,7 @@ fsm_find_control_statement_thread_paths
{
  vec_safe_push (path, bbi);
  /* Recursively follow SSA_NAMEs looking for a constant definition.  */
- fsm_find_control_statement_thread_paths (arg, visited_phis, path,
+ fsm_find_control_statement_thread_paths (arg, visited_bbs, path,
   seen_loop_phi);
 
  path->pop ();
@@ -1391,13 +1391,13 @@ thread_through_normal_block (edge e,
   vec *bb_path;
   vec_alloc (bb_path, n_basic_blocks_for_fn (cfun));
   vec_safe_push (bb_path, e->dest);
-  hash_set *visited_phis = new hash_set;
+  hash_set *visited_bbs = new hash_set;
 
   max_threaded_paths = PARAM_VALUE (PARAM_MAX_FSM_THREAD_PATHS);
-  fsm_find_control_statement_thread_paths (cond, visited_phis, bb_path,
+  fsm_find_control_statement_thread_paths (cond, visited_bbs, bb_path,
   false);
 
-  delete visited_phis;
+  delete visited_bbs;
   vec_free (bb_path);
 }
   return 0;
--- gcc/testsuite/gcc.c-torture/compile/pr65735.c.jj2015-04-11 
16:14:33.173263982 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr65735.c   2015-04-11 
16:14:06.0 +0200
@@ -0,0 +1,21 @@
+/* PR tree-optimization/65735 */
+
+int foo (void);
+
+void
+bar (int a, int b, int c)
+{
+  while (!a)
+{
+  c = foo ();
+  if (c == 7)
+   c = b;
+  switch (c)
+   {
+   case 1:
+ a = b++;
+ if (b)
+   b = 1;
+   }
+}
+}

Jakub


Re: [patch, fortran, RFC] First steps towards inlining matmul

2015-04-11 Thread Thomas Koenig
Hi Mikael,

>> Still to do:  Bounds checking (a rather big one),
> ... as you do a front-end to front-end transformation, you get bounds
> checking for free, don't you?

Only partially.

What the patch does is

 integer i,j,k
 c = 0
 do j=0, size(b,2)-1
   do k=0, size(a, 2)-1
 do i=0, size(a, 1)-1
c(i * stride(c,1) + lbound(c,1), j * stride(c,2) +
lbound(c,2)) =
   c(i * stride(c,1) + lbound(c,1), j * stride(c,2) + lbound(c,2)) +
a(i * stride(a,1) + lbound(a,1), k * stride(a,2) +
lbound(a,2)) *
b(k * stride(b,1) + lbound(b,1), j * stride(b,2) + lbound(b,2))
 end do
   end do
 end do

If size(b,2) < size(c,2) or size(a,1) < size(c,1) or
size(a,2) < size(b,1), this will not get caught - no
array bounds violation in the DO loops, but illegal
code nonetheless.

Also, the error message is different, which should also be
changed.

What I would like to add to check before the loop, and then
add a "do not bounds-check" flag to the reference.

Thomas


Re: [PATCH] Fix PR ipa/65722

2015-04-11 Thread Jan Hubicka
> > 2015-04-10  Martin Liska  
> > 
> > * g++.dg/ipa/pr65722.C: New test.
> > 
> > gcc/ChangeLog:
> > 
> > 2015-04-10  Martin Liska  
> > 
> > PR ipa/65722
> > * ipa-icf.c (sem_variable::equals_wpa): Consider comparsion just
> > for references coming from cgraph nodes.
> 
> Please add into compare_cgraph_references to never return true when one
> parameter is function and other variable. How it comes we do not get different
> hash values here? Perhaps when adding the hash values of references, we sould
> iteratively hash in some identifier saying if object is function or variable.
> 
> For vtables, we want to test DECL_VIRTUAL_P for match even for variables,
> because we do not want to match RTTI and vtable (though it may be unlikely
> that they are the same).
> Refactor the code to test
> 
> /* For virtual tables we need to check flags used by ipa-devirt.  */
> if (DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl))
>   {
> if (DECL_VIRTUAL_P (ref->referred->decl) != DECL_VIRTUAL_P 
> (ref2->referred->decl))
>   fail claiming that virutal flag mismatched
> if (is_a_funtion && DECL_VIRTUAL_P (ref->referred->decl)
> && DECL_FINAL (ref->referred->decl) != DECL_FINAL 
> (ref2->referred->decl))
>   fail chaliming that final flag mismatched
>   }
> 
> The conditional is quite confusing written as it is. (probably by myself :)
> Thanks!
> Honza

Hi,
this is variant I am testing. 

Index: ipa-icf.c
===
--- ipa-icf.c   (revision 222010)
+++ ipa-icf.c   (working copy)
@@ -368,6 +368,10 @@ sem_item::compare_cgraph_references (
   if (n1 == n2)
 return true;
 
+  /* Never match variable and function.  */
+  if (is_a  (n1) != is_a  (n2))
+return false;
+
   /* Merging two definitions with a reference to equivalent vtables, but
  belonging to a different type may result in ipa-polymorphic-call analysis
  giving a wrong answer about the dynamic type of instance.  */
@@ -587,9 +591,6 @@ void
 sem_item::update_hash_by_addr_refs (hash_map  &m_symtab_node_map)
 {
-  if (is_a  (node) && DECL_VIRTUAL_P (node->decl))
-return;
-
   ipa_ref* ref;
   inchash::hash hstate (hash);
   for (unsigned i = 0; i < node->num_references (); i++)
@@ -1667,17 +1668,19 @@ sem_variable::equals_wpa (sem_item *item
  ref->address_matters_p ()))
return false;
 
-  /* DECL_FINAL_P flag on methods referred by virtual tables is used
-to decide on completeness possible_polymorphic_call_targets lists
-and therefore it must match.  */
-  if ((DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl))
- && (DECL_VIRTUAL_P (ref->referred->decl)
- || DECL_VIRTUAL_P (ref2->referred->decl))
- && ((DECL_VIRTUAL_P (ref->referred->decl)
-  != DECL_VIRTUAL_P (ref2->referred->decl))
- || (DECL_FINAL_P (ref->referred->decl)
- != DECL_FINAL_P (ref2->referred->decl
-return return_false_with_msg ("virtual or final flag mismatch");
+  /* When matching virtual tables, be sure to also match information
+relevant for polymorphic call analysis.  */
+  if (DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl))
+   {
+ if (DECL_VIRTUAL_P (ref->referred->decl)
+ != DECL_VIRTUAL_P (ref2->referred->decl))
+return return_false_with_msg ("virtual flag mismatch");
+ if (DECL_VIRTUAL_P (ref->referred->decl)
+ && is_a  (ref->referred)
+ && (DECL_FINAL_P (ref->referred->decl)
+ != DECL_FINAL_P (ref2->referred->decl)))
+return return_false_with_msg ("final flag mismatch");
+   }
 }
 
   return true;


Re: [PATCH] Fix a FSM threading ICE (PR tree-optimization/65735)

2015-04-11 Thread Marc Glisse

On Sat, 11 Apr 2015, Jakub Jelinek wrote:


@@ -1391,13 +1391,13 @@ thread_through_normal_block (edge e,
  vec *bb_path;
  vec_alloc (bb_path, n_basic_blocks_for_fn (cfun));
  vec_safe_push (bb_path, e->dest);
-  hash_set *visited_phis = new hash_set;
+  hash_set *visited_bbs = new hash_set;

  max_threaded_paths = PARAM_VALUE (PARAM_MAX_FSM_THREAD_PATHS);
-  fsm_find_control_statement_thread_paths (cond, visited_phis, bb_path,
+  fsm_find_control_statement_thread_paths (cond, visited_bbs, bb_path,
   false);

-  delete visited_phis;
+  delete visited_bbs;
  vec_free (bb_path);
}
  return 0;


I understand minimizing the patches right before the release. At any other 
time, it would have been a great occasion to remove this new/delete 
anti-pattern.


--
Marc Glisse


Re: [PATCH] Fix a FSM threading ICE (PR tree-optimization/65735)

2015-04-11 Thread Richard Biener
On April 11, 2015 6:34:43 PM GMT+02:00, Jakub Jelinek  wrote:
>Hi!
>
>On the following testcase, starting with r221675 aka PR65177 fix
>we get ICE, because FSM discovery finds a path that includes the same
>blocks
>multiple times, like:
>Registering FSM jump thread: (9, 4) incoming edge;  (4, 5)  (5, 12) 
>(12, 14)  (14, 5)  (5, 12) nocopy; (5, 12) 
>All these bbs belong to the same loop, with bb14 being the header and
>bb12
>the latch.  And the copy_bbs/duplicate_thread_path don't seem to be
>really
>prepared to duplicate the same basic block more than once.
>
>fsm_find_control_statement_thread_paths has guard against recursion,
>but it
>adds to the hash_set the PHI nodes.  On the testcase, bb5 is added to
>the
>path first through one of the PHIs:
># c_3 = PHI 
># b_33 = PHI 
>and the second time through the other PHI.
>
>The following patch fixes that by adding to the has_set the basic
>blocks
>containing the PHIs instead of the PHIs.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Thanks,
Richard.

>2015-04-11  Jakub Jelinek  
>
>   PR tree-optimization/65735
>   * tree-ssa-threadedge.c (fsm_find_control_statement_thread_paths):
>   Remove visited_phis argument, add visited_bbs, avoid recursing into
>the
>   same bb rather than just into the same phi node.
>   (thread_through_normal_block): Adjust caller.
>
>   * gcc.c-torture/compile/pr65735.c: New test.
>
>--- gcc/tree-ssa-threadedge.c.jj   2015-02-16 22:18:34.0 +0100
>+++ gcc/tree-ssa-threadedge.c  2015-04-11 16:13:51.906916300 +0200
>@@ -1015,7 +1015,7 @@ static int max_threaded_paths;
> 
> static void
> fsm_find_control_statement_thread_paths (tree expr,
>-   hash_set *visited_phis,
>+   hash_set *visited_bbs,
>vec *&path,
>bool seen_loop_phi)
> {
>@@ -1034,7 +1034,7 @@ fsm_find_control_statement_thread_paths
> return;
> 
>   /* Avoid infinite recursion.  */
>-  if (visited_phis->add (def_stmt))
>+  if (visited_bbs->add (var_bb))
> return;
> 
>   gphi *phi = as_a  (def_stmt);
>@@ -1109,7 +1109,7 @@ fsm_find_control_statement_thread_paths
>   {
> vec_safe_push (path, bbi);
> /* Recursively follow SSA_NAMEs looking for a constant definition. 
>*/
>-fsm_find_control_statement_thread_paths (arg, visited_phis, path,
>+fsm_find_control_statement_thread_paths (arg, visited_bbs, path,
>  seen_loop_phi);
> 
> path->pop ();
>@@ -1391,13 +1391,13 @@ thread_through_normal_block (edge e,
>   vec *bb_path;
>   vec_alloc (bb_path, n_basic_blocks_for_fn (cfun));
>   vec_safe_push (bb_path, e->dest);
>-  hash_set *visited_phis = new hash_set;
>+  hash_set *visited_bbs = new hash_set;
> 
>   max_threaded_paths = PARAM_VALUE (PARAM_MAX_FSM_THREAD_PATHS);
>-  fsm_find_control_statement_thread_paths (cond, visited_phis,
>bb_path,
>+  fsm_find_control_statement_thread_paths (cond, visited_bbs,
>bb_path,
>  false);
> 
>-  delete visited_phis;
>+  delete visited_bbs;
>   vec_free (bb_path);
> }
>   return 0;
>--- gcc/testsuite/gcc.c-torture/compile/pr65735.c.jj   2015-04-11
>16:14:33.173263982 +0200
>+++ gcc/testsuite/gcc.c-torture/compile/pr65735.c  2015-04-11
>16:14:06.0 +0200
>@@ -0,0 +1,21 @@
>+/* PR tree-optimization/65735 */
>+
>+int foo (void);
>+
>+void
>+bar (int a, int b, int c)
>+{
>+  while (!a)
>+{
>+  c = foo ();
>+  if (c == 7)
>+  c = b;
>+  switch (c)
>+  {
>+  case 1:
>+a = b++;
>+if (b)
>+  b = 1;
>+  }
>+}
>+}
>
>   Jakub




Re: [PATCH] Fix a FSM threading ICE (PR tree-optimization/65735)

2015-04-11 Thread Jakub Jelinek
On Sat, Apr 11, 2015 at 07:19:00PM +0200, Marc Glisse wrote:
> On Sat, 11 Apr 2015, Jakub Jelinek wrote:
> 
> >@@ -1391,13 +1391,13 @@ thread_through_normal_block (edge e,
> >  vec *bb_path;
> >  vec_alloc (bb_path, n_basic_blocks_for_fn (cfun));
> >  vec_safe_push (bb_path, e->dest);
> >-  hash_set *visited_phis = new hash_set;
> >+  hash_set *visited_bbs = new hash_set;
> >
> >  max_threaded_paths = PARAM_VALUE (PARAM_MAX_FSM_THREAD_PATHS);
> >-  fsm_find_control_statement_thread_paths (cond, visited_phis, bb_path,
> >+  fsm_find_control_statement_thread_paths (cond, visited_bbs, bb_path,
> >false);
> >
> >-  delete visited_phis;
> >+  delete visited_bbs;
> >  vec_free (bb_path);
> >}
> >  return 0;
> 
> I understand minimizing the patches right before the release. At any other
> time, it would have been a great occasion to remove this new/delete
> anti-pattern.

Not at this point, I really wanted to do RC1 on Friday, now it looks more
likely for Monday, but really only blocker bugs at this point should go in.

Jakub


Re: [Patch, WWWDOCS] gcc-5/changes.html: Mention that C FE can be build as libcc1.so

2015-04-11 Thread Gerald Pfeifer
Hi Tobias,

On Fri, 6 Feb 2015, Tobias Burnus wrote:
> I think it is useful to know that one can build libcc1.so - also as
> advertisement. Thus, I propose to include something like the quip in
> the attachment.

Index: htdocs/gcc-5/changes.html
===
+The C front end can now also be build as library, which is for instance
+   used by https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob_plain;f=gdb/NEWS;hb=gdb-7.9-branch";
+   >gdb 7.9 for compiling source code used for code injection.

that would be "built as a library", and I believe "GDB 7.9".

Okay with these changes.

Thank you,
Gerald


[PATCH] PR target/47098 OBSD_LIB_SPEC on i686-openbsd3 missing

2015-04-11 Thread Bernhard Reutner-Fischer
gcc/config/openbsd.h:143:18: error: ‘OBSD_LIB_SPEC’ was not declared in
this scope
 #define LIB_SPEC OBSD_LIB_SPEC
  ^
gcc/gcc.c:879:31: note:
in expansion of macro ‘LIB_SPEC’
 static const char *lib_spec = LIB_SPEC;
   ^
make[2]: *** [gcc.o] Error 1

Is the patch below ok for trunk?

i.e. openbsd-oldgas.h is only used on
i?86-*-openbsd2.*|i?86-*openbsd3.[0123] so is right on spot it seems.

Alternatively remove openbsd <= 3.3 support altogether since openbsd-3.3 was
released May 1, 2003.
This probably needs a deprecation announcement from Release Managers or
something.

gcc/ChangeLog:

2015-04-10  Bernhard Reutner-Fischer  

PR target/47098
* config/openbsd-oldgas.h (OBSD_LIB_SPEC): Add.
---
 gcc/config/openbsd-oldgas.h |4 
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/openbsd-oldgas.h b/gcc/config/openbsd-oldgas.h
index 04a4d37..5cef1eb 100644
--- a/gcc/config/openbsd-oldgas.h
+++ b/gcc/config/openbsd-oldgas.h
@@ -20,3 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 
 
 #define OBSD_OLD_GAS
+
+/* OpenBSD3.0 had no libpthread, pthreads lived in -lc_r */
+#define OBSD_LIB_SPEC "%{!shared:-lc%{pthread:_r}}"
+
-- 
1.7.10.4



patch ping

2015-04-11 Thread Bernhard Reutner-Fischer
Hi,

I'd like to ask an RM or global reviewer to kindly consider the
following patches preventing one or the other target in config-list.mk
to build:

[PATCH, bfin] handle BFIN_CPU_UNKNOWN in TARGET_CPU_CPP_BUILTINS
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00034.html

[PATCH, c6x] handle unk_isa in TARGET_CPU_CPP_BUILTINS
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00089.html


Cosmetic patchlets pending but probably for stage 1 now:

Remove redundant guard in emit_bss()
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00337.html

tree-tailcall: Commentary typo fix, remove fwd declaration
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00342.html

s/ ;/;/g Makefile.tpl
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00380.html


[wwwdocs] Add a note around -Wno-discarded-array-qualifiers to the GCC 5 release notes

2015-04-11 Thread Gerald Pfeifer
This is a patch by Martin Uecker, which I just committed.

Gerald
Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.102
diff -u -r1.102 changes.html
--- changes.html10 Apr 2015 21:47:18 -  1.102
+++ changes.html12 Apr 2015 01:01:25 -
@@ -339,6 +339,12 @@
a new warning option -Wno-int-conversion; and warnings
about qualifiers on pointers being discarded via a new warning option
-Wno-discarded-qualifiers.
+To allow proper use of const qualifiers with multidimensional arrays,
+   GCC will not warn about incompatible pointer types anymore for
+   conversions between pointers to arrays with and without const qualifier
+   (except when using -pedantic). Instead, a new warning is
+   emitted only if the const qualifier is lost. This can be controlled with
+   a new warning option -Wno-discarded-array-qualifiers. 
 The C front end now generates more precise caret diagnostics.
 The -pg command-line option now only affects the current
 file in an LTO build.


Re: [PATCH] Fix PR ipa/65722

2015-04-11 Thread Jan Hubicka
Hi,
this is version of patch I comitted after testing at x86_64-linux firefox build
and bootstrapped/regtested ppc64-linux.

Honza

Jan Hubicka  
Martin Liska  

PR ipa/65722
* g++.dg/ipa/pr65722.C: New testcase.

* ipa-icf.c (sem_item::compare_cgraph_references): function and
variable can not match.
(sem_item::update_hash_by_addr_refs): Fix handling of virtual tables.
(sem_variable::equals_wpa): Fix checking of DECL_FINAL_P patch.
Index: testsuite/g++.dg/ipa/pr65722.C
===
--- testsuite/g++.dg/ipa/pr65722.C  (revision 0)
+++ testsuite/g++.dg/ipa/pr65722.C  (revision 0)
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-O -fipa-icf -fno-rtti" }
+
+struct A
+{
+  virtual void f ()
+  {
+__builtin_abort ();
+  }
+  virtual void g ();
+};
+
+struct B : virtual A { };
+struct C : B, virtual A { };
+
+void foo()
+{
+  C c;
+  C *p = &c;
+  p->f ();
+}
Index: ipa-icf.c
===
--- ipa-icf.c   (revision 221977)
+++ ipa-icf.c   (working copy)
@@ -368,6 +368,10 @@ sem_item::compare_cgraph_references (
   if (n1 == n2)
 return true;
 
+  /* Never match variable and function.  */
+  if (is_a  (n1) != is_a  (n2))
+return false;
+
   /* Merging two definitions with a reference to equivalent vtables, but
  belonging to a different type may result in ipa-polymorphic-call analysis
  giving a wrong answer about the dynamic type of instance.  */
@@ -587,9 +591,6 @@ void
 sem_item::update_hash_by_addr_refs (hash_map  &m_symtab_node_map)
 {
-  if (is_a  (node) && DECL_VIRTUAL_P (node->decl))
-return;
-
   ipa_ref* ref;
   inchash::hash hstate (hash);
   for (unsigned i = 0; i < node->num_references (); i++)
@@ -1667,17 +1668,19 @@ sem_variable::equals_wpa (sem_item *item
  ref->address_matters_p ()))
return false;
 
-  /* DECL_FINAL_P flag on methods referred by virtual tables is used
-to decide on completeness possible_polymorphic_call_targets lists
-and therefore it must match.  */
-  if ((DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl))
- && (DECL_VIRTUAL_P (ref->referred->decl)
- || DECL_VIRTUAL_P (ref2->referred->decl))
- && ((DECL_VIRTUAL_P (ref->referred->decl)
-  != DECL_VIRTUAL_P (ref2->referred->decl))
- || (DECL_FINAL_P (ref->referred->decl)
- != DECL_FINAL_P (ref2->referred->decl
-return return_false_with_msg ("virtual or final flag mismatch");
+  /* When matching virtual tables, be sure to also match information
+relevant for polymorphic call analysis.  */
+  if (DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl))
+   {
+ if (DECL_VIRTUAL_P (ref->referred->decl)
+ != DECL_VIRTUAL_P (ref2->referred->decl))
+return return_false_with_msg ("virtual flag mismatch");
+ if (DECL_VIRTUAL_P (ref->referred->decl)
+ && is_a  (ref->referred)
+ && (DECL_FINAL_P (ref->referred->decl)
+ != DECL_FINAL_P (ref2->referred->decl)))
+return return_false_with_msg ("final flag mismatch");
+   }
 }
 
   return true;


Re: [PATCH 1/4] Docs: extend.texi: Add missing semicolon for consistency

2015-04-11 Thread Michael Witten
On Wed, 8 Apr 2015 21:13:10 +0200 (CEST), Gerald Pfeifer wrote:

> On Wed, 27 Apr 2011, Michael Witten wrote:
>> ---
>>  trunk/gcc/doc/extend.texi |2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/trunk/gcc/doc/extend.texi b/trunk/gcc/doc/extend.texi
>> index eddff95..c154958 100644
>> --- a/trunk/gcc/doc/extend.texi
>> +++ b/trunk/gcc/doc/extend.texi
>> @@ -3997,7 +3997,7 @@
>>  @smallexample
>>  __attribute__((noreturn)) void d0 (void),
>>  __attribute__((format(printf, 1, 2))) d1 (const char *, ...),
>> - d2 (void)
>> + d2 (void);
>>  @end smallexample
>>  
>>  @noindent
>
> Hi Michael,
>
> and big apologies for this falling through a lot of cracks
> apparently.  I just committed your patch with the ChangeLog
> below.
>
> If there are any other patches that have not been committed
> (nor NACKed yet, I know there were some as well), please let
> us know and I will look into getting at least documentation
> patches addressed swiftly going forward.
>
> Thank you, and sorry again,
> Gerald
>
> 2015-04-08  Michael Witten  
>
>   * doc/extend.texi (Attribute Syntax): Add a trailing semicolon
>   to an example.
>
> Index: doc/extend.texi
> ===
> --- doc/extend.texi   (revision 221930)
> +++ doc/extend.texi   (working copy)
> @@ -4771,7 +4771,7 @@
>  @smallexample
>  __attribute__((noreturn)) void d0 (void),
>  __attribute__((format(printf, 1, 2))) d1 (const char *, ...),
> - d2 (void)
> + d2 (void);
>  @end smallexample
>
>  @noindent

Well, now! What a pleasant surprise! I was looking for a reason to crack
open a beer, and this shall do nicely.

Say, how did you end up coming across this patch after nearly 4 years?

Anyway, thanks for letting me know, and thank you and the rest of the
GCC team for all of your hard work; you make the world go round.

Sincerely,
Michael Witten


gcc-patches@gcc.gnu.org

2015-04-11 Thread Jan Hubicka
Hi,
this patch fixes two issues that reproduce with firefox build configured for 
LTO&FDO
with -O3 -march=native on bdver2 (but probably elsewhere too).

The first is an ICE on out of bound accesss of jump functions. This is becuase
inline_call uses speculation_useful_p which in turn evaulates predicates.
This can't be done before jump functions are updated after clonning is finished.

THe second is a wrong code, where ipa-cp manages to propagate address of 
non-constant
variable and tries to use it as a call target.

Both bugs I think exists already in GCC 4.9, but they are latent, so I will 
backport
the patch, too.

Bootstrapped/regtested ppc64-linux and also tested on Firefox build, will commit
it shortly.

Honza

PR ipa/65743
* ipa-inline-transform.c (speculation_removed): Remove static var.
(check_speculations): New function.
(clone_inlined_nodes): Do not check spculations.
(inline_call): Call check_speculations.
* ipa-prop.c (ipa_make_edge_direct_to_target): Do not
consider non-invariants.
Index: ipa-inline-transform.c
===
--- ipa-inline-transform.c  (revision 222016)
+++ ipa-inline-transform.c  (working copy)
@@ -64,7 +64,6 @@ along with GCC; see the file COPYING3.
 
 int ncalls_inlined;
 int nfunctions_inlined;
-bool speculation_removed;
 
 /* Scale frequency of NODE edges by FREQ_SCALE.  */
 
@@ -256,12 +255,29 @@ clone_inlined_nodes (struct cgraph_edge
   next = e->next_callee;
   if (!e->inline_failed)
 clone_inlined_nodes (e, duplicate, update_original, overall_size, 
freq_scale);
+}
+}
+
+/* Check all speculations in N and resolve them if they seems useless. */
+
+static bool
+check_speculations (cgraph_node *n)
+{
+  bool speculation_removed = false;
+  cgraph_edge *next;
+
+  for (cgraph_edge *e = n->callees; e; e = next)
+{
+  next = e->next_callee;
   if (e->speculative && !speculation_useful_p (e, true))
{
  e->resolve_speculation (NULL);
  speculation_removed = true;
}
+  else if (!e->inline_failed)
+   speculation_removed |= check_speculations (e->callee);
 }
+  return speculation_removed;
 }
 
 /* Mark all call graph edges coming out of NODE and all nodes that have been
@@ -310,7 +326,6 @@ inline_call (struct cgraph_edge *e, bool
   bool predicated = inline_edge_summary (e)->predicate != NULL;
 #endif
 
-  speculation_removed = false;
   /* Don't inline inlined edges.  */
   gcc_assert (e->inline_failed);
   /* Don't even think of inlining inline clone.  */
@@ -360,6 +375,7 @@ inline_call (struct cgraph_edge *e, bool
 mark_all_inlined_calls_cdtor (e->callee);
   if (opt_for_fn (e->caller->decl, optimize))
 new_edges_found = ipa_propagate_indirect_call_infos (curr, new_edges);
+  check_speculations (e->callee);
   if (update_overall_summary)
inline_update_overall_summary (to);
   new_size = inline_summaries->get (to)->size;
Index: ipa-prop.c
===
--- ipa-prop.c  (revision 222016)
+++ ipa-prop.c  (working copy)
@@ -2626,9 +2626,29 @@ ipa_make_edge_direct_to_target (struct c
   target = canonicalize_constructor_val (target, NULL);
   if (!target || TREE_CODE (target) != FUNCTION_DECL)
{
- if (ie->indirect_info->member_ptr)
-   /* Member pointer call that goes through a VMT lookup.  */
-   return NULL;
+ /* Member pointer call that goes through a VMT lookup.  */
+ if (ie->indirect_info->member_ptr
+ /* Or if target is not an invariant expression and we do not
+know if it will evaulate to function at runtime.
+This can happen when folding through &VAR, where &VAR
+is IP invariant, but VAR itself is not.
+
+TODO: Revisit this when GCC 5 is branched.  It seems that
+member_ptr check is not needed and that we may try to fold
+the expression and see if VAR is readonly.  */
+ || !is_gimple_ip_invariant (target))
+   {
+ if (dump_enabled_p ())
+   {
+ location_t loc = gimple_location_safe (ie->call_stmt);
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+  "discovered direct call non-invariant "
+  "%s/%i\n",
+  ie->caller->name (), ie->caller->order);
+   }
+ return NULL;
+   }
+
 
   if (dump_enabled_p ())
{