public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37613]  New: probelm with optmization and local variable stored in an asm register
@ 2008-09-22 11:18 daniel dot diaz at univ-paris1 dot fr
  2008-09-22 11:29 ` [Bug c/37613] " rguenth at gcc dot gnu dot org
  2008-09-22 14:09 ` daniel dot diaz at univ-paris1 dot fr
  0 siblings, 2 replies; 3+ messages in thread
From: daniel dot diaz at univ-paris1 dot fr @ 2008-09-22 11:18 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2024 bytes --]

in this simple function

bug.c:
void restore() {
  register long reg_ebx asm ("ebx");
  reg_ebx = saved_ebx;
}


$ gcc -v
Utilisation des specs internes.
Target: i386-redhat-linux
Configuré avec: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-cpu=generic --build=i386-redhat-linux
Modèle de thread: posix
gcc version 4.3.2 20080905 (Red Hat 4.3.2-3) (GCC) 

$ uname -a
Linux lima.univ-paris1.fr 2.6.24-0.83.rc5.fc9 #1 SMP Tue Dec 11 12:04:08 EST
2007 i686 i686 i386 GNU/Linux

$ gcc -O -S  -ffixed-ebx -fomit-frame-pointer bug.c
$ cat bug.c

restore:
        rep
        ret
        .size   restore, .-restore
        .comm   saved_ebx,4,4

the function is empty: the assignment to reg_ebx has been discarded (because
considered as a local variable). In the presence of asm it should be kept.
It is OK if -O is not given.

Maybe there is a way do it differently (btw I cannot declare the var as global
nor static in my application).


-- 
           Summary: probelm with optmization and local variable stored in an
                    asm register
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: daniel dot diaz at univ-paris1 dot fr
 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=37613


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

* [Bug c/37613] probelm with optmization and local variable stored in an asm register
  2008-09-22 11:18 [Bug c/37613] New: probelm with optmization and local variable stored in an asm register daniel dot diaz at univ-paris1 dot fr
@ 2008-09-22 11:29 ` rguenth at gcc dot gnu dot org
  2008-09-22 14:09 ` daniel dot diaz at univ-paris1 dot fr
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-09-22 11:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-09-22 11:27 -------
reg_ebx is obviously unused in your function so the assignment is DCEd.  I
guess
what you try to do is not really possible with C.


-- 

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


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

* [Bug c/37613] probelm with optmization and local variable stored in an asm register
  2008-09-22 11:18 [Bug c/37613] New: probelm with optmization and local variable stored in an asm register daniel dot diaz at univ-paris1 dot fr
  2008-09-22 11:29 ` [Bug c/37613] " rguenth at gcc dot gnu dot org
@ 2008-09-22 14:09 ` daniel dot diaz at univ-paris1 dot fr
  1 sibling, 0 replies; 3+ messages in thread
From: daniel dot diaz at univ-paris1 dot fr @ 2008-09-22 14:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from daniel dot diaz at univ-paris1 dot fr  2008-09-22 14:08 -------
Richard Guenther says it is impossible in C... In C maybe but not in GNU C :-)
This worked perfectly under older versions (may gcc 3.x.x) and it is a pitty if
this feature is lost now. 


-- 


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


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

end of thread, other threads:[~2008-09-22 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-22 11:18 [Bug c/37613] New: probelm with optmization and local variable stored in an asm register daniel dot diaz at univ-paris1 dot fr
2008-09-22 11:29 ` [Bug c/37613] " rguenth at gcc dot gnu dot org
2008-09-22 14:09 ` daniel dot diaz at univ-paris1 dot fr

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