diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83a466e9a39..884826439bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,10 @@ -2013-02-15 Aldy Hernandez +2013-02-19 Jakub Jelinek + + PR tree-optimization/56381 + * tree-ssa-pre.c (create_expression_by_pieces): Fix up last argument + to fold_build3. + +2013-02-18 Aldy Hernandez Jakub Jelinek PR target/52555 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index afa9cd7a39a..50ad1016f7c 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,4 +1,4 @@ -2013-02-11 Aldy Hernandez +2013-02-18 Aldy Hernandez PR target/52555 * c-common.c (handle_optimize_attribute): Call diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8458cce659e..1828629494c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-02-19 Jakub Jelinek + + PR tree-optimization/56381 + * g++.dg/opt/pr56381.C: New test. + 2013-02-18 Jakub Jelinek PR pch/54117 diff --git a/gcc/testsuite/g++.dg/opt/pr56381.C b/gcc/testsuite/g++.dg/opt/pr56381.C new file mode 100644 index 00000000000..38a121d979a --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr56381.C @@ -0,0 +1,156 @@ +// PR tree-optimization/56381 +// { dg-do compile } +// { dg-options "-std=c++11 -O2 -w" } + +template +class intrusive_ptr {}; +class BasicReferenceCounted +{ +}; +template +class ReferenceCountingPointer : intrusive_ptr +{ +}; +typedef BasicReferenceCounted ReferenceCountedInConditions; +class PointTag; +template +struct PreciseFloatType +{ + typedef T Type; +}; +template +struct ExtVecTraits +{ + typedef T __attribute__ ((vector_size (N * sizeof (T)))) type; +}; +template +using ExtVec = typename ExtVecTraits ::type; +template using Vec4 = ExtVec ; +template +Vec cross3 (Vec x, Vec y) +{ + Vec x1200 = (Vec) { x[2], x[0] }; + Vec y2010 { y[2], y[0], y[1], y[0] }; + Vec x2010 = (Vec) { x[2], x[0], x[1], x[0] }; + Vec y1200 = (Vec) { y[1], y[0] }; + return x1200 * y2010 - x2010 * y1200; +} +template +struct Rot3 +{ + typedef Vec4 Vec; + Vec axis[3]; +}; +class Basic2DVector +{ +}; +template +struct Basic3DVector +{ + typedef Vec4 MathVector; + Basic3DVector (MathVector iv) : v { (iv[0]), (iv[1]), (iv[2]), (iv[3]) } {} + T mag2 () {} + Basic3DVector unit () + { + T my_mag = mag2 (); + return (my_mag) ? (*this) * (T () / (my_mag)) : *this; + } + Basic3DVector + cross (Basic3DVector lh) { return cross3 (v, lh.v); } + Vec4 v; +}; +template +Basic3DVector operator * (Basic3DVector , T); +template +struct PV3DBase +{ + typedef Basic3DVector BasicVectorType; + template + PV3DBase (Basic3DVector v) : theVector (v) {} + BasicVectorType basicVector () { return theVector; } + T x (); + T y (); + BasicVectorType theVector; +}; +class VectorTag; +template +struct Vector3DBase:public PV3DBase +{ + typedef PV3DBase BaseClass; + template + Vector3DBase (Basic3DVector v) : BaseClass (v) {} + Vector3DBase unit () { return (this->basicVector ().unit ()); } + template + Vector3DBase ::Type, FrameTag> cross (Vector3DBase v) + { + return (this->theVector.cross (v.basicVector ())); + } +}; +template +class Point3DBase : public PV3DBase +{ +}; +template +Vector3DBase ::Type, Frame> operator - (Point3DBase , Point3DBase ); +class GlobalTag; +template +struct TkRotation +{ + typedef Vector3DBase GlobalVector; + TkRotation (GlobalVector aX, GlobalVector aY) + { + GlobalVector uX = aX.unit (); + GlobalVector uY = aY.unit (); + GlobalVector uZ (uX.cross (uY)); + rot.axis[2] = uZ.basicVector ().v; + } + Basic3DVector z (); + Rot3 rot; +}; +template +struct GloballyPositioned +{ + typedef Point3DBase PositionType; + typedef TkRotation RotationType; + typedef Point3DBase GlobalPoint; + typedef Vector3DBase GlobalVector; + T iniPhi () { return 999.9978; } + GloballyPositioned (PositionType pos, RotationType rot) : thePos (pos), theRot (rot) { resetCache (); } + PositionType position () const; + RotationType rotation () const; + PositionType thePos; + RotationType theRot; + void resetCache () + { + if ((thePos.x () == 0.) && (thePos.y () == 0.)) + thePhi = 0.; + else + thePhi = iniPhi (); + } + T thePhi; +}; +class Plane; +using TangentPlane = Plane; +struct Surface : public GloballyPositioned , ReferenceCountedInConditions +{ + typedef GloballyPositioned Base; + Surface (PositionType pos, RotationType rot): + Base (pos, rot) {} +}; +struct Plane : Surface +{ + template + Plane (Args ... args): + Surface ((args) ...) {} +}; +class Cylinder : Surface +{ + void tangentPlane (const GlobalPoint &) const; +}; +void +Cylinder::tangentPlane (const GlobalPoint & aPoint) const +{ + GlobalVector yPlane (rotation ().z ()); + GlobalVector xPlane (yPlane.cross (aPoint - position ())); + new TangentPlane (aPoint, RotationType (xPlane, yPlane)); +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 9ccec2156eb..10c8091758e 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2923,7 +2923,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr, break; case 3: folded = fold_build3 (nary->opcode, nary->type, - genop[0], genop[1], genop[3]); + genop[0], genop[1], genop[2]); break; default: gcc_unreachable ();