From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fencepost.gnu.org (fencepost.gnu.org [IPv6:2001:470:142:3::e]) by sourceware.org (Postfix) with ESMTPS id 473A7383A482 for ; Wed, 5 Jun 2024 01:35:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 473A7383A482 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=fastmail.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 473A7383A482 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717551323; cv=none; b=ZDm1BaRVRj9Lfcl8uv1Gx8njUFpl94yBtzjfsKsZ//6soUZUuENRBh9KBMFJmAJgLdt9pAUOyDPFLJLSjikZz5vtgvnkvbmh8deq0X4z535JYcXWbEaSi/N9qhqfLeqK6hRO1LgY4LMrVpYmt6hHB/+C7nKM0h8NJJbV9ZZMD0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717551323; c=relaxed/simple; bh=3qmWjaD5mmevDuuCPLlFJwwgUUsiPYrjV6043/WM12Q=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=Df4RmfzTvEPenRhhX4g3tSQOWZGkXVEsy42FLj/K3z/bnvPS9V0N/4MI9HUgQ+OjLV4Fsoi8vi2umTPjev2vAZjB2d8RDj1A47B0yaBs2Vwh7GMzgDpc2nTgGjaQdPEHKly1oFPCBYodxMm/DO1OUeB90kdGsivB6YU6Xk1xcIU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eggs.gnu.org ([2001:470:142:3::10]) by fencepost.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEfYa-0006ry-5i for bug-gcc@gnu.org; Tue, 04 Jun 2024 21:35:17 -0400 Received: from wfhigh7-smtp.messagingengine.com ([64.147.123.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEfYX-0005kN-Tm for bug-gcc@gnu.org; Tue, 04 Jun 2024 21:35:15 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id C3B281800144 for ; Tue, 4 Jun 2024 21:35:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 04 Jun 2024 21:35:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.org; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm1; t=1717551307; x=1717637707; bh=eX/eMffcgwXjJBKn1Qqa5eY27NSO8oaK bDTh1E9IFi0=; b=CeNZmt7q/XJJTeKlmM66slDB1pnPX9MBlpnwpk7HQpOZ0MGq u/k17oldYmNNk6DmXoaajiyrwuGWKTrnxGRIfD+8vxoldMpOsoHCeXPN/n4cJbj6 2aBQkGjEO5xfsdsN06rlPOXEnfWEbtxCO/yhmS3eVYx6Xg8D6c1Qvwd39fk/gT6Q TKxChuwXHqfeYFWiYO2sOqKcXeS1m5IgW329/DIeFSzi9IS8qbUcMMnZzZcLIija aw0NQve3ggZ9SZzkKU6+OpijS/q2uIXeTE2gP4tI695lwCMjf5Meh+2eV9GrSSoi 4lnucJtS8OxwfEgbdsXPX8ND6gUGvjHdU1sdEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1717551307; x=1717637707; bh=eX/eMffcgwXjJBKn1Qqa5eY27NSO8oaKbDT h1E9IFi0=; b=fkNWCdKbHjC4VwOHZS/O1Qe1s505/rCp7fZzt9Bl4Ndp/AiQu/a R705nsNafQkrXrINbMUUQ3pE0Vg+0EGrCHmilILmuodUtDRSVLXeKPF78oBSwbGw 3hSUpOkxPapfhov3eutRVp8/9VY+EmyWvRrmZXQhj9so6RJkGg3nafCI7vV4YNd6 +bprEKJ5FYJa52lOKWLZcKJVWNek3K0dCMNcn+xznip6YWJL+GMGVx5Q3sOY+Brt gyxqGcq9HSIdSu5mbR1/Lmvs60NJpkEg+7mLg/iuExASjoTz4ZK7OfBWTwrk+HIE BE3DZ27ft92Vs45FvyR9z+TFJsWEs/uxCZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelhedggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtsehttdertddttd dvnecuhfhrohhmpefurghtihhshhcuuegrlhgrhicuoegsrghlrgihrdgrnhhlsehfrghs thhmrghilhdrohhrgheqnecuggftrfgrthhtvghrnhepfeeikeelveegieehhfevieduie dvgfelvdeihfeggeeuieefueehuefffefhkeefnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepsggrlhgrhidrrghnlhesfhgrshhtmhgrihhlrd horhhg X-ME-Proxy: Feedback-ID: ie211494c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 4 Jun 2024 21:35:07 -0400 (EDT) Date: Tue, 4 Jun 2024 20:35:05 -0500 (CDT) From: Satish Balay To: bug-gcc@gnu.org Subject: gfortran-14.1.1: issue with -Jpath search order Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Received-SPF: pass client-ip=64.147.123.158; envelope-from=balay.anl@fastmail.org; helo=wfhigh7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VALID_EF=-0.1,FREEMAIL_FROM=0.001,RCVD_IN_DNSWL_LOW=-0.7,SPF_HELO_PASS=-0.001,SPF_PASS=-0.001,T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: A test case: >>>>>>>>> $ ls incdir/ moddir/ srcdir/ $ ls incdir/ $ ls moddir/ $ ls srcdir/ modtest.F90 $ cat srcdir/modtest.F90 module modtest integer a end module program main use modtest end $ gfortran --version GNU Fortran (GCC) 14.1.1 20240522 (Red Hat 14.1.1-4) Copyright (C) 2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ strace --follow-forks -o trace.log gfortran -Jmoddir -Iincdir srcdir/modtest.F90 $ <<<< >From trace.log: >>>> 231249 openat(AT_FDCWD, "moddir/modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 231249 unlink("moddir/modtest.mod") = -1 ENOENT (No such file or directory) 231249 rename("moddir/modtest.mod0", "moddir/modtest.mod") = 0 231249 openat(AT_FDCWD, "modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 231249 openat(AT_FDCWD, "srcdir/modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 231249 openat(AT_FDCWD, "incdir/modtest.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 231249 openat(AT_FDCWD, "moddir/modtest.mod", O_RDONLY) = 5 <<<< i.e after moddir/modtest.mod is created - its searched for in the following order: - pwd - src-file-dir - -Ipath - -Jpath With this search order - a buggy/old/incorrect modtest.mod in pwd or src-file-dir gets picked up - resulting in broken builds. Checking ifx from OneAPI - i see: >>>> $ ifx --version ifx (IFORT) 2023.0.0 20221201 Copyright (C) 1985-2022 Intel Corporation. All rights reserved. $ ifx --help |& grep -A2 \\-module -module path specify path where mod files should be placed and first location to look for mod files <<<< Here with ifx - I don't get into the issue with picking up buggy/old/incorrect modtest.mod. With a slightly tweaked test: >>>>>>>> $ cat srcdir/modtest.F90 module modtest integer a end module program main use modtestwrong end $ strace --follow-forks -o trace.log ifx -module moddir -Iincdir srcdir/modtest.F90 srcdir/modtest.F90(5): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MODTESTWRONG] use modtestwrong ----^ compilation aborted for srcdir/modtest.F90 (code 1) $ <<< trace.log has: >>> 1573952 openat(AT_FDCWD, "moddir/modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 1573952 openat(AT_FDCWD, "modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 1573952 openat(AT_FDCWD, "srcdir/modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 1573952 openat(AT_FDCWD, "./modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory) 1573952 openat(AT_FDCWD, "incdir/modtestwrong.mod", O_RDONLY) = -1 ENOENT (No such file or directory) ... <<<< [i.e; -Jpath is searched first, then pwd, src-file-dir, ./, -Ipath, ...] So is this a bug in gfortran? thanks, Satish