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

"Frank D. Cringle" (fdc@cliwe.ping.de)
Thu, 30 May 1996 13:25:53 +0200


Michael Staats <michael@thp.uni-duisburg.de> writes:
>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.

Free software roolz!

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

Big business tries harder.

>	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)

change to:

    if (verbose) printf("\tmemused = %lu\n", (unsigned long) Memused);

>viewfax.c: In function `usleep':
>viewfax.c:385: warning: implicit declaration of function `select'

select() gets declared via <sys/types.h> on Solaris.
grep /usr/include/* /usr/include/sys/* ...

>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

I claim that the condition `might' can't happen.  Anyway, if it did
there would be garbage on the screen rather than a crash.

>	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

That's true.  It should be initialised to NULL (only affects an error path).

>faxinput.c:117: warning: `rowsperstrip' might be used uninitialized in this function

That's true too.  The code might fail on a broken tiff file.

> [ ... ]

>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.

" *** GCC 2.7.1 with Bounds Checking: Version 1.0 released ***
"  
" The latest version of the patches that give full fine-grained bounds
" checking to GCC have been released and are available from:
"  
" 	  ftp://dse.doc.ic.ac.uk/pub/misc/bcc
"  
" Please read the latest README file in that directory which will tell
" you how to install and compile the patches. There are also binary
" distributions for the following machines:
"  
" 	  i486-unknown-linux (ELF only)
"  
" For more information, there are WWW pages for this software:
"  
" 	  http://www-dse.doc.ic.ac.uk/~rj3/bounds-checking.html
" 	  http://www-ala.doc.ic.ac.uk/~phjk/BoundsChecking.html
"  
" Richard W.M. Jones <rwmj@doc.ic.ac.uk>

I applied the 2.7.1 patches to gcc-2.7.2 without problems (as far as I
recall) and I am running the resulting binary as my standard
compiler.  It only adds the bound-checking stuff if you request it
with the -fbounds-checking option.  I have not visited the site
recently, so maybe there is a newer version.

-- 
Frank Cringle                      | fdc@cliwe.ping.de
voice + fax                        | +49 2304 467101