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: nob...@puremagic.com
          Reporter: snarwin+bugzi...@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.

--

Reply via email to