Skip to content

--add-library on 32 bit code seems to use 64 bit library #2949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
markrtuttle opened this issue Sep 13, 2018 · 0 comments
Closed

--add-library on 32 bit code seems to use 64 bit library #2949

markrtuttle opened this issue Sep 13, 2018 · 0 comments

Comments

@markrtuttle
Copy link
Collaborator

With the file main.c

#include <string.h>

int main(){
  char buffer[] = "a";
  int x = strlen(buffer);
  return x;
}

the commands

goto-cc -m32 -o main.gb main.c
goto-instrument --add-library main.gb main2.gb

report numerous conflicts including

file <builtin-architecture-strings> line 3: warning: conflicting initializers for variable "__CPROVER_architecture_long_int_width"
using old value in module main file <builtin-architecture-strings> line 3
32
ignoring new value in module <built-in-library> file <builtin-architecture-strings> line 3
64

I can see from the symbol table that something has been added (strlen::1::len and strlen::s), but I'm not sure I can trust the result. I don't see the equivalent of --32 or -m32 for goto-instrument (it doesn't recognize these flags). I tried to submit this as a KNOWNBUG test case for goto-instrument, but couldn't see how to write a test.desc that would pass -m32 to cbmc before running goto-instrument.

kroening pushed a commit that referenced this issue Sep 15, 2018
kroening pushed a commit that referenced this issue Sep 18, 2018
kroening pushed a commit that referenced this issue Sep 20, 2018
Fixes #2949

This enables auto-detecting the architecture of a goto-binary when
performing transformations on it, e.g., with main.c:

int main(){
  char buffer[] = "a";
  int x = strlen(buffer);
  return x;
}

the commands

  goto-cc -m32 -o main.gb main.c
  goto-instrument --add-library main.gb main2.gb

now pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant