Files
42-LibUnit/tests/libunit/04_sigbus.c
Erwann Lagouche 677028dcbb Prettier output and some fixes (#4)
* feat: tab results

* feat: more colors

* style: norm

* fix: patch a spacing bug

* fix: patch a small issue

* fix: patch some leaks

* style: norm
2026-01-25 18:20:20 +01:00

26 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 04_sigbus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/25 15:22:52 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int test_sigbus(void)
{
char *cptr;
int *iptr;
__asm__("pushf\norl $0x40000,(%rsp)\npopf");
cptr = malloc(sizeof(int) + 1);
iptr = (int *)++cptr;
*iptr = 42;
return (1);
}