public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21688] New: gcc miscompiles with -Os (wrong code at least on i386, x86_64 and ppc)
@ 2005-05-20 22:24 felix-gcc at fefe dot de
  2005-05-20 22:43 ` [Bug middle-end/21688] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2005-05-20 23:02 ` [Bug middle-end/21688] [4.0 Regression] gcc miscompiles with -funit-at-a-time pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: felix-gcc at fefe dot de @ 2005-05-20 22:24 UTC (permalink / raw)
  To: gcc-bugs

wget http://dl.fefe.de/crypt-bug.c
gcc4 -Os -o t crypt-bug.c
./t
  # assertion failure
gcc4 -O -o t crypt-bug.c
./t
  # works ok
reproduced on i386, x86_64 and using Apple's gcc 4 in Tiger.

-- 
           Summary: gcc miscompiles with -Os (wrong code at least on i386,
                    x86_64 and ppc)
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: felix-gcc at fefe dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-linux
  GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux


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


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

* [Bug middle-end/21688] [4.0 Regression] gcc miscompiles with -Os (wrong code at least on i386, x86_64 and ppc)
  2005-05-20 22:24 [Bug c/21688] New: gcc miscompiles with -Os (wrong code at least on i386, x86_64 and ppc) felix-gcc at fefe dot de
@ 2005-05-20 22:43 ` pinskia at gcc dot gnu dot org
  2005-05-20 23:02 ` [Bug middle-end/21688] [4.0 Regression] gcc miscompiles with -funit-at-a-time pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-20 22:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-20 22:43 -------
Hmm, the assmbley for the functions at -O and -O -funit-at-a-time are no different but we get wrong 
code some how.

This works on the mainline and in 3.4.0 so it is a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org
          Component|c                           |middle-end
           Keywords|                            |wrong-code
      Known to fail|                            |4.0.0
      Known to work|                            |3.4.0 4.1.0
            Summary|gcc miscompiles with -Os    |[4.0 Regression] gcc
                   |(wrong code at least on     |miscompiles with -Os (wrong
                   |i386, x86_64 and ppc)       |code at least on i386,
                   |                            |x86_64 and ppc)
   Target Milestone|---                         |4.0.1


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


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

* [Bug middle-end/21688] [4.0 Regression] gcc miscompiles with -funit-at-a-time
  2005-05-20 22:24 [Bug c/21688] New: gcc miscompiles with -Os (wrong code at least on i386, x86_64 and ppc) felix-gcc at fefe dot de
  2005-05-20 22:43 ` [Bug middle-end/21688] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-05-20 23:02 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-20 23:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-20 23:02 -------
Oh, even at -O0 -funit-at-a-time, we get this missed compiled.

There are buffer overflows somewhere:
*******
mudflap violation 1 (check/write): time=1116629904.932813 ptr=0x80ce540 size=33
pc=0x45b4a8 location=`crypt-bug.c:206 (encrypt)'
      /home/peshtigo/pinskia/linux/lib/libmudflap.so.0(__mf_check+0x48) [0x45b4a8]
      ./a.out(encrypt+0x1c7) [0x80499c4]
      ./a.out(crypt+0xaaf) [0x804be45]
Nearby object 1: checked region begins 0B into and ends 1B after
mudflap object 0xa095a08: name=`crypt-bug.c:190 L'
bounds=[0x80ce540,0x80ce55f] size=32 area=static check=0r/4w liveness=4
alloc time=1116629904.932154 pc=0x45bfe8
Nearby object 2: checked region begins 32B before and ends 0B into
mudflap object 0xa095a70: name=`crypt-bug.c:190 R'
bounds=[0x80ce560,0x80ce57f] size=32 area=static check=0r/3w liveness=3
alloc time=1116629904.932158 pc=0x45bfe8
number of nearby objects: 2


Fixing that I get a different the abort, can you double check to make sure this code is really valid, from 
the looks of it, it is not.

The code is assuming that L and R come right after each in memory, and that is a false assumption.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID
            Summary|[4.0 Regression] gcc        |[4.0 Regression] gcc
                   |miscompiles with -Os (wrong |miscompiles with -funit-at-
                   |code at least on i386,      |a-time
                   |x86_64 and ppc)             |


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


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

end of thread, other threads:[~2005-05-20 23:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-20 22:24 [Bug c/21688] New: gcc miscompiles with -Os (wrong code at least on i386, x86_64 and ppc) felix-gcc at fefe dot de
2005-05-20 22:43 ` [Bug middle-end/21688] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-05-20 23:02 ` [Bug middle-end/21688] [4.0 Regression] gcc miscompiles with -funit-at-a-time pinskia at gcc dot gnu 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).