Skip to content

Commit

Permalink
__CPROVER_llabs returns a long long
Browse files Browse the repository at this point in the history
Fixes the declaration in builtin_headers.h. Type checking actually
ignored this declaration and would always generate the expression of the
correct type.
  • Loading branch information
tautschnig committed Dec 5, 2021
1 parent fdc7ba5 commit d984199
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
10 changes: 7 additions & 3 deletions regression/cbmc-library/__builtin_llabs-01/main.c
@@ -1,9 +1,13 @@
#include <assert.h>
#include <stdlib.h>

#include <limits.h>

#ifndef __GNUC__
long long __builtin_llabs(long long);
#endif

int main()
{
__builtin_llabs();
assert(0);
assert(__builtin_llabs(LLONG_MIN + 1) == LLONG_MAX);
return 0;
}
4 changes: 2 additions & 2 deletions regression/cbmc-library/__builtin_llabs-01/test.desc
@@ -1,6 +1,6 @@
KNOWNBUG
CORE
main.c
--pointer-check --bounds-check
--pointer-check --bounds-check --signed-overflow-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
Expand Down
5 changes: 3 additions & 2 deletions regression/cbmc-library/llabs-01/main.c
@@ -1,9 +1,10 @@
#include <assert.h>
#include <stdlib.h>

#include <limits.h>

int main()
{
llabs();
assert(0);
assert(llabs(LLONG_MIN + 1) == LLONG_MAX);
return 0;
}
4 changes: 2 additions & 2 deletions regression/cbmc-library/llabs-01/test.desc
@@ -1,6 +1,6 @@
KNOWNBUG
CORE
main.c
--pointer-check --bounds-check
--pointer-check --bounds-check --signed-overflow-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
Expand Down
2 changes: 1 addition & 1 deletion src/ansi-c/cprover_builtin_headers.h
Expand Up @@ -84,7 +84,7 @@ int __CPROVER_isunorderedd(double f, double g);
// absolute value
int __CPROVER_abs(int x);
long int __CPROVER_labs(long int x);
long int __CPROVER_llabs(long long int x);
long long int __CPROVER_llabs(long long int x);
double __CPROVER_fabs(double x);
long double __CPROVER_fabsl(long double x);
float __CPROVER_fabsf(float x);
Expand Down

0 comments on commit d984199

Please sign in to comment.