https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63450
Bug ID: 63450 Summary: Optimizing -O3 generates rep ret on an almost empty function Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: lc at luiscoloradosistemas dot com When I try to compile this piece of code: $ cat pru.c void f() { int b=0; } using gcc -O3 -S -o pru.S pru.c I get this assembler output: $ gcc -O3 -S -o - pru.c .file "pru.c" .text .p2align 4,,15 .globl f .type f, @function f: .LFB0: .cfi_startproc rep <<<<<<<<< string prefix just before a ret ??? ret .cfi_endproc .LFE0: .size f, .-f .ident "GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-3)" .section .note.GNU-stack,"",@progbits In some other cases I have got even the `rep' and the `ret' in the same line, so the assembler complained about it (in release 2.20 of the assembler, not in later 2.23.2) with this piece of code: $ cat program.c #include <stdio.h> void printer(void) { int a=0; printf("%d\n", a); } void setter(void) { int b = 42; } int main() { setter(); printer(); return 0; } arch: Linux ***** 2.6.32-358.23.2.el6.x86_64 #1 SMP Sat Sep 14 05:32:37 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux compiler version: gcc-4.8 (GCC) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.