https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91585
Bug ID: 91585 Summary: segfault when calling a non void function without a return statement Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lucien.gentis at waika9 dot com Target Milestone: --- Created attachment 46773 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46773&action=edit file generated when -save-temps option is specified GCC : 8.3.0 Linux Debian 10 - kernel 4.19.0-5-amd64 Attachment : test1.ii Hello, Building following code (see attachement) via command 'gcc -g -Wall -O2 -save-temps test1.cc -o test1' ///////////////////////////////////////// #include <stdio.h> int f(int a) { printf("function f called - a = %d\n",a); } int main(void) { f(1); } ///////////////////////////////////////// compiler output : test1.cc: In function 'int f(int)': test1.cc:4:1: warning: no return statement in function returning non-void [-Wreturn-type] but if I execute test1, I get : function f called - a = 1 Erreur de segmentation Maybe it's not a bug, but since program crashes with a segfault, shouldn't the compiler send an error instead of a warning ? PS : same program does not crash if compiled via GCC 7.4.0