Re: compiling problem with egcs-1.03a

David Mosberger-Tang (David.Mosberger@acm.org)
Sun, 22 Nov 1998 09:48:51 -0800

>>>>> On Sun, 22 Nov 1998 15:24:27 +0100 (CET), Georg Huettenegger <georg@mondoshawan.unix.cslab.tuwien.ac.at> said:

Georg> hi everybody, i downloaded the new sane-1.00 and it does not
Georg> compile with my egcs-1.03a (from the redhat 5.2) on an intel
Georg> linux machine with the following message: egcs -c -g -O2
Georg> -Wall -DHAVE_CONFIG_H -I. -I. -I../include -I../include
Georg> -D_GNU_SOURCE -DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
Georg> -DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=1 -DV_MINOR=0
Georg> -DBACKEND_NAME=abaton -DLIBDIR=/usr/local/lib/sane -fPIC
Georg> -DPIC abaton.c abaton.c: In function
Georg> `sane_abaton_control_option': abaton.c:1116: incompatible
Georg> types in assignment make: *** [abaton.lo] Error 1

Georg> i fixed the problem by using the gcc-2.7.2.3 but i think
Georg> either egcs or sane should have a real problem with this
Georg> backend. perhaps somebody would like to investigate this
Georg> (which is not nice for 1.00).

Here's a trivial fix (I'm guessing that it'll fix the problem):

--- backend/abaton.c~ Sat Nov 21 18:54:14 1998
+++ backend/abaton.c Sun Nov 22 09:42:23 1998
@@ -1113,7 +1113,7 @@

case OPT_Y_RESOLUTION:
if (s->val[OPT_PREVIEW].w || s->val[OPT_RESOLUTION_BIND].w) {
- s->val[OPT_X_RESOLUTION] = *(SANE_Word *)val;
+ s->val[OPT_X_RESOLUTION].w = *(SANE_Word *)val;
if (info)
*info |= SANE_INFO_RELOAD_OPTIONS;
}

However, I think the real bug may be in egcs-1.03a. I thought ANSI C
allows such assignments to the first member of a union (or is this
supposed to be allowed for union initialization only?).

--david

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com