Compilers avoid inlining functions that could violate program semantics, such as recursive functions (beyond a few levels), virtual functions called via base pointers, or functions whose address is taken. While keywords like `inline` are hints, `__attribute__((always_inline))` (GCC/Clang) or `__forceinline` (MSVC) strongly suggest inlining but can still be ignored if infeasible, whereas `__attribute__((noinline))` explicitly prevents it.