This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/16845] demangler not working for plain "int"


------- Additional Comments From ian at wasabisystems dot com  2004-08-01 02:06 -------
I believe that the behaviour of __cxa_demangle conforms to the API.  I also
believe that the API is broken.  The present code conforms to the broken API.

The API is here:
http://www.codesourcery.com/cxx-abi/abi.html#demangler

It says 'Ambiguities are possible between extern "C" object names and internal
built-in type names, e.g. "i" may be either an object named "i" or the built-in
"int" type. Such ambiguities should be resolved to user names over built-in
names.'  All internal built-in type names are mangled as a single lower-case
character.  I interpret the API statement to mean that any string consisting of
a single lower-case character should not be demangled.

The API further says "If there is an error in demangling, the return value is a
null pointer."  Therefore, in this case, the function must return NULL.  Of the
options for a value to put in *status, -2 is the only reasonable choice.

There is a mailing list thread which discusses this here:
http://gcc.gnu.org/ml/libstdc++/2004-02/msg00333.html

Others agree that my reading of the API is reasonable.  I continue to think that
it is the only reasonable reading.

So I don't think there is a bug in __cxa_demangle.  As the submitter notes,
there is another demangler, written in C++, in ext/demangle.h.  That demangler
has many more features.  For more general C++ usage, that is the demangler to
use.  The submitter says there is some problem with it, but in my (limited)
experience it works fine.

In closing, I repeat that I think that the API is broken, but I have had very
limited response in my comments about this or about other broken aspects of the
mangling scheme in general.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16845


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]