TelluIoT / ThingML

The ThingML modelling language
https://github.com/TelluIoT/ThingML
Apache License 2.0
102 stars 33 forks source link

De-serialising bug in C compiler? #138

Closed jakhog closed 7 years ago

jakhog commented 7 years ago

The following snippet of code is found in the CCompilerContext.java file here

while (i > 0) {
    i = i - 1;
    if (i == 0) result += buffer + "[" + index + "]";
    else result += "(" + buffer + "[" + index + "]" + "<<" + (8 * i) + ") + ";
    index = index + 1;
}

@ffleurey @Lyadis; wouldn't this only work for integer types?

I would guess that the crazy union-trick should be used here as well?

nharrand commented 7 years ago

Are you sure this code is actually used? It looks like a previous (and not deleted) code for serialization. But anyway, you are right, this should not work for double and float.

brice-morin commented 7 years ago

@jakhog what is the status of this issue?

jakhog commented 7 years ago

Fixed in 6c4e9c914b1470cc7757ec6e93307e1cfbbc33ba