public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFC: --enable-checking=valgrind.
@ 2002-11-10 17:35 Hans-Peter Nilsson
  2002-11-10 19:34 ` Zack Weinberg
  0 siblings, 1 reply; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-10 17:35 UTC (permalink / raw)
  To: gcc-patches

A conceptual patch.  Bootstrap still in progress on
i686-pc-linux-gnu.  Lots of bug indications so far...

Valgrind also has memory management instrumentation that
could be useful in marking what GC-allocated memory chunks
are actually not supposed to be accessed and similar.  This
first step runs valgrind on ./gen* and for the subprograms
called from gcc.

Thoughts?

gcc:
	* configure.in (--enable-checking=valgrind): New.
	* Makefile.in (VALGRIND_PATH, VALGRIND_CMD, VALGRIND_DEFINES):
	New variables.
	(HOST_CFLAGS, ALL_CFLAGS): Add $(VALGRIND_DEFINES).
	(executing gencheck, genconfigs, genconditions, genflags,
	gencodes, genconstants, genemit, genrecog, genopinit, genextract,
	genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds,
	gengtype, genprotos): Prepend $(VALGRIND_CMD).
	* gcc.c (execute): Arrange to prepend $(VALGRIND_PATH) -q to each
	command.
	* configure, config.in: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.622
diff -p -c -r1.622 configure.in
*** configure.in	7 Nov 2002 22:48:09 -0000	1.622
--- configure.in	11 Nov 2002 01:11:04 -0000
*************** no)	;;
*** 211,216 ****
--- 211,217 ----
  		rtl)	ac_rtl_checking=1 ;;
  		gc)	ac_gc_checking=1 ;;
  		gcac)	ac_gc_always_collect=1 ;;
+ 		valgrind)	ac_checking_valgrind=1 ;;
  		*)	AC_MSG_ERROR(unknown check category $check) ;;
  		esac
  	done
*************** if test x$ac_gc_always_collect != x ; th
*** 256,261 ****
--- 257,280 ----
     paranoid mode, validating the entire heap and collecting garbage at
     every opportunity.  This is extremely expensive.])
  fi
+ valgrind_defines=
+ valgrind_path=
+ valgrind_cmd=
+ if test x$ac_checking_valgrind != x ; then
+   AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
+ 	[$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
+   if test "x$valgrind_path" = "x" ; then
+ 	AC_MSG_ERROR([*** Can't find valgrind])
+   fi
+   valgrind_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
+   valgrind_cmd="$valgrind_path -q"
+   AC_DEFINE(ENABLE_VALGRIND, 1,
+ [Define if you want to run subprograms and generated programs
+    through valgrind (a memory checker).  This is rather expensive.])
+ fi
+ AC_SUBST(valgrind_defines)
+ AC_SUBST(valgrind_path)
+ AC_SUBST(valgrind_cmd)

  # Enable code coverage collection
  AC_ARG_ENABLE(coverage,
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.955
diff -p -c -r1.955 Makefile.in
*** Makefile.in	29 Oct 2002 21:37:13 -0000	1.955
--- Makefile.in	11 Nov 2002 01:11:07 -0000
*************** STRICT2_WARN = -Wtraditional -pedantic -
*** 96,101 ****
--- 96,106 ----
  # "extern" tags in header files.
  NOCOMMON_FLAG = @nocommon_flag@

+ # These are set by --enable-checking=valgrind.
+ VALGRIND_PATH = @valgrind_path@
+ VALGRIND_CMD = @valgrind_cmd@
+ VALGRIND_DEFINES = @valgrind_defines@
+
  # This is how we control whether or not the additional warnings are applied.
  .-warn = $(STRICT_WARN)
  GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG)
*************** BUILD_PREFIX = @BUILD_PREFIX@
*** 483,489 ****
  BUILD_PREFIX_1 = @BUILD_PREFIX_1@
  # Native compiler for the build machine and its switches.
  HOST_CC = @HOST_CC@
! HOST_CFLAGS= @HOST_CFLAGS@ -DGENERATOR_FILE

  # Native linker and preprocessor flags.  For x-fragment overrides.
  HOST_LDFLAGS=$(LDFLAGS)
--- 488,494 ----
  BUILD_PREFIX_1 = @BUILD_PREFIX_1@
  # Native compiler for the build machine and its switches.
  HOST_CC = @HOST_CC@
! HOST_CFLAGS= @HOST_CFLAGS@ -DGENERATOR_FILE $(VALGRIND_DEFINES)

  # Native linker and preprocessor flags.  For x-fragment overrides.
  HOST_LDFLAGS=$(LDFLAGS)
*************** INTERNAL_CFLAGS = -DIN_GCC @CROSS@
*** 602,608 ****
  # This is the variable actually used when we compile.
  # If you change this line, you probably also need to change the definition
  # of HOST_CFLAGS in build-make to match.
! ALL_CFLAGS = $(X_CFLAGS) $(T_CFLAGS) \
    $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@

  # Likewise.
--- 607,613 ----
  # This is the variable actually used when we compile.
  # If you change this line, you probably also need to change the definition
  # of HOST_CFLAGS in build-make to match.
! ALL_CFLAGS = $(X_CFLAGS) $(T_CFLAGS) $(VALGRIND_DEFINES) \
    $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@

  # Likewise.
*************** cppspec.o: cppspec.c $(CONFIG_H) $(SYSTE
*** 1282,1288 ****

  tree-check.h: s-check ; @true
  s-check : gencheck$(build_exeext) $(srcdir)/move-if-change
! 	./gencheck$(build_exeext) > tmp-check.h
  	$(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h
  	$(STAMP) s-check

--- 1287,1293 ----

  tree-check.h: s-check ; @true
  s-check : gencheck$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./gencheck$(build_exeext) > tmp-check.h
  	$(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h
  	$(STAMP) s-check

*************** mips-tdump.o : mips-tdump.c $(CONFIG_H)
*** 1689,1701 ****

  insn-config.h: s-config ; @true
  s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change
! 	./genconfig$(build_exeext) $(md_file) > tmp-config.h
  	$(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h
  	$(STAMP) s-config

  insn-conditions.c: s-conditions ; @true
  s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change
! 	./genconditions$(build_exeext) $(md_file) > tmp-conditions.c
  	$(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c
  	$(STAMP) s-conditions

--- 1694,1706 ----

  insn-config.h: s-config ; @true
  s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genconfig$(build_exeext) $(md_file) > tmp-config.h
  	$(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h
  	$(STAMP) s-config

  insn-conditions.c: s-conditions ; @true
  s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genconditions$(build_exeext) $(md_file) > tmp-conditions.c
  	$(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c
  	$(STAMP) s-conditions

*************** dummy-conditions.o : dummy-conditions.c
*** 1710,1728 ****

  insn-flags.h: s-flags ; @true
  s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change
! 	./genflags$(build_exeext) $(md_file) > tmp-flags.h
  	$(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h
  	$(STAMP) s-flags

  insn-codes.h: s-codes ; @true
  s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change
! 	./gencodes$(build_exeext) $(md_file) > tmp-codes.h
  	$(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h
  	$(STAMP) s-codes

  insn-constants.h: s-constants ; @true
  s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change
! 	./genconstants$(build_exeext) $(md_file) > tmp-constants.h
  	$(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h
  	$(STAMP) s-constants

--- 1715,1733 ----

  insn-flags.h: s-flags ; @true
  s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genflags$(build_exeext) $(md_file) > tmp-flags.h
  	$(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h
  	$(STAMP) s-flags

  insn-codes.h: s-codes ; @true
  s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./gencodes$(build_exeext) $(md_file) > tmp-codes.h
  	$(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h
  	$(STAMP) s-codes

  insn-constants.h: s-constants ; @true
  s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genconstants$(build_exeext) $(md_file) > tmp-constants.h
  	$(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h
  	$(STAMP) s-constants

*************** insn-emit.o : insn-emit.c $(CONFIG_H) $(
*** 1734,1740 ****

  insn-emit.c: s-emit ; @true
  s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change
! 	./genemit$(build_exeext) $(md_file) > tmp-emit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c
  	$(STAMP) s-emit

--- 1739,1745 ----

  insn-emit.c: s-emit ; @true
  s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genemit$(build_exeext) $(md_file) > tmp-emit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c
  	$(STAMP) s-emit

*************** insn-recog.o : insn-recog.c $(CONFIG_H)
*** 1746,1752 ****

  insn-recog.c: s-recog ; @true
  s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change
! 	./genrecog$(build_exeext) $(md_file) > tmp-recog.c
  	$(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c
  	$(STAMP) s-recog

--- 1751,1757 ----

  insn-recog.c: s-recog ; @true
  s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genrecog$(build_exeext) $(md_file) > tmp-recog.c
  	$(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c
  	$(STAMP) s-recog

*************** insn-opinit.o : insn-opinit.c $(CONFIG_H
*** 1757,1763 ****

  insn-opinit.c: s-opinit ; @true
  s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change
! 	./genopinit$(build_exeext) $(md_file) > tmp-opinit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
  	$(STAMP) s-opinit

--- 1762,1768 ----

  insn-opinit.c: s-opinit ; @true
  s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genopinit$(build_exeext) $(md_file) > tmp-opinit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
  	$(STAMP) s-opinit

*************** insn-extract.o : insn-extract.c $(CONFIG
*** 1768,1774 ****

  insn-extract.c: s-extract ; @true
  s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change
! 	./genextract$(build_exeext) $(md_file) > tmp-extract.c
  	$(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c
  	$(STAMP) s-extract

--- 1773,1779 ----

  insn-extract.c: s-extract ; @true
  s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genextract$(build_exeext) $(md_file) > tmp-extract.c
  	$(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c
  	$(STAMP) s-extract

*************** insn-peep.o : insn-peep.c $(CONFIG_H) $(
*** 1779,1785 ****

  insn-peep.c: s-peep ; @true
  s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change
! 	./genpeep$(build_exeext) $(md_file) > tmp-peep.c
  	$(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c
  	$(STAMP) s-peep

--- 1784,1790 ----

  insn-peep.c: s-peep ; @true
  s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genpeep$(build_exeext) $(md_file) > tmp-peep.c
  	$(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c
  	$(STAMP) s-peep

*************** insn-attrtab.o : insn-attrtab.c $(CONFIG
*** 1791,1803 ****

  insn-attr.h: s-attr ; @true
  s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change
! 	./genattr$(build_exeext) $(md_file) > tmp-attr.h
  	$(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h
  	$(STAMP) s-attr

  insn-attrtab.c: s-attrtab ; @true
  s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change
! 	./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
  	$(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
  	$(STAMP) s-attrtab

--- 1796,1808 ----

  insn-attr.h: s-attr ; @true
  s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genattr$(build_exeext) $(md_file) > tmp-attr.h
  	$(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h
  	$(STAMP) s-attr

  insn-attrtab.c: s-attrtab ; @true
  s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
  	$(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
  	$(STAMP) s-attrtab

*************** insn-output.o : insn-output.c $(CONFIG_H
*** 1810,1816 ****

  insn-output.c: s-output ; @true
  s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change
! 	./genoutput$(build_exeext) $(md_file) > tmp-output.c
  	$(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c
  	$(STAMP) s-output

--- 1815,1821 ----

  insn-output.c: s-output ; @true
  s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genoutput$(build_exeext) $(md_file) > tmp-output.c
  	$(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c
  	$(STAMP) s-output

*************** genrtl.c genrtl.h : s-genrtl
*** 1819,1834 ****
  	@true	# force gnu make to recheck modification times.

  s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H)
! 	./gengenrtl$(build_exeext) -h > tmp-genrtl.h
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
! 	./gengenrtl$(build_exeext) > tmp-genrtl.c
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
  	$(STAMP) s-genrtl

  tm-preds.h: s-preds; @true

  s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
! 	./genpreds$(build_exeext) > tmp-preds.h
  	$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
  	$(STAMP) s-preds

--- 1824,1839 ----
  	@true	# force gnu make to recheck modification times.

  s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H)
! 	$(VALGRIND_CMD) ./gengenrtl$(build_exeext) -h > tmp-genrtl.h
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
! 	$(VALGRIND_CMD) ./gengenrtl$(build_exeext) > tmp-genrtl.c
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
  	$(STAMP) s-genrtl

  tm-preds.h: s-preds; @true

  s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genpreds$(build_exeext) > tmp-preds.h
  	$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
  	$(STAMP) s-preds

*************** gtyp-gen.h: Makefile
*** 1893,1899 ****
  	$(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h

  s-gtype: gengtype$(build_exeext) $(GTFILES)
! 	./gengtype
  	$(STAMP) s-gtype

  #
--- 1898,1904 ----
  	$(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h

  s-gtype: gengtype$(build_exeext) $(GTFILES)
! 	$(VALGRIND_CMD) ./gengtype
  	$(STAMP) s-gtype

  #
*************** xsys-protos.h: $(GCC_PASSES) $(srcdir)/s
*** 2401,2407 ****
  	mv tmp-fixtmp.c fixtmp.c
  	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
  	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
! 	  | ./gen-protos >xsys-protos.hT
  	mv xsys-protos.hT xsys-protos.h
  	rm -rf fixtmp.c

--- 2406,2412 ----
  	mv tmp-fixtmp.c fixtmp.c
  	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
  	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
! 	  | $(VALGRIND_CMD) ./gen-protos >xsys-protos.hT
  	mv xsys-protos.hT xsys-protos.h
  	rm -rf fixtmp.c

Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.344
diff -p -c -r1.344 gcc.c
*** gcc.c	14 Oct 2002 07:15:38 -0000	1.344
--- gcc.c	11 Nov 2002 01:11:09 -0000
*************** execute ()
*** 2843,2848 ****
--- 2843,2874 ----
  #endif /* DEBUG */
      }

+ #ifdef ENABLE_VALGRIND
+   /* Run the each command through valgrind.  Allocate a separate argv
+      array to prepend the path to valgrind and "-q" for quiet operation.  */
+
+   for (i = 0; i < n_commands; i++)
+     {
+       const char **argv;
+       int argc;
+       int j;
+
+       for (argc = 0; commands[i].argv[argc] != NULL; argc++)
+ 	;
+
+       argv = alloca ((argc + 3) * sizeof (char *));
+
+       argv[0] = VALGRIND_PATH;
+       argv[1] = "-q";
+       argv[argc + 2] = NULL;
+       for (j = 0; j < argc; j++)
+ 	argv[j + 2] = commands[i].argv[j];
+
+       commands[i].argv = argv;
+       commands[i].prog = argv[0];
+     }
+ #endif
+
    /* Run each piped subprocess.  */

    for (i = 0; i < n_commands; i++)

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-10 17:35 RFC: --enable-checking=valgrind Hans-Peter Nilsson
@ 2002-11-10 19:34 ` Zack Weinberg
  2002-11-11  1:55   ` Hans-Peter Nilsson
  0 siblings, 1 reply; 25+ messages in thread
From: Zack Weinberg @ 2002-11-10 19:34 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

On Sun, Nov 10, 2002 at 08:35:36PM -0500, Hans-Peter Nilsson wrote:
> A conceptual patch.  Bootstrap still in progress on
> i686-pc-linux-gnu.  Lots of bug indications so far...

I bet many of those indications will go away if you add annotations to
cppfiles.c so that it knows what's going on with mmap().  valgrind
defines the accessible memory area of an mmap region to be precisely
the size passed to mmap; cpplib will touch one byte beyond that (it
knows that the kernel will round up the region to a page boundary and
zero-fill the intervening space).

zw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-10 19:34 ` Zack Weinberg
@ 2002-11-11  1:55   ` Hans-Peter Nilsson
  2002-11-11 16:53     ` Zack Weinberg
  2002-11-18 17:20     ` Richard Henderson
  0 siblings, 2 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-11  1:55 UTC (permalink / raw)
  To: gcc-patches

On Sun, 10 Nov 2002, Zack Weinberg wrote:

> On Sun, Nov 10, 2002 at 08:35:36PM -0500, Hans-Peter Nilsson wrote:
> > A conceptual patch.  Bootstrap still in progress on
> > i686-pc-linux-gnu.  Lots of bug indications so far...
>
> I bet many of those indications will go away if you add annotations to
> cppfiles.c so that it knows what's going on with mmap().

Oh right, that cute mmap trick...  With this updated patch, the
"many-many" indications from cppfiles are replaced by "many",
for example the following first one.  I don't know what causes
that "Line number overflow detected" message, but perhaps old
binutils.

--5784-- Line number overflow detected (65535 --> 0) in insn-recog.c
==5784== Conditional jump or move depends on uninitialised value(s)
==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)
==5784==    by 0x81C536E: insn_default_length (insn-attrtab.c:594)
==5784==    by 0x817160F: shorten_branches (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/final.c:1334)
==5784==    by 0x836F421: rest_of_compilation (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/toplev.c:3546)
==5784==
==5784== Conditional jump or move depends on uninitialised value(s)
==5784==    at 0x81EE5AB: get_attr_prefix_0f (insn-attrtab.c:23298)
==5784==    by 0x81C536E: insn_default_length (insn-attrtab.c:594)
==5784==    by 0x817160F: shorten_branches (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/final.c:1334)
==5784==    by 0x836F421: rest_of_compilation (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/toplev.c:3546)
==5784==
==5784== Conditional jump or move depends on uninitialised value(s)
==5784==    at 0x81E5FD3: get_attr_length_immediate (insn-attrtab.c:16579)
==5784==    by 0x81C5399: insn_default_length (insn-attrtab.c:594)
==5784==    by 0x817160F: shorten_branches (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/final.c:1334)
==5784==    by 0x836F421: rest_of_compilation (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/toplev.c:3546)
==5784==
==5784== Conditional jump or move depends on uninitialised value(s)
==5784==    at 0x81E607C: get_attr_length_immediate (insn-attrtab.c:16579)
==5784==    by 0x81C5399: insn_default_length (insn-attrtab.c:594)
==5784==    by 0x817160F: shorten_branches (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/final.c:1334)
==5784==    by 0x836F421: rest_of_compilation (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/toplev.c:3546)


	* cppfiles.c (read_include_file) [ENABLE_VALGRIND]: When doing the
	mmap+1 trick, annotate the byte after the mmap:ed area as readable.
	* configure.in (--enable-checking=valgrind): New.
	* Makefile.in (VALGRIND_PATH, VALGRIND_CMD, VALGRIND_DEFINES):
	New variables.
	(HOST_CFLAGS, ALL_CFLAGS): Add $(VALGRIND_DEFINES).
	(executing gencheck, genconfigs, genconditions, genflags,
	gencodes, genconstants, genemit, genrecog, genopinit, genextract,
	genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds,
	gengtype, genprotos): Prepend $(VALGRIND_CMD).
	* gcc.c (execute) [ENABLE_VALGRIND]: Arrange to prepend
	$(VALGRIND_PATH) -q to each command.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.622
diff -p -c -r1.622 configure.in
*** configure.in	7 Nov 2002 22:48:09 -0000	1.622
--- configure.in	11 Nov 2002 09:46:29 -0000
*************** AC_ARG_ENABLE(multilib,
*** 182,187 ****
--- 182,191 ----
  [], [enable_multilib=yes])
  AC_SUBST(enable_multilib)

+ # Find the native compiler
+ AC_PROG_CC
+ AC_PROG_CPP
+
  # Enable expensive internal checks
  AC_ARG_ENABLE(checking,
  [  --enable-checking[=LIST]
*************** no)	;;
*** 211,216 ****
--- 215,221 ----
  		rtl)	ac_rtl_checking=1 ;;
  		gc)	ac_gc_checking=1 ;;
  		gcac)	ac_gc_always_collect=1 ;;
+ 		valgrind)	ac_checking_valgrind=1 ;;
  		*)	AC_MSG_ERROR(unknown check category $check) ;;
  		esac
  	done
*************** if test x$ac_gc_always_collect != x ; th
*** 256,261 ****
--- 261,287 ----
     paranoid mode, validating the entire heap and collecting garbage at
     every opportunity.  This is extremely expensive.])
  fi
+ valgrind_defines=
+ valgrind_path=
+ valgrind_cmd=
+ if test x$ac_checking_valgrind != x ; then
+   # It is physically possible that there's valgrind but no valgrind.h, but
+   # gcc relies on making annotations so we must require it to be there.
+   AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
+   AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
+ 	[$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
+   if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then
+ 	AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h])
+   fi
+   valgrind_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
+   valgrind_cmd="$valgrind_path -q"
+   AC_DEFINE(ENABLE_VALGRIND, 1,
+ [Define if you want to run subprograms and generated programs
+    through valgrind (a memory checker).  This is rather expensive.])
+ fi
+ AC_SUBST(valgrind_defines)
+ AC_SUBST(valgrind_path)
+ AC_SUBST(valgrind_cmd)

  # Enable code coverage collection
  AC_ARG_ENABLE(coverage,
*************** AC_CANONICAL_SYSTEM
*** 379,386 ****
  # Set program_transform_name
  AC_ARG_PROGRAM

- # Find the native compiler
- AC_PROG_CC
  AC_PROG_CC_C_O
  # autoconf is lame and doesn't give us any substitution variable for this.
  if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
--- 405,410 ----
*************** if test $ac_cv_prog_cc_no_long_long = ye
*** 425,431 ****
  fi
  AC_SUBST(strict1_warn)

- AC_PROG_CPP
  AC_C_INLINE
  gcc_AC_C_VOLATILE

--- 449,454 ----
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.955
diff -p -c -r1.955 Makefile.in
*** Makefile.in	29 Oct 2002 21:37:13 -0000	1.955
--- Makefile.in	11 Nov 2002 09:46:30 -0000
*************** STRICT2_WARN = -Wtraditional -pedantic -
*** 96,101 ****
--- 96,106 ----
  # "extern" tags in header files.
  NOCOMMON_FLAG = @nocommon_flag@

+ # These are set by --enable-checking=valgrind.
+ VALGRIND_PATH = @valgrind_path@
+ VALGRIND_CMD = @valgrind_cmd@
+ VALGRIND_DEFINES = @valgrind_defines@
+
  # This is how we control whether or not the additional warnings are applied.
  .-warn = $(STRICT_WARN)
  GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG)
*************** BUILD_PREFIX = @BUILD_PREFIX@
*** 483,489 ****
  BUILD_PREFIX_1 = @BUILD_PREFIX_1@
  # Native compiler for the build machine and its switches.
  HOST_CC = @HOST_CC@
! HOST_CFLAGS= @HOST_CFLAGS@ -DGENERATOR_FILE

  # Native linker and preprocessor flags.  For x-fragment overrides.
  HOST_LDFLAGS=$(LDFLAGS)
--- 488,494 ----
  BUILD_PREFIX_1 = @BUILD_PREFIX_1@
  # Native compiler for the build machine and its switches.
  HOST_CC = @HOST_CC@
! HOST_CFLAGS= @HOST_CFLAGS@ -DGENERATOR_FILE $(VALGRIND_DEFINES)

  # Native linker and preprocessor flags.  For x-fragment overrides.
  HOST_LDFLAGS=$(LDFLAGS)
*************** INTERNAL_CFLAGS = -DIN_GCC @CROSS@
*** 602,608 ****
  # This is the variable actually used when we compile.
  # If you change this line, you probably also need to change the definition
  # of HOST_CFLAGS in build-make to match.
! ALL_CFLAGS = $(X_CFLAGS) $(T_CFLAGS) \
    $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@

  # Likewise.
--- 607,613 ----
  # This is the variable actually used when we compile.
  # If you change this line, you probably also need to change the definition
  # of HOST_CFLAGS in build-make to match.
! ALL_CFLAGS = $(X_CFLAGS) $(T_CFLAGS) $(VALGRIND_DEFINES) \
    $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@

  # Likewise.
*************** cppspec.o: cppspec.c $(CONFIG_H) $(SYSTE
*** 1282,1288 ****

  tree-check.h: s-check ; @true
  s-check : gencheck$(build_exeext) $(srcdir)/move-if-change
! 	./gencheck$(build_exeext) > tmp-check.h
  	$(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h
  	$(STAMP) s-check

--- 1287,1293 ----

  tree-check.h: s-check ; @true
  s-check : gencheck$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./gencheck$(build_exeext) > tmp-check.h
  	$(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h
  	$(STAMP) s-check

*************** mips-tdump.o : mips-tdump.c $(CONFIG_H)
*** 1689,1701 ****

  insn-config.h: s-config ; @true
  s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change
! 	./genconfig$(build_exeext) $(md_file) > tmp-config.h
  	$(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h
  	$(STAMP) s-config

  insn-conditions.c: s-conditions ; @true
  s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change
! 	./genconditions$(build_exeext) $(md_file) > tmp-conditions.c
  	$(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c
  	$(STAMP) s-conditions

--- 1694,1706 ----

  insn-config.h: s-config ; @true
  s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genconfig$(build_exeext) $(md_file) > tmp-config.h
  	$(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h
  	$(STAMP) s-config

  insn-conditions.c: s-conditions ; @true
  s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genconditions$(build_exeext) $(md_file) > tmp-conditions.c
  	$(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c
  	$(STAMP) s-conditions

*************** dummy-conditions.o : dummy-conditions.c
*** 1710,1728 ****

  insn-flags.h: s-flags ; @true
  s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change
! 	./genflags$(build_exeext) $(md_file) > tmp-flags.h
  	$(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h
  	$(STAMP) s-flags

  insn-codes.h: s-codes ; @true
  s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change
! 	./gencodes$(build_exeext) $(md_file) > tmp-codes.h
  	$(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h
  	$(STAMP) s-codes

  insn-constants.h: s-constants ; @true
  s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change
! 	./genconstants$(build_exeext) $(md_file) > tmp-constants.h
  	$(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h
  	$(STAMP) s-constants

--- 1715,1733 ----

  insn-flags.h: s-flags ; @true
  s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genflags$(build_exeext) $(md_file) > tmp-flags.h
  	$(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h
  	$(STAMP) s-flags

  insn-codes.h: s-codes ; @true
  s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./gencodes$(build_exeext) $(md_file) > tmp-codes.h
  	$(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h
  	$(STAMP) s-codes

  insn-constants.h: s-constants ; @true
  s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genconstants$(build_exeext) $(md_file) > tmp-constants.h
  	$(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h
  	$(STAMP) s-constants

*************** insn-emit.o : insn-emit.c $(CONFIG_H) $(
*** 1734,1740 ****

  insn-emit.c: s-emit ; @true
  s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change
! 	./genemit$(build_exeext) $(md_file) > tmp-emit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c
  	$(STAMP) s-emit

--- 1739,1745 ----

  insn-emit.c: s-emit ; @true
  s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genemit$(build_exeext) $(md_file) > tmp-emit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c
  	$(STAMP) s-emit

*************** insn-recog.o : insn-recog.c $(CONFIG_H)
*** 1746,1752 ****

  insn-recog.c: s-recog ; @true
  s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change
! 	./genrecog$(build_exeext) $(md_file) > tmp-recog.c
  	$(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c
  	$(STAMP) s-recog

--- 1751,1757 ----

  insn-recog.c: s-recog ; @true
  s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genrecog$(build_exeext) $(md_file) > tmp-recog.c
  	$(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c
  	$(STAMP) s-recog

*************** insn-opinit.o : insn-opinit.c $(CONFIG_H
*** 1757,1763 ****

  insn-opinit.c: s-opinit ; @true
  s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change
! 	./genopinit$(build_exeext) $(md_file) > tmp-opinit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
  	$(STAMP) s-opinit

--- 1762,1768 ----

  insn-opinit.c: s-opinit ; @true
  s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genopinit$(build_exeext) $(md_file) > tmp-opinit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
  	$(STAMP) s-opinit

*************** insn-extract.o : insn-extract.c $(CONFIG
*** 1768,1774 ****

  insn-extract.c: s-extract ; @true
  s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change
! 	./genextract$(build_exeext) $(md_file) > tmp-extract.c
  	$(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c
  	$(STAMP) s-extract

--- 1773,1779 ----

  insn-extract.c: s-extract ; @true
  s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genextract$(build_exeext) $(md_file) > tmp-extract.c
  	$(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c
  	$(STAMP) s-extract

*************** insn-peep.o : insn-peep.c $(CONFIG_H) $(
*** 1779,1785 ****

  insn-peep.c: s-peep ; @true
  s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change
! 	./genpeep$(build_exeext) $(md_file) > tmp-peep.c
  	$(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c
  	$(STAMP) s-peep

--- 1784,1790 ----

  insn-peep.c: s-peep ; @true
  s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genpeep$(build_exeext) $(md_file) > tmp-peep.c
  	$(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c
  	$(STAMP) s-peep

*************** insn-attrtab.o : insn-attrtab.c $(CONFIG
*** 1791,1803 ****

  insn-attr.h: s-attr ; @true
  s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change
! 	./genattr$(build_exeext) $(md_file) > tmp-attr.h
  	$(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h
  	$(STAMP) s-attr

  insn-attrtab.c: s-attrtab ; @true
  s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change
! 	./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
  	$(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
  	$(STAMP) s-attrtab

--- 1796,1808 ----

  insn-attr.h: s-attr ; @true
  s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genattr$(build_exeext) $(md_file) > tmp-attr.h
  	$(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h
  	$(STAMP) s-attr

  insn-attrtab.c: s-attrtab ; @true
  s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
  	$(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
  	$(STAMP) s-attrtab

*************** insn-output.o : insn-output.c $(CONFIG_H
*** 1810,1816 ****

  insn-output.c: s-output ; @true
  s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change
! 	./genoutput$(build_exeext) $(md_file) > tmp-output.c
  	$(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c
  	$(STAMP) s-output

--- 1815,1821 ----

  insn-output.c: s-output ; @true
  s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genoutput$(build_exeext) $(md_file) > tmp-output.c
  	$(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c
  	$(STAMP) s-output

*************** genrtl.c genrtl.h : s-genrtl
*** 1819,1834 ****
  	@true	# force gnu make to recheck modification times.

  s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H)
! 	./gengenrtl$(build_exeext) -h > tmp-genrtl.h
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
! 	./gengenrtl$(build_exeext) > tmp-genrtl.c
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
  	$(STAMP) s-genrtl

  tm-preds.h: s-preds; @true

  s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
! 	./genpreds$(build_exeext) > tmp-preds.h
  	$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
  	$(STAMP) s-preds

--- 1824,1839 ----
  	@true	# force gnu make to recheck modification times.

  s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H)
! 	$(VALGRIND_CMD) ./gengenrtl$(build_exeext) -h > tmp-genrtl.h
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
! 	$(VALGRIND_CMD) ./gengenrtl$(build_exeext) > tmp-genrtl.c
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
  	$(STAMP) s-genrtl

  tm-preds.h: s-preds; @true

  s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
! 	$(VALGRIND_CMD) ./genpreds$(build_exeext) > tmp-preds.h
  	$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
  	$(STAMP) s-preds

*************** gtyp-gen.h: Makefile
*** 1893,1899 ****
  	$(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h

  s-gtype: gengtype$(build_exeext) $(GTFILES)
! 	./gengtype
  	$(STAMP) s-gtype

  #
--- 1898,1904 ----
  	$(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h

  s-gtype: gengtype$(build_exeext) $(GTFILES)
! 	$(VALGRIND_CMD) ./gengtype
  	$(STAMP) s-gtype

  #
*************** xsys-protos.h: $(GCC_PASSES) $(srcdir)/s
*** 2401,2407 ****
  	mv tmp-fixtmp.c fixtmp.c
  	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
  	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
! 	  | ./gen-protos >xsys-protos.hT
  	mv xsys-protos.hT xsys-protos.h
  	rm -rf fixtmp.c

--- 2406,2412 ----
  	mv tmp-fixtmp.c fixtmp.c
  	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
  	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
! 	  | $(VALGRIND_CMD) ./gen-protos >xsys-protos.hT
  	mv xsys-protos.hT xsys-protos.h
  	rm -rf fixtmp.c

Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.344
diff -p -c -r1.344 gcc.c
*** gcc.c	14 Oct 2002 07:15:38 -0000	1.344
--- gcc.c	11 Nov 2002 09:46:32 -0000
*************** execute ()
*** 2843,2848 ****
--- 2843,2874 ----
  #endif /* DEBUG */
      }

+ #ifdef ENABLE_VALGRIND
+   /* Run the each command through valgrind.  Allocate a separate argv
+      array to prepend the path to valgrind and "-q" for quiet operation.  */
+
+   for (i = 0; i < n_commands; i++)
+     {
+       const char **argv;
+       int argc;
+       int j;
+
+       for (argc = 0; commands[i].argv[argc] != NULL; argc++)
+ 	;
+
+       argv = alloca ((argc + 3) * sizeof (char *));
+
+       argv[0] = VALGRIND_PATH;
+       argv[1] = "-q";
+       argv[argc + 2] = NULL;
+       for (j = 0; j < argc; j++)
+ 	argv[j + 2] = commands[i].argv[j];
+
+       commands[i].argv = argv;
+       commands[i].prog = argv[0];
+     }
+ #endif
+
    /* Run each piped subprocess.  */

    for (i = 0; i < n_commands; i++)
Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.156
diff -p -c -r1.156 cppfiles.c
*** cppfiles.c	22 Sep 2002 02:03:16 -0000	1.156
--- cppfiles.c	11 Nov 2002 09:46:32 -0000
*************** Foundation, 59 Temple Place - Suite 330,
*** 27,32 ****
--- 27,35 ----
  #include "intl.h"
  #include "mkdeps.h"
  #include "splay-tree.h"
+ #ifdef ENABLE_VALGRIND
+ #include <valgrind.h>
+ #endif

  #ifdef HAVE_MMAP_FILE
  # include <sys/mman.h>
*************** read_include_file (pfile, inc)
*** 418,423 ****
--- 421,433 ----
  	  buf = (uchar *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
  	  if (buf == (uchar *)-1)
  	    goto perror_fail;
+
+ #ifdef ENABLE_VALGRIND
+ 	  /* We must tell Valgrind that the byte at buf[size] is
+ 	     actually readable.  */
+ 	  VALGRIND_MAKE_READABLE (buf + size, 1);
+ #endif
+
  	  inc->mapped = 1;
  	}
        else

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-11  1:55   ` Hans-Peter Nilsson
@ 2002-11-11 16:53     ` Zack Weinberg
  2002-11-11 17:48       ` Hans-Peter Nilsson
  2002-11-12  6:02       ` Jan Hubicka
  2002-11-18 17:20     ` Richard Henderson
  1 sibling, 2 replies; 25+ messages in thread
