🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clu
Article #24

Yet another linker bug + fix

#24
From: Matti Jokinen
Date: Sun, 27 Dec 1987 22:37
52 lines
1850 bytes
Description:  An attempt to overload a module with more than one parameter
may crash the debugger.  The bug appears at least in VAX CLU.

Repeat-by:  Compile the following program into c.bin:

    c = cluster is create

	rep = string

	create = proc[t,u: type](x: t, y: u,
				 p: proctype(t) returns(rep),
				 q: proctype(u) returns(rep))
		     returns(cvt)
	  return(p(x))
	end create

    end c

Type `debug c', and when the linker prompt appears, type `load("c")'.

Although the symptoms are very similar, this bug is unrelated to the bug
I reported in article 22.

Fix: The true origin of this problem appears to be the following equate
in /usr/clu/link/linker.equ:

    params = sequence[constant]

I think it should be

    params = oneof[dummy: null, list: sequence[constant]]

However, changing this would cause a number of changes in various parts
of the linker.  I am reluctant to maintain a system that differs too
much from the `official' MIT version.  Also, these changes may depend on
the linker version you have.

Thus I prefere a quick fix, and fortunately there is one.  Redefine the
Copy procedure in /usr/clu/link/clu/constant.  The original definition is

    Copy = proc (C: cvt) returns (cvt);
	return (rep$Copy1(C));
	end Copy;

Replace it with

    Copy = proc (C: cvt) returns (cvt);
	tagcase C
	    tag a_Null:	return(C);
	    others:	return (rep$Copy1(C));
	    end;
	end Copy;
Technical Details
Message-ID: <662@tucos.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!ames!amdahl!uunet!mcvax!enea!tut!tucos!jokinen

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!ames!amdahl!uunet!mcvax!enea!tut!tucos!jokinen
From: jokinen@tucos.UUCP (Matti Jokinen)
Newsgroups: comp.lang.clu
Subject: Yet another linker bug + fix
Message-ID: <662@tucos.UUCP>
Date: 27 Dec 87 22:37:10 GMT
Distribution: inet
Organization: University of Turku, Finland
Lines: 52
Approved: jokinen@cs.utu.fi
X-Posting-Number: 26