Write the shortest program which, when run with no arguments, stdin, or user input, triggers a core dump.

Your code must behave this way when run on some common out-of-the-box Linux distribution. Other than installing support for your target language, you may not reconfigure the system to make it more fragile than it is as provided.

25-byte C example: int main(){*((int*)0)=0;} on my Ubuntu outputs

Segmentation fault (core dumped)
  • 6
    \$\begingroup\$ related \$\endgroup\$
    – Arnauld
    Commented Dec 2, 2016 at 11:53
  • \$\begingroup\$ I'm posting here since I'm not sure if this is right, but is perl -ue '' a valid solution? (question intended for people knowing perl) \$\endgroup\$
    – Dada
    Commented Dec 2, 2016 at 12:40
  • \$\begingroup\$ @Dada, when running that I get Aborted (core dumped) instead of Segmentation fault (core dumped). \$\endgroup\$ Commented Dec 2, 2016 at 13:42
  • 1
    \$\begingroup\$ @redstarcoder It doesn't have to be a segfault, so that would work. \$\endgroup\$
    – mbomb007
    Commented Dec 2, 2016 at 14:37
  • \$\begingroup\$ We already have questions for the fastest way to create a SIGSEGV and the fastest way to create a SIGILL. Dumping core on Linux without a signal is likely to be very verbose compared to crashing in a way that creates a core file, so this question is basically "shortest way to cause a SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGBUS, SIGSYS, SIGTRAP, SIGXCPU, or SIGXFSZ". I think we'd be better off with those as separate questions, rather than having a combined question for any (especially as some of the existing SIGSEGV/SIGILL are very short). \$\endgroup\$
    – user62131
    Commented Dec 2, 2016 at 16:19

5 Answers 5


C, 5 bytes


Try it online!

Slightly longer, 7 bytes

  • \$\begingroup\$ Why did I get downvoted? This is my first post ever. \$\endgroup\$ Commented Dec 2, 2016 at 15:57
  • 1
    \$\begingroup\$ I can't guarantee this is what happened, but it's possible that your post was flagged as low-quality because it was short, and then the system itself casted a downvote because you edited. We really dislike this behavior, but it's something the system does that we can't change. \$\endgroup\$
    – DJMcMayhem
    Commented Dec 2, 2016 at 16:13
  • \$\begingroup\$ Welcome to Programming Puzzles & Code Golf! The downvote was cast automatically by the Community user when you edited your answer. I consider this a bug. \$\endgroup\$
    – Dennis
    Commented Dec 2, 2016 at 16:15
  • 1
    \$\begingroup\$ The "maximum golfed" answer counts as 9 bytes; it's 2 in the file itself, but has 7 bytes of penalties (Dm=main) because it requires an unusual compiler configuration (you'd write it as "2+7 = 9 bytes"). In general, trying to hide code in the compiler configuration or the program's filename is a cheap tactic, and the penalties are intended to prevent it improving your score except in cases where it's interesting. \$\endgroup\$
    – user62131
    Commented Dec 2, 2016 at 16:22
  • \$\begingroup\$ Well said! I will remove it. \$\endgroup\$ Commented Dec 5, 2016 at 11:04

Jelly, 2 bytes



A dyadic atom (here ×, but there are swathes of others) followed by the quick ß which instructs to call the same link (the whole line of code) with the same arity - calling it once more with any arity would also work, so, since it is the only line of code, ß could be replaced by any of ¢ÇçÑñ (last link as a nilad, last link as a monad, last link as a dyad, next link as a monad, or next link as a dyad).


NASM, 3 bytes


I guess it tries to jump to whatever is on the default stack and immediately segfaults :).

Built with: nasm -f elf64 golf.asm && ld golf.o -o golf


BASH, 10 bytes

kill -6 $$

kill -6 precisely does this


C, 14 bytes


It's that simple 8-)


Not the answer you're looking for? Browse other questions tagged or ask your own question.