From: Zack Weinberg @ 2002-11-11 16:53 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> > I bet many of those indications will go away if you add annotations to
> > cppfiles.c so that it knows what's going on with mmap().
> 
> Oh right, that cute mmap trick...  With this updated patch, the
> "many-many" indications from cppfiles are replaced by "many",
> for example the following first one.

...

> ==5784== Conditional jump or move depends on uninitialised value(s)
> ==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)
> ==5784==    by 0x81C536E: insn_default_length (insn-attrtab.c:594)
> ==5784==    by 0x817160F: shorten_branches (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/final.c:1334)
> ==5784==    by 0x836F421: rest_of_compilation (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/toplev.c:3546)
> ==5784==

Hmm.  This is probabably just one bug, in genattrtab, but genattrtab
is such a mess I don't know where to begin looking.

What's on line 23298 of insn-attrtab.c?

> I don't know what causes that "Line number overflow detected"
> message, but perhaps old binutils.

The stabs debug format has a limit of 65535 lines in a single
translation unit; the x86 insn-recog.c is 54827 lines before #include
processing, presumably the headers push it over the edge.  DWARF can
handle this, or we can talk about ways to shrink it.
 
> 	* cppfiles.c (read_include_file) [ENABLE_VALGRIND]: When doing the
> 	mmap+1 trick, annotate the byte after the mmap:ed area as readable.

