From: Jinsong.Zhao on
On Oct 2, 12:52 am, Tobias Burnus <bur...(a)net-b.de> wrote:
>
> I sincerely doubt this. (Not that compiler bugs don't exist, but
> programming errors are much more likely.) Looking at the valgrind
> output (using gfortran) and at ifort -check all, I would claim that
>
>       if (mode == 1) then
>         ...
>       else
>         allocate(c(norbs, norbs), wj(1), wk(1), eigs(norbs),
> dxyz(3*numat), grad(nvar))
>         ...
>       end if
>       grad = 0.d0  ! <<< Line 47
>
> is wrong if grad is not allocated (as valgrind & ifort -check all
> indicate). Moving up "grad" one line or allocating it for mode == 1
> helps. (No, I'm not reading the whole program to check what is the
> algorithmically correct solution.)
>
> Tobias

Thank you, Tobias, for your test.

if grad = 0.d0 is moved up one line, then grad will not be execute
using the above input file, and will give error results.

if grad = 0.d0 is put before if (mode == 1) (line 12), then also
segmentation fault. it is same to be placed at line.

Regards,
Jinsong

From: Jinsong.Zhao on
On Oct 2, 10:34 am, ka...(a)REMOVE.apl.washington.edu (Steven G. Kargl)
wrote:
>
> You want to update to a newer version.  You have 4.2.4 and 4.3.2
> as released versions, and from the gfortran wiki you can get a
> bleeding edge pre-release of 4.4.0.

I will try the newer version.

>
>
> Read the documentation.  -Wall will give many more warns on things
> like variables used but uninitialized.
>

I have read the warning message. there are no warnings about variables
used but uninitialized.

Thanks again.
Jinsong
From: Steven G. Kargl on
In article <2f1e736a-f167-4815-a18a-bf08ece33557(a)u65g2000hsc.googlegroups.com>,
"Jinsong.Zhao(a)gmail.com" <Jinsong.Zhao(a)gmail.com> writes:
> On Oct 2, 10:34�am, ka...(a)REMOVE.apl.washington.edu (Steven G. Kargl)
> wrote:
>>
>> Read the documentation. �-Wall will give many more warns on things
>> like variables used but uninitialized.
>>
> I have read the warning message. there are no warnings about variables
> used but uninitialized.

Did you use -Wall? Because I find,

REMOVE:kargl[335] grep -i uninit sgk.log
enpart.F90:574: warning: 'j1' may be used uninitialized in this function
enpart.F90:574: warning: 'j4' may be used uninitialized in this function
mndod.F90:433: warning: 'f1' may be used uninitialized in this function
mndod.F90:433: warning: 'f2' may be used uninitialized in this function


--
steve
From: Steven G. Kargl on
In article <bb182196-3796-4281-b193-3ec40df1bf2e(a)y21g2000hsf.googlegroups.com>,
"Jinsong.Zhao(a)gmail.com" <Jinsong.Zhao(a)gmail.com> writes:
> On Oct 2, 12:52�am, Tobias Burnus <bur...(a)net-b.de> wrote:
>>
>> I sincerely doubt this. (Not that compiler bugs don't exist, but
>> programming errors are much more likely.) Looking at the valgrind
>> output (using gfortran) and at ifort -check all, I would claim that
>>
>> � � � if (mode == 1) then
>> � � � � ...
>> � � � else
>> � � � � allocate(c(norbs, norbs), wj(1), wk(1), eigs(norbs),
>> dxyz(3*numat), grad(nvar))
>> � � � � ...
>> � � � end if
>> � � � grad = 0.d0 �! <<< Line 47
>>
>> is wrong if grad is not allocated (as valgrind & ifort -check all
>> indicate). Moving up "grad" one line or allocating it for mode == 1
>> helps. (No, I'm not reading the whole program to check what is the
>> algorithmically correct solution.)
>>
>> Tobias
> Thank you, Tobias, for your test.
> if grad = 0.d0 is moved up one line, then grad will not be execute
> using the above input file, and will give error results.
> if grad = 0.d0 is put before if (mode == 1) (line 12), then also
> segmentation fault. it is same to be placed at line.

grad isn't allocated. For your input file, it appears you've located
a bug in mopac

