public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55870] New: Compiler crash when template includes sizeof of something that shouldn't be dereferenced
@ 2013-01-03 22:39 dspeyer at gmail dot com
  2013-01-04 13:19 ` [Bug c++/55870] " paolo.carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: dspeyer at gmail dot com @ 2013-01-03 22:39 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55870
           Summary: Compiler crash when template includes sizeof of
                    something that shouldn't be dereferenced
    Classification: Unclassified
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dspeyer@gmail.com


Created attachment 29079
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29079
Preprocessed Source Code

The compiler said "internal compiler error: Segmentation fault. Please submit a
full bug report" so I am.  I realize there are few safe things to do with a
dereferenced null pointer, but usually sizeof is one of them.

Source code is attached.  I think the critical line is:

template<typename b> static void*
val(silliness<sizeof(static_cast<b*>(NULL)->s1)>*)

which was supposed to specialize if and only if b::s1 existed.  As you may have
guessed, this was an attempt to figure out why saner sfinae mechanisms weren't
working.

Here's the compiler output:

g++ -v --save-temps -o sfinae sfinae.cc
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-targets=all --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'sfinae' '-shared-libgcc'
'-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.3/cc1plus -E -quiet -v -D_GNU_SOURCE sfinae.cc
-D_FORTIFY_SOURCE=2 -mtune=generic -fpch-preprocess -o sfinae.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../i486-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.3
 /usr/include/c++/4.3/i486-linux-gnu
 /usr/include/c++/4.3/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.3.3/include
 /usr/lib/gcc/i486-linux-gnu/4.3.3/include-fixed
 /usr/include/i486-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'sfinae' '-shared-libgcc'
'-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.3/cc1plus -fpreprocessed sfinae.ii -quiet
-dumpbase sfinae.cc -mtune=generic -auxbase sfinae -version -fstack-protector
-o sfinae.s
GNU C++ (Ubuntu 4.3.3-5ubuntu4) version 4.3.3 (i486-linux-gnu)
    compiled by GNU C version 4.3.3, GMP version 4.2.4, MPFR version 2.4.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e2b5a0303075a65d33d75f9466062812
sfinae.cc:28: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.


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

* [Bug c++/55870] Compiler crash when template includes sizeof of something that shouldn't be dereferenced
  2013-01-03 22:39 [Bug c++/55870] New: Compiler crash when template includes sizeof of something that shouldn't be dereferenced dspeyer at gmail dot com
@ 2013-01-04 13:19 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-04 13:19 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-04 13:19:18 UTC ---
4.3.x is very old and not maintained anymore; the issue cannot be reproduced in
the active branches.


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

end of thread, other threads:[~2013-01-04 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 22:39 [Bug c++/55870] New: Compiler crash when template includes sizeof of something that shouldn't be dereferenced dspeyer at gmail dot com
2013-01-04 13:19 ` [Bug c++/55870] " paolo.carlini at oracle dot com

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