| Summary: | Warning for uninitialized var has the wrong function and location | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Josh Stone <jistone> |
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
| Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 27 | CC: | aravindvijayan224185, cfergeau, debarshir, jakub |
| Target Milestone: | --- | Keywords: | Reopened, Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-11-30 18:16:20 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
The warning disappears when compiled as: gcc -Wuninitialized -c uninit.c It should still be there, isn't it? (In reply to comment #1) > The warning disappears when compiled as: > gcc -Wuninitialized -c uninit.c > > It should still be there, isn't it? No, I think -O is needed to detect uninitialized. GCC(1) says: "Because these warnings depend on optimization, the exact variables or elements for which there are warnings will depend on the precise optimization options and version of GCC used." This message is a notice that Fedora 15 is now at end of life. Fedora has stopped maintaining and issuing updates for Fedora 15. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At this time, all open bugs with a Fedora 'version' of '15' have been closed as WONTFIX. (Please note: Our normal process is to give advanced warning of this occurring, but we forgot to do that. A thousand apologies.) Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, feel free to reopen this bug and simply change the 'version' to a later Fedora version. Bug Reporter: Thank you for reporting this issue and we are sorry that we were unable to fix it before Fedora 15 reached end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged to click on "Clone This Bug" (top right of this page) and open it against that version of Fedora. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping (In reply to comment #0) > $ gcc -Wuninitialized -O -c uninit.c > uninit.c: In function ‘foo’: > uninit.c:10:3: warning: ‘x’ may be used uninitialized in this function > [-Wuninitialized] This is still wrong on F17 too: $ rpm -q gcc gcc-4.7.0-5.fc17.x86_64 $ gcc -Wuninitialized -O -c uninit.c uninit.c: In function ‘foo’: uninit.c:10:3: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed. (In reply to Fedora End Of Life from comment #6) > If you can reproduce this bug against a currently maintained version of > Fedora please feel free to reopen this bug against that version. The issue remains in gcc-4.8.1-1.fc19.x86_64. This message is a notice that Fedora 19 is now at end of life. Fedora has stopped maintaining and issuing updates for Fedora 19. It is Fedora's policy to close all bug reports from releases that are no longer maintained. Approximately 4 (four) weeks from now this bug will be closed as EOL if it remains open with a Fedora 'version' of '19'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 19 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. $ rpm -q gcc gcc-4.9.2-1.fc21.x86_64 $ gcc -Wuninitialized -O -c uninit.c uninit.c: In function ‘foo’: uninit.c:10:3: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] return bar (); ^ $ gcc -Wuninitialized -O -c uninit.c -fno-inline uninit.c: In function ‘bar’: uninit.c:5:3: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] return x; ^ This message is a reminder that Fedora 21 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 21. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '21'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 21 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. $ rpm -q gcc
gcc-5.1.1-4.fc23.x86_64
$ gcc -Wuninitialized -O -c uninit.c
uninit.c: In function ‘bar’:
uninit.c:3:14: warning: implicit declaration of function ‘baz’ [-Wimplicit-function-declaration]
int x, y = baz();
^
uninit.c: In function ‘foo’:
uninit.c:10:10: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return bar ();
^
$ gcc -Wuninitialized -O -c uninit.c -fno-inline
uninit.c: In function ‘bar’:
uninit.c:3:14: warning: implicit declaration of function ‘baz’ [-Wimplicit-function-declaration]
int x, y = baz();
^
uninit.c:5:10: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return x;
^
It didn't hit "implicit declaration" before - maybe that's new to the default warning set? But that location is corrent anyway, while "uninitialized" still gets it wrong in the inlined case.
This message is a reminder that Fedora 23 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 23. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '23'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 23 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The situation is the same with gcc-6.2.1-2.fc25.x86_64 This message is a reminder that Fedora 25 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 25. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '25'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 25 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Still the same with gcc-7.2.1-2.fc27.x86_64 This message is a reminder that Fedora 27 is nearing its end of life. On 2018-Nov-30 Fedora will stop maintaining and issuing updates for Fedora 27. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '27'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 27 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed. |
Description of problem: In a warning for an uninitialized variable in my program, I was confused because the named variable did not exist in the given function or at the given line. It turned out to be from a static function that was inlined near that location. Version-Release number of selected component (if applicable): gcc-4.6.0-7.fc15.x86_64 How reproducible: 100% Steps to Reproduce: 1. cat uninit.c static int bar (void) { int x, y = baz(); if (y) x = y; return x; } int foo (void) { return bar (); } 2. gcc -Wuninitialized -O -c uninit.c Actual results: $ gcc -Wuninitialized -O -c uninit.c uninit.c: In function ‘foo’: uninit.c:10:3: warning: ‘x’ may be used uninitialized in this function [-Wuninitialized] Expected results: It should name the function and line where 'x' actually exists. It works correctly without inlining: $ gcc -Wuninitialized -O -c uninit.c -fno-inline uninit.c: In function ‘bar’: uninit.c:5:3: warning: ‘x’ may be used uninitialized in this function [-Wuninitialized] Additional info: For comparison, gcc-4.5.1-4.fc14.x86_64 gets the line closer, though at the point of x's declaration rather than use, but still misses the function name. $ gcc -Wuninitialized -O -c uninit.c uninit.c: In function ‘foo’: uninit.c:3:7: warning: ‘x’ may be used uninitialized in this function uninit.c:3:7: note: ‘x’ was declared here $ gcc -Wuninitialized -O -c uninit.c -fno-inline uninit.c: In function ‘bar’: uninit.c:3:7: warning: ‘x’ may be used uninitialized in this function