i386-G++ ICE in output_operand with static and -fPIC

Michael Eager eager@mvista.com
Fri Jun 13 22:18:00 GMT 2003


I compile the attached test case with G++ 3.2.2 specifying -fPIC:

  g++ -fPIC x.cpp -o x

the following error is generated:

  x.cpp: In function `int ListNextX()':
  x.cpp:19: output_operand: Wrong address expression or operand constraint

The error appears to occur when code for the structure assignment
on line 16 is being generated.  The messages is actually generated by 
print_operand_address() in i386.c.  The rtx node that it fails on is 

(plus:SI (mem:SI (plus:SI (reg/f:SI 6 ebp)
            (const_int -1344 [0xfffffac0])) [0 S4 A8])
    (const:SI (unspec:SI[ 
                (symbol_ref/v:SI ("AppList"))
            ]  7)))

If I remove the "static" storage attribute from AppList, the error 
disappears.  The corresponding rtx node is a bit different:

(mem/u:SI (plus:SI (reg:SI 3 ebx)
        (const:SI (unspec:SI[ 
                    (symbol_ref:SI ("AppList"))
                ]  6))) [0 S4 A8])

If I read the code correctly, by the time output_operand is called,
the expectation is that the rtx can be assembled with one instruction.
The failing node can't be output as a single x86 instruction, it looks
like it should be converted into two (or more) instructions.

Can someone help me out here?  Where should I be looking?
Please CC me at this email address.


Test case (x.cpp):
typedef struct {
   int                  Id;
   char Errors[128][10];
} ListElem_T;


//static
ListElem_T   AppList[100];

int
ListNextX()
{
   unsigned int i;
   ListElem_T x;

       x = AppList[i]; /* Structure Assignment */

   return -1;
}


--
Michael Eager     eager@mvista.com	408-328-8426	
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA  94085



More information about the Gcc mailing list