https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122369
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> That's a reduced example from SPECaccel v2021's 463.swim.
Correction: It is SPECaccel 2023.
* * *
The program below of comment 0 has a single namespace - but for some reasons
three statement labels – I note in particular, that they belong to omp_region =
0, 1, and 2.
Namely:
(gdb) p *ns->st_labels
$16 = {priority = 19041, left = 0x3593050, right = 0x0, value = 366, defined =
ST_LABEL_FORMAT, referenced = ST_LABEL_UNKNOWN, format = 0x3593a00,
backend_decl = 0x0, where = {nextc = 0x35059e0,
u = {lb = 0x35059b0, location = 55597488}}, ns = 0x358ae40, omp_region = 0}
This has the location:
12 | 366 FORMAT(/, ' Vcheck = ',E12.4,/)
| 1
(gdb) p *ns->st_labels->left
$17 = {priority = 3862, left = 0x0, right = 0x35918e0, value = 366, defined =
ST_LABEL_UNKNOWN, referenced = ST_LABEL_FORMAT, format = 0x0, backend_decl =
0x0, where = {nextc = 0x3584e14, u = {
lb = 0x3584db0, location = 56118704}}, ns = 0x358ae40, omp_region = 2}
(gdb) p *ns->st_labels->left->right
$18 = {priority = 1543, left = 0x0, right = 0x0, value = 366, defined =
ST_LABEL_UNKNOWN, referenced = ST_LABEL_FORMAT, format = 0x0, backend_decl =
0x0, where = {nextc = 0x3584e14, u = {
lb = 0x3584db0, location = 56118704}}, ns = 0x358ae40, omp_region = 1}
These have the location:
11 | WRITE(6,366) PCHECK, UCHECK, VCHECK
| 1
EXPECTED: A single statement label – especially as the "WRITE" should already
be outside of the OpenMP region...
The code is generated via symbol.cc's
/* Given a label number, search for and return a pointer to the label
structure, creating it if it does not exist. */
gfc_st_label *
gfc_get_st_label (int labelno)
{
gfc_st_label *lp;
gfc_namespace *ns;
int omp_region = (gfc_in_omp_metadirective_body
? gfc_omp_metadirective_region_count : 0);
And the problem seems to be that 'gfc_in_omp_metadirective_body' is still
(wrongly) true – causing it being created with omp_region != 0.