constness fixes, round-trip and fuzz-testing for CHOICE
diff --git a/asn1c/unber.c b/asn1c/unber.c
index b2fec49..a344921 100644
--- a/asn1c/unber.c
+++ b/asn1c/unber.c
@@ -771,10 +771,10 @@
  * Dummy functions.
  */
 asn_dec_rval_t
-ber_check_tags(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-               asn_struct_ctx_t *opt_ctx, const void *ptr, size_t size,
-               int tag_mode, int last_tag_form, ber_tlv_len_t *last_length,
-               int *opt_tlv_form) {
+ber_check_tags(const asn_codec_ctx_t *opt_codec_ctx,
+               const asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx,
+               const void *ptr, size_t size, int tag_mode, int last_tag_form,
+               ber_tlv_len_t *last_length, int *opt_tlv_form) {
     asn_dec_rval_t rv = {0, 0};
     (void)opt_codec_ctx;
     (void)td;
@@ -789,7 +789,7 @@
 }
 
 ssize_t
-der_write_tags(asn_TYPE_descriptor_t *td, size_t slen, int tag_mode,
+der_write_tags(const asn_TYPE_descriptor_t *td, size_t slen, int tag_mode,
                int last_tag_form, ber_tlv_tag_t tag,
                asn_app_consume_bytes_f *cb, void *app_key) {
     (void)td;
diff --git a/skeletons/ANY.c b/skeletons/ANY.c
index 396093f..b370f53 100644
--- a/skeletons/ANY.c
+++ b/skeletons/ANY.c
@@ -55,11 +55,10 @@
     } while(0)
 
 asn_enc_rval_t
-ANY_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-
-	if(flags & XER_F_CANONICAL) {
+ANY_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+               enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+               void *app_key) {
+    if(flags & XER_F_CANONICAL) {
 		/*
 		 * Canonical XER-encoding of ANY type is not supported.
 		 */
@@ -183,7 +182,8 @@
 #ifndef ASN_DISABLE_PER_SUPPORT
 
 asn_dec_rval_t
-ANY_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+ANY_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                const asn_TYPE_descriptor_t *td,
                 const asn_per_constraints_t *constraints, void **sptr,
                 asn_per_data_t *pd) {
     const asn_OCTET_STRING_specifics_t *specs =
@@ -240,8 +240,8 @@
 }
 
 asn_enc_rval_t
-ANY_encode_uper(asn_TYPE_descriptor_t *td,
-                const asn_per_constraints_t *constraints, void *sptr,
+ANY_encode_uper(const asn_TYPE_descriptor_t *td,
+                const asn_per_constraints_t *constraints, const void *sptr,
                 asn_per_outp_t *po) {
     const ANY_t *st = (const ANY_t *)sptr;
     asn_enc_rval_t er = {0, 0, 0};
diff --git a/skeletons/ANY.h b/skeletons/ANY.h
index 7d5f369..70d42a9 100644
--- a/skeletons/ANY.h
+++ b/skeletons/ANY.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef ASN_TYPE_ANY_H
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c
index 69e7bc7..1a76f47 100644
--- a/skeletons/BIT_STRING.c
+++ b/skeletons/BIT_STRING.c
@@ -61,9 +61,9 @@
  * BIT STRING generic constraint.
  */
 int
-BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
+BIT_STRING_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 
 	if(st && st->buf) {
 		if((st->size == 0 && st->bits_unused)
@@ -89,10 +89,10 @@
 };
 
 asn_enc_rval_t
-BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t er;
+BIT_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      int ilevel, enum xer_encoder_flags_e flags,
+                      asn_app_consume_bytes_f *cb, void *app_key) {
+    asn_enc_rval_t er;
 	char scratch[128];
 	char *p = scratch;
 	char *scend = scratch + (sizeof(scratch) - 10);
@@ -151,9 +151,9 @@
  * BIT STRING specific contents printer.
  */
 int
-BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const char * const h2c = "0123456789ABCDEF";
+BIT_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                 asn_app_consume_bytes_f *cb, void *app_key) {
+    const char * const h2c = "0123456789ABCDEF";
 	char scratch[64];
 	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 	uint8_t *buf;
@@ -316,9 +316,9 @@
 
 asn_dec_rval_t
 BIT_STRING_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
-                         asn_TYPE_descriptor_t *td,
-                         const asn_per_constraints_t *constraints, void **sptr,
-                         asn_per_data_t *pd) {
+                       const asn_TYPE_descriptor_t *td,
+                       const asn_per_constraints_t *constraints, void **sptr,
+                       asn_per_data_t *pd) {
     const asn_OCTET_STRING_specifics_t *specs = td->specifics
 		? (const asn_OCTET_STRING_specifics_t *)td->specifics
 		: &asn_SPC_BIT_STRING_specs;
@@ -419,9 +419,9 @@
 }
 
 asn_enc_rval_t
-BIT_STRING_encode_uper(asn_TYPE_descriptor_t *td,
-                         const asn_per_constraints_t *constraints, void *sptr,
-                         asn_per_outp_t *po) {
+BIT_STRING_encode_uper(const asn_TYPE_descriptor_t *td,
+                       const asn_per_constraints_t *constraints,
+                       const void *sptr, asn_per_outp_t *po) {
     const asn_OCTET_STRING_specifics_t *specs =
         td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
                       : &asn_SPC_BIT_STRING_specs;
@@ -573,8 +573,7 @@
         0, sizeof(lengths) / sizeof(lengths[0]) - 1)];
     if(!constraints) constraints = &td->encoding_constraints;
     if(constraints->per_constraints) {
-        const asn_per_constraint_t *pc =
-            &td->encoding_constraints.per_constraints->size;
+        const asn_per_constraint_t *pc = &constraints->per_constraints->size;
         if(pc->flags & APC_CONSTRAINED) {
             long suggested_upper_bound = pc->upper_bound < (ssize_t)max_length
                                              ? pc->upper_bound
diff --git a/skeletons/BIT_STRING.h b/skeletons/BIT_STRING.h
index ce3be19..bd2d23d 100644
--- a/skeletons/BIT_STRING.h
+++ b/skeletons/BIT_STRING.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_BIT_STRING_H_
diff --git a/skeletons/BIT_STRING_oer.c b/skeletons/BIT_STRING_oer.c
index b18e27f..a5f289c 100644
--- a/skeletons/BIT_STRING_oer.c
+++ b/skeletons/BIT_STRING_oer.c
@@ -10,7 +10,8 @@
 #include <errno.h>
 
 asn_dec_rval_t
-BIT_STRING_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+BIT_STRING_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
+                      const asn_TYPE_descriptor_t *td,
                       const asn_oer_constraints_t *constraints, void **sptr,
                       const void *ptr, size_t size) {
     BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
@@ -89,10 +90,11 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-BIT_STRING_encode_oer(asn_TYPE_descriptor_t *td,
-                        const asn_oer_constraints_t *constraints, void *sptr,
-                        asn_app_consume_bytes_f *cb, void *app_key) {
-    BIT_STRING_t *st = (BIT_STRING_t *)sptr;
+BIT_STRING_encode_oer(const asn_TYPE_descriptor_t *td,
+                      const asn_oer_constraints_t *constraints,
+                      const void *sptr, asn_app_consume_bytes_f *cb,
+                      void *app_key) {
+    const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
     asn_enc_rval_t erval = {0, 0, 0};
     const asn_oer_constraints_t *cts =
         constraints ? constraints : td->encoding_constraints.oer_constraints;
diff --git a/skeletons/BMPString.c b/skeletons/BMPString.c
index 8fa583b..e9958ff 100644
--- a/skeletons/BMPString.c
+++ b/skeletons/BMPString.c
@@ -64,9 +64,8 @@
 };
 
 int
-BMPString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-                           asn_app_constraint_failed_f *ctfailcb,
-                           void *app_key) {
+BMPString_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                     asn_app_constraint_failed_f *ctfailcb, void *app_key) {
     const BMPString_t *st = (const BMPString_t *)sptr;
 
     if(st && st->buf) {
@@ -128,9 +127,9 @@
 
 asn_dec_rval_t
 BMPString_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr,
-		const char *opt_mname, const void *buf_ptr, size_t size) {
-	asn_dec_rval_t rc;
+                     const asn_TYPE_descriptor_t *td, void **sptr,
+                     const char *opt_mname, const void *buf_ptr, size_t size) {
+    asn_dec_rval_t rc;
 
 	rc = OCTET_STRING_decode_xer_utf8(opt_codec_ctx, td, sptr, opt_mname,
 		buf_ptr, size);
@@ -193,10 +192,10 @@
 }
 
 asn_enc_rval_t
-BMPString_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const BMPString_t *st = (const BMPString_t *)sptr;
+BMPString_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                     int ilevel, enum xer_encoder_flags_e flags,
+                     asn_app_consume_bytes_f *cb, void *app_key) {
+    const BMPString_t *st = (const BMPString_t *)sptr;
 	asn_enc_rval_t er;
 
 	(void)ilevel;
@@ -212,9 +211,9 @@
 }
 
 int
-BMPString_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const BMPString_t *st = (const BMPString_t *)sptr;
+BMPString_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                asn_app_consume_bytes_f *cb, void *app_key) {
+    const BMPString_t *st = (const BMPString_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
diff --git a/skeletons/BMPString.h b/skeletons/BMPString.h
index f465797..b3be163 100644
--- a/skeletons/BMPString.h
+++ b/skeletons/BMPString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_BMPString_H_
diff --git a/skeletons/BOOLEAN.c b/skeletons/BOOLEAN.c
index 8102d04..3da5a6b 100644
--- a/skeletons/BOOLEAN.c
+++ b/skeletons/BOOLEAN.c
@@ -55,10 +55,9 @@
  */
 asn_dec_rval_t
 BOOLEAN_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
-		asn_TYPE_descriptor_t *td,
-		void **bool_value, const void *buf_ptr, size_t size,
-		int tag_mode) {
-	BOOLEAN_t *st = (BOOLEAN_t *)*bool_value;
+                   const asn_TYPE_descriptor_t *td, void **bool_value,
+                   const void *buf_ptr, size_t size, int tag_mode) {
+    BOOLEAN_t *st = (BOOLEAN_t *)*bool_value;
 	asn_dec_rval_t rval;
 	ber_tlv_len_t length;
 	ber_tlv_len_t lidx;
@@ -117,13 +116,13 @@
 }
 
 asn_enc_rval_t
-BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t erval;
-	BOOLEAN_t *st = (BOOLEAN_t *)sptr;
+BOOLEAN_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                   int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb,
+                   void *app_key) {
+    asn_enc_rval_t erval;
+    const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
 
-	erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key);
+    erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key);
 	if(erval.encoded == -1) {
 		erval.failed_type = td;
 		erval.structure_ptr = sptr;
@@ -153,8 +152,9 @@
  * Decode the chunk of XML text encoding INTEGER.
  */
 static enum xer_pbd_rval
-BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
-	BOOLEAN_t *st = (BOOLEAN_t *)sptr;
+BOOLEAN__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
+                         const void *chunk_buf, size_t chunk_size) {
+    BOOLEAN_t *st = (BOOLEAN_t *)sptr;
 	const char *p = (const char *)chunk_buf;
 
 	(void)td;
@@ -184,16 +184,15 @@
 
 asn_dec_rval_t
 BOOLEAN_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-
-	return xer_decode_primitive(opt_codec_ctx, td,
+                   const asn_TYPE_descriptor_t *td, void **sptr,
+                   const char *opt_mname, const void *buf_ptr, size_t size) {
+    return xer_decode_primitive(opt_codec_ctx, td,
 		sptr, sizeof(BOOLEAN_t), opt_mname, buf_ptr, size,
 		BOOLEAN__xer_body_decode);
 }
 
 asn_enc_rval_t
-BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
+BOOLEAN_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
 	int ilevel, enum xer_encoder_flags_e flags,
 		asn_app_consume_bytes_f *cb, void *app_key) {
 	const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
@@ -216,9 +215,9 @@
 }
 
 int
-BOOLEAN_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
+BOOLEAN_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+              asn_app_consume_bytes_f *cb, void *app_key) {
+    const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
 	const char *buf;
 	size_t buflen;
 
@@ -261,7 +260,8 @@
 #ifndef ASN_DISABLE_PER_SUPPORT
 
 asn_dec_rval_t
-BOOLEAN_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+BOOLEAN_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                    const asn_TYPE_descriptor_t *td,
                     const asn_per_constraints_t *constraints, void **sptr,
                     asn_per_data_t *pd) {
     asn_dec_rval_t rv;
@@ -294,8 +294,8 @@
 
 
 asn_enc_rval_t
-BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td,
-                    const asn_per_constraints_t *constraints, void *sptr,
+BOOLEAN_encode_uper(const asn_TYPE_descriptor_t *td,
+                    const asn_per_constraints_t *constraints, const void *sptr,
                     asn_per_outp_t *po) {
     const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
 	asn_enc_rval_t er = { 0, 0, 0 };
@@ -318,8 +318,8 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-BOOLEAN_encode_oer(asn_TYPE_descriptor_t *td,
-                   const asn_oer_constraints_t *constraints, void *sptr,
+BOOLEAN_encode_oer(const asn_TYPE_descriptor_t *td,
+                   const asn_oer_constraints_t *constraints, const void *sptr,
                    asn_app_consume_bytes_f *cb, void *app_key) {
     asn_enc_rval_t er = { 1, 0, 0 };
     const BOOLEAN_t *st = sptr;
@@ -337,9 +337,9 @@
 
 asn_dec_rval_t
 BOOLEAN_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
-                        asn_TYPE_descriptor_t *td,
-                        const asn_oer_constraints_t *constraints, void **sptr,
-                        const void *ptr, size_t size) {
+                   const asn_TYPE_descriptor_t *td,
+                   const asn_oer_constraints_t *constraints, void **sptr,
+                   const void *ptr, size_t size) {
     asn_dec_rval_t ok = {RC_OK, 1};
     BOOLEAN_t *st;
 
diff --git a/skeletons/BOOLEAN.h b/skeletons/BOOLEAN.h
index bdf6ce0..7e6b8fb 100644
--- a/skeletons/BOOLEAN.h
+++ b/skeletons/BOOLEAN.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_BOOLEAN_H_
diff --git a/skeletons/ENUMERATED.c b/skeletons/ENUMERATED.c
index b4134bb..c5c197e 100644
--- a/skeletons/ENUMERATED.c
+++ b/skeletons/ENUMERATED.c
@@ -57,7 +57,7 @@
 
 asn_dec_rval_t
 ENUMERATED_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
-                      asn_TYPE_descriptor_t *td,
+                      const asn_TYPE_descriptor_t *td,
                       const asn_oer_constraints_t *constraints, void **sptr,
                       const void *ptr, size_t size) {
     asn_dec_rval_t rval;
@@ -81,10 +81,11 @@
 }
 
 asn_enc_rval_t
-ENUMERATED_encode_oer(asn_TYPE_descriptor_t *td,
-                      const asn_oer_constraints_t *constraints, void *sptr,
-                      asn_app_consume_bytes_f *cb, void *app_key) {
-    ENUMERATED_t *st = (ENUMERATED_t *)sptr;
+ENUMERATED_encode_oer(const asn_TYPE_descriptor_t *td,
+                      const asn_oer_constraints_t *constraints,
+                      const void *sptr, asn_app_consume_bytes_f *cb,
+                      void *app_key) {
+    const ENUMERATED_t *st = sptr;
 	long value;
 
 	if(asn_INTEGER2long(st, &value)) {
@@ -100,7 +101,7 @@
 
 asn_dec_rval_t
 ENUMERATED_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
-                       asn_TYPE_descriptor_t *td,
+                       const asn_TYPE_descriptor_t *td,
                        const asn_per_constraints_t *constraints, void **sptr,
                        asn_per_data_t *pd) {
     asn_dec_rval_t rval;
@@ -124,10 +125,10 @@
 }
 
 asn_enc_rval_t
-ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td,
-                       const asn_per_constraints_t *constraints, void *sptr,
-                       asn_per_outp_t *po) {
-    ENUMERATED_t *st = (ENUMERATED_t *)sptr;
+ENUMERATED_encode_uper(const asn_TYPE_descriptor_t *td,
+                       const asn_per_constraints_t *constraints,
+                       const void *sptr, asn_per_outp_t *po) {
+    const ENUMERATED_t *st = (const ENUMERATED_t *)sptr;
     long value;
 
     if(asn_INTEGER2long(st, &value)) {
diff --git a/skeletons/ENUMERATED.h b/skeletons/ENUMERATED.h
index 14ed8bb..5bb6a2e 100644
--- a/skeletons/ENUMERATED.h
+++ b/skeletons/ENUMERATED.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_ENUMERATED_H_
diff --git a/skeletons/GeneralString.h b/skeletons/GeneralString.h
index 55b994f..074c364 100644
--- a/skeletons/GeneralString.h
+++ b/skeletons/GeneralString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_GeneralString_H_
diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c
index 365ef19..b2d0603 100644
--- a/skeletons/GeneralizedTime.c
+++ b/skeletons/GeneralizedTime.c
@@ -219,9 +219,10 @@
  * Check that the time looks like the time.
  */
 int
-GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr;
+GeneralizedTime_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                           asn_app_constraint_failed_f *ctfailcb,
+                           void *app_key) {
+    const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr;
 	time_t tloc;
 
 	errno = EPERM;			/* Just an unlikely error code */
@@ -237,10 +238,10 @@
 }
 
 asn_enc_rval_t
-GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	GeneralizedTime_t *st = (GeneralizedTime_t *)sptr;
+GeneralizedTime_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                           int tag_mode, ber_tlv_tag_t tag,
+                           asn_app_consume_bytes_f *cb, void *app_key) {
+    GeneralizedTime_t *st;
 	asn_enc_rval_t erval;
 	int fv, fd;	/* seconds fraction value and number of digits */
 	struct tm tm;
@@ -249,38 +250,38 @@
 	/*
 	 * Encode as a canonical DER.
 	 */
-	errno = EPERM;
-	tloc = asn_GT2time_frac(st, &fv, &fd, &tm, 1);	/* Recognize time */
-	if(tloc == -1 && errno != EPERM)
-		/* Failed to recognize time. Fail completely. */
+    errno = EPERM;
+    tloc = asn_GT2time_frac((const GeneralizedTime_t *)sptr, &fv, &fd, &tm,
+                            1); /* Recognize time */
+    if(tloc == -1 && errno != EPERM) {
+        /* Failed to recognize time. Fail completely. */
 		ASN__ENCODE_FAILED;
+    }
 
-	st = asn_time2GT_frac(0, &tm, fv, fd, 1); /* Save time canonically */
-	if(!st) ASN__ENCODE_FAILED;	/* Memory allocation failure. */
+    st = asn_time2GT_frac(0, &tm, fv, fd, 1); /* Save time canonically */
+    if(!st) ASN__ENCODE_FAILED;               /* Memory allocation failure. */
 
-	erval = OCTET_STRING_encode_der(td, st, tag_mode, tag, cb, app_key);
+    erval = OCTET_STRING_encode_der(td, st, tag_mode, tag, cb, app_key);
 
-	FREEMEM(st->buf);
-	FREEMEM(st);
+    ASN_STRUCT_FREE(*td, st);
 
-	return erval;
+    return erval;
 }
 
 #ifndef	ASN___INTERNAL_TEST_MODE
 
 asn_enc_rval_t
-GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-
-	if(flags & XER_F_CANONICAL) {
+GeneralizedTime_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                           int ilevel, enum xer_encoder_flags_e flags,
+                           asn_app_consume_bytes_f *cb, void *app_key) {
+    if(flags & XER_F_CANONICAL) {
 		GeneralizedTime_t *gt;
 		asn_enc_rval_t rv;
 		int fv, fd;		/* fractional parts */
 		struct tm tm;
 
 		errno = EPERM;
-		if(asn_GT2time_frac((GeneralizedTime_t *)sptr,
+		if(asn_GT2time_frac((const GeneralizedTime_t *)sptr,
 					&fv, &fd, &tm, 1) == -1
 				&& errno != EPERM)
 			ASN__ENCODE_FAILED;
@@ -301,9 +302,9 @@
 #endif	/* ASN___INTERNAL_TEST_MODE */
 
 int
-GeneralizedTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr;
+GeneralizedTime_print(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+    const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
diff --git a/skeletons/GeneralizedTime.h b/skeletons/GeneralizedTime.h
index 92f0029..c4e5c56 100644
--- a/skeletons/GeneralizedTime.h
+++ b/skeletons/GeneralizedTime.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_GeneralizedTime_H_
diff --git a/skeletons/GraphicString.h b/skeletons/GraphicString.h
index 420521d..82b1929 100644
--- a/skeletons/GraphicString.h
+++ b/skeletons/GraphicString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_GraphicString_H_
diff --git a/skeletons/IA5String.c b/skeletons/IA5String.c
index 6530ba3..4397041 100644
--- a/skeletons/IA5String.c
+++ b/skeletons/IA5String.c
@@ -58,9 +58,9 @@
 };
 
 int
-IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const IA5String_t *st = (const IA5String_t *)sptr;
+IA5String_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                     asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    const IA5String_t *st = (const IA5String_t *)sptr;
 
 	if(st && st->buf) {
 		uint8_t *buf = st->buf;
diff --git a/skeletons/IA5String.h b/skeletons/IA5String.h
index fa9f7ac..5a4d5f2 100644
--- a/skeletons/IA5String.h
+++ b/skeletons/IA5String.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_IA5String_H_
diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c
index 3257cf7..b1103ad 100644
--- a/skeletons/INTEGER.c
+++ b/skeletons/INTEGER.c
@@ -56,10 +56,12 @@
  * Encode INTEGER type using DER.
  */
 asn_enc_rval_t
-INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	INTEGER_t *st = (INTEGER_t *)sptr;
+INTEGER_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                   int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb,
+                   void *app_key) {
+    const INTEGER_t *st = (const INTEGER_t *)sptr;
+    asn_enc_rval_t rval;
+    INTEGER_t effective_integer;
 
 	ASN_DEBUG("%s %s as INTEGER (tm=%d)",
 		cb?"Encoding":"Estimating", td->name, tag_mode);
@@ -96,19 +98,23 @@
 		/* Remove leading superfluous bytes from the integer */
 		shift = buf - st->buf;
 		if(shift) {
-			uint8_t *nb = st->buf;
-			uint8_t *end;
+            union {
+                const uint8_t *c_buf;
+                uint8_t *nc_buf;
+            } unconst;
+            unconst.c_buf = st->buf;
+            effective_integer.buf = unconst.nc_buf + shift;
+            effective_integer.size = st->size - shift;
 
-			st->size -= shift;	/* New size, minus bad bytes */
-			end = nb + st->size;
+            st = &effective_integer;
+        }
+    }
 
-			for(; nb < end; nb++, buf++)
-				*nb = *buf;
-		}
-
-	} /* if(1) */
-
-	return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key);
+	rval = der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key);
+    if(rval.structure_ptr == &effective_integer) {
+        rval.structure_ptr = sptr;
+    }
+    return rval;
 }
 
 static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(
@@ -194,12 +200,11 @@
  * INTEGER specific human-readable output.
  */
 int
-INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const INTEGER_t *st = (const INTEGER_t *)sptr;
+INTEGER_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+              asn_app_consume_bytes_f *cb, void *app_key) {
+    const INTEGER_t *st = (const INTEGER_t *)sptr;
 	ssize_t ret;
 
-	(void)td;
 	(void)ilevel;
 
 	if(!st || !st->buf)
@@ -311,8 +316,9 @@
  * Decode the chunk of XML text encoding INTEGER.
  */
 static enum xer_pbd_rval
-INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
-	INTEGER_t *st = (INTEGER_t *)sptr;
+INTEGER__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
+                         const void *chunk_buf, size_t chunk_size) {
+    INTEGER_t *st = (INTEGER_t *)sptr;
 	intmax_t dec_value;
 	intmax_t hex_value = 0;
 	const char *lp;
@@ -543,19 +549,18 @@
 
 asn_dec_rval_t
 INTEGER_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-
-	return xer_decode_primitive(opt_codec_ctx, td,
+                   const asn_TYPE_descriptor_t *td, void **sptr,
+                   const char *opt_mname, const void *buf_ptr, size_t size) {
+    return xer_decode_primitive(opt_codec_ctx, td,
 		sptr, sizeof(INTEGER_t), opt_mname,
 		buf_ptr, size, INTEGER__xer_body_decode);
 }
 
 asn_enc_rval_t
-INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const INTEGER_t *st = (const INTEGER_t *)sptr;
+INTEGER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                   int ilevel, enum xer_encoder_flags_e flags,
+                   asn_app_consume_bytes_f *cb, void *app_key) {
+    const INTEGER_t *st = (const INTEGER_t *)sptr;
 	asn_enc_rval_t er;
 
 	(void)ilevel;
@@ -573,7 +578,8 @@
 #ifndef	ASN_DISABLE_PER_SUPPORT
 
 asn_dec_rval_t
-INTEGER_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+INTEGER_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                    const asn_TYPE_descriptor_t *td,
                     const asn_per_constraints_t *constraints, void **sptr,
                     asn_per_data_t *pd) {
     const asn_INTEGER_specifics_t *specs =
@@ -689,13 +695,13 @@
 }
 
 asn_enc_rval_t
-INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
-                    const asn_per_constraints_t *constraints, void *sptr,
+INTEGER_encode_uper(const asn_TYPE_descriptor_t *td,
+                    const asn_per_constraints_t *constraints, const void *sptr,
                     asn_per_outp_t *po) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     asn_enc_rval_t er;
-	INTEGER_t *st = (INTEGER_t *)sptr;
+	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	const uint8_t *buf;
 	const uint8_t *end;
 	const asn_per_constraint_t *ct;
diff --git a/skeletons/INTEGER.h b/skeletons/INTEGER.h
index 708d845..8efd75c 100644
--- a/skeletons/INTEGER.h
+++ b/skeletons/INTEGER.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_INTEGER_H_
diff --git a/skeletons/INTEGER_oer.c b/skeletons/INTEGER_oer.c
index bea2e07..5c98d3e 100644
--- a/skeletons/INTEGER_oer.c
+++ b/skeletons/INTEGER_oer.c
@@ -10,7 +10,8 @@
 #include <errno.h>
 
 asn_dec_rval_t
-INTEGER_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+INTEGER_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
+                   const asn_TYPE_descriptor_t *td,
                    const asn_oer_constraints_t *constraints, void **sptr,
                    const void *ptr, size_t size) {
     const asn_INTEGER_specifics_t *specs =
@@ -99,8 +100,8 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-INTEGER_encode_oer(asn_TYPE_descriptor_t *td,
-                   const asn_oer_constraints_t *constraints, void *sptr,
+INTEGER_encode_oer(const asn_TYPE_descriptor_t *td,
+                   const asn_oer_constraints_t *constraints, const void *sptr,
                    asn_app_consume_bytes_f *cb, void *app_key) {
     const INTEGER_t *st = sptr;
     asn_enc_rval_t er;
diff --git a/skeletons/ISO646String.h b/skeletons/ISO646String.h
index 4948315..dcaa414 100644
--- a/skeletons/ISO646String.h
+++ b/skeletons/ISO646String.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_ISO646String_H_
diff --git a/skeletons/Makefile.am b/skeletons/Makefile.am
index 43fde66..698e4bb 100644
--- a/skeletons/Makefile.am
+++ b/skeletons/Makefile.am
@@ -50,7 +50,7 @@
     OBJECT_IDENTIFIER.c OBJECT_IDENTIFIER.h     \
     OCTET_STRING.c OCTET_STRING.h               \
     OCTET_STRING_oer.c                          \
-    OPEN_TYPE.c OPEN_TYPE.h                     \
+    OPEN_TYPE.c OPEN_TYPE.h OPEN_TYPE_oer.c     \
     ObjectDescriptor.c ObjectDescriptor.h       \
     PrintableString.c PrintableString.h         \
     REAL.c REAL.h                               \
diff --git a/skeletons/NULL.c b/skeletons/NULL.c
index ed7f853..77a377e 100644
--- a/skeletons/NULL.c
+++ b/skeletons/NULL.c
@@ -52,10 +52,9 @@
 };
 
 asn_enc_rval_t
-NULL_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t erval;
+NULL_encode_der(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode,
+                ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) {
+    asn_enc_rval_t erval;
 
 	erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key);
 	if(erval.encoded == -1) {
@@ -67,10 +66,10 @@
 }
 
 asn_enc_rval_t
-NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t er;
+NULL_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+                void *app_key) {
+    asn_enc_rval_t er;
 
 	(void)td;
 	(void)sptr;
@@ -86,8 +85,9 @@
 
 
 static enum xer_pbd_rval
-NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
-	(void)td;
+NULL__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
+                      const void *chunk_buf, size_t chunk_size) {
+    (void)td;
 	(void)sptr;
 	(void)chunk_buf;    /* Going to be empty according to the rules below. */
 
@@ -102,10 +102,9 @@
 
 asn_dec_rval_t
 NULL_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-
-	return xer_decode_primitive(opt_codec_ctx, td,
+                const asn_TYPE_descriptor_t *td, void **sptr,
+                const char *opt_mname, const void *buf_ptr, size_t size) {
+    return xer_decode_primitive(opt_codec_ctx, td,
 		sptr, sizeof(NULL_t), opt_mname, buf_ptr, size,
 		NULL__xer_body_decode);
 }
@@ -119,10 +118,9 @@
 }
 
 int
-NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-
-	(void)td;	/* Unused argument */
+NULL_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+           asn_app_consume_bytes_f *cb, void *app_key) {
+    (void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
 
 	if(sptr) {
@@ -135,9 +133,10 @@
 #ifndef ASN_DISABLE_OER_SUPPORT
 
 asn_dec_rval_t
-NULL_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-                  const asn_oer_constraints_t *constraints, void **struct_ptr,
-                  const void *ptr, size_t size) {
+NULL_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
+                const asn_TYPE_descriptor_t *td,
+                const asn_oer_constraints_t *constraints, void **struct_ptr,
+                const void *ptr, size_t size) {
     asn_dec_rval_t rv = {RC_OK, 0};
     (void)opt_codec_ctx;
     (void)td;
@@ -149,8 +148,8 @@
 }
 
 asn_enc_rval_t
-NULL_encode_oer(asn_TYPE_descriptor_t *td,
-                const asn_oer_constraints_t *constraints, void *sptr,
+NULL_encode_oer(const asn_TYPE_descriptor_t *td,
+                const asn_oer_constraints_t *constraints, const void *sptr,
                 asn_app_consume_bytes_f *cb, void *app_key) {
     asn_enc_rval_t er;
 
@@ -170,7 +169,8 @@
 #ifndef ASN_DISABLE_PER_SUPPORT
 
 asn_dec_rval_t
-NULL_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+NULL_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                 const asn_TYPE_descriptor_t *td,
                  const asn_per_constraints_t *constraints, void **sptr,
                  asn_per_data_t *pd) {
     asn_dec_rval_t rv;
@@ -199,8 +199,8 @@
 }
 
 asn_enc_rval_t
-NULL_encode_uper(asn_TYPE_descriptor_t *td,
-                 const asn_per_constraints_t *constraints, void *sptr,
+NULL_encode_uper(const asn_TYPE_descriptor_t *td,
+                 const asn_per_constraints_t *constraints, const void *sptr,
                  asn_per_outp_t *po) {
     asn_enc_rval_t er;
 
diff --git a/skeletons/NULL.h b/skeletons/NULL.h
index 050840a..50f53ca 100644
--- a/skeletons/NULL.h
+++ b/skeletons/NULL.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_TYPE_NULL_H
diff --git a/skeletons/NativeEnumerated.c b/skeletons/NativeEnumerated.c
index d95dea2..4ed8749 100644
--- a/skeletons/NativeEnumerated.c
+++ b/skeletons/NativeEnumerated.c
@@ -57,8 +57,8 @@
 };
 
 asn_enc_rval_t
-NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel,
-                            enum xer_encoder_flags_e flags,
+NativeEnumerated_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                            int ilevel, enum xer_encoder_flags_e flags,
                             asn_app_consume_bytes_f *cb, void *app_key) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
@@ -87,10 +87,10 @@
 
 asn_dec_rval_t
 NativeEnumerated_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints,
-	void **sptr, asn_per_data_t *pd) {
-    const asn_INTEGER_specifics_t *specs =
-        (const asn_INTEGER_specifics_t *)td->specifics;
+                             const asn_TYPE_descriptor_t *td,
+                             const asn_per_constraints_t *constraints,
+                             void **sptr, asn_per_data_t *pd) {
+    const asn_INTEGER_specifics_t *specs = td->specifics;
     asn_dec_rval_t rval = { RC_OK, 0 };
 	long *native = (long *)*sptr;
 	const asn_per_constraint_t *ct;
@@ -154,9 +154,9 @@
 }
 
 asn_enc_rval_t
-NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td,
+NativeEnumerated_encode_uper(const asn_TYPE_descriptor_t *td,
                              const asn_per_constraints_t *constraints,
-                             void *sptr, asn_per_outp_t *po) {
+                             const void *sptr, asn_per_outp_t *po) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     asn_enc_rval_t er;
@@ -178,7 +178,7 @@
 
 	er.encoded = 0;
 
-	native = *(long *)sptr;
+	native = *(const long *)sptr;
 
 	key.nat_value = native;
 	kf = bsearch(&key, specs->value2enum, specs->map_count,
diff --git a/skeletons/NativeEnumerated.h b/skeletons/NativeEnumerated.h
index dc4e323..4d897a0 100644
--- a/skeletons/NativeEnumerated.h
+++ b/skeletons/NativeEnumerated.h
@@ -1,6 +1,5 @@
-/*-
- * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+/*
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 /*
diff --git a/skeletons/NativeEnumerated_oer.c b/skeletons/NativeEnumerated_oer.c
index 9b0c0d3..3222348 100644
--- a/skeletons/NativeEnumerated_oer.c
+++ b/skeletons/NativeEnumerated_oer.c
@@ -31,7 +31,7 @@
 
 asn_dec_rval_t
 NativeEnumerated_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
-                            asn_TYPE_descriptor_t *td,
+                            const asn_TYPE_descriptor_t *td,
                             const asn_oer_constraints_t *constraints,
                             void **nint_ptr, const void *ptr, size_t size) {
     asn_dec_rval_t rval = {RC_OK, 0};
@@ -99,9 +99,9 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-NativeEnumerated_encode_oer(asn_TYPE_descriptor_t *td,
+NativeEnumerated_encode_oer(const asn_TYPE_descriptor_t *td,
                             const asn_oer_constraints_t *constraints,
-                            void *sptr, asn_app_consume_bytes_f *cb,
+                            const void *sptr, asn_app_consume_bytes_f *cb,
                             void *app_key) {
     asn_enc_rval_t er;
     long native;
diff --git a/skeletons/NativeInteger.c b/skeletons/NativeInteger.c
index 05ecae0..f172437 100644
--- a/skeletons/NativeInteger.c
+++ b/skeletons/NativeInteger.c
@@ -62,8 +62,8 @@
  */
 asn_dec_rval_t
 NativeInteger_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td,
-	void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) {
+                         const asn_TYPE_descriptor_t *td, void **nint_ptr,
+                         const void *buf_ptr, size_t size, int tag_mode) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     long *native = (long *)*nint_ptr;
@@ -147,11 +147,11 @@
  * Encode the NativeInteger using the standard INTEGER type DER encoder.
  */
 asn_enc_rval_t
-NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	unsigned long native = *(unsigned long *)ptr;	/* Disable sign ext. */
-	asn_enc_rval_t erval;
+NativeInteger_encode_der(const asn_TYPE_descriptor_t *sd, const void *ptr,
+                         int tag_mode, ber_tlv_tag_t tag,
+                         asn_app_consume_bytes_f *cb, void *app_key) {
+    unsigned long native = *(const unsigned long *)ptr; /* Disable sign ext. */
+    asn_enc_rval_t erval;
 	INTEGER_t tmp;
 
 #ifdef	WORDS_BIGENDIAN		/* Opportunistic optimization */
@@ -173,10 +173,9 @@
 	
 	/* Encode fake INTEGER */
 	erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key);
-	if(erval.encoded == -1) {
-		assert(erval.structure_ptr == &tmp);
-		erval.structure_ptr = ptr;
-	}
+    if(erval.structure_ptr == &tmp) {
+        erval.structure_ptr = ptr;
+    }
 	return erval;
 }
 
@@ -185,8 +184,9 @@
  */
 asn_dec_rval_t
 NativeInteger_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
+                         const asn_TYPE_descriptor_t *td, void **sptr,
+                         const char *opt_mname, const void *buf_ptr,
+                         size_t size) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     asn_dec_rval_t rval;
@@ -226,9 +226,9 @@
 
 
 asn_enc_rval_t
-NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
+NativeInteger_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                         int ilevel, enum xer_encoder_flags_e flags,
+                         asn_app_consume_bytes_f *cb, void *app_key) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     char scratch[32];	/* Enough for 64-bit int */
@@ -254,7 +254,7 @@
 
 asn_dec_rval_t
 NativeInteger_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
-                          asn_TYPE_descriptor_t *td,
+                          const asn_TYPE_descriptor_t *td,
                           const asn_per_constraints_t *constraints, void **sptr,
                           asn_per_data_t *pd) {
     const asn_INTEGER_specifics_t *specs =
@@ -290,9 +290,9 @@
 }
 
 asn_enc_rval_t
-NativeInteger_encode_uper(asn_TYPE_descriptor_t *td,
-                          const asn_per_constraints_t *constraints, void *sptr,
-                          asn_per_outp_t *po) {
+NativeInteger_encode_uper(const asn_TYPE_descriptor_t *td,
+                          const asn_per_constraints_t *constraints,
+                          const void *sptr, asn_per_outp_t *po) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     asn_enc_rval_t er;
@@ -301,9 +301,9 @@
 
 	if(!sptr) ASN__ENCODE_FAILED;
 
-	native = *(long *)sptr;
+    native = *(const long *)sptr;
 
-	ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native);
+    ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native);
 
 	memset(&tmpint, 0, sizeof(tmpint));
 	if((specs&&specs->field_unsigned)
@@ -321,8 +321,8 @@
  * INTEGER specific human-readable output.
  */
 int
-NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-                    asn_app_consume_bytes_f *cb, void *app_key) {
+NativeInteger_print(const asn_TYPE_descriptor_t *td, const void *sptr,
+                    int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     const long *native = (const long *)sptr;
diff --git a/skeletons/NativeInteger.h b/skeletons/NativeInteger.h
index 17a6486..e2741c2 100644
--- a/skeletons/NativeInteger.h
+++ b/skeletons/NativeInteger.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 /*
diff --git a/skeletons/NativeInteger_oer.c b/skeletons/NativeInteger_oer.c
index f13f782..411413a 100644
--- a/skeletons/NativeInteger_oer.c
+++ b/skeletons/NativeInteger_oer.c
@@ -11,7 +11,7 @@
 
 asn_dec_rval_t
 NativeInteger_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
-                         asn_TYPE_descriptor_t *td,
+                         const asn_TYPE_descriptor_t *td,
                          const asn_oer_constraints_t *constraints,
                          void **nint_ptr, const void *ptr, size_t size) {
     const asn_INTEGER_specifics_t *specs =
@@ -68,9 +68,10 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-NativeInteger_encode_oer(asn_TYPE_descriptor_t *td,
-                         const asn_oer_constraints_t *constraints, void *sptr,
-                         asn_app_consume_bytes_f *cb, void *app_key) {
+NativeInteger_encode_oer(const asn_TYPE_descriptor_t *td,
+                         const asn_oer_constraints_t *constraints,
+                         const void *sptr, asn_app_consume_bytes_f *cb,
+                         void *app_key) {
     const asn_INTEGER_specifics_t *specs =
         (const asn_INTEGER_specifics_t *)td->specifics;
     INTEGER_t tmpint;
diff --git a/skeletons/NativeReal.c b/skeletons/NativeReal.c
index 382ef3b..f7bccd4 100644
--- a/skeletons/NativeReal.c
+++ b/skeletons/NativeReal.c
@@ -91,7 +91,7 @@
  */
 asn_dec_rval_t
 NativeReal_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
-                      asn_TYPE_descriptor_t *td, void **sptr,
+                      const asn_TYPE_descriptor_t *td, void **sptr,
                       const void *buf_ptr, size_t size, int tag_mode) {
     asn_dec_rval_t rval;
     ber_tlv_len_t length;
@@ -172,9 +172,9 @@
  * Encode the NativeReal using the standard REAL type DER encoder.
  */
 asn_enc_rval_t
-NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
+NativeReal_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      int tag_mode, ber_tlv_tag_t tag,
+                      asn_app_consume_bytes_f *cb, void *app_key) {
     double d = NativeReal__get_double(td, sptr);
     asn_enc_rval_t erval;
 	REAL_t tmp;
@@ -205,10 +205,10 @@
  */
 asn_dec_rval_t
 NativeReal_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
-                       asn_TYPE_descriptor_t *td,
+                       const asn_TYPE_descriptor_t *td,
                        const asn_per_constraints_t *constraints, void **sptr,
                        asn_per_data_t *pd) {
-	asn_dec_rval_t rval;
+    asn_dec_rval_t rval;
     double d;
 	REAL_t tmp;
 	void *ptmp = &tmp;
@@ -238,9 +238,9 @@
  * Encode the NativeReal using the OCTET STRING PER encoder.
  */
 asn_enc_rval_t
-NativeReal_encode_uper(asn_TYPE_descriptor_t *td,
-                       const asn_per_constraints_t *constraints, void *sptr,
-                       asn_per_outp_t *po) {
+NativeReal_encode_uper(const asn_TYPE_descriptor_t *td,
+                       const asn_per_constraints_t *constraints,
+                       const void *sptr, asn_per_outp_t *po) {
     double d = NativeReal__get_double(td, sptr);
 	asn_enc_rval_t erval;
 	REAL_t tmp;
@@ -272,9 +272,10 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-NativeReal_encode_oer(asn_TYPE_descriptor_t *td,
-                   const asn_oer_constraints_t *constraints, void *sptr,
-                   asn_app_consume_bytes_f *cb, void *app_key) {
+NativeReal_encode_oer(const asn_TYPE_descriptor_t *td,
+                      const asn_oer_constraints_t *constraints,
+                      const void *sptr, asn_app_consume_bytes_f *cb,
+                      void *app_key) {
     asn_enc_rval_t er = {0, 0, 0};
 
     if(!constraints) constraints = td->encoding_constraints.oer_constraints;
@@ -335,9 +336,9 @@
 
 asn_dec_rval_t
 NativeReal_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
-                        asn_TYPE_descriptor_t *td,
-                        const asn_oer_constraints_t *constraints, void **sptr,
-                        const void *ptr, size_t size) {
+                      const asn_TYPE_descriptor_t *td,
+                      const asn_oer_constraints_t *constraints, void **sptr,
+                      const void *ptr, size_t size) {
     asn_dec_rval_t ok = {RC_OK, 0};
     double d;
     ssize_t len_len;
@@ -429,9 +430,9 @@
  */
 asn_dec_rval_t
 NativeReal_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-	asn_dec_rval_t rval;
+                      const asn_TYPE_descriptor_t *td, void **sptr,
+                      const char *opt_mname, const void *buf_ptr, size_t size) {
+    asn_dec_rval_t rval;
 	REAL_t st = { 0, 0 };
 	REAL_t *stp = &st;
 
@@ -452,9 +453,9 @@
 }
 
 asn_enc_rval_t
-NativeReal_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
+NativeReal_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      int ilevel, enum xer_encoder_flags_e flags,
+                      asn_app_consume_bytes_f *cb, void *app_key) {
     double d = NativeReal__get_double(td, sptr);
 	asn_enc_rval_t er;
 
@@ -470,10 +471,9 @@
  * REAL specific human-readable output.
  */
 int
-NativeReal_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-
-	(void)ilevel;	/* Unused argument */
+NativeReal_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                 asn_app_consume_bytes_f *cb, void *app_key) {
+    (void)ilevel;	/* Unused argument */
 
 	if(sptr) {
         double d = NativeReal__get_double(td, sptr);
diff --git a/skeletons/NativeReal.h b/skeletons/NativeReal.h
index c3e9e2d..b6d16d6 100644
--- a/skeletons/NativeReal.h
+++ b/skeletons/NativeReal.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 /*
diff --git a/skeletons/NumericString.c b/skeletons/NumericString.c
index 891e4f5..c89597e 100644
--- a/skeletons/NumericString.c
+++ b/skeletons/NumericString.c
@@ -78,9 +78,9 @@
 };
 
 int
-NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const NumericString_t *st = (const NumericString_t *)sptr;
+NumericString_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    const NumericString_t *st = (const NumericString_t *)sptr;
 
 	if(st && st->buf) {
 		uint8_t *buf = st->buf;
diff --git a/skeletons/NumericString.h b/skeletons/NumericString.h
index 8e4f7ec..ae79873 100644
--- a/skeletons/NumericString.h
+++ b/skeletons/NumericString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_NumericString_H_
diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c
index 3f26477..290545d 100644
--- a/skeletons/OBJECT_IDENTIFIER.c
+++ b/skeletons/OBJECT_IDENTIFIER.c
@@ -56,9 +56,10 @@
 };
 
 int
-OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
+OBJECT_IDENTIFIER_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                             asn_app_constraint_failed_f *ctfailcb,
+                             void *app_key) {
+    const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
 
 	if(st && st->buf) {
 		if(st->size < 1) {
@@ -182,8 +183,9 @@
 }
 
 static enum xer_pbd_rval
-OBJECT_IDENTIFIER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
-	OBJECT_IDENTIFIER_t *st = (OBJECT_IDENTIFIER_t *)sptr;
+OBJECT_IDENTIFIER__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
+                                   const void *chunk_buf, size_t chunk_size) {
+    OBJECT_IDENTIFIER_t *st = (OBJECT_IDENTIFIER_t *)sptr;
 	const char *chunk_end = (const char *)chunk_buf + chunk_size;
 	const char *endptr;
 	asn_oid_arc_t s_arcs[10];
@@ -224,19 +226,19 @@
 
 asn_dec_rval_t
 OBJECT_IDENTIFIER_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-
-	return xer_decode_primitive(opt_codec_ctx, td,
+                             const asn_TYPE_descriptor_t *td, void **sptr,
+                             const char *opt_mname, const void *buf_ptr,
+                             size_t size) {
+    return xer_decode_primitive(opt_codec_ctx, td,
 		sptr, sizeof(OBJECT_IDENTIFIER_t), opt_mname,
 			buf_ptr, size, OBJECT_IDENTIFIER__xer_body_decode);
 }
 
 asn_enc_rval_t
-OBJECT_IDENTIFIER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
+OBJECT_IDENTIFIER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                             int ilevel, enum xer_encoder_flags_e flags,
+                             asn_app_consume_bytes_f *cb, void *app_key) {
+    const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
 	asn_enc_rval_t er;
 
     (void)ilevel;
@@ -253,9 +255,10 @@
 }
 
 int
-OBJECT_IDENTIFIER_print(asn_TYPE_descriptor_t *td, const void *sptr,
-	int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
-	const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
+OBJECT_IDENTIFIER_print(const asn_TYPE_descriptor_t *td, const void *sptr,
+                        int ilevel, asn_app_consume_bytes_f *cb,
+                        void *app_key) {
+    const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
diff --git a/skeletons/OBJECT_IDENTIFIER.h b/skeletons/OBJECT_IDENTIFIER.h
index 7336285..aa0d5c7 100644
--- a/skeletons/OBJECT_IDENTIFIER.h
+++ b/skeletons/OBJECT_IDENTIFIER.h
@@ -1,6 +1,5 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- * 	All rights reserved.
+/*
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_OBJECT_IDENTIFIER_H_
diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c
index e618609..3946206 100644
--- a/skeletons/OCTET_STRING.c
+++ b/skeletons/OCTET_STRING.c
@@ -178,9 +178,9 @@
  */
 asn_dec_rval_t
 OCTET_STRING_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td,
-	void **sptr, const void *buf_ptr, size_t size, int tag_mode) {
-	const asn_OCTET_STRING_specifics_t *specs = td->specifics
+                        const asn_TYPE_descriptor_t *td, void **sptr,
+                        const void *buf_ptr, size_t size, int tag_mode) {
+    const asn_OCTET_STRING_specifics_t *specs = td->specifics
 				? (const asn_OCTET_STRING_specifics_t *)td->specifics
 				: &asn_SPC_OCTET_STRING_specs;
 	BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
@@ -532,14 +532,14 @@
  * Encode OCTET STRING type using DER.
  */
 asn_enc_rval_t
-OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t er;
+OCTET_STRING_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                        int tag_mode, ber_tlv_tag_t tag,
+                        asn_app_consume_bytes_f *cb, void *app_key) {
+    asn_enc_rval_t er;
 	const asn_OCTET_STRING_specifics_t *specs = td->specifics
 				? (const asn_OCTET_STRING_specifics_t *)td->specifics
 				: &asn_SPC_OCTET_STRING_specs;
-	BIT_STRING_t *st = (BIT_STRING_t *)sptr;
+	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 	enum asn_OS_Subvariant type_variant = specs->subvariant;
 	int fix_last_byte = 0;
 
@@ -594,10 +594,10 @@
 }
 
 asn_enc_rval_t
-OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const char * const h2c = "0123456789ABCDEF";
+OCTET_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                        int ilevel, enum xer_encoder_flags_e flags,
+                        asn_app_consume_bytes_f *cb, void *app_key) {
+    const char * const h2c = "0123456789ABCDEF";
 	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	asn_enc_rval_t er;
 	char scratch[16 * 3 + 4];
@@ -746,10 +746,10 @@
 }
 
 asn_enc_rval_t
-OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
+OCTET_STRING_encode_xer_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
+                             int ilevel, enum xer_encoder_flags_e flags,
+                             asn_app_consume_bytes_f *cb, void *app_key) {
+    const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	asn_enc_rval_t er;
 	uint8_t *buf, *end;
 	uint8_t *ss;	/* Sequence start */
@@ -974,8 +974,10 @@
 /*
  * Convert from the plain UTF-8 format, expanding entity references: "2 &lt; 3"
  */
-static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) {
-	OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
+static ssize_t
+OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf,
+                              size_t chunk_size, int have_more) {
+    OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
 	const char *p = (const char *)chunk_buf;
 	const char *pend = p + chunk_size;
 	uint8_t *buf;
@@ -1115,16 +1117,14 @@
  * Decode OCTET STRING from the XML element's body.
  */
 static asn_dec_rval_t
-OCTET_STRING__decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr,
-	const char *opt_mname, const void *buf_ptr, size_t size,
-	int (*opt_unexpected_tag_decoder)
-		(void *struct_ptr, const void *chunk_buf, size_t chunk_size),
-	ssize_t (*body_receiver)
-		(void *struct_ptr, const void *chunk_buf, size_t chunk_size,
-			int have_more)
-) {
-	OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr;
+OCTET_STRING__decode_xer(
+    const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td,
+    void **sptr, const char *opt_mname, const void *buf_ptr, size_t size,
+    int (*opt_unexpected_tag_decoder)(void *struct_ptr, const void *chunk_buf,
+                                      size_t chunk_size),
+    ssize_t (*body_receiver)(void *struct_ptr, const void *chunk_buf,
+                             size_t chunk_size, int have_more)) {
+    OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr;
 	const asn_OCTET_STRING_specifics_t *specs = td->specifics
 				? (const asn_OCTET_STRING_specifics_t *)td->specifics
 				: &asn_SPC_OCTET_STRING_specs;
@@ -1176,9 +1176,10 @@
  */
 asn_dec_rval_t
 OCTET_STRING_decode_xer_hex(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr,
-		const char *opt_mname, const void *buf_ptr, size_t size) {
-	return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
+                            const asn_TYPE_descriptor_t *td, void **sptr,
+                            const char *opt_mname, const void *buf_ptr,
+                            size_t size) {
+    return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
 		buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal);
 }
 
@@ -1187,9 +1188,10 @@
  */
 asn_dec_rval_t
 OCTET_STRING_decode_xer_binary(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr,
-		const char *opt_mname, const void *buf_ptr, size_t size) {
-	return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
+                               const asn_TYPE_descriptor_t *td, void **sptr,
+                               const char *opt_mname, const void *buf_ptr,
+                               size_t size) {
+    return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
 		buf_ptr, size, 0, OCTET_STRING__convert_binary);
 }
 
@@ -1198,9 +1200,10 @@
  */
 asn_dec_rval_t
 OCTET_STRING_decode_xer_utf8(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr,
-		const char *opt_mname, const void *buf_ptr, size_t size) {
-	return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
+                             const asn_TYPE_descriptor_t *td, void **sptr,
+                             const char *opt_mname, const void *buf_ptr,
+                             size_t size) {
+    return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
 		buf_ptr, size,
 		OCTET_STRING__handle_control_chars,
 		OCTET_STRING__convert_entrefs);
@@ -1349,7 +1352,7 @@
 
 asn_dec_rval_t
 OCTET_STRING_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
-                         asn_TYPE_descriptor_t *td,
+                         const asn_TYPE_descriptor_t *td,
                          const asn_per_constraints_t *constraints, void **sptr,
                          asn_per_data_t *pd) {
     const asn_OCTET_STRING_specifics_t *specs = td->specifics
@@ -1498,9 +1501,9 @@
 }
 
 asn_enc_rval_t
-OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
-                         const asn_per_constraints_t *constraints, void *sptr,
-                         asn_per_outp_t *po) {
+OCTET_STRING_encode_uper(const asn_TYPE_descriptor_t *td,
+                         const asn_per_constraints_t *constraints,
+                         const void *sptr, asn_per_outp_t *po) {
     const asn_OCTET_STRING_specifics_t *specs = td->specifics
 		? (const asn_OCTET_STRING_specifics_t *)td->specifics
 		: &asn_SPC_OCTET_STRING_specs;
@@ -1643,9 +1646,9 @@
 #endif  /* ASN_DISABLE_PER_SUPPORT */
 
 int
-OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const char * const h2c = "0123456789ABCDEF";
+OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
+                   int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+    const char * const h2c = "0123456789ABCDEF";
 	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	char scratch[16 * 3 + 4];
 	char *p = scratch;
@@ -1685,9 +1688,10 @@
 }
 
 int
-OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr,
-		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
-	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
+OCTET_STRING_print_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
+                        int ilevel, asn_app_consume_bytes_f *cb,
+                        void *app_key) {
+    const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
diff --git a/skeletons/OCTET_STRING.h b/skeletons/OCTET_STRING.h
index 36b982d..5992850 100644
--- a/skeletons/OCTET_STRING.h
+++ b/skeletons/OCTET_STRING.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_OCTET_STRING_H_
diff --git a/skeletons/OCTET_STRING_oer.c b/skeletons/OCTET_STRING_oer.c
index 3a72166..c2f9a5c 100644
--- a/skeletons/OCTET_STRING_oer.c
+++ b/skeletons/OCTET_STRING_oer.c
@@ -11,7 +11,7 @@
 
 asn_dec_rval_t
 OCTET_STRING_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
-                        asn_TYPE_descriptor_t *td,
+                        const asn_TYPE_descriptor_t *td,
                         const asn_oer_constraints_t *constraints, void **sptr,
                         const void *ptr, size_t size) {
     const asn_OCTET_STRING_specifics_t *specs =
@@ -100,13 +100,14 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-OCTET_STRING_encode_oer(asn_TYPE_descriptor_t *td,
-                        const asn_oer_constraints_t *constraints, void *sptr,
-                        asn_app_consume_bytes_f *cb, void *app_key) {
+OCTET_STRING_encode_oer(const asn_TYPE_descriptor_t *td,
+                        const asn_oer_constraints_t *constraints,
+                        const void *sptr, asn_app_consume_bytes_f *cb,
+                        void *app_key) {
     const asn_OCTET_STRING_specifics_t *specs =
         td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
                       : &asn_SPC_OCTET_STRING_specs;
-    OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
+    const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
     const asn_oer_constraints_t *cts =
         constraints ? constraints : td->encoding_constraints.oer_constraints;
     ssize_t ct_size = cts ? cts->size : -1;
diff --git a/skeletons/OPEN_TYPE.c b/skeletons/OPEN_TYPE.c
index 4786799..c672992 100644
--- a/skeletons/OPEN_TYPE.c
+++ b/skeletons/OPEN_TYPE.c
@@ -37,9 +37,9 @@
     } while(0)
 
 asn_dec_rval_t
-OPEN_TYPE_ber_get(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-                  void *sptr, asn_TYPE_member_t *elm, const void *ptr,
-                  size_t size) {
+OPEN_TYPE_ber_get(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td, void *sptr,
+                  const asn_TYPE_member_t *elm, const void *ptr, size_t size) {
     size_t consumed_myself = 0;
     asn_type_selector_result_t selected;
     void *memb_ptr;   /* Pointer to the member */
@@ -122,9 +122,9 @@
 }
 
 asn_dec_rval_t
-OPEN_TYPE_xer_get(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-                  void *sptr, asn_TYPE_member_t *elm, const void *ptr,
-                  size_t size) {
+OPEN_TYPE_xer_get(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td, void *sptr,
+                  const asn_TYPE_member_t *elm, const void *ptr, size_t size) {
     size_t consumed_myself = 0;
     asn_type_selector_result_t selected;
     void *memb_ptr;   /* Pointer to the member */
@@ -287,8 +287,8 @@
 
 asn_dec_rval_t
 OPEN_TYPE_uper_get(const asn_codec_ctx_t *opt_codec_ctx,
-                   asn_TYPE_descriptor_t *td, void *sptr,
-                   asn_TYPE_member_t *elm, asn_per_data_t *pd) {
+                   const asn_TYPE_descriptor_t *td, void *sptr,
+                   const asn_TYPE_member_t *elm, asn_per_data_t *pd) {
     asn_type_selector_result_t selected;
     void *memb_ptr;   /* Pointer to the member */
     void **memb_ptr2; /* Pointer to that pointer */
@@ -361,10 +361,10 @@
 }
 
 asn_enc_rval_t
-OPEN_TYPE_encode_uper(asn_TYPE_descriptor_t *td,
-                      const asn_per_constraints_t *constraints, void *sptr,
-                      asn_per_outp_t *po) {
-    void *memb_ptr;   /* Pointer to the member */
+OPEN_TYPE_encode_uper(const asn_TYPE_descriptor_t *td,
+                      const asn_per_constraints_t *constraints,
+                      const void *sptr, asn_per_outp_t *po) {
+    const void *memb_ptr;   /* Pointer to the member */
     asn_TYPE_member_t *elm; /* CHOICE's element */
     asn_enc_rval_t er;
     unsigned present;
@@ -383,10 +383,11 @@
     elm = &td->elements[present];
     if(elm->flags & ATF_POINTER) {
         /* Member is a pointer to another structure */
-        memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
+        memb_ptr =
+            *(const void *const *)((const char *)sptr + elm->memb_offset);
         if(!memb_ptr) ASN__ENCODE_FAILED;
     } else {
-        memb_ptr = (char *)sptr + elm->memb_offset;
+        memb_ptr = (const char *)sptr + elm->memb_offset;
     }
 
     if(uper_open_type_put(elm->type, NULL, memb_ptr, po) < 0) {
diff --git a/skeletons/OPEN_TYPE.h b/skeletons/OPEN_TYPE.h
index 617fb6a..d0f02fd 100644
--- a/skeletons/OPEN_TYPE.h
+++ b/skeletons/OPEN_TYPE.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2017-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef ASN_OPEN_TYPE_H
@@ -28,33 +28,33 @@
  * by the other members of the parent structure.
  */
 asn_dec_rval_t OPEN_TYPE_ber_get(const asn_codec_ctx_t *opt_codec_ctx,
-                                 asn_TYPE_descriptor_t *parent_type,
+                                 const asn_TYPE_descriptor_t *parent_type,
                                  void *parent_structure,
-                                 asn_TYPE_member_t *element, const void *ptr,
-                                 size_t size);
+                                 const asn_TYPE_member_t *element,
+                                 const void *ptr, size_t size);
 
 asn_dec_rval_t OPEN_TYPE_xer_get(const asn_codec_ctx_t *opt_codec_ctx,
-                                 asn_TYPE_descriptor_t *parent_type,
+                                 const asn_TYPE_descriptor_t *parent_type,
+                                 void *parent_structure,
+                                 const asn_TYPE_member_t *element,
+                                 const void *ptr, size_t size);
+
+asn_dec_rval_t OPEN_TYPE_oer_get(const asn_codec_ctx_t *opt_codec_ctx,
+                                 const asn_TYPE_descriptor_t *parent_type,
                                  void *parent_structure,
                                  asn_TYPE_member_t *element, const void *ptr,
                                  size_t size);
 
-asn_dec_rval_t OPEN_TYPE_oer_get(const asn_codec_ctx_t *opt_codec_ctx,
-                                  asn_TYPE_descriptor_t *parent_type,
-                                  void *parent_structure,
-                                  asn_TYPE_member_t *element,
-                                  const void *ptr, size_t size);
-
 asn_dec_rval_t OPEN_TYPE_uper_get(const asn_codec_ctx_t *opt_codec_ctx,
-                                  asn_TYPE_descriptor_t *parent_type,
+                                  const asn_TYPE_descriptor_t *parent_type,
                                   void *parent_structure,
-                                  asn_TYPE_member_t *element,
+                                  const asn_TYPE_member_t *element,
                                   asn_per_data_t *pd);
 
-asn_enc_rval_t OPEN_TYPE_encode_uper(asn_TYPE_descriptor_t *type_descriptor,
-                                     const asn_per_constraints_t *constraints,
-                                     void *struct_ptr,
-                                     asn_per_outp_t *per_output);
+asn_enc_rval_t OPEN_TYPE_encode_uper(
+    const asn_TYPE_descriptor_t *type_descriptor,
+    const asn_per_constraints_t *constraints, const void *struct_ptr,
+    asn_per_outp_t *per_output);
 
 #ifdef __cplusplus
 }
diff --git a/skeletons/OPEN_TYPE_oer.c b/skeletons/OPEN_TYPE_oer.c
index 30bf099..dd2f5c6 100644
--- a/skeletons/OPEN_TYPE_oer.c
+++ b/skeletons/OPEN_TYPE_oer.c
@@ -8,9 +8,9 @@
 #include <errno.h>
 
 asn_dec_rval_t
-OPEN_TYPE_oer_get(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-                  void *sptr, asn_TYPE_member_t *elm, const void *ptr,
-                  size_t size) {
+OPEN_TYPE_oer_get(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td, void *sptr,
+                  asn_TYPE_member_t *elm, const void *ptr, size_t size) {
     asn_type_selector_result_t selected;
     void *memb_ptr;   /* Pointer to the member */
     void **memb_ptr2; /* Pointer to that pointer */
diff --git a/skeletons/ObjectDescriptor.h b/skeletons/ObjectDescriptor.h
index 2423469..526511e 100644
--- a/skeletons/ObjectDescriptor.h
+++ b/skeletons/ObjectDescriptor.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_ObjectDescriptor_H_
diff --git a/skeletons/PrintableString.c b/skeletons/PrintableString.c
index 0cf1741..ffc08b7 100644
--- a/skeletons/PrintableString.c
+++ b/skeletons/PrintableString.c
@@ -89,9 +89,10 @@
 
 
 int
-PrintableString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const PrintableString_t *st = (const PrintableString_t *)sptr;
+PrintableString_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                           asn_app_constraint_failed_f *ctfailcb,
+                           void *app_key) {
+    const PrintableString_t *st = (const PrintableString_t *)sptr;
 
 	if(st && st->buf) {
 		uint8_t *buf = st->buf;
diff --git a/skeletons/PrintableString.h b/skeletons/PrintableString.h
index d788944..6a49d16 100644
--- a/skeletons/PrintableString.h
+++ b/skeletons/PrintableString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_PrintableString_H_
diff --git a/skeletons/REAL.c b/skeletons/REAL.c
index 023afa3..f1d0665 100644
--- a/skeletons/REAL.c
+++ b/skeletons/REAL.c
@@ -306,9 +306,9 @@
 }
 
 int
-REAL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const REAL_t *st = (const REAL_t *)sptr;
+REAL_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+           asn_app_consume_bytes_f *cb, void *app_key) {
+    const REAL_t *st = (const REAL_t *)sptr;
 	ssize_t ret;
 	double d;
 
@@ -369,10 +369,10 @@
 }
 
 asn_enc_rval_t
-REAL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	REAL_t *st = (REAL_t *)sptr;
+REAL_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+                void *app_key) {
+    const REAL_t *st = (const REAL_t *)sptr;
 	asn_enc_rval_t er;
 	double d;
 
@@ -392,8 +392,9 @@
  * Decode the chunk of XML text encoding REAL.
  */
 static enum xer_pbd_rval
-REAL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
-	REAL_t *st = (REAL_t *)sptr;
+REAL__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
+                      const void *chunk_buf, size_t chunk_size) {
+    REAL_t *st = (REAL_t *)sptr;
 	double value;
 	const char *xerdata = (const char *)chunk_buf;
 	char *endptr = 0;
@@ -458,10 +459,9 @@
 
 asn_dec_rval_t
 REAL_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-
-	return xer_decode_primitive(opt_codec_ctx, td,
+                const asn_TYPE_descriptor_t *td, void **sptr,
+                const char *opt_mname, const void *buf_ptr, size_t size) {
+    return xer_decode_primitive(opt_codec_ctx, td,
 		sptr, sizeof(REAL_t), opt_mname,
 		buf_ptr, size, REAL__xer_body_decode);
 }
@@ -846,8 +846,8 @@
  * Encode as Canonical OER
  */
 asn_enc_rval_t
-REAL_encode_oer(asn_TYPE_descriptor_t *td,
-                const asn_oer_constraints_t *constraints, void *sptr,
+REAL_encode_oer(const asn_TYPE_descriptor_t *td,
+                const asn_oer_constraints_t *constraints, const void *sptr,
                 asn_app_consume_bytes_f *cb, void *app_key) {
     const REAL_t *st = sptr;
     asn_enc_rval_t er;
@@ -874,7 +874,8 @@
 }
 
 asn_dec_rval_t
-REAL_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+REAL_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
+                const asn_TYPE_descriptor_t *td,
                 const asn_oer_constraints_t *constraints, void **sptr,
                 const void *ptr, size_t size) {
     asn_dec_rval_t ok = {RC_OK, 0};
@@ -929,7 +930,8 @@
 #ifndef ASN_DISABLE_PER_SUPPORT
 
 asn_dec_rval_t
-REAL_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+REAL_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                 const asn_TYPE_descriptor_t *td,
                  const asn_per_constraints_t *constraints, void **sptr,
                  asn_per_data_t *pd) {
     (void)constraints;	/* No PER visible constraints */
@@ -937,8 +939,8 @@
 }
 
 asn_enc_rval_t
-REAL_encode_uper(asn_TYPE_descriptor_t *td,
-                 const asn_per_constraints_t *constraints, void *sptr,
+REAL_encode_uper(const asn_TYPE_descriptor_t *td,
+                 const asn_per_constraints_t *constraints, const void *sptr,
                  asn_per_outp_t *po) {
     (void)constraints;	/* No PER visible constraints */
 	return OCTET_STRING_encode_uper(td, 0, sptr, po);
diff --git a/skeletons/REAL.h b/skeletons/REAL.h
index af82325..d71147a 100644
--- a/skeletons/REAL.h
+++ b/skeletons/REAL.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_TYPE_REAL_H
diff --git a/skeletons/RELATIVE-OID.c b/skeletons/RELATIVE-OID.c
index 18fbdb3..2f6295b 100644
--- a/skeletons/RELATIVE-OID.c
+++ b/skeletons/RELATIVE-OID.c
@@ -93,9 +93,9 @@
 }
 
 int
-RELATIVE_OID_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const RELATIVE_OID_t *st = (const RELATIVE_OID_t *)sptr;
+RELATIVE_OID_print(const asn_TYPE_descriptor_t *td, const void *sptr,
+                   int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+    const RELATIVE_OID_t *st = (const RELATIVE_OID_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
@@ -114,8 +114,9 @@
 }
 
 static enum xer_pbd_rval
-RELATIVE_OID__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
-	RELATIVE_OID_t *st = (RELATIVE_OID_t *)sptr;
+RELATIVE_OID__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
+                              const void *chunk_buf, size_t chunk_size) {
+    RELATIVE_OID_t *st = (RELATIVE_OID_t *)sptr;
 	const char *chunk_end = (const char *)chunk_buf + chunk_size;
 	const char *endptr;
 	asn_oid_arc_t s_arcs[6];
@@ -157,19 +158,19 @@
 
 asn_dec_rval_t
 RELATIVE_OID_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-
-	return xer_decode_primitive(opt_codec_ctx, td,
+                        const asn_TYPE_descriptor_t *td, void **sptr,
+                        const char *opt_mname, const void *buf_ptr,
+                        size_t size) {
+    return xer_decode_primitive(opt_codec_ctx, td,
 		sptr, sizeof(RELATIVE_OID_t), opt_mname,
 			buf_ptr, size, RELATIVE_OID__xer_body_decode);
 }
 
 asn_enc_rval_t
-RELATIVE_OID_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	RELATIVE_OID_t *st = (RELATIVE_OID_t *)sptr;
+RELATIVE_OID_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                        int ilevel, enum xer_encoder_flags_e flags,
+                        asn_app_consume_bytes_f *cb, void *app_key) {
+    const RELATIVE_OID_t *st = (const RELATIVE_OID_t *)sptr;
 	asn_enc_rval_t er;
 
 	(void)ilevel;	/* Unused argument */
diff --git a/skeletons/RELATIVE-OID.h b/skeletons/RELATIVE-OID.h
index edae83d..289bbca 100644
--- a/skeletons/RELATIVE-OID.h
+++ b/skeletons/RELATIVE-OID.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_RELATIVE_OID_H_
diff --git a/skeletons/T61String.h b/skeletons/T61String.h
index 27f7cc6..3f4707a 100644
--- a/skeletons/T61String.h
+++ b/skeletons/T61String.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_T61String_H_
diff --git a/skeletons/TeletexString.h b/skeletons/TeletexString.h
index 59d0ef7..a43f3e3 100644
--- a/skeletons/TeletexString.h
+++ b/skeletons/TeletexString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_TeletexString_H_
diff --git a/skeletons/UTCTime.c b/skeletons/UTCTime.c
index d645869..ffbed58 100644
--- a/skeletons/UTCTime.c
+++ b/skeletons/UTCTime.c
@@ -74,18 +74,17 @@
  * Check that the time looks like the time.
  */
 int
-UTCTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const UTCTime_t *st = (const UTCTime_t *)sptr;
+UTCTime_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                   asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    const UTCTime_t *st = (const UTCTime_t *)sptr;
 	time_t tloc;
 
 	errno = EPERM;			/* Just an unlikely error code */
 	tloc = asn_UT2time(st, 0, 0);
 	if(tloc == -1 && errno != EPERM) {
-		ASN__CTFAIL(app_key, td, sptr,
-			"%s: Invalid time format: %s (%s:%d)",
-			td->name, strerror(errno), __FILE__, __LINE__);
-		return -1;
+        ASN__CTFAIL(app_key, td, sptr, "%s: Invalid time format: %s (%s:%d)",
+                    td->name, strerror(errno), __FILE__, __LINE__);
+        return -1;
 	}
 
 	return 0;
@@ -94,17 +93,16 @@
 #ifndef	ASN___INTERNAL_TEST_MODE
 
 asn_enc_rval_t
-UTCTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-
-	if(flags & XER_F_CANONICAL) {
+UTCTime_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                   int ilevel, enum xer_encoder_flags_e flags,
+                   asn_app_consume_bytes_f *cb, void *app_key) {
+    if(flags & XER_F_CANONICAL) {
 		asn_enc_rval_t rv;
 		UTCTime_t *ut;
 		struct tm tm;
 
 		errno = EPERM;
-		if(asn_UT2time((UTCTime_t *)sptr, &tm, 1) == -1
+		if(asn_UT2time((const UTCTime_t *)sptr, &tm, 1) == -1
 				&& errno != EPERM)
 			ASN__ENCODE_FAILED;
 
@@ -125,9 +123,9 @@
 #endif	/* ASN___INTERNAL_TEST_MODE */
 
 int
-UTCTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const UTCTime_t *st = (const UTCTime_t *)sptr;
+UTCTime_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+              asn_app_consume_bytes_f *cb, void *app_key) {
+    const UTCTime_t *st = (const UTCTime_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
diff --git a/skeletons/UTCTime.h b/skeletons/UTCTime.h
index 23234fa..3c5c0c4 100644
--- a/skeletons/UTCTime.h
+++ b/skeletons/UTCTime.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_UTCTime_H_
diff --git a/skeletons/UTF8String.c b/skeletons/UTF8String.c
index ae48063..a82da36 100644
--- a/skeletons/UTF8String.c
+++ b/skeletons/UTF8String.c
@@ -84,9 +84,9 @@
 #define	U8E_EINVAL	-5	/* Invalid arguments */
 
 int
-UTF8String_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	ssize_t len = UTF8String_length((const UTF8String_t *)sptr);
+UTF8String_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    ssize_t len = UTF8String_length((const UTF8String_t *)sptr);
 	switch(len) {
 	case U8E_EINVAL:
 		ASN__CTFAIL(app_key, td, sptr,
@@ -185,9 +185,9 @@
 }
 
 int
-UTF8String_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const UTF8String_t *st = (const UTF8String_t *)sptr;
+UTF8String_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                 asn_app_consume_bytes_f *cb, void *app_key) {
+    const UTF8String_t *st = (const UTF8String_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
diff --git a/skeletons/UTF8String.h b/skeletons/UTF8String.h
index 4deec26..0304483 100644
--- a/skeletons/UTF8String.h
+++ b/skeletons/UTF8String.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_UTF8String_H_
diff --git a/skeletons/UniversalString.c b/skeletons/UniversalString.c
index 67fb6a1..e4a08d5 100644
--- a/skeletons/UniversalString.c
+++ b/skeletons/UniversalString.c
@@ -64,13 +64,13 @@
 };
 
 int
-UniversalString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+UniversalString_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
                            asn_app_constraint_failed_f *ctfailcb,
                            void *app_key) {
     const UniversalString_t *st = (const UniversalString_t *)sptr;
 
     if(st && st->buf) {
-        if(st->size & 3) {
+        if(st->size % 4) {
             ASN__CTFAIL(app_key, td, sptr,
                         "%s: invalid size %zu not divisible by 4 (%s:%d)",
                         td->name, st->size, __FILE__, __LINE__);
@@ -146,9 +146,10 @@
 
 asn_dec_rval_t
 UniversalString_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td, void **sptr,
-		const char *opt_mname, const void *buf_ptr, size_t size) {
-	asn_dec_rval_t rc;
+                           const asn_TYPE_descriptor_t *td, void **sptr,
+                           const char *opt_mname, const void *buf_ptr,
+                           size_t size) {
+    asn_dec_rval_t rc;
 
 	rc = OCTET_STRING_decode_xer_utf8(opt_codec_ctx, td, sptr, opt_mname,
 		buf_ptr, size);
@@ -202,10 +203,10 @@
 }
 
 asn_enc_rval_t
-UniversalString_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const UniversalString_t *st = (const UniversalString_t *)sptr;
+UniversalString_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                           int ilevel, enum xer_encoder_flags_e flags,
+                           asn_app_consume_bytes_f *cb, void *app_key) {
+    const UniversalString_t *st = (const UniversalString_t *)sptr;
 	asn_enc_rval_t er;
 
 	(void)ilevel;
@@ -221,9 +222,9 @@
 }
 
 int
-UniversalString_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const UniversalString_t *st = (const UniversalString_t *)sptr;
+UniversalString_print(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+    const UniversalString_t *st = (const UniversalString_t *)sptr;
 
 	(void)td;	/* Unused argument */
 	(void)ilevel;	/* Unused argument */
@@ -236,36 +237,3 @@
 	return 0;
 }
 
-/*
- * Biased function for randomizing UCS-4 sequences.
- */
-static size_t
-UniversalString__random_char(uint8_t *b) {
-    uint32_t code;
-
-    switch(asn_random_between(0, 4)) {
-    case 0:
-        code = 0;
-        break;
-    case 1:
-        code = 1;
-        break;
-    case 2:
-        code = 0xd7ff;  /* End of pre-surrogate block */
-        break;
-    case 3:
-        code = 0xe000;  /* Beginning of post-surrogate block */
-        break;
-    case 4:
-        code = 0x10ffff;
-        break;
-    }
-
-    b[0] = code >> 24;
-    b[1] = code >> 16;
-    b[2] = code >> 8;
-    b[3] = code;
-
-    return 4;
-}
-
diff --git a/skeletons/UniversalString.h b/skeletons/UniversalString.h
index b2673ae..df0c07a 100644
--- a/skeletons/UniversalString.h
+++ b/skeletons/UniversalString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_UniversalString_H_
diff --git a/skeletons/VideotexString.h b/skeletons/VideotexString.h
index 1227f58..37177d3 100644
--- a/skeletons/VideotexString.h
+++ b/skeletons/VideotexString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_VideotexString_H_
diff --git a/skeletons/VisibleString.c b/skeletons/VisibleString.c
index fe2762f..e163791 100644
--- a/skeletons/VisibleString.c
+++ b/skeletons/VisibleString.c
@@ -58,9 +58,9 @@
 };
 
 int
-VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const VisibleString_t *st = (const VisibleString_t *)sptr;
+VisibleString_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    const VisibleString_t *st = (const VisibleString_t *)sptr;
 
 	if(st && st->buf) {
 		uint8_t *buf = st->buf;
diff --git a/skeletons/VisibleString.h b/skeletons/VisibleString.h
index a8d278b..842d56e 100644
--- a/skeletons/VisibleString.h
+++ b/skeletons/VisibleString.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_VisibleString_H_
diff --git a/skeletons/asn_SEQUENCE_OF.h b/skeletons/asn_SEQUENCE_OF.h
index e678f03..e35bc44 100644
--- a/skeletons/asn_SEQUENCE_OF.h
+++ b/skeletons/asn_SEQUENCE_OF.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_SEQUENCE_OF_H
diff --git a/skeletons/asn_SET_OF.h b/skeletons/asn_SET_OF.h
index a2067d8..882e1a4 100644
--- a/skeletons/asn_SET_OF.h
+++ b/skeletons/asn_SET_OF.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_SET_OF_H
diff --git a/skeletons/asn_application.c b/skeletons/asn_application.c
index 2cb9b19..5b25207 100644
--- a/skeletons/asn_application.c
+++ b/skeletons/asn_application.c
@@ -6,10 +6,12 @@
 #include <asn_application.h>
 #include <errno.h>
 
-static asn_enc_rval_t asn_encode_internal(
-    const asn_codec_ctx_t *opt_codec_ctx,
-    enum asn_transfer_syntax syntax, asn_TYPE_descriptor_t *td,
-    void *sptr, asn_app_consume_bytes_f *callback, void *callback_key);
+static asn_enc_rval_t asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
+                                          enum asn_transfer_syntax syntax,
+                                          const asn_TYPE_descriptor_t *td,
+                                          const void *sptr,
+                                          asn_app_consume_bytes_f *callback,
+                                          void *callback_key);
 
 
 struct callback_count_bytes_key {
@@ -113,8 +115,9 @@
 
 asn_enc_rval_t
 asn_encode_to_buffer(const asn_codec_ctx_t *opt_codec_ctx,
-                     enum asn_transfer_syntax syntax, asn_TYPE_descriptor_t *td,
-                     void *sptr, void *buffer, size_t buffer_size) {
+                     enum asn_transfer_syntax syntax,
+                     const asn_TYPE_descriptor_t *td, const void *sptr,
+                     void *buffer, size_t buffer_size) {
     struct overrun_encoder_key buf_key;
     asn_enc_rval_t er;
 
@@ -141,9 +144,9 @@
 
 static asn_enc_rval_t
 asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
-                    enum asn_transfer_syntax syntax, asn_TYPE_descriptor_t *td,
-                    void *sptr, asn_app_consume_bytes_f *callback,
-                    void *callback_key) {
+                    enum asn_transfer_syntax syntax,
+                    const asn_TYPE_descriptor_t *td, const void *sptr,
+                    asn_app_consume_bytes_f *callback, void *callback_key) {
     asn_enc_rval_t er;
     enum xer_encoder_flags_e xer_flags = XER_F_CANONICAL;
 
@@ -303,9 +306,8 @@
 
 asn_dec_rval_t
 asn_decode(const asn_codec_ctx_t *opt_codec_ctx,
-           enum asn_transfer_syntax syntax, struct asn_TYPE_descriptor_s *td,
+           enum asn_transfer_syntax syntax, const asn_TYPE_descriptor_t *td,
            void **sptr, const void *buffer, size_t size) {
-
     if(!td || !td->op || !sptr || (size && !buffer)) {
         ASN__DECODE_FAILED;
     }
diff --git a/skeletons/asn_application.h b/skeletons/asn_application.h
index d75a2ce..a125562 100644
--- a/skeletons/asn_application.h
+++ b/skeletons/asn_application.h
@@ -78,9 +78,8 @@
 asn_enc_rval_t asn_encode_to_buffer(
     const asn_codec_ctx_t *opt_codec_parameters, /* See asn_codecs.h */
     enum asn_transfer_syntax,
-    struct asn_TYPE_descriptor_s *type_to_encode,
-    void *structure_to_encode,
-    void *buffer, size_t buffer_size);
+    const struct asn_TYPE_descriptor_s *type_to_encode,
+    const void *structure_to_encode, void *buffer, size_t buffer_size);
 
 
 /*
@@ -118,11 +117,11 @@
  */
 asn_dec_rval_t asn_decode(
     const asn_codec_ctx_t *opt_codec_parameters, enum asn_transfer_syntax,
-    struct asn_TYPE_descriptor_s *type_to_decode,
+    const struct asn_TYPE_descriptor_s *type_to_decode,
     void **structure_ptr, /* Pointer to a target structure's pointer */
     const void *buffer,   /* Data to be decoded */
     size_t size           /* Size of that buffer */
-    );
+);
 
 
 /*
@@ -134,7 +133,7 @@
  * particular constraint has failed.
  */
 typedef void (asn_app_constraint_failed_f)(void *application_specific_key,
-	struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
+	const struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
 	const void *structure_which_failed_ptr,
 	const char *error_message_format, ...) CC_PRINTFLIKE(4, 5);
 
diff --git a/skeletons/asn_bit_data.h b/skeletons/asn_bit_data.h
index 750522b..8b13663 100644
--- a/skeletons/asn_bit_data.h
+++ b/skeletons/asn_bit_data.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+ * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_BIT_DATA
diff --git a/skeletons/asn_codecs.h b/skeletons/asn_codecs.h
index 4b2a294..e75c270 100644
--- a/skeletons/asn_codecs.h
+++ b/skeletons/asn_codecs.h
@@ -1,6 +1,5 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+/*
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_CODECS_H
@@ -52,10 +51,10 @@
 	 */
 
 	/* Type which cannot be encoded */
-	struct asn_TYPE_descriptor_s *failed_type;
+	const struct asn_TYPE_descriptor_s *failed_type;
 
 	/* Pointer to the structure of that type */
-	void *structure_ptr;
+	const void *structure_ptr;
 } asn_enc_rval_t;
 #define	ASN__ENCODE_FAILED do {					\
 	asn_enc_rval_t tmp_error;				\
diff --git a/skeletons/asn_codecs_prim.c b/skeletons/asn_codecs_prim.c
index f15a18d..78448a8 100644
--- a/skeletons/asn_codecs_prim.c
+++ b/skeletons/asn_codecs_prim.c
@@ -11,9 +11,9 @@
  */
 asn_dec_rval_t
 ber_decode_primitive(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td,
-	void **sptr, const void *buf_ptr, size_t size, int tag_mode) {
-	ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr;
+                     const asn_TYPE_descriptor_t *td, void **sptr,
+                     const void *buf_ptr, size_t size, int tag_mode) {
+    ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr;
 	asn_dec_rval_t rval;
 	ber_tlv_len_t length = 0; /* =0 to avoid [incorrect] warning. */
 
@@ -81,11 +81,11 @@
  * Encode an always-primitive type using DER.
  */
 asn_enc_rval_t
-der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t erval;
-	ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr;
+der_encode_primitive(const asn_TYPE_descriptor_t *td, const void *sptr,
+                     int tag_mode, ber_tlv_tag_t tag,
+                     asn_app_consume_bytes_f *cb, void *app_key) {
+    asn_enc_rval_t erval;
+	const ASN__PRIMITIVE_TYPE_t *st = (const ASN__PRIMITIVE_TYPE_t *)sptr;
 
 	ASN_DEBUG("%s %s as a primitive type (tm=%d)",
 		cb?"Encoding":"Estimating", td->name, tag_mode);
@@ -144,8 +144,8 @@
  * Local internal type passed around as an argument.
  */
 struct xdp_arg_s {
-	asn_TYPE_descriptor_t *type_descriptor;
-	void *struct_key;
+    const asn_TYPE_descriptor_t *type_descriptor;
+    void *struct_key;
 	xer_primitive_body_decoder_f *prim_body_decoder;
 	int decoded_something;
 	int want_more;
@@ -249,14 +249,11 @@
 
 asn_dec_rval_t
 xer_decode_primitive(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *td,
-	void **sptr,
-	size_t struct_size,
-	const char *opt_mname,
-	const void *buf_ptr, size_t size,
-	xer_primitive_body_decoder_f *prim_body_decoder
-) {
-	const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
+                     const asn_TYPE_descriptor_t *td, void **sptr,
+                     size_t struct_size, const char *opt_mname,
+                     const void *buf_ptr, size_t size,
+                     xer_primitive_body_decoder_f *prim_body_decoder) {
+    const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
 	asn_struct_ctx_t s_ctx;
 	struct xdp_arg_s s_arg;
 	asn_dec_rval_t rc;
diff --git a/skeletons/asn_codecs_prim.h b/skeletons/asn_codecs_prim.h
index 917c892..3399ee7 100644
--- a/skeletons/asn_codecs_prim.h
+++ b/skeletons/asn_codecs_prim.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_CODECS_PRIM_H
@@ -30,21 +30,19 @@
 	XPBD_NOT_BODY_IGNORE,	/* Not a body format, but safe to ignore */
 	XPBD_BODY_CONSUMED	/* Body is recognized and consumed */
 };
-typedef enum xer_pbd_rval (xer_primitive_body_decoder_f)
-	(asn_TYPE_descriptor_t *td, void *struct_ptr,
-		const void *chunk_buf, size_t chunk_size);
+typedef enum xer_pbd_rval(xer_primitive_body_decoder_f)(
+    const asn_TYPE_descriptor_t *td, void *struct_ptr,
+    const void *chunk_buf, size_t chunk_size);
 
 /*
  * Specific function to decode simple primitive types.
  * Also see xer_decode_general() in xer_decoder.h
  */
-asn_dec_rval_t xer_decode_primitive(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *type_descriptor,
-	void **struct_ptr, size_t struct_size,
-	const char *opt_mname,
-	const void *buf_ptr, size_t size,
-	xer_primitive_body_decoder_f *prim_body_decoder
-);
+asn_dec_rval_t xer_decode_primitive(
+    const asn_codec_ctx_t *opt_codec_ctx,
+    const asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr,
+    size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size,
+    xer_primitive_body_decoder_f *prim_body_decoder);
 
 #ifdef __cplusplus
 }
diff --git a/skeletons/asn_internal.h b/skeletons/asn_internal.h
index e308182..74ae1dc 100644
--- a/skeletons/asn_internal.h
+++ b/skeletons/asn_internal.h
@@ -1,6 +1,5 @@
-/*-
- * Copyright (c) 2003, 2004, 2005, 2007 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+/*
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 /*
diff --git a/skeletons/asn_random_fill.h b/skeletons/asn_random_fill.h
index bfaa13e..47f9b8a 100644
--- a/skeletons/asn_random_fill.h
+++ b/skeletons/asn_random_fill.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+ * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN_RANDOM_FILL
diff --git a/skeletons/asn_system.h b/skeletons/asn_system.h
index 6dbd148..eacacc4 100644
--- a/skeletons/asn_system.h
+++ b/skeletons/asn_system.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 /*
diff --git a/skeletons/ber_decoder.c b/skeletons/ber_decoder.c
index fffd1a1..75d6016 100644
--- a/skeletons/ber_decoder.c
+++ b/skeletons/ber_decoder.c
@@ -28,9 +28,9 @@
  */
 asn_dec_rval_t
 ber_decode(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *type_descriptor,
-	void **struct_ptr, const void *ptr, size_t size) {
-	asn_codec_ctx_t s_codec_ctx;
+           const asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr,
+           const void *ptr, size_t size) {
+    asn_codec_ctx_t s_codec_ctx;
 
 	/*
 	 * Stack checker requires that the codec context
@@ -63,10 +63,10 @@
  */
 asn_dec_rval_t
 ber_check_tags(const asn_codec_ctx_t *opt_codec_ctx,
-		asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx,
-		const void *ptr, size_t size, int tag_mode, int last_tag_form,
-		ber_tlv_len_t *last_length, int *opt_tlv_form) {
-	ssize_t consumed_myself = 0;
+               const asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx,
+               const void *ptr, size_t size, int tag_mode, int last_tag_form,
+               ber_tlv_len_t *last_length, int *opt_tlv_form) {
+    ssize_t consumed_myself = 0;
 	ssize_t tag_len;
 	ssize_t len_len;
 	ber_tlv_tag_t tlv_tag;
diff --git a/skeletons/ber_decoder.h b/skeletons/ber_decoder.h
index e9907bd..1ac2a5e 100644
--- a/skeletons/ber_decoder.h
+++ b/skeletons/ber_decoder.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_BER_DECODER_H_
@@ -22,21 +22,21 @@
  * NOTE: Use the der_encode() function (der_encoder.h) to produce encoding
  * which is compliant with ber_decode().
  */
-asn_dec_rval_t ber_decode(const struct asn_codec_ctx_s *opt_codec_ctx,
-	struct asn_TYPE_descriptor_s *type_descriptor,
-	void **struct_ptr,	/* Pointer to a target structure's pointer */
-	const void *buffer,	/* Data to be decoded */
-	size_t size		/* Size of that buffer */
-	);
+asn_dec_rval_t ber_decode(
+    const struct asn_codec_ctx_s *opt_codec_ctx,
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    void **struct_ptr,  /* Pointer to a target structure's pointer */
+    const void *buffer, /* Data to be decoded */
+    size_t size         /* Size of that buffer */
+);
 
 /*
  * Type of generic function which decodes the byte stream into the structure.
  */
-typedef asn_dec_rval_t (ber_type_decoder_f)(
-		const struct asn_codec_ctx_s *opt_codec_ctx,
-		struct asn_TYPE_descriptor_s *type_descriptor,
-		void **struct_ptr, const void *buf_ptr, size_t size,
-		int tag_mode);
+typedef asn_dec_rval_t(ber_type_decoder_f)(
+    const struct asn_codec_ctx_s *opt_codec_ctx,
+    const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr,
+    const void *buf_ptr, size_t size, int tag_mode);
 
 /*******************************
  * INTERNALLY USEFUL FUNCTIONS *
@@ -50,15 +50,14 @@
  * head->last_tag_form is non-zero.
  */
 asn_dec_rval_t ber_check_tags(
-		const struct asn_codec_ctx_s *opt_codec_ctx,	/* codec options */
-		struct asn_TYPE_descriptor_s *type_descriptor,
-		asn_struct_ctx_t *opt_ctx,	/* saved decoding context */
-		const void *ptr, size_t size,
-		int tag_mode,		/* {-1,0,1}: IMPLICIT, no, EXPLICIT */
-		int last_tag_form,	/* {-1,0:1}: any, primitive, constr */
-		ber_tlv_len_t *last_length,
-		int *opt_tlv_form	/* optional tag form */
-	);
+    const struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    asn_struct_ctx_t *opt_ctx, /* saved decoding context */
+    const void *ptr, size_t size,
+    int tag_mode,      /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+    int last_tag_form, /* {-1,0:1}: any, primitive, constr */
+    ber_tlv_len_t *last_length, int *opt_tlv_form /* optional tag form */
+);
 
 #ifdef __cplusplus
 }
diff --git a/skeletons/ber_tlv_length.h b/skeletons/ber_tlv_length.h
index f7f95e5..d1e4d48 100644
--- a/skeletons/ber_tlv_length.h
+++ b/skeletons/ber_tlv_length.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_BER_TLV_LENGTH_H_
diff --git a/skeletons/ber_tlv_tag.h b/skeletons/ber_tlv_tag.h
index 60e8668..ce227ad 100644
--- a/skeletons/ber_tlv_tag.h
+++ b/skeletons/ber_tlv_tag.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_BER_TLV_TAG_H_
diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c
index 49c389d..628979e 100644
--- a/skeletons/constr_CHOICE.c
+++ b/skeletons/constr_CHOICE.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #include <asn_internal.h>
@@ -103,9 +102,10 @@
  * The decoder of the CHOICE type.
  */
 asn_dec_rval_t
-CHOICE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const void *ptr, size_t size, int tag_mode) {
-	/*
+CHOICE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td, void **struct_ptr,
+                  const void *ptr, size_t size, int tag_mode) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_CHOICE_specifics_t *specs =
@@ -360,13 +360,13 @@
 }
 
 asn_enc_rval_t
-CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
-		int tag_mode, ber_tlv_tag_t tag,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
+CHOICE_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                  int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb,
+                  void *app_key) {
+    const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
 	asn_TYPE_member_t *elm;	/* CHOICE element */
 	asn_enc_rval_t erval;
-	void *memb_ptr;
+	const void *memb_ptr;
 	size_t computed_size = 0;
 	unsigned present;
 
@@ -396,8 +396,9 @@
 	 */
 	elm = &td->elements[present-1];
 	if(elm->flags & ATF_POINTER) {
-		memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
-		if(memb_ptr == 0) {
+        memb_ptr =
+            *(const void *const *)((const char *)sptr + elm->memb_offset);
+        if(memb_ptr == 0) {
 			if(elm->optional) {
 				erval.encoded = 0;
 				ASN__ENCODED_OK(erval);
@@ -406,8 +407,8 @@
 			ASN__ENCODE_FAILED;
 		}
 	} else {
-		memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-	}
+        memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+    }
 
 	/*
 	 * If the CHOICE itself is tagged EXPLICIT:
@@ -483,10 +484,11 @@
 }
 
 int
-CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
-	unsigned present;
+CHOICE_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                  asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    const asn_CHOICE_specifics_t *specs =
+        (const asn_CHOICE_specifics_t *)td->specifics;
+    unsigned present;
 
 	if(!sptr) {
 		ASN__CTFAIL(app_key, td, sptr,
@@ -544,10 +546,10 @@
  * Decode the XER (XML) data.
  */
 asn_dec_rval_t
-CHOICE_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-	/*
+CHOICE_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td, void **struct_ptr,
+                  const char *opt_mname, const void *buf_ptr, size_t size) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
@@ -774,11 +776,12 @@
 
 
 asn_enc_rval_t
-CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const asn_CHOICE_specifics_t *specs=(const asn_CHOICE_specifics_t *)td->specifics;
-	asn_enc_rval_t er;
+CHOICE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                  enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+                  void *app_key) {
+    const asn_CHOICE_specifics_t *specs =
+        (const asn_CHOICE_specifics_t *)td->specifics;
+    asn_enc_rval_t er;
 	unsigned present;
 
 	if(!sptr)
@@ -794,18 +797,19 @@
 	}  else {
 		asn_enc_rval_t tmper;
 		asn_TYPE_member_t *elm = &td->elements[present-1];
-		void *memb_ptr;
+		const void *memb_ptr;
 		const char *mname = elm->name;
 		unsigned int mlen = strlen(mname);
 
 		if(elm->flags & ATF_POINTER) {
-			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
-			if(!memb_ptr) ASN__ENCODE_FAILED;
+            memb_ptr =
+                *(const void *const *)((const char *)sptr + elm->memb_offset);
+            if(!memb_ptr) ASN__ENCODE_FAILED;
 		} else {
-			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-		}
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+        }
 
-		er.encoded = 0;
+        er.encoded = 0;
 
 		if(!(flags & XER_F_CANONICAL)) ASN__TEXT_INDENT(1, ilevel);
 		ASN__CALLBACK3("<", 1, mname, mlen, ">", 1);
@@ -826,7 +830,8 @@
 }
 
 asn_dec_rval_t
-CHOICE_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+CHOICE_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                   const asn_TYPE_descriptor_t *td,
                    const asn_per_constraints_t *constraints, void **sptr,
                    asn_per_data_t *pd) {
     const asn_CHOICE_specifics_t *specs =
@@ -878,8 +883,11 @@
 	}
 
 	/* Adjust if canonical order is different from natural order */
-	if(specs->canonical_order)
-		value = specs->canonical_order[value];
+	if(specs->from_canonical_order) {
+        ASN_DEBUG("CHOICE presence from wire %d", value);
+		value = specs->from_canonical_order[value];
+        ASN_DEBUG("CHOICE presence index effective %d", value);
+    }
 
 	/* Set presence to be able to free it later */
 	_set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1);
@@ -909,13 +917,13 @@
 }
 
 asn_enc_rval_t
-CHOICE_encode_uper(asn_TYPE_descriptor_t *td,
-                   const asn_per_constraints_t *constraints, void *sptr,
+CHOICE_encode_uper(const asn_TYPE_descriptor_t *td,
+                   const asn_per_constraints_t *constraints, const void *sptr,
                    asn_per_outp_t *po) {
-	const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
+    const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
 	asn_TYPE_member_t *elm;	/* CHOICE's element */
 	const asn_per_constraint_t *ct;
-	void *memb_ptr;
+	const void *memb_ptr;
 	unsigned present;
 	int present_enc;
 
@@ -941,17 +949,20 @@
 
 	ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present);
 
-	/* Adjust if canonical order is different from natural order */
-	if(specs->canonical_order)
-		present_enc = specs->canonical_order[present];
-	else
-		present_enc = present;
+    /* Adjust if canonical order is different from natural order */
+    if(specs->to_canonical_order)
+        present_enc = specs->to_canonical_order[present];
+    else
+        present_enc = present;
 
-	if(ct && ct->range_bits >= 0) {
+    if(ct && ct->range_bits >= 0) {
 		if(present_enc < ct->lower_bound
 		|| present_enc > ct->upper_bound) {
 			if(ct->flags & APC_EXTENSIBLE) {
-				if(per_put_few_bits(po, 1, 1))
+                ASN_DEBUG(
+                    "CHOICE member %d (enc %d) is an extension (%ld..%ld)",
+                    present, present_enc, ct->lower_bound, ct->upper_bound);
+                if(per_put_few_bits(po, 1, 1))
 					ASN__ENCODE_FAILED;
 			} else {
 				ASN__ENCODE_FAILED;
@@ -959,44 +970,51 @@
 			ct = 0;
 		}
 	}
-	if(ct && ct->flags & APC_EXTENSIBLE)
-		if(per_put_few_bits(po, 0, 1))
+	if(ct && ct->flags & APC_EXTENSIBLE) {
+        ASN_DEBUG("CHOICE member %d (enc %d) is not an extension (%ld..%ld)",
+                  present, present_enc, ct->lower_bound, ct->upper_bound);
+        if(per_put_few_bits(po, 0, 1))
 			ASN__ENCODE_FAILED;
+    }
+
 
 	elm = &td->elements[present];
-	if(elm->flags & ATF_POINTER) {
+    ASN_DEBUG("CHOICE member \"%s\" %d (as %d)", elm->name, present,
+              present_enc);
+    if(elm->flags & ATF_POINTER) {
 		/* Member is a pointer to another structure */
-		memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
-		if(!memb_ptr) ASN__ENCODE_FAILED;
+        memb_ptr =
+            *(const void *const *)((const char *)sptr + elm->memb_offset);
+        if(!memb_ptr) ASN__ENCODE_FAILED;
 	} else {
-		memb_ptr = (char *)sptr + elm->memb_offset;
-	}
+        memb_ptr = (const char *)sptr + elm->memb_offset;
+    }
 
-	if(ct && ct->range_bits >= 0) {
-		if(per_put_few_bits(po, present_enc, ct->range_bits))
-			ASN__ENCODE_FAILED;
+    if(ct && ct->range_bits >= 0) {
+        if(per_put_few_bits(po, present_enc, ct->range_bits))
+            ASN__ENCODE_FAILED;
 
-		return elm->type->op->uper_encoder(elm->type, elm->encoding_constraints.per_constraints,
-			memb_ptr, po);
-	} else {
-		asn_enc_rval_t rval;
-		if(specs->ext_start == -1)
-			ASN__ENCODE_FAILED;
-		if(uper_put_nsnnwn(po, present_enc - specs->ext_start))
-			ASN__ENCODE_FAILED;
-		if(uper_open_type_put(elm->type, elm->encoding_constraints.per_constraints,
-			memb_ptr, po))
-			ASN__ENCODE_FAILED;
-		rval.encoded = 0;
-		ASN__ENCODED_OK(rval);
-	}
+        return elm->type->op->uper_encoder(
+            elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po);
+    } else {
+        asn_enc_rval_t rval;
+        if(specs->ext_start == -1) ASN__ENCODE_FAILED;
+        if(uper_put_nsnnwn(po, present_enc - specs->ext_start))
+            ASN__ENCODE_FAILED;
+        if(uper_open_type_put(elm->type,
+                              elm->encoding_constraints.per_constraints,
+                              memb_ptr, po))
+            ASN__ENCODE_FAILED;
+        rval.encoded = 0;
+        ASN__ENCODED_OK(rval);
+    }
 }
-   
+
 
 int
-CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
+CHOICE_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+             asn_app_consume_bytes_f *cb, void *app_key) {
+    const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics;
 	unsigned present;
 
 	if(!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
diff --git a/skeletons/constr_CHOICE.h b/skeletons/constr_CHOICE.h
index 57d58a9..7649480 100644
--- a/skeletons/constr_CHOICE.h
+++ b/skeletons/constr_CHOICE.h
@@ -1,6 +1,5 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+/*
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_CONSTR_CHOICE_H_
@@ -28,7 +27,8 @@
 	unsigned tag2el_count;
 
 	/* Canonical ordering of CHOICE elements, for PER */
-	const unsigned *canonical_order;
+	const unsigned *to_canonical_order;
+	const unsigned *from_canonical_order;
 
 	/*
 	 * Extensions-related stuff.
diff --git a/skeletons/constr_CHOICE_oer.c b/skeletons/constr_CHOICE_oer.c
index 39310b0..6480a96 100644
--- a/skeletons/constr_CHOICE_oer.c
+++ b/skeletons/constr_CHOICE_oer.c
@@ -125,7 +125,8 @@
 }
 
 asn_dec_rval_t
-CHOICE_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+CHOICE_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td,
                   const asn_oer_constraints_t *constraints, void **struct_ptr,
                   const void *ptr, size_t size) {
     /*
@@ -314,14 +315,14 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-CHOICE_encode_oer(asn_TYPE_descriptor_t *td,
-                  const asn_oer_constraints_t *constraints, void *sptr,
+CHOICE_encode_oer(const asn_TYPE_descriptor_t *td,
+                  const asn_oer_constraints_t *constraints, const void *sptr,
                   asn_app_consume_bytes_f *cb, void *app_key) {
     const asn_CHOICE_specifics_t *specs =
         (const asn_CHOICE_specifics_t *)td->specifics;
     asn_TYPE_member_t *elm; /* CHOICE element */
     unsigned present;
-    void *memb_ptr;
+    const void *memb_ptr;
     ber_tlv_tag_t tag;
     ssize_t tag_len;
     asn_enc_rval_t er = {0, 0, 0};
@@ -340,13 +341,14 @@
 
     elm = &td->elements[present-1];
     if(elm->flags & ATF_POINTER) {
-        memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
+        memb_ptr =
+            *(const void *const *)((const char *)sptr + elm->memb_offset);
         if(memb_ptr == 0) {
             /* Mandatory element absent */
             ASN__ENCODE_FAILED;
         }
     } else {
-        memb_ptr = (void *)((char *)sptr + elm->memb_offset);
+        memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
     }
 
     tag = asn_TYPE_outmost_tag(elm->type, memb_ptr, elm->tag_mode, elm->tag);
@@ -359,7 +361,7 @@
         ASN__ENCODE_FAILED;
     }
 
-    if(specs->ext_start >= 0 && specs->ext_start <= (present-1)) {
+    if(specs->ext_start >= 0 && (unsigned)specs->ext_start <= (present-1)) {
         ssize_t encoded = oer_open_type_put(elm->type,
                                elm->encoding_constraints.oer_constraints,
                                memb_ptr, cb, app_key);
diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c
index d4c16a6..46af34f 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -110,15 +110,16 @@
  * The decoder of the SEQUENCE type.
  */
 asn_dec_rval_t
-SEQUENCE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const void *ptr, size_t size, int tag_mode) {
-	/*
+SEQUENCE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
+                    const asn_TYPE_descriptor_t *td, void **struct_ptr,
+                    const void *ptr, size_t size, int tag_mode) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_SEQUENCE_specifics_t *specs = (const asn_SEQUENCE_specifics_t *)td->specifics;
-	asn_TYPE_member_t *elements = td->elements;
+    const asn_TYPE_member_t *elements = td->elements;
 
-	/*
+    /*
 	 * Parts of the structure being constructed.
 	 */
 	void *st = *struct_ptr;	/* Target structure. */
@@ -515,10 +516,10 @@
  * The DER encoder of the SEQUENCE type.
  */
 asn_enc_rval_t
-SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
-	void *sptr, int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	size_t computed_size = 0;
+SEQUENCE_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                    int tag_mode, ber_tlv_tag_t tag,
+                    asn_app_consume_bytes_f *cb, void *app_key) {
+    size_t computed_size = 0;
 	asn_enc_rval_t erval;
 	ssize_t ret;
 	size_t edx;
@@ -532,12 +533,13 @@
 	for(edx = 0; edx < td->elements_count; edx++) {
 		asn_TYPE_member_t *elm = &td->elements[edx];
 
-		void *memb_ptr;		/* Pointer to the member */
-		void **memb_ptr2;	/* Pointer to that pointer */
+		const void *memb_ptr;		/* Pointer to the member */
+        const void *const *memb_ptr2; /* Pointer to that pointer */
 
-		if(elm->flags & ATF_POINTER) {
-			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-			if(!*memb_ptr2) {
+        if(elm->flags & ATF_POINTER) {
+            memb_ptr2 =
+                (const void *const *)((const char *)sptr + elm->memb_offset);
+            if(!*memb_ptr2) {
 				ASN_DEBUG("Element %s %zu not present",
 					elm->name, edx);
 				if(elm->optional)
@@ -546,12 +548,12 @@
 				ASN__ENCODE_FAILED;
 			}
 		} else {
-			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-			memb_ptr2 = &memb_ptr;
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+            memb_ptr2 = &memb_ptr;
 		}
 
 		/* Eliminate default values */
-		if(elm->default_value && elm->default_value(0, memb_ptr2) == 1)
+		if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0)
 			continue;
 
 		erval = elm->type->op->der_encoder(elm->type, *memb_ptr2,
@@ -581,20 +583,21 @@
 	for(edx = 0; edx < td->elements_count; edx++) {
 		asn_TYPE_member_t *elm = &td->elements[edx];
 		asn_enc_rval_t tmperval;
-		void *memb_ptr;		/* Pointer to the member */
-		void **memb_ptr2;	/* Pointer to that pointer */
+        const void *memb_ptr;           /* Pointer to the member */
+        const void *const *memb_ptr2;   /* Pointer to that pointer */
 
-		if(elm->flags & ATF_POINTER) {
-			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-			if(!*memb_ptr2) continue;
+        if(elm->flags & ATF_POINTER) {
+            memb_ptr2 =
+                (const void *const *)((const char *)sptr + elm->memb_offset);
+            if(!*memb_ptr2) continue;
 		} else {
-			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-			memb_ptr2 = &memb_ptr;
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+            memb_ptr2 = &memb_ptr;
 		}
 
 		/* Eliminate default values */
-		if(elm->default_value && elm->default_value(0, memb_ptr2) == 1)
-			continue;
+        if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0)
+            continue;
 
 		tmperval = elm->type->op->der_encoder(elm->type, *memb_ptr2,
 			elm->tag_mode, elm->tag, cb, app_key);
@@ -628,10 +631,10 @@
  * Decode the XER (XML) data.
  */
 asn_dec_rval_t
-SEQUENCE_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const char *opt_mname,
-		const void *ptr, size_t size) {
-	/*
+SEQUENCE_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
+                    const asn_TYPE_descriptor_t *td, void **struct_ptr,
+                    const char *opt_mname, const void *ptr, size_t size) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_SEQUENCE_specifics_t *specs
@@ -876,9 +879,9 @@
 }
 
 asn_enc_rval_t
-SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel,
-                    enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
-                    void *app_key) {
+SEQUENCE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                    int ilevel, enum xer_encoder_flags_e flags,
+                    asn_app_consume_bytes_f *cb, void *app_key) {
     asn_enc_rval_t er;
     int xcan = (flags & XER_F_CANONICAL);
     asn_TYPE_descriptor_t *tmp_def_val_td = 0;
@@ -892,16 +895,17 @@
     for(edx = 0; edx < td->elements_count; edx++) {
         asn_enc_rval_t tmper;
         asn_TYPE_member_t *elm = &td->elements[edx];
-        void *memb_ptr;
+        const void *memb_ptr;
         const char *mname = elm->name;
         unsigned int mlen = strlen(mname);
 
         if(elm->flags & ATF_POINTER) {
-            memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
+            memb_ptr =
+                *(const void *const *)((const char *)sptr + elm->memb_offset);
             if(!memb_ptr) {
                 assert(tmp_def_val == 0);
-                if(elm->default_value) {
-                    if(elm->default_value(1, &tmp_def_val)) {
+                if(elm->default_value_set) {
+                    if(elm->default_value_set(&tmp_def_val)) {
                         ASN__ENCODE_FAILED;
                     } else {
                         memb_ptr = tmp_def_val;
@@ -915,7 +919,7 @@
                 }
             }
         } else {
-            memb_ptr = (void *)((char *)sptr + elm->memb_offset);
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
         }
 
         if(!xcan) ASN__TEXT_INDENT(1, ilevel);
@@ -943,9 +947,9 @@
 }
 
 int
-SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	size_t edx;
+SEQUENCE_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+               asn_app_consume_bytes_f *cb, void *app_key) {
+    size_t edx;
 	int ret;
 
 	if(!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
@@ -1035,9 +1039,9 @@
 }
 
 int
-SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	size_t edx;
+SEQUENCE_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                    asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    size_t edx;
 
 	if(!sptr) {
 		ASN__CTFAIL(app_key, td, sptr,
@@ -1083,10 +1087,11 @@
 #ifndef ASN_DISABLE_PER_SUPPORT
 
 asn_dec_rval_t
-SEQUENCE_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+SEQUENCE_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                     const asn_TYPE_descriptor_t *td,
                      const asn_per_constraints_t *constraints, void **sptr,
                      asn_per_data_t *pd) {
-	const asn_SEQUENCE_specifics_t *specs = (const asn_SEQUENCE_specifics_t *)td->specifics;
+    const asn_SEQUENCE_specifics_t *specs = (const asn_SEQUENCE_specifics_t *)td->specifics;
 	void *st = *sptr;	/* Target structure. */
 	int extpresent;		/* Extension additions are present */
 	uint8_t *opres;		/* Presence of optional root members */
@@ -1159,9 +1164,9 @@
 				(int)opmd.nboff, (int)opmd.nbits);
 			if(present == 0) {
 				/* This element is not present */
-				if(elm->default_value) {
+				if(elm->default_value_set) {
 					/* Fill-in DEFAULT */
-					if(elm->default_value(1, memb_ptr2)) {
+					if(elm->default_value_set(memb_ptr2)) {
 						FREEMEM(opres);
 						ASN__DECODE_FAILED;
 					}
@@ -1281,7 +1286,7 @@
 		asn_TYPE_member_t *elm = &td->elements[edx];
 		void **memb_ptr2;	/* Pointer to member pointer */
 
-		if(!elm->default_value) continue;
+		if(!elm->default_value_set) continue;
 
 		/* Fetch the pointer to this member */
 		if(elm->flags & ATF_POINTER) {
@@ -1293,8 +1298,8 @@
 		}
 
 		/* Set default value */
-		if(elm->default_value(1, memb_ptr2)) {
-			ASN__DECODE_FAILED;
+        if(elm->default_value_set(memb_ptr2)) {
+            ASN__DECODE_FAILED;
 		}
 	}
 
@@ -1304,9 +1309,9 @@
 }
 
 static int
-SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr,
-		asn_per_outp_t *po1, asn_per_outp_t *po2) {
-	const asn_SEQUENCE_specifics_t *specs
+SEQUENCE__handle_extensions(const asn_TYPE_descriptor_t *td, const void *sptr,
+                            asn_per_outp_t *po1, asn_per_outp_t *po2) {
+    const asn_SEQUENCE_specifics_t *specs
 		= (const asn_SEQUENCE_specifics_t *)td->specifics;
 	int exts_present = 0;
 	int exts_count = 0;
@@ -1318,9 +1323,9 @@
 	/* Find out which extensions are present */
 	for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) {
 		asn_TYPE_member_t *elm = &td->elements[edx];
-		void *memb_ptr;		/* Pointer to the member */
-		void **memb_ptr2;	/* Pointer to that pointer */
-		int present;
+        const void *memb_ptr; /* Pointer to the member */
+        const void *const *memb_ptr2; /* Pointer to that pointer */
+        int present;
 
 		if(!IN_EXTENSION_GROUP(specs, edx)) {
 			ASN_DEBUG("%s (@%zu) is not extension", elm->type->name, edx);
@@ -1329,11 +1334,12 @@
 
 		/* Fetch the pointer to this member */
 		if(elm->flags & ATF_POINTER) {
-			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-			present = (*memb_ptr2 != 0);
+            memb_ptr2 =
+                (const void *const *)((const char *)sptr + elm->memb_offset);
+            present = (*memb_ptr2 != 0);
 		} else {
-			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-			memb_ptr2 = &memb_ptr;
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+            memb_ptr2 = &memb_ptr;
 			present = 1;
 		}
 
@@ -1356,10 +1362,10 @@
 }
 
 asn_enc_rval_t
-SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td,
-                     const asn_per_constraints_t *constraints, void *sptr,
+SEQUENCE_encode_uper(const asn_TYPE_descriptor_t *td,
+                     const asn_per_constraints_t *constraints, const void *sptr,
                      asn_per_outp_t *po) {
-	const asn_SEQUENCE_specifics_t *specs
+    const asn_SEQUENCE_specifics_t *specs
 		= (const asn_SEQUENCE_specifics_t *)td->specifics;
 	asn_enc_rval_t er;
 	int n_extensions;
@@ -1381,7 +1387,7 @@
 	 * and whether to encode extensions
 	 */
 	if(specs->ext_before >= 0) {
-		n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0);
+		n_extensions = SEQUENCE__handle_extensions(td, sptr, 0, 0);
 		if(n_extensions < 0)
 			ASN__ENCODE_FAILED;
 		if(per_put_few_bits(po, n_extensions ? 1 : 0, 1))
@@ -1393,31 +1399,32 @@
 	/* Encode a presence bitmap */
 	for(i = 0; i < specs->roms_count; i++) {
 		asn_TYPE_member_t *elm;
-		void *memb_ptr;		/* Pointer to the member */
-		void **memb_ptr2;	/* Pointer to that pointer */
-		int present;
+		const void *memb_ptr;		/* Pointer to the member */
+        const void *const *memb_ptr2; /* Pointer to that pointer */
+        int present;
 
 		edx = specs->oms[i];
 		elm = &td->elements[edx];
 
 		/* Fetch the pointer to this member */
 		if(elm->flags & ATF_POINTER) {
-			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-			present = (*memb_ptr2 != 0);
+            memb_ptr2 =
+                (const void *const *)((const char *)sptr + elm->memb_offset);
+            present = (*memb_ptr2 != 0);
 		} else {
-			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-			memb_ptr2 = &memb_ptr;
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+            memb_ptr2 = &memb_ptr;
 			present = 1;
 		}
 
 		/* Eliminate default values */
-		if(present && elm->default_value
-		&& elm->default_value(0, memb_ptr2) == 1)
-			present = 0;
+        if(present && elm->default_value_cmp
+           && elm->default_value_cmp(*memb_ptr2) == 0)
+            present = 0;
 
 		ASN_DEBUG("Element %s %s %s->%s is %s",
 			elm->flags & ATF_POINTER ? "ptr" : "inline",
-			elm->default_value ? "def" : "wtv",
+			elm->default_value_cmp ? "def" : "wtv",
 			td->name, elm->name, present ? "present" : "absent");
 		if(per_put_few_bits(po, present, 1))
 			ASN__ENCODE_FAILED;
@@ -1431,18 +1438,19 @@
 		? td->elements_count : specs->ext_before - 1); edx++) {
 
 		asn_TYPE_member_t *elm = &td->elements[edx];
-		void *memb_ptr;		/* Pointer to the member */
-		void **memb_ptr2;	/* Pointer to that pointer */
+        const void *memb_ptr;         /* Pointer to the member */
+        const void *const *memb_ptr2; /* Pointer to that pointer */
 
-		if(IN_EXTENSION_GROUP(specs, edx))
+        if(IN_EXTENSION_GROUP(specs, edx))
 			continue;
 
 		ASN_DEBUG("About to encode %s", elm->type->name);
 
 		/* Fetch the pointer to this member */
 		if(elm->flags & ATF_POINTER) {
-			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-			if(!*memb_ptr2) {
+            memb_ptr2 =
+                (const void *const *)((const char *)sptr + elm->memb_offset);
+            if(!*memb_ptr2) {
 				ASN_DEBUG("Element %s %zu not present",
 					elm->name, edx);
 				if(elm->optional)
@@ -1451,12 +1459,12 @@
 				ASN__ENCODE_FAILED;
 			}
 		} else {
-			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-			memb_ptr2 = &memb_ptr;
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+            memb_ptr2 = &memb_ptr;
 		}
 
 		/* Eliminate default values */
-		if(elm->default_value && elm->default_value(0, memb_ptr2) == 1)
+		if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0)
 			continue;
 
 		ASN_DEBUG("Encoding %s->%s", td->name, elm->name);
@@ -1477,12 +1485,12 @@
 	ASN_DEBUG("Bit-map of %d elements", n_extensions);
 	/* #18.7. Encoding the extensions presence bit-map. */
 	/* TODO: act upon NOTE in #18.7 for canonical PER */
-	if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions)
+	if(SEQUENCE__handle_extensions(td, sptr, po, 0) != n_extensions)
 		ASN__ENCODE_FAILED;
 
 	ASN_DEBUG("Writing %d extensions", n_extensions);
 	/* #18.9. Encode extensions as open type fields. */
-	if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions)
+	if(SEQUENCE__handle_extensions(td, sptr, 0, po) != n_extensions)
 		ASN__ENCODE_FAILED;
 
 	ASN__ENCODED_OK(er);
diff --git a/skeletons/constr_SEQUENCE.h b/skeletons/constr_SEQUENCE.h
index fd44353..01d0311 100644
--- a/skeletons/constr_SEQUENCE.h
+++ b/skeletons/constr_SEQUENCE.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_CONSTR_SEQUENCE_H_
diff --git a/skeletons/constr_SEQUENCE_OF.c b/skeletons/constr_SEQUENCE_OF.c
index fa60786..7d63540 100644
--- a/skeletons/constr_SEQUENCE_OF.c
+++ b/skeletons/constr_SEQUENCE_OF.c
@@ -11,11 +11,11 @@
  * The DER encoder of the SEQUENCE OF type.
  */
 asn_enc_rval_t
-SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_TYPE_member_t *elm = td->elements;
-	asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(ptr);
+SEQUENCE_OF_encode_der(const asn_TYPE_descriptor_t *td, const void *ptr,
+                       int tag_mode, ber_tlv_tag_t tag,
+                       asn_app_consume_bytes_f *cb, void *app_key) {
+    asn_TYPE_member_t *elm = td->elements;
+	const asn_anonymous_sequence_ *list = _A_CSEQUENCE_FROM_VOID(ptr);
 	size_t computed_size = 0;
 	ssize_t encoding_size = 0;
 	asn_enc_rval_t erval;
@@ -88,17 +88,17 @@
 }
 
 asn_enc_rval_t
-SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel,
-                       enum xer_encoder_flags_e flags,
+SEQUENCE_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                       int ilevel, enum xer_encoder_flags_e flags,
                        asn_app_consume_bytes_f *cb, void *app_key) {
     asn_enc_rval_t er;
     const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
-    asn_TYPE_member_t *elm = td->elements;
-    asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(sptr);
+    const asn_TYPE_member_t *elm = td->elements;
+    const asn_anonymous_sequence_ *list = _A_CSEQUENCE_FROM_VOID(sptr);
     const char *mname = specs->as_XMLValueList
                             ? 0
                             : ((*elm->name) ? elm->name : elm->type->xml_tag);
-    unsigned int mlen = mname ? strlen(mname) : 0;
+    size_t mlen = mname ? strlen(mname) : 0;
     int xcan = (flags & XER_F_CANONICAL);
     int i;
 
@@ -140,19 +140,19 @@
 }
 
 asn_enc_rval_t
-SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td,
-                        const asn_per_constraints_t *constraints, void *sptr,
-                        asn_per_outp_t *po) {
-	asn_anonymous_sequence_ *list;
+SEQUENCE_OF_encode_uper(const asn_TYPE_descriptor_t *td,
+                        const asn_per_constraints_t *constraints,
+                        const void *sptr, asn_per_outp_t *po) {
+    const asn_anonymous_sequence_ *list;
 	const asn_per_constraint_t *ct;
 	asn_enc_rval_t er;
-	asn_TYPE_member_t *elm = td->elements;
+	const asn_TYPE_member_t *elm = td->elements;
 	int seq;
 
 	if(!sptr) ASN__ENCODE_FAILED;
-	list = _A_SEQUENCE_FROM_VOID(sptr);
+    list = _A_CSEQUENCE_FROM_VOID(sptr);
 
-	er.encoded = 0;
+    er.encoded = 0;
 
 	ASN_DEBUG("Encoding %s as SEQUENCE OF (%d)", td->name, list->count);
 
diff --git a/skeletons/constr_SEQUENCE_OF.h b/skeletons/constr_SEQUENCE_OF.h
index c2acc6a..45204f3 100644
--- a/skeletons/constr_SEQUENCE_OF.h
+++ b/skeletons/constr_SEQUENCE_OF.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_CONSTR_SEQUENCE_OF_H_
diff --git a/skeletons/constr_SEQUENCE_oer.c b/skeletons/constr_SEQUENCE_oer.c
index 4e71596..9906af9 100644
--- a/skeletons/constr_SEQUENCE_oer.c
+++ b/skeletons/constr_SEQUENCE_oer.c
@@ -66,17 +66,20 @@
     }
 }
 
-static void *element_ptr(void *struct_ptr, asn_TYPE_member_t *elm) {
+static const void *
+element_ptr(const void *struct_ptr, const asn_TYPE_member_t *elm) {
     if(elm->flags & ATF_POINTER) {
         /* Member is a pointer to another structure */
-        return *(void **)((char *)struct_ptr + elm->memb_offset);
+        return *(const void *const *)((const char *)struct_ptr
+                                      + elm->memb_offset);
     } else {
-        return (void *)((char *)struct_ptr + elm->memb_offset);
+        return (const void *)((const char *)struct_ptr + elm->memb_offset);
     }
 }
 
 asn_dec_rval_t
-SEQUENCE_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+SEQUENCE_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
+                    const asn_TYPE_descriptor_t *td,
                     const asn_oer_constraints_t *constraints, void **struct_ptr,
                     const void *ptr, size_t size) {
     const asn_SEQUENCE_specifics_t *specs =
@@ -177,11 +180,11 @@
                     ASN_DEBUG("Presence map ended prematurely: %d", present);
                     RETURN(RC_FAIL);
                 } else if(present == 0) {
-                    if(elm->default_value) {
+                    if(elm->default_value_set) {
                         /* Fill-in DEFAULT */
                         void *tmp;
-                        if(elm->default_value(1,
-                                              element_ptrptr(st, elm, &tmp))) {
+                        if(elm->default_value_set(
+                               element_ptrptr(st, elm, &tmp))) {
                             RETURN(RC_FAIL);
                         }
                     }
@@ -322,7 +325,8 @@
                 /* Fall through */
             case 0:
                 /* Fill-in DEFAULT */
-                if(elm->default_value && elm->default_value(1, memb_ptr2)) {
+                if(elm->default_value_set
+                   && elm->default_value_set(memb_ptr2)) {
                     RETURN(RC_FAIL);
                 }
                 continue;
@@ -388,8 +392,8 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-SEQUENCE_encode_oer(asn_TYPE_descriptor_t *td,
-                    const asn_oer_constraints_t *constraints, void *sptr,
+SEQUENCE_encode_oer(const asn_TYPE_descriptor_t *td,
+                    const asn_oer_constraints_t *constraints, const void *sptr,
                     asn_app_consume_bytes_f *cb, void *app_key) {
     const asn_SEQUENCE_specifics_t *specs = (const asn_SEQUENCE_specifics_t *)td->specifics;
     size_t computed_size = 0;
@@ -412,10 +416,10 @@
             for(edx = specs->ext_after + 1;
                 (ssize_t)edx < specs->ext_before - 1; edx++) {
                 asn_TYPE_member_t *elm = &td->elements[edx];
-                void *memb_ptr = element_ptr(sptr, elm);
+                const void *memb_ptr = element_ptr(sptr, elm);
                 if(memb_ptr) {
-                    if(elm->default_value
-                       && elm->default_value(0, &memb_ptr) == 1) {
+                    if(elm->default_value_cmp
+                       && elm->default_value_cmp(memb_ptr) == 0) {
                         /* Do not encode default values in extensions */
                     } else {
                         has_extensions = 1;
@@ -440,10 +444,10 @@
                 if(IN_EXTENSION_GROUP(specs, edx)) break;
 
                 if(elm->optional) {
-                    void *memb_ptr = element_ptr(sptr, elm);
+                    const void *memb_ptr = element_ptr(sptr, elm);
                     uint32_t has_component = memb_ptr != NULL;
-                    if(has_component && elm->default_value
-                       && elm->default_value(0, &memb_ptr) == 1) {
+                    if(has_component && elm->default_value_cmp
+                       && elm->default_value_cmp(&memb_ptr) == 0) {
                         has_component = 0;
                     }
                     ret = asn_put_few_bits(&preamble, has_component, 1);
@@ -464,13 +468,14 @@
     for(edx = 0; edx < td->elements_count; edx++) {
         asn_TYPE_member_t *elm = &td->elements[edx];
         asn_enc_rval_t er;
-        void *memb_ptr;
+        const void *memb_ptr;
 
         if(IN_EXTENSION_GROUP(specs, edx)) break;
 
         memb_ptr = element_ptr(sptr, elm);
         if(memb_ptr) {
-            if(elm->default_value && elm->default_value(0, &memb_ptr) == 1) {
+            if(elm->default_value_cmp
+               && elm->default_value_cmp(memb_ptr) == 0) {
                 /* Skip default values in encoding */
                 continue;
             }
@@ -524,9 +529,9 @@
         for(edx = specs->ext_after + 1; (ssize_t)edx < specs->ext_before - 1;
             edx++) {
             asn_TYPE_member_t *elm = &td->elements[edx];
-            void *memb_ptr = element_ptr(sptr, elm);
-            if(memb_ptr && elm->default_value
-               && elm->default_value(0, &memb_ptr) == 1) {
+            const void *memb_ptr = element_ptr(sptr, elm);
+            if(memb_ptr && elm->default_value_cmp
+               && elm->default_value_cmp(memb_ptr) == 0) {
                 memb_ptr = 0;   /* Do not encode default value. */
             }
             ret |= asn_put_few_bits(&extadds, memb_ptr ? 1 : 0, 1);
@@ -540,11 +545,11 @@
         for(edx = specs->ext_after + 1; (ssize_t)edx < specs->ext_before - 1;
             edx++) {
             asn_TYPE_member_t *elm = &td->elements[edx];
-            void *memb_ptr = element_ptr(sptr, elm);
+            const void *memb_ptr = element_ptr(sptr, elm);
 
             if(memb_ptr) {
-                if(elm->default_value
-                   && elm->default_value(0, &memb_ptr) == 1) {
+                if(elm->default_value_cmp
+                   && elm->default_value_cmp(memb_ptr) == 0) {
                     /* Do not encode default value. */
                 } else {
                     asn_enc_rval_t er = elm->type->op->oer_encoder(
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c
index 422e663..4f0230c 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -7,7 +7,7 @@
 #include <constr_SET.h>
 
 /* Check that all the mandatory members are present */
-static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st);
+static int _SET_is_populated(const asn_TYPE_descriptor_t *td, const void *st);
 
 /*
  * Number of bytes left for this structure.
@@ -94,13 +94,14 @@
  * The decoder of the SET type.
  */
 asn_dec_rval_t
-SET_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const void *ptr, size_t size, int tag_mode) {
-	/*
+SET_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
+               const asn_TYPE_descriptor_t *td, void **struct_ptr,
+               const void *ptr, size_t size, int tag_mode) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
-	asn_TYPE_member_t *elements = td->elements;
+	const asn_TYPE_member_t *elements = td->elements;
 
 	/*
 	 * Parts of the structure being constructed.
@@ -392,8 +393,8 @@
 }
 
 static int
-_SET_is_populated(asn_TYPE_descriptor_t *td, void *st) {
-	const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
+_SET_is_populated(const asn_TYPE_descriptor_t *td, const void *st) {
+    const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
 	size_t edx;
 
 	/*
@@ -404,8 +405,9 @@
 		unsigned int midx, pres, must;
 
 		midx = edx/(8 * sizeof(specs->_mandatory_elements[0]));
-		pres = ((unsigned int *)((char *)st + specs->pres_offset))[midx];
-		must = sys_ntohl(specs->_mandatory_elements[midx]);
+        pres = ((const unsigned int *)((const char *)st
+                                       + specs->pres_offset))[midx];
+        must = sys_ntohl(specs->_mandatory_elements[midx]);
 
 		if((pres & must) == must) {
 			/*
@@ -432,10 +434,9 @@
  * The DER encoder of the SET type.
  */
 asn_enc_rval_t
-SET_encode_der(asn_TYPE_descriptor_t *td,
-	void *sptr, int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
+SET_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, int tag_mode,
+               ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) {
+    const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
 	size_t computed_size = 0;
 	asn_enc_rval_t er;
 	int t2m_build_own = (specs->tag2el_count != td->elements_count);
@@ -467,15 +468,16 @@
 	for(edx = 0; edx < td->elements_count; edx++) {
 		asn_TYPE_member_t *elm = &td->elements[edx];
 		asn_enc_rval_t tmper;
-		void *memb_ptr_dontuse; /* Pointer to the member */
-		void **memb_ptr2;	/* Pointer to that pointer */
+		const void *memb_ptr_dontuse; /* Pointer to the member */
+        const void *const *memb_ptr2; /* Pointer to that pointer */
 
-		/*
+        /*
 		 * Compute the length of the encoding of this member.
 		 */
 		if(elm->flags & ATF_POINTER) {
-			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-			if(!*memb_ptr2) {
+            memb_ptr2 =
+                (const void *const *)((const char *)sptr + elm->memb_offset);
+            if(!*memb_ptr2) {
 				if(!elm->optional) {
 					/* Mandatory elements missing */
 					FREEMEM(t2m_build);
@@ -489,13 +491,14 @@
 				continue;
 			}
 		} else {
-			memb_ptr_dontuse = (void *)((char *)sptr + elm->memb_offset);
-			memb_ptr2 = &memb_ptr_dontuse; /* Only use of memb_ptr_dontuse */
+            memb_ptr_dontuse =
+                (const void *)((const char *)sptr + elm->memb_offset);
+            memb_ptr2 = &memb_ptr_dontuse; /* Only use of memb_ptr_dontuse */
 		}
 
 		/* Eliminate default values */
-		if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) {
-			if(t2m_build) {
+        if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0) {
+            if(t2m_build) {
 				t2m_build[t2m_count].el_no = edx;
 				t2m_build[t2m_count].el_tag = 0;
 				t2m_count++;
@@ -566,23 +569,25 @@
 		asn_TYPE_member_t *elm;
 		asn_enc_rval_t tmper;
 
-		void *memb_ptr_dontuse;		/* Pointer to the member */
-		void **memb_ptr2;	/* Pointer to that pointer */
+		const void *memb_ptr_dontuse;		/* Pointer to the member */
+        const void *const *memb_ptr2;       /* Pointer to that pointer */
 
-		/* Encode according to the tag order */
+        /* Encode according to the tag order */
 		elm = &td->elements[t2m[edx].el_no];
 
 		if(elm->flags & ATF_POINTER) {
-			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-			if(!*memb_ptr2) continue;
+            memb_ptr2 =
+                (const void *const *)((const char *)sptr + elm->memb_offset);
+            if(!*memb_ptr2) continue;
 		} else {
-			memb_ptr_dontuse = (void *)((char *)sptr + elm->memb_offset);
-			memb_ptr2 = &memb_ptr_dontuse; /* Only use of memb_ptr_dontuse */
+            memb_ptr_dontuse =
+                (const void *)((const char *)sptr + elm->memb_offset);
+            memb_ptr2 = &memb_ptr_dontuse; /* Only use of memb_ptr_dontuse */
 		}
 
 		/* Eliminate default values */
-		if(elm->default_value && elm->default_value(0, memb_ptr2) == 1)
-			continue;
+        if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0)
+            continue;
 
 		tmper = elm->type->op->der_encoder(elm->type, *memb_ptr2,
 			elm->tag_mode, elm->tag, cb, app_key);
@@ -615,14 +620,14 @@
  * Decode the XER (XML) data.
  */
 asn_dec_rval_t
-SET_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-	/*
+SET_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
+               const asn_TYPE_descriptor_t *td, void **struct_ptr,
+               const char *opt_mname, const void *buf_ptr, size_t size) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
-	asn_TYPE_member_t *elements = td->elements;
+	const asn_TYPE_member_t *elements = td->elements;
 	const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
 
 	/*
@@ -660,7 +665,7 @@
 		pxer_chunk_type_e ch_type;	/* XER chunk type */
 		ssize_t ch_size;		/* Chunk size */
 		xer_check_tag_e tcv;		/* Tag check value */
-		asn_TYPE_member_t *elm;
+		const asn_TYPE_member_t *elm;
 
 		/*
 		 * Go inside the inner member of a set.
@@ -831,10 +836,10 @@
 }
 
 asn_enc_rval_t
-SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
+SET_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+               enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+               void *app_key) {
+    const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
 	asn_enc_rval_t er;
 	int xcan = (flags & XER_F_CANONICAL);
 	const asn_TYPE_tag2member_t *t2m = specs->tag2el_cxer;
@@ -851,25 +856,26 @@
 	for(edx = 0; edx < t2m_count; edx++) {
 		asn_enc_rval_t tmper;
 		asn_TYPE_member_t *elm;
-		void *memb_ptr;
-		const char *mname;
-		unsigned int mlen;
+        const void *memb_ptr;
+        const char *mname;
+		size_t mlen;
 
 		elm = &td->elements[t2m[edx].el_no];
 		mname = elm->name;
 		mlen = strlen(elm->name);
 
 		if(elm->flags & ATF_POINTER) {
-			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
-			if(!memb_ptr) {
+            memb_ptr =
+                *(const void *const *)((const char *)sptr + elm->memb_offset);
+            if(!memb_ptr) {
 				if(elm->optional)
 					continue;
 				/* Mandatory element missing */
 				ASN__ENCODE_FAILED;
 			}
 		} else {
-			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-		}
+            memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
+        }
 
 		if(!xcan)
 			ASN__TEXT_INDENT(1, ilevel);
@@ -892,9 +898,9 @@
 }
 
 int
-SET_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	size_t edx;
+SET_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+          asn_app_consume_bytes_f *cb, void *app_key) {
+    size_t edx;
 	int ret;
 
 	if(!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
@@ -975,9 +981,9 @@
 }
 
 int
-SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	size_t edx;
+SET_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+               asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    size_t edx;
 
 	if(!sptr) {
 		ASN__CTFAIL(app_key, td, sptr,
diff --git a/skeletons/constr_SET.h b/skeletons/constr_SET.h
index 489355a..d64a00f 100644
--- a/skeletons/constr_SET.h
+++ b/skeletons/constr_SET.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_CONSTR_SET_H_
diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c
index 54ced1f..f3f5294 100644
--- a/skeletons/constr_SET_OF.c
+++ b/skeletons/constr_SET_OF.c
@@ -66,15 +66,16 @@
  * The decoder of the SET OF type.
  */
 asn_dec_rval_t
-SET_OF_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const void *ptr, size_t size, int tag_mode) {
-	/*
+SET_OF_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td, void **struct_ptr,
+                  const void *ptr, size_t size, int tag_mode) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
-	asn_TYPE_member_t *elm = td->elements;	/* Single one */
+    const asn_TYPE_member_t *elm = td->elements; /* Single one */
 
-	/*
+    /*
 	 * Parts of the structure being constructed.
 	 */
 	void *st = *struct_ptr;	/* Target structure. */
@@ -310,14 +311,14 @@
  * The DER encoder of the SET OF type.
  */
 asn_enc_rval_t
-SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
-	int tag_mode, ber_tlv_tag_t tag,
-	asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_TYPE_member_t *elm = td->elements;
-	asn_TYPE_descriptor_t *elm_type = elm->type;
+SET_OF_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
+                  int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb,
+                  void *app_key) {
+    const asn_TYPE_member_t *elm = td->elements;
+	const asn_TYPE_descriptor_t *elm_type = elm->type;
 	der_type_encoder_f *der_encoder = elm_type->op->der_encoder;
-	asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr);
-	size_t computed_size = 0;
+    const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr);
+    size_t computed_size = 0;
 	ssize_t encoding_size = 0;
 	struct _el_buffer *encoded_els;
 	ssize_t eels_count = 0;
@@ -334,8 +335,8 @@
 	for(edx = 0; edx < list->count; edx++) {
 		void *memb_ptr = list->array[edx];
 		if(!memb_ptr) continue;
-		erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0);
-		if(erval.encoded == -1)
+        erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0);
+        if(erval.encoded == -1)
 			return erval;
 		computed_size += erval.encoded;
 
@@ -352,7 +353,7 @@
 	if(encoding_size == -1) {
 		erval.encoded = -1;
 		erval.failed_type = td;
-		erval.structure_ptr = ptr;
+		erval.structure_ptr = sptr;
 		return erval;
 	}
 	computed_size += encoding_size;
@@ -367,22 +368,19 @@
 	 * according to their encodings. Build an array of the
 	 * encoded elements.
 	 */
-	encoded_els = (struct _el_buffer *)MALLOC(
-				list->count * sizeof(encoded_els[0]));
-	if(encoded_els == NULL) {
-		erval.encoded = -1;
-		erval.failed_type = td;
-		erval.structure_ptr = ptr;
-		return erval;
-	}
+    encoded_els =
+        (struct _el_buffer *)MALLOC(list->count * sizeof(encoded_els[0]));
+    if(encoded_els == NULL) {
+        ASN__ENCODE_FAILED;
+    }
 
-	ASN_DEBUG("Encoding members of %s SET OF", td->name);
+    ASN_DEBUG("Encoding members of %s SET OF", td->name);
 
 	/*
 	 * Encode all members.
 	 */
 	for(edx = 0; edx < list->count; edx++) {
-		void *memb_ptr = list->array[edx];
+		const void *memb_ptr = list->array[edx];
 		struct _el_buffer *encoded_el = &encoded_els[eels_count];
 
 		if(!memb_ptr) continue;
@@ -398,10 +396,7 @@
 			for(edx--; edx >= 0; edx--)
 				FREEMEM(encoded_els[edx].buf);
 			FREEMEM(encoded_els);
-			erval.encoded = -1;
-			erval.failed_type = td;
-			erval.structure_ptr = ptr;
-			return erval;
+            ASN__ENCODE_FAILED;
 		}
 
 		/*
@@ -444,14 +439,11 @@
 		 * Standard callback failed, or
 		 * encoded size is not equal to the computed size.
 		 */
-		erval.encoded = -1;
-		erval.failed_type = td;
-		erval.structure_ptr = ptr;
+        ASN__ENCODE_FAILED;
 	} else {
 		erval.encoded = computed_size;
-	}
-
-	ASN__ENCODED_OK(erval);
+        ASN__ENCODED_OK(erval);
+    }
 }
 
 #undef	XER_ADVANCE
@@ -466,14 +458,14 @@
  * Decode the XER (XML) data.
  */
 asn_dec_rval_t
-SET_OF_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-	void **struct_ptr, const char *opt_mname,
-		const void *buf_ptr, size_t size) {
-	/*
+SET_OF_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td, void **struct_ptr,
+                  const char *opt_mname, const void *buf_ptr, size_t size) {
+    /*
 	 * Bring closer parts of structure description.
 	 */
 	const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
-	asn_TYPE_member_t *element = td->elements;
+	const asn_TYPE_member_t *element = td->elements;
 	const char *elm_tag;
 	const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
 
@@ -651,14 +643,14 @@
 
 
 asn_enc_rval_t
-SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
-	int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t er;
+SET_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+                  enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+                  void *app_key) {
+    asn_enc_rval_t er;
 	const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
-	asn_TYPE_member_t *elm = td->elements;
-	asn_anonymous_set_ *list = _A_SET_FROM_VOID(sptr);
-	const char *mname = specs->as_XMLValueList
+	const asn_TYPE_member_t *elm = td->elements;
+    const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr);
+    const char *mname = specs->as_XMLValueList
 		? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag);
 	size_t mlen = mname ? strlen(mname) : 0;
 	int xcan = (flags & XER_F_CANONICAL);
@@ -750,9 +742,9 @@
 }
 
 int
-SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_TYPE_member_t *elm = td->elements;
+SET_OF_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
+             asn_app_consume_bytes_f *cb, void *app_key) {
+    asn_TYPE_member_t *elm = td->elements;
 	const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr);
 	int ret;
 	int i;
@@ -825,9 +817,9 @@
 }
 
 int
-SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	asn_TYPE_member_t *elm = td->elements;
+SET_OF_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
+                  asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+    const asn_TYPE_member_t *elm = td->elements;
 	asn_constr_check_f *constr;
 	const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr);
 	int i;
@@ -860,13 +852,14 @@
 }
 
 asn_dec_rval_t
-SET_OF_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+SET_OF_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
+                   const asn_TYPE_descriptor_t *td,
                    const asn_per_constraints_t *constraints, void **sptr,
                    asn_per_data_t *pd) {
-	asn_dec_rval_t rv;
+    asn_dec_rval_t rv;
 	const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
-	asn_TYPE_member_t *elm = td->elements;	/* Single one */
-	void *st = *sptr;
+    const asn_TYPE_member_t *elm = td->elements; /* Single one */
+    void *st = *sptr;
 	asn_anonymous_set_ *list;
 	const asn_per_constraint_t *ct;
 	int repeat = 0;
diff --git a/skeletons/constr_SET_OF.h b/skeletons/constr_SET_OF.h
index b5c9819..f32e607 100644
--- a/skeletons/constr_SET_OF.h
+++ b/skeletons/constr_SET_OF.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	CONSTR_SET_OF_H
diff --git a/skeletons/constr_SET_OF_oer.c b/skeletons/constr_SET_OF_oer.c
index 0008fa9..1357c2b 100644
--- a/skeletons/constr_SET_OF_oer.c
+++ b/skeletons/constr_SET_OF_oer.c
@@ -107,9 +107,10 @@
 }
 
 asn_dec_rval_t
-SET_OF_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-                    const asn_oer_constraints_t *constraints, void **struct_ptr,
-                    const void *ptr, size_t size) {
+SET_OF_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
+                  const asn_TYPE_descriptor_t *td,
+                  const asn_oer_constraints_t *constraints, void **struct_ptr,
+                  const void *ptr, size_t size) {
     const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
     asn_dec_rval_t rval = {RC_OK, 0};
     void *st = *struct_ptr; /* Target structure */
@@ -227,13 +228,13 @@
  * Encode as Canonical OER.
  */
 asn_enc_rval_t
-SET_OF_encode_oer(asn_TYPE_descriptor_t *td,
-                    const asn_oer_constraints_t *constraints, void *sptr,
-                    asn_app_consume_bytes_f *cb, void *app_key) {
+SET_OF_encode_oer(const asn_TYPE_descriptor_t *td,
+                  const asn_oer_constraints_t *constraints, const void *sptr,
+                  asn_app_consume_bytes_f *cb, void *app_key) {
+    const asn_TYPE_member_t *elm;
+    const asn_anonymous_set_ *list;
     size_t computed_size = 0;
     ssize_t qty_len;
-    asn_TYPE_member_t *elm;
-    asn_anonymous_set_ *list;
     int n;
 
     (void)constraints;
@@ -241,7 +242,7 @@
     if(!sptr) ASN__ENCODE_FAILED;
 
     elm = td->elements;
-    list = _A_SET_FROM_VOID(sptr);
+    list = _A_CSET_FROM_VOID(sptr);
 
     qty_len = oer_put_quantity(list->count, cb, app_key);
     if(qty_len < 0) {
diff --git a/skeletons/constr_TYPE.h b/skeletons/constr_TYPE.h
index 7810349..089f891 100644
--- a/skeletons/constr_TYPE.h
+++ b/skeletons/constr_TYPE.h
@@ -1,6 +1,5 @@
-/*-
- * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+/*
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 /*
@@ -97,11 +96,11 @@
 /*
  * Print the structure according to its specification.
  */
-typedef int (asn_struct_print_f)(
-		struct asn_TYPE_descriptor_s *type_descriptor,
-		const void *struct_ptr,
-		int level,	/* Indentation level */
-		asn_app_consume_bytes_f *callback, void *app_key);
+typedef int(asn_struct_print_f)(
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const void *struct_ptr,
+    int level, /* Indentation level */
+    asn_app_consume_bytes_f *callback, void *app_key);
 
 /*
  * Compare two structs between each other.
@@ -131,7 +130,7 @@
  * Information Object Set driven constraints.
  */
 typedef struct asn_type_selector_result_s {
-    struct asn_TYPE_descriptor_s *type_descriptor; /* Type encoded. */
+    const struct asn_TYPE_descriptor_s *type_descriptor; /* Type encoded. */
     unsigned presence_index; /* Associated choice variant. */
 } asn_type_selector_result_t;
 typedef asn_type_selector_result_t(asn_type_selector_f)(
@@ -227,7 +226,8 @@
     asn_TYPE_descriptor_t *type;            /* Member type descriptor */
     asn_type_selector_f *type_selector;     /* IoS runtime type selector */
     asn_encoding_constraints_t encoding_constraints;
-    int (*default_value)(int setval, void **sptr); /* DEFAULT <value> */
+    int (*default_value_set)(void **sptr);      /* Set DEFAULT <value> */
+    int (*default_value_cmp)(const void *sptr); /* Compare DEFAULT <value> */
     const char *name; /* ASN.1 identifier of the element */
 } asn_TYPE_member_t;
 
diff --git a/skeletons/constraints.c b/skeletons/constraints.c
index c260997..df3c6c1 100644
--- a/skeletons/constraints.c
+++ b/skeletons/constraints.c
@@ -2,10 +2,10 @@
 #include <constraints.h>
 
 int
-asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor,
-	const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) {
-
-	(void)type_descriptor;	/* Unused argument */
+asn_generic_no_constraint(const asn_TYPE_descriptor_t *type_descriptor,
+                          const void *struct_ptr,
+                          asn_app_constraint_failed_f *cb, void *key) {
+    (void)type_descriptor;	/* Unused argument */
 	(void)struct_ptr;	/* Unused argument */
 	(void)cb;	/* Unused argument */
 	(void)key;	/* Unused argument */
@@ -15,10 +15,10 @@
 }
 
 int
-asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor,
-	const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) {
-
-	(void)type_descriptor;	/* Unused argument */
+asn_generic_unknown_constraint(const asn_TYPE_descriptor_t *type_descriptor,
+                               const void *struct_ptr,
+                               asn_app_constraint_failed_f *cb, void *key) {
+    (void)type_descriptor;	/* Unused argument */
 	(void)struct_ptr;	/* Unused argument */
 	(void)cb;	/* Unused argument */
 	(void)key;	/* Unused argument */
@@ -28,15 +28,16 @@
 }
 
 struct errbufDesc {
-	asn_TYPE_descriptor_t *failed_type;
-	const void *failed_struct_ptr;
+    const asn_TYPE_descriptor_t *failed_type;
+    const void *failed_struct_ptr;
 	char *errbuf;
 	size_t errlen;
 };
 
 static void
-_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) {
-	struct errbufDesc *arg = key;
+_asn_i_ctfailcb(void *key, const asn_TYPE_descriptor_t *td, const void *sptr,
+                const char *fmt, ...) {
+    struct errbufDesc *arg = key;
 	va_list ap;
 	ssize_t vlen;
 	ssize_t maxlen;
@@ -73,7 +74,7 @@
 }
 
 int
-asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor,
+asn_check_constraints(const asn_TYPE_descriptor_t *type_descriptor,
                       const void *struct_ptr, char *errbuf, size_t *errlen) {
     struct errbufDesc arg;
     int ret;
diff --git a/skeletons/constraints.h b/skeletons/constraints.h
index 48d49e2..0bd86a9 100644
--- a/skeletons/constraints.h
+++ b/skeletons/constraints.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	ASN1_CONSTRAINTS_VALIDATOR_H
@@ -25,24 +25,23 @@
  * This function returns 0 in case all ASN.1 constraints are met
  * and -1 if one or more constraints were failed.
  */
-int
-asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor,
-	const void *struct_ptr,	/* Target language's structure */
-	char *errbuf,		/* Returned error description */
-	size_t *errlen		/* Length of the error description */
-	);
+int asn_check_constraints(
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const void *struct_ptr, /* Target language's structure */
+    char *errbuf,           /* Returned error description */
+    size_t *errlen          /* Length of the error description */
+);
 
 
 /*
  * Generic type for constraint checking callback,
  * associated with every type descriptor.
  */
-typedef int (asn_constr_check_f)(
-	struct asn_TYPE_descriptor_s *type_descriptor,
-	const void *struct_ptr,
-	asn_app_constraint_failed_f *optional_callback,	/* Log the error */
-	void *optional_app_key		/* Opaque key passed to a callback */
-	);
+typedef int(asn_constr_check_f)(
+    const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr,
+    asn_app_constraint_failed_f *optional_callback, /* Log the error */
+    void *optional_app_key /* Opaque key passed to a callback */
+);
 
 /*******************************
  * INTERNALLY USEFUL FUNCTIONS *
diff --git a/skeletons/der_encoder.c b/skeletons/der_encoder.c
index a26d57e..2c6a6f7 100644
--- a/skeletons/der_encoder.c
+++ b/skeletons/der_encoder.c
@@ -12,19 +12,17 @@
  * The DER encoder of any type.
  */
 asn_enc_rval_t
-der_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr,
-	asn_app_consume_bytes_f *consume_bytes, void *app_key) {
-
-	ASN_DEBUG("DER encoder invoked for %s",
+der_encode(const asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr,
+           asn_app_consume_bytes_f *consume_bytes, void *app_key) {
+    ASN_DEBUG("DER encoder invoked for %s",
 		type_descriptor->name);
 
 	/*
 	 * Invoke type-specific encoder.
 	 */
-	return type_descriptor->op->der_encoder(type_descriptor,
-		struct_ptr,	/* Pointer to the destination structure */
-		0, 0,
-		consume_bytes, app_key);
+    return type_descriptor->op->der_encoder(
+        type_descriptor, struct_ptr, /* Pointer to the destination structure */
+        0, 0, consume_bytes, app_key);
 }
 
 /*
@@ -51,9 +49,9 @@
  * A variant of the der_encode() which encodes the data into the provided buffer
  */
 asn_enc_rval_t
-der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr,
-	void *buffer, size_t buffer_size) {
-	enc_to_buf_arg arg;
+der_encode_to_buffer(const asn_TYPE_descriptor_t *type_descriptor,
+                     const void *struct_ptr, void *buffer, size_t buffer_size) {
+    enc_to_buf_arg arg;
 	asn_enc_rval_t ec;
 
 	arg.buffer = buffer;
@@ -74,8 +72,8 @@
  * Write out leading TL[v] sequence according to the type definition.
  */
 ssize_t
-der_write_tags(asn_TYPE_descriptor_t *sd, size_t struct_length, int tag_mode,
-               int last_tag_form,
+der_write_tags(const asn_TYPE_descriptor_t *sd, size_t struct_length,
+               int tag_mode, int last_tag_form,
                ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */
                asn_app_consume_bytes_f *cb, void *app_key) {
 #define ASN1_DER_MAX_TAGS_COUNT 4
diff --git a/skeletons/der_encoder.h b/skeletons/der_encoder.h
index 68b9d5c..e93944e 100644
--- a/skeletons/der_encoder.h
+++ b/skeletons/der_encoder.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_DER_ENCODER_H_
@@ -20,31 +20,30 @@
  * NOTE: Use the ber_decode() function (ber_decoder.h) to decode data
  * produced by der_encode().
  */
-asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor,
-		void *struct_ptr,	/* Structure to be encoded */
-		asn_app_consume_bytes_f *consume_bytes_cb,
-		void *app_key		/* Arbitrary callback argument */
-	);
+asn_enc_rval_t der_encode(const struct asn_TYPE_descriptor_s *type_descriptor,
+                          const void *struct_ptr, /* Structure to be encoded */
+                          asn_app_consume_bytes_f *consume_bytes_cb,
+                          void *app_key /* Arbitrary callback argument */
+);
 
 /* A variant of der_encode() which encodes data into the pre-allocated buffer */
 asn_enc_rval_t der_encode_to_buffer(
-		struct asn_TYPE_descriptor_s *type_descriptor,
-		void *struct_ptr,	/* Structure to be encoded */
-		void *buffer,		/* Pre-allocated buffer */
-		size_t buffer_size	/* Initial buffer size (maximum) */
-	);
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const void *struct_ptr, /* Structure to be encoded */
+    void *buffer,           /* Pre-allocated buffer */
+    size_t buffer_size      /* Initial buffer size (maximum) */
+);
 
 /*
  * Type of the generic DER encoder.
  */
-typedef asn_enc_rval_t (der_type_encoder_f)(
-		struct asn_TYPE_descriptor_s *type_descriptor,
-		void *struct_ptr,	/* Structure to be encoded */
-		int tag_mode,		/* {-1,0,1}: IMPLICIT, no, EXPLICIT */
-		ber_tlv_tag_t tag,
-		asn_app_consume_bytes_f *consume_bytes_cb,	/* Callback */
-		void *app_key		/* Arbitrary callback argument */
-	);
+typedef asn_enc_rval_t(der_type_encoder_f)(
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const void *struct_ptr, /* Structure to be encoded */
+    int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+    ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
+    void *app_key /* Arbitrary callback argument */
+);
 
 
 /*******************************
@@ -54,15 +53,13 @@
 /*
  * Write out leading TL[v] sequence according to the type definition.
  */
-ssize_t der_write_tags(
-		struct asn_TYPE_descriptor_s *type_descriptor,
-		size_t struct_length,
-		int tag_mode,		/* {-1,0,1}: IMPLICIT, no, EXPLICIT */
-		int last_tag_form,	/* {0,!0}: prim, constructed */
-		ber_tlv_tag_t tag,
-		asn_app_consume_bytes_f *consume_bytes_cb,
-		void *app_key
-	);
+ssize_t der_write_tags(const struct asn_TYPE_descriptor_s *type_descriptor,
+                       size_t struct_length,
+                       int tag_mode,      /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+                       int last_tag_form, /* {0,!0}: prim, constructed */
+                       ber_tlv_tag_t tag,
+                       asn_app_consume_bytes_f *consume_bytes_cb,
+                       void *app_key);
 
 #ifdef __cplusplus
 }
diff --git a/skeletons/oer_decoder.c b/skeletons/oer_decoder.c
index 52950f4..911a567 100644
--- a/skeletons/oer_decoder.c
+++ b/skeletons/oer_decoder.c
@@ -10,9 +10,9 @@
  */
 asn_dec_rval_t
 oer_decode(const asn_codec_ctx_t *opt_codec_ctx,
-	asn_TYPE_descriptor_t *type_descriptor,
-	void **struct_ptr, const void *ptr, size_t size) {
-	asn_codec_ctx_t s_codec_ctx;
+           const asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr,
+           const void *ptr, size_t size) {
+    asn_codec_ctx_t s_codec_ctx;
 
 	/*
 	 * Stack checker requires that the codec context
@@ -58,7 +58,7 @@
  */
 ssize_t
 oer_open_type_get(const asn_codec_ctx_t *opt_codec_ctx,
-                  struct asn_TYPE_descriptor_s *td,
+                  const struct asn_TYPE_descriptor_s *td,
                   const asn_oer_constraints_t *constraints, void **struct_ptr,
                   const void *bufptr, size_t size) {
     asn_dec_rval_t dr;
@@ -96,7 +96,7 @@
 
 asn_dec_rval_t
 oer_decode_primitive(const asn_codec_ctx_t *opt_codec_ctx,
-                     asn_TYPE_descriptor_t *td,
+                     const asn_TYPE_descriptor_t *td,
                      const asn_oer_constraints_t *constraints, void **sptr,
                      const void *ptr, size_t size) {
     ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr;
diff --git a/skeletons/oer_decoder.h b/skeletons/oer_decoder.h
index 6c95d62..40992e9 100644
--- a/skeletons/oer_decoder.h
+++ b/skeletons/oer_decoder.h
@@ -21,7 +21,7 @@
  * Parses CANONICAL-OER and BASIC-OER.
  */
 asn_dec_rval_t oer_decode(const struct asn_codec_ctx_s *opt_codec_ctx,
-	struct asn_TYPE_descriptor_s *type_descriptor,
+	const struct asn_TYPE_descriptor_s *type_descriptor,
 	void **struct_ptr,	/* Pointer to a target structure's pointer */
 	const void *buffer,	/* Data to be decoded */
 	size_t size		/* Size of that buffer */
@@ -32,7 +32,7 @@
  */
 typedef asn_dec_rval_t(oer_type_decoder_f)(
     const struct asn_codec_ctx_s *opt_codec_ctx,
-    struct asn_TYPE_descriptor_s *type_descriptor,
+    const struct asn_TYPE_descriptor_s *type_descriptor,
     const asn_oer_constraints_t *constraints,
     void **struct_ptr,
     const void *buf_ptr,
@@ -55,7 +55,7 @@
  *      >0:     Number of bytes used from bufptr.
  */
 ssize_t oer_open_type_get(const asn_codec_ctx_t *opt_codec_ctx,
-                          struct asn_TYPE_descriptor_s *td,
+                          const struct asn_TYPE_descriptor_s *td,
                           const asn_oer_constraints_t *constraints,
                           void **struct_ptr, const void *bufptr, size_t size);
 
diff --git a/skeletons/oer_encoder.c b/skeletons/oer_encoder.c
index d0e6ea0..4b7d7da 100644
--- a/skeletons/oer_encoder.c
+++ b/skeletons/oer_encoder.c
@@ -9,18 +9,17 @@
  * The OER encoder of any type.
  */
 asn_enc_rval_t
-oer_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr,
-        asn_app_consume_bytes_f *consume_bytes, void *app_key) {
+oer_encode(const asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr,
+           asn_app_consume_bytes_f *consume_bytes, void *app_key) {
+    ASN_DEBUG("OER encoder invoked for %s", type_descriptor->name);
 
-        ASN_DEBUG("OER encoder invoked for %s",
-                type_descriptor->name);
-
-        /*
-         * Invoke type-specific encoder.
-         */
-        return type_descriptor->op->oer_encoder(type_descriptor, 0,
-                struct_ptr,     /* Pointer to the destination structure */
-                consume_bytes, app_key);
+    /*
+     * Invoke type-specific encoder.
+     */
+    return type_descriptor->op->oer_encoder(
+        type_descriptor, 0,
+        struct_ptr, /* Pointer to the destination structure */
+        consume_bytes, app_key);
 }
 
 /*
@@ -30,29 +29,29 @@
         void *buffer;
         size_t left;
 } enc_to_buf_arg;
-static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) {
-        enc_to_buf_arg *arg = (enc_to_buf_arg *)key;
+static int
+encode_to_buffer_cb(const void *buffer, size_t size, void *key) {
+    enc_to_buf_arg *arg = (enc_to_buf_arg *)key;
 
-        if(arg->left < size)
-                return -1;      /* Data exceeds the available buffer size */
+    if(arg->left < size) return -1; /* Data exceeds the available buffer size */
 
-        memcpy(arg->buffer, buffer, size);
-        arg->buffer = ((char *)arg->buffer) + size;
-        arg->left -= size;
+    memcpy(arg->buffer, buffer, size);
+    arg->buffer = ((char *)arg->buffer) + size;
+    arg->left -= size;
 
-        return 0;
+    return 0;
 }
 
 /*
  * A variant of the oer_encode() which encodes the data into the provided buffer
  */
 asn_enc_rval_t
-oer_encode_to_buffer(struct asn_TYPE_descriptor_s *type_descriptor,
+oer_encode_to_buffer(const asn_TYPE_descriptor_t *type_descriptor,
                      const asn_oer_constraints_t *constraints,
-                     void *struct_ptr,  /* Structure to be encoded */
-                     void *buffer,      /* Pre-allocated buffer */
-                     size_t buffer_size /* Initial buffer size (maximum) */
-                     ) {
+                     const void *struct_ptr, /* Structure to be encoded */
+                     void *buffer,           /* Pre-allocated buffer */
+                     size_t buffer_size      /* Initial buffer size (maximum) */
+) {
     enc_to_buf_arg arg;
     asn_enc_rval_t ec;
 
@@ -79,8 +78,8 @@
 }
 
 asn_enc_rval_t
-oer_encode_primitive(asn_TYPE_descriptor_t *td,
-                     const asn_oer_constraints_t *constraints, void *sptr,
+oer_encode_primitive(const asn_TYPE_descriptor_t *td,
+                     const asn_oer_constraints_t *constraints, const void *sptr,
                      asn_app_consume_bytes_f *cb, void *app_key) {
     const ASN__PRIMITIVE_TYPE_t *st = (const ASN__PRIMITIVE_TYPE_t *)sptr;
     asn_enc_rval_t er = {0, 0, 0};
@@ -112,30 +111,30 @@
 static int
 oer__count_bytes(const void *buffer, size_t size, void *bytes_ptr) {
     size_t *bytes = bytes_ptr;
+    (void)buffer;
     *bytes += size;
     return 0;
 }
 
 ssize_t
-oer_open_type_put(asn_TYPE_descriptor_t *td,
-                  const asn_oer_constraints_t *constraints,
-                  void *sptr, asn_app_consume_bytes_f *cb,
-                  void *app_key) {
+oer_open_type_put(const asn_TYPE_descriptor_t *td,
+                  const asn_oer_constraints_t *constraints, const void *sptr,
+                  asn_app_consume_bytes_f *cb, void *app_key) {
     size_t serialized_byte_count = 0;
     asn_enc_rval_t er;
     ssize_t len_len;
 
     er = td->op->oer_encoder(td, constraints, sptr, oer__count_bytes,
                              &serialized_byte_count);
-    if(er.encoded == -1) return -1;
-    assert(serialized_byte_count == er.encoded);
+    if(er.encoded < 0) return -1;
+    assert(serialized_byte_count == (size_t)er.encoded);
 
     len_len = oer_serialize_length(serialized_byte_count, cb, app_key);
     if(len_len == -1) return -1;
 
     er = td->op->oer_encoder(td, constraints, sptr, cb, app_key);
-    if(er.encoded == -1) return -1;
-    assert(serialized_byte_count == er.encoded);
+    if(er.encoded < 0) return -1;
+    assert(serialized_byte_count == (size_t)er.encoded);
 
     return er.encoded + len_len;
 }
diff --git a/skeletons/oer_encoder.h b/skeletons/oer_encoder.h
index 37d95e3..252bd6a 100644
--- a/skeletons/oer_encoder.h
+++ b/skeletons/oer_encoder.h
@@ -19,31 +19,31 @@
  * Produces CANONICAL-OER output compatible with CANONICAL-OER
  * and BASIC-OER decoders.
  */
-asn_enc_rval_t oer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
-                          void *struct_ptr, /* Structure to be encoded */
+asn_enc_rval_t oer_encode(const struct asn_TYPE_descriptor_s *type_descriptor,
+                          const void *struct_ptr, /* Structure to be encoded */
                           asn_app_consume_bytes_f *consume_bytes_cb,
                           void *app_key /* Arbitrary callback argument */
-                          );
+);
 
 /* A variant of oer_encode() which encodes data into the pre-allocated buffer */
 asn_enc_rval_t oer_encode_to_buffer(
-    struct asn_TYPE_descriptor_s *type_descriptor,
+    const struct asn_TYPE_descriptor_s *type_descriptor,
     const asn_oer_constraints_t *constraints,
-    void *struct_ptr,  /* Structure to be encoded */
-    void *buffer,      /* Pre-allocated buffer */
-    size_t buffer_size /* Initial buffer size (maximum) */
-    );
+    const void *struct_ptr, /* Structure to be encoded */
+    void *buffer,           /* Pre-allocated buffer */
+    size_t buffer_size      /* Initial buffer size (maximum) */
+);
 
 /*
  * Type of the generic OER encoder.
  */
 typedef asn_enc_rval_t(oer_type_encoder_f)(
-    struct asn_TYPE_descriptor_s *type_descriptor,
+    const struct asn_TYPE_descriptor_s *type_descriptor,
     const asn_oer_constraints_t *constraints,
-    void *struct_ptr,                          /* Structure to be encoded */
+    const void *struct_ptr,                    /* Structure to be encoded */
     asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
     void *app_key                              /* Arbitrary callback argument */
-    );
+);
 
 /*
  * Write out the Open Type (X.696 (08/2015), #30).
@@ -51,9 +51,9 @@
  *      -1:     Fatal error encoding the type.
  *     >=0:     Number of bytes serialized.
  */
-ssize_t oer_open_type_put(struct asn_TYPE_descriptor_s *td,
+ssize_t oer_open_type_put(const struct asn_TYPE_descriptor_s *td,
                           const asn_oer_constraints_t *constraints,
-                          void *struct_ptr,
+                          const void *struct_ptr,
                           asn_app_consume_bytes_f *consume_bytes_cb,
                           void *app_key);
 
diff --git a/skeletons/oer_support.h b/skeletons/oer_support.h
index 508ce64..dbc9b5f 100644
--- a/skeletons/oer_support.h
+++ b/skeletons/oer_support.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+ * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	OER_SUPPORT_H
diff --git a/skeletons/per_decoder.c b/skeletons/per_decoder.c
index 6fe71dc..a9051fb 100644
--- a/skeletons/per_decoder.c
+++ b/skeletons/per_decoder.c
@@ -8,8 +8,10 @@
  * multiple of 8 bytes.
  */
 asn_dec_rval_t
-uper_decode_complete(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) {
-	asn_dec_rval_t rval;
+uper_decode_complete(const asn_codec_ctx_t *opt_codec_ctx,
+                     const asn_TYPE_descriptor_t *td, void **sptr,
+                     const void *buffer, size_t size) {
+    asn_dec_rval_t rval;
 
 	rval = uper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0);
 	if(rval.consumed) {
@@ -37,8 +39,10 @@
 }
 
 asn_dec_rval_t
-uper_decode(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) {
-	asn_codec_ctx_t s_codec_ctx;
+uper_decode(const asn_codec_ctx_t *opt_codec_ctx,
+            const asn_TYPE_descriptor_t *td, void **sptr, const void *buffer,
+            size_t size, int skip_bits, int unused_bits) {
+    asn_codec_ctx_t s_codec_ctx;
 	asn_dec_rval_t rval;
 	asn_per_data_t pd;
 
diff --git a/skeletons/per_decoder.h b/skeletons/per_decoder.h
index e97dd78..24dfe93 100644
--- a/skeletons/per_decoder.h
+++ b/skeletons/per_decoder.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_PER_DECODER_H_
@@ -20,11 +20,11 @@
  */
 asn_dec_rval_t uper_decode_complete(
     const struct asn_codec_ctx_s *opt_codec_ctx,
-    struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
+    const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
     void **struct_ptr,  /* Pointer to a target structure's pointer */
     const void *buffer, /* Data to be decoded */
     size_t size         /* Size of data buffer */
-    );
+);
 
 /*
  * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
@@ -32,13 +32,13 @@
  */
 asn_dec_rval_t uper_decode(
     const struct asn_codec_ctx_s *opt_codec_ctx,
-    struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
+    const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
     void **struct_ptr,  /* Pointer to a target structure's pointer */
     const void *buffer, /* Data to be decoded */
     size_t size,        /* Size of data buffer */
     int skip_bits,      /* Number of unused leading bits, 0..7 */
     int unused_bits     /* Number of unused tailing bits, 0..7 */
-    );
+);
 
 
 /*
@@ -46,7 +46,7 @@
  */
 typedef asn_dec_rval_t(per_type_decoder_f)(
     const asn_codec_ctx_t *opt_codec_ctx,
-    struct asn_TYPE_descriptor_s *type_descriptor,
+    const struct asn_TYPE_descriptor_s *type_descriptor,
     const asn_per_constraints_t *constraints, void **struct_ptr,
     asn_per_data_t *per_data);
 
diff --git a/skeletons/per_encoder.c b/skeletons/per_encoder.c
index adee4e6..317897d 100644
--- a/skeletons/per_encoder.c
+++ b/skeletons/per_encoder.c
@@ -2,11 +2,16 @@
 #include <asn_internal.h>
 #include <per_encoder.h>
 
-static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, const asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
+static asn_enc_rval_t uper_encode_internal(const asn_TYPE_descriptor_t *td,
+                                           const asn_per_constraints_t *,
+                                           const void *sptr,
+                                           asn_app_consume_bytes_f *cb,
+                                           void *app_key);
 
 asn_enc_rval_t
-uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
-	return uper_encode_internal(td, 0, sptr, cb, app_key);
+uper_encode(const asn_TYPE_descriptor_t *td, const void *sptr,
+            asn_app_consume_bytes_f *cb, void *app_key) {
+    return uper_encode_internal(td, 0, sptr, cb, app_key);
 }
 
 /*
@@ -30,8 +35,9 @@
 }
 
 asn_enc_rval_t
-uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) {
-	enc_to_buf_arg key;
+uper_encode_to_buffer(const asn_TYPE_descriptor_t *td, const void *sptr,
+                      void *buffer, size_t buffer_size) {
+    enc_to_buf_arg key;
 
 	key.buffer = buffer;
 	key.left = buffer_size;
@@ -65,9 +71,9 @@
 	return 0;
 }
 ssize_t
-uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td,
-                          const asn_per_constraints_t *constraints, void *sptr,
-                          void **buffer_r) {
+uper_encode_to_new_buffer(const asn_TYPE_descriptor_t *td,
+                          const asn_per_constraints_t *constraints,
+                          const void *sptr, void **buffer_r) {
     asn_enc_rval_t er;
 	enc_dyn_arg key;
 
@@ -118,10 +124,10 @@
 }
 
 static asn_enc_rval_t
-uper_encode_internal(asn_TYPE_descriptor_t *td,
-                     const asn_per_constraints_t *constraints, void *sptr,
+uper_encode_internal(const asn_TYPE_descriptor_t *td,
+                     const asn_per_constraints_t *constraints, const void *sptr,
                      asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_per_outp_t po;
+    asn_per_outp_t po;
 	asn_enc_rval_t er;
 
 	/*
diff --git a/skeletons/per_encoder.h b/skeletons/per_encoder.h
index fd090ac..94177cf 100644
--- a/skeletons/per_encoder.h
+++ b/skeletons/per_encoder.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2006-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_PER_ENCODER_H_
@@ -20,10 +20,11 @@
  * field of the return value. Use the following formula to convert to bytes:
  * 	bytes = ((.encoded + 7) / 8)
  */
-asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor,
-	void *struct_ptr,	/* Structure to be encoded */
-	asn_app_consume_bytes_f *consume_bytes_cb,	/* Data collector */
-	void *app_key		/* Arbitrary callback argument */
+asn_enc_rval_t uper_encode(
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const void *struct_ptr,                    /* Structure to be encoded */
+    asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */
+    void *app_key                              /* Arbitrary callback argument */
 );
 
 /*
@@ -32,10 +33,10 @@
  * field of the return value.
  */
 asn_enc_rval_t uper_encode_to_buffer(
-	struct asn_TYPE_descriptor_s *type_descriptor,
-	void *struct_ptr,	/* Structure to be encoded */
-	void *buffer,		/* Pre-allocated buffer */
-	size_t buffer_size	/* Initial buffer size (max) */
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const void *struct_ptr, /* Structure to be encoded */
+    void *buffer,           /* Pre-allocated buffer */
+    size_t buffer_size      /* Initial buffer size (max) */
 );
 
 /*
@@ -46,21 +47,19 @@
  * encoding of uper_encode() and uper_encode_to_buffer().
  */
 ssize_t uper_encode_to_new_buffer(
-	struct asn_TYPE_descriptor_s *type_descriptor,
-	const asn_per_constraints_t *constraints,
-	void *struct_ptr,	/* Structure to be encoded */
-	void **buffer_r		/* Buffer allocated and returned */
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const asn_per_constraints_t *constraints,
+    const void *struct_ptr, /* Structure to be encoded */
+    void **buffer_r         /* Buffer allocated and returned */
 );
 
 /*
  * Type of the generic PER encoder function.
  */
-typedef asn_enc_rval_t (per_type_encoder_f)(
-	struct asn_TYPE_descriptor_s *type_descriptor,
-	const asn_per_constraints_t *constraints,
-	void *struct_ptr,
-	asn_per_outp_t *per_output
-);
+typedef asn_enc_rval_t(per_type_encoder_f)(
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const asn_per_constraints_t *constraints, const void *struct_ptr,
+    asn_per_outp_t *per_output);
 
 #ifdef __cplusplus
 }
diff --git a/skeletons/per_opentype.c b/skeletons/per_opentype.c
index 70a1b44..353766a 100644
--- a/skeletons/per_opentype.c
+++ b/skeletons/per_opentype.c
@@ -17,7 +17,7 @@
 static int uper_ugot_refill(asn_per_data_t *pd);
 static int per_skip_bits(asn_per_data_t *pd, int skip_nbits);
 static asn_dec_rval_t uper_sot_suck(const asn_codec_ctx_t *,
-                                    asn_TYPE_descriptor_t *td,
+                                    const asn_TYPE_descriptor_t *td,
                                     const asn_per_constraints_t *constraints,
                                     void **sptr, asn_per_data_t *pd);
 
@@ -26,7 +26,9 @@
  * #10.1, #10.2
  */
 int
-uper_open_type_put(asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
+uper_open_type_put(const asn_TYPE_descriptor_t *td,
+                   const asn_per_constraints_t *constraints, const void *sptr,
+                   asn_per_outp_t *po) {
     void *buf;
     void *bptr;
     ssize_t size;
@@ -62,9 +64,11 @@
 }
 
 static asn_dec_rval_t
-uper_open_type_get_simple(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
-	const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-	asn_dec_rval_t rv;
+uper_open_type_get_simple(const asn_codec_ctx_t *ctx,
+                          const asn_TYPE_descriptor_t *td,
+                          const asn_per_constraints_t *constraints, void **sptr,
+                          asn_per_data_t *pd) {
+    asn_dec_rval_t rv;
 	ssize_t chunk_bytes;
 	int repeat;
 	uint8_t *buf = 0;
@@ -140,9 +144,11 @@
 }
 
 static asn_dec_rval_t CC_NOTUSED
-uper_open_type_get_complex(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
-	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-	uper_ugot_key arg;
+uper_open_type_get_complex(const asn_codec_ctx_t *ctx,
+                           const asn_TYPE_descriptor_t *td,
+                           asn_per_constraints_t *constraints, void **sptr,
+                           asn_per_data_t *pd) {
+    uper_ugot_key arg;
 	asn_dec_rval_t rv;
 	ssize_t padding;
 
@@ -250,7 +256,7 @@
 
 
 asn_dec_rval_t
-uper_open_type_get(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
+uper_open_type_get(const asn_codec_ctx_t *ctx, const asn_TYPE_descriptor_t *td,
                    const asn_per_constraints_t *constraints, void **sptr,
                    asn_per_data_t *pd) {
     return uper_open_type_get_simple(ctx, td, constraints, sptr, pd);
@@ -278,9 +284,10 @@
  */
 
 static asn_dec_rval_t
-uper_sot_suck(const asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
-	const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-	asn_dec_rval_t rv;
+uper_sot_suck(const asn_codec_ctx_t *ctx, const asn_TYPE_descriptor_t *td,
+              const asn_per_constraints_t *constraints, void **sptr,
+              asn_per_data_t *pd) {
+    asn_dec_rval_t rv;
 
 	(void)ctx;
 	(void)td;
diff --git a/skeletons/per_opentype.h b/skeletons/per_opentype.h
index 31c1832..7e7dc61 100644
--- a/skeletons/per_opentype.h
+++ b/skeletons/per_opentype.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2007-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_PER_OPENTYPE_H_
@@ -10,7 +10,7 @@
 #endif
 
 asn_dec_rval_t uper_open_type_get(const asn_codec_ctx_t *opt_codec_ctx,
-                                  asn_TYPE_descriptor_t *td,
+                                  const asn_TYPE_descriptor_t *td,
                                   const asn_per_constraints_t *constraints,
                                   void **sptr, asn_per_data_t *pd);
 
@@ -21,9 +21,9 @@
  * X.691 (2015/08), #11.2
  * Returns -1 if error is encountered. 0 if all OK.
  */
-int uper_open_type_put(asn_TYPE_descriptor_t *td,
-                       const asn_per_constraints_t *constraints, void *sptr,
-                       asn_per_outp_t *po);
+int uper_open_type_put(const asn_TYPE_descriptor_t *td,
+                       const asn_per_constraints_t *constraints,
+                       const void *sptr, asn_per_outp_t *po);
 
 #ifdef __cplusplus
 }
diff --git a/skeletons/per_support.c b/skeletons/per_support.c
index 95af9f6..a1c7702 100644
--- a/skeletons/per_support.c
+++ b/skeletons/per_support.c
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2005-2014 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+ * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #include <asn_system.h>
diff --git a/skeletons/per_support.h b/skeletons/per_support.h
index 94dde9f..3e905a8 100644
--- a/skeletons/per_support.h
+++ b/skeletons/per_support.h
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2005-2014 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+ * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_PER_SUPPORT_H_
diff --git a/skeletons/xer_decoder.c b/skeletons/xer_decoder.c
index 3ac6b6b..5b87703 100644
--- a/skeletons/xer_decoder.c
+++ b/skeletons/xer_decoder.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #include <asn_application.h>
@@ -11,9 +11,10 @@
  * Decode the XER encoding of a given type.
  */
 asn_dec_rval_t
-xer_decode(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-		void **struct_ptr, const void *buffer, size_t size) {
-	asn_codec_ctx_t s_codec_ctx;
+xer_decode(const asn_codec_ctx_t *opt_codec_ctx,
+           const asn_TYPE_descriptor_t *td, void **struct_ptr,
+           const void *buffer, size_t size) {
+    asn_codec_ctx_t s_codec_ctx;
 
 	/*
 	 * Stack checker requires that the codec context
diff --git a/skeletons/xer_decoder.h b/skeletons/xer_decoder.h
index f865102..b951c41 100644
--- a/skeletons/xer_decoder.h
+++ b/skeletons/xer_decoder.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_XER_DECODER_H_
@@ -17,19 +17,20 @@
  * The XER decoder of any ASN.1 type. May be invoked by the application.
  * Decodes CANONICAL-XER and BASIC-XER.
  */
-asn_dec_rval_t xer_decode(const struct asn_codec_ctx_s *opt_codec_ctx,
-	struct asn_TYPE_descriptor_s *type_descriptor,
-	void **struct_ptr,	/* Pointer to a target structure's pointer */
-	const void *buffer,	/* Data to be decoded */
-	size_t size		/* Size of data buffer */
-	);
+asn_dec_rval_t xer_decode(
+    const struct asn_codec_ctx_s *opt_codec_ctx,
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    void **struct_ptr,  /* Pointer to a target structure's pointer */
+    const void *buffer, /* Data to be decoded */
+    size_t size         /* Size of data buffer */
+);
 
 /*
  * Type of the type-specific XER decoder function.
  */
 typedef asn_dec_rval_t(xer_type_decoder_f)(
     const asn_codec_ctx_t *opt_codec_ctx,
-    struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr,
+    const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr,
     const char *opt_mname, /* Member name */
     const void *buf_ptr, size_t size);
 
diff --git a/skeletons/xer_encoder.c b/skeletons/xer_encoder.c
index a655ae3..4b4891f 100644
--- a/skeletons/xer_encoder.c
+++ b/skeletons/xer_encoder.c
@@ -10,10 +10,10 @@
  * The XER encoder of any type. May be invoked by the application.
  */
 asn_enc_rval_t
-xer_encode(asn_TYPE_descriptor_t *td, void *sptr,
-	enum xer_encoder_flags_e xer_flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	asn_enc_rval_t er = {0, 0, 0};
+xer_encode(const asn_TYPE_descriptor_t *td, const void *sptr,
+           enum xer_encoder_flags_e xer_flags, asn_app_consume_bytes_f *cb,
+           void *app_key) {
+    asn_enc_rval_t er = {0, 0, 0};
 	asn_enc_rval_t tmper;
 	const char *mname;
 	size_t mlen;
@@ -52,8 +52,8 @@
 }
 
 int
-xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) {
-	asn_enc_rval_t er;
+xer_fprint(FILE *stream, const asn_TYPE_descriptor_t *td, const void *sptr) {
+    asn_enc_rval_t er;
 
 	if(!stream) stream = stdout;
 	if(!td || !sptr)
@@ -95,8 +95,8 @@
 }
 
 enum xer_equivalence_e
-xer_equivalent(struct asn_TYPE_descriptor_s *td, void *struct1,
-               void *struct2, FILE *opt_debug_stream) {
+xer_equivalent(const struct asn_TYPE_descriptor_s *td, const void *struct1,
+               const void *struct2, FILE *opt_debug_stream) {
     struct xer_buffer xb1 = {0, 0, 0};
     struct xer_buffer xb2 = {0, 0, 0};
     asn_enc_rval_t e1, e2;
diff --git a/skeletons/xer_encoder.h b/skeletons/xer_encoder.h
index 81c0d0c..564eea7 100644
--- a/skeletons/xer_encoder.h
+++ b/skeletons/xer_encoder.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_XER_ENCODER_H_
@@ -24,12 +24,12 @@
  * The XER encoder of any type. May be invoked by the application.
  * Produces CANONICAL-XER and BASIC-XER depending on the (xer_flags).
  */
-asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
-		void *struct_ptr,	/* Structure to be encoded */
-		enum xer_encoder_flags_e xer_flags,
-		asn_app_consume_bytes_f *consume_bytes_cb,
-		void *app_key		/* Arbitrary callback argument */
-	);
+asn_enc_rval_t xer_encode(const struct asn_TYPE_descriptor_s *type_descriptor,
+                          const void *struct_ptr, /* Structure to be encoded */
+                          enum xer_encoder_flags_e xer_flags,
+                          asn_app_consume_bytes_f *consume_bytes_cb,
+                          void *app_key /* Arbitrary callback argument */
+);
 
 /*
  * A helper function that uses XER encoding/decoding to verify that:
@@ -50,8 +50,8 @@
     XEQ_ROUND_TRIP_FAILED /* Bad round-trip */
 };
 enum xer_equivalence_e xer_equivalent(
-    struct asn_TYPE_descriptor_s *type_descriptor, void *struct1, void *struct2,
-    FILE *opt_debug_stream);
+    const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct1,
+    const void *struct2, FILE *opt_debug_stream);
 
 /*
  * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
@@ -61,19 +61,20 @@
  * 	-1: Problem printing the structure.
  * WARNING: No sensible errno value is returned.
  */
-int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr);
+int xer_fprint(FILE *stream, const struct asn_TYPE_descriptor_s *td,
+               const void *sptr);
 
 /*
  * Type of the generic XER encoder.
  */
-typedef asn_enc_rval_t (xer_type_encoder_f)(
-		struct asn_TYPE_descriptor_s *type_descriptor,
-		void *struct_ptr,	/* Structure to be encoded */
-		int ilevel,		/* Level of indentation */
-		enum xer_encoder_flags_e xer_flags,
-		asn_app_consume_bytes_f *consume_bytes_cb,	/* Callback */
-		void *app_key		/* Arbitrary callback argument */
-	);
+typedef asn_enc_rval_t(xer_type_encoder_f)(
+    const struct asn_TYPE_descriptor_s *type_descriptor,
+    const void *struct_ptr, /* Structure to be encoded */
+    int ilevel,             /* Level of indentation */
+    enum xer_encoder_flags_e xer_flags,
+    asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
+    void *app_key                              /* Arbitrary callback argument */
+);
 
 #ifdef __cplusplus
 }
diff --git a/skeletons/xer_support.h b/skeletons/xer_support.h
index 8b01944..c3a36e7 100644
--- a/skeletons/xer_support.h
+++ b/skeletons/xer_support.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com.
- * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
 #ifndef	_XER_SUPPORT_H_
diff --git a/tests/tests-asn1c-compiler/104-param-1-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/104-param-1-OK.asn1.-Pfwide-types
index c3f4934..7de1b8a 100644
--- a/tests/tests-asn1c-compiler/104-param-1-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/104-param-1-OK.asn1.-Pfwide-types
@@ -39,7 +39,7 @@
 		.type = &asn_DEF_REAL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -74,7 +74,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -131,7 +131,7 @@
 		.type = &asn_DEF_Collection_16P0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "field-REAL"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Bunch, field_IA5String),
@@ -140,7 +140,7 @@
 		.type = &asn_DEF_Collection_16P1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "field-IA5String"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/105-param-2-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/105-param-2-OK.asn1.-Pfwide-types
index 603d9a7..05b2a8e 100644
--- a/tests/tests-asn1c-compiler/105-param-2-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/105-param-2-OK.asn1.-Pfwide-types
@@ -58,7 +58,7 @@
 		.type = &asn_DEF_REAL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed"
 		},
 };
@@ -100,7 +100,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 };
@@ -149,7 +149,7 @@
 		.type = &asn_DEF_signed_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/106-param-constr-OK.asn1.-P b/tests/tests-asn1c-compiler/106-param-constr-OK.asn1.-P
index 32c74a5..c45ec25 100644
--- a/tests/tests-asn1c-compiler/106-param-constr-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/106-param-constr-OK.asn1.-P
@@ -24,7 +24,7 @@
 /*** <<< CODE [Narrow] >>> ***/
 
 static int
-memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_narrow1_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -49,7 +49,7 @@
 }
 
 static int
-memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_narrow2_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -74,7 +74,7 @@
 }
 
 static int
-memb_narrow3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_narrow3_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -101,23 +101,27 @@
 
 /*** <<< STAT-DEFS [Narrow] >>> ***/
 
-static int asn_DFL_2_set_3(int set_value, void **sptr) {
+static int asn_DFL_2_cmp_3(const void *sptr) {
+	const long *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 3 */
+	return (*st != 3);
+}
+static int asn_DFL_2_set_3(void **sptr) {
 	long *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 3 */
-		*st = 3;
-		return 0;
-	} else {
-		/* Test default value 3 */
-		return (*st == 3);
-	}
+	/* Install default value 3 */
+	*st = 3;
+	return 0;
 }
 asn_TYPE_member_t asn_MBR_Narrow_15P0_1[] = {
 	{ ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow1),
@@ -126,7 +130,8 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_narrow1_constraint_1 },
-		.default_value = asn_DFL_2_set_3,	/* DEFAULT 3 */
+		.default_value_cmp = asn_DFL_2_cmp_3,	/* Compare DEFAULT 3 */
+		.default_value_set = asn_DFL_2_set_3,	/* Set DEFAULT 3 */
 		.name = "narrow1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Narrow_15P0, narrow2),
@@ -135,7 +140,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_narrow2_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "narrow2"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow3),
@@ -144,7 +149,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_narrow3_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "narrow3"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/108-param-constr-3-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/108-param-constr-3-OK.asn1.-Pfwide-types
index 13305af..3859933 100644
--- a/tests/tests-asn1c-compiler/108-param-constr-3-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/108-param-constr-3-OK.asn1.-Pfwide-types
@@ -21,7 +21,7 @@
 /*** <<< CODE [MinMax] >>> ***/
 
 int
-MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+MinMax_16P0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -99,7 +99,7 @@
 /*** <<< CODE [ThreePlus] >>> ***/
 
 int
-ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ThreePlus_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr;
 	long value;
diff --git a/tests/tests-asn1c-compiler/110-param-3-OK.asn1.-Pfcompound-names b/tests/tests-asn1c-compiler/110-param-3-OK.asn1.-Pfcompound-names
index 81764e1..9750918 100644
--- a/tests/tests-asn1c-compiler/110-param-3-OK.asn1.-Pfcompound-names
+++ b/tests/tests-asn1c-compiler/110-param-3-OK.asn1.-Pfcompound-names
@@ -52,23 +52,27 @@
 
 /*** <<< STAT-DEFS [Flag] >>> ***/
 
-static int asn_DFL_2_set_5(int set_value, void **sptr) {
+static int asn_DFL_2_cmp_5(const void *sptr) {
+	const long *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 5 */
+	return (*st != 5);
+}
+static int asn_DFL_2_set_5(void **sptr) {
 	long *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 5 */
-		*st = 5;
-		return 0;
-	} else {
-		/* Test default value 5 */
-		return (*st == 5);
-	}
+	/* Install default value 5 */
+	*st = 5;
+	return 0;
 }
 asn_TYPE_member_t asn_MBR_Flag_15P0_1[] = {
 	{ ATF_POINTER, 1, offsetof(struct Flag_15P0, field),
@@ -77,7 +81,8 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = asn_DFL_2_set_5,	/* DEFAULT 5 */
+		.default_value_cmp = asn_DFL_2_cmp_5,	/* Compare DEFAULT 5 */
+		.default_value_set = asn_DFL_2_set_5,	/* Set DEFAULT 5 */
 		.name = "field"
 		},
 };
@@ -112,23 +117,27 @@
 	&asn_SPC_Flag_15P0_specs_1	/* Additional specs */
 };
 
-static int asn_DFL_7_set_5(int set_value, void **sptr) {
+static int asn_DFL_7_cmp_5(const void *sptr) {
+	const long *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 5 */
+	return (*st != 5);
+}
+static int asn_DFL_7_set_5(void **sptr) {
 	long *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 5 */
-		*st = 5;
-		return 0;
-	} else {
-		/* Test default value 5 */
-		return (*st == 5);
-	}
+	/* Install default value 5 */
+	*st = 5;
+	return 0;
 }
 static const asn_INTEGER_enum_map_t asn_MAP_field_value2enum_7[] = {
 	{ 3,	3,	"red" },
@@ -175,7 +184,8 @@
 		.type = &asn_DEF_field_7,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = asn_DFL_7_set_5,	/* DEFAULT 5 */
+		.default_value_cmp = asn_DFL_7_cmp_5,	/* Compare DEFAULT 5 */
+		.default_value_set = asn_DFL_7_set_5,	/* Set DEFAULT 5 */
 		.name = "field"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/119-per-strings-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/119-per-strings-OK.asn1.-Pgen-PER
index fdca0be..ebf970c 100644
--- a/tests/tests-asn1c-compiler/119-per-strings-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/119-per-strings-OK.asn1.-Pgen-PER
@@ -451,7 +451,7 @@
 /*** <<< CODE [PDU] >>> ***/
 
 static int
-memb_ia5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ia5_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -475,7 +475,7 @@
 }
 
 static int
-memb_ia5_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ia5_ce_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -499,7 +499,7 @@
 }
 
 static int
-memb_ia5_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ia5_ir_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -533,7 +533,7 @@
 	return permitted_alphabet_code2value_7[code];
 }
 static int
-memb_vs_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_vs_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const VisibleString_t *st = (const VisibleString_t *)sptr;
 	
@@ -557,7 +557,7 @@
 }
 
 static int
-memb_vs_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_vs_ce_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const VisibleString_t *st = (const VisibleString_t *)sptr;
 	
@@ -581,7 +581,7 @@
 }
 
 static int
-memb_vs_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_vs_ir_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const VisibleString_t *st = (const VisibleString_t *)sptr;
 	
@@ -615,7 +615,7 @@
 	return permitted_alphabet_code2value_11[code];
 }
 static int
-memb_pr_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_pr_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PrintableString_t *st = (const PrintableString_t *)sptr;
 	
@@ -639,7 +639,7 @@
 }
 
 static int
-memb_pr_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_pr_ir_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PrintableString_t *st = (const PrintableString_t *)sptr;
 	
@@ -673,7 +673,7 @@
 	return permitted_alphabet_code2value_14[code];
 }
 static int
-memb_ns_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ns_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const NumericString_t *st = (const NumericString_t *)sptr;
 	
@@ -697,7 +697,7 @@
 }
 
 static int
-memb_ns_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ns_ce_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const NumericString_t *st = (const NumericString_t *)sptr;
 	
@@ -721,7 +721,7 @@
 }
 
 static int
-memb_ns_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ns_ir_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const NumericString_t *st = (const NumericString_t *)sptr;
 	
@@ -755,7 +755,7 @@
 	return permitted_alphabet_code2value_18[code];
 }
 static int
-memb_ut_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ut_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UTF8String_t *st = (const UTF8String_t *)sptr;
 	size_t size;
@@ -787,7 +787,7 @@
 }
 
 static int
-memb_ut_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ut_ce_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UTF8String_t *st = (const UTF8String_t *)sptr;
 	size_t size;
@@ -819,7 +819,7 @@
 }
 
 static int
-memb_ut_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ut_ir_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UTF8String_t *st = (const UTF8String_t *)sptr;
 	
@@ -843,7 +843,7 @@
 }
 
 static int
-memb_bm_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_bm_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BMPString_t *st = (const BMPString_t *)sptr;
 	
@@ -867,7 +867,7 @@
 }
 
 static int
-memb_bm_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_bm_cs_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BMPString_t *st = (const BMPString_t *)sptr;
 	size_t size;
@@ -894,7 +894,7 @@
 }
 
 static int
-memb_bm_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_bm_ce_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BMPString_t *st = (const BMPString_t *)sptr;
 	
@@ -918,7 +918,7 @@
 }
 
 static int
-memb_bm_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_bm_ir_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BMPString_t *st = (const BMPString_t *)sptr;
 	
@@ -952,7 +952,7 @@
 	return permitted_alphabet_code2value_26[code];
 }
 static int
-memb_us_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_us_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UniversalString_t *st = (const UniversalString_t *)sptr;
 	
@@ -976,7 +976,7 @@
 }
 
 static int
-memb_us_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_us_cs_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UniversalString_t *st = (const UniversalString_t *)sptr;
 	size_t size;
@@ -1003,7 +1003,7 @@
 }
 
 static int
-memb_us_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_us_ce_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UniversalString_t *st = (const UniversalString_t *)sptr;
 	
@@ -1027,7 +1027,7 @@
 }
 
 static int
-memb_us_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_us_ir_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UniversalString_t *st = (const UniversalString_t *)sptr;
 	
@@ -1190,7 +1190,7 @@
 		.type = &asn_DEF_PDU,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -1227,7 +1227,7 @@
 		.type = &asn_DEF_many_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "many"
 		},
 	{ ATF_POINTER, 30, offsetof(struct PDU, ia5),
@@ -1236,7 +1236,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ia5"
 		},
 	{ ATF_POINTER, 29, offsetof(struct PDU, ia5_c),
@@ -1245,7 +1245,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ia5_c_constr_5, .general_constraints =  memb_ia5_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ia5-c"
 		},
 	{ ATF_POINTER, 28, offsetof(struct PDU, ia5_ce),
@@ -1254,7 +1254,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ia5_ce_constr_6, .general_constraints =  memb_ia5_ce_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ia5-ce"
 		},
 	{ ATF_POINTER, 27, offsetof(struct PDU, ia5_ir),
@@ -1263,7 +1263,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ia5_ir_constr_7, .general_constraints =  memb_ia5_ir_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ia5-ir"
 		},
 	{ ATF_POINTER, 26, offsetof(struct PDU, vs),
@@ -1272,7 +1272,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "vs"
 		},
 	{ ATF_POINTER, 25, offsetof(struct PDU, vs_c),
@@ -1281,7 +1281,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_vs_c_constr_9, .general_constraints =  memb_vs_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "vs-c"
 		},
 	{ ATF_POINTER, 24, offsetof(struct PDU, vs_ce),
@@ -1290,7 +1290,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_vs_ce_constr_10, .general_constraints =  memb_vs_ce_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "vs-ce"
 		},
 	{ ATF_POINTER, 23, offsetof(struct PDU, vs_ir),
@@ -1299,7 +1299,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_vs_ir_constr_11, .general_constraints =  memb_vs_ir_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "vs-ir"
 		},
 	{ ATF_POINTER, 22, offsetof(struct PDU, pr),
@@ -1308,7 +1308,7 @@
 		.type = &asn_DEF_PrintableString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "pr"
 		},
 	{ ATF_POINTER, 21, offsetof(struct PDU, pr_c),
@@ -1317,7 +1317,7 @@
 		.type = &asn_DEF_PrintableString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_pr_c_constr_13, .general_constraints =  memb_pr_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "pr-c"
 		},
 	{ ATF_POINTER, 20, offsetof(struct PDU, pr_ir),
@@ -1326,7 +1326,7 @@
 		.type = &asn_DEF_PrintableString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_pr_ir_constr_14, .general_constraints =  memb_pr_ir_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "pr-ir"
 		},
 	{ ATF_POINTER, 19, offsetof(struct PDU, ns),
@@ -1335,7 +1335,7 @@
 		.type = &asn_DEF_NumericString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ns"
 		},
 	{ ATF_POINTER, 18, offsetof(struct PDU, ns_c),
@@ -1344,7 +1344,7 @@
 		.type = &asn_DEF_NumericString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ns_c_constr_16, .general_constraints =  memb_ns_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ns-c"
 		},
 	{ ATF_POINTER, 17, offsetof(struct PDU, ns_ce),
@@ -1353,7 +1353,7 @@
 		.type = &asn_DEF_NumericString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ns_ce_constr_17, .general_constraints =  memb_ns_ce_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ns-ce"
 		},
 	{ ATF_POINTER, 16, offsetof(struct PDU, ns_ir),
@@ -1362,7 +1362,7 @@
 		.type = &asn_DEF_NumericString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ns_ir_constr_18, .general_constraints =  memb_ns_ir_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ns-ir"
 		},
 	{ ATF_POINTER, 15, offsetof(struct PDU, ut_c),
@@ -1371,7 +1371,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ut_c_constr_19, .general_constraints =  memb_ut_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ut-c"
 		},
 	{ ATF_POINTER, 14, offsetof(struct PDU, ut_ce),
@@ -1380,7 +1380,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ut_ce_constr_20, .general_constraints =  memb_ut_ce_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ut-ce"
 		},
 	{ ATF_POINTER, 13, offsetof(struct PDU, ut_ir),
@@ -1389,7 +1389,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_ut_ir_constr_21, .general_constraints =  memb_ut_ir_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ut-ir"
 		},
 	{ ATF_POINTER, 12, offsetof(struct PDU, bm),
@@ -1398,7 +1398,7 @@
 		.type = &asn_DEF_BMPString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bm"
 		},
 	{ ATF_POINTER, 11, offsetof(struct PDU, bm_c),
@@ -1407,7 +1407,7 @@
 		.type = &asn_DEF_BMPString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_bm_c_constr_23, .general_constraints =  memb_bm_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bm-c"
 		},
 	{ ATF_POINTER, 10, offsetof(struct PDU, bm_cs),
@@ -1416,7 +1416,7 @@
 		.type = &asn_DEF_BMPString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_bm_cs_constr_24, .general_constraints =  memb_bm_cs_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bm-cs"
 		},
 	{ ATF_POINTER, 9, offsetof(struct PDU, bm_ce),
@@ -1425,7 +1425,7 @@
 		.type = &asn_DEF_BMPString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_bm_ce_constr_25, .general_constraints =  memb_bm_ce_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bm-ce"
 		},
 	{ ATF_POINTER, 8, offsetof(struct PDU, bm_ir),
@@ -1434,7 +1434,7 @@
 		.type = &asn_DEF_BMPString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_bm_ir_constr_26, .general_constraints =  memb_bm_ir_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bm-ir"
 		},
 	{ ATF_POINTER, 7, offsetof(struct PDU, us),
@@ -1443,7 +1443,7 @@
 		.type = &asn_DEF_UniversalString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "us"
 		},
 	{ ATF_POINTER, 6, offsetof(struct PDU, us_c),
@@ -1452,7 +1452,7 @@
 		.type = &asn_DEF_UniversalString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_us_c_constr_28, .general_constraints =  memb_us_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "us-c"
 		},
 	{ ATF_POINTER, 5, offsetof(struct PDU, us_cs),
@@ -1461,7 +1461,7 @@
 		.type = &asn_DEF_UniversalString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_us_cs_constr_29, .general_constraints =  memb_us_cs_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "us-cs"
 		},
 	{ ATF_POINTER, 4, offsetof(struct PDU, us_ce),
@@ -1470,7 +1470,7 @@
 		.type = &asn_DEF_UniversalString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_us_ce_constr_30, .general_constraints =  memb_us_ce_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "us-ce"
 		},
 	{ ATF_POINTER, 3, offsetof(struct PDU, us_ir),
@@ -1479,7 +1479,7 @@
 		.type = &asn_DEF_UniversalString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_us_ir_constr_31, .general_constraints =  memb_us_ir_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "us-ir"
 		},
 	{ ATF_POINTER, 2, offsetof(struct PDU, real),
@@ -1488,7 +1488,7 @@
 		.type = &asn_DEF_NativeReal,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "real"
 		},
 	{ ATF_POINTER, 1, offsetof(struct PDU, oid),
@@ -1497,7 +1497,7 @@
 		.type = &asn_DEF_OBJECT_IDENTIFIER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "oid"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1.-P b/tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1.-P
index 6bda6a8..627c271 100644
--- a/tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1.-P
@@ -29,7 +29,7 @@
 /*** <<< CODE [T] >>> ***/
 
 int
-T_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+T_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 	
diff --git a/tests/tests-asn1c-compiler/126-per-extensions-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/126-per-extensions-OK.asn1.-Pgen-PER
index 86dc8f5..52f1508 100644
--- a/tests/tests-asn1c-compiler/126-per-extensions-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/126-per-extensions-OK.asn1.-Pgen-PER
@@ -43,7 +43,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "str-o"
 		},
 	{ ATF_POINTER, 3, offsetof(struct PDU, str_m),
@@ -52,7 +52,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "str-m"
 		},
 	{ ATF_POINTER, 2, offsetof(struct PDU, singl),
@@ -61,7 +61,7 @@
 		.type = &asn_DEF_Singleton,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "singl"
 		},
 	{ ATF_POINTER, 1, offsetof(struct PDU, pdu_2),
@@ -70,7 +70,7 @@
 		.type = &asn_DEF_PDU_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "pdu-2"
 		},
 };
@@ -133,31 +133,37 @@
 
 /*** <<< STAT-DEFS [Singleton] >>> ***/
 
-static int asn_DFL_2_set(int set_value, void **sptr) {
+static int asn_DFL_2_cmp(const void *sptr) {
 	static uint8_t defv[] = "z";
-	IA5String_t *st = *sptr;
+	const IA5String_t *st = sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
-		st = (*sptr = CALLOC(1, sizeof(*st)));
-		if(!st) return -1;
+		return -1; /* No value is not a default value */
 	}
 	
-	if(set_value) {
-		uint8_t *ptr = MALLOC(sizeof(defv));
-		if(!ptr) return -1;
-		memcpy(ptr, &defv, sizeof(defv));
-		FREEMEM(st->buf);
-		st->buf = ptr;
-		st->size = sizeof(defv) - 1;
+	if(st->size == (sizeof(defv) - 1)
+	&& memcmp(st->buf, &defv, sizeof(defv) - 1) == 0)
 		return 0;
-	} else {
-		if(st->size != (sizeof(defv) - 1)
-		|| memcmp(st->buf, &defv, sizeof(defv) - 1))
-			return 0;
-		return 1;
-	}
+	return 1;
+}
+static int asn_DFL_2_set(void **sptr) {
+	static uint8_t defv[] = "z";
+	IA5String_t *st = *sptr;
+	uint8_t *nstr = MALLOC(sizeof(defv));
 	
+	if(!nstr) return -1;
+	memcpy(nstr, defv, sizeof(defv));
+	
+	if((st = *sptr)) {
+		FREEMEM(st->buf);
+	} else {
+		st = (*sptr = CALLOC(1, sizeof(*st)));
+		if(!st) { FREEMEM(nptr); return -1; }
+	}
+	st->buf = nstr;
+	st->size = sizeof(defv) - 1;
+	
+	return 0;
 }
 asn_TYPE_member_t asn_MBR_Singleton_1[] = {
 	{ ATF_POINTER, 1, offsetof(struct Singleton, opt_z),
@@ -166,7 +172,8 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = asn_DFL_2_set,	/* DEFAULT "z" */
+		.default_value_cmp = asn_DFL_2_cmp,	/* Compare DEFAULT "z" */
+		.default_value_set = asn_DFL_2_set,	/* Set DEFAULT "z" */
 		.name = "opt-z"
 		},
 };
@@ -261,7 +268,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "main"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext1),
@@ -270,7 +277,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ext1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext0),
@@ -279,11 +286,12 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ext0"
 		},
 };
-static const unsigned asn_MAP_PDU_2_cmap_1[] = { 0, 2, 1 };
+static const unsigned asn_MAP_PDU_2_to_canonical_1[] = { 0, 2, 1 };
+static const unsigned asn_MAP_PDU_2_from_canonical_1[] = { 0, 2, 1 };
 static const asn_TYPE_tag2member_t asn_MAP_PDU_2_tag2el_1[] = {
     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* ext0 */
     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ext1 */
@@ -296,7 +304,8 @@
 	sizeof(((struct PDU_2 *)0)->present),
 	.tag2el = asn_MAP_PDU_2_tag2el_1,
 	.tag2el_count = 3,	/* Count of tags in the map */
-	.canonical_order = asn_MAP_PDU_2_cmap_1,	/* Canonically sorted */
+	.to_canonical_order = asn_MAP_PDU_2_to_canonical_1,
+	.from_canonical_order = asn_MAP_PDU_2_from_canonical_1,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_PDU_2 = {
diff --git a/tests/tests-asn1c-compiler/127-per-long-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/127-per-long-OK.asn1.-Pgen-PER
index 0311cbb..40c39f8 100644
--- a/tests/tests-asn1c-compiler/127-per-long-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/127-per-long-OK.asn1.-Pgen-PER
@@ -25,7 +25,7 @@
 /*** <<< CODE [T] >>> ***/
 
 static int
-unsigned32_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+unsigned32_4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -45,7 +45,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-unsplit32_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+unsplit32_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -74,7 +74,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-memb_small32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_small32range_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -99,7 +99,7 @@
 }
 
 static int
-memb_full32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_full32range_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -124,7 +124,7 @@
 }
 
 static int
-memb_unsigned32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned32_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -140,7 +140,7 @@
 }
 
 static int
-memb_unsplit32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsplit32_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -257,7 +257,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_small32range_constr_2, .general_constraints =  memb_small32range_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "small32range"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, full32range),
@@ -266,7 +266,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_full32range_constr_3, .general_constraints =  memb_full32range_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "full32range"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsigned32),
@@ -275,7 +275,7 @@
 		.type = &asn_DEF_unsigned32_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_unsigned32_constr_4, .general_constraints =  memb_unsigned32_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned32"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsplit32),
@@ -284,7 +284,7 @@
 		.type = &asn_DEF_unsplit32_5,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_unsplit32_constr_5, .general_constraints =  memb_unsplit32_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsplit32"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/134-per-long-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/134-per-long-OK.asn1.-Pgen-PER
index 9cfaa78..17670fa 100644
--- a/tests/tests-asn1c-compiler/134-per-long-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/134-per-long-OK.asn1.-Pgen-PER
@@ -23,7 +23,7 @@
 /*** <<< CODE [T] >>> ***/
 
 static int
-memb_unsigned33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned33_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -54,7 +54,7 @@
 }
 
 static int
-memb_unsigned42_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned42_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -85,7 +85,7 @@
 }
 
 static int
-memb_signed33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed33_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -116,7 +116,7 @@
 }
 
 static int
-memb_signed33ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed33ext_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -179,7 +179,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_unsigned33_constr_2, .general_constraints =  memb_unsigned33_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned33"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsigned42),
@@ -188,7 +188,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_unsigned42_constr_3, .general_constraints =  memb_unsigned42_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned42"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, signed33),
@@ -197,7 +197,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_signed33_constr_4, .general_constraints =  memb_signed33_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed33"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, signed33ext),
@@ -206,7 +206,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_signed33ext_constr_5, .general_constraints =  memb_signed33ext_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed33ext"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/136-oer-long-OK.asn1.-Pgen-OER b/tests/tests-asn1c-compiler/136-oer-long-OK.asn1.-Pgen-OER
index 314aba0..301c17c 100644
--- a/tests/tests-asn1c-compiler/136-oer-long-OK.asn1.-Pgen-OER
+++ b/tests/tests-asn1c-compiler/136-oer-long-OK.asn1.-Pgen-OER
@@ -36,7 +36,7 @@
 /*** <<< CODE [T] >>> ***/
 
 static int
-memb_unsigned8_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned8_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -61,7 +61,7 @@
 }
 
 static int
-memb_unsigned16_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned16_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -86,7 +86,7 @@
 }
 
 static int
-memb_unsigned16stack_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned16stack_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -111,7 +111,7 @@
 }
 
 static int
-memb_unsigned16stack_ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned16stack_ext_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -136,7 +136,7 @@
 }
 
 static int
-memb_unsigned33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_unsigned33_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -167,7 +167,7 @@
 }
 
 static int
-memb_minmax_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_minmax_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -186,7 +186,7 @@
 }
 
 static int
-memb_signed8_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed8_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -211,7 +211,7 @@
 }
 
 static int
-memb_signed16_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed16_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -236,7 +236,7 @@
 }
 
 static int
-memb_signed16stack_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed16stack_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -261,7 +261,7 @@
 }
 
 static int
-memb_signed16stack_ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed16stack_ext_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -286,7 +286,7 @@
 }
 
 static int
-memb_signed32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed32_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -311,7 +311,7 @@
 }
 
 static int
-memb_signed33ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signed33ext_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -383,23 +383,27 @@
 
 /*** <<< STAT-DEFS [T] >>> ***/
 
-static int asn_DFL_9_set_3(int set_value, void **sptr) {
+static int asn_DFL_9_cmp_3(const void *sptr) {
+	const long *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 3 */
+	return (*st != 3);
+}
+static int asn_DFL_9_set_3(void **sptr) {
 	long *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 3 */
-		*st = 3;
-		return 0;
-	} else {
-		/* Test default value 3 */
-		return (*st == 3);
-	}
+	/* Install default value 3 */
+	*st = 3;
+	return 0;
 }
 static asn_TYPE_member_t asn_MBR_T_1[] = {
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsigned8),
@@ -408,7 +412,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_unsigned8_constr_2, .per_constraints = 0, .general_constraints =  memb_unsigned8_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned8"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsigned16),
@@ -417,7 +421,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_unsigned16_constr_3, .per_constraints = 0, .general_constraints =  memb_unsigned16_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned16"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsigned16stack),
@@ -426,7 +430,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_unsigned16stack_constr_4, .per_constraints = 0, .general_constraints =  memb_unsigned16stack_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned16stack"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsigned16stack_ext),
@@ -435,7 +439,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_unsigned16stack_ext_constr_5, .per_constraints = 0, .general_constraints =  memb_unsigned16stack_ext_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned16stack-ext"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, unsigned33),
@@ -444,7 +448,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_unsigned33_constr_6, .per_constraints = 0, .general_constraints =  memb_unsigned33_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unsigned33"
 		},
 	{ ATF_POINTER, 7, offsetof(struct T, minmax),
@@ -453,7 +457,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_minmax_constr_7, .per_constraints = 0, .general_constraints =  memb_minmax_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "minmax"
 		},
 	{ ATF_POINTER, 6, offsetof(struct T, signed8),
@@ -462,7 +466,8 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_signed8_constr_9, .per_constraints = 0, .general_constraints =  memb_signed8_constraint_1 },
-		.default_value = asn_DFL_9_set_3,	/* DEFAULT 3 */
+		.default_value_cmp = asn_DFL_9_cmp_3,	/* Compare DEFAULT 3 */
+		.default_value_set = asn_DFL_9_set_3,	/* Set DEFAULT 3 */
 		.name = "signed8"
 		},
 	{ ATF_POINTER, 5, offsetof(struct T, signed16),
@@ -471,7 +476,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_signed16_constr_10, .per_constraints = 0, .general_constraints =  memb_signed16_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed16"
 		},
 	{ ATF_POINTER, 4, offsetof(struct T, signed16stack),
@@ -480,7 +485,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_signed16stack_constr_11, .per_constraints = 0, .general_constraints =  memb_signed16stack_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed16stack"
 		},
 	{ ATF_POINTER, 3, offsetof(struct T, signed16stack_ext),
@@ -489,7 +494,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_signed16stack_ext_constr_12, .per_constraints = 0, .general_constraints =  memb_signed16stack_ext_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed16stack-ext"
 		},
 	{ ATF_POINTER, 2, offsetof(struct T, signed32),
@@ -498,7 +503,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_signed32_constr_13, .per_constraints = 0, .general_constraints =  memb_signed32_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed32"
 		},
 	{ ATF_POINTER, 1, offsetof(struct T, signed33ext),
@@ -507,7 +512,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_signed33ext_constr_14, .per_constraints = 0, .general_constraints =  memb_signed33ext_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signed33ext"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/137-oer-string-OK.asn1.-Pgen-OER b/tests/tests-asn1c-compiler/137-oer-string-OK.asn1.-Pgen-OER
index b62b973..bf21904 100644
--- a/tests/tests-asn1c-compiler/137-oer-string-OK.asn1.-Pgen-OER
+++ b/tests/tests-asn1c-compiler/137-oer-string-OK.asn1.-Pgen-OER
@@ -70,7 +70,7 @@
 /*** <<< CODE [T] >>> ***/
 
 static int
-memb_con_ia5_constraint_6(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_con_ia5_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	size_t size;
@@ -97,7 +97,7 @@
 }
 
 static int
-memb_con_utf8_constraint_6(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_con_utf8_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UTF8String_t *st = (const UTF8String_t *)sptr;
 	size_t size;
@@ -129,7 +129,7 @@
 }
 
 static int
-memb_con_universal_constraint_6(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_con_universal_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UniversalString_t *st = (const UniversalString_t *)sptr;
 	size_t size;
@@ -177,7 +177,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unc-ia5"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct unconstrained, unc_utf8),
@@ -186,7 +186,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unc-utf8"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct unconstrained, unc_universal),
@@ -195,7 +195,7 @@
 		.type = &asn_DEF_UniversalString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unc-universal"
 		},
 };
@@ -240,7 +240,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_con_ia5_constr_7, .per_constraints = 0, .general_constraints =  memb_con_ia5_constraint_6 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "con-ia5"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct constrained, con_utf8),
@@ -249,7 +249,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_con_utf8_constr_8, .per_constraints = 0, .general_constraints =  memb_con_utf8_constraint_6 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "con-utf8"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct constrained, con_universal),
@@ -258,7 +258,7 @@
 		.type = &asn_DEF_UniversalString,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_con_universal_constr_9, .per_constraints = 0, .general_constraints =  memb_con_universal_constraint_6 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "con-universal"
 		},
 };
