Received: by smtp02.oce.nl (4.1/SMI-4.1)
	id AA04128; Thu, 25 Feb 99 15:31:17 +0100
Received: from gate7.olympiakos.com ([207.113.13.68])
	by oce.nl (8.9.0/8.9.0) with ESMTP id PAA23434;
	Thu, 25 Feb 1999 15:28:15 +0100 (MET)
Received: from localhost (bin@localhost)
	by gate7.olympiakos.com (8.8.7/8.8.7) with SMTP id IAA32562;
	Thu, 25 Feb 1999 08:58:14 -0500
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Thu, 25 Feb 1999 08:57:56 -0500
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.8.7/8.8.7) id IAA32549
	for tiff-outgoing; Thu, 25 Feb 1999 08:57:55 -0500
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from sgi.com (sgi.SGI.COM [192.48.153.1])
	by gate7.olympiakos.com (8.8.7/8.8.7) with ESMTP id IAA32546
	for <tiff@olympiakos.com>; Thu, 25 Feb 1999 08:57:51 -0500
Received: from ra.abo.fi (ra.abo.fi [130.232.213.1] (may be forged)) 
	by sgi.com (980327.SGI.8.8.8-aspam/980304.SGI-aspam:
       SGI does not authorize the use of its proprietary
       systems or networks for unsolicited or bulk email
       from the Internet.) 
	via ESMTP id FAA08198
	for <tiff@sgi.com>; Thu, 25 Feb 1999 05:57:48 -0800 (PST)
	mail_from (pnielsen@ra.abo.fi)
Received: from aton.abo.fi (pnielsen@aton.abo.fi [130.232.213.6])
	by ra.abo.fi (8.8.8/8.8.8) with ESMTP id PAA21882;
	Thu, 25 Feb 1999 15:57:36 +0200 (EET)
From: Peter Nielsen INF <pnielsen@ra.abo.fi>
Received: (from pnielsen@localhost)
	by aton.abo.fi (8.8.8/8.8.8) id PAA18460;
	Thu, 25 Feb 1999 15:57:36 +0200 (EET)
Message-Id: <199902251357.PAA18460@aton.abo.fi>
Subject: Re: Pb with LZW
To: tiff@sgi.com
Date: Thu, 25 Feb 1999 15:57:36 +0200 (EET)
Cc: bruno_ledoux@binuscan.com, ChrisL@mobiusg.com
In-Reply-To: <D1DFB211BB3ED111B01F00A0240D1555A2B600@mail.mobiusg.com> from "Chris Losinger" at Feb 25, 99 08:35:33 am
X-Mailer: ELM [version 2.4 PL23]
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Sender: owner-tiff@olympiakos.com

>From: Bruno Ledoux [mailto:bruno_ledoux@binuscan.com]
>>When I compile the tif_lzw.c file with default speed optimisation in
>>Visual C++5, I get strange colors when decompressing
>>TIFF LZW files. If I compile the tif_lzw.c file with all optimisation
>>off, things are working correctly !
>
>it's not your code. the same thing happens to me. VC5, and v34b37.

Hello Chris, Bruno, all,

The reason for this problem is most probably the sad fact that Microsoft 
VC++ does optimizations with the shift operator that violates the C/C++ 
standard. Here's a simple example (32-bit int assumed):

unsigned int int32bit = 1;
unsigned int shift = 33;
unsinged int result = int32bit << shift;

According to the C/C++ standard the result should be zero (0) if
all bits are shifted out.

Microsoft, on the other hand has redefined the standard and
the manual says that the result is "undefined" if all bits
are shifted out.

Solution: Use a better compiler that adheres to standards.

Best regards,
	Peter Nielsen


