This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/32370] New: [4.3 Regression] Segfault after rejecting bogus assembler
- From: "tbm at cyrius dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jun 2007 17:40:48 -0000
- Subject: [Bug middle-end/32370] New: [4.3 Regression] Segfault after rejecting bogus assembler
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I have a really interesting testcase that fails with current trunk. It's
a piece of C code with some x86 assembler which I'm trying to compile on
IA64. Obviously, this won't work. In the past, GCC happily rejected the
code. Now, however, GCC segfaults after printing an error. In fact, it's
a bit more interesting than this: GCC segfaults with -O and above, but with
no -O option it runs out of memory.
GCC did the right thing (i.e. reject the code and exit) as of 20070604.
Unfortunately I don't have a working gdb on ia64 so I cannot attach a
traceback.
tbm@coconut0:~$ /usr/lib/gcc-snapshot/libexec/gcc/ia64-linux-gnu/4.3.0/cc1 -O1
vbetool-thunk.c
inb_local printk x_inb
Analyzing compilation unit
Performing interprocedural optimizations
<visibility> <early_local_cleanups> <inline> <static-var>
<pure-const>Assembling functions:
inb_local
vbetool-thunk.c: In function 'inb_local':
vbetool-thunk.c:10: error: can't find a register in class 'AR_M_REGS' while
reloading 'asm'
vbetool-thunk.c:10: error: 'asm' operand has impossible constraints
x_inb
vbetool-thunk.c: In function 'x_inb':
vbetool-thunk.c:22: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
tbm@coconut0:~/src/b/vbetool-0.7$
/usr/lib/gcc-snapshot/libexec/gcc/ia64-linux-gnu/4.3.0/cc1 vbetool-thunk.c
inb_local
vbetool-thunk.c: In function 'inb_local':
vbetool-thunk.c:10: error: can't find a register in class 'AR_M_REGS' while
reloading 'asm'
vbetool-thunk.c:10: error: 'asm' operand has impossible constraints
printkKilled
Testcase:
#include <stdarg.h>
#define __BUILDIO(bwl,bw,type) \
unsigned type in##bwl##_local(unsigned long port) { \
unsigned type value; \
__asm__ __volatile__("in" #bwl " %w1, %" #bw "0" : "=a"(value) :
"Nd"(port)); \
return value; \
}\
__BUILDIO(b,b,char)
void
printk(const char *fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
va_end(argptr);
}
void
x_inb(unsigned short port)
{
unsigned char val;
val = inb_local(port);
}
--
Summary: [4.3 Regression] Segfault after rejecting bogus
assembler
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tbm at cyrius dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32370