Code-Golf: What is the shortest program that compiles and crashes?

Viewed 11924

This is a little bit of fun. Can you devise the shortest program which compiles but does nothing but immediately crash when executed? Wherefore by "crash" we mean that the program stops with an error condition (a core dump for example).

Is there a language that crashes faster (7 chars) than C using a gcc compiler? [I leave this answer for somebody to find.]

(It should be allowable to use compiler flags. Otherwise 7 wouldn't work nowadays, compiler checks became much better.)

[evaluation of results] I am unable to mark a single answer because there are multiple correct ones for multiple languages. It would not be fair to disqualify one answer for another. Please use votes for choosing best answers.

35 Answers

PostScript, 1 character

Like GolfScript:

*

Syntactically legal, but crashes during runtime because the token * is not defined (different reason than why GolfScript crashes).

0 Bytes

Using A86, you can have a zero sized source file!

Using the DOS command prompt:

> copy con crash.asm
[ctrl-z]
1 file(s) copied
> dir *.asm
11/12/2009  13:59                 0 crash.asm
> a86 crash.asm
A86 macro assembler, V4.05 Copyright 2000 Eric Isaacson
Source:
crash.asm
Object: crash.COM
Symbols: crash.SYM
> dir *.com
11/12/2009  13:59                 0 CRASH.COM
> c.com

Groovy 3 characters

1/0

Produces

java.lang.ArithmeticException: / by zero

Related