public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/5531: gcc 3.0.2 -O3 -mthumb gererates invalid asm instructions
@ 2002-01-29 6:56 Mike.Wynn
0 siblings, 0 replies; only message in thread
From: Mike.Wynn @ 2002-01-29 6:56 UTC (permalink / raw)
To: gcc-gnats
>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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-01-29 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-29 6:56 optimization/5531: gcc 3.0.2 -O3 -mthumb gererates invalid asm instructions Mike.Wynn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).