From patchwork Sat Feb 1 18:49:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 315922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 963E92C0090 for ; Sun, 2 Feb 2014 05:50:30 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=nLD4hJiHhqq6tGd/eyDvE2wEoBuJBZm4DR88dNqxQ9Wa++ dj5krlGMdRVFfbJGW+AGmZXv3IwKtcj1Lf47a7J3oQQ4n7WSCqgd2FwcI3XSdcGc 4Zw8PGs93V2S3JhX1nf6XCfO7QrwVwut+uSP28pgghjO/UShn/CuXm+FCr4mE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=Zt8k3cIyIAOu6CGUsPlmetmoruI=; b=bNlitSx89QtYs9SexAMC pxvFT6gAjRUFis/3Wj97KL/DfwSuq5LiwKLRqXWDToRg6xartT7PmcLgbwFvpME+ hRuJq7ywAGSTkLkgGP2C0jqxdixlaPZtJZGL2X/7CdCxabHRjvAWnTwKo8vC7gvh 9sJyyoF69JJp57NaDI2uhXs= Received: (qmail 8150 invoked by alias); 1 Feb 2014 18:50:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 8130 invoked by uid 89); 1 Feb 2014 18:50:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp22.services.sfr.fr Received: from smtp22.services.sfr.fr (HELO smtp22.services.sfr.fr) (93.17.128.12) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 01 Feb 2014 18:50:22 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2212.sfr.fr (SMTP Server) with ESMTP id 385CA700016A; Sat, 1 Feb 2014 19:50:20 +0100 (CET) Received: from [192.168.0.16] (did75-4-82-66-46-21.fbx.proxad.net [82.66.46.21]) by msfrf2212.sfr.fr (SMTP Server) with ESMTP id C69177000095; Sat, 1 Feb 2014 19:50:10 +0100 (CET) X-SFR-UUID: 20140201185010813.C69177000095@msfrf2212.sfr.fr Message-ID: <52ED41CD.6030205@sfr.fr> Date: Sat, 01 Feb 2014 19:49:49 +0100 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: gfortran , gcc-patches Subject: [Patch, fortran] PR57033 ICE on extended derived type and default initialization X-IsSubscribed: yes Hello, here is a fix for PR57033. The problem was gfc_convert_to_structure_constructor calling itself recursively and changing `actual' behind its back without going through the loop condition. The fix is pretty obvious; I thought there was something missing (see the PR) but on second thought, it seems to be correct. regression tested on x86_64-unknown-linux-gnu; OK for trunk and then 4.8/4.7? Mikael 2014-01-26 Mikael Morin PR fortran/57033 * primary.c (gfc_convert_to_structure_constructor): Avoid null pointer dereference. 2014-01-26 Mikael Morin PR fortran/57033 * gfortran.dg/default_initialization_7.f90: New test. diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index c77b4ec..7d7fbad 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2544,7 +2544,8 @@ gfc_convert_to_structure_constructor (gfc_expr *e, gfc_symbol *sym, gfc_expr **c if (parent && !comp) break; - actual = actual->next; + if (actual) + actual = actual->next; } if (!build_actual_constructor (&comp_head, &ctor_head, sym))