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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-25 
08:49:30 UTC ---
Jason - is that what is expected?  Or should we have rejected the array
before?  I suppose a value of zero is unused (apart from for the GNU extension
of array[0]).  But array[0] and array[ULONG_MAX] would mangle the same.

Patch that restores previous behavior:

Index: gcc/cp/mangle.c
===================================================================
--- gcc/cp/mangle.c     (revision 188927)
+++ gcc/cp/mangle.c     (working copy)
@@ -3121,6 +3121,9 @@ write_array_type (const tree type)
             elements in the array, not the largest allowed index.  */
          double_int dmax
            = double_int_add (tree_to_double_int (max), double_int_one);
+         /* Truncate the result - this will mangle [0, SIZE_INT_MAX]
+            number of elements as zero.  */
+         dmax = double_int_zext (dmax, TYPE_PRECISION (TREE_TYPE (max)));
          gcc_assert (double_int_fits_in_uhwi_p (dmax));
          write_unsigned_number (dmax.low);
        }

Reply via email to