On Tue, Dec 15, 2009 at 1:46 AM, John Denker <[email protected]> wrote:
> Status summary:
>
> 0) I merged in Jester's nan-fixes. That was easy:
> git remote add -t nan-fixes jester
> git://gitorious.org/~jester/fg/jesters-clone.git
> git pull jester
> make
We want GIT! We want GIT! :D
> 1) If I want to get anything done, I cannot --enable-fpe
> because that leads to an early FP exception, while the
> splash screen is still up.
That may be the nasal bug Jacob is seeing. I could reproduce it and
also made a little test case that I am gonna submit as a gcc bug
report. It is clearly accessing the "double" member of the union
before it has been established as valid. I have adjusted the
workaround I had posted earlier so that the bug is no longer triggered
for me. (See attachment) Also, compiling with -O3 makes it go away
here.
> 2) It is still easy to get SEGVs or ABORTs (due to
> corrupt double-linked lists) when exiting from the
> sim. Some logs including tracebacks are here
> http://www.av8n.com/fly/fgfs//corrupt--21540.log
> http://www.av8n.com/fly/fgfs//corrupt--21628.log
>
> This appears to be about 90% reproducible chez moi.
> It is at least as likely to happen after after a
> short (30 second) simulator run as after a long
> (90 minute) one.
I can confirm this as well. I have already reported two potential
issues that need to be investigated (based on valgrind reports).
Also, Tat has started a cvs bisect: so far he has bracketed the
problem between 1st of october and 1st of november, I think.
--
Csaba/Jester
diff --git a/simgear/nasal/hash.c b/simgear/nasal/hash.c
index 1efe8fb..f9683ee 100644
--- a/simgear/nasal/hash.c
+++ b/simgear/nasal/hash.c
@@ -62,28 +62,28 @@ static unsigned int refhash(naRef key)
}
}
-static int equal(naRef a, naRef b)
+static int equal(const naRef* a, const naRef* b)
{
- if(IS_NUM(a)) return a.num == b.num;
- if(PTR(a).obj == PTR(b).obj) return 1;
- if(naStr_len(a) != naStr_len(b)) return 0;
- return memcmp(naStr_data(a), naStr_data(b), naStr_len(a)) == 0;
+ if(IS_NUM(*a)) return a->num == b->num;
+ if(PTR(*a).obj == PTR(*b).obj) return 1;
+ if(naStr_len(*a) != naStr_len(*b)) return 0;
+ return memcmp(naStr_data(*a), naStr_data(*b), naStr_len(*a)) == 0;
}
/* Returns the index of a cell that either contains a matching key, or
* is the empty slot to receive a new insertion. */
-static int findcell(struct HashRec *hr, naRef key, unsigned int hash)
+static int findcell(struct HashRec *hr, const naRef* key, unsigned int hash)
{
int i, mask = POW2(hr->lgsz+1)-1, step = (2*hash+1) & mask;
for(i=HBITS(hr,hash); TAB(hr)[i] != ENT_EMPTY; i=(i+step)&mask)
- if(TAB(hr)[i] != ENT_DELETED && equal(key, ENTS(hr)[TAB(hr)[i]].key))
+ if(TAB(hr)[i] != ENT_DELETED && equal(key, &ENTS(hr)[TAB(hr)[i]].key))
break;
return i;
}
static void hashset(HashRec* hr, naRef key, naRef val)
{
- int ent, cell = findcell(hr, key, refhash(key));
+ int ent, cell = findcell(hr, &key, refhash(key));
if((ent = TAB(hr)[cell]) == ENT_EMPTY) {
ent = hr->next++;
if(ent >= NCELLS(hr)) return; /* race protection, don't overrun */
@@ -127,7 +127,7 @@ int naHash_get(naRef hash, naRef key, naRef* out)
{
HashRec* hr = REC(hash);
if(hr) {
- int ent, cell = findcell(hr, key, refhash(key));
+ int ent, cell = findcell(hr, &key, refhash(key));
if((ent = TAB(hr)[cell]) < 0) return 0;
*out = ENTS(hr)[ent].val;
return 1;
@@ -147,7 +147,7 @@ void naHash_delete(naRef hash, naRef key)
{
HashRec* hr = REC(hash);
if(hr) {
- int cell = findcell(hr, key, refhash(key));
+ int cell = findcell(hr, &key, refhash(key));
if(TAB(hr)[cell] >= 0) {
TAB(hr)[cell] = ENT_DELETED;
if(--hr->size < POW2(hr->lgsz-1))
@@ -211,7 +211,7 @@ int naiHash_tryset(naRef hash, naRef key, naRef val)
{
HashRec* hr = REC(hash);
if(hr) {
- int ent, cell = findcell(hr, key, refhash(key));
+ int ent, cell = findcell(hr, &key, refhash(key));
if((ent = TAB(hr)[cell]) >= 0) { ENTS(hr)[ent].val = val; return 1; }
}
return 0;
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel