Folks,
Johnny Tang from CEBAF has verified that the bug I reported in gcc compiling
on a Sun4 for a 68K also exists using an HP host.
Here is a cleaner program which demonstrates the problem:
**********************************************************************
test_float_rep()
{
struct{
union {
float f;
int i;
} u;
float f;
} s;
union {
float f;
int i;
} u;
u.f = 0.;
printf("u.f = %f, u.i = %x\n", u.f, u.i);
s.u.f = 0.;
printf("s.u.f = %f, s.u.i = %x\n", s.u.f, s.u.i);
}
**********************************************************************
This program creates two unions of a float and an int, one in a structure and
one not inside a structure. The value 0.0 is assigned to the float member of
each union, and the values of both the float and int members are printed out.
Here is the output on an MVME167 when compiling with gcc version 2.2.3.1.
**********************************************************************
13-lab> test_float_rep
u.f = 0.000000, u.i = 0
s.u.f = 0.000000, s.u.i = 80000000
**********************************************************************
Note that when the float is not contained in a structure that zero is
represented as 0x0, which is correct. However, when the float is contained in
a structure then zero is represented as 0x8000000, which is not correct.
The solution to the problem turns out to be simple: use a more recent version
of gcc.
Here is the output on an MVME167 when compiling with gcc version 2.5.8, which
is the version I built when building Hideos.
**********************************************************************
13-lab> test_float_rep
u.f = 0.000000, u.i = 0
s.u.f = 0.000000, s.u.i = 0
____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 [email protected] (e-mail)
or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
- Navigate by Date:
- Prev:
epics Philippe Marcel
- Next:
Re: epics Jeff Hill
- Index:
1994
1995
1996
<1997>
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: epics Jeff Hill
- Next:
Re: Bug in gcc Mark Rivers
- Index:
1994
1995
1996
<1997>
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|