[Issue 22994] New: importC: some types not zero-initialized in static array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 7 06:07:59 UTC 2022


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

          Issue ID: 22994
           Summary: importC: some types not zero-initialized in static
                    array
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

issue 22918 still affects static arrays

char c[1];
double dbl[1];
enum E { a = 1, };
enum E myE[1];
int printf(char *, ...);
int main()
{ 
        printf("%d\n", (int)c[0]);
        printf("%lf\n", dbl[0]);
        printf("%d\n", (int)myE[0]);
        return 0;
}

should print 0, 0.000000, 0, but prints 255, nan, 1

--


More information about the Digitalmars-d-bugs mailing list