🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #67

gcc-2.2.2/68k (bug) and overenthusiastic optimisation

#67
From: 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.
Technical Details
Message-ID: <9211031846.AA10073@milliways>
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!rock!concert!uvaarpa!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!synoptics.com!asmith

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!rock!concert!uvaarpa!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!synoptics.com!asmith
From: asmith@synoptics.com (Andrew Smith)
Subject: gcc-2.2.2/68k (bug) and overenthusiastic optimisation
Message-ID: <9211031846.AA10073@milliways>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 3 Nov 1992 18:46:18 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 42