xlat: For reductiontargets, compute numElements based on sizeof target type
authorRamprasad Venkataraman <ramv@illinois.edu>
Thu, 20 Oct 2011 00:44:24 +0000 (19:44 -0500)
committerRamprasad Venkataraman <ramv@illinois.edu>
Fri, 21 Oct 2011 16:27:49 +0000 (11:27 -0500)
The generated code for reductiontarget entry methods was wrongly calculating
the number of elements in the reduction message by dividing the msg data size
by the sizeof the other variable in the function call (which usually is int
numElements)!

Fix this by using sizeof target data type

src/xlat-i/xi-symbol.C

index f4b52ce16aade6990d26dd1f5c4e777d953955f0..3a1fbc170aa73dac5080c441acdf55214fce3869 100644 (file)
@@ -5064,7 +5064,7 @@ void ParamList::beginRednWrapperUnmarshall(XStr &str)
                 str << "  " << dt << " " << next->param->name << "; "
                     << next->param->name << " = "
                     << "((CkReductionMsg*)impl_msg)->getLength() / sizeof("
-                    << dt << ");\n";
+                    << param->type->deref() << ");\n";
                 dt = param->type->deref();
                 str << "  " << dt << "* " << param->name << "; "
                     << param->name << " = (" << dt << "*)impl_buf;\n";
@@ -5073,7 +5073,7 @@ void ParamList::beginRednWrapperUnmarshall(XStr &str)
                 str << "  " << dt << " " << param->name << "; "
                     << param->name << " = "
                     << "((CkReductionMsg*)impl_msg)->getLength() / sizeof("
-                    << dt << ");\n";
+                    << next->param->type->deref() << ");\n";
                 dt = next->param->type->deref();
                 str << "  " << dt << "* " << next->param->name << "; "
                     << next->param->name << " = (" << dt << "*)impl_buf;\n";