* cc -O3 problem on osf v3.2
@ 1995-06-28 4:00 Bill Wang
1995-06-28 4:00 ` Dan Pop
1995-07-03 4:00 ` f77 and cc optimization " Christos Siopis
0 siblings, 2 replies; 5+ messages in thread
From: Bill Wang @ 1995-06-28 4:00 UTC (permalink / raw)
The following short c program produces two different result by
using -O3 and -O (or no optimization at all):
#include <stdio.h>
#include <math.h>
main() {
double sig( double x, double gain, double thresh);
double x;
for (x=(-4.0); x<4.1; x+=1.0) {
printf("%f %f\n", x, sig(x,1.0,0.0) );
}
}
double sig( double x, double gain, double thresh) {
return( 1.0 / ( 1.0 + exp( - (gain) * ( x - thresh ) ) ) );
}
Using -O or no opti: (correct result, same result on SUN, HP, Ultrix, etc)
-4.000000 0.017986
-3.000000 0.047426
-2.000000 0.119203
-1.000000 0.268941
0.000000 0.500000
1.000000 0.731059
2.000000 0.880797
3.000000 0.952574
4.000000 0.982014
Using -O3: (WRONG!)
-4.000000 0.982014
-3.000000 0.952574
-2.000000 0.880797
-1.000000 0.731059
0.000000 0.500000
1.000000 0.268941
2.000000 0.119203
3.000000 0.047426
4.000000 0.017986
Any hints or help would be appreciated!
--
Bill Wang
US Mail = Psychology Department, Indiana University, Bloomington, IN 47405
Internet = wcwang@cs.indiana.edu
HTTP = http://www.psych.indiana.edu/hyplan/wcwang.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc -O3 problem on osf v3.2
1995-06-28 4:00 cc -O3 problem on osf v3.2 Bill Wang
@ 1995-06-28 4:00 ` Dan Pop
1995-06-29 4:00 ` Mike Iglesias
1995-07-03 4:00 ` f77 and cc optimization " Christos Siopis
1 sibling, 1 reply; 5+ messages in thread
From: Dan Pop @ 1995-06-28 4:00 UTC (permalink / raw)
In <3srrb4$qhe@usenet.ucs.indiana.edu> wcwang@hagen.psych.indiana.edu (Bill Wang) writes:
>The following short c program produces two different result by
>using -O3 and -O (or no optimization at all):
>
...
>
>Using -O or no opti: (correct result, same result on SUN, HP, Ultrix, etc)
>
...
>Using -O3: (WRONG!)
...
>
>Any hints or help would be appreciated!
1. Don't use -O3.
or
2. Use cc -migrate -O3 which produces the correct results.
Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@mail.cern.ch
Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cc -O3 problem on osf v3.2
1995-06-28 4:00 ` Dan Pop
@ 1995-06-29 4:00 ` Mike Iglesias
0 siblings, 0 replies; 5+ messages in thread
From: Mike Iglesias @ 1995-06-29 4:00 UTC (permalink / raw)
In article <danpop.804368690@rscernix>, Dan Pop <Dan.Pop@mail.cern.ch> wrote:
>>Any hints or help would be appreciated!
>
>1. Don't use -O3.
>or
>2. Use cc -migrate -O3 which produces the correct results.
And report it to Digital so it can be fixed.
--
Mike Iglesias Internet: iglesias@draco.acs.uci.edu
University of California, Irvine phone: (714) 824-6926
Office of Academic Computing FAX: (714) 824-2069
Central Computing Support
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: f77 and cc optimization problem on osf v3.2
1995-07-03 4:00 ` f77 and cc optimization " Christos Siopis
@ 1995-07-03 4:00 ` Dan Pop
0 siblings, 0 replies; 5+ messages in thread
From: Dan Pop @ 1995-07-03 4:00 UTC (permalink / raw)
In <3t85a0$1na@no-names.nerdc.ufl.edu> siopis@astro.ufl.edu (Christos Siopis) writes:
>Hi,
>
>Recently there was a thread on a bug of OSF's cc compiler, regarding the
>-O3 optimization option. I have a problem with the *Fortran* compiler that
>I suspect can be traced back to cc's bug. Here is my problem:
>
>----------------
>% f77 -v nbmod.f
>/usr/lib/cmplrs/fort/decfort -o /tmp/forAAAaanbea.o nbmod.f
>/usr/bin/cc -v /usr/lib/cmplrs/fort/for_main.o /tmp/forAAAaanbea.o -O4 -lUfor
>-lfor -lFutil -lm -lots
>/usr/lib/cmplrs/cc/ld -g0 -O4 -call_shared /usr/lib/cmplrs/cc/crt0.o
>/usr/lib/cmplrs/fort/for_main.o /tmp/forAAAaanbea.o -lUfor -lfor -lFutil
>-lm -lots -lc
>Assertion failed: 0, file ../../../../../../src/usr/ccs/lib/libmld/
>cmrlc_produce.c, line 864
>0.2u 0.0s 0:00 30% 0+7k 18+8io 1pf+0w
>Fatal error in: /usr/lib/cmplrs/cc/ld IOT/Abort trap
>fort: Severe: Failed while trying to link.
>----------------
>
>I have no idea what the assertion failure means and I could not locate
>any ../../../blabla/cmrlc_produce.c file (could it probably be missing?)
>What does cmrlc_produce.c do?
>
This is a very good example for the bigots who insist that asserts are
the right way to produce error messages for the end user.
Contact DEC support for the patch you need.
Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@mail.cern.ch
Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
^ permalink raw reply [flat|nested] 5+ messages in thread
* f77 and cc optimization problem on osf v3.2
1995-06-28 4:00 cc -O3 problem on osf v3.2 Bill Wang
1995-06-28 4:00 ` Dan Pop
@ 1995-07-03 4:00 ` Christos Siopis
1995-07-03 4:00 ` Dan Pop
1 sibling, 1 reply; 5+ messages in thread
From: Christos Siopis @ 1995-07-03 4:00 UTC (permalink / raw)
To: lionel, siopis
Hi,
Recently there was a thread on a bug of OSF's cc compiler, regarding the
-O3 optimization option. I have a problem with the *Fortran* compiler that
I suspect can be traced back to cc's bug. Here is my problem:
----------------
% f77 -v nbmod.f
/usr/lib/cmplrs/fort/decfort -o /tmp/forAAAaanbea.o nbmod.f
/usr/bin/cc -v /usr/lib/cmplrs/fort/for_main.o /tmp/forAAAaanbea.o -O4 -lUfor
-lfor -lFutil -lm -lots
/usr/lib/cmplrs/cc/ld -g0 -O4 -call_shared /usr/lib/cmplrs/cc/crt0.o
/usr/lib/cmplrs/fort/for_main.o /tmp/forAAAaanbea.o -lUfor -lfor -lFutil
-lm -lots -lc
Assertion failed: 0, file ../../../../../../src/usr/ccs/lib/libmld/
cmrlc_produce.c, line 864
0.2u 0.0s 0:00 30% 0+7k 18+8io 1pf+0w
Fatal error in: /usr/lib/cmplrs/cc/ld IOT/Abort trap
fort: Severe: Failed while trying to link.
----------------
I have no idea what the assertion failure means and I could not locate
any ../../../blabla/cmrlc_produce.c file (could it probably be missing?)
What does cmrlc_produce.c do?
The default optimization parameter for DEC OSF f77 is -O4, which is actually
passed down to the cc compiler. When I compiled the program with -O0 and -O1
there was no problem. When I compiled with -O2 though, it would *not*
work. So it seems my problem starts with -O2, not -O3.
One solution suggested was to use the -migrate option,
but that did not work either:
----------------
% f77 -migrate -v nbmod.f
/usr/lib/cmplrs/fort/decfort -o /tmp/forAAAaalzra.o nbmod.f
/usr/bin/cc -migrate -v /usr/lib/cmplrs/fort/for_main.o /tmp/forAAAaalzra.o -O4
-lUfor -lfor -lFutil -lm -lots
/usr/lib/cmplrs/cc/ld -g0 -O4 -std0 -call_shared /usr/lib/cmplrs/cc/crt0.o
/usr/lib/cmplrs/fort/for_main.o /tmp/forAAAaalzra.o -lUfor -lfor -lFutil -lm
-lots -lots -lc
Assertion failed: 0, file ../../../../../../src/usr/ccs/lib/libmld/
cmrlc_produce.c, line 864
0.2u 0.0s 0:00 42% 0+7k 5+9io 0pf+0w
Fatal error in: /usr/lib/cmplrs/cc/ld IOT/Abort trap
fort: Severe: Failed while trying to link.
----------------
This is interesting, because according to the documentation, -migrate
forces the compiler to use the DEC C (instead of the DEC OSF/1 C)
compilation environment, which uses "other" optimizations.
One difference between my case and the cc bug reported by Bill Wang is that
I cannot even link, whereas he *could* link, but he would get different
results from the optimized and the non-optimized executables.
I have compiled the source code successfully on Ultrix, AIX, VMS and SunOS.
I will have to use my Alpha for runs that could take several weeks at
a time, and optimization could be crucial (I have had execution time
decreased by more than a factor of 2 between -O1 and -O4 on one occasion).
So using -O1 would not really be a satisfactory solution (unless there
was a way to know that -O4 would not significantly improve performance).
Any help would be appreciated. Please cc: your post to me personally.
--
*********************************************************************
* Christos Siopis | Internet: siopis@astro.ufl.edu *
* Graduate Student | BITNET : siopis@ufcc *
* P.O. Box 112055 | *
* Department of Astronomy | Voice : (904) 374-6833 *
* University of Florida | (904) 392-0123 *
* Gainesville, FL 32611-2055 | *
* U.S.A. | FAX : (904) 392-5089 *
*********************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1995-07-03 4:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-06-28 4:00 cc -O3 problem on osf v3.2 Bill Wang
1995-06-28 4:00 ` Dan Pop
1995-06-29 4:00 ` Mike Iglesias
1995-07-03 4:00 ` f77 and cc optimization " Christos Siopis
1995-07-03 4:00 ` Dan Pop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox