diff --git a/cint/inc/Api.h b/cint/inc/Api.h
index 574403ea9867c9dbd553ff946634f85fbe3752d7..19ff9c7980634dfa33a3d4f54e41b87835874f61 100644
--- a/cint/inc/Api.h
+++ b/cint/inc/Api.h
@@ -196,6 +196,7 @@ using namespace Cint;
 #pragma link off class $G__linked_taginfo;
 #pragma link off class G__includepath;
 #pragma link C++ namespace Cint;
+#pragma link C++ nestedclasses;
 #pragma link off namespace Cint::Internal;
 #endif
 
diff --git a/cint/inc/G__ci.h b/cint/inc/G__ci.h
index 99cda481c6c698eeae26b31c345b9fbab34f736f..507d340efb7f46d453f2326d417b0f39234c4fa8 100644
--- a/cint/inc/G__ci.h
+++ b/cint/inc/G__ci.h
@@ -20,10 +20,10 @@
 #define G__CINT_VER6  1
 #endif
 
-#define G__CINTVERSION_V6      60010024
-#define G__CINTVERSIONSTR_V6  "6.1.25, Sept 10, 2007"
-#define G__CINTVERSION_V5      50160024
-#define G__CINTVERSIONSTR_V5  "5.16.25, Sept 10, 2007"
+#define G__CINTVERSION_V6      60010026
+#define G__CINTVERSIONSTR_V6  "6.1.26, Oct 11, 2007"
+#define G__CINTVERSION_V5      50160026
+#define G__CINTVERSIONSTR_V5  "5.16.26, Oct 11, 2007"
 
 #define G__ALWAYS
 /* #define G__NEVER */
@@ -398,7 +398,7 @@ typedef unsigned long long G__uint64;
 #if defined(G__WIN32) && !defined(G__STD_EXCEPTION)
 #define G__STD_EXCEPTION
 #endif
-#if defined(G__STD_EXCEPTION) && !defined(G__EXCEPTIONWRAPPER)
+#if defined(G__STD_EXCEPTION) && !defined(G__EXCEPTIONWRAPPER) && !defined(G__APIIF)
 #define G__EXCEPTIONWRAPPER
 #endif
 
diff --git a/cint/include/ReadF.C b/cint/include/ReadF.C
index 14d496e25bac91a9925eb83054bd50d81b1fc65e..88ac76e92af3f948b9b99a632a5c9acc591143a1 100644
--- a/cint/include/ReadF.C
+++ b/cint/include/ReadF.C
@@ -1,10 +1,3 @@
-/* -*- C++ -*- */
-/*************************************************************************
- * Copyright(c) 1995~2005  Masaharu Goto (cint@pcroot.cern.ch)
- *
- * For the licensing terms see the file COPYING
- *
- ************************************************************************/
 /*****************************************************************************
 * ReadFile.C
 *****************************************************************************/
@@ -56,6 +49,12 @@ void ReadFile::initialize()
   argc = 0;
   setseparator(" \t\v");
   setendofline("");
+#ifndef G__OLDIMPLEMENTATION1960
+  setdelimitor("");
+#endif
+#ifndef G__OLDIMPLEMENTATION3000
+  setquotation("");
+#endif
 }
 
 void ReadFile::setseparator(const char *separatorin)
@@ -78,6 +77,14 @@ void ReadFile::setendofline(const char *endoflinein)
   lenendofline = strlen(endofline);
 }
 
+#ifndef G__OLDIMPLEMENTATION3000
+void ReadFile::setquotation(const char *quotationin)
+{
+  strcpy(quotation,quotationin); 
+  lenquotation = strlen(quotation);
+}
+#endif
+
 /*****************************************************************************
 * Reading one line
 *****************************************************************************/
@@ -189,6 +196,18 @@ void ReadFile::separatearg(void)
   p = argbuf;
   do {
     while(isseparator((c = *p)) && c) ++p;
+#ifndef G__OLDIMPLEMENTATION3000
+    if(isquotation(c)) {
+      argv[++argc] = ++p;
+      while(!isquotation((c = *p)) && c) {
+        if(c=='\\') ++p;
+        ++p;
+      }
+      *p = '\0';
+      ++p;
+    }
+    else 
+#endif
     if(c) {
       argv[++argc] = p;
 #ifndef G__OLDIMPLEMENTATION1960
@@ -242,6 +261,21 @@ int ReadFile::isdelimitor(int c)
 
 #endif
 
+#ifndef G__OLDIMPLEMENTATION3000
+/*****************************************************************************
+* isquotation()
+*****************************************************************************/
+int ReadFile::isquotation(int c)
+{
+  int i;
+  for(i=0;i<lenquotation;i++) {
+    if(c==quotation[i]) return(1);
+  }
+  return(0);
+}
+
+#endif
+
 /*****************************************************************************
 * disp()
 *****************************************************************************/
diff --git a/cint/include/ReadF.cxx b/cint/include/ReadF.cxx
index 14d496e25bac91a9925eb83054bd50d81b1fc65e..88ac76e92af3f948b9b99a632a5c9acc591143a1 100644
--- a/cint/include/ReadF.cxx
+++ b/cint/include/ReadF.cxx
@@ -1,10 +1,3 @@
-/* -*- C++ -*- */
-/*************************************************************************
- * Copyright(c) 1995~2005  Masaharu Goto (cint@pcroot.cern.ch)
- *
- * For the licensing terms see the file COPYING
- *
- ************************************************************************/
 /*****************************************************************************
 * ReadFile.C
 *****************************************************************************/
@@ -56,6 +49,12 @@ void ReadFile::initialize()
   argc = 0;
   setseparator(" \t\v");
   setendofline("");
+#ifndef G__OLDIMPLEMENTATION1960
+  setdelimitor("");
+#endif
+#ifndef G__OLDIMPLEMENTATION3000
+  setquotation("");
+#endif
 }
 
 void ReadFile::setseparator(const char *separatorin)
@@ -78,6 +77,14 @@ void ReadFile::setendofline(const char *endoflinein)
   lenendofline = strlen(endofline);
 }
 
+#ifndef G__OLDIMPLEMENTATION3000
+void ReadFile::setquotation(const char *quotationin)
+{
+  strcpy(quotation,quotationin); 
+  lenquotation = strlen(quotation);
+}
+#endif
+
 /*****************************************************************************
 * Reading one line
 *****************************************************************************/
