public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
@ 2011-08-21 21:12 d.g.gorbachev at gmail dot com
  2011-08-21 21:15 ` [Bug bootstrap/50148] " d.g.gorbachev at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2011-08-21 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50148
           Summary: GCC fails to bootstrap with -O3 due to "may be used
                    uninitialized" errors
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.g.gorbachev@gmail.com
              Host: i686-pc-linux-gnu
            Target: i686-pc-linux-gnu
             Build: i686-pc-linux-gnu


Created attachment 25070
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25070
Patch for c-parser.c

Error message:

../../gcc-4.7/gcc/c-parser.c: In function 'c_expr
c_parser_postfix_expression_after_primary(c_parser*, location_t, c_expr)':
../../gcc-4.7/gcc/c-parser.c:6664:16: error: 'origtypes' may be used
uninitialized in this function [-Werror=maybe-uninitialized]


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
@ 2011-08-21 21:15 ` d.g.gorbachev at gmail dot com
  2011-08-24 21:23 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2011-08-21 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 2011-08-21 21:12:23 UTC ---
Created attachment 25071
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25071
Patch for sched-deps.c

Also fails during -O3 LTO bootstrap in sched-deps.c.

(Another solution would be to build GCC with -Wno-error=maybe-uninitialized.)


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
  2011-08-21 21:15 ` [Bug bootstrap/50148] " d.g.gorbachev at gmail dot com
@ 2011-08-24 21:23 ` pinskia at gcc dot gnu.org
  2011-08-24 22:10 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-08-24 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-08-24 21:17:24 UTC ---
