LinuxCNC/linuxcnc

Forced -O0 on rtapi/rtapi_pci.cc

Opened this issue · 2 comments

Compiling the rtapi part results in a warning:

In file included from /usr/include/spawn.h:22,
                 from rtapi/rtapi.h:994,
                 from rtapi/rtapi_pci.cc:34:
/usr/include/features.h:414:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]

The problem is caused by an explicit -O0 optimization flag in src/rtapi/Submakefile (line 17). The problem tracks down to the original commit of the PCI interface: 96b73e4

My guess is that it has been in there to while developing/debugging the code.

The -O0 flag should be removed and then someone needs to test this on a system with a PCI card. The original commit linked above mentions that the code is for hm2_pci cards to work. Maybe @pcw-mesa or others with a HM2 PCI card can help with testing removal of the -O0 flag and thereby getting rid of the warning?

I can test this sometime today or tomorrow

OK LInuxCNC seems to run unchanged on a PCI card with the -O0 flag removed

rmu75 commented

Watch out, using -O0 is exactly the thing you would do to "fix" the compiler optimizing away code that depends on undefined bevahiour.