[comp.unix.xenix] cc really dumps core on this program. why?

klarich@d.cs.okstate.edu (KLARICH TERRY JAME) (08/28/90)

Earlier this month, I posted an article asking why my c compiler dumps core
on a certain program.  At the time I typed in the program, I didn't get it
right.  I got some messages saying that the program ran fine.  Here is the
original program.
--------------------------------------------------------------------------------
#include <stdio.h>
#include <values.h>

main()
{
double d;
 d = MAXDOUBLE;
 printf("%E\n",d);

--------------------------------------------------------------------------------
This program does work as expected.  However, the next one doesn't.
--------------------------------------------------------------------------------
#include <stdio.h>
#include <values.h>

struct {
 double min,max;
} range = {MINDOUBLE,MAXDOUBLE};

main()
{
printf("range.min = %E, range.max = %E\n",range.min,range.max);
}
--------------------------------------------------------------------------------
This program causes the cc compiler to dump core.  I am using Xenix 2.3.2
with the lng085 update.

If anyone can tell me how to fix this problem, I would sure appreciate the
help.

Terry Klarich <klarich@d.cs.okstate.edu> or <terry@unx.ucc.okstate.edu>

gt0178a@prism.gatech.EDU (BURNS,JIM) (08/29/90)

in article <1990Aug28.041601.5515@d.cs.okstate.edu>, klarich@d.cs.okstate.edu (KLARICH TERRY JAME) says:
< #include <stdio.h>
< #include <values.h>
< 
< struct {
<  double min,max;
< } range = {MINDOUBLE,MAXDOUBLE};
< 
< main()
< {
< printf("range.min = %E, range.max = %E\n",range.min,range.max);
< }
< --------------------------------------------------------------------------------
< This program causes the cc compiler to dump core.  I am using Xenix 2.3.2
< with the lng085 update.

Just as a point of interest, this compiles and executes fine on HP-UX 7.0,
SunOS 4.0.3, and Ultrix 2.2. However, it gets the compile error 'illegal
initialization' under A/UX 1.1, or the ATT universe on Dynix 2.0v2.

-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a@prism.gatech.edu

tony@jassys.UUCP (Tony Holden) (08/31/90)

I'm running 2.2.3 on a 286 and it works here

% a.out
range.min = 0.000000E+00, range.max = 1.797693E+308
-- 
Tony Holden
tony@jassys

chucka@cup.portal.com (Charles - Anderson) (09/01/90)

Running 286 Xenix and mine is ok too.

chucka

I'm running 2.2.3 on a 286 and it works here

% a.out
range.min = 0.000000E+00, range.max = 1.797693E+308
-- 
Tony Holden
tony@jassys