[Patch,Fortran] PR 43042 - fix -fwhole-file ICE for C_NULL_PTR DT init

Tobias Burnus burnus@net-b.de
Tue Feb 23 18:29:00 GMT 2010


Hello,

the patch fixes an ICE found when compiling the gfortran testsuite with
LTO (-flto), but -fwhole-file is enough to trigger the ICE.

On one hand, C_NULL_PTR is a derived types (DT) with hidden components -
but on the other hand it is just NULL (the integer number 0). The ICE
comes about in gfc_conv_initializer. First the DT is replaced by the
integer expression (EXPR_CONST), but if "ts" (= function argument, not
expr->ts) has ts->type == BT_DERIVED, one enters gfc_conv_structure -
and ICEs there.

The solution is simple: Call directly in the if branch gfc_conv_constant
and exit.

Build and regtested on x86-64-linux. OK for the trunk?

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nullptr.diff
Type: text/x-patch
Size: 2656 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100223/8bbb52f8/attachment.bin>


More information about the Gcc-patches mailing list