This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Vector subscription, register storage class
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Artem Shinkarov <artyom dot shinkaroff at gmail dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>
- Date: Wed, 9 Jun 2010 20:06:34 +0000 (UTC)
- Subject: Re: Vector subscription, register storage class
- References: <AANLkTim3wn5v_6CpbXCsGKSZLDRzZe5xrAeKARVDuabG@mail.gmail.com>
On Wed, 9 Jun 2010, Artem Shinkarov wrote:
> It should be addressable, but register keyword disallows it. To solve
> this problem I modify c-decl.c:start_decl like this:
I think that's too early, since you still want "&vector" (explicitly
taking the address) to be rejected for a vector with register storage
class. I don't claim it's optimal, but Andrew Pinski's patch handles
marking vectors addressable even when they have the register storage
class.
> But still I have an example that does not work:
> struct vec_s {
> vector short member;
> };
>
> int main () {
> register struct vec_s v2;
> v2.member[2] = 4;
> return 0;
> }
>
> The question is should it work at all? And what would be the optimal
> way to implement it?
If you allow subscripting register vectors, then surely this case should
work as well.
--
Joseph S. Myers
joseph@codesourcery.com