public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17176] New: internal compiler error on invalid inline assembler code
@ 2004-08-24 20:40 m dot a dot termeer at student dot tue dot nl
  2004-08-24 20:46 ` [Bug c/17176] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: m dot a dot termeer at student dot tue dot nl @ 2004-08-24 20:40 UTC (permalink / raw)
  To: gcc-bugs

i was trying to get a stack dump from a linux program and used some assembler to
do the trick. when compiling the following code

#include <stdio.h>

main() {
        char *stackptr;
        __asm__("movl %esp,%%eax" : "=eax"(stackptr) : : "eax");

        return 0;
}

with "gcc stack_crash.c" causes the output

dec@dec:~$ gcc stack_crash.c
stack_crash.c: In function `main':
stack_crash.c:20: Internal compiler error in instantiate_virtual_regs_1, at
function.c:3971
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

this is gcc version 3.2.3, or more complete, the output of gcc -v:

dec@dec:~$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/specs
Configured with: ../gcc-3.2.3/configure --prefix=/usr --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld
--verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.2.3

to fix the problem, i upgraded my gcc version to 3.3.3 and now i get the
following output.

stack_crash.c: In function `main':
stack_crash.c:5: error: impossible constraint in `asm'

with gcc -v being

Reading specs from /usr/lib/gcc-lib/i486-pc-linux-gnu/3.3.3/specs
Configured with: /var/tmp/portage/gcc-3.3.3-r6/work/gcc-3.3.3/configure
--prefix=/usr --bindir=/usr/i486-pc-linux-gnu/gcc-bin/3.3
--includedir=/usr/lib/gcc-lib/i486-pc-linux-gnu/3.3.3/include
--datadir=/usr/share/gcc-data/i486-pc-linux-gnu/3.3
--mandir=/usr/share/gcc-data/i486-pc-linux-gnu/3.3/man
--infodir=/usr/share/gcc-data/i486-pc-linux-gnu/3.3/info --enable-shared
--host=i486-pc-linux-gnu --target=i486-pc-linux-gnu --with-system-zlib
--enable-languages=c,c++ --enable-threads=posix --enable-long-long
--disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio
--enable-version-specific-runtime-libs
--with-gxx-include-dir=/usr/lib/gcc-lib/i486-pc-linux-gnu/3.3.3/include/g++-v3
--with-local-prefix=/usr/local --enable-shared --enable-nls
--without-included-gettext --disable-multilib --enable-__cxa_atexit
--enable-clocale=generic
Thread model: posix
gcc version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6)

so actually, this bug is already fixed. but i just felt like submitting it.

by the way, the correct asm code turned out to be

        unsigned char *stackptr = (unsigned char *)&stackptr;
        asm ("movl %%esp, %0\n" :"=r"(stackptr));

which works with both versions of gcc.

the bug was present on various linux systems, with different distributions,
processors and such.

-- 
           Summary: internal compiler error on invalid inline assembler code
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: m dot a dot termeer at student dot tue dot nl
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: various linux systems


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


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

* [Bug c/17176] internal compiler error on invalid inline assembler code
  2004-08-24 20:40 [Bug c/17176] New: internal compiler error on invalid inline assembler code m dot a dot termeer at student dot tue dot nl
@ 2004-08-24 20:46 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 20:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 20:46 -------
Yes we know it was fixed, there are already many bug reports about this failure, See PR7916, 9181, and 
others.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.3.3


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


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

end of thread, other threads:[~2004-08-24 20:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-24 20:40 [Bug c/17176] New: internal compiler error on invalid inline assembler code m dot a dot termeer at student dot tue dot nl
2004-08-24 20:46 ` [Bug c/17176] " 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).