[dmd-internals] building dmd with the microsoft compiler

Rainer Schuetze r.sagitario at gmx.de
Mon Nov 14 00:08:32 PST 2011


Thanks.

My list was only a compilation of examples of errors, I was not 
expecting that they would be handled so fast (I hoped so for actual 
bugs). So there are some more:

backend\dt.c(213) : warning C4293: '>>' : shift count negative or too 
big, undefined behavior
backend\cod3.c(2025) : warning C4310: cast truncates constant value
backend\cod3.c(2734) : warning C4806: '^' : unsafe operation: no value 
of type 'bool' promoted to type 'int' can equal the given constant
backend\cod3.c(5171) : warning C4309: '=' : truncation of constant value
backend\cod2.c(1507) : warning C4806: '^' : unsafe operation: no value 
of type 'bool' promoted to type 'int' can equal the given constant
backend\cod2.c(3338) : warning C4293: '<<' : shift count negative or too 
big, undefined behavior
backend\cod1.c(2218) : warning C4309: 'initializing' : truncation of 
constant value
backend\cgxmm.c(405) : warning C4305: '=' : truncation from '__int64' to 
'targ_size_t'
backend\cgobj.c(510) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(1094) : warning C4309: 'initializing' : truncation of 
constant value
backend\cgobj.c(1217) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(1235) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(1317) : warning C4309: 'initializing' : truncation of 
constant value
backend\cgobj.c(1319) : warning C4309: 'initializing' : truncation of 
constant value
backend\cgobj.c(1320) : warning C4309: 'initializing' : truncation of 
constant value
backend\cgobj.c(1326) : warning C4309: 'initializing' : truncation of 
constant value
backend\cgobj.c(1490) : warning C4309: 'initializing' : truncation of 
constant value
backend\cgobj.c(2289) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(2318) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(2449) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(2455) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(2460) : warning C4309: '=' : truncation of constant value
backend\cgobj.c(2722) : warning C4309: '=' : truncation of constant value
backend\cg87.c(637) : warning C4305: 'initializing' : truncation from 
'double' to 'float'
backend\cg87.c(660) : warning C4309: 'initializing' : truncation of 
constant value
lexer.c(2356) : warning C4063: case '0' is not a valid value for switch 
of enum 'Lexer::number::FLAGS'
         lexer.c(1973) : see declaration of 'Lexer::number::FLAGS'
intrange.c(62) : warning C4804: '-' : unsafe use of type 'bool' in operation
intrange.c(240) : warning C4804: '-' : unsafe use of type 'bool' in 
operation
intrange.c(242) : warning C4804: '-' : unsafe use of type 'bool' in 
operation
iasm.c(4277) : warning C4063: case '229' is not a valid value for switch 
of enum 'TOK'
         lexer.h(42) : see declaration of 'TOK'
iasm.c(4566) : warning C4063: case '233' is not a valid value for switch 
of enum 'TOK'
         lexer.h(42) : see declaration of 'TOK'

On 13.11.2011 23:49, Walter Bright wrote:
>
>
> 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
>>
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
>



More information about the dmd-internals mailing list