public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56211] New: gnulib yesno compiled incorrectly with -02 on x86_64
@ 2013-02-05  6:39 allan at archlinux dot org
  2013-02-05  7:09 ` [Bug tree-optimization/56211] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: allan at archlinux dot org @ 2013-02-05  6:39 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56211

             Bug #: 56211
           Summary: gnulib yesno compiled incorrectly with -02 on x86_64
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: allan@archlinux.org


Compiling gzip with optimization generates code that mangles the return value
of the gnulib yesno function on x86_64 Linux.  This bug is not present in i686.

This results in files being overwritten despite answering "n" to:
gzip: out.gz already exists; do you wish to overwrite (y or n)?

This is seen in both Arch Linux and Fedora 18 and is present in the latest 4.7
and 4.8 snapshots.

Git bisect implicates r173711:
http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4c7817e5

Downstream bug with relevant disassembly:
https://bugs.archlinux.org/task/33121


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/56211] gnulib yesno compiled incorrectly with -02 on x86_64
  2013-02-05  6:39 [Bug tree-optimization/56211] New: gnulib yesno compiled incorrectly with -02 on x86_64 allan at archlinux dot org
@ 2013-02-05  7:09 ` pinskia at gcc dot gnu.org
  2013-02-05  7:28 ` [Bug target/56211] " pinskia at gcc dot gnu.org
  2013-02-05 12:04 ` allan at archlinux dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-02-05  7:09 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56211

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-05 07:08:44 UTC ---
Do you have a testcase?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/56211] gnulib yesno compiled incorrectly with -02 on x86_64
  2013-02-05  6:39 [Bug tree-optimization/56211] New: gnulib yesno compiled incorrectly with -02 on x86_64 allan at archlinux dot org
  2013-02-05  7:09 ` [Bug tree-optimization/56211] " pinskia at gcc dot gnu.org
@ 2013-02-05  7:28 ` pinskia at gcc dot gnu.org
  2013-02-05 12:04 ` allan at archlinux dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-02-05  7:28 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56211

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2013-02-05
          Component|tree-optimization           |target
     Ever Confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-05 07:27:56 UTC ---
This really sounds like a bug in a mismatched function declarations and
definitions. Meaning this is not a GCC bug but rather a bug in the source you
are using.  Make sure bool is defined the same in both sides of the call.

The reason why I say this is because I just tried a simple testcase look at the
output of the code and found it does the correct thing.
Like:
_Bool g(void);

void h(void);

void f(void)
{
  if (!g())
    return h();
}
---- CUT ----
This assumes the yesno function is declared with a _Bool return type on the
calee side.
That produces:
    call    g
    testb    %al, %al

Which is not what is located in the generated assembly code that you provided:
  405402:    e8 99 7e 00 00           callq  40d2a0 <yesno>
  405407:    85 c0                    test   %eax,%eax


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/56211] gnulib yesno compiled incorrectly with -02 on x86_64
  2013-02-05  6:39 [Bug tree-optimization/56211] New: gnulib yesno compiled incorrectly with -02 on x86_64 allan at archlinux dot org
  2013-02-05  7:09 ` [Bug tree-optimization/56211] " pinskia at gcc dot gnu.org
  2013-02-05  7:28 ` [Bug target/56211] " pinskia at gcc dot gnu.org
@ 2013-02-05 12:04 ` allan at archlinux dot org
  2 siblings, 0 replies; 4+ messages in thread
From: allan at archlinux dot org @ 2013-02-05 12:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56211

Allan McRae <allan at archlinux dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Allan McRae <allan at archlinux dot org> 2013-02-05 12:04:33 UTC ---
You are correct.   More searching shows yesno declared as returning bool in one
place and int in the other.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-05 12:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-05  6:39 [Bug tree-optimization/56211] New: gnulib yesno compiled incorrectly with -02 on x86_64 allan at archlinux dot org
2013-02-05  7:09 ` [Bug tree-optimization/56211] " pinskia at gcc dot gnu.org
2013-02-05  7:28 ` [Bug target/56211] " pinskia at gcc dot gnu.org
2013-02-05 12:04 ` allan at archlinux dot org

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).