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

2009-11-13 Thread evan at chromium dot org


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

int main(void)
{
   typedef std::map 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 '' 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



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

2011-09-25 Thread evan at chromium dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42032

--- Comment #11 from Evan Martin  2011-09-25 16:02:25 
UTC ---
I am on personal leave until 2012.

If you're within Google, you can read http://www/~evanm/leave.html for more.

Otherwise, for Chrome questions you can try asking t...@chromium.org,
and for questions for me personally you can try mart...@danga.com.


[Bug c++/45697] New: __restrict__ inconsistent in presence of typedefs

2010-09-16 Thread evan at chromium dot org
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

typedef unsigned char uint8_t;
void f(uint8_t __restrict__ foo[]) {
  // no warnings/errors
}
void f2(unsigned char __restrict__ foo[]) {
  // doesn't compile::
  // test.cc:6: error: ‘__restrict__’ qualifiers cannot be applied to ‘unsigned
char’
}

The two functions should be equivalent, I think -- both erroring or neither
erroring.  Verbose details follow.


$ gcc -v -save-temps test.cc
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mtune=generic' '-march=i486'
 /usr/lib/gcc/i486-linux-gnu/4.4.3/cc1plus -E -quiet -v -D_GNU_SOURCE test.cc
-D_FORTIFY_SOURCE=2 -mtune=generic -march=i486 -fpch-preprocess
-fstack-protector -o test.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.4
 /usr/include/c++/4.4/i486-linux-gnu
 /usr/include/c++/4.4/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.4.3/include
 /usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mtune=generic' '-march=i486'
 /usr/lib/gcc/i486-linux-gnu/4.4.3/cc1plus -fpreprocessed test.ii -quiet
-dumpbase test.cc -mtune=generic -march=i486 -auxbase test -version
-fstack-protector -o test.s
GNU C++ (Ubuntu 4.4.3-4ubuntu5) version 4.4.3 (i486-linux-gnu)
compiled by GNU C version 4.4.3, GMP version 4.3.2, MPFR version
2.4.2-p1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu 4.4.3-4ubuntu5) version 4.4.3 (i486-linux-gnu)
compiled by GNU C version 4.4.3, GMP version 4.3.2, MPFR version
2.4.2-p1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 35224f2c24023afb0a5be7befe8d5f3f
test.cc:6: error: ‘__restrict__’ qualifiers cannot be applied to ‘unsigned
char’


-- 
   Summary: __restrict__ inconsistent in presence of typedefs
   Product: gcc
   Version: 4.4.3
Status: UNCONFIRMED
      Severity: normal
      Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: evan at chromium dot org


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



[Bug c++/45697] __restrict__ inconsistent in presence of typedefs

2011-07-11 Thread evan at chromium dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45697

--- Comment #4 from Evan Martin  2011-07-11 22:38:49 
UTC ---
Sorry, I should have linked to the bug that prompted this bug report.
http://code.google.com/p/skia/issues/detail?id=63

Briefly, the Skia library (used by Google Chrome and Android) has usage of
restrict that Clang complains about.  In trying to reduce the problem to a test
case, I encountered the below inconsistency in gcc and thought I'd be a good
citizen to file a bug.  If the Skia code is just wrong by the spec, it's
probably not worth changing gcc.

The Skia usage of restrict presumably worked on some platform, or they wouldn't
have checked it in.  But perhaps it was ignored on those platforms anyway.  I
have asked on the Skia bug for more information.  It seems likely to me this
bug should be WONTFIXed.