public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "lc at luiscoloradosistemas dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/63450] New: Optimizing -O3 generates rep ret on an almost empty function
Date: Fri, 03 Oct 2014 10:46:00 -0000	[thread overview]
Message-ID: <bug-63450-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-10-03 10:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 10:46 lc at luiscoloradosistemas dot com [this message]
2014-10-03 10:57 ` [Bug c/63450] " lc at luiscoloradosistemas dot com
2014-10-03 14:29 ` andi-gcc at firstfloor dot org
2014-10-06 14:53 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-63450-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).