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

valid code emitting W106 since commit 68003b0cdb #1049

Closed
sezero opened this issue Feb 18, 2023 · 5 comments
Closed

valid code emitting W106 since commit 68003b0cdb #1049

sezero opened this issue Feb 18, 2023 · 5 comments
Labels
bug C C compiler

Comments

@sezero
Copy link
Contributor

sezero commented Feb 18, 2023

Since commit 68003b0, valid code like below emits W106 warning:

/* minimal reproducer */
#include <stdint.h>
typedef enum
{
    SDL_FALSE = 0,
    SDL_TRUE = 1
} SDL_bool;
typedef int64_t Sint64;
typedef uint64_t Uint64;

extern Sint64
SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);

void foo (void) {
    SDLTest_RandomSint64BoundaryValue(INT64_MIN, 99, SDL_FALSE);
    SDLTest_RandomSint64BoundaryValue(INT64_MIN + 1, INT64_MAX, SDL_FALSE);
    SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX - 1, SDL_FALSE);
    SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX, SDL_FALSE);
}
wcc386 -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -wx -wcd=303 -fo=1.obj 1.c
1.c(14): Warning! W106: Parameter 1: Constant out of range - truncated
1.c(14): Note! N2003: source conversion type is '__int64'
1.c(14): Note! N2004: target conversion type is '__int64'
1.c(15): Warning! W106: Parameter 1: Constant out of range - truncated
1.c(15): Note! N2003: source conversion type is '__int64'
1.c(15): Note! N2004: target conversion type is '__int64'
1.c(15): Warning! W106: Parameter 2: Constant out of range - truncated
1.c(15): Note! N2003: source conversion type is '__int64'
1.c(15): Note! N2004: target conversion type is '__int64'
1.c(16): Warning! W106: Parameter 1: Constant out of range - truncated
1.c(16): Note! N2003: source conversion type is '__int64'
1.c(16): Note! N2004: target conversion type is '__int64'
1.c(16): Warning! W106: Parameter 2: Constant out of range - truncated
1.c(16): Note! N2003: source conversion type is '__int64'
1.c(16): Note! N2004: target conversion type is '__int64'
1.c(17): Warning! W106: Parameter 1: Constant out of range - truncated
1.c(17): Note! N2003: source conversion type is '__int64'
1.c(17): Note! N2004: target conversion type is '__int64'
1.c(17): Warning! W106: Parameter 2: Constant out of range - truncated
1.c(17): Note! N2003: source conversion type is '__int64'
1.c(17): Note! N2004: target conversion type is '__int64'

The minimal reproducer above is abstracted from SDL, and it causes build
errors in github CI runners in the SDL2 branch due to our use of -we .

@sezero
Copy link
Contributor Author

sezero commented Feb 18, 2023

Note that the asm output is actually the same (as seen by wdis -a) across the
different ow versions. Only the latest ow is emitting a warning, which is bogus
as far as I can see.

@jmalak jmalak added bug C C compiler labels Feb 18, 2023
@jmalak
Copy link
Member

jmalak commented Feb 18, 2023

Thanks for your bug report. I will review last change, probably some mistake.
I will add some test code for 64-bit constants, because existing reggression tests include only 32-bit cases.

As workaround you can use -wcd=106 C compiler option.

@jmalak
Copy link
Member

jmalak commented Feb 19, 2023

Now it should be fixed.
Please recheck.

@sezero
Copy link
Contributor Author

sezero commented Feb 19, 2023

Now it should be fixed. Please recheck.

Thanks -- Will test as soon as a CI build is available.

@sezero
Copy link
Contributor Author

sezero commented Feb 19, 2023

As of Last-CI-build from 5e8ab30 the warnings do not appear. Thanks.

Closing the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug C C compiler
Projects
None yet
Development

No branches or pull requests

2 participants