On 08/28/2012 02:08 AM, Jim Meyering wrote: > It seems legit, but perhaps it should be complaining about "match" > rather than "file".
I don't see why it's legit. Even if longjmp trashes the value of 'match', the code right after the longjmp immediately sets 'match' (there's a comment to the code to that effect). This bogus warning, along with the seemingly random variable name that it mentions, may be the symptom of a deeper problem in GCC, one that causes GCC to generate incorrect code, so it's probably worth filing a GCC bug report. For now I pushed this further patch into diffutils: >From e1c27502ee286392ef2be93af752a51574930038 Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Thu, 30 Aug 2012 07:52:22 -0700 Subject: [PATCH] diff: silence GCC warning instead of slowing down * src/dir.c (find_dir_file_pathname): Use 'IF_LINT (volatile)' to silence the gcc warning, rather than using 'volatile', as the warning appears to be bogus. --- src/dir.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dir.c b/src/dir.c index a2f6bba..530807e 100644 --- a/src/dir.c +++ b/src/dir.c @@ -323,8 +323,13 @@ dir_loop (struct comparison const *cmp, int i) char * find_dir_file_pathname (char const *dir, char const *file) { + /* The 'IF_LINT (volatile)' works around what appears to be a bug in + gcc 4.8.0 20120825; see + <http://lists.gnu.org/archive/html/bug-diffutils/2012-08/msg00007.html>. + */ + char const * IF_LINT (volatile) match = file; + char *val; - char const *volatile match = file; struct dirdata dirdata; dirdata.names = NULL; dirdata.data = NULL; -- 1.7.11.4
