@@ -1088,15 +1088,31 @@ private module GetConvertedResultExpression {
10881088 }
10891089
10901090 private Expr getConvertedResultExpressionImpl0 ( Instruction instr ) {
1091+ // For an expression such as `i += 2` we pretend that the generated
1092+ // `StoreInstruction` contains the result of the expression even though
1093+ // this isn't totally aligned with the C/C++ standard.
10911094 exists ( TranslatedAssignOperation tao |
10921095 result = tao .getExpr ( ) and
10931096 instr = tao .getInstruction ( any ( AssignmentStoreTag tag ) )
10941097 )
10951098 or
1099+ // Similarly for `i++` and `++i` we pretend that the generated
1100+ // `StoreInstruction` is contains the result of the expression even though
1101+ // this isn't totally aligned with the C/C++ standard.
10961102 exists ( TranslatedCrementOperation tco |
10971103 result = tco .getExpr ( ) and
10981104 instr = tco .getInstruction ( any ( CrementStoreTag tag ) )
10991105 )
1106+ or
1107+ // IR construction inserts an additional cast to a `size_t` on the extent
1108+ // of a `new[]` expression. The resulting `ConvertInstruction` doesn't have
1109+ // a result for `getConvertedResultExpression`. We remap this here so that
1110+ // this `ConvertInstruction` maps to the result of the expression that
1111+ // represents the extent.
1112+ exists ( TranslatedNonConstantAllocationSize tas |
1113+ result = tas .getExtent ( ) .getExpr ( ) and
1114+ instr = tas .getInstruction ( any ( AllocationExtentConvertTag tag ) )
1115+ )
11001116 }
11011117
11021118 private Expr getConvertedResultExpressionImpl ( Instruction instr ) {
0 commit comments