Skip to content

Added workarounds for compilers with EDG frontend (LCC and Nvidia) - #3057

Merged
vitaut merged 4 commits into
fmtlib:masterfrom
phprus:edg-based-1
Aug 29, 2022
Merged

vitaut merged 4 commits into
fmtlib:masterfrom
phprus:edg-based-1

Conversation

@phprus

@phprus phprus commented Aug 25, 2022

Copy link
Copy Markdown
Contributor

Added workarounds for compilers with EDG frontend (LCC and Nvidia) that emulate GCC.

phprus added 4 commits August 27, 2022 12:20
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
…and compiler without std::is_constant_evaluated()

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
@vitaut

vitaut commented Aug 27, 2022

Copy link
Copy Markdown
Contributor

Thanks for the PR! Could you post errors that are being fixed for reference?

@phprus

phprus commented Aug 27, 2022

Copy link
Copy Markdown
Contributor Author

I have error messages in Russian. The error messages from the Nvidia compiler are the same.

  1. (LCC only)
lcc: ".../include/fmt/core.h", строка 289: предупреждение #3317: неизвестная опция "Og" директивы #pragma "GCC optimize" [-Wpragmas].
  1. (LCC and Nvidia)
lcc: ".../test/format-test.cc", строка 2154: ошибка fmtlib#28: выражение должно иметь константное значение

      static_assert(test_error<__VA_ARGS__>(fmt, error), "")
                    ^
 в раскрытие макроса "EXPECT_ERROR" на строке 2182
    EXPECT_ERROR("{:{}}", "width/precision is not integer", int, double);
    ^
lcc: ".../include/fmt/core.h", строка 759: примечание #2700: попытка доступа к просроченному хранилищу
      if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id]))
                                                                  ^

  1. (workaround for Nvidia in PR Disable non-type template args for nvhpc #3053)
lcc: ".../include/fmt/format.h", строка 4159: ошибка fmtlib#2500: шаблон литерального оператора должен иметь список параметров шаблона, эквивалентный "<char ...>"

  template <detail_exported::fixed_string Str> constexpr auto operator""_a() {
                                                              ^
  1. Inconsistency FMT_CONSTEXPR20 and test
lcc: ".../test/compile-test.cc", строка 327: ошибка fmtlib#2933:
          call to consteval функция
          "test_format<max_string_length,Char,Args...,<auto-1>>(auto, const Args &...) [где max_string_length=6UL, Char=char, Args=<bool>, <auto-1>=FMT_COMPILE_STRING]"
          did not produce a valid constant expression
    EXPECT_EQ("true ", test_format<6>(FMT_COMPILE("{:5}"), true));
                                     ^
 в раскрытие макроса "EXPECT_EQ" на строке 327

@phprus

phprus commented Aug 27, 2022

Copy link
Copy Markdown
Contributor Author

Update:
LCC - Successful build and tests (Debug and Release, C++14,17,20)
Nvidia compilers - Successful build, but some tests failed (float point formatting).

@phprus

phprus commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

Nvidia compilers error message for bug 2:
#3028 (comment)

Comment thread include/fmt/core.h

FMT_CONSTEXPR void check_dynamic_spec(int arg_id) {
detail::ignore_unused(arg_id);
#if !defined(__LCC__)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to exclude __NVCOMPILER here too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know.
My tests have shown that this set of ifdefs is sufficient for Nvidia, but I do not use the Nvidia compiler in production and do not know its specifics.

LCC supports is_constant_evaluated but Nvidia does not. Therefore, for Nvidia, disabling the test is enough.

This ifdef disables code for LCC, as there is an LCC specific bug (Internal compiler error).

LCC and Elbrus is my hobby, not production usage, but I have access to it for testing.

@vitaut
vitaut merged commit 33b4c33 into fmtlib:master Aug 29, 2022
@vitaut

vitaut commented Aug 29, 2022

Copy link
Copy Markdown
Contributor

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants