Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-9781

Fix GCC 7 runtime issue: Unaligned loads and stores for int128_t types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 4.0.0
    • Impala 4.0.0
    • Backend
    • None

    Description

      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():

       

          case 16:
            return DecimalVal(*reinterpret_cast<int128_t*>(t->GetSlot(slot_offset_)));
      

      DecimalUtil::DecodeFromFixedLenByteArray():

       

       

        template<typename T>
        static inline void DecodeFromFixedLenByteArray(
            const uint8_t* buffer, int fixed_len_size, T* v) {
      ...
          *v = 0; <--- unaligned store
      

      DictDecoder::GetValue():

        virtual void GetValue(int index, void* buffer) {
          T* val_ptr = reinterpret_cast<T*>(buffer);
          ...
          *val_ptr = dict_[index]; <--- unaligned store
        }
      

      These can be converted to use memcpy / memset to avoid the unaligned stores/loads.

       

      Attachments

        Activity

          People

            joemcdonnell Joe McDonnell
            joemcdonnell Joe McDonnell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: