gcc-5-20141102 is now available

2014-11-02 Thread gccadmin
Snapshot gcc-5-20141102 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/5-20141102/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 5 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/trunk revision 217020

You'll find:

 gcc-5-20141102.tar.bz2   Complete GCC

  MD5=f4351323ae114c061f2529503f9a8ecc
  SHA1=6871bda34212595d0803823d1905b78d0b20cae7

Diffs from 5-20141026 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-5
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


Comparing tree types

2014-11-02 Thread Vini Kanvar
I am trying to compare the tree declarations of the lhs and the rhs of
the assignment statement in the following program.

struct node {
struct node * next;
};
struct node ** obj1, obj2;
obj1 = &obj2.next;  // lhs is obj1, rhs is obj2.next

---
Let us call the following tree declaration of the lhs as "obj1_tree".
-
 
unsigned SI
size 
unit size 
align 32 symtab 0 alias set -1 canonical type 0x405cc000
pointer_to_this >
unsigned SI
size 
unit size 
align 32 symtab 0 alias set -1 canonical type 0x405c5ea0>
used unsigned SI file structstruct2.c line 8 col 17
size  constant 32>
unit size  constant 4>
align 32 context  chain >

-
Let us call the following tree declaration of the rhs as
"obj2.next_tree"
-
 
unit size 
align 32 symtab 0 alias set -1 canonical type 0x405c5f60
fields  context 
pointer_to_this  chain >
unsigned SI
size 
unit size 
align 32 symtab 0 alias set -1 canonical type 0x405cc000
pointer_to_this >
used unsigned nonlocal SI file structstruct2.c line 3 col 16
size  constant 32>
unit size  constant 4>
align 32 offset_align 128
offset  constant 0>
bit offset  constant 0> context  chain
>
-

Please note from the above tree declarations that 
Type1 = TREE_TYPE (TREE_TYPE (obj1_tree)) = 0x405c5f00
Type2 = TREE_TYPE (obj2.next_tree) = 0x405cc000
Type3 = TYPE_POINTER_TO (TREE_TYPE (TREE_TYPE (obj2.next_tree))) =
0x405c5f00

I was expecting Type1 and Type2 to be equal because obj1=&obj2.next.
However, in this case, we see that Type1 and Type3 are equal. Please
explain this.

Also, what is the meaning of "pointer_to_this" in the tree declarations?

Thanks and regards,
Vini Kanvar.




Re: selective linking of floating point support for *printf / *scanf

2014-11-02 Thread Joern Rennecke
On 24 October 2014 09:06, Thomas Preud'homme  wrote:
>> From: gcc-ow...@gcc.gnu.org [mailto:gcc-ow...@gcc.gnu.org] On
>> Behalf Of Joseph S. Myers
>>
>> I'm not clear if you're proposing such a patch for review, but note:
>
> Yep but not yet for inclusion as I'm waiting to see if this would suit the 
> use case of avr people.

Sorry for the late reply, I was on vacation, and then I meant to flesh
out a suitable
solution for the macro/hook problem to test it, but the more I think
about it, the more
questions arise how this is best structured...

First, the interface of your hook: you say it returns a bool, but that
bool is not used.
You leave the case to fall through to the default case, thus emitting
the expression unchanged.
For my purposes, I have to change the expression.
Note how my original patch had:

+ exp = copy_node (exp);
+ CALL_EXPR_FN (exp) = build_addr (decl, current_function_decl);

I don't think changing the existing expression
destructively is safe, so the return value should be the - possibly
changed - expression.
You can just explain in the hook description that this return value
may be changed and/or
additional target-specific output may be emitted.

The auto-float-io option description dos not match what I intended the
hook to do on the
avr.  The idea was to have standard behaviour as default, i.e. printf
knows about float, and
have the hook change the function name to the integer-specific
function if the arguments
don't mention float and the function is not a v* function.
So, if we want to have a versatile hook and describe the option
specifically, it should be
a target option.  OTOH, that complicate the implementation of a
generic hook even more...


>
>>
>> (a) you mean DEF_EXT_LIB_BUILTIN (since asprintf and vasprintf aren't in
>> ISO C);
>
> Ok.
>
>>
>> (b) please don't add new target macros such as
>> CUSTOM_STDI_WEAK_SYM_PATTERN and
>> CUSTOM_STDO_WEAK_SYM_PATTERN (if
>> something is defined in tm_defines and used in architecture-
>> independent
>> code, it's effectively a target macro), find a way to implement these as
>> hooks instead.

targhooks.c is not entirely target-independent code, so on one level
we could say it's
OK to customize it with macros, and we don't want to stuff the target
vector with a gazillion
settings that only very few targets use, but OTOH, if one target has
multiple libraries,
it might want multile variants of this hook.  In fact, having
sub-hooks for that hook wouldn't
work if they were POD-kind hooks, and way overcomplicate the target if
they weren't...

Considering we mean to move to C++, making the hook a template seems the proper
thing to do.  Prima facie I would say it should be templated on the
two strings that you
want to use.  However, C++ won't allow to use string literals as
template parameters.
So you need to stuff the strings as return values into class member functions.
Which means that there has to be a class definition somewhere in tm.h
... which, unfortunately,
we can't expand in the same macro that is used to assigning the
function instantiation to the
target vector element initializer, because you can't have a class
definition in a template
argument, nor can you have a statement expression outside of functions.
So we need two macros, one to define the class, one to provide the
function pointer for
the target vector element.

To illustrate, here are a few snippets of code that do TemPlated Printing
of input/output string, in parts meant model code for hook(?) include file,
builtins.c:expand_builtin code, and target vector (hook) setting:

==> tpp.h <==
extern "C" void printf (const char *fmt, ...);

template
void print_str (void)
{
  t dummy;
  printf ("%s\n", dummy.in());
  printf ("%s\n", dummy.out());
}

#define PRINT_STR_DEF(S1,S2) \
  class __FILE__##inout##S1##S2\
  { \
public: \
const char *in (void) { return #S1; } \
const char *out (void) { return #S2; } \
  };

#define PRINT_STR(S1,S2) print_str<__FILE__##inout##S1##S2>

extern void (*fp) (void);

==> tpp-exp.cc <==
#include "tpp.h"

int main (void)
{
  (*fp)();
  return 0;
}

==> tpp-tv.cc <==
#include "tpp.h"

PRINT_STR_DEF(scanf,printf)
void (*fp) (void) = PRINT_STR(scanf,printf);

Now, are we actually OK with having a template in an include file?  I
think C++11 has extern templates, but then, that's probably too new
for our purposes.
Would we want to use an existing include file, or a new special-purpose one?

Also, that '__FILE__' is not actually expanded - I think we have to
hand to through some more macro invocations to expand it.
And then the expansion will cause trouble with quotes and the dot from
the filename...
But how should clashes between multiple such classes be avoided?  That
would happen if your hook is actually a wrapper to use
different template instantiations of the generic templated hook
depending on the subtarget - should the port writer use namespaces
there?