Skip to content

Conversation

@am11
Copy link
Member

@am11 am11 commented Aug 5, 2023

Warnings are of the form:

warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]

reported on linux-x64 build (with cc: clang 17 rc1).

@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-VM-meta-mono labels Aug 5, 2023
@vargaz
Copy link
Contributor

vargaz commented Aug 6, 2023

Looks ok, but the new types should be consistent, i.e. use guint everywhere.

@am11
Copy link
Member Author

am11 commented Aug 6, 2023

i.e. use guint everywhere.

I've followed the type nearby code was preferring. e.g. jit-info.h has number of existing bitfields using guint32.

@vargaz vargaz merged commit c686f8a into dotnet:main Aug 6, 2023
1. For the special anonymous containers kept by MonoImage.
2. When user code creates a generic parameter via SRE, but has not yet set an owner. */
int is_anonymous : 1;
gint is_anonymous : 1;
Copy link
Member

Choose a reason for hiding this comment

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

@am11 these still raise the warning in main, should this have been guint?

/__w/1/s/src/mono/mono/metadata/sre.c:1626:33: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
                          generic_container->is_method = TRUE;
                                                       ^ ~~~~
  /__w/1/s/src/mono/mono/metadata/sre.c:1631:36: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
                          generic_container->is_anonymous = TRUE;
                                                          ^ ~~~~

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, yes guint is correct.

akoeplinger added a commit to akoeplinger/runtime that referenced this pull request Aug 30, 2023
It was supposed to be fixed in dotnet#90068 but we should've used `guint` for the one-bit bitfield.
akoeplinger added a commit that referenced this pull request Aug 30, 2023
It was supposed to be fixed in #90068 but we should've used `guint` for the one-bit bitfield.
@ghost ghost locked as resolved and limited conversation to collaborators Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-VM-meta-mono 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