Path: utzoo!attcan!uunet!husc6!bloom-beacon!mit-eddie!ll-xn!ames!pasteur!ucbvax!decwrl!muscat!jfcl.dec.com!tsc.dec.com!pete
From: pete@tsc.dec.com (Pete Schmitt)
Newsgroups: comp.sys.att
Subject: Am I seeing things?
Keywords: compiler problems
Message-ID: <547@tsc.dec.com>
Date: 24 Jun 88 14:08:53 GMT
Organization: DEC CSC/NSU in Colorado Springs
Lines: 34

When I run the following code on a VAX running Ultrix 2.2 I get a
correct output of:
			2 to the 4th = 16

When I run it on a 6300+ running V2.5 unix I get:

			2 to the 0th = 4

Where is the problem?  Is this a bug?

The code:


/* lpowd.c */
main()
{
	long b,e,a,lpow();
	b = 2;
	e = 4;
	a = lpow(b,e);
	printf("%d to the %dth = %d\n",b,e,a);
}
	
long lpow(lnum, n)
	
	long lnum;
	long n;
	{
		long p;
		p=1;
		for ( ; n > 0; --n)
			p *= lnum;
		return (p);
	}