oiskuu.c(11): error #12192: unreachable statement oiskuu.c(13): error #12254: Buffer overflow: index is outside the bounds for arr ay "" which is passed as actual argument 1 to "comparative_truth" at (file:oisku u.c line:24); array "" of size (0:0) is indexed by value 1
oiskuu.c: In function `main': oiskuu.c:25: warning: control reaches end of non-void function
I don't know any compiler which suppresses syntax checking on account of your pragma.
I get the same result (no output) with both gcc and icc. I suppose one could argue you have enough undefined behavior to get any result you choose. I don't see how you can argue about the result of the comparison, but I'll avoid further discussion of that.
Tim, please do point out the cause of undefined behaviour. You can omit the #pragma and pass -inline-level=1 (or -O1) as flags, and you may add return to main(), those should not change the outcome. After that, it looks like a strictly conforming program to me, but maybe I'm just not seeing something??
Edit: make sure you test it on x86_64, on x86 it won't trigger.
Yes, this is strange. The 64-bit compiler appears to be using, in effect, (long int) where you have (unsigned), when optimization is on. So it is converting to 64-bit signed integers, rather than observing (unsigned), while (unsigned long int) works as you apparently expect.
I'll look into it and see if we're doing something wrong. To be clear, what you're concerned about is the comparison of the two ints (a & b) that are cast to be unsigned, right? The stuff about inlining, opts and string lengths doesn't really pertain to that issue, correct? Let me know if I've missed something, in the meantime I'll try to figure out what's going on and whether it's a bug or a feature :-)