Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread Andreas Schwab
H.J. Lu hjl.to...@gmail.com writes:

 What is wrong with it?

It tests nothing.

Andreas.

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


Re: [PATCH] nios2-linux: add missing cpp specs

2015-05-30 Thread Mike Frysinger
On 30 May 2015 09:38, Sandra Loosemore wrote:
 On 05/29/2015 09:28 PM, Mike Frysinger wrote:
  On 29 May 2015 12:32, Sandra Loosemore wrote:
  On 05/29/2015 11:36 AM, Mike Frysinger wrote:
  On 29 May 2015 08:44, Sandra Loosemore wrote:
  On 05/27/2015 10:00 AM, Mike Frysinger wrote:
  Define CPP_SPEC for nios2 linux targets so that -posix  -pthread work
  like on all other linux targets.
 
  2015-05-27  Mike Frysinger  vap...@gentoo.org
 
  * config/nios2/linux.h (CPP_SPEC): Define.
 
  I see that -posix is not documented at all in invoke.texi and -pthread
  is documented only for RS6000 and Solaris (which is not Linux).  What,
  exactly, are these options supposed to do on all other linux targets?
  If these options are supposed to be generic to all Linux targets,
  can't they be handled in some common way instead of duplicating the
  CPP_SPEC code in all the individual back ends?
 
  please see my other threads/patches
 
  (Sorry, I am a few days behind in mailing list traffic, was just trying
  to respond to the review request that was CC'ed to me directly.)
 
  Do you mean this one?
 
  https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html
 
  yes
 
  That addresses my concern about not duplicating this in every back end,
  but I still don't see any documentation and don't really understand what
  these flags are supposed to do or why I might need to add them to my
  command line.  Taking off my nios2 maintainer hat and putting on the
  docs maintainer one instead, I think proper documentation for these
  options is a requirement here
 
  i'm not familiar with the history.  i'm merely cleaning up some of the mess.
  both defines are respected by glibc and make a difference to compilation.
 
 I see that the glibc manual does document the preprocessor macros, but 
 it doesn't look like glibc either uses or documents the use of special 
 GCC command-line options, so I am still confused about why we need these 
 options.  However, if using these command-line options on targets where 
 they previously have existed is common practice, I have no real 
 objection to adding them to nios2 as well.
 
 But, please note that the GCC coding conventions
 
 https://gcc.gnu.org/codingconventions.html#Documentation
 
 explicitly requires documentation for all command-line options.
 
 So, if you are cleaning up the mess to generalize the implementation of 
 these options so that they are no longer confined to a few specific 
 targets, you must also move the documentation for these options out of 
 the back-end-specific part of the manual and make sure it accurately 
 reflects the current purpose and usage of these options.

it's not that i disagree with anything you're saying wrt documentation -- the 
situation is pretty bad.  it's that i think it's not directly impacted by my
changes.  my cleanups also do not really move them out of the back end ...
they still only work for gnu/linux type targets.  so while we should see about 
fixing the docs, i don't think my patch should depend on that considering (1) 
it's an obvious (imo) improvement and (2) the docs have always been broken.
-mike


signature.asc
Description: Digital signature


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread Andreas Schwab
H.J. Lu hjl.to...@gmail.com writes:

 diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
 index 88356cc..74ebff7 100644
 --- a/gcc/config/m68k/m68k.h
 +++ b/gcc/config/m68k/m68k.h
 @@ -40,7 +40,8 @@ along with GCC; see the file COPYING3.  If not see
  %{m68020-40:-m68040}%{m68020-60:-m68040}\
  %{mcpu=*:-mcpu=%*}%{march=*:-march=%*}\
  
 -#define ASM_PCREL_SPEC %{fPIC|fpic|mpcrel:--pcrel} \
 +#define ASM_PCREL_SPEC %{ FPIC_SPEC :--pcrel} \
 + %{mpcrel:%{ NO_FPIC_SPEC :--pcrel}} \
   %{msep-data|mid-shared-library:--pcrel} \

That expands to a spurious --pcrel with -fno-PIE, causing the assembler
to error out while compiling crtstuff if the compiler is configured with
--enable-default-pie.

Andreas.

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


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread Andreas Schwab
H.J. Lu hjl.to...@gmail.com writes:

 There is no harm and the message is gone in stage 2 and 3,
 We can treat it the same as other spurious messages from the
 bootstrap compiler.

But you still need to fix the first test, since it doesn't test
anything.

Andreas.

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


Re: Teach gimple_canonical_types_compatible_p about incomplete types

2015-05-30 Thread Jan Hubicka
 On May 30, 2015 12:56:26 AM GMT+02:00, Jan Hubicka hubi...@ucw.cz wrote:
 
 Index: tree.h
 ===
 --- tree.h   (revision 223877)
 +++ tree.h   (working copy)
 @@ -4598,7 +4598,28 @@
  extern void DEBUG_FUNCTION verify_type (const_tree t);
 extern bool gimple_canonical_types_compatible_p (const_tree,
 const_tree,
   bool trust_type_canonical = 
  true);
 +/* Return simplified tree code of type that is used for canonical type
 merging.  */
 +inline enum tree_code
 +tree_code_for_canonical_type_merging (enum tree_code code)
 +{
 +  /* By C standard, each enumerated type shall be compatible with
 char,
 + a signed integer, or an unsigned integer.  The choice of type is
 + implementation defined (in our case it depends on -fshort-enum).
 
 Please drop the mention of -fshort-enum as Joseph clarified.

I think the comment there is correct -fshort-enum will make us to pick different
integer types based on number of values, but they will always interoperable with
some normal integer type.

Honza
 
 thanks,


Re: Do less generous pointer globbing in alias.c

2015-05-30 Thread Andreas Schwab
Jan Hubicka hubi...@ucw.cz writes:

   * alias.c (alias_set_entry_d): Add is_pointer and has_pointer.
   (alias_stats): Add num_universal.
   (alias_set_subset_of): Special case pointers; be ready for NULL
   children.
   (alias_sets_conflict_p): Special case pointers; be ready for NULL
   children.
   (init_alias_set_entry): Break out from ...
   (record_alias_subset): ... here; propagate new fields;
   allocate children only when really needed.
   (get_alias_set): Do less generous pointer globbing.
   (dump_alias_stats_in_alias_c): Update statistics.
   * gcc.dg/alias-8.c: Do not xfail.
   * gcc.dg/pr62167.c: Prevent FRE.
   * gcc.dg/alias-14.c: New testcase.

This is causing a miscompilation of the stage2 compiler on ia64.

Andreas.

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


[Ada] Use underscored preprocessor symbols in C files

2015-05-30 Thread Eric Botcazou
This changes 4 preprocessor symbols tested in the C files (linux, sun, i386 
and sparc) to their underscored variants.  Both forms are defined by the 
compiler in normal mode, but the former is not in strictly conformant mode and 
this is problematic on Solaris now.  The other preprocessor symbols tested 
already use an underscored form, modulo a couple of exceptions.

Tested on x86_64-suse-linux and i686-pc-solaris2.10, applied on the mainline.


2015-05-30  Eric Botcazou  ebotca...@adacore.com

* adaint.c: Test for __linux__ instead of linux and __sun__ instead
of sun.  Add missing leading underscore to AIX.  Remove #elif 0.
* adaint.h: Likewise.
* cio.c: Likewise.
* cstreams.c: Likewise.
* env.c: Likewise.
* gsocket.h: Likewise.
* init.c: Likewise.  Test for __i386__ instead of i386.
* link.c: Likewise.
* s-oscons-tmplt.c: Likewise.
* sysdep.c: Likewise.
* terminals.c: Likewise.  Use BSD symbol instead of FREEBSD.
* tracebak.c: Likewise.  Test for __sparc__ instead of sparc.


-- 
Eric BotcazouIndex: sysdep.c
===
--- sysdep.c	(revision 223885)
+++ sysdep.c	(working copy)
@@ -49,7 +49,7 @@
 #endif
 
 #ifdef __ANDROID__
-#undef linux
+#undef __linux__
 #endif
 
 #ifdef IN_RTS
@@ -66,7 +66,7 @@
 #include time.h
 #include errno.h
 
-#if defined (sun)  defined (__SVR4)  !defined (__vxworks)
+#if defined (__sun__)  !defined (__vxworks)
 /* The declaration is present in time.h but conditionalized
on a couple of macros we don't define.  */
 extern struct tm *localtime_r(const time_t *, struct tm *);
@@ -282,10 +282,10 @@ __gnat_ttyname (int filedes)
 }
 #endif
 
-#if defined (linux) || defined (sun) \
+#if defined (__linux__) || defined (__sun__) \
   || defined (WINNT) \
   || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
-  || (defined (__svr4__)  defined (i386)) || defined (__Lynx__) \
+  || (defined (__svr4__)  defined (__i386__)) || defined (__Lynx__) \
   || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
   || defined (__GLIBC__) || defined (__APPLE__)
 
@@ -335,9 +335,9 @@ getc_immediate_common (FILE *stream,
int *avail,
int waiting ATTRIBUTE_UNUSED)
 {
-#if defined (linux) || defined (sun) \
+#if defined (__linux__) || defined (__sun__) \
 || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
-|| defined (_AIX) || (defined (__svr4__)  defined (i386)) \
+|| defined (_AIX) || (defined (__svr4__)  defined (__i386__)) \
 || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
 || defined (__GLIBC__) || defined (__APPLE__)
   char c;
@@ -355,9 +355,9 @@ getc_immediate_common (FILE *stream,
   /* Set RAW mode, with no echo */
   termios_rec.c_lflag = termios_rec.c_lflag  ~ICANON  ~ECHO;
 
-#if defined(linux) || defined (sun) \
+#if defined (__linux__) || defined (__sun__) \
 || defined (__MACHTEN__) || defined (__hpux__) \
-|| defined (_AIX) || (defined (__svr4__)  defined (i386)) \
+|| defined (_AIX) || (defined (__svr4__)  defined (__i386__)) \
 || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
 || defined (__GLIBC__) || defined (__APPLE__)
   eof_ch = termios_rec.c_cc[VEOF];
@@ -756,7 +756,7 @@ __gnat_localtime_tzoff (const time_t *ti
   struct tm tp ATTRIBUTE_UNUSED;
 
 /* AIX, HPUX, Sun Solaris */
-#if defined (_AIX) || defined (__hpux__) || defined (sun)
+#if defined (_AIX) || defined (__hpux__) || defined (__sun__)
 {
   (*Lock_Task) ();
 
@@ -819,7 +819,7 @@ __gnat_localtime_tzoff (const time_t *ti
 /* Darwin, Free BSD, Linux, where component tm_gmtoff is present in
struct tm */
 
-#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (linux) \
+#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
   || defined (__GLIBC__)
 {
   localtime_r (timer, tp);
Index: tracebak.c
===
--- tracebak.c	(revision 223885)
+++ tracebak.c	(working copy)
@@ -335,7 +335,7 @@ extern void __runnit(); /* thread entry
 /* PPC ELF (GNU/Linux  VxWorks) -*/
 
 #elif (defined (_ARCH_PPC)  defined (__vxworks)) ||  \
-  (defined (linux)  defined (__powerpc__))
+  (defined (__linux__)  defined (__powerpc__))
 
 #define USE_GENERIC_UNWINDER
 
@@ -363,7 +363,7 @@ struct layout
 
 /*-- SPARC Solaris -*/
 
-#elif defined (sun)  defined (sparc)
+#elif defined (__sun__)  defined (__sparc__)
 
 #define USE_GENERIC_UNWINDER
 
@@ -401,12 +401,12 @@ struct layout
 
 /*--- x86 --*/
 
-#elif defined (i386)
+#elif defined (__i386__)
 
 #if defined (__WIN32)
 #include windows.h
 #define IS_BAD_PTR(ptr) 

Compute canonical type by main variants

2015-05-30 Thread Jan Hubicka

Richard,
this patch makes canonical_type to be computed via the hash only for main
variants of types.  The idea is to save some lookups because most types are
variants and should match.

I also added sanity checking about that.

Bootstrapped/regtested ppc-linux, OK?

Honza

* lto.c (iterative_hash_canonical_type,
gimple_register_canonical_type): only hash main variants of types
* tree.c (verify_type_variant): Verify that type and variant is
compatible.
(gimple_canonical_types_compatible_p): Look for main variants.

Index: lto/lto.c
===
--- lto/lto.c   (revision 223883)
+++ lto/lto.c   (working copy)
@@ -413,6 +413,9 @@ static void
 iterative_hash_canonical_type (tree type, inchash::hash hstate)
 {
   hashval_t v;
+
+  /* All type variants have same TYPE_CANONICAL.  */
+  type = TYPE_MAIN_VARIANT (type);
   /* An already processed type.  */
   if (TYPE_CANONICAL (type))
 {
@@ -498,7 +501,15 @@ gimple_register_canonical_type (tree t)
   if (TYPE_CANONICAL (t) || !type_with_alias_set_p (t))
 return;
 
-  gimple_register_canonical_type_1 (t, hash_canonical_type (t));
+  /* Canonical types are same among all complete variants.  */
+  if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (t)))
+TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
+  else
+{
+  gimple_register_canonical_type_1 (TYPE_MAIN_VARIANT (t),
+   hash_canonical_type (TYPE_MAIN_VARIANT 
(t)));
+  TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
+}
 }
 
 /* Re-compute TYPE_CANONICAL for NODE and related types.  */
Index: tree.c
===
--- tree.c  (revision 223883)
+++ tree.c  (working copy)
@@ -12819,6 +12819,17 @@ verify_type_variant (const_tree t, tree
   debug_tree (TREE_TYPE (t));
   return false;
 }
+  if (type_with_alias_set_p (t)
+   !gimple_canonical_types_compatible_p (t, tv, false))
+{
+  error (type is not compatible with its vairant);
+  debug_tree (tv);
+  error (type variant's TREE_TYPE);
+  debug_tree (TREE_TYPE (tv));
+  error (type's TREE_TYPE);
+  debug_tree (TREE_TYPE (t));
+  return false;
+}
   return true;
 #undef verify_variant_match
 }
@@ -12843,7 +12854,13 @@ bool
 gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
 bool trust_type_canonical)
 {
-  /* Before starting to set up the SCC machinery handle simple cases.  */
+  /* Type variants should be same as the main variant.  When not doing sanity
+ checking to verify this fact, go to main variants and save some work.  */
+  if (trust_type_canonical)
+{
+  t1 = TYPE_MAIN_VARIANT (t1);
+  t2 = TYPE_MAIN_VARIANT (t2);
+}
 
   /* Check first for the obvious case of pointer identity.  */
   if (t1 == t2)


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread H.J. Lu
On Sat, May 30, 2015 at 9:44 AM, Andreas Schwab sch...@linux-m68k.org wrote:
 H.J. Lu hjl.to...@gmail.com writes:

 There is no harm and the message is gone in stage 2 and 3,
 We can treat it the same as other spurious messages from the
 bootstrap compiler.

 But you still need to fix the first test, since it doesn't test
 anything.


What is wrong with it?  Its purpose is to always compile GCC
without PIE.  If the bootstrap compiler allows -fno-PIE, we add
it.  Does the test pass when the bootstrap compiler errors
on -fno-PIE?


-- 
H.J.


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread Andreas Schwab
Andreas Schwab sch...@linux-m68k.org writes:

 H.J. Lu hjl.to...@gmail.com writes:

 diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
 index 88356cc..74ebff7 100644
 --- a/gcc/config/m68k/m68k.h
 +++ b/gcc/config/m68k/m68k.h
 @@ -40,7 +40,8 @@ along with GCC; see the file COPYING3.  If not see
  %{m68020-40:-m68040}%{m68020-60:-m68040}\
  %{mcpu=*:-mcpu=%*}%{march=*:-march=%*}\
  
 -#define ASM_PCREL_SPEC %{fPIC|fpic|mpcrel:--pcrel} \
 +#define ASM_PCREL_SPEC %{ FPIC_SPEC :--pcrel} \
 + %{mpcrel:%{ NO_FPIC_SPEC :--pcrel}} \
   %{msep-data|mid-shared-library:--pcrel} \

 That expands to a spurious --pcrel with -fno-PIE, causing the assembler
 to error out while compiling crtstuff if the compiler is configured with
 --enable-default-pie.

This was already buggy before, -fpie should always have implied --pcrel.
Fixed as below.

Andreas.

* config/m68k/m68k.h (ASM_PCREL_SPEC): Pass --pcrel also for
implict or explicit -fPIE or -fpie.

diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 74ebff7..b227c67 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -40,8 +40,8 @@ along with GCC; see the file COPYING3.  If not see
 %{m68020-40:-m68040}%{m68020-60:-m68040}\
 %{mcpu=*:-mcpu=%*}%{march=*:-march=%*}\
 
-#define ASM_PCREL_SPEC %{ FPIC_SPEC :--pcrel} \
- %{mpcrel:%{ NO_FPIC_SPEC :--pcrel}} \
+#define ASM_PCREL_SPEC %{ FPIE_OR_FPIC_SPEC :--pcrel} \
+ %{mpcrel:%{ NO_FPIE_AND_FPIC_SPEC :--pcrel}} \
  %{msep-data|mid-shared-library:--pcrel} \
 
 
-- 
2.4.2

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


Re: [expmed] Avoid clobbering a yet-to-be-used base/index register.

2015-05-30 Thread DJ Delorie

  * expmed.c (extract_bit_field_1): Avoid clobbering a
  yet-to-be-used base/index register.
 OK.
 jeff

Thanks! committed.



Re: [patch 10/10] debug-early merge: compiler proper

2015-05-30 Thread Aldy Hernandez

On 05/29/2015 03:33 PM, Jason Merrill wrote:

On 05/29/2015 03:26 PM, Richard Biener wrote:

ISTR I had to mark the gimple reg used for the bound as
non-DECL_IGNORED for the LTO stuff.


Let's go with that, then.


Well, I did play around with that option originally, but temporaries do 
not end up in the symbol table, so we won't see them to feed them to 
late_global_decl.


We'd have to save them on the side to make them survive until late and 
then feed them to late_global_decl separately (which I'm sure Richi will 
hate), or we could drill down through the array type/domain to find the 
gimple register (which now has an early DIE) and call late_global_decl 
on it.  However, this last option sounds like a variant of my original 
idea-- fill the bound location later, with the unfortunate side-effect 
of having an additional DIE (the gimple register DIE).


I guess we could iterate through all the gimple registers late that have 
DECL_IGNORED_P == NULL and call late_global_decl on them, but I dislike 
this as well.  Actually, all ideas involving generating DIEs for 
temporaries involve an additional DIE we wouldn't otherwise get.


Can I clean up my original idea instead?

Aldy


Fix Ada bootstrap with LTO

2015-05-30 Thread Jan Hubicka
Hi,
this patch fixes the cddce ICE reproducing during Ada bootstrap. The problem is
forward_edge_to_pdom which does not know how to update PHIs. Due to presence
of abnormal edges there is not unique predecestor the code looks for.

I decided to simply remove the code and go for alternative solution. When CDDCE
removes a conditional, it knows that the condition does not decide about any
live statement.  We can just keep one of outgoing edges but we need to be sure
to not close empty loops in the regions consisting only of basic blocks 
containing
no live statements in them.

I simply calculate distance from next live BB by using 
inverted_post_order_compute
and chose the successors that is on the path to live code. This leaves all the
redirection up to the following cfgcleanup.

Bootstrapped/regtested ppc64-linux. Without Ada because it does not build 
currently
for unrelated reasons, but I did LTObootstrap far enough to be sure that we can
build gnat binary now.

Honza

PR middle-end/65337
* cfganal.c (inverted_post_order_compute): Add option to specify 
starting
points other than EXIT_BLOCK.
* cfganal.h (inverted_post_order_compute): Update prototype.
(bb_postoder): New variable.
(forward_edge_to_pdom): Remove.
(remove_dead_stmt): Rewrite removal of dead control flow.
(eliminate_unnecessary_stmts): Free bb_postorder.
Index: cfganal.c
===
--- cfganal.c   (revision 223892)
+++ cfganal.c   (working copy)
@@ -759,6 +759,9 @@ dfs_find_deadend (basic_block bb)
(from successors to predecessors).
This ordering can be used for forward dataflow problems among others.
 
+   Optionally if START_POINTS is specified, start from exit block and all
+   basic blocks in START_POINTS.  This is used by CD-DCE.
+
This function assumes that all blocks in the CFG are reachable
from the ENTRY (but not necessarily from EXIT).
 
@@ -776,7 +779,8 @@ dfs_find_deadend (basic_block bb)
and do another inverted traversal from that block.  */
 
 int
-inverted_post_order_compute (int *post_order)
+inverted_post_order_compute (int *post_order,
+sbitmap *start_points)
 {
   basic_block bb;
   edge_iterator *stack;
@@ -794,6 +798,18 @@ inverted_post_order_compute (int *post_o
   /* None of the nodes in the CFG have been visited yet.  */
   bitmap_clear (visited);
 
+  if (start_points)
+{
+  FOR_ALL_BB_FN (bb, cfun)
+if (bitmap_bit_p (*start_points, bb-index))
+ {
+stack[sp++] = ei_start (bb-preds);
+bitmap_set_bit (visited, bb-index);
+ }
+  stack[sp++] = ei_start (EXIT_BLOCK_PTR_FOR_FN (cfun)-preds);
+  bitmap_set_bit (visited, EXIT_BLOCK_PTR_FOR_FN (cfun)-index);
+}
+  else
   /* Put all blocks that have no successor into the initial work list.  */
   FOR_ALL_BB_FN (bb, cfun)
 if (EDGE_COUNT (bb-succs) == 0)
Index: cfganal.h
===
--- cfganal.h   (revision 223892)
+++ cfganal.h   (working copy)
@@ -61,7 +61,7 @@ extern void add_noreturn_fake_exit_edges
 extern void connect_infinite_loops_to_exit (void);
 extern int post_order_compute (int *, bool, bool);
 extern basic_block dfs_find_deadend (basic_block);
-extern int inverted_post_order_compute (int *);
+extern int inverted_post_order_compute (int *, sbitmap *start_points = 0);
 extern int pre_and_rev_post_order_compute_fn (struct function *,
  int *, int *, bool);
 extern int pre_and_rev_post_order_compute (int *, int *, bool);
Index: tree-ssa-dce.c
===
--- tree-ssa-dce.c  (revision 223892)
+++ tree-ssa-dce.c  (working copy)
@@ -147,6 +147,9 @@ static sbitmap visited_control_parents;
to be recomputed.  */
 static bool cfg_altered;
 
+/* When non-NULL holds map from basic block index into the postorder.  */
+static int *bb_postorder;
+
 
 /* If STMT is not already marked necessary, mark it, and add it to the
worklist if ADD_TO_WORKLIST is true.  */
@@ -1030,65 +1034,6 @@ remove_dead_phis (basic_block bb)
   return something_changed;
 }
 
-/* Forward edge E to respective POST_DOM_BB and update PHIs.  */
-
-static edge
-forward_edge_to_pdom (edge e, basic_block post_dom_bb)
-{
-  gphi_iterator gsi;
-  edge e2 = NULL;
-  edge_iterator ei;
-
-  if (dump_file  (dump_flags  TDF_DETAILS))
-fprintf (dump_file, Redirecting edge %i-%i to %i\n, e-src-index,
-e-dest-index, post_dom_bb-index);
-
-  e2 = redirect_edge_and_branch (e, post_dom_bb);
-  cfg_altered = true;
-
-  /* If edge was already around, no updating is necessary.  */
-  if (e2 != e)
-return e2;
-
-  if (!gimple_seq_empty_p (phi_nodes (post_dom_bb)))
-{
-  /* We are sure that for every live PHI we are seeing control dependent 
BB.
- This means that we can pick any edge to 

Re: RFC: Add C++ warnings for unnecessarily general return types

2015-05-30 Thread Trevor Saunders
On Fri, May 29, 2015 at 11:14:46PM -0600, Jeff Law wrote:
 On 05/29/2015 11:39 AM, Richard Sandiford wrote:
 One of the main early aims of the rtl refactoring is to finally separate
 instructions (rtx_insns) from other rtxes.  I thought it would help if the
 compiler could warn about cases where a function returns rtx when it
 could return rtx_insn*, or where a variable has type rtx but could have
 type rtx_insn*.
 
 This patch tries to implement something along those lines.  There are two
 warning options, one for function returns and one for variables.  There are
 obviously many good reasons why a functon or variable might have a more 
 general
 type than it might appear to need, so the options certainly aren't -Wall or
 -Wextra material.  But it might be worth having them as stage 2 and 3 
 warnings.
 I can't speak to the implementation as it hits the C++ front-end where my
 knowledge approaches zero.  But I can say that I really like what you're
 trying to do here.  I can easily see how it'd be useful for GCC.

Yeah, I did a bit of this manually a while ago, but automating things is
good.

It would also be useful to have something for arguments, but I guess
that's harder and requires LTO, or at least some post processing.

It would also be useful and also much harder to be able to automatically
rewrite as well as detect these cases.

 The big question in my mind is how useful would this be on other codebases
 --  I have a hard time believing that GCC is the only codebase which has
 these problems.

I'm tempted to agree.  I was going to say that I couldn't think of
another example off the top of my head, but actually I think there are
some things I could use it for or at least I'd give it a try for.

The other more generic approach is to make it easier to write plugins to
do this sort of thing.  I've been pondering writing a checker plugin for
gcc's code for a little while but haven't started on anything yet.

Trev


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread H.J. Lu
On Sat, May 30, 2015 at 2:18 PM, Andreas Schwab sch...@linux-m68k.org wrote:
 H.J. Lu hjl.to...@gmail.com writes:

 What is wrong with it?

 It tests nothing.


Can you explain?

-- 
H.J.


Re: Do less generous pointer globbing in alias.c

2015-05-30 Thread Jan Hubicka
 Jan Hubicka hubi...@ucw.cz writes:
 
  * alias.c (alias_set_entry_d): Add is_pointer and has_pointer.
  (alias_stats): Add num_universal.
  (alias_set_subset_of): Special case pointers; be ready for NULL
  children.
  (alias_sets_conflict_p): Special case pointers; be ready for NULL
  children.
  (init_alias_set_entry): Break out from ...
  (record_alias_subset): ... here; propagate new fields;
  allocate children only when really needed.
  (get_alias_set): Do less generous pointer globbing.
  (dump_alias_stats_in_alias_c): Update statistics.
  * gcc.dg/alias-8.c: Do not xfail.
  * gcc.dg/pr62167.c: Prevent FRE.
  * gcc.dg/alias-14.c: New testcase.
 
 This is causing a miscompilation of the stage2 compiler on ia64.

Hmm, lovely :( 
According to GCC compile farm wiki, GCC 60 and 66 are ia64 but they are not.
I am not sure I have access to working ia64 box.  Can you possibly help me
to debug this?  Is it devirtualization related?
With earlier versions of the patch I run into issue of ipa-icf ICEing in 
sem_function::parse because ipa_polymorphic_call_context::get_dynamic_type
missed initialization of VPTR.  I pushed out just partial fix to the issue
as I want to test it on Firefox first and I am running into intresting
issues with Firefox LTO right now (unrelated to the aliasing).
With some luck it is the same problem because IA-64 has different representation
of function pointers.

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


Re: [RFA] Factor conversion out of COND_EXPR using match.pd pattern

2015-05-30 Thread Marc Glisse

(only commenting on the technique, not on the transformation itself)


+(simplify
+  (cond @0 (convert @1) INTEGER_CST@2)
+  (if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
+COMPARISON_CLASS_P (@0)


If you add COMPARISON_CLASS_P to define_predicates, you could write:
(cond COMPARISON_CLASS_P@0 (convert @1) INTEGER_CST@2)
or maybe use a for loop on comparisons, which would give names to 
TREE_OPERAND (@0, *). This should even handle the operand_equal_p 
alternative:


(cond (cmp:c@0 @1 @2) (convert @1) INTEGER_CST@2)


+int_fits_type_p (@2, TREE_TYPE (@1))
+((operand_equal_p (TREE_OPERAND (@0, 0), @2, 0)
+operand_equal_p (TREE_OPERAND (@0, 1), @1, 0))
+  || (operand_equal_p (TREE_OPERAND (@0, 0), @1, 0)
+   operand_equal_p (TREE_OPERAND (@0, 1), @2, 0
+(with { tree itype = TREE_TYPE (@1); tree otype = TREE_TYPE (@2); }
+  (convert:otype (cond:itype @0 @1 (convert:itype @2))


This should be enough, no need to specify the outer type
(convert (cond:itype @0 @1 (convert:itype @2))

I believe we should not have to write cond:itype here, cond should be made 
to use the type of its second argument instead of the first one, by 
default (expr::gen_transform already has a few special cases).


--
Marc Glisse


Re: [RFA] Factor conversion out of COND_EXPR using match.pd pattern

2015-05-30 Thread Bernhard Reutner-Fischer
On May 30, 2015 6:22:59 AM GMT+02:00, Jeff Law l...@redhat.com wrote:

+/* { dg-final { cleanup-tree-dump original } } */

Please drop this cleanup dg-final, trunk now does this automatically.

Thanks,




Re: [patch] fix bootstrap on FreeBSD i386/arm

2015-05-30 Thread Andreas Tobler

Hi Steve,

On 29.05.15 19:18, Steve Ellcey wrote:

On Thu, 2015-05-28 at 23:54 +0200, Eric Botcazou wrote:

This patch restores bootstrap on i386-*-freebsd*.
The build was failing after the introduction of -std=c++98
configure/build flag. The -std=c++98 enables strict_ansi and on FreeBSD
the libc function atoll is not defined for this.


Solaris (x86 and SPARC) is also broken in various ways: for example, the sun
preprocessor macro is no more defined.  Why do we need strict ANSI exactly?


Andreas,

This patch (or the earlier one) is also breaking a build of my MIPS
cross compiler.  On CentOS 5.11 (yes I know that is old) I can build a
cross compiler where the executables are x86_64 objects but not when
they are i386 objects (i.e. when using -m32 to build GCC).  The error
is duplicate atoll definitions (one in read-rtl.c and one in stdlib.h).

I may be mistaken but think when you moved the atoll check from
AC_CHECK_FUNCS to gcc_AC_CHECK_DECLS you needed to change config.in and
read-rtl.c because gcc_AC_CHECK_DECLS sets HAVE_DECL_ATOLL instead of
HAVE_ATOLL.


I'm sorry. I totally forgot about autoheader...

I'm testing this one now. Would you mind giving it a try?

Thanks,
Andreas

Index: config.in
===
--- config.in   (revision 223885)
+++ config.in   (working copy)
@@ -624,12 +624,6 @@
 #endif
 
 
-/* Define to 1 if you have the `atoll' function. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_ATOLL
-#endif
-
-
 /* Define to 1 if you have the `atoq' function. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_ATOQ
@@ -686,9 +680,16 @@
 #endif
 
 
-/* Define to 1 if we found a declaration for 'basename', otherwise define to
-   0. */
+/* Define to 1 if we found a declaration for 'atoll', otherwise define to 0.
+   */
 #ifndef USED_FOR_TARGET
+#undef HAVE_DECL_ATOLL
+#endif
+
+
+/* Define to 1 if you have the declaration of `basename(const char*)', and to
+   0 if you don't. */
+#ifndef USED_FOR_TARGET
 #undef HAVE_DECL_BASENAME
 #endif
 
@@ -963,8 +964,8 @@
 #endif
 
 
-/* Define to 1 if we found a declaration for 'strstr', otherwise define to 0.
-   */
+/* Define to 1 if you have the declaration of `strstr(const char*,const
+   char*)', and to 0 if you don't. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_DECL_STRSTR
 #endif
Index: read-rtl.c
===
--- read-rtl.c  (revision 223885)
+++ read-rtl.c  (working copy)
@@ -704,7 +704,7 @@
 
 /* Provide a version of a function to read a long long if the system does
not provide one.  */
-#if HOST_BITS_PER_WIDE_INT  HOST_BITS_PER_LONG  !defined(HAVE_ATOLL)  
!defined(HAVE_ATOQ)
+#if HOST_BITS_PER_WIDE_INT  HOST_BITS_PER_LONG  !HAVE_DECL_ATOLL  
!defined(HAVE_ATOQ)
 HOST_WIDE_INT atoll (const char *);
 
 HOST_WIDE_INT
@@ -1328,7 +1328,7 @@
 #else
/* Prefer atoll over atoq, since the former is in the ISO C99 standard.
   But prefer not to use our hand-rolled function above either.  */
-#if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ)
+#if HAVE_DECL_ATOLL || !defined(HAVE_ATOQ)
tmp_wide = atoll (name.string);
 #else
tmp_wide = atoq (name.string);


Re: ping: [gcc patch] libcc1: '@' GDB array operator

2015-05-30 Thread Jan Kratochvil
On Sat, 30 May 2015 07:42:35 +0200, Jeff Law wrote:
 We're still digging out a
 bit from the patches queued while preparing for the gcc5 release.
  gcc6

 So I guess at some level it's not clear to me why we need to support the @
 operator in libcc1.  So perhaps starting with a justification for
 wanting/needed that capability would be helpful.

It is not a simple /@[0-9]+$/ regex, the expression can be for example
(*vararray@(3+1))
Parentheses still could be parsed by GDB, though.

But a statement expression could not be parsed by GDB:
compile print ({ __auto_type ptr=vararray+1; *ptr@3; })
But I have found now it does not work - it prints just a pointer, not an array
- due to:
1   int main (void) { typeof (({ int a[]={1,2,3,4,5}; a; })) *ptr_type; 
return 0; }
(gdb) ptype ptr_type
type = int **
It is in DWARF really just:
DW_TAG_pointer_type - DW_TAG_pointer_type - DW_TAG_base_type

With future C++ support it also would not work:
1   int array[]={1,2,3,4,5};
2   auto copy(array);
(gdb) ptype copy
type = int *


I have found now GDB can do also
*vararray@somevar
while this GCC patch cannot:
gdb command line:1:39: error: second parameter of operator '@' requires 
constant integer
I did not realize that myself before.  I do not think there is an easy fix for
the GCC patch, is it?  But I do not think it matters too much, IMO GDB users
usually put there just constant numbers, at least I do.


So all the currently working cases can be implemented also just in GDB.
I still find more correct to do it in GCC than to implement new kind of
expression parsing in GDB - which the 'compile' project tries to avoid.
But sure up to you whether it fits in GCC or not.


 As for the patch itself, you noted you weren't sure if copy_node was right,
 it would help if you'd describe what problem you were having that's solved
 by copying the node. I wonder if you should be building up a node from
 scratch here.

I have removed it and it works.  But there are many statements I do not
understand and I only guess they should be copying similar code around.
The block of code can be replaced just by:
case ATSIGN_EXPR:
  op0 = TREE_OPERAND (expr, 0);
  op1 = TREE_OPERAND (expr, 1);
  ret = op0;
  TREE_TYPE (ret) = build_array_type_nelts (TREE_TYPE (op0),
tree_to_uhwi (op1));
  TREE_READONLY (ret) = TREE_READONLY (expr);
  TREE_SIDE_EFFECTS (ret) = TREE_SIDE_EFFECTS (expr);
  TREE_THIS_VOLATILE (ret) = TREE_THIS_VOLATILE (expr);
  goto out;
which also works for me.  But I guess one could find some countercases for this
simplified block.


 In general, please use C style comments rather than C++.

Done.


Jan


Re: [RFA] Reimplement canonicalization of comparison arguments in match.pd

2015-05-30 Thread Marc Glisse

On Fri, 29 May 2015, Jeff Law wrote:

c-common.c::shorten_compare has code to canonicalize the arguments of a 
comparison so that the constant is the second argument.  This patch removes 
the implementation from c-common.c and instead implements it in match.pd.


Note the match.pd tries to match the prior behavior of shorten_compare, hence 
the strange handling of zero.  No justification exists AFAIK for that strange 
handling in shorten_compare.


The match.pd pattern is primarily Kai's -- I just took the 4 patterns he 
wrote and squashed them into a single pattern to avoid the test duplication.


The xfailed testcase is only case I saw across my comparison tests where this 
change regressed.  Basically shorten-compare had something non-canonical when 
called.  It was able to canonicalize, then optimize the result.  I just 
wanted a record of that test in the testsuite. Obviously if we hit our goal 
of implementing everything from shorten_compare, that test will no longer 
need to be xfailed :-)


Bootstrapped and regression tested on x86-linux-gnu.  OK for the trunk?


I understand doing it in 2 commits to better see what regresses, but I 
don't think we should keep the weirdness in match.pd.


Does it regress anything if we instead add inside the for loop that 
follows /* -A CMP -B - B CMP A.  */


(simplify
 (cmp CONSTANT_CLASS_P@0 @1)
 (scmp @1 @0))

? If we want to inhibit in some cases because we fail to fold to a 
constant, or because COND_EXPR needs 1 != 0 or something, we can always 
add checks:


(simplify
 (cmp CONSTANT_CLASS_P@0 @1)
 (if (!zerop (@1))
  (scmp @1 @0)))

(hmm, I didn't add zerop to tree.[hc] yet) or !CONSTANT_CLASS_P (@1) or 
whatever is necessary.


--
Marc Glisse


[PATCH] netbsd: respect -symbolic

2015-05-30 Thread Mike Frysinger
The current netbsd elf spec doesn't respect -symbolic which prevents
passing -Bsymbolic down to the linker.  This causes problems when you
try to link the runtime linker as it creates an ELF with incorrect
sections in it leading it to crash at startup.

2015-05-30  Benigno B. Junior  b...@gentoo.org

* config/netbsd-elf.h (NETBSD_LINK_SPEC_ELF): Turn -symbolic into
-Bsymbolic.
---
 gcc/config/netbsd-elf.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/netbsd-elf.h b/gcc/config/netbsd-elf.h
index ea09429..a679bbd 100644
--- a/gcc/config/netbsd-elf.h
+++ b/gcc/config/netbsd-elf.h
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.  If not see
 #define NETBSD_LINK_SPEC_ELF \
   %{assert*} %{R*} %{rpath*} \
%{shared:-shared} \
+   %{symbolic:-Bsymbolic} \
%{!shared: \
  -dc -dp \
  %{!nostdlib: \
-- 
2.4.1



Re: Teach gimple_canonical_types_compatible_p about incomplete types

2015-05-30 Thread Bernhard Reutner-Fischer
On May 30, 2015 12:56:26 AM GMT+02:00, Jan Hubicka hubi...@ucw.cz wrote:

Index: tree.h
===
--- tree.h (revision 223877)
+++ tree.h (working copy)
@@ -4598,7 +4598,28 @@
 extern void DEBUG_FUNCTION verify_type (const_tree t);
extern bool gimple_canonical_types_compatible_p (const_tree,
const_tree,
bool trust_type_canonical = 
 true);
+/* Return simplified tree code of type that is used for canonical type
merging.  */
+inline enum tree_code
+tree_code_for_canonical_type_merging (enum tree_code code)
+{
+  /* By C standard, each enumerated type shall be compatible with
char,
+ a signed integer, or an unsigned integer.  The choice of type is
+ implementation defined (in our case it depends on -fshort-enum).

Please drop the mention of -fshort-enum as Joseph clarified.

thanks,

 
+ For this reason we make no distinction between ENUMERAL_TYPE and
INTEGER
+ type and compare only by their signedness and precision.  */
+  if (code == ENUMERAL_TYPE)
+return INTEGER_TYPE;
+  /* To allow inter-operability between languages having references
and
+ C, we consider reference types and pointers alike.  Note that
this is
+ not strictly necessary for C-Fortran 2008 interoperability
because
+ Fortran define C_PTR type that needs to be compatible with C
pointers
+ and we handle this one as ptr_type_node.  */
+  if (code == REFERENCE_TYPE)
+return POINTER_TYPE;
+  return code;
+}
+
 #define tree_map_eq tree_map_base_eq
 extern unsigned int tree_map_hash (const void *);
 #define tree_map_marked_p tree_map_base_marked_p




Re: [patch] libstdc++/66327 don't pass null pointers to memcmp

2015-05-30 Thread Jonathan Wakely

On 30/05/15 09:36 +, Jörg Richter wrote:

How about comparing only the length against 0?
The pointers must be != 0 if length  0.

Like so? Yes, that's probably an improvement, because we need that
length anyway.


Yes, that is what I had in mind.
I think the second case can be handled equally by
precomputing std::min(__len1, __len2).


Yep, that's better too, I've tested and committed this patch. Thanks
for the suggestions.


commit 12ae71c3947824fa096113a418c7fe9e2ba89d19
Author: Jonathan Wakely jwak...@redhat.com
Date:   Fri May 29 23:48:55 2015 +0100

	* include/bits/stl_algobase.h (__equaltrue::equal): Check length
	instead of checking for null pointers.
	(__lexicographical_comparetrue::__lc): Only check shorter length.

diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index db065e2..12eb7ec 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -812,11 +812,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 static bool
 equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
 {
-	  if (__first1 == 0 || __first2 == 0)
-	return __first1 == __last1;
-
-	  return !__builtin_memcmp(__first1, __first2, sizeof(_Tp)
-   * (__last1 - __first1));
+	  if (const size_t __len = (__last1 - __first1))
+	return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len);
+	  return true;
 	}
 };
 
@@ -920,14 +918,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	{
 	  const size_t __len1 = __last1 - __first1;
 	  const size_t __len2 = __last2 - __first2;
-	  if (__len1  __len2)
-	{
-	  if (int __result = __builtin_memcmp(__first1, __first2,
-		  std::min(__len1, __len2)))
-		{
-		  return __result  0;
-		}
-	}
+	  if (const size_t __len = std::min(__len1, __len2))
+	if (int __result = __builtin_memcmp(__first1, __first2, __len))
+	  return __result  0;
 	  return __len1  __len2;
 	}
 };


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread Andreas Schwab
H.J. Lu hjl.to...@gmail.com writes:

 +# Check if -fno-PIE works.
 +AC_CACHE_CHECK([for -fno-PIE option],
 +  [gcc_cv_c_no_fpie],
 +  [saved_CFLAGS=$CFLAGS
 +   CFLAGS=$CFLAGS -fno-PIE
 +   AC_COMPILE_IFELSE([int main(void) {return 0;}],
 + [gcc_cv_c_no_fpie=yes],
 + [gcc_cv_c_no_fpie=no])
 +   CFLAGS=$saved_CFLAGS])
 +if test $gcc_cv_c_no_fpie = yes; then
 +  NO_PIE_CFLAGS=-fno-PIE
 +fi
 +AC_SUBST([NO_PIE_CFLAGS])
 +

That doesn't work:

configure:28726: checking for -fno-PIE option
configure:28737: g++ -c -g   conftest.cpp 5
configure:28737: $? = 0
configure:28745: result: yes

 +# Check if -no-pie works.
 +AC_CACHE_CHECK([for -no-pie option],
 +  [gcc_cv_no_pie],
 +  [saved_LDFLAGS=$LDFLAGS
 +   LDFLAGS=$LDFLAGS -no-pie
 +   AC_LINK_IFELSE([int main(void) {return 0;}],
 + [gcc_cv_no_pie=yes],
 + [gcc_cv_no_pie=no])
 +   LDFLAGS=$saved_LDFLAGS])
 +if test $gcc_cv_no_pie = yes; then
 +  NO_PIE_FLAG=-no-pie
 +fi
 +AC_SUBST([NO_PIE_FLAG])
 +

That doesn't work with gcc 4.3:

configure:28753: checking for -no-pie option
configure:28764: g++ -std=c++98 -o conftest -g -no-pie conftest.cpp  5
g++: unrecognized option '-no-pie'
configure:28764: $? = 0
configure:28773: result: yes

Andreas.

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


Re: Do less generous pointer globbing in alias.c

2015-05-30 Thread H.J. Lu
On Thu, May 28, 2015 at 1:12 PM, Jan Hubicka hubi...@ucw.cz wrote:
 hello,
 only providing you the testcase why I need transitive closure of contains
 pointer via the extra child I noticed that there is extra symmetry to handle:

  struct a {void *ptr;}
  char **ptr = (char **)a.ptr;
  ptr = ...

 This one doesn't really fly with my extra subset code, because ptr is not
 universal pointer, but struct a contains one and thus should conflict with
 every pointer.  Adding every pointer as subset of every structure with
 universal pointer is impractical (childs of those structures would be 
 appearing
 as new pointer types get alias sets) and thus indeed it is better to handle it
 same way as alias set 0 - by a special case in alias_set_subset_of
 and alias_sets_conflict_p.

 So I added the second flag - has_pointer that is transitive closure of
 is_pointer and added the special case to alias_sets_conflict_p instead of
 adding the extra subset relation into the DAG.

 I also added statistics and made changes you suggested (making child
 hash to be possibly NULL and clenaing up alias set conflict construction)

 I also constructed a testcase that covers all the new code paths.

 The patch bootstrapped/regtested ppc64-linux.  I am not bound to teaching
 next week, so if I hear no negative comments, I will schedule commiting the
 patch for weekend to deal with possible fallout.

 There are few cleanups possible incrementally - i.e. the hash set seems
 irrationaly large for average type, we could avoid some pointer travelling
 overhead and we could also do better at alias_sets_must_conflict_p.

 Honza

 * alias.c (alias_set_entry_d): Add is_pointer and has_pointer.
 (alias_stats): Add num_universal.
 (alias_set_subset_of): Special case pointers; be ready for NULL
 children.
 (alias_sets_conflict_p): Special case pointers; be ready for NULL
 children.
 (init_alias_set_entry): Break out from ...
 (record_alias_subset): ... here; propagate new fields;
 allocate children only when really needed.
 (get_alias_set): Do less generous pointer globbing.
 (dump_alias_stats_in_alias_c): Update statistics.
 * gcc.dg/alias-8.c: Do not xfail.
 * gcc.dg/pr62167.c: Prevent FRE.
 * gcc.dg/alias-14.c: New testcase.
==
 --- testsuite/gcc.dg/alias-8.c  (revision 223772)
 +++ testsuite/gcc.dg/alias-8.c  (working copy)
 @@ -8,5 +8,5 @@ struct s {
  void
  func(struct s *ptr)
  {
 -  *(void **)ptr-p = 0; /* { dg-warning type-punned pointer  { xfail 
 *-*-* } } */
 +  *(void **)ptr-p = 0; /* { dg-warning type-punned pointer  { } } */
  }

This caused:

ERROR: gcc.dg/alias-8.c: syntax error in target selector  for 
dg-warning 11 type-punned pointer  { } 

I checked in this fix.

H.J.
---
Index: ChangeLog
===
--- ChangeLog (revision 223886)
+++ ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2015-05-30  H.J. Lu  hongjiu...@intel.com
+
+ * gcc.dg/alias-8.c: Fix dg-warning.
+
 2015-05-30  Jan Hubicka  hubi...@ucw.cz

  * gcc.dg/alias-8.c: Do not xfail.
Index: gcc.dg/alias-8.c
===
--- gcc.dg/alias-8.c (revision 223886)
+++ gcc.dg/alias-8.c (working copy)
@@ -8,5 +8,5 @@
 void
 func(struct s *ptr)
 {
-  *(void **)ptr-p = 0; /* { dg-warning type-punned pointer  { } } */
+  *(void **)ptr-p = 0; /* { dg-warning type-punned pointer } */
 }


Re: [PATCH] nios2-linux: add missing cpp specs

2015-05-30 Thread Sandra Loosemore

On 05/29/2015 09:28 PM, Mike Frysinger wrote:

On 29 May 2015 12:32, Sandra Loosemore wrote:

On 05/29/2015 11:36 AM, Mike Frysinger wrote:

On 29 May 2015 08:44, Sandra Loosemore wrote:

On 05/27/2015 10:00 AM, Mike Frysinger wrote:

Define CPP_SPEC for nios2 linux targets so that -posix  -pthread work
like on all other linux targets.

2015-05-27  Mike Frysinger  vap...@gentoo.org

* config/nios2/linux.h (CPP_SPEC): Define.


I see that -posix is not documented at all in invoke.texi and -pthread
is documented only for RS6000 and Solaris (which is not Linux).  What,
exactly, are these options supposed to do on all other linux targets?
If these options are supposed to be generic to all Linux targets,
can't they be handled in some common way instead of duplicating the
CPP_SPEC code in all the individual back ends?


please see my other threads/patches


(Sorry, I am a few days behind in mailing list traffic, was just trying
to respond to the review request that was CC'ed to me directly.)

Do you mean this one?

https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html


yes


That addresses my concern about not duplicating this in every back end,
but I still don't see any documentation and don't really understand what
these flags are supposed to do or why I might need to add them to my
command line.  Taking off my nios2 maintainer hat and putting on the
docs maintainer one instead, I think proper documentation for these
options is a requirement here


i'm not familiar with the history.  i'm merely cleaning up some of the mess.
both defines are respected by glibc and make a difference to compilation.


I see that the glibc manual does document the preprocessor macros, but 
it doesn't look like glibc either uses or documents the use of special 
GCC command-line options, so I am still confused about why we need these 
options.  However, if using these command-line options on targets where 
they previously have existed is common practice, I have no real 
objection to adding them to nios2 as well.


But, please note that the GCC coding conventions

https://gcc.gnu.org/codingconventions.html#Documentation

explicitly requires documentation for all command-line options.

So, if you are cleaning up the mess to generalize the implementation of 
these options so that they are no longer confined to a few specific 
targets, you must also move the documentation for these options out of 
the back-end-specific part of the manual and make sure it accurately 
reflects the current purpose and usage of these options.


-Sandra



Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread H.J. Lu
On Sat, May 30, 2015 at 8:10 AM, Andreas Schwab sch...@linux-m68k.org wrote:
 H.J. Lu hjl.to...@gmail.com writes:

 +# Check if -fno-PIE works.
 +AC_CACHE_CHECK([for -fno-PIE option],
 +  [gcc_cv_c_no_fpie],
 +  [saved_CFLAGS=$CFLAGS
 +   CFLAGS=$CFLAGS -fno-PIE
 +   AC_COMPILE_IFELSE([int main(void) {return 0;}],
 + [gcc_cv_c_no_fpie=yes],
 + [gcc_cv_c_no_fpie=no])
 +   CFLAGS=$saved_CFLAGS])
 +if test $gcc_cv_c_no_fpie = yes; then
 +  NO_PIE_CFLAGS=-fno-PIE
 +fi
 +AC_SUBST([NO_PIE_CFLAGS])
 +

 That doesn't work:

 configure:28726: checking for -fno-PIE option
 configure:28737: g++ -c -g   conftest.cpp 5
 configure:28737: $? = 0
 configure:28745: result: yes

 +# Check if -no-pie works.
 +AC_CACHE_CHECK([for -no-pie option],
 +  [gcc_cv_no_pie],
 +  [saved_LDFLAGS=$LDFLAGS
 +   LDFLAGS=$LDFLAGS -no-pie
 +   AC_LINK_IFELSE([int main(void) {return 0;}],
 + [gcc_cv_no_pie=yes],
 + [gcc_cv_no_pie=no])
 +   LDFLAGS=$saved_LDFLAGS])
 +if test $gcc_cv_no_pie = yes; then
 +  NO_PIE_FLAG=-no-pie
 +fi
 +AC_SUBST([NO_PIE_FLAG])
 +

 That doesn't work with gcc 4.3:

 configure:28753: checking for -no-pie option
 configure:28764: g++ -std=c++98 -o conftest -g -no-pie conftest.cpp  5
 g++: unrecognized option '-no-pie'
 configure:28764: $? = 0
 configure:28773: result: yes


Starting GCC 4.6, the unrecognized option became an error.
Before 4.6, it was ignored.  Does it cause any problems for
bootstrap?

-- 
H.J.


Re: GIMPLE syntax highlighting for vim

2015-05-30 Thread Marek Polacek
On Sat, May 30, 2015 at 08:56:09AM +0300, Mikhail Maltsev wrote:
  The attached vim script can be used to highlight syntax in GIMPLE dumps
  making them somewhat easier to read.

Which reminds me that we could have something similar for match.pd.
I might take a crack at that next week.

Marek


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread Andreas Schwab
H.J. Lu hjl.to...@gmail.com writes:

 Starting GCC 4.6, the unrecognized option became an error.
 Before 4.6, it was ignored.  Does it cause any problems for
 bootstrap?

No, only spurious messages.

Andreas.

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


Re: Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

2015-05-30 Thread H.J. Lu
On Sat, May 30, 2015 at 8:54 AM, Andreas Schwab sch...@linux-m68k.org wrote:
 H.J. Lu hjl.to...@gmail.com writes:

 Starting GCC 4.6, the unrecognized option became an error.
 Before 4.6, it was ignored.  Does it cause any problems for
 bootstrap?

 No, only spurious messages.


There is no harm and the message is gone in stage 2 and 3,
We can treat it the same as other spurious messages from the
bootstrap compiler.


-- 
H.J.