public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Egcs 1.1 produces incorrect ColdFire code
@ 1998-09-15 8:14 Eric Devolder
1998-09-15 12:01 ` Toon Moene
1998-10-31 1:24 ` Jeffrey A Law
0 siblings, 2 replies; 5+ messages in thread
From: Eric Devolder @ 1998-09-15 8:14 UTC (permalink / raw)
To: egcs-bugs
Hey all, I've configured Egcs 1.1b with Binutils 2.9.1 for m68k-coff.
Here is a simple program that illustrates the incorrect code:
typedef struct
{
char spacing[0xAAAA]; /* value which breaks 16-bit displacement */
char tryme;
} silly;
void
main (void)
{
silly *sill = 0;
sill->tryme = 0xABCD;
}
When compiling with Egcs 1.1b, I obtain the following:
/usr2/styx/comp/m68k/egcs-1.1b/binutils-2.9.1/bin/m68k-coff-gcc -m5200
-S -I../../src/include -I../../src/dbug/v2 -I. -fno-builtin -ansi -Wall
-D MCF5206_EVS src/dbug/t.c -o obj/gnu/board/t.s
src/dbug/t.c:9: warning: return type of `main' is not `int'
src/dbug/t.c: In function `main':
src/dbug/t.c:12: warning: overflow in implicit constant conversion
/usr2/styx/comp/m68k/egcs-1.1b/binutils-2.9.1/bin/m68k-coff-as -m5200
--register-prefix-optional -ahls=obj/gnu/board/t.lst -o
obj/gnu/board/t.o obj/gnu/board/t.s
obj/gnu/board/t.s: Assembler messages:
obj/gnu/board/t.s:13: Error: displacement too large for this
architecture; needs 68020 or higher -- statement `move.b %d0,43690(%a0)'
ignored
Here is the listing file:
68K GAS obj/gnu/board/t.s page 1
1 .file "t.c"
2 gcc2_compiled.:
3 __gnu_compiled_c:
4 .text
5 ???? 00 .even
6 .globl main
7 main:
8 ???? 4E56 FFFC link.w %a6,#-4
9 ???? 4EB9 0000 jsr __main
9 0000
10 ???? 42AE FFFC clr.l -4(%a6)
11 ???? 206E FFFC move.l -4(%a6),%a0
12 ???? 70CD moveq.l #-51,%d0
13 move.b %d0,43690(%a0) <---- invalid
16-bit displacement
14 .L1:
15 ???? 4E5E unlk %a6
16 rts
^L68K GAS obj/gnu/board/t.s page 2
The assembler correctly catches the invalid displacement for ColdFire.
For what its worth, this was working in Egcs 1.0.3, as evidenced by the
listing file below:
68K GAS obj/gnu/board/t.s page 1
1 .file "t.c"
2 gcc2_compiled.:
3 __gnu_compiled_c:
4 .text
5 .even
6 .globl main
7 main:
8 0000 4E56 FFFC link.w %a6,#-4
9 0004 4EB9 0000 jsr __main
9 0000
10 000a 42AE FFFC clr.l -4(%a6)
11 000e 206E FFFC move.l -4(%a6),%a0
12 0012 203C 0000 move.l #43690,%d0
12 AAAA
13 0018 72CD moveq.l #-51,%d1
14 001a 1181 0800 move.b %d1,(%a0,%d0.l)
15 .L1:
16 001e 4E5E unlk %a6
17 0020 4E75 rts
^L68K GAS obj/gnu/board/t.s page 2
Thanks,
Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Egcs 1.1 produces incorrect ColdFire code
1998-09-15 8:14 Egcs 1.1 produces incorrect ColdFire code Eric Devolder
@ 1998-09-15 12:01 ` Toon Moene
1998-09-17 1:11 ` Jeffrey A Law
1998-10-31 1:24 ` Jeffrey A Law
1 sibling, 1 reply; 5+ messages in thread
From: Toon Moene @ 1998-09-15 12:01 UTC (permalink / raw)
To: Eric Devolder; +Cc: egcs-bugs
> Hey all, I've configured Egcs 1.1b with Binutils 2.9.1
> for m68k-coff. Here is a simple program that illustrates
> the incorrect code:
>
> [ simple snip ]
>
> When compiling with Egcs 1.1b, I obtain the following:
>
> /usr2/styx/comp/m68k/egcs-1.1b/binutils-2.9.1/bin/m68k-coff-gcc
> -m5200 -S -I../../src/include -I../../src/dbug/v2 -I.
> -fno-builtin -ansi -Wall -D MCF5206_EVS src/dbug/t.c -o
> obj/gnu/board/t.s
> ...
> obj/gnu/board/t.s: Assembler messages:
> obj/gnu/board/t.s:13: Error: displacement too large for
> this architecture; needs 68020 or higher -- statement
> `move.b %d0,43690(%a0)' ignored
Unfortunately, I don't have egcs-1.1 lying around anymore, but it
might be instructive to look into .../gcc/config/m68k/m68k.h and
search for the "TARGET_SWITCHES"; the following is the current entry
for the m5200 (note the turning off of MASK_68020):
{ "5200", - (MASK_68060|MASK_68040|MASK_68040_ONLY|MASK_68020 \
|MASK_BITFIELD|MASK_68881)}, \
{ "5200", (MASK_5200)}, \
This bit (TARGET_68020) is used further down in the m68k.h file to
allow large offsets to address registers, so for the m5200 this bit
should *not* be set, as above.
HTH,
Toon.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Egcs 1.1 produces incorrect ColdFire code
1998-09-15 12:01 ` Toon Moene
@ 1998-09-17 1:11 ` Jeffrey A Law
1998-09-17 12:58 ` Toon Moene
0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey A Law @ 1998-09-17 1:11 UTC (permalink / raw)
To: Toon Moene; +Cc: Eric Devolder, egcs-bugs
In message < 9809151847.AA23990@moene.indiv.nluug.nl >you write:
> > obj/gnu/board/t.s: Assembler messages:
> > obj/gnu/board/t.s:13: Error: displacement too large for
> > this architecture; needs 68020 or higher -- statement
> > `move.b %d0,43690(%a0)' ignored
>
> Unfortunately, I don't have egcs-1.1 lying around anymore, but it
> might be instructive to look into .../gcc/config/m68k/m68k.h and
> search for the "TARGET_SWITCHES"; the following is the current entry
> for the m5200 (note the turning off of MASK_68020):
>
> { "5200", - (MASK_68060|MASK_68040|MASK_68040_ONLY|MASK_68020 \
> |MASK_BITFIELD|MASK_68881)}, \
> { "5200", (MASK_5200)}, \
>
> This bit (TARGET_68020) is used further down in the m68k.h file to
> allow large offsets to address registers, so for the m5200 this bit
> should *not* be set, as above.
I do not think changing TARGET_SWITCHES is the right fix since that
will have other effects than just changing the allowable offsets.
It is probably better to fix GO_IF_LEGITIMATE_ADDRESS and friends to
test TARGET_5200 has needed.
jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Egcs 1.1 produces incorrect ColdFire code
1998-09-17 1:11 ` Jeffrey A Law
@ 1998-09-17 12:58 ` Toon Moene
0 siblings, 0 replies; 5+ messages in thread
From: Toon Moene @ 1998-09-17 12:58 UTC (permalink / raw)
To: law; +Cc: Eric Devolder, egcs-bugs
In message < 9809151847.AA23990@moene.indiv.nluug.nl > I wrote:
> > obj/gnu/board/t.s: Assembler messages:
> > obj/gnu/board/t.s:13: Error: displacement too large for
> > this architecture; needs 68020 or higher -- statement
> > `move.b %d0,43690(%a0)' ignored
>
> Unfortunately, I don't have egcs-1.1 lying around anymore, but it
> might be instructive to look into .../gcc/config/m68k/m68k.h and
> search for the "TARGET_SWITCHES"; the following is the current
entry
> for the m5200 (note the turning off of MASK_68020):
>
> { "5200", -
(MASK_68060|MASK_68040|MASK_68040_ONLY|MASK_68020 \
> |MASK_BITFIELD|MASK_68881)},
\
> { "5200", (MASK_5200)},
\
>
> This bit (TARGET_68020) is used further down in the m68k.h file to
> allow large offsets to address registers, so for the m5200 this bit
> should *not* be set, as above.
and Jeff replied:
> I do not think changing TARGET_SWITCHES is the right fix
> since that will have other effects than just changing
> the allowable offsets. It is probably better to fix
> GO_IF_LEGITIMATE_ADDRESS and friends to test TARGET_5200
> has needed.
According to my reading of the documentation, the above definition
turns *off* flags TARGET_68060, TARGET_68040, TARGET_68040_ONLY,
TARGET_68020, TARGET_BITFIELD and TARGET_68881 when specifying
-m5200 on the command line.
QUOTE
TARGET_SWITCHES
...
Each subgrouping contains a string constant, that defines the
option name, and a number, which contains the bits to set in
`target_flags'. A negative number says to clear these bits
instead; the negative of the number is which bits to clear.
The actual option name is made by appending `-m' to the
specified name [ meant here is `prepending', I think (TM) ]
...
UNQUOTE
So gcc -m5200 should clear TARGET_68020 (amongst others) and set
TARGET_5200. If this interpretation is correct, the backend
shouldn't generate large offsets, because TARGET_68020 isn't set.
Confusingly yours,
Toon.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Egcs 1.1 produces incorrect ColdFire code
1998-09-15 8:14 Egcs 1.1 produces incorrect ColdFire code Eric Devolder
1998-09-15 12:01 ` Toon Moene
@ 1998-10-31 1:24 ` Jeffrey A Law
1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey A Law @ 1998-10-31 1:24 UTC (permalink / raw)
To: Eric Devolder; +Cc: egcs-bugs
In message <35FE7D3D.E38EC066@email.sps.mot.com>you write:
> Hey all, I've configured Egcs 1.1b with Binutils 2.9.1 for m68k-coff.
> Here is a simple program that illustrates the incorrect code:
>
> typedef struct
> {
> char spacing[0xAAAA]; /* value which breaks 16-bit displacement */
> char tryme;
> } silly;
>
> void
> main (void)
> {
> silly *sill = 0;
>
> sill->tryme = 0xABCD;
> }
>
> When compiling with Egcs 1.1b, I obtain the following:
This has been fixed for the upcoming egcs-1.1.1 release:
main:
link.w %a6,#-4
jsr __main
clr.l -4(%a6)
move.l -4(%a6),%a0
move.l #43690,%d0
moveq.l #-51,%d1
move.b %d1,(%a0,%d0.l)
.L1:
unlk %a6
rts
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1998-10-31 1:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-15 8:14 Egcs 1.1 produces incorrect ColdFire code Eric Devolder
1998-09-15 12:01 ` Toon Moene
1998-09-17 1:11 ` Jeffrey A Law
1998-09-17 12:58 ` Toon Moene
1998-10-31 1:24 ` Jeffrey A Law
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).