> Am 13.06.2025 um 00:14 schrieb Paul Eggert <[email protected]>: > > On 2025-06-12 03:29, Peter Dyballa wrote: >> (gdb) p base >> $2 = 0x0 > > That's obviously wrong; 'base' should not be a null pointer. Can you track > down why it is a null pointer?
I think I found the actual cause: char const *const *line =
&curr.file[0].linbuf[i++];.
This statement on line #376 in context.c is probably too much for GCC 4.2… (To
prove that assumption I should compile diffutils 3.12 with GCC 7, GCC 10, or
GCC 14.)
Here is again a wide comparison, correct vs. wrong:
x86_64 macOS High Sierra, Version 10.13.6, GNU gdb (GDB) 14.2 | PPC Mac OS X
10.4.11, Tiger, GNU gdb 6.3.50-20050815 (Apple version gdb-696), 2007
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
(gdb) on line #369 | (gdb) n
(gdb) on line #374 | (gdb) n
(gdb) on line #376 | (gdb) n
(gdb) p line | (gdb) p line
$13 = (const char * const *) 0x40137c | $1 = (const
char * const *) 0x100607098
(gdb) p *line | (gdb) p *line
$14 = 0x0 | $2 =
0x101001630 "compiler.cxx_standard \\\n", ' ' …
(gdb) p **line | (gdb) p
**line
Cannot access memory at address 0x0 | $3 = 99 'c'
(gdb) p curr | (gdb) p curr
$15 = { | 'curr' has
unknown type; cast it to its declared type
file = {{ |
desc = 7, |
openerr = 0, |
err = 0, |
name = 0xbfffd8e2 "Portfile-graphite2-312", |
filetype = 0x56558 "regular file", |
stat = { |
st_dev = 234881030, |
st_ino = 121849958, |
st_mode = 33188, |
st_nlink = 1, |
st_uid = 501, |
st_gid = 80, |
st_rdev = 0, |
st_atimespec = { |
tv_sec = 1750069349, |
tv_nsec = 0 |
}, |
st_mtimespec = { |
tv_sec = 1749476888, |
tv_nsec = 0 |
}, |
st_ctimespec = { |
tv_sec = 1749650195, |
tv_nsec = 0 |
}, |
st_size = 1412, |
st_blocks = 8, |
st_blksize = 4096, |
st_flags = 0, |
st_gen = 0, |
st_lspare = 0, |
st_qspare = {0, 0} |
}, |
dirstream = 0x0, |
buffer = 0x1801200, |
bufsize = 4096, |
buffered = 1412, |
linbuf = 0x40138c, |
linbuf_base = -3, |
buffered_lines = 7, |
valid_lines = 10, |
alloc_lines = 13, |
prefix_end = 0x1801630 "compiler.cxx_standard … |
prefix_lines = 30, |
suffix_begin = 0x18016c6 "#test.env", ' ' … |
equivs = 0x4015e0, |
undiscarded = 0x401460, |
realindexes = 0x40147c, |
nondiscarded_lines = 6, |
changed = 0x401444, |
missing_newline = false, |
eof = true, |
equiv_max = 8 |
}, { |
desc = 8, |
openerr = 0, |
err = 0, |
name = 0xbfffd8f9 "Portfile-graphite2", |
filetype = 0x56558 "regular file", |
stat = { |
st_dev = 234881030, |
st_ino = 121849957, |
st_mode = 33188, |
st_nlink = 1, |
st_uid = 501, |
st_gid = 80, |
st_rdev = 0, |
st_atimespec = { |
tv_sec = 1750069324, |
tv_nsec = 0 |
}, |
st_mtimespec = { |
tv_sec = 1749476888, |
tv_nsec = 0 |
}, |
st_ctimespec = { |
tv_sec = 1749650195, |
tv_nsec = 0 |
}, |
st_size = 1412, |
st_blocks = 8, |
st_blksize = 4096, |
st_flags = 0, |
st_gen = 0, |
st_lspare = 0, |
st_qspare = {0, 0} |
}, |
dirstream = 0x0, |
buffer = 0x1803600, |
bufsize = 4096, |
buffered = 1412, |
linbuf = 0x40140c, |
linbuf_base = -3, |
buffered_lines = 7, |
valid_lines = 10, |
alloc_lines = 12, |
prefix_end = 0x1803a30 "compiler.cxx_standard … |
prefix_lines = 30, |
suffix_begin = 0x1803ac6 "#test.env", ' ' … |
equivs = 0x401620, |
undiscarded = 0x401498, |
realindexes = 0x4014b4, |
nondiscarded_lines = 6, |
changed = 0x401468, |
missing_newline = false, |
eof = true, |
equiv_max = 8 |
}}, |
parent = 0x59b4c |
} |
(gdb) p suppress_blank_empty | (gdb) p
suppress_blank_empty
$16 = false |
'suppress_blank_empty' has unknown type; cast it to its declared type
suppress_blank_empty && **line == '\n' = $17 = 0 |
(gdb) n | (gdb) n
(gdb) n | (gdb) n
(gdb) step | (gdb) step
print_1_line (line_flag=0x0, line=0x40137c) at util.c:989 | print_1_line
(line_flag=0x0, line=0x100607098) at util.c:989
(gdb) step | (gdb) step
print_1_line_nl (line_flag=0x0, line=0x40137c, skip_nl=false) … |
print_1_line_nl (line_flag=0x0, line=0x100607098, skip_nl=false) at util.c:1001
--
Greetings
Pete <]
o __o |__ o HPV, the real
___o /I -\<, |o \ -\),-% high speed!
___/\ /\___./ \___...O/ O____.....`-O-'-()--o_________________
