Issue 154431
Summary Regression: segfault in simple hello world when using glibc 2.32-2.35 on x86_64
Labels new issue
Assignees
Reporter rautyrauty
    Hello everyone I'm trying to push a new llvm (19 or 20) into an older branch of my linux distribution, but there's a problem with glibc 2.32 that I cannot solve.
I have two options: either fix llvm, or patch the glibc 2.32. I don't know how to do either.

### helloworld.c
```c
#include <stdio.h>

int main() {
    printf("hello world\n");
    return 0;
}
```

### Description
Simple hello world program crashes with segmentation fault when compiled with LLVM 19 and LLVM 20 on systems with glibc 2.32-2.35. 

### Steps to Reproduce
1. `clang-19 helloworld.c -o hello`
2. `./hello`

### Expected Behavior
"hello world" output

### Actual Behavior
Segmentation fault

### Environment
- OS: ALT Linux
- glibc: 2.32 (also reproduced on 2.34, 2.35)
- LLVM: 19.1.7, 20.1.8
- Architecture: x86_64

### Additional Notes
- Works fine with GCC 10.3.1
- Works fine with LLVM 17.0.6
- Works fine with LLVM 20.1.8 and updated glibc 2.35 to https://sourceware.org/git/?p=glibc.git;a=commit;h=3f63f9dfe1dbb11486914b3fec767041fa6c7c95, but I can't update glibc to 2.35, only patch 2.32.
- Works with glibc 2.38+

### test.sh (yes, there is a double typo clang-20):
```bash
#!/bin/bash -x
pushd "$HOME" || return 1
cat > helloworld.c <<EOF
#include <stdio.h>

int main() {
    printf("hello world\n");
    return 0;
}
EOF

rpm -q glibc

echo "=========== clang-19 ============="
clang-19 -v
clang-19 helloworld.c -o hello19
./hello19
clang-19 -c -o helloworld19.bc helloworld.c -emit-llvm
lli-19 helloworld19.bc

echo "=========== clang-20 ============="
clang-20 -v
clang-20 helloworld.c -o hello20
./hello20
clang-20 -c -o helloworld20.bc helloworld.c -emit-llvm
lli-20 helloworld20.bc

echo "=========== clang-20 ============="
gcc -v
gcc helloworld.c -o hellogcc
./hellogcc
```

### Logs:
With glibc 2.32:

[llvm-hello-world-glibc-2-32.log](https://github.com/user-attachments/files/21870510/llvm-hello-world-glibc-2-32.log)

With glibc 2.35 updated to https://sourceware.org/git/?p=glibc.git;a=commit;h=24962427071fa532c3c48c918e9d64d719cc8a6c:

[llvm-hello-world-glibc-2-35-0-5.log](https://github.com/user-attachments/files/21870530/llvm-hello-world-glibc-2-35-0-5.log)

With glibc 2.35 updated to https://sourceware.org/git/?p=glibc.git;a=commit;h=3f63f9dfe1dbb11486914b3fec767041fa6c7c95:

[llvm-hello-world-glibc-2-35-0-234.log](https://github.com/user-attachments/files/21870549/llvm-hello-world-glibc-2-35-0-234.log)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to