Skip to content

read_f{4,8}{be,le}(): fix violations of strict aliasing rules - #73

Merged
GreyCat merged 2 commits into
masterfrom
fix-strict-aliasing-violations
Jun 3, 2024
Merged

read_f{4,8}{be,le}(): fix violations of strict aliasing rules#73
GreyCat merged 2 commits into
masterfrom
fix-strict-aliasing-violations

Conversation

@generalmimon

Copy link
Copy Markdown
Member

@generalmimon
generalmimon requested a review from GreyCat May 17, 2024 16:00

@GreyCat GreyCat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to add this one. Thanks for thorough research and implementation!

@GreyCat
GreyCat merged commit 2831b0e into master Jun 3, 2024
@GreyCat
GreyCat deleted the fix-strict-aliasing-violations branch June 3, 2024 13:07
@ZeroChaos-

Copy link
Copy Markdown

Kismet just pulled this update and it's still not working. Any chance you could take a look?

x86_64-pc-linux-gnu-g++ -std=gnu++20 -mtune=core2 -pipe -O3 -flto -frecord-gcc-switches -Wstringop-overread -Wformat -Wformat-security -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full  -Werror=odr -Werror=lto-type-mismatch -Werror=stringop-overread -Werror=format-security -march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=36864 -fPIE -pie -ggdb3  -Wall -Wno-deprecated-declarations -Wno-format-truncation -Wno-unused-local-typedefs -Wno-unused-function -Wno-infinite-recursion -g -I. -fPIE -mtune=core2 -pipe  -flto -frecord-gcc-switches -Wstringop-overread -Wformat -Wformat-security -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full -Werror=odr -Werror=lto-type-mismatch -Werror=stringop-overread -Werror=format-security -march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=36864 -fPIE -pie -ggdb3 -Werror=strict-aliasing  -DKS_STR_ENCODING_NONE -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/elogind   -c kaitaistream.cc -o kaitaistream.cc.o
kaitaistream.cc: In member function ‘float kaitai::kstream::read_f4be()’:
kaitaistream.cc:266:38: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  266 |     return reinterpret_cast<float &>(t);
      |                                      ^
kaitaistream.cc: In member function ‘double kaitai::kstream::read_f8be()’:
kaitaistream.cc:275:39: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  275 |     return reinterpret_cast<double &>(t);
      |                                       ^
kaitaistream.cc: In member function ‘float kaitai::kstream::read_f4le()’:
kaitaistream.cc:288:38: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  288 |     return reinterpret_cast<float &>(t);
      |                                      ^
kaitaistream.cc: In member function ‘double kaitai::kstream::read_f8le()’:
kaitaistream.cc:297:39: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  297 |     return reinterpret_cast<double &>(t);
      |

@ZeroChaos-

Copy link
Copy Markdown

Nevermind, apologies for the noise. There was an issue on import which is fixed now. Thanks for the fix!

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

Successfully merging this pull request may close these issues.

3 participants