@@ -189,6 +196,18 @@ void ReadFile::separatearg(void)
   p = argbuf;
   do {
     while(isseparator((c = *p)) && c) ++p;
+#ifndef G__OLDIMPLEMENTATION3000
+    if(isquotation(c)) {
+      argv[++argc] = ++p;
+      while(!isquotation((c = *p)) && c) {
+        if(c=='\\') ++p;
+        ++p;
+      }
+      *p = '\0';
+      ++p;
+    }
+    else 
+#endif
     if(c) {
       argv[++argc] = p;
 #ifndef G__OLDIMPLEMENTATION1960
@@ -242,6 +261,21 @@ int ReadFile::isdelimitor(int c)
 
 #endif
 
+#ifndef G__OLDIMPLEMENTATION3000
+/*****************************************************************************
+* isquotation()
+*****************************************************************************/
+int ReadFile::isquotation(int c)
+{
+  int i;
+  for(i=0;i<lenquotation;i++) {
+    if(c==quotation[i]) return(1);
+  }
+  return(0);
+}
+
+#endif
+
 /*****************************************************************************
 * disp()
 *****************************************************************************/
diff --git a/cint/include/ReadF.h b/cint/include/ReadF.h
index a7382b52712a1abce139a22ca97f3a4e628087af..19a70d50c481298ec23981516a5792dfb8905324 100644
--- a/cint/include/ReadF.h
+++ b/cint/include/ReadF.h
@@ -1,10 +1,3 @@
-/* -*- C++ -*- */
-/*************************************************************************
- * Copyright(c) 1995~2005  Masaharu Goto (cint@pcroot.cern.ch)
- *
- * For the licensing terms see the file COPYING
- *
- ************************************************************************/
 /*****************************************************************************
 * ReadFile.h
 *
@@ -30,6 +23,9 @@
 #define MAX_TOKEN        1024
 #define MAX_SEPARATOR    32
 #define MAX_ENDOFLINE    10
+#ifndef G__OLDIMPLEMENTATION3000
+#define MAX_QUOTATION    10
+#endif
 
 class ReadFile {
  public:
@@ -56,6 +52,9 @@ class ReadFile {
   void setdelimitor(const char *delimitorin); 
 #endif
   void setendofline(const char *endoflinein); 
+#ifndef G__OLDIMPLEMENTATION3000
+  void setquotation(const char *quotationin); 
+#endif
 
   int isvalid() { if(fp) return(1); else return(0); }
   void disp();
@@ -75,6 +74,10 @@ class ReadFile {
 #endif
   char endofline[MAX_ENDOFLINE];
   int lenendofline;
+#ifndef G__OLDIMPLEMENTATION3000
+  char quotation[MAX_SEPARATOR];
+  int lenquotation;
+#endif
 
   void separatearg(void);
   void initialize();
@@ -83,6 +86,9 @@ class ReadFile {
   int isdelimitor(int c);
 #endif
   int isendofline(int c);
+#ifndef G__OLDIMPLEMENTATION3000
+  int isquotation(int c);
+#endif
 };
 
 
diff --git a/cint/lib/stdstrct/stdcxxfunc.h b/cint/lib/stdstrct/stdcxxfunc.h
index 001953fef3f84052801f17e7b6b92e018e994e04..403b8e31a3b32b6c3277fa38935ce11b8ce1d544 100644
--- a/cint/lib/stdstrct/stdcxxfunc.h
+++ b/cint/lib/stdstrct/stdcxxfunc.h
@@ -25,15 +25,20 @@
 #include <time.h>
 #include <locale.h>
 #endif
+
+#include <ctime>
+
 #if (defined(__sgi) && !defined(__GNUC__) && !defined(__KCC)) || (defined(__alpha) && !defined(__GNUC__))
 #include <math.h>
 #else
 #include <cmath>
 #endif
 #ifdef __hpux
-namespace std {} using namespace std;
+namespace std {}
 #endif
 
+using namespace std;
+
 #ifdef __MAKECINT__
 
 //long  abs  (long);
@@ -67,6 +72,8 @@ float tanh (float);
 double abs(double);            // fabs()
 double pow(double, int);
 
+size_t strftime(char* ptr, size_t maxsize, const char* fmt, const struct tm* time);
+
 #if !defined(G__SUN) && !defined(G__AIX)
 long double abs  (long double);
 long double acos (long double);
diff --git a/cint/src/Apiif.cxx b/cint/src/Apiif.cxx
index 5775e670297b40c6b01b3ce6d98f23ae42544002..5723c8547526087e97231f833d86acad9f93254d 100644
--- a/cint/src/Apiif.cxx
+++ b/cint/src/Apiif.cxx
@@ -15,6 +15,7 @@ extern "C" void G__cpp_reset_tagtableG__API();
 
 extern "C" void G__set_cpp_environmentG__API() {
   G__add_compiledheader("Api.h");
+  G__add_compiledheader("Shadow.h");
   G__cpp_reset_tagtableG__API();
 }
 #include <new>
@@ -3226,7 +3227,7 @@ static int G__G__API_87_0_18(G__value* result7, G__CONST char* funcname, struct
 *********************************************************/
 class G__Sizep2memfuncG__API {
  public:
-  G__Sizep2memfuncG__API() {p=&G__Sizep2memfuncG__API::sizep2memfunc;}
+  G__Sizep2memfuncG__API(): p(&G__Sizep2memfuncG__API::sizep2memfunc) {}
     size_t sizep2memfunc() { return(sizeof(p)); }
   private:
     size_t (G__Sizep2memfuncG__API::*p)();
@@ -3367,10 +3368,6 @@ static void G__setup_memvarCintcLcLG__ClassInfo(void) {
 }
 
 
-   /* Cint::G__ClassInfo::MatchMode */
-
-   /* Cint::G__ClassInfo::InheritanceMode */
-
    /* Cint::G__BaseClassInfo */
 static void G__setup_memvarCintcLcLG__BaseClassInfo(void) {
    G__tag_memvar_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__BaseClassInfo));
@@ -3398,8 +3395,6 @@ static void G__setup_memvarCintcLcLG__MethodArgInfo(void) {
 }
 
 
-   /* Cint::G__DataMemberInfo::error_code */
-
    /* Cint::G__CallFunc */
 static void G__setup_memvarCintcLcLG__CallFunc(void) {
    G__tag_memvar_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__CallFunc));
@@ -3411,8 +3406,6 @@ static void G__setup_memvarCintcLcLG__CallFunc(void) {
 }
 
 
-   /* Cint::G__CallFunc::MatchMode */
-
    /* Cint::G__TypedefInfo */
 static void G__setup_memvarCintcLcLG__TypedefInfo(void) {
    G__tag_memvar_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__TypedefInfo));
