This is the mail archive of the gcc-patches@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]

i386 attribute memory bug


I discovered the following debugging my flow reorg:

The calculation of attribute memory is not safe.  When applied
to return_internal, we get a segv.

This is because instruction types are defaulted to "integer" 
which assumes two input operands.  Return_internal does not,
and so the system crashes.  This comes up when sched2 tries
to determine the priority of the return.

It is likely that this has not been seen before because basic
block boundaries were not correct wrt the prologue and epilogue.

The following is the most conservative patch.  Instead of 
defaulting instructions to "integer", default them to "other".


r~


	* i386.md (attr type): Default insns to new type "other".

Index: config/i386/i386.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.37
diff -c -p -d -r1.37 i386.md
*** i386.md	1998/10/06 19:41:52	1.37
--- i386.md	1998/10/27 23:20:49
***************
*** 72,79 ****
  ;; to i386.h at the same time.
  
  (define_attr "type"
!   "integer,binary,memory,test,compare,fcompare,idiv,imul,lea,fld,fpop,fpdiv,fpmul"
!   (const_string "integer"))
  
  (define_attr "memory" "none,load,store"
    (cond [(eq_attr "type" "idiv,lea")
--- 72,79 ----
  ;; to i386.h at the same time.
  
  (define_attr "type"
!   "integer,binary,memory,test,compare,fcompare,idiv,imul,lea,fld,fpop,fpdiv,fpmul,other"
!   (const_string "other"))
  
  (define_attr "memory" "none,load,store"
    (cond [(eq_attr "type" "idiv,lea")


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