Length of the ERRMSG result

Francisco Pena fran.pena@usc.es
Wed Oct 1 08:54:00 GMT 2014


Thank you again for your answer. Let's see if somebody can clarify
whether the maximum size of the ERRMSG result depends on the compiler
or the OS.

Best,
Fran

2014-09-30 21:31 GMT+02:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> I just told you.  The length is whatever you set in the
> declaration.  Now, if you meant to ask 'how do I determine
> if my buffer's length is sufficient to hold the entire errmsg
> from allocate?'  The answer is that 'it is (likely) OS dependent'
> as the errors generated by say MS Windows (may) differ from those
> generated by FreeBSD.
>
> I haven't looked, bu suspect that gfortran internal generates
> a dynamic errmsg via alloca and copies into whatever is associated
> by ERRMSG=.
>
> --
> steve
>
> On Tue, Sep 30, 2014 at 06:30:17PM +0200, Francisco Pena wrote:
>> Thank you Steve, I agree. But I imagine that there is a specific
>> length in the implementation of ALLOCATE for the gfortran compiler
>> that ensures that all error messages must fit in this length. In my
>> humble opinion, this information could be in the Manual.
>>
>> Best,
>> Fran
>>
>> 2014-09-30 18:23 GMT+02:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
>> > On Tue, Sep 30, 2014 at 06:08:10PM +0200, Francisco Pena wrote:
>> >>
>> >> I was trying to find the length of the character result of argument
>> >> ERRMSG in ALLOCATE for the gfortran compiler. I am unable to find this
>> >> data in the gfortan Documentation. Is there also a place to consult
>> >> which are the errors that gfortran can return in ALLOCATE?
>> >>
>> >
>> > I could be wrong, but the length is set by the user.
>> > You do something like
>> >
>> > character(len=10) err
>> > ...
>> > allocate(..., errmsg=err)
>> >
>> > If an error occurs, you get up to 10 characters of information.
>> > So, you need to provide a sufficiently long buffer if you expect
>> > a long error message.
>> >
>> > --
>> > Steve
>>
>>
>>
>> --
>>
>> Francisco José Pena Brage
>> Departamento de Matemática Aplicada
>> Facultade de Matemáticas. Campus Vida
>> 15782 Santiago de Compostela - Spain
>> Tel.: +34 8818 13194
>> Fax: +34 8818 13197
>> Email: fran(dot)pena(at)usc(dot)es
>> http://www.usc.es/ingmat
>
> --
> Steve



-- 

Francisco José Pena Brage
Departamento de Matemática Aplicada
Facultade de Matemáticas. Campus Vida
15782 Santiago de Compostela - Spain
Tel.: +34 8818 13194
Fax: +34 8818 13197
Email: fran(dot)pena(at)usc(dot)es
http://www.usc.es/ingmat



More information about the Fortran mailing list