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

            Bug ID: 129308
           Summary: wrong code at -O0: SHR minint fails an assertion
                    instead of producing zero
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: algol68
          Assignee: algol68 at gcc dot gnu.org
          Reporter: kyuwoncho18 at gmail dot com
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

begin
  bits x = BIN 1;
  assert (x SHR minint = 16r0)
end

godbolt: https://godbolt.org/z/b899Y5hb6

At -O2 the program exits successfully, while at -O0 it reports an assertion
failure and aborts. The GNU Algol 68 SHR semantics produce all-zero bits when
the shift magnitude exceeds the bits width, so the assertion must pass.

Reply via email to