Skip to content

Commit 15a67e4

Browse files
author
Daniel Kroening
authored
Merge pull request #1320 from tautschnig/double-output
Do not add an "l" prefix to double constants when double==long double
2 parents 5fb4cbf + 4be7685 commit 15a67e4

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

regression/cbmc/Float24/main.c

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
int main()
2+
{
3+
double d=5.1;
4+
__CPROVER_assert(0, "");
5+
return 0;
6+
}

regression/cbmc/Float24/test.desc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--win32 --xml-ui
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
VERIFICATION FAILED
7+
<full_lhs_value>5\.1</full_lhs_value>
8+
--
9+
^warning: ignoring
10+
<full_lhs_value>5\.1l</full_lhs_value>

src/ansi-c/expr2c.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,8 @@ std::string expr2ct::convert_constant(
18591859
// ANSI-C: double is default; float/long-double require annotation
18601860
if(src.type()==float_type())
18611861
dest+='f';
1862-
else if(src.type()==long_double_type())
1862+
else if(src.type()==long_double_type() &&
1863+
double_type()!=long_double_type())
18631864
dest+='l';
18641865
}
18651866
else if(dest.size()==4 &&

0 commit comments

Comments
 (0)