This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/5531: gcc 3.0.2 -O3 -mthumb gererates invalid asm instructions



>Number:         5531
>Category:       optimization
>Synopsis:       gcc 3.0.2 -O3 -mthumb gererates invalid asm instructions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          mistaken
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 29 06:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Mike.Wynn@l8night.co.uk
>Release:        gcc 3.0.2 (Devkitadv)
>Organization:
>Environment:
Win2000,  --host=i686-pc-cygwin --target=arm-agb-elf --with-cpu=arm7tdmi
>Description:
the -finline-functions part of O3 causes ldrb rN, [sp] asm instruction on thumb mode.
the following error is given  
Error: byte or halfword not valid for base register
I have reduced the file to a minimun, small changes to the source will make the problem go away!
>How-To-Repeat:
gcc -O2 -mthumb -finline-functions -c -o main-buggy.o main-buggy.c
or gcc -O3 -mthumb -c -o main-buggy.o main-buggy.c
>Fix:
don't use -O3 or -finline-functions, randomly add lines/functions to source !
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="main-buggy.c"
Content-Disposition: inline; filename="main-buggy.c"


void msgPrint( int x, int y, unsigned short palette, const unsigned char * msg )
{
	unsigned short * mapbase;
	int index, end;

	index = y * 32 + x;

	end = index + (32 - x);

	mapbase = (unsigned short)0x0600000;
	palette <<= 12;
	while ( *msg )
	{
		if ( index == end ) return;
		mapbase[index++] = (*msg|palette);
		msg++;
	}
}

const char * const digits = "0123456789ABCDEF";
void
printInt( int num, int x, int y, int palette )
{
	unsigned char tmp[5];
	tmp[0] = digits[(num>>12)&0xF];
	tmp[1] = digits[(num>>8)&0xF];
	tmp[2] = digits[(num>>4)&0xF];
	tmp[3] = digits[num&0xF];
	tmp[4] = 0;
	msgPrint( x, y, palette, tmp ); 
}

int main()
{
	return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]