[sane-devel] xsane infinite loop lockup - seems to boil down to compiler optimisation difference

Oliver Rauch Oliver.Rauch at Rauch-Domain.DE
Wed Aug 8 08:38:25 UTC 2007


Am Dienstag, den 07.08.2007, 22:28 +1000 schrieb David Campbell:

> 
> This means that the current comparison "if (new_val != val)" in the 
> xsane_back_gtk_value_update() function in xsane-back-gtk.c is invalid, 
> because if there is the slightest difference in the floating point value 
> (and there can be if the compiler has decided to implement the code 
> optimally using processor registers), it will attempt to set the value 
> again, and I'm seeing an infinite looping happening there because it 
> never gets to the point where the values are the same!


if (new_val != val) ...

in general (and also in this case) is allowed.
Please note that val and new_val are not floating point numbers in this code, they have the type SANE_Word (= int).
So we have an integer comparison here.

Please could you add some debug output to xsame-back-gtk.c after these lines:

  xsane_back_gtk_set_option(opt_num, &val, SANE_ACTION_SET_VALUE);
  xsane_control_option(xsane.dev, opt_num, SANE_ACTION_GET_VALUE, &new_val, 0);
DBG(0, "val = %d, new_val = %d\n", val, new_val);

and send a little trace of it when the infinit loop occurs.


Best regards
Oliver




More information about the sane-devel mailing list