Skip to content

Commit 54ebac4

Browse files
author
BaierD
committed
Add default type sizes check for fromIeeeBitvector()
1 parent 06fb659 commit 54ebac4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/org/sosy_lab/java_smt/basicimpl/AbstractFloatingPointFormulaManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.sosy_lab.java_smt.api.FloatingPointRoundingMode;
2525
import org.sosy_lab.java_smt.api.Formula;
2626
import org.sosy_lab.java_smt.api.FormulaType;
27+
import org.sosy_lab.java_smt.api.FormulaType.BitvectorType;
2728
import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType;
2829

2930
/**
@@ -245,6 +246,11 @@ protected abstract TFormulaInfo castFromImpl(
245246
@Override
246247
public FloatingPointFormula fromIeeeBitvector(
247248
BitvectorFormula pNumber, FloatingPointType pTargetType) {
249+
BitvectorType bvType = (BitvectorType) formulaCreator.getFormulaType(pNumber);
250+
Preconditions.checkArgument(
251+
bvType.getSize() == pTargetType.getTotalSize(),
252+
"The total size of the used FloatingPointType has to match the size of the bitvector"
253+
+ " given");
248254
return wrap(fromIeeeBitvectorImpl(extractInfo(pNumber), pTargetType));
249255
}
250256

0 commit comments

Comments
 (0)