public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nickc at redhat dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/45000] RX signed extened unsigned char or short return value. Date: Thu, 22 Jul 2010 09:43:00 -0000 [thread overview] Message-ID: <20100722094244.21317.qmail@sourceware.org> (raw) In-Reply-To: <bug-45000-19023@http.gcc.gnu.org/bugzilla/> ------- Comment #1 from nickc at redhat dot com 2010-07-22 09:42 ------- Hi Kazuhiro-san, This is not a bug, it is the expected behaviour. What is happening is that the return value from func() is being promoted to "signed int" (and not "unsigned int" as you might expect). Thus since the MOV.B instruction performs a sign extension it is a sufficient instruction for the load operation. Note - if you try using the result of calling func() then you will see a zero extension being performed. Eg: int bar (int a) { return a < func(); } results in: mov.L #_uA, r14 movu.B [r14], r14 cmp r1, r14 sclt.L r1 rts with inlining, or: push.l r7 mov.L r1, r7 bsr _func movu.B r1, r1 cmp r7, r1 sclt.L r1 rtsd #4, r7-r7 without. Cheers Nick Clifton PS. See section 6.3.1.1 of the ISO C99 standard for more information about this behaviour -- nickc at redhat dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nickc at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45000
next prev parent reply other threads:[~2010-07-22 9:43 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-07-20 9:07 [Bug target/45000] New: " kazuhiro dot inaoka dot ud at renesas dot com 2010-07-22 9:43 ` nickc at redhat dot com [this message] 2010-07-28 7:19 ` [Bug target/45000] " kazuhiro dot inaoka dot ud at renesas dot com 2010-07-28 13:55 ` nickc at redhat dot com 2010-07-28 14:05 ` nickc at redhat dot com 2010-08-03 9:33 ` kazuhiro dot inaoka dot ud at renesas 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=20100722094244.21317.qmail@sourceware.org \ --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: linkBe 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).