Bug 22074 – importC: Generate tests for stressing CParser using Csmith

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-22T20:20:02Z
Last change time
2024-12-13T19:17:18Z
Keywords
bootcamp, ImportC
Assigned to
No Owner
Creator
Iain Buclaw
Moved to GitHub: dmd#19953 →

Comments

Comment #0 by ibuclaw — 2021-06-22T20:20:02Z
https://github.com/csmith-project/csmith/ This will be an easy way to find bugs in the CParser. --- cat src/keywords.c.in > random.c csmith --nomain --no-packed-struct --no-bitfields >> random.c gcc -E -P random.c > randomgen.c dmd -verrors=context randomgen.c --- randomgen.c(1683): Error: found `=` when expecting `;` or `=`, did you mean `int32_t l_2464 = (`? int32_t l_2464 = (-1L); ^ randomgen.c(1683): Error: found `=` instead of statement int32_t l_2464 = (-1L); ^ randomgen.c(1705): Error: found `[` when expecting `;` or `=`, did you mean `uint16_t l_2387 = 4`? uint16_t l_2387[4][6][1] = {{{0x24FAL},{1UL},{0x24FAL},{1UL},{0x24FAL},{1UL}},{{0x24FAL},{1UL},{0x24FAL},{1UL},{0x24FAL},{1UL}},{{0x24FAL},{1UL},{0x24FAL},{1UL},{0x24FAL},{1UL}},{{0x24FAL},{1UL},{0x24FAL},{1UL},{0x24FAL},{1UL}}};
Comment #1 by bugzilla — 2021-06-27T10:35:00Z
I don't understand. int32_t is a typedef defined by stdint.h, it is not a keyword and is not known to ImportC without the typedef.
Comment #2 by ibuclaw — 2021-06-27T14:28:11Z
(In reply to Walter Bright from comment #1) > I don't understand. int32_t is a typedef defined by stdint.h, it is not a > keyword and is not known to ImportC without the typedef. There is not specific failing example here. Any errors found by Csmith will have to be Creduce'd. The actual error message I posted is from a large source file generated by a fuzzer.
Comment #3 by ibuclaw — 2021-06-27T14:28:30Z
(In reply to Iain Buclaw from comment #2) > (In reply to Walter Bright from comment #1) > > I don't understand. int32_t is a typedef defined by stdint.h, it is not a > > keyword and is not known to ImportC without the typedef. > There is not specific failing example here. > > Any errors found by Csmith will have to be Creduce'd. The actual error > message I posted is from a large source file generated by a fuzzer. ...and has no meaning on its own.
Comment #4 by robert.schadek — 2024-12-13T19:17:18Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19953 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB