From 5f3d07b1bd11c83b9c0460fdcdaa08b92294247f Mon Sep 17 00:00:00 2001 From: Paul Russo <russo@fnal.gov> Date: Wed, 23 Jun 2010 21:13:22 +0000 Subject: [PATCH] Do not set G__static_alloc when "const" is parsed, const variables should not have static storage duration. Abort whole function bytecode generation when an initialized const int variable declaration is seen. The standard allows this to be used in an array declaration, which is very hard to support for whole function bytecode generation because we have no place to store the initializer since we do not allocate storage for variables during the generation (instead we increment the space needed in the whole function bytecode special variable). These two changes together fix savannah bug #68471. git-svn-id: http://root.cern.ch/svn/root/trunk@34089 27541ba8-7e3a-0410-8455-c3a389f83636 --- cint/cint/src/parse.cxx | 1 - cint/cint/src/var.cxx | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cint/cint/src/parse.cxx b/cint/cint/src/parse.cxx index 54be6fb5298..72de8e575f1 100644 --- a/cint/cint/src/parse.cxx +++ b/cint/cint/src/parse.cxx @@ -4068,7 +4068,6 @@ static int G__keyword_anytime_5(G__FastAllocString& statement) } int store_no_exec = G__no_exec; G__no_exec = 0; - G__static_alloc = 1; int brace_level = 0; G__exec_statement(&brace_level); G__static_alloc = 0; diff --git a/cint/cint/src/var.cxx b/cint/cint/src/var.cxx index 93631b81f1e..1051b9716a4 100644 --- a/cint/cint/src/var.cxx +++ b/cint/cint/src/var.cxx @@ -2981,6 +2981,14 @@ inline void G__alloc_var_ref(int SIZE, CONVFUNC f, char* item, G__var_array* var /*memset((char*) var->p[ig15], 0, SIZE);*/ } } + if ( + (G__asm_wholefunction == G__ASM_FUNC_COMPILE) && + (var->type[ig15] == 'i') && + (var->constvar[ig15] & G__CONSTVAR) && + result.type + ) { + G__abortbytecode(); + } /* Now do initialization. */ if ( /* Variable has storage to initialize */ -- GitLab