https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69504

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-01-27
          Component|tree-optimization           |c
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is because you use the vector extension of indexing a vector with [] but
with variable indexes the FE represents this in a way that takes the address
of the vector variable which isn't possible in this case - it's a register.

    printf ((const char * restrict) "%d\n", (int) *((unsigned char *) &u8x16 +
(sizetype) i));

so I fear the solution here is to reject the code with an error or force
the frontend to special-case register vars by going through a temporary,
that is, use ({ u8x16_t tem = u8x16; tem[i]; })

Frontend issue.  If you do sth like

void foo (u8x16_t *);
int main(void) {
    register u8x16_t u8x16 asm ("xmm0");
    foo (&u8x16);
}

the FEs will reject it with

error: address of register variable ‘u8x16’ requested

so I think rejecting this code is a reasonable thing.  Using intrinsics if you
use processor specific registers is a reasonable thing to expect from you here.

Reply via email to