Displaying 2 results from an estimated 2 matches for "static_buf_size".
2016 Mar 16
4
Problem with __builtin_object_size when it depends on a condition
Optimizer doesn't know how to calculate 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...
2016 Mar 17
3
Problem with __builtin_object_size when it depends on a condition
...vm-dev at lists.llvm.org> wrote:
>>
>> Optimizer doesn't know how to calculate 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;
>>...