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

Reply via email to