Hacker Blogs
Work in progress: 15,409 of 181,233 sites checked so far, more every week · updated 2 Nov 2026Missing a blog? Tell us

Top all-time · #1451

K

Krister Walfridsson

Personal blog · kristerw.blogspot.comprogrammingsystems

Krister Walfridsson's personal blog at kristerw.blogspot.com covers programming and systems. Since 2015, 51 different Hacker News readers have linked it 91 times, most often “Why undefined behavior may call a never-called function”. The last post was in 2021, but the archive is still widely read.

Visit the blog
91mentions?
51HN people?
2015–2026first – last linked?
Links on Hacker News per year · peak 24 in 2017

Random thoughts on programming languages, compilers, operating systems, etc.

Most-linked posts?

  1. Why undefined behavior may call a never-called function
    14 people · 15 mentions · first linked 2017-09-04
  2. /2016/02/how-undefined-signed-overflow-enables.html
    6 people · 6 mentions · first linked 2016-11-28
  3. Useful GCC warning options not enabled by -Wall -Wextra
    5 people · 5 mentions · first linked 2017-09-17
  4. How LLVM Optimizes Geometric Sums
    4 people · 8 mentions · first linked 2019-04-28
  5. How LLVM Optimizes Power Sums
    3 people · 3 mentions · first linked 2022-10-27
  6. The structure of a GCC back end
    2 people · 2 mentions · first linked 2017-08-06
  7. Building GCC 1.27
    2 people · 2 mentions · first linked 2019-01-26
  8. Building GCC 1.27 (first GCC with x86 support) (2019)
    2 people · 2 mentions · first linked 2024-04-02
  9. The cost of conditional moves and branches
    2 people · 2 mentions · first linked 2017-03-05
  10. How undefined signed overflow enables optimizations in GCC
    2 people · 2 mentions · first linked 2016-02-21

