Skip to content

Cross execution access bug in rel() and ghost if blocks #992

@AkasakaJelos

Description

@AkasakaJelos

Consider the following example:

package exercises

// ##(--hyperMode extended --enableExperimentalHyperFeatures)

// @ ghost
// @ decreases
func GetInt() (res int)

// @ requires rel(t, 0) != rel(t, 1)
func test5_RelationalIndexBug(t uint64) {
	steps := make([]uint64, 20)

	//@ ghost var t0 uint64 = rel(t, 0)
	//@ ghost var t1 uint64 = rel(t, 1)

	//@ idx1 := GetInt()

	//@ assume t0 < t1 ==> 0 <= idx1 && idx1 < rel(len(steps), 0)
	//@ assume t0 < t1 ==> 0<= idx1 && idx1 < len(rel(steps,0))

	/*@
	  ghost if t0 < t1 {
	      ghost var TStar uint64 = rel(steps[idx1], 0)
	  }
	  @*/
}

If we run on Gobra, Gobra will return the following error:

[info] Error at: </.../exercises/relissues8.go:30:18> Assignment might fail.
[info] Permission to steps[idx1] might not suffice.

(Did an initial mistake with analysis, as my example was bad. Please see the comments below.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions