pardo@JUNE.CS.WASHINGTON.EDU (07/15/89)
MACHINE: i386 Sequent. GCC: v 1.34, configured using the standard configuration script. The following appears to be a bug. `gcc' recognizes operand specifiers of the form `*&structname.member' and `structname', but does not recognize oeprand specifiers of the form `structname.member'. ;-D on ( I want a port-a-bull! ) Pardo * test.c: -------------------------------------------------------------- typedef struct buf_list_t { struct buf_t *tail; char lock; } buf_list_t; buf_list_t freelist; int zork (struct buf_t *buf) { asm ( "movl %2,%%ecx\n\txchgl %%ecx,%0\n\tmovl %2,(%%ecx)" : "=m" (*&freelist.tail) : "0" (*&freelist.tail) , "mr" (buf) : "cx" ); return (0); } * compile: -------- gcc -Wall -S -c test.c * test.s: -------- .file "test.c" gcc_compiled.: .text .align 2 .globl _zork _zork: pushl %ebp movl %esp,%ebp /APP movl 8(%ebp),%ecx xchgl %ecx,_freelist movl 8(%ebp),(%ecx) /NO_APP xorl %eax,%eax jmp L1 L1: leave ret .comm _freelist,8 * Change "*&" to "" -------- * compile: -------- gcc -Wall -S -c test.c test.c: In function zork: test.c:16: inconsistent operand constraints in an `asm' *** Error code 1 `all' not remade because of errors * Change "freelist.tail" to "freelist" -------- * compile: -------- gcc -Wall -S -c test.c * test.s: -------- <<the same as *&freelist.tail>> I sent this sample to wilson@ucbarpa.berkeley.edu who writes back with a quick patch that will stop the error message but does not solve the problem. His message follows: Date: Fri, 14 Jul 89 13:41:43 -0700 From: wilson@ucbarpa.Berkeley.EDU (James E. Wilson) Message-Id: <8907142041.AA01281@ucbarpa.Berkeley.EDU> To: pardo@june.cs.washington.edu Subject: Re: More `asm' questions... [...] The following patch will get rid of the error message, but it is not complete, and possibly not even correct. Bit-fields will still generate an error, and I didn't even bother to test unions. It looks like the real bug is buried somewhere deep inside of the reload code (which I am not very familiar with). [...] *** stmt.c.old Fri Jul 14 12:48:52 1989 --- stmt.c Fri Jul 14 12:49:01 1989 *************** *** 783,789 **** if (TREE_CODE (val) != VAR_DECL && TREE_CODE (val) != PARM_DECL ! && TREE_CODE (val) != INDIRECT_REF) { rtx reg = gen_reg_rtx (TYPE_MODE (TREE_TYPE (val))); /* `build' isn't safe; it really expects args to be trees. */ --- 783,790 ---- if (TREE_CODE (val) != VAR_DECL && TREE_CODE (val) != PARM_DECL ! && TREE_CODE (val) != INDIRECT_REF ! && TREE_CODE (val) != COMPONENT_REF) { rtx reg = gen_reg_rtx (TYPE_MODE (TREE_TYPE (val))); /* `build' isn't safe; it really expects args to be trees. */