<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54478>54478</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][OpenMP][omp2012] Failure in Fortran::evaluate::ToInt64 while building omp2012
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
NimishMishra
</td>
</tr>
</table>
<pre>
**Note**: This issue can be reproduced from the monorepo once the upstream from [fir-dev](https://github.com/flang-compiler/f18-llvm-project/tree/fir-dev) has matured. The actual issue came up while building omp2012 with the current state of LLVM flang (lowering enabled)
The following reduced source code dumps core with `flang-new -fopenmp -c -o rtc04.o rtc04.f`
```
! FAIL: flang-new -fopenmp -c -o rtc04.o rtc04.f
PROGRAM rtc04
INTEGER i2, num_threads
!$omp do ordered schedule(static)
!$ do i2=1,num_threads
!$ end do
END PROGRAM
```
Core dumps as
```
./rtc04.f:3:1: warning: Character in fixed-form label field must be a digit
PROGRAM rtc04
^
./rtc04.f:4:3: warning: Character in fixed-form label field must be a digit
INTEGER i2, num_threads
^
./rtc04.f:9:1: warning: Character in fixed-form label field must be a digit
END PROGRAM
^
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /f18-llvm-project/install/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -fopenmp -o rtc04.o rtc04.f
#0 0x000056355b588ef4 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x000056355b58660e SignalHandler(int) Signals.cpp:0:0
#2 0x00007f31471593c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)
#3 0x000056355c4c0648 Fortran::evaluate::ToInt64(Fortran::evaluate::Expr<Fortran::evaluate::SomeType> const&) (/f18-llvm-project/install/bin/flang-new+0x41a2648)
#4 0x000056355bf3480c genOMP(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Evaluation&, Fortran::parser::OpenMPLoopConstruct const&) OpenMP.cpp:0:0
#5 0x000056355bf2f070 Fortran::lower::genOpenMPConstruct(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Evaluation&, Fortran::parser::OpenMPConstruct const&) (/f18-llvm-project/install/bin/flang-new+0x3c11070)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVktv4zgM_jXOhXAgP-McckjTdLZAX2iLuRayJceasSVDkpvOv1_KStKmk7a7izms4YceFPnxI0WrVOzXIoiXeN8oy30rSJbw2AgDwpiBQ0UllBw077ViQ8UZ1Fp1YBsOnZIKxxUoWfFxZOiN1Zx2XibIzmqhQ8afg-w8iIvG2t6g-iC-wHsjbDOU00p12KlbKjchtnvRcu0GoiJs2-cuRLM_eGVxCDVzN7NTGc-hoQY6agfN2RQxc6CVHWh7QN45RLBtUCeUg2iZkBtAGzGJYtii_RF0NWjNpQVjqeWgari6-n4NIyJA1K3acu0WcknLljM0HJDzgCz925mtVYtSTgaRjBwZNWjkpFKMAxu63mBTc28zyIl3V_IthLXquex6CCsIFWhbkXS6_9Yo-taW6_rbd-MILpaXVy5i_1jjuPLu_vbb_fLaD_ohgMubx_W39T2IOIhXIIfuyTYYTGZ2AgejQZwiicAw8Jpx7dytGnS8xfAUjkVRvZI0ioO_cAUqT85xaPWb_iNJLhlK-4n1zTnsAJ-mYXyvHL-eamo-IW2KKbTnIlkm-ESOvy3VEgPomquGakwkrkFIqMULZ0ip7qClJW9xgLcMusFYty0oMIGJvKfwJK9Btj5lOt2Z_0Omv44ffAhl_mdZ-C1gbwzfXa2XD2swQ9kJiwvLwW2aXmkLVsFxhcA5M3VFYKr0BvtAMSuErNqB-XJTaWoaKGn10yJWPvUmHiwOjKngNI1DBKfmd1ptNNYmqjdDhxveGYLTpUZITOO2dRiEPJQnv7uqCEKrRY815aXIn_I0HORPqbYybIUcXsKNHCDk6F2oyh9vduMHWxERJATIC8Ery5MsK7Oi4HUKd1h07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