Do not treat integer literals 0u, 0l as base-8

Only literals with a digit following the initial 0 should be understood as
base-8.
This commit is contained in:
Michael Tautschnig 2017-04-12 08:45:02 +01:00
parent ae0ab674ab
commit 591d8829e1
3 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,6 @@
int main()
{
unsigned x;
x=0u;
return 0;
}

View File

@ -0,0 +1,8 @@
CORE
main.c
--show-goto-functions
^EXIT=0$
^SIGNAL=0$
--
00u
^warning: ignoring

View File

@ -75,7 +75,7 @@ exprt convert_integer_literal(const std::string &src)
std::string without_prefix(src, 2, std::string::npos);
value=string2integer(without_prefix, 2);
}
else if(src.size()>=2 && src[0]=='0')
else if(src.size()>=2 && src[0]=='0' && isdigit(src[1]))
{
// octal
base=8;