windelbouwman / ppci

A compiler for ARM, X86, MSP430, xtensa and more implemented in pure Python
https://ppci.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
337 stars 36 forks source link

Evaluation of constant expression in preprocessing directives may produce incorrect results #131

Open pmor13 opened 2 years ago

pmor13 commented 2 years ago
#if (1 ? -2 : 1u) < 0
#error
#endif
File : "<source>"
    1:#if (1 ? -2 : 0 + 1u) < 0
    2:#error
       ^ 
2022-04-24 21:27:27,454 |     INFO |       root | ppci 0.5.5 compiler on CPython 3.8.10 on Linux-5.13.0-1021-aws-x86_64-with-glibc2.29
2022-04-24 21:27:27,457 |     INFO |   cbuilder | Starting C compilation (c99)
2022-04-24 21:27:27,458 |    ERROR |       root | 
2022-04-24 21:27:27,458 |    ERROR |       root | (<source>, 2, 2)
Compiler returned: 1
ppci 0.5.5