[ 
https://issues.apache.org/jira/browse/IMPALA-9781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17119267#comment-17119267
 ] 

ASF subversion and git services commented on IMPALA-9781:
---------------------------------------------------------

Commit 227da84c3757eb857008e7b82aad622ed959eb84 in impala's branch 
refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=227da84 ]

IMPALA-9781: Fix GCC 7 unaligned 128-bit loads / stores

When running a release binary built with GCC 7.5.0, it crashes
with an unaligned memory error in multiple pieces of code.
In these locations, we are doing stores to 128-bit values, but we
cannot guarantee alignment. GCC 7 must be optimizing the code to
use instructions that require a higher level of alignment than
we can provide.

This switches the code locations to use memset / memcpy with
local variables to avoid the unaligned stores.

Testing:
 - Ran exhaustive tests with a release binary built by GCC 7.5.0
 - Ran exhaustive tests

Change-Id: I67320790789d5b57aeaf2dff0eae7352a1cbf81e
Reviewed-on: http://gerrit.cloudera.org:8080/15993
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Fix GCC 7 runtime issue: Unaligned loads and stores for int128_t types
> ----------------------------------------------------------------------
>
>                 Key: IMPALA-9781
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9781
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 4.0
>            Reporter: Joe McDonnell
>            Priority: Major
>
> When running with a release binary built with GCC 7, Impala crashes with 
> multiple distinct unaligned memory errors. They are all related to 
> manipulating 128-bit values. Presumably GCC 7 added an optimization to use an 
> instruction that requires alignment for setting 128-bit values. The locations 
> impacted are:
> SlotRef::GetDecimalValInterpreted():
>  
> {code:java}
>     case 16:
>       return 
> DecimalVal(*reinterpret_cast<int128_t*>(t->GetSlot(slot_offset_)));
> {code}
> DecimalUtil::DecodeFromFixedLenByteArray():
>  
>  
> {code:java}
>   template<typename T>
>   static inline void DecodeFromFixedLenByteArray(
>       const uint8_t* buffer, int fixed_len_size, T* v) {
> ...
>     *v = 0; <--- unaligned store
> {code}
> DictDecoder::GetValue():
> {code:java}
>   virtual void GetValue(int index, void* buffer) {
>     T* val_ptr = reinterpret_cast<T*>(buffer);
>     ...
>     *val_ptr = dict_[index]; <--- unaligned store
>   }
> {code}
> These can be converted to use memcpy / memset to avoid the unaligned 
> stores/loads.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to