[gnu.gcc.bug] bug in sdbout.c, sdbout_params

grunwald@flute.cs.uiuc.edu (Dirk Grunwald) (05/18/89)

This is w.r.t 1.35

Not certain if this is a gcc or g++ bug.

in sdbout.c, sdbout_parms, there is no check for DECL_NAME(parms) being
null, as is done in dbxout.c, dbxout_parms. The following is a guess
as to what should be done in that case; a higher level blessing is
needed.

This corrects the problem (in g++ at least) of -g0 producing lines such
as
	.def	_^R; .tag etc etc etc

However, there appears to be a remaining problem with, as the Encore assembler
puts it,

Assembler: FOO.s
        aline 392(cline 13): Unbalanced Symbol Table Entries-Too Many Scope Ends

which is unrelated to this problem, but still pretty annoying. I couldn't find
the problem from inspecting the files.

----------------------------------------------------------------------

static void
sdbout_parms (parms1)
     tree parms1;
{
  tree type;
  tree parms;

  for (parms = parms1; parms; parms = TREE_CHAIN (parms))
    {
      int current_sym_value = DECL_OFFSET (parms) / BITS_PER_UNIT;

      if (DECL_NAME(parms))
	{
	  PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (parms)));
	}
      else
	{
	  PUT_SDB_DEF ("$anon");
	}
--
Dirk Grunwald
Univ. of Illinois
grunwald@flute.cs.uiuc.edu

meissner@tiktok.dg.com (Michael Meissner) (05/23/89)

In article <GRUNWALD.89May17164336@flute.cs.uiuc.edu>
grunwald@flute.cs.uiuc.edu (Dirk Grunwald) writes:

| This is w.r.t 1.35
| 
| Not certain if this is a gcc or g++ bug.
| 
| in sdbout.c, sdbout_parms, there is no check for DECL_NAME(parms) being
| null, as is done in dbxout.c, dbxout_parms. The following is a guess
| as to what should be done in that case; a higher level blessing is
| needed.
| 
| This corrects the problem (in g++ at least) of -g0 producing lines such
| as
| 	.def	_^R; .tag etc etc etc

	...

| static void
| sdbout_parms (parms1)
|      tree parms1;
| {
|   tree type;
|   tree parms;
| 
|   for (parms = parms1; parms; parms = TREE_CHAIN (parms))
|     {
|       int current_sym_value = DECL_OFFSET (parms) / BITS_PER_UNIT;
| 
|       if (DECL_NAME(parms))
| 	{
| 	  PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (parms)));
| 	}
|       else
| 	{
| 	  PUT_SDB_DEF ("$anon");
| 	}

	...

Rather than hard coding the name to '$anon', which might be used by
the programmer if DOLLARS_IN_IDENTIFIERS is used, you might want to
consider using the same logic that creates the .<n>fake names used for
tags.  For example:

static void
sdbout_parms (parms1)
     tree parms1;
{
  tree type;
  tree parms;
  char *name;

  for (parms = parms1; parms; parms = TREE_CHAIN (parms))
    {
      int current_sym_value = DECL_OFFSET (parms) / BITS_PER_UNIT;

      name = IDENTIFIER_POINTER (DECL_NAME (parms));
      if (name == (char *)0 || *name == '\0')
	name = gen_fake_label ();

      PUT_SDB_DEF (name);

	...

By the way, as long as I'm talking about GCC and sdb, I should warn
people that I had problems with `sdbout_reg_parms' generating the
wrong information for parameters passed in registers.  I've fixed the
problem locally, and hope to give the changes back to GNU central
shortly.
--
Michael Meissner, Data General.
Uucp:		...!mcnc!rti!xyzzy!meissner		If compiles were much
Internet:	meissner@dg-rtp.DG.COM			faster, when would we
Old Internet:	meissner%dg-rtp.DG.COM@relay.cs.net	have time for netnews?