This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: subreg question
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 13 Dec 2001 10:16:30 -0800
- Subject: Re: subreg question
- References: <112A6238-EF6C-11D5-86F6-003065C86F94@apple.com>
>>>>> "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