This is the mail archive of the gcc-patches@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]

Re: PATCH: PR other/42230: abi::__cxa_demangle fails to return the length of the decoded name


On Sat, Jan 9, 2010 at 1:52 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> I am testing this patch to return length according as documented. OK
> if no regressions?
>
> Thanks.
>

Ian approved it in PR. I checked it in. I will also check it into src.


> H.J.
> ---
> libiberty/
>
> 2010-01-09 ?Ian Lance Taylor ?<iant@google.com>
>
> ? ? ? ?PR other/42230
> ? ? ? ?* cp-demangle.c (d_demangle): Return dgs.alc on success.
>
> libstdc++-v3/
>
> 2010-01-09 ?H.J. Lu ?<hongjiu.lu@intel.com>
>
> ? ? ? ?PR other/42230
> ? ? ? ?* testsuite/abi/pr42230.cc: New.
>
> diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
> index 43cf34a..d37c90e 100644
> --- a/libiberty/cp-demangle.c
> +++ b/libiberty/cp-demangle.c
> @@ -4777,7 +4777,7 @@ d_demangle (const char *mangled, int options, size_t *palc)
> ? ? ? return NULL;
> ? ? }
>
> - ?*palc = dgs.allocation_failure ? 1 : 0;
> + ?*palc = dgs.allocation_failure ? 1 : dgs.alc;
> ? return dgs.buf;
> ?}
>
> --- /dev/null ? 2010-01-07 11:41:26.231386042 -0800
> +++ a/libstdc++-v3/testsuite/abi/pr42230.cc ? ? 2010-01-09 13:44:12.000000000 -0800
> @@ -0,0 +1,16 @@
> +// { dg-do run }
> +
> +#include <cxxabi.h>
> +#include <cassert>
> +#include <cstddef>
> +
> +int main()
> +{
> + ?std::size_t length = 0;
> + ?int cc;
> +
> + ?char* ret = abi::__cxa_demangle("e", 0, &length, &cc);
> +
> + ?assert( (cc < 0 && !ret) || (ret && length) );
> + ?return 0;
> +}
>



-- 
H.J.


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