[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gcc -fanalyze
From: |
Paul Eggert |
Subject: |
Re: gcc -fanalyze |
Date: |
Sat, 9 May 2020 18:13:41 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
The first bug in that output:
cc1: warning: function may return address of local variable
[-Wreturn-local-addr]
lib/careadlinkat.c:73:8: note: declared here
73 | char stack_buf[1024];
| ^~~~~~~~~
This is a false alarm. I installed the attached patch to pacify GCC (if you
build with GCC_LINT).
But perhaps I jumped the gun here - the workaround is reasonably awful, so
perhaps it'd be better to disable -Wreturn-local-addr instead, at least for this
compilation unit.
lib/diffseq.h:432:36: warning: 'bxbest' may be used uninitialized in this
function [-Wmaybe-uninitialized]
432 | part->ymid = bxybest - bxbest;
| ~~~~~~~~^~~~~~~~
This false alarm is because the program was built without GCC_LINT being
defined. If you build with -DGCC_LINT the false alarm should go away. (Maybe
some others will go away too, at least careadlinkat is like this now....) This
is what Emacs etc. do. Perhaps this should be moved to the manywarnings module?
Speaking of which, manywarnings.m4 should be updated for GCC 10, mostly for the
-fanalyze warnings. I installed the second attached patch to do that.
0001-careadlinkat-pacify-Wreturn-local-addr.patch
Description: Text Data
0002-manywarnings-port-to-GCC-10.1.patch
Description: Text Data