https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115536

            Bug ID: 115536
           Summary: Expression is evaluated incorrectly when encountering
                    relops and indirection
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: gaius at gcc dot gnu.org
  Target Milestone: ---

The following code fails with:

$ gm2 -g testcond2.mod
$ ./a.out
failed

MODULE condtest2 ;

FROM libc IMPORT printf, exit ;


PROCEDURE test (VAR a, b, c, d: CARDINAL) ;
BEGIN
   IF (a = b) # (c = d)
   THEN
      printf ("passed\n")
   ELSE
      printf ("failed\n") ;
      exit (1)
   END
END test ;


VAR
   e, f, g, h: CARDINAL ;
BEGIN
   e := 1 ;
   f := 2 ;
   g := 3 ;
   h := 3 ;
   test (e, f, g, h)
END condtest2.

Reply via email to