* problems with compilers bundled with RH Linux?
@ 1997-12-11 18:07 yue-feng sun
1997-12-11 19:37 ` Michal Jaegermann
0 siblings, 1 reply; 11+ messages in thread
From: yue-feng sun @ 1997-12-11 18:07 UTC (permalink / raw)
----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 27
Hello there,
I have had no luck with both RH Linux/Intel and now RH
Linux/ALpha to compile the following attached combination of C++, C,
and fortran programs, while there have been no problems using
Slackware Linux/Intel and Solaris.
My problems are :
1. When it compiles a fortran subroutine of matrix
multiplication with parameter and dimension statements, the
compilation fails:
The error message is : floating exception during constant evaluation;
cannot recover.
2. If I don't use that subroutine, I still cannot get through.
The error is
/usr/lib/libf2c.so: undefined reference to 'MAIN__'
You can save the 6 files: Makefile, cppmain.C, cstuff.c,
fstuff.f, time_keeper.c, and time_keeper.h, as named under a directory.
I usually simply type make and everything is fine but not on RH Linux.
If you can successfully test it using RH Linux, please let me know how
you did.
Thanks.
Yue-Feng Sun
----------
X-Sun-Data-Type: Makefile
X-Sun-Data-Description: Makefile
X-Sun-Data-Name: Makefile
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 52
#
# Y.F. Sun, sunyf@ldeo.columbia.edu
FLAGPLATFORM =
FFLAGS =
CFLAGS =
C++FLAGS = -O
INCDIRS =
CPP = g++ -DCPP
CC = gcc -DCC
FC = g77 -DFOR
LKL = g77
##### Local vairable definitions #####
PROG1 = cftest
OBJS1 = cppmain.o cstuff.o fstuff.o time_keeper.o
PROGRAMS = $(PROG1)
FLAGS = $(FLAGPLATFORM) $(FFLAGS) $(CFLAGS) $(C++FLAGS)
LIBS =
##### Rules and their local targets #####
.c.o:
$(CC) -c $(INCDIRS) $(FLAGPLATFORM) $(CFLAGS) $<
.C.o:
$(CPP) -c $(INCDIRS) $(FLAGPLATFORM) $(C++FLAGS) $<
.f.o:
$(FC) -c $(INCDIRS) $(FFLAGS) $<
##### Rules and their goal targets #####
default:
make targets
targets: $(PROGRAMS)
$(PROG1): $(OBJS1)
$(LKL) $(FLAGS) -o $@ $(OBJS1) $(LIBS)
cleanall:
rm -f *.o *.a core $(PROGRAMS)
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: cppmain.C
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 32
/* c2f.C, Y.F. Sun*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "time_keeper.h"
extern "C" cprint(int , float *);
extern "C" void f2c_(int *, float *);
int main(int argc, char *argv[])
{
int dv1d;
float *v1df;
int i;
dv1d = 10;
v1df = (float *) malloc(dv1d*sizeof(float));
for(i=0; i< dv1d;i++) v1df[i] = i;
start_time();
f2c_(&dv1d,v1df);
cprint(dv1d,v1df);
free ( (char *) v1df);
prn_time();
printf("done.\a\a\a\n");
}
----------
X-Sun-Data-Type: c-file
X-Sun-Data-Description: c-file
X-Sun-Data-Name: cstuff.c
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 23
/* cstuff.c, Y.F. Sun */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
void cprint(int lx, float *x)
{
int i;
for(i=0; i< lx;i++) printf("%d %f\n", i, x[i]);
printf("\n");
}
void fcallc_(int *lx,float *x)
{
int i;
for( i = 0; i < *lx; i++) x[i] += 1000.;
}
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: fstuff.f
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 52
c Y.F. Sun
subroutine f2c(lx,x)
real x(*)
external fcallc
c
do i=1,lx
x(i) = x(i) + 100.
enddo
call fcallc(lx,x)
call matrixmulc()
return
end
c***************************************************************
c***************************************************************
subroutine matrixmulc()
c
parameter(lx1 = 1000, lx2 = 500, lx3 = 500)
real a(lx1,lx2), b(lx2,lx3), c(lx1,lx3)
real at(lx2,lx1)
external fcallc
c
print *, 'C matrix multiplication: C = AB, Cmn, m,n = ',lx1,lx3
do j=1,lx2
do i=1,lx1
a(i,j) = 0.000
if(i .eq. j) a(i,j) = 1.
enddo
enddo
do j=1,lx2
do k=1,lx3
b(j,k) = j*0.0001+k
enddo
enddo
c transpose of A
do j=1,lx1
do i=1,lx2
at(i,j) = a(j,i)
enddo
enddo
do j=1,lx3
do i=1,lx1
c(i,j) = 0.
do m=1, lx2
c(i,j) = c(i,j) + at(m,i) * b(m,j)
enddo
if(j .eq. lx3 .and. i .le. 10)
$ write(*, 100) ' c(',i,',',j,') = ', c(i,j)
enddo
enddo
100 format(a,I4,a,I4,a,f15.4)
return
end
----------
X-Sun-Data-Type: c-file
X-Sun-Data-Description: c-file
X-Sun-Data-Name: time_keeper.c
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 41
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAXSTRING 100
typedef struct {
clock_t begin_clock, save_clock;
time_t begin_time, save_time;
} time_keeper;
static time_keeper tk;
void start_time()
{
tk.begin_clock = tk.save_clock = clock();
tk.begin_time = tk.save_time = time(NULL);
}
double prn_time()
{
char s1[MAXSTRING], s2[MAXSTRING];
double clocks_per_second = (double) CLOCKS_PER_SEC,
user_time, real_time;
user_time = (clock() - tk.save_clock) / clocks_per_second;
real_time = difftime(time(NULL), tk.save_time);
tk.save_clock = clock();
tk.save_time = time(NULL);
sprintf(s1, "%.5f", user_time);
sprintf(s2, "%.5f", real_time);
printf("%s%.5f%s\n\n",
"User time: ", user_time, " seconds");
printf("%s%.5f%s\n\n",
"Real time: ", real_time, " seconds");
return user_time;
}
----------
X-Sun-Data-Type: h-file
X-Sun-Data-Description: h-file
X-Sun-Data-Name: time_keeper.h
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 16
/* time_keeper.h */
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#if defined CC
extern void start_time();
extern double prn_time();
#endif
#if defined CPP
extern "C" void start_time();
extern "C" double prn_time();
#endif
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: problems with compilers bundled with RH Linux?
1997-12-11 18:07 problems with compilers bundled with RH Linux? yue-feng sun
@ 1997-12-11 19:37 ` Michal Jaegermann
0 siblings, 0 replies; 11+ messages in thread
From: Michal Jaegermann @ 1997-12-11 19:37 UTC (permalink / raw)
>
> My problems are :
> 1. When it compiles a fortran subroutine of matrix
> multiplication with parameter and dimension statements, the
> compilation fails:
> The error message is : floating exception during constant evaluation;
> cannot recover.
Which compiler? Unpatched f2c?
When I fed this fstuff.f to g77 I got:
g77 -o fstuff fstuff.f
fstuff.f: In subroutine `matrixmulc':
fstuff.f:40:
do j=1,lx3
1
fstuff.f:51: (continued):
end
2
Statement at (2) invalid in context established by statement at (1)
fstuff.f:40:
do j=1,lx3
^
End of source file before end of block started at (^)
I thought that g77 is a Fortran 77 compiler and it does not support
extensions like 'do ... enddo'. Am I wrong? BTW - fort77 brought,
correctly,
Error on line 51: DO loop or BLOCK IF not closed
> 2. If I don't use that subroutine, I still cannot get through.
> The error is
> /usr/lib/libf2c.so: undefined reference to 'MAIN__'
^^^^
This is your main entry point for a Fortran program. If you failed
to compile then it does not exist.
--mj
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: problems with compilers bundled with RH Linux?
@ 1997-12-11 19:37 Michal Jaegermann
0 siblings, 0 replies; 11+ messages in thread
From: Michal Jaegermann @ 1997-12-11 19:37 UTC (permalink / raw)
>
> My problems are :
> 1. When it compiles a fortran subroutine of matrix
> multiplication with parameter and dimension statements, the
> compilation fails:
> The error message is : floating exception during constant evaluation;
> cannot recover.
Which compiler? Unpatched f2c?
When I fed this fstuff.f to g77 I got:
g77 -o fstuff fstuff.f
fstuff.f: In subroutine `matrixmulc':
fstuff.f:40:
do j=1,lx3
1
fstuff.f:51: (continued):
end
2
Statement at (2) invalid in context established by statement at (1)
fstuff.f:40:
do j=1,lx3
^
End of source file before end of block started at (^)
I thought that g77 is a Fortran 77 compiler and it does not support
extensions like 'do ... enddo'. Am I wrong? BTW - fort77 brought,
correctly,
Error on line 51: DO loop or BLOCK IF not closed
> 2. If I don't use that subroutine, I still cannot get through.
> The error is
> /usr/lib/libf2c.so: undefined reference to 'MAIN__'
^^^^
This is your main entry point for a Fortran program. If you failed
to compile then it does not exist.
--mj
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
----- End Included Message -----
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: problems with compilers bundled with RH Linux?
@ 1997-12-11 20:38 yue-feng sun
0 siblings, 0 replies; 11+ messages in thread
From: yue-feng sun @ 1997-12-11 20:38 UTC (permalink / raw)
Hello Michal,
That's the compiler fort.77 (f2c) with RH4.2. I don't know if
it's patched or unpatched.
You cannot feed this fstuff.f to g77 as an independent program.
You should use the Makefile.
g77 supports do ... enddo.
The main entry point is in cppmain.C
Please use the Makefile, and have the 5 files and then test.
It's successful on Slackware-bundled gcc, g++, anf g77 compilers and
also successful on gcc, g++, g77 on Solaris. Not on RH Linux.
Sun
----- Begin Included Message -----
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: problems with compilers bundled with RH Linux?
@ 1997-12-11 23:41 Craig Burley
0 siblings, 0 replies; 11+ messages in thread
From: Craig Burley @ 1997-12-11 23:41 UTC (permalink / raw)
>g77 -o fstuff fstuff.f
>fstuff.f: In subroutine `matrixmulc':
>fstuff.f:40:
> do j=1,lx3
> 1
>fstuff.f:51: (continued):
> end
> 2
>Statement at (2) invalid in context established by statement at (1)
>fstuff.f:40:
> do j=1,lx3
> ^
>End of source file before end of block started at (^)
>
>I thought that g77 is a Fortran 77 compiler and it does not support
>extensions like 'do ... enddo'. Am I wrong? BTW - fort77 brought,
>correctly,
g77 supports DO...END DO. You've got DO...END above.
> Error on line 51: DO loop or BLOCK IF not closed
fort77 is basically complaining about the same thing, but
differently.
tq vm, (burley)
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread[parent not found: <199712112218.RAA12838@brg0>]
* Re: problems with compilers bundled with RH Linux?
[not found] <199712112218.RAA12838@brg0>
@ 1997-12-12 1:57 ` Michal Jaegermann
0 siblings, 0 replies; 11+ messages in thread
From: Michal Jaegermann @ 1997-12-12 1:57 UTC (permalink / raw)
I got a complete set of sources posted here earlier by yue-feng sun
and run this test after compiling with g77-egcs compiler. The program
reported
User time: 39.21680 seconds
Real time: 42.00000 seconds
Then I added, rather at random, without even looking at these sources,
"FFLAGS = -O6 -funroll-all-loops -fschedule-insns". Times
reported changed to:
User time: 6.69336 seconds
Real time: 7.00000 seconds
6-fold improvement for a few lousy flags? This should teach you
to use an optimizer in the future. :-)
After throwing into a fray also "-fschedule-insns2
-fexpensive-optimizations -frerun-cse-after-loop" I got the same
looking output but times reported changed to
User time: 6.35254 seconds
Real time: 6.00000 seconds
"Real time" shorter than "User time"? Oh, that is an optimization!
Michal
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: problems with compilers bundled with RH Linux?
@ 1997-12-12 14:50 yue-feng sun
0 siblings, 0 replies; 11+ messages in thread
From: yue-feng sun @ 1997-12-12 14:50 UTC (permalink / raw)
Many thanks indeed to Wes and Michal for testing my programs and directing me to
the great egcs-1.0.
Last night, I got egcs-1.0 and easily installed it on my Alpha 533 MHz
(Many thanks for egcs' great work on both the compilers and the easiness of
installation). Everything is smooth and fine. But I didn't use the optimization
options. I'll do that today night.
I'll try to install egcs-1.0 on my Pentimum 90 and 133, on UltraSparc II, and
SP2 and see what happens.
Regards,
Yue-Feng Sun
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: problems with compilers bundled with RH Linux?
@ 1997-12-12 15:26 Craig Burley
0 siblings, 0 replies; 11+ messages in thread
From: Craig Burley @ 1997-12-12 15:26 UTC (permalink / raw)
>User time: 6.35254 seconds
>
>Real time: 6.00000 seconds
>
>"Real time" shorter than "User time"? Oh, that is an optimization!
IIRC, g77 has/had (i.e. maybe "has" in the current official release,
0.5.21, but "had" in the current development version) a bug in one
or more of the time-reporting intrinsics that affected some systems.
That might explain some inconsistent results, including these.
--
"Practice random senselessness and act kind of beautiful."
James Craig Burley, Software Craftsperson burley@gnu.org
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: problems with compilers bundled with RH Linux?
@ 1997-12-12 16:08 Dave Gilbert
0 siblings, 0 replies; 11+ messages in thread
From: Dave Gilbert @ 1997-12-12 16:08 UTC (permalink / raw)
I've had two compiler problems so far:
GCC with RH5.0 won't compile the kernel (Signal 6 in
scsi/flashpoint.c) - not that I use flashpoint. (Kernel source that was
installed by the RedHat installer).
An old version of EGCS I've got (only acouple of weeks old) won't do
-mcpu=21164 - it complains during assembly.
Dave
--
---------------------------------------------------- Man can not live -
David Alan Gilbert - gro.gilbert @ treblig.org ---- by bread alone. He
---------------------------------------------------- needs chocolate. -
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <199712121526.KAA09405@melange.gnu.org>]
* Re: problems with compilers bundled with RH Linux?
[not found] <199712121526.KAA09405@melange.gnu.org>
@ 1997-12-12 16:11 ` Michal Jaegermann
0 siblings, 0 replies; 11+ messages in thread
From: Michal Jaegermann @ 1997-12-12 16:11 UTC (permalink / raw)
Craig Burley wrote:
>
> >User time: 6.35254 seconds
> >
> >Real time: 6.00000 seconds
> >
> >"Real time" shorter than "User time"? Oh, that is an optimization!
>
> IIRC, g77 has/had (i.e. maybe "has" in the current official release,
> 0.5.21, but "had" in the current development version) a bug in one
> or more of the time-reporting intrinsics that affected some systems.
This was a tongue-in-cheek comment. Sources in question use difftime()
to compute "Real time". This function is documented to return time
in seconds and does not seem to return any non-zero fractional part -
even if a return type is double. To me it is far from clear from a
documentation if this is a library bug or not. The above result likely
really means that "Real time" was below 6.5 seconds.
Michal
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <34916168.3B609A37@treblig.org>]
* Re: problems with compilers bundled with RH Linux?
[not found] <34916168.3B609A37@treblig.org>
@ 1997-12-12 20:36 ` Richard Henderson
0 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 1997-12-12 20:36 UTC (permalink / raw)
On Fri, Dec 12, 1997 at 04:08:08PM +0000, Dave Gilbert wrote:
> GCC with RH5.0 won't compile the kernel (Signal 6 in
> scsi/flashpoint.c) - not that I use flashpoint. (Kernel source that was
> installed by the RedHat installer).
Long known and fixed in current gcc snapshots and EGCS.
> An old version of EGCS I've got (only acouple of weeks old) won't do
> -mcpu=21164 - it complains during assembly.
What is the complaint? There was one somewhat recent
broken snapshot, but it was quickly fixed. You might
try the actual release now too.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~1997-12-12 20:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-12-11 18:07 problems with compilers bundled with RH Linux? yue-feng sun
1997-12-11 19:37 ` Michal Jaegermann
-- strict thread matches above, loose matches on Subject: below --
1997-12-11 19:37 Michal Jaegermann
1997-12-11 20:38 yue-feng sun
1997-12-11 23:41 Craig Burley
[not found] <199712112218.RAA12838@brg0>
1997-12-12 1:57 ` Michal Jaegermann
1997-12-12 14:50 yue-feng sun
1997-12-12 15:26 Craig Burley
1997-12-12 16:08 Dave Gilbert
[not found] <199712121526.KAA09405@melange.gnu.org>
1997-12-12 16:11 ` Michal Jaegermann
[not found] <34916168.3B609A37@treblig.org>
1997-12-12 20:36 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox