Skip to content

Commit 38ffa4c

Browse files
authored
Merge pull request #809 from tautschnig/base-8
Do not treat integer literals 0u, 0l as base-8
2 parents 8341c84 + 591d882 commit 38ffa4c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

regression/cbmc/unsigned1/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
int main()
2+
{
3+
unsigned x;
4+
x=0u;
5+
return 0;
6+
}

regression/cbmc/unsigned1/test.desc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
00u
8+
^warning: ignoring

src/ansi-c/literals/convert_integer_literal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ exprt convert_integer_literal(const std::string &src)
7575
std::string without_prefix(src, 2, std::string::npos);
7676
value=string2integer(without_prefix, 2);
7777
}
78-
else if(src.size()>=2 && src[0]=='0')
78+
else if(src.size()>=2 && src[0]=='0' && isdigit(src[1]))
7979
{
8080
// octal
8181
base=8;

0 commit comments

Comments
 (0)