www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21503] New: Incorrect C main signature causes undefined

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

          Issue ID: 21503
           Summary: Incorrect C main signature causes undefined behavior
                    in  safe code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

Example program:

---
extern(C) void main(double[] foo)  safe
{
    import std.stdio;
    writeln(foo); // undefined behavior
}
---

To avoid this, the compiler should check the signature of a  safe extern(C)
main function for conformance to the C standard.

--
Dec 26 2020