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

Kim Lux lux at diesel-research.com
Fri Jan 21 22:41:14 UTC 2005


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 
gdb-6.1post-1.20040607.43

Thanks

-- 
Kim Lux,  Diesel Research Inc.





More information about the fedora-devel-list mailing list