plugins exts BUGFIX storage must be 8B large

Fixes #2253
diff --git a/src/parser_common.c b/src/parser_common.c
index 8b46db0..f33b9a7 100644
--- a/src/parser_common.c
+++ b/src/parser_common.c
@@ -3587,7 +3587,7 @@
         LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)&pnode, NULL), cleanup);
 
         /* usually is a linked-list of all the parsed schema nodes */
-        pnodes_p = substmt->storage;
+        pnodes_p = (struct lysp_node **)substmt->storage;
         while (*pnodes_p) {
             pnodes_p = &(*pnodes_p)->next;
         }
@@ -3615,7 +3615,7 @@
     case LY_STMT_TYPEDEF:
     case LY_STMT_UNIQUE:
         /* parse, sized array */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage, NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)substmt->storage, NULL), cleanup);
         break;
 
     case LY_STMT_ARGUMENT:
@@ -3657,7 +3657,7 @@
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage, NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)substmt->storage, NULL), cleanup);
         break;
 
     case LY_STMT_CONFIG:
@@ -3669,7 +3669,7 @@
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage, NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)substmt->storage, NULL), cleanup);
         break;
 
     case LY_STMT_ORDERED_BY:
@@ -3681,7 +3681,7 @@
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage, NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)substmt->storage, NULL), cleanup);
         break;
 
     case LY_STMT_STATUS:
@@ -3693,7 +3693,7 @@
         }
 
         /* parse */
-        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage, NULL), cleanup);
+        LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)substmt->storage, NULL), cleanup);
         break;
 
     default:
diff --git a/src/plugins_exts.c b/src/plugins_exts.c
index 6797c15..e7626a2 100644
--- a/src/plugins_exts.c
+++ b/src/plugins_exts.c
@@ -87,7 +87,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, const void *parsed, struct lysc_ext_instance *ext,
+lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, uint64_t parsed, struct lysc_ext_instance *ext,
         struct lysc_ext_substmt *substmt)
 {
     LY_ERR rc = LY_SUCCESS;
@@ -101,7 +101,7 @@
         ly_bool enabled;
 
         /* evaluate */
-        LY_CHECK_GOTO(rc = lys_eval_iffeatures(ctx->ctx, parsed, &enabled), cleanup);
+        LY_CHECK_GOTO(rc = lys_eval_iffeatures(ctx->ctx, (struct lysp_qname *)parsed, &enabled), cleanup);
         if (!enabled) {
             /* it is disabled, remove the whole extension instance */
             rc = LY_ENOT;
@@ -163,7 +163,7 @@
     case LY_STMT_REFERENCE:
     case LY_STMT_UNITS:
         /* just make a copy */
-        LY_CHECK_GOTO(rc = lydict_insert(ctx->ctx, parsed, 0, substmt->storage), cleanup);
+        LY_CHECK_GOTO(rc = lydict_insert(ctx->ctx, (const char *)parsed, 0, (const char **)substmt->storage), cleanup);
         break;
 
     case LY_STMT_BIT:
@@ -175,7 +175,9 @@
         }
 
         /* compile */
-        LY_CHECK_GOTO(rc = lys_compile_type_enums(ctx, parsed, basetype, NULL, substmt->storage), cleanup);
+        rc = lys_compile_type_enums(ctx, (struct lysp_type_enum *)parsed, basetype, NULL,
+                (struct lysc_type_bitenum_item **)substmt->storage);
+        LY_CHECK_GOTO(rc, cleanup);
         break;
 
     case LY_STMT_CONFIG: {
@@ -193,12 +195,12 @@
                 /* default config */
                 flags = LYS_CONFIG_W;
             }
-            memcpy(substmt->storage, &flags, 2);
+            memcpy((void *)substmt->storage, &flags, 2);
         } /* else leave zero */
         break;
     }
     case LY_STMT_MUST: {
-        const struct lysp_restr *restrs = parsed;
+        const struct lysp_restr *restrs = (struct lysp_restr *)parsed;
 
         /* sized array */
         COMPILE_ARRAY_GOTO(ctx, restrs, *(struct lysc_must **)substmt->storage, lys_compile_must, rc, cleanup);
@@ -206,43 +208,44 @@
     }
     case LY_STMT_WHEN: {
         const uint16_t flags;
-        const struct lysp_when *when = parsed;
+        const struct lysp_when *when = (struct lysp_when *)parsed;
 
         /* read compiled status */
         lyplg_ext_get_storage(ext, LY_STMT_STATUS, sizeof flags, (const void **)&flags);
 
         /* compile */
-        LY_CHECK_GOTO(rc = lys_compile_when(ctx, when, flags, NULL, NULL, NULL, substmt->storage), cleanup);
+        LY_CHECK_GOTO(rc = lys_compile_when(ctx, when, flags, NULL, NULL, NULL, (struct lysc_when **)substmt->storage), cleanup);
         break;
     }
     case LY_STMT_FRACTION_DIGITS:
     case LY_STMT_REQUIRE_INSTANCE:
         /* just make a copy */
