Bug 206110

Summary: lang/ruby22: fix setjmp clobbered variables (using clang 3.8.0 and optimizing for 'high' CPUs)
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: freebsd-ruby (Nobody) <ruby>
Status: Closed FIXED    
Severity: Affects Some People CC: swills
Priority: --- Flags: bugzilla: maintainer-feedback? (ruby)
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206074
Attachments:
Description Flags
Mark several variables volatile so they won't have undefined state after setjmp() none

Description Dimitry Andric freebsd_committer freebsd_triage 2016-01-10 18:38:20 UTC
Created attachment 165370 [details]
Mark several variables volatile so they won't have undefined state after setjmp()

During my preparations for bug 206074 (exp-run for clang 3.8.0), I noticed that lang/ruby22 would sometimes crash during the build.  Specifically, on i386, with CPUTYPE=ivybridge, you would get segfaults in miniruby.

It turns out these are because there are several places in ruby where setjmp() is used, and where not all variables accessed after setjmp() are marked volatile.  This can cause them to have undefined state.

Fix this by marking several variables in different functions volatile.

These patches were obtained from NetBSD pkgsrc, thanks to Jörg Sonnenberger for the hint.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-12-07 12:48:01 UTC
A commit references this bug:

Author: swills
Date: Wed Dec  7 12:47:31 UTC 2016
New revision: 428055
URL: https://svnweb.freebsd.org/changeset/ports/428055

Log:
  lang/ruby22: fix setjmp clobbered variables

  PR:		206110
  Submitted by:	dim

Changes:
  head/Mk/bsd.ruby.mk
  head/lang/ruby22/files/patch-eval.c
  head/lang/ruby22/files/patch-eval_error.c
  head/lang/ruby22/files/patch-thread.c
  head/lang/ruby22/files/patch-vm_eval.c
  head/lang/ruby22/files/patch-vm_trace.c
Comment 2 Steve Wills freebsd_committer freebsd_triage 2016-12-07 13:33:28 UTC
Committed, thanks. Could you try to submit this upstream?