What Hacker News says?

  1. > What does that even mean in the absence of a formal standard and competing compiler implementations? (Hint: nothing.) Undefined behaviour is stuff that you compiler's optimizers have been promised can never occur, so they are allowed to transform your code based on that assumption. Here's a post I made on Reddit in 2019 with a list of resources on what undefined behaviour is: https://www.reddit.com/r/rust/comments…

    Comment linking /2017/09/why-undefined-behavior-may-call-never.html

    on “An RFC that adds support for Rust to the Linux kernel”
  2. Submitted Useful GCC warning options not enabled by -Wall -Wextra as a story · 288 points

    HN discussion
  3. > That could literally produce no output program? Way worse than even that (you might be noticing a theme here...). Once the optimizer has removed as dead code any branch that, if taken, would provably lead to UB at some arbitrary future point of execution, it can conclude that the other branch is now the only possible execution, and call it unconditionally, even if that leads to removing all your files (the classic…

    Comment linking /2017/09/why-undefined-behavior-may-call-never.html

    on “Rust 1.45”
  4. Submitted Why undefined behavior may call a never-called function as a story · 139 points

    HN discussion
  5. > ANSI Common LISP lives up to that standard. There is only one version of the ANSI Common Lisp standard, so it is trivially compatible with itself. > C's versioning lives up to that standard. Then how do you explain this astonishing work of art? https://kristerw.blogspot.com/2016/07/code-behaving-differen...

    Comment linking /2016/07/code-behaving-differently-in-c90-c99.html

    on “Rust is mostly safety”
  6. Submitted Code behaving differently in C90, C99, C11, C++98, and C++11 as a story · 134 points

    HN discussion
  7. While I like a lot of what's in here, for (size_t i = 9; i <= 9; --i) is a pretty terrible example to put in the second chapter. I would not let that line pass code review. There is no need or place for cutesy cleverness in C. EDIT: Ugh, just found this too: isset[!!largeA[i]] += 1; Not only is that confusingly cutesy, but largeA[i] is a double . Please DON'T write – or encourage beginners to write! – such smug code…

    Comment linking /2016/02/how-undefined-signed-overflow-enables.html

    on “Modern C [pdf]”
  8. Submitted The structure of a GCC back end as a story · 104 points

    HN discussion
  9. LLVM can do more complex sums, too. See https://kristerw.blogspot.com/2019/04/how-llvm-optimizes-geo...

    Comment linking /2019/04/how-llvm-optimizes-geometric-sums.html

    on “You can't fool the optimizer”
  10. Submitted How undefined signed overflow enables optimizations in GCC as a story · 100 points

    HN discussion
  11. This explanation of why signed int overflow is undefined is interesting (although the behaviour is still very annoying): https://kristerw.blogspot.com/2016/02/how-undefined-signed-o... (HN discussion: https://news.ycombinator.com/item?id=11146384 ) More examples here: http://blog.llvm.org/2011/05/what-every-c-programmer-should-...

    Comment linking /2016/02/how-undefined-signed-overflow-enables.html

    on “Making memcpy(NULL, NULL, 0) well-defined”
  12. Submitted GCC code generation for C++ Weekly Ep 43 example as a story · 86 points

    HN discussion
  13. https://kristerw.blogspot.com/2016/02/how-undefined-signed-o...

    Comment linking /2016/02/how-undefined-signed-overflow-enables.html

    on “Rust: Not So Great For Codec Implementing”
  14. Submitted Interprocedural optimization in GCC as a story · 84 points

    HN discussion
  15. To reinforce this, I still believe C is one of the most elegant syntax's for a "portable assembler". There are many dark corners of C, take for example pointers: https://kristerw.blogspot.com/2016/03/c-pointers-are-not-har...

    Comment linking /2016/03/c-pointers-are-not-hardware-pointers.html

    on “The Resurgence of C Programming”
  16. Submitted Building GCC 1.27 (first GCC with x86 support) (2019) as a story · 76 points

    HN discussion
  17. > Everyone says that and they have no proof. Here's an entire blog post with proof: https://kristerw.blogspot.com/2016/02/how-undefined-signed-o...

    Comment linking /2016/02/how-undefined-signed-overflow-enables.html

    on “Nearly all binary searches and mergesorts are broken (2006)”
  18. Submitted Type-based aliasing in C as a story · 71 points

    HN discussion
  19. For some examples of the types of optimizations enabled by allowing overflow to be undefined: https://kristerw.blogspot.com/2016/02/how-undefined-signed-o...

    Comment linking /2016/02/how-undefined-signed-overflow-enables.html

    on “Signed Integers Are Two’s Complement”
  20. Submitted Watching for software inefficiencies with Valgrind as a story · 67 points

    HN discussion
  21. That particular behavior (and some other examples of pathological optimizer behavior) is probably an emergent property of how several optimizations combine as opposed to being a specifically targeted optimization. I can imagine something the optimizer doing something like: 1. Determine possible function call targets 2. Eliminate invalid targets from call set 3. If only one target remains, replace indirect call with…

    Comment linking /2017/09/follow-up-on-why-undefined-behavior-may.html

    on “One Word Broke C”
  22. Submitted Writing a GCC back end as a story · 58 points

    HN discussion
  23. It's C++, but UB allows the compiler to call a function the programmer never called https://kristerw.blogspot.com/2017/09/why-undefined-behavior... I'm not sure how any compiler writer can condone this behaviour.

    Comment linking /2017/09/why-undefined-behavior-may-call-never.html

    on “One Word Broke C”
  24. Submitted More Turing-completeness in surprising places as a story · 48 points

    HN discussion
  25. > Setting aside the question of what exactly "undefined behavior" means, why does a language spec have to include it? If there is behavior that cannot be defined, why not just omit it from the standard? The original reason was that there were things they didn't want to define. For example, signed integer overflow works differently on different hardware architectures. If they defined one behavior in the standard then…

    Comment linking /2016/02/how-undefined-signed-overflow-enables.html

    on “Security flaws caused by compiler optimizations”
  26. Submitted C pointers are not hardware pointers as a story · 45 points

    HN discussion
  27. No, it is very generic. See https://kristerw.blogspot.com/2019/04/how-llvm-optimizes-geo... , https://blog.matthieud.me/2020/exploring-clang-llvm-optimiza... (discussed at https://news.ycombinator.com/item?id=28207207 ) (I remember reading a page with more examples, but cannot find it)

    Comment linking /2019/04/how-llvm-optimizes-geometric-sums.html

    on “In C++, is empty() faster than comparing the size with zero?”
  28. Submitted Why volatile is hard to specify and implement as a story · 38 points

    HN discussion
  29. Yeah. Here's a GCC developer experimenting with a 31-year old GCC version on a modern system (the first one with x86 support): >It is amazing how well things work – the modern assembler, linker, and debugger handles the code generated by GCC 1.27 without any problems. https://kristerw.blogspot.com/2019/01/building-gcc-127.html And the write-up he based his experiments upon: https://miyuki.github.io/2017/10/04/gcc-ar…

    Comment linking /2019/01/building-gcc-127.html

    on “IT professionals should work in a mainframe environment at some point (2015)”
  30. Submitted Instruction-less computation as a story · 28 points

    HN discussion

Search all of HN for kristerw.blogspot.com

Linked by the same people?