Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
GCC undefined behaviors are getting wild
(opens in new tab)
(blog.pkh.me)
9 points
ux
3y ago
3 comments
Save
Share
3 comments
3 comments · 3 top-level
top
newest
oldest
suprjami
3y ago
I really like the idea of decompiling ones' own code with Ghidra to see different ways the logic can be represented. Using `-Wextra` adds a warning about the signed\unsigned comparison, but Ghidra's `(ulong)(uint)` casts make that a bit clearer.
llimos
3y ago
This is a great writeup on what's possible with undefined behavior
https://devblogs.microsoft.com/oldnewthing/20140627-00/?p=63...
xeeeeeeeeeeenu
3y ago
If you want signed integer overflow to be defined, use the "-fwrapv" flag.
j
/
k
navigate · click thread line to collapse