https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
Bug ID: 86177 Summary: Wnull-dereference warning for object file compile missing Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jg at jguk dot org Target Milestone: --- Hello This doesn't give any warning that the pointer is not checked when being compiled. If linked with second program example below, there is no issue visible. Then crashes when runs: jonny@asus:~/code$ ./main Segmentation fault (core dumped) //g++-8 -O2 -Wall -Wextra -Wnull-dereference -Wpedantic -o main -c main.cpp void f(int *i) { *i = 1; } //g++-8 -O2 -Wall -Wextra -Wnull-dereference -Wpedantic main1.o -o main main2.cpp extern void f(int* i); int main() { f(nullptr); // return }