https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107768
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Oh I was printing the backtrace of the wrong one :) Breakpoint 5, warning_at (location=21406144, opt=860, gmsgid=0x36bec84 "zero as null pointer constant") at /home/apinski/src/upstream-gcc/gcc/gcc/diagnostic.cc:1875 1875 { 1: expand_location( location) = {file = 0x4c16150 "t.cc", line = 24, column = 1, data = 0x0, sysp = false} (gdb) bt #0 warning_at (location=21406144, opt=860, gmsgid=0x36bec84 "zero as null pointer constant") at /home/apinski/src/upstream-gcc/gcc/gcc/diagnostic.cc:1875 #1 0x000000000106a451 in maybe_warn_zero_as_null_pointer_constant (expr=<integer_cst 0x7ffff7268360>, loc=21406144) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/tree.cc:6247 #2 0x0000000000d29f62 in cp_convert_to_pointer (type=<pointer_type 0x7ffff6c24f18>, expr=<integer_cst 0x7ffff7268360>, dofold=true, complain=3) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/cvt.cc:213 #3 0x0000000000d2d1dc in ocp_convert (type=<pointer_type 0x7ffff6c24f18>, expr=<integer_cst 0x7ffff7268360>, convtype=79, flags=17, complain=3) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/cvt.cc:887 #4 0x0000000000d2fc39 in convert (type=<pointer_type 0x7ffff6c24f18>, expr=<integer_cst 0x7ffff7268360>) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/cvt.cc:1688 #5 0x0000000000d1d930 in cp_fold (x=<convert_expr 0x7ffff6e56980>) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/cp-gimplify.cc:2515 #6 0x0000000000d1601b in cp_fold_r (stmt_p=0x7ffff6c277a0, walk_subtrees=0x7fffffffd3e0, data_=0x7fffffffd540) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/cp-gimplify.cc:1017 #7 0x0000000001dd730d in walk_tree_1 (tp=0x7ffff6c277a0, func=0xd157dc <cp_fold_r(tree*, int*, void*)>, data=0x7fffffffd540, pset=0x0, lh=0x1065f71 <cp_walk_subtrees(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)>) at /home/apinski/src/upstream-gcc/gcc/gcc/tree.cc:11257 #8 0x0000000001dd78ab in walk_tree_1 (tp=0x7ffff6c210c0, func=0xd157dc <cp_fold_r(tree*, int*, void*)>, data=0x7fffffffd540, pset=0x0, lh=0x1065f71 <cp_walk_subtrees(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)>) at /home/apinski/src/upstream-gcc/gcc/gcc/tree.cc:11361 #9 0x0000000000d1690a in cp_fold_function (fndecl=<function_decl 0x7ffff6c21000 resuming_on_new_thread>) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/cp-gimplify.cc:1133 #10 0x0000000000d9f747 in finish_function (inline_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/decl.cc:18210 #11 0x0000000000f1300a in cp_parser_function_definition_after_declarator (parser=0x7ffff7274be0, inline_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:31905 #12 0x0000000000f12e10 in cp_parser_function_definition_from_specifiers_and_declarator (parser=0x7ffff7274be0, decl_specifiers=0x7fffffffd9b0, attributes=<tree 0x0>, declarator=0x4c16320) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:31819 #13 0x0000000000efebc5 in cp_parser_init_declarator (parser=0x7ffff7274be0, flags=0, decl_specifiers=0x7fffffffd9b0, checks=0x0, function_definition_allowed_p=true, member_p=false, declares_class_or_enum=0, function_definition_p=0x7fffffffd939, maybe_range_for_decl=0x0, init_loc=0x7fffffffd940, auto_result=0x7fffffffd948) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22693 #14 0x0000000000eefdd6 in cp_parser_simple_declaration (parser=0x7ffff7274be0, function_definition_allowed_p=true, maybe_range_for_decl=0x0) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:15341 #15 0x0000000000eef8cf in cp_parser_block_declaration (parser=0x7ffff7274be0, statement_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:15161 #16 0x0000000000eef51d in cp_parser_declaration (parser=0x7ffff7274be0, prefix_attrs=<tree 0x0>) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:15027 #17 0x0000000000eef5e9 in cp_parser_toplevel_declaration (parser=0x7ffff7274be0) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:15048 #18 0x0000000000ed74fc in cp_parser_translation_unit (parser=0x7ffff7274be0) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:5090 #19 0x0000000000f4e06b in c_parse_file () at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:49349 #20 0x000000000115200a in c_common_parse_file () at /home/apinski/src/upstream-gcc/gcc/gcc/c-family/c-opts.cc:1248 #21 0x000000000197da00 in compile_file () at /home/apinski/src/upstream-gcc/gcc/gcc/toplev.cc:444 #22 0x0000000001980acd in do_compile (no_backend=false) at /home/apinski/src/upstream-gcc/gcc/gcc/toplev.cc:2125 #23 0x0000000001980eb5 in toplev::main (this=0x7fffffffdd62, argc=5, argv=0x7fffffffde68) at /home/apinski/src/upstream-gcc/gcc/gcc/toplev.cc:2277 #24 0x0000000003293c49 in main (argc=5, argv=0x7fffffffde68) at /home/apinski/src/upstream-gcc/gcc/gcc/main.cc:39