Date
1 - 2 of 2
Review: oslc fix for indexing (issue1868052)
larry...@...
Reviewers: ,
Description: Component indexing wasn't creating the necessary temporary if the types didn't match. This caused the wrong code to be emitted for something like this: "int i = (int)P[0];" Please review this at http://codereview.appspot.com/1868052/show Affected files: src/liboslcomp/codegen.cpp Index: src/liboslcomp/codegen.cpp =================================================================== --- src/liboslcomp/codegen.cpp (revision 792) +++ src/liboslcomp/codegen.cpp (working copy) @@ -757,7 +757,8 @@ ind = index()->codegen (); ind2 = index2() ? index2()->codegen () : NULL; ind3 = index3() ? index3()->codegen () : NULL; - if (! dest) + // Make a destination if not given one, or if it's the wrong type + if (! dest || ! equivalent (dest->typespec(), typespec())) dest = m_compiler->make_temporary (typespec()); if (lv->typespec().is_array()) { if (index3()) { |
|
cku...@...
|
|