https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78253
--- Comment #3 from Christophe Lyon <clyon at gcc dot gnu.org> --- Compile the attached code with: CFLAGS="-marm -fpie" arm-linux-gnueabi-gcc $CFLAGS -c main.c -o main.o arm-linux-gnueabi-gcc $CFLAGS -c some_module.c -o some_module.o Link with arm-linux-gnueabi-gcc -pie -o test_weak main.o some_module.o Correct execution should show: Entering test_weak_funcion_call This line is to avoid optimization in further call_weak_by_pointer res_pointer_call = 11 res_direct_call = 11 All Ok But instead we have: Entering test_weak_funcion_call This line is to avoid optimization in further call_weak_by_pointer res_pointer_call = 10 res_direct_call = 11 ERROR: Results from direct call and from call via pointer differs The behaviour changed with r220674.