Skip to content

Commit 873727c

Browse files
committed
Support __builtin_dynamic_object_size
Use the same approximation of the behaviour as we already did for `__builtin_object_size`. Fixes: #8116
1 parent 69bb2b6 commit 873727c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ansi-c/c_typecheck_expr.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -3512,11 +3512,15 @@ exprt c_typecheck_baset::do_special_functions(
35123512

35133513
return typecast_exprt(expr.arguments()[0], expr.type());
35143514
}
3515-
else if(identifier=="__builtin_object_size")
3515+
else if(
3516+
identifier == "__builtin_object_size" ||
3517+
identifier == "__builtin_dynamic_object_size")
35163518
{
3517-
// this is a gcc extension to provide information about
3519+
// These are gcc extensions to provide information about
35183520
// object sizes at compile time
35193521
// http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html
3522+
// Our behavior is as if it was never possible to determine the object that
3523+
// the pointer pointed to.
35203524

35213525
if(expr.arguments().size()!=2)
35223526
{

src/ansi-c/compiler_headers/gcc_builtin_headers_mem_string.h

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void* __builtin_memmove(void*, const void*, __CPROVER_size_t);
119119
void* __builtin_mempcpy(void*, const void*, __CPROVER_size_t);
120120
void* __builtin_memset(void*, int, __CPROVER_size_t);
121121
__CPROVER_size_t __builtin_object_size(const void*, int);
122+
__CPROVER_size_t __builtin_dynamic_object_size(const void*, int);
122123
int __builtin_popcount(unsigned);
123124
int __builtin_popcountimax(uintmax_t);
124125
int __builtin_popcountll(unsigned long long int x);

0 commit comments

Comments
 (0)