From patchwork Sat Feb 24 20:04:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 877453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473803-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="K5K0Y/XC"; dkim-atps=neutral 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 3zpfFq3jJdz9sW8 for ; Sun, 25 Feb 2018 07:05:01 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=P0erMerFlnrY0aDWaE5JfCbaox7bgCY007FndwRUCK1eiZvhXB 4+KUvw0z4PZthG8QdlwaN4tVYhmiDNfKBnabBeyXK+myOv8PhwNU9U+jmNn25owG kp/dApT6tcrFfmivPhRhjszkDLvQKudZAHAyjgS7ZM30WFZCurL3r/8YY= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=MaRUhVD+r6/w6Fui+Dd1pS0fSn4=; b=K5K0Y/XCIR1yT4Gce1Y0 Q2xUJ8kMIcrr73rO7cy638foN6Mev4jRVXwj9tLdI6Ey5ME+zjoxjGaGZwJ14txG MfbHNQ8/sv7EvUeKU8O/TFDUIa6qTBckYIgePbL3XG9w16xKFb6QG7EIFAQgAo7D 4brk8U3KJ/67impuDMgH0J4= Received: (qmail 64215 invoked by alias); 24 Feb 2018 20:04:51 -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 63795 invoked by uid 89); 24 Feb 2018 20:04:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*MI:1915, H*M:1915 X-Spam-User: qpsmtpd, 2 recipients X-HELO: cc-smtpout1.netcologne.de Received: from cc-smtpout1.netcologne.de (HELO cc-smtpout1.netcologne.de) (89.1.8.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 24 Feb 2018 20:04:48 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id 262B1134AA; Sat, 24 Feb 2018 21:04:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id 1A63511DB7; Sat, 24 Feb 2018 21:04:45 +0100 (CET) Received: from [78.35.157.23] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 5a91c55c-02b8-7f0000012729-7f000001bb19-1 for ; Sat, 24 Feb 2018 21:04:44 +0100 Received: from [192.168.178.20] (xdsl-78-35-157-23.netcologne.de [78.35.157.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Sat, 24 Feb 2018 21:04:43 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 78238, ICE with SELECT TYPE with -fdefault-integer-8 Message-ID: Date: Sat, 24 Feb 2018 21:04:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Hello world, the attached patch fixes a 7/8 regression with SELECT TYPE where the constant had the wrong type with -fdefault-integer-8. Regression-tested. OK for trunk and gcc-7? Regards Thomas 2018-01-24 Thomas Koenig PR fortran/78238 * gfortran.h (gfc_integer_4_kind): Define. * resolve.c (resolve_select_type): Make sure that the kind of c->high is gfc_integer_4_kind. 2018-01-24 Thomas Koenig PR fortran/78238 * gfortran.dg/select_type_40.f90: New test. Index: gfortran.h =================================================================== --- gfortran.h (Revision 257788) +++ gfortran.h (Arbeitskopie) @@ -2921,6 +2921,7 @@ extern int gfc_numeric_storage_size; extern int gfc_character_storage_size; #define gfc_logical_4_kind 4 +#define gfc_integer_4_kind 4 /* symbol.c */ void gfc_clear_new_implicit (void); Index: resolve.c =================================================================== --- resolve.c (Revision 257788) +++ resolve.c (Arbeitskopie) @@ -8965,7 +8965,7 @@ resolve_select_type (gfc_code *code, gfc_namespace { vtab = gfc_find_derived_vtab (c->ts.u.derived); gcc_assert (vtab); - c->high = gfc_get_int_expr (gfc_default_integer_kind, NULL, + c->high = gfc_get_int_expr (gfc_integer_4_kind, NULL, c->ts.u.derived->hash_value); } else @@ -8974,6 +8974,13 @@ resolve_select_type (gfc_code *code, gfc_namespace gcc_assert (vtab && CLASS_DATA (vtab)->initializer); e = CLASS_DATA (vtab)->initializer; c->high = gfc_copy_expr (e); + if (c->high->ts.kind != gfc_integer_4_kind) + { + gfc_typespec ts; + ts.kind = gfc_integer_4_kind; + ts.type = BT_INTEGER; + gfc_convert_type_warn (c->high, &ts, 2, 0); + } } e = gfc_lval_expr_from_sym (vtab);