From: Paul-Antoine Arras <[email protected]>
Since r17-1526-g619a5e5586759a
"driver: Spill long COLLECT_GCC_OPTIONS to a response file [PR111527]"
it is not safe to use a raw getenv call to read COLLECT_GCC_OPTIONS.
Even though these instances only check whether the env var is set but do not
look up its value, change to use read_collect_gcc_options for consistency and to
avoid future issues.
PR driver/111527
gcc/ChangeLog:
* config/gcn/mkoffload.cc (compile_native): Use
read_collect_gcc_options instead of getenv.
* config/nvptx/mkoffload.cc (compile_native): Likewise.
---
This is a forge pull request published on the gcc-patches mailing list mailing
list
as requested by Paul-Antoine Arras via Sourceware Forge
<[email protected]>.
Forge discussion: https://forge.sourceware.org/gcc/gcc/pulls/261
Get it locally using:
```
git fetch forge-upstream "+refs/versioned_pull/261/*:refs/versioned_pull/261/*"
git switch -c "pr-261-v1" "refs/versioned_pull/261/1/head"
```
Or, download the patch at: https://forge.sourceware.org/gcc/gcc/pulls/261.diff
Created on: 2026-10-29 16:41:15+00:00
Latest update: 2026-10-29 17:23:30+00:00
Changes: 2 changed files, 2 additions, 2 deletions
Head revision: parras/gcc ref read_collect_gcc_options commit
3652703379b99d08d3e76a7d50365fd33f7e3571
Base revision: gcc/gcc ref trunk commit
17337464cf334e44ff3ecbf05062e665d256d242 r17-5742-g17337464cf334e
Merge base: 17337464cf334e44ff3ecbf05062e665d256d242
Requested Reviewers: tschwinge
Changed files:
- M: gcc/config/gcn/mkoffload.cc
- M: gcc/config/nvptx/mkoffload.cc
gcc/config/gcn/mkoffload.cc | 2 +-
gcc/config/nvptx/mkoffload.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index 65bd81b9ba423..1fb5868377898 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -806,7 +806,7 @@ static void
compile_native (const char *infile, const char *outfile, const char *compiler,
bool fPIC, bool fpic)
{
- const char *collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS");
+ const char *collect_gcc_options = read_collect_gcc_options ();
if (!collect_gcc_options)
fatal_error (input_location,
"environment variable %<COLLECT_GCC_OPTIONS%> must be set");
diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc
index 6a2a3bc939b0e..fb85143603b73 100644
--- a/gcc/config/nvptx/mkoffload.cc
+++ b/gcc/config/nvptx/mkoffload.cc
@@ -592,7 +592,7 @@ static void
compile_native (const char *infile, const char *outfile, const char *compiler,
bool fPIC, bool fpic)
{
- const char *collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS");
+ const char *collect_gcc_options = read_collect_gcc_options ();
if (!collect_gcc_options)
fatal_error (input_location,
"environment variable COLLECT_GCC_OPTIONS must be set");
--
2.56.0