infer icon indicating copy to clipboard operation
infer copied to clipboard

Topl parse error if there isn't a newline at end of property.topl

Open JukMR opened this issue 2 years ago • 0 comments

Please make sure your issue is not addressed in the FAQ.

Please include the following information:

  • [x] The version of infer from infer --version.
  • [x] Your operating system and version, for example "Debian 9", "MacOS High Sierra", whether you are using Docker, etc.
  • [x] Which command you ran, for example infer -- make.
  • [x] The full output in a paste, for instance a gist.
  • [x] If possible, a minimal example to reproduce your problem (for instance, some code where infer reports incorrectly, together with the way you run infer to reproduce the incorrect report).
  • Infer version v1.1.0-669338131
  • OS: Linux 5.15.81-1-MANJARO

When trying to run a property in topl the following command fails if there is no newline at the end of file.

Running infer --topl-only --topl-properties property.topl -- clang -c file.c

where file.c is:

int foo(int number){
    return number;
}

int main(){
    foo(1);
}

and property.topl is:

property notOneAsArg
  prefix "Main"
  start -> start: *
  start -> error: foo(Arg1, Ret) when Arg1 == 1

When there is a newline at the end of property.topl topl detect the property as expected:

➜  issue infer --topl-only --topl-properties property.topl -- clang -c file.c
Capturing in make/cc mode...
Found 1 source file to analyze in $HOME/issue/infer-out
1/1 [################################################################################] 100% 38.55ms

file.c:5: error: Topl Error
  property notOneAsArg fails.
  3. }
  4. 
  5. int main(){
     ^
  6.     foo(1);
  7. }


Found 1 issue
  Issue Type(ISSUED_TYPE_ID): #
      Topl Error(TOPL_ERROR): 1

When there is no newline at the end of property.topl the following error occurs

➜  issue infer --topl-only --topl-properties property.topl -- clang -c file.c
Usage Error: $HOME/property.topl:4:48: topl parse error

I don't know if this an expected behavior but couldn't find its explanation anywhere on the topl docs.

CC: @dgutson

JukMR avatar Dec 08 '22 18:12 JukMR