From 0f2cb9d34e26741b69926d4596da1eb1fcd473bc Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 20 Jun 2003 00:07:34 +0000
Subject: [PATCH] Don't optimize 3D_Mesh.

---
 Mesh/2D_Mesh_Triangle.cpp | 4 ++--
 Mesh/3D_Mesh.cpp          | 6 ++----
 Mesh/Makefile             | 6 +++++-
 Triangle/Makefile         | 8 ++++----
 4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/Mesh/2D_Mesh_Triangle.cpp b/Mesh/2D_Mesh_Triangle.cpp
index 44647bbc10..eaf2b96f4b 100644
--- a/Mesh/2D_Mesh_Triangle.cpp
+++ b/Mesh/2D_Mesh_Triangle.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_Mesh_Triangle.cpp,v 1.3 2003-03-21 00:52:41 geuzaine Exp $
+// $Id: 2D_Mesh_Triangle.cpp,v 1.4 2003-06-20 00:07:34 geuzaine Exp $
 //
 // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
 //
@@ -211,7 +211,7 @@ int Mesh_Shewchuk(Surface * s)
       val += mid.pointattributelist[k];
     }
     val /= mid.numberofcorners;
-    val = val * val / 2.;       // we generate isotropic meshes
+    val = val * val / 1.5; // approx (we want isotropic meshes)
     mid.trianglearealist[i] = val;
   }
 
diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp
index 9a5978fba8..2accb5b9f9 100644
--- a/Mesh/3D_Mesh.cpp
+++ b/Mesh/3D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Mesh.cpp,v 1.55 2003-06-14 16:41:12 geuzaine Exp $
+// $Id: 3D_Mesh.cpp,v 1.56 2003-06-20 00:07:34 geuzaine Exp $
 //
 // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
 //
@@ -60,9 +60,7 @@ int Alerte_Point_Scabreux;
 
 inline void cgsmpl(Simplex * s, double &x, double &y, double &z)
 {
-  //compiler sous linux avec -O2 et faire tourner bench/3d/sphere2.geo
-  //->boum. Ne se produit pas si on accede a V[3] avant!
-  //if(!s->V[3]) Msg(GERROR, "oups");
+  // this inlining crashes with gcc -O2...
 
   x = 0.25 * (s->V[0]->Pos.X +
               s->V[1]->Pos.X + s->V[2]->Pos.X + s->V[3]->Pos.X);
diff --git a/Mesh/Makefile b/Mesh/Makefile
index b66231d887..4ed3490c36 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.51 2003-03-21 00:52:41 geuzaine Exp $
+# $Id: Makefile,v 1.52 2003-06-20 00:07:34 geuzaine Exp $
 #
 # Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
 #
@@ -81,6 +81,10 @@ ${LIB}: ${OBJ}
 .cpp.o:
 	${CXX} ${CFLAGS} -c $<
 
+# Don't optimize 3D_Mesh: it sometimes mysteriously crashes on Linux
+3D_Mesh.o:
+	${CXX} ${FLAGS} ${INCLUDE} -c $<
+
 clean:
 	rm -f *.o
 
diff --git a/Triangle/Makefile b/Triangle/Makefile
index a282ea90a0..6d01fdd75c 100644
--- a/Triangle/Makefile
+++ b/Triangle/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.15 2003-03-21 00:52:46 geuzaine Exp $
+# $Id: Makefile,v 1.16 2003-06-20 00:07:34 geuzaine Exp $
 #
 # Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
 #
@@ -23,9 +23,9 @@ include ../variables
 
 LIB = ../lib/libGmshTriangle.a
 
-# Do not optimize triangle: it crashes badly on Linux
-OPTIM = -O0
-CFLAGS = ${OPTIM} ${FLAGS} -DTRILIBRARY
+# Don't optimize triangle: it crashes on Linux
+# CFLAGS = ${OPTIM} ${FLAGS} -DTRILIBRARY
+CFLAGS = ${FLAGS} -DTRILIBRARY
 
 SRC = triangle.c
 
-- 
GitLab