Re: [Rd] valgrind complains about regex.c (PR#8043)

From: Charles Geyer <charlie_at_stat.umn.edu>
Date: Tue 02 Aug 2005 - 23:34:36 GMT

On Tue, Aug 02, 2005 at 07:50:54AM -0400, Duncan Murdoch wrote:
> Prof Brian Ripley wrote:
> >Did you compile R without optimization? Such reads are often the result
> >of read-aheads produced by the optimizer in an attempt to keep
> >pipelines full (and are harmless).
>
> There were both a read and a write. I can see the read being harmless,
> but is the write harmless? I suspect this may be the bug I fixed on
> July 16, since it had to do with character classes including ranges
> (like Charlie's "[a-pr-z]").
>
> Charlie, have you tried a recent version of R-patched?

No. And I can't do it right away. I'm packing up to move back to Minneapolis after my sabbatical year in Seattle. Maybe in a few days. Sorry to not be more helpful. Maybe I'll try it on the plane if I can.

> Duncan Murdoch
>
> >
> >On an un-optimized build of R I am unable to reproduce this. (I also was
> >unable to reproduce it on my optimized build of 2.1.1 using gcc 3.4.4,
> >although I did get a report on other read-aheads.)
> >
> >On Mon, 1 Aug 2005 charlie@stat.umn.edu wrote:
> >
> >
> >>I think I am using objects according to the man page.
> >>This seems to be a valid regular expression. But whether
> >>I know what I'm doing or no, it still shouldn't be doing
> >>what valgrind seems to be saying it's doing. (IMHO)
> >
> >
> >I think you need to take that up with compiler designers: it is common
> >practice.
> >
> >
> >>---------- start of script ----------
> >>Script started on Mon 01 Aug 2005 02:09:00 PM PDT
> >>linux$ printenv VALGRIND_OPTS
> >>--tool=3Dmemcheck
> >>linux$ cat bar.R
> >>
> >>foo <- 1
> >>bar <- 2:3
> >>baz <- 4:6
> >>qux <- matrix(7:10, 2)
> >>
> >>ls()
> >>rm(list =3D objects(pattern =3D "^[a-pr-z]"))
> >>ls()
> >>
> >>linux$ R --version
> >>R 2.1.1 (2005-06-20).
> >>Copyright (C) 2005 R Development Core Team
> >>
> >>R is free software and comes with ABSOLUTELY NO WARRANTY.
> >>You are welcome to redistribute it under the terms of the GNU
> >>General Public License. For more information about these matters,
> >>see http://www.gnu.org/copyleft/gpl.html.
> >>linux$ gcc --version
> >>=1B[0mgcc (GCC) 3.3.5 20050117 (prerelease) (SUSE Linux)
> >>=1B[0mCopyright (C) 2003 Free Software Foundation, Inc.
> >>=1B[0mThis is free software; see the source for copying conditions.
> >>There =
> >>is NO
> >>=1B[0mwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> >>PU=
> >>RPOSE.
> >>=1B[0m
> >>linux$ cat /etc/SuSE-release=20
> >>SuSE Linux 9.3 (i586)
> >>VERSION =3D 9.3
> >>linux$ R --vanilla --debugger=3Dvalgrind < bar.R >| bar.Rout
> >>=3D=3D22324=3D=3D Memcheck, a memory error detector for x86-linux.
> >>=3D=3D22324=3D=3D Copyright (C) 2002-2004, and GNU GPL'd, by Julian
> >>Seward =
> >>et al.
> >>=3D=3D22324=3D=3D Using valgrind-2.2.0, a program supervision framework
> >>for=
> >>x86-linux.
> >>=3D=3D22324=3D=3D Copyright (C) 2000-2004, and GNU GPL'd, by Julian
> >>Seward =
> >>et al.
> >>=3D=3D22324=3D=3D For more details, rerun with: -v
> >>=3D=3D22324=3D=3D=20
> >>=3D=3D22324=3D=3D Invalid read of size 4
> >>=3D=3D22324=3D=3D at 0x81255AD: parse_expression (regex.c:5045)
> >>=3D=3D22324=3D=3D by 0x8125868: parse_branch (regex.c:4475)
> >>=3D=3D22324=3D=3D by 0x8125913: parse_reg_exp (regex.c:4420)
> >>=3D=3D22324=3D=3D by 0x81261B3: Rf_regcomp (regex.c:4384)
> >>=3D=3D22324=3D=3D Address 0x1C1E23A8 is 0 bytes after a block of size 32
> >>a=
> >>lloc'd
> >>=3D=3D22324=3D=3D at 0x1B90650D: calloc (in
> >>/usr/lib/valgrind/vgpreload_=
> >>memcheck.so)
> >>=3D=3D22324=3D=3D by 0x81247B5: parse_expression (regex.c:5406)
> >>=3D=3D22324=3D=3D by 0x8125868: parse_branch (regex.c:4475)
> >>=3D=3D22324=3D=3D by 0x8125913: parse_reg_exp (regex.c:4420)
> >>=3D=3D22324=3D=3D=20
> >>=3D=3D22324=3D=3D Invalid write of size 4
> >>=3D=3D22324=3D=3D at 0x81255B2: parse_expression (regex.c:5045)
> >>=3D=3D22324=3D=3D by 0x8125868: parse_branch (regex.c:4475)
> >>=3D=3D22324=3D=3D by 0x8125913: parse_reg_exp (regex.c:4420)
> >>=3D=3D22324=3D=3D by 0x81261B3: Rf_regcomp (regex.c:4384)
> >>=3D=3D22324=3D=3D Address 0x1C1E23A8 is 0 bytes after a block of size 32
> >>a=
> >>lloc'd
> >>=3D=3D22324=3D=3D at 0x1B90650D: calloc (in
> >>/usr/lib/valgrind/vgpreload_=
> >>memcheck.so)
> >>=3D=3D22324=3D=3D by 0x81247B5: parse_expression (regex.c:5406)
> >>=3D=3D22324=3D=3D by 0x8125868: parse_branch (regex.c:4475)
> >>=3D=3D22324=3D=3D by 0x8125913: parse_reg_exp (regex.c:4420)
> >>=3D=3D22324=3D=3D=20
> >>=3D=3D22324=3D=3D ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 39
> >>f=
> >>rom 2)
> >>=3D=3D22324=3D=3D malloc/free: in use at exit: 12691882 bytes in 6426
> >>block=
> >>s.
> >>=3D=3D22324=3D=3D malloc/free: 32534 allocs, 26108 frees, 33105500 bytes
> >>al=
> >>located.
> >>=3D=3D22324=3D=3D For a detailed leak analysis, rerun with: --leak-check=
> >>=3Dyes
> >>=3D=3D22324=3D=3D For counts of detected errors, rerun with: -v
> >>linux$ exit
> >>
> >>Script done on Mon 01 Aug 2005 02:10:42 PM PDT
> >>---------- end of script ----------
> >>--=20
> >>Charles Geyer
> >>Professor, School of Statistics
> >>University of Minnesota
> >>charlie@stat.umn.edu
> >>
> >>______________________________________________
> >>R-devel@r-project.org mailing list
> >>https://stat.ethz.ch/mailman/listinfo/r-devel
> >>
> >>
> >
> >

-- 
Charles Geyer
Professor, School of Statistics
University of Minnesota
charlie@stat.umn.edu

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Aug 03 09:38:19 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:33 GMT