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]

patch to g++ name-mangling bug


There is a bug in the g++ name-mangling code which occurs when a template
takes a value parameter larger than the native word size (i.e. a long long
parameter).  The bug does not cause a problem during compilation.  It _does_,
however, cause a problem when debugging, since gdb segfaults inside of
libiberty when it encounters the incorrectly mangled name.  The basic problem
is that, in the case of a 'long long' or 'unsigned long long' parameter which
requires more than one digit, the mangled value doesn't get underscores added
to it, as are required.  In the below change, the gist of the test being made
was:

if ( hi == (low >> (bits_per_int - 1)) )

This was to check if the high part of the value was a sign extension of the
low part.  This is only a valid test if the low part is a signed int.  Looking
at the definition of the int cst structure, we see it is unsigned.  So an
explicit cast fixes the problem.  This patch is against the egcs-20000313
snapshot:

diff ./egcs-20000313/gcc/cp/method.c ./new/gcc/cp/method.c
604c604
<       != (TREE_INT_CST_LOW (value) >> (HOST_BITS_PER_WIDE_INT - 1)))
---
>       != (((HOST_WIDE_INT)(TREE_INT_CST_LOW (value))) >> (HOST_BITS_PER_WIDE_INT - 1)))

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