public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function'
@ 2005-05-01 16:43 olh at suse dot de
  2005-05-01 16:44 ` [Bug c/21320] " olh at suse dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: olh at suse dot de @ 2005-05-01 16:43 UTC (permalink / raw)
  To: gcc-bugs

this testcase is taken from subversion-1.1.4 subversion/libsvn_delta/svndiff.c

install_gcc40-1/libexec/gcc/powerpc-unknown-linux-gnu/4.0.1/cc1 -fpreprocessed /tmp/t.i -quiet -dumpbase t.c -auxbase-strip t -O2 -Wall -version -o t.s
GNU C version 4.0.1 20050429 (prerelease) (powerpc-unknown-linux-gnu)
        compiled by GNU C version 4.0.1 20050429 (prerelease).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
t.c: In function 'svn_txdelta_read_svndiff_window':
t.c:149: warning: 'ninst' may be used uninitialized in this function

-- 
           Summary: possible false positives for '$foo may be used
                    uninitialized in this function'
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: olh at suse dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-linux
  GCC host triplet: powerpc-linux
GCC target triplet: powerpc-linux


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


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

* [Bug c/21320] possible false positives for '$foo may be used uninitialized in this function'
  2005-05-01 16:43 [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function' olh at suse dot de
@ 2005-05-01 16:44 ` olh at suse dot de
  2005-05-01 16:45 ` [Bug middle-end/21320] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: olh at suse dot de @ 2005-05-01 16:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From olh at suse dot de  2005-05-01 16:44 -------
Created an attachment (id=8784)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8784&action=view)
/tmp/pr21320-t.i.bz2


-- 


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


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

* [Bug middle-end/21320] possible false positives for '$foo may be used uninitialized in this function'
  2005-05-01 16:43 [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function' olh at suse dot de
  2005-05-01 16:44 ` [Bug c/21320] " olh at suse dot de
@ 2005-05-01 16:45 ` pinskia at gcc dot gnu dot org
  2005-05-09 21:23 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-01 16:45 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end
           Keywords|                            |diagnostic


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


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

* [Bug middle-end/21320] possible false positives for '$foo may be used uninitialized in this function'
  2005-05-01 16:43 [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function' olh at suse dot de
  2005-05-01 16:44 ` [Bug c/21320] " olh at suse dot de
  2005-05-01 16:45 ` [Bug middle-end/21320] " pinskia at gcc dot gnu dot org
@ 2005-05-09 21:23 ` pinskia at gcc dot gnu dot org
  2005-05-11  6:17 ` olh at suse dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-09 21:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-09 21:23 -------
Reduced testcase:
void *g();

static void *count_and_verify_instructions(int *ninst,const unsigned char *p)
{
   if (p == ((void *)0))
    return g();
 *ninst = 0;
 return 0;
}
void f(int);
void *decode_window(const unsigned char *data)
{
  int ninst;
  void *svn_err__temp = count_and_verify_instructions(&ninst, data);
  if (svn_err__temp)
    return svn_err__temp;

  f (ninst);
  return 0;
}


So this is not a bug at all because g (svn_error_createf) could return null.

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


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


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

* [Bug middle-end/21320] possible false positives for '$foo may be used uninitialized in this function'
  2005-05-01 16:43 [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function' olh at suse dot de
                   ` (2 preceding siblings ...)
  2005-05-09 21:23 ` pinskia at gcc dot gnu dot org
@ 2005-05-11  6:17 ` olh at suse dot de
  2005-05-11 10:43 ` pinskia at gcc dot gnu dot org
  2005-06-03 14:17 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: olh at suse dot de @ 2005-05-11  6:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From olh at suse dot de  2005-05-11 06:17 -------
Is there an attribute to declare a function as 'will never return NULL'?
In this case it is true, the called function dereferences the pointer
to return before returning to the caller.


-- 


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


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

* [Bug middle-end/21320] possible false positives for '$foo may be used uninitialized in this function'
  2005-05-01 16:43 [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function' olh at suse dot de
                   ` (3 preceding siblings ...)
  2005-05-11  6:17 ` olh at suse dot de
@ 2005-05-11 10:43 ` pinskia at gcc dot gnu dot org
  2005-06-03 14:17 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 10:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-11 10:43 -------
(In reply to comment #3)
> Is there an attribute to declare a function as 'will never return NULL'?
> In this case it is true, the called function dereferences the pointer
> to return before returning to the caller.

There is none yet but there is some talk about adding one because it would improve code generation 
and checks on null too.


-- 


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


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

* [Bug middle-end/21320] possible false positives for '$foo may be used uninitialized in this function'
  2005-05-01 16:43 [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function' olh at suse dot de
                   ` (4 preceding siblings ...)
  2005-05-11 10:43 ` pinskia at gcc dot gnu dot org
@ 2005-06-03 14:17 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-03 14:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-03 14:17 -------
(In reply to comment #4)
> There is none yet but there is some talk about adding one because it would improve code generation 
> and checks on null too.
The talk is in PR 20318 and they reference this testcase.

-- 


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


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

end of thread, other threads:[~2005-06-03 14:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-01 16:43 [Bug c/21320] New: possible false positives for '$foo may be used uninitialized in this function' olh at suse dot de
2005-05-01 16:44 ` [Bug c/21320] " olh at suse dot de
2005-05-01 16:45 ` [Bug middle-end/21320] " pinskia at gcc dot gnu dot org
2005-05-09 21:23 ` pinskia at gcc dot gnu dot org
2005-05-11  6:17 ` olh at suse dot de
2005-05-11 10:43 ` pinskia at gcc dot gnu dot org
2005-06-03 14:17 ` pinskia at gcc dot gnu dot org

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