From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 7F4923857C5D for ; Fri, 22 Jul 2022 10:38:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F4923857C5D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,185,1654588800"; d="diff'?scan'208";a="80045948" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 22 Jul 2022 02:38:38 -0800 IronPort-SDR: 81/y0p1ej0ngebGronQ6C9Bk6aPaht1tZk5/DxpH8D5feNMADhYTuBSMBhGxAWhxlp/PpiATKX w60YUuTLInRhwmQIVXQ3Jf2xHGijJBWK+OsUiO5rHBILUyZ5s3hEL0fH5fpexUYWjSQiEQlhFm TY+0DWzhZkjClB1rh4WZHB7AsGlc12zMh7n4VNAdhuVzat6NioqimYTmPPp7yV+2O9368vXkcc acTAV0uLQRjNohFBIk0lQNH12Upr/sujTJlveyzqljlXThacXueWXliIzziTHcRoS/O+tgX4Lt hcA= Content-Type: multipart/mixed; boundary="------------ab3BLE4aM5xNTiBSKsrzlVqk" Message-ID: Date: Fri, 22 Jul 2022 12:38:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: gcc-patches , Jakub Jelinek From: Tobias Burnus Subject: [Patch] OpenMP requires: Fix diagnostic filename corner case X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2022 10:38:44 -0000 --------------ab3BLE4aM5xNTiBSKsrzlVqk Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable This patch addresses a corner case which causes a filename confusion: lto1: error: OpenMP 'requires' directive with 'unified_address' specifie= d only in some compilation units lto1: note: '1.c' has 'unified_address' lto1: note: but '1.c' has not lto1: fatal error: errors during merging of translation units This happens, e.g., for a source code like the following, where two files are identical except that only one has an additional '#pragma omp requires'= : ---------------- int main () { int i; #pragma omp target map(from:i) i =3D 1; return i; } ---------------- Both have 'main._omp_fn.0' - which gets merged to the same decl such that the source file will be identical. Without the fatal error shown for requires, it would fail later during liking due to having the same symbol ('main') multiple times - but that additional diagnostic is not reached, leaving one puzzled. I did run into this with 'gcc -fopenmp test_*.c' missing that I had a second file in that dir which also started with test_... OK for mainline? Or do you think adding a testcase makes sense? Tobias PS: It might also be possible to generate this with class instantiations for valid code - other than the requires mismatch. PPS: If compiles as 'gcc -fopenmp .c' / in the testsuite, the new inform will be: lto1: note: '/tmp/ccAs0w67.o' has 'unified_address' lto1: note: but '/tmp/ccv6XCfc.o' has not That avoids the issue with showing the sane name but is not perfect, either= . But that's a known issue and splittitng compiling from linking will improve the diagnostic! ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955 --------------ab3BLE4aM5xNTiBSKsrzlVqk Content-Type: text/x-patch; charset="UTF-8"; name="requires-loc-fix.diff" Content-Disposition: attachment; filename="requires-loc-fix.diff" Content-Transfer-Encoding: base64 T3Blbk1QIHJlcXVpcmVzOiBGaXggZGlhZ25vc3RpYyBmaWxlbmFtZSBjb3JuZXIgY2FzZQoK VGhlIGlzc3VlIG9jY3VycyB3aGVuIHRoZXJlIGlzLCBlLmcuLCBtYWluLl9vbXBfZm4uMCBp biB0d28gZmlsZXMgd2l0aApkaWZmZXJlbnQgT3Blbk1QIHJlcXVpcmVzIGNsYXVzZXMuICBU aGUgZnVuY3Rpb24gZW50cmllcyBpbiB0aGUgb2ZmbG9hZAp0YWJsZSBlbmRzIHVwIGhhdmlu ZyB0aGUgc2FtZSBkZWNsIHRyZWUgYW5kLCBoZW5jZSwgdGhlIGRpYWdub3N0aWMgc2hvd2Vk CnRoZSBzYW1lIGZpbGVuYW1lIGZvciBib3RoLiAgU29sdXRpb246IFVzZSB0aGUgLm8gZmls ZW5hbWUgaW4gdGhpcyBjYXNlLgoKTm90ZSB0aGF0IHRoZSBpc3N1ZSBkb2VzIG5vdCBvY2N1 ciB3aXRoIHNhbWUtbmFtZWQgJ3N0YXRpYycgZnVuY3Rpb25zIGFuZAp3aXRob3V0IHRoZSBm YXRhbCBlcnJvciBmcm9tIHRoZSByZXF1aXJlcyBkaWFnbm9zdGljLCB0aGVyZSB3b3VsZCBi ZQpsYXRlciBhIGxpbmtlciBlcnJvciBkdWUgdG8gaGF2aW5nIHR3byAnbWFpbicuCgpnY2Mv CgkqIGx0by1jZ3JhcGguY2MgKGlucHV0X29mZmxvYWRfdGFibGVzKTogSW1wcm92ZSByZXF1 aXJlcyBkaWFnbm9zdGljCgl3aGVuIGZpbGVuYW1lcyBjb21lIG91dCBpZGVudGljYWxseS4K CmRpZmYgLS1naXQgYS9nY2MvbHRvLWNncmFwaC5jYyBiL2djYy9sdG8tY2dy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