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 andfunction pointer type return type postfix fix.


On 26 Nov 2003 01:32:18 -0500, Ian Lance Taylor <ian@wasabisystems.com> wrote:

> 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.''

Just mentioning those two is fine.  If you have overloads like

 template <class T> void f(T, A<1+(int)1.0>);
 template <class T> void f(T, A<1+(int)1.00>);

that would be ill-formed.

> 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.

Note that my quote above is from the ABI spec, not the language standard.

> Or maybe what the standard is saying is that a compiler MAY normalize
> but is not REQUIRED to normalize.

Yes.

> In which case there is no reason that we have to normalize floating point
> constants.

Agreed, we don't have to.  I think Gaby was suggesting that we might want
to anyway.

> 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.

I don't have much of an opinion.  I frankly don't see the problem with the
existing solution of just dumping the target-dependent hex representation.

Jason


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