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

            Bug ID: 91152
           Summary: endif-label error when using #pragma with
                    -fdirectives-only
           Product: gcc
           Version: 9.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpewhacker at gmail dot com
  Target Milestone: ---

Created attachment 46595
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46595&action=edit
test.c

When using "-E -fdirectives-only" some pragmas enclosed in #if blocks will
cause endif-labels warning and also fail to preprocess correctly (the pragma is
remove from the processed output).

The attached program source can demonstrate this behaviour as follows:

 $ gcc -DUSE_OPENMP -fopenmp -E -fdirectives-only -o preprocess.c test.c &&
grep "pragma omp" preprocess.c
 test.c:4:7: warning: extra tokens at end of #endif directive [-Wendif-labels]
     4 | #pragma omp threadprivate(state)
       |       ^

Note the lack of pragma in the pre-processed output


Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.1.1 20190503 (Red Hat 9.1.1-1) (GCC)

Reply via email to