diff --git a/asprintf.h b/asprintf.h
index 35514bfc2198859e802c882a8523f8ded8f12b77..d28f3544eea74281fd4486228c7a06b25a38785a 100644
--- a/asprintf.h
+++ b/asprintf.h
@@ -8,8 +8,8 @@ extern "C" {
 #define __attribute__(arg)
 #endif
 
-int asprintf(char** pbuffer, const char* format, ...) __attribute__((format(printf,2,3)));
-int vasprintf(char** pbuffer, const char* format, va_list ap) __attribute__((format(printf,2,0)));
+int asprintf(char** pbuffer, const char* format, ...) __attribute__((__format__(__printf__,2,3)));
+int vasprintf(char** pbuffer, const char* format, va_list ap) __attribute__((__format__(__printf__,2,0)));
 #ifdef __cplusplus
 }
 #endif
diff --git a/iocsh b/iocsh
index be3a573e181a3d36b64babf23b3d29003a63a69c..bde7ec7809031e41fcfd5abba27100e1d4d64792 100755
--- a/iocsh
+++ b/iocsh
@@ -128,9 +128,9 @@ else
 BASE=$(basename $(rp $EPICS_BASE))
 BASE=${BASE#*base-}
 fi
-if [ "${BASE#3.14.}" = "$BASE" -a "${BASE#3.15.}" = "$BASE" ]
+if [ "${BASE#3.}" = "$BASE" ]
 then
-    echo "Cannot find any EPICS 3.14 or 3.15 version" >&2
+    echo "Cannot find any EPICS base version" >&2
     echo "Try setting EPICS_BASE environment variable to full path" >&2
     exit 1
 fi
diff --git a/require.c b/require.c
index 20928962e23ba9a340abd4f86b12c729b9526b57..a2db678a4fc66f4d1aea28176421623ff37a0ef3 100644
--- a/require.c
+++ b/require.c
@@ -442,6 +442,7 @@ static int setupDbPath(const char* module, const char* dbdir)
 static int getRecordHandle(const char* namepart, short type, long minsize, DBADDR* paddr)
 {
     char recordname[PVNAME_STRINGSZ];
+    long dummy, offset;
 
     sprintf(recordname, "%.*s%s", (int)(PVNAME_STRINGSZ-strlen(namepart)-1), getenv("IOC"), namepart);
     if (dbNameToAddr(recordname, paddr) != 0)
@@ -468,6 +469,8 @@ static int getRecordHandle(const char* namepart, short type, long minsize, DBADD
             recordname);
         return -1;
     }
+    /* update array information */
+    dbGetRset(paddr)->get_array_info(paddr, &dummy, &offset);
     return 0;
 }
 
