http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45841
Hans-Peter Nilsson <hp at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|libstdc++ |testsuite --- Comment #15 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2010-10-04 23:51:54 UTC --- (In reply to comment #9) > ... something is wrong > with lseek(). It certainly is! There are at least three issues here. 1. The simulator has a bug: on a 64-bit host, the offset parameter to the lseek call is in-effect zero-extended from 32-bit-long to 64-bit-long. This causes any change to the sequence of lseeks to show random regressions. 2. There is a test-suite hook, libstdc++-v3/testsuite/lib/libstdc++.exp:check_v3_target_fileio that should catch this. 3. Fixing #1 certainly shows improvement; 14 additional tests pass, but also 2 regressions, so there's still another issue... Due to (#1 and) #2, I'm recategorizing this PR as belonging to the testsuite and I'm assigning it to myself, pending a patch for #2 and investigating #3. Sorry for the noise, feel free to remove yourself from CC if this made you lose interest. :) For the record, an strace excerpt of the simulator before and after r164529 shows the issue better than the actual simulator trace I had in mind. (Though it also shows that the failing ltrace call is an addition, and I guess you would want to eliminate it, if possible. Oops, four issues! Maybe that was what the attached patch was about...) r164528: ... open("seekoff-2io.tst", O_RDWR) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=116, ...}) = 0 lseek(4, 0, SEEK_CUR) = 0 lseek(4, 2, SEEK_SET) = 2 fstat(4, {st_mode=S_IFREG|0644, st_size=116, ...}) = 0 lseek(4, 0, SEEK_CUR) = 2 read(4, " ", 1) = 1 read(4, "9", 1) = 1 lseek(4, 3, SEEK_SET) = 3 write(4, "\n", 1) = 1 lseek(4, 4, SEEK_SET) = 4 read(4, "9", 1) = 1 lseek(4, 1, SEEK_CUR) = 6 read(4, "1", 1) = 1 read(4, "1", 1) = 1 lseek(4, 4294967295, SEEK_CUR) = 4294967303 write(4, "x", 1) = 1 write(4, "\n", 1) = 1 lseek(4, 0, SEEK_CUR) = 4294967305 read(4, "", 1) = 0 read(4, "", 1) = 0 lseek(4, 0, SEEK_END) = 4294967305 write(4, "\n", 1) = 1 write(4, "because because because. . .", 28) = 28 lseek(4, 4294967295, SEEK_END) = 8589934629 read(4, "", 1) = 0 lseek(4, 4294967295, SEEK_CUR) = 12884901924 read(4, "", 1) = 0 read(4, "", 1) = 0 read(4, "", 1) = 0 close(4) = 0 ... r164529: ... open("seekoff-2io.tst", O_RDWR) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=116, ...}) = 0 lseek(4, 0, SEEK_CUR) = 0 lseek(4, 2, SEEK_SET) = 2 fstat(4, {st_mode=S_IFREG|0644, st_size=116, ...}) = 0 lseek(4, 0, SEEK_CUR) = 2 read(4, " ", 1) = 1 read(4, "9", 1) = 1 lseek(4, 3, SEEK_SET) = 3 write(4, "\n", 1) = 1 lseek(4, 4, SEEK_SET) = 4 read(4, "9", 1) = 1 lseek(4, 1, SEEK_CUR) = 6 read(4, "1", 1) = 1 read(4, "1", 1) = 1 lseek(4, 0, SEEK_CUR) = 8 lseek(4, 4294967295, SEEK_CUR) = 4294967303 write(4, "x", 1) = 1 write(4, "\n", 1) = 1 lseek(4, 0, SEEK_CUR) = 4294967305 read(4, "", 1) = 0 read(4, "", 1) = 0 write(2, "assertion \"", 11assertion ") = 11 write(2, "c1 == c3", 8c1 == c3) = 8 write(2, "\" failed: file \"", 16" failed: file ") = 16 ...