[Bug c/63450] New: Optimizing -O3 generates rep ret on an almost empty function

2014-10-03 Thread lc at luiscoloradosistemas dot com
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
.typef, @function
f:
.LFB0:
.cfi_startproc
rep  <<<<<<<<< string prefix just before a ret ???
ret
.cfi_endproc
.LFE0:
.sizef, .-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 

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.


[Bug c/63450] Optimizing -O3 generates rep ret on an almost empty function

2014-10-03 Thread lc at luiscoloradosistemas dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63450

--- Comment #1 from Luis Colorado  ---
when i compile a completely empty function i get the rep ret in the same line.


[Bug c/63450] Optimizing -O3 generates rep ret on an almost empty function

2014-10-05 Thread lc at luiscoloradosistemas dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63450

--- Comment #3 from Luis Colorado  ---
just one thing.  When you compile a completely empty function you get `rep ret'
in one line, instead of that on two lines.  The result is some assemblers (gnu
as at version 2.20, for example) complainting it as an error and you don't get
a good compilation.