[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Any known bugs in gcc wrt symbols in gdb and/or var allocation ?

I think I've found 2 issues with gcc-3.4.2-6.fc3.

Consider the following code:

<code snippet begins>
void dbug12_stop_reason (enum dbug12_stop *reason, int *sigrc)
  int replyEnd; 
  unsigned char reply[254];
  replyEnd = 0; 
  // get the reply
  replyEnd = dbug12_get_reply(reply); 
  printf("Reply is %s\n",reply); 
  // handle the error condition
  // can't pass here with a zero length
  if (replyEnd == 0)
<code snippet ends>

Problem #1:  gdb cannot find replyEnd:

(gdb) whatis replyEnd 
No symbol "replyEnd" in current context.

Problem #2:
The code doesn't execute properly if I delete the "replyEnd = 0;" line.

Without "replyEnd = 0;" in the code, it gets an unalterable junk value.

With "replyEnd = 0;" in the code, replyEnd gets set to the return value
of dbug12_get_reply, which it should.

BTW: the definition of dbug12_get_reply is: 

static int dbug12_get_reply (unsigned char *packet)

I was also playing around with changing the size of the reply buffer, ie
"reply[255]", reply[253], etc.  It didn't look like gcc was changing the
size of the buffer on a clean build. 

It looks like gcc isn't allocating something properly. 

Has anyone seen anything like this before ? 

rpm -q gdb 


Kim Lux,  Diesel Research Inc.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]