* OSF/1 1.3 cc -O Bug!
@ 1994-02-21 22:02 Frederick (Rick) A Niles
1994-02-22 16:31 ` Wesp Gerhard
0 siblings, 1 reply; 5+ messages in thread
From: Frederick (Rick) A Niles @ 1994-02-21 22:02 UTC (permalink / raw)
How's this for a bug:
The following crashes for 'cc -O' and not for 'cc'
under OSF/1 1.3 and NOT under OSF/1 1.2:
int DATA_is_illegal(f)
float f;
{
unsigned int *num;
num = (unsigned int *) &f;
if (*num == 0x7FFFFFFF) {
return(1);
}
return(0);
}
Just a wondering what ya think.....
Give it a try....
Rick Niles
niles@axp745.gsfc.nasa.gov
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: OSF/1 1.3 cc -O Bug! 1994-02-21 22:02 OSF/1 1.3 cc -O Bug! Frederick (Rick) A Niles @ 1994-02-22 16:31 ` Wesp Gerhard 1994-02-22 19:19 ` Rick Murphy 0 siblings, 1 reply; 5+ messages in thread From: Wesp Gerhard @ 1994-02-22 16:31 UTC (permalink / raw) In <2kbb1p$630@paperboy.gsfc.nasa.gov>, Frederick (Rick) A Niles (niles@axp745.gsfc.nasa.gov) wrote: > How's this for a bug: > The following crashes for 'cc -O' and not for 'cc' > under OSF/1 1.3 and NOT under OSF/1 1.2: > int DATA_is_illegal(f) > float f; > { > unsigned int *num; > num = (unsigned int *) &f; > if (*num == 0x7FFFFFFF) { > return(1); > } > return(0); > } > Just a wondering what ya think..... > Give it a try.... > Rick Niles > niles@axp745.gsfc.nasa.gov The quality of DEC's software products is really amazing... I simplified the example a little bit: ------ crash.c: -------- int i(double x) { int *p; p= &x; return *p; } ------- EOF ------------ First of all, please note that that piece of code may even have an application: If int and double have the same storage size, this should just 'typecast' the argument x to an int, yielding the internal representation of the double. You could then use the int to extract the fields of the double (sign, mantissa, exponent). However, a compilation attempt had the following result: % cc -O crash.c /usr/lib/cmplrs/cc/cfe: Warning: crash.c, line 4: Incompatible pointer type assignment p= &x; ---^ Fatal error in: /usr/lib/cmplrs/cc/ugen Segmentation fault - core dumped Our OS and compiler version: % uname -a OSF1 picard V1.3 112 alpha % cc -V cc (cc) The DEC OSF/1 AXP Compiler Driver 3.11 [many $RCSfile: lines deleted] cc without "-O" also worked for me. I can't verify if it works on OSF1 1.2, because I don't have it. "c89 -O" also core dumps (you must explicitly type- cast &x to (int *) in order to make c89 compile the code), because it invokes the same "ugen". I don't know if the bug (YES, this is a *BUG*) resides in the OS or the compiler, but I hope the people at DEC (who are reading this, right?) will *IMMEDIATELY* find that out and fix it. Greetings, -Gerhard ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OSF/1 1.3 cc -O Bug! 1994-02-22 16:31 ` Wesp Gerhard @ 1994-02-22 19:19 ` Rick Murphy 1994-02-23 11:47 ` Wesp Gerhard 0 siblings, 1 reply; 5+ messages in thread From: Rick Murphy @ 1994-02-22 19:19 UTC (permalink / raw) In article <CLMwL8.9uw@wst.edvz.sbg.ac.at>, gwesp@wst.edvz.sbg.ac.at (Wesp Gerhard) writes: >First of all, please note that that piece of code may even have >an application: If int and double have the same storage size, >this should just 'typecast' the argument x to an int, yielding the internal >representation of the double. You could then use the int to extract >the fields of the double (sign, mantissa, exponent). It's not that easy (but that's the compiler's problem..) the floating argument is passed in a floating point register and needs to be stored/loaded in order to be converted to integer. > I don't know if the bug (YES, this is a *BUG*) resides in the OS or the >compiler, but I hope the people at DEC (who are reading this, right?) will >*IMMEDIATELY* find that out and fix it. Anytime the compiler crashes it's a bug. Fortunately, this is fixed in 2.0: % uname -a OSF1 rhmosf.dco.dec.com X2.0 201.1 alpha % cat crash.c int i(double x) { int *p; p= &x; return *p; } % cc -O crash.c /usr/lib/cmplrs/cc/cfe: Warning: crash.c, line 4: Incompatible pointer type assi gnment p= &x; ---^ ld: Unresolved: main -- Rick Murphy, WA1SPT/4 Washington Federal Programs Office Domain: murphy@dco.dec.com Technical Support Group Bang: decwrl!burfle.enet!murphy This posting expresses MY opinions only; Ding: 301-306-2040. I do not speak for Digital. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OSF/1 1.3 cc -O Bug! 1994-02-22 19:19 ` Rick Murphy @ 1994-02-23 11:47 ` Wesp Gerhard 1994-02-25 20:55 ` Rick Murphy 0 siblings, 1 reply; 5+ messages in thread From: Wesp Gerhard @ 1994-02-23 11:47 UTC (permalink / raw) In <2kdls5$ief@decuac.dec.com>, Rick Murphy (murphy@dco.dec.com) wrote: [...] > Anytime the compiler crashes it's a bug. Fortunately, this is fixed in 2.0: > % uname -a > OSF1 rhmosf.dco.dec.com X2.0 201.1 alpha [...crash.c gets compiled without core dump...] So it was an OS bug? Can this bug affect other programs too, causing them to dump core without reason? Do we have to upgrade to osf1 2.0 or is there a fix for 1.3 available? Greetings, -Gerhard ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OSF/1 1.3 cc -O Bug! 1994-02-23 11:47 ` Wesp Gerhard @ 1994-02-25 20:55 ` Rick Murphy 0 siblings, 0 replies; 5+ messages in thread From: Rick Murphy @ 1994-02-25 20:55 UTC (permalink / raw) In article <CLoE38.E0E@wst.edvz.sbg.ac.at>, gwesp@wst.edvz.sbg.ac.at (Wesp Gerhard) writes: >In <2kdls5$ief@decuac.dec.com>, Rick Murphy (murphy@dco.dec.com) wrote: >> Anytime the compiler crashes it's a bug. Fortunately, this is fixed in 2.0: > So it was an OS bug? Can this bug affect other programs too, causing them >to dump core without reason? Do we have to upgrade to osf1 2.0 or is there >a fix for 1.3 available? No - you misunderstood. If the compiler dumps core, that is an indication of a bug in the *compiler*. I did not intend to imply that there was a problem that would cause other programs to "dump core without reason". As to a fix - contact your Customer Support Center. They're the only ones who can distribute patches. -Rick -- Rick Murphy, WA1SPT/4 Washington Federal Programs Office Domain: murphy@dco.dec.com Technical Support Group Bang: decwrl!burfle.enet!murphy This posting expresses MY opinions only; Ding: 301-306-2040. I do not speak for Digital. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1994-02-25 20:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1994-02-21 22:02 OSF/1 1.3 cc -O Bug! Frederick (Rick) A Niles 1994-02-22 16:31 ` Wesp Gerhard 1994-02-22 19:19 ` Rick Murphy 1994-02-23 11:47 ` Wesp Gerhard 1994-02-25 20:55 ` Rick Murphy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox