This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: subreg question


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]