public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cesarb at nitnet dot com dot br" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/14907] New: bogus sign/zero extension when relaying parameters with regparm
Date: Sat, 10 Apr 2004 14:59:00 -0000	[thread overview]
Message-ID: <20040410140503.14907.cesarb@nitnet.com.br> (raw)

(this seem to be another case of the general bug of "the compiler doesn't know
when it has already extended the value")

This is the "other side" of PR 14903

When compiling:
extern void __attribute__((__regparm__(3))) f(unsigned char x);
void __attribute__((__regparm__(3))) g(unsigned char x) { f(x); }

With:
gcc -W -Wall -Os -fomit-frame-pointer -save-temps -c

The result is:
g:
        movzbl  %al, %eax
        jmp     f

Notice again the bogus zero extension (sign extension with signed char). The
same happens with shorts.

While PR 14903 can cause excessive stack usage, this one just looks dumb in the
assembly output.

Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040401)

-- 
           Summary: bogus sign/zero extension when relaying parameters with
                    regparm
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cesarb at nitnet dot com dot br
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


             reply	other threads:[~2004-04-10 14:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-10 14:59 cesarb at nitnet dot com dot br [this message]
2004-04-10 15:48 ` [Bug target/14907] " pinskia at gcc dot gnu dot org
2004-04-10 18:13 ` [Bug optimization/14907] " cesarb at nitnet dot com dot br
2004-07-10  1:28 ` [Bug target/14907] " pinskia at gcc dot gnu dot org

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=20040410140503.14907.cesarb@nitnet.com.br \
    --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).