[mesa-users] Inline Comments in Namelists

Richard Townsend townsend at astro.wisc.edu
Thu May 7 19:40:06 EDT 2015


Hi Josiah —

gfortran behaves ‘as expected’ if you put a space just before the comment. But I’m digging into this further, as it may be a compiler bug.

cheers,

Rich

> On May 7, 2015, at 6:22 PM, Josiah Schwab <jwschwab at berkeley.edu> wrote:
> 
> Hi All,
> 
> Did you know that inline comments in namelists are treated differently
> than in the body of a program in a compiler-dependent way?  I didn't!
> 
> For example, in a fortran program an assignment of the form
> 
>  val = 3.14!2.78
> 
> obviously assigns the value 3.14 to the variable val.
> 
> If you write the same thing in a fortran namelist (an inlist),
> 
>  + with ifort, it behaves as you would naively expect
>  + with gfortran, whole line is is effectively ignored
> 
> I've attached a trivial test program that demonstrates this.
> 
> 
> GNU Fortran (GCC) 4.9.3 20141212 (prerelease)
> ,----
> | henyey: ~$ gfortran -o test.x test_namelist.f90 && ./test.x
> | 
> | assign: val =  3.14
> | namelist: val = -1.00
> `----
> 
> ifort (IFORT) 14.0.2 20140120
> ,----
> | henyey: ~$ ifort -o test.x test_namelist.f90 && ./test.x
> |
> | assign: val =  3.14
> | namelist: val =  3.14
> `----
> 
> I spent a while today chasing a problem that boiled down to this
> peculiarity.  I figured I'd send a mail so that someday someone will
> think of this more quickly than I did.
> 
> I tried looking up the standard, but couldn't find anything specific
> enough to tell whether this behavior is specified or undefined.
> 
> Best,
> Josiah
> 
> <test_namelist.tar.gz>------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud 
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y_______________________________________________
> mesa-users mailing list
> mesa-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mesa-users





More information about the Mesa-users mailing list