@@ -303,7 +303,7 @@
 		.type = &asn_DEF_unconstrained_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "unconstrained"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, constrained),
@@ -312,7 +312,7 @@
 		.type = &asn_DEF_constrained_6,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "constrained"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER b/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
index e973c95..5379108 100644
--- a/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
+++ b/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
@@ -72,7 +72,7 @@
 /*** <<< CODE [B-0-0] >>> ***/
 
 int
-B_0_0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+B_0_0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -152,7 +152,7 @@
 /*** <<< CODE [C-1-2] >>> ***/
 
 int
-C_1_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+C_1_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -232,7 +232,7 @@
 /*** <<< CODE [D-inv] >>> ***/
 
 int
-D_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+D_inv_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -312,7 +312,7 @@
 /*** <<< CODE [E-2-5] >>> ***/
 
 int
-E_2_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+E_2_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -392,7 +392,7 @@
 /*** <<< CODE [F-inv] >>> ***/
 
 int
-F_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+F_inv_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -472,7 +472,7 @@
 /*** <<< CODE [G-3-3] >>> ***/
 
 int
-G_3_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+G_3_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -552,7 +552,7 @@
 /*** <<< CODE [H-4-5] >>> ***/
 
 int
-H_4_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+H_4_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -632,7 +632,7 @@
 /*** <<< CODE [I-1-5] >>> ***/
 
 int
