[comp.sys.amiga] yet another Aztec C bug...

rmariani@watmum.UUCP (12/05/86)

This one was found easier because it produces an assembly time error
however, it is not so easy to determine the source...

main()
{
	register int p;
	int s[10];

 	s[p/4]/p;
}

Causes an assembly time error when compiled with the +l option but
works fine otherwise...

;main()
;{
	public	_main
_main:
	link	a5,#.2
	movem.l	.3,-(sp)
;	register int p;
;	int s[10];
;
; 	s[p/4]/p;
	move.l	d4,d0
	move.l	#4,d1			<---- you guys should generate a
	jsr	.divs#			      a shift please... don't call
	asl.l	#2,d0			      the signed division thing...
	lea	-40(a5),a6
	move.l	d0,-(sp)
	move.l	(a6,.l),d0		<---- CHOKE HERE
	move.l	(sp)+,d3
	move.l	d4,d1
	jsr	.divs#
;}
.4
	movem.l	(sp)+,.3
	unlk	a5
	rts
.2	equ	-40
.3	reg	d4
	public	.begin
	dseg
	cseg
	end

Besides the fact that this code is not exactly ummmm optimal, there is
a slight (so slight) syntax error in the assembler, that line should read

move.l (a6,d0.l),d0

Sigh....

Can we try to do something about this one B4 Version 3.40 too?

By the way, I am a registered (and satisfied!) Commercial version owner
and I have not recieved anything from Aztec ever.  I sent in my forms
last March. 

Maybe they don't like Canadians or something?  :-)


	-Rico

page@ulowell.UUCP (Bob Page) (12/06/86)

rmariani@watmum.UUCP (Rico Mariani) wrote in article <717@watmum.UUCP>:
>This one was found easier because it produces an assembly time error

Fixed in V3.30e (beta version).  It still generates the jsr .divs#
instruction, though.

	Old code:		New code:		Bob's comments
	--------------		--------------		--------------
	move.l	d4,d0		move.l	#4,d1		reversed order
	move.l	#4,d1		move.l	d4,d0
	jsr	.divs#		jsr	.divs#		still no shift
	asl.l	#2,d0		asl.l	#2,d0
	lea	-40(a5),a6	lea	-40(a5),a0
	move.l	d0,-(sp)	move.l	d0,d2		a speedup here
	move.l	(a6,.l),d0	move.l	(a0,d2.l),d0	fixed the bug
	move.l	(sp)+,d3				was excess code
	move.l	d4,d1		move.l	d4,d1
	jsr	.divs#		jsr	.divs#

The rest of the code is about the same.  It runs through the
assembler OK, too.

..Bob (not affiliated with Manx, by the way, except as beta tester)
-- 
Bob Page,  U of Lowell CS Dept.      ulowell!page,  page@ulowell.CSNET