Subject: Re: compiler madness
To: None <,>
From: None <>
List: port-sparc64
Date: 03/28/2002 17:30:40
| Maybe this is useful for tracking some compiler bug or whatever:
| The INN port segfaults on startup in a very interesting way.
| innd/timer.c uses three tables to track usage. Those are
| declared as follows (there's no need to omit the 'static', in fact,
| adding 'static' fixes the problem):
| unsigned start[TMR_MAX];
| unsigned cumulative[TMR_MAX];
| unsigned count[TMR_MAX];
| The following loop will fail on writing to start[0]:
| for (i = 0; i < TMR_MAX; i++) {
|         count[i] = start[i] = cumulative[i] = 0;
|     }
| In gdb, 'count' & 'cumulative' show up as empty memory,
| only 'start' contains (seemingly) random garbage. There seems to
| be something wrong when the program tries to write to 'start',
| although there's nothing particular to see in gdb.
| Making these three arrays 'static' fixes the problem, no more
| segfaults (disabling optimization doesn't change the results,
| either). I'm running James' 20020328-snapshot, although I saw the
| segfault even before the update, but I didn't investigate.
| Can somebody explain this? Unluckily, I cannot reproduce this by
| a small sample program :-/ Should I file a PR?

Not quite yet.

1) How and when did you compile the innd that is segfaulting?

2) Can you provide a full register dump?  (I think info all-regs 
should do it in gdb.)

3) Can you provide a full disassembly of the routine where the 
dump is occuring?