I think you also need to clear the annotation again when the map is
deallocated, or that one byte might continue to be considered
readable.  Probably want to hang onto the region ID, too.

zw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-11 16:53     ` Zack Weinberg
@ 2002-11-11 17:48       ` Hans-Peter Nilsson
  2002-11-12  6:02       ` Jan Hubicka
  1 sibling, 0 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-11 17:48 UTC (permalink / raw)
  To: gcc-patches

On Mon, 11 Nov 2002, Zack Weinberg wrote:
> On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> > ==5784== Conditional jump or move depends on uninitialised value(s)
> > ==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)

> Hmm.  This is probabably just one bug, in genattrtab, but genattrtab
> is such a mess I don't know where to begin looking.

Yes, most are this very bug or similar-looking get_attr* ones
elsewhere in insn-attrtab.c.  I didn't look close at it.

> What's on line 23298 of insn-attrtab.c?

Well, I didn't look. :-)  I want to enable the use of valgrind
*first*, *then* it's easy to catch errors and fix twisty
annotation needs.  (Actually, I saw nothing obvious -- some
macro invocations on items that looked valid, a line 391 chars
long.)

> > I don't know what causes that "Line number overflow detected"
> > message, but perhaps old binutils.
>
> The stabs debug format has a limit of 65535 lines in a single
> translation unit

Right; it dawned on me that this is the stage1 compiler running,
compiled with the host egcs-1.1.2 compiler, so it has stabs in
its *executable*; stage2 will be without.  (I'm quickstrapping
it now after my autokiller killed it for breaking the 200M
ulimit household rules.  It does slow things down running in a
simulator...)

> > 	* cppfiles.c (read_include_file) [ENABLE_VALGRIND]: When doing the
> > 	mmap+1 trick, annotate the byte after the mmap:ed area as readable.
>
> I think you also need to clear the annotation again when the map is
> deallocated, or that one byte might continue to be considered
> readable.  Probably want to hang onto the region ID, too.

Yeah, sure.  I think you're focusing too much on details at this
time.  This is primarily a conceptual patch, as mentioned, and
the point was that this kind of annotation is possible and
simple.  It's a "hey, I think we should have
--enable-checking=valgrind" with the patch as a proof of
concept.  (BTW, do you want the region ID for something in
particular?  Or do you just think it'd be handy?)

So what do you (the general you) think?
Is it worth having?  Is this a wrong move?
What'd be the showstoppers?

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-11 16:53     ` Zack Weinberg
  2002-11-11 17:48       ` Hans-Peter Nilsson
@ 2002-11-12  6:02       ` Jan Hubicka
  2002-11-12 17:11         ` Hans-Peter Nilsson
  1 sibling, 1 reply; 25+ messages in thread
From: Jan Hubicka @ 2002-11-12  6:02 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Hans-Peter Nilsson, gcc-patches

> On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> > > I bet many of those indications will go away if you add annotations to
> > > cppfiles.c so that it knows what's going on with mmap().
> > 
> > Oh right, that cute mmap trick...  With this updated patch, the
> > "many-many" indications from cppfiles are replaced by "many",
> > for example the following first one.
> 
> ...
> 
> > ==5784== Conditional jump or move depends on uninitialised value(s)
> > ==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)
> > ==5784==    by 0x81C536E: insn_default_length (insn-attrtab.c:594)
> > ==5784==    by 0x817160F: shorten_branches (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/final.c:1334)
> > ==5784==    by 0x836F421: rest_of_compilation (/home/hp/cvs_areas/gcc/cvs_write/egcs/gcc/toplev.c:3546)
> > ==5784==
> 
> Hmm.  This is probabably just one bug, in genattrtab, but genattrtab
> is such a mess I don't know where to begin looking.
It is probably bug in the machine description.
We use type information to figure out how many arguments instruction
have.
In case it has fewer arugments, we access uninitialized memory that
"usually works :)".  If you will just go to gdb and do "p debug_rtx (insn)"
I think I can fix the bugs easilly.
What we should do in this case is to eighter invent new type or set the
problematic attributes explicitly in the patern... 
valgrind looks really usefull :)

Honza
> 
> What's on line 23298 of insn-attrtab.c?
> 
> > I don't know what causes that "Line number overflow detected"
> > message, but perhaps old binutils.
> 
> The stabs debug format has a limit of 65535 lines in a single
> translation unit; the x86 insn-recog.c is 54827 lines before #include
> processing, presumably the headers push it over the edge.  DWARF can
> handle this, or we can talk about ways to shrink it.
>  
> > 	* cppfiles.c (read_include_file) [ENABLE_VALGRIND]: When doing the
> > 	mmap+1 trick, annotate the byte after the mmap:ed area as readable.
> 
> I think you also need to clear the annotation again when the map is
> deallocated, or that one byte might continue to be considered
> readable.  Probably want to hang onto the region ID, too.
> 
> zw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-12  6:02       ` Jan Hubicka
@ 2002-11-12 17:11         ` Hans-Peter Nilsson
  2002-11-12 17:21           ` Zack Weinberg
  2002-11-13  5:32           ` Jan Hubicka
  0 siblings, 2 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-12 17:11 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Zack Weinberg, gcc-patches

On Tue, 12 Nov 2002, Jan Hubicka wrote:
> > On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> > > ==5784== Conditional jump or move depends on uninitialised value(s)
> > > ==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)

> > Hmm.  This is probabably just one bug, in genattrtab, but genattrtab
> > is such a mess I don't know where to begin looking.
> It is probably bug in the machine description.
> We use type information to figure out how many arguments instruction
> have.
> In case it has fewer arugments, we access uninitialized memory that
> "usually works :)".  If you will just go to gdb and do "p debug_rtx (insn)"
> I think I can fix the bugs easilly.

Hum, as I said I was just soliciting feedback about whether this
feature would be useful at all, and would then rather get the
patch into shape to be applied so people can do this by
themselves.  But since you think it's useful and Zack dives into
reviewing the details, I guess it is, and it's time to shape up
the damn patch. :-)

It'll take a week to run regression tests, so I hope I can just
settle for a successful bootstrap & check without
--enable-checking=valgrind and a successful bootstrap with it.
Bootstrap hasn't even finished compiling the java libs.  Maybe I
can get a "discount", to just need --enable-languages=c.

Here's the insn in get_attr_prefix_0f for the first trigging call
when, with a suitable --save-temps, doing
valgrind  --num-callers=20 --gdb-attach=yes ./stage1/cc1
 -fpreprocessed libgcc2.i -quiet -dumpbase libgcc2.c
 -auxbase-strip /tmp/bb.s -g -O2 -W -Wall  -Wwrite-strings
 -Wstrict-prototypes -Wmissing-prototypes -version -fPIC -o /tmp/bb.s
(I can't seem to get useful debug info out of the bootstrapped
cc1, using gdb-5.2.1)

Please excuse the line-wrapping.

(jump_insn:HI 22 285 36 0x4176ba50 (set (pc)
        (if_then_else (lt (reg:CCGOC 17 flags)
                (const_int 0 [0x0]))
            (label_ref 295)
            (pc))) 509 {*jcc_1} (insn_list:REG_DEP_ANTI 268 (insn_list:REG_DEP_ANTI 263 (insn_list:REG_DEP_ANTI 264
(insn_list:REG_DEP_ANTI 5 (insn_list:REG_DEP_ANTI 208 (insn_list:REG_DEP_ANTI 209 (insn_list:REG_DEP_ANTI 284 (insn_list 285
(insn_list:REG_DEP_ANTI 267 (insn_list:REG_DEP_ANTI 269 (insn_list:REG_DEP_ANTI 270 (insn_list:REG_DEP_ANTI 271 (insn_list:REG_DEP_ANTI 265
(insn_list:REG_DEP_ANTI 266 (insn_list:REG_DEP_ANTI 226 (nil))))))))))))))))
    (expr_list:REG_DEAD (reg:CCGOC 17 flags)
        (expr_list:REG_BR_PROB (const_int 2100 [0x834])
            (nil))))

the same insn also trigs later, for a total of three
indications.

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-12 17:11         ` Hans-Peter Nilsson
@ 2002-11-12 17:21           ` Zack Weinberg
  2002-11-13  5:32           ` Jan Hubicka
  1 sibling, 0 replies; 25+ messages in thread
From: Zack Weinberg @ 2002-11-12 17:21 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Jan Hubicka, gcc-patches

On Tue, Nov 12, 2002 at 08:11:06PM -0500, Hans-Peter Nilsson wrote:
> 
> Hum, as I said I was just soliciting feedback about whether this
> feature would be useful at all, and would then rather get the
> patch into shape to be applied so people can do this by
> themselves.  But since you think it's useful and Zack dives into
> reviewing the details, I guess it is, and it's time to shape up
> the damn patch. :-)

I definitely think it's useful -- especially if you add annotation
logic to ggc-page.c so it knows object boundaries.  (I just found a
(harmless) access-past-end-of-object bug by running cc1plus under
valgrind -- with ggc-simple.c; when ggc-page.c's in use it has no
clue.)

zw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-12 17:11         ` Hans-Peter Nilsson
  2002-11-12 17:21           ` Zack Weinberg
@ 2002-11-13  5:32           ` Jan Hubicka
  2002-11-13 13:38             ` Hans-Peter Nilsson
  1 sibling, 1 reply; 25+ messages in thread
From: Jan Hubicka @ 2002-11-13  5:32 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Jan Hubicka, Zack Weinberg, gcc-patches

> On Tue, 12 Nov 2002, Jan Hubicka wrote:
> > > On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> > > > ==5784== Conditional jump or move depends on uninitialised value(s)
> > > > ==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)
> 
> > > Hmm.  This is probabably just one bug, in genattrtab, but genattrtab
> > > is such a mess I don't know where to begin looking.
> > It is probably bug in the machine description.
> > We use type information to figure out how many arguments instruction
> > have.
> > In case it has fewer arugments, we access uninitialized memory that
> > "usually works :)".  If you will just go to gdb and do "p debug_rtx (insn)"
> > I think I can fix the bugs easilly.
> 
> Hum, as I said I was just soliciting feedback about whether this
> feature would be useful at all, and would then rather get the
> patch into shape to be applied so people can do this by
> themselves.  But since you think it's useful and Zack dives into
> reviewing the details, I guess it is, and it's time to shape up
> the damn patch. :-)
> 
> It'll take a week to run regression tests, so I hope I can just
> settle for a successful bootstrap & check without
> --enable-checking=valgrind and a successful bootstrap with it.
> Bootstrap hasn't even finished compiling the java libs.  Maybe I
> can get a "discount", to just need --enable-languages=c.
> 
> Here's the insn in get_attr_prefix_0f for the first trigging call
> when, with a suitable --save-temps, doing
> valgrind  --num-callers=20 --gdb-attach=yes ./stage1/cc1
>  -fpreprocessed libgcc2.i -quiet -dumpbase libgcc2.c
>  -auxbase-strip /tmp/bb.s -g -O2 -W -Wall  -Wwrite-strings
>  -Wstrict-prototypes -Wmissing-prototypes -version -fPIC -o /tmp/bb.s
> (I can't seem to get useful debug info out of the bootstrapped
> cc1, using gdb-5.2.1)
> 
> Please excuse the line-wrapping.
> 
> (jump_insn:HI 22 285 36 0x4176ba50 (set (pc)
>         (if_then_else (lt (reg:CCGOC 17 flags)
>                 (const_int 0 [0x0]))
>             (label_ref 295)
>             (pc))) 509 {*jcc_1} (insn_list:REG_DEP_ANTI 268 (insn_list:REG_DEP_ANTI 263 (insn_list:REG_DEP_ANTI 264
> (insn_list:REG_DEP_ANTI 5 (insn_list:REG_DEP_ANTI 208 (insn_list:REG_DEP_ANTI 209 (insn_list:REG_DEP_ANTI 284 (insn_list 285
> (insn_list:REG_DEP_ANTI 267 (insn_list:REG_DEP_ANTI 269 (insn_list:REG_DEP_ANTI 270 (insn_list:REG_DEP_ANTI 271 (insn_list:REG_DEP_ANTI 265
> (insn_list:REG_DEP_ANTI 266 (insn_list:REG_DEP_ANTI 226 (nil))))))))))))))))
>     (expr_list:REG_DEAD (reg:CCGOC 17 flags)
>         (expr_list:REG_BR_PROB (const_int 2100 [0x834])
>             (nil))))
> 
> the same insn also trigs later, for a total of three
> indications.
Hi,
here is patch for that.  It is interesting pass ordering problem :)
Hope it will reduce "many" into at least "half many"

Honza

Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.401
diff -c -3 -p -r1.401 i386.md
*** i386.md	31 Oct 2002 15:21:22 -0000	1.401
--- i386.md	13 Nov 2002 13:30:05 -0000
***************
*** 187,199 ****
  	   (if_then_else (match_operand 1 "constant_call_address_operand" "")
  	     (const_int 4)
  	     (const_int 0))
  	 (eq_attr "type" "ibr")
! 	   (if_then_else (and (ge (minus (match_dup 0) (pc))
! 				  (const_int -128))
! 			      (lt (minus (match_dup 0) (pc))
! 				  (const_int 124)))
! 	     (const_int 1)
! 	     (const_int 4))
  	 ]
  	 (symbol_ref "/* Update immediate_length and other attributes! */
  		      abort(),1")))
--- 187,196 ----
  	   (if_then_else (match_operand 1 "constant_call_address_operand" "")
  	     (const_int 4)
  	     (const_int 0))
+ 	 ;; We don't know the size before shorten_branches.  Optimisitically
+ 	 ;; expect the instruction to fit for better scheduling.
  	 (eq_attr "type" "ibr")
! 	   (const_int 1)
  	 ]
  	 (symbol_ref "/* Update immediate_length and other attributes! */
  		      abort(),1")))
***************
*** 12837,12849 ****
    "%+j%C1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "prefix_0f")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 0)
! 	     (const_int 1)))])
  
  (define_insn "*jcc_2"
    [(set (pc)
--- 12834,12846 ----
    "%+j%C1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "length")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 2)
! 	     (const_int 6)))])
  
  (define_insn "*jcc_2"
    [(set (pc)
***************
*** 12855,12867 ****
    "%+j%c1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "prefix_0f")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 0)
! 	     (const_int 1)))])
  
  ;; In general it is not safe to assume too much about CCmode registers,
  ;; so simplify-rtx stops when it sees a second one.  Under certain 
--- 12852,12864 ----
    "%+j%c1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "length")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 2)
! 	     (const_int 6)))])
  
  ;; In general it is not safe to assume too much about CCmode registers,
  ;; so simplify-rtx stops when it sees a second one.  Under certain 
***************
*** 13122,13127 ****
--- 13119,13131 ----
    ""
    "jmp\t%l0"
    [(set_attr "type" "ibr")
+    (set (attr "length")
+ 	   (if_then_else (and (ge (minus (match_dup 0) (pc))
+ 				  (const_int -128))
+ 			      (lt (minus (match_dup 0) (pc))
+ 				  (const_int 124)))
+ 	     (const_int 2)
+ 	     (const_int 5)))
     (set_attr "modrm" "0")])
  
  (define_expand "indirect_jump"
***************
*** 13248,13261 ****
  			            (const_int 124))))
  		      (const_int 2)
  		      (const_int 16)))
