http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57514
Bug ID: 57514 Summary: -fno-align-functions doesn't work on member functions Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com [hjl@gnu-6 tmp]$ cat a.cc class Foo { public: void yyy (); }; void Foo::yyy () { } [hjl@gnu-6 tmp]$ gcc -S a.cc -fno-align-functions -O3 [hjl@gnu-6 tmp]$ cat a.s .file "a.cc" .text .align 2 .globl _ZN3Foo3yyyEv .type _ZN3Foo3yyyEv, @function _ZN3Foo3yyyEv: .LFB0: .cfi_startproc rep ret .cfi_endproc .LFE0: .size _ZN3Foo3yyyEv, .-_ZN3Foo3yyyEv [hjl@gnu-6 tmp]$ gcc -S a.cc -O3 [hjl@gnu-6 tmp]$ cat a.s .file "a.cc" .text .align 2 .p2align 4,,15 .globl _ZN3Foo3yyyEv .type _ZN3Foo3yyyEv, @function _ZN3Foo3yyyEv: .LFB0: .cfi_startproc rep ret .cfi_endproc .LFE0: .size _ZN3Foo3yyyEv, .-_ZN3Foo3yyyEv C++ front end has /* If pointers to member functions use the least significant bit to indicate whether a function is virtual, ensure a pointer to this function will have that bit clear. */ if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn && TREE_CODE (type) == METHOD_TYPE && DECL_ALIGN (decl) < 2 * BITS_PER_UNIT) DECL_ALIGN (decl) = 2 * BITS_PER_UNIT; But the function alignment is controlled by -falign-functions and backends. All member functions may be aligned to 16 byte on x86. How does C++ run-tim use the least significant bit to indicate whether a member function is virtual?