tiny STL code sample segfaults cc1plus

Bug #1019725 reported by graspee on 2012-07-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
gcc-4.6 (Ubuntu)
gcc-4.7 (Ubuntu)

Bug Description

g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 (standard g++ package on 64 bit pangolin)


#include <deque>
int main(){
   std::deque<int[2]> y;
   y.push_back( {2,5} );

 g++ -std=c++0x bug.cpp
bug.cpp: In function ‘int main()’:
bug.cpp:4:23: internal compiler error: Segmentation fault

I'm sorry if this bug report doesn't follow your guidelines. Just delete it if you want. It seemed important though. I started reading through your bug submitting procedure but it was way too complicated and longwinded. So, take it or leave it.

Ubuntu 12.04 LTS

 Installed: 4:4.6.3-1ubuntu5
  Candidate: 4:4.6.3-1ubuntu5
  Version table:
 *** 4:4.6.3-1ubuntu5 0
        500 http://gb.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: g++ 4:4.6.3-1ubuntu5
ProcVersionSignature: Ubuntu 3.2.0-26.41-generic 3.2.19
Uname: Linux 3.2.0-26-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.0.1-0ubuntu8
Architecture: amd64
Date: Sun Jul 1 06:24:20 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
SourcePackage: gcc-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

graspee (graspee) wrote :
Dave Gilbert (ubuntu-treblig) wrote :

Hi Graspee,
  Hey that's a good bug - thank you for reporting it!

Triaged: Trivially repeatable

I confirm this happens also on the gcc-4.6 package in QQ - 4.6.3-8ubuntu1
4.7 doesn't seg, but it's not happy (possibly a separate bug report?)


affects: gcc-defaults (Ubuntu) → gcc-4.6 (Ubuntu)
Changed in gcc-4.6 (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Dave Gilbert (ubuntu-treblig) wrote :

I noticed gcc-4.7 was actually segging, but it's error that it had seg'd was much less obvious.

Changed in gcc-4.7 (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Dave Gilbert (ubuntu-treblig) wrote :

$ g++-4.7 -std=c++0x -fpermissive t.C
In file included from /usr/include/c++/4.7/x86_64-linux-gnu/bits/c++allocator.h:34:0,
                 from /usr/include/c++/4.7/bits/allocator.h:48,
                 from /usr/include/c++/4.7/deque:62,
                 from t.C:1:
/usr/include/c++/4.7/ext/new_allocator.h: In member function ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int [2]; _Args = {int [2]}; _Tp = int [2]]’:
/usr/include/c++/4.7/ext/new_allocator.h:109:9: error: non-trivial conversion at assignment
*D.12241 = *D.12830;

/usr/include/c++/4.7/ext/new_allocator.h:109: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccxiXwoh.out file, please attach this to your bugreport.

g++-4.7 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.1-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.1 (Ubuntu/Linaro 4.7.1-2ubuntu1)

Dave Gilbert (ubuntu-treblig) wrote :

hmm, I'm going to correct myself on comment #3 on 4.7 - it might not have seg'd - there is a crash file but I think that's just the preprocessessed source, not an indication of a seg.

So 4.6 seg
     4.7 the error and preprocessed source from #4

Matthias Klose (doko) wrote :

I can't see this anymore with 4.7 and trunk (gcc-snapshot)

Changed in gcc-4.7 (Ubuntu):
status: Triaged → Fix Released
In , Doko-v (doko-v) wrote :

this works with 4.7 and trunk, fails with 4.6

$ cat foo.cc
#include <deque>
int main(){
   std::deque<int[2]> y;
   y.push_back( {2,5} );

$ g++-4.6 -std=c++0x foo.cc
foo.cc: In function 'int main()':
foo.cc:4:23: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.

I bet we have a duplicate. Fixed in the active branches anyway.

Changed in gcc:
importance: Unknown → Medium
status: Unknown → Fix Released
Dave Gilbert (ubuntu-treblig) wrote :

   With 4.7 (4.7.1-7ubuntu1) I see an

/usr/include/c++/4.7/ext/new_allocator.h:110:4: error: parenthesized initializer in array new [-fpermissive]

but if I add the -fpermissive I get the trace as per my comment #4 - is that a separate report or a symptom of the same bug?


*** Bug 55553 has been marked as a duplicate of this bug. ***

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.