Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2017 13:34:19 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316489 - head/usr.bin/grep
Message-ID:  <201704041334.v34DYJt1093547@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Tue Apr  4 13:34:19 2017
New Revision: 316489
URL: https://svnweb.freebsd.org/changeset/base/316489

Log:
  bsdgrep: Initialize vars to avoid a false positive GCC warning
  
  Reported by:	lwhsu
  MFC after:	1 month
  MFC with:	r316477

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==============================================================================
--- head/usr.bin/grep/util.c	Tue Apr  4 13:18:56 2017	(r316488)
+++ head/usr.bin/grep/util.c	Tue Apr  4 13:34:19 2017	(r316489)
@@ -282,6 +282,9 @@ procline(struct str *l, int nottext)
 	int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags;
 	int startm = 0;
 
+	/* Initialize to avoid a false positive warning from GCC. */
+	lastmatch.rm_so = lastmatch.rm_eo = 0;
+
 	/* Loop to process the whole line */
 	while (st <= l->len) {
 		lastmatches = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704041334.v34DYJt1093547>