- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The IVF11.1.067 does not give some compile / run-time error for allocatable array shape conformance problem. For example:
subroutine Array_Shape_Conformance
implicit none
real:: ra(3, 3), rb(4, 4), rc(4, 4)
real, allocatable:: sa(:, :), sb(:, :), xy(:)
ra = 3.0; rb = 4.0;
! The shapes of the array expressions do not conform.
! rc = ra + rb ! *** *** *** error
allocate( sa(3, 3), source = ra )
allocate( sb(4, 4), source = rb )
rc = sa + sb ! the compiler give no compile or run-time error
write(unit = *, fmt = "(4F12.7)") rc
return
end subroutine
Link kopiert
5 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The above example should be a runtime error when bounds checking enabled.
While there is sufficient information at compile time to determine that the expression is in error (due to knowing the shape of the arrays), I do not believe there is something in the specification to require the compiler to detect such an error. A "lint" feature should detect this error in programming.
While there is sufficient information at compile time to determine that the expression is in error (due to knowing the shape of the arrays), I do not believe there is something in the specification to require the compiler to detect such an error. A "lint" feature should detect this error in programming.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
As rc is big enough to accommodate all SIZEs involved, this may not strictly produce a bounds check error. I agree with Jim that it ought to produce a run time error when /check is set at compile time. Apparently, other brands of compilers agree also, judging by web references to updates to diagnose such problems.
Early f90 compilers diagnosed these unconditionally, but the performance hit was unacceptable.
I notice the results produced by ifort and gfortran are different, both problematical.
Early f90 compilers diagnosed these unconditionally, but the performance hit was unacceptable.
I notice the results produced by ifort and gfortran are different, both problematical.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The Intel compiler does not do run-time shape checking. This is on our wish list. Sometimes, array bounds checking will be triggered by such an error but not always.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Thanks a lot.
#1 what's meaning of -- lint
#2 what's meaning of -- rc
#3 I suggest: the IVF compiler give a run-time switch for (allocatable) array shape checking.
#1 what's meaning of -- lint
#2 what's meaning of -- rc
#3 I suggest: the IVF compiler give a run-time switch for (allocatable) array shape checking.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
lint is an old Unix term for static syntax checking.
rc is the name you gave your array.
rc is the name you gave your array.
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite