https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85927

--- Comment #2 from Nick Desaulniers <ndesaulniers at google dot com> ---
Sorry, probably:

__attribute__((naked))
unsigned long save_flags4(void) {
    asm volatile("pushf; pop %rax;ret;");
}

is a better example:

0000000000000000 <save_flags4>:
   0:   9c                      pushfq 
   1:   58                      pop    %rax
   2:   c3                      retq   
   3:   0f 0b                   ud2 

(gcc-7 replaces ud2 with another ret, but I guess both should work in
practice).

Reply via email to