[LLVMbugs] [Bug 5169] New: stack alignment?
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Mon Oct 12 10:42:06 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=5169
Summary: stack alignment?
Product: libraries
Version: trunk
Platform: PC
OS/Version: FreeBSD
Status: NEW
Severity: normal
Priority: P2
Component: Backend: X86
AssignedTo: unassignedbugs at nondot.org
ReportedBy: rdivacky at freebsd.org
CC: llvmbugs at cs.uiuc.edu
witten ~# cat argc.c
#include <stdio.h>
int
main()
{
char *arr[] = {"a", "b", "c", "d"};
char *a = *arr+1;
int argc;
char **argv;
char **env;
__asm__("and $0xfffffff0,%esp");
argv = &a;
argc = *(long *)(void *)(argv - 1);
printf("I: %i\n", argc);
}
witten ~# gcc argc.c &&./a.out
I: 0
witten ~# clang argc.c && ./a.out
I: 672454409
Segmentation fault (core dumped)
when I comment out the __asm__("and $0xfffffff0,%esp"); the segfault is gone
but the printed value I is still wrong...
I dont know if this is llvm only specific or clang plays a role here.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list