carbon icon indicating copy to clipboard operation
carbon copied to clipboard

Exhale QPs with predicates results in an "empty.reduceLeft" error

Open tdardinier opened this issue 3 years ago • 4 comments

The Viper program

predicate p()

method m()
  ensures forall i: Int :: p()

results in the following error:

ERROR: The following exception occured in ViperServer: java.lang.UnsupportedOperationException: empty.reduceLeft
 trace:
  scala.collection.TraversableOnce.reduceLeft(TraversableOnce.scala:179)
  scala.collection.TraversableOnce.reduceLeft$(TraversableOnce.scala:177)
  scala.collection.mutable.ArrayBuffer.scala$collection$IndexedSeqOptimized$$super$reduceLeft(ArrayBuffer.scala:47)
  scala.collection.IndexedSeqOptimized.reduceLeft(IndexedSeqOptimized.scala:73)
  scala.collection.IndexedSeqOptimized.reduceLeft$(IndexedSeqOptimized.scala:72)
  scala.collection.mutable.ArrayBuffer.reduceLeft(ArrayBuffer.scala:47)
  scala.collection.TraversableOnce.reduce(TraversableOnce.scala:207)
  scala.collection.TraversableOnce.reduce$(TraversableOnce.scala:207)
  scala.collection.AbstractTraversable.reduce(Traversable.scala:104)
  viper.carbon.modules.impls.QuantifiedPermModule.translateExhale(QuantifiedPermModule.scala:723)

which occurs because a reduce operation is done on the arguments of the predicates, and in this case the predicate has no argument.

This should probably be handled by the consistency checks.

tdardinier avatar Jul 13 '21 12:07 tdardinier

Resolved in Silicon with PR https://github.com/viperproject/silicon/pull/597.

Corresponding regression in PR https://github.com/viperproject/silver/pull/554. The latter should only be accepted once this Carbon is was resolved.

mschwerhoff avatar Feb 08 '22 17:02 mschwerhoff

It seems that the Silver regression PR https://github.com/viperproject/silver/pull/554 was merged without a fix in Carbon. I'll disable this test (all/issues/silicon/0595.vpr) in Silver for Carbon for now, but it should be reenabled once this is fixed.

JonasAlaif avatar Mar 29 '22 09:03 JonasAlaif

I can't reproduce the error in Carbon (I get a well-definedness error, but I think that's correct with the latest design)

alexanderjsummers avatar May 31 '22 10:05 alexanderjsummers