This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Trust TREE_ADDRESSABLE
- From: Richard Biener <rguenther at suse dot de>
- To: Steven Bosscher <stevenb dot gcc at gmail dot com>,Eric Botcazou <ebotcazou at adacore dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>,Jan Hubicka <hubicka at ucw dot cz>
- Date: Sat, 07 Jun 2014 15:15:43 +0200
- Subject: Re: [PATCH] Trust TREE_ADDRESSABLE
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1406041546210 dot 2632 at zhemvz dot fhfr dot qr> <1541821 dot OLGIFrEuUk at polaris> <dcc8a682-9d02-4adf-842b-2cec994a03bb at email dot android dot com> <5656052 dot gV1A7U3eBS at polaris> <CABu31nMEb6NVCJ8rhqnqKaJSsst9QGaMN6gC=QrxyhN9+7PGTQ at mail dot gmail dot com>
On June 7, 2014 1:54:06 PM CEST, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>On Sat, Jun 7, 2014 at 12:59 PM, Eric Botcazou wrote:
>>> >In Ada we don't mark (external) variables as addressable if we
>don't
>>> >see their address taken.
>>>
>>> You have to (now). The testing was of course to detect this...
>>
>> Well, you need to define what TREE_ADDRESSABLE means now, because
>according to
>>
>> /* In VAR_DECL, PARM_DECL and RESULT_DECL nodes, nonzero means
>address
>> of this is needed. So it cannot be in a register.
>> [...]
>> #define TREE_ADDRESSABLE(NODE) ((NODE)->base.addressable_flag)
>>
>> your change is clearly wrong and the Ada compiler clearly right.
>
>"Clearly"?
>
>An external variable is a VAR_DECL that cannot be in a register. It
>can be loaded into a register (or stored into), and for that its
>address is needed. So I would expect an external variable to be marked
>addressable by default.
>
>I was always surprised that this was not the case before Richi's
>change.
Well, honza was as well, so I thought I must be wrong.
>
>> And auditing
>> the various front-ends might also be in order here if they really
>need to mark
>> every single external variable as addressable to be safe wrt
>aliasing.
>
>Right. And this should have been done (clearly ;-) ) before the patch
>was committed...
I thought that bootstrap and regtest plus what I remember from debug sessions was enough.
Anyway, an easy fix is to make all globals TREE_ADDRESSABLE somewhere in the varpool code.
But I have no idea how to audit the frontends and judge their language specific knowledge they put into deciding whether a deck may have its address taken.
Richard.
>Ciao!
>Steven