From: phys6k@menudo.uh.edu (Yansong Chen )
Subject: Optimization bug on fork()?
Date: 20 Oct 1994 21:30:09 GMT [thread overview]
Message-ID: <386nh1$231@masala.cc.uh.edu> (raw)
I have run the following program in AXP/OSF (axposf.stanford.edu),
-------------------cut from here--------------------
#include <sys/types.h>
#include <unistd.h>
main()
{
float x;
int i;
x = 1e3;
for (i=0;i<1;i++) {
fork();
printf("%f\n",x);
}
}
---------------end here------------------------------
The parent and child processes return same value of x if I do not turn on
the optimization option when I compile it. But If I do optimization during
compile, ( cc -O2 or -O3, gcc -O1 or -O2 ), the parent and child processes
return different values. In my case, the parent return 1000, the child return
0. I run this program on axposf.stanford.edu.
I don't know if this is the right newsgroup to post this question, but this
case only happens in OSF/1. I have tried this program in many other different
system, include Ultrix, Sun/OS, Solaris, Linux. It gives correct result in
all of those systems, just gives wired result in OSF/1.
So is that a bug in OSF/1?
I do not subscribe this newsgroup, please send me e-mail if possible.
Thank you for read this post.:_)
--
yansong chen
--
YChen@uh.edu
reply other threads:[~1994-10-20 21:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox