www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23040] New: importC: optimizer rejects null dereference of

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 puremagic.com
          Reporter: duser neet.fi
                CC: duser 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

--
Apr 19 2022