#include <cstdio> int main() { printf("%s\n", (char*)0); // run-time error for g++ 4.3.2, } // while ok for g++ 3.4.4
run-time error: 10 [main] a 1808 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack) Segmentation fault (core dumped) expexted behavior:print nothing or (null) workaround: use cout comment: Many people still prefer printf to cout. The disabled function make printf almost useless. -- Summary: Printf of typed null pointer causes a run-time error Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hosoda-t at palette dot plala dot or dot jp GCC host triplet: Microsoft Windows XP GCC target triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37765