Re: Auto-generated .rodata contents and __attribute__((section))

2018-05-18 Thread Richard Biener
On Thu, May 17, 2018 at 11:10 PM Segher Boessenkool <
seg...@kernel.crashing.org> wrote:

> On Thu, May 17, 2018 at 06:10:13PM +0200, Michael Matz wrote:
> > On Wed, 16 May 2018, Richard Biener wrote:
> > > > Are constant pool entries merged at compile time or at link time? I
> > > > would presume it should be done at link time because otherwise
you're
> > > > only merging entries within a single compilation unit (which doesn't
> > > > sound that useful in a big project with hundreds of source files),
> > > > right?
> > >
> > > constant pool entries are merged at compile time.  There's no such
thing
> > > as mergeable constant pool sections
> >
> > Actually there is in ELF.  Mergable sections can not only hold strings,
> > but also fixed-size entities (e.g. 4 or 8 byte constants).  Those are
> > merged content-wise at link time and references properly rewritten.  Of
> > course, those still aren't per-function.

Interesting.  Do they allow merging across such sections?  Consider
a 8 byte entity 0x12345678 and 4 byte entities 0x1234 0x5678,
will the 4 byte entities share the rodata with the 8 byte one?  I believe
GCC pulls off such tricks in its internal constant pool merging code.

It might be worth gathering statistics on the size of constant pool
entries for this.

Now the question is of course if BFD contains support for optimizing
those sections.

> It also works correctly in combination with -ffunction-sections,
> -fdata-sections, -Wl,--gc-sections.  And not with per-function constant
> pools like on arm-linux; I'm not sure how that could ever work.


> Segher


Your newsletter subscription

2018-05-18 Thread José Carmo
Hello bit.ly/bonuseml 500$ Ваш приз,

You want to add the email address gcc@gcc.gnu.org to the following newsletters:

Newsletter 

Newsletter de Setembro 


Click here to confirm your newsletter subscriptions: Confirmation 

 

If you do not click this link, the e-mail address you provided will not be 
included in the e-mail subscriber list. 

If you have not subscribed to this newsletter, ignore this e-mail. We will not 
send you any further e-mails. 

You can unsubscribe from our newsletter at any time by clicking the unsubscribe 
link contained in every newsletter. 

Best regards, 
Your Shop Team 

--
Espingardaria " Loja de Armas "  ( Gunsmith ) 
José  Carmo   
Rua Rodrigues Lapa, 3A =  Cruz de Pau 
2845-132   Amora 
ven...@lojadearmas.pt 

How do I stop gcc from loading data into registers when that's not needed?

2018-05-18 Thread Paul Koning
Gents,

In some targets, like pdp11 and vax, most instructions can reference data in 
memory directly.

So when I have "if (x < y) ..." I would expect something like this:

cmpw  x, y
bgeq  1f
...

What I actually see, with -O2 and/or -Os, is:

movw  x, r0
movw  y, r1
cmpw  r0, r1
bgeq  1f
...

which is both longer and slower.  I can't tell why this happens, or how to stop 
it.  The machine description has "general_operand" so it doesn't seem to be the 
place that forces things into registers.

paul



Re: How do I stop gcc from loading data into registers when that's not needed?

2018-05-18 Thread Richard Biener
On May 18, 2018 8:03:05 PM GMT+02:00, Paul Koning  
wrote:
>Gents,
>
>In some targets, like pdp11 and vax, most instructions can reference
>data in memory directly.
>
>So when I have "if (x < y) ..." I would expect something like this:
>
>   cmpw  x, y
>   bgeq  1f
>   ...
>
>What I actually see, with -O2 and/or -Os, is:
>
>   movw  x, r0
>   movw  y, r1
>   cmpw  r0, r1
>   bgeq  1f
>   ...
>
>which is both longer and slower.  I can't tell why this happens, or how
>to stop it.  The machine description has "general_operand" so it
>doesn't seem to be the place that forces things into registers.

I would expect combine to merge the load and arithmetic and thus it is 
eventually the target costing that makes that not succeed. 

Richard. 

>   paul



gcc-8-20180518 is now available

2018-05-18 Thread gccadmin
Snapshot gcc-8-20180518 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/8-20180518/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 8 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-8-branch 
revision 260383

You'll find:

 gcc-8-20180518.tar.xzComplete GCC

  SHA256=f02e8f919de390afef0afffd5ea573b42e21175c5a9bd36727f3298f8e7ce430
  SHA1=8d2b739997dec25ee13720589e19090ba44fc61f

Diffs from 8-20180511 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-8
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.


Re: How to disable multiple declarations

2018-05-18 Thread sumit kasliwal; via gcc
> Hi,
> 
> As a visiting faculty member at a local college, I am preparing
> documentation for some students that details bad practices to
> avoid when programming with C.
> 
> One of the practices I admonish against is multiple declarations
> in a single statement. While my doc does whatever little is
> possible at the documentation level, I was also looking for a way
> for being able to disable multiple declarations in the Makefile
> itself.
> 
> Is there some way I can get the gcc compiler to throw an error
> at compile time if it spots multiple declarations being made
> in a single C statement ? The error mechanism must be specific
> to multiple-declarations.
> 
> Thanks for any help


Re: How to disable multiple declarations

2018-05-18 Thread Jonathan Wakely
On 19 May 2018 at 07:01, sumit kasliwal; wrote:
>> Hi,
>>
>> As a visiting faculty member at a local college, I am preparing
>> documentation for some students that details bad practices to
>> avoid when programming with C.
>>
>> One of the practices I admonish against is multiple declarations
>> in a single statement. While my doc does whatever little is
>> possible at the documentation level, I was also looking for a way
>> for being able to disable multiple declarations in the Makefile
>> itself.
>>
>> Is there some way I can get the gcc compiler to throw an error
>> at compile time if it spots multiple declarations being made
>> in a single C statement ? The error mechanism must be specific
>> to multiple-declarations.
>>
>> Thanks for any help

There was a thread about this recently:
https://gcc.gnu.org/ml/gcc/2018-04/msg00110.html

But the short answer is no.