#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %begin
int main(int argc, char **argv) { /*%begin*/
_imp_initialise(argc, argv);
// 2 %integer x
int X;
// 3
// 4 ! The intention was this:
// 5 x = (65 << 24) ! (76 << 16) ! (71 << 8) ! 3
X = 65 << 24 | 76 << 16 | 71 << 8 | 3;
// 6
// 7 ! but the vax compiler contained this line:
// 8
// 9 x = ((3 + (71 << 8)) + 76 << 16) + 65 << 24
X = 3 + (71 << 8) + (76 << 16) + (65 << 24);
// 10
// 11 ! and C is complaining that the result does not fit in 32 bits.
// 12 ! So clearly, the precedence of shift vs add is wrong!
// 13
// 14 ! 5 Statements compiled
// 15 ! test/shiftprecbug.c: In function 'main':
// 16 ! test/shiftprecbug.c:17:39: warning: result of '1196359745 << 24' requires 56 bits to represent, but 'int' only has 32 bits [-Wshift-overflow=]
// 17 ! 17 | X = ((3 + (71 << 8)) + 76 << 16) + 65 << 24;
// 18 ! | ^~
// 19
// 20 %endofprogram
_imp_stop(0);
return 0;
end_0:;
}