subreg question
Aldy Hernandez
aldyh@redhat.com
Thu Dec 13 10:33:00 GMT 2001
>>>>> "Dale" == Dale Johannesen <dalej@apple.com> writes:
> What cases of subreg are supposed to be handled exactly?
> double x(float y) {
> double z;
> *((float *)&z) = y; <-- boo!
> return z; }
i believe this is invalid code, hence implementation dependent. You
can't access an lvalue as a different type as it was declared.
Try unions.
> On ppc, the rtl for the store after purge_addressof looks like:
> (insn 36 12 17 (set (subreg:SF (reg/v:DF 118) 0)
> (reg:SF 121)) -1 (nil)
> (nil))
> This seems to work (118 eventually gets resolved to memory) despite
> an explicit statement in rtl.texi that it is invalid. Is it really?
> The original case involved Altivec vectors, which as you recall are
> 16 bytes:
> vector signed char v;
> int i;
> *((int *)&v) = i;
ditto here. I don't think you can do this.-- well, should.
Aldy
More information about the Gcc
mailing list