------- Comment #17 from ebotcazou at gcc dot gnu dot org 2006-01-22 11:43 ------- > No real solution as of this writing, only a poor workaround: not compiling the > support files with -gnato (overflow checks).
Well, I may have spoken too soon. :-) We are calling Remove_Side_Effects on: N_Type_Conversion (Node_Id=1679) (analyzed) Rewritten: original node = N_Op_Add "Oadd" (Node_Id=39499) Parent = N_Range (Node_Id=1681) Sloc = 7611 fdd2a00.adb:6:38 Etype = N_Defining_Identifier "Tstream_element_offsetB" (Entity_Id=2017) Subtype_Mark = N_Identifier "Tstream_element_offsetB" (Node_Id=39497) Expression = N_Function_Call (Node_Id=39496) Conversion_OK = True It turns out that the fix is already present in the front-end, but inhibited: -- If this is a type conversion, leave the type conversion and remove -- the side effects in the expression. This is important in several -- circumstances: for change of representations, and also when this -- is a view conversion to a smaller object, where gigi can end up -- creating its own temporary of the wrong size. -- ??? this transformation is inhibited for elementary types that are -- not involved in a change of representation because it causes -- regressions that are not fully understood yet. elsif Nkind (Exp) = N_Type_Conversion and then (not Is_Elementary_Type (Underlying_Type (Exp_Type)) or else Nkind (Parent (Exp)) = N_Assignment_Statement) then Remove_Side_Effects (Expression (Exp), Name_Req, Variable_Ref); Scope_Suppress := Svg_Suppress; return; However, another possible fix is to make a copy when we know we will not be able to use a renaming. Tentative patch to be attached. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18819