public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/28925]  New: problem with zero_extract during gcse
@ 2006-09-01 11:37 zippel at linux-m68k dot org
  2006-09-01 11:39 ` [Bug rtl-optimization/28925] " zippel at linux-m68k dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: zippel at linux-m68k dot org @ 2006-09-01 11:37 UTC (permalink / raw)
  To: gcc-bugs

I have a problem with 4.1 on m68k-linux, which miscompiles the following 
test case during the gcse pass:

struct b {
        unsigned a : 1;
        unsigned b : 1;
        unsigned c : 1;
        unsigned d : 1;
};

unsigned int x = 1;

void f(int y, struct b *p)
{       
        switch (y) {
        case 1: 
                p->a = 0;
                p->b = 0;
                break;
        case 3: 
                p->a = 0;
                p->b = 1;
                break;
        default:
                return;
        }
        p->c = x;
        p->d = 1;
}

The assignment to p->c is done via zero_extract:

(insn 46 45 48 5 (set (zero_extract:SI (mem/s/j:QI (reg/v/f:SI 31 [ p ]) [0 S1
A8])
            (const_int 1 [0x1])
            (const_int 2 [0x2]))
        (reg:SI 40 [ x ])) 278 {*m68k.md:4815} (nil)
    (nil))

The other assignments are done with (and) and (ior). When propagating the 
mem expression, gcse misses this assignment and the assignment to p->d 
overwrites it, because the earlier mem expression was propagated past it 
in a register.

Currently I'm using the attached patch, which simply invalidates the 
load/store. Now I need some help from someone, who is more familiar with 
this code, whether this is the correct approach.
It would be nice if above could be changed into (zero_extract:SI (reg)), 
but I guess that would be a little too complex.


-- 
           Summary: problem with zero_extract during gcse
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zippel at linux-m68k dot org
GCC target triplet: m68k-linux


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


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

* [Bug rtl-optimization/28925] problem with zero_extract during gcse
  2006-09-01 11:37 [Bug rtl-optimization/28925] New: problem with zero_extract during gcse zippel at linux-m68k dot org
@ 2006-09-01 11:39 ` zippel at linux-m68k dot org
  2006-09-06 16:04 ` ebotcazou at gcc dot gnu dot org
  2006-09-08 20:46 ` ebotcazou at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: zippel at linux-m68k dot org @ 2006-09-01 11:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zippel at linux-m68k dot org  2006-09-01 11:39 -------
Created an attachment (id=12167)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12167&action=view)
possible fix for gcse problem


-- 


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


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

* [Bug rtl-optimization/28925] problem with zero_extract during gcse
  2006-09-01 11:37 [Bug rtl-optimization/28925] New: problem with zero_extract during gcse zippel at linux-m68k dot org
  2006-09-01 11:39 ` [Bug rtl-optimization/28925] " zippel at linux-m68k dot org
@ 2006-09-06 16:04 ` ebotcazou at gcc dot gnu dot org
  2006-09-08 20:46 ` ebotcazou at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-06 16:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ebotcazou at gcc dot gnu dot org  2006-09-06 16:04 -------
Confirmed according to the RTL logs.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-06 16:04:40
               date|                            |


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


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

* [Bug rtl-optimization/28925] problem with zero_extract during gcse
  2006-09-01 11:37 [Bug rtl-optimization/28925] New: problem with zero_extract during gcse zippel at linux-m68k dot org
  2006-09-01 11:39 ` [Bug rtl-optimization/28925] " zippel at linux-m68k dot org
  2006-09-06 16:04 ` ebotcazou at gcc dot gnu dot org
@ 2006-09-08 20:46 ` ebotcazou at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-08 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ebotcazou at gcc dot gnu dot org  2006-09-08 20:45 -------
The approach looks OK but the fix should use invalidate_any_buried_refs.

Post the revised version to gcc-patches if it works (read the guidelines on
http://gcc.gnu.org/contribute.html) and I'll formally approve it.  Please
also specify whether this is a regression from earlier versions of the
compiler.


-- 


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


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

* [Bug rtl-optimization/28925] problem with zero_extract during gcse
       [not found] <bug-28925-4@http.gcc.gnu.org/bugzilla/>
@ 2012-10-22 20:34 ` schwab@linux-m68k.org
  0 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2012-10-22 20:34 UTC (permalink / raw)
  To: gcc-bugs


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

Andreas Schwab <schwab@linux-m68k.org> changed:

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

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> 2012-10-22 20:34:36 UTC ---
No longer reproducable since 4.2, assuming fixed.


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

end of thread, other threads:[~2012-10-22 20:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-01 11:37 [Bug rtl-optimization/28925] New: problem with zero_extract during gcse zippel at linux-m68k dot org
2006-09-01 11:39 ` [Bug rtl-optimization/28925] " zippel at linux-m68k dot org
2006-09-06 16:04 ` ebotcazou at gcc dot gnu dot org
2006-09-08 20:46 ` ebotcazou at gcc dot gnu dot org
     [not found] <bug-28925-4@http.gcc.gnu.org/bugzilla/>
2012-10-22 20:34 ` schwab@linux-m68k.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).