Article ID: 000082004 Content Type: Troubleshooting Last Reviewed: 09/14/2011

Array Elements in Structures Do Not Copy Correctly

Environment

  • Quartus® II Subscription Edition
  • BUILT IN - ARTICLE INTRO SECOND COMPONENT

    Critical Issue

    Description

    C2H accelerators do not correctly copy array elements that are elements of structures.

    In , the a and b elements of the structure copy correctly, but the buf element does not. After this assignment, struct_a equals {9, 8, {3, 3, 3, 3}}.

    Array Elements of Structs
    typedef struct my_struct { int a; int b; int buf[BUF_SIZE]; }MY_STRUCT; MY_STRUCT struct_a = {1, 2, {3, 3, 3, 3}}; MY_STRUCT struct_b = {9, 8, {7, 7, 7, 7}}; struct_a = struct_b;
    Resolution

    Copy the array elements explicitly, as shown in .

    Copying Array Elements Explicitly
    { int i=0; do { struct_a.buf[i] = struct_b.buf[i]; i ; } while (i<LENGTH_OF_BUF_ELEMENT) }

    Related Products

    This article applies to 1 products

    Intel® Programmable Devices