Bug #1161: Build Assertion Failure with VC+++ - Unitialized variable in rb_define_hooked_variable
http://redmine.ruby-lang.org/issues/show/1161

Author: Charlie Savage
Status: Open, Priority: Normal
Category: core
ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32_90]

Build ruby 1.9.1 with VC 2008 using the following flags:

RUNTIMEFLAG = -MDd
OPTFLAGS = -Od -RTC1
LDFLAGS = -link -INCREMENTAL:NO -DEBUG -OPT:REF -OPT:ICF

Failure occurs when running miniruby.exe for the first time:

Run-Time Check Failure #3 - The variable 'tmp' is being used without being initialized.

This patch fixes the problem:

--- variable.c	2009-02-14 14:18:26 -0700
+++ variable.old.c	2009-02-14 14:16:05 -0700
@@ -484,8 +484,7 @@
     gvar->setter = setter?(gvar_setter_t *)setter:var_setter;
     gvar->marker = var_marker;
 
-    if (var)
-      RB_GC_GUARD(tmp);
+    RB_GC_GUARD(tmp);
 }
 
 void


----------------------------------------
http://redmine.ruby-lang.org