[m-dev.] undefined types

Tyson Richard DOWD trd at students.cs.mu.oz.au
Mon Feb 17 17:42:43 AEDT 1997


> Hi Tyson,
> 
> Your changes to type_info handling for grades fast & jump
> has broken tests/valid/headvar_not_found in those grades.
> The reason it breaks is that the test case declares a couple
> of types but doesn't define them.  Currently we allow this
> in other grades, and so we should allow it in grade fast/jump too.
> 
> Can you please fix this one?


Estimated hours taken: 0.3

Fix a bug in the initialization of type_infos for types with
declarations but without definitions.

runtime/type_info.h:
	- Declare_entry(...) of entry labels before using them, as they
	  may be externally defined.

Index: type_info.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/type_info.h,v
retrieving revision 1.17
diff -u -r1.17 type_info.h
--- type_info.h	1997/02/17 01:02:13	1.17
+++ type_info.h	1997/02/17 06:30:06
@@ -337,10 +337,15 @@
 */
 
 /*
-** A fairly generic static code address initializer.
+** A fairly generic static code address initializer - at least for entry
+** labels.
 */
 #define MR_INIT_CODE_ADDR(Base, PredAddr, Offset)			\
-	((Word *) (Word) &Base)[Offset]	= (Word) ENTRY(PredAddr)
+	do {								\
+		Declare_entry(PredAddr);				\
+		((Word *) (Word) &Base)[Offset]	= (Word) ENTRY(PredAddr);\
+	} while (0)
+			
 
 #define MR_SPECIAL_PRED_INIT(Base, TypeId, Offset, Pred)	\
 	MR_INIT_CODE_ADDR(Base, mercury____##Pred##___##TypeId, Offset)



-- 
       Tyson Dowd           # "Most people's C code should be indented
                            #  six feet downward and covered with 
     trd at cs.mu.oz.au        #  dirt."
http://www.cs.mu.oz.au/~trd # - Blair Houghton, on C code indentation



More information about the developers mailing list