public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: royhills@hotmail.com
To: gcc-gnats@gcc.gnu.org
Subject: c/7710: GCC warns "<var> might be used uninitialized" when optimisation turned on
Date: Sat, 24 Aug 2002 09:36:00 -0000	[thread overview]
Message-ID: <20020824122216.23603.qmail@sources.redhat.com> (raw)


>Number:         7710
>Category:       c
>Synopsis:       GCC warns "<var> 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
YWluJzoNCmdjYy1mcC11bnVzZWQuYzo2OiB3YXJuaW5nOiBgZnAnIG1pZ2h0IGJlIHVzZWQgdW5p
bml0aWFsaXplZCBpbiB0aGlzIGZ1bmN0aW9uDQpyc2hAcm95Oi91c3IvaG9tZS9yc2gvc3JjJCB1
bmFtZSAtYQ0KTGludXggcm95IDIuMi4xOXByZTE3ICMyIE1vbiBGZWIgNCAxOToyNToyNyBHTVQg
MjAwMiBpNTg2IHVua25vd24NCnJzaEByb3k6L3Vzci9ob21lL3JzaC9zcmMkIGV4aXQNCmV4aXQN
CgpTY3JpcHQgZG9uZSBvbiBGcmkgQXVnIDIzIDIwOjIzOjM4IDIwMDIK


             reply	other threads:[~2002-08-24 12:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-24  9:36 royhills [this message]
2002-08-24 10:56 nathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020824122216.23603.qmail@sources.redhat.com \
    --to=royhills@hotmail.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).