[Bug bootstrap/71471] [7 Regression] Selftest failure in pretty-print.c

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 9 15:35:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71471

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Reproduced on gcc111 (powerpc-ibm-aix7.1.3.0)

(gdb) bt
#0  _Z11fancy_abortPKciS0_ (file=0x12557bbc <num_c_common_reswords+33788>
"../../src/gcc/selftest.c", line=44, 
    function=0x12557be0 <num_c_common_reswords+33824> "fail") at
../../src/gcc/diagnostic.c:1281
#1  0x10d2a088 in _ZN8selftest4failEPKciS1_ (file=0x125574b8
<num_c_common_reswords+31992> "../../src/gcc/pretty-print.c", 
    line=1246, msg=0x125575a4 <num_c_common_reswords+32228> "ASSERT_STREQ
(expected, pp_formatted_text (&pp))")
    at ../../src/gcc/selftest.c:44
#2  0x10d28634 in _ZN8selftestL19assert_pp_format_vaEPKcbS1_PPc (
    expected=0x125576cc <num_c_common_reswords+32524> "0xcafebabe 12345678",
show_color=false, 
    fmt=0x1255771c <num_c_common_reswords+32604> "%p %x", ap=0x2ff21de8) at
../../src/gcc/pretty-print.c:1246
#3  0x10d28700 in _ZN8selftestL16assert_pp_formatEPKcS1_z (
    expected=0x125576cc <num_c_common_reswords+32524> "0xcafebabe 12345678",
fmt=0x1255771c <num_c_common_reswords+32604> "%p %x")
    at ../../src/gcc/pretty-print.c:1258
#4  0x10d28ab8 in _ZN8selftestL14test_pp_formatEv () at
../../src/gcc/pretty-print.c:1321
#5  0x10d28c60 in _ZN8selftest20pretty_print_c_testsEv () at
../../src/gcc/pretty-print.c:1362
#6  0x1231c5d0 in _ZN8selftest9run_testsEv () at
../../src/gcc/selftest-run-tests.c:49
#7  0x10006544 in _ZN6toplev14run_self_testsEv (this=0x2ff21fc8) at
../../src/gcc/toplev.c:2048
#8  0x100067cc in _ZN6toplev4mainEiPPc (this=0x2ff21fc8, argc=21,
argv=0x2ff22074) at ../../src/gcc/toplev.c:2125
#9  0x100006ec in main (argc=21, argv=0x2ff22074) at ../../src/gcc/main.c:39

The issue is:

1320      assert_pp_format ("0xcafebabe 12345678", "%p %x", (void *)0xcafebabe,
1321                        0x12345678);

(gdb) p expected
$1 = 0x125576cc <num_c_common_reswords+32524> "0xcafebabe 12345678"
(gdb) call pp_formatted_text (&pp)
$2 = 811804352
(gdb) p (const char *)$2
$3 = 0x306326c0 "cafebabe 12345678"

i.e. the test for "%p" expects "0x" header, which isn't present.

This is implemented as:
  #define pp_pointer(PP, P)      pp_scalar (PP, "%p", P)

which uses sprintf.

Is pp_format's printing of %p meant to be host-dependent?


More information about the Gcc-bugs mailing list