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

Missing warning on some cases of integer literal coercion #5728

Open
fairywreath opened this issue Dec 3, 2024 · 1 comment · May be fixed by #6510
Open

Missing warning on some cases of integer literal coercion #5728

fairywreath opened this issue Dec 3, 2024 · 1 comment · May be fixed by #6510
Assignees
Labels
goal:client support Feature or fix needed for a current slang user.

Comments

@fairywreath
Copy link
Contributor

fairywreath commented Dec 3, 2024

These properly give warnings:

    int x1 = 0xffffffffffff;
    int x2 = -9223372036854775807;
1.slang(36): warning 30081: implicit conversion from 'uint64_t' to 'int' is not recommended
    int x1 = 0xffffffffffff;
             ^~~~~~~~~~~~~~~
1.slang(38): warning 30081: implicit conversion from 'int64_t' to 'int' is not recommended
    int x2 = -9223372036854775807;
              ^~~~~~~~~~~~~~~~~~~

But these do not(note they are assigned to UINT64_MAX)

    int x3 = 18446744073709551615;
    int x4 = 0xFFFFFFFFFFFFFFFF;

This needs to be investigated and fixed.

@bmillsNV bmillsNV added this to the Q1 2025 (Winter) milestone Dec 5, 2024
@bmillsNV bmillsNV added the goal:client support Feature or fix needed for a current slang user. label Dec 5, 2024
@zlatinski zlatinski self-assigned this Feb 24, 2025
@jkwak-work
Copy link
Collaborator

It appears that I am getting a little different error message with ToT.

tests/compute/frem.slang(14): warning 30081: implicit conversion from 'int64_t' to 'int' is not recommended
    int x1 = 0xffffffffffff;
             ^~~~~~~~~~~~~~

tests/compute/frem.slang(15): warning 30081: implicit conversion from 'int64_t' to 'int' is not recommended
    int x2 = -9223372036854775807;
              ^~~~~~~~~~~~~~~~~~~

tests/compute/frem.slang(16): warning 39999: integer literal is too large to be represented in a signed integer type, interpreting as unsigned
    int x3 = 18446744073709551615;
             ^~~~~~~~~~~~~~~~~~~~

It sounds all correct.
Only problem I see is that x4 is not printing a warning.

@bmillsNV bmillsNV assigned jarcherNV and unassigned zlatinski Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:client support Feature or fix needed for a current slang user.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants