I was trying to find a way to prove what the associativity (left or right) is for the + operation for a simple bison-generated integer calculator (gcc compiled on Linux). The only way I could think of was to force an overflow in one direction but not the other, e.g., Maxint + 1 + (-1). But the program simply wraps (mod) or crosses over to negative and back as necessary without error so left and right give same result. I tried using an intermediate variable declared as a signed int for the result and also gcc flags like ftrapv, fwrapv, and Wall, but nothing changed. Is there something simple I can do in my C-code to make a program crash or give a runtime warning on MAXINT+1 (2147483647+1)? Does bison generate code that suppresses all error output because I defined a yyerror function?

Similar questions and discussions