Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Aug 29, 2022

Conversation

phprus
Copy link
Contributor

@phprus phprus commented Aug 25, 2022

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

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
Copy link
Contributor

vitaut commented Aug 27, 2022

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

@phprus
Copy link
Contributor Author

phprus commented Aug 27, 2022

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
Copy link
Contributor Author

phprus commented Aug 27, 2022

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
Copy link
Contributor Author

phprus commented Aug 29, 2022

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

@@ -755,8 +755,11 @@ class compile_parse_context
using base::check_arg_id;

FMT_CONSTEXPR void check_dynamic_spec(int arg_id) {
detail::ignore_unused(arg_id);
#if !defined(__LCC__)
Copy link
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
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
Copy link
Contributor

vitaut commented Aug 29, 2022

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.

None yet

2 participants