This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/42032] Aliasing errors in stl_tree.h



------- Comment #3 from evan at chromium dot org  2009-11-13 19:49 -------
I brought this up on the Google-internal C list.  They reduced it further:

$ cat main.cc
#include <map>

int main(void)
{
   typedef std::map<int, char*> MyMap2;
   MyMap2 map2_;
   MyMap2::iterator map_iter2 = map2_.find(5);
   return *map_iter2->second;
}
$ g++ -O3 -Wall -c main.cc
main.cc: In function 'int main()':
main.cc:8: warning: dereferencing pointer '<anonymous>' does break
strict-aliasing rules
/opt/local/include/gcc44/c++/bits/stl_tree.h:179: note: initialized from here

$ g++ -v
Using built-in specs.
Target: i386-apple-darwin9
Configured with: ../gcc-4.4.1/configure --prefix=/opt/local
--build=i386-apple-darwin9
--enable-languages=c,c++,objc,obj-c++,java,fortran
--libdir=/opt/local/lib/gcc44 --includedir=/opt/local/include/gcc44
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--with-local-prefix=/opt/local --with-system-zlib --disable-nls
--program-suffix=-mp-4.4
--with-gxx-include-dir=/opt/local/include/gcc44/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local
Thread model: posix
gcc version 4.4.1 (GCC)


-- 

evan at chromium dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |evan at chromium dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]