Joe McDonnell created IMPALA-9781:
-------------------------------------

             Summary: 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: Improvement
          Components: Backend
    Affects Versions: Impala 4.0
            Reporter: Joe McDonnell


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