Issue 170291
Summary stack 64 bit num misalignment caused by -fstack-protector-strong
Labels
Assignees
Reporter dongwei123wh
    I used clang on armv7 arch(little endian), when I add compiler option -fstack-protector-strong, the sprinf_s for uint64_t num is abnormal,  demo as below:

sprintf_s(buffer, bufferLen, formar, 0x3c6ULL);
..
void sprintf_s(buffer, bufferLen, formar, ...)
{
   ...
    va_list args;
    va_start(args, format);
    u64val = va_arg(args, long long int);   //   get wrong num 0x0000036c 00000015, not 0x00000000 000003c6,  
    ....
}

 The reason is 0x3c6 address is not 64 bit aligned address, so va_arg get wrong address
 stack data like: 00000015 0000036c 00000000

so, Why does this happen?  and how can it be resolved?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to