- 
                Notifications
    
You must be signed in to change notification settings  - Fork 929
 
Description
Since quite some time now (~3 months), I have been encountering a segmentation fault / illegal hardware instruction, possibly in MPI_Init() when running with -fsanitize=address. I switched to using valgrind instead, where this does not happen. However, I would like to return to using sanitizers because they are faster. The issue occurs with both clang / gcc.
Background information
- openmpi 5.0.6
 - clang 19.1.7
 - gcc 14.2.1
 
I installed all of these with the package manager of my linux distribution (pacman, arch).
My OS is Arch Linux, my host is a ThinkPad X1 Carbon Gen 11. This happens on my local machine, so no network.
Details of the problem
Code that produces segmentation fault:
#include <mpi.h>
int main(int argc, char **argv)
{
    MPI_Init(&argc, &argv);
    MPI_Finalize();
}
Compiling and running with clang consistently produces:
$ OMPI_MPICC=clang mpicc -fsanitize=address test.c -o test && ./test
[x1carbon:317427:0:317427] Caught signal 11 (Segmentation fault: address not mapped to object at address 0x1000)
zsh: segmentation fault  ./test
Compiling and running with gcc produces sometimes:
[x1carbon:317515:0:317515] Caught signal 4 (Illegal instruction: illegal operand)
AddressSanitizer:DEADLYSIGNAL
=================================================================
==317515==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x72aa6e4526af bp 0x72aa6d243dc0 sp 0x72aa6d243db8 T0)
==317515==The signal is caused by a READ memory access.
==317515==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.
and sometimes this:
[x1carbon:317530:0:317530] Caught signal 4 (Illegal instruction: illegal operand)
zsh: illegal hardware instruction (core dumped)  ./test
I would expect this code to run at most with warnings about leaks, but not with segmentation faults.
I could not find anybody else with my system configuration having the same issue, so it might be totally my fault.