I am the OP. Sorry for my fault. It should be "+m" instead of "+a" for using the memory instead of register.
"+m"
"+a"
I modified the code to:
asm ("incl %0":"+m"(global_counter));
Problem solved.