🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Andrew Smith Tue, 03 Nov 1992 18:46
gcc-2.2.2/68k (bug) and overenthusiastic optimisation
#67
Author: Andrew Smith
Date: Tue, 03 Nov 1992 18:46
41 lines
1853 bytes
I found a problem with gcc-2.2.2 configured for target=sun3 i.e. m68k target.

1. GCC seems to ignore the -fno-defer-pop command-line directive. There is no
	way to stop the optimiser using deferred popping of subroutine args
	(except not using -O).


2. The above problem occurs when I want to write some sort of asm() statements
	which use the stack e.g. an interrupt handler:

void
  dummy_intr( void )
{
	int parm = 1;

	asm(   _real_intr:    moveml    d0-d7/a0-sp,sp@-    );

	call_c_routine( parm );

	asm(                  moveml    sp@+,d0-d7/a0-sp    );
	asm(                  rte                           );
}

This is broken because "parm" is pushed onto the stack before the
subroutine call but is not popped when -O is on. GCC thinks it will be
popped by the unlk instruction which it inserts before my '}' end of
routine which never gets called in my example because of the intervening "rte".

	REQUEST 1:   would it be easy to add a feature to alert GCC to the
		fact that the asm statements are using "sp" and it must not
		assume it stays unchanged. A similar syntax to the normal
		asm( ..... : : : "sp" ) would work, I think.

	REQUEST 2:   otherwise, some sort of GCC extension would be nice for
		programming interrupt routines cf Microsoft-C.



Andrew Smith
Distributed Network Systems
SynOptics Communications Inc.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads