From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64216 invoked by alias); 24 Feb 2018 20:04:51 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@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 20:04:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------048D7A9E95BA6FCDBA3B6A63" X-SW-Source: 2018-02/txt/msg00172.txt.bz2 This is a multi-part message in MIME format. --------------048D7A9E95BA6FCDBA3B6A63 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 569 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. --------------048D7A9E95BA6FCDBA3B6A63 Content-Type: text/x-patch; name="p1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p1.diff" Content-length: 1320 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); --------------048D7A9E95BA6FCDBA3B6A63 Content-Type: text/x-fortran; name="select_type_40.f90" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="select_type_40.f90" Content-length: 229 ! { dg-do compile } ! { dg-additional-options "-fdefault-integer-8" } ! PR 78238 - this used to cause an ICE. ! Original test cae by Gerhard Steinmetz class(*), allocatable :: q select type (x => q) type is (real) end select end --------------048D7A9E95BA6FCDBA3B6A63--