public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24361]  New: Optimizations -fcse-follow-jumps -fforce-mem break code
@ 2005-10-14 11:03 tromp at cwi dot nl
  2005-10-14 13:07 ` [Bug rtl-optimization/24361] [4.0 regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tromp at cwi dot nl @ 2005-10-14 11:03 UTC (permalink / raw)
  To: gcc-bugs

-bash-3.00$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)

The program below produces incorrect results with -O2 and higher, which
I've deduced is due to the combined options -fcse-follow-jumps -fforce-mem

#include <stdlib.h>
#include <stdio.h>

typedef unsigned long Word_t;

typedef struct {
  unsigned char type;
  unsigned char color;
  unsigned char left;
  unsigned char right;
} cell;

//possible cell types
#define WIDTH 3

typedef cell bstate[WIDTH]; // borderstate

void wordtostate(Word_t s, int bump, bstate state)
{
  char stack[WIDTH];
  int sp,i,type,leftcolor=0;
  cell *sti;

  for (sti = &state[i = sp = 0]; i < WIDTH; sti++, i++) {
    sti->type = type = (s >> (3*i)) & 7;
    sti->left = sti->right = i;
    sti->color = leftcolor ^ 1; // assume opposite color
    if (type & 2) {
      sti->right = state[sti->left = stack[--sp]].right;
      state[sti->left].right = state[sti->right].left = i;
      sti->color ^= (sti->left == i-1); // check color assumption
    }
    if (type & 1)
      stack[sp++] = i;
    leftcolor = sti->color;
  }
}

int main()
{
  bstate state;
  Word_t s = 0675;

  wordtostate(s, 0, state);
  printf("%s\n", state[1].color ? "OK" : "BUG");
  return 0;
}


-- 
           Summary: Optimizations -fcse-follow-jumps -fforce-mem break code
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tromp at cwi dot nl


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


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

* [Bug rtl-optimization/24361] [4.0 regression] Optimizations -fcse-follow-jumps -fforce-mem break code
  2005-10-14 11:03 [Bug c/24361] New: Optimizations -fcse-follow-jumps -fforce-mem break code tromp at cwi dot nl
@ 2005-10-14 13:07 ` pinskia at gcc dot gnu dot org
  2005-10-15 17:54 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-14 13:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-10-14 13:07 -------
I think this has been fixed in 4.0.3 by the patch for PR 23324 but I need
someone to test.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |i686-pc-linux-gnu
           Keywords|                            |wrong-code
            Summary|Optimizations -fcse-follow- |[4.0 regression]
                   |jumps -fforce-mem break code|Optimizations -fcse-follow-
                   |                            |jumps -fforce-mem break code
   Target Milestone|---                         |4.0.3


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


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

* [Bug rtl-optimization/24361] [4.0 regression] Optimizations -fcse-follow-jumps -fforce-mem break code
  2005-10-14 11:03 [Bug c/24361] New: Optimizations -fcse-follow-jumps -fforce-mem break code tromp at cwi dot nl
  2005-10-14 13:07 ` [Bug rtl-optimization/24361] [4.0 regression] " pinskia at gcc dot gnu dot org
@ 2005-10-15 17:54 ` pinskia at gcc dot gnu dot org
  2006-03-11  3:18 ` mmitchel at gcc dot gnu dot org
  2007-02-03 15:46 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-15 17:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-10-15 17:54 -------
Confirmed, still fails on the 4.0 branch.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.0.3
      Known to work|                            |4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-10-15 17:54:19
               date|                            |


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


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

* [Bug rtl-optimization/24361] [4.0 regression] Optimizations -fcse-follow-jumps -fforce-mem break code
  2005-10-14 11:03 [Bug c/24361] New: Optimizations -fcse-follow-jumps -fforce-mem break code tromp at cwi dot nl
  2005-10-14 13:07 ` [Bug rtl-optimization/24361] [4.0 regression] " pinskia at gcc dot gnu dot org
  2005-10-15 17:54 ` pinskia at gcc dot gnu dot org
@ 2006-03-11  3:18 ` mmitchel at gcc dot gnu dot org
  2007-02-03 15:46 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-03-11  3:18 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.3                       |4.0.4


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


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

* [Bug rtl-optimization/24361] [4.0 regression] Optimizations -fcse-follow-jumps -fforce-mem break code
  2005-10-14 11:03 [Bug c/24361] New: Optimizations -fcse-follow-jumps -fforce-mem break code tromp at cwi dot nl
                   ` (2 preceding siblings ...)
  2006-03-11  3:18 ` mmitchel at gcc dot gnu dot org
@ 2007-02-03 15:46 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gdr at gcc dot gnu dot org  2007-02-03 15:46 -------
Fixed in GCC-4.1.1 and higher.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.0.4                       |4.1.1


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


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

end of thread, other threads:[~2007-02-03 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-14 11:03 [Bug c/24361] New: Optimizations -fcse-follow-jumps -fforce-mem break code tromp at cwi dot nl
2005-10-14 13:07 ` [Bug rtl-optimization/24361] [4.0 regression] " pinskia at gcc dot gnu dot org
2005-10-15 17:54 ` pinskia at gcc dot gnu dot org
2006-03-11  3:18 ` mmitchel at gcc dot gnu dot org
2007-02-03 15:46 ` gdr 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).