The problem can be replicated with below code, which runs fine on RHEL6/gcc 4.4 whereas it throws segmentation fault on RHEL9/gcc 11.3
<< coredump.c >>
#include<stdio.h>
#include<stdlib.h>
int main()
{
printf("nIn mainn");
printf("n %s: This statement fails on RH9n");
exit(0);
}
I’ve built executable by running below commands –
cc -c coredump.c
cc -o coredump coredump.o
On RHEL6/gcc 4.4, it runs as below:
./coredump
In main
: This statement fails on RH9
gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
On RHEL9/gcc 11.3, it fails with segmentation fault.
./coredump
In main
Segmentation fault (core dumped)
echo $?
139
gcc --version
gcc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Is there a way to replicate behavior of RH6/gcc 4.4 on RH9/gcc 11.3
Thanks.