136
\$\begingroup\$

Challenge

Write the shortest program that, when compiled or executed, produces a fatal error message smaller than the program itself. The error message may not be generated by the program itself, such as Python's raise. A valid answer must include both the code and the error message. Shortest valid answer wins.

No error message does not count as an error message.

Example (Lua)

Code (46 bytes):

[
--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Error (45 bytes):

[string "[..."]:1: unexpected symbol near '['
\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Dennis Jul 28 '17 at 16:18
  • 1
    \$\begingroup\$ @Dennis I guess that's one way of solving the "OP doesn't edit clarifications into question" problem. \$\endgroup\$ – Ørjan Johansen Jul 29 '17 at 23:52
  • 1
    \$\begingroup\$ Thanks for accepting my answer, which got the most votes; however, this was tagged code-golf, so you should accept this answer, which is the shortest. \$\endgroup\$ – MD XF Nov 24 '17 at 21:38
  • \$\begingroup\$ @smartpeople is this: "__main__.CodeException: Raised an &rror." my error or is this:"Raised an &rror." \$\endgroup\$ – FantaC Dec 25 '17 at 17:13
  • \$\begingroup\$ TrumpScript running in China? \$\endgroup\$ – Stan Strum Jan 30 '18 at 6:34

103 Answers 103

58
\$\begingroup\$

ed, 3 bytes

Note: Most of the answers here are ignoring the trailing newline printed as part of the error message in their count. But I don’t see anything in the question to justify ignoring it, and the author commented that the newline should be included. So unless the question is changed, I’m going to include it.

Code (with trailing newline):

??

Error (with trailing newline):

?

\$\endgroup\$
  • 19
    \$\begingroup\$ Actually, this is impossible to beat. :P \$\endgroup\$ – totallyhuman Jul 21 '17 at 20:21
  • 1
    \$\begingroup\$ Can ed do addition and primality testing? Or is that not required for this type of challenge? \$\endgroup\$ – Stephen Jul 21 '17 at 22:34
  • 4
    \$\begingroup\$ @StepHen Yes, it can do addition and primality testing in unary via the usual regex-with-backreferences trick. \$\endgroup\$ – Anders Kaseorg Jul 22 '17 at 0:57
  • 1
    \$\begingroup\$ Very clever, but '?' isn't fatal. \$\endgroup\$ – Mark Plotnick Jul 27 '17 at 11:50
  • 2
    \$\begingroup\$ As pointed out in a flag, the error is fatal if the code isn't read from a terminal. Try it online! \$\endgroup\$ – Dennis Jul 4 '18 at 14:12
59
\$\begingroup\$

C (modern Linux), 19 bytes

Would've done my famous segfault but totallyhuman stole it.

main(){longjmp(0);}

Output (18 bytes):

Segmentation fault
\$\endgroup\$
  • \$\begingroup\$ You currently have a higher score than me so... Win-win? \$\endgroup\$ – totallyhuman Jul 21 '17 at 20:23
  • 1
    \$\begingroup\$ Let us continue this discussion in chat. \$\endgroup\$ – Dennis Jul 21 '17 at 21:48
  • \$\begingroup\$ Are there no other locale with a shorter version (So that you could then use main(){main();})? \$\endgroup\$ – 12431234123412341234123 Jul 27 '17 at 13:10
  • \$\begingroup\$ @12431234123412341234123 Not that I know of. Also, main(){main();} is not guaranteed to seg-fault. \$\endgroup\$ – MD XF Jul 30 '17 at 20:51
  • 1
    \$\begingroup\$ @MDXF There is no guarantee (and with optimization enabled in gcc or clang, it end up in a endless loop or ignore the call). But on Code Golf we need a working implementation not a guarantee. \$\endgroup\$ – 12431234123412341234123 Jul 31 '17 at 9:08
48
\$\begingroup\$

Python 2, 35 bytes

import sys;sys.tracebacklimit=000;a

Gives error:

NameError: name 'a' is not defined
\$\endgroup\$
  • 14
    \$\begingroup\$ modifying the traceback limit... nice one \$\endgroup\$ – HyperNeutrino Jul 21 '17 at 19:44
  • 1
    \$\begingroup\$ This is clever! \$\endgroup\$ – Skyler Jul 24 '17 at 19:37
34
\$\begingroup\$

JavaScript (Firefox), 31 bytes

# This is a comment, right? ...

Throws this error:

SyntaxError: illegal character

Tested in the console of Firefox 54.0.1 on Windows 7.

\$\endgroup\$
26
\$\begingroup\$

Python 2, 87 79 bytes

-8 bytes thanks to Zacharý and Erik the Outgolfer.

from __future__ import braces
#i am most surely seriously actually totallyhuman

Try it online!

Error message, 78 bytes:

Assuming the code is stored in a file named a.

  File "a", line 1
    from __future__ import braces
SyntaxError: not a chance

This is actually a nice little Easter egg in Python. :D

\$\endgroup\$
  • 1
    \$\begingroup\$ You can assume a one-char file name! \$\endgroup\$ – Zacharý Jul 21 '17 at 19:28
  • 1
    \$\begingroup\$ Assuming a 1-char file name, you can golf to this. \$\endgroup\$ – Erik the Outgolfer Jul 21 '17 at 19:36
  • \$\begingroup\$ Heh, nice. - - - \$\endgroup\$ – totallyhuman Jul 21 '17 at 19:40
  • 1
    \$\begingroup\$ But the error message has to be smaller than the program itself... \$\endgroup\$ – Leaky Nun Jul 21 '17 at 20:06
  • 1
    \$\begingroup\$ If you use IDLE you can get \s\sFile "<stdin>", line 1\nSyntaxError: not a chance which is only 50 bytes [\s is a space and \n is a newline], so you can get a 51 byte program.. \$\endgroup\$ – boboquack Jul 26 '17 at 8:39
20
\$\begingroup\$

Haskell, 13 bytes

main = (main)

Save as t.hs or another one-character name, compile with ghc, and run. Error message (with trailing newline):

t: <<loop>>
\$\endgroup\$
19
\$\begingroup\$

Taxi, 38 21 bytes

Switch to plan "abc".

Produces:

error: no such label

Try it online!

-17 bytes thanks to Engineer Toast

Tries to switch to "abc", which does not exist. You would have [abc] somewhere.

\$\endgroup\$
  • 4
    \$\begingroup\$ You can get down to 21 bytes with Switch to plan "abc". producing error: no such label. This might be one of the few code-golf challenges where Taxi beats some traditional languages. \$\endgroup\$ – Engineer Toast Jul 21 '17 at 20:00
  • \$\begingroup\$ @EngineerToast thanks, didn't think of that one. \$\endgroup\$ – Stephen Jul 21 '17 at 20:03
18
\$\begingroup\$

><>, 26 bytes

>>>>>>>>>>>>>>>>>>>>>>>>>:

Try it online!

Every error message in Fish is something smells fishy..., so this just moves the pointer right enough times to be longer than that and attempts to duplicate the top of the stack, which is empty at the time.

\$\endgroup\$
  • 2
    \$\begingroup\$ I like it, and it's definately the most fishy of all solutions :-) \$\endgroup\$ – Xan-Kun Clark-Davis Jul 25 '17 at 16:58
  • \$\begingroup\$ @Xan-KunClark-Davis sigh you had to... :P \$\endgroup\$ – HyperNeutrino Jul 25 '17 at 17:26
18
\$\begingroup\$

JavaScript (Firefox), 21 bytes

(a=null)=>a.charAt(1)

Error (20 bytes): TypeError: a is null

\$\endgroup\$
  • 2
    \$\begingroup\$ D'oh! I knew there was a shorter one... \$\endgroup\$ – ETHproductions Jul 21 '17 at 20:49
  • \$\begingroup\$ I had the same idea, came up with a=null;a.x01234567890 Same amount of bytes \$\endgroup\$ – RuteNL Nov 9 '17 at 13:43
16
\$\begingroup\$

System V shell, 25 bytes

mount /dev/hda1 /mnt/hda1

Error message (23 bytes):

mount: not a typewriter

"Not a typewriter" or ENOTTY is an error code defined in errno.h on Unix systems. This is used to indicate that an invalid ioctl (input/output control) number was specified in an ioctl system call. On my system, in /usr/include/asm-generic/errno-base.h, I can find this line:

#define ENOTTY          25      /* Not a typewriter */

In Version 6 UNIX and older, I/O was limited to serial-connected terminal devices, such as a teletype (TTY). These were usually managed through the gtty and stty system calls. If one were to try to use either of these system calls on a non-terminal device, ENOTTY was generated.

Nowadays, there is naturally no need to use a teletype. When gtty and stty were replaced with ioctl, ENOTTY was kept. Some systems still display this message; but most say "inappropriate ioctl for device" instead.

\$\endgroup\$
  • \$\begingroup\$ Please explain... \$\endgroup\$ – Mega Man Jul 22 '17 at 17:05
  • \$\begingroup\$ @MegaMan Updated with explanation. \$\endgroup\$ – MD XF Jul 22 '17 at 17:46
  • 1
    \$\begingroup\$ Upvote for actually enlightening explanation. \$\endgroup\$ – Xan-Kun Clark-Davis Jul 25 '17 at 17:00
11
\$\begingroup\$

QBasic, 11 bytes

There are two solutions of 11 bytes in QBasic, one of which might be golfed further. The shortest error message QBasic has is overflow, and can be triggered as such:

i%=i%+32677

This throws overflow because the max for an integer (i%) is 32676. I couldn't get the 32677 golfed without QBasic auto-casting this to long...

Another error, at 11 bytes, would be out of data. QBasic has DATA statements that store data in the program, which can later be accessed by READ statements. Issuing more READs than DATAs causes the error:

READ a$ '--

Note that the statement is padded with a comment to get it up to the length of the error message. Yes, I have an error message with a shorter program, and a program with a shorter error message ...

\$\endgroup\$
11
\$\begingroup\$

C (Modern Linux), 19 bytes

I suggested this in chat, but nobody took the oppurtunity. :P Credit to MD XF's hilarious answer.

main(){puts('s');;}

Error message, 18 bytes

Segmentation fault
\$\endgroup\$
  • 1
    \$\begingroup\$ But the error message has to be smaller than the program itself... \$\endgroup\$ – Leaky Nun Jul 21 '17 at 20:08
  • \$\begingroup\$ Byte counts were screwed up, my bad. \$\endgroup\$ – totallyhuman Jul 21 '17 at 20:16
  • 9
    \$\begingroup\$ This is a generic message printed by the shell when subprocess terminates with exit code 139. The C program itself produces no error message at all. \$\endgroup\$ – Dennis Jul 21 '17 at 21:41
  • 7
    \$\begingroup\$ @Dennis Exit code 139 is actually another lie made up by the shell. Unix distinguishes between signal 11 (W_EXITCODE(0, 11) == 11) and exit code 139 (W_EXITCODE(139, 9) == 139 << 8). Shells set $? non-surjectively to WIFEXITED(wstatus) ? WEXITSTATUS(wstatus) : WTERMSIG(wstatus) + 128, but most languages expose the difference. \$\endgroup\$ – Anders Kaseorg Jul 22 '17 at 18:05
  • 2
    \$\begingroup\$ @Anders Is WIFEXITED(wstatus) equivalent to DIVORCE(alimony) by any chance? \$\endgroup\$ – Janus Bahs Jacquet Jul 27 '17 at 10:50
11
\$\begingroup\$

Javascript (V8), 24 bytes

decodeURIComponent('%');

Error, 23 bytes:

URIError: URI malformed

Tested on Nodejs v6.11.0 and Google Chrome v59.0.3071.115.

Try it online!

Note that TIO expands the error message.

\$\endgroup\$
  • 5
    \$\begingroup\$ Welcome to PPCG! \$\endgroup\$ – Stephen Jul 24 '17 at 13:02
11
\$\begingroup\$

TrumpScript, 30 bytes

We love NATO!
America is great

Error message:

Trump doesn't want to hear it
\$\endgroup\$
  • 3
    \$\begingroup\$ P.S. Error codes are in constants.py \$\endgroup\$ – Timtech Jul 26 '17 at 12:52
10
\$\begingroup\$

PowerShell, 215 189 bytes

[]
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

Try it online!

So, PowerShell has ... verbose ... error messages. Additionally, most non-syntax error messages are Runtime Exceptions, meaning that they're non-fatal, which reduces this problem to needing to find a short parsing error.

I think this is one of the shortest, if not the shortest, @TessellatingHeckler has demonstrated this is the shortest parsing error, and it still weighs in at 188 bytes just for the error message. So we basically need to append enough 1s to reach 189 bytes of "code."

Running this locally on c:\a.ps1 for example, will cut down on the byte count by a handful as it's just a shorter file path, but then it's not available on TIO.

Produces error:

At /tmp/home/.code.tio.ps1:1 char:2
+ []
+  ~
Missing type name after '['.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : MissingTypename
\$\endgroup\$
  • \$\begingroup\$ I was asked three questions in the comments, one of which you asked, but the two you didn't ask both applied to your answer, and not yours. \$\endgroup\$ – user72528 Jul 21 '17 at 19:37
  • \$\begingroup\$ @user72528 Yeah, I found that amusing as well. \$\endgroup\$ – AdmBorkBork Jul 21 '17 at 19:38
  • \$\begingroup\$ You can use a one char file name! \$\endgroup\$ – Zacharý Jul 21 '17 at 19:54
  • 1
    \$\begingroup\$ @Zacharý I can, but then it's not reproducible on TIO due to how TIO handles the sandboxing. I prefer to keep it usable on TIO than to save a few bytes. \$\endgroup\$ – AdmBorkBork Jul 21 '17 at 20:00
  • 2
    \$\begingroup\$ What about [] which looks like a shorter error Missing type name after '[' and depending on exactly how you count could be around 190 - tio.run/##K8gvTy0qzkjNyfn/PzqWy3Dogv//AQ (taken from the parser strings here that looks like the shortest parser error to me ([xml](gc .\ParserStrings.resx)).root.data.value | sort { $_.length } -Desc). \$\endgroup\$ – TessellatingHeckler Jul 21 '17 at 21:34
9
\$\begingroup\$

Commodore 64 Basic, 15 bytes

?SYNTAX   ERROR

Produces

?SYNTAX  ERROR

(Note two spaces in the error message, where the program has three)

?SYNTAX ERROR is tied with ?VERIFY ERROR as the third-shortest error message that C64 Basic can produce, and the shortest that can be reliably triggered by code (the shortest message, BREAK IN 1, requires user interaction, while ?LOAD ERROR requires a defective tape or floppy disk, and ?VERIFY ERROR requires the presence of a floppy or tape containing a file that doesn't match the program in RAM).

\$\endgroup\$
  • 1
    \$\begingroup\$ Ha, didn't even see this when I posted mine. Always good to see another BASIC user... +1 \$\endgroup\$ – MD XF Jul 23 '17 at 0:51
8
\$\begingroup\$

R, 29 28 bytes

-1 byte thanks to JarkoDubbeldam

a #abcdefghijklmnopqrstuvwxy

Throws the error Error: object 'a' not foundwhich is 27 bytes.

Try it online!

\$\endgroup\$
  • 2
    \$\begingroup\$ a #abcdefghijklmnopqrstuvwxy's error Error: object 'a' not found is one byte shorter. \$\endgroup\$ – JAD Jul 23 '17 at 15:16
  • \$\begingroup\$ @JarkoDubbeldam thank you. \$\endgroup\$ – Giuseppe Jul 25 '17 at 17:45
7
\$\begingroup\$

Ruby (33 32 bytes)

32 bytes

&
#abcdefghijklmnopqrstuvwxyz12

Throws the error (assuming in a file named "a"):

31 bytes

a:1: syntax error, unexpected &

Edit: Shaved a byte off by using & instead of << thanks to Eric, who also came up with an even shorter Ruby solution: http://codegolf.stackexchange.com/a/135087/65905

\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to PPCG! \$\endgroup\$ – Martin Ender Jul 21 '17 at 19:56
  • \$\begingroup\$ @EricDuminil nice! I thought all the single character operators were quoted in the error message, but you're right: & isn't. Neat! Also, good find with the hex escape. I was struggling to find a shorter and non-stack-trace fatal error message other than a syntax error. \$\endgroup\$ – ameketa Jul 23 '17 at 19:53
  • \$\begingroup\$ @ameketa: I actually wrote a bruteforce program and tested every possible 1, 2 and 3-byte Ruby program :D Thanks for the link. \$\endgroup\$ – Eric Duminil Jul 23 '17 at 20:50
5
\$\begingroup\$

Brainf**k, 17 bytes, this interpreter

+++++++++++++++<<

Brainf**k is such a simple language that almost every interpreter has a different error message. This one uses Memory Error: -1 for when the pointer is moved to the left too much and you attempt another operation

\$\endgroup\$
  • \$\begingroup\$ I guess choosing an interpreter is as much a part of the challenge as choosing a language. \$\endgroup\$ – user72528 Jul 21 '17 at 19:18
  • \$\begingroup\$ @user72528 Well here, we define a language by its interpreter, so this challenge is a bit about choosing the interpreter with the shortest error messages :) \$\endgroup\$ – HyperNeutrino Jul 21 '17 at 19:21
  • 1
    \$\begingroup\$ Who beats brainfuck? Nobody? Alright. \$\endgroup\$ – Erik the Outgolfer Jul 21 '17 at 19:28
  • \$\begingroup\$ The unbeatable solution would a two byte solution which causes an error of 1 character. \$\endgroup\$ – Zacharý Jul 21 '17 at 19:30
  • \$\begingroup\$ @Zacharý Certainly lol \$\endgroup\$ – HyperNeutrino Jul 21 '17 at 19:44
5
\$\begingroup\$

Common Lisp, 20 bytes

(/ 1 0))))))))))))))

