Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Jun 2002 14:00:33 +0000
From:      henry tieman <henryt_NOSPAM@aracnet.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   gcc -O and xsane crash
Message-ID:  <3CFF6B01.3080500@aracnet.com>

next in thread | raw e-mail | index | archive | help
I found a compiler problem with optimizations in Xsane-0.85.  Gcc 
generates a test against an uninitialised variable in the function 
preview_autoselect_scanarea which can cause a memory overrun.  Turning 
off optimazations cures the problem.

The details are: the second loop in the function generates a stopping 
comparison of (x < y), y is a register variable, and not (x < 
p->image_width) like the source code says.   I used ddd's "Machine Code 
Window" to see this.  y is uninitialized at this point so the memory 
overrun seems to depend on the picture being scanned.

Since I have a workaround, I'm not too interested in solving this 
myself. I just thought it would be helpfull to other users to pass the 
information on.

I had a friend in collage that always complained the compiler was wrong 
and he was never right. So I really really hate to say it myself.

I should probably include I'm using FreeBSD 4.5  with
    gcc version 2.95.3 20010315 (release) [FreeBSD]

-- 
Henry Tieman
You may have to remove the _NOSPAM to reply to this message.
Objects in the mirror are closer than they appear.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CFF6B01.3080500>