Floating Pt. Optimize on PA

Jeffrey A Law law@cygnus.com
Fri Dec 25 16:36:00 GMT 1998


  In message < 4.1.19981225141347.00be7aa0@garfield.dis.com >you write:
  > --=====================_1893231202==_
  > Content-Type: text/plain; charset="us-ascii"
  > 
  > The attached code at -O2 fails with egcs-1.1b and egcs-1.1.1. It
  > works correctly in gcc 2.8.1.
  > 
  > Analysis:
  > 
  >         fldds 0(0,%r19),%fr8
  >         ldw -120(0,%r30),%r20
  >         ldo -120(%r30),%r21
  >         fstds %fr8,0(0,%r21)
  >         addil LR'L$C0002-$global$,%r27
  >         stw %r20,16(0,%r4)
  >         copy %r1,%r22
  >         ldw 4(0,%r21),%r24
  >         copy %r20,%r25
  >         stw %r24,20(0,%r4)
  >         .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR
  >         bl printf,%r2
  >         ldo RR'L$C0002-$global$(%r22),%r26
  > 
  > The second instruction (ldw -120(0,%r30),%r20) is attempting to
  > load the high order 32 bits of the floating point value into a
  > general register before the floating point value has been saved
  > into the frame. 
I didn't do the full analysis, but I'm pretty sure your sample code is bogus.

#define SET_DOUBLE(_t, _addr, _v)                       \
        ( (_t).d = (_v),                                \
         ((long*)(_addr))[0] = ((long*) &(_t))[0],      \
         ((long*)(_addr))[1] = ((long*) &(_t))[1])

Note that you references the data in "t" via t.d and ((long*) (&_t)[0] which
produces undefined results according to ANSI.


jeff



More information about the Gcc-bugs mailing list