https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81687

            Bug ID: 81687
           Summary: Compiler drops label in OpenMP region
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: protze at itc dot rwth-aachen.de
  Target Milestone: ---

Created attachment 41911
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41911&action=edit
stripped down reproducer

The issue was reproduced on these systems / compilers:
- CENTOS 7.3 / x86_64:
  - gcc-Version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) 
  - gcc-Version 5.3.0 (GCC)
  - gcc-Version 6.2.0 (GCC)
  - gcc-Version 7.1.0 (GCC)
- Ubuntu 17.04 / x86_64:
  - gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)

Compiling attached code with OpenMP flag, the compiler drops the label and
therefore the linker cannot reference the label:

$ gcc -fopenmp label-test.c
/tmp/pj416018/cluster-hpc_5730/cc0vHR78.o: In function `main._omp_fn.0':
test.c:(.text+0x31): undefined reference to `.L4'

Looking into the pre-assembly (-S), the label .L4 is missing when compiling
with OpenMP flag, while $.L4 is used in a movl instruction. The label is there
when compiling without OpenMP flag.

Introducing more instructions before/after the label or referencing the label
using goto does not change the situation. Optimization only changes the name of
the label, but the label is missing in all cases.

Reply via email to