public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/51806] New: -flto ignores -Werror
@ 2012-01-10  1:28 DeusExSophismata at gmail dot com
  2012-01-10 10:04 ` [Bug lto/51806] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: DeusExSophismata at gmail dot com @ 2012-01-10  1:28 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51806
           Summary: -flto ignores -Werror
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: DeusExSophismata@gmail.com


If a program triggers a warning that is only discovered during link time
optimization (such as a potential use of an uninitialized variable that crosses
compilation unit boundaries), the flag -Werror is ignored.

[david@david-desktop gcc error]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/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
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--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-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) 


==============================================
main.cpp
==============================================
void f1 (int & x);

int main () {
    int x;
    f1 (x);
    return 0;
}
==============================================
werror.cpp
==============================================
void f1 (int & x) {
    volatile int y = x;
}
==============================================

[david@david-desktop gcc error]$ g++ main.cpp werror.cpp -Wuninitialized
-Werror -O1 -flto
In file included from :0:0:
main.cpp: In function ‘main’:
werror.cpp:2:19: warning: ‘x’ is used uninitialized in this function
[-Wuninitialized]
main.cpp:4:6: note: ‘x’ was declared here


Compilation is seen as successful and a.out exists.

The expected behavior is that the warning would be converted to an error by
-Werror and stop the linking / compiling final stage. The effect of this is
that automated build tools believe that the compiling was a success (and the
warning may be buried deep in the middle of the output when compiling multiple
programs), so the user may not know that there was a problem found despite
having -Werror selected.


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

end of thread, other threads:[~2012-01-10 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-10  1:28 [Bug lto/51806] New: -flto ignores -Werror DeusExSophismata at gmail dot com
2012-01-10 10:04 ` [Bug lto/51806] " rguenth at gcc dot gnu.org
2012-01-10 16:29 ` rguenth at gcc dot gnu.org
2012-01-10 16:32 ` 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).