see attached 0001-Avoid-ASan-new-delete-type-mismatch.patch
>From 653d9da624c56fab05ed568133f30640b9e75b4f Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sberg...@redhat.com>
Date: Thu, 9 Jun 2016 15:21:46 +0200
Subject: [PATCH] Avoid ASan new-delete-type-mismatch

...when Function::domTree is created as DominatorTree in Function::convertToSSA
(src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp) but destroyed only as base
Graph in ~Function (src/gallium/drivers/nouveau/codegen/nv50_ir_bb.cpp).
---
 src/gallium/drivers/nouveau/codegen/nv50_ir.h      | 37 +++++++++++++++++++++-
 .../drivers/nouveau/codegen/nv50_ir_ssa.cpp        | 37 +---------------------
 2 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 94e54bb..c864d56 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -1132,6 +1132,41 @@ private:
    void splitCommon(Instruction *, BasicBlock *, bool attach);
 };
 
+// DominatorTree implements an algorithm for finding immediate dominators,
+// as described by T. Lengauer & R. Tarjan.
+class DominatorTree : public Graph
+{
+public:
+   DominatorTree(Graph *cfg);
+   ~DominatorTree() { }
+
+   bool dominates(BasicBlock *, BasicBlock *);
+
+   void findDominanceFrontiers();
+
+private:
+   void build();
+   void buildDFS(Node *);
+
+   void squash(int);
+   inline void link(int, int);
+   inline int eval(int);
+
+   void debugPrint();
+
+   Graph *cfg;
+
+   Node **vert;
+   int *data;
+   const int count;
+
+   #define SEMI(i)     (data[(i) + 0 * count])
+   #define ANCESTOR(i) (data[(i) + 1 * count])
+   #define PARENT(i)   (data[(i) + 2 * count])
+   #define LABEL(i)    (data[(i) + 3 * count])
+   #define DOM(i)      (data[(i) + 4 * count])
+};
+
 class Function
 {
 public:
@@ -1171,7 +1206,7 @@ public:
 
    Graph cfg;
    Graph::Node *cfgExit;
-   Graph *domTree;
+   DominatorTree *domTree;
    Graph::Node call; // node in the call graph
 
    BasicBlock **bbArray; // BBs in emission order
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp
index 3d25ad9..9652b72 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp
@@ -27,41 +27,6 @@ namespace nv50_ir {
 
 // Converts nv50 IR generated from TGSI to SSA form.
 
-// DominatorTree implements an algorithm for finding immediate dominators,
-// as described by T. Lengauer & R. Tarjan.
-class DominatorTree : public Graph
-{
-public:
-   DominatorTree(Graph *cfg);
-   ~DominatorTree() { }
-
-   bool dominates(BasicBlock *, BasicBlock *);
-
-   void findDominanceFrontiers();
-
-private:
-   void build();
-   void buildDFS(Node *);
-
-   void squash(int);
-   inline void link(int, int);
-   inline int eval(int);
-
-   void debugPrint();
-
-   Graph *cfg;
-
-   Node **vert;
-   int *data;
-   const int count;
-
-   #define SEMI(i)     (data[(i) + 0 * count])
-   #define ANCESTOR(i) (data[(i) + 1 * count])
-   #define PARENT(i)   (data[(i) + 2 * count])
-   #define LABEL(i)    (data[(i) + 3 * count])
-   #define DOM(i)      (data[(i) + 4 * count])
-};
-
 void DominatorTree::debugPrint()
 {
    for (int i = 0; i < count; ++i) {
@@ -326,7 +291,7 @@ Function::convertToSSA()
 
    // 1. create the dominator tree
    domTree = new DominatorTree(&cfg);
-   reinterpret_cast<DominatorTree *>(domTree)->findDominanceFrontiers();
+   domTree->findDominanceFrontiers();
 
    // 2. insert PHI functions
    DLList workList;
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to