https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98011
Bug ID: 98011
Summary: [OpenACC] 'gcc/fortran/scanner.c:load_line' should
consider 'flag_openacc' in addition to 'flag_openmp'
(and vice versa?)?
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: openacc
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tschwinge at gcc dot gnu.org
CC: burnus at gcc dot gnu.org, jakub at gcc dot gnu.org
Target Milestone: ---
It's not obvious (to me, at least), why in 'gcc/fortran/scanner.c:load_line'
'flag_openmp' and 'flag_openacc' are handled differently:
/* For truncation and tab warnings, set seen_comment to false if one has
either an OpenMP or OpenACC directive - or a !GCC$ attribute. If
OpenMP is enabled, use '!$' as as conditional compilation sentinel
and OpenMP directive ('!$omp'). */
if (seen_comment && first_comment && flag_openmp && comment_ix + 1 == i
&& c == '$')
first_comment = seen_comment = false;
if (seen_comment && first_comment && comment_ix + 4 == i)
{
if (((*pbuf)[comment_ix+1] == 'g' || (*pbuf)[comment_ix+1] == 'G')
&& ((*pbuf)[comment_ix+2] == 'c' || (*pbuf)[comment_ix+2] == 'C')
&& ((*pbuf)[comment_ix+3] == 'c' || (*pbuf)[comment_ix+3] == 'C')
&& c == '$')
first_comment = seen_comment = false;
if (flag_openacc
&& (*pbuf)[comment_ix+1] == '$'
&& ((*pbuf)[comment_ix+2] == 'a' || (*pbuf)[comment_ix+2] == 'A')
&& ((*pbuf)[comment_ix+3] == 'c' || (*pbuf)[comment_ix+3] == 'C')
&& (c == 'c' || c == 'C'))
first_comment = seen_comment = false;
}
Shouldn't this also be handled vice versa?
If that indeed is meant to be different, then let's please add some "dummy
handling"/commentary to make this explicit, to show that we did consider this.