This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Trust TREE_ADDRESSABLE
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: Richard Biener <rguenther at suse dot de>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Sat, 7 Jun 2014 13:54:06 +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>
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.
> 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...
Ciao!
Steven