This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11190] New: ICE in output_operand (wrong address) with static and -fPIC
- From: "eager at mvista dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jun 2003 23:48:58 -0000
- Subject: [Bug c++/11190] New: ICE in output_operand (wrong address) with static and -fPIC
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11190
Summary: ICE in output_operand (wrong address) with static and -
fPIC
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: eager@mvista.com
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-hardhat-linux
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.
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;
}