@@ -3446,10 +3439,6 @@ static void G__setup_memvarCintcLcLG__TokenInfo(void) {
 }
 
 
-   /* Cint::G__TokenInfo::G__TokenType */
-
-   /* Cint::G__TokenInfo::G__TokenProperty */
-
    /* Cint::G__SourceFileInfo */
 static void G__setup_memvarCintcLcLG__SourceFileInfo(void) {
    G__tag_memvar_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__SourceFileInfo));
@@ -4023,6 +4012,9 @@ static void G__cpp_setup_global3() {
    G__memvar_setup((void*)G__PVOID,112,0,0,-1,-1,-1,1,"G__CALLFUNC_H=0",1,(char*)NULL);
    G__memvar_setup((void*)G__PVOID,112,0,0,-1,-1,-1,1,"G__TYPEDEFINFO_H=0",1,(char*)NULL);
    G__memvar_setup((void*)G__PVOID,112,0,0,-1,-1,-1,1,"G__TOKENINFO_H=0",1,(char*)NULL);
+}
+
+static void G__cpp_setup_global4() {
 
    G__resetglobalenv();
 }
@@ -4031,6 +4023,7 @@ extern "C" void G__cpp_setup_globalG__API() {
   G__cpp_setup_global1();
   G__cpp_setup_global2();
   G__cpp_setup_global3();
+  G__cpp_setup_global4();
 }
 
 /*********************************************************
@@ -4113,6 +4106,8 @@ extern "C" void G__cpp_reset_tagtableG__API() {
   G__G__APILN_CintcLcLG__TokenInfocLcLG__TokenProperty.tagnum = -1 ;
   G__G__APILN_CintcLcLG__SourceFileInfo.tagnum = -1 ;
   G__G__APILN_CintcLcLG__IncludePathInfo.tagnum = -1 ;
+  G__G__APILN_basic_ostreamlEcharcOchar_traitslEchargRsPgR.tagnum = -1 ;
+  G__G__APILN_string.tagnum = -1 ;
   G__G__APILN_CintcLcLG__ShadowMaker.tagnum = -1 ;
 }
 
@@ -4147,6 +4142,8 @@ extern "C" void G__cpp_setup_tagtableG__API() {
    G__tagtable_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__TokenInfocLcLG__TokenProperty),sizeof(int),-1,0,(char*)NULL,NULL,NULL);
    G__tagtable_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__SourceFileInfo),sizeof(Cint::G__SourceFileInfo),-1,34048,(char*)NULL,G__setup_memvarCintcLcLG__SourceFileInfo,G__setup_memfuncCintcLcLG__SourceFileInfo);
    G__tagtable_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__IncludePathInfo),sizeof(Cint::G__IncludePathInfo),-1,3328,(char*)NULL,G__setup_memvarCintcLcLG__IncludePathInfo,G__setup_memfuncCintcLcLG__IncludePathInfo);
+   G__get_linked_tagnum_fwd(&G__G__APILN_basic_ostreamlEcharcOchar_traitslEchargRsPgR);
+   G__get_linked_tagnum_fwd(&G__G__APILN_string);
    G__tagtable_setup(G__get_linked_tagnum(&G__G__APILN_CintcLcLG__ShadowMaker),sizeof(Cint::G__ShadowMaker),-1,35328,(char*)NULL,G__setup_memvarCintcLcLG__ShadowMaker,G__setup_memfuncCintcLcLG__ShadowMaker);
 }
 extern "C" void G__cpp_setupG__API(void) {
diff --git a/cint/src/Apiif.h b/cint/src/Apiif.h
index 31445863013ffe502013f1a9dc9497dc41a465c5..ec35e1906da1d7b89798fbe4b49731b43f37ceaf 100644
--- a/cint/src/Apiif.h
+++ b/cint/src/Apiif.h
@@ -16,16 +16,14 @@
 #define G__DICTIONARY
 #include "G__ci.h"
 extern "C" {
-extern G__DLLEXPORT int G__cpp_dllrevG__API();
-extern G__DLLEXPORT void G__set_cpp_environmentG__API();
-extern G__DLLEXPORT void G__cpp_setup_tagtableG__API();
-extern G__DLLEXPORT void G__cpp_setup_inheritanceG__API();
-extern G__DLLEXPORT void G__cpp_setup_typetableG__API();
-extern G__DLLEXPORT void G__cpp_setup_memvarG__API();
-extern G__DLLEXPORT void G__cpp_setup_globalG__API();
-extern G__DLLEXPORT void G__cpp_setup_memfuncG__API();
-extern G__DLLEXPORT void G__cpp_setup_funcG__API();
-extern G__DLLEXPORT void G__cpp_setupG__API();
+extern void G__cpp_setup_tagtableG__API();
+extern void G__cpp_setup_inheritanceG__API();
+extern void G__cpp_setup_typetableG__API();
+extern void G__cpp_setup_memvarG__API();
+extern void G__cpp_setup_globalG__API();
+extern void G__cpp_setup_memfuncG__API();
+extern void G__cpp_setup_funcG__API();
+extern void G__set_cpp_environmentG__API();
 }
 
 
@@ -35,8 +33,6 @@ extern G__DLLEXPORT void G__cpp_setupG__API();
 #ifndef G__MEMFUNCBODY
 #endif
 
-extern G__linked_taginfo G__G__APILN_string;
-extern G__linked_taginfo G__G__APILN_basic_ostreamlEcharcOchar_traitslEchargRsPgR;
 extern G__linked_taginfo G__G__APILN_G__value;
 extern G__linked_taginfo G__G__APILN_G__friendtag;
 extern G__linked_taginfo G__G__APILN_G__bytecodefunc;
@@ -62,6 +58,8 @@ extern G__linked_taginfo G__G__APILN_CintcLcLG__TokenInfocLcLG__TokenType;
 extern G__linked_taginfo G__G__APILN_CintcLcLG__TokenInfocLcLG__TokenProperty;
 extern G__linked_taginfo G__G__APILN_CintcLcLG__SourceFileInfo;
 extern G__linked_taginfo G__G__APILN_CintcLcLG__IncludePathInfo;
+extern G__linked_taginfo G__G__APILN_basic_ostreamlEcharcOchar_traitslEchargRsPgR;
+extern G__linked_taginfo G__G__APILN_string;
 extern G__linked_taginfo G__G__APILN_CintcLcLG__ShadowMaker;
 
 /* STUB derived class for protected member access */
