Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #3500

modifying constants in Fortran and elsewhere

Path csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From gah4 <gah4@u.washington.edu>
Newsgroups comp.compilers
Subject modifying constants in Fortran and elsewhere
Date Mon, 10 Jul 2023 19:42:01 -0700
Organization Compilers Central
Sender johnl%iecc.com
Approved comp.compilers@iecc.com
Message-ID <23-07-003@comp.compilers> (permalink)
MIME-Version 1.0
Content-Type text/plain; charset="UTF-8"
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="66936"; mail-complaints-to="abuse@iecc.com"
Keywords errors, history, Fortran
Posted-Date 11 Jul 2023 20:38:33 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:3500

Show key headers only | View raw


A potential bug since the earliest days of Fortran is passing a
constant to a subroutine, and then changing the value of the dummy
argument.

In at least some Fortran system, this modifies the value of a constant
used other places in a program.

As this was known when PL/I was designed, it is defined such that
modifiable constants are passed to called procedures. C avoids it by
not allowing the & operator on constants. (Though K&R allows
modification of string constants.)

Somehow, in all the years, that feature was never added to Fortran.

It is easy to write programs and test for it, but I wonder if there
are any stories for real program that had this bug, and even better,
stories about the difficulty of finding it, or problems caused by it.

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-10 19:42 -0700
  Re: modifying constants in Fortran and elsewhere Thomas Koenig <tkoenig@netcologne.de> - 2023-07-15 10:57 +0000
    Re: modifying constants in Fortran and elsewhere Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2023-07-16 11:56 +0200
    Re: modifying constants in Fortran and elsewhere Thomas Koenig <tkoenig@netcologne.de> - 2023-07-16 13:08 +0000
      Re: modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-16 19:09 -0700
        Re: modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-17 10:51 -0700
      Re: modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-16 19:17 -0700
  Re: modifying constants in Fortran and elsewhere David Brown <david.brown@hesbynett.no> - 2023-07-17 13:09 +0200

csiph-web