Skip to content

Compiling assert(expr) yields redundant if #755

Closed
@tautschnig

Description

@tautschnig

I haven't yet done any bisect, but just noticed that assert(expr) now yields both an assert instruction as well as an if:

$ cat as.c
#include <assert.h>

int main(int argc, char* argv[])
{
  assert(0);
  return 0;
}
$ cbmc/cbmc --show-goto-functions as.c
[...]
main /* main */
        // 0 file as.c line 5 function main
        ASSERT !((signed long int)!(0 != 0) != 0l) // assertion 0
        // 1 file as.c line 5 function main
        IF (signed long int)!(0 != 0) != 0l THEN GOTO 1
        // 2 file as.c line 6 function main
     1: main#return_value = 0;
        // 3 file as.c line 7 function main
        END_FUNCTION

This is on OS X, but the original observation was triggered on Linux.

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