This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/34982] [4.3 regression] calling a function with undefined parameters causes segmentation fault at -O1 or higher
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jan 2008 18:50:39 -0000
- Subject: [Bug target/34982] [4.3 regression] calling a function with undefined parameters causes segmentation fault at -O1 or higher
- References: <bug-34982-5606@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from rguenth at gcc dot gnu dot org 2008-01-26 18:50 -------
We seem to use local calling conventions for emitting the body of something,
but
at the call site we pass arguments via the stack.
P1 until we know more about this.
Reduced testcase:
extern void abort (void);
static void something();
int main()
{
something(-1);
}
static void something(int i)
{
if (i != -1)
abort ();
}
The asm shows it:
something:
subl $12, %esp
cmpl $-1, %eax
je .L3
call abort
.L3:
addl $12, %esp
ret
but:
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ecx
subl $8, %esp
movl $-1, (%esp)
call something
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|c |target
Ever Confirmed|0 |1
Keywords| |wrong-code
Priority|P3 |P1
Last reconfirmed|0000-00-00 00:00:00 |2008-01-26 18:50:39
date| |
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34982