{"id":2232181,"url":"http://patchwork.ozlabs.org/api/patches/2232181/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/yddse881z3o.fsf@CeBiTec.Uni-Bielefeld.DE/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<yddse881z3o.fsf@CeBiTec.Uni-Bielefeld.DE>","list_archive_url":null,"date":"2026-05-03T12:01:15","name":"c++: modules: Fix posix_fallocate error handling","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e00c902ad5c671b6080d8a92a27917cfb9bacfc3","submitter":{"id":4362,"url":"http://patchwork.ozlabs.org/api/people/4362/?format=json","name":"Rainer Orth","email":"ro@CeBiTec.Uni-Bielefeld.DE"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/yddse881z3o.fsf@CeBiTec.Uni-Bielefeld.DE/mbox/","series":[{"id":502574,"url":"http://patchwork.ozlabs.org/api/series/502574/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=502574","date":"2026-05-03T12:01:15","name":"c++: modules: Fix posix_fallocate error handling","version":1,"mbox":"http://patchwork.ozlabs.org/series/502574/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232181/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232181/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=cebitec.uni-bielefeld.de header.i=@cebitec.uni-bielefeld.de\n header.a=rsa-sha256 header.s=20200306 header.b=AxaNMOCJ;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=cebitec.uni-bielefeld.de header.i=@cebitec.uni-bielefeld.de\n header.a=rsa-sha256 header.s=20200306 header.b=AxaNMOCJ","sourceware.org; dmarc=none (p=none dis=none)\n header.from=CeBiTec.Uni-Bielefeld.DE","sourceware.org;\n spf=pass smtp.mailfrom=cebitec.uni-bielefeld.de","server2.sourceware.org;\n arc=none smtp.remote-ip=129.70.160.84"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g7k0F2hXfz1y04\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 03 May 2026 22:01:49 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 385284B9DB5E\n\tfor <incoming@patchwork.ozlabs.org>; Sun,  3 May 2026 12:01:46 +0000 (GMT)","from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE\n [129.70.160.84])\n by sourceware.org (Postfix) with ESMTPS id B83A84BB24E8;\n Sun,  3 May 2026 12:01:17 +0000 (GMT)","from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1])\n by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id C5B08DC2EC;\n Sun,  3 May 2026 14:01:16 +0200 (CEST)","from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1])\n by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new,\n port 10026)\n with ESMTP id NoeM9W2KB6wm; Sun,  3 May 2026 14:01:16 +0200 (CEST)","from manam.CeBiTec.Uni-Bielefeld.DE (p508551ea.dip0.t-ipconnect.de\n [80.133.81.234]) (Authenticated sender: ro)\n by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 058CFDC2EB;\n Sun,  3 May 2026 14:01:15 +0200 (CEST)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 385284B9DB5E","OpenDKIM Filter v2.11.0 sourceware.org B83A84BB24E8"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org B83A84BB24E8","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org B83A84BB24E8","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777809678; cv=none;\n b=Amuu1Og7g/zPVb/4NIRB/3wLjYOM4L/rsntGuC+6mjx9BiZCncvHBSb17HtqOg7kyh76eJqfDYusNNqmFRHaEUUl8QQ72IUsGvuXYbWMAKVRsmykzJgbOIFQETrn6MbY3p8oKyvRzTpW+1r7HF24LvxsCfRWCoVW8ZqNh98P6kc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777809678; c=relaxed/simple;\n bh=etzJwPFZGUiG00xvl2z1Pzn7TURB9G0JFiSWssM9bP8=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=qK5cbluD17N3ljXUPhvN7NS7MyoekV9bcJuchuq94HRvd0l3pvK0vTLtZRNDk+B+Q70GnI4oKOkYZV2GSSBnx+RcHePc1KVgNNmE+Vf8f9W4Abv/xJ3K4U6hEwlgcM4V7Kvcto8n2VBnIwklqJf3bH3tctqmUFd0zrXRjOZA8QE=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=\n cebitec.uni-bielefeld.de; h=content-type:content-type\n :mime-version:user-agent:message-id:date:date:subject:subject\n :from:from:received:received; s=20200306; t=1777809676; bh=etzJw\n PFZGUiG00xvl2z1Pzn7TURB9G0JFiSWssM9bP8=; b=AxaNMOCJsK26anP2/Imtt\n WP8B3vdBee5rKtK9rnExamWniIqKfRzCLMRnXQyXCkyHgXlTWUwmID796gzIcNnn\n QXjKJKtmG84mwBSYGOZY8NqqkmWOMLb+OU/ui6R5/uri4gDlMEjKd1XcELVy1NXO\n 9XdzJspKAa7Rp+Qd8OZl1E4sNW+q/L45lE1Y6eY919vpoqeQSBkDYMpvXNHSC3J3\n HbkUgMvkcwQCH9rDI//h8ihkc2/usVTMv45M7vdP34nzcffbc/s3y2S++oILLKdT\n 2WXlXj96N+xkYlBchqBsELLZhG6cg2hh6bzvyAhiTNXks8/Np/T2V7KE9K2Du2d0\n Q==","X-Virus-Scanned":"amavisd-new at cebitec.uni-bielefeld.de","From":"Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>","To":"gcc-patches@gcc.gnu.org","Cc":"Patrick Palka <ppalka@gcc.gnu.org>","Subject":"[PATCH] c++: modules: Fix posix_fallocate error handling","Date":"Sun, 03 May 2026 14:01:15 +0200","Message-ID":"<yddse881z3o.fsf@CeBiTec.Uni-Bielefeld.DE>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"=-=-=\"","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"When testing GCC on FreeBSD in a ZFS build directory, every single\ng++.dg/modules test FAILS like\n\nFAIL: g++.dg/modules/100616_a.H (internal compiler error: Segmentation fault)\nFAIL: g++.dg/modules/100616_a.H (test for excess errors)\nFAIL: g++.dg/modules/100616_a.H module-cmi  (gcm.cache/\\$srcdir/g++.dg/modules/100616_a.H.gcm)\n\nfor a total of almost 2200.  This happens because posix_fallocate\nreturns ENOTSUP as documented in IEEE 1003.1-2024/XPG8:\n\n[ENOTSUP]\n    The underlying file system does not support this operation.\n\nHowever, module.cc (elf_out::create_mapping) only falls back to\nftruncate for a return value of EINVAL.  This won't happen on\nglibc-based systems because posix_fallocate itself emulates the\nalloction under the hood, so the error is never exposed.\n\nThe patch is trivial: just also expect ENOTSUP in this situation, which\nfixes all related failures.\n\nBootstrapped without regressions on amd64-pc-freebsd15.0,\ni386-pc-solaris2.11, and x86_64-pc-linux-gnu.\n\nOk for trunk?\n\n\tRainer","diff":"# HG changeset patch\n# Parent  162b0ebe1e96e55fc1b8f6c8f933dd24fdfedf12\nc++: modules: Fix posix_fallocate error handling\n\ndiff --git a/gcc/cp/module.cc b/gcc/cp/module.cc\n--- a/gcc/cp/module.cc\n+++ b/gcc/cp/module.cc\n@@ -1912,7 +1912,7 @@ elf_out::create_mapping (unsigned ext, b\n     {\n #ifdef HAVE_POSIX_FALLOCATE\n       int result = posix_fallocate (fd, offset, length);\n-      if (result != EINVAL)\n+      if (result != EINVAL && result != ENOTSUP)\n \treturn result == 0;\n       /* Not supported by the underlying filesystem, fallback to ftruncate.  */\n #endif\n","prefixes":[]}