gnu.cfg: Add configuration and test for __builtin_assume_aligned()

This commit is contained in:
versat 2019-10-10 10:23:21 +02:00
parent 637510393a
commit 77c711d129
2 changed files with 22 additions and 1 deletions

View File

@ -59,6 +59,23 @@
<valid>0:</valid>
</arg>
</function>
<!-- void * __builtin_assume_aligned (const void *exp, size_t align, ...) -->
<!-- This function can have either two or three arguments, if it has three, the third argument should have integer type. -->
<function name="__builtin_assume_aligned">
<noreturn>false</noreturn>
<returnValue type="void *">arg1</returnValue>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in"/>
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="3" direction="in" default="0">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- void * __builtin_memcpy(void *dest, const void *source, size_t size);-->
<!-- memcpy() is sometimes defined as __builtin_memcpy() so the define above does not work -->
<function name="__builtin_memcpy">

View File

@ -108,12 +108,16 @@ int no_resourceLeak_mkostemp_02(char *template, int flags)
return mkostemp(template, flags);
}
void valid_code(int argInt1, va_list valist_arg)
void valid_code(int argInt1, va_list valist_arg, int * parg)
{
char *p;
if (__builtin_expect(argInt1, 0)) {}
if (__builtin_expect_with_probability(argInt1 + 1, 2, 0.5)) {}
void *ax1 = __builtin_assume_aligned(parg, 16);
printf("%p", ax1);
void *ax2 = __builtin_assume_aligned(parg, 32, 8);
printf("%p", ax2);
p = (char *)malloc(10);
free(p);