ultravideo / kvazaar

An open-source HEVC encoder
BSD 3-Clause "New" or "Revised" License
833 stars 180 forks source link

strict aliasing warnings with GCC 4.8 #238

Closed darealshinji closed 4 years ago

darealshinji commented 5 years ago

GCC 4.8 shows several -Wstrict-aliasing warnings in picture-avx2.c:

strategies/avx2/picture-avx2.c: In function ‘inter_recon_bipred_no_mov_avx2’:
strategies/avx2/picture-avx2.c:789:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     sample1_epi8 = _mm256_castsi128_si256(_mm_cvtsi32_si128(*(int32_t*)&lcu->rec.y[y_in_lcu * LCU_WIDTH + x_in_lcu]));
     ^
strategies/avx2/picture-avx2.c:822:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     sample1_epi8 = _mm256_castsi128_si256(_mm_cvtsi32_si128(*(int32_t*)&lcu->rec.y[y_in_lcu * LCU_WIDTH + x_in_lcu]));
     ^
strategies/avx2/picture-avx2.c:884:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      sample1_epi8 = _mm256_castsi128_si256(_mm_cvtsi32_si128(*(int32_t*)&lcu->rec.u[y_in_lcu * LCU_WIDTH_C + x_in_lcu]));
      ^
strategies/avx2/picture-avx2.c:888:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      sample1_epi8 = _mm256_castsi128_si256(_mm_cvtsi32_si128(*(int32_t*)&lcu->rec.v[y_in_lcu * LCU_WIDTH_C + x_in_lcu]));
      ^
strategies/avx2/picture-avx2.c:902:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      sample1_epi8 = _mm256_castsi128_si256(_mm_cvtsi32_si128(*(int32_t*)&lcu->rec.u[y_in_lcu * LCU_WIDTH_C + x_in_lcu]));
      ^
strategies/avx2/picture-avx2.c:906:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      sample1_epi8 = _mm256_castsi128_si256(_mm_cvtsi32_si128(*(int32_t*)&lcu->rec.v[y_in_lcu * LCU_WIDTH_C + x_in_lcu]));
      ^
strategies/avx2/picture-avx2.c: In function ‘inter_recon_bipred_avx2’:
strategies/avx2/picture-avx2.c:1067:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
       _mm256_slli_epi32(_mm256_cvtepu8_epi32(_mm_cvtsi32_si128(*(int32_t*) &(lcu->rec.y[y_in_lcu * LCU_WIDTH + x_in_lcu]))), 14 - KVZ_BIT_DEPTH);
       ^
strategies/avx2/picture-avx2.c:1161:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
        _mm256_slli_epi32(_mm256_cvtepu8_epi32(_mm_cvtsi32_si128(*(int32_t*) &(lcu->rec.u[y_in_lcu * LCU_WIDTH_C + x_in_lcu]))), 14 - KVZ_BIT_DEPTH);
        ^
strategies/avx2/picture-avx2.c:1174:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
        _mm256_slli_epi32(_mm256_cvtepu8_epi32(_mm_cvtsi32_si128(*(int32_t*) &(lcu->rec.v[y_in_lcu * LCU_WIDTH_C + x_in_lcu]))), 14 - KVZ_BIT_DEPTH);
        ^

This doesn't happen with GCC 7 so I don't know if you actually consider this a problem.

Arizer commented 5 years ago

Hi,

That part of code will be rewritten in the near future. We'll get rid of this annoyance when that happens. Thanks for the report.

Arizer commented 4 years ago

Update: this function has been removed a while ago due to other problems.