Re: Is there a way in Fortran to designate an integer value as integer*8 ?

Liste des GroupesRevenir à cl fortran 
Sujet : Re: Is there a way in Fortran to designate an integer value as integer*8 ?
De : lynnmcguire5 (at) *nospam* gmail.com (Lynn McGuire)
Groupes : comp.lang.fortran
Date : 26. Oct 2024, 21:50:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vfjkml$3sd4e$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
User-Agent : Mozilla Thunderbird
On 10/26/2024 6:51 AM, Thomas Koenig wrote:
Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
On 10/24/2024 1:28 AM, Thomas Koenig wrote:
Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
 
F2C fixes the other big problem
automatically, the change of initial array index from one to zero.
>
If I remember correctly, it does so by issueing invalid C (or
C++), by using negative offsets from pointers.  Might work now,
might not work tomorrow.
>
But note the IIRC above.
>
I want to move to a monolanguage environment.  50,000 lines of my
calculation engine are C++ already.  850,000 lines to go.
 That motivation, I understand, especially if the GUI code is in C++,
but there is a caveat.  Consider
        subroutine foo(i,n)
       integer array(10)
       common array
       integer n
       integer i(n)
       integer k
       do k=1,n
          i(k) = k + array(k)
       end do
       end
 which gets translated by stock f2c (to which you may have made
adjustments) into
 #include "f2c.h"
 /* Common Block Declarations */
 struct {
     integer array[10];
} _BLNK__;
 #define _BLNK__1 _BLNK__
 /* Subroutine */ int foo_(integer *i__, integer *n)
{
     /* System generated locals */
     integer i__1;
      /* Local variables */
     static integer k;
      /* Parameter adjustments */
     --i__;
      /* Function Body */
     i__1 = *n;
     for (k = 1; k <= i__1; ++k) {
i__[k] = k + _BLNK__1.array[k - 1];
     }
     return 0;
} /* foo_ */
 The common block handling looks OK, but the dummy argument
(aka parameters, in C parlance) handling is very probably not.
 The "parameter adjustment" above is explicitly listed as undefined
behavior, in annex J2 of n2596.pdf (for example):
 "Addition or subtraction of a pointer into, or just beyond, an
array object and an integer type produces a result that does not
point into, or just beyond, the same array object (6.5.6)."
 Undefined behavior is the worst kind of error in your program
that you can have in C, it is not required to be diagnosed, and
compilers can, and do, make optimizations based on the assumption
that it does not happen, so this is liable to break in unforseen
circumstances.
 So if your version of f2c does the same, I would check the C++
