Re: Incoming Message
Your file is attached.
No warning for module global variable which is set but never used
Hello,I'm wondering why GCC does not throw any warning when a module global variable is set (write) but never used (read).Is this behavior wanted? Does it makes sense to add such warning?Greets
Re: No warning for module global variable which is set but never used
Ahh, ok. With these explanation I understand that the compiler does remove it because of optimatizion. This is somehow good and bad. Good that unused variable does not consume any memory. Bad that developer is not informed that variable can be removed. Ursprüngliche Nachricht Von: Jakub Jelinek Datum: 09.12.20 11:00 (GMT+01:00) An: David Brown Cc: webmaster , gcc@gcc.gnu.org Betreff: Re: No warning for module global variable which is set but never used On Wed, Dec 09, 2020 at 10:50:22AM +0100, David Brown wrote:> I'd say that it makes sense to have such a warning as a natural> enhancement to the existing "-Wunused-but-set-variable" warning. But IThat is not really possible.The -Wunused-but-set-* warning works by having two bits for the DECL,TREE_USED and DECL_READ_P, where any uses mark the var TREE_USED and(conservatively) what can read the value marks it DECL_READ_Pand -Wunused-but-set-* is then variables that are TREE_USED and!DECL_READ_P. All this needs to be done early in the FE.For the static vars, the optimization to remove them altogether is donemuch later, and at that point the compiler doesn't know if it isn't usedbecause all the reads in the program have been optimized away vs. there werenone. Jakub
Re: No warning for module global variable which is set but never used
I'm talking about C/C++ :-) Ursprüngliche Nachricht Von: Tobias Burnus Datum: 09.12.20 13:15 (GMT+01:00) An: webmaster Betreff: Re: No warning for module global variable which is set but never used The example below is for Fortran – but the same applies to C++ modulesand to static variable in general, especially if they are global variables.(It is not clear from the question about which language you were talking.)TobiasOn 09.12.20 13:13, Tobias Burnus wrote:> On 09.12.20 13:02, webmaster wrote:>>> Ahh, ok. With these explanation I understand that the compiler does>> remove it because of optimatizion. This is somehow good and bad.>> Good that unused variable does not consume any memory. Bad that>> developer is not informed that variable can be removed.>> That's the general problem with (module) global variables:>> module m> integer :: A> end>> program main> use m> external foo> A = 5> call foo()> end>> > Now assume in a different file:>> subroutine foo> use m> print *, A> end>> In this case, the compiler cannot see while processing the first file> that 'foo' in a different file actually uses the variable - and cannot> warn.>> Doing tracking for static (implicit or explicit "SAVE") is difficult;> for (module) global variable it is impossible to do in general.>> Tobias>-Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / GermanyRegistergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Re: No warning for module global variable which is set but never used
I have the following Code C\C++: static int foo = 0; static void bar(void) { foo = 1; } Here it is clear for the compiler that the variable foo can only be accessed from the same modul and not from ther modules. From the explanations before I understand that the variable is removed due to optimization. But I do not understand why GCC does not throws a warning. >From my point of view it is responsibility of the developer to remove the unused variable.
Re: No warning for module global variable which is set but never used
Is it possible to request such feature? Am 09.12.2020 um 16:45 schrieb webmaster: > I have the following Code C\C++: > > static int foo = 0; > > static void bar(void) > { > foo = 1; > } > > Here it is clear for the compiler that the variable foo can only be > accessed from the same modul and not from ther modules. From the > explanations before I understand that the variable is removed due to > optimization. But I do not understand why GCC does not throws a warning. > >>From my point of view it is responsibility of the developer to remove > the unused variable. >
Re: No warning for module global variable which is set but never used
Ahhh, ok. Good too know. I think also it is not of high priority ;-) Greets Patrick Am 10.12.2020 um 16:26 schrieb David Brown: > On 10/12/2020 16:10, webmaster wrote: > > (As a general rule, you'll get more useful responses if you use your > name in your posts. It's common courtesy.) > > >> Is it possible to request such feature? >> > > Of course you can file a request for it. Go to the gcc bugzilla site: > > <https://gcc.gnu.org/bugzilla/> > > First, search thoroughly to see if it is already requested - obvious > duplicate requests just waste developers' time. If you find a > duplicate, add a comment and put yourself on the cc list. If you don't > find a duplicate, file it as a new bug. > > Given the replies on this list from gcc developers, I would not hold my > breath waiting for this feature. It is unlikely to be implemented > unless the relevant compiler passes are re-organised in some way, or > extra information is tracked. So I don't think it will be a priority. > > However, it's always good to track these things - and if many people > want a particular feature, it can't harm its chances of getting done > eventually. > > mvh., > > David > > >> Am 09.12.2020 um 16:45 schrieb webmaster: >>> I have the following Code C\C++: >>> >>> static int foo = 0; >>> >>> static void bar(void) >>> { >>> foo = 1; >>> } >>> >>> Here it is clear for the compiler that the variable foo can only be >>> accessed from the same modul and not from ther modules. From the >>> explanations before I understand that the variable is removed due to >>> optimization. But I do not understand why GCC does not throws a warning. >>> >>> >From my point of view it is responsibility of the developer to remove >>> the unused variable. >>> >> >> -- ___ _ __ _ _ __ _ _ _ _ |_ _| __| (_)__| | (_) |_ / _|___ _ _ | |_ ___| |_ | |_ _| |___ | | / _` | / _` | | | _| | _/ _ \ '_| | _/ -_) ' \ | | || | |_ / |___| \__,_|_\__,_| |_|\__| |_| \___/_|\__\___|_||_| |_|\_,_|_/__| -BEGIN PGP PUBLIC KEY BLOCK- Version: GnuPG v2.0.17 (MingW32) mQENBFHMmT8BCAC0smvU7Bq1ABxAhvBRn7d4ekkk95aCE4TTQo4wy1z/rGLhQfdt dhiD+Vy61vGrsdK3ei5sW6rBvX2m8+YmBi+8AAgSiZmS0JM3Zz3cmTi5oh0D/yM8 4aDj7wQYfJyzSmYN8InAQ5eA77lwIdqG27kR9wga2szeJwCnWReta0R+7YFkpUW+ zUlf4SWcUx5SmBsaiELQpm+Qcn+fyopo12RX6YVmoNPBvN2nDXDnRhUCKGc+0xhD UrBpCHrApK6sTnMsD34ClCLTL2L1gckQ0AsQqY3PJlx3R8kIJxlmr6R3WnjPMIG0 lqrukB9PcOrHM1MZXK1gK6AtypHBN98lr8Z9ABEBAAG0KndlYm1hc3RlciA8d2Vi bWFzdGVyQGRlZmNvbi1jYy5keW5kbnMub3JnPokBPgQTAQIAKAUCUcyZPwIbIwUJ CWYBgAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQcN1vxvRQl+0SEwf+KXjf YtiSUSVS11uqeQ/8g46NwmNa91P3toZvEd7vhLSbjnL9bi/vApzNnUTGT3VP4/NA dg9SbR4qKlSr8T+YikRMV3tiuiVq8m7g00qM9y8MIomwJTounz8VdO/aJXFSOxAK Bb6ElREADspCzr2qSZCnozWUzbd+b8owbGeRRq3e33Aa5Nlm/xDRxGDWANbaIA8q Gkibvy3vWEwrxiwsakvHGaEZnPEtlNm3M1xcmFAuyl73qzUMkLN0u9E/2igo4EB5 EdMb5Ab5hfWdljxBqJr0tsvMfSK4VkzMCbKYkTqHZIRPQnhiSBE6Yo1Q6RCl/Hht bkvU4RA0J+NkXMZljrkBDQRRzJk/AQgA0HojJnK0uhEkAnbmszYsf477DV+LD02s ZEAlLGhJlf9qYaDiPMPwaZ3nK8/PYKzPpBWfHgRQP97rLHPIVJYl3BHDa/nWeZ2b e/HzYhpX0djbK9qe6W/CTfGbXmC/y+4dDGB8dvtTAW3JILm7xEdwiWtywozEVy7V lnMK4JQvlfOh+3XO6qv71FXyuRkObvkYzqvxUYHewtvvObcVxXHP0C0O6LB44iAW 2boZVVuiHdudnyNAezJajPMUT8SnI0bwL6+0TgnHL4cKNUEPQljIrrvi+9nCkq7V uBtnsYtyoo2reoxmCbX/Z1zZsxdUcKpeJHlc5AypyN8DUJ+APJ9NnwARAQABiQEl BBgBAgAPBQJRzJk/AhsMBQkJZgGAAAoJEHDdb8b0UJftOY0H/1TChmQrJC/qzefW PK7EqFlBg3TIEXdu8JHjF42ZOgzQRfp7E2wWzEx0Y45lNXMs6Yg15hWCEDaUDF6F 5WZKNrP8xIldyR9Aw7fyKqjZ9UuKovqofHsCiaSO7nWzGM6GF3nBDNI9NcFve/wN wggyjAbohOJrJGal3N0HlG3cakqjEmjBe1gQEMC0ZPlWstb/cqqr49TNPrRmQc4P SyGffh8Xqhw94m1LDBXFEaYe7AxjNk1sPAVfO1rOdLF6GOun/UwgbhDQX/Rb9C3t AhjSgyFEiR/gfrUZ7R6SY51qOUf1lN5ZN85C/x27XoZWYlsNaH3Ei6nG+yeswBMk ZRMbezQ= =Med3 -END PGP PUBLIC KEY BLOCK-
Designing Expert
Hi, I was on your website. www.gcc.gnu.org My name is Rakhi, I am a web developer having 9+ years' experience in website development and UX/UI web-design. I work closely with my clients in translating their vision into reality at reasonable rates. My work is 100% original. Services: Website development, using: * Wordpress, HTML5, CSS3, bootstrap, AngularJS, JavaScript, jQuery, php. Web design, using: * Adobe Photoshop, Adobe Illustrator, Sketch, Gimp. Additional Skills * Great English communication skills. * Ability to work in team. * Ability to be online during work hours for real time communication. * Experience with GIT source control. * Experience with Agile Methodology. * Trello, JIRA knowledge. Feel free to contact me! Thanks, Rakhi
Hurennetzwerk News
Neue Einträge in: http://www.hurennetzwerk.de/frankfurt-kontakte.php http://www.hurennetzwerk.de/hamburg-kontakte.php http://www.hurennetzwerk.de/oldenburg-kontakte.php http://www.hurennetzwerk.de/herne-kontakte.php http://www.geiles-nrw.de/ http://www.hurennetzwerk.de/erkrath-kontakte.php http://www.hurennetzwerk.de/bayreuth-kontakte.php http://www.hurennetzwerk.de/viersen_kontakte.php http://www.hurennetzwerk.de/kamen-kontakte.php http://www.hurennetzwerk.de/freiburg-kontakte.php http://www.hurennetzwerk.de/jena-kontakte.php http://www.hurennetzwerk.de/uelzen-kontakte.php http://www.hurennetzwerk.de/leipzig-kontakte.php http://www.hurennetzwerk.de/koeln2-kontakte.php http://www.hurennetzwerk.de/bad_homburg-kontakte.php http://www.hurennetzwerk.de/saarland.php http://www.hurennetzwerk.de/nuernberg-kontakte.php http://www.hurennetzwerk.de/osnabrueck-kontakte.php http://www.hurennetzwerk.de/schweinfurt-kontakte.php http://www.hurennetzwerk.de/trier-kontakte.php http://www.hurennetzwerk.de/leubnitz-kontakte.php http://www.hurennetzwerk.de/landshut-kontakte.php http://www.hurennetzwerk.de/koeln2-kontakte.php http://www.hurennetzwerk.de/berlin-kontakte.php http://www.hurennetzwerk.de/essen-kontakte.php http://www.hurennetzwerk.de/koeln-kontakte.php http://www.hurennetzwerk.de/gelsenkirchen-kontakte.php http://www.hurennetzwerk.de/worms-kontakte.php http://www.hurennetzwerk.de/wuppertal-kontakte.php