public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ljalvs at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/53386] New: Bad assembly code produced for m68000
Date: Thu, 17 May 2012 04:05:00 -0000	[thread overview]
Message-ID: <bug-53386-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2012-05-17  2:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17  4:05 ljalvs at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53386-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).