🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #52655

[SOLVED] Re: INN 2.2.2 -> 2.3.3 behavior differences

#52655
From: Stephen L. Ulmer
Date: Fri, 01 Jun 2001 20:33
59 lines
3506 bytes
 "nomailguy" == those who know me have no need of my name
             <not-a-real-address@usa.net> writes:

  nomailguy> i see that the one i quoted is a cnfs token for class 3
  nomailguy> in BUF100 at offset 0.

  nomailguy> what appears to be the problem is that the offsets of all
  nomailguy> the tokens you posted are 0.  i don't know what would
  nomailguy> cause this, but it's definitely borked.


This was actually a compiler bug in gcc 2.95.2, I'm building gcc
2.95.3 to see if the gcc bug has been fixed.

The problem arises from '-O2' optimization of this function:

,----[ from cnfs.c ]
| STATIC TOKEN CNFSMakeToken(char *cycbuffname, CYCBUFF_OFF_T offset,
|              U_INT32_T cycnum, STORAGECLASS class, TOKEN *oldtoken) {
|     TOKEN               token;
|     INT32_T             int32;
|     INT32_T             foo;
| 
|     if (oldtoken == (TOKEN *)NULL)
|         memset(&token, '\0', sizeof(token));
|     else
|         memcpy(&token, oldtoken, sizeof(token));
|     /*
|     ** XXX We'll assume that TOKENSIZE is 16 bytes and that we divvy it
|     ** up as: 8 bytes for cycbuffname, 4 bytes for offset, 4 bytes
|     ** for cycnum.  See also: CNFSBreakToken() for hard-coded constants.
|     */
|     token.type = TOKEN_CNFS;
|     token.class = class;
|     memcpy(token.token, cycbuffname, CNFSMAXCYCBUFFNAME);
|     int32 = htonl(offset / CNFS_BLOCKSIZE);
|     memcpy(&token.token[8], &int32, sizeof(int32));
|     int32 = htonl(cycnum);
|     memcpy(&token.token[12], &int32, sizeof(int32));
|     return token;
| }
`----

The variable 'int32' is only ever referenced by address, the (broken)
optimizer took out the assignments...

If I modify this to _use_ 'int32' (pass it to a function, say syslog())
the problem goes away.  If I compile this file without optimizations,
the problem goes away.

Regards,

-- 
Stephen L. Ulmer                              ulmer@nersp.nerdc.ufl.edu
Senior Systems Programmer                         http://www.ulmer.org/
Northeast Regional Data Center                      VOX: (352) 392-2061
University of Florida                               FAX: (352) 392-9440
Technical Details
Message-ID: <wjh8zjc0x06.fsf@spnode33.nerdc.ufl.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeeds.nerdc.ufl.edu!not-for-mail
References: <wjhwv70qhjm.fsf@spnode33.nerdc.ufl.edu> <th7kengijs2tea@news.supernews.com> <wjhelt8qcac.fsf@spnode33.nerdc.ufl.edu> <9f124601dgc@enews4.newsguy.com>

Show Full Headers
Complete Article Headers
Message-ID: <wjh8zjc0x06.fsf@spnode33.nerdc.ufl.edu>
Subject: [SOLVED] Re: INN 2.2.2 -> 2.3.3 behavior differences
Date: Fri, 01 Jun 2001 20:33:07 +0000
From: "Stephen L. Ulmer" <ulmer@ufl.edu>
References: <wjhwv70qhjm.fsf@spnode33.nerdc.ufl.edu> <th7kengijs2tea@news.supernews.com> <wjhelt8qcac.fsf@spnode33.nerdc.ufl.edu> <9f124601dgc@enews4.newsguy.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeeds.nerdc.ufl.edu!not-for-mail
Newsgroups: news.software.nntp
Organization: Open Systems Group, NERDC, UF
Lines: 58
Reply-To: "Stephen L. Ulmer" <ulmer@ufl.edu>
NNTP-Posting-Host: spnode33.nerdc.ufl.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: spnode25.nerdc.ufl.edu 991427587 267946 128.227.174.33 (1 Jun 2001 20:33:07 GMT)
X-Complaints-To: abuse@ufl.edu
NNTP-Posting-Date: 1 Jun 2001 20:33:07 GMT
Keywords: token,int32,nomailguy,sizeof,problem,offset,memcpy,cnfs
X-Home-Page: http://www.ulmer.org/
User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Cuyahoga Valley)