fpga_load segmentation faul when compiled under gcc 12.2
In Debian bookworm using gcc 12.2.0-14 compiling fpga_load with the standard arguments in makefile results in segmentation faul:
root@mdis-setup1:/home/dua/jensen/13MD05-90/MDISforLinux/TOOLS/FPGA_LOAD# ./fpga_load 0x1172 0x4d45 0x4b 0 -t
BARs of FPGA PCI device 14:10.0:
BAR0: 0x0000d000; size: 0x00001000, mapType: IO;
BAR1: 0x0000e200; size: 0x00000100, mapType: IO;
BAR2: 0x91620000; size: 0x00010000, mapType: MEM;
BAR3: 0x91610000; size: 0x00010000, mapType: MEM;
BAR4: 0x91600000; size: 0x00010000, mapType: MEM;
BAR5: 0x00000000; size: 0x00000000, mapType: unused;
Information about the Chameleon FPGA:
FPGA File=' �@ ��@ ' table model=0x41('A') Revision 2.0 Magic 0xCDEF
Segmentation fault (core dumped)
Stacktrace:
Core was generated by `./fpga_load 0x1172 0x4d45 0x4b 0 -t'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000400000 in ?? ()
(gdb) bt
#0 0x0000000000400000 in ?? ()
#1 0x000000000040810c in Get_Chameleon.constprop.0 ()
#2 0x0000000000409a03 in Z100_PciInit ()
#3 0x000000000040233b in main ()
This does not happen when compiling with debug options: make V=1 DEBUG=dbg CODE_COVERAGE=-g
the difference is that when failing it compiles with -O2 and with the debug options gcc uses -O0 -g