Re: failure due to compiler ?

agriff@ix.netcom.com (Andrea Griffini)
23 Jul 1996 23:26:48 -0400

          From comp.compilers

Related articles
Re: failure due to compiler? kanze@lts.sel.alcatel.de (1996-07-04)
Re: failure due to compiler? dave_sc@csl.sri.com (1996-07-15)
Re: failure due to compiler? rfg@monkeys.com (1996-07-22)
Re: failure due to compiler ? agriff@ix.netcom.com (1996-07-23)
| List of all articles for this month |

From: agriff@ix.netcom.com (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;


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


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
    Andrea Griffini \ agriff@ix.netcom.com
          programmer \ http://www.netcom.com/~agriff
--


Post a followup to this message

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