From 608c1d180a9e1d132287aacde015dfd0c8fa4953 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 31 Oct 2016 21:52:43 +0200 Subject: Fix some valgrind errors. --- ChangeLog | 8 ++++++++ awkgram.c | 7 ++++++- awkgram.y | 7 ++++++- io.c | 5 +++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a790fc6..1e862c7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-10-31 Arnold D. Robbins + + Fix valgrind issues. + + * io.c (init_awkpath): Need to allocate max_path+3 pointers. + * awkgram.y (make_profile_number): Need to add STRCUR flag and + set n->stfmt to STFMT_UNUSED. See the comment in the code. + 2016-10-26 Arnold D. Robbins * io.c (init_awkpath): Set max path len for leading separator. diff --git a/awkgram.c b/awkgram.c index 0ad0fac8..78839fe9 100644 --- a/awkgram.c +++ b/awkgram.c @@ -8619,7 +8619,12 @@ make_profile_number(double d, const char *str, size_t len) n->stptr = estrdup(str, len + 1); n->stptr[len] = '\0'; n->stlen = len; - n->flags |= NUMCONSTSTR; + // Set STRCUR and n->stfmt for use when profiling + // (i.e., actually running the program) so that + // force_string() on this item will work ok. + // Thanks and a tip of the hatlo to valgrind. + n->flags |= (NUMCONSTSTR|STRCUR); + n->stfmt = STFMT_UNUSED; } return n; diff --git a/awkgram.y b/awkgram.y index a36e1792..4ed1e78b 100644 --- a/awkgram.y +++ b/awkgram.y @@ -6242,7 +6242,12 @@ make_profile_number(double d, const char *str, size_t len) n->stptr = estrdup(str, len + 1); n->stptr[len] = '\0'; n->stlen = len; - n->flags |= NUMCONSTSTR; + // Set STRCUR and n->stfmt for use when profiling + // (i.e., actually running the program) so that + // force_string() on this item will work ok. + // Thanks and a tip of the hatlo to valgrind. + n->flags |= (NUMCONSTSTR|STRCUR); + n->stfmt = STFMT_UNUSED; } return n; diff --git a/io.c b/io.c index 816ff56a..6f9ffbf6 100644 --- a/io.c +++ b/io.c @@ -2742,8 +2742,9 @@ init_awkpath(path_info *pi) if (*p == envsep) max_path++; - emalloc(pi->awkpath, char **, (max_path + 1) * sizeof(char *), "init_awkpath"); - memset(pi->awkpath, 0, (max_path + 1) * sizeof(char *)); + // +3 --> 2 for null entries at front and end of path, 1 for NULL end of list + emalloc(pi->awkpath, char **, (max_path + 3) * sizeof(char *), "init_awkpath"); + memset(pi->awkpath, 0, (max_path + 3) * sizeof(char *)); start = path; i = 0; -- cgit v1.2.3 From 95aa1b0f60981430eb5cca81ead2d86d3c2793e1 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 31 Oct 2016 21:59:42 +0200 Subject: Add README.aix. Typo fix in README.zLinux. --- README_d/ChangeLog | 5 +++++ README_d/README.aix | 9 +++++++++ README_d/README.zLinux | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 README_d/README.aix diff --git a/README_d/ChangeLog b/README_d/ChangeLog index a9377f0f..da3ced84 100644 --- a/README_d/ChangeLog +++ b/README_d/ChangeLog @@ -1,3 +1,8 @@ +2016-10-31 Arnold D. Robbins + + * README.aix: New file. + * README.zLinux: Typo fix. + 2016-08-25 Arnold D. Robbins * 4.1.4: Release tar ball made. diff --git a/README_d/README.aix b/README_d/README.aix new file mode 100644 index 00000000..eb686fe6 --- /dev/null +++ b/README_d/README.aix @@ -0,0 +1,9 @@ +Mon Oct 31 21:54:05 IST 2016 +============================ + +To compile gawk 4.1.4 correctly with IBM's xlc compiler, you need to +use the -qalias=noansi command line option. Otherwise the compiler +makes incorrect optimizations and the resulting binary core dumps +on many tests. + +Thanks to Tony Reix (tony.reix@atos.net) for the info. diff --git a/README_d/README.zLinux b/README_d/README.zLinux index 2ff18fff..e9dbcb60 100644 --- a/README_d/README.zLinux +++ b/README_d/README.zLinux @@ -6,7 +6,7 @@ before compiling: 1. Run configure. 2. Edit the top-level Makefile and extension/Makefile and change -O2 to -O1. -3. Run `make && make' check as usual. +3. Run `make && make check' as usual. If you don't change the optimization level, the testext test will fail. -- cgit v1.2.3