-I_1_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+I_1_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -712,7 +712,7 @@
 /*** <<< CODE [J-4-5] >>> ***/
 
 int
-J_4_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+J_4_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -792,7 +792,7 @@
 /*** <<< CODE [K-1-4] >>> ***/
 
 int
-K_1_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+K_1_4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -872,7 +872,7 @@
 /*** <<< CODE [L-0-5] >>> ***/
 
 int
-L_0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+L_0_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -952,7 +952,7 @@
 /*** <<< CODE [M-inv] >>> ***/
 
 int
-M_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+M_inv_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1032,7 +1032,7 @@
 /*** <<< CODE [N-0-5] >>> ***/
 
 int
-N_0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+N_0_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1112,7 +1112,7 @@
 /*** <<< CODE [O-inv] >>> ***/
 
 int
-O_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+O_inv_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1192,7 +1192,7 @@
 /*** <<< CODE [EConstr] >>> ***/
 
 int
-EConstr_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+EConstr_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1272,7 +1272,7 @@
 /*** <<< CODE [FConstr] >>> ***/
 
 int
-FConstr_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+FConstr_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
diff --git a/tests/tests-asn1c-compiler/139-component-relation-OK.asn1.-P b/tests/tests-asn1c-compiler/139-component-relation-OK.asn1.-P
index 495570c..e9af4b3 100644
--- a/tests/tests-asn1c-compiler/139-component-relation-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/139-component-relation-OK.asn1.-P
@@ -62,7 +62,7 @@
 /*** <<< CODE [Frame] >>> ***/
 
 static int
-memb_ident_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ident_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -104,7 +104,7 @@
 }
 
 static int
-memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -132,7 +132,7 @@
 		.type = &asn_DEF_PrimitiveMessage,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "PrimitiveMessage"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct value, choice.ComplexMessage),
@@ -141,7 +141,7 @@
 		.type = &asn_DEF_ComplexMessage,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ComplexMessage"
 		},
 };
@@ -156,7 +156,7 @@
 	sizeof(((struct value *)0)->present),
 	.tag2el = asn_MAP_value_tag2el_3,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -181,7 +181,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_ident_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ident"
 		},
 	{ ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Frame, value),
@@ -190,7 +190,7 @@
 		.type = &asn_DEF_value_3,
 		.type_selector = select_value_type,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_value_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "value"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/140-component-relation-OK.asn1.-P b/tests/tests-asn1c-compiler/140-component-relation-OK.asn1.-P
index 495570c..e9af4b3 100644
--- a/tests/tests-asn1c-compiler/140-component-relation-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/140-component-relation-OK.asn1.-P
@@ -62,7 +62,7 @@
 /*** <<< CODE [Frame] >>> ***/
 
 static int
-memb_ident_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ident_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -104,7 +104,7 @@
 }
 
 static int
-memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -132,7 +132,7 @@
 		.type = &asn_DEF_PrimitiveMessage,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "PrimitiveMessage"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct value, choice.ComplexMessage),
@@ -141,7 +141,7 @@
 		.type = &asn_DEF_ComplexMessage,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ComplexMessage"
 		},
 };
@@ -156,7 +156,7 @@
 	sizeof(((struct value *)0)->present),
 	.tag2el = asn_MAP_value_tag2el_3,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -181,7 +181,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_ident_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ident"
 		},
 	{ ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Frame, value),
@@ -190,7 +190,7 @@
 		.type = &asn_DEF_value_3,
 		.type_selector = select_value_type,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_value_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "value"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/141-component-relation-OK.asn1.-P b/tests/tests-asn1c-compiler/141-component-relation-OK.asn1.-P
index f62a334..80abe31 100644
--- a/tests/tests-asn1c-compiler/141-component-relation-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/141-component-relation-OK.asn1.-P
@@ -62,7 +62,7 @@
 /*** <<< CODE [Frame] >>> ***/
 
 static int
-memb_ident_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_ident_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -110,7 +110,7 @@
 }
 
 static int
-memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -138,7 +138,7 @@
 		.type = &asn_DEF_PrimitiveMessage,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "PrimitiveMessage"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct value, choice.ComplexMessage),
@@ -147,7 +147,7 @@
 		.type = &asn_DEF_ComplexMessage,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ComplexMessage"
 		},
 };
@@ -162,7 +162,7 @@
 	sizeof(((struct value *)0)->present),
 	.tag2el = asn_MAP_value_tag2el_3,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -187,7 +187,7 @@
 		.type = &asn_DEF_ConstrainedInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_ident_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ident"
 		},
 	{ ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Frame, value),
@@ -196,7 +196,7 @@
 		.type = &asn_DEF_value_3,
 		.type_selector = select_value_type,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_value_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "value"
 		},
 };
@@ -255,7 +255,7 @@
 /*** <<< CODE [ConstrainedInteger] >>> ***/
 
 int
-ConstrainedInteger_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ConstrainedInteger_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
diff --git a/tests/tests-asn1c-compiler/142-anonymous-types-deco-OK.asn1.-Pfcompound-names b/tests/tests-asn1c-compiler/142-anonymous-types-deco-OK.asn1.-Pfcompound-names
index 5425357..30be937 100644
--- a/tests/tests-asn1c-compiler/142-anonymous-types-deco-OK.asn1.-Pfcompound-names
+++ b/tests/tests-asn1c-compiler/142-anonymous-types-deco-OK.asn1.-Pfcompound-names
@@ -39,7 +39,7 @@
 		.type = &asn_DEF_Type1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct CommonType, choice.t2),
@@ -48,7 +48,7 @@
 		.type = &asn_DEF_Type2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t2"
 		},
 };
@@ -63,7 +63,7 @@
 	sizeof(((struct CommonType *)0)->present),
 	.tag2el = asn_MAP_CommonType_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_CommonType = {
@@ -121,7 +121,7 @@
 /*** <<< CODE [Type1] >>> ***/
 
 static int
-memb_x_constraint_2(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_x_constraint_2(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	size_t size;
@@ -147,7 +147,7 @@
 }
 
 static int
-memb_y_constraint_2(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_y_constraint_2(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	size_t size;
@@ -182,7 +182,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_x_constraint_2 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "x"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Type1__anonType, y),
@@ -191,7 +191,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_y_constraint_2 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "y"
 		},
 };
@@ -236,7 +236,7 @@
 		.type = &asn_DEF_anonType_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "anonType"
 		},
 };
@@ -250,7 +250,7 @@
 	sizeof(((struct Type1 *)0)->present),
 	.tag2el = asn_MAP_Type1_tag2el_1,
 	.tag2el_count = 1,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Type1 = {
@@ -308,7 +308,7 @@
 /*** <<< CODE [Type2] >>> ***/
 
 static int
-memb_x_constraint_2(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_x_constraint_2(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	size_t size;
@@ -334,7 +334,7 @@
 }
 
 static int
-memb_y_constraint_2(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_y_constraint_2(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	size_t size;
@@ -369,7 +369,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_x_constraint_2 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "x"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Type2__anonType, y),
@@ -378,7 +378,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_y_constraint_2 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "y"
 		},
 };
@@ -423,7 +423,7 @@
 		.type = &asn_DEF_anonType_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "anonType"
 		},
 };
@@ -437,7 +437,7 @@
 	sizeof(((struct Type2 *)0)->present),
 	.tag2el = asn_MAP_Type2_tag2el_1,
 	.tag2el_count = 1,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Type2 = {
diff --git a/tests/tests-asn1c-compiler/143-inner-parameterization-OK.asn1.-P b/tests/tests-asn1c-compiler/143-inner-parameterization-OK.asn1.-P
index 873ca73..01dab4e 100644
--- a/tests/tests-asn1c-compiler/143-inner-parameterization-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/143-inner-parameterization-OK.asn1.-P
@@ -27,7 +27,7 @@
 		.type = &asn_DEF_SpecializedContent_21P0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "content13"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Message, content42),
@@ -36,7 +36,7 @@
 		.type = &asn_DEF_SpecializedContent_21P1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "content42"
 		},
 };
@@ -105,7 +105,7 @@
 /*** <<< CODE [SpecializedContent] >>> ***/
 
 static int
-memb_id_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -130,7 +130,7 @@
 }
 
 static int
-memb_id_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_id_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -164,7 +164,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_id_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "id"
 		},
 };
@@ -206,7 +206,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_id_constraint_3 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "id"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P b/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P
index 23fa442..2f0a421 100644
--- a/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P
@@ -26,7 +26,7 @@
 		.type = &asn_DEF_SpecializedContent_30P0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "content"
 		},
 };
@@ -122,7 +122,7 @@
 /*** <<< CODE [SpecializedContent] >>> ***/
 
 static int
-memb_id_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -164,7 +164,7 @@
 }
 
 static int
-memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -192,7 +192,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "INTEGER"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct value, choice.BOOLEAN),
@@ -201,7 +201,7 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "BOOLEAN"
 		},
 };
@@ -216,7 +216,7 @@
 	sizeof(((struct value *)0)->present),
 	.tag2el = asn_MAP_value_tag2el_3,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -241,7 +241,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_id_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "id"
 		},
 	{ ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_30P0, value),
@@ -250,7 +250,7 @@
 		.type = &asn_DEF_value_3,
 		.type_selector = select_value_type,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_value_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "value"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER
index b553308..e17e676 100644
--- a/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER
@@ -26,7 +26,7 @@
 		.type = &asn_DEF_SpecializedContent_30P0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "content"
 		},
 };
@@ -122,7 +122,7 @@
 /*** <<< CODE [SpecializedContent] >>> ***/
 
 static int
-memb_id_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -164,7 +164,7 @@
 }
 
 static int
-memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -205,7 +205,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "INTEGER"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct value, choice.BOOLEAN),
@@ -214,11 +214,12 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "BOOLEAN"
 		},
 };
-static const unsigned asn_MAP_value_cmap_3[] = { 1, 0 };
+static const unsigned asn_MAP_value_to_canonical_3[] = { 1, 0 };
+static const unsigned asn_MAP_value_from_canonical_3[] = { 1, 0 };
 static const asn_TYPE_tag2member_t asn_MAP_value_tag2el_3[] = {
     { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 1, 0, 0 }, /* BOOLEAN */
     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* INTEGER */
@@ -230,7 +231,8 @@
 	sizeof(((struct value *)0)->present),
 	.tag2el = asn_MAP_value_tag2el_3,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = asn_MAP_value_cmap_3,	/* Canonically sorted */
+	.to_canonical_order = asn_MAP_value_to_canonical_3,
+	.from_canonical_order = asn_MAP_value_from_canonical_3,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -255,7 +257,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_id_constr_2, .general_constraints =  memb_id_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "id"
 		},
 	{ ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_30P0, value),
@@ -264,7 +266,7 @@
 		.type = &asn_DEF_value_3,
 		.type_selector = select_value_type,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_value_constr_3, .general_constraints =  memb_value_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "value"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-OER b/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-OER
index 41ecc19..b8e9b11 100644
--- a/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-OER
+++ b/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-OER
@@ -23,7 +23,7 @@
 /*** <<< CODE [Short] >>> ***/
 
 int
-Short_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Short_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -103,7 +103,7 @@
 /*** <<< CODE [Alias] >>> ***/
 
 int
-Alias_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Alias_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -184,7 +184,7 @@
 /*** <<< CODE [Soo] >>> ***/
 
 static int
-memb_foo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_foo_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -224,7 +224,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = &asn_OER_memb_foo_constr_2, .per_constraints = 0, .general_constraints =  memb_foo_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "foo"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Soo, bar),
@@ -233,7 +233,7 @@
 		.type = &asn_DEF_Short,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bar"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Soo, baz),
@@ -242,7 +242,7 @@
 		.type = &asn_DEF_Alias,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "baz"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-PER
index 3f6d46a..c4cfef0 100644
--- a/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/147-inherit-per-constraints-OK.asn1.-Pgen-PER
@@ -24,7 +24,7 @@
 /*** <<< CODE [Short] >>> ***/
 
 int
-Short_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Short_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -107,7 +107,7 @@
 /*** <<< CODE [Alias] >>> ***/
 
 int
-Alias_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Alias_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -190,7 +190,7 @@
 /*** <<< CODE [Soo] >>> ***/
 
 static int
-memb_foo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_foo_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -232,7 +232,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_foo_constr_2, .general_constraints =  memb_foo_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "foo"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Soo, bar),
@@ -241,7 +241,7 @@
 		.type = &asn_DEF_Short,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bar"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Soo, baz),
@@ -250,7 +250,7 @@
 		.type = &asn_DEF_Alias,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "baz"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pfwide-types
index 529f5c8..6b10989 100644
--- a/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pfwide-types
@@ -68,7 +68,7 @@
 /*** <<< CODE [WeirdlyConstrainedREAL] >>> ***/
 
 int
-WeirdlyConstrainedREAL_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+WeirdlyConstrainedREAL_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const REAL_t *st = (const REAL_t *)sptr;
 	double value;
@@ -147,7 +147,7 @@
 /*** <<< CODE [Indirect-IEEE-binary32] >>> ***/
 
 int
-Indirect_IEEE_binary32_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Indirect_IEEE_binary32_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -217,7 +217,7 @@
 /*** <<< CODE [IEEE-binary32-w] >>> ***/
 
 int
-IEEE_binary32_w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -287,7 +287,7 @@
 /*** <<< CODE [IEEE-binary32-0w] >>> ***/
 
 int
-IEEE_binary32_0w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_0w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -357,7 +357,7 @@
 /*** <<< CODE [IEEE-binary32-w0] >>> ***/
 
 int
-IEEE_binary32_w0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_w0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -426,7 +426,7 @@
 /*** <<< CODE [IEEE-binary64-w] >>> ***/
 
 int
-IEEE_binary64_w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -492,7 +492,7 @@
 /*** <<< CODE [IEEE-binary64-0w] >>> ***/
 
 int
-IEEE_binary64_0w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_0w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -558,7 +558,7 @@
 /*** <<< CODE [IEEE-binary64-w0] >>> ***/
 
 int
-IEEE_binary64_w0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_w0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -639,7 +639,7 @@
 /*** <<< CODE [Test] >>> ***/
 
 static int
-indirect_ieee_binary32_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+indirect_ieee_binary32_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -662,7 +662,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_w_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_w_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -685,7 +685,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_0w_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_0w_4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -708,7 +708,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_w0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_w0_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -828,7 +828,7 @@
 		.type = &asn_DEF_Indirect_IEEE_binary32,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "indirect-ieee-binary32"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_w),
@@ -837,7 +837,7 @@
 		.type = &asn_DEF_IEEE_binary32_w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_0w),
@@ -846,7 +846,7 @@
 		.type = &asn_DEF_IEEE_binary32_0w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-0w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_w0),
@@ -855,7 +855,7 @@
 		.type = &asn_DEF_IEEE_binary32_w0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-w0"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_w),
@@ -864,7 +864,7 @@
 		.type = &asn_DEF_IEEE_binary64_w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_0w),
@@ -873,7 +873,7 @@
 		.type = &asn_DEF_IEEE_binary64_0w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-0w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_w0),
@@ -882,7 +882,7 @@
 		.type = &asn_DEF_IEEE_binary64_w0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-w0"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-OER b/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-OER
index 6d0386b..508ccbc 100644
--- a/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-OER
+++ b/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-OER
@@ -72,7 +72,7 @@
 /*** <<< CODE [WeirdlyConstrainedREAL] >>> ***/
 
 int
-WeirdlyConstrainedREAL_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+WeirdlyConstrainedREAL_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	double value;
 	
@@ -153,7 +153,7 @@
 /*** <<< CODE [Indirect-IEEE-binary32] >>> ***/
 
 int
-Indirect_IEEE_binary32_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Indirect_IEEE_binary32_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -231,7 +231,7 @@
 /*** <<< CODE [IEEE-binary32-w] >>> ***/
 
 int
-IEEE_binary32_w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -309,7 +309,7 @@
 /*** <<< CODE [IEEE-binary32-0w] >>> ***/
 
 int
