[Beremiz-devel] [MatIEC] too many elements in array initialization

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Beremiz-devel] [MatIEC] too many elements in array initialization

Beremiz-Devel mailing list
Hi Mario,

if there are too many initialization elements for array, then iec2c
fails with
"Internal compiler error in file generate_c_vardecl.cc at line 249."
or
"Internal compiler error in file generate_c_vardecl.cc at line 304."

But the standard allows this. See 2.4.3.2 "Initial value assignment":

"
If the number of initial values given in the initialization list exceeds the number of array entries, the
excess (rightmost) initial values shall be ignored. If the number of initial values is less than the
number of array entries, the remaining array entries shall be filled with the default initial values for the
corresponding data type. In either case, the user shall be warned of this condition during preparation
of the program for execution.
"

I've changed a code so unused initialization elements are ignored (see
attached patch). But I couldn't find the way to get a good
understandable user warning in this case.

--
Best regards,
Andrey Skvortsov

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel

too_many_elements_in_array.patch (1K) Download Attachment
signature.asc (849 bytes) Download Attachment
Loading...