summaryrefslogtreecommitdiff
path: root/gcc/java/jcf-dump.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-01 19:13:12 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-01 19:13:12 +0000
commitf777f44e36399c3734420141b4c812c2480dfec1 (patch)
tree304e594d569cf875f5c6f04bf21588735a992445 /gcc/java/jcf-dump.c
parentd8de93cb7c4d337b2b28eb0ccc02d8b28e9f74df (diff)
downloadgcc-f777f44e36399c3734420141b4c812c2480dfec1.tar.gz
* jcf-dump.c (print_constant, case CONSTANT_float): Don't fall
foul of type-based aliasing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57699 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/jcf-dump.c')
-rw-r--r--gcc/java/jcf-dump.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c
index 13a177df066..2824a6b3cc9 100644
--- a/gcc/java/jcf-dump.c
+++ b/gcc/java/jcf-dump.c
@@ -504,10 +504,18 @@ DEFUN(print_constant, (out, jcf, index, verbosity),
break;
case CONSTANT_Float:
{
- jfloat fnum = JPOOL_FLOAT (jcf, index);
- fprintf (out, "%s%.10g", verbosity > 0 ? "Float " : "", (double) fnum);
+ union
+ {
+ jfloat f;
+ int32 i;
+ } pun;
+
+ pun.f = JPOOL_FLOAT (jcf, index);
+ fprintf (out, "%s%.10g",
+ verbosity > 0 ? "Float " : "", (double) pun.f);
if (verbosity > 1)
- fprintf (out, ", bits = 0x%08lx", (long) (* (int32 *) &fnum));
+ fprintf (out, ", bits = 0x%08lx", (long) pun.i);
+
break;
}
case CONSTANT_Double: