Skip to content

Java: invariant masked by overflow condition (no exceptions) ? #290

@wilsondy

Description

@wilsondy

java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Darwin Dylans-MBP.localdomain 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
Compile per your preference...

java -cp target/classes:target/test-classes:$DAIKONDIR/daikon.jar daikon.Chicory --daikon --ppt-select-pattern=org\.joda\.time\.field\.FieldUtils org.junit.runner.JUnitCore org.joda.time.field.TestFieldUtils

0
0
0
0
letting overflow go... 
0
0
letting overflow go... 
0
0
0
0
0
0
0
0
letting overflow go... 
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
letting overflow go... 
0
0
0
0
0
0
0
0
0
0
Count: 20
Chicory warning: ClassFile: org.junit.runner.notification.RunNotifier$9 - classfile version (49) is out of date and may not be processed correctly.
Chicory warning: ClassFile: org.junit.runner.notification.RunNotifier$4 - classfile version (49) is out of date and may not be processed correctly.
Chicory warning: ClassFile: org.junit.runner.notification.RunNotifier$2 - classfile version (49) is out of date and may not be processed correctly.

Time: 0.086

OK (1 test)


Daikon version 5.8.5, released July 22, 2020; http://plse.cs.washington.edu/daikon.
Reading declaration files Processing trace data; reading 1 dtrace file:

===========================================================================
org.joda.time.field.FieldUtils.safeAdd(long, long):::ENTER
val1 != val2
===========================================================================
org.joda.time.field.FieldUtils.safeAdd(long, long):::EXIT
return != orig(val1)
return != orig(val2)
===========================================================================
org.joda.time.field.FieldUtils.safeAdd2(long,long):::ENTER
val1 != val2
===========================================================================
org.joda.time.field.FieldUtils.safeAdd2(long, long):::EXIT
return != orig(val1)
return != orig(val2)
return - orig(val1) - orig(val2) == 0
Exiting Daikon.

What you expected to happen:
testSafeAdd Invariant should equal testSafeAdd2 (particularly return - orig(val1) - orig(val2) == 0
as we see no indication this invariant was violated even in the overflow conditions...

Source attached SOURCE.zip
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions