public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14907] New: bogus sign/zero extension when relaying parameters with regparm
@ 2004-04-10 14:59 cesarb at nitnet dot com dot br
  2004-04-10 15:48 ` [Bug target/14907] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cesarb at nitnet dot com dot br @ 2004-04-10 14:59 UTC (permalink / raw)
  To: gcc-bugs

(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


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

* [Bug target/14907] bogus sign/zero extension when relaying parameters with regparm
  2004-04-10 14:59 [Bug optimization/14907] New: bogus sign/zero extension when relaying parameters with regparm cesarb at nitnet dot com dot br
@ 2004-04-10 15:48 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-10 15:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-10 15:31 -------
Confirmed.  I think this is requied by the ABI to promote it but since it is already promoted it could just 
use the full register, I do not know if this is really a bug but then again I could be wrong.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|optimization                |target
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-10 15:31:46
               date|                            |


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


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

* [Bug optimization/14907] bogus sign/zero extension when relaying parameters with regparm
  2004-04-10 14:59 [Bug optimization/14907] New: bogus sign/zero extension when relaying parameters with regparm cesarb at nitnet dot com dot br
  2004-04-10 15:48 ` [Bug target/14907] " pinskia at gcc dot gnu dot org
@ 2004-04-10 18:13 ` cesarb at nitnet dot com dot br
  2004-07-10  1:28 ` [Bug target/14907] " pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: cesarb at nitnet dot com dot br @ 2004-04-10 18:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cesarb at nitnet dot com dot br  2004-04-10 15:56 -------
regparm is a different (gcc-specific) version of the ABI right? (But someone
should check if the bogus extensions happen when loading the arguments from the
stack too, and check if they are really bogus when reading from the stack).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |optimization


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


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

* [Bug target/14907] bogus sign/zero extension when relaying parameters with regparm
  2004-04-10 14:59 [Bug optimization/14907] New: bogus sign/zero extension when relaying parameters with regparm cesarb at nitnet dot com dot br
  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 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-10  1:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-10 01:28 -------
Basically the problem is that the RTL optimizers do not know if they come in as full 32bit register even 
though the ABI demands it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-04-10 15:31:46         |2004-07-10 01:28:55
               date|                            |


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


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

end of thread, other threads:[~2004-07-10  1:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-10 14:59 [Bug optimization/14907] New: bogus sign/zero extension when relaying parameters with regparm cesarb at nitnet dot com dot br
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

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