Displaying 2 results from an estimated 2 matches for "chararray2".
Did you mean:
chararray
2016 Mar 16
4
Problem with __builtin_object_size when it depends on a condition
...te the object size when it finds
condition that cannot be eliminated. There is example:
-----------------------------------------------
#include<stdlib.h>
#define STATIC_BUF_SIZE 10
#define LARGER_BUF_SIZE 30
size_t foo(int flag) {
char *cptr;
char chararray[LARGER_BUF_SIZE];
char chararray2[STATIC_BUF_SIZE];
if(flag)
cptr = chararray2;
else
cptr = chararray;
return __builtin_object_size(cptr, 2);
}
int main() {
size_t ret;
ret = foo(0);
printf("\n%d\n", ret);
return 0;
}
----------------------------------------------
If you try to compile...
2016 Mar 17
3
Problem with __builtin_object_size when it depends on a condition
...le:
>>
>> -----------------------------------------------
>> #include<stdlib.h>
>> #define STATIC_BUF_SIZE 10
>> #define LARGER_BUF_SIZE 30
>>
>> size_t foo(int flag) {
>> char *cptr;
>> char chararray[LARGER_BUF_SIZE];
>> char chararray2[STATIC_BUF_SIZE];
>> if(flag)
>> cptr = chararray2;
>> else
>> cptr = chararray;
>>
>> return __builtin_object_size(cptr, 2);
>> }
>>
>> int main() {
>> size_t ret;
>> ret = foo(0);
>> printf("\n%d\n&...