Re: failure due to compiler ? (Andrea Griffini)
23 Jul 1996 23:26:48 -0400

          From comp.compilers

Related articles
Re: failure due to compiler? (1996-07-04)
Re: failure due to compiler? (1996-07-15)
Re: failure due to compiler? (1996-07-22)
Re: failure due to compiler ? (1996-07-23)
| List of all articles for this month |

From: (Andrea Griffini)
Newsgroups: comp.compilers
Date: 23 Jul 1996 23:26:48 -0400
Organization: Compilers Central
References: 96-07-041 96-07-100 96-07-148
Keywords: Pascal, errors

Using Borland Pascal 7.0 on the PC i ran into a very strange problem
in a compression program; after debugging at the assembler level into
the runtime libraries i found a bug in the shift operator on long
(32 bit) integers.

    var a:longint;

        a:=$12345; (* hexadecimal constant *)
        writeln(a shr 24) (* this prints 256 instead of 0 *)

The problem appears only if a 386 or newer processor is found and is
due to a non-supported (wrong?) use of the double-shift instruction (a
shift with a counter bigger than the destination).

Try to guess how many things i dobule checked in my LZW program before
suspecting the shift operator ... :)

    Andrea Griffini \
          programmer \

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.