shivaramaarao wrote:

These cmov instructions load the operand irrespective of condition 
satisfaction. 

=>  cmpq    $4, %rax  
=>  cmovnsq 24(%r11), %r9   

     here r11 is 0 and 24(0) will be loaded even if argc < 4 and hence we get 
this crash. if we pass the address of argv, we will get a valid address to load.

   I think we need to add a check for argc <=0 in this function. But, there may 
be performance implications with this extra check.


https://github.com/llvm/llvm-project/pull/76122
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to