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

    <tr>
        <th>Summary</th>
        <td>
            flang 15 fails to build on i386 with `error: non-constant-expression cannot be narrowed from type 'long long' to 'std::size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          sylvestre
      </td>
    </tr>
</table>

<pre>
    On Debian unstable:
```

/<<PKGBUILDDIR>>/build-llvm/./bin/clang++ -DFLANG_LITTLE_ENDIAN=1 -DFLANG_VENDOR="\"Debian \"" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/flang/lib/Evaluate -I/<<PKGBUILDDIR>>/flang/lib/Evaluate -I/<<PKGBUILDDIR>>/flang/include -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/flang/include -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/include -I/<<PKGBUILDDIR>>/llvm/include -isystem /<<PKGBUILDDIR>>/llvm/../mlir/include -isystem /<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/mlir/include -isystem /<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/clang/include -isystem /<<PKGBUILDDIR>>/llvm/../clang/include -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -ffile-prefix-map=/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -ffile-prefix-map=/<<PKGBUILDDIR>>/= -no-canonical-prefixes -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -std=c++17 -MD -MT tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o -MF tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o.d -o tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o -c /<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp
/<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp:296:30: error: non-constant-expression cannot be narrowed from type 'long long' to 'std::size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
    std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp:367:1: note: in instantiation of member function 'Fortran::evaluate::Constant<Fortran::evaluate::Type<TypeCategory::Character, 1>>::CopyFrom' requested here
INSTANTIATE_CONSTANT_TEMPLATES
^
/<<PKGBUILDDIR>>/flang/include/flang/Evaluate/constant.h:239:42: note: expanded from macro 'INSTANTIATE_CONSTANT_TEMPLATES'
 FOR_EACH_INTRINSIC_KIND(template class Constant, )
 ^
/<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp:296:30: note: insert an explicit cast to silence this issue
    std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 static_cast<size_t>(                  )
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUV0tv4zgS_jX0haBhk34efJAlK2tMYjcc9wZ7MiiqJHOaIjUklcRz2N--oKQ8drq3k-x0L3YEQQKrilXFrx4qcedkqQFWaLpG02TAG382duUu6h6ctzDITH5Z7TVOIJNc40Y7zzMFiEVolKBRhGaj_u6W3ZOmiMWIxZ9-uVp_3l4nyfaA2CbcNM0aqXKi1H2FaDoMBKkRTYXiukR0jegakyS9jnZXp-vt8Xi9OW12yTbaIZaMnzl_3-yS_QGxBFGKpjGitHewWyBKMUlO6fZ6c9qn6e3meFpvj7eIJbNJYFztPp9u958P8SasrqPD1aaVfaGdbo9JfIr3u9tjtDuebqL4sL99YaT7w030Nfl6e7N9oW7fj4M3RrkXFFLneQmUZFK7V9yi5yqZIZpu7rlquIe3DP25XVIL1eRviv-J0_x4C-_U2Ot6lpbu4jxU-D2bhiFzKyXthxX8F0j9r-yIP0bkw4h8paFwnosvpLbGg_DGEuet0SUmd4WxFfeY3IG1xiKWdATiQDRW-gsmd9qQRjcOciJMVXGdEyU1EG7LpgId9ubcA_Gygrbc94fjNv1HX8WIJRST4tM2xqTQhjiouPZSEKk92No46aXRmBT30slMKukvROpgwJGzzHPQr3x7ZeeZ1uiy4TaHnPB7LhXvdWh4wOSOKxVEH73l_3aQmltegQeLyd2DlR4CIFKXDpM7wZ0nvzU87Kykc1KXpJCgciK19JIr-TtYh0kNeXuSTrEyumwfQUPXQJeLAFjNPWkdCEeXmNzJqlZSSE8KrpQ_W9OU57DJ3IOFnLgH6cWZ5FDwRvlOuTbwKKD2xF9qaEma3EvrG65I7k04RQ4KPJBvcFxTluA8CfqtDNlw1x2WCKPvwboW_3BUBTwPdKlz0J73gcklL7VxXgpHhFFBZ1E0WgR2SJPwdkGOe_56XUgFpLZQyEdS8br9SvyIQmHJe0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