[dmd-internals] building dmd with the microsoft compiler
Walter Bright
walter at digitalmars.com
Sun Nov 13 14:49:50 PST 2011
On 11/13/2011 8:42 AM, Rainer Schuetze wrote:
>
>
>
> - I did not figure out what's wrong with this, but it sounds dangerous:
> RTLSYMS
> .\backend\rtlsym.c(95) : warning C4806: '|' : unsafe operation: no value of
> type 'bool' promoted to type 'int' can equal the given constant
> .\backend\rtlsym.c(95) : warning C4554: '|' : check operator precedence for
> possible error; use parentheses to clarify precedence
bug
>
> - probably false positives regarding calculations with bools like:
> i ^= d1 > d2;
> .\backend\evalu8.c(1667) : warning C4805: '^=' : unsafe mix of type 'int' and
> type 'bool' in operation
spurious, but fixed anyway
> return (x - sign) ^ -sign;
> .\intrange.c(24) : warning C4804: '-' : unsafe use of type 'bool' in operation
spurious, but fixed anyway
>
> - lots of "truncation of constant value", which are more unsigned -> signed
> conversion
> static char nops[7] = { 0x90,0x90,0x90,0x90,0x90,0x90,0x90 };
> .\backend\cod3.c(324) : warning C4309: 'initializing' : truncation of constant
> value
>
latent bug
> - but this seems problematic, because the array value is later used as an
> index assumed positive
> static char invconvtab[] = { .... OPd_ld, ... };
> .\backend\cgelem.c(377) : warning C4305: 'initializing' : truncation from
> 'OPER' to 'char'
> .\backend\cgelem.c(377) : warning C4309: 'initializing' : truncation of
> constant value
latent bug
>
> - too large shift count:
> value |= value << 32;
> .\backend\cod2.c(3312) : warning C4293: '<<' : shift count negative or too
> big, undefined behavior
it works, but fixed anyway
>
> - the following looks actually like a bug:
> if (!config.flags4 & CFG4optimized)
> .\backend\cgreg.c(53) : warning C4806: '&' : unsafe operation: no value of
> type 'bool' promoted to type 'int' can equal the given constant
bug
>
> - this is probably another bug:
> if (sc->func && !((TypeFunction *)t1)->trust <= TRUSTsystem)
> .\expression.c(7680) : warning C4804: '<=' : unsafe use of type 'bool' in
> operation
bug
>
> - switch on enumerators with values not part of the enumeration:
> .\iasm.c(4053) : warning C4063: case '237' is not a valid value for switch of
> enum 'TOK'
spurious, but fixed anyway
>
> - lots of warnings regarding unreachable code, mostly due to preprocessor
> conditionals
>
More information about the dmd-internals
mailing list