[Patch, libfortran] PR45629 Get rid of setjmp/longjmp in the IO library

Janne Blomqvist blomqvist.janne@gmail.com
Tue Nov 2 08:35:00 GMT 2010


Huh, accidentally hit the send button... continuing where I left off.

On Tue, Nov 2, 2010 at 10:27, Janne Blomqvist <blomqvist.janne@gmail.com> wrote:
> On Tue, Nov 2, 2010 at 05:27, Jerry DeLisle <jvdelisle@frontier.com> wrote:
>> On 11/01/2010 04:30 PM, Janne Blomqvist wrote:
>>>
>>> Hi,
>>>
>>> the attached patch gets rid of the setjmp()/longjmp() based EOF
>>> handling in list directed reads. It also fixes PR 45629.
>>>
>>> Tested on x86_64-unknown-linux-gnu, Ok for trunk?  I understand stage
>>> 1 just ended, and as EOF handling has been a rich source of tricky
>>> bugs in the IO library, I'm perfectly Ok with postponing this until
>>> 4.7.
>>
>> Overall I like the patch.
>>
>> I am concerned about the changes to st_parameter_dt.  To be on the safe side
>> I wonder if you should do something like this?  (Maybe I worry too much.  ;)
>> )
>
> Yes, I think you worry too much in this case. The part of
> st_parameter_dt I have modified is never touched by the frontend, the
> frontend just allocates space on the stack for the library to use. A
> condensed version is

struct st_parameter_dt
{
    // stuff
  union
    {
      struct
        {
           // private part of struct, including last_char and jmp_buf
        } p;
      /* This pad size must be equal to the pad_size declared in
         trans-io.c (gfc_build_io_library_fndecls).  The above structure
         must be smaller or equal to this array.  */
      char pad[16 * sizeof (char *) + 32 * sizeof (int)];
    } u;
    // some more stuff
}

That is, as long as the "p" struct is smaller than the array "pad", no
worries. My patch does actually reduce the size of the "p" struct;
changing last_char to int increases the size by 3 bytes, but removing
the jmp_buf pointer reduces it by 4 or 8 bytes + possible alignment
changes.

>> Otherwise patch is OK.

Thanks for the review. Do you agree with Steve that it's Ok to commit
it now and we have time to fix any issues before release?


-- 
Janne Blomqvist



More information about the Fortran mailing list