This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: [PATCH] PR libstdc++/13045 / C++ demangler, floating values and function pointer type return type postfix fix.


Jason Merrill <jason@redhat.com> writes:

> On 25 Nov 2003 23:51:54 -0500, Ian Lance Taylor <ian@wasabisystems.com> wrote:
> 
> > Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> >
> >> It will not work. One reason was explained by DJ.  Another is that
> >> it does not reduce to a normal form before outputing leading to many
> >> symbols being thought different while they are the same.
> >
> > Note that g++ already does not reduce to normal form.
> 
> You seem to be making a leap from discussing a normal form for floating
> point constants to a normal form for general expressions.

That's because I think they reduce to the same problem.

> > In other words, g++ does not recognize that A<i+0> and A<0+i> are
> > arguably the same type, at least in the sense that it is probably
> > impossible to distinguish between them other than by different
> > instantiations of static variables.
> >
> > Is this a bug in g++?
> 
> No.
> 
>    5.1.5 Type encodings
> 
>    Note that the expression is mangled without constant folding or other
>    simplification, and without parentheses, which are implicit in the
>    prefix representation.  Except for the parentheses, therefore, it
>    represents the source token stream. (C++ Standard reference 14.5.5.1
>    p. 5.)

If the expression represents the source token stream, then are these
meant to be equivalent or different:
   A<1+(int)1.0>
   A<1+(int)1.00>
?

Gaby's earlier standard quote suggests that this program is
ill-formed, since the templates are ``functionally equivalent but not
equivalent.''

But your 5.1.5 quote above appears to be in conflict with his
14.5.5.1/7 section.  His section suggests that using A<I+0> and A<0+I>
is ill-formed.  Your section suggests that it is not.

Or maybe what the standard is saying is that a compiler MAY normalize
but is not REQUIRED to normalize.  In which case there is no reason
that we have to normalize floating point constants.

In other words, if we don't have to normalize expressions, then why do
we have to normalize floating point constants?  As I said above, it
seems to me that these reduce to the same problem.


All that aside, I would certainly be in favor of changing the mangling
of floating point constants to a machine independent form.  C99 hex
encoding is as good as any.

Ian


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