REMOVE:kargl[381] ./mopac sgk.dat
STOP grad not allocated!
REMOVE:kargl[382] diff -u setup_mopac_arrays.F90.orig setup_mopac_arrays.F90
--- setup_mopac_arrays.F90.orig 2008-10-01 21:08:55.000000000 -0700
+++ setup_mopac_arrays.F90 2008-10-01 21:10:03.000000000 -0700
@@ -44,6 +44,11 @@
allocate(fb(mpack), cb(norbs, norbs), pbold(6*mpack), pbold2(6*mpack), &
& pbold3(max(mpack, 400)))
end if
+
+ if (.not. allocated(grad)) then
+ stop 'grad not allocated!'
+ end if
+
grad = 0.d0
else
!




From: Steven G. Kargl on
In article <QOOdnUfwHYcd0HnVnZ2dnUVZ_o_inZ2d(a)comcast.com>,
kargl(a)REMOVE.apl.washington.edu (Steven G. Kargl) writes:
> In article <bb182196-3796-4281-b193-3ec40df1bf2e(a)y21g2000hsf.googlegroups.com>,
> "Jinsong.Zhao(a)gmail.com" <Jinsong.Zhao(a)gmail.com> writes:
>> On Oct 2, 12:52�am, Tobias Burnus <bur...(a)net-b.de> wrote:
>>>
>>> I sincerely doubt this. (Not that compiler bugs don't exist, but
>>> programming errors are much more likely.) Looking at the valgrind
>>> output (using gfortran) and at ifort -check all, I would claim that
>>>
>>> � � � if (mode == 1) then
>>> � � � � ...
>>> � � � else
>>> � � � � allocate(c(norbs, norbs), wj(1), wk(1), eigs(norbs),
>>> dxyz(3*numat), grad(nvar))
>>> � � � � ...
>>> � � � end if
>>> � � � grad = 0.d0 �! <<< Line 47
>>>
>>> is wrong if grad is not allocated (as valgrind & ifort -check all
>>> indicate). Moving up "grad" one line or allocating it for mode == 1
>>> helps. (No, I'm not reading the whole program to check what is the
>>> algorithmically correct solution.)
>>>
>>> Tobias
>> Thank you, Tobias, for your test.
>> if grad = 0.d0 is moved up one line, then grad will not be execute
>> using the above input file, and will give error results.
>> if grad = 0.d0 is put before if (mode == 1) (line 12), then also
>> segmentation fault. it is same to be placed at line.
>
> grad isn't allocated. For your input file, it appears you've located
> a bug in mopac
>
> REMOVE:kargl[381] ./mopac sgk.dat
> STOP grad not allocated!
> REMOVE:kargl[382] diff -u setup_mopac_arrays.F90.orig setup_mopac_arrays.F90
> --- setup_mopac_arrays.F90.orig 2008-10-01 21:08:55.000000000 -0700
> +++ setup_mopac_arrays.F90 2008-10-01 21:10:03.000000000 -0700
> @@ -44,6 +44,11 @@
> allocate(fb(mpack), cb(norbs, norbs), pbold(6*mpack), pbold2(6*mpack), &
> & pbold3(max(mpack, 400)))
> end if
> +
> + if (.not. allocated(grad)) then
> + stop 'grad not allocated!'
> + end if
> +
> grad = 0.d0
> else
> !

Ugh!

A a crappy piece of software! After fixing

REMOVE:kargl[413] diff -u deriv.F90.orig deriv.F90
--- deriv.F90.orig 2008-10-01 21:27:45.000000000 -0700
+++ deriv.F90 2008-10-01 21:27:43.000000000 -0700
@@ -69,6 +69,9 @@
!***********************************************************************
data icalcn/ 0/
if (icalcn /= numcal) then
+ if (.not. allocated(aidref)) then
+ allocate(aidref(nvar))
+ end if
aidref = 0.d0
aifrst = index(keywrd,' RESTART') == 0
saddle = index(keywrd, " SADDLE") /= 0

you hit
REMOVE:kargl[412] ./mopac sgk.dat
At line 109 of file cartab.F90
Fortran runtime error: Array reference out of bounds for array 'nallop',
lower bound of dimension 1 exceeded (-1077948016 < 1)

--
steve


First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10
Prev: Segmentation Fault using cron
Next: fortran 90/95 BNF grammar