Subject: Re: What optimization causes this?
To: None <kpneal@pobox.com>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 01/16/2002 01:30:16
>I'm trying to get a package for neXtaw together. I've gotten to the
>point where it begins to compile, proceeds for a while, and then
>blows up like so:

>cc -DPACKAGE=\"neXtaw\" -DVERSION=\"0.10\" -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DNO_WIDEC_H=1 -DHAS_WCHAR_H=1 -DHAS_XMU_H=1 -DUSE_XWCHAR_STRING=1 -DHAVE_LIBXEXT=1 -DHAVE_LIBXMU=1 -I. -I. -DUSEGRAY -DNO_MENU_LINES -DNeedFunctionPrototypes -I../.. -I/usr/pkg/obj/x11/neXtaw/work/.buildlink/include -I/usr/pkg/share/x11-links/include -Wall -O -c  -fPIC -DPIC Scrollbar.c -o .libs/Scrollbar.lo
>Scrollbar.c: In function `RepeatNotify':
>Scrollbar.c:1004: warning: cast to pointer from integer of different size
>Scrollbar.c: In function `NotifyScroll':
>Scrollbar.c:1050: warning: cast to pointer from integer of different size

Some warnings can only be done when using the optimizer.
Which is probably why you don't see this when using -O0 or no -O.
Eg. for grins try

cc -O0 -Wuninitialized -Werror ....

FWIW the above sounds like a code bug, not an optimization issue.
Lots of code assumes that pointers are 32bit and can be passed around in an
int or long.  That won't work with 64bit pointers.

--sjg