Some problems on Solaris

Jim Seymour jseymour at jimsun.LinxNet.com
Mon Feb 15 21:08:19 CET 1999


> Date: Mon, 15 Feb 1999 13:39:04 +0100 (MET)
> Message-ID: <Pine.UW2.3.95.990215133102.17224B-100000 at bryggen.bgnett.no>
> From: Johan Ur Riise <riise at bgnett.no>
> Subject: Re: Some problems on Solaris
> 
> re.: bus error, pointer misalignment...
> On Linux, improperly aligned accesses are fixed in the kernel.
> gcc has an option -Wcast-align, maybe that one will point to
> the problem when you compile on Solaris.
> Just an idea.

And maybe a good one.  Thanks.  Heh.  I *used* to be a good software 
designer.  Now I don't even remember the common causes of bus errors.
(SysAdmin'ing for a few years is obviously Not Good for ones mental
sharpness.)

Here's what happened when I added that option...

------------------------- begin included text --------------------------

loadmsgcat.c: In function `_nl_load_domain':
loadmsgcat.c:107: warning: cast increases required alignment of target type
loadmsgcat.c:182: warning: cast increases required alignment of target type
loadmsgcat.c:184: warning: cast increases required alignment of target type
loadmsgcat.c:187: warning: cast increases required alignment of target type

secmem.c: In function `secmem_realloc':
secmem.c:301: warning: cast increases required alignment of target type

secmem.c: In function `secmem_free':
secmem.c:322: warning: cast increases required alignment of target type

iobuf.c: In function `file_filter':
iobuf.c:126: warning: cast increases required alignment of target type

iobuf.c: In function `block_filter':
iobuf.c:349: warning: cast increases required alignment of target type

http.c: In function `connect_server':
http.c:643: warning: cast increases required alignment of target type

md5.c: In function `md5_final':
md5.c:315: warning: cast increases required alignment of target type
md5.c:316: warning: cast increases required alignment of target type
md5.c:323: warning: cast increases required alignment of target type
md5.c:324: warning: cast increases required alignment of target type
md5.c:325: warning: cast increases required alignment of target type
md5.c:326: warning: cast increases required alignment of target type

random.c: In function `read_pool':
random.c:268: warning: cast increases required alignment of target type
random.c:268: warning: cast increases required alignment of target type
random.c:281: warning: cast increases required alignment of target type
random.c:281: warning: cast increases required alignment of target type

rmd160.c: In function `rmd160_mixblock':
rmd160.c:456: warning: cast increases required alignment of target type
rmd160.c:457: warning: cast increases required alignment of target type
rmd160.c:458: warning: cast increases required alignment of target type
rmd160.c:459: warning: cast increases required alignment of target type
rmd160.c:460: warning: cast increases required alignment of target type

sha1.c: In function `sha1_final':
sha1.c:313: warning: cast increases required alignment of target type
sha1.c:314: warning: cast increases required alignment of target type
sha1.c:315: warning: cast increases required alignment of target type
sha1.c:316: warning: cast increases required alignment of target type
sha1.c:317: warning: cast increases required alignment of target type

./tiger.c: In function `tiger_final':
./tiger.c:853: warning: cast increases required alignment of target type
./tiger.c:854: warning: cast increases required alignment of target type
./tiger.c:855: warning: cast increases required alignment of target type

compress.c: In function `compress_filter':
compress.c:251: warning: cast increases required alignment of target type

armor.c: In function `armor_filter':
armor.c:1011: warning: cast increases required alignment of target type

mdfilter.c: In function `md_filter':
mdfilter.c:63: warning: cast increases required alignment of target type

textfilter.c: In function `text_filter':
textfilter.c:205: warning: cast increases required alignment of target type

cipher.c: In function `cipher_filter':
cipher.c:101: warning: cast increases required alignment of target type

hkp.c: In function `urlencode_filter':
hkp.c:178: warning: cast increases required alignment of target type

encr-data.c: In function `decode_filter':
encr-data.c:133: warning: cast increases required alignment of target type

encode.c: In function `encrypt_filter':
encode.c:361: warning: cast increases required alignment of target type

-------------------------- end included text ---------------------------


I might note that there are other warnings, as well.  Some that might
be of concern:

------------------------- begin included text --------------------------

dcgettext.c:399: warning: `act' might be used uninitialized in this function
dotlock.c:69: warning: int format, pid_t arg (arg 3)
dotlock.c:94: warning: int format, pid_t arg (arg 6)
/usr/include/arpa/inet.h:46: warning: `struct in_addr' declared inside parameter list
/usr/include/arpa/inet.h:46: warning: its scope is only this definition or declaration,
/usr/include/arpa/inet.h:46: warning: which is probably not what you want.
/usr/include/arpa/inet.h:46: warning: parameter has incomplete type
/usr/include/arpa/inet.h:49: warning: parameter has incomplete type
/usr/include/arpa/inet.h:50: warning: parameter has incomplete type
rndunix.c:347: warning: implicit declaration of function `kill'
rndunix.c:488: warning: suggest explicit braces to avoid ambiguous `else'
rndunix.c:615: warning: implicit declaration of function `signal'
keyedit.c:1344: warning: suggest explicit braces to avoid ambiguous `else'
keyedit.c:1391: warning: suggest explicit braces to avoid ambiguous `else'

-------------------------- end included text ---------------------------

The "implicit declaration' warnings may not be an issue.  Would have to
examine them.

The only reason I didn't bother mentioning these previously is that the
other issues seemed far more critical.

There are also quite a few "warning: subscript has type `char'".  Why
does the compiler regard that as a potential problem?  Signed chars,
perhaps?  Thus a (greater?) potential for a negative array index?

After having been badly burned by ignoring what appeared to be
innocuous warning messages once-upon-a-time, I don't do that any more!
(Btw: I usually follow gcc's recommendations regarding the "explicit
braces" suggestions.  Sometimes they're kind of silly, but at least
it removes all doubt.  And the warning messages.  [Hint, hint :-).])


Regards,
Jim
-- 
Jim Seymour                  | PGP Public Key available at:
jseymour at jimsun.LinxNet.com  | http://www.uk.pgp.net/pgpnet/pks-commands.html
http://home.msen.com/~jimsun | http://www.trustcenter.de/cgi-bin/SearchCert.cgi




More information about the Gnupg-devel mailing list