Initializing float variables without type suffix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

i think i found an error, when float variables are initialized.
Parsing the line

float var = 1.2345; 

creates a symbol "var", but the initializer (struct expression) is from 
type "EXPR_VALUE" - 
not "EXPR_FVALUE".
I think this happens, because the expression "1.2345" is interpreted as 
double and, as result of this, 
gets casted with the function cast_to(). It seems that cast_to() doesn't 
make double to float casts.

The result of this is, that if you want to show the initvalue of this 
symbol, "1" instead of "1.2345" is displayed.
If the variable is initialized with an additional type suffix, like 

float var = 1.2345F; 

or datatype double is used, it works.

Greetings,
Thomas Schmid


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux