1. 47

  2. 4

    It might be because I spend a lot of time dealing with serialisation and deserialisation in C but I spotted this bug immediately. It’s surprising nobody else noticed this in 6 years. It’s also possible that this wasn’t noticed because most people who use GLFW will be using it for games which run full screen (and therefore setting an icon seems moot) but I’m not sure.

    1. 1

      Nobody experienced the bug though. The generated code without ubsan seems to do what you’d expect.

      1. 2

        What I mean is that for a seasoned C language lawyer, any instance of (foo << n) | (bar << m) is immediately alarming. I was surprised no language lawyer (and I don’t even think I would call myself a C language lawyer yet) had read the code until now since this jumped out at me as soon as I saw the first code snippet.

    2. 3

      tl;dr Use UBSan by default in debug builds.

      1. 1

        Interesting, is there any flag that can warn on int promotions being done?