llvm2c icon indicating copy to clipboard operation
llvm2c copied to clipboard

constval/createUndefValue: replacing LLVM undef value by all zeros is not accurate

Open tomsik68 opened this issue 5 years ago • 1 comments

We need this for scalar as well as aggregate type of undef value.

It would be nice to have a choice:

  1. The default behavior could be to crash with an error message that undef value doesn't translate to C.
  2. For sv-comp compatible verifiers, we need an option to replace undef values by __VERIFIER_nondet_* (depending on type).
  3. We can still have the option to replace undef value by zero, but user has to ask for it explicitly.

tomsik68 avatar Jul 20 '20 09:07 tomsik68

Actually, undef value can easily be created in C by allocating a variable without assigning any value to it. This is a better candidate for the default behavior than crashing.

int main() {
    int a;
    return a;
}

tomsik68 avatar Jul 31 '20 14:07 tomsik68