From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24222 invoked by alias); 24 Aug 2002 12:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24203 invoked by uid 71); 24 Aug 2002 12:26:01 -0000 Resent-Date: 24 Aug 2002 12:26:01 -0000 Resent-Message-ID: <20020824122601.24202.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, royhills@hotmail.com Received: (qmail 23604 invoked by uid 61); 24 Aug 2002 12:22:16 -0000 Message-Id: <20020824122216.23603.qmail@sources.redhat.com> Date: Sat, 24 Aug 2002 09:36:00 -0000 From: royhills@hotmail.com Reply-To: royhills@hotmail.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/7710: GCC warns " might be used uninitialized" when optimisation turned on X-SW-Source: 2002-08/txt/msg00521.txt.bz2 List-Id: >Number: 7710 >Category: c >Synopsis: GCC warns " might be used uninitialized" when optimisation turned on >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sat Aug 24 05:26:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: royhills@hotmail.com >Release: GCC 2.95.2 >Organization: >Environment: Debian Linux "Potato" (2.2r7) running on i386 with custom 2.2.19 Kernel. >Description: GCC 2.95.2 on Debian Linux 2.2r7 gives the warning: "`fp' might be used uninitialized in this function" when optimisation is turned on with -O1 or -O2, but no warning is issued if optimisation is turned off. I've simplified the code to a 13 line program which I attach to this bug report. Lookig at the code, I can see no way that the variable "fp" could be used uninitialised. This issue doesn't seem to affect the real program which works fine with -O2 (so far anyway...). Example: # Program compiles fine without optimisation rsh@roy:/usr/home/rsh/src$ gcc -Wall gcc-fp-unused.c # But it gives the warning with optimisation on rsh@roy:/usr/home/rsh/src$ gcc -O2 -Wall gcc-fp-unused.c gcc-fp-unused.c: In function `main': gcc-fp-unused.c:6: warning: `fp' might be used uninitialized in this function >How-To-Repeat: Bug is fully repeatable on my system. Warning occurs every time the file shown in the attachment is compiled with optimisation turned on. >Fix: Compile without optimisation :-) >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="gcc-fp-unused.ts" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="gcc-fp-unused.ts" U2NyaXB0IHN0YXJ0ZWQgb24gRnJpIEF1ZyAyMyAyMDoyMjoxOCAyMDAyCnJzaEByb3k6L3Vzci9o b21lL3JzaC9zcmMkIGNhdCBnY2MtZnAtdW51c2VkLmMNCiNpbmNsdWRlIDxzdGRpby5oPg0KDQpp bnQgbWFpbiAoKSB7DQogICBjaGFyIGJ1ZlsyNTVdOw0KICAgaW50IGZsYWcgPSAwOw0KICAgRklM RSAqZnA7DQoNCiAgIGlmIChmbGFnKQ0KICAgICAgZnAgPSBmb3BlbigidGVzdC50eHQiLCAiciIp Ow0KDQogICBmb3IgKDs7KSB7DQogICAgICBpZiAoZmxhZykNCiAgICAgICAgIGZnZXRzKGJ1Ziwg MjU1LCBmcCk7DQogICB9DQogICByZXR1cm4oMCk7DQp9DQpyc2hAcm95Oi91c3IvaG9tZS9yc2gv c3JjJCBnY2MgLS12ZXJzaW9uDQoyLjk1LjINCnJzaEByb3k6L3Vzci9ob21lL3JzaC9zcmMkIGdj YyAtV2FsbCBnY2MtZnAtdW51c2VkLmMNCnJzaEByb3k6L3Vzci9ob21lL3JzaC9zcmMkIGdjYyAt TzIgLVdhbGwgZ2NjLWZwLXVudXNlZC5jDQpnY2MtZnAtdW51c2VkLmM6IEluIGZ1bmN0aW9uIGBt YWluJzoNCmdjYy1mcC11bnVzZWQuYzo2OiB3YXJuaW5nOiBgZn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