From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9774 invoked by alias); 24 Aug 2004 20:40:36 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9760 invoked by uid 48); 24 Aug 2004 20:40:34 -0000 Date: Tue, 24 Aug 2004 20:40:00 -0000 From: "m dot a dot termeer at student dot tue dot nl" To: gcc-bugs@gcc.gnu.org Message-ID: <20040824204030.17176.m.a.termeer@student.tue.nl> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/17176] New: internal compiler error on invalid inline assembler code X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg02491.txt.bz2 List-Id: 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 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 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