@@ -665,7 +668,9 @@ static int findLibRelease (
     char* version;
     char* symname;
     char name[NAME_MAX + 11];                               /* get space for library path + "LibRelease" */
-
+    
+    (void)data;                                             /* unused */
+    if (size < sizeof(struct dl_phdr_info)) return 0;       /* wrong version of struct dl_phdr_info */
     /* find a symbol with a name like "_<module>LibRelease"
        where <module> is from the library name "<location>/lib<module>.so" */
     if (info->dlpi_name == NULL || info->dlpi_name[0] == 0) return 0;  /* no library name */
@@ -1171,7 +1176,7 @@ static int handleDependencies(const char* module, char* depfilename)
             while (*end && !isspace((unsigned char)*end)) end++;
 
             /* add + to numerial versions if not yet there */
-            if (*(end-1) != '+' && strspn(rversion, "0123456789.") == end-rversion) *end++ = '+';
+            if (*(end-1) != '+' && strspn(rversion, "0123456789.") == (size_t)(end-rversion)) *end++ = '+';
 
             /* terminate version */
             *end = 0;
diff --git a/require.h b/require.h
index 22b2287aef09fed01720d6084248c75e7954b682..59d89b001367d6b0ab8d165d2acd755511b81ee9 100644
--- a/require.h
+++ b/require.h
@@ -15,7 +15,7 @@ const char* getLibVersion(const char* libname);
 const char* getLibLocation(const char* libname);
 int libversionShow(const char* outfile);
 int runScript(const char* filename, const char* args);
-int putenvprintf(const char* format, ...) __attribute__((format(printf,1,2)));
+int putenvprintf(const char* format, ...) __attribute__((__format__(__printf__,1,2)));
 void pathAdd(const char* varname, const char* dirname);
 
 #ifdef __cplusplus
diff --git a/runScript.c b/runScript.c
index 1fe840bd35302c8d0e5b1042ebd3d99accdcf1de..6017663981bb990095568d9456bfdc890a5836f4 100644
--- a/runScript.c
+++ b/runScript.c
@@ -1,4 +1,6 @@
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -10,6 +12,8 @@
 #include <initHooks.h>
 #include <epicsVersion.h>
 
+#define EPICSVER EPICS_VERSION*10000+EPICS_REVISION*100+EPICS_MODIFICATION
+
 #ifdef vxWorks
 #include "asprintf.h"
 #include <sysSymTbl.h>
@@ -28,8 +32,7 @@
 #include "asprintf.h"
 #endif
 
-#ifdef BASE_VERSION
-#define EPICS_3_13
+#if (EPICSVER<31400)
 extern char** ppGlobalEnviron;
 #define OSI_PATH_SEPARATOR "/"
 #define OSI_PATH_LIST_SEPARATOR ":"
@@ -124,7 +127,7 @@ const char* getFormat(const char** pp)
 {
     static char format [20];
     const char* p = *pp;
-    int i = 1;
+    unsigned int i = 1;
     if (runScriptDebug > 1) printf ("getFormat %s\n", p);
     if ((format[0] = *p++) == '%')
     {
@@ -166,9 +169,13 @@ int runScript(const char* filename, const char* args)
         return -1;
     }
     
-    if (macCreateHandle(&mac,(char*[]){ "", "environ", NULL, NULL }) != 0) goto error;
+    if (macCreateHandle(&mac,(
+#if (EPICSVER>=31501)
+        const
+#endif
+        char*[]){ "", "environ", NULL, NULL }) != 0) goto error;
     macSuppressWarning(mac, 1);
-#ifdef EPICS_3_13
+#if (EPICSVER<31400)
     /* Have no environment macro substitution, thus load envionment explicitly */
     /* Actually, environmant macro substitution was introduced in 3.14.3 */
     for (pairs = ppGlobalEnviron; *pairs; pairs++)
@@ -194,7 +201,7 @@ int runScript(const char* filename, const char* args)
 
 #ifdef vxWorks
     /* expand macros (environment variables) in file name because vxWorks shell can't do it */
-#ifdef EPICS_3_13
+#if (EPICSVER<31400)
     /* 3.13 version of macExpandString is broken and may write more than allowed */
     while ((len = labs(macExpandString(mac, (char*)filename, line_exp, 
             line_exp_size/2))) >= line_exp_size/2)
@@ -272,7 +279,7 @@ int runScript(const char* filename, const char* args)
                 printf("runScript raw line (%ld chars): '%s'\n", len, line_raw);
         /* expand and check the buffer size (different epics versions write different may number of bytes)*/
         while ((len = labs(macExpandString(mac, line_raw, line_exp, 
-#ifdef EPICS_3_13
+#if (EPICSVER<31400)
         /* 3.13 version of macExpandString is broken and may write more than allowed */
                 line_exp_size/2))) >= line_exp_size/2)
 #else       
@@ -401,7 +408,7 @@ end:
     return status;
 }
 
-#ifndef EPICS_3_13
+#if (EPICSVER>=31400)
 /* initHooks is not included in iocCore in 3.13 */
 
 struct cmditem