http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50672
Markus Trippelsdorf <markus at trippelsdorf dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |markus at trippelsdorf dot | |de --- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2011-10-09 15:28:16 UTC --- % cat test.ii namespace std { template<class _CharT> struct char_traits; typedef struct __locale_struct { } *__locale_t; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ostream; typedef basic_ostream<char> ostream; } class UniqueId { }; typedef int BoxCoordinate; typedef int BoxDimension; const BoxDimension X = 0; const BoxDimension Y = 1; const BoxDimension NDimensions = 2; class BoxPoint { protected: BoxCoordinate point[NDimensions]; public: BoxPoint(BoxCoordinate x, BoxCoordinate y) { } bool isValid() const { } void operator += (const BoxPoint& p) { if (isValid() && p.isValid()) { point[X] += p.point[X]; } } BoxCoordinate& operator [] (const BoxDimension& dimension) { return point[dimension]; } }; class BoxSize: public BoxPoint { }; class BoxRegion { private: BoxPoint _origin; BoxSize _space; public: BoxRegion(const BoxPoint& o, const BoxSize& s) : _origin(o), _space(s) { } BoxCoordinate& origin(BoxDimension d) { } BoxCoordinate& space(BoxDimension d) { } }; inline bool operator <= (const BoxPoint& p, const BoxRegion& r) { for (BoxDimension d = X; d <= Y; d++) if (p[d] < r.origin(d) || p[d] >= r.origin(d) + r.space(d)) return false; return true; } extern "C" { typedef struct _WidgetRec *Widget; } struct GraphGC { BoxPoint offsetIfSelected; }; class GraphNode; class Graph; class GraphEdge { private: UniqueId _id; GraphNode *_from; GraphNode *_to; bool _hidden; GraphEdge *_nextFrom; GraphEdge *_nextTo; GraphEdge *_prevFrom; GraphEdge *_prevTo; GraphEdge *next; GraphEdge *prev; Graph *graph; public: GraphEdge(GraphNode *f, GraphNode *t): _id(), _from(f), _to(t), _hidden(false), _nextFrom(0), _nextTo(0), _prevFrom(0), _prevTo(0), next(0), prev(0), graph(0) { } GraphNode *from() const { } GraphNode *to() const { } }; class LineGraphEdge: public GraphEdge { protected: static void findLine(const BoxPoint& c1, const BoxPoint& c2, const BoxRegion& b1, const BoxRegion& b2, BoxPoint& p1, BoxPoi nt& p2, const GraphGC& gc); virtual void drawLine(Widget w, const BoxRegion& exposed, const GraphGC& gc) const; public: void _print(std::ostream& os, const GraphGC &gc) const; }; class ArcGraphEdge: public LineGraphEdge { static bool center(const BoxPoint& p1, const BoxPoint& p2, const BoxPoint& p3, double& x, double& y); void makeLine(Widget w, const BoxRegion& exposed, std::ostream& os, const GraphGC& gc) const; }; class GraphNode { public: int count; bool& selected() { } GraphEdge *firstTo() const { } GraphEdge *nextTo(GraphEdge *ref) const; virtual const BoxPoint& pos() const = 0; virtual const BoxRegion& region(const GraphGC& gc) const = 0; virtual bool isHint() const { } }; class PosGraphNode: public GraphNode { }; class RegionGraphNode: public PosGraphNode { }; class HintGraphNode: public RegionGraphNode { }; void ArcGraphEdge::makeLine(Widget w, const BoxRegion& exposed, std::ostream& os, const GraphGC& gc) const { HintGraphNode *arc_hint = 0; RegionGraphNode *arc_from = 0; RegionGraphNode *arc_to = 0; bool make_arc = true; if (from()->isHint() && to()->isHint()) { make_arc = false; } else if (from()->isHint() && from()->firstTo() != 0) { if (arc_hint == 0 || arc_from == 0 || arc_to == 0 || arc_hint->nextTo(arc_hint->firstTo()) != 0) { make_arc = false; } } if (!make_arc) { if (w != 0) LineGraphEdge::drawLine(w, exposed, gc); else LineGraphEdge::_print(os, gc); return; } BoxPoint pos_from = arc_from->pos(); BoxRegion region_from = arc_from->region(gc); BoxPoint pos_to = arc_to->pos(); BoxRegion region_to = arc_to->region(gc); BoxPoint pos_hint = arc_hint->pos(); if (arc_hint->selected()) { pos_hint += gc.offsetIfSelected; } if (pos_hint <= region_from || pos_hint <= region_to) { return; } double cx, cy; bool ok = center(pos_from, pos_hint, pos_to, cx, cy); if (!ok) { if (w != 0) LineGraphEdge::drawLine(w, exposed, gc); else LineGraphEdge::_print(os, gc); } } % g++ test.ii -Wfatal-errors -S -O2 -w -fpermissive -o /dev/null test.ii: In member function ‘void ArcGraphEdge::makeLine(Widget, const BoxRegion&, std::ostream&, const GraphGC&) const’: test.ii:103:9: internal compiler error: Segmentation fault