[sane-devel] C undefined operations in sane-backends-1.0.7-beta1

Henning Meier-Geinitz henning@meier-geinitz.de
Wed, 23 Jan 2002 21:43:35 +0100


Hi,

On Wed, Jan 23, 2002 at 09:55:55AM +0000, Tim Waugh wrote:
> I get these warnings when compiling sane-backends-1.0.7-beta1. 

This is with gcc-3.x? I don't get them with gcc 2.95.4.

> They
> are for things like:
> 
> 	bit = ++bit % 8;
> 
> which are indeed undefined.

Because it's not clear if bit should be incremented and then the right
side assigned to it or vice versa? Or what's the excat problem?

> mustek.c:4574: warning: operation on `ptr' may be undefined
> mustek.c:4584: warning: operation on `ptr' may be undefined

I have splitted the code into two lines.

> mustek_usb.c:1294: warning: operation on `status' may be undefined

Different bug. This was something like "status = status =
somefunction()".

Both are fixed in CVS.

Thanks,
  Henning