gcc-4.2-20061212 building error using unsafe *FLAGS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

First, I do know that building with *FLAGS other than the default is
not recommended, that's why I don't send this message to
gcc at gcc gnu org. I try to fix the problem at the end of the message
so please read it up to the end.

I wonder what can be the reason of the fail. Is the problem only in me
or also in gcc?

When building the gcc-4.2-20061212 snapshot I got the following error:

/home/gcc/build/./prev-gcc/xgcc -B/home/gcc/build/./prev-gcc/ -B/home/gcc/i686-pc-linux-gnu/bin/ -c   -s -pipe -Os -march=athlon-xp -fomit-frame-pointer -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -Werror    -DHAVE_CONFIG_H -I. -I. -I../../src/gcc-4.2-20061212/gcc -I../../src/gcc-4.2-20061212/gcc/. -I../../src/gcc-4.2-20061212/gcc/../include -I../../src/gcc-4.2-20061212/gcc/../libcpp/include  -I../../src/gcc-4.2-20061212/gcc/../libdecnumber -I../libdecnumber    ../../src/gcc-4.2-20061212/gcc/tree-if-conv.c -o tree-if-conv.o
cc1: warnings being treated as errors
../../src/gcc-4.2-20061212/gcc/tree-if-conv.c: In function 'main_tree_if_conversion':
../../src/gcc-4.2-20061212/gcc/tree-if-conv.c:832: warning: 'cond' may be used uninitialized in this function
../../src/gcc-4.2-20061212/gcc/tree-if-conv.c:832: note: 'cond' was declared here
make[3]: *** [tree-if-conv.o] Error 1
make[3]: Leaving directory `/home/gcc/build/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/gcc/build'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/gcc/build'
make: *** [all] Error 2

Build commands were as follows

../src/gcc-4.2-20061212/configure --prefix=/home/gcc \
	--disable-multilib --enable-shared --enable-threads=posix \
	--enable-version-specific-runtime-libs --enable-languages=c \
	--disable-checking --disable-nls

export C="-s -pipe -Os -march=athlon-xp -fomit-frame-pointer"

make CFLAGS="$C" LIBCFLAGS="$C" LIBCXXFLAGS="$C" BOOT_CFLAGS="$C" \
	LDFLAGS="-s" XCFLAGS="$C" TCFLAGS="$C"

In gcc/tree-if-conv.c I found the following code

[CODE]
tree phi, cond;
// Some code both not using and not changing "cond" here
if (phi)
  true_bb = find_phi_replacement_condition (loop, bb, &cond, &bsi);

while (phi)
  {
    tree next = PHI_CHAIN (phi);
    replace_phi_with_cond_modify_expr (phi, cond, true_bb, &bsi);
    release_phi_node (phi);
    phi = next;
  }
// "cond" isn't used in the rest of the function
[/CODE]

At the beginning of the loop cond can be uninitialized. Though, I guess
if "if (phi)" is wrong then "while (phi)" is wrong as well, so if
"cond" is uninitialized then it isn't also used in the function.
Nevertheless, the compiler don't think so (is it wrong). It gives a
warning that (due to -Werror) breaks the build.

The warning can be removed in three ways.

1. Remove -Werror from the command line. (BTW, how and why did it
   appear there?).

2. Initialize cond in the declaration. For example, using the following
   declaration instead of the existing one.

tree phi, cond = 0;

3. Move the loop into the code block controlled by the "if". Something
   like

if (phi)
  {
    true_bb = find_phi_replacement_condition (loop, bb, &cond, &bsi);

    while (phi)
      {
        tree next = PHI_CHAIN (phi);
        replace_phi_with_cond_modify_expr (phi, cond, true_bb, &bsi);
        release_phi_node (phi);
        phi = next;
      }
  }

  In this case the loop can probably be replaced with do-while
  construction.

However, I'm not a gcc developer or about so the suggested code can be
wrong since I don't know what it is to do. The only thing I did is
removing the warning. Moreover, having fixed this warning I got the
similar ones in some other files.

So, the general question is whether the error is in the compiler, or
everything is as it should be and the error appears just because I
amn't allowed to use such *FLAGS.

-- 
Nothing but perfection
pv

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux