My mistake, the patch file should not have the random changes to
libiberty/functions.texi. Not sure how that ended up there.
---
Fritz Reese


On Fri, Nov 10, 2017 at 4:31 PM, Fritz Reese <fritzore...@gmail.com> wrote:
> All,
>
> The attached patch fixes the ICE reported in PR 82886. The ICE is due
> to compiling the program with -finit-derived, but without any other
> -finit-* flag (apparently this is something which I never tried when I
> introduced -finit-derived, somehow...) Previously, -finit-derived
> would inherit the component initializer expressions from flags like
> -finit-local-zero, -finit-integer=, -finit-logical=, etc... The
> problem is, if one is not specified and a derived type variable
> contains a component of the same type, the structure constructor
> itself is generated, but the structure element for the component ends
> up with a NULL expression.
>
> The attached patch implements what I think is a natural solution from
> the user's perspective. If -finit-derived is given, any -finit-* flags
> which are not given will be treated as if -finit-local-zero was given,
> for the purposes of the derived-type component initializers. (Of
> course explicit -finit-* flags will still override this inference).
>
> Regression tests pass on x86_64-redhat-linux. OK?
>
> ---
> Fritz Reese
>
> From e70f3917a7b2d35f9baad2f09199c1ccc60a04d4 Mon Sep 17 00:00:00 2001
> From: Fritz Reese <fritzore...@gmail.com>
> Date: Fri, 10 Nov 2017 16:10:06 -0500
> Subject: [PATCH] Fix -finit-derived when given without other -finit-* flags.
>
>         PR fortran/82886
>         gcc/fortran/
>         * gfortran.h (gfc_build_init_expr): New prototype.
>         * invoke.texi (finit-derived): Update documentation.
>         * expr.c (gfc_build_init_expr): New, from gfc_build_default_init_expr.
>         (gfc_build_default_init_expr): Redirect to 
> gfc_build_init_expr(,,false)
>         (component_initializer): Force building initializers using
>         gfc_build_init_expr(,,true).
>
>         PR fortran/82886
>         * gcc/testsuite/gfortran.dg/init_flag_16.f03: New testcase.

Attachment: pr82886.patch
Description: Binary data

Reply via email to