Try it online!

Error Message

/: division by zero
\$\endgroup\$
  • 11
    \$\begingroup\$ o_o unbalanced parentheses in Lisp ... you learn something new every day. \$\endgroup\$ – Zacharý Jul 21 '17 at 19:32
  • 1
    \$\begingroup\$ If you replace the 0 with 1, it will error on the parens but it doesn't get that far with 0. I just needed to add characters to be longer than the message \$\endgroup\$ – Cheldon Jul 21 '17 at 19:34
5
\$\begingroup\$

TryAPL, 11 bytes

Code (11):

'abcdefghij

Error (10):

open quote
\$\endgroup\$
5
\$\begingroup\$

Javascript(Firefox),29 27 bytes

new Date('-').toISOString()

throws RangeError: invalid date which is 24 bytes. Tested on Firefox 54.0.1 on Windows 10.

\$\endgroup\$
5
\$\begingroup\$

ZX Spectrum Basic, 9 bytes

RUN USR 8

produces:

Error message

Explanation:

I am (exceptionally) counting ASCII representation of the program for length purposes, including the end of line (it's not really important, since we could always pad a shorter program with spaces).

Usually, ZX Spectrum error messages are longer and more helpful than this - the ROM routine at 0x0008 expects error code following the machine code call to RST 8., and fetches some random (deterministic) byte from the ROM, which produces this nonsensical error message M. 5 is the error number, , is added by the error printing routine and 0:1 is the line:command position of the error.

\$\endgroup\$
  • \$\begingroup\$ Actually this is 9 bytes normally anyway, because the ZX Spectrum doesn't evaluate numbers at run time, so there are actually 6 hidden bytes which allow it to access the binary representation of 8 directly. \$\endgroup\$ – Neil Jul 23 '17 at 19:11
4
\$\begingroup\$

Aubergine, 53 bytes

0/0 Lots of wasted space. I don't know how Aubergine.

Outputs SyntaxError: Invalid instruction (0) at character 0.

Try it online!

\$\endgroup\$
4
\$\begingroup\$

Perl 5, 5 bytes

die$/

Outputs a newline, for one byte.

Try it online!

\$\endgroup\$
  • \$\begingroup\$ ._. Now ... if only perl errors on the empty file! \$\endgroup\$ – Zacharý Jul 22 '17 at 1:34
  • 4
    \$\begingroup\$ Wait, is this a violation of the "may not be generated by the program itself"? I didn't understand what that rule was saying. \$\endgroup\$ – aschepler Jul 22 '17 at 1:41
  • 1
    \$\begingroup\$ @Zacharý ... giving an error message with total length negative one? \$\endgroup\$ – aschepler Jul 22 '17 at 1:54
  • 1
    \$\begingroup\$ This might be invalid ... or not, depends on whether the OP meant the error or the error message \$\endgroup\$ – Zacharý Jul 22 '17 at 2:14
  • \$\begingroup\$ ^ clarification: whether a program errors directly or creates an error message directly \$\endgroup\$ – Zacharý Jul 23 '17 at 0:31
4
\$\begingroup\$

Perl 5, 11 bytes

Since I'm not clear on whether my other answer obeys the challenge rules, here's another alternative.

#line 0
die

Error output:

Died.

With an ending newline, for 6 bytes.

Try it online!

For some reason the Perl interpreter internal function Perl_mess_sv contains:

if (CopLINE(cop))
    Perl_sv_catpvf(aTHX_ sv, " at %s line %" IVdf,
                    OutCopFILE(cop), (IV)CopLINE(cop));

where CopLINE(cop) gets the current code context's line number. So if that line number happens to evaluate to zero, Perl skips adding the usual " at <filename> line <n>" to the error message.

\$\endgroup\$
  • 1
    \$\begingroup\$ It seems nor valid to me. IIRC die is for the program to exit. \$\endgroup\$ – sergiol Jul 22 '17 at 17:34
  • 1
    \$\begingroup\$ How is that any different than python raise? \$\endgroup\$ – Eric Duminil Jul 23 '17 at 12:09
  • \$\begingroup\$ Well, the OP might have been referring to either generating the error or the error message. I commented on which one he meant. \$\endgroup\$ – Zacharý Jul 23 '17 at 14:42
4
\$\begingroup\$

ArnoldC, 150 bytes

IT'S SHOWTIME
HEY CHRISTMAS TREE b
YOU SET US UP 0
GET TO THE CHOPPER b
HERE IS MY INVITATION b
HE HAD TO SPLIT 0
ENOUGH TALK
YOU HAVE BEEN TERMINATED

Try it online!

Error is 94 bytes (including trailing newline):

Exception in thread "main" java.lang.ArithmeticException: / by zero
    at code.main(Hello.java)

Preserved because I think this is more funny - spoiler: it was those dang teenage pranksters.

ArnoldC, 280 bytes

IT'S SHOWTIME
HEY CHRISTMAS TREE BRBDoorBetterNotBeThosePeskyTeenagePranksters
YOU SET US UP 0
GET YOUR ASS TO MARS BRBDoorBetterNotBeThosePeskyTeenagePranksters
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY
YOU HAVE BEEN TERMINATED

Pseudocode:

start program
new variable
set to 0
set new variable to output from function
call function
take input
end program

Try it online!

Generates a "no input" error. (Almost all other errors in ArnoldC include a large piece of boilerplate):

279 bytes (including trailing newline):

Exception in thread "main" java.util.NoSuchElementException
    at java.util.Scanner.throwFor(Scanner.java:862)
    at java.util.Scanner.next(Scanner.java:1485)
    at java.util.Scanner.nextInt(Scanner.java:2117)
    at java.util.Scanner.nextInt(Scanner.java:2076)
    at code.main(Hello.java)
\$\endgroup\$
4
\$\begingroup\$

TI-Basic, 9 bytes

Shortest error messages are 8 bytes each: ERR:DATE, ERR:MODE, ERR:STAT, and ERR:ZOOM. I didn't consider ERR:DATE because that doesn't work on models without an internal clock. Also, I didn't go for ERR:ZOOM because it seemed too hard to trigger.

Program (9 bytes):

Seq:DrawInv X:::::

Error message: ERR:MODE (8 bytes)

Program (9 bytes):

median({1},{0::

Error message: ERR:STAT (8 bytes)

\$\endgroup\$
3
\$\begingroup\$

Ruby, 25 bytes

That was a fun exercise, thanks! There's probably a way to get a shorter error message with a SegFault, but I couldn't find any.

/\x
# Invalid hexa regexp

Error message:

a:1: invalid hex escape

24 bytes, including a trailing newline.

Try it online!

Ruby, 26 bytes

Here's my previous answer:

08
# No 8 allowed in octal

Error message:

a:1: Invalid octal digit

25 bytes, including a trailing newline.

\$\endgroup\$
  • \$\begingroup\$ I think you should separate your answers. \$\endgroup\$ – Solomon Ucko Jul 24 '17 at 0:51
  • \$\begingroup\$ @SolomonUcko: Any reason why? There are many answers already. I just wanted to leave a trail of my previous answer. People usually just edit the byte count with <s>26</s> 25, but it's often for minor changes. \$\endgroup\$ – Eric Duminil Jul 24 '17 at 7:34
  • \$\begingroup\$ Actually, I'm not sure why I said that, so nevermind. \$\endgroup\$ – Solomon Ucko Jul 30 '17 at 14:00
3
\$\begingroup\$

C++ (on macOS High Sierra beta), 23 characters

int main(){*(int*)0=0;}

Output: (22 characters)

Segmentation fault: 11

I do not recall whether previous versions of macOS provide the more traditional Segmentation fault (core dumped) response but adding spaces to the code to pad that out is pretty trivial.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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