From 87c9d2d09a01eb73e89289de8a4e8d7f141d2595 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Thu, 9 Apr 1998 21:49:55 -0700
Subject: [PATCH] bugfix in __INIT

Rev: src/program.c:1.74
Rev: src/testsuite.in:1.87
---
 src/program.c    | 8 ++++----
 src/testsuite.in | 5 ++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/program.c b/src/program.c
index 9e6047a5f1..50274a775f 100644
--- a/src/program.c
+++ b/src/program.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: program.c,v 1.73 1998/04/09 02:49:48 hubbe Exp $");
+RCSID("$Id: program.c,v 1.74 1998/04/10 04:49:55 hubbe Exp $");
 #include "program.h"
 #include "object.h"
 #include "dynamic_buffer.h"
@@ -769,7 +769,7 @@ struct program *end_first_pass(int finish)
 
 
   /* Collect references to inherited __INIT functions */
-  for(e=1;e<new_program->num_inherits;e++)
+  for(e=new_program->num_inherits-1;e>1;e--)
   {
     int id;
     if(new_program->inherits[e].inherit_level!=1) continue;
@@ -777,9 +777,9 @@ struct program *end_first_pass(int finish)
     if(id!=-1)
     {
       init_node=mknode(F_ARG_LIST,
-		       init_node,
 		       mkcastnode(void_type_string,
-				  mkapplynode(mkidentifiernode(id),0)));
+				  mkapplynode(mkidentifiernode(id),0)),
+		       init_node);
     }
   }
 
diff --git a/src/testsuite.in b/src/testsuite.in
index 87b152a1d9..50f4989717 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -1,4 +1,4 @@
-test_true([["$Id: testsuite.in,v 1.86 1998/04/09 21:11:03 hubbe Exp $"]])
+test_true([["$Id: testsuite.in,v 1.87 1998/04/10 04:49:55 hubbe Exp $"]])
 test_eq(1e1,10.0)
 test_eq(1E1,10.0)
 test_eq(1e+1,10.0)
@@ -11,6 +11,9 @@ test_true([[1.0e-40]])
 test_eq([[#"foo
 bar"]],[["foo\nbar"]])
 test_true([[stringp(#string "Makefile")]])
+test_any([[class Bar { array(int) foo = ({}); }; class Foo { inherit Bar; array(int) foo = ({1}); }; return sizeof(Foo()->foo);]],1)
+
+
 test_any([[object(Stdio.File) f; f=Stdio.File(); return 1]],1)
 test_compile([[int t=gauge { string foo; };]])
 test_compile_any([[class { object(Stdio.FILE) f; void create() { f=Stdio.FILE(); }}]])
-- 
GitLab