Illegal Instruction in bit_vector
Andrew Borthwick
borthwic@johnson.cs.nyu.edu
Tue Jan 20 07:33:00 GMT 1998
Hi,
I am having trouble with a bug which kills my program with "SIGILL, Illegal
instruction" when I exectute the following bit of code. The thing that troubles
me other than the "SIGILL" is that when I compile the code with the -O3 flag, it
doesn't occur, but when I compile it with -g, it does occur. Further adding to
the confusion is that this problem cropped up after I had made changes in code
unrelated to this class. Before this code had worked fine.
I have tried isolating the offending bit of code, but when I do, the problem
disappears, so I don't think I can give you the bug in it's complete context. I
am running egcs 1.0.1 on sparc-sun-solaris2.5.1.
----------------------------------------------------------------------
void ConsistencyFeature::Initialize() { // a static member function
. . .
vector<bool> &kluge = consistMatrix[histIndex];
kluge[futIndex] = true; // dies here with SIGILL
. . .
}
consistMatrix is defined as vector<vector<bool> > and has a size of 29. It is a
static variable in the class "ConsistencyFeature".
kluge's and consistMatrix's states at the point of the bug are as follows:
(gdb) p kluge
$7 = (bit_vector &) @0xd8f20: {start = {<random_access_iterator<bool,int>> = {},
p = 0xd8338, offset = 0}, finish = {<random_access_iterator<bool,int>> =
{},
p = 0xd8338, offset = 29}, end_of_storage = 0xd833c}
(gdb) p ConsistencyFeature::consistMatrix
$8 = {start = 0xd8f20, finish = 0xd924c, end_of_storage = 0xd92a0}
(gdb) p histIndex
$9 = 0
(gdb) p futIndex
$10 = 0
------------------------------------------------------
Note that this is my second attempt at this. I got the same bug when I
simply did
consistMatrix[histIndex][futIndex] = true;
It's hard for me to imagine how this could be a problem with my code,
especially given the fact that it doesn't occur in optimized code. Does this
look like a compiler problem to you? Any suggestions on how to identify exactly
what the "Illegal instruction" is?
Thanks,
Andrew Borthwick
More information about the Gcc-bugs
mailing list