-        memcpy(substmt->storage, &parsed, 1);
+        memcpy((void *)substmt->storage, &parsed, 1);
         break;
 
     case LY_STMT_MANDATORY:
     case LY_STMT_ORDERED_BY:
     case LY_STMT_STATUS:
         /* just make a copy */
-        memcpy(substmt->storage, &parsed, 2);
+        memcpy((void *)substmt->storage, &parsed, 2);
         break;
 
     case LY_STMT_MAX_ELEMENTS:
     case LY_STMT_MIN_ELEMENTS:
         /* just make a copy */
-        memcpy(substmt->storage, &parsed, 4);
+        memcpy((void *)substmt->storage, &parsed, 4);
         break;
 
     case LY_STMT_POSITION:
     case LY_STMT_VALUE:
         /* just make a copy */
-        memcpy(substmt->storage, &parsed, 8);
+        memcpy((void *)substmt->storage, &parsed, 8);
         break;
 
     case LY_STMT_IDENTITY:
         /* compile */
-        LY_CHECK_GOTO(rc = lys_identity_precompile(ctx, NULL, NULL, parsed, substmt->storage), cleanup);
+        rc = lys_identity_precompile(ctx, NULL, NULL, (struct lysp_ident *)parsed, (struct lysc_ident **)substmt->storage);
+        LY_CHECK_GOTO(rc, cleanup);
         break;
 
     case LY_STMT_LENGTH:
@@ -250,26 +253,29 @@
     /* fallthrough */
     case LY_STMT_RANGE:
         /* compile, use uint64 default range */
-        LY_CHECK_GOTO(rc = lys_compile_type_range(ctx, parsed, LY_TYPE_UINT64, length_restr, 0, NULL, substmt->storage),
-                cleanup);
+        rc = lys_compile_type_range(ctx, (struct lysp_restr *)parsed, LY_TYPE_UINT64, length_restr, 0, NULL,
+                (struct lysc_range **)substmt->storage);
+        LY_CHECK_GOTO(rc, cleanup);
         break;
 
     case LY_STMT_PATTERN:
         /* compile */
-        LY_CHECK_GOTO(rc = lys_compile_type_patterns(ctx, parsed, NULL, substmt->storage), cleanup);
+        rc = lys_compile_type_patterns(ctx, (struct lysp_restr *)parsed, NULL, (struct lysc_pattern ***)substmt->storage);
+        LY_CHECK_GOTO(rc, cleanup);
         break;
 
     case LY_STMT_TYPE: {
         const uint16_t flags;
         const char *units;
-        const struct lysp_type *ptype = parsed;
+        const struct lysp_type *ptype = (struct lysp_type *)parsed;
 
         /* read compiled info */
         lyplg_ext_get_storage(ext, LY_STMT_STATUS, sizeof flags, (const void **)&flags);
         lyplg_ext_get_storage(ext, LY_STMT_UNITS, sizeof units, (const void **)&units);
 
         /* compile */
-        LY_CHECK_GOTO(rc = lys_compile_type(ctx, NULL, flags, ext->def->name, ptype, substmt->storage, &units, NULL), cleanup);
+        rc = lys_compile_type(ctx, NULL, flags, ext->def->name, ptype, (struct lysc_type **)substmt->storage, &units, NULL);
+        LY_CHECK_GOTO(rc, cleanup);
         LY_ATOMIC_INC_BARRIER((*(struct lysc_type **)substmt->storage)->refcount);
         break;
     }
@@ -326,7 +332,7 @@
     LY_ERR rc = LY_SUCCESS;
     LY_ARRAY_COUNT_TYPE u, v;
     enum ly_stmt stmtp;
-    const void *storagep;
+    uint64_t storagep;
     struct ly_set storagep_compiled = {0};
 
     LY_CHECK_ARG_RET(ctx ? ctx->ctx : NULL, ctx, extp, ext, LY_EINVAL);
@@ -336,9 +342,9 @@
 
     LY_ARRAY_FOR(extp->substmts, u) {
         stmtp = extp->substmts[u].stmt;
-        storagep = *(void **)extp->substmts[u].storage;
+        storagep = *(uint64_t *)extp->substmts[u].storage;
 
-        if (!storagep || ly_set_contains(&storagep_compiled, storagep, NULL)) {
+        if (!storagep || ly_set_contains(&storagep_compiled, (void *)storagep, NULL)) {
             /* nothing parsed or already compiled (for example, if it is a linked list of parsed nodes) */
             continue;
         }
@@ -357,7 +363,7 @@
         }
 
         /* compiled */
-        ly_set_add(&storagep_compiled, storagep, 1, NULL);
+        ly_set_add(&storagep_compiled, (void *)storagep, 1, NULL);
     }
 
 cleanup:
@@ -583,12 +589,12 @@
 }
 
 LY_ERR
-lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, const void ***storage_p)
+lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, uint64_t *storage_p)
 {
     LY_ARRAY_COUNT_TYPE u;
     enum ly_stmt match = 0;
 
-    *storage_p = NULL;
+    *storage_p = 0;
 
     if (!(stmt & LY_STMT_NODE_MASK)) {
         /* matching a non-node statement */
@@ -609,14 +615,14 @@
 lyplg_ext_get_storage(const struct lysc_ext_instance *ext, int stmt, uint32_t storage_size, const void **storage)
 {
     LY_ERR rc = LY_SUCCESS;
-    const void **s;
+    uint64_t s;
 
     /* get pointer to the storage, is set even on error */
     rc = lyplg_ext_get_storage_p(ext, stmt, &s);
 
     /* assign */
     if (s) {
-        memcpy(storage, s, storage_size);
+        memcpy(storage, (void *)s, storage_size);
     } else {
         memset(storage, 0, storage_size);
     }
@@ -630,7 +636,7 @@
     LY_ARRAY_COUNT_TYPE u;
     const struct lysp_ext_instance *extp = NULL;
     enum ly_stmt match = 0;
-    const void **s = NULL;
+    uint64_t s = 0;
 
     /* find the parsed ext instance */
     LY_ARRAY_FOR(ext->module->parsed->exts, u) {
@@ -658,7 +664,7 @@
 
     /* assign */
     if (s) {
-        memcpy(storage, s, storage_size);
+        memcpy(storage, (void *)s, storage_size);
     } else {
         memset(storage, 0, storage_size);
     }
diff --git a/src/plugins_exts.h b/src/plugins_exts.h
index de4c9f7..74ce215 100644
--- a/src/plugins_exts.h
+++ b/src/plugins_exts.h
@@ -393,7 +393,7 @@
  */
 struct lysp_ext_substmt {
     enum ly_stmt stmt;  /**< parsed substatement */
-    void *storage;      /**< pointer to the parsed storage of the statement according to the specific
+    uint64_t storage;   /**< (pointer to) the parsed storage of the statement according to the specific
                              lys_ext_substmt::stmt */
 };
 
@@ -426,7 +426,7 @@
  */
 struct lysc_ext_substmt {
     enum ly_stmt stmt;  /**< compiled substatement */
-    void *storage;      /**< pointer to the compiled storage of the statement according to the specific
+    uint64_t storage;   /**< (pointer to) the compiled storage of the statement according to the specific
                              lys_ext_substmt::stmt */
 };
 
diff --git a/src/plugins_exts/metadata.c b/src/plugins_exts/metadata.c
index 9567e07..8b12a04 100644
--- a/src/plugins_exts/metadata.c
+++ b/src/plugins_exts/metadata.c
@@ -79,27 +79,27 @@
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_IF_FEATURE;
-    ext->substmts[0].storage = &ann_pdata->iffeatures;
+    ext->substmts[0].storage = (uint64_t)&ann_pdata->iffeatures;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_UNITS;
-    ext->substmts[1].storage = &ann_pdata->units;
+    ext->substmts[1].storage = (uint64_t)&ann_pdata->units;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_STATUS;
-    ext->substmts[2].storage = &ann_pdata->flags;
+    ext->substmts[2].storage = (uint64_t)&ann_pdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_TYPE;
-    ext->substmts[3].storage = &ann_pdata->type;
+    ext->substmts[3].storage = (uint64_t)&ann_pdata->type;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[4].storage = &ann_pdata->dsc;
+    ext->substmts[4].storage = (uint64_t)&ann_pdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_REFERENCE;
-    ext->substmts[5].storage = &ann_pdata->ref;
+    ext->substmts[5].storage = (uint64_t)&ann_pdata->ref;
 
     if ((r = lyplg_ext_parse_extension_instance(pctx, ext))) {
         return r;
@@ -139,27 +139,27 @@
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_IF_FEATURE;
-    ext->substmts[0].storage = NULL;
+    ext->substmts[0].storage = 0;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_UNITS;
-    ext->substmts[1].storage = &ann_cdata->units;
+    ext->substmts[1].storage = (uint64_t)&ann_cdata->units;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_STATUS;
-    ext->substmts[2].storage = &ann_cdata->flags;
+    ext->substmts[2].storage = (uint64_t)&ann_cdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_TYPE;
-    ext->substmts[3].storage = &ann_cdata->type;
+    ext->substmts[3].storage = (uint64_t)&ann_cdata->type;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[4].storage = &ann_cdata->dsc;
+    ext->substmts[4].storage = (uint64_t)&ann_cdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_REFERENCE;
-    ext->substmts[5].storage = &ann_cdata->ref;
+    ext->substmts[5].storage = (uint64_t)&ann_cdata->ref;
 
     ret = lyplg_ext_compile_extension_instance(cctx, extp, ext);
     return ret;
diff --git a/src/plugins_exts/structure.c b/src/plugins_exts/structure.c
index ee7a52e..9c5a82b 100644
--- a/src/plugins_exts/structure.c
+++ b/src/plugins_exts/structure.c
@@ -90,60 +90,60 @@
     /* parse substatements */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_MUST;
-    ext->substmts[0].storage = &struct_pdata->musts;
+    ext->substmts[0].storage = (uint64_t)&struct_pdata->musts;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_STATUS;
-    ext->substmts[1].storage = &struct_pdata->flags;
+    ext->substmts[1].storage = (uint64_t)&struct_pdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[2].storage = &struct_pdata->dsc;
+    ext->substmts[2].storage = (uint64_t)&struct_pdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_REFERENCE;
-    ext->substmts[3].storage = &struct_pdata->ref;
+    ext->substmts[3].storage = (uint64_t)&struct_pdata->ref;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_TYPEDEF;
-    ext->substmts[4].storage = &struct_pdata->typedefs;
+    ext->substmts[4].storage = (uint64_t)&struct_pdata->typedefs;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_GROUPING;
-    ext->substmts[5].storage = &struct_pdata->groupings;
+    ext->substmts[5].storage = (uint64_t)&struct_pdata->groupings;
 
     /* data-def-stmt */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[6].stmt = LY_STMT_CONTAINER;
-    ext->substmts[6].storage = &struct_pdata->child;
+    ext->substmts[6].storage = (uint64_t)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[7].stmt = LY_STMT_LEAF;
-    ext->substmts[7].storage = &struct_pdata->child;
+    ext->substmts[7].storage = (uint64_t)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
-    ext->substmts[8].storage = &struct_pdata->child;
+    ext->substmts[8].storage = (uint64_t)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[9].stmt = LY_STMT_LIST;
-    ext->substmts[9].storage = &struct_pdata->child;
+    ext->substmts[9].storage = (uint64_t)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[10].stmt = LY_STMT_CHOICE;
-    ext->substmts[10].storage = &struct_pdata->child;
+    ext->substmts[10].storage = (uint64_t)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[11].stmt = LY_STMT_ANYDATA;
-    ext->substmts[11].storage = &struct_pdata->child;
+    ext->substmts[11].storage = (uint64_t)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[12].stmt = LY_STMT_ANYXML;
-    ext->substmts[12].storage = &struct_pdata->child;
+    ext->substmts[12].storage = (uint64_t)&struct_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[13].stmt = LY_STMT_USES;
-    ext->substmts[13].storage = &struct_pdata->child;
+    ext->substmts[13].storage = (uint64_t)&struct_pdata->child;
 
     rc = lyplg_ext_parse_extension_instance(pctx, ext);
     return rc;
@@ -190,60 +190,60 @@
     LY_ARRAY_CREATE_GOTO(cctx->ctx, ext->substmts, 14, rc, emem);
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_MUST;
-    ext->substmts[0].storage = &struct_cdata->musts;
+    ext->substmts[0].storage = (uint64_t)&struct_cdata->musts;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_STATUS;
-    ext->substmts[1].storage = &struct_cdata->flags;
+    ext->substmts[1].storage = (uint64_t)&struct_cdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[2].storage = &struct_cdata->dsc;
+    ext->substmts[2].storage = (uint64_t)&struct_cdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_REFERENCE;
-    ext->substmts[3].storage = &struct_cdata->ref;
+    ext->substmts[3].storage = (uint64_t)&struct_cdata->ref;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_TYPEDEF;
-    ext->substmts[4].storage = NULL;
+    ext->substmts[4].storage = 0;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_GROUPING;
-    ext->substmts[5].storage = NULL;
+    ext->substmts[5].storage = 0;
 
     /* data-def-stmt */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[6].stmt = LY_STMT_CONTAINER;
-    ext->substmts[6].storage = &struct_cdata->child;
+    ext->substmts[6].storage = (uint64_t)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[7].stmt = LY_STMT_LEAF;
-    ext->substmts[7].storage = &struct_cdata->child;
+    ext->substmts[7].storage = (uint64_t)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
-    ext->substmts[8].storage = &struct_cdata->child;
+    ext->substmts[8].storage = (uint64_t)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[9].stmt = LY_STMT_LIST;
-    ext->substmts[9].storage = &struct_cdata->child;
+    ext->substmts[9].storage = (uint64_t)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[10].stmt = LY_STMT_CHOICE;
-    ext->substmts[10].storage = &struct_cdata->child;
+    ext->substmts[10].storage = (uint64_t)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[11].stmt = LY_STMT_ANYDATA;
-    ext->substmts[11].storage = &struct_cdata->child;
+    ext->substmts[11].storage = (uint64_t)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[12].stmt = LY_STMT_ANYXML;
-    ext->substmts[12].storage = &struct_cdata->child;
+    ext->substmts[12].storage = (uint64_t)&struct_cdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[13].stmt = LY_STMT_USES;
-    ext->substmts[13].storage = &struct_cdata->child;
+    ext->substmts[13].storage = (uint64_t)&struct_cdata->child;
 
     *lyplg_ext_compile_get_options(cctx) |= LYS_COMPILE_NO_CONFIG | LYS_COMPILE_NO_DISABLED;
     rc = lyplg_ext_compile_extension_instance(cctx, extp, ext);
@@ -339,53 +339,53 @@
     /* parse substatements */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_STATUS;
-    ext->substmts[0].storage = &aug_pdata->flags;
+    ext->substmts[0].storage = (uint64_t)&aug_pdata->flags;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_DESCRIPTION;
-    ext->substmts[1].storage = &aug_pdata->dsc;
+    ext->substmts[1].storage = (uint64_t)&aug_pdata->dsc;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_REFERENCE;
-    ext->substmts[2].storage = &aug_pdata->ref;
+    ext->substmts[2].storage = (uint64_t)&aug_pdata->ref;
 
     /* data-def-stmt */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[3].stmt = LY_STMT_CONTAINER;
-    ext->substmts[3].storage = &aug_pdata->child;
+    ext->substmts[3].storage = (uint64_t)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[4].stmt = LY_STMT_LEAF;
-    ext->substmts[4].storage = &aug_pdata->child;
+    ext->substmts[4].storage = (uint64_t)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[5].stmt = LY_STMT_LEAF_LIST;
-    ext->substmts[5].storage = &aug_pdata->child;
+    ext->substmts[5].storage = (uint64_t)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[6].stmt = LY_STMT_LIST;
-    ext->substmts[6].storage = &aug_pdata->child;
+    ext->substmts[6].storage = (uint64_t)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[7].stmt = LY_STMT_CHOICE;
-    ext->substmts[7].storage = &aug_pdata->child;
+    ext->substmts[7].storage = (uint64_t)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[8].stmt = LY_STMT_ANYDATA;
-    ext->substmts[8].storage = &aug_pdata->child;
+    ext->substmts[8].storage = (uint64_t)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[9].stmt = LY_STMT_ANYXML;
-    ext->substmts[9].storage = &aug_pdata->child;
+    ext->substmts[9].storage = (uint64_t)&aug_pdata->child;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[10].stmt = LY_STMT_USES;
-    ext->substmts[10].storage = &aug_pdata->child;
+    ext->substmts[10].storage = (uint64_t)&aug_pdata->child;
 
     /* case */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[11].stmt = LY_STMT_CASE;
-    ext->substmts[11].storage = &aug_pdata->child;
+    ext->substmts[11].storage = (uint64_t)&aug_pdata->child;
 
     if ((rc = lyplg_ext_parse_extension_instance(pctx, ext))) {
         return rc;
@@ -394,7 +394,7 @@
     /* add fake parsed augment node */
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[12].stmt = LY_STMT_AUGMENT;
-    ext->substmts[12].storage = &aug_pdata->aug;
+    ext->substmts[12].storage = (uint64_t)&aug_pdata->aug;
 
     aug_pdata->aug = calloc(1, sizeof *aug_pdata->aug);
     if (!aug_pdata->aug) {
@@ -476,7 +476,7 @@
 
     assert(ctx);
 
-    aug = ext->substmts[12].storage;
+    aug = (struct lysp_node_augment **)ext->substmts[12].storage;
     rc = lyplg_ext_sprinter_ptree_add_nodes(ctx, (*aug)->child, structure_sprinter_pnode);
 
     return rc;
diff --git a/src/plugins_exts/yangdata.c b/src/plugins_exts/yangdata.c
index 0c8f37b..a07ef23 100644
--- a/src/plugins_exts/yangdata.c
+++ b/src/plugins_exts/yangdata.c
@@ -58,15 +58,15 @@
     LY_ARRAY_CREATE_GOTO(lyplg_ext_parse_get_cur_pmod(pctx)->mod->ctx, ext->substmts, 3, ret, emem);
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_CONTAINER;
-    ext->substmts[0].storage = &ext->parsed;
+    ext->substmts[0].storage = (uint64_t)&ext->parsed;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_CHOICE;
-    ext->substmts[1].storage = &ext->parsed;
+    ext->substmts[1].storage = (uint64_t)&ext->parsed;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_USES;
-    ext->substmts[2].storage = &ext->parsed;
+    ext->substmts[2].storage = (uint64_t)&ext->parsed;
 
     if ((ret = lyplg_ext_parse_extension_instance(pctx, ext))) {
         return ret;
@@ -96,15 +96,15 @@
     LY_ARRAY_CREATE_GOTO(cctx->ctx, ext->substmts, 3, ret, emem);
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[0].stmt = LY_STMT_CONTAINER;
-    ext->substmts[0].storage = &ext->compiled;
+    ext->substmts[0].storage = (uint64_t)&ext->compiled;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[1].stmt = LY_STMT_CHOICE;
-    ext->substmts[1].storage = &ext->compiled;
+    ext->substmts[1].storage = (uint64_t)&ext->compiled;
 
     LY_ARRAY_INCREMENT(ext->substmts);
     ext->substmts[2].stmt = LY_STMT_USES;
-    ext->substmts[2].storage = &ext->compiled;
+    ext->substmts[2].storage = (uint64_t)&ext->compiled;
 
     *lyplg_ext_compile_get_options(cctx) |= LYS_COMPILE_NO_CONFIG | LYS_COMPILE_NO_DISABLED;
     ret = lyplg_ext_compile_extension_instance(cctx, extp, ext);
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 9327561..a627799 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -2585,7 +2585,7 @@
         struct lysc_node **list;
 
         if (ctx->ext) {
-            lyplg_ext_get_storage_p(ctx->ext, LY_STMT_DATA_NODE_MASK, (const void ***)&list);
+            lyplg_ext_get_storage_p(ctx->ext, LY_STMT_DATA_NODE_MASK, (uint64_t *)&list);
         } else if (node->nodetype == LYS_RPC) {
             list = (struct lysc_node **)&ctx->cur_mod->compiled->rpcs;
         } else if (node->nodetype == LYS_NOTIF) {
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index 10b1c6c..145ae8f 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -1520,7 +1520,7 @@
 
         case LY_STMT_TYPE: {
             /* single type */
-            struct lysp_type **type_p = substmts[u].storage;
+            struct lysp_type **type_p = (void *)substmts[u].storage;
 
             lysp_type_free(&fctx, *type_p);
             free(*type_p);
@@ -1635,7 +1635,7 @@
         }
         case LY_STMT_WHEN:
             /* single item, expects a pointer */
-            lysc_when_free(&fctx, substmts[u].storage);
+            lysc_when_free(&fctx, (struct lysc_when **)substmts[u].storage);
             break;
 
         case LY_STMT_PATTERN: {
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index fecccf5..d3e399c 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -730,7 +730,7 @@
  * @return LY_SUCCESS on success.
  * @return LY_ENOT if the substatement is not supported.
  */
-LY_ERR lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, const void ***storage_p);
+LY_ERR lyplg_ext_get_storage_p(const struct lysc_ext_instance *ext, int stmt, uint64_t *storage_p);
 
 /**
  * @brief Warning if the filename does not match the expected module name and version