[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#716635: gcc-4.8: Miscompilation at optimization -O1



retitle 716635 gcc-4.8: Miscompilation due to wrong RTL-optimization
thanks

On Thu, Nov 14, 2013 at 09:29:52PM +0100, Aurelien Jarno wrote:
> tag 716635 - help
> tag 716635 + upstream
> forwarded 716635 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59137 
> retitle 716635 gcc-4.8: Miscompilation at optimization -O1 on mips/mipsel
> thanks
> 
> On Wed, Jul 10, 2013 at 04:28:46PM -0400, Camm Maguire wrote:
> > 
> > Package: gcc-4.8
> > Version: 4.8.1-5
> > Severity: important
> > 
> > The following code
> > 
> > type_of(x0)==t_cons
> > 
> > from 
> > 
> > DEFUNO_NEW("LISTP",object,fLlistp,LISP
> >    ,1,1,NONE,OO,OO,OO,OO,void,Llistp,(object x0),"")
> > 
> > {
> > 	/* 1 args */
> > 
> > 	if (x0 == Cnil || type_of(x0) == t_cons)
> > 		x0 = Ct;
> > 	else
> > 		x0 = Cnil;
> > 	RETURN1(x0);
> > }
> > 
> > where type_of(x0) is fully expanded as
> > 
> > ({register object _z=(object)(x0); ((((ufixnum)(_z))>=0x80000000) ?
> > t_fixnum : ((!(_z)->d.e || (((ufixnum)((*(object *)(_z))))>=0x80000000))
> > ? (_z==((object)&Cnil_body) ? t_symbol : t_cons) : _z->d.t));})
> > 
> > incorrectly gives true when compiled at O1, and correctly gives false
> > when compiled at -O0 (only on mips).
> > 
> > The following is a gdb session followed by the full preprocessed source.
> > 
> 
> Attached is a reduced testcase. The problem does appear at -O1, but not
> at -O0 nor -O2. It is reproducible with GCC 4.7, 4.8 or snapshot, but
> not with 4.6 or older. I have reported it upstream as issue #59137.
> 

Note that while it occurs on MIPS, this is actually a generic RTL
optimization issue which can also appears on other architecture.
Retitling the bug accordingly.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


Reply to: