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

Re: bug in latest egcs



  In message <x767qggguw.fsf@myware.rz.uni-karlsruhe.de>you write:
  > Hi,
  > 
  > One of the last changes introduced a bug in egcs which is only
  > visible with high optimization.  This is the stripped down source:
Yes.


  > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  > 
  > The problem is in the assignment to `sign'.  On i386 using -O3 -g I get
Thanks for the analysis.  Obviously something is wrong.


  > I guess the the code handling the aliases is wrong and that for
  > calculating `jo' %eax should have been used, leaving %edi unmodifed.
Nope, it's not the alias code, since the alias code involves only memory
locations, not registers.   I can revert back to the alias code from
Sept 29 and still get this bug.

>From the .lreg dump we have:

(insn 28 25 29 (set (reg:SI 28)
        (lshiftrt:SI (reg/v:SI 23)
            (const_int 23))) 241 {lshrsi3} (insn_list 16 (nil))
    (nil))

(insn 29 28 31 (set (reg:SI 28)
        (and:SI (reg:SI 28)
            (const_int 255))) 184 {andsi3} (insn_list 28 (nil))
    (nil))

(insn 31 29 33 (set (reg/v:SI 22)
        (plus:SI (reg:SI 28)
            (const_int -127))) 144 {addsi3+1} (insn_list 29 (nil))
    (nil))

(note 33 31 132 "" NOTE_INSN_DELETED)
                
(insn 132 33 34 (set (reg/v:SI 25)
        (const_int 1)) 52 {movsi+1} (nil)
    (expr_list:REG_EQUAL (const_int 1)
        (nil)))        

(insn 34 132 35 (set (cc0)
        (reg/v:SI 23)) 0 {tstsi_1} (nil)
    (nil))


Note that insn 34 sets cc0 from the contents of reg23 (which is 'i'
in the source code).  Note that reg23 does not change in this hunk
of code.

Further note that reg28 is the value for 'j0'.


>From the .greg dump we find:

;; 23 conflicts: 21 22 23 25 28 31 0
;; 28 conflicts: 21 22 23 25 28

Which looks correct (reg23 & reg28 conflict).

reg23 is initially allocated to hard register 2
reg28 is initially allocated to hard register 0

Reg2 gets spilled.  reg23 gets rellocated to reg1

Later reg0 gets spilled. reg28 gets rellocated to reg5

Then reg1 gets spilled.  reg23 gets reallocated to reg5, which
causes the incorrect code to be generated.

I've got to run, but I'll be looking further into this tomorrow, but
I can say that it's not an alias problem.


Jeff


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