--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Wed Mar  8 15:11:07 1995
--* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311)
--*           id AA20982; Wed, 8 Mar 1995 15:11:07 -0500
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 3359; Wed, 08 Mar 95 15:10:18 EST
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.BRONSTEI.NOTE.YKTVMV.3385.Mar.08.14:54:46.-0500>
--*           for asbugs@watson; Wed, 08 Mar 95 15:10:18 -0500
--* Received: from bernina.ethz.ch by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Wed, 08 Mar 95 14:54:46 EST
--* Received: from vinci.inf.ethz.ch by bernina.ethz.ch with SMTP inbound;
--*           Wed, 8 Mar 1995 20:54:38 +0100
--* Received: (bronstei@localhost) by vinci.inf.ethz.ch (8.6.8/8.6.6) id UAA08268
--*           for asbugs@watson.ibm.com; Wed, 8 Mar 1995 20:54:37 +0100
--* Date: Wed, 8 Mar 1995 20:54:37 +0100
--* From: bronstei <bronstei@inf.ethz.ch>
--* Message-Id: <199503081954.UAA08268@vinci.inf.ethz.ch>
--* To: asbugs@watson.ibm.com
--* Subject: [1] runtime seg fault in domain hashing [qot.as][1.0.6]

--@ Fixed  by:  SSD   Tue Mar 21 12:49:05 EST 1995 
--@ Tested by:  none 
--@ Summary:    Patched the generation of references to extend symbols. (This fix should appear in r1-1-0.) 

--
-- This program runs fine if all the source is in *one* file, but if
-- cats.as and qot.as are compiled separately, through:
-- % axiomxl -Fo -Fao cats.as
-- % axiomxl -Fx qot.as cats.o
-- then running qot produces a seg fault (on a sun) with the following stack:
--
-- Program received signal SIGSEGV, Segmentation fault.
-- 0x5184 in CF29_integer_MINUS_init (e1=0x65500, P0_idx=0) at qot.as:31
-- (xxgdb) info stack
-- #0  0x5184 in CF29_integer_MINUS_init (e1=0x65500, P0_idx=0) at qot.as:31
-- #1  0x3dc1c in CF91_ifn ()
-- #2  0x3acc0 in CF24_domHash ()
-- #3  0x3c2dc in CF59_domainHash_BANG_ ()
-- #4  0x27b4 in CF0_qot (e1=0x0) at qot.as:11
-- #5  0x6d20 in main (argc=1, argv=0xeffff544) at axlmain.as:1

------------------------------- cats.as ----------------------------------
#include "axllib.as"

MyRing: Category == Ring with { bar: (%, %) -> % }

extend Integer: MyRing == add { bar(u:%, v:%):%	== gcd(u, v) }


------------------------------- qot.as -----------------------------------
#include "axllib.as"

#library mylib "cats.ao"
import from mylib;

Foo(R:Ring):Ring with {
	foo: R -> %;
	if R has EuclideanDomain then foo: % -> %;
} == add {
	macro Rep == R;

	import from Rep;

	0:% == per 0;
	1:% == per 1;
	foo(a:R):% == per a;
	coerce(a:Integer):% == foo(a::R);
	coerce(a:SingleInteger):% == foo(a::R);
	(a:%) + (b:%):% == a;
	-(a:%):% == a;
	(a:%) * (b:%):% == a;
	(p:R) * (a:%):% == a;
	(a:%) ^ (n:Integer):% == a;
	(a:%) = (b:%):Boolean == false;
	(port:TextWriter) << (a:%):TextWriter == port;

	if R has EuclideanDomain then foo(a:%):% == a;
		
}		
test():TextWriter == {
	import from Integer, Foo Integer;

        a := foo 2;
	print << "done" << newline;
}

test();

 
