-
-
Save jedisct1/6787e095ade93703a7f2fde112586102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test case for Xcode 11 broken stack alignment | |
// See https://forums.developer.apple.com/thread/121887 | |
// Compile with cc -mavx -O2 a.c | |
#include <fcntl.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
typedef struct { | |
char d[16]; | |
void *e; | |
struct { | |
char b[5536]; | |
} f; | |
} i; | |
void g(void) { | |
struct addrinfo hints, *k; | |
memset(&hints, 0, sizeof hints); | |
getaddrinfo(NULL, NULL, &hints, &k); | |
} | |
int main(void) { | |
puts("Hello world"); | |
fflush(stdout); | |
close(open("/dev/null", O_RDONLY)); | |
i context; | |
context.e = open; | |
printf("%p\n", context.d); | |
g(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment