GCC generates wrong code for some control flow under -O2 on X86_64. See attached t.c for source and t.s for assembly. The code would return wrong result in case the first function call returns ERR_NONE and the second returns 1.
/path/to/wrlinux-6/wrlinux/configure --enable-board=intel-x86-64 --enable-rootfs=glibc_small --enable-kernel=preempt_rt ./host-cross/usr/bin/x86_64-wrs-linux/i686-wrs-linux-gnu-gcc -O2 -m64 -S t.c