On Wed, Oct 22, 2014 at 11:21:28PM +0400, Ilya Verbin wrote: > > Also, do we really want the messy DOS/Windows '\r' in the messages on > > Unix-ish targets? Shouldn't that be dependent on what target is the library > > configured for? > > Fixed.
... I'm still seeing various unhandled malloc failures, e.g.: cean_util.cpp: res =(CeanReadRanges *)malloc(sizeof(CeanReadRanges) + cean_util.cpp- (ap->rank - rank) * sizeof(CeanReadDim)); cean_util.cpp- res->current_number = 0; dv_util.cpp: res = (CeanReadRanges *)malloc( dv_util.cpp- sizeof(CeanReadRanges) + (rank - i) * sizeof(CeanReadDim)); dv_util.cpp- res -> last_noncont_ind = rank - i - 1; offload_env.cpp: env_var_def = (char*)malloc(sz); offload_env.cpp- memcpy(env_var_def, env_var_name, sz); offload_env.cpp- env_var_def[sz] = 0; offload_env.cpp- int new_env_size = new_env.size(); offload_env.cpp: rez = (char**) malloc((new_env_size + 1) * sizeof(char*)); offload_env.cpp- std::copy(new_env.begin(), new_env.end(), rez); offload_env.cpp- rez[new_env_size] = 0; offload_host.cpp: char * ptr = (char*)malloc(size); offload_host.cpp- COIRESULT res; offload_host.cpp- offload_host.cpp- memset(ptr, 0, size); offload_host.cpp: m_vars = (VarDesc*) malloc(m_vars_total * sizeof(VarDesc)); offload_host.cpp- memcpy(m_vars, vars, m_vars_total * sizeof(VarDesc)); offload_host.cpp: m_func_desc = (FunctionDescriptor*) malloc(m_func_desc_size + offload_host.cpp- misc_data_size); offload_host.cpp- m_func_desc->console_enabled = console_enabled; offload_host.cpp: res = (arr_desc *)malloc(sizeof(arr_desc)); offload_host.cpp- res->base = reinterpret_cast<int64_t>(ptr_val); would crash if malloc returns NULL. Similarly for realloc: offload_host.cpp: m_vars = (VarDesc*)realloc(m_vars, m_vars_total * sizeof(VarDesc)); offload_host.cpp- m_vars_extra = offload_host.cpp: (VarExtra*)realloc(m_vars_extra, m_vars_total * sizeof(VarExtra)); ... offload_host.cpp- ext_elements.val = m_vars[i].count; Also, I see you heavily use malloc.h, not sure how portable that is, certainly e.g. gcc checks through configure for its presence. I suppose stdlib.h being more portable. Or, if you want liboffloadmic to be supported only on i?86-*-linux* / x86_64-*-linux* rather than all i?86/x86_64 targets, maybe you should say so in configure.tgt. If you leave it on for all i?86/x86_64 targets, be prepared to handle issues on Darwin, mingw/cygwin, BSDs etc. Jakub