-IEEE_binary32_0w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_0w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -387,7 +387,7 @@
 /*** <<< CODE [IEEE-binary32-w0] >>> ***/
 
 int
-IEEE_binary32_w0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_w0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -464,7 +464,7 @@
 /*** <<< CODE [IEEE-binary64-w] >>> ***/
 
 int
-IEEE_binary64_w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -538,7 +538,7 @@
 /*** <<< CODE [IEEE-binary64-0w] >>> ***/
 
 int
-IEEE_binary64_0w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_0w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -612,7 +612,7 @@
 /*** <<< CODE [IEEE-binary64-w0] >>> ***/
 
 int
-IEEE_binary64_w0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_w0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -699,7 +699,7 @@
 /*** <<< CODE [Test] >>> ***/
 
 static int
-indirect_ieee_binary32_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+indirect_ieee_binary32_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -722,7 +722,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_w_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_w_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -745,7 +745,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_0w_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_0w_4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -768,7 +768,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_w0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_w0_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -903,7 +903,7 @@
 		.type = &asn_DEF_Indirect_IEEE_binary32,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "indirect-ieee-binary32"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_w),
@@ -912,7 +912,7 @@
 		.type = &asn_DEF_IEEE_binary32_w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_0w),
@@ -921,7 +921,7 @@
 		.type = &asn_DEF_IEEE_binary32_0w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-0w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_w0),
@@ -930,7 +930,7 @@
 		.type = &asn_DEF_IEEE_binary32_w0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-w0"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_w),
@@ -939,7 +939,7 @@
 		.type = &asn_DEF_IEEE_binary64_w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_0w),
@@ -948,7 +948,7 @@
 		.type = &asn_DEF_IEEE_binary64_0w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-0w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_w0),
@@ -957,7 +957,7 @@
 		.type = &asn_DEF_IEEE_binary64_w0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-w0"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-PER
index 700d120..7ba0c05 100644
--- a/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/154-with-REAL-components-OK.asn1.-Pgen-PER
@@ -72,7 +72,7 @@
 /*** <<< CODE [WeirdlyConstrainedREAL] >>> ***/
 
 int
-WeirdlyConstrainedREAL_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+WeirdlyConstrainedREAL_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	double value;
 	
@@ -156,7 +156,7 @@
 /*** <<< CODE [Indirect-IEEE-binary32] >>> ***/
 
 int
-Indirect_IEEE_binary32_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Indirect_IEEE_binary32_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -237,7 +237,7 @@
 /*** <<< CODE [IEEE-binary32-w] >>> ***/
 
 int
-IEEE_binary32_w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -318,7 +318,7 @@
 /*** <<< CODE [IEEE-binary32-0w] >>> ***/
 
 int
-IEEE_binary32_0w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_0w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -399,7 +399,7 @@
 /*** <<< CODE [IEEE-binary32-w0] >>> ***/
 
 int
-IEEE_binary32_w0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary32_w0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -479,7 +479,7 @@
 /*** <<< CODE [IEEE-binary64-w] >>> ***/
 
 int
-IEEE_binary64_w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -556,7 +556,7 @@
 /*** <<< CODE [IEEE-binary64-0w] >>> ***/
 
 int
-IEEE_binary64_0w_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_0w_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -633,7 +633,7 @@
 /*** <<< CODE [IEEE-binary64-w0] >>> ***/
 
 int
-IEEE_binary64_w0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+IEEE_binary64_w0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -722,7 +722,7 @@
 /*** <<< CODE [Test] >>> ***/
 
 static int
-indirect_ieee_binary32_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+indirect_ieee_binary32_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -745,7 +745,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_w_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_w_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -768,7 +768,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_0w_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_0w_4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -791,7 +791,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-ieee_binary32_w0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ieee_binary32_w0_5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -934,7 +934,7 @@
 		.type = &asn_DEF_Indirect_IEEE_binary32,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "indirect-ieee-binary32"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_w),
@@ -943,7 +943,7 @@
 		.type = &asn_DEF_IEEE_binary32_w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_0w),
@@ -952,7 +952,7 @@
 		.type = &asn_DEF_IEEE_binary32_0w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-0w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary32_w0),
@@ -961,7 +961,7 @@
 		.type = &asn_DEF_IEEE_binary32_w0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary32-w0"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_w),
@@ -970,7 +970,7 @@
 		.type = &asn_DEF_IEEE_binary64_w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_0w),
@@ -979,7 +979,7 @@
 		.type = &asn_DEF_IEEE_binary64_0w,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-0w"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test, ieee_binary64_w0),
@@ -988,7 +988,7 @@
 		.type = &asn_DEF_IEEE_binary64_w0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ieee-binary64-w0"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/19-param-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/19-param-OK.asn1.-Pfwide-types
index a00a51e..1c16740 100644
--- a/tests/tests-asn1c-compiler/19-param-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/19-param-OK.asn1.-Pfwide-types
@@ -34,7 +34,7 @@
 /*** <<< CODE [SIGNED] >>> ***/
 
 static int
-memb_signature_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_signature_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 	size_t size;
@@ -74,7 +74,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "version"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct toBeSigned, signature),
@@ -83,7 +83,7 @@
 		.type = &asn_DEF_OBJECT_IDENTIFIER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signature"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct toBeSigned, issuer),
@@ -92,7 +92,7 @@
 		.type = &asn_DEF_Name,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "issuer"
 		},
 };
@@ -137,7 +137,7 @@
 		.type = &asn_DEF_toBeSigned_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "toBeSigned"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, algorithm),
@@ -146,7 +146,7 @@
 		.type = &asn_DEF_OBJECT_IDENTIFIER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "algorithm"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, signature),
@@ -155,7 +155,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_signature_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "signature"
 		},
 };
@@ -278,7 +278,7 @@
 		.type = &asn_DEF_RelativeDistinguishedName,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -359,7 +359,7 @@
 /*** <<< CODE [RelativeDistinguishedName] >>> ***/
 
 static int
-memb_IA5String_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_IA5String_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -392,7 +392,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_IA5String_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
diff --git a/tests/tests-asn1c-compiler/22-tags-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/22-tags-OK.asn1.-Pfwide-types
index 0ba29f1..dd286a5 100644
--- a/tests/tests-asn1c-compiler/22-tags-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/22-tags-OK.asn1.-Pfwide-types
@@ -48,7 +48,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.n),
@@ -57,7 +57,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "n"
 		},
 };
@@ -72,7 +72,7 @@
 	sizeof(((struct b *)0)->present),
 	.tag2el = asn_MAP_b_tag2el_3,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -97,7 +97,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T1, b),
@@ -106,7 +106,7 @@
 		.type = &asn_DEF_b_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T1, c),
@@ -115,7 +115,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/30-set-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/30-set-OK.asn1.-Pfwide-types
index 1822fea..ef0ea21 100644
--- a/tests/tests-asn1c-compiler/30-set-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/30-set-OK.asn1.-Pfwide-types
@@ -50,7 +50,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, s),
@@ -59,7 +59,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "s"
 		},
 	{ ATF_POINTER, 1, offsetof(struct T, b),
@@ -68,7 +68,7 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfcompound-names b/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfcompound-names
index 55eb127..0169848 100644
--- a/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfcompound-names
+++ b/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfcompound-names
@@ -36,7 +36,7 @@
 		.type = &asn_DEF_Tree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -95,7 +95,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "height"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Tree, width),
@@ -104,7 +104,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "width"
 		},
 };
@@ -240,7 +240,7 @@
 		.type = &asn_DEF_Forest,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -277,7 +277,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "cup-of-coffee"
 		},
 };
@@ -320,7 +320,7 @@
 		.type = &asn_DEF_Member_5,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -357,7 +357,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Stuff__other, choice.b),
@@ -366,7 +366,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -381,7 +381,7 @@
 	sizeof(((struct Stuff__other *)0)->present),
 	.tag2el = asn_MAP_other_tag2el_9,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -406,7 +406,7 @@
 		.type = &asn_DEF_trees_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "trees"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Stuff, anything),
@@ -415,7 +415,7 @@
 		.type = &asn_DEF_anything_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "anything"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Stuff, other),
@@ -424,7 +424,7 @@
 		.type = &asn_DEF_other_9,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "other"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfwide-types
index 85e8679..cbb8e90 100644
--- a/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/31-set-of-OK.asn1.-Pfwide-types
@@ -36,7 +36,7 @@
 		.type = &asn_DEF_Tree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -95,7 +95,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "height"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Tree, width),
@@ -104,7 +104,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "width"
 		},
 };
@@ -240,7 +240,7 @@
 		.type = &asn_DEF_Forest,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -277,7 +277,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "cup-of-coffee"
 		},
 };
@@ -320,7 +320,7 @@
 		.type = &asn_DEF_Member_5,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -357,7 +357,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct other, choice.b),
@@ -366,7 +366,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -381,7 +381,7 @@
 	sizeof(((struct other *)0)->present),
 	.tag2el = asn_MAP_other_tag2el_9,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -406,7 +406,7 @@
 		.type = &asn_DEF_trees_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "trees"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Stuff, anything),
@@ -415,7 +415,7 @@
 		.type = &asn_DEF_anything_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "anything"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Stuff, other),
@@ -424,7 +424,7 @@
 		.type = &asn_DEF_other_9,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "other"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/32-sequence-of-OK.asn1.-P b/tests/tests-asn1c-compiler/32-sequence-of-OK.asn1.-P
index 91d0940..b75a93b 100644
--- a/tests/tests-asn1c-compiler/32-sequence-of-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/32-sequence-of-OK.asn1.-P
@@ -34,7 +34,7 @@
 		.type = &asn_DEF_Fault,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -100,7 +100,7 @@
 		.type = &asn_DEF_Error,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -223,7 +223,7 @@
 		.type = &asn_DEF_Error,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -260,7 +260,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "someString"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct SeqWithMandatory, seqOfMan),
@@ -269,7 +269,7 @@
 		.type = &asn_DEF_seqOfMan_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "seqOfMan"
 		},
 };
@@ -349,7 +349,7 @@
 		.type = &asn_DEF_Error,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -386,7 +386,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "someString"
 		},
 	{ ATF_POINTER, 1, offsetof(struct SeqWithOptional, seqOfOpt),
@@ -395,7 +395,7 @@
 		.type = &asn_DEF_seqOfOpt_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "seqOfOpt"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/37-indirect-choice-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/37-indirect-choice-OK.asn1.-Pfwide-types
index a338bf2..44ec422 100644
--- a/tests/tests-asn1c-compiler/37-indirect-choice-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/37-indirect-choice-OK.asn1.-Pfwide-types
@@ -45,7 +45,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, choice.t_b),
@@ -54,7 +54,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-b"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, choice.t_c),
@@ -63,7 +63,7 @@
 		.type = &asn_DEF_Choice1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-c"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, choice.t_d),
@@ -72,7 +72,7 @@
 		.type = &asn_DEF_Choice2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-d"
 		},
 };
@@ -89,7 +89,7 @@
 	sizeof(((struct T *)0)->present),
 	.tag2el = asn_MAP_T_tag2el_1,
 	.tag2el_count = 4,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_T = {
@@ -149,7 +149,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c-a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice1, choice.c_b),
@@ -158,7 +158,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c-b"
 		},
 };
@@ -173,7 +173,7 @@
 	sizeof(((struct Choice1 *)0)->present),
 	.tag2el = asn_MAP_Choice1_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice1 = {
@@ -238,7 +238,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c-a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_b),
@@ -247,7 +247,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c-b"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_d),
@@ -256,7 +256,7 @@
 		.type = &asn_DEF_Choice1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c-d"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_e),
@@ -265,7 +265,7 @@
 		.type = &asn_DEF_Choice1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c-e"
 		},
 };
@@ -285,7 +285,7 @@
 	sizeof(((struct Choice2 *)0)->present),
 	.tag2el = asn_MAP_Choice2_tag2el_1,
 	.tag2el_count = 4,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice2 = {
diff --git a/tests/tests-asn1c-compiler/39-sequence-of-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/39-sequence-of-OK.asn1.-Pfwide-types
index 9d42a25..4a298ec 100644
--- a/tests/tests-asn1c-compiler/39-sequence-of-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/39-sequence-of-OK.asn1.-Pfwide-types
@@ -42,7 +42,7 @@
 		.type = &asn_DEF_T2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -78,7 +78,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, collection),
@@ -87,7 +87,7 @@
 		.type = &asn_DEF_collection_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "collection"
 		},
 };
@@ -155,7 +155,7 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "flag"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T2, str),
@@ -164,7 +164,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "str"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/42-real-life-OK.asn1.-PR b/tests/tests-asn1c-compiler/42-real-life-OK.asn1.-PR
index 8564c9b..84d06a1 100644
--- a/tests/tests-asn1c-compiler/42-real-life-OK.asn1.-PR
+++ b/tests/tests-asn1c-compiler/42-real-life-OK.asn1.-PR
@@ -40,7 +40,7 @@
 /*** <<< CODE [LogLine] >>> ***/
 
 static int
-memb_varsets_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_varsets_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	size_t size;
 	
@@ -75,7 +75,7 @@
 		.type = &asn_DEF_VariablePartSet,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -111,7 +111,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "line-digest"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct LogLine, varsets),
@@ -120,7 +120,7 @@
 		.type = &asn_DEF_varsets_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_varsets_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "varsets"
 		},
 };
@@ -200,7 +200,7 @@
 /*** <<< CODE [VariablePartSet] >>> ***/
 
 static int
-memb_vparts_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_vparts_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -228,7 +228,7 @@
 		.type = &asn_DEF_VariablePart,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -264,7 +264,7 @@
 		.type = &asn_DEF_vparts_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_vparts_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "vparts"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct VariablePartSet, resolution),
@@ -273,7 +273,7 @@
 		.type = &asn_DEF_ActionItem,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "resolution"
 		},
 };
@@ -369,7 +369,7 @@
 /*** <<< CODE [VariablePart] >>> ***/
 
 static int
-memb_vset_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_vset_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	size_t size;
 	
@@ -404,7 +404,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -440,7 +440,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "from"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct vrange, to),
@@ -449,7 +449,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "to"
 		},
 };
@@ -493,7 +493,7 @@
 		.type = &asn_DEF_vset_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_vset_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "vset"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct VariablePart, choice.vrange),
@@ -502,7 +502,7 @@
 		.type = &asn_DEF_vrange_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "vrange"
 		},
 };
@@ -517,7 +517,7 @@
 	sizeof(((struct VariablePart *)0)->present),
 	.tag2el = asn_MAP_VariablePart_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 2	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_VariablePart = {
@@ -647,7 +647,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -683,7 +683,7 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "critical"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct notify, email),
@@ -692,7 +692,7 @@
 		.type = &asn_DEF_email_9,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "email"
 		},
 };
@@ -736,7 +736,7 @@
 		.type = &asn_DEF_accept_as_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "accept-as"
 		},
 	{ ATF_POINTER, 1, offsetof(struct ActionItem, notify),
@@ -745,7 +745,7 @@
 		.type = &asn_DEF_notify_7,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "notify"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/43-recursion-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/43-recursion-OK.asn1.-Pfwide-types
index ae5fa99..c51e633 100644
--- a/tests/tests-asn1c-compiler/43-recursion-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/43-recursion-OK.asn1.-Pfwide-types
@@ -53,7 +53,7 @@
 		.type = &asn_DEF_Test_structure_1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -89,7 +89,7 @@
 		.type = &asn_DEF_Test_structure_1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -125,7 +125,7 @@
 		.type = &asn_DEF_t_member1_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-member1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test_structure_1, t_member2),
@@ -134,7 +134,7 @@
 		.type = &asn_DEF_t_member2_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-member2"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Test_structure_1, t_member3),
@@ -143,7 +143,7 @@
 		.type = &asn_DEF_Test_structure_1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-member3"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Test_structure_1, t_member4),
@@ -152,7 +152,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t-member4"
 		},
 };
@@ -251,7 +251,7 @@
 		.type = &asn_DEF_Choice_1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -288,7 +288,7 @@
 		.type = &asn_DEF_Choice_1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "and"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice_1, choice.Or),
@@ -297,7 +297,7 @@
 		.type = &asn_DEF_or_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "or"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice_1, choice.Not),
@@ -306,7 +306,7 @@
 		.type = &asn_DEF_Choice_1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "not"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice_1, choice.other),
@@ -315,7 +315,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "other"
 		},
 };
@@ -332,7 +332,7 @@
 	sizeof(((struct Choice_1 *)0)->present),
 	.tag2el = asn_MAP_Choice_1_tag2el_1,
 	.tag2el_count = 4,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice_1 = {
@@ -400,7 +400,7 @@
 		.type = &asn_DEF_Test_structure_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m1"
 		},
 };
@@ -491,7 +491,7 @@
 		.type = &asn_DEF_Test_structure_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m1"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/44-choice-in-sequence-OK.asn1.-P b/tests/tests-asn1c-compiler/44-choice-in-sequence-OK.asn1.-P
index cdf6b67..e9f4993 100644
--- a/tests/tests-asn1c-compiler/44-choice-in-sequence-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/44-choice-in-sequence-OK.asn1.-P
@@ -77,7 +77,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "f"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct e, choice.g),
@@ -86,7 +86,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "g"
 		},
 };
@@ -101,7 +101,7 @@
 	sizeof(((struct e *)0)->present),
 	.tag2el = asn_MAP_e_tag2el_6,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -126,7 +126,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct h, choice.j),
@@ -135,7 +135,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "j"
 		},
 };
@@ -150,7 +150,7 @@
 	sizeof(((struct h *)0)->present),
 	.tag2el = asn_MAP_h_tag2el_9,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -175,7 +175,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.d),
@@ -184,7 +184,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "d"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.e),
@@ -193,7 +193,7 @@
 		.type = &asn_DEF_e_6,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "e"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.h),
@@ -202,7 +202,7 @@
 		.type = &asn_DEF_h_9,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "h"
 		},
 };
@@ -220,7 +220,7 @@
 	sizeof(((struct b *)0)->present),
 	.tag2el = asn_MAP_b_tag2el_3,
 	.tag2el_count = 5,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -245,7 +245,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, b),
@@ -254,7 +254,7 @@
 		.type = &asn_DEF_b_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/46-redefine-OK.asn1.-PR b/tests/tests-asn1c-compiler/46-redefine-OK.asn1.-PR
index 60d1d1c..f7edb4c 100644
--- a/tests/tests-asn1c-compiler/46-redefine-OK.asn1.-PR
+++ b/tests/tests-asn1c-compiler/46-redefine-OK.asn1.-PR
@@ -75,7 +75,7 @@
 		.type = &asn_DEF_PrimitiveType,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "field"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/47-set-ext-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/47-set-ext-OK.asn1.-Pfwide-types
index 6142463..1a55fe8 100644
--- a/tests/tests-asn1c-compiler/47-set-ext-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/47-set-ext-OK.asn1.-Pfwide-types
@@ -44,7 +44,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 };
@@ -131,7 +131,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 };
@@ -216,7 +216,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 };
@@ -230,7 +230,7 @@
 	sizeof(((struct T3 *)0)->present),
 	.tag2el = asn_MAP_T3_tag2el_1,
 	.tag2el_count = 1,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_T3 = {
@@ -291,7 +291,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 };
@@ -305,7 +305,7 @@
 	sizeof(((struct T4 *)0)->present),
 	.tag2el = asn_MAP_T4_tag2el_1,
 	.tag2el_count = 1,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_T4 = {
diff --git a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
index 78b3d22..d911711 100644
--- a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
@@ -68,7 +68,7 @@
 /*** <<< CODE [Int2] >>> ***/
 
 int
-Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Int1_t *st = (const Int1_t *)sptr;
 	long value;
@@ -142,7 +142,7 @@
 /*** <<< CODE [Int3] >>> ***/
 
 int
-Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Int2_t *st = (const Int2_t *)sptr;
 	long value;
@@ -220,7 +220,7 @@
 /*** <<< CODE [Int4] >>> ***/
 
 int
-Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Int3_t *st = (const Int3_t *)sptr;
 	long value;
@@ -298,7 +298,7 @@
 /*** <<< CODE [Int5] >>> ***/
 
 int
-Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Int4_t *st = (const Int4_t *)sptr;
 	long value;
@@ -376,7 +376,7 @@
 /*** <<< CODE [ExtensibleExtensions] >>> ***/
 
 int
-ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ExtensibleExtensions_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -517,7 +517,7 @@
 /*** <<< CODE [Str2] >>> ***/
 
 int
-Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Str2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Str1_t *st = (const Str1_t *)sptr;
 	size_t size;
@@ -618,7 +618,7 @@
 /*** <<< CODE [Str3] >>> ***/
 
 int
-Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Str3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Str2_t *st = (const Str2_t *)sptr;
 	size_t size;
@@ -708,7 +708,7 @@
 /*** <<< CODE [Str4] >>> ***/
 
 int
-Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Str4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -795,7 +795,7 @@
 /*** <<< CODE [PER-Visible] >>> ***/
 
 int
-PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+PER_Visible_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -882,7 +882,7 @@
 /*** <<< CODE [PER-Visible-2] >>> ***/
 
 int
-PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+PER_Visible_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -969,7 +969,7 @@
 /*** <<< CODE [Not-PER-Visible-1] >>> ***/
 
 int
-Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Not_PER_Visible_1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1056,7 +1056,7 @@
 /*** <<< CODE [Not-PER-Visible-2] >>> ***/
 
 int
-Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Not_PER_Visible_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1143,7 +1143,7 @@
 /*** <<< CODE [Not-PER-Visible-3] >>> ***/
 
 int
-Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Not_PER_Visible_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1230,7 +1230,7 @@
 /*** <<< CODE [SIZE-but-not-FROM] >>> ***/
 
 int
-SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+SIZE_but_not_FROM_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	size_t size;
@@ -1320,7 +1320,7 @@
 /*** <<< CODE [SIZE-and-FROM] >>> ***/
 
 int
-SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+SIZE_and_FROM_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	size_t size;
@@ -1410,7 +1410,7 @@
 /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
 
 int
-Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Neither_SIZE_nor_FROM_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1491,7 +1491,7 @@
 /*** <<< CODE [Utf8-4] >>> ***/
 
 int
-Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Utf8_4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UTF8String_t *st = (const UTF8String_t *)sptr;
 	
@@ -1591,7 +1591,7 @@
 /*** <<< CODE [Utf8-3] >>> ***/
 
 int
-Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Utf8_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Utf8_2_t *st = (const Utf8_2_t *)sptr;
 	size_t size;
@@ -1671,7 +1671,7 @@
 /*** <<< CODE [Utf8-2] >>> ***/
 
 int
-Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Utf8_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Utf8_1_t *st = (const Utf8_1_t *)sptr;
 	size_t size;
@@ -1825,7 +1825,7 @@
 /*** <<< CODE [VisibleIdentifier] >>> ***/
 
 int
-VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+VisibleIdentifier_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Identifier_t *st = (const Identifier_t *)sptr;
 	size_t size;
@@ -1931,7 +1931,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_int1_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Int1_t *st = (const Int1_t *)sptr;
 	long value;
@@ -1962,7 +1962,7 @@
 }
 
 static int
-memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_int4_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Int4_t *st = (const Int4_t *)sptr;
 	long value;
@@ -1993,7 +1993,7 @@
 }
 
 static int
-memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_int5_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Int5_t *st = (const Int5_t *)sptr;
 	long value;
@@ -2026,43 +2026,51 @@
 
 /*** <<< STAT-DEFS [Sequence] >>> ***/
 
-static int asn_DFL_2_set_3(int set_value, void **sptr) {
+static int asn_DFL_2_cmp_3(const void *sptr) {
+	const Int1_t *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 3 */
+	long value;
+	if(asn_INTEGER2long(st, &value))
+		return -1;
+	return (value != 3);
+}
+static int asn_DFL_2_set_3(void **sptr) {
 	Int1_t *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 3 */
-		return asn_long2INTEGER(st, 3);
-	} else {
-		/* Test default value 3 */
-		long value;
-		if(asn_INTEGER2long(st, &value))
-			return -1;
-		return (value == 3);
-	}
+	/* Install default value 3 */
+	return asn_long2INTEGER(st, 3);
 }
-static int asn_DFL_5_set_1(int set_value, void **sptr) {
+static int asn_DFL_5_cmp_1(const void *sptr) {
+	const BOOLEAN_t *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 1 */
+	return (*st != 1);
+}
+static int asn_DFL_5_set_1(void **sptr) {
 	BOOLEAN_t *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 1 */
-		*st = 1;
-		return 0;
-	} else {
-		/* Test default value 1 */
-		return (*st == 1);
-	}
+	/* Install default value 1 */
+	*st = 1;
+	return 0;
 }
 static const asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = {
 	{ 1,	3,	"one" },
@@ -2111,7 +2119,8 @@
 		.type = &asn_DEF_Int1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_int1_c_constraint_1 },
-		.default_value = asn_DFL_2_set_3,	/* DEFAULT 3 */
+		.default_value_cmp = asn_DFL_2_cmp_3,	/* Compare DEFAULT 3 */
+		.default_value_set = asn_DFL_2_set_3,	/* Set DEFAULT 3 */
 		.name = "int1-c"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, int4),
@@ -2120,7 +2129,7 @@
 		.type = &asn_DEF_Int4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int4"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c),
@@ -2129,7 +2138,7 @@
 		.type = &asn_DEF_Int4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_int4_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int4-c"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Sequence, Bool),
@@ -2138,7 +2147,8 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = asn_DFL_5_set_1,	/* DEFAULT 1 */
+		.default_value_cmp = asn_DFL_5_cmp_1,	/* Compare DEFAULT 1 */
+		.default_value_set = asn_DFL_5_set_1,	/* Set DEFAULT 1 */
 		.name = "bool"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c),
@@ -2147,7 +2157,7 @@
 		.type = &asn_DEF_enum_c_6,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "enum-c"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Sequence, null),
@@ -2156,7 +2166,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "null"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Sequence, int5_c),
@@ -2165,7 +2175,7 @@
 		.type = &asn_DEF_Int5,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_int5_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int5-c"
 		},
 };
@@ -2242,7 +2252,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -2371,7 +2381,7 @@
 /*** <<< CODE [Enum1] >>> ***/
 
 int
-Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Enum1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -2488,7 +2498,7 @@
 /*** <<< CODE [Identifier] >>> ***/
 
 int
-Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Identifier_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const VisibleString_t *st = (const VisibleString_t *)sptr;
 	size_t size;
diff --git a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
index c588c01..4174ea6 100644
--- a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
@@ -73,7 +73,7 @@
 /*** <<< CODE [Int2] >>> ***/
 
 int
-Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -156,7 +156,7 @@
 /*** <<< CODE [Int3] >>> ***/
 
 int
-Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -239,7 +239,7 @@
 /*** <<< CODE [Int4] >>> ***/
 
 int
-Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -322,7 +322,7 @@
 /*** <<< CODE [Int5] >>> ***/
 
 int
-Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Int5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -404,7 +404,7 @@
 /*** <<< CODE [ExtensibleExtensions] >>> ***/
 
 int
-ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ExtensibleExtensions_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -561,7 +561,7 @@
 /*** <<< CODE [Str2] >>> ***/
 
 int
-Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Str2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Str1_t *st = (const Str1_t *)sptr;
 	size_t size;
@@ -675,7 +675,7 @@
 /*** <<< CODE [Str3] >>> ***/
 
 int
-Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Str3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Str2_t *st = (const Str2_t *)sptr;
 	size_t size;
@@ -786,7 +786,7 @@
 /*** <<< CODE [Str4] >>> ***/
 
 int
-Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Str4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -884,7 +884,7 @@
 /*** <<< CODE [PER-Visible] >>> ***/
 
 int
-PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+PER_Visible_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -981,7 +981,7 @@
 /*** <<< CODE [PER-Visible-2] >>> ***/
 
 int
-PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+PER_Visible_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1078,7 +1078,7 @@
 /*** <<< CODE [Not-PER-Visible-1] >>> ***/
 
 int
-Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Not_PER_Visible_1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1175,7 +1175,7 @@
 /*** <<< CODE [Not-PER-Visible-2] >>> ***/
 
 int
-Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Not_PER_Visible_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1272,7 +1272,7 @@
 /*** <<< CODE [Not-PER-Visible-3] >>> ***/
 
 int
-Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Not_PER_Visible_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1369,7 +1369,7 @@
 /*** <<< CODE [SIZE-but-not-FROM] >>> ***/
 
 int
-SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+SIZE_but_not_FROM_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	size_t size;
@@ -1469,7 +1469,7 @@
 /*** <<< CODE [SIZE-and-FROM] >>> ***/
 
 int
-SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+SIZE_and_FROM_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	size_t size;
@@ -1569,7 +1569,7 @@
 /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
 
 int
-Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Neither_SIZE_nor_FROM_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 	
@@ -1660,7 +1660,7 @@
 /*** <<< CODE [Utf8-4] >>> ***/
 
 int
-Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Utf8_4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const UTF8String_t *st = (const UTF8String_t *)sptr;
 	
@@ -1770,7 +1770,7 @@
 /*** <<< CODE [Utf8-3] >>> ***/
 
 int
-Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Utf8_3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Utf8_2_t *st = (const Utf8_2_t *)sptr;
 	size_t size;
@@ -1861,7 +1861,7 @@
 /*** <<< CODE [Utf8-2] >>> ***/
 
 int
-Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Utf8_2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Utf8_1_t *st = (const Utf8_1_t *)sptr;
 	size_t size;
@@ -2034,7 +2034,7 @@
 /*** <<< CODE [VisibleIdentifier] >>> ***/
 
 int
-VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+VisibleIdentifier_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const Identifier_t *st = (const Identifier_t *)sptr;
 	size_t size;
@@ -2159,7 +2159,7 @@
  * so here we adjust the DEF accordingly.
  */
 static int
-memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_int1_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -2184,7 +2184,7 @@
 }
 
 static int
-memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_int4_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -2209,7 +2209,7 @@
 }
 
 static int
-memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_int5_c_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -2259,41 +2259,49 @@
 
 /*** <<< STAT-DEFS [Sequence] >>> ***/
 
-static int asn_DFL_2_set_3(int set_value, void **sptr) {
+static int asn_DFL_2_cmp_3(const void *sptr) {
+	const Int1_t *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 3 */
+	return (*st != 3);
+}
+static int asn_DFL_2_set_3(void **sptr) {
 	Int1_t *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 3 */
-		*st = 3;
-		return 0;
-	} else {
-		/* Test default value 3 */
-		return (*st == 3);
-	}
+	/* Install default value 3 */
+	*st = 3;
+	return 0;
 }
-static int asn_DFL_5_set_1(int set_value, void **sptr) {
+static int asn_DFL_5_cmp_1(const void *sptr) {
+	const BOOLEAN_t *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 1 */
+	return (*st != 1);
+}
+static int asn_DFL_5_set_1(void **sptr) {
 	BOOLEAN_t *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 1 */
-		*st = 1;
-		return 0;
-	} else {
-		/* Test default value 1 */
-		return (*st == 1);
-	}
+	/* Install default value 1 */
+	*st = 1;
+	return 0;
 }
 static const asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = {
 	{ 1,	3,	"one" },
@@ -2342,7 +2350,8 @@
 		.type = &asn_DEF_Int1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_int1_c_constr_2, .general_constraints =  memb_int1_c_constraint_1 },
-		.default_value = asn_DFL_2_set_3,	/* DEFAULT 3 */
+		.default_value_cmp = asn_DFL_2_cmp_3,	/* Compare DEFAULT 3 */
+		.default_value_set = asn_DFL_2_set_3,	/* Set DEFAULT 3 */
 		.name = "int1-c"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, int4),
@@ -2351,7 +2360,7 @@
 		.type = &asn_DEF_Int4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int4"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c),
@@ -2360,7 +2369,7 @@
 		.type = &asn_DEF_Int4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_int4_c_constr_4, .general_constraints =  memb_int4_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int4-c"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Sequence, Bool),
@@ -2369,7 +2378,8 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = asn_DFL_5_set_1,	/* DEFAULT 1 */
+		.default_value_cmp = asn_DFL_5_cmp_1,	/* Compare DEFAULT 1 */
+		.default_value_set = asn_DFL_5_set_1,	/* Set DEFAULT 1 */
 		.name = "bool"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c),
@@ -2378,7 +2388,7 @@
 		.type = &asn_DEF_enum_c_6,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "enum-c"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Sequence, null),
@@ -2387,7 +2397,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "null"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Sequence, int5_c),
@@ -2396,7 +2406,7 @@
 		.type = &asn_DEF_Int5,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = &asn_PER_memb_int5_c_constr_13, .general_constraints =  memb_int5_c_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int5-c"
 		},
 };
@@ -2483,7 +2493,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -2624,7 +2634,7 @@
 /*** <<< CODE [Enum1] >>> ***/
 
 int
-Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Enum1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -2759,7 +2769,7 @@
 /*** <<< CODE [Identifier] >>> ***/
 
 int
-Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+Identifier_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const VisibleString_t *st = (const VisibleString_t *)sptr;
 	size_t size;
diff --git a/tests/tests-asn1c-compiler/59-choice-extended-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/59-choice-extended-OK.asn1.-Pfwide-types
index 12caca2..e2dab3c 100644
--- a/tests/tests-asn1c-compiler/59-choice-extended-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/59-choice-extended-OK.asn1.-Pfwide-types
@@ -55,7 +55,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.b),
@@ -64,7 +64,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice, choice.c),
@@ -73,7 +73,7 @@
 		.type = &asn_DEF_Choice,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c"
 		},
 };
@@ -92,7 +92,7 @@
 	sizeof(((struct Choice *)0)->present),
 	.tag2el = asn_MAP_Choice_tag2el_1,
 	.tag2el_count = 3,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice = {
diff --git a/tests/tests-asn1c-compiler/60-any-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/60-any-OK.asn1.-Pfwide-types
index 39b6e8b..8e5ee2d 100644
--- a/tests/tests-asn1c-compiler/60-any-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/60-any-OK.asn1.-Pfwide-types
@@ -28,7 +28,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 	{ ATF_ANY_TYPE | ATF_NOFLAGS, 0, offsetof(struct T1, any),
@@ -37,7 +37,7 @@
 		.type = &asn_DEF_ANY,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "any"
 		},
 };
@@ -102,7 +102,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "i"
 		},
 	{ ATF_POINTER, 1, offsetof(struct T2, any),
@@ -111,7 +111,7 @@
 		.type = &asn_DEF_ANY,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "any"
 		},
 };
@@ -176,7 +176,7 @@
 		.type = &asn_DEF_ANY,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "any1"
 		},
 	{ ATF_ANY_TYPE | ATF_NOFLAGS, 0, offsetof(struct T3, any2),
@@ -185,7 +185,7 @@
 		.type = &asn_DEF_ANY,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "any2"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfnative-types b/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfnative-types
index 91828bd..1d99041 100644
--- a/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfnative-types
+++ b/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfnative-types
@@ -393,7 +393,7 @@
 		.type = &asn_DEF_T2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m1"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Ts, m2),
@@ -402,7 +402,7 @@
 		.type = &asn_DEF_T3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m2"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Ts, m3),
@@ -411,7 +411,7 @@
 		.type = &asn_DEF_T3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m3"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfwide-types
index d041c2c..30cc719 100644
--- a/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/65-multi-tag-OK.asn1.-Pfwide-types
@@ -393,7 +393,7 @@
 		.type = &asn_DEF_T2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m1"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Ts, m2),
@@ -402,7 +402,7 @@
 		.type = &asn_DEF_T3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m2"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Ts, m3),
@@ -411,7 +411,7 @@
 		.type = &asn_DEF_T3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m3"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/66-ref-simple-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/66-ref-simple-OK.asn1.-Pfwide-types
index c83d269..99f414a 100644
--- a/tests/tests-asn1c-compiler/66-ref-simple-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/66-ref-simple-OK.asn1.-Pfwide-types
@@ -27,7 +27,7 @@
 		.type = &asn_DEF_SimpleType,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "named"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/69-reserved-words-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/69-reserved-words-OK.asn1.-Pfwide-types
index 6456b7a..063aa6e 100644
--- a/tests/tests-asn1c-compiler/69-reserved-words-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/69-reserved-words-OK.asn1.-Pfwide-types
@@ -47,7 +47,7 @@
 /*** <<< CODE [T] >>> ***/
 
 static int
-memb_char_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_char_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
 	size_t size;
@@ -116,7 +116,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, Char),
@@ -125,7 +125,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_char_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "char"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, Class),
@@ -134,7 +134,7 @@
 		.type = &asn_DEF_class_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "class"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct T, Double),
@@ -143,7 +143,7 @@
 		.type = &asn_DEF_REAL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "double"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/70-xer-test-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/70-xer-test-OK.asn1.-Pfwide-types
index bc2b478..ac22bc8 100644
--- a/tests/tests-asn1c-compiler/70-xer-test-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/70-xer-test-OK.asn1.-Pfwide-types
@@ -84,7 +84,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "sequence"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.set),
@@ -93,7 +93,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.sequenceOf),
@@ -102,7 +102,7 @@
 		.type = &asn_DEF_SequenceOf,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "sequenceOf"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.extensibleSet),
@@ -111,7 +111,7 @@
 		.type = &asn_DEF_ExtensibleSet,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "extensibleSet"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.extensibleSequence),
@@ -120,7 +120,7 @@
 		.type = &asn_DEF_ExtensibleSequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "extensibleSequence"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.extensibleSequence2),
@@ -129,7 +129,7 @@
 		.type = &asn_DEF_ExtensibleSequence2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "extensibleSequence2"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfNULL),
@@ -138,7 +138,7 @@
 		.type = &asn_DEF_SetOfNULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "setOfNULL"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfREAL),
@@ -147,7 +147,7 @@
 		.type = &asn_DEF_SetOfREAL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "setOfREAL"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfEnums),
@@ -156,7 +156,7 @@
 		.type = &asn_DEF_SetOfEnums,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "setOfEnums"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfNULL),
@@ -165,7 +165,7 @@
 		.type = &asn_DEF_NamedSetOfNULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "namedSetOfNULL"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfREAL),
@@ -174,7 +174,7 @@
 		.type = &asn_DEF_NamedSetOfREAL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "namedSetOfREAL"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfEnums),
@@ -183,7 +183,7 @@
 		.type = &asn_DEF_NamedSetOfEnums,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "namedSetOfEnums"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.seqOfZuka),
@@ -192,7 +192,7 @@
 		.type = &asn_DEF_SeqOfZuka,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "seqOfZuka"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfChoice),
@@ -201,7 +201,7 @@
 		.type = &asn_DEF_SetOfChoice,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "setOfChoice"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfChoice),
@@ -210,7 +210,7 @@
 		.type = &asn_DEF_NamedSetOfChoice,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "namedSetOfChoice"
 		},
 };
@@ -238,7 +238,7 @@
 	sizeof(((struct PDU *)0)->present),
 	.tag2el = asn_MAP_PDU_tag2el_1,
 	.tag2el_count = 15,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 15	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_PDU = {
@@ -298,7 +298,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "integer"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Sequence, sequence),
@@ -307,7 +307,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "sequence"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Sequence, bits),
@@ -316,7 +316,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bits"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, string),
@@ -325,7 +325,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "string"
 		},
 };
