This avoids setting the TREE_OVERFLOW bit on DECL_FIELD_OFFSET for the shifted bounds field.
If DECL_FIELD_OFFSET of array-field is always a constant we could as well use DECL_FIELD_OFFSET (bounds_field) = size_int (-int_byte_position (array_field)); also I notice that DECL_OFFSET_ALIGN is now bogus for bounds_field. DECL_FIELD_OFFSET no longer has the desired zero bits. Shouldn't we instead set DECL_FIELD_OFFSET to -DECL_OFFSET_ALIGN and adjust DECL_FIELD_BIT_OFFSET accordingly? Well, with the above questions and suggestions I'd rather leave it to you deciding whether you like the below hack or want to rework the function a bit. Fixes === gnat tests === Running target unix/ FAIL: gnat.dg/align_max.adb execution test FAIL: gnat.dg/thin_pointer2.adb execution test FAIL: gnat.dg/unc_memfree.adb execution test Running target unix//-m32 FAIL: gnat.dg/align_max.adb execution test FAIL: gnat.dg/thin_pointer2.adb execution test FAIL: gnat.dg/unc_memfree.adb execution test Richard. 2011-09-02 Richard Guenther <rguent...@suse.de> ada/ * gcc-interface/utils.c (shift_unc_components_for_thin_pointers): Drop overflow bit on negative offsets. Index: trunk/gcc/ada/gcc-interface/utils.c =================================================================== *** trunk.orig/gcc/ada/gcc-interface/utils.c 2011-09-05 13:01:59.000000000 +0200 --- trunk/gcc/ada/gcc-interface/utils.c 2011-09-05 13:56:37.000000000 +0200 *************** shift_unc_components_for_thin_pointers ( *** 3411,3416 **** --- 3414,3425 ---- DECL_FIELD_OFFSET (bounds_field) = size_binop (MINUS_EXPR, size_zero_node, byte_position (array_field)); + if (TREE_CODE (DECL_FIELD_OFFSET (bounds_field)) == INTEGER_CST + && TREE_OVERFLOW (DECL_FIELD_OFFSET (bounds_field))) + DECL_FIELD_OFFSET (bounds_field) + = build_int_cst_wide (sizetype, + TREE_INT_CST_LOW (DECL_FIELD_OFFSET (bounds_field)), + TREE_INT_CST_HIGH (DECL_FIELD_OFFSET (bounds_field))); DECL_FIELD_OFFSET (array_field) = size_zero_node; DECL_FIELD_BIT_OFFSET (array_field) = bitsize_zero_node;