diff --git a/cint/src/HISTORY b/cint/src/HISTORY
index 061af58923ae9f6197cbb267da7b7e8b64204bda..caa10c9dcde2d7d67843a3177a9695387eb23168 100644
--- a/cint/src/HISTORY
+++ b/cint/src/HISTORY
@@ -4972,6 +4972,16 @@
 *   members were getting declared static, even when they were not)
 * - scratch_upto now returns a counter that gets bumped 
 *   every time the dictionary is rewound, allows detection of changed dict.
+*
+* 5.16.26 Oct 11, 2007
+* 6.1.26 Oct 11, 2007
+* - move to subversion
+* - fix gcc4strm
+* - update CINT API dictionary
+* - update ReadF tutorial
+* - fix bytecode generation (was disabled in some loops)
+* - minor bug fixes
+
 
 * ---------------------------------------------------------------------
 *     , A::operator float() conversion with standard conversion
diff --git a/cint/src/v6_expr.cxx b/cint/src/v6_expr.cxx
index 2196716239c1db535d69eabaaaa436f9ee0b8f54..5d4313586bb3da7944923868d18a493e8e338aaf 100644
--- a/cint/src/v6_expr.cxx
+++ b/cint/src/v6_expr.cxx
@@ -408,7 +408,7 @@ G__value G__calc(const char* exprwithspace);
       while(pp_and) { \
          G__free_tempobject(); --G__templevel; /* 1516 */ \
          if(G__asm_dbg) \
-            G__fprinterr(G__serr,"   %s: CNDJMP assigned for AND %x  %s:%d\n", ppointer_and[pp_and-1] - 1, G__asm_cp, __FILE__, __LINE__); \
+            G__fprinterr(G__serr,"   %3x: CNDJMP assigned for AND %x  %s:%d\n", ppointer_and[pp_and-1] - 1, G__asm_cp, __FILE__, __LINE__); \
          if(G__PVOID==G__asm_inst[ppointer_and[pp_and-1]]) /* 1575 */ \
             G__asm_inst[ppointer_and[--pp_and]] = G__asm_cp; \
          else --pp_and; /* 1575 */ \
diff --git a/cint/src/v6_ifunc.cxx b/cint/src/v6_ifunc.cxx
index 3b0a6160e99dcbe1dc7a62350f512068301fb101..5c22e56b6474c3a6ebed1a776e335f995c34f45d 100644
--- a/cint/src/v6_ifunc.cxx
+++ b/cint/src/v6_ifunc.cxx
@@ -4886,7 +4886,12 @@ int G__interpret_func(G__value* result7, char* funcname, G__param* libp, int has
                   G__incsetup_memfunc(baseclass->herit[basen]->basetagnum);
                   p_ifunc = G__struct.memfunc[baseclass->herit[basen]->basetagnum];
 #ifdef G__VIRTUALBASE
-                  if (baseclass->herit[basen]->property&G__ISVIRTUALBASE) {
+                  // require !G__prerun, else store_inherit_offset might not point
+                  // to a valid object with vtable, and G__getvirtualbaseoffset()
+                  // might fail. We should not need the voffset in this case
+                  // anyway, as we don't actually call the function.
+                  if (!G__prerun &&
+                      baseclass->herit[basen]->property&G__ISVIRTUALBASE) {
                      G__store_struct_offset = store_inherit_offset +
                                               G__getvirtualbaseoffset(store_inherit_offset, G__tagnum
                                                                       , baseclass, basen);
@@ -4914,7 +4919,12 @@ int G__interpret_func(G__value* result7, char* funcname, G__param* libp, int has
                   G__incsetup_memfunc(baseclass->herit[basen]->basetagnum);
                   p_ifunc = G__struct.memfunc[baseclass->herit[basen]->basetagnum];
 #ifdef G__VIRTUALBASE
-                  if (baseclass->herit[basen]->property&G__ISVIRTUALBASE) {
+                  // require !G__prerun, else store_inherit_offset might not point
+                  // to a valid object with vtable, and G__getvirtualbaseoffset()
+                  // might fail. We should not need the voffset in this case
+                  // anyway, as we don't actually call the function.
+                  if (!G__prerun &&
+                      baseclass->herit[basen]->property&G__ISVIRTUALBASE) {
                      G__store_struct_offset = store_inherit_offset +
                                               G__getvirtualbaseoffset(store_inherit_offset, G__tagnum
                                                                       , baseclass, basen);
@@ -5493,15 +5503,12 @@ int G__interpret_func(G__value* result7, char* funcname, G__param* libp, int has
    }
    else {
       // -- We are not doing whole function compilation.
-      // FIXME: Turn off bytecode generation unconditionally without saving the old state.
       G__asm_noverflow = 0;
    }
 #else // G__ASM_WHOLEFUNC
-   // FIXME: Turn off bytecode generation unconditionally without saving the old state.
    G__asm_noverflow = 0;
 #endif // G__ASM_WHOLEFUNC
-   G__asm_cp = 0;
-   G__asm_dt = G__MAXSTACK - 1;
+   G__clear_asm();
 #endif // G__ASM_IFUNC
 #endif // G__ASM
    //
diff --git a/cint/src/v6_init.cxx b/cint/src/v6_init.cxx
index f5d8564c8fb2140df2793d03430112038bdd460e..cd8335125bc2e189d5422c73270a0f5ca3804936 100644
--- a/cint/src/v6_init.cxx
+++ b/cint/src/v6_init.cxx
@@ -120,6 +120,7 @@ void G__remove_setup_func(const char* libname)
 int G__call_setup_funcs()
 {
    int i, k = 0;
+   G__var_array* store_p_local = G__p_local; // changed by setupfuncs
    G__LockCriticalSection();
    if (!G__initpermanentsl) {
       G__initpermanentsl = new std::list<G__DLLINIT>;
@@ -135,6 +136,7 @@ int G__call_setup_funcs()
 #endif
       }
    G__UnlockCriticalSection();
+   G__p_local = store_p_local;
    return k;
 }
 
diff --git a/cint/src/v6_parse.cxx b/cint/src/v6_parse.cxx
index 99ee03f466da53273950742fe34211a8edeba04e..a87f28f443646dd4b42b4bf15df1461280c0c008 100644
--- a/cint/src/v6_parse.cxx
+++ b/cint/src/v6_parse.cxx
@@ -1925,7 +1925,8 @@ static G__value G__exec_do()
    //
    //  Start bytecode generation, if enabled.
    //
-   int asm_start_pc = 0;
+   // Rember the position of the beginning of the body for the jump at the end.
+   int asm_start_pc = G__asm_cp;
    if (G__asm_loopcompile) {
       // -- We are generating bytecode for loops.
       //
@@ -1935,15 +1936,15 @@ static G__value G__exec_do()
          // -- If bytecode generation is turned off, turn it on.
 #ifdef G__ASM_DBG
          if (G__asm_dbg) {
-            G__fprinterr(G__serr, "\nLoop compile start (for do).");
+            G__fprinterr(G__serr, "\nLoop compile start (for do).  Erasing old bytecode and resetting pc.");
             G__printlinenum();
          }
 #endif // G__ASM_DBG
          G__asm_noverflow = 1;
          G__clear_asm();
+         // Rember the position of the beginning of the body for the jump at the end.
+         asm_start_pc = G__asm_cp;
       }
-      // Rember the position of the beginning of the body for the jump at the end.
-      asm_start_pc = G__asm_cp;
       // Clear the data stack.
       G__asm_clear();
    }
@@ -2736,16 +2737,21 @@ static G__value G__exec_loop(char* forinit, char* condition, int naction, char**
    //
 #ifdef G__ASM
    if (G__asm_loopcompile) {
+      // -- We are generating bytecode for loops.
+      //
+      // Reset and initialize the bytecode generation environment.
+      //
       if (!G__asm_noverflow) {
+         // -- If bytecode generation is turned off, turn it on.
+#ifdef G__ASM_DBG
+         if (G__asm_dbg) {
+            G__fprinterr(G__serr, "\nLoop compile start (for a for or while).  Erasing old bytecode and resetting pc.");
+            G__printlinenum();
+         }
+#endif // G__ASM_DBG
          G__asm_noverflow = 1;
          G__clear_asm();
       }
-#ifdef G__ASM_DBG
-      if (G__asm_dbg) {
-         G__fprinterr(G__serr, "\nLoop compile start. (for for or while)");
-         G__printlinenum();
-      }
-#endif // G__ASM_DBG
    }
 #endif // G__ASM
    //
@@ -3097,6 +3103,9 @@ static G__value G__exec_loop(char* forinit, char* condition, int naction, char**
                G__asm_optimize(&asm_start_pc);
                //fprintf(stderr, "\nG__exec_loop: End bytecode optimize.\n");
             }
+            // FIXME: Are we ignoring bytecode generation errors from G__asm_optimize here?
+            // Reenable bytecode generation.
+            G__asm_noverflow = 1;
             if (G__asm_dbg) {
                G__fprinterr(G__serr, "\nBytecode loop compilation successful. (for for or while)");
                G__printlinenum();
@@ -3116,7 +3125,11 @@ static G__value G__exec_loop(char* forinit, char* condition, int naction, char**
             if (!G__no_exec_compile) {
                //fprintf(stderr, "G__exec_loop: Beginning to execute bytecode.\n", G__no_exec_compile);
                // Note: Bytecode generation must be off here, or we will overwrite the generated code!
+               // Disable bytecode generation.
+               G__asm_noverflow = 0;
                /*int status =*/ G__exec_asm(asm_start_pc, 0, &result, 0);
+               // Reenable bytecode generation.
+               G__asm_noverflow = 1;
                if (G__return != G__RETURN_NON) {
                   // -- User requested that we return immediately.
                   // If no bytecode errors, restore bytecode generation
diff --git a/cint/src/v6_struct.cxx b/cint/src/v6_struct.cxx
index 644abf731551a2e48585556a7137dabb7fff1032..feb1886ee8fb2b838b541f2a22876b403cd74a21 100644
--- a/cint/src/v6_struct.cxx
+++ b/cint/src/v6_struct.cxx
@@ -531,7 +531,7 @@ void G__define_struct(char type)
    char tagname[G__LONGLINE];
    int c = G__fgetname_template(tagname, "{:;=&");
    if (strlen(tagname) >= G__LONGLINE) {
-      G__fprinterr(G__serr, "Limitation: class name too long. Must be < %d", G__LONGLINE);
+      G__fprinterr(G__serr, "Limitation: class name '%s' too long. Must be < %d", tagname, G__LONGLINE);
       G__genericerror(0);
    }
    while (c == ':') {
@@ -734,7 +734,7 @@ void G__define_struct(char type)
       c = G__fgetname(basename, "{,");
 #endif // G__TEMPLATECLASS
       if (strlen(basename) >= G__LONGLINE) {
-         G__fprinterr(G__serr, "Limitation: class name too long. Must be < %d", G__LONGLINE);
+         G__fprinterr(G__serr, "Limitation: class name '%s' too long. Must be < %d", basename, G__LONGLINE);
          G__genericerror(0);
       }
       // [struct|class] <tagname> : <private|protected|public|virtual> base1 , base2 {}
@@ -749,7 +749,7 @@ void G__define_struct(char type)
          c = G__fgetname_template(basename, "{,");
          isvirtualbase = G__ISVIRTUALBASE;
          if (strlen(basename) >= G__LONGLINE) {
-            G__fprinterr(G__serr, "Limitation: class name too long. Must be < %d", G__LONGLINE);
+            G__fprinterr(G__serr, "Limitation: class name '%s' too long. Must be < %d", basename, G__LONGLINE);
             G__genericerror(0);
          }
       }
@@ -765,7 +765,7 @@ void G__define_struct(char type)
          c = G__fgetname(basename, "{,");
 #endif // G__TEMPLATECLASS
          if (strlen(basename) >= G__LONGLINE) {
-            G__fprinterr(G__serr, "Limitation: class name too long. Must be < %d", G__LONGLINE);
+            G__fprinterr(G__serr, "Limitation: class name '%s' too long. Must be < %d", basename, G__LONGLINE);
             G__genericerror(0);
          }
       }
@@ -777,7 +777,7 @@ void G__define_struct(char type)
          c = G__fgetname(basename, "{,");
 #endif // G__TEMPLATECLASS
          if (strlen(basename) >= G__LONGLINE) {
-            G__fprinterr(G__serr, "Limitation: class name too long. Must be < %d", G__LONGLINE);
+            G__fprinterr(G__serr, "Limitation: class name '%s' too long. Must be < %d", basename, G__LONGLINE);
             G__genericerror(0);
          }
       }
@@ -789,7 +789,7 @@ void G__define_struct(char type)
          c = G__fgetname(basename, "{,");
 #endif // G__TEMPLATECLASS
          if (strlen(basename) >= G__LONGLINE) {
-            G__fprinterr(G__serr, "Limitation: class name too long. Must be < %d", G__LONGLINE);
+            G__fprinterr(G__serr, "Limitation: class name '%s' too long. Must be < %d", basename, G__LONGLINE);
             G__genericerror(0);
          }
       }
@@ -802,7 +802,7 @@ void G__define_struct(char type)
          c = G__fgetname_template(basename, "{,");
          isvirtualbase = G__ISVIRTUALBASE;
          if (strlen(basename) >= G__LONGLINE) {
-            G__fprinterr(G__serr, "Limitation: class name too long. Must be < %d", G__LONGLINE);
+            G__fprinterr(G__serr, "Limitation: class name '%s' too long. Must be < %d", basename, G__LONGLINE);
             G__genericerror(0);
          }
       }
diff --git a/cint/stl/algo.h b/cint/stl/algo.h
index bc597b2ac64431aa25a17508bd59fdf7c99468be..0b6d28e652d15d61df8d38032c278fe08b94402f 100644
--- a/cint/stl/algo.h
+++ b/cint/stl/algo.h
@@ -34,6 +34,11 @@
 #include <heap.h>
 #include <tempbuf.h>
 
+#if defined(__CINT__) && !defined(__MAKECINT__)
+// This is needed for Cint::G__long_random
+#pragma setertti
+#endif
+
 template <class T>
 inline T __median(T a, T b, T c) {
     if (a < b)
@@ -531,20 +536,18 @@ OutputIterator rotate_copy(ForwardIterator first, ForwardIterator middle,
     return copy(first, middle, copy(middle, last, result));
 }
 
-unsigned long __long_random(unsigned long);
-
 template <class RandomAccessIterator, class Distance>
 void __random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
 		      Distance*) {
     if (first == last) return;
     for (RandomAccessIterator i = first + 1; i != last; i++)
-	iter_swap(i, first + Distance(__long_random((i - first) + 1)));
+       iter_swap(i, first + Distance(Cint::G__long_random((i - first) + 1)));
 }
 
 template <class RandomAccessIterator>
 inline void random_shuffle(RandomAccessIterator first,
 			   RandomAccessIterator last) {
-    __random_shuffle(first, last, distance_type(first));
+    __random_shuffle(first, last, &(first-first));
 }
 
 template <class RandomAccessIterator, class RandomNumberGenerator>