[Patch][Fortran] PR91253 fix continuation-line handling with -pre_include

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Patch][Fortran] PR91253 fix continuation-line handling with -pre_include

Tobias Burnus-3
This fixes the gfortran.dg/continuation_6.f fails testsuite fails with
newer GLIBC.

The continuation line handling assumes that the line number starts at 0
(→ continue_line) and then can be incremented, if needed.

The problem came up with -pre_include, which is used with newer GLIBC to
provide things like "!GCC$ builtin (cos) attributes simd (notinbranch)
if('x86_64')".

There, first the file math-vector-fortran.h file is loaded, then the
actual file. The 'continue_line' gets incremented for
math-vector-fortran.h but nothing resets it before parsing the actual
input file. For the 'include_stmt' function, the reset happens during
parsing – while for our case, this knowledge is only in the line
information, but on file change, 'continue_line' is not updated/reset.

I think the same issue can occur with #include, especially as one plays
with #line, but I have not actually tested it. Obviously, if one plays
around with #line during a continuation block, this check won't work
either. However, it should fix the most common occurrence.

Additionally, I have removed the ATTRIBUTE_UNUSED from get_file's
'reason' as it is used in the linemap_add call.

And I have moved the OpenMP/OpenACC comment before if openmp/openacc
condition, where in my opinion it belongs to.

OK for the trunk?

Tobias


continue.diff (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Patch][Fortran] PR91253 fix continuation-line handling with -pre_include

jerry DeLisle-3
On 11/7/19 12:41 PM, Tobias Burnus wrote:

> This fixes the gfortran.dg/continuation_6.f fails testsuite fails with newer GLIBC.
>
> The continuation line handling assumes that the line number starts at 0 (→
> continue_line) and then can be incremented, if needed.
>
> The problem came up with -pre_include, which is used with newer GLIBC to provide
> things like "!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')".
>
> There, first the file math-vector-fortran.h file is loaded, then the actual
> file. The 'continue_line' gets incremented for math-vector-fortran.h but nothing
> resets it before parsing the actual input file. For the 'include_stmt' function,
> the reset happens during parsing – while for our case, this knowledge is only in
> the line information, but on file change, 'continue_line' is not updated/reset.
>
> I think the same issue can occur with #include, especially as one plays with
> #line, but I have not actually tested it. Obviously, if one plays around with
> #line during a continuation block, this check won't work either. However, it
> should fix the most common occurrence.
>
> Additionally, I have removed the ATTRIBUTE_UNUSED from get_file's 'reason' as it
> is used in the linemap_add call.
>
> And I have moved the OpenMP/OpenACC comment before if openmp/openacc condition,
> where in my opinion it belongs to.
>
> OK for the trunk?
>
> Tobias
>

Yes, OK, thanks for patch.

Jerry