bug in aud code generation
When we compile the following example (sac2c 1.3.3-MijasCosta-572-g9eca without flags)
we get a two element vector as result! Closer inspection shows that there is a problem in the descriptor initialisation for the constant array.
after compilation, we have:
SAC_ND_ALLOC_BEGIN((SACp_emal_2334__flat_18, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), 1, 1, int) ND_CREATE__ARRAY__SHAPE( (SACp_emal_2334__flat_18, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), -1, 1, 2, 2, (SACl_f, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACl_f, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), -2) SAC_ND_ALLOC_END((SACp_emal_2334__flat_18, (AUD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), 1, 1, int)
ALLOC_BEGIN is expanded into:
... SACp_emal_2334__flat_18__dim = 1;
subsequently, ND_CREATE__ARRAY__SHAPE does not change the dim, but it fills the shape components correctly up until __dim:
... (((SAC_array_descriptor_t) (((intptr_t)SACp_emal_2334__flat_18__desc) & (-1 ^ (3))))[(6 + (0))]) = 2; SAC_i = 1; for (SAC_j = 0; SAC_i < SACp_emal_2334__flat_18__dim; SAC_i++, SAC_j++) { (((SAC_array_descriptor_t) (((intptr_t)SACp_emal_2334__flat_18__desc) & (-1 ^ (3))))[(6 + (SAC_i))]) = (((SAC_array_descriptor_t) (((intptr_t)SACl_f__desc) & (-1 ^ (3))))[(6 + (SAC_j))]); } ...
all the data is copied correctly as well!