@@ -410,7 +410,7 @@
 		.type = &asn_DEF_RELATIVE_OID,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "roid"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Set, opaque),
@@ -419,7 +419,7 @@
 		.type = &asn_DEF_OCTET_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "opaque"
 		},
 };
@@ -560,7 +560,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "string"
 		},
 	{ ATF_POINTER, 1, offsetof(struct ExtensibleSet, Enum),
@@ -569,7 +569,7 @@
 		.type = &asn_DEF_enum_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "enum"
 		},
 };
@@ -648,7 +648,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "string"
 		},
 	{ ATF_POINTER, 2, offsetof(struct ExtensibleSequence, integer),
@@ -657,7 +657,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "integer"
 		},
 	{ ATF_POINTER, 1, offsetof(struct ExtensibleSequence, gtime),
@@ -666,7 +666,7 @@
 		.type = &asn_DEF_GeneralizedTime,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "gtime"
 		},
 };
@@ -739,7 +739,7 @@
 		.type = &asn_DEF_UTF8String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "string"
 		},
 	{ ATF_POINTER, 1, offsetof(struct ExtensibleSequence2, integer),
@@ -748,7 +748,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "integer"
 		},
 };
@@ -815,7 +815,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -874,7 +874,7 @@
 		.type = &asn_DEF_REAL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -984,7 +984,7 @@
 		.type = &asn_DEF_Member_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -1043,7 +1043,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "y"
 		},
 };
@@ -1102,7 +1102,7 @@
 		.type = &asn_DEF_REAL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "name"
 		},
 };
@@ -1212,7 +1212,7 @@
 		.type = &asn_DEF_name_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "name"
 		},
 };
@@ -1271,7 +1271,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "id"
 		},
 };
@@ -1330,7 +1330,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "zuka"
 		},
 };
@@ -1396,7 +1396,7 @@
 		.type = &asn_DEF_SimpleChoice,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -1462,7 +1462,7 @@
 		.type = &asn_DEF_SimpleChoice,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "whatever"
 		},
 };
@@ -1533,7 +1533,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct SimpleChoice, choice.b),
@@ -1542,7 +1542,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -1557,7 +1557,7 @@
 	sizeof(((struct SimpleChoice *)0)->present),
 	.tag2el = asn_MAP_SimpleChoice_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_SimpleChoice = {
diff --git a/tests/tests-asn1c-compiler/72-same-names-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/72-same-names-OK.asn1.-Pfwide-types
index bda3445..1140af1 100644
--- a/tests/tests-asn1c-compiler/72-same-names-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/72-same-names-OK.asn1.-Pfwide-types
@@ -39,7 +39,7 @@
 		.type = &asn_DEF_Type1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Member, t2),
@@ -48,7 +48,7 @@
 		.type = &asn_DEF_Type2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "t2"
 		},
 };
@@ -93,7 +93,7 @@
 		.type = &asn_DEF_Member_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -173,7 +173,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct another_name, b),
@@ -182,7 +182,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -226,7 +226,7 @@
 		.type = &asn_DEF_another_name_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "another-name"
 		},
 };
@@ -240,7 +240,7 @@
 	sizeof(((struct one_name *)0)->present),
 	.tag2el = asn_MAP_one_name_tag2el_2,
 	.tag2el_count = 1,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -265,7 +265,7 @@
 		.type = &asn_DEF_one_name_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "one-name"
 		},
 };
@@ -378,7 +378,7 @@
 /*** <<< CODE [Type2] >>> ***/
 
 static int
-memb_a_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_a_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 	size_t size;
@@ -409,7 +409,7 @@
 }
 
 static int
-memb_a_constraint_8(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_a_constraint_8(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 	size_t size;
@@ -449,7 +449,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_a_constraint_3 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct another_name, b),
@@ -458,7 +458,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -502,7 +502,7 @@
 		.type = &asn_DEF_another_name_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "another-name"
 		},
 };
@@ -545,7 +545,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_a_constraint_8 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct another_name, b),
@@ -554,7 +554,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -598,7 +598,7 @@
 		.type = &asn_DEF_another_name_8,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "another-name"
 		},
 };
@@ -647,7 +647,7 @@
 		.type = &asn_DEF_one_name_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "one-name"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Type2, choice.two_name),
@@ -656,7 +656,7 @@
 		.type = &asn_DEF_two_name_7,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "two-name"
 		},
 };
@@ -671,7 +671,7 @@
 	sizeof(((struct Type2 *)0)->present),
 	.tag2el = asn_MAP_Type2_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Type2 = {
diff --git a/tests/tests-asn1c-compiler/73-circular-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/73-circular-OK.asn1.-Pfwide-types
index 3bdfca4..3ddb5ce 100644
--- a/tests/tests-asn1c-compiler/73-circular-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/73-circular-OK.asn1.-Pfwide-types
@@ -42,7 +42,7 @@
 		.type = &asn_DEF_EpytRef,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -78,7 +78,7 @@
 		.type = &asn_DEF_data_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "data"
 		},
 };
@@ -209,7 +209,7 @@
 		.type = &asn_DEF_Type,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -245,7 +245,7 @@
 		.type = &asn_DEF_stype_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "stype"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Epyt, type),
@@ -254,7 +254,7 @@
 		.type = &asn_DEF_Type,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "type"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Epyt, ypet),
@@ -263,7 +263,7 @@
 		.type = &asn_DEF_Ypet,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ypet"
 		},
 };
@@ -392,7 +392,7 @@
 /*** <<< CODE [Ypet] >>> ***/
 
 static int
-memb_patest1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_patest1_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -416,7 +416,7 @@
 }
 
 static int
-memb_patest2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_patest2_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const IA5String_t *st = (const IA5String_t *)sptr;
 	
@@ -442,25 +442,29 @@
 
 /*** <<< STAT-DEFS [Ypet] >>> ***/
 
-static int asn_DFL_3_set_7(int set_value, void **sptr) {
+static int asn_DFL_3_cmp_7(const void *sptr) {
+	const INTEGER_t *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 7 */
+	long value;
+	if(asn_INTEGER2long(st, &value))
+		return -1;
+	return (value != 7);
+}
+static int asn_DFL_3_set_7(void **sptr) {
 	INTEGER_t *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 7 */
-		return asn_long2INTEGER(st, 7);
-	} else {
-		/* Test default value 7 */
-		long value;
-		if(asn_INTEGER2long(st, &value))
-			return -1;
-		return (value == 7);
-	}
+	/* Install default value 7 */
+	return asn_long2INTEGER(st, 7);
 }
 static asn_TYPE_member_t asn_MBR_senums_4[] = {
 	{ ATF_POINTER, 0, 0,
@@ -469,7 +473,7 @@
 		.type = &asn_DEF_EnumType,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -505,7 +509,7 @@
 		.type = &asn_DEF_Epyt,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "epyt"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Ypet, plain),
@@ -514,7 +518,8 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = asn_DFL_3_set_7,	/* DEFAULT 7 */
+		.default_value_cmp = asn_DFL_3_cmp_7,	/* Compare DEFAULT 7 */
+		.default_value_set = asn_DFL_3_set_7,	/* Set DEFAULT 7 */
 		.name = "plain"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Ypet, senums),
@@ -523,7 +528,7 @@
 		.type = &asn_DEF_senums_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "senums"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Ypet, patest1),
@@ -532,7 +537,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_patest1_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "patest1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Ypet, patest2),
@@ -541,7 +546,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_patest2_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "patest2"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/84-param-tags-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/84-param-tags-OK.asn1.-Pfwide-types
index 538a342..c2e286d 100644
--- a/tests/tests-asn1c-compiler/84-param-tags-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/84-param-tags-OK.asn1.-Pfwide-types
@@ -32,7 +32,7 @@
 /*** <<< CODE [TestType] >>> ***/
 
 static int
-memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_common_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -59,23 +59,27 @@
 
 /*** <<< STAT-DEFS [TestType] >>> ***/
 
-static int asn_DFL_2_set_0(int set_value, void **sptr) {
+static int asn_DFL_2_cmp_0(const void *sptr) {
+	const long *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 0 */
+	return (*st != 0);
+}
+static int asn_DFL_2_set_0(void **sptr) {
 	long *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 0 */
-		*st = 0;
-		return 0;
-	} else {
-		/* Test default value 0 */
-		return (*st == 0);
-	}
+	/* Install default value 0 */
+	*st = 0;
+	return 0;
 }
 asn_TYPE_member_t asn_MBR_TestType_16P0_1[] = {
 	{ ATF_NOFLAGS, 1, offsetof(struct TestType_16P0, common),
@@ -84,7 +88,8 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_common_constraint_1 },
-		.default_value = asn_DFL_2_set_0,	/* DEFAULT 0 */
+		.default_value_cmp = asn_DFL_2_cmp_0,	/* Compare DEFAULT 0 */
+		.default_value_set = asn_DFL_2_set_0,	/* Set DEFAULT 0 */
 		.name = "common"
 		},
 };
@@ -119,23 +124,27 @@
 	&asn_SPC_TestType_16P0_specs_1	/* Additional specs */
 };
 
-static int asn_DFL_4_set_0(int set_value, void **sptr) {
+static int asn_DFL_4_cmp_0(const void *sptr) {
+	const BOOLEAN_t *st = sptr;
+	
+	if(!st) {
+		return -1; /* No value is not a default value */
+	}
+	
+	/* Test default value 0 */
+	return (*st != 0);
+}
+static int asn_DFL_4_set_0(void **sptr) {
 	BOOLEAN_t *st = *sptr;
 	
 	if(!st) {
-		if(!set_value) return -1;	/* Not a default value */
 		st = (*sptr = CALLOC(1, sizeof(*st)));
 		if(!st) return -1;
 	}
 	
-	if(set_value) {
-		/* Install default value 0 */
-		*st = 0;
-		return 0;
-	} else {
-		/* Test default value 0 */
-		return (*st == 0);
-	}
+	/* Install default value 0 */
+	*st = 0;
+	return 0;
 }
 asn_TYPE_member_t asn_MBR_TestType_16P1_3[] = {
 	{ ATF_NOFLAGS, 1, offsetof(struct TestType_16P1, common),
@@ -144,7 +153,8 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = asn_DFL_4_set_0,	/* DEFAULT 0 */
+		.default_value_cmp = asn_DFL_4_cmp_0,	/* Compare DEFAULT 0 */
+		.default_value_set = asn_DFL_4_set_0,	/* Set DEFAULT 0 */
 		.name = "common"
 		},
 };
@@ -219,7 +229,7 @@
 		.type = &asn_DEF_TestType_16P0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "type1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct TestChoice, choice.type2),
@@ -228,7 +238,7 @@
 		.type = &asn_DEF_TestType_16P1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "type2"
 		},
 };
@@ -243,7 +253,7 @@
 	sizeof(((struct TestChoice *)0)->present),
 	.tag2el = asn_MAP_TestChoice_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_TestChoice = {
@@ -294,7 +304,7 @@
 /*** <<< CODE [AutoType] >>> ***/
 
 static int
-memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_common_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -319,7 +329,7 @@
 }
 
 static int
-memb_common_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_common_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	BOOLEAN_t value;
 	
@@ -353,7 +363,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_common_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "common"
 		},
 };
@@ -395,7 +405,7 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_common_constraint_3 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "common"
 		},
 };
@@ -470,7 +480,7 @@
 		.type = &asn_DEF_AutoType_34P0,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "type1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct AutoChoice, choice.type2),
@@ -479,7 +489,7 @@
 		.type = &asn_DEF_AutoType_34P1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "type2"
 		},
 };
@@ -494,7 +504,7 @@
 	sizeof(((struct AutoChoice *)0)->present),
 	.tag2el = asn_MAP_AutoChoice_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_AutoChoice = {
diff --git a/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfcompound-names b/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfcompound-names
index 5e59177..5b01772 100644
--- a/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfcompound-names
+++ b/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfcompound-names
@@ -40,7 +40,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bs"
 		},
 };
@@ -54,7 +54,7 @@
 	sizeof(((struct T *)0)->present),
 	.tag2el = asn_MAP_T_tag2el_1,
 	.tag2el_count = 1,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_T = {
diff --git a/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfwide-types
index 64280ca..5e99804 100644
--- a/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/89-bit-string-enum-OK.asn1.-Pfwide-types
@@ -40,7 +40,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bs"
 		},
 };
@@ -54,7 +54,7 @@
 	sizeof(((struct T *)0)->present),
 	.tag2el = asn_MAP_T_tag2el_1,
 	.tag2el_count = 1,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_T = {
diff --git a/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-P b/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-P
index e915b0b..61b7d4c 100644
--- a/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-P
@@ -68,7 +68,7 @@
 /*** <<< CODE [CN-IntegerMinMax] >>> ***/
 
 int
-CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerMinMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -134,7 +134,7 @@
 /*** <<< CODE [CN-IntegerMinLow] >>> ***/
 
 int
-CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerMinLow_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -206,7 +206,7 @@
 /*** <<< CODE [NO-IntegerMinHigh] >>> ***/
 
 int
-NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerMinHigh_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -284,7 +284,7 @@
 /*** <<< CODE [NO-IntegerLowHigh] >>> ***/
 
 int
-NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerLowHigh_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -361,7 +361,7 @@
 /*** <<< CODE [CN-IntegerLowMax] >>> ***/
 
 int
-CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerLowMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -438,7 +438,7 @@
 /*** <<< CODE [NO-IntegerHighMax] >>> ***/
 
 int
-NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerHighMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -516,7 +516,7 @@
 /*** <<< CODE [NO-IntegerLowestMax] >>> ***/
 
 int
-NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerLowestMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -594,7 +594,7 @@
 /*** <<< CODE [NO-IntegerOutRange] >>> ***/
 
 int
-NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerOutRange_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -671,7 +671,7 @@
 /*** <<< CODE [NO-IntegerOutValue] >>> ***/
 
 int
-NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerOutValue_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -748,7 +748,7 @@
 /*** <<< CODE [OK-IntegerInRange1] >>> ***/
 
 int
-OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -820,7 +820,7 @@
 /*** <<< CODE [OK-IntegerInRange2] >>> ***/
 
 int
-OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -892,7 +892,7 @@
 /*** <<< CODE [OK-IntegerInRange3] >>> ***/
 
 int
-OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -964,7 +964,7 @@
 /*** <<< CODE [OK-IntegerInRange4] >>> ***/
 
 int
-OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1036,7 +1036,7 @@
 /*** <<< CODE [OK-IntegerInRange5] >>> ***/
 
 int
-OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1108,7 +1108,7 @@
 /*** <<< CODE [NO-IntegerInRange6] >>> ***/
 
 int
-NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerInRange6_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
diff --git a/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pfwide-types
index a5d364d..f3facef 100644
--- a/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pfwide-types
@@ -68,7 +68,7 @@
 /*** <<< CODE [CN-IntegerMinMax] >>> ***/
 
 int
-CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerMinMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	
@@ -136,7 +136,7 @@
 /*** <<< CODE [CN-IntegerMinLow] >>> ***/
 
 int
-CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerMinLow_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -214,7 +214,7 @@
 /*** <<< CODE [NO-IntegerMinHigh] >>> ***/
 
 int
-NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerMinHigh_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -292,7 +292,7 @@
 /*** <<< CODE [NO-IntegerLowHigh] >>> ***/
 
 int
-NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerLowHigh_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -369,7 +369,7 @@
 /*** <<< CODE [CN-IntegerLowMax] >>> ***/
 
 int
-CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerLowMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -447,7 +447,7 @@
 /*** <<< CODE [NO-IntegerHighMax] >>> ***/
 
 int
-NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerHighMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -525,7 +525,7 @@
 /*** <<< CODE [NO-IntegerLowestMax] >>> ***/
 
 int
-NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerLowestMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -603,7 +603,7 @@
 /*** <<< CODE [NO-IntegerOutRange] >>> ***/
 
 int
-NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerOutRange_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -680,7 +680,7 @@
 /*** <<< CODE [NO-IntegerOutValue] >>> ***/
 
 int
-NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerOutValue_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -757,7 +757,7 @@
 /*** <<< CODE [OK-IntegerInRange1] >>> ***/
 
 int
-OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -829,7 +829,7 @@
 /*** <<< CODE [OK-IntegerInRange2] >>> ***/
 
 int
-OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -901,7 +901,7 @@
 /*** <<< CODE [OK-IntegerInRange3] >>> ***/
 
 int
-OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -973,7 +973,7 @@
 /*** <<< CODE [OK-IntegerInRange4] >>> ***/
 
 int
-OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1045,7 +1045,7 @@
 /*** <<< CODE [OK-IntegerInRange5] >>> ***/
 
 int
-OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -1123,7 +1123,7 @@
 /*** <<< CODE [NO-IntegerInRange6] >>> ***/
 
 int
-NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerInRange6_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
diff --git a/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pgen-PER
index 3b354b4..ee2e421 100644
--- a/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-Pgen-PER
@@ -72,7 +72,7 @@
 /*** <<< CODE [CN-IntegerMinMax] >>> ***/
 
 int
-CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerMinMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -148,7 +148,7 @@
 /*** <<< CODE [CN-IntegerMinLow] >>> ***/
 
 int
-CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerMinLow_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -230,7 +230,7 @@
 /*** <<< CODE [NO-IntegerMinHigh] >>> ***/
 
 int
-NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerMinHigh_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -318,7 +318,7 @@
 /*** <<< CODE [NO-IntegerLowHigh] >>> ***/
 
 int
-NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerLowHigh_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -405,7 +405,7 @@
 /*** <<< CODE [CN-IntegerLowMax] >>> ***/
 
 int
-CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+CN_IntegerLowMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -492,7 +492,7 @@
 /*** <<< CODE [NO-IntegerHighMax] >>> ***/
 
 int
-NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerHighMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -580,7 +580,7 @@
 /*** <<< CODE [NO-IntegerLowestMax] >>> ***/
 
 int
-NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerLowestMax_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	const INTEGER_t *st = (const INTEGER_t *)sptr;
 	long value;
@@ -668,7 +668,7 @@
 /*** <<< CODE [NO-IntegerOutRange] >>> ***/
 
 int
-NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerOutRange_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -755,7 +755,7 @@
 /*** <<< CODE [NO-IntegerOutValue] >>> ***/
 
 int
-NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerOutValue_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	unsigned long value;
 	
@@ -842,7 +842,7 @@
 /*** <<< CODE [OK-IntegerInRange1] >>> ***/
 
 int
-OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -924,7 +924,7 @@
 /*** <<< CODE [OK-IntegerInRange2] >>> ***/
 
 int
-OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1006,7 +1006,7 @@
 /*** <<< CODE [OK-IntegerInRange3] >>> ***/
 
 int
-OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1088,7 +1088,7 @@
 /*** <<< CODE [OK-IntegerInRange4] >>> ***/
 
 int
-OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1170,7 +1170,7 @@
 /*** <<< CODE [OK-IntegerInRange5] >>> ***/
 
 int
-OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_IntegerInRange5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	long value;
 	
@@ -1252,7 +1252,7 @@
 /*** <<< CODE [NO-IntegerInRange6] >>> ***/
 
 int
-NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_IntegerInRange6_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
diff --git a/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE b/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE
index 76146d7..8205746 100644
--- a/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE
+++ b/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE
@@ -21,7 +21,7 @@
 /*** <<< CODE [OK-Integer1] >>> ***/
 
 int
-OK_Integer1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_Integer1_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -87,7 +87,7 @@
 /*** <<< CODE [OK-Integer2] >>> ***/
 
 int
-OK_Integer2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_Integer2_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -153,7 +153,7 @@
 /*** <<< CODE [OK-Integer3] >>> ***/
 
 int
-OK_Integer3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_Integer3_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -219,7 +219,7 @@
 /*** <<< CODE [OK-Integer4] >>> ***/
 
 int
-OK_Integer4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+OK_Integer4_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -285,7 +285,7 @@
 /*** <<< CODE [NO-Integer5] >>> ***/
 
 int
-NO_Integer5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+NO_Integer5_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
diff --git a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfindirect-choice b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfindirect-choice
index 51f08c4..4ab6ef1 100644
--- a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfindirect-choice
+++ b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfindirect-choice
@@ -55,7 +55,7 @@
 		.type = &asn_DEF_Choice1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch1"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Everything, ch2),
@@ -64,7 +64,7 @@
 		.type = &asn_DEF_Choice2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch2"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Everything, ch3),
@@ -73,7 +73,7 @@
 		.type = &asn_DEF_Choice3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch3"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, set),
@@ -82,7 +82,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, a),
@@ -91,7 +91,7 @@
 		.type = &asn_DEF_Alpha,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, b),
@@ -100,7 +100,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, g),
@@ -109,7 +109,7 @@
 		.type = &asn_DEF_Gamma,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "g"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, ot),
@@ -118,7 +118,7 @@
 		.type = &asn_DEF_OneTwo,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ot"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, tt),
@@ -127,7 +127,7 @@
 		.type = &asn_DEF_TwoThree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "tt"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, to),
@@ -136,7 +136,7 @@
 		.type = &asn_DEF_ThreeOne,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "to"
 		},
 };
@@ -234,7 +234,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "something"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice1, choice.some2),
@@ -243,7 +243,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "some2"
 		},
 };
@@ -258,7 +258,7 @@
 	sizeof(((struct Choice1 *)0)->present),
 	.tag2el = asn_MAP_Choice1_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice1 = {
@@ -331,7 +331,7 @@
 		.type = &asn_DEF_TypeRef,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "typeref"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice2, choice.some3),
@@ -340,7 +340,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "some3"
 		},
 };
@@ -355,7 +355,7 @@
 	sizeof(((struct Choice2 *)0)->present),
 	.tag2el = asn_MAP_Choice2_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice2 = {
@@ -438,7 +438,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "aa"
 		},
 };
@@ -482,7 +482,7 @@
 		.type = &asn_DEF_Choice3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -519,7 +519,7 @@
 		.type = &asn_DEF_a_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice3, choice.b),
@@ -528,7 +528,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice3, choice.c),
@@ -537,7 +537,7 @@
 		.type = &asn_DEF_c_5,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c"
 		},
 };
@@ -553,7 +553,7 @@
 	sizeof(((struct Choice3 *)0)->present),
 	.tag2el = asn_MAP_Choice3_tag2el_1,
 	.tag2el_count = 3,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice3 = {
@@ -629,7 +629,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Member, set),
@@ -638,7 +638,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Member, seq),
@@ -647,7 +647,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "seq"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Member, set2),
@@ -656,7 +656,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set2"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Member, set3),
@@ -665,7 +665,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set3"
 		},
 };
@@ -712,7 +712,7 @@
 		.type = &asn_DEF_Member_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -787,7 +787,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_POINTER, 3, offsetof(struct Sequence, seq),
@@ -796,7 +796,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "seq"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Sequence, b),
@@ -805,7 +805,7 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Sequence, set),
@@ -814,7 +814,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set"
 		},
 };
@@ -943,7 +943,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -987,7 +987,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Alpha, b),
@@ -996,7 +996,7 @@
 		.type = &asn_DEF_b_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -1072,7 +1072,7 @@
 		.type = &asn_DEF_Alpha,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Beta, g),
@@ -1081,7 +1081,7 @@
 		.type = &asn_DEF_Gamma,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "g"
 		},
 };
@@ -1160,7 +1160,7 @@
 		.type = &asn_DEF_TwoThree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "o"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Gamma, a),
@@ -1169,7 +1169,7 @@
 		.type = &asn_DEF_Alpha,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Gamma, b),
@@ -1178,7 +1178,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -1266,7 +1266,7 @@
 		.type = &asn_DEF_TwoThree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m12"
 		},
 };
@@ -1357,7 +1357,7 @@
 		.type = &asn_DEF_ThreeOne,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m23"
 		},
 };
@@ -1452,7 +1452,7 @@
 		.type = &asn_DEF_OneTwo,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m31"
 		},
 	{ ATF_POINTER, 0, offsetof(struct ThreeOne, g),
@@ -1461,7 +1461,7 @@
 		.type = &asn_DEF_Gamma,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "g"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfwide-types
index bd9f57d..85e4e63 100644
--- a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.-Pfwide-types
@@ -55,7 +55,7 @@
 		.type = &asn_DEF_Choice1,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch1"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Everything, ch2),
@@ -64,7 +64,7 @@
 		.type = &asn_DEF_Choice2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch2"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Everything, ch3),
@@ -73,7 +73,7 @@
 		.type = &asn_DEF_Choice3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch3"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, set),
@@ -82,7 +82,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, a),
@@ -91,7 +91,7 @@
 		.type = &asn_DEF_Alpha,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, b),
@@ -100,7 +100,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, g),
@@ -109,7 +109,7 @@
 		.type = &asn_DEF_Gamma,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "g"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, ot),
@@ -118,7 +118,7 @@
 		.type = &asn_DEF_OneTwo,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ot"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, tt),
@@ -127,7 +127,7 @@
 		.type = &asn_DEF_TwoThree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "tt"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Everything, to),
@@ -136,7 +136,7 @@
 		.type = &asn_DEF_ThreeOne,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "to"
 		},
 };
@@ -234,7 +234,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "something"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice1, choice.some2),
@@ -243,7 +243,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "some2"
 		},
 };
@@ -258,7 +258,7 @@
 	sizeof(((struct Choice1 *)0)->present),
 	.tag2el = asn_MAP_Choice1_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice1 = {
@@ -330,7 +330,7 @@
 		.type = &asn_DEF_TypeRef,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "typeref"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice2, choice.some3),
@@ -339,7 +339,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "some3"
 		},
 };
@@ -354,7 +354,7 @@
 	sizeof(((struct Choice2 *)0)->present),
 	.tag2el = asn_MAP_Choice2_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice2 = {
@@ -437,7 +437,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "aa"
 		},
 };
@@ -481,7 +481,7 @@
 		.type = &asn_DEF_Choice3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -518,7 +518,7 @@
 		.type = &asn_DEF_a_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice3, choice.b),
@@ -527,7 +527,7 @@
 		.type = &asn_DEF_Everything,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice3, choice.c),
@@ -536,7 +536,7 @@
 		.type = &asn_DEF_c_5,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "c"
 		},
 };
@@ -552,7 +552,7 @@
 	sizeof(((struct Choice3 *)0)->present),
 	.tag2el = asn_MAP_Choice3_tag2el_1,
 	.tag2el_count = 3,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice3 = {
@@ -628,7 +628,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Member, set),
@@ -637,7 +637,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Member, seq),
@@ -646,7 +646,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "seq"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Member, set2),
@@ -655,7 +655,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set2"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Member, set3),
@@ -664,7 +664,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set3"
 		},
 };
@@ -711,7 +711,7 @@
 		.type = &asn_DEF_Member_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -786,7 +786,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_POINTER, 3, offsetof(struct Sequence, seq),
@@ -795,7 +795,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "seq"
 		},
 	{ ATF_POINTER, 2, offsetof(struct Sequence, b),
@@ -804,7 +804,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Sequence, set),
@@ -813,7 +813,7 @@
 		.type = &asn_DEF_Set,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "set"
 		},
 };
@@ -942,7 +942,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -986,7 +986,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Alpha, b),
@@ -995,7 +995,7 @@
 		.type = &asn_DEF_b_3,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -1071,7 +1071,7 @@
 		.type = &asn_DEF_Alpha,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 	{ ATF_POINTER, 1, offsetof(struct Beta, g),
@@ -1080,7 +1080,7 @@
 		.type = &asn_DEF_Gamma,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "g"
 		},
 };
@@ -1159,7 +1159,7 @@
 		.type = &asn_DEF_TwoThree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "o"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Gamma, a),
@@ -1168,7 +1168,7 @@
 		.type = &asn_DEF_Alpha,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "a"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Gamma, b),
@@ -1177,7 +1177,7 @@
 		.type = &asn_DEF_Beta,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "b"
 		},
 };
@@ -1265,7 +1265,7 @@
 		.type = &asn_DEF_TwoThree,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m12"
 		},
 };
@@ -1356,7 +1356,7 @@
 		.type = &asn_DEF_ThreeOne,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m23"
 		},
 };
@@ -1451,7 +1451,7 @@
 		.type = &asn_DEF_OneTwo,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m31"
 		},
 	{ ATF_POINTER, 0, offsetof(struct ThreeOne, g),
@@ -1460,7 +1460,7 @@
 		.type = &asn_DEF_Gamma,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "g"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/93-asn1c-controls-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/93-asn1c-controls-OK.asn1.-Pfwide-types
index 7c005de..25b381d 100644
--- a/tests/tests-asn1c-compiler/93-asn1c-controls-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/93-asn1c-controls-OK.asn1.-Pfwide-types
@@ -29,7 +29,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ainl"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Sequence, aptr),
@@ -38,7 +38,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "aptr"
 		},
 };
@@ -126,7 +126,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ainl"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Set, aptr),
@@ -135,7 +135,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "aptr"
 		},
 };
@@ -235,7 +235,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = ""
 		},
 };
@@ -272,7 +272,7 @@
 		.type = &asn_DEF_setof_2,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "setof"
 		},
 	{ ATF_POINTER, 0, offsetof(struct Choice, choice.aptr),
@@ -281,7 +281,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "aptr"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ainl),
@@ -290,7 +290,7 @@
 		.type = &asn_DEF_Sequence,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ainl"
 		},
 };
@@ -306,7 +306,7 @@
 	sizeof(((struct Choice *)0)->present),
 	.tag2el = asn_MAP_Choice_tag2el_1,
 	.tag2el_count = 3,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice = {
diff --git a/tests/tests-asn1c-compiler/94-set-optionals-OK.asn1.-P b/tests/tests-asn1c-compiler/94-set-optionals-OK.asn1.-P
index c6e5a09..adec1e2 100644
--- a/tests/tests-asn1c-compiler/94-set-optionals-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/94-set-optionals-OK.asn1.-P
@@ -62,7 +62,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m0"
 		},
 	{ ATF_POINTER, 1, offsetof(struct TestSet, m1),
@@ -71,7 +71,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m1"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m2),
@@ -80,7 +80,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m2"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m3),
@@ -89,7 +89,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m3"
 		},
 	{ ATF_POINTER, 1, offsetof(struct TestSet, m4),
@@ -98,7 +98,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m4"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m5),
@@ -107,7 +107,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m5"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m6),
@@ -116,7 +116,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m6"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m7),
@@ -125,7 +125,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m7"
 		},
 	{ ATF_POINTER, 1, offsetof(struct TestSet, m8),
@@ -134,7 +134,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m8"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m9),
@@ -143,7 +143,7 @@
 		.type = &asn_DEF_VisibleString,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "m9"
 		},
 };
diff --git a/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pfwide-types
index beb669f..5cdf71e 100644
--- a/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pfwide-types
@@ -65,7 +65,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "null"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct ch, choice.Int),
@@ -74,7 +74,7 @@
 		.type = &asn_DEF_INTEGER,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int"
 		},
 };
@@ -89,7 +89,7 @@
 	sizeof(((struct ch *)0)->present),
 	.tag2el = asn_MAP_ch_tag2el_4,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -114,7 +114,7 @@
 		.type = &asn_DEF_RELATIVE_OID,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "roid"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.bitstr),
@@ -123,7 +123,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bitstr"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ch),
@@ -132,7 +132,7 @@
 		.type = &asn_DEF_ch_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.Bool),
@@ -141,7 +141,7 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bool"
 		},
 };
@@ -159,7 +159,7 @@
 	sizeof(((struct Choice *)0)->present),
 	.tag2el = asn_MAP_Choice_tag2el_1,
 	.tag2el_count = 5,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = 3	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice = {
@@ -217,7 +217,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bitstr"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.roid),
@@ -226,7 +226,7 @@
 		.type = &asn_DEF_RELATIVE_OID,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "roid"
 		},
 };
@@ -241,7 +241,7 @@
 	sizeof(((struct Choice2 *)0)->present),
 	.tag2el = asn_MAP_Choice2_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice2 = {
diff --git a/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pgen-PER
index d22436e..8c759dc 100644
--- a/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/95-choice-per-order-OK.asn1.-Pgen-PER
@@ -78,7 +78,7 @@
 		.type = &asn_DEF_NULL,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "null"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct ch, choice.Int),
@@ -87,11 +87,12 @@
 		.type = &asn_DEF_NativeInteger,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "int"
 		},
 };
-static const unsigned asn_MAP_ch_cmap_4[] = { 1, 0 };
+static const unsigned asn_MAP_ch_to_canonical_4[] = { 1, 0 };
+static const unsigned asn_MAP_ch_from_canonical_4[] = { 1, 0 };
 static const asn_TYPE_tag2member_t asn_MAP_ch_tag2el_4[] = {
     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* int */
     { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 0, 0, 0 } /* null */
@@ -103,7 +104,8 @@
 	sizeof(((struct ch *)0)->present),
 	.tag2el = asn_MAP_ch_tag2el_4,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = asn_MAP_ch_cmap_4,	/* Canonically sorted */
+	.to_canonical_order = asn_MAP_ch_to_canonical_4,
+	.from_canonical_order = asn_MAP_ch_from_canonical_4,
 	.ext_start = -1	/* Extensions start */
 };
 static /* Use -fall-defs-global to expose */
@@ -128,7 +130,7 @@
 		.type = &asn_DEF_RELATIVE_OID,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "roid"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.bitstr),
@@ -137,7 +139,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bitstr"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ch),
@@ -146,7 +148,7 @@
 		.type = &asn_DEF_ch_4,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "ch"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.Bool),
@@ -155,11 +157,12 @@
 		.type = &asn_DEF_BOOLEAN,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bool"
 		},
 };
-static const unsigned asn_MAP_Choice_cmap_1[] = { 2, 1, 0, 3 };
+static const unsigned asn_MAP_Choice_to_canonical_1[] = { 2, 1, 0, 3 };
+static const unsigned asn_MAP_Choice_from_canonical_1[] = { 2, 1, 0, 3 };
 static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = {
     { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */
     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, 0, 0 }, /* int */
@@ -174,7 +177,8 @@
 	sizeof(((struct Choice *)0)->present),
 	.tag2el = asn_MAP_Choice_tag2el_1,
 	.tag2el_count = 5,	/* Count of tags in the map */
-	.canonical_order = asn_MAP_Choice_cmap_1,	/* Canonically sorted */
+	.to_canonical_order = asn_MAP_Choice_to_canonical_1,
+	.from_canonical_order = asn_MAP_Choice_from_canonical_1,
 	.ext_start = 3	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice = {
@@ -240,7 +244,7 @@
 		.type = &asn_DEF_BIT_STRING,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "bitstr"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.roid),
@@ -249,7 +253,7 @@
 		.type = &asn_DEF_RELATIVE_OID,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "roid"
 		},
 };
@@ -264,7 +268,7 @@
 	sizeof(((struct Choice2 *)0)->present),
 	.tag2el = asn_MAP_Choice2_tag2el_1,
 	.tag2el_count = 2,	/* Count of tags in the map */
-	.canonical_order = 0,
+	0, 0,
 	.ext_start = -1	/* Extensions start */
 };
 asn_TYPE_descriptor_t asn_DEF_Choice2 = {
diff --git a/tests/tests-asn1c-compiler/98-attribute-class-OK.asn1.-P b/tests/tests-asn1c-compiler/98-attribute-class-OK.asn1.-P
index f64ce10..589b80e 100644
--- a/tests/tests-asn1c-compiler/98-attribute-class-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/98-attribute-class-OK.asn1.-P
@@ -35,7 +35,7 @@
 /*** <<< CODE [Attribute] >>> ***/
 
 static int
-memb_identifier_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
+memb_identifier_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
 	
 	if(!sptr) {
@@ -63,7 +63,7 @@
 		.type = &asn_DEF_RELATIVE_OID,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_identifier_constraint_1 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "identifier"
 		},
 	{ ATF_NOFLAGS, 0, offsetof(struct Attribute, siAttributeValue),
@@ -72,7 +72,7 @@
 		.type = &asn_DEF_IA5String,
 		.type_selector = 0,
 		{ .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
-		.default_value = 0,
+		0, 0, /* No default value */
 		.name = "siAttributeValue"
 		},
 };
diff --git a/tests/tests-randomized/Makefile.am b/tests/tests-randomized/Makefile.am
index 07bba5e..d28968a 100644
--- a/tests/tests-randomized/Makefile.am
+++ b/tests/tests-randomized/Makefile.am
@@ -24,6 +24,7 @@
     ${srcdir}/check-bundles.sh
 
 TESTS =
+TESTS += bundles/00-NULL-bundle.txt
 TESTS += bundles/01-BOOLEAN-bundle.txt
 TESTS += bundles/02-INTEGER-bundle.txt
 TESTS += bundles/03-ENUMERATED-bundle.txt
diff --git a/tests/tests-randomized/bundles/00-NULL-bundle.txt b/tests/tests-randomized/bundles/00-NULL-bundle.txt
new file mode 100644
index 0000000..7951def
--- /dev/null
+++ b/tests/tests-randomized/bundles/00-NULL-bundle.txt
@@ -0,0 +1 @@
+NULL
diff --git a/tests/tests-randomized/bundles/15-CHOICE-bundle.txt b/tests/tests-randomized/bundles/15-CHOICE-bundle.txt
index 55b8f45..f7d493a 100644
--- a/tests/tests-randomized/bundles/15-CHOICE-bundle.txt
+++ b/tests/tests-randomized/bundles/15-CHOICE-bundle.txt
@@ -1,11 +1,20 @@
 CHOICE { null NULL }
 CHOICE { null NULL, ... }
 CHOICE { one NULL, two [2] NULL }
+CHOICE { one [1] NULL, two [2] NULL }
+CHOICE { one [2] NULL, two [1] NULL }
+CHOICE { one [1] NULL, two [3] NULL }
+CHOICE { one [3] NULL, two [1] NULL }
+CHOICE { one [3] NULL, two [1] NULL, three [2] NULL }
+CHOICE { one [4] NULL, two [3] NULL, three [1] NULL, four [2] NULL }
+CHOICE { one [5] NULL, two [4] NULL, ..., three [3] NULL, four [2] NULL }
+CHOICE { null NULL, ..., one [5] NULL, two [4] NULL, three [3] NULL, four [2] NULL }
 CHOICE { one NULL, two [2] NULL, ... }
 CHOICE { one NULL, ..., two [2] NULL }
 CHOICE { one NULL, two [2] NULL, ..., three [3] NULL }
 CHOICE { one NULL, ..., two [2] NULL, three [3] NULL }
 CHOICE { one BOOLEAN, ..., two [2] BOOLEAN, three [3] BOOLEAN }
 CHOICE { one BOOLEAN, two BIT STRING (SIZE(1..3)) }
-CHOICE { ..., one BOOLEAN, two BIT STRING (SIZE(1..3)) }
+CHOICE { null NULL, ..., one BOOLEAN, two BIT STRING (SIZE(1..3)) }
 CHOICE { one NULL, two BOOLEAN, three BIT STRING (SIZE(1..3)) }
+CHOICE { null NULL, ..., one NULL, two BOOLEAN, three BIT STRING (SIZE(1..3)) }