🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Adam de Boor Sat, 07 Oct 1989 08:46
spurious warning in dbxread.c
#288
Author: Adam de Boor
Date: Sat, 07 Oct 1989 08:46
42 lines
1900 bytes
The following code in dbxread.c can be falsely triggered by a zero-length array
in gcc:

      /* g++ -g0 can put out bitpos & bitsize zero for a static
	 field.  This does not give us any way of getting its
	 class, so we can't know its name.  But we can just
	 ignore the field so we don't dump core and other nasty
	 stuff.  */
      if (list->field.bitpos == 0
	  && list->field.bitsize == 0)
	{
	  /* Have we given the warning yet?  */
	  static int warning_given = 0;

	  /* Only give the warning once, no matter how many class
	     variables there are.  */
	  if (!warning_given)
	    {
	      warning_given = 1;
	      fprintf_filtered (stderr, "\n\
Warning:  DBX-style class variable debugging information encountered.\n\
You seem to have compiled your program with \
\"g++ -g0\" instead of \"g++ -g\".\n\
Therefore GDB will not know about your class variables.\n\
");

E.g. the declaration

typedef union {
    int		num;
    char	str[0];
} foo;

will generate a type stab: "foo:t16=u4num:1,0,32;str:17=ar1,0,-1;2,0,0;;"
I.e. str is an array of characters whose index ranges from 0 to -1 of type int,
but is at offset 0 and of length 0. Not certain how to recognize this
case as I'm not certain what in g++ can trigger a similar symbol entry.
An obvious point is that the field is an array yet has 0 bits allocated: a sure
sign that you've got a zero-length array...but would that conflict with the
thing that g++ produces? There's the question...

a
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads