
     1  %begin
503 @ 4405:         LINE   1 "regression-compile-tmp/shiftprecbug.imp"
504 @ 4448:         BEGIN  _lev0id0 {lev=0 --> 1}

     2    %integer x
     3  
     4    ! The intention was this:
505 @ 4449:            LINE   2 "regression-compile-tmp/shiftprecbug.imp"
506 @ 4492:            DEF    X p1=V_0081 a/tf=11 b/format=1 c/ostate=0  type=1 (integer) form=1 (simple) special=0 (<special:0>) linkage=0 (auto) spec=0 indirect=0 unass=0

     5    x = (65 << 24) ! (76 << 16) ! (71 << 8) ! 3
     6    
     7    ! but the vax compiler contained this line:
     8    
507 @ 4505:            LINE   5 "regression-compile-tmp/shiftprecbug.imp"
508 @ 4548:            PUSH   X
509 @ 4551:            PUSHI  #0x00000041
510 @ 4556:            PUSHI  #0x00000018
511 @ 4561:            LSH   
512 @ 4562:            PUSHI  #0x0000004c
513 @ 4567:            PUSHI  #0x00000010
514 @ 4572:            LSH   
515 @ 4573:            OR    
516 @ 4574:            PUSHI  #0x00000047
517 @ 4579:            PUSHI  #0x00000008
518 @ 4584:            LSH   
519 @ 4585:            OR    
520 @ 4586:            PUSHI  #0x00000003
521 @ 4591:            OR    
522 @ 4592:            ASSVAL

     9    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  
523 @ 4593:            LINE   9 "regression-compile-tmp/shiftprecbug.imp"
524 @ 4636:            PUSH   X
525 @ 4639:            PUSHI  #0x00000003
526 @ 4644:            PUSHI  #0x00000047
527 @ 4649:            PUSHI  #0x00000008
528 @ 4654:            LSH   
529 @ 4655:            ADD   
530 @ 4656:            PUSHI  #0x0000004c
531 @ 4661:            PUSHI  #0x00000010
532 @ 4666:            LSH   
533 @ 4667:            ADD   
534 @ 4668:            PUSHI  #0x00000041
535 @ 4673:            PUSHI  #0x00000018
536 @ 4678:            LSH   
537 @ 4679:            ADD   
538 @ 4680:            ASSVAL

    20  %endofprogram
539 @ 4681:            LINE   20 "regression-compile-tmp/shiftprecbug.imp"
540 @ 4724:         END    _lev0id0 {lev=1 --> 0}
541 @ 4725:         END     {lev=0 --> -1}
542 @ 4726: 

