[Consult] g++: About "-Wunused-variable" for constant variable initialized by function
Hello All: I found an issue about g++, it is OK for "-Wall -O0", but will report -Wunused-variable for "-Wall -O1|2|3|s". The original version (e.g. gcc 4.8.3 redhat version) does not report warning for "-Wall -O?". The related operation: [root@localhost qemu_cc]# cat test.cc const char n() { return 1; } const char c = n(); [root@localhost qemu_cc]# /usr/local/bin/g++ -Wall -O0 -c -o test.o test.cc [root@localhost qemu_cc]# /usr/local/bin/g++ -Wall -O2 -c -o test.o test.cc test.cc:2:12: warning: 'c' defined but not used [-Wunused-variable] const char c = n(); ^ The g++ information: [root@localhost qemu_cc]# /usr/local/bin/g++ -v Using built-in specs. COLLECT_GCC=/usr/local/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --disable-multilibs --disable-nls Thread model: posix gcc version 5.0.0 20141003 (experimental) (GCC) If we are sure it is a bug, I shall try to analyze it within this month. Thanks -- Chen Gang Open, share, and attitude like air, water, and life which God blessed
Re: RTL infrastructure leaks VALUE expressions into aliasing-detecting functions
On Fri, Oct 10, 2014 at 8:37 PM, Uros Bizjak wrote: >> Right. And my question is what happens if we aren't as aggressive here. >> What happens if before this check we return nonzero if X or Y is a VALUE? >> Do we then get into memrefs_conflict_p and does it do the right thing? > > Following patch just after AND detection in base_alias_check fixes the > testcase from PR: > > --cut here-- > Index: alias.c > === > --- alias.c (revision 216100) > +++ alias.c (working copy) > @@ -1842,6 +1842,8 @@ base_alias_check (rtx x, rtx x_base, rtx y, rtx y_ > || (int) GET_MODE_UNIT_SIZE (x_mode) < -INTVAL (XEXP (y, 1 > return 1; > > + return 1; > + >/* Differing symbols not accessed via AND never alias. */ >if (GET_CODE (x_base) != ADDRESS && GET_CODE (y_base) != ADDRESS) > return 0; > --cut here-- > > I have started a bootstrap on alpha native with this patch (it will > take a day or so) and will report back findings Yes, this "patch" solves the original gfortran problem. It looks to me that the code that handles AND addresses in base_alias_check is not prepared to handle VALUES correctly. Uros.
gcc-5-20141012 is now available
Snapshot gcc-5-20141012 is now available on ftp://gcc.gnu.org/pub/gcc/snapshots/5-20141012/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 5 SVN branch with the following options: svn://gcc.gnu.org/svn/gcc/trunk revision 216127 You'll find: gcc-5-20141012.tar.bz2 Complete GCC MD5=95691e1088e4143efd311be53a612e93 SHA1=5d654b8fa4cc56c0baca42b3fc405d0965f4d4e3 Diffs from 5-20141005 are available in the diffs/ subdirectory. When a particular snapshot is ready for public consumption the LATEST-5 link is updated and a message is sent to the gcc list. Please do not use a snapshot before it has been announced that way.