public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57407] New: Missing uninitialized warning following assert
@ 2013-05-25  1:39 stuff0003 at pobox dot com
  2013-05-25  2:21 ` [Bug tree-optimization/57407] " stuff0003 at pobox dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: stuff0003 at pobox dot com @ 2013-05-25  1:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57407

            Bug ID: 57407
           Summary: Missing uninitialized warning following assert
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stuff0003 at pobox dot com

In certain circumstances following an assertion, there is no warning for an
uninitialised variable.
(keyword also: uninitialized)

$ cat nowarn.c
#include <stdio.h>
#include <assert.h>
int main(int ac,char**av){
  int e,f;
  f=1;assert(f);
  printf("%d\n",e);
  return 0;
}
$ gcc -c nowarn.c -Wall -O3
$
(no warning generated)

Note that without optimisation you get the expected result:

$ gcc -c nowarn.c -Wall
nowarn.c: In function ‘main’:
nowarn.c:6:9: warning: ‘e’ may be used uninitialised in this function
[-Wuninitialized]

$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
...

You also get the expected result if assert(f) is replace by assert(1).
>From gcc-bugs-return-423100-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat May 25 01:53:15 2013
Return-Path: <gcc-bugs-return-423100-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5323 invoked by alias); 25 May 2013 01:53:15 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 5140 invoked by uid 48); 25 May 2013 01:53:10 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57407] Missing uninitialized warning following assert
Date: Sat, 25 May 2013 01:53:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.6.3
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords component
Message-ID: <bug-57407-4-wmFMC8sWGj@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57407-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57407-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg01773.txt.bz2
Content-length: 555

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW407

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
          Component|c                           |tree-optimization

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you try 4.7.x ?  4.6.3 is no longer support or you could report it to
linaro/ubuntu instead and get support from them.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/57407] Missing uninitialized warning following assert
  2013-05-25  1:39 [Bug c/57407] New: Missing uninitialized warning following assert stuff0003 at pobox dot com
@ 2013-05-25  2:21 ` stuff0003 at pobox dot com
  2013-05-27  8:41 ` rguenth at gcc dot gnu.org
  2013-05-27 11:22 ` stuff0003 at pobox dot com
  2 siblings, 0 replies; 4+ messages in thread
From: stuff0003 at pobox dot com @ 2013-05-25  2:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57407

--- Comment #2 from Alex <stuff0003 at pobox dot com> ---
I'm very sorry, I don't have the means to do that test easily.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/57407] Missing uninitialized warning following assert
  2013-05-25  1:39 [Bug c/57407] New: Missing uninitialized warning following assert stuff0003 at pobox dot com
  2013-05-25  2:21 ` [Bug tree-optimization/57407] " stuff0003 at pobox dot com
@ 2013-05-27  8:41 ` rguenth at gcc dot gnu.org
  2013-05-27 11:22 ` stuff0003 at pobox dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-05-27  8:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57407

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
> gcc-4.6 -S t.c -O3 -Wall
t.c: In function 'main':
t.c:6:11: warning: 'e' is used uninitialized in this function [-Wuninitialized]
> gcc-4.7 -S t.c -O3 -Wall
t.c: In function 'main':
t.c:6:11: warning: 'e' is used uninitialized in this function [-Wuninitialized]
> gcc-4.8 -S t.c -O3 -Wall
t.c: In function 'main':
t.c:6:11: warning: 'e' is used uninitialized in this function [-Wuninitialized]
     printf("%d\n",e);
           ^

thus, works for me.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/57407] Missing uninitialized warning following assert
  2013-05-25  1:39 [Bug c/57407] New: Missing uninitialized warning following assert stuff0003 at pobox dot com
  2013-05-25  2:21 ` [Bug tree-optimization/57407] " stuff0003 at pobox dot com
  2013-05-27  8:41 ` rguenth at gcc dot gnu.org
@ 2013-05-27 11:22 ` stuff0003 at pobox dot com
  2 siblings, 0 replies; 4+ messages in thread
From: stuff0003 at pobox dot com @ 2013-05-27 11:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57407

--- Comment #4 from Alex <stuff0003 at pobox dot com> ---
That's curious. It certainly doesn't work for me.

I wonder if it's possible that there is something wrong with subversion 4.6.3
(as opposed to version 4.6 tried above), or if Ubuntu/Linaro have somehow
introduced the problem when they ported it.

In any case, I'll take Andrew Pinski's suggestion and report it to Ubuntu. It
doesn't work for their current stable release, 12.04.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-27 11:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-25  1:39 [Bug c/57407] New: Missing uninitialized warning following assert stuff0003 at pobox dot com
2013-05-25  2:21 ` [Bug tree-optimization/57407] " stuff0003 at pobox dot com
2013-05-27  8:41 ` rguenth at gcc dot gnu.org
2013-05-27 11:22 ` stuff0003 at pobox dot com

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).