Subject: compiler bugs (O2 making trouble)
To: None <port-macppc@netbsd.org>
From: paul beard <paulbeard@mac.com>
List: port-macppc
Date: 04/03/2002 19:57:45
Here's some excerpts from a conversation about making SANE work on
my olde worlde PPC.
>> > Setting the correct data length is another problem: sane-find-scanner
>> > uses a different length depending on wether the command line option "-v"
>> > is set or not set -- I suspect a compiler bug; removing "-O2" from
>> > CFLAGS helped.
>
>>
>> What compiler makes trouble with "-O2"?
>
>
> [...-backends/work/sane-backends-1.0.7/sanei]# gcc -v
> Using builtin specs.
> gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)> (PPC evrsion)
>
> It is really weird error. The following statements from
> scanner_do_inquiry in sane-find-scanner.c do not work properly.
>
> size = 36; /* patched; was 5 */
> set_inquiry_return_size (inquiry.cmd, size);
> sanei_scsi_cmd (sfd, inquiry.cmd, inquiry.size, buffer, &size);
>
> Some fprintf(stderr,...) statements in sanei_scsi_cmd2 show that byte 4
> of the cdb and the variable "size" have the _same_, but wrong, value,
> sometimes 5, sometimes 8, if the program is compiled with -O2. My
> conclusion is that "size = 36;" does not work properly -- for whichever
> reason... This may sound weird, but I don't see how else inquiry.cmd[4]
> and size could have the same wrong value.
--
Paul Beard
8040 27th Ave NE
Seattle WA 98115
206 529 8400
Murphy's Law is recursive. Washing your car to make it rain
doesn't work.