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

    <tr>
        <th>Summary</th>
        <td>
            Clang-8/9 hangs when compiling gnu-gsl package with Ofast option targeting arm_32 architecture
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    (I have reported the same issue to bug-gsl using the GNU mailing list. But no response.: [bug-gsl link](https://lists.gnu.org/archive/html/bug-gsl/2023-02/index.html))

Hi.
I'm working on a project where I compile with different optimization options for different target architectures in different compile versions.

Cross compilation failed when compiling gsl package. (compiler hang)

First, the compiled environment is inside the docker container, and the docker image is based on 'ubuntu:16.04'. The host running that docker conatiner is x86_64 Ubuntu 20.04.5 LTS.

The following is the result of executing 'uname -a' in an environment where compiling gsl fails.

```
$ uname -a
Linux 30a3b73aab3b 5.4.0-125-generic #141-Ubuntu SMP Wed Aug 10 13:42:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
```

Inside the 'ubuntu:16.04' docker container, I tried to build gsl with the following options.

- compiler version: gcc-4 ~ gcc-11 and clang-4 ~ clang-13
- target architecture: x86_64, x86_32, arm_32, arm_64, mips(eb)_32, mips_64
- optimization level: O0, O1, O2, O3, Os, Ofast

When I tried gsl for the above compiler options, it failed to compile in the following case.

- compiler version: clang-8 and clang-8
- target architecture: arm_32
- optimization level: Ofast

i.e. it failed to cross compile gsl with Ofast option with arm_32 target architecture with clang-8 and clang-9 in x86_64 environment. (In all other cases the gsl build succeeded.)


I also tried to build by downgrading the gsl version since the build failed on gsl-2.7.1. But gsl-2.7, gsl-2.6, gsl-2.5, gsl-2.4 all failed to build. (I haven't tried lower versions. I'd like to compile the highest version, gsl-2.7.1, if possible.)

The reason why the build failed was because of the 'compiler hang', and in particular, I analyzed which command the hang occurred when trying.

As a result of checking with the htop command, hang occurred while executing the two commands below, and it was confirmed that the size of the virtual memory occupied by the process executing these two commands increased to 42G.

- Commands to induce hang
```
/home/user/tools/clang/clang-8.0/bin/clang-8 -cc1 -triple armv4t-ubuntu-linux-gnueabi -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name mathieu_charv.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -fno-trapping-math -ffp-contract=fast -ffast-math -ffinite-math-only -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu arm7tdmi -target-feature +soft-float-abi -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi soft -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /home/user/tmp1/sources/gsl/gsl-2.7.1_clang-8.0_arm_32_Ofast_normal/specfunc/.libs/mathieu_charv.gcno -resource-dir /home/user/tools/clang/clang-8.0/lib/clang/8.0.0 -dependency-file .deps/mathieu_charv.Tpo -sys-header-deps -MP -MT mathieu_charv.lo -isysroot /home/user/tools//arm-ubuntu-linux-gnueabi-8.2.0/arm-ubuntu-linux-gnueabi/sysroot -isystem /home/user/tools//arm-ubuntu-linux-gnueabi-8.2.0/arm-ubuntu-linux-gnueabi/sysroot/usr/include -D HAVE_CONFIG_H -I . -I .. -I .. -I /home/user/tools//arm-ubuntu-linux-gnueabi-8.2.0/arm-ubuntu-linux-gnueabi/sysroot/usr/include -D PIC -internal-isystem /usr/local/include -internal-isystem /home/user/tools/clang/clang-8.0/lib/clang/8.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Ofast -fdebug-compilation-dir /home/user/tmp1/sources/gsl/gsl-2.7.1_clang-8.0_arm_32_Ofast_normal/specfunc -ferror-limit 19 -fmessage-length 172 -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o .libs/mathieu_charv.o -x c mathieu_charv.c -faddrsig

/home/user/tools/clang/clang-8.0/bin/clang-8 -cc1 -triple armv4t-ubuntu-linux-gnueabi -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name coulomb.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -fno-trapping-math -ffp-contract=fast -ffast-math -ffinite-math-only -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu arm7tdmi -target-feature +soft-float-abi -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi soft -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /home/user/tmp1/sources/gsl/gsl-2.7.1_clang-8.0_arm_32_Ofast_normal/specfunc/.libs/coulomb.gcno -resource-dir /home/user/tools/clang/clang-8.0/lib/clang/8.0.0 -dependency-file .deps/coulomb.Tpo -sys-header-deps -MP -MT coulomb.lo -isysroot /home/user/tools//arm-ubuntu-linux-gnueabi-8.2.0/arm-ubuntu-linux-gnueabi/sysroot -isystem /home/user/tools//arm-ubuntu-linux-gnueabi-8.2.0/arm-ubuntu-linux-gnueabi/sysroot/usr/include -D HAVE_CONFIG_H -I . -I .. -I .. -I /home/user/tools//arm-ubuntu-linux-gnueabi-8.2.0/arm-ubuntu-linux-gnueabi/sysroot/usr/include -D PIC -internal-isystem /usr/local/include -internal-isystem /home/user/tools/clang/clang-8.0/lib/clang/8.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Ofast -fdebug-compilation-dir /home/user/tmp1/sources/gsl/gsl-2.7.1_clang-8.0_arm_32_Ofast_normal/specfunc -ferror-limit 19 -fmessage-length 172 -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o .libs/coulomb.o -x c coulomb.c -faddrsig
```

Can you please confirm if it is possible to build(cross compile) gsl with Ofast option with arm_32 target architecture with clang-8 and clang-9 in x86_64 environment?

I am new to bug report and issue open. Required information may be missing.
If you request additional information, we will respond faithfully.
thank you
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWUuP4zby_zTqS4GCTPl56ENP99-TBpJM8M_M5tigqJLENEUqJGW357CffVGUbMseT7LA7iYIMIAhS2SxHr96UZTwXtUG8T5ZvEsWT3eiD41198F2sse7wpaH-4Svn6EROwSHnXUBSwgNghctgvK-RwgWir5mtdfQe2XqOP_-x0_QCqXpWSsfUnjXBzAWHPrOGo9pkj9Asnh3XKqVeU0WTwlfNyF0PskfEr5N-JYW-7Q2fWpdnfCtcLJRO0z4tgmtTvh2ZJDwLc94zjKe8K0yJb6lA8GGftlTkj0M1-9UOtw8J3zVwt66V1LSGhDQOfsrygD7Bh3CM0jbdkoj7FVooFRVhQ5NANsF1arPIihr4oM1HirrJiRBuBoDRG0DytA79KDMhOLIe4fOE4N0quSjs96PJIOYSiiNJWlmxnHSmpDrhHwVNaaQ8PXI1EEjTH1l-FY5HxL-GP0zEpaAZqecNS2ppEhFr0qMJKWVr-hAWhOEMuhoqTDldE61oqYwgEJ4LAnDhK_6ojehT_KH2TLN5glfpfCxQWisD-B6Y4YQEWEiQAQSQIze1suX5Rw-RR7AszSbpwv4_uPPF_AQv8pqbffETPmok0Pf6wC2AnxD2QeaInUMhSoTCV-RA4S5MHnw9CWgBPWlO5JlNv6GRz6HE9s48r0y_RvkmciLVS5EkRewSOdpxmZ8wWo06JSEhOez-YyNtv38w0_wC5bw0Ncwy2CWJ_nDnCf5Q5bDp4-PwDPOj3Bc_r3_8VPCt1HkbfWG8D578pZTbrr3GYJTlOGU0kqXEY4Y_OEC8THmLzBicAq-MaQpw2sp2Rz-Gf9nsxg_UgtTx8HhbpYfGdxIGuIxmE360V3OYyC6dnI3zLaq8wlfY5HwzThJQzQ7CrhIXI071MT_Q0akH2bxGpd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