[Issue 22074] New: importC: Generate tests for stressing CParser using Csmith

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 20:20:02 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22074

          Issue ID: 22074
           Summary: importC: Generate tests for stressing CParser using
                    Csmith
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

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}}};

--


More information about the Digitalmars-d-bugs mailing list