(In reply to comment #1)
> (Another solution would be to build GCC with -Wno-error=maybe-uninitialized.)

I think that is a bad idea really.  The question is this is a false positive or
a true positive?


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
  2011-08-21 21:15 ` [Bug bootstrap/50148] " d.g.gorbachev at gmail dot com
  2011-08-24 21:23 ` pinskia at gcc dot gnu.org
@ 2011-08-24 22:10 ` pinskia at gcc dot gnu.org
  2011-12-14 21:23 ` matt at use dot net
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-08-24 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-08-24 21:33:23 UTC ---
(In reply to comment #0)
> Created attachment 25070 [details]
> Patch for c-parser.c
> 
> Error message:
> 
> ../../gcc-4.7/gcc/c-parser.c: In function 'c_expr
> c_parser_postfix_expression_after_primary(c_parser*, location_t, c_expr)':
> ../../gcc-4.7/gcc/c-parser.c:6664:16: error: 'origtypes' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]

This patch is correct and does prevent the warning as we are using an
uninitialized value of origtypes (though if we inline  build_function_call_vec
and then convert_arguments, the only time it is used unitialized is when
exprlist is non NULL but that requires a lot of optimizations to happen really
and it might only be seen by the human eye rather the compiler).


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
                   ` (2 preceding siblings ...)
  2011-08-24 22:10 ` pinskia at gcc dot gnu.org
@ 2011-12-14 21:23 ` matt at use dot net
  2012-12-17 19:12 ` matt at use dot net
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: matt at use dot net @ 2011-12-14 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

Matt Hargett <matt at use dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matt at use dot net

--- Comment #4 from Matt Hargett <matt at use dot net> 2011-12-14 20:56:55 UTC ---
It's only when -fipa-cp-clone is used. If you use all -O3 flags except that
one, it works around the issue.

Andrew, can we add a pragma to that specific file with a pointer to this bug?


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
                   ` (3 preceding siblings ...)
  2011-12-14 21:23 ` matt at use dot net
@ 2012-12-17 19:12 ` matt at use dot net
  2012-12-18 17:27 ` matt at use dot net
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: matt at use dot net @ 2012-12-17 19:12 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Matt Hargett <matt at use dot net> 2012-12-17 19:12:11 UTC ---
Just verified this still happens in 4.7 and trunk.


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
                   ` (4 preceding siblings ...)
  2012-12-17 19:12 ` matt at use dot net
@ 2012-12-18 17:27 ` matt at use dot net
  2013-01-07 22:15 ` matt at use dot net
  2013-01-08  9:45 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: matt at use dot net @ 2012-12-18 17:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Matt Hargett <matt at use dot net> 2012-12-18 17:26:54 UTC ---
Applying the supplied patch reveals another issue underneath, which is a false
positive:

/work/mhargett/gcc-trunk-obj/./prev-gcc/xg++
-B/work/mhargett/gcc-trunk-obj/./prev-gcc/
-B/u/mhargett/x86_64-unknown-linux-gnu/bin/ -nostdinc++
-B/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
-I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu
-I/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include
-I/work/mhargett/gcc-trunk/libstdc++-v3/libsupc++
-L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/work/mhargett/gcc-trunk-obj/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
  -g -O2 -O3 -march=nocona -mtune=core2 -floop-block -floop-interchange
-floop-strip-mine -flto=jobserver -frandom-seed=1 -DIN_GCC   -fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common 
-DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o gengtype \
        gengtype.o gengtype-lex.o gengtype-parse.o gengtype-state.o version.o
errors.o libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a libcommon.a
../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a 
In file included from ../../gcc-trunk/libiberty/cp-demangle.c:876:0,
                 from :51:
../../gcc-trunk/libbacktrace/elf.c: In function ‘elf_add’:
../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: ‘ehdr_view.len’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
   if (munmap (const_cast.v, view->len) < 0)
              ^
In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0,
                 from :51:
../../gcc-trunk/libbacktrace/elf.c:476:25: note: ‘ehdr_view.len’ was declared
here
   struct backtrace_view ehdr_view;
                         ^
In file included from ../../gcc-trunk/libiberty/cp-demangle.c:876:0,
                 from :51:
../../gcc-trunk/libbacktrace/mmapio.c:98:14: error: ‘ehdr_view.base’ may be
used uninitialized in this function [-Werror=maybe-uninitialized]
   if (munmap (const_cast.v, view->len) < 0)
              ^
In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0,
                 from :51:
../../gcc-trunk/libbacktrace/elf.c:476:25: note: ‘ehdr_view.base’ was declared
here
   struct backtrace_view ehdr_view;
                         ^
In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0,
                 from :51:
../../gcc-trunk/libbacktrace/elf.c:516:10: error: ‘ehdr_view.data’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
   memcpy (&ehdr, ehdr_view.data, sizeof ehdr);
          ^
In file included from ../../gcc-trunk/libiberty/cp-demangle.c:879:0,
                 from :51:
../../gcc-trunk/libbacktrace/elf.c:476:25: note: ‘ehdr_view.data’ was declared
here
   struct backtrace_view ehdr_view;
                         ^
lto1: all warnings being treated as errors
make[4]: *** [/tmp/ccQGEpYR.ltrans15.ltrans.o] Error 1


in libbacktrace/elf.c, elf_add() calls backtrace_get_view(..., &ehdr_view).
ehdr_view isn't initialized. backtrace_get_view() will return 1 and leave
edhr_view uninitialized, but the potential uninitialized use of ehdr_view is
guarded in get_elf() with a 'goto fail'. Therefore, the uninitialized ehdr_view
would never get to backtrace_release_view().

Let me know if I should file a separate bug for this.


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
                   ` (5 preceding siblings ...)
  2012-12-18 17:27 ` matt at use dot net
@ 2013-01-07 22:15 ` matt at use dot net
  2013-01-08  9:45 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: matt at use dot net @ 2013-01-07 22:15 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Matt Hargett <matt at use dot net> 2013-01-07 22:14:21 UTC ---
This appears to be resolved for me, as of r194995. If someone with permissions
can mark as RESOLVED, I'll VERIFY.


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

* [Bug bootstrap/50148] GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors
  2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
                   ` (6 preceding siblings ...)
  2013-01-07 22:15 ` matt at use dot net
@ 2013-01-08  9:45 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-08  9:45 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-08 09:45:22 UTC ---
Fixed thus.  (Note that on release branches we do not enable -Werror by default
so it's a non-issue there and also in general IMHO, for the false positives
at least)


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

end of thread, other threads:[~2013-01-08  9:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-21 21:12 [Bug bootstrap/50148] New: GCC fails to bootstrap with -O3 due to "may be used uninitialized" errors d.g.gorbachev at gmail dot com
2011-08-21 21:15 ` [Bug bootstrap/50148] " d.g.gorbachev at gmail dot com
2011-08-24 21:23 ` pinskia at gcc dot gnu.org
2011-08-24 22:10 ` pinskia at gcc dot gnu.org
2011-12-14 21:23 ` matt at use dot net
2012-12-17 19:12 ` matt at use dot net
2012-12-18 17:27 ` matt at use dot net
2013-01-07 22:15 ` matt at use dot net
2013-01-08  9:45 ` rguenth at gcc dot gnu.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).