@@ -177,19 +177,21 @@ lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, const void *parsed, struct l
177177 break ;
178178
179179 case LY_STMT_CONFIG : {
180- const uint16_t flags = ( uintptr_t ) parsed ;
180+ uint16_t flags ;
181181
182182 if (!(ctx -> compile_opts & LYS_COMPILE_NO_CONFIG )) {
183+ memcpy (& flags , & parsed , 2 );
183184 if (flags & LYS_CONFIG_MASK ) {
184185 /* explicitly set */
185- * ( uint16_t * ) substmt -> storage = flags | LYS_SET_CONFIG ;
186+ flags |= LYS_SET_CONFIG ;
186187 } else if (ext -> parent_stmt & LY_STMT_DATA_NODE_MASK ) {
187188 /* inherit */
188- * ( uint16_t * ) substmt -> storage = ((struct lysc_node * )ext -> parent )-> flags & LYS_CONFIG_MASK ;
189+ flags = ((struct lysc_node * )ext -> parent )-> flags & LYS_CONFIG_MASK ;
189190 } else {
190191 /* default config */
191- * ( uint16_t * ) substmt -> storage = LYS_CONFIG_W ;
192+ flags = LYS_CONFIG_W ;
192193 }
194+ memcpy (substmt -> storage , & flags , 2 );
193195 } /* else leave zero */
194196 break ;
195197 }
@@ -214,26 +216,26 @@ lys_compile_ext_instance_stmt(struct lysc_ctx *ctx, const void *parsed, struct l
214216 case LY_STMT_FRACTION_DIGITS :
215217 case LY_STMT_REQUIRE_INSTANCE :
216218 /* just make a copy */
217- * ( uint8_t * ) substmt -> storage = ( uintptr_t ) parsed ;
219+ memcpy ( substmt -> storage , & parsed , 1 ) ;
218220 break ;
219221
220222 case LY_STMT_MANDATORY :
221223 case LY_STMT_ORDERED_BY :
222224 case LY_STMT_STATUS :
223225 /* just make a copy */
224- * ( uint16_t * ) substmt -> storage = ( uintptr_t ) parsed ;
226+ memcpy ( substmt -> storage , & parsed , 2 ) ;
225227 break ;
226228
227229 case LY_STMT_MAX_ELEMENTS :
228230 case LY_STMT_MIN_ELEMENTS :
229231 /* just make a copy */
230- * ( uint32_t * ) substmt -> storage = ( uintptr_t ) parsed ;
232+ memcpy ( substmt -> storage , & parsed , 4 ) ;
231233 break ;
232234
233235 case LY_STMT_POSITION :
234236 case LY_STMT_VALUE :
235237 /* just make a copy */
236- * ( int64_t * ) substmt -> storage = ( uintptr_t ) parsed ;
238+ memcpy ( substmt -> storage , & parsed , 8 ) ;
237239 break ;
238240
239241 case LY_STMT_IDENTITY :
0 commit comments