From patchwork Sat Dec 7 09:17:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Richard Thomas X-Patchwork-Id: 2019609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=F10mOwoU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y52dP118gz1yRK for ; Sat, 7 Dec 2024 20:19:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BED63858CDB for ; Sat, 7 Dec 2024 09:19:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BED63858CDB Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=F10mOwoU X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 76E213858CDB; Sat, 7 Dec 2024 09:18:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76E213858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 76E213858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::630 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733563093; cv=none; b=UsuaPGY+w8lohb5bJkkY8sU8zF1Lk6B9gFRX3/U9hksKjovH7F+Iyx7QKJ5cglSWugcW2+GXOdKpP7Oqm6rzK0smyBJAk20oFq4AbQrtu8TpK+SsrFD5uPz7UgNuARhQYEnRC0UahsaYeggTW5JN4NuGS0azTVdVXPMC9L2NUF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733563093; c=relaxed/simple; bh=Z3ocVctqwtF6kNKSgzN2b8dJ4V1SzqLKCNolIcQSmH8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=jHTwjh7XWxfjxmWb9BoClFa8uPOce6ytbovfkVzfoK64MG85D31V+gCgYy6YB1scrOcAI2IZO9Xpgm/cG+HUqESqd3CI8VutvUCFWS0rXntCg3ayYdu3+SaOvS059BmWwCf0xsytovo2AAQq9LwgZenpSIuZyWfJ4zRCqYSHaeU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76E213858CDB Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-21145812538so23978675ad.0; Sat, 07 Dec 2024 01:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733563092; x=1734167892; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Z3ocVctqwtF6kNKSgzN2b8dJ4V1SzqLKCNolIcQSmH8=; b=F10mOwoUwfqXDs9FDbH87X2iiv6mEAfI9KuvHz9dOVplcCjBuIx8ne+pyxq6G+r+uU l5pT6MTOGlryNc/0AUpoDnxSrzDskM8UvCax8qSEX7IimtjUqBYMXG+RfNuYPrcrEYpJ nWXn9iYboqT2nkbRK1UAN+V9UFYfqhjhqCzdLkLCd3qq9rilCG3Pm65AVe8WJ/fc+98B w2n7EbmxmXe0INbBVEaOfJlwfUpNX0+bNdndAy5wJl7y3V7xetdtEoG9hK1bomCcn9xp ruS+AnPj/o/UHidgfu5gtWDTajKSUH+Omor+U39C5yE3uAaMZ37gBBijCg1wVU30Orpz KqhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733563092; x=1734167892; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Z3ocVctqwtF6kNKSgzN2b8dJ4V1SzqLKCNolIcQSmH8=; b=PWS8JbXBol45hs+erGu5m7Z8MxZ8V3ITvQVbmaUnRRzj6KeJ5PkRommGVt8QrISySb zwM/mghKUdFt1ZsdxFJYkZV7e7Jnzsq04OorMhyNlRNbyCb6BSfrS7dTDjwRv9knXpc4 fP02wkarquASAmyFKFxUyIj6nPmWRqQM0GzJZB67T66el6tgoDgIXpLGKgbQ60dWiooI CK+ce+e7q9ud8DodW/AKEkDmpV2Bfdq25yVKgWNx7DWBjfp7KpncbBokpL/8dOdyUyts vzmPDTGOplhThgDhI1GJ9X8P720Eo6vOS3d/U4g+LlXy6PMOGRXtqCvFfEiHX4kEifXk 5K+Q== X-Forwarded-Encrypted: i=1; AJvYcCV2jZFHcxatErE7QNUnc+Zm2rqRlimzHzpjO8Wnecty+0wyWeOfwQMr5A3i+xl4zr98/Ob0y9/Q/MPxoA==@gcc.gnu.org X-Gm-Message-State: AOJu0YzpcSShcIKxbHmpur/CNEaqSTJUsKjwbcjUvE9I0kHE7iVF5aPF XUROzphaawlRKv4E+Zv0rRN5HonjdftDoPLSEfERdQvJXAcjHpos0nHG3WR25u3H16f3/CyVv1S obQVr9Pm/+Ywxyqewj6NGs+Q6ThAg4abS X-Gm-Gg: ASbGncss/9G+s+3HBq0P3jZNgMuGTzKB9EAPZAKAEk+vP9xm5HbtHNb4eyJhrHj2X0y CGaG+sH0BNeud8jNQLFR+PsuUY3DzV/U4j4UzrE8fQSpXXaXJ9dLnfiuF2WRrf7e57w== X-Google-Smtp-Source: AGHT+IGCdyNAxYbQ0d2RlGPiGeYkUrJIAS98cuO3WEOx8dBYNrwkKOfUxJTF7ygDdZSF68wL7OtKFCFUluk1rYHEDyg= X-Received: by 2002:a17:902:da8a:b0:216:25a2:2ebe with SMTP id d9443c01a7336-21625a22f5fmr51038585ad.19.1733563092059; Sat, 07 Dec 2024 01:18:12 -0800 (PST) MIME-Version: 1.0 From: Paul Richard Thomas Date: Sat, 7 Dec 2024 09:17:57 +0000 Message-ID: Subject: [Patch, fortran] PR116261 - [15 regression] gfortran.dg/sizeof_6.f90 -O1 timeout since r15-2739-g4cb07a38233 To: "fortran@gcc.gnu.org" , gcc-patches , Harald Anlauf X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi All, I must apologise for reintroducing this regression again, after the second application of the fix for PR102689. I must admit that I had totally forgotten about it, even though it was the reason for withdrawing the patch the first time, and the failure was sporadic on my system, so I missed it on regression testing both times around. I cannot see what is wrong with the element length coming from an explicit typespec in the allocate statement but suppressing its use fixed the problem. I don't especially like increasing the number of arguments in gfc_array_init_size/gfc_array_allocate but it does improve clarity. I have taken the opportunity to effect a temporary fix to the other regression that I caused, PR117901, with the change to class_transformational_1.f90. I prepared a proper patch for this but, in preparing a dedicated testcase, I uncovered other problems that it didn't fix :-( Regression tests OK on Fedora/x86_64 - OK to push? Paul diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 6ff2c238038..9a8477650f4 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -6104,7 +6104,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, stmtblock_t * descriptor_block, tree * overflow, tree expr3_elem_size, tree *nelems, gfc_expr *expr3, tree expr3_desc, bool e3_has_nodescriptor, gfc_expr *expr, - tree *element_size) + tree *element_size, bool explicit_ts) { tree type; tree tmp; @@ -6164,7 +6164,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, tmp = gfc_conv_descriptor_dtype (descriptor); gfc_add_modify (pblock, tmp, gfc_conv_descriptor_dtype (expr3_desc)); } - else if (expr->ts.type == BT_CLASS + else if (expr->ts.type == BT_CLASS && !explicit_ts && expr3 && expr3->ts.type != BT_CLASS && expr3_elem_size != NULL_TREE && expr3_desc == NULL_TREE) { @@ -6469,7 +6469,8 @@ bool gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, tree errlen, tree label_finish, tree expr3_elem_size, tree *nelems, gfc_expr *expr3, tree e3_arr_desc, - bool e3_has_nodescriptor, gfc_omp_namelist *omp_alloc) + bool e3_has_nodescriptor, gfc_omp_namelist *omp_alloc, + bool explicit_ts) { tree tmp; tree pointer; @@ -6601,7 +6602,8 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, &offset, lower, upper, &se->pre, &set_descriptor_block, &overflow, expr3_elem_size, nelems, expr3, e3_arr_desc, - e3_has_nodescriptor, expr, &element_size); + e3_has_nodescriptor, expr, &element_size, + explicit_ts); if (dimension) { diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h index ab27f15cab2..becc8ca4a49 100644 --- a/gcc/fortran/trans-array.h +++ b/gcc/fortran/trans-array.h @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see se, which should contain an expression for the array descriptor. */ bool gfc_array_allocate (gfc_se *, gfc_expr *, tree, tree, tree, tree, tree, tree *, gfc_expr *, tree, bool, - gfc_omp_namelist *); + gfc_omp_namelist *, bool); /* Allow the bounds of a loop to be set from a callee's array spec. */ void gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping *, diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index b8fba1d91fe..80a9502a8a4 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -6992,7 +6992,8 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate) label_finish, tmp, &nelems, e3rhs ? e3rhs : code->expr3, e3_is == E3_DESC ? expr3 : NULL_TREE, - e3_has_nodescriptor, omp_alloc_item)) + e3_has_nodescriptor, omp_alloc_item, + code->ext.alloc.ts.type != BT_UNKNOWN)) { /* A scalar or derived type. First compute the size to allocate. diff --git a/gcc/testsuite/gfortran.dg/class_transformational_1.f90 b/gcc/testsuite/gfortran.dg/class_transformational_1.f90 index 77ec24a43c0..3e64f5d91e5 100644 --- a/gcc/testsuite/gfortran.dg/class_transformational_1.f90 +++ b/gcc/testsuite/gfortran.dg/class_transformational_1.f90 @@ -169,7 +169,7 @@ contains end subroutine unlimited_rebar (arg) - class(*) :: arg(:) + class(*), allocatable :: arg(:) ! Not having this allocatable => pr117901 call class_bar (arg) end