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] |
Hello Compiling the Ada testcase below on mips-irix/n32 ICEs out of an invalid operation produced by the SRA try_instantiate_multiple_fields circuitry. The case is extracted from the a-except runtime library unit, so the ICE presented here actually breaks bootstrap for Ada on the target. package P is function Letter return String; end; package body P is function X return String is begin return "X"; end; function Letter return String is begin return X; end; end; The compiler eventually complains about an invalid BIT_FIELD_REF conversion operand, like so: $ ../prev-gcc/gnat1 -gnatp -O1 [...] p.adb ... p.adb:14: error: invalid operand to unary operator BIT_FIELD_REF <SR.2_4, 32, 32>; p.adb:14: note: in statement SR.5_6 = (unsigned int) BIT_FIELD_REF <SR.2_4, 32, 32>; Indeed, post-gimplification NOP_EXPRs are expected to apply to "is_gimple_val" operands only, and SRA turns P.Letter () { ... <bb 2>: D.1314 ={v} p__x (); D.1313 ={v} D.1314; R5b ={v} D.1313; D.1315 ={v} R5b; return D.1315; } into P.Letter () { ... <bb 2>: SR.1_1 = 0; SR.2_2 = 0; D.1314 ={v} p__x (); SR.3_3 = VIEW_CONVERT_EXPR<UNSIGNED_64>(D.1314); SR.2_4 = SR.3_3; SR.4_5 = SR.1_1 & 0x0ffffffff00000000; SR.5_6 = (unsigned int) BIT_FIELD_REF <SR.2_4, 32, 32>; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SR.6_7 = (UNSIGNED_64) SR.5_6; SR.1_8 = SR.4_5 | SR.6_7; SR.7_9 = SR.1_8 & 4294967295; SR.8_10 = (unsigned int) BIT_FIELD_REF <SR.2_4, 32, 0>; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SR.9_11 = (UNSIGNED_64) SR.8_10; SR.10_12 = SR.9_11 << 32; SR.1_13 = SR.7_9 | SR.10_12; SR.1_14 = SR.2_4; SR.11_15 = SR.1_14; D.1315 ={v} VIEW_CONVERT_EXPR<struct >(SR.11_15); return D.1315; The transformed assignments initially involved Ada "fat" pointers to unconstrained objects (strings), represented as a record with two regular pointer fields, one to the bounds and one to the data. IIUC, try_instantiate_multiple_fields is meant to simplify the code generated for accesses to groups of bitfields. Pointer fields are usually not good candidates for such coalescing, and the unexpected code expansion above I think illustrates this pretty well. Pointer fields are most of the time not coalesced by virtue of their size typically being equal to that of a word, which is not the case on mips-irix with the n32 ABI where the crash showed up. The attached simple patch is a suggestion to address that by early returning from try_instantiate_multiple_fields when the candidate field has POINTER_TYPE. Tested first on mips-irix/n32 by checking that the testcase doesn't ICE anymore and that bootstrap proceeds past the previous failure point, then with a regular bootstrap and regression test cycle on x86_64-suse-linux. Thanks in advance, Olivier 2008-05-06 Olivier Hainque <hainque@adacore.com> * tree-sra.c (try_instantiate_multiple_fields): Early return if field has POINTER_TYPE. testsuite/ * gnat.dg/fatp_sra.adb: New test.
Attachment:
fatp-sra.dif
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |