PR# 19449 Wrongly triggered invariant in LINKED_LIST

Problem Report Summary
Submitter: larswi
Category: Compiler
Priority: Medium
Date: 2018/08/20
Class: Bug
Severity: Serious
Number: 19449
Release: 18.07, 18.01, 17.01 ...?
Confidential: No
Status: Closed
Responsible:
Environment: linux
Synopsis: Wrongly triggered invariant in LINKED_LIST

Description
First i got problem with LINKED_LIST and invariant item_corresponds_to_index: (not off) implies (item = i_th (index)) inherited from CHAIN. It triggers somtimes (random?). 
I have created a small program that duplicates the problem (attached). I guess it has something to do with the garbage collector moving objects.



To Reproduce
class APPLICATION

inherit
    LINKED_LIST [STRING]
        rename
            make as make_ll
        end

create
    make

feature

    make
        local
            i, n: INTEGER
            str: STRING
        do
            make_ll
            n := 1_000_000
            from i := 1 until i > n loop
                str := "A"
                extend (str)
                finish
                if item /= i_th (index) then
                    print ("ERROR! count: " + count.out + " index: " + index.out + "%N")
                    print ("item: " + item.out + "%N")
                    print ("i_th: " + i_th (index).out + "%N")
                end
                i := i + 1
            end
        end

end

./application
ERROR! count: 26200 index: 26200
item: A
i_th: A
ERROR! count: 57641 index: 57641
item: A
i_th: A
ERROR! count: 106724 index: 106724
item: A
i_th: A

...
Problem Report Interactions
From:alexk_es    Date:2018/08/25    Status: Closed    Download   

											
											
											
From:alexk_es    Date:2018/08/24    Status: Analyzed    Download   

											
											
											
From:larswi    Date:2018/08/20    Status: Analyzed    Download   

											
											
											
Attachment: project.ecf     Size:845
From:alexk_es    Date:2018/08/20    Status: Analyzed    Download   

											
											
											
From:larswi    Date:2018/08/20    Download   

											
											
											
Attachment: application.e     Size:717