public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os
@ 2013-10-12  3:09 arequipeno at gmail dot com
  2013-10-12  3:10 ` [Bug c/58698] " arequipeno at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: arequipeno at gmail dot com @ 2013-10-12  3:09 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4413 bytes --]

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

            Bug ID: 58698
           Summary: Spurious "may be used unitialized" warning when
                    compiling with -Os
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arequipeno at gmail dot com

When compiling the (soon to be) attached file with -Os, I receive the following
warning:

[pilcher@ian freecusd2]$ gcc -Os -W -Wall -Wextra -lpthread -c -o /dev/null
raid.c
raid.c: In function ‘fcd_raid_fn’:
raid.c:694:20: warning: ‘array’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
  array->ideal_devs = atoi(c + matches[4].rm_so);
                    ^
raid.c:642:25: note: ‘array’ was declared here
  struct fcd_raid_array *array;
                         ^

I don't get this warning with -O0, -O1, -O2, or -O3.

(array is initialized by the call to fcd_find_array at line 651; that function
can be found at line 371.)

This is gcc 4.8.1 on Fedora 19 (x86_64):

[pilcher@ian ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-isl=/builddir/build/BUILD/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/cloog-install
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.1 20130603 (Red Hat 4.8.1-1) (GCC)
>From gcc-bugs-return-431516-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Oct 12 03:09:46 2013
Return-Path: <gcc-bugs-return-431516-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25026 invoked by alias); 12 Oct 2013 03:09:46 -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 24999 invoked by uid 48); 12 Oct 2013 03:09:43 -0000
From: "arequipeno at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/58698] Spurious "may be used unitialized" warning when compiling with -Os
Date: Sat, 12 Oct 2013 03:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: arequipeno at gmail dot com
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: attachments.created
Message-ID: <bug-58698-4-y6OCQ7T3DD@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58698-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58698-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-10/txt/msg00660.txt.bz2
Content-length: 227

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

--- Comment #1 from Ian Pilcher <arequipeno at gmail dot com> ---
Created attachment 30987
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id0987&actioníit
C source file


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

* [Bug c/58698] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
@ 2013-10-12  3:10 ` arequipeno at gmail dot com
  2013-10-12  3:11 ` arequipeno at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: arequipeno at gmail dot com @ 2013-10-12  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Ian Pilcher <arequipeno at gmail dot com> ---
Created attachment 30988
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30988&action=edit
Header file (required to compile C source)


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

* [Bug c/58698] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
  2013-10-12  3:10 ` [Bug c/58698] " arequipeno at gmail dot com
@ 2013-10-12  3:11 ` arequipeno at gmail dot com
  2013-10-12  3:13 ` arequipeno at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: arequipeno at gmail dot com @ 2013-10-12  3:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Ian Pilcher <arequipeno at gmail dot com> ---
Created attachment 30989
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30989&action=edit
Preprocessed file


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

* [Bug c/58698] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
  2013-10-12  3:10 ` [Bug c/58698] " arequipeno at gmail dot com
  2013-10-12  3:11 ` arequipeno at gmail dot com
@ 2013-10-12  3:13 ` arequipeno at gmail dot com
  2013-10-12 19:50 ` [Bug tree-optimization/58698] " pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: arequipeno at gmail dot com @ 2013-10-12  3:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Ian Pilcher <arequipeno at gmail dot com> ---
Created attachment 30990
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30990&action=edit
Assembler file


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

