public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20359] New: Incorrect code with global register variables
@ 2005-03-07 11:45 simonmar at microsoft dot com
  2005-03-07 15:02 ` [Bug rtl-optimization/20359] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: simonmar at microsoft dot com @ 2005-03-07 11:45 UTC (permalink / raw)
  To: gcc-bugs

Global register variables rear their ugly head again.  Here's a simple test case
that generates incorrect code on x86_64 with gcc 3.4.2:

$ cat bug.c
register void * R1 __asm__("%r13");

extern void g(void);
static void f(void) {
 R1 = g;
 goto *R1;
}
$ gcc -v  
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
$ gcc -O -S bug.c

The generated code for function f is:

f:
.LFB2:
        movl    $g, %eax
        jmp     *%rax

Note the assignment to the global register variable R1 has been lost.

This is breaking the Glasgow Haskell Compiler (http://www.haskell.org/ghc/) on
the x86_64 platform.  It might be related to the (closed) bug #7871.

-- 
           Summary: Incorrect code with global register variables
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simonmar at microsoft dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-*-linux
  GCC host triplet: x86_64-*-linux
GCC target triplet: x86_64-*-linux


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


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

end of thread, other threads:[~2005-05-19 17:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-07 11:45 [Bug c/20359] New: Incorrect code with global register variables simonmar at microsoft dot com
2005-03-07 15:02 ` [Bug rtl-optimization/20359] " pinskia at gcc dot gnu dot org
2005-03-07 15:05 ` pinskia at gcc dot gnu dot org
2005-03-07 15:11 ` simonmar at microsoft dot com
2005-03-07 15:13 ` pinskia at gcc dot gnu dot org
2005-03-07 17:28 ` [Bug rtl-optimization/20359] [3.3/3.4 regression] " belyshev at depni dot sinp dot msu dot ru
2005-03-08 14:01 ` jakub at gcc dot gnu dot org
2005-05-19 17:40 ` mmitchel 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).