This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, Bernd Edlinger <bernd dot edlinger at hotmail dot de>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, <richard dot sandiford at arm dot com>
- Date: Wed, 16 Oct 2019 16:35:16 +0000
- Subject: Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c
- Ironport-sdr: 464ixdb0YC4EkuWON95z9NuObb9Orsav0w4s0GtsfRj/l2MjMYsILfvsYt5FgmPimhEtcZNs+l G4bRTOCcb1EsaRjlj1yDHf45v4un23JEMYyKYbrVldv1wSBN4jWwukWiLNKiTiT3FVOm+B6Xp4 UId5VlofSm4/gJTauXLKvFmQ68DsMJcufu8T9l98b92oybRPtp/SEWjGspnKW4kAIL11SSwwaE CsulfHmmQ6f7Qt2lLxcwioPvPXCwtG/TjwaLPzJQZEo6Sx94WqNekwKhQFFzbQmfOhbtIxAnFt KSY=
- Ironport-sdr: bmDUEyj+AZ3T5X9V4T/NqJ2IOv8bwZr0xF39j1B3+e+UMWYKru1VDDPpBS+My3eV/zBxHXkXE1 21XERzPtAzMeiqzOdlacwo2hhaML3Oc2QAISVl0C4nrQheEcc9SZZTu5V1HiSwOLe0jBACCqFv w2tjovJ/dNjlTsxWDN7se23CEjWZ3QaJ/nL/av0e2rTKb0kzR6WkAWp49G/H4/tKHBlpdKP/Ni VOeqD57P7KTufN4UGa1ZyipGADegq7IQf8Uyk5VebPyGzl9u6u0BapennBGeEiOux5ODdjPqyp dxA=
- References: <VI1PR03MB45289E8FD7DD111FE1F0E2BAE49E0@VI1PR03MB4528.eurprd03.prod.outlook.com> <mptblugu3ma.fsf@arm.com> <ffc4f149-9320-1e46-2647-37925b8fc5ff@gmail.com> <20191016155055.GM2116@tucnak>
On Wed, 16 Oct 2019, Jakub Jelinek wrote:
> The counter example would be:
> #define F(x) \
> __extension__ (({ __typeof__ (x) _x = x; _x < 0 ? -_x : _x; }))
> #define G(x) \
> __extension__ (({ __typeof__ (x) _x = x; F(_x); }))
> where a -Wshadow diagnostics could point the author at a serious bug,
> because in the expansion it will be __typeof__ (_x) _x = _x; ...
And this is not theoretical,
<https://sourceware.org/bugzilla/show_bug.cgi?id=15667>
<https://sourceware.org/ml/libc-alpha/2013-06/msg00851.html> was a real
bug in glibc soft-fp where shadowing of variables called _c1 and _c2 in
two macros resulted in wrong code.
--
Joseph S. Myers
joseph@codesourcery.com