[Patch, libgfortran] PR59700 and PR59764 Misleading/buggy runtime error message

Jerry DeLisle jvdelisle@charter.net
Sat Jan 11 17:27:00 GMT 2014

My apologies please.  I forgot to mention Dominiq for his superb assistance with
this patch and testing. Many thanks!

On 01/11/2014 09:13 AM, Jerry DeLisle wrote:
> The attached patch fixes both these bugs, combining Steve's patch and mine.
> Recent fixes of memory leaks placed the free_line before the generation of the
> error messages rather than after,  The item_count which identifies the read list
> item involved with the error was getting cleared, resulting in a faulty error
> message.  This is fixed by moving the free_line location to after the message
> string is created (before issuing the error still).
> The second issue is the variable item_count was being used for two separate
> purposes and collided in the case of read_logical.  This was a known issue from
> several years ago. Fixed by adjusting the dtp structure just a bit. I used a
> spare bit for the expanded_read flag and then used the integer slot made
> available for a new variable line_buffer_pos. The new variable name is an
> accurate description of what it does, not confused with "item_count".
> Regression tested on x86-64.
> OK for trunk?  I will add the test case from PR59700 to the test suite.
> Regards,
> Jerry
> 2014-01-10  Jerry DeLisle  <jvdelisle@gcc.gnu>
> 	    Steven G. Kargl  <kargl@gcc.gnu.org>
> 	PR libfortran/59700
> 	PR libfortran/59764
> 	* io/io.h (struct st_parameter_dt): Assign expanded_read flag to
> 	unused bit. Define new variable line_buffer_pos.
> 	* io/list_read.c (free_saved, next_char, l_push_char,
> 	read_logical, read_real): Replace use of item_count with
> 	line_buffer_pos for line_buffer look ahead.
> 	(read_logical, read_integer, parse_real, read_real, check_type):
> 	Adjust location of free_line to after generating error messages
> 	to retain the correct item count for the message.

More information about the Gcc-patches mailing list