From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by sourceware.org (Postfix) with ESMTPS id 689A03858D20 for ; Sun, 11 Feb 2024 02:00:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 689A03858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: sourceware.org; spf=none smtp.mailfrom=troutmask.apl.washington.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 689A03858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=128.95.76.21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707616847; cv=none; b=HLNypu/8acUnhfIKowmNRXQs2xVkpr1LVzz0UPVVH8ZmfO9Gu2iQN+Q40c51HAxN1j7qdGhAGlf13s6VlrOvCEpoqxQ9un4tbZSIK/8tWAn9oCcbv4HxE+fp47oFbCkZw+vnU0swsdVWRBI0q42MtvVEQu9nMQCytHSdEf7ncmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707616847; c=relaxed/simple; bh=cgEuJ5Fr5rFWDkC5Wf6xJE7DG89PrLMusUSHEBQue5M=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=A9D7UJkA4MEvJE+yPpNRfOKeIg6qqd+rMwe3c6FQSIenrkFcPJ7OsQx8YtAHVsdISA7Eyj5nwUj54hQ7XL0hTiaFCLY1+h3xuS0XkP26qmCrTwIsOe8XGeg7VTU1fyMlBVz/2FSpGlxvsso0P+Xlg7AcqH73M8tCbnj8Rnw2yvg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.17.1/8.17.1) with ESMTP id 41B20hQX050169 for ; Sat, 10 Feb 2024 18:00:43 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) DKIM-Filter: OpenDKIM Filter v2.10.3 troutmask.apl.washington.edu 41B20hQX050169 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=troutmask.apl.washington.edu; s=troutmask; t=1707616843; bh=cgEuJ5Fr5rFWDkC5Wf6xJE7DG89PrLMusUSHEBQue5M=; h=Date:From:To:Subject:Reply-To:From; b=ASDK+fiYxTDr0vt+r2cEpb9oZ9Fn+K29qV94BjiObMm5bXZnReu72YFbH8ivMm2xq 5qT6qucap7AE13z7UhV/SL3h+JThAN3NQHzLZJIXpBipwrK5C50GDUn6NYVxVW0Aik JJ1Mt1L8FonmndsKgIae+i7gU/lAZcqsfOMm06LGCLzK/fEoNsREjxZsdgRa46O5qG Avo3lnfY0+UIb8Rt638c5LcBSBK+8VDZqJ+Y4CtlYAOg3VL1S/GZViCBiwb5gJDjJK 5jEamCv1z/NZp2H6jz0dmk9IOBvt4jNuoQqekWFrXN4P4u8RJ1N4BDz7LAIXKFboIR BqjAzlx7n5iSw== Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.17.1/8.17.1/Submit) id 41B20grN050168 for fortran@gcc.gnu.org; Sat, 10 Feb 2024 18:00:42 -0800 (PST) (envelope-from sgk) Date: Sat, 10 Feb 2024 18:00:42 -0800 From: Steve Kargl To: fortran@gcc.gnu.org Subject: Need a hint or more likely help Message-ID: Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: All, consider this simple code: module foo contains subroutine bar character(len=:), allocatable :: s(:) call bah(s) end subroutine bar end module foo If one compiles with -fdump-tree-original, one see (with some pruning) void bar () { integer(kind=8) .s; struct array01_character(kind=1) s; The above two lines seem to be ok. bitsizetype D.4319; sizetype D.4320; try { D.4319 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <.s> * 8; D.4320 = (sizetype) NON_LVALUE_EXPR <.s>; s.data = 0B; s.dtype = {.elem_len=(unsigned long) .s, .version=0, .rank=1, .type=6}; bah ((character(kind=1)[0:][1:.s] * restrict) s.data, .s); } This is bad. .s is undefined. I've trace this to trans-array.cc:11531 if (sym->ts.type == BT_CHARACTER && !INTEGER_CST_P (sym->ts.u.cl->backend_decl)) { gfc_conv_string_length (sym->ts.u.cl, NULL, &init); gfc_trans_vla_type_sizes (sym, &init); The problem here is that sym->ts.u.cl->length == NULL. If I change the conditional to if (sym->ts.type == BT_CHARACTER && sym->ts.u.cl->length && !INTEGER_CST_P (sym->ts.u.cl->backend_decl)) then the option -fdump-tree-original produces void bar () { integer(kind=8) .s; struct array01_character(kind=1) s; try { s.data = 0B; s.dtype = {.elem_len=(unsigned long) .s, .version=0, .rank=1, .type=6}; bah ((character(kind=1)[0:][1:.s] * restrict) s.data, .s); } which looks good except I don't know what the reference to .s here means. Is this correct or should we set .s to zero by artificially setting sym->ts.u.cl->length to, say, zero length? -- Steve