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

            Bug ID: 124028
           Summary: Bit shift with shift amount as a variable still
                    broken-ga68 (GCC) 16.0.1 20260208 (experimental)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: algol68
          Assignee: algol68 at gcc dot gnu.org
          Reporter: jpl.algol68 at gmail dot com
  Target Milestone: ---

I have seen bug 123959 with status as resolved, but I believe this shows an
issue remains.  The erroneous output of "k" changes at each running.


access Transput
begin
proc printbits = (int x) void:
   begin
     bits b := Bin(x);
     for i from 31 by -1 to 0 do
         ( b TEST 31 | puts(("1")) | puts(("0")));
         ( i Mod 4 = 0 | puts((" ")));
         b := b Shl 1
     od
   end;

   int i := 12;
   int shft := 2;

   int j := Abs(Bin(i) Shl 2);
   int k := Abs(Bin(i) Shl shft);

   puts(("i: " + whole(i, 10) + "  "));
   printbits(i);
   puts(("'n"));

   puts(("shifted using literal: 'n"));
   puts(("j: " + whole(j, 10) + "  "));
   printbits(j);
   puts(("'n"));

   puts(("shifted using variable: 'n"));
   puts(("k: " + whole(k, 15) + "  "));
   printbits(k);
   puts(("'n"))

end

Reply via email to