Interactions between c++filter and assembler output

Joe Buck jbuck@Synopsys.COM
Fri Feb 26 11:15:00 GMT 1999


[ c++filt barfs on .directive mangled_symbol,something_else ]

> This seems like a bug in c++filt to me.  I'd generally prefer to fix the
> bug rather than hack up the assembly code to avoid the bug :-)

The bug in the demangler was introduced by the HP aCC support.  Here's a
code fragment from the main program in libiberty/cplus-dem.c

	  /* Try to read a label.  */
	  while (c != EOF && (isalnum(c) || c == '_' || c == '$' || c == '.' ||
                              c == '<' || c == '>' || c == '#' || c == ',' || c == '*' || c == '&' ||
                              c == '[' || c == ']' || c == ':' || c == '(' || c == ')'))
                              /* the ones in the 2nd & 3rd lines were added to handle
                                 HP aCC template specialization manglings */
	    {
	      if (i >= MBUF_SIZE-1)
		break;
	      mbuffer[i++] = c;
	      c = getchar ();
	    }

Note that ',' is considered a legal character that can appear in a mangled
symbol, plus all kinds of other troublesome characters (parentheses, etc).
Can all those strange characters really appear in HP aCC symbols?  I
don't seem to see them with my copy of HP aCC.

Perhaps this loop based just on single characters needs to be replaced
by regular expression matching?






More information about the Gcc-bugs mailing list