ponyc: Compiler crash in ponyc 0.28.0 with LLVM 7+ for certain projects

Originally reported while working on #3138.

A few Pony projects I tested crash ponyc 0.28.0 on the Writing ./foo.o step when running in Docker. For example, pony-kafka or one of my personal projects. Some projects (for example, pony-stable) compile just fine.

For example, with pony-kafka I get the following logs and the error code 139:

$ docker run -v /tmp/pony-kafka:/src/main ponylang/ponyc:0.28.0 ponyc examples/simple  
Building builtin -> /usr/local/lib/pony/0.28.0/packages/builtin
Building examples/simple -> /src/main/examples/simple
Building net -> /usr/local/lib/pony/0.28.0/packages/net
Building collections -> /usr/local/lib/pony/0.28.0/packages/collections
Building ponytest -> /usr/local/lib/pony/0.28.0/packages/ponytest
Building time -> /usr/local/lib/pony/0.28.0/packages/time
Building random -> /usr/local/lib/pony/0.28.0/packages/random
Building ../../pony-kafka/customlogger -> /src/main/pony-kafka/customlogger
Building ../../pony-kafka -> /src/main/pony-kafka
Building custombuffered -> /src/main/pony-kafka/custombuffered
Building codecs -> /src/main/pony-kafka/custombuffered/codecs
Building ../../utils/bool_converter -> /src/main/pony-kafka/utils/bool_converter
Building itertools -> /usr/local/lib/pony/0.28.0/packages/itertools
Building customnet -> /src/main/pony-kafka/customnet
Building fsm -> /src/main/pony-kafka/fsm
Building options -> /usr/local/lib/pony/0.28.0/packages/options
Building compression -> /src/main/pony-kafka/compression
Generating
 Reachability
 Selector painting
 Data prototypes
 Data types
 Function prototypes
 Functions
 Descriptors
Optimising
Writing ./simple.o
Stack dump:
0.	Running pass 'Function Pass Manager' on module 'simple'.
1.	Running pass 'Greedy Register Allocator' on function '@3359'

This doesn’t happen for the 0.27.0 Docker tag, when using the distribution release of Pony outside of the container, or when using ponyc --debug. For these cases, it will compile (or just fail normally with error code 255 when trying to link the required libraries).

I have yet to test the distribution release of Pony inside the container.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 61 (55 by maintainers)

Commits related to this issue

Most upvoted comments

Update: the fix has been merged into the 9.0.1 branch. I’m still not sure the timeline of the 9.0.1 release.

FYI: Good news my patch regarding MemCpyOpt fix just got accepted. It will be in the next LLVM release.

I think it’s a good time to wrap up this issue: My patch works correctly on the example program here and passes all the existing tests. The biggest problem now is that since this fix is on the LLVM side, how do we propagate it back to ponyc? Currently we don’t use custom-built LLVM, so should we just disable MemCpyOpt pass for now until the patch is landed in upstream LLVM?