--* From Manuel.Bronstein@sophia.inria.fr  Tue Oct 31 17:04:56 2000
--* Received: from server-16.tower-4.starlabs.net (mail.london-1.starlabs.net [212.125.75.12])
--* 	by nagmx1.nag.co.uk (8.9.3/8.9.3) with SMTP id RAA21606
--* 	for <ax-bugs@nag.co.uk>; Tue, 31 Oct 2000 17:04:55 GMT
--* X-VirusChecked: Checked
--* Received: (qmail 12390 invoked from network); 31 Oct 2000 17:04:20 -0000
--* Received: from droopix.inria.fr (138.96.111.4)
--*   by server-16.tower-4.starlabs.net with SMTP; 31 Oct 2000 17:04:20 -0000
--* Received: by droopix.inria.fr (8.11.1/8.10.0) id e9VH4Jp02494 for ax-bugs@nag.co.uk; Tue, 31 Oct 2000 18:04:19 +0100
--* Date: Tue, 31 Oct 2000 18:04:19 +0100
--* From: Manuel Bronstein <Manuel.Bronstein@sophia.inria.fr>
--* Message-Id: <200010311704.e9VH4Jp02494@droopix.inria.fr>
--* To: ax-bugs@nag.co.uk
--* Subject: [3] overloading causes bad code generation

--@ Fixed  by: <Who> <Date>
--@ Tested by: <Name of new or existing file in test directory>
--@ Summary:   <Description of real problem and the fix>

-- Command line: axiomxl -q1 -ginterp badcall.as
-- Version: 1.1.12p6
-- Original bug file name: badcall.as

--------------------------- badcall.as -----------------------------
--
-- Looks like overloading functions with the same total # of params
-- really confuses the compiler at -q1:
--
-- % axiomxl -q2 -ginterp badcall.as
-- a = 2
-- b = 3
--
-- % axiomxl -q1 -ginterp badcall.as
-- a = 2
-- b = -1
--
-- % axiomxl -q1 -fx -laxllib badcall.as
-- % badcall
-- Segmentation fault
--

#include "axllib"

define Foo: Category == with {
	foo: % -> (%, %, %);
	foo: (%, %) -> (%, %);
}


extend Integer: Foo == add {
	foo(x:%):(%, %, %) == {
		x < 0 => (-x, -1, -1);
		(x, 1, 1)
	}

	foo(x:%, z:%):(%, %) == {
		x < 0 => (-x, -z);
		(x, z)
	}
}

main():() == {
	import from Integer;
	(a, b) := foo(-2, -3);                  -- should be (2,3)
	print << "a = " << a << newline;
	print << "b = " << b << newline;
}

main()

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp
