Commit eb55ce4b by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/7804 (bad printing of fp constant in warning message)

	PR c++/7804
	* error.c (dump_expr) [REAL_CST]: Output in decimal format.

	* g++.dg/other/warning1.C: New test.

From-SVN: r57843
parent f5b63cb6
2002-10-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/7804
* error.c (dump_expr) [REAL_CST]: Output in decimal format.
2002-10-03 Mark Mitchell <mark@codesourcery.com> 2002-10-03 Mark Mitchell <mark@codesourcery.com>
PR c++/7931 PR c++/7931
......
...@@ -1508,13 +1508,7 @@ dump_expr (t, flags) ...@@ -1508,13 +1508,7 @@ dump_expr (t, flags)
break; break;
case REAL_CST: case REAL_CST:
{ REAL_VALUE_TO_DECIMAL (TREE_REAL_CST (t), digit_buffer, -1);
const unsigned char *p = (const unsigned char *) &TREE_REAL_CST (t);
size_t i;
strcpy (digit_buffer, "0x");
for (i = 0; i < sizeof TREE_REAL_CST (t); i++)
sprintf (digit_buffer + 2 + 2*i, "%02x", *p++);
}
output_add_string (scratch_buffer, digit_buffer); output_add_string (scratch_buffer, digit_buffer);
break; break;
......
2002-10-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/7804
* g++.dg/other/warning1.C: New test.
2002-10-04 Roger Sayle <roger@eyesopen.com> 2002-10-04 Roger Sayle <roger@eyesopen.com>
* gcc.c-torture/execute/20020720-1.x: XFAIL instead of skipping * gcc.c-torture/execute/20020720-1.x: XFAIL instead of skipping
......
// { dg-do compile }
// PR c++/7804
// Floating point formatting in error and warning messages
extern "C" int printf(const char *, ...);
struct S
{
static const float inf = 1.0f / 0.0f; // { dg-warning "1.0|initialization" }
static const float nan = 0.0f / 0.0f; // { dg-warning "0.0|initialization" }
};
int main()
{
printf("%f\n%f\n", S::inf, S::nan);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment