<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/139220>139220</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            flang: recent regression - CXXFLAGS are passed to flang
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sylvestre
      </td>
    </tr>
</table>

<pre>
    A recent regression on linux: CXXFLAGS are passed to flang which doesn't understand 

```
[...]
-DCMAKE_CXX_FLAGS="-O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=3" \
[...]
FAILED: flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90-pp.f90 flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90.o.ddi 
/build/source/build-llvm/bin/flang --target=x86_64-pc-linux-gnu -cpp -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/build/source/flang-rt/include -I/build/source/flang-rt/../flang/include -I/build/source/build-llvm/runtimes/runtimes-bins/flang-rt -g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fstack-protector-strong -fstack-clash-protection -fcf-protection -O3 -module-dirflang-rt/lib/runtime -fno-lto -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -E /build/source/flang/module/iso_fortran_env_impl.f90 > flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90-pp.f90 && /usr/bin/cmake -E cmake_ninja_depends --tdi=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/FortranDependInfo.json --lang=Fortran --src=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90-pp.f90 --out=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90-pp.f90 --dep=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90-pp.f90.d --obj=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90.o --ddi=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build/source/flang/module/iso_fortran_env_impl.f90.o.ddi --src-orig=/build/source/flang/module/iso_fortran_env_impl.f90
flang-21: error: unknown argument: '-mno-omit-leaf-frame-pointer'
flang-21: error: unknown argument: '-fstack-protector-strong'
flang-21: error: unknown argument '-fstack-clash-protection'; did you mean '-Xclang -fstack-clash-protection'?
flang-21: error: unknown argument '-fcf-protection'; did you mean '-Xclang -fcf-protection'?
```

Full log:
https://llvm-jenkins.debian.net/job/llvm-toolchain-bookworm-binaries/architecture=amd64,distribution=bookworm,label=amd64/1321/consoleFull

Regression range:
6c4dd8d1d2f1e81c2b309924afb255b58a31ceb2..b006756d44def73fda09c7cb99b1c2347436aadb 

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMV99v2yoU_mvIC8KyIbGThzy4cTxFt22mptN6nywM2KHFYAHu1v_-CidZf2zrNHW6qxQp9jmH4-98fMCBOidbLcQSzM7ArJjQwe-NXboHdS-ct2JSG_6wzKEVTGgPrWitcE4aDY2GSurhKyA5XN3clOf5hx2kVsCeOic49AY2iuoWftlLtofcCKcBzjwcNBfWeao5BHEefml8_MU5mJ1FUQRmBYhzVKwu8n_W1ermphrTA1IAjNGWQNRog0wnPWos7QTqjdReWIi6k10J2rx0Ns5Tdod6a7xg3ljkvDW6_eZgirr9yR1qRJ8bYzvqIfosrDUWkOJgQ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