public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60165] New: "may be used uninitialized" warning with -O3 but not with -O2
@ 2014-02-13  3:17 vincent-gcc at vinc17 dot net
  2014-02-13  8:40 ` [Bug tree-optimization/60165] " vincent-gcc at vinc17 dot net
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2014-02-13  3:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60165
           Summary: "may be used uninitialized" warning with -O3 but not
                    with -O2
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net

With:

gcc (Debian 20140111-1) 4.9.0 20140111 (experimental) [trunk revision 206552]

I get the following inconsistency in the warnings:

ypig% cat out.i
int a, b;
int fn2 (int, int);
int fn1 (int *p1)
{
    if (fn2 (a, 0))
        *p1 = b;
    int c;
    fn1 (&c);
    return c;
}
ypig% gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O2 out.i
ypig% gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O3 out.i
out.i: In function 'fn1':
out.i:9:5: error: 'c' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
     return c;
     ^
cc1: some warnings being treated as errors
ypig% 

I don't know whether this is regarded as normal, but this looks strange.

Note: I got this problem when compiling round_prec.c from the GNU MPFR trunk. I
generated the preprocessed file with -E, then used creduce on the following
script:

#!/bin/sh
{
  gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O2 out.i && \
  ! gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O3 out.i
} >/dev/null 2>&1

to generate the simple testcase (and fixed the declarations to avoid additional
warnings -- I think I should have used -Werror in the script to avoid them in
the first place).


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

end of thread, other threads:[~2014-02-13 13:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13  3:17 [Bug tree-optimization/60165] New: "may be used uninitialized" warning with -O3 but not with -O2 vincent-gcc at vinc17 dot net
2014-02-13  8:40 ` [Bug tree-optimization/60165] " vincent-gcc at vinc17 dot net
2014-02-13  9:21 ` rguenth at gcc dot gnu.org
2014-02-13 10:09 ` vincent-gcc at vinc17 dot net
2014-02-13 10:17 ` jakub at gcc dot gnu.org
2014-02-13 10:29 ` vincent-gcc at vinc17 dot net
2014-02-13 12:14 ` vincent-gcc at vinc17 dot net
2014-02-13 12:57 ` glisse at gcc dot gnu.org
2014-02-13 13:33 ` vincent-gcc at vinc17 dot net
2014-02-13 13:48 ` vincent-gcc at vinc17 dot net

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