🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Staale L. Hansen Tue, 03 Dec 1996 00:00
long long bug?
#6115
Author: Staale L. Hansen
Date: Tue, 03 Dec 1996 00:00
18 lines
1339 bytes
In a loop reading data from disk I have a global counter of type
"long long", which is incremented by the number of bytes read.
The counter increases normally for a while, but suddenly it jumps
to a gigantic number (~120E12).
If I change the variable type to "long", or make it volatile, this
does not happen.

The code is too long to post here, but it is compiled with gcc 2.7.2.1
on Solaris x86 (Pentium) 2.5, with no optimization

Has anyone else seen this? Are there any known bugs with "long long"'s?

-- 
Staale L. Hansen, M.Sc.       | Spacetec A.S, Prestvannv. 38,
Software Engineer             | N-9005 Tromsoe, Norway
EMail: staale@spacetec.no     | Phone: +47 77 66 08 00
WWW:   http://www.spacetec.no | Fax:   +47 77 65 58 59
Re: long long bug?
#6122
Author: Pavel Pokorny
Date: Thu, 05 Dec 1996 00:00
32 lines
1987 bytes
Staale L. Hansen (staale@spacetec.no) wrote:
: In a loop reading data from disk I have a global counter of type
: "long long", which is incremented by the number of bytes read.
: The counter increases normally for a while, but suddenly it jumps
: to a gigantic number (~120E12).
: If I change the variable type to "long", or make it volatile, this
: does not happen.

: The code is too long to post here, but it is compiled with gcc 2.7.2.1
: on Solaris x86 (Pentium) 2.5, with no optimization

: Has anyone else seen this? Are there any known bugs with "long long"'s?

: -- 
: Staale L. Hansen, M.Sc.       | Spacetec A.S, Prestvannv. 38,
: Software Engineer             | N-9005 Tromsoe, Norway
: EMail: staale@spacetec.no     | Phone: +47 77 66 08 00
: WWW:   http://www.spacetec.no | Fax:   +47 77 65 58 59

One explanation could be:
some other part of you program writes incorrestly to a certain 
portion of memory. If you counter is of type long double,
it occupies this portion of memory and is thus changed,
while if your counter is of type long it does not occupy
this memory and thus is not changed. :-)

 Pavel POKORNY                                   phone: +42 2 24 35 50 33    
 Department of Mathematics                              +42 2 24 35 30 96    
 Prague Institute of Chemical Technology         fax:   +42 2 34 27 63
 Technicka 5
 166 28 Prague, Czech Republic             e-mail: Pavel.Pokorny@vscht.cz 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads