[Issue 23040] New: importC: optimizer rejects null dereference of volatile pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 19 14:56:58 UTC 2022


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

          Issue ID: 23040
           Summary: importC: optimizer rejects null dereference of
                    volatile pointer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

void my_fatal()
{ 
        *((volatile unsigned int *) 0) = (unsigned int) 0xdeadbeefUL;
}

compile: dmd -O -c test.c

Error: null dereference in function my_fatal

i see in
https://github.com/dlang/dmd/blob/b1ac484/src/dmd/backend/cgelem.d#L6253 where
the error is emitted, it has a check to allow this with volatile pointers but
the keyword is ignored in importC

--


More information about the Digitalmars-d-bugs mailing list