Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Optimization bug on fork()?
@ 1994-10-20 21:30 Yansong Chen 
  0 siblings, 0 replies; only message in thread
From: Yansong Chen  @ 1994-10-20 21:30 UTC (permalink / 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1994-10-20 21:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-10-20 21:30 Optimization bug on fork()? Yansong Chen 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox