schema compile CHANGE support list compilation
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 64cb330..9c79d00 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -3638,7 +3638,7 @@
     INSERT_WORD(ctx, buf, list->name, word, word_len);
 
     /* parse substatements */
-    YANG_READ_SUBSTMT_FOR(ctx, data, kw, word, word_len, ret,) {
+    YANG_READ_SUBSTMT_FOR(ctx, data, kw, word, word_len, ret, goto checks) {
         switch (kw) {
         case YANG_CONFIG:
             LY_CHECK_RET(parse_config(ctx, data, &list->flags, &list->exts));
@@ -3724,6 +3724,14 @@
             return LY_EVALID;
         }
     }
+    LY_CHECK_RET(ret);
+checks:
+    if (list->max && list->min > list->max) {
+        LOGVAL_YANG(ctx, LYVE_SEMANTICS,
+                    "Invalid combination of min-elements and max-elements: min value %u is bigger than the max value %u.",
+                    list->min, list->max);
+        return LY_EVALID;
+    }
 
     return ret;
 }