On 2 December 2014 at 07:50, Tobias Burnus <bur...@net-b.de> wrote:
> Hi Manuel,
>
> Manuel López-Ibáñez wrote:
>>
>> This patch actually does not touch linemap but I will appreciate
>> Dodji's comments about the approach. The problem is that in case of
>> long lines, the column hint of 120 might be too small, thus we do not
>> have enough locations within one line to point to a higher column
>> (like 132 in the testcase). Giving as column hint the length of the
>> line seems the right fix.
>> [...]
>> My fix here is to create a dummy location for line_len -1 (the last column
>> in the line). This forces the next map to start after this last column's
>> location.
>
>
> My feeling is that that doesn't work for
> -ffree-line-length-none/-ffixed-line-length-none. In that case,
> gfc_option.free_line_length == 0 and there is no limit to the number of
> characters per line. Thus, I fear that
>
>        b->location
> -       = linemap_line_start (line_table, current_file->line++, 120);
> +       = linemap_line_start (line_table, current_file->line++, line_len);
>
>
> might even set the line length to 0 - but I haven't checked. For all other
> values, it should work.

My understanding of this piece of code is that Fortran reads the whole
line into a buffer, and that line_len is the length of the line just
read. Am I wrong? If so, is there any way to compute the length of the
current line?

A small optimization would be to use all that information about
truncation limits to give a smaller column hint when possible, but
someone more knowledgeable in Fortran can do that as a follow-up. I
think setting it to the actual length line will fix the ICEs and only
waste a bit of memory if the lines are quite long.

Cheers,

Manuel.

Reply via email to