!    (set (attr "type")
! 	(if_then_else (and (eq_attr "alternative" "0")
! 			   (and (ge (minus (match_dup 0) (pc))
! 			            (const_int -128))
! 			        (lt (minus (match_dup 0) (pc))
! 			            (const_int 124))))
! 		      (const_string "ibr")
! 		      (const_string "multi")))])
  
  (define_split
    [(set (pc)
--- 13252,13260 ----
  			            (const_int 124))))
  		      (const_int 2)
  		      (const_int 16)))
!    ;; We don't know the type before shorten branches.  Optimistically expect
!    ;; the loop instruction to match.
!    (set (attr "type") (const_string "ibr"))])
  
  (define_split
    [(set (pc)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-13  5:32           ` Jan Hubicka
@ 2002-11-13 13:38             ` Hans-Peter Nilsson
  0 siblings, 0 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-13 13:38 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Zack Weinberg, gcc-patches

On Wed, 13 Nov 2002, Jan Hubicka wrote:

> > On Tue, 12 Nov 2002, Jan Hubicka wrote:
> > > > On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> > > > > ==5784== Conditional jump or move depends on uninitialised value(s)
> > > > > ==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)

> > (jump_insn:HI 22 285 36 0x4176ba50 (set (pc)
> >         (if_then_else (lt (reg:CCGOC 17 flags)
> >                 (const_int 0 [0x0]))
> >             (label_ref 295)
   ...

> Hi,
> here is patch for that.  It is interesting pass ordering problem :)
> Hope it will reduce "many" into at least "half many"

It actually reduces them to "none yet", at df.o in stage2.
Thanks.

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: RFC: --enable-checking=valgrind.
  2002-11-11  1:55   ` Hans-Peter Nilsson
  2002-11-11 16:53     ` Zack Weinberg
@ 2002-11-18 17:20     ` Richard Henderson
  2002-11-18 18:24       ` [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.) Hans-Peter Nilsson
  1 sibling, 1 reply; 25+ messages in thread
From: Richard Henderson @ 2002-11-18 17:20 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> 	* cppfiles.c (read_include_file) [ENABLE_VALGRIND]: When doing the
> 	mmap+1 trick, annotate the byte after the mmap:ed area as readable.
> 	* configure.in (--enable-checking=valgrind): New.
> 	* Makefile.in (VALGRIND_PATH, VALGRIND_CMD, VALGRIND_DEFINES):
> 	New variables.
> 	(HOST_CFLAGS, ALL_CFLAGS): Add $(VALGRIND_DEFINES).
> 	(executing gencheck, genconfigs, genconditions, genflags,
> 	gencodes, genconstants, genemit, genrecog, genopinit, genextract,
> 	genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds,
> 	gengtype, genprotos): Prepend $(VALGRIND_CMD).
> 	* gcc.c (execute) [ENABLE_VALGRIND]: Arrange to prepend
> 	$(VALGRIND_PATH) -q to each command.

Ok.


r~

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-18 17:20     ` Richard Henderson
@ 2002-11-18 18:24       ` Hans-Peter Nilsson
  2002-11-18 20:37         ` Richard Henderson
                           ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-18 18:24 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc-patches

On Mon, 18 Nov 2002, Richard Henderson wrote:
> On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
        [Patch for --enable-checking=valgrind take 1]
>
> Ok.

Thanks for the review (that patch did work as far as I ran it).

But I have an updated, polished patch which after 53.75 hours on
an Athlon model 4 1GHz finally finished bootstrapping (phew!).
Just have to finish bootstrap&check without
--enable-checking=valgrind and without the patch too.  FWIW,
testing also included patches for annotations for the ggc memory
management; none trigged AFAICT.  (Will follow as separate
patch.)

Summary of changes to previous patch:
- Only DRIVER_DEFINES needs the path to valgrind.
- I thought better name the prefix $(RUN_GEN) as there may be
other uses for prepending stuff when executing the ./gen*
helpers (and since it's slightly shorter; helps when reading
Makefile.in).
- All the compiler tests are moved together, before
--enable-checking, not just the necessary AC_PROG_CC and
AC_PROG_CPP.
- As Zack pointed out, the mmap+1 annotation in cppfiles.c
should be removed when the page is munmapped.
- I renamed ENABLE_VALGRIND to ENABLE_VALGRIND_CHECKING for
consistency and to avoid confusion if someone wants to
add use of some other valgrind feature e.g.
ENABLE_VALGRIND_CACHE_PROFILING.


Bootstrapped i686-pc-linux-gnu with
--enable-checking=misc,tree,gc,rtlflag,valgrind which
corresponds to the default but adding valgrind.  No Ada.

Will bootstrap and check with default --enable-checking,
comparing with and without the patch before checking in.
Note I have Honza's patch at
<URL:http://gcc.gnu.org/ml/gcc-patches/2002-11/msg00767.html> in
the tree.  Yes, there *are* test-suite "regressions" when adding
--enable-checking=valgrind. :-)  I'll report the findings
separately.

	* Makefile.in (RUN_GEN, VALGRIND_DRIVER_DEFINES): New variables.
	(DRIVER_DEFINES): Add $(VALGRIND_DRIVER_DEFINES).
	(executing gencheck, genconfigs, genconditions, genflags,
	gencodes, genconstants, genemit, genrecog, genopinit, genextract,
	genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds,
	gengtype, genprotos): Prepend $(RUN_GEN).
	* configure.in: Move host compiler tests before --enable-checking
	tests.
	(--enable-checking=valgrind): New.
	* config.in, configure: Regenerate.
	* cppfiles.c (read_include_file) [ENABLE_VALGRIND_CHECKING]: When
	doing the mmap+1 trick, annotate the byte after the mmap:ed area
	as readable.
	(purge_cache) [ENABLE_VALGRIND_CHECKING]: Remove above annotation.
	* gcc.c (execute) [ENABLE_VALGRIND_CHECKING]: Arrange to prepend
	VALGRIND_PATH -q to each command.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.956
diff -p -c -r1.956 Makefile.in
*** Makefile.in	12 Nov 2002 00:27:31 -0000	1.956
--- Makefile.in	19 Nov 2002 01:35:33 -0000
*************** STRICT2_WARN = -Wtraditional -pedantic -
*** 96,101 ****
--- 96,105 ----
  # "extern" tags in header files.
  NOCOMMON_FLAG = @nocommon_flag@

+ # These are set by --enable-checking=valgrind.
+ RUN_GEN = @valgrind_command@
+ VALGRIND_DRIVER_DEFINES = @valgrind_path_defines@
+
  # This is how we control whether or not the additional warnings are applied.
  .-warn = $(STRICT_WARN)
  GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG)
*************** DRIVER_DEFINES = \
*** 1260,1265 ****
--- 1264,1270 ----
    -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
    -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
    -DTOOLDIR_BASE_PREFIX=\"$(unlibsubdir)/../\" \
+   $(VALGRIND_DRIVER_DEFINES) \
    `test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
    `test "X$${SHLIB_MULTILIB}" = "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"`

*************** cppspec.o: cppspec.c $(CONFIG_H) $(SYSTE
*** 1282,1288 ****

  tree-check.h: s-check ; @true
  s-check : gencheck$(build_exeext) $(srcdir)/move-if-change
! 	./gencheck$(build_exeext) > tmp-check.h
  	$(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h
  	$(STAMP) s-check

--- 1287,1293 ----

  tree-check.h: s-check ; @true
  s-check : gencheck$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./gencheck$(build_exeext) > tmp-check.h
  	$(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h
  	$(STAMP) s-check

*************** mips-tdump.o : mips-tdump.c $(CONFIG_H)
*** 1690,1702 ****

  insn-config.h: s-config ; @true
  s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change
! 	./genconfig$(build_exeext) $(md_file) > tmp-config.h
  	$(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h
  	$(STAMP) s-config

  insn-conditions.c: s-conditions ; @true
  s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change
! 	./genconditions$(build_exeext) $(md_file) > tmp-conditions.c
  	$(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c
  	$(STAMP) s-conditions

--- 1695,1707 ----

  insn-config.h: s-config ; @true
  s-config : $(md_file) genconfig$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genconfig$(build_exeext) $(md_file) > tmp-config.h
  	$(SHELL) $(srcdir)/move-if-change tmp-config.h insn-config.h
  	$(STAMP) s-config

  insn-conditions.c: s-conditions ; @true
  s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genconditions$(build_exeext) $(md_file) > tmp-conditions.c
  	$(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c
  	$(STAMP) s-conditions

*************** dummy-conditions.o : dummy-conditions.c
*** 1711,1729 ****

  insn-flags.h: s-flags ; @true
  s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change
! 	./genflags$(build_exeext) $(md_file) > tmp-flags.h
  	$(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h
  	$(STAMP) s-flags

  insn-codes.h: s-codes ; @true
  s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change
! 	./gencodes$(build_exeext) $(md_file) > tmp-codes.h
  	$(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h
  	$(STAMP) s-codes

  insn-constants.h: s-constants ; @true
  s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change
! 	./genconstants$(build_exeext) $(md_file) > tmp-constants.h
  	$(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h
  	$(STAMP) s-constants

--- 1716,1734 ----

  insn-flags.h: s-flags ; @true
  s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genflags$(build_exeext) $(md_file) > tmp-flags.h
  	$(SHELL) $(srcdir)/move-if-change tmp-flags.h insn-flags.h
  	$(STAMP) s-flags

  insn-codes.h: s-codes ; @true
  s-codes : $(md_file) gencodes$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./gencodes$(build_exeext) $(md_file) > tmp-codes.h
  	$(SHELL) $(srcdir)/move-if-change tmp-codes.h insn-codes.h
  	$(STAMP) s-codes

  insn-constants.h: s-constants ; @true
  s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genconstants$(build_exeext) $(md_file) > tmp-constants.h
  	$(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h
  	$(STAMP) s-constants

*************** insn-emit.o : insn-emit.c $(CONFIG_H) $(
*** 1735,1741 ****

  insn-emit.c: s-emit ; @true
  s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change
! 	./genemit$(build_exeext) $(md_file) > tmp-emit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c
  	$(STAMP) s-emit

--- 1740,1746 ----

  insn-emit.c: s-emit ; @true
  s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genemit$(build_exeext) $(md_file) > tmp-emit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c
  	$(STAMP) s-emit

*************** insn-recog.o : insn-recog.c $(CONFIG_H)
*** 1747,1753 ****

  insn-recog.c: s-recog ; @true
  s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change
! 	./genrecog$(build_exeext) $(md_file) > tmp-recog.c
  	$(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c
  	$(STAMP) s-recog

--- 1752,1758 ----

  insn-recog.c: s-recog ; @true
  s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genrecog$(build_exeext) $(md_file) > tmp-recog.c
  	$(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c
  	$(STAMP) s-recog

*************** insn-opinit.o : insn-opinit.c $(CONFIG_H
*** 1758,1764 ****

  insn-opinit.c: s-opinit ; @true
  s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change
! 	./genopinit$(build_exeext) $(md_file) > tmp-opinit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
  	$(STAMP) s-opinit

--- 1763,1769 ----

  insn-opinit.c: s-opinit ; @true
  s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genopinit$(build_exeext) $(md_file) > tmp-opinit.c
  	$(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
  	$(STAMP) s-opinit

*************** insn-extract.o : insn-extract.c $(CONFIG
*** 1769,1775 ****

  insn-extract.c: s-extract ; @true
  s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change
! 	./genextract$(build_exeext) $(md_file) > tmp-extract.c
  	$(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c
  	$(STAMP) s-extract

--- 1774,1780 ----

  insn-extract.c: s-extract ; @true
  s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genextract$(build_exeext) $(md_file) > tmp-extract.c
  	$(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c
  	$(STAMP) s-extract

*************** insn-peep.o : insn-peep.c $(CONFIG_H) $(
*** 1780,1786 ****

  insn-peep.c: s-peep ; @true
  s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change
! 	./genpeep$(build_exeext) $(md_file) > tmp-peep.c
  	$(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c
  	$(STAMP) s-peep

--- 1785,1791 ----

  insn-peep.c: s-peep ; @true
  s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genpeep$(build_exeext) $(md_file) > tmp-peep.c
  	$(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c
  	$(STAMP) s-peep

*************** insn-attrtab.o : insn-attrtab.c $(CONFIG
*** 1792,1804 ****

  insn-attr.h: s-attr ; @true
  s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change
! 	./genattr$(build_exeext) $(md_file) > tmp-attr.h
  	$(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h
  	$(STAMP) s-attr

  insn-attrtab.c: s-attrtab ; @true
  s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change
! 	./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
  	$(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
  	$(STAMP) s-attrtab

--- 1797,1809 ----

  insn-attr.h: s-attr ; @true
  s-attr : $(md_file) genattr$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genattr$(build_exeext) $(md_file) > tmp-attr.h
  	$(SHELL) $(srcdir)/move-if-change tmp-attr.h insn-attr.h
  	$(STAMP) s-attr

  insn-attrtab.c: s-attrtab ; @true
  s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
  	$(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
  	$(STAMP) s-attrtab

*************** insn-output.o : insn-output.c $(CONFIG_H
*** 1811,1817 ****

  insn-output.c: s-output ; @true
  s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change
! 	./genoutput$(build_exeext) $(md_file) > tmp-output.c
  	$(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c
  	$(STAMP) s-output

--- 1816,1822 ----

  insn-output.c: s-output ; @true
  s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genoutput$(build_exeext) $(md_file) > tmp-output.c
  	$(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c
  	$(STAMP) s-output

*************** genrtl.c genrtl.h : s-genrtl
*** 1820,1835 ****
  	@true	# force gnu make to recheck modification times.

  s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H)
! 	./gengenrtl$(build_exeext) -h > tmp-genrtl.h
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
! 	./gengenrtl$(build_exeext) > tmp-genrtl.c
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
  	$(STAMP) s-genrtl

  tm-preds.h: s-preds; @true

  s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
! 	./genpreds$(build_exeext) > tmp-preds.h
  	$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
  	$(STAMP) s-preds

--- 1825,1840 ----
  	@true	# force gnu make to recheck modification times.

  s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H)
! 	$(RUN_GEN) ./gengenrtl$(build_exeext) -h > tmp-genrtl.h
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
! 	$(RUN_GEN) ./gengenrtl$(build_exeext) > tmp-genrtl.c
  	$(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
  	$(STAMP) s-genrtl

  tm-preds.h: s-preds; @true

  s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
! 	$(RUN_GEN) ./genpreds$(build_exeext) > tmp-preds.h
  	$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
  	$(STAMP) s-preds

*************** gtyp-gen.h: Makefile
*** 1894,1900 ****
  	$(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h

  s-gtype: gengtype$(build_exeext) $(GTFILES)
! 	./gengtype
  	$(STAMP) s-gtype

  #
--- 1899,1905 ----
  	$(SHELL) $(srcdir)/move-if-change tmp-gtyp.h gtyp-gen.h

  s-gtype: gengtype$(build_exeext) $(GTFILES)
! 	$(RUN_GEN) ./gengtype
  	$(STAMP) s-gtype

  #
*************** xsys-protos.h: $(GCC_PASSES) $(srcdir)/s
*** 2402,2408 ****
  	mv tmp-fixtmp.c fixtmp.c
  	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
  	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
! 	  | ./gen-protos >xsys-protos.hT
  	mv xsys-protos.hT xsys-protos.h
  	rm -rf fixtmp.c

--- 2407,2413 ----
  	mv tmp-fixtmp.c fixtmp.c
  	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
  	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
! 	  | $(RUN_GEN) ./gen-protos >xsys-protos.hT
  	mv xsys-protos.hT xsys-protos.h
  	rm -rf fixtmp.c

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.622
diff -p -c -r1.622 configure.in
*** configure.in	7 Nov 2002 22:48:09 -0000	1.622
--- configure.in	19 Nov 2002 01:35:37 -0000
*************** changequote([, ])dnl
*** 176,181 ****
--- 176,257 ----
    fi
  fi

+ # Find the native compiler
+ AC_PROG_CC
+ AC_PROG_CC_C_O
+ # autoconf is lame and doesn't give us any substitution variable for this.
+ if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
+   NO_MINUS_C_MINUS_O=yes
+ else
+   OUTPUT_OPTION='-o $@'
+ fi
+ AC_SUBST(NO_MINUS_C_MINUS_O)
+ AC_SUBST(OUTPUT_OPTION)
+
+ # See if GNAT has been installed
+ gcc_AC_PROG_GNAT
+
+ AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
+ ac_cv_prog_cc_no_long_long,
+ [save_CFLAGS="$CFLAGS"
+ CFLAGS="-Wno-long-long"
+ AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
+ 	       ac_cv_prog_cc_no_long_long=no)
+ CFLAGS="$save_CFLAGS"])
+
+ if test x$have_gnat != xno ; then
+ AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
+ ac_cv_prog_adac_no_long_long,
+ [cat >conftest.adb <<EOF
+ procedure conftest is begin null; end conftest;
+ EOF
+ if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then
+   ac_cv_prog_adac_no_long_long=yes
+ else
+   ac_cv_prog_adac_no_long_long=no
+ fi
+ rm -f conftest*])
+ else
+   ac_cv_prog_adac_no_long_long=yes
+ fi
+
+ strict1_warn=
+ if test $ac_cv_prog_cc_no_long_long = yes && \
+     test $ac_cv_prog_adac_no_long_long = yes ; then
+   strict1_warn="-pedantic -Wno-long-long"
+ fi
+ AC_SUBST(strict1_warn)
+
+ AC_PROG_CPP
+ AC_C_INLINE
+ gcc_AC_C_VOLATILE
+
+ gcc_AC_C_LONG_DOUBLE
+ gcc_AC_C_LONG_LONG
+ gcc_AC_C__BOOL
+
+ # sizeof(char) is 1 by definition.
+ gcc_AC_COMPILE_CHECK_SIZEOF(short)
+ gcc_AC_COMPILE_CHECK_SIZEOF(int)
+ gcc_AC_COMPILE_CHECK_SIZEOF(long)
+ if test $ac_cv_c_long_long = yes; then
+   gcc_AC_COMPILE_CHECK_SIZEOF(long long)
+ fi
+ if test $ac_cv_c___int64 = yes; then
+   gcc_AC_COMPILE_CHECK_SIZEOF(__int64)
+ fi
+
+ gcc_AC_C_CHARSET
+
+ # If the native compiler is GCC, we can enable warnings even in stage1.
+ # That's useful for people building cross-compilers, or just running a
+ # quick `make'.
+ warn_cflags=
+ if test "x$GCC" = "xyes"; then
+   warn_cflags='$(GCC_WARN_CFLAGS)'
+ fi
+ AC_SUBST(warn_cflags)
+
  # Determine whether or not multilibs are enabled.
  AC_ARG_ENABLE(multilib,
  [  --enable-multilib       enable library support for multiple ABIs],
*************** no)	;;
*** 211,216 ****
--- 287,293 ----
  		rtl)	ac_rtl_checking=1 ;;
  		gc)	ac_gc_checking=1 ;;
  		gcac)	ac_gc_always_collect=1 ;;
+ 		valgrind)	ac_checking_valgrind=1 ;;
  		*)	AC_MSG_ERROR(unknown check category $check) ;;
  		esac
  	done
*************** if test x$ac_gc_always_collect != x ; th
*** 256,261 ****
--- 333,357 ----
     paranoid mode, validating the entire heap and collecting garbage at
     every opportunity.  This is extremely expensive.])
  fi
+ valgrind_path_defines=
+ valgrind_command=
+ if test x$ac_checking_valgrind != x ; then
+   # It is certainly possible that there's valgrind but no valgrind.h.
+   # GCC relies on making annotations so we must have both.
+   AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
+   AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
+ 	[$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
+   if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then
+ 	AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h])
+   fi
+   valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
+   valgrind_command="$valgrind_path -q"
+   AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
+ [Define if you want to run subprograms and generated programs
+    through valgrind (a memory checker).  This is extremely expensive.])
+ fi
+ AC_SUBST(valgrind_path_defines)
+ AC_SUBST(valgrind_command)

  # Enable code coverage collection
  AC_ARG_ENABLE(coverage,
*************** AC_CANONICAL_SYSTEM
*** 378,459 ****

  # Set program_transform_name
  AC_ARG_PROGRAM
-
- # Find the native compiler
- AC_PROG_CC
- AC_PROG_CC_C_O
- # autoconf is lame and doesn't give us any substitution variable for this.
- if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
-   NO_MINUS_C_MINUS_O=yes
- else
-   OUTPUT_OPTION='-o $@'
- fi
- AC_SUBST(NO_MINUS_C_MINUS_O)
- AC_SUBST(OUTPUT_OPTION)
-
- # See if GNAT has been installed
- gcc_AC_PROG_GNAT
-
- AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
- ac_cv_prog_cc_no_long_long,
- [save_CFLAGS="$CFLAGS"
- CFLAGS="-Wno-long-long"
- AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes,
- 	       ac_cv_prog_cc_no_long_long=no)
- CFLAGS="$save_CFLAGS"])
-
- if test x$have_gnat != xno ; then
- AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long,
- ac_cv_prog_adac_no_long_long,
- [cat >conftest.adb <<EOF
- procedure conftest is begin null; end conftest;
- EOF
- if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then
-   ac_cv_prog_adac_no_long_long=yes
- else
-   ac_cv_prog_adac_no_long_long=no
- fi
- rm -f conftest*])
- else
-   ac_cv_prog_adac_no_long_long=yes
- fi
-
- strict1_warn=
- if test $ac_cv_prog_cc_no_long_long = yes && \
-     test $ac_cv_prog_adac_no_long_long = yes ; then
-   strict1_warn="-pedantic -Wno-long-long"
- fi
- AC_SUBST(strict1_warn)
-
- AC_PROG_CPP
- AC_C_INLINE
- gcc_AC_C_VOLATILE
-
- gcc_AC_C_LONG_DOUBLE
- gcc_AC_C_LONG_LONG
- gcc_AC_C__BOOL
-
- # sizeof(char) is 1 by definition.
- gcc_AC_COMPILE_CHECK_SIZEOF(short)
- gcc_AC_COMPILE_CHECK_SIZEOF(int)
- gcc_AC_COMPILE_CHECK_SIZEOF(long)
- if test $ac_cv_c_long_long = yes; then
-   gcc_AC_COMPILE_CHECK_SIZEOF(long long)
- fi
- if test $ac_cv_c___int64 = yes; then
-   gcc_AC_COMPILE_CHECK_SIZEOF(__int64)
- fi
-
- gcc_AC_C_CHARSET
-
- # If the native compiler is GCC, we can enable warnings even in stage1.
- # That's useful for people building cross-compilers, or just running a
- # quick `make'.
- warn_cflags=
- if test "x$GCC" = "xyes"; then
-   warn_cflags='$(GCC_WARN_CFLAGS)'
- fi
- AC_SUBST(warn_cflags)

  # Stage specific cflags for build.
  stage1_cflags=
--- 474,479 ----
Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.156
diff -p -c -r1.156 cppfiles.c
*** cppfiles.c	22 Sep 2002 02:03:16 -0000	1.156
--- cppfiles.c	19 Nov 2002 01:35:38 -0000
*************** Foundation, 59 Temple Place - Suite 330,
*** 27,32 ****
--- 27,35 ----
  #include "intl.h"
  #include "mkdeps.h"
  #include "splay-tree.h"
+ #ifdef ENABLE_VALGRIND_CHECKING
+ #include <valgrind.h>
+ #endif

  #ifdef HAVE_MMAP_FILE
  # include <sys/mman.h>
*************** read_include_file (pfile, inc)
*** 418,423 ****
--- 421,433 ----
  	  buf = (uchar *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
  	  if (buf == (uchar *)-1)
  	    goto perror_fail;
+
+ #ifdef ENABLE_VALGRIND_CHECKING
+ 	  /* We must tell Valgrind that the byte at buf[size] is actually
+ 	     readable.  Discard the handle to avoid handle leak.  */
+ 	  VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (buf + size, 1));
+ #endif
+
  	  inc->mapped = 1;
  	}
        else
*************** purge_cache (inc)
*** 498,504 ****
      {
  #if MMAP_THRESHOLD
        if (inc->mapped)
! 	munmap ((PTR) inc->buffer, inc->st.st_size);
        else
  #endif
  	free ((PTR) inc->buffer);
--- 508,523 ----
      {
  #if MMAP_THRESHOLD
        if (inc->mapped)
! 	{
! #ifdef ENABLE_VALGRIND_CHECKING
! 	  /* Undo the previous annotation for the
! 	     known-zero-byte-after-mmap.  Discard the handle to avoid
! 	     handle leak.  */
! 	  VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (inc->buffer
! 						    + inc->st.st_size, 1));
! #endif
! 	  munmap ((PTR) inc->buffer, inc->st.st_size);
! 	}
        else
  #endif
  	free ((PTR) inc->buffer);
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.344
diff -p -c -r1.344 gcc.c
*** gcc.c	14 Oct 2002 07:15:38 -0000	1.344
--- gcc.c	19 Nov 2002 01:35:45 -0000
*************** execute ()
*** 2843,2848 ****
--- 2843,2875 ----
  #endif /* DEBUG */
      }

+ #ifdef ENABLE_VALGRIND_CHECKING
+   /* Run the each command through valgrind.  To simplifiy prepending the
+      path to valgrind and the option "-q" (for quiet operation unless
+      something triggers), we allocate a separate argv array.  */
+
+   for (i = 0; i < n_commands; i++)
+     {
+       const char **argv;
+       int argc;
+       int j;
+
+       for (argc = 0; commands[i].argv[argc] != NULL; argc++)
+ 	;
+
+       argv = alloca ((argc + 3) * sizeof (char *));
+
+       argv[0] = VALGRIND_PATH;
+       argv[1] = "-q";
+       for (j = 2; j < argc + 2; j++)
+ 	argv[j] = commands[i].argv[j - 2];
+       argv[j] = NULL;
+
+       commands[i].argv = argv;
+       commands[i].prog = argv[0];
+     }
+ #endif
+
    /* Run each piped subprocess.  */

    for (i = 0; i < n_commands; i++)

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-18 18:24       ` [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.) Hans-Peter Nilsson
@ 2002-11-18 20:37         ` Richard Henderson
  2002-11-20 11:57           ` Hans-Peter Nilsson
  2002-11-18 22:12         ` Neil Booth
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 25+ messages in thread
From: Richard Henderson @ 2002-11-18 20:37 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

On Mon, Nov 18, 2002 at 09:24:19PM -0500, Hans-Peter Nilsson wrote:
> 	* Makefile.in (RUN_GEN, VALGRIND_DRIVER_DEFINES): New variables.
> 	(DRIVER_DEFINES): Add $(VALGRIND_DRIVER_DEFINES).
> 	(executing gencheck, genconfigs, genconditions, genflags,
> 	gencodes, genconstants, genemit, genrecog, genopinit, genextract,
> 	genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds,
> 	gengtype, genprotos): Prepend $(RUN_GEN).
> 	* configure.in: Move host compiler tests before --enable-checking
> 	tests.
> 	(--enable-checking=valgrind): New.
> 	* config.in, configure: Regenerate.
> 	* cppfiles.c (read_include_file) [ENABLE_VALGRIND_CHECKING]: When
> 	doing the mmap+1 trick, annotate the byte after the mmap:ed area
> 	as readable.
> 	(purge_cache) [ENABLE_VALGRIND_CHECKING]: Remove above annotation.
> 	* gcc.c (execute) [ENABLE_VALGRIND_CHECKING]: Arrange to prepend
> 	VALGRIND_PATH -q to each command.

Updated patch is ok.

Really, I don't think you needed to have combined the cpp fix with the
base valgrind invocation patch.


r~

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-18 18:24       ` [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.) Hans-Peter Nilsson
  2002-11-18 20:37         ` Richard Henderson
@ 2002-11-18 22:12         ` Neil Booth
  2002-11-19  4:37           ` Hans-Peter Nilsson
  2002-11-18 22:33         ` Andreas Jaeger
  2002-11-26  5:42         ` [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)) Jakub Jelinek
  3 siblings, 1 reply; 25+ messages in thread
From: Neil Booth @ 2002-11-18 22:12 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Richard Henderson, gcc-patches

Hans-Peter Nilsson wrote:-

> +
> + #ifdef ENABLE_VALGRIND_CHECKING
> + 	  /* We must tell Valgrind that the byte at buf[size] is actually
> + 	     readable.  Discard the handle to avoid handle leak.  */
> + 	  VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (buf + size, 1));
> + #endif
> +
>   	  inc->mapped = 1;
>   	}
>         else
> *************** purge_cache (inc)
> *** 498,504 ****
>       {
>   #if MMAP_THRESHOLD
>         if (inc->mapped)
> ! 	munmap ((PTR) inc->buffer, inc->st.st_size);
>         else
>   #endif
>   	free ((PTR) inc->buffer);
> --- 508,523 ----
>       {
>   #if MMAP_THRESHOLD
>         if (inc->mapped)
> ! 	{
> ! #ifdef ENABLE_VALGRIND_CHECKING
> ! 	  /* Undo the previous annotation for the
> ! 	     known-zero-byte-after-mmap.  Discard the handle to avoid
> ! 	     handle leak.  */
> ! 	  VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (inc->buffer
> ! 						    + inc->st.st_size, 1));
> ! #endif
> ! 	  munmap ((PTR) inc->buffer, inc->st.st_size);
> ! 	}

To avoid ballooning #ifdef-nastiness, could you (maybe in the #ifdef you
added at the top of the file) add something like

#else
#define VALGRIND_DISCARD(x)  /* Ignore.  */

and get rid of the conditional compilation in these two places?

Neil.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-18 18:24       ` [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.) Hans-Peter Nilsson
  2002-11-18 20:37         ` Richard Henderson
  2002-11-18 22:12         ` Neil Booth
@ 2002-11-18 22:33         ` Andreas Jaeger
  2002-11-19  4:33           ` Hans-Peter Nilsson
  2002-11-26  5:42         ` [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)) Jakub Jelinek
  3 siblings, 1 reply; 25+ messages in thread
From: Andreas Jaeger @ 2002-11-18 22:33 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Richard Henderson, gcc-patches


With valgrind from CVS, there's one problem with your patch:

/cvs/gcc/gcc/cppfiles.c: In function `read_include_file':
/cvs/gcc/gcc/cppfiles.c:428: warning: implicit declaration of function `VALGRIND_DISCARD'
/cvs/gcc/gcc/cppfiles.c:428: warning: implicit declaration of function `VALGRIND_MAKE_READABLE'
/cvs/gcc/gcc/cppfiles.c: In function `purge_cache':
/cvs/gcc/gcc/cppfiles.c:516: warning: function `VALGRIND_DISCARD' was previously declared within a block
/cvs/gcc/gcc/cppfiles.c:516: warning: implicit declaration of function `VALGRIND_MAKE_NOACCESS'

I added an include of <memcheck.h> to cppfiles.c to fix this,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-18 22:33         ` Andreas Jaeger
@ 2002-11-19  4:33           ` Hans-Peter Nilsson
  2002-11-19  7:31             ` Andreas Jaeger
  0 siblings, 1 reply; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-19  4:33 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Richard Henderson, gcc-patches

On Tue, 19 Nov 2002, Andreas Jaeger wrote:

> With valgrind from CVS, there's one problem with your patch:
>
> /cvs/gcc/gcc/cppfiles.c: In function `read_include_file':
> /cvs/gcc/gcc/cppfiles.c:428: warning: implicit declaration of function `VALGRIND_DISCARD'

Oh my, an API change.  I use 1.0.4 as you might guess.  I guess
that's easily autoconf:ed for, if you please.

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-18 22:12         ` Neil Booth
@ 2002-11-19  4:37           ` Hans-Peter Nilsson
  0 siblings, 0 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-19  4:37 UTC (permalink / raw)
  To: Neil Booth; +Cc: gcc-patches

On Tue, 19 Nov 2002, Neil Booth wrote:
> To avoid ballooning #ifdef-nastiness, could you (maybe in the #ifdef you
> added at the top of the file) add something like
>
> #else
> #define VALGRIND_DISCARD(x)  /* Ignore.  */
>
> and get rid of the conditional compilation in these two places?

Of course!  I'll test it by inspecting preprocessed output of
the files, to weasly save me 60 hours of bootstrapping.

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-19  4:33           ` Hans-Peter Nilsson
@ 2002-11-19  7:31             ` Andreas Jaeger
  2002-11-19  9:07               ` Hans-Peter Nilsson
  0 siblings, 1 reply; 25+ messages in thread
From: Andreas Jaeger @ 2002-11-19  7:31 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Richard Henderson, gcc-patches

Hans-Peter Nilsson <hp@bitrange.com> writes:

> On Tue, 19 Nov 2002, Andreas Jaeger wrote:
>
>> With valgrind from CVS, there's one problem with your patch:
>>
>> /cvs/gcc/gcc/cppfiles.c: In function `read_include_file':
>> /cvs/gcc/gcc/cppfiles.c:428: warning: implicit declaration of function `VALGRIND_DISCARD'
>
> Oh my, an API change.  I use 1.0.4 as you might guess.  I guess

I used the latest CVS.

> that's easily autoconf:ed for, if you please.

Can you do that as part of your patch - if not, I'll try to do it next
weekend?

Just checking for <memcheck.h> and including it if it exists should be
all that's needed,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-19  7:31             ` Andreas Jaeger
@ 2002-11-19  9:07               ` Hans-Peter Nilsson
  2002-11-19  9:15                 ` [RFA:] Take 2 Andreas Jaeger
  0 siblings, 1 reply; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-19  9:07 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Richard Henderson, gcc-patches

On Tue, 19 Nov 2002, Andreas Jaeger wrote:
> Hans-Peter Nilsson <hp@bitrange.com> writes:
>
> > On Tue, 19 Nov 2002, Andreas Jaeger wrote:
> >
> >> With valgrind from CVS, there's one problem with your patch:
> >>
> >> /cvs/gcc/gcc/cppfiles.c: In function `read_include_file':
> >> /cvs/gcc/gcc/cppfiles.c:428: warning: implicit declaration of function `VALGRIND_DISCARD'
> >
> > Oh my, an API change.  I use 1.0.4 as you might guess.  I guess
>
> I used the latest CVS.

The snapshot I see is stated to be "of the current development,
unstable sources".  Perhaps they will change this before
release, perhaps to something else.
(Where's the CVS repo?  Perhaps it says in the 1.1.0 ss.)

> > that's easily autoconf:ed for, if you please.
>
> Can you do that as part of your patch - if not, I'll try to do it next
> weekend?

Please do it.

> Just checking for <memcheck.h> and including it if it exists should be
> all that's needed,

I think memcheck.h is just too common a name to do that without
risking breakage (I hope they change that, perhaps to
vgmemcheck.h).  I suggest checking whether VALGRIND_DISCARD is
in valgrind.h, and if not, whether it's in memcheck.h and only
*then* define some macro to test before including memcheck.h.
I'll test with 1.0.4 if you do.  But I can't really test that it
works for you with my current valgrind, so please do it.
(FWIW, there's no memcheck.h in 1.0.4.)

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2
  2002-11-19  9:07               ` Hans-Peter Nilsson
@ 2002-11-19  9:15                 ` Andreas Jaeger
  0 siblings, 0 replies; 25+ messages in thread
From: Andreas Jaeger @ 2002-11-19  9:15 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Richard Henderson, gcc-patches, Julian Seward

Hans-Peter Nilsson <hp@bitrange.com> writes:

> On Tue, 19 Nov 2002, Andreas Jaeger wrote:
>> Hans-Peter Nilsson <hp@bitrange.com> writes:
>>
>> > On Tue, 19 Nov 2002, Andreas Jaeger wrote:
>> >
>> >> With valgrind from CVS, there's one problem with your patch:
>> >>
>> >> /cvs/gcc/gcc/cppfiles.c: In function `read_include_file':
>> >> /cvs/gcc/gcc/cppfiles.c:428: warning: implicit declaration of function `VALGRIND_DISCARD'
>> >
>> > Oh my, an API change.  I use 1.0.4 as you might guess.  I guess
>>
>> I used the latest CVS.
>
> The snapshot I see is stated to be "of the current development,
> unstable sources".  Perhaps they will change this before
> release, perhaps to something else.

I hope not - but who knows :-(

> (Where's the CVS repo?  Perhaps it says in the 1.1.0 ss.)

:pserver:anonymous@cvs.valgrind.sourceforge.net:/cvsroot/valgrind

>
>> > that's easily autoconf:ed for, if you please.
>>
>> Can you do that as part of your patch - if not, I'll try to do it next
>> weekend?
>
> Please do it.

Ok, will do.

>> Just checking for <memcheck.h> and including it if it exists should be
>> all that's needed,
>
> I think memcheck.h is just too common a name to do that without
> risking breakage (I hope they change that, perhaps to
> vgmemcheck.h).  I suggest checking whether VALGRIND_DISCARD is
> in valgrind.h, and if not, whether it's in memcheck.h and only
> *then* define some macro to test before including memcheck.h.
> I'll test with 1.0.4 if you do.  But I can't really test that it
> works for you with my current valgrind, so please do it.
> (FWIW, there's no memcheck.h in 1.0.4.)

I'll try to follow your suggestion,
Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)
  2002-11-18 20:37         ` Richard Henderson
@ 2002-11-20 11:57           ` Hans-Peter Nilsson
  0 siblings, 0 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-20 11:57 UTC (permalink / raw)
  To: gcc-patches

On Mon, 18 Nov 2002, Richard Henderson wrote:
> Updated patch is ok.

Thanks for the review.

On request from Neil, I instead committed this for cppfiles.c,
as an obvious change to the patch.  Tested by inspecting
preprocessed output with and without --enable-checking=valgrind
and "manually" checking the expected whitespace change, plus the
expected extra ";" without --enable-checking, compared to the
previous, bootstrapped&checked patch.  Also bootstrapped&checked
without --enable-checking=valgrind.  New ChangeLog entry for
that file:

	* cppfiles.c [!ENABLE_VALGRIND_CHECKING] (VALGRIND_DISCARD):
	Define as empty.
	(read_include_file): When doing the mmap+1 trick,
	valgrind-annotate the byte after the mmap:ed area as readable.
	(purge_cache): Remove above annotation.

Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.156
diff -p -c -r1.156 cppfiles.c
*** cppfiles.c	22 Sep 2002 02:03:16 -0000	1.156
--- cppfiles.c	20 Nov 2002 00:02:38 -0000
*************** Foundation, 59 Temple Place - Suite 330,
*** 27,32 ****
--- 27,38 ----
  #include "intl.h"
  #include "mkdeps.h"
  #include "splay-tree.h"
+ #ifdef ENABLE_VALGRIND_CHECKING
+ #include <valgrind.h>
+ #else
+ /* Avoid #ifdef:s when we can help it.  */
+ #define VALGRIND_DISCARD(x)
+ #endif

  #ifdef HAVE_MMAP_FILE
  # include <sys/mman.h>
*************** read_include_file (pfile, inc)
*** 418,423 ****
--- 424,434 ----
  	  buf = (uchar *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
  	  if (buf == (uchar *)-1)
  	    goto perror_fail;
+
+ 	  /* We must tell Valgrind that the byte at buf[size] is actually
+ 	     readable.  Discard the handle to avoid handle leak.  */
+ 	  VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (buf + size, 1));
+
  	  inc->mapped = 1;
  	}
        else
*************** purge_cache (inc)
*** 498,504 ****
      {
  #if MMAP_THRESHOLD
        if (inc->mapped)
! 	munmap ((PTR) inc->buffer, inc->st.st_size);
        else
  #endif
  	free ((PTR) inc->buffer);
--- 509,522 ----
      {
  #if MMAP_THRESHOLD
        if (inc->mapped)
! 	{
! 	  /* Undo the previous annotation for the
! 	     known-zero-byte-after-mmap.  Discard the handle to avoid
! 	     handle leak.  */
! 	  VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (inc->buffer
! 						    + inc->st.st_size, 1));
! 	  munmap ((PTR) inc->buffer, inc->st.st_size);
! 	}
        else
  #endif
  	free ((PTR) inc->buffer);

brgds, H-P



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.))
  2002-11-18 18:24       ` [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.) Hans-Peter Nilsson
                           ` (2 preceding siblings ...)
  2002-11-18 22:33         ` Andreas Jaeger
@ 2002-11-26  5:42         ` Jakub Jelinek
  2002-11-26  9:59           ` Richard Henderson
  2002-11-28  7:34           ` Hans-Peter Nilsson
  3 siblings, 2 replies; 25+ messages in thread
From: Jakub Jelinek @ 2002-11-26  5:42 UTC (permalink / raw)
  To: Richard Henderson, Hans-Peter Nilsson; +Cc: gcc-patches

On Mon, Nov 18, 2002 at 09:24:19PM -0500, Hans-Peter Nilsson wrote:
> - All the compiler tests are moved together, before
> --enable-checking, not just the necessary AC_PROG_CC and
> AC_PROG_CPP.

> 	* configure.in: Move host compiler tests before --enable-checking
> 	tests.

This hunk broke ..../configure <arch>-<vendor>-<os>
and ..../configure --host <arch>-<vendor>-<os> --target <arch>-<vendor>-<os>
builds.

Say with ../configure i386-redhat-linux
I know get:
checking assembler subsection support... ../../gcc/configure: line 7359: i386-redhat-linux-nm: command not found
../../gcc/configure: line 7360: i386-redhat-linux-nm: command not found
.subsection
etc.
The problem is, at least from what I can see, that if gcc_AC_PROG_GNAT
comes before AC_CANONICAL_SYSTEM/AC_ARG_PROGRAM, then checking for canonical
host and canonical build is done twice, not just once (first time in
gcc_AC_PROG_GNAT expansion, then in AC_CANONICAL_SYSTEM), the first time
is host_alias set to i386-redhat-linux and host to i386-redhat-linux-gnu,
the second time both to i386-redhat-linux-gnu, which is at AC_ARG_PROGRAM
time different from target_alias (AC_CANONICAL_TARGET was expanded
just once, so target_alias is i386-redhat-linux and just target is
i386-redhat-linux-gnu), so program_prefix is set to ${target_alias}-.
The following patch seems to fix it.
Ok to commit?

2002-11-26  Jakub Jelinek  <jakub@redhat.com>

	* configure.in: Move AC_CANONICAL_SYSTEM and AC_ARG_PROGRAM back
	before AC_PROG_CC.
	* configure: Rebuilt.

--- gcc/configure.in.jj	2002-11-26 15:13:51.000000000 +0100
+++ gcc/configure.in	2002-11-26 15:15:39.000000000 +0100
@@ -176,6 +176,12 @@ changequote([, ])dnl
   fi
 fi
 
+# Determine the host, build, and target systems
+AC_CANONICAL_SYSTEM
+
+# Set program_transform_name
+AC_ARG_PROGRAM
+
 # Find the native compiler
 AC_PROG_CC
 AC_PROG_CC_C_O
@@ -469,12 +475,6 @@ AC_ARG_ENABLE(shared,
 ], [enable_shared=yes])
 AC_SUBST(enable_shared)
 
-# Determine the host, build, and target systems
-AC_CANONICAL_SYSTEM
-
-# Set program_transform_name
-AC_ARG_PROGRAM
-
 # Stage specific cflags for build.
 stage1_cflags=
 case $build in
--- gcc/configure.jj	2002-11-26 15:13:57.000000000 +0100
+++ gcc/configure	2002-11-26 15:21:09.000000000 +0100
@@ -791,6 +791,137 @@ if test x${gcc_gxx_include_dir} = x; the
   fi
 fi
 
+# Determine the host, build, and target systems
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:843: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:864: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:882: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+# Set program_transform_name
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+  rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+
 # Find the native compiler
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
@@ -1076,70 +1207,6 @@ fi
 
 
 # See if GNAT has been installed
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
-  if test -f $ac_dir/install-sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f $ac_dir/install.sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1106: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
-  case $nonopt in
-  NONE)
-    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-    fi ;;
-  *) host_alias=$nonopt ;;
-  esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1127: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
-  case $nonopt in
-  NONE) build_alias=$host_alias ;;
-  *) build_alias=$nonopt ;;
-  esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
 if test $host != $build; then
   ac_tool_prefix=${host_alias}-
 else
@@ -2185,118 +2252,6 @@ fi
 
 
 
-# Determine the host, build, and target systems
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-#    same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-#    as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:2218: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
-  case $nonopt in
-  NONE)
-    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-    fi ;;
-  *) host_alias=$nonopt ;;
-  esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:2239: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
-  case $nonopt in
-  NONE) target_alias=$host_alias ;;
-  *) target_alias=$nonopt ;;
-  esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:2257: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
-  case $nonopt in
-  NONE) build_alias=$host_alias ;;
-  *) build_alias=$nonopt ;;
-  esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
-  test "$program_prefix$program_suffix$program_transform_name" = \
-    NONENONEs,x,x, &&
-  program_prefix=${target_alias}-
-
-
-# Set program_transform_name
-if test "$program_transform_name" = s,x,x,; then
-  program_transform_name=
-else
-  # Double any \ or $.  echo might interpret backslashes.
-  cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
-  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
-  rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
-  program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-
 # Stage specific cflags for build.
 stage1_cflags=
 case $build in
@@ -8889,19 +8844,24 @@ s%@includedir@%$includedir%g
 s%@oldincludedir@%$oldincludedir%g
 s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g
-s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g
 s%@host@%$host%g
 s%@host_alias@%$host_alias%g
 s%@host_cpu@%$host_cpu%g
 s%@host_vendor@%$host_vendor%g
 s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
 s%@build@%$build%g
 s%@build_alias@%$build_alias%g
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
+s%@CC@%$CC%g
+s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g
+s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g
 s%@GNATBIND@%$GNATBIND%g
 s%@ADAC@%$ADAC%g
 s%@strict1_warn@%$strict1_warn%g
@@ -8914,11 +8874,6 @@ s%@valgrind_path_defines@%$valgrind_path
 s%@valgrind_command@%$valgrind_command%g
 s%@coverage_flags@%$coverage_flags%g
 s%@enable_shared@%$enable_shared%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
 s%@stage1_cflags@%$stage1_cflags%g
 s%@SET_MAKE@%$SET_MAKE%g
 s%@AWK@%$AWK%g


	Jakub

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.))
  2002-11-26  5:42         ` [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)) Jakub Jelinek
@ 2002-11-26  9:59           ` Richard Henderson
  2002-11-28  7:34           ` Hans-Peter Nilsson
  1 sibling, 0 replies; 25+ messages in thread
From: Richard Henderson @ 2002-11-26  9:59 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Hans-Peter Nilsson, gcc-patches

On Tue, Nov 26, 2002 at 02:36:32PM +0100, Jakub Jelinek wrote:
> 	* configure.in: Move AC_CANONICAL_SYSTEM and AC_ARG_PROGRAM back
> 	before AC_PROG_CC.
> 	* configure: Rebuilt.

Ok.


r~

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.))
  2002-11-26  5:42         ` [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)) Jakub Jelinek
  2002-11-26  9:59           ` Richard Henderson
@ 2002-11-28  7:34           ` Hans-Peter Nilsson
  2002-11-28  8:08             ` Hans-Peter Nilsson
  1 sibling, 1 reply; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-28  7:34 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Henderson, gcc-patches

On Tue, 26 Nov 2002, Jakub Jelinek wrote:
> 	* configure.in: Move AC_CANONICAL_SYSTEM and AC_ARG_PROGRAM back
> 	before AC_PROG_CC.

It would help prevent this happening again in the future if
there was a comment that the invocation order has to be
preserved, or indeed if those macros had been self-checking like
some other autoconf macros are.

> 	* configure: Rebuilt.
>
> --- gcc/configure.in.jj	2002-11-26 15:13:51.000000000 +0100
> +++ gcc/configure.in	2002-11-26 15:15:39.000000000 +0100
> @@ -176,6 +176,12 @@ changequote([, ])dnl
>    fi
>  fi
>
> +# Determine the host, build, and target systems

"# Needs to be invoked before AC_PROG_CC."

Thanks for fixing it.

brgds, H-P

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.))
  2002-11-28  7:34           ` Hans-Peter Nilsson
@ 2002-11-28  8:08             ` Hans-Peter Nilsson
  0 siblings, 0 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2002-11-28  8:08 UTC (permalink / raw)
  To: gcc-patches

On Tue, 26 Nov 2002, Jakub Jelinek wrote:
> 	* configure.in: Move AC_CANONICAL_SYSTEM and AC_ARG_PROGRAM back
> 	before AC_PROG_CC.

It would help prevent this happening again in the future if
there was a comment that the invocation order has to be
preserved, or indeed if those macros had been self-checking like
some other autoconf macros are.

> 	* configure: Rebuilt.
>
> --- gcc/configure.in.jj	2002-11-26 15:13:51.000000000 +0100
> +++ gcc/configure.in	2002-11-26 15:15:39.000000000 +0100
> @@ -176,6 +176,12 @@ changequote([, ])dnl
>    fi
>  fi
>
> +# Determine the host, build, and target systems

"# Needs to be invoked before AC_PROG_CC."

Thanks for fixing it.

brgds, H-P


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2002-11-27 23:08 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-10 17:35 RFC: --enable-checking=valgrind Hans-Peter Nilsson
2002-11-10 19:34 ` Zack Weinberg
2002-11-11  1:55   ` Hans-Peter Nilsson
2002-11-11 16:53     ` Zack Weinberg
2002-11-11 17:48       ` Hans-Peter Nilsson
2002-11-12  6:02       ` Jan Hubicka
2002-11-12 17:11         ` Hans-Peter Nilsson
2002-11-12 17:21           ` Zack Weinberg
2002-11-13  5:32           ` Jan Hubicka
2002-11-13 13:38             ` Hans-Peter Nilsson
2002-11-18 17:20     ` Richard Henderson
2002-11-18 18:24       ` [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.) Hans-Peter Nilsson
2002-11-18 20:37         ` Richard Henderson
2002-11-20 11:57           ` Hans-Peter Nilsson
2002-11-18 22:12         ` Neil Booth
2002-11-19  4:37           ` Hans-Peter Nilsson
2002-11-18 22:33         ` Andreas Jaeger
2002-11-19  4:33           ` Hans-Peter Nilsson
2002-11-19  7:31             ` Andreas Jaeger
2002-11-19  9:07               ` Hans-Peter Nilsson
2002-11-19  9:15                 ` [RFA:] Take 2 Andreas Jaeger
2002-11-26  5:42         ` [PATCH] Fix configure (was Re: [RFA:] Take 2 (was: Re: RFC: --enable-checking=valgrind.)) Jakub Jelinek
2002-11-26  9:59           ` Richard Henderson
2002-11-28  7:34           ` Hans-Peter Nilsson
2002-11-28  8:08             ` Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).