Skip to content

Instantly share code, notes, and snippets.

@tj800x
Last active July 7, 2017 19:51
Show Gist options
  • Save tj800x/012f7403b95e2d9d2d22feba89f92c02 to your computer and use it in GitHub Desktop.
Save tj800x/012f7403b95e2d9d2d22feba89f92c02 to your computer and use it in GitHub Desktop.
FormatStringSizeCrash on ponyc 0.14.0; Apple LLVM version 8.1.0 (clang-802.0.42)
use "format"
actor Main
new create(env:Env) =>
let n: U128 = 42
env.out.print("Regular output. n="+n.string())
env.out.print(Format.int[U128](where x=n, fmt=FormatBinaryBare, prefix=PrefixDefault, prec=1, width=20, align=AlignRight,fill='0'))
env.out.print("Before runtime fault. Segment fault 11 on Mac OS X.")
env.out.print(Format.int[U128](where x=n, fmt=FormatBinaryBare, prefix=PrefixDefault, prec=1, width=-1, align=AlignRight,fill='0'))
env.out.print("This is never executed because the above line crashes at runtime.")
"""
Building builtin -> /usr/local/Cellar/ponyc/0.14.0/packages/builtin
Building . -> /Users/thomasjohnson/Projects/pony/FormatStringSizeCrash
Building format -> /usr/local/Cellar/ponyc/0.14.0/packages/format
Building collections -> /usr/local/Cellar/ponyc/0.14.0/packages/collections
Building ponytest -> /usr/local/Cellar/ponyc/0.14.0/packages/ponytest
Building time -> /usr/local/Cellar/ponyc/0.14.0/packages/time
Generating
Reachability
Selector painting
Data prototypes
Data types
Function prototypes
Functions
Descriptors
Optimising
Writing ./FormatStringSizeCrash.o
Linking ./FormatStringSizeCrash
Regular output. n=42
00000000000000101010
Before runtime fault. Segment fault 11 on Mac OS X.
/bin/bash: line 1: 31076 Segmentation fault: 11 ./FormatStringSizeCrash
[Finished in 4.0s with exit code 139]
[shell_cmd: ponyc && ./FormatStringSizeCrash]
[dir: /Users/thomasjohnson/Projects/pony/FormatStringSizeCrash]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
ponyc --version
0.14.0 [release]
compiled with: llvm 3.9.1 -- Apple LLVM version 8.1.0 (clang-802.0.42)
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment