seg fault with viewfax under AIX (when pressing 'u')

Michael Staats (michael@thp.uni-duisburg.de)
Thu, 30 May 1996 10:19:46 +0200



Hello,

On Wed, 29 May 1996, Frank D. Cringle wrote:

> Michael Staats <michael@thp.uni-duisburg.de> writes:
> 
> [I see that the original message already answers some of the questions
>  raised in my reaction to Gert's reply.  That man is just too quick ;]
> 
> >If I compile with -g everything works fine (as usual :-).
> 
>   Doctor, doctor!  It dumps core if I compile without -g.
>   So don't do that.
> 
> No, I do not find that a satisfactory answer either.
> 
> FreeImage() calls XDestroyImage(), so I guess I can claim that the bug
> is in the AIX xlib.

That would really surprise me since I didn't compile the xlib
with/without -g :-)

Seriously, I have just checked the following things:

Use "cc -O" to compile: Memory fault (core dumped)

Use "cc -O3" to compile: Illegal instruction (core dumped)

Use "cc" (no -g or -O): No Seg fault.

Use "gcc -O" (gcc 2.7.2) to compile: No seg fault.

Use "gcc -O3" (gcc 2.7.2) to compile: No seg fault.

Use "xlC -O" (IBM C++ Compiler in C mode: newer and better than
standard cc): No seg fault.

Use "xlC -O3": No seg fault.

So, after all it seems that perhaps this is not a problem of viewfax
but of the C Compiler (sorry Gert :-). Strange. The version of cc we
use (1.3.0.15) appeared very stable and sufficiently "bug-free" (after
some bug fixes, the first version 1.3.0.0 was really bad).

On the other hand "gcc -Wall -ansi -pedantic" gives the following
warnings:

	gcc -Wall -pedantic -ansi -O -g      -DSYSV -DAIXV3   -DHELPFILE=\"/usr/local/lib/viewfax.tif\" -c viewfax.c
viewfax.c: In function `GetImage':
viewfax.c:373: warning: int format, long int arg (arg 2)
viewfax.c: In function `usleep':
viewfax.c:385: warning: implicit declaration of function `select'
viewfax.c: In function `RotImage':
viewfax.c:1233: warning: `d0' might be used uninitialized in this function
viewfax.c:1253: warning: `d0' might be used uninitialized in this function
viewfax.c:1253: warning: `d1' might be used uninitialized in this function
viewfax.c:1253: warning: `d2' might be used uninitialized in this function
viewfax.c:1253: warning: `d3' might be used uninitialized in this function
viewfax.c:1297: warning: `d0' might be used uninitialized in this function
	gcc -Wall -pedantic -ansi -O -g      -DSYSV -DAIXV3   -DHELPFILE=\"/usr/local/lib/viewfax.tif\" -c faxinput.c
faxinput.c: In function `notetiff':
faxinput.c:107: warning: `dir' might be used uninitialized in this function
faxinput.c:117: warning: `rowsperstrip' might be used uninitialized in this function
	gcc -Wall -pedantic -ansi -O -g      -DSYSV -DAIXV3   -DHELPFILE=\"/usr/local/lib/viewfax.tif\" -c faxinit.c
	gcc -Wall -pedantic -ansi -O -g      -DSYSV -DAIXV3   -DHELPFILE=\"/usr/local/lib/viewfax.tif\" -c faxexpand.c
	rm -f viewfax
	gcc -Wall -pedantic -ansi -o viewfax viewfax.o faxinput.o faxinit.o faxexpand.o -O -g    -lXext -lX11  -bnodelcsect


The warnings about uninitialized variables in "RotImage" seem
suspicious in this case.

> Is the bug specific to particular fax images or
> does it always happen (with the help page, for instance)?

When the bug occurs, it occurs with all pages.

> Do you have
> a tool like purify or the bound-checking version of gcc installed?

No sorry. What is the bound-checking version of gcc? We recently
upgraded from gcc 2.4.? to 2.7.2. I could not find an option for
bound-checking.

Thanks for answering,
	Michael

-- 
Michael Staats, Theoretical Physics, Uni-GH Duisburg 
email: michael@thp.Uni-Duisburg.DE
<a href="http://WWW.thp.Uni-Duisburg.DE/">The THP homepage!</a>