This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] C60-CGT:如果给定多个双精度输入参数、将忽略第10个值。

Guru**** 2482225 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1452049/c6000-cgt-given-multiple-double-input-parameters-the-10th-value-is-ignored

器件型号:C60-CGT

工具与软件:

您好!

在以下示例中、此结构在初始化后不包含预期值。 第10个元素未正确初始化。

如果我对例如 var5使用 float 而不是 double、则程序将按预期打印。 如果我将 var5替换为两个 float var51和 var52、则程序仍按预期工作。

将 init_data.cpp 中的实现替换为默认初始化后执行每个元素分配、不能解决问题。

cl6x --help
TMS320C6x C/C++ Compiler v8.3.10
Tools Copyright (c) 1996-2018 Texas Instruments Incorporated


编译标志。  在所有优化级别观察。

-qq -mv6600 --relaxed_ansi --define=SOC_TDA3XX --keep_unneeded_statics --diag_wrap=off --display_error_number --diag_suppress=556 --diag_suppress=2458 --mem_model:data=far --wchar_t=16 --fp_reassoc=off --float_operations_allowed=all --ramfunc=off --emit_warnings_as_errors -O3 --opt_for_speed=4 -DNDEBUG --symdebug:none --c++14


代码
init_data.hpp
#ifndef INIT_DATA_HPP_
#define INIT_DATA_HPP_

struct Data
{
  double var1;
  double var2;
  double var3;
  double var4;
  double var5;
  double var6;
  double var7;
  double var8;
  double var9;
  double var10;
  double var11;
};

Data initData(double inVar1,
              double inVar2,
              double inVar3,
              double inVar4,
              double inVar5,
              double inVar6,
              double inVar7,
              double inVar8,
              double inVar9,
              double inVar10,
              double inVar11);

#endif  // INIT_DATA_HPP_


init_data.cpp
#include "init_data.hpp"

Data initData(double inVar1,
              double inVar2,
              double inVar3,
              double inVar4,
              double inVar5,
              double inVar6,
              double inVar7,
              double inVar8,
              double inVar9,
              double inVar10,
              double inVar11)
{
  return {inVar1, inVar2, inVar3, inVar4, inVar5, inVar6, inVar7, inVar8, inVar9, inVar10, inVar11};
}


init_data_app.cpp
#include "application_if/application_if.hpp"
#include "init_data.hpp"

#include <xdc/runtime/System.h>

namespace se
{
namespace application
{
void init()
{
  Data data = initData(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0);

  // Prints as expected.
  System_printf("Result 1: %f\n", data.var1);
  System_printf("Result 2: %f\n", data.var2);
  System_printf("Result 3: %f\n", data.var3);
  System_printf("Result 4: %f\n", data.var4);
  System_printf("Result 5: %f\n", data.var5);
  System_printf("Result 6: %f\n", data.var6);
  System_printf("Result 7: %f\n", data.var7);
  System_printf("Result 8: %f\n", data.var8);
  System_printf("Result 9: %f\n", data.var9);
  // Prints -0.000000 instead of 10.0.
  System_printf("Result 10: %f\n", data.var10);
  // Prints 11.0 as expected.
  System_printf("Result 11: %f\n", data.var11);
}
}  // namespace application
}  // namespace se


输出
Result 1: 1.0000
Result 2: 2.0000
Result 3: 3.0000
Result 4: 4.0000
Result 5: 5.0000
Result 6: 6.0000
Result 7: 7.0000
Result 8: 8.0000
Result 9: 9.0000
Result 10: -0.0000
Result 11: 11.0000

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    还使用 TMS320C6x C/C++编译器 v8.3.13进行了测试

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您报告此问题并提供完整的测试用例。  我能够重现相同的行为。  我提交了 EXT_EP-12126条目 以调查此问题。  我们欢迎您通过这个链接来了解。

    谢谢。此致、

    -George.