Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strict aliasing warnings on gcc10 #2204

Closed
terrelln opened this issue Jun 15, 2020 · 1 comment
Closed

strict aliasing warnings on gcc10 #2204

terrelln opened this issue Jun 15, 2020 · 1 comment

Comments

@terrelln
Copy link
Contributor

Describe the bug
gcc10 has new strict aliasing warnings not raised in gcc9.

To Reproduce

> CC=gcc10 make zstd
../lib/compress/zstd_compress.c: In function ‘ZSTD_loadCEntropy’:
../lib/compress/zstd_compress.c:2923:64: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
 2923 |         size_t const hufHeaderSize = HUF_readCTable((HUF_CElt*)bs->entropy.huf.CTable, &maxSymbolValue, dictPtr,
      |                                                                ^~
../lib/compress/zstd_compress_literals.c: In function ‘ZSTD_compressLiterals’:
../lib/compress/zstd_compress_literals.c:108:28: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  108 |                 (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2) :
      |                            ^~~~~~~
../lib/compress/zstd_compress_literals.c:112:28: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  112 |                 (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2);
      |                            ^~~~~~~
../lib/compress/zstd_compress_superblock.c: In function ‘ZSTD_buildSuperBlockEntropy_literal’:
../lib/compress/zstd_compress_superblock.c:116:76: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  116 |     if (repeat == HUF_repeat_check && !HUF_validateCTable((HUF_CElt const*)prevHuf->CTable, countWksp, maxSymbolValue)) {
      |                                                                            ^~~~~~~
../lib/compress/zstd_compress_superblock.c:123:64: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  123 |     {   size_t const maxBits = HUF_buildCTable_wksp((HUF_CElt*)nextHuf->CTable, countWksp,
      |                                                                ^~~~~~~
../lib/compress/zstd_compress_superblock.c:130:32: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  130 |                     (HUF_CElt*)nextHuf->CTable, countWksp, maxSymbolValue);
      |                                ^~~~~~~
../lib/compress/zstd_compress_superblock.c:133:32: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  133 |                     (HUF_CElt*)nextHuf->CTable, maxSymbolValue, huffLog);
      |                                ^~~~~~~
../lib/compress/zstd_compress_superblock.c:137:42: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  137 |                         (HUF_CElt const*)prevHuf->CTable, countWksp, maxSymbolValue);
      |                                          ^~~~~~~
../lib/compress/zstd_compress_superblock.c: In function ‘ZSTD_compressSubBlock’:
../lib/compress/zstd_compress_superblock.c:553:74: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  553 |     {   size_t cLitSize = ZSTD_compressSubBlock_literal((const HUF_CElt*)entropy->huf.CTable,
      |                                                                          ^~~~~~~
../lib/compress/zstd_compress_superblock.c: In function ‘ZSTD_estimateSubBlockSize_literal’:
../lib/compress/zstd_compress_superblock.c:594:83: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
  594 |         {   size_t cLitSizeEstimate = HUF_estimateCompressedSize((const HUF_CElt*)huf->CTable, countWksp, maxSymbolValue);
      |

Expected behavior
No warnings

Desktop (please complete the following information):

  • Compiler gcc10
algitbot pushed a commit to alpinelinux/aports that referenced this issue Nov 9, 2020
add -fno-strict-aliasing so it builds with gcc 10.

upstream report: facebook/zstd#2204
@terrelln
Copy link
Contributor Author

Fixed by PR #2415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant