This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/32603] New: Sibcall optimization fails to detect non-overlapping arguments
- From: "jconner at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jul 2007 23:27:13 -0000
- Subject: [Bug middle-end/32603] New: Sibcall optimization fails to detect non-overlapping arguments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code, compiled for arm-none-elf at -O2:
~~~~~~~~~~
#define noinline __attribute__((noinline))
typedef struct {
int data[4];
} arr16_t;
int result = 0;
void noinline func2 (int i, int j, arr16_t arr)
{
result = (arr.data[0] != 1
|| arr.data[1] != 2
|| arr.data[2] != 3
|| arr.data[3] != 4);
}
void func1 (int i, int j, int k, int l, int m, int n, arr16_t a)
{
func2(i, j, a);
}
int main(int argc, const char *argv[])
{
arr16_t arr = {{1, 2, 3, 4}};
func1(0, 0, 0, 0, 0, 0, arr);
return result;
}
~~~~~~~~~~
The call to func2 should be optimized into a sibcall, however store_one_arg()
is preventing it because it incorrectly identifies the arr16_t coming into
func1 as overlapping on the stack where it needs to put the outgoing arr16_t
for the call to func2. In fact, the incoming arg only uses [SP,SP+7] (the
other two words are passed in registers) and the outgoing arg uses
[SP+8,SP+23].
--
Summary: Sibcall optimization fails to detect non-overlapping
arguments
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jconner at apple dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32603