diff --git a/Expression.pas b/Expression.pas index eb816bd..897c03a 100644 --- a/Expression.pas +++ b/Expression.pas @@ -3453,11 +3453,17 @@ var while tp <> nil do begin if tp^.middle <> nil then begin GenerateCode(tp^.middle); - if expressionType^.kind in [structType,unionType] then begin - if expressionType^.size & $FFFF8000 <> 0 then - Error(61); - Gen1t(pc_ldc, long(expressionType^.size).lsw, cgWord); - Gen0(pc_psh); + if expressionType^.kind in [structType,unionType,definedType] + then begin + tType := expressionType; + while tType^.kind = definedType do + tType := tType^.dType; + if tType^.kind in [structType,unionType] then begin + if tType^.size & $FFFF8000 <> 0 then + Error(61); + Gen1t(pc_ldc, long(tType^.size).lsw, cgWord); + Gen0(pc_psh); + end; {if} end; {if} if fmt <> fmt_none then begin new(tfp); diff --git a/cc.notes b/cc.notes index b8b7c6c..efd3583 100644 --- a/cc.notes +++ b/cc.notes @@ -1620,6 +1620,8 @@ If you use #pragma debug 0x0010 to enable stack check debug code, the compiler w 15. Native code peephole optimization might produce invalid code in some obscure circumstances where one element of a global or static array was decremented and then another element of the same array was accessed immediately thereafter. +16. When an expression of const- or volatile-qualified struct or union type was passed as a function parameter, incorrect code would be generated. This could lead to incorrect program behavior or crashes. + -- Bugs from C 2.1.1 B3 that have been fixed in C 2.2.0 --------------------- 1. There were various bugs that could cause incorrect code to be generated in certain cases. Some of these were specific to certain optimization passes, alone or in combination.