From patchwork Sat Aug 6 15:26:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 108788 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]) by ozlabs.org (Postfix) with SMTP id 48A3BB6F72 for ; Sun, 7 Aug 2011 01:26:54 +1000 (EST) Received: (qmail 24925 invoked by alias); 6 Aug 2011 15:26:49 -0000 Received: (qmail 24887 invoked by uid 22791); 6 Aug 2011 15:26:48 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cc-smtpout3.netcologne.de (HELO cc-smtpout3.netcologne.de) (89.1.8.213) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 06 Aug 2011 15:26:33 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id 6220812383; Sat, 6 Aug 2011 17:26:32 +0200 (CEST) Received: from [192.168.0.197] (xdsl-78-35-137-25.netcologne.de [78.35.137.25]) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA id 338C411DC9; Sat, 6 Aug 2011 17:26:31 +0200 (CEST) Message-ID: <4E3D5D26.5030904@netcologne.de> Date: Sat, 06 Aug 2011 17:26:30 +0200 From: Thomas Koenig User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 MIME-Version: 1.0 To: "fortran@gcc.gnu.org" , gcc-patches Subject: [patch, Fortran, committed] Fix PR 50004 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 Hello world, I have committed the attached patch as obvious after regression-testing. The problem was that gfc_typenode_for_spec was clobbering the typespec for the ISO C types by converting them to integer. Don't know why I hadn't seen this before. Regards Thomas 2011-08-06 Thomas Koenig PR fortran/50004 * target-memory.c (gfc_target_expr-size): Don't clobber typespec for derived types. * simplify.c (gfc_simplify_transfer): Don't calculate source_size twice. Index: target-memory.c =================================================================== --- target-memory.c (Revision 177487) +++ target-memory.c (Arbeitskopie) @@ -120,8 +120,14 @@ gfc_target_expr_size (gfc_expr *e) case BT_HOLLERITH: return e->representation.length; case BT_DERIVED: - type = gfc_typenode_for_spec (&e->ts); - return int_size_in_bytes (type); + { + /* Determine type size without clobbering the typespec for ISO C + binding types. */ + gfc_typespec ts; + ts = e->ts; + type = gfc_typenode_for_spec (&ts); + return int_size_in_bytes (type); + } default: gfc_internal_error ("Invalid expression in gfc_target_expr_size."); return 0; Index: simplify.c =================================================================== --- simplify.c (Revision 177487) +++ simplify.c (Arbeitskopie) @@ -6048,8 +6048,6 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr && gfc_array_size (source, &tmp) == FAILURE) gfc_internal_error ("Failure getting length of a constant array."); - source_size = gfc_target_expr_size (source); - /* Create an empty new expression with the appropriate characteristics. */ result = gfc_get_constant_expr (mold->ts.type, mold->ts.kind, &source->where);