Subject: Re: Optimizer bug in NetBSD/SPARC64 1.5?
To: None <port-sparc@NetBSD.ORG, port-sparc64@NetBSD.ORG>
From: Greg Earle <earle@isolar.DynDNS.ORG>
List: port-sparc
Date: 02/15/2001 11:24:43
> On Thu, Feb 15, 2001 at 01:32:48AM -0800, Greg Earle wrote:
>>
>> I found a problem with NMH 1.04 on my Ultra 5+. The "scan" program was
>> calling every message in all my folders "?4128":
> ...
>> cc -c -DHAVE_CONFIG_H -I.. -I. -I.. -O2 scansbr.c
> ...
>> ?4128 10/07 "MiNa hi<<helloooooooo ----------------------------
>>
>> This only happens if "CFLAGS" is "-O2".
>
> This sort of thing is *usually* a coding error, and *not* an optimizer
> bug. Things like uninitialized variables and returning a pointer to an
> automatic variable, for example, may appear to work if the compiler
> isn't as aggressive.
Interesting observation, but given that the same exact code compiled with -O2
on NetBSD/SPARC 1.4.2 works fine, and it didn't work when compiled with -O2 on
NetBSD/SPARC64 1.5, doesn't that shoot that theory? I suppose the optimizer
could've changed between egcs-2.91.60 19981201 (egcs-1.1.1 release) in 1.4.2
and the gcc-2.95.2 19991024 release in 1.5 ... but the NMH code appears to be
pretty much identical.
(Actually, I lied - I have NMH 1.03 on the 1.4.2 system, and I was building NMH
1.04 on the Ultra - but I suspect this "scan" code - which is crufty and has
been around since MH 6.8.x days, easily - hasn't changed much, if at all.)
Anyway, I got it work by not using "-O2", so I'm happy. Just thought it was
odd that only "-O2" caused the errant behavior.
[Followups set to port-sparc64 only]
- Greg