* [Bug tree-optimization/58698] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-12  3:13 ` arequipeno at gmail dot com
@ 2013-10-12 19:50 ` pinskia at gcc dot gnu.org
  2013-10-14  9:05 ` [Bug tree-optimization/58698] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-10-12 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
          Component|c                           |tree-optimization
      Known to fail|                            |4.7.0, 4.8.1

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It happens with 4.7.0 also.


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

* [Bug tree-optimization/58698] [4.7/4.8/4.9 Regression] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
                   ` (3 preceding siblings ...)
  2013-10-12 19:50 ` [Bug tree-optimization/58698] " pinskia at gcc dot gnu.org
@ 2013-10-14  9:05 ` rguenth at gcc dot gnu.org
  2013-10-14 16:50 ` law at redhat dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-14  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-14
      Known to work|                            |4.6.3
   Target Milestone|---                         |4.7.4
            Summary|Spurious "may be used       |[4.7/4.8/4.9 Regression]
                   |unitialized" warning when   |Spurious "may be used
                   |compiling with -Os          |unitialized" warning when
                   |                            |compiling with -Os
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.0

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed also for trunk.  Does not happen with 4.6.


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

* [Bug tree-optimization/58698] [4.7/4.8/4.9 Regression] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
                   ` (4 preceding siblings ...)
  2013-10-14  9:05 ` [Bug tree-optimization/58698] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
@ 2013-10-14 16:50 ` law at redhat dot com
  2013-11-05 15:00 ` rguenth at gcc dot gnu.org
  2013-11-19 22:18 ` law at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2013-10-14 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com

--- Comment #7 from Jeffrey A. Law <law at redhat dot com> ---
This is a result of jump threading being throttled at -Os.

When optimizing for size, we will not thread through a block with side effects
that has more than one predecessor.  Such blocks have to be duplicated to
isolate the optimizable path through the CFG.  The duplication can obviously
contribute to code size increases.

In this particular example we have a CFG path we can  optimize. 
bb52->bb95->bb198

(gdb) p debug_bb_n (52)
<bb 52>:
_173 = (sizetype) _170;
_174 = buf_111 + _173;
fcd_err (4, "raid.c:382: WARNING: RAID device name \'%.*s\' too long\n", _171,
_174);
goto <bb 95>;

$63 = (basic_block_def *) 0x7ffff7d7f208
(gdb) p debug_bb_n (95)
<bb 95>:
# _200 = PHI <-1(52), -1(68), 0(69), 1(71), -1(72), 1(92), ret_201(93), -1(94)>
# array_380 = PHI <array_431(52), _209(68), _209(69), _209(71), _209(72),
array_427(92), array_416(93), array_416(94)>
uuid ={v} {CLOBBER};
if (_200 < 0)
  goto <bb 198>;
else
  goto <bb 96>;

$64 = (basic_block_def *) 0x7ffff7d7f888
(gdb) p debug_bb_n (198)
<bb 198>:
goto <bb 160>;


So normally we'd duplicate bb95 so that we can optimize the path 52->95->198
since on that path we know where bb95 will go.

With jump threading throttled because bb95 has > 1 pred and statements with
side effects (uuid = ...), the path is not optimized as stays as shown above.

Thus, the uninitialized warning analysis has to consider that the path
52->95->96 may be traversed and if that path is followed, it'll use "array".


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

* [Bug tree-optimization/58698] [4.7/4.8/4.9 Regression] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
                   ` (5 preceding siblings ...)
  2013-10-14 16:50 ` law at redhat dot com
@ 2013-11-05 15:00 ` rguenth at gcc dot gnu.org
  2013-11-19 22:18 ` law at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-05 15:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug tree-optimization/58698] [4.7/4.8/4.9 Regression] Spurious "may be used unitialized" warning when compiling with -Os
  2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
                   ` (6 preceding siblings ...)
  2013-11-05 15:00 ` rguenth at gcc dot gnu.org
@ 2013-11-19 22:18 ` law at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2013-11-19 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #8 from Jeffrey A. Law <law at redhat dot com> ---
Confirmed duplicate of 42145.

*** This bug has been marked as a duplicate of bug 42145 ***


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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-12  3:09 [Bug c/58698] New: Spurious "may be used unitialized" warning when compiling with -Os arequipeno at gmail dot com
2013-10-12  3:10 ` [Bug c/58698] " arequipeno at gmail dot com
2013-10-12  3:11 ` arequipeno at gmail dot com
2013-10-12  3:13 ` arequipeno at gmail dot com
2013-10-12 19:50 ` [Bug tree-optimization/58698] " pinskia at gcc dot gnu.org
2013-10-14  9:05 ` [Bug tree-optimization/58698] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-10-14 16:50 ` law at redhat dot com
2013-11-05 15:00 ` rguenth at gcc dot gnu.org
2013-11-19 22:18 ` law at redhat 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).