non-negative value

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1146 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2006-08-28 02:30:41 +00:00
parent ade8b310cf
commit f04c795a04
2 changed files with 35 additions and 0 deletions

View File

@ -55,6 +55,25 @@ asn1f_fix_bit_string_type(arg_t *arg) {
"is not an identifier", v->_lineno);
return -1;
}
/* 21.1 */
if(v->value == NULL) {
FATAL("BIT STRING NamedBit value at line %d "
"must be explicitly specified in braces",
v->_lineno);
return -1;
} else if(v->value->type == ATV_REFERENCED) {
/* Resolve the value */
if(asn1f_value_resolve(arg, v, 0))
return -1;
}
if(v->value->type != ATV_INTEGER
|| v->value->value.v_integer < 0) {
FATAL("BIT STRING NamedBit value at line %d: "
"non-negative integer value expected",
v->_lineno);
return -1;
}
}
return r_value;

View File

@ -0,0 +1,16 @@
-- SE: Semantic error
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .114
ModuleBitStringNegativeInteger
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 114 }
DEFINITIONS ::=
BEGIN
T ::= BIT STRING { one(-2) }
END