From: Arjen M. <Arj...@de...> - 2018-01-07 11:03:55
|
Hi Alan, > -----Original Message----- > From: Alan W. Irwin [mailto:ir...@be...] > Sent: Saturday, January 06, 2018 3:30 AM > To: Arjen Markus > Cc: PLplot development list > Subject: RE: Command-line parsing improvements for both C and Fortran > > On 2018-01-05 13:38-0000 Arjen Markus wrote: > > [...] > > > That [extra printouts of locations reached] limits the possibilities > considerably ;). I have narrowed it further to the call of max_cstring_length, but of > course this is merely the location where it is noted something is wrong, not > necessarily the cause. > > Hi Arjen: > > Your experiments appear to have nailed exactly where the issue was. So much > thanks for that work! As a direct result of that work I discovered I had forgotten an > essential slice specification in the call to max_cstring_length which I have now fixed > (commit 70ec495). > As a result my strong expectation is your next test of Fortran example > 1 for the allocated length and size case will give perfect results for both modern > gfortran and ifort I can now confirm that it works for both compilers. There is a small issue though with the gfortran compiler under Cygwin. I do not understand it (*) but here is the output to screen if I use the -h option: $ ./x01f -h pl_parse_dynamic = T argv before call to plparseopts(..., PL_PARSE_SKIP) i = 0, argument = ./x01f i = 1, argument = -h /bin/sh: C:\Program: command not found This does not happen for Intel Fortran - then I get an overview of all the options that are available. (*) From a closer look at the code I think this is due to the fragment: #ifdef HAVE_POPEN FILE *pager = NULL; if ( getenv( "PAGER" ) != NULL ) pager = (FILE *) popen( "$PAGER", "w" ); if ( pager == NULL ) pager = (FILE *) popen( "more", "w" ); if ( pager != NULL ) outfile = pager; #endif It is probably trying to run a pager program like "more" but that does not quite work on Cygwin. BTW, I had to adjust the .def file for Intel Fortran to get it all to build correctly. I will submit the changes. > > By the way, this fix has nothing to do with the gfortran-4.9.2 issue where the > allocate length and size command in plget_arguments_dynamic (that already works > for your modern gfortran and ifort cases) overflows when doing a simple internal > calculation of the amount of memory needed. I double-checked with gdb that the > length and size are properly defined for that allocate command. Therefore my > conclusion must be that gfortran-4.9.2 is just plain broken for such allocate > commands (while your ifort and more modern gfortran are obviously not broken in > this regard). > Pity, that means a newer version is still needed. Regards, Arjen DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail. |