www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22074] New: importC: Generate tests for stressing CParser

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 puremagic.com
          Reporter: ibuclaw 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}}};

--
Jun 22