Re: Fix pr61848, linux kernel miscompile

2014-09-14 Thread Andrew Pinski
On Sun, Sep 14, 2014 at 9:02 PM, Alan Modra  wrote:
> This patch cures the linux kernel boot failure when compiled using
> trunk gcc.  (Andrew, apologies for hijacking your bugzilla, I started
> work on this before finding the bugzilla..)

It is ok that you took over as it looks like you have a more complete
patch than I had.
Does it make sense to add a few testcases for the section attribute too?

Thanks,
Andrew Pinski

>
> At its heart, the problem is caused by merge_decls merging from the
> old decl to the new decl, then copying back to the old decl and
> discarding the new.  When Jan moved some fields to the symtab,
> "copying back to the old decl" was lost for those fields.  Really,
> it would be best if merge_decls was rewritten to merge everything to
> the kept decl, but here I'm just doing that for fields accessed via
> decl_with_vis.symtab_node.
>
> I also make a few other fixes
> 1)  Trunk does not honour the last section attribute.
> extern char foo;
> char foo __attribute__ ((__section__(".machine")));
> char foo __attribute__ ((__section__(".mymachine")));
> results in a section of ".machine" for foo, rather than
> ".mymachine", the result for previous compilers back to 2.95 and
> possibly beyond.
> 1b) The comment about issuing "an error if the sections conflict"
> being done "later in decl_attributes" is seriously out of date.
> decl_attributes is called earlier on a fresh decl, so no error is
> issued (which I think makes the code in handle_section_attribute
> issuing this error, dead).  It's been that way since at least 2.95.
> 2)  TLS model attributes have never been merged as far as I can tell,
> except for #pragma omp threadprivate variables.  I think
> extern int __thread x;
> int __thread x __attribute__ ((__tls_model__("local-exec")));
> ought to result in a local-exec "x" rather than a default model
> "x", but see the "isn't quite correct" comment below.  Fixing that
> will, I think, require changing enum tls_model to make
> TLS_MODEL_REAL different to TLS_MODEL_GLOBAL_DYNAMIC (which will
> also fix the mismatch between enum tls_model and tls_model_names[]).
> 3)  The patch hunks below in cp/decl.c that just s/olddecl/newdecl/
> are to fix "if (TREE_CODE (newdecl) == FUNCTION_DECL) ...
> else switch (TREE_CODE (olddecl))" which looks horrible to me.
> It's really just cosmetic since we know
> TREE_CODE (newdecl) == TREE_CODE (olddecl) at this point.
>
> Bootstrapped and regression tested x86_64-linux.  OK to apply?
>
> gcc/c/
> PR middle-end/61848
> * c-decl.c (merge_decls): Don't merge section name or tls model
> to newdecl symtab node, instead merge to olddecl.  Override
> existing olddecl section name.  Set tls_model for all thread-local
> vars, not just OMP thread-private ones.  Remove incorrect comment.
> gcc/cp/
> PR middle-end/61848
> * decl.c (merge_decls): Don't merge section name, comdat group or
> tls model to newdecl symtab node, instead merge to olddecl.
> Override existing olddecl section name.  Set tls_model for all
> thread-local vars, not just OMP thread-private ones.  Remove
> incorrect comment.
>
> Index: gcc/c/c-decl.c
> ===
> --- gcc/c/c-decl.c  (revision 215233)
> +++ gcc/c/c-decl.c  (working copy)
> @@ -2292,22 +2292,10 @@ merge_decls (tree newdecl, tree olddecl, tree newt
>
>/* Merge the threadprivate attribute.  */
>if (TREE_CODE (olddecl) == VAR_DECL && C_DECL_THREADPRIVATE_P (olddecl))
> -{
> -  set_decl_tls_model (newdecl, DECL_TLS_MODEL (olddecl));
> -  C_DECL_THREADPRIVATE_P (newdecl) = 1;
> -}
> +C_DECL_THREADPRIVATE_P (newdecl) = 1;
>
>if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS))
>  {
> -  /* Merge the section attribute.
> -We want to issue an error if the sections conflict but that
> -must be done later in decl_attributes since we are called
> -before attributes are assigned.  */
> -  if ((DECL_EXTERNAL (olddecl) || TREE_PUBLIC (olddecl) || TREE_STATIC 
> (olddecl))
> - && DECL_SECTION_NAME (newdecl) == NULL
> - && DECL_SECTION_NAME (olddecl))
> -   set_decl_section_name (newdecl, DECL_SECTION_NAME (olddecl));
> -
>/* Copy the assembler name.
>  Currently, it can only be defined in the prototype.  */
>COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
> @@ -2517,6 +2505,20 @@ merge_decls (tree newdecl, tree olddecl, tree newt
>   (char *) newdecl + sizeof (struct tree_decl_common),
>   tree_code_size (TREE_CODE (olddecl)) - sizeof (struct 
> tree_decl_common));
>   olddecl->decl_with_vis.symtab_node = snode;
> +
> + if ((DECL_EXTERNAL (olddecl)
> +  || TREE_PUBLIC (olddecl)
> +  || TREE_STATI

Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-09-14 Thread Chen Gang

On 9/15/14 11:03, Michael Eager wrote:
> On 09/14/14 00:51, Chen Gang wrote:
>> Hello maintainers:
>>
>> I also find some warnings during compiling microblaze, I also shall try
>> to fix them, but excuse me, I am not quite familiar the testsuite for
>> microblaze, could you provide any related information for it?
> 
> Hi Chen --
> 
> This is the gcc DejaGNU test suite.  You can find info about DejaGNU
> at http://www.gnu.org/software/dejagnu.  There is also info about
> testing GCC here: https://gcc.gnu.org/wiki/Testing_GCC
> 

OK, thanks. I finished about x86_64 testsuite, and also tried microblaze
testsuite under x86_64 machine, but failed. Do I need any additional
information for microblaze testsuite?


> Rather than the standard "make check-gcc" described on the wiki
> page and elsewhere, I use a script which sets some configuration
> options and executes runtest directly.  This uses a MicroBlaze processor
> simulator called vpexec which was included with an older version of
> Xilinx's EDK.  Xilinx no longer supports vpexec.
> 
> You can use a hardware target board to test microblaze-gcc,
> or a different simulator such as QEMU.
> 

OK, thanks, I shall try Qemu (it is the additional chance for me to
familiar with Qemu).

And do you mean I need try testsuite under the related microblaze host (
e.g. Qemu microblaze simulator)?


After finish environments construction, I shall also try to test a patch
for "((void (*)(void)) 0)()" fixing.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed


Fix pr61848, linux kernel miscompile

2014-09-14 Thread Alan Modra
This patch cures the linux kernel boot failure when compiled using
trunk gcc.  (Andrew, apologies for hijacking your bugzilla, I started
work on this before finding the bugzilla..)

At its heart, the problem is caused by merge_decls merging from the
old decl to the new decl, then copying back to the old decl and
discarding the new.  When Jan moved some fields to the symtab,
"copying back to the old decl" was lost for those fields.  Really,
it would be best if merge_decls was rewritten to merge everything to
the kept decl, but here I'm just doing that for fields accessed via
decl_with_vis.symtab_node.

I also make a few other fixes
1)  Trunk does not honour the last section attribute.
extern char foo;
char foo __attribute__ ((__section__(".machine")));
char foo __attribute__ ((__section__(".mymachine")));
results in a section of ".machine" for foo, rather than
".mymachine", the result for previous compilers back to 2.95 and
possibly beyond.
1b) The comment about issuing "an error if the sections conflict"
being done "later in decl_attributes" is seriously out of date.
decl_attributes is called earlier on a fresh decl, so no error is
issued (which I think makes the code in handle_section_attribute
issuing this error, dead).  It's been that way since at least 2.95.
2)  TLS model attributes have never been merged as far as I can tell,
except for #pragma omp threadprivate variables.  I think
extern int __thread x;
int __thread x __attribute__ ((__tls_model__("local-exec")));
ought to result in a local-exec "x" rather than a default model
"x", but see the "isn't quite correct" comment below.  Fixing that
will, I think, require changing enum tls_model to make
TLS_MODEL_REAL different to TLS_MODEL_GLOBAL_DYNAMIC (which will
also fix the mismatch between enum tls_model and tls_model_names[]).
3)  The patch hunks below in cp/decl.c that just s/olddecl/newdecl/
are to fix "if (TREE_CODE (newdecl) == FUNCTION_DECL) ...
else switch (TREE_CODE (olddecl))" which looks horrible to me.
It's really just cosmetic since we know
TREE_CODE (newdecl) == TREE_CODE (olddecl) at this point.

