DenisTarasyuk commented on issue #46708:
URL: https://github.com/apache/arrow/issues/46708#issuecomment-2958979494

   > Thanks. Does it mean that this is a LLVM optimization bug? We can avoid 
this bug by setting `out_high`/`out_low` on invalid case, right?
   
   I think this is called "undefined behaviour". It is not llvm bug it is just 
something not specified in cpp specs so LLVM was free to to anything. If I am 
not wrong there is some function after castDECIMAL_utf8 that uses 
`out_high`/`out_low` and as they are primitives that function expects them to 
have some value. So on O3 optimization level LLVM done some inlining and 
backtracked generated code from that function body back to those lines I 
mentioned and decided that if those are primitives required to have valid 
values that means function that populates them should always populate them 
which means gdv_fn_dec_from_string should always return 0. I am not 100% sure 
it works like that but that is how I understand it now.
   Setting values to 0 fixes it for me. I have seen some documents that state 
even printf in return -1 block will cause LLVM to fix code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to