public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35926]  New: Pushing / Poping ebx without using it.
@ 2008-04-13 17:49 ppelissi at caramail dot com
  2008-04-13 17:50 ` [Bug c/35926] " ppelissi at caramail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ppelissi at caramail dot com @ 2008-04-13 17:49 UTC (permalink / raw)
  To: gcc-bugs

The following code produces a push and pop of ebx without using it inside:

typedef struct toto_s *toto_t;
toto_t add (toto_t a, toto_t b) {
  int64_t tmp = (int64_t)(intptr_t)a + ((int64_t)(intptr_t)b&~1L);
  return (toto_t)(intptr_t) tmp;
}

Here is the output of the compiler:
gcc version 4.3.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-O3' '-S' '-fomit-frame-pointer' '-save-temps'
'-mtune=generic'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.0/cc1 -E -quiet -v immediate.c
-mtune=generic -fomit-frame-pointer -O3 -fpch-preprocess -o immediate.i
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.3.0/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.3.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-O3' '-S' '-fomit-frame-pointer' '-save-temps'
'-mtune=generic'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.0/cc1 -fpreprocessed immediate.i
-quiet -dumpbase immediate.c -mtune=generic -auxbase immediate -O3 -version
-fomit-frame-pointer -o immediate.s
GNU C (GCC) version 4.3.0 (i686-pc-linux-gnu)
        compiled by GNU C version 4.3.0, GMP version 4.2.2, MPFR version 2.3.1.
warning: GMP header version 4.2.2 differs from library version 4.1.4.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128998
Compiler executable checksum: 6f004a95f08b214d06bfab9d0128e657
COMPILER_PATH=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.0/:/usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.0/:/usr/local/libexec/gcc/i686-pc-linux-gnu/:/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.0/:/usr/local/lib/gcc/i686-pc-linux-gnu/
LIBRARY_PATH=/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.0/:/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-O3' '-S' '-fomit-frame-pointer' '-save-temps'
'-mtune=generic'
[pphd@localhost to-do]$ cat immediate.s 
        .file   "immediate.c"
        .text
        .p2align 4,,15
.globl add
        .type   add, @function
add:
        pushl   %ebx
        movl    12(%esp), %eax
        movl    8(%esp), %ecx
        popl    %ebx
        andl    $-2, %eax
        addl    %ecx, %eax
        ret
        .size   add, .-add
        .ident  "GCC: (GNU) 4.3.0"
        .section        .note.GNU-stack,"",@progbits

I can reproduce this problem for GCC 4.1.2 and GCC 4.2.2 too.


-- 
           Summary: Pushing / Poping ebx without using it.
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ppelissi at caramail dot com
 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=35926


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

* [Bug c/35926] Pushing / Poping ebx without using it.
  2008-04-13 17:49 [Bug c/35926] New: Pushing / Poping ebx without using it ppelissi at caramail dot com
@ 2008-04-13 17:50 ` ppelissi at caramail dot com
  2008-04-14  9:19 ` [Bug target/35926] " rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ppelissi at caramail dot com @ 2008-04-13 17:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ppelissi at caramail dot com  2008-04-13 17:49 -------
Created an attachment (id=15473)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15473&action=view)
preprocessed sources


-- 


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


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

* [Bug target/35926] Pushing / Poping ebx without using it.
  2008-04-13 17:49 [Bug c/35926] New: Pushing / Poping ebx without using it ppelissi at caramail dot com
  2008-04-13 17:50 ` [Bug c/35926] " ppelissi at caramail dot com
@ 2008-04-14  9:19 ` rguenth at gcc dot gnu dot org
  2008-04-14 11:13 ` ubizjak at gmail dot com
  2008-12-28  7:00 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-14  9:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-04-14 09:18 -------
This is setting up the frame pointer which is needed for unwinding/debugging
on some targets.  You can use -fomit-frame-pointer to avoid this.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug target/35926] Pushing / Poping ebx without using it.
  2008-04-13 17:49 [Bug c/35926] New: Pushing / Poping ebx without using it ppelissi at caramail dot com
  2008-04-13 17:50 ` [Bug c/35926] " ppelissi at caramail dot com
  2008-04-14  9:19 ` [Bug target/35926] " rguenth at gcc dot gnu dot org
@ 2008-04-14 11:13 ` ubizjak at gmail dot com
  2008-12-28  7:00 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2008-04-14 11:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2008-04-14 11:12 -------
(In reply to comment #2)
> This is setting up the frame pointer which is needed for unwinding/debugging
> on some targets.  You can use -fomit-frame-pointer to avoid this.

No, -fomit-frame-pointer uses %ebp.

%ebx is marked as used due to long long value in %ecx/%ebx. For some reason,
%ebx is still marked as live when function prologue and epilogue are
constructed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug target/35926] Pushing / Poping ebx without using it.
  2008-04-13 17:49 [Bug c/35926] New: Pushing / Poping ebx without using it ppelissi at caramail dot com
                   ` (2 preceding siblings ...)
  2008-04-14 11:13 ` ubizjak at gmail dot com
@ 2008-12-28  7:00 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28  7:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-12-28 06:57 -------
Confirmed, still happens even after IRA.  ebx is still being marked as being
used even though the RA does not use it.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |i?86-*-*
           Keywords|                            |missed-optimization, ra
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-28 06:57:47
               date|                            |


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


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

end of thread, other threads:[~2008-12-28  7:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-13 17:49 [Bug c/35926] New: Pushing / Poping ebx without using it ppelissi at caramail dot com
2008-04-13 17:50 ` [Bug c/35926] " ppelissi at caramail dot com
2008-04-14  9:19 ` [Bug target/35926] " rguenth at gcc dot gnu dot org
2008-04-14 11:13 ` ubizjak at gmail dot com
2008-12-28  7:00 ` 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).