Skip to content

Parsing a file with a negative global integer fails

[Issue initially reported by Gruber in https://stackoverflow.com/questions/71708334/frama-clang-invalid-integer-constant

Frama-Clang does not correctly translate negative integer constant when they are used to initialized a global variable, as can be seen in the following code

const long long value = -1;

int main(){
    return 0;
}

which results in

[kernel] /home/virgile/example.cpp:1: User Error:
  Invalid character - in integer literal: -1
[kernel] User Error: stopping on file "/home/virgile/example.cpp" that has errors.

Convert.convert_static_const should use Convert.mk_int64_cst instead of directly doing Int64.to_string.