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

Enable building with gcc-14 #101623

Merged
merged 5 commits into from
May 13, 2024
Merged

Conversation

am11
Copy link
Member

@am11 am11 commented Apr 26, 2024

No description provided.

@am11 am11 requested a review from MichalStrehovsky as a code owner April 26, 2024 20:06
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 26, 2024
Copy link
Contributor

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

@am11
Copy link
Member Author

am11 commented May 13, 2024

Updated gcc pipeline. gcc14 was picked up in the CI:

  -- The C compiler identification is GNU 14.1.0
  -- The CXX compiler identification is GNU 14.1.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/gcc-14 - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/g++-14 - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done

@jkoritzinsky jkoritzinsky merged commit a2d23a9 into dotnet:main May 13, 2024
150 checks passed
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
@kunalspathak
Copy link
Member

@am11 - did you run into any compilation issues with gcc-14 that does not repro on gcc-12. E.g. https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_apis/build/builds/706791/logs/284.

It is not liking the presence of if/else inside constexpr method. If I remove the if-else, things work fine. Any thoughts?

    static constexpr regMaskTP CreateFromRegNum(const regNumber reg, regMaskSmall mask)
    {
#ifdef HAS_MORE_THAN_64_REGISTERS
        if (reg < 64)
        {
        }
        else
        {
        }
        return regMaskTP(mask, RBM_NONE);
#else
        return regMaskTP(mask, RBM_NONE);
#endif
    }

@am11
Copy link
Member Author

am11 commented Jun 14, 2024

It's pedantically requiring single return for std=c++11 conformance:

static constexpr regMaskTP CreateFromRegNum(regNumber reg, regMaskSmall mask)
{
#ifdef HAS_MORE_THAN_64_REGISTERS
    return (reg < 64) ? regMaskTP(mask, RBM_NONE) : regMaskTP(RBM_NONE, mask);
#else
    return regMaskTP(mask, RBM_NONE);
#endif
}

(with std=c++14, if/else works)

C++11 page 140: https://open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf

— its function-body shall be = delete, = default, or a compound-statement that contains only
  — null statements,
  — static_assert-declarations
  — typedef declarations and alias-declarations that do not define classes or enumerations,
  — using-declarations,
  — using-directives,
  — and exactly one return statement;

C++14 page 155: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf

—(3.4) its function-body shall be = delete, = default, or a compound-statement that does not contain
  —(3.4.1) an asm-definition,
  —(3.4.2) a goto statement,
  —(3.4.3) a try-block, or
  —(3.4.4) a definition of a variable of non-literal type or of static or thread storage duration or for which
  no initialization is performed.

@am11 am11 deleted the feature/build/gcc-14 branch June 14, 2024 07:58
@kunalspathak
Copy link
Member

(with std=c++14, if/else works)

hhm, how can i make my code work then in current scenario where we are on gcc-14 and in std=c++11 conformance?

@am11
Copy link
Member Author

am11 commented Jun 14, 2024

Have you tried the code provided above?

@kunalspathak
Copy link
Member

Have you tried the code provided above?

sorry, earlier I missed that piece and was just staring at c++14 and c++11 conformance. Your suggestion works :)

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants