[PATCH, PR d/90601] Committed fix for ICE: gimplification failed (gimplify.c at 13436)

Iain Buclaw ibuclaw@gdcproject.org
Sun Aug 11 10:01:00 GMT 2019


Hi,

The expression that caused the ICE

        ++(a += 1.0);

The D front-end rewrites and applies implicit type conversions so the
expression gets simplified as

        (int)((double) a += 1.0) += 1

The codegen pass would subsequently generate the following invalid code

        (int)(double) a = (int)((double) a + 1.0) + 1

The LHS expression `(int)(double) a', represented as a FIX_TRUNC_EXPR
being what trips as it is not a valid lvalue for assignment.

While LHS casts are stripped away, convert_expr adds a double cast
because it converts the expression to its original type before
converting it to its target type.  There is no valid reason why this
is done, so it has been removed.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r274263.

-- 
Iain
---
gcc/d/ChangeLog:

        PR d/90601
        * d-convert.cc (convert_expr): Don't convert an expression to its
        original front-end type before converting to its target type.

gcc/testsuite/ChangeLog:

        PR d/90601
        * gdc.dg/pr90601.d: New test.

---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr90601.patch
Type: text/x-patch
Size: 907 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190811/7f63cd18/attachment.bin>


More information about the Gcc-patches mailing list