[PATCH] RFC: Fix GCSE bug optimization/11440 (3.3 regression)

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Mon Jul 14 15:22:00 GMT 2003


On Monday 14 July 2003 00:30, Mark Mitchell wrote:
> On Fri, 2003-07-11 at 14:35, Franz Sirl wrote:
> > Hi,
> >
> > this patch against the 3_3-branch fixes the testcase for me (no completed
> > bootstrap/regtest so far). I'm not 100% sure if it's the right place to
> > reject the note, but it looks reasonable to me. And do I need to reject
> > STRICT_LOW_PART and SUBREG too?
>
> I don't know about the latter question, but the patch looks reasonable
> to me.  I've copied Jeff Law because, as the original GCSE author, he
> might have additional input.  The patch is certainly conservative, and
> the fact that it fixes open code-gen problems is convincing, so please
> go ahead and apply the patch to both 3.3.1 and mailine, and close the
> PR.

Committed.

I switched myself into RTL->C converter mode and managed to create a small 
ugly looking C testcase that shows the bug on powerpc-linux-gnu when 
executed.

OK to commit to mainline and branch?

Franz.

	PR optimization/11440
	* gcc.c-torture/execute/20030714-1.c: New testcase.

-------------- next part --------------
/* derived from PR optimization/11440  */

extern void abort (void);
extern void exit (int);

typedef _Bool bool;
const bool false = 0;
const bool true = 1;

enum EPosition 
{
  STATIC, RELATIVE, ABSOLUTE, FIXED
};
typedef enum EPosition EPosition;

enum EFloat 
{
  FNONE = 0, FLEFT, FRIGHT
};
typedef enum EFloat EFloat;

struct RenderBox
{
  int unused[6];
  short m_verticalPosition;
  
  bool m_layouted : 1;
  bool m_unused : 1;
  bool m_minMaxKnown : 1;
  bool m_floating : 1;
  
  bool m_positioned : 1;
  bool m_overhangingContents : 1;
  bool m_relPositioned : 1;
  bool m_paintSpecial : 1;
  
  bool m_isAnonymous : 1;
  bool m_recalcMinMax : 1;
  bool m_isText : 1;
  bool m_inline : 1;
  
  bool m_replaced : 1;
  bool m_mouseInside : 1;
  bool m_hasFirstLine : 1;
  bool m_isSelectionBorder : 1;
  
  bool (*isTableCell) (struct RenderBox *this);
};

typedef struct RenderBox RenderBox;

struct RenderStyle
{
  struct NonInheritedFlags 
    {
      union 
	{
	  struct 
	    {
	      unsigned int _display : 4;
	      unsigned int _bg_repeat : 2;
	      bool _bg_attachment : 1;
	      unsigned int _overflow : 4 ;
	      unsigned int _vertical_align : 4;
	      unsigned int _clear : 2;
	      EPosition _position : 2;
	      EFloat _floating : 2;
	      unsigned int _table_layout : 1;
	      bool _flowAroundFloats :1;

	      unsigned int _styleType : 3;
	      bool _hasHover : 1;
	      bool _hasActive : 1;
	      bool _clipSpecified : 1;
	      unsigned int _unicodeBidi : 2;
	      int _unused : 1;
	    } f;
	  int _niflags;
	};
    } noninherited_flags;
};

typedef struct RenderStyle RenderStyle;

extern void RenderObject_setStyle(RenderBox *this, RenderStyle *_style);
extern void removeFromSpecialObjects(RenderBox *this);



void RenderBox_setStyle(RenderBox *thisin, RenderStyle *_style)
{
  RenderBox *this = thisin;
  bool oldpos, tmp;
  EPosition tmppo;
  
  ({
    ({
      tmp = this->m_positioned;
      goto l0;
      0;
    });
    
    l0:
    0;
  });

  oldpos = tmp;

  RenderObject_setStyle(this, _style);
  
  ({
    ({
      tmppo = _style->noninherited_flags.f._position;
      goto l1;
      0;
    });
    
    l1:
    0;
  });

  switch(tmppo)
    {
    case ABSOLUTE:
    case FIXED:
	{
	  bool ltrue = true;
	  this->m_positioned = ltrue;
	  break;
	}

    default:
	{
	  EFloat tmpf;
	  EPosition tmpp;
	  if (oldpos)
	    {
	      bool ltrue = true;
	      this->m_positioned = ltrue;
	      removeFromSpecialObjects(this);
	    }
	    {
	      bool lfalse = false;
	      this->m_positioned = lfalse;
	    }

	  ({
	    ({
	      tmpf = _style->noninherited_flags.f._floating;
	      goto l2;
	      0;
	    });
	    
	    l2:
	    0;
	  });

	  if(!this->isTableCell (this) && !(tmpf == FNONE)) 
	    {
	      bool ltrue = true;
	      this->m_floating = ltrue;
	    }
	  else 
	    {
	      ({
		({
		  tmpp = _style->noninherited_flags.f._position;
		  goto l3;
		  0;
		});
		
		l3:
		0;
	      });
	      if (tmpp == RELATIVE)
		{
		  bool ltrue = true;
		  this->m_relPositioned = ltrue;
		}
	    }
	}
    }
}




RenderBox g_this;
RenderStyle g__style;

void RenderObject_setStyle(RenderBox *this, RenderStyle *_style)
{
  (void) this;
  (void) _style;
}

void removeFromSpecialObjects(RenderBox *this)
{
  (void) this;
}

bool RenderBox_isTableCell (RenderBox *this)
{
  (void) this;
  return false;
}

int main (void)
{

  g_this.m_relPositioned = false;
  g_this.m_positioned = false;
  g_this.m_floating = false;
  g_this.isTableCell = RenderBox_isTableCell;

  g__style.noninherited_flags.f._position = FIXED;
  g__style.noninherited_flags.f._floating = FNONE;

  RenderBox_setStyle (&g_this, &g__style);
  
  if (g_this.m_positioned != true)
    abort ();
  if (g_this.m_relPositioned != false)
    abort ();
  if (g_this.m_floating != false)
    abort ();

  exit (0);
}


More information about the Gcc-patches mailing list