Bootstrapped and regression tested x86_64-linux.  OK to apply?

gcc/c/
PR middle-end/61848
* c-decl.c (merge_decls): Don't merge section name or tls model
to newdecl symtab node, instead merge to olddecl.  Override
existing olddecl section name.  Set tls_model for all thread-local
vars, not just OMP thread-private ones.  Remove incorrect comment.
gcc/cp/
PR middle-end/61848
* decl.c (merge_decls): Don't merge section name, comdat group or
tls model to newdecl symtab node, instead merge to olddecl.
Override existing olddecl section name.  Set tls_model for all
thread-local vars, not just OMP thread-private ones.  Remove
incorrect comment.

Index: gcc/c/c-decl.c
===
--- gcc/c/c-decl.c  (revision 215233)
+++ gcc/c/c-decl.c  (working copy)
@@ -2292,22 +2292,10 @@ merge_decls (tree newdecl, tree olddecl, tree newt
 
   /* Merge the threadprivate attribute.  */
   if (TREE_CODE (olddecl) == VAR_DECL && C_DECL_THREADPRIVATE_P (olddecl))
-{
-  set_decl_tls_model (newdecl, DECL_TLS_MODEL (olddecl));
-  C_DECL_THREADPRIVATE_P (newdecl) = 1;
-}
+C_DECL_THREADPRIVATE_P (newdecl) = 1;
 
   if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS))
 {
-  /* Merge the section attribute.
-We want to issue an error if the sections conflict but that
-must be done later in decl_attributes since we are called
-before attributes are assigned.  */
-  if ((DECL_EXTERNAL (olddecl) || TREE_PUBLIC (olddecl) || TREE_STATIC 
(olddecl))
- && DECL_SECTION_NAME (newdecl) == NULL
- && DECL_SECTION_NAME (olddecl))
-   set_decl_section_name (newdecl, DECL_SECTION_NAME (olddecl));
-
   /* Copy the assembler name.
 Currently, it can only be defined in the prototype.  */
   COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
@@ -2517,6 +2505,20 @@ merge_decls (tree newdecl, tree olddecl, tree newt
  (char *) newdecl + sizeof (struct tree_decl_common),
  tree_code_size (TREE_CODE (olddecl)) - sizeof (struct 
tree_decl_common));
  olddecl->decl_with_vis.symtab_node = snode;
+
+ if ((DECL_EXTERNAL (olddecl)
+  || TREE_PUBLIC (olddecl)
+  || TREE_STATIC (olddecl))
+ && DECL_SECTION_NAME (newdecl) != NULL)
+   set_decl_section_name (olddecl, DECL_SECTION_NAME (newdecl));
+
+ /* This isn't quite correct for something like
+   int __thread x attribute ((tls_model ("local-exec")));
+   extern int __thread x;
+as we'll lose the "local-exec" model.  */
+ if (TREE_CODE (olddecl) == VAR_DECL
+ 

Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-09-14 Thread Michael Eager

On 09/14/14 00:51, Chen Gang wrote:

Hello maintainers:

I also find some warnings during compiling microblaze, I also shall try
to fix them, but excuse me, I am not quite familiar the testsuite for
microblaze, could you provide any related information for it?


Hi Chen --

This is the gcc DejaGNU test suite.  You can find info about DejaGNU
at http://www.gnu.org/software/dejagnu.  There is also info about
testing GCC here: https://gcc.gnu.org/wiki/Testing_GCC

Rather than the standard "make check-gcc" described on the wiki
page and elsewhere, I use a script which sets some configuration
options and executes runtest directly.  This uses a MicroBlaze processor
simulator called vpexec which was included with an older version of
Xilinx's EDK.  Xilinx no longer supports vpexec.

You can use a hardware target board to test microblaze-gcc,
or a different simulator such as QEMU.


--
Michael Eagerea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


Re: [PATCH 1/2] Add an no_reorder attribute for LTO

2014-09-14 Thread Andi Kleen
> I see, you want to mix toplevel/non-toplevel across partitions.  In that case 
> we also
> need to disable logic sorting partitions by size if no_reorder BBs exists in 
> more than
> one partition.

Isn't that already broken then with -fno-toplevel-reorder? 

It already puts ordered nodes into different partitions, unless i'm missing
something.

-Andi



Re: [patch i386]: Sibcall tail-call improvement and partial fix PR/60104

2014-09-14 Thread Segher Boessenkool
On Sun, Sep 14, 2014 at 02:38:45PM -0700, Mike Stump wrote:
> +   SIBLING_CALL_P (tmp) = 1;
> +   SIBLING_CALL_P (tmp) = 1;

The second time is to make sure?  :-)


Segher


Re: [PATCH 1/2] Add an no_reorder attribute for LTO

2014-09-14 Thread Jan Hubicka
> > Yep, -fno-toplevel-reorder also ldisables some optimizations (as unreachable
> > function removal)
> 
> Actually it seemed like in my tests it only disables unreachable
> variable removal. Might have been wrong though.
> 
> > >/* Set when function is visible by other units.  */
> > >unsigned externally_visible : 1;
> > > +  /* Don't reorder to other symbols having this set.  */
> > > +  unsigned no_reorder : 1;
> > 
> > Is it necessary to introduce extra bit for this? It is quite rarely chcecked
> > property, what it buys over lookup_attribute calls everywhere?
> 
> There are quite a few FOR_EACH_FUNCTION/VAR loops that check it now.
> So I thought about m*n cost, m:symbols, n*number of attributes per sym.
> But perhaps that was premature optimization.
> 
> Also one idea was to eventually set it implicitly for the flag,
> this would allow -fno-toplevel-reorder per individual file in LTO
> and also eliminate some special cases. Ok but I suppose this could
> somehow add implicit attributes.

Hmm, that looks like a good argument - adding the attribute to every single
declaration would be wasteful.  Lets go with a flag then.
> 
> > > --- a/gcc/cgraphclones.c
> > > +++ b/gcc/cgraphclones.c
> > > @@ -437,6 +437,7 @@ cgraph_node::create_clone (tree decl, gcov_type 
> > > gcov_count, int freq,
> > >new_node->definition = definition;
> > >new_node->local = local;
> > >new_node->externally_visible = false;
> > > +  new_node->no_reorder = no_reorder;
> > 
> > In kernel case I suppose you don't need to stick no-reorder flag on clones?
> > If we produce static clone, in what case keeping noreorderness help?
> 
> For kernel no_reorder is only ever set on variables (initcalls)
> 
> > This makes no-reorder variables unremovable by unreachable 
> > function/variable removal.
> > This is not documented so in extend.texi and moreover perhaps we do not 
> > want this,
> > as user can use no_reorder && used attribute in that case?
> 
> It was like this before, so if the flag is set implicitely it will be
> convenient to use the same semantics. But I suppose implicit setting
> can also add attribute used (although that may change some warnings)

-fno-toplevel-reorder was done this way to immitate as closely as possible
the non-unit-at-a-time mode so legacy codebases do not break.  I guess
-fno-topelvel-reorder can just imply no_reorder and used attribute.
I still think it would be better tomake no_reorder to do only what name
suggests.
> 
> My tests also relied on it (but with Mike's trick that can be fixed)
> 
> Given all this do you still want the flag to be removed?

No, I guess it can stay.
> 
> > >else
> > >  {
> > >output_asm_statements ();
> > >  
> > >expand_all_functions ();
> > >output_variables ();
> > > +  output_in_order (true);
> > 
> > I would expect output_in_order to come first and perhaps replace 
> > output_asm_statements
> > (so relative order of asm statements and output in order stuff is preserved)
> 
> good point. 
> 
> > >int current_order = -1;
> > > +  int noreorder_pos = 0;
> > >  
> > >FOR_EACH_VARIABLE (vnode)
> > >  gcc_assert (!vnode->aux);
> > 
> > Hmm, why this is not a simple pass over the nodes array that goes first and 
> > inserts all noreorder
> > symbols into the first partition before the actual balancing starts?
> 
> I guess I was more ambitious. interleaving is also better if we start
> setting the flag implicitly, so the partioning with
> -fno-toplevel-reorder would behave like before.

I see, you want to mix toplevel/non-toplevel across partitions.  In that case 
we also
need to disable logic sorting partitions by size if no_reorder BBs exists in 
more than
one partition.

I guess this makes sense, I will look more into your implementation.

Honza
> 
> -andi


Re: [patch i386]: Sibcall tail-call improvement and partial fix PR/60104

2014-09-14 Thread Mike Stump
On May 22, 2014, at 2:01 PM, Kai Tietz  wrote:
> This patch adds a small improvement about sibling tail-calls.

So, I was hoping that you would weigh or fix the damage (PR61387) this does on 
darwin.

Here is a patch that fixes it.

Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 215252)
+++ config/i386/i386.c  (working copy)
@@ -38968,9 +38968,12 @@ x86_output_mi_thunk (FILE *file, tree, H
 {
   if (sibcall_insn_operand (fnaddr, word_mode))
{
- tmp = gen_rtx_CALL (VOIDmode, fnaddr, const0_rtx);
-  tmp = emit_call_insn (tmp);
-  SIBLING_CALL_P (tmp) = 1;
+ fnaddr = XEXP (DECL_RTL (function), 0);
+ tmp = gen_rtx_MEM (QImode, fnaddr);
+ tmp = gen_rtx_CALL (VOIDmode, tmp, const0_rtx);
+ tmp = emit_call_insn (tmp);
+ SIBLING_CALL_P (tmp) = 1;
+ SIBLING_CALL_P (tmp) = 1;
}
   else
emit_jump_insn (gen_indirect_jump (fnaddr));


Ok?

Re: [PATCH] doc/install.texi: add documentation for --disable-libsanitizer

2014-09-14 Thread Gerald Pfeifer
On Wed, 10 Sep 2014, Markus Trippelsdorf wrote:
> 2014-09-10  Markus Trippelsdorf  
> 
>   * doc/install.texi (Options specification): add 
>   --disable-libsanitizer item.

Looks good to me, thanks.

Gerald


Re: [PATCH 1/2] Add an no_reorder attribute for LTO

2014-09-14 Thread Andi Kleen
> Yep, -fno-toplevel-reorder also ldisables some optimizations (as unreachable
> function removal)

Actually it seemed like in my tests it only disables unreachable
variable removal. Might have been wrong though.

> >/* Set when function is visible by other units.  */
> >unsigned externally_visible : 1;
> > +  /* Don't reorder to other symbols having this set.  */
> > +  unsigned no_reorder : 1;
> 
> Is it necessary to introduce extra bit for this? It is quite rarely chcecked
> property, what it buys over lookup_attribute calls everywhere?

There are quite a few FOR_EACH_FUNCTION/VAR loops that check it now.
So I thought about m*n cost, m:symbols, n*number of attributes per sym.
But perhaps that was premature optimization.

Also one idea was to eventually set it implicitly for the flag,
this would allow -fno-toplevel-reorder per individual file in LTO
and also eliminate some special cases. Ok but I suppose this could
somehow add implicit attributes.

> > --- a/gcc/cgraphclones.c
> > +++ b/gcc/cgraphclones.c
> > @@ -437,6 +437,7 @@ cgraph_node::create_clone (tree decl, gcov_type 
> > gcov_count, int freq,
> >new_node->definition = definition;
> >new_node->local = local;
> >new_node->externally_visible = false;
> > +  new_node->no_reorder = no_reorder;
> 
> In kernel case I suppose you don't need to stick no-reorder flag on clones?
> If we produce static clone, in what case keeping noreorderness help?

For kernel no_reorder is only ever set on variables (initcalls)

> This makes no-reorder variables unremovable by unreachable function/variable 
> removal.
> This is not documented so in extend.texi and moreover perhaps we do not want 
> this,
> as user can use no_reorder && used attribute in that case?

It was like this before, so if the flag is set implicitely it will be
convenient to use the same semantics. But I suppose implicit setting
can also add attribute used (although that may change some warnings)

My tests also relied on it (but with Mike's trick that can be fixed)

Given all this do you still want the flag to be removed?

> >else
> >  {
> >output_asm_statements ();
> >  
> >expand_all_functions ();
> >output_variables ();
> > +  output_in_order (true);
> 
> I would expect output_in_order to come first and perhaps replace 
> output_asm_statements
> (so relative order of asm statements and output in order stuff is preserved)

good point. 

> >int current_order = -1;
> > +  int noreorder_pos = 0;
> >  
> >FOR_EACH_VARIABLE (vnode)
> >  gcc_assert (!vnode->aux);
> 
> Hmm, why this is not a simple pass over the nodes array that goes first and 
> inserts all noreorder
> symbols into the first partition before the actual balancing starts?

I guess I was more ambitious. interleaving is also better if we start
setting the flag implicitly, so the partioning with
-fno-toplevel-reorder would behave like before.

-andi


Re: [PATCH 1/2] Add an no_reorder attribute for LTO

2014-09-14 Thread Jan Hubicka
> From: Andi Kleen 
> 
> Some projects need to prevent reordering of specific top level
> declarations with LTO, in particular declarations defining init calls.

Thanks for working on it!
> 
> The only way to do that with LTO was to use -fno-toplevel-reorder,
> which stops reordering for all declarations and makes LTO partitioning
> less efficient.

Yep, -fno-toplevel-reorder also disables some optimizations (as unreachable
function removal)
> 
> This patch adds a new no_reorder attribute that stops reordering only
> for the marked declaration. The program can then only mark e.g. the
> initcalls and leave all the other declarations alone.
> 
> The patch does:
> 
> - Adds the new no_reorder attribute for the C family.
> - Initializes a new no_reorder flag in the symtab_nodes in the
> function visibility flag.
> - Maintains the no_reorder flag when creating new nodes.
> - Changes the partition code to always keep a separate
> sorted queue of ordered nodes and flush them in order with the other
> nodes. This is used by all nodes with -fno-toplevel-reorder,
> and only the marked ones without it.
> Parts of the old -fno-toplevel-reorder code paths are reused.
> - Adds various checks throughout the tree to make no_reorder
> marked functions behave the same as with -fno-toplevel-reorder
> - Changes the LTO streamer to serialize the no_reorder attribute.
> 
> Bootstrapped and tested with LTO + -fno-toplevel-reorder, plain LTO
> and bootstrap w/o LTO on x86_64-linux. Also fixes the reordering in
> the other large project.
> 
> gcc/c-family/:
> 
> 2014-09-14  Andi Kleen  
> 
>   * c-common.c (handle_no_reorder_attribute): New function.
>   (c_common_attribute_table): Add no_reorder attribute.
> 
> gcc/:
> 
> 2014-09-14  Andi Kleen  
> 
>   * cgraph.h (symtab_node): Add no_reorder attribute.
>   * cgraphclones.c (cgraph_node::create_clone): Copy no_reorder.
>   (cgraph_node::create_version_clone): Dito.
>   * trans-mem.c (ipa_tm_create_version_alias): Dito.
>   * cgraphunit.c (varpool_node::finalize_decl): Check no_reorder.
>   (output_in_order): Add no_reorder flag. Only handle no_reorder
>   nodes when set.
>   (symbol_table::compile): Add separate pass for no_reorder nodes.
>   * doc/extend.texi (no_reorder): Document no_reorder attribute.
>   * ipa-visibility.c (function_and_variable_visibility): Set
>   no_reorder flag in symtab_node from declaration.
>   * lto-cgraph.c (lto_output_node): Serialize no_reorder.
>   (lto_output_varpool_node): Dito.
>   (input_overwrite_node): Dito.
>   (input_varpool_node): Dito.
>   * varpool.c (varpool_node::add): Set no_reorder attribute.
>   (symbol_table::remove_unreferenced_decls): Handle no_reorder.
>   (symbol_table::output_variables): Dito.
>   * symtab.c (symtab_node::dump_base): Print no_reorder.
> 
> gcc/lto/:
> 
> 2014-09-13  Andi Kleen  
> 
>   * lto-partition.c (node_cmp): Update comment.
>   (varpool_node_cmp): Use symtab_node for comparison.
>   (add_sorted_nodes): New function.
>   (lto_balanced_map): Change to keep ordered queue
>   of ordered node. Handle no_reorder attribute.
> ---
>  gcc/c-family/c-common.c |  17 
>  gcc/cgraph.h|   2 +
>  gcc/cgraphclones.c  |   2 +
>  gcc/cgraphunit.c|  36 ++--
>  gcc/doc/extend.texi |   9 +++-
>  gcc/ipa-visibility.c|   6 +++
>  gcc/lto-cgraph.c|   4 ++
>  gcc/lto/lto-partition.c | 112 
> ++--
>  gcc/symtab.c|   2 +
>  gcc/trans-mem.c |   1 +
>  gcc/varpool.c   |  21 +++--
>  11 files changed, 153 insertions(+), 59 deletions(-)
> 
> diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
> index 39be956..74bda6b 100644
> --- a/gcc/c-family/c-common.c
> +++ b/gcc/c-family/c-common.c
> @@ -328,6 +328,8 @@ static tree handle_used_attribute (tree *, tree, tree, 
> int, bool *);
>  static tree handle_unused_attribute (tree *, tree, tree, int, bool *);
>  static tree handle_externally_visible_attribute (tree *, tree, tree, int,
>bool *);
> +static tree handle_no_reorder_attribute (tree *, tree, tree, int,
> +  bool *);
>  static tree handle_const_attribute (tree *, tree, tree, int, bool *);
>  static tree handle_transparent_union_attribute (tree *, tree, tree,
>   int, bool *);
> @@ -652,6 +654,8 @@ const struct attribute_spec c_common_attribute_table[] =
> handle_unused_attribute, false },
>{ "externally_visible", 0, 0, true,  false, false,
> handle_externally_visible_attribute, false },
> +  { "no_reorder",  0, 0, true, false, false,
> +  handle_no_reorder_attribute, false },
>/* The same comments as for noreturn attributes apply to const ones.  */

Re: [PATCH v2] Use sscanf instead of atoll in gcov-tool.c

2014-09-14 Thread John David Anglin

On 8-Sep-14, at 5:21 AM, Richard Biener wrote:

On Sun, Sep 7, 2014 at 7:36 PM, John David Anglin > wrote:
The attached patch fixes bootstrap on hpux which doesn't have the  
atoll

function.

Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.

OK for trunk?


"ll" is not portable (it's GNU), I think BSD uses "q" and windows may
use sth else.  I think the code shouldn't use 'long long' but int64_t
and the appropriate SCNd64 macros for the sscanf format specifier.


Attached is an updated version using the SCNd64 macro.  It works fine
on hpux.  The PRI/SCN macrocs are available back to at least hpux10.20.

The other alternative is to use the atoll implementation in read-rtl.c.

Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.

OK for trunk?

Dave
--
John David Anglin   dave.ang...@bell.net


2014-09-14  John David Anglin  

PR gcov-profile/61790
* gcov-tool.c (do_rewrite): Change normalize_val to int64_t.  Use
sscanf instead of atoll.

Index: gcov-tool.c
===
--- gcov-tool.c (revision 215242)
+++ gcov-tool.c (working copy)
@@ -288,7 +288,7 @@
   int opt;
   int ret;
   const char *output_dir = 0;
-  long long normalize_val = 0;
+  int64_t normalize_val = 0;
   float scale = 0.0;
   int numerator = 1;
   int denominator = 1;
@@ -308,7 +308,7 @@
   break;
 case 'n':
   if (!do_scaling)
-normalize_val = atoll (optarg);
+sscanf (optarg, "%" SCNd64, &normalize_val);
   else
 fnotice (stderr, "scaling cannot co-exist with normalization,"
 " skipping\n");


Re: [C++14 PATCH] Minor cleanup, don't run tests for which compilation is enough.

2014-09-14 Thread Ville Voutilainen
On 14 September 2014 21:36, Paolo Carlini  wrote:
> Hi,
>
> On 09/14/2014 07:44 PM, Ville Voutilainen wrote:
>>
>> Tested on Linux-x64.
>
> Thanks. In such cases you can as well remove the main: then is also
> immediately obvious the the testcase is a dg-do compile.


Sure, but sometimes I use such test snippets as starting points for something
more elaborate that gets actually run, it saves time having a main already there
even if the test itself doesn't use it. ;)


Re: [PATCH 2/2] Add test cases for noreorder

2014-09-14 Thread Mike Stump
On Sep 14, 2014, at 10:51 AM, Andi Kleen  wrote:
> From: Andi Kleen 
> 
> Add some simple test cases for noreorder behaving like
> -fno-toplevel-reorder and -fno-toplevel-reorder still working.
> Unfortunately there's no easy way to check for output order in DG,
> so we just check for existence.

I thought some of these would span lines…. foo.*bar  could check foo on a line 
before bar?

/* { dg-final { scan-assembler "section.*foo" } } */

int foo (int a)
{
  static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
  void *p = &&l1 + ar[a];
  goto *p;
  l1:
return 1;
  l2:
return 2;
}

Yup, works just fine.  Some might say it isn’t a feature, but we have no plans 
to fix it.

Re: [C++14 PATCH] Minor cleanup, don't run tests for which compilation is enough.

2014-09-14 Thread Paolo Carlini

Hi,

On 09/14/2014 07:44 PM, Ville Voutilainen wrote:

Tested on Linux-x64.
Thanks. In such cases you can as well remove the main: then is also 
immediately obvious the the testcase is a dg-do compile.


Paolo.


[PATCH 2/2] Add test cases for noreorder

2014-09-14 Thread Andi Kleen
From: Andi Kleen 

Add some simple test cases for noreorder behaving like
-fno-toplevel-reorder and -fno-toplevel-reorder still working.
Unfortunately there's no easy way to check for output order in DG,
so we just check for existence.

gcc/testsuite/:

2014-09-14  Andi Kleen  

* gcc.dg/noreorder.c: New test.
* gcc.dg/noreorder2.c: New test.
* gcc.dg/noreorder3.c: New test.
---
 gcc/testsuite/gcc.dg/noreorder.c  | 24 
 gcc/testsuite/gcc.dg/noreorder2.c | 11 +++
 gcc/testsuite/gcc.dg/noreorder3.c | 10 ++
 3 files changed, 45 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/noreorder.c
 create mode 100644 gcc/testsuite/gcc.dg/noreorder2.c
 create mode 100644 gcc/testsuite/gcc.dg/noreorder3.c

diff --git a/gcc/testsuite/gcc.dg/noreorder.c b/gcc/testsuite/gcc.dg/noreorder.c
new file mode 100644
index 000..1559465
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noreorder.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern void f2(int);
+
+__attribute__((no_reorder, noinline)) static int foobar(void)
+{
+   f2(1);
+}
+
+static int barbar(void)
+{
+   f2(2);
+}
+
+int bozo(void)
+{
+   f2(3);
+   foobar();
+}
+
+/* { dg-final { scan-assembler "foobar" } } */
+/* { dg-final { scan-assembler "bozo" } } */
+/* { dg-final { scan-assembler-not "barbar" } } */
diff --git a/gcc/testsuite/gcc.dg/noreorder2.c 
b/gcc/testsuite/gcc.dg/noreorder2.c
new file mode 100644
index 000..558361b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noreorder2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-toplevel-reorder" } */
+
+__attribute__((no_reorder)) int foobar;
+
+static int barbar;
+int bozo;
+
+/* { dg-final { scan-assembler "foobar" } } */
+/* { dg-final { scan-assembler "bozo" } } */
+/* { dg-final { scan-assembler "barbar" } } */
diff --git a/gcc/testsuite/gcc.dg/noreorder3.c 
b/gcc/testsuite/gcc.dg/noreorder3.c
new file mode 100644
index 000..a0b637f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noreorder3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+__attribute__((no_reorder)) int foobar;
+static int barbar;
+int bozo;
+
+/* { dg-final { scan-assembler "foobar" } } */
+/* { dg-final { scan-assembler "bozo" } } */
+/* { dg-final { scan-assembler-not "barbar" } } */
-- 
2.1.0



[PATCH 1/2] Add an no_reorder attribute for LTO

2014-09-14 Thread Andi Kleen
From: Andi Kleen 

Some projects need to prevent reordering of specific top level
declarations with LTO, in particular declarations defining init calls.

The only way to do that with LTO was to use -fno-toplevel-reorder,
which stops reordering for all declarations and makes LTO partitioning
less efficient.

This patch adds a new no_reorder attribute that stops reordering only
for the marked declaration. The program can then only mark e.g. the
initcalls and leave all the other declarations alone.

The patch does:

- Adds the new no_reorder attribute for the C family.
- Initializes a new no_reorder flag in the symtab_nodes in the
function visibility flag.
- Maintains the no_reorder flag when creating new nodes.
- Changes the partition code to always keep a separate
sorted queue of ordered nodes and flush them in order with the other
nodes. This is used by all nodes with -fno-toplevel-reorder,
and only the marked ones without it.
Parts of the old -fno-toplevel-reorder code paths are reused.
- Adds various checks throughout the tree to make no_reorder
marked functions behave the same as with -fno-toplevel-reorder
- Changes the LTO streamer to serialize the no_reorder attribute.

Bootstrapped and tested with LTO + -fno-toplevel-reorder, plain LTO
and bootstrap w/o LTO on x86_64-linux. Also fixes the reordering in
the other large project.

gcc/c-family/:

2014-09-14  Andi Kleen  

* c-common.c (handle_no_reorder_attribute): New function.
(c_common_attribute_table): Add no_reorder attribute.

gcc/:

2014-09-14  Andi Kleen  

* cgraph.h (symtab_node): Add no_reorder attribute.
* cgraphclones.c (cgraph_node::create_clone): Copy no_reorder.
(cgraph_node::create_version_clone): Dito.
* trans-mem.c (ipa_tm_create_version_alias): Dito.
* cgraphunit.c (varpool_node::finalize_decl): Check no_reorder.
(output_in_order): Add no_reorder flag. Only handle no_reorder
nodes when set.
(symbol_table::compile): Add separate pass for no_reorder nodes.
* doc/extend.texi (no_reorder): Document no_reorder attribute.
* ipa-visibility.c (function_and_variable_visibility): Set
no_reorder flag in symtab_node from declaration.
* lto-cgraph.c (lto_output_node): Serialize no_reorder.
(lto_output_varpool_node): Dito.
(input_overwrite_node): Dito.
(input_varpool_node): Dito.
* varpool.c (varpool_node::add): Set no_reorder attribute.
(symbol_table::remove_unreferenced_decls): Handle no_reorder.
(symbol_table::output_variables): Dito.
* symtab.c (symtab_node::dump_base): Print no_reorder.

gcc/lto/:

2014-09-13  Andi Kleen  

* lto-partition.c (node_cmp): Update comment.
(varpool_node_cmp): Use symtab_node for comparison.
(add_sorted_nodes): New function.
(lto_balanced_map): Change to keep ordered queue
of ordered node. Handle no_reorder attribute.
---
 gcc/c-family/c-common.c |  17 
 gcc/cgraph.h|   2 +
 gcc/cgraphclones.c  |   2 +
 gcc/cgraphunit.c|  36 ++--
 gcc/doc/extend.texi |   9 +++-
 gcc/ipa-visibility.c|   6 +++
 gcc/lto-cgraph.c|   4 ++
 gcc/lto/lto-partition.c | 112 ++--
 gcc/symtab.c|   2 +
 gcc/trans-mem.c |   1 +
 gcc/varpool.c   |  21 +++--
 11 files changed, 153 insertions(+), 59 deletions(-)

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 39be956..74bda6b 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -328,6 +328,8 @@ static tree handle_used_attribute (tree *, tree, tree, int, 
bool *);
 static tree handle_unused_attribute (tree *, tree, tree, int, bool *);
 static tree handle_externally_visible_attribute (tree *, tree, tree, int,
 bool *);
+static tree handle_no_reorder_attribute (tree *, tree, tree, int,
+bool *);
 static tree handle_const_attribute (tree *, tree, tree, int, bool *);
 static tree handle_transparent_union_attribute (tree *, tree, tree,
int, bool *);
@@ -652,6 +654,8 @@ const struct attribute_spec c_common_attribute_table[] =
  handle_unused_attribute, false },
   { "externally_visible", 0, 0, true,  false, false,
  handle_externally_visible_attribute, false },
+  { "no_reorder",0, 0, true, false, false,
+  handle_no_reorder_attribute, false },
   /* The same comments as for noreturn attributes apply to const ones.  */
   { "const",  0, 0, true,  false, false,
  handle_const_attribute, false },
@@ -6953,6 +6957,19 @@ handle_externally_visible_attribute (tree *pnode, tree 
name,
   return NULL_TREE;
 }
 
+/* Handle the "no_reorder" attribute. Argu

[C++14 PATCH] Minor cleanup, don't run tests for which compilation is enough.

2014-09-14 Thread Ville Voutilainen
Tested on Linux-x64.

/testsuite
2014-09-14  Ville Voutilainen  

Minor cleanup, don't run tests for which compilation is enough.
* g++.dg/g++.dg/cpp1y/var-templ1.C: Change return to
static_assert, compile instead of running.
* g++.dg/g++.dg/cpp1y/var-templ3.C: Likewise.
* g++.dg/g++.dg/cpp1y/var-templ4.C: Likewise.
* g++.dg/g++.dg/cpp1y/var-templ5.C: Likewise.
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ1.C 
b/gcc/testsuite/g++.dg/cpp1y/var-templ1.C
index 856198a..89b3c8f 100644
--- a/gcc/testsuite/g++.dg/cpp1y/var-templ1.C
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ1.C
@@ -1,4 +1,4 @@
-// { dg-do run { target c++14 } }
+// { dg-do compile { target c++14 } }
 
 template
   struct S1
@@ -12,10 +12,7 @@ template
 
 int main ()
 {
-  int v = var>/2;
-  return !(
-   var> == v
-&& var> == var>>>
-&& var> != 222
-  );
+  static_assert(var> == var>/2
+   && var> == var>>>
+   && var> != 222, "");
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ3.C 
b/gcc/testsuite/g++.dg/cpp1y/var-templ3.C
index 52ef668..254f388 100644
--- a/gcc/testsuite/g++.dg/cpp1y/var-templ3.C
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ3.C
@@ -1,4 +1,4 @@
-// { dg-do run { target c++14 } }
+// { dg-do compile { target c++14 } }
 
 template
  constexpr int var = sizeof (T);
@@ -12,7 +12,5 @@ template
 
 int main ()
 {
-  return !(
-var + var == S1::a
-  );
+  static_assert(var + var == S1::a, "");
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ4.C 
b/gcc/testsuite/g++.dg/cpp1y/var-templ4.C
index 4ad7be6..3cd84a8 100644
--- a/gcc/testsuite/g++.dg/cpp1y/var-templ4.C
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ4.C
@@ -1,4 +1,4 @@
-// { dg-do run { target c++14 } }
+// { dg-do compile { target c++14 } }
 
 template
   constexpr int var = sizeof (T);
@@ -8,8 +8,5 @@ template<>
 
 int main ()
 {
-  return !(
-   var == 10
-&& var == sizeof(char)
-  );
+  static_assert(var == 10 && var == sizeof(char), "");
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ5.C 
b/gcc/testsuite/g++.dg/cpp1y/var-templ5.C
index a10f388..a8bc7f6 100644
--- a/gcc/testsuite/g++.dg/cpp1y/var-templ5.C
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ5.C
@@ -1,4 +1,4 @@
-// { dg-do run { target c++14 } }
+// { dg-do compile { target c++14 } }
 
 template
   struct S1
@@ -15,7 +15,5 @@ template class T, int A>
 
 int main ()
 {
-  return !(
-var2 == 120
-  );
+  static_assert(var2 == 120, "");
 }


var-templ-test-cleanup.changelog
Description: Binary data


[PATCH C++, PING] - SD-6 Implementation Part N/4.

2014-09-14 Thread Ed Smith-Rowland

I would like review of my SD-6 implementation.

Part 1 - __has_include__ built-in in libcpp.
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00083.html

Part 2 - __has_include macro and C++ language feature macros.
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00084.html

Part 3 - libstdc++ library macros was already approved by Jonathan. 
Thank you.

https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00085.html
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00110.html

Part 4 - C++ front end tests.
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00553.html

These build and test cleanly on x86_64-linux.

Part 5 - __has_cpp_attribute and supporting machinery is proving more 
interesting than I thought.

But the rest should be put in.

Thank you,
Ed Smith-Rowland



Re: [PATCH 5/5] add libcc1 [gcc-5/changes.html]

2014-09-14 Thread Manuel López-Ibáñez
What happened with this? I don't see any libcc1 in the gcc repository
and this patch was never committed.

Cheers,

Manuel.


On 31 August 2014 17:12, Gerald Pfeifer  wrote:
> Hi Jan,
>
> On Fri, 8 Aug 2014, Jan Kratochvil wrote:
 "Jeff" == Jeff Law  writes:
 Does this deserve a mention in the news file?
>> Attached (based on Tom's PATCH 0/5 mail).
>
> Index: htdocs/gcc-5/changes.html
> ===
> +C
> +  
> +GDB evaluation of a block of source code is now provided by new GCC
> +plugin.
>
> How does one obtain/install/trigger this plugin?  Where are more details
> documented?  This is information I'd add here.
>
> +A user can compile a code snippet and it will be inserted into the 
> inferior
> +and evaluated.  Declarations needed by the snippet are supplied by GDB, 
> and
> +there is a GDB--GCC interface so that the snippets can refer to local
> +variables in the current inferior frame.
>
> The validator probably is going to complain that this needs to be within
> ... markers.
>
> In HTML, I'd just say GDB-GCC (one dash).
>
> I'm good with this patch modulo these suggestion, but perhaps Jeff or
> Tom have some further input?
>
> Gerald


[C++14 PATCH] Do not diagnose lambda default arguments in c++14 modes.

2014-09-14 Thread Ville Voutilainen
Tested on Linux-x64.

/cp
2014-09-14  Ville Voutilainen  

Do not diagnose lambda default arguments in c++14 modes.
* parser.c (cp_parser_lambda_declarator_opt): Make the pedwarn conditional.

/testsuite
2014-09-14  Ville Voutilainen  

Do not diagnose lambda default arguments in c++14 modes.
* g++.dg/cpp0x/lambda/lambda-defarg.C: Enable in c++11_only.
* g++.dg/cpp1y/lambda-defarg.C: New.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c696fd2..de61eb9 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -9220,7 +9220,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
   /* Default arguments shall not be specified in the
 	 parameter-declaration-clause of a lambda-declarator.  */
   for (tree t = param_list; t; t = TREE_CHAIN (t))
-	if (TREE_PURPOSE (t))
+	if (TREE_PURPOSE (t) && cxx_dialect < cxx14)
 	  pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic,
 		   "default argument specified for lambda parameter");
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C
index cefa24d..11d8170 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C
@@ -1,6 +1,6 @@
-// { dg-do compile { target c++11 } }
+// { dg-do compile { target c++11_only } }
 
 int main()
 {
-  [](int a = 1) { return a; }(); // { dg-error "" }
+  [](int a = 1) { return a; }(); // { dg-error "default argument" }
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-defarg.C b/gcc/testsuite/g++.dg/cpp1y/lambda-defarg.C
new file mode 100644
index 000..eafbe18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-defarg.C
@@ -0,0 +1,6 @@
+// { dg-do compile { target c++14 } }
+
+int main()
+{
+  [](int a = 1) { return a; }(); 
+}


lambda-defarg-cxx14.changelog
Description: Binary data


[PATCH] libatomic: Acquire locks in increasing order to avoid deadlocks

2014-09-14 Thread Daniel Cederman
libat_lock_n acquires a set of locks from an array of locks. As done now,
locks might be acquired first from the end of the array and then from the
start of the array. Consider the scenario of two threads each trying to
acquire all locks. Thread 1 starts by taking lock 1 and thread 2 starts by
taking lock 0. Since both threads need a lock taken by the other we have
a deadlock. This patch changes the order in which locks are taken so that
it is always increasing. This way at least one thread will always make
progress.

As the cache line size is normally a power of two the div and mod operation
will be compiled to bit operations.

2014-09-14  Daniel Cederman  

* libatomic/config/posix/lock.c (libat_lock_n): Acquire
locks in increasing order to avoid deadlocks
---
 libatomic/config/posix/lock.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/libatomic/config/posix/lock.c b/libatomic/config/posix/lock.c
index a214c45..a13830f 100644
--- a/libatomic/config/posix/lock.c
+++ b/libatomic/config/posix/lock.c
@@ -81,19 +81,26 @@ libat_lock_n (void *ptr, size_t n)
 {
   uintptr_t h = addr_hash (ptr);
   size_t i = 0;
+  size_t l;
 
   /* Don't lock more than all the locks we have.  */
   if (n > PAGE_SIZE)
 n = PAGE_SIZE;
 
-  do
+  l = n / CACHLINE_SIZE + h;
+
+  if (n % CACHLINE_SIZE)
+l++;
+
+  if (l >= NLOCKS)
 {
-  pthread_mutex_lock (&locks[h].mutex);
-  if (++h == NLOCKS)
-   h = 0;
-  i += WATCH_SIZE;
+  for (i=0; i < l - NLOCKS; i++)
+pthread_mutex_lock (&locks[i].mutex);
+  l = NLOCKS;
 }
-  while (i < n);
+
+  for (i=h; i < l; i++)
+pthread_mutex_lock (&locks[i].mutex);
 }
 
 void
-- 
2.1.0



Re: [PATCHv2] Vimrc config with GNU formatting

2014-09-14 Thread Alexander Monakov
On Thu, 11 Sep 2014, Yury Gribov wrote:
> Ok, it tooks some time. Basically we want brace symbol to behave differently
> in two contexts:
> 
> 1) not add any additional offset when not following control flow operator:
> void
> f ()
> {
>   int x;
>   {
>   }
> }

Note that GCC commonly uses custom iteration macros, e.g.:

  FOR_EACH_BB_FN(bb, fn)
{
  do_stuff;
}

and cinoptions that get the braces-in-switch case wrong should get constructs
like the above right.

(to get gnu-style autoindent in Vim, I've been using
http://www.vim.org/scripts/script.php?script_id=575 and would adjust braces in
switch by hand if need arose; the script is probably very close to one of
approaches posted in this thread, but I haven't checked)

Alexander


Re: [C++14] Add is_final type trait.

2014-09-14 Thread Jonathan Wakely

On 13/09/14 21:58 -0400, Ed Smith-Rowland wrote:

We've had __has_final built-in for a good while.
the std library component is_final was added to C++14 - which is now good.
I noticed while looking at the latest SD-6 draft.

So here is a simple patch that builds and passes clean on x86_64-linux.

OK?


Yes, OK for trunk. Thanks, Ed.

I'd be willing to approve a backport to 4.9 as well (changing the test
from >= 201402L to > 201103L) if you wanted to prepare that patch :-)


Re: [Patch] PR 61692 - Fix for inline asm ICE

2014-09-14 Thread David Wohlferd
I sent you the file you requested (off list), but never heard back from 
you about the valgrind results.


In an effort to move this along, I installed ubuntu under virtualbox and 
did a build of gcc.  When running the output of this build with 
valgrind, I saw a number of memory *leaks* reported, but no overruns, 
despite having maxed out the operands + clobbers in a variety of ways.


I have only tested this on x86, and only with inline asm, but I have had 
no luck (using code inspection, sprinkling printfs, and now valgrind) 
locating the error you are expecting to see.  Without knowing what is 
making you "quite confident" there is a problem, I don't know what else 
to try.  Suggestions?


Theoretically I could add the nclobbers in "just in case." But unlike 
adding nlabels, adding nclobbers here will almost certainly break 
someone's code.  I'm not prepared to do that unless there is a clear 
problem to be fixed, and I'm just not seeing it.


If you are also out of ideas, I can re-send the patch for the original 
ninputs + noutputs + nlabels problem (along with the testcase you 
requested), and we can at least fix the known ICE.


dw

On 8/1/2014 11:29 AM, Jeff Law wrote:

On 08/01/14 02:07, David Wohlferd wrote:


I'd love to.  Unfortunately, my platform doesn't support valgrind.

Ah.




Also, please include the testcase you had nlabels part.


I have created the testcase for the 31 labels problem.  However, not so
much for the nclobbers part.  And if I'm going to patch both, I should
have testcases for both.
Tell you what, pass along what you've got and I'll run it under 
valgrind here.  I'm quite confident both need to be changed -- though 
it is possible nothing will trigger with the nclobbers stuff if it is 
indeed handled separately throughout the guts of GCC.



Jeff





Re: [PATCH v4 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__

2014-09-14 Thread FX
Committed as rev. 215251
Thanks for the review.

FX


Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-09-14 Thread Chen Gang
Hello maintainers:

I also find some warnings during compiling microblaze, I also shall try
to fix them, but excuse me, I am not quite familiar the testsuite for
microblaze, could you provide any related information for it?

Thanks.

On 09/08/2014 11:28 PM, Chen Gang wrote:
> On 09/08/2014 10:24 AM, Chen Gang wrote:
>> On 09/07/2014 11:17 PM, Chen Gang wrote:
 On 8/13/14 23:10, Michael Eager wrote:
> On 07/06/14 03:26, Chen Gang wrote:
>>
>>* microblaze/mocroblaze.md (call_value_intern): Use 'SI' instead of
>>'VOID' for operand 1, just like 'call_internal1' has done.
>>
>> The related warning:
>>
>>../../gcc/gcc/config/microblaze/microblaze.md:2172: warning: operand 
>> 1 missing mode?
>>
>>
>> Signed-off-by: Chen Gang 
>> ---
>>   gcc/config/microblaze/microblaze.md | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gcc/config/microblaze/microblaze.md 
>> b/gcc/config/microblaze/microblaze.md
>> index 2bd5d72..9580221 100644
>> --- a/gcc/config/microblaze/microblaze.md
>> +++ b/gcc/config/microblaze/microblaze.md
>> @@ -2171,7 +2171,7 @@
>>
>>   (define_insn "call_value_intern"
>> [(set (match_operand:VOID 0 "register_operand" "=d")
>> -(call (mem (match_operand:VOID 1 "call_insn_operand" "ri"))
>> +(call (mem (match_operand:SI 1 "call_insn_operand" "ri"))
>> (match_operand:SI 2 "" "i")))
>>  (clobber (match_operand:SI 3 "register_operand" "=d"))]
>> ""
>
> This patch causes a test suite regression:
>
> Executing on host: mb-gcc  -fno-diagnostics-show-caret 
> -fdiagnostics-color=never-O0  -w -c -mno-xl-soft-mul 
> -mxl-barrel-shift -mcpu=v6.00.a   -o calls.o 
> testsuite/gcc.c-torture/compile/calls.c(timeout = 60)
> pid is 24832 -24832
> testsuite/gcc.c-torture/compile/calls.c: In function 'f1':
> testsuite/gcc.c-torture/compile/calls.c:6:1: error: unrecognizable insn:
> (call_insn 5 2 8 2 (parallel [
> (set (reg:SI 3 r3)
> (call (mem:SI (const_int 0 [0]) [0 MEM[(void * (*) 
> (void))0B] S4 A32])
> (const_int 24 [0x18])))
> (clobber (reg:SI 15 r15))
> ]) testsuite/gcc.c-torture/compile/calls.c:5 -1
>  (nil)
> (nil))
> testsuite/gcc.c-torture/compile/calls.c:6:1: internal compiler error: in 
> extract_insn, at recog.c:2204
> 0x983018 _fatal_insn(char const*, rtx_def const*, char const*, int, char 
> const*)
> /store/Xilinx/repo/fsf/gcc/gcc/rtl-error.c:109
> 0x983041 _fatal_insn_not_found(rtx_def const*, char const*, int, char 
> const*)
> /store/Xilinx/repo/fsf/gcc/gcc/rtl-error.c:117
> 0x9539cd extract_insn(rtx_def*)
> /store/Xilinx/repo/fsf/gcc/gcc/recog.c:2204
> 0x7a5b59 instantiate_virtual_regs_in_insn
> /store/Xilinx/repo/fsf/gcc/gcc/function.c:1561
> 0x7aaa78 instantiate_virtual_regs
> /store/Xilinx/repo/fsf/gcc/gcc/function.c:1932
>
>>>
> 
> At present, I guess the original code is correct, need not additional
> fix: "When call call_insn_operand() in gencog(), related 'rtx' mode is
> VOIDmode (which need VOID, not SI)".
> 
> For the compiler's warning: "operand 1 is VOIDmode", after give some
> related test, "operand 1 is VOIDmode" is all OK, the related tests are
> below:
> 
>  - For almost same definitions, they are OK:
> 
>- int *(*T)(void);
> 
>- char *(*T)(int);
> 
>...
> 
>  - For incorrect assignments, report related correct warning/error:
> 
>- char a = ((long long *(*)(short)) 0) (1);
> 
>- ((long long *(*)(short)) 0) ();
> 
>...
> 
> If what I guess is correct, the below issue can be fixed in the same
> way, please help check.
> 
>>>   typedef void  (*T)(void);
>>>   f1 ()
>>>   {
>>> ((T) 0)();
>>>   }
>>>
>>
>> Oh, sorry, neither original nor the new one (with this patch) can
>> recognize the code above.
>>
> 
> Need use VOID instead of SI, or when real VOIDmode comes, it does not
> match SImode, so cause issue.
> 
> The related test code ('void' will cause CALL instead of SET):
> 
>   typedef void (*T)(void);
>   f1 ()
>   {
> ((T) 0)();
>   }
> 
> The related error:
> 
>   [root@localhost gcc]# ./cc1 /tmp/calls.c -o /tmp/1.s
>f1
>   Analyzing compilation unit
>   Performing interprocedural optimizations
><*free_lang_data>   
>   Assembling functions:
>f1
>   /tmp/calls.c: In function 'f1':
>   /tmp/calls.c:5:1: error: unrecognizable insn:
>}
>^
>   (call_insn 5 2 8 2 (parallel [
>   (call (mem:SI (const_int 0 [0]) [0 MEM[(void (*) 
> (void))0B] S4 A32])
>   (const_int 24 [0x18]))
>   (clobber (reg:SI 15 r15))
>   ]) /tmp/calls.c:4 -1
>(nil)
>   (nil))
>   /tmp/calls.c:5:1: internal compiler error: in extract_insn, at recog.c:2204
>   0xb

Re: [PATCH v4 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__

2014-09-14 Thread Mike Stump
On Sep 13, 2014, at 5:48 AM, FX  wrote:
> Updated version, bootstraps and regtests.
> OK to commit?

Ok.