Open graypinkfurball opened 1 week ago
Related to #253. I noticed that in c_parser.py at L1882, it ignores type suffixes on hexadecimal floating point literals.
This commit explicitly ignoring hexadecimal literals, and this commit added an incorrect test.
float* a = { 0.1f, 0.1, 0.1l, 0x1p0f, 0x1p0, 0x1p0l };
FileAST: Decl: a, [], [], [], [] PtrDecl: [] TypeDecl: a, [], None IdentifierType: ['float'] InitList: Constant: float, 0.1f Constant: double, 0.1 Constant: long double, 0.1l Constant: float, 0x1p0f Constant: float, 0x1p0 Constant: float, 0x1p0l
The type of the hexadecimal constants should be "float", "double" and "long double" in that order. Test cases should be amended.
type
I ran a little test with my compiler to verify the sizes of the literals.
#include <stdio.h> int main(void) { printf("%llu %llu %llu\n%llu %llu %llu", sizeof(0.1f), sizeof(0.1), sizeof(0.1l), sizeof(0x1p0f), sizeof(0x1p0), sizeof(0x1p0l)); return 0; }
4 8 16 4 8 16
Thank you for the report. Please feel free to submit a PR with a fix
Related to #253. I noticed that in c_parser.py at L1882, it ignores type suffixes on hexadecimal floating point literals.
This commit explicitly ignoring hexadecimal literals, and this commit added an incorrect test.
The
type
of the hexadecimal constants should be "float", "double" and "long double" in that order. Test cases should be amended.I ran a little test with my compiler to verify the sizes of the literals.