<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63723>63723</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] Error of the conditional compilation with an empty statement
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          yus3710-fj
      </td>
    </tr>
</table>

<pre>
    This is an issue from Fujitsu testsuite.

Flang-new terminates abnormally when compiling the conditional compilation sentinel with an empty statement.  
According to [the document of OpenMP 5.0](https://www.openmp.org/spec-html/5.0/openmpsu24.html#x40-470002.2.2), the sentinel should be replaced by two spaces in this case.

The following are the test program, Flang-new and gfortran compilation result.

```fortran
! test.f90
!$ 
print *,'pass'
end
```
```console
$ flang-new -v -fopenmp test.f90 
flang-new version 17.0.0 (https://github.com/llvm/llvm-project.git 289828b1c0a6bc6eed8a634376a5152adae2283b)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/install/bin
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/8
Selected GCC installation: /usr/lib/gcc/aarch64-redhat-linux/8
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/path/to/install/bin/flang-new" -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenmp -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +neon -target-feature +v8a -o /tmp/test-03cb8d.o -x f95-cpp-input test.f90
/path/to/gcc/11.2.0/include/c++/11.2.0/bits/stl_vector.h:1063: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::const_reference = const char&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__n < this->size()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /path/to/install/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenmp -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +neon -target-feature +v8a -o /tmp/test-03cb8d.o -x f95-cpp-input test.f90
 #0 0x0000ffff977afc70 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/path/to/install/bin/../lib/libLLVMSupport.so.17git+0x19fc70)
 #1 0x0000ffff977add50 llvm::sys::RunSignalHandlers() (/path/to/install/bin/../lib/libLLVMSupport.so.17git+0x19dd50)
 #2 0x0000ffff977adec0 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000ffff991f066c (linux-vdso.so.1+0x66c)
 #4 0x0000ffff97192dbc raise (/lib64/libc.so.6+0x32dbc)
 #5 0x0000ffff97180928 abort (/lib64/libc.so.6+0x20928)
 #6 0x0000ffff928648c0 std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<std::__detail::__variant::__variant_idx_cookie (*)(std::__detail::__variant::_Move_assign_base<false, Fortran::parser::NullInit, Fortran::parser::Name>::operator=(std::__detail::__variant::_Move_assign_base<false, Fortran::parser::NullInit, Fortran::parser::Name>&&)::'lambda'(auto&&, auto)&&, std::variant<Fortran::parser::NullInit, Fortran::parser::Name>&)>, std::integer_sequence<unsigned long, 0ul>>::__visit_invoke(std::__detail::__variant::_Move_assign_base<false, Fortran::parser::NullInit, Fortran::parser::Name>::operator=(std::__detail::__variant::_Move_assign_base<false, Fortran::parser::NullInit, Fortran::parser::Name>&&)::'lambda'(auto&&, auto)&&, std::variant<Fortran::parser::NullInit, Fortran::parser::Name>&) (/path/to/install/bin/../lib/../lib/libFortranParser.so.17git+0x848c0)
 #7 0x0000ffff92a2d1ec Fortran::parser::Prescanner::Statement() (/path/to/install/bin/../lib/../lib/libFortranParser.so.17git+0x24d1ec)
 #8 0x0000ffff92a2b9d0 Fortran::parser::Prescanner::Prescan(Fortran::common::Interval<Fortran::parser::Provenance>) (/path/to/install/bin/../lib/../lib/libFortranParser.so.17git+0x24b9d0)
 #9 0x0000ffff92a17458 Fortran::parser::Parsing::Prescan(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Fortran::parser::Options) (/path/to/install/bin/../lib/../lib/libFortranParser.so.17git+0x237458)
#10 0x0000ffff9839126c Fortran::frontend::FrontendAction::runPrescan() (/path/to/install/bin/../lib/libflangFrontend.so.17git+0x5126c)
#11 0x0000ffff9845699c Fortran::frontend::CodeGenAction::beginSourceFileAction() (/path/to/install/bin/../lib/libflangFrontend.so.17git+0x11699c)
#12 0x0000ffff98392150 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/path/to/install/bin/../lib/libflangFrontend.so.17git+0x52150)
#13 0x0000ffff98383310 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/path/to/install/bin/../lib/libflangFrontend.so.17git+0x43310)
#14 0x0000ffff988c30a8 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/path/to/install/bin/../lib/libflangFrontendTool.so.17git+0x30a8)
#15 0x0000000000406170 fc1_main(llvm::ArrayRef<char const*>, char const*) (/path/to/install/bin/flang-new+0x406170)
#16 0x0000000000403524 main (/path/to/install/bin/flang-new+0x403524)
#17 0x0000ffff97180d64 __libc_start_main (/lib64/libc.so.6+0x20d64)
#18 0x00000000004039c0 _start (/path/to/install/bin/flang-new+0x4039c0)
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
Fujitsu flang-new version 17.0.0 (https://github.com/llvm/llvm-project.git 289828b1c0a6bc6eed8a634376a5152adae2283b)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/install/bin
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: note: diagnostic msg: Error generating preprocessed source(s).
```
```console
$ gfortran -v -fopenmp test.f90 
Driving: gfortran -v -fopenmp test.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/8/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,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 --disable-libmpx --enable-gnu-indirect-function --build=aarch64-redhat-linux
Thread model: posix
gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC) 
 :
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWltv27jy_zTMC0FBomxZesiD48S7Bbr_Bm3-5zwKFDWS2VKklqScZD_9ASn5Im-Tpj1dYIE9RZqYt5nfXDjDIc2sFa0CuEbLG7S8vWKD22lz_TzYdJXEpPl8Ven6-fphJywWFjOFhbUD4MboDm-Hz8LZATuwzg7CQYTiWxSvx99byVRLFDxiB6YTijmwmFVKm45J-Ywfd6Aw110vpFAtdjvAXKtaOKEVk9MI8y1sQTmhQOJH4XYeBHS9e8bWMQcdKBdhPPJcc65NHchpjJY3nmit-eAnYd3gDz2o3-7xMorR8hbRfOdcb1G6RnSL6Pbx8THSPaiuj7RpEd3aHjjZuU4iuvVr6HYctgNdRGN_-rSIyWIVxzGNaEQRLRDdBGGOoO1OD7LGFWADvWQcalw9Y_eose0ZB4uFws4rmDM7V-HDDnCjpdSPXiRmIBD26sa90a1hnWd2UjRTNW4bbZxhaqZAA3aQbkYbZfH4M82femkS6EdNER97EF1M-u2NUA4jukZ0g-iqZ9Yi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