standard if if has a similar provision (I strongly suspect so,
but I don't know), and, if that is the case, modify your version
of f2c to generate conforming code for array dummy arguments.
Otherwise, you are betting your company.
First, I include all of my 300+ common blocks as 200 files.  I converted those separately and cleaned them up so that the static variables and defines are easy to peruse and understand.  I delete all of the local common block conversions by f2c in the subroutines and change them back to include files.  An easy cleanup that I have to do 5,000 times (4,000 to go now plus the 100+ subroutines that we have modified for customers since I started the conversion project two years ago).
I also removed the parameter adjustments from my copy of f2c.  It is a little tricky but as you say, they are not legal code in C++.
I have extensively modified my copy of f2c so that it generates better legal C++ code and many other improvements.  But my changes are subject to the old 80 / 20 rule.  I have 80% automated conversions and 20% hand conversions.  I do have a little experience here: Fortran since 1975, C since 1987, and C++ since 2000.
Thanks for the warnings,
Lynn

Date Sujet#  Auteur
2 Oct 24 * Is there a way in Fortran to designate an integer value as integer*8 ?88Lynn McGuire
2 Oct 24 +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?66Lawrence D'Oliveiro
2 Oct 24 i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?65Lynn McGuire
3 Oct 24 i +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Lawrence D'Oliveiro
3 Oct 24 i i`- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire
3 Oct 24 i `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?62Steven G. Kargl
3 Oct 24 i  `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?61Lynn McGuire
3 Oct 24 i   `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?60Steven G. Kargl
3 Oct 24 i    `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?59Lynn McGuire
3 Oct 24 i     +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?3Steven G. Kargl
3 Oct 24 i     i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Clive Page
4 Oct 24 i     i `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Steven G. Kargl
4 Oct 24 i     +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?37Lawrence D'Oliveiro
4 Oct 24 i     i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?36Lynn McGuire
4 Oct 24 i     i `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?35Lawrence D'Oliveiro
4 Oct 24 i     i  +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?33Lynn McGuire
4 Oct 24 i     i  i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?32Lawrence D'Oliveiro
5 Oct 24 i     i  i `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?31Lynn McGuire
5 Oct 24 i     i  i  `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?30Lawrence D'Oliveiro
5 Oct 24 i     i  i   `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?29Lynn McGuire
20 Oct 24 i     i  i    `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?28Lawrence D'Oliveiro
21 Oct 24 i     i  i     `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?27Lynn McGuire
21 Oct 24 i     i  i      `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?26Thomas Koenig
22 Oct 24 i     i  i       `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?25Lynn McGuire
23 Oct 24 i     i  i        `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?24Lawrence D'Oliveiro
23 Oct 24 i     i  i         +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Lynn McGuire
23 Oct 24 i     i  i         i`- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lawrence D'Oliveiro
23 Oct 24 i     i  i         `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?21Lynn McGuire
23 Oct 24 i     i  i          `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?20Lawrence D'Oliveiro
23 Oct 24 i     i  i           `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?19Lynn McGuire
24 Oct 24 i     i  i            +- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lawrence D'Oliveiro
24 Oct 24 i     i  i            `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?17Thomas Koenig
26 Oct 24 i     i  i             `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?16Lynn McGuire
26 Oct 24 i     i  i              +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Lawrence D'Oliveiro
26 Oct 24 i     i  i              i`- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire
26 Oct 24 i     i  i              `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?13Thomas Koenig
26 Oct 24 i     i  i               +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?9Lawrence D'Oliveiro
26 Oct 24 i     i  i               i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?8Thomas Koenig
27 Oct 24 i     i  i               i `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?7Lawrence D'Oliveiro
27 Oct 24 i     i  i               i  `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?6Thomas Koenig
27 Oct 24 i     i  i               i   +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?4Lawrence D'Oliveiro
29 Oct 24 i     i  i               i   i+- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire
29 Oct 24 i     i  i               i   i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2James Kuyper
29 Oct 24 i     i  i               i   i `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Waldek Hebisch
29 Oct 24 i     i  i               i   `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire
26 Oct 24 i     i  i               `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?3Lynn McGuire
26 Oct 24 i     i  i                `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Thomas Koenig
29 Oct 24 i     i  i                 `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire
4 Oct 24 i     i  `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire
13 Oct 24 i     `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?18Thomas Koenig
13 Oct 24 i      +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?5R Daneel Olivaw
13 Oct 24 i      i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?4Thomas Koenig
13 Oct 24 i      i `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?3R Daneel Olivaw
13 Oct 24 i      i  `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Lawrence D'Oliveiro
17 Oct 24 i      i   `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lawrence D'Oliveiro
13 Oct 24 i      +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Gary Scott
13 Oct 24 i      i`- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lawrence D'Oliveiro
14 Oct 24 i      +- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire
14 Oct 24 i      `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?9Lynn McGuire
15 Oct 24 i       `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?8Thomas Koenig
15 Oct 24 i        +- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1R Daneel Olivaw
16 Oct 24 i        +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?4Lynn McGuire
16 Oct 24 i        i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?3Lawrence D'Oliveiro
17 Oct 24 i        i `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Lynn McGuire
17 Oct 24 i        i  `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lawrence D'Oliveiro
16 Oct 24 i        `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Lawrence D'Oliveiro
16 Oct 24 i         `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lawrence D'Oliveiro
3 Oct 24 +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?20R Daneel Olivaw
3 Oct 24 i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?19Steven G. Kargl
3 Oct 24 i `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?18R Daneel Olivaw
3 Oct 24 i  `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?17Lynn McGuire
4 Oct 24 i   `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?16Lawrence D'Oliveiro
4 Oct 24 i    `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?15R Daneel Olivaw
4 Oct 24 i     `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?14Lawrence D'Oliveiro
4 Oct 24 i      +* Re: Is there a way in Fortran to designate an integer value as integer*8 ?3Steven G. Kargl
5 Oct 24 i      i`* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2R Daneel Olivaw
5 Oct 24 i      i `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Steven G. Kargl
4 Oct 24 i      `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?10Gary Scott
5 Oct 24 i       `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?9Clive Page
5 Oct 24 i        `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?8Gary Scott
6 Oct 24 i         `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?7Lawrence D'Oliveiro
6 Oct 24 i          `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?6Gary Scott
6 Oct 24 i           `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?5Lawrence D'Oliveiro
6 Oct 24 i            `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?4Gary Scott
6 Oct 24 i             `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?3Lawrence D'Oliveiro
6 Oct 24 i              `* Re: Is there a way in Fortran to designate an integer value as integer*8 ?2Gary Scott
6 Oct 24 i               `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Gary Scott
5 Oct 24 `- Re: Is there a way in Fortran to designate an integer value as integer*8 ?1Lynn McGuire

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal