But if there's something I'm sick of it's that stupid "well the spec says it's UB so let's just write code that FUCKS THE DEV as hard as possible." attitude in certain circles regarding a one letter programming language.
The code in question is a classic array lookup with missing bounds check. If you write code like that and then blame people for using it wrong because the spec says so, you're just as arrogant, just in a different way.
The function that they were calling can be summarized as, "check to see if a value is in a set," only to receive an initially inexplicable segfault. They had a clear example of what that could look like, someone else's code from a common library, yet spent a considerable amount of time untangling the code in the library where the bug popped up.
It is wrong to assume incompetence on the part of the glibc authors, particularly when the comparison library has a much more limited scope and can afford to avoid "bullshit code", but the source of the frustration is clear. I would hardly define them as an arrogant prick because of that.
My opinion is that there is only one excuse for writing so unreadable code for such simple functionality (even taking account the legacy): that would be to use a language completely unfit for the task. That should not be the case here ... or is it? Why so many macros?
I've written tons and tons of software for Linux, and I believe only once have I seen a bug in glibc[1].
[1] And it was both a horrible bug, and also an extremely weird corner case: https://bugzilla.redhat.com/show_bug.cgi?id=563103#c8
Tangent: surprises me how often comment people lose their shit when you utter the slightest word of criticism about some pet {language,code, tech}, but are absolutely fine, supportive and enabling when someone verbally eviscerates the living shit out of another human based on what they said, or their opinion.
How is attacking a non human idea and no one in particular bad, but attacking a specific person viciously ok? I don't get that and I never did.
Well it's not an absolute, is it? There's context. Some specific people deserve to be attacked.
When you encounter other peoples' code and it looks a bit complicated, and not the 'obvious and simple' thing, your first thought should never be 'they wrote bullshit code', but instead 'what have I missed? What did I forget to consider for this function?'
I don't know anything about the glibc authors, or their code style, but if you go through your life assuming incompetence if someone wrote a function differently to your initial thoughts, then you are an arrogant prick.