public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/53386] New: Bad assembly code produced for m68000
@ 2012-05-17  4:05 ljalvs at gmail dot com
  2012-05-17  8:46 ` [Bug target/53386] " schwab@linux-m68k.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: ljalvs at gmail dot com @ 2012-05-17  4:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53386

             Bug #: 53386
           Summary: Bad assembly code produced for m68000
    Classification: Unclassified
           Product: gcc
           Version: 4.6.4
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ljalvs@gmail.com


Hi,

I'm currently using gcc 4.2.4 to build uClinux for a 68000 target (68HC000
cpu).

I've update my toolchain to newer tool versions but now gcc (4.6.4) is
producing bad assembly for this target.

I'm almost sure that it is producing only 68020 assembly code and/or ignoring
the -m68000 switch (I checked that when specifying -m68000 or -m68020 gcc is
producing the same assembly code).


Here is a simple testcase (a line from the kernel where my system was hanging):

C instruction (from 'proc_net_ns_init' function):

[...]
memcpy(netd->name, "net", 4);
[...]


4.2.4 assembly output:
[...]
  60:    157c 006e 004d     moveb #110,%a2@(77)
  66:    157c 0065 004e     moveb #101,%a2@(78)
  6c:    157c 0074 004f     moveb #116,%a2@(79)
  72:    422a 0050          clrb %a2@(80)
[...]


4.6.4 assembly output:
[...]
  42:    217c 6e65 7400     movel #1852142592,%a0@(77)
  48:    004d 
[...]


Since the opcode movel has an odd displacement, it is causing an address/bus
error exception, halting the cpu.



Another difference I've noticed while tracing the above issue, is the way
parameters are placed in the stack for the function call:


4.2.4 assembly:
[...]
movel  absolute_address,%sp-
[...]


4.6.4 assembly:
[...]
moveaw  value1,%a0
addal   value2,%a0
movel   %a0@,%sp-
[...]


This is not critical but at a first look, it look it has slower execution and
produces larger code (is this correct?).




Command line used in this test (from the kernel build):

m68k-uclinux-gcc -m68000 -Wp,-MD,net/sunrpc/.rpc_pipe.o.d -isystem
/usr/local/lib/gcc/m68k-uclinux/4.5.1/include
-I/root/m68k/20120401/uClinux-dist/linux-3.x/arch/m68k/include
-Iarch/m68k/include/generated -Iinclude  -include
/root/m68k/20120401/uClinux-dist/linux-3.x/include/linux/kconfig.h -D__KERNEL__
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -O2 -pipe -DUTS_SYSNAME=\"uClinux\"
-D__uClinux__ -fomit-frame-pointer -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -DCC_HAVE_ASM_GOTO   
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(rpc_pipe)" 
-D"KBUILD_MODNAME=KBUILD_STR(sunrpc)" -c -o fs/proc/proc_net.o
fs/proc/proc_net.c



Anyone knows what is the latest gcc version where code for 68000 is still ok?
(I didn't want to go and build version by version until I find the one that's
broken...)



Regards,
Luis Alves


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-01-19 22:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-17  4:05 [Bug target/53386] New: Bad assembly code produced for m68000 ljalvs at gmail dot com
2012-05-17  8:46 ` [Bug target/53386] " schwab@linux-m68k.org
2012-05-17 10:19 ` ljalvs at gmail dot com
2012-05-17 10:30 ` ljalvs at gmail dot com
2012-05-17 11:00 ` mikpe at it dot uu.se
2012-05-17 11:09 ` ljalvs at gmail dot com
2012-05-17 11:32 ` mikpe at it dot uu.se
2012-05-17 12:06 ` mikpe at it dot uu.se
2012-05-17 13:01 ` mikpe at it dot uu.se
2012-05-17 14:40 ` ljalvs at gmail dot com
2012-05-17 15:11 ` mikpe at it dot uu.se
2012-05-17 15:37 ` schwab@linux-m68k.org
2012-05-17 15:56 ` ljalvs at gmail dot com
2012-05-18 17:37 ` ljalvs at gmail dot com
2015-01-19 22:49 ` law at redhat dot com

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).