From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 270CE3858C31; Tue, 24 Jan 2023 10:52:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 270CE3858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674557550; bh=EyU9Kuvn7oZiLEeiITZ6iD+18XaoS++nwK4ZRXNqFXg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aJPql1jdTXz8FYC1QCtITNnvKYeMhfwS7rH3uwlBgBcYZkVc9KO+aXCgF0JleEgtR SnbeAZjFzwCmDzKHyohF3rUqp607C9g/Ss3MxkISmA65aQnZOOgcwggUeSfhZ4Wyke c8fe+zaRukYB/iNzbHVpcAny1r1huLBhmvcwrja0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug driver/106624] [13 Regression] LTO plugin fails to build in parallel builds: xgcc: fatal error: cannot execute '/build/build/./prev-gcc/collect2': execv: Bad address since r13-2011-g53e3b2bf16a486 Date: Tue, 24 Jan 2023 10:52:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: driver X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106624 --- Comment #13 from CVS Commits --- The releases/gcc-12 branch has been updated by Martin Liska : https://gcc.gnu.org/g:193f7e62815b4089dfaed4c2bd34fd4f10209e27 commit r12-9061-g193f7e62815b4089dfaed4c2bd34fd4f10209e27 Author: Sergei Trofimovich Date: Tue Aug 16 12:35:07 2022 +0100 driver: fix environ corruption after putenv() [PR106624] The bug appeared afte r13-2010-g1270ccda70ca09 "Factor out jobserver_active_p" slightly changed `putenv()` use from allocating to non-allocating: -xputenv (concat ("MAKEFLAGS=3D", dup, NULL)); +xputenv (jinfo.skipped_makeflags.c_str ()); `xputenv()` (and `putenv()`) don't copy strings and only store the pointer in the `environ` global table. As a result `environ` got corrupted as soon as `jinfo.skipped_makeflags` store got deallocated. This started causing bootstrap crashes in `execv()` calls: xgcc: fatal error: cannot execute '/build/build/./prev-gcc/collect2= ': execv: Bad address The change restores memory allocation for `xputenv()` argument. gcc/ PR driver/106624 * gcc.cc (driver::detect_jobserver): Allocate storage xputenv() argument using xstrdup(). (cherry picked from commit 2b403297b111c990c331b5bbb6165b061ad2259b)=