xref: /openbmc/qemu/tests/tcg/multiarch/segfault.c (revision bbc0543b)
1*bbc0543bSGustavo Romero #include <stdio.h>
2*bbc0543bSGustavo Romero #include <string.h>
3*bbc0543bSGustavo Romero 
4*bbc0543bSGustavo Romero /* Cause a segfault for testing purposes. */
5*bbc0543bSGustavo Romero 
main(int argc,char * argv[])6*bbc0543bSGustavo Romero int main(int argc, char *argv[])
7*bbc0543bSGustavo Romero {
8*bbc0543bSGustavo Romero     int *ptr = (void *)0xdeadbeef;
9*bbc0543bSGustavo Romero 
10*bbc0543bSGustavo Romero     if (argc == 2 && strcmp(argv[1], "-s") == 0) {
11*bbc0543bSGustavo Romero         /* Cause segfault. */
12*bbc0543bSGustavo Romero         printf("%d\n", *ptr);
13*bbc0543bSGustavo Romero     }
14*bbc0543bSGustavo Romero }
15