[PR44627] templates with class and pointer error cause bailing out and crash
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc |
Fix Released
|
Medium
|
|||
gcc-4.4 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Binary package hint: gcc-4.4
With this file as the only input:
==============
class A
{
A * get_a_pointer();
};
template <class T>
void function()
{
A::
}
==============
The g++ crashes with this output:
==============
‘
crashy_test.cpp:9: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccWR7fhP.out file, please attach this to your bugreport.
==============
A box pops up with the message "Sorry, the program cc1plus closed unexpectedly". Here is the preprocessed source it saved:
==============
// /usr/lib/
# 1 "crashy_test.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "crashy_test.cpp"
class A
{
A * get_a_pointer();
};
template <class T>
void function()
{
A::
}
==============
Other info:
It doesn't seem to matter that 'anything' doesn't exist. Replacing it with a member (variable or function) that does exist doesn't make a difference.
You get a similar error even if you remove the last '}'.
This bug should be low priority, since it only occurs if your code has two errors g++ should be reporting (in the second to last line):
-You cannot call A::get_a_pointer() without an object, and
-You cannot request members from the non-class type A*.
I don't mind it reporting one of these errors, then bailing out without crashing.
The problem goes away if you make A::get_a_pointer static, or if you replace the . with ->. It also goes away if you make function not a template function. It can be reproduced if you make function a member function of a templated class instead.
$ g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8)
$ apt-cache policy gcc-4.4
gcc-4.4:
Installed: 4.4.1-4ubuntu8
Candidate: 4.4.1-4ubuntu8
Version table:
*** 4.4.1-4ubuntu8 0
500 http://
100 /var/lib/
$ uname -a
Linux ubuntu 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8 04:02:15 UTC 2009 x86_64 GNU/Linux
$ lsb_release -rd
Description: Ubuntu 9.10
Release: 9.10
summary: |
- templates with class and pointer error cause bailing out and crash + [PR44627] templates with class and pointer error cause bailing out and + crash |
Changed in gcc-4.4 (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in gcc: | |
status: | Unknown → In Progress |
Changed in gcc: | |
status: | In Progress → Fix Released |
Changed in gcc: | |
importance: | Unknown → Medium |
This bug was fixed in the package gcc-4.4 - 4.4.4-6ubuntu1
---------------
gcc-4.4 (4.4.4-6ubuntu1) maverick; urgency=low
* Merge with Debian.
gcc-4.4 (4.4.4-6) unstable; urgency=low
* Update to SVN 20100622 from the gcc-4_4-branch (r161235). on/44508, PR target/44261, PR target/43740,
- Fix PR bootstrap/44544, PR fortran/44536, PR target/44534,
PR tree-optimizati
PR bootstrap/44426. PR c++/44627 (LP: #503668), PR target/39690.
[ Matthias Klose ] libgcc- cross.mk
* Add M68K TLS support, backport from the 4.5 branch. Closes: #586060.
* Merge binary-libgcc.mk packaging changes into binary-
(Loic Minier).
* Fix Fortran cross-compiler build when not building the runtime library.
* Apply proposed fix for PR target/44626 (backport from the 4.5 branch).
LP: #564492.
* Add maintainer scripts for cross packages.
[ Marcin Juszkiewicz ] binary- *-cross. mk files into rules.d/ binary- *.mk.
* Merge the rules.d/
* ARM: speed up division on Thumb-2 (backport from the trunk). LP: #589779.
gcc-4.4 (4.4.4-5) unstable; urgency=low
[ Matthias Klose ]
* Update to SVN 20100612 from the gcc-4_4-branch (r160657). patches/ libstdc+ +-pic.diff: Fix installation for cross builds. +/vmi_class_ type_info. cc from the 4.5 branch. +-*-ldbl- compat. diff patches.
- Fix PR target/44169, PR target/44481, PR target/44075, PR other/43838,
PR libstdc++/32499, PR libgcj/44216.
* debian/
* Update libsupc+
Closes: #584308.
* Export long double versions of "C" math library for arm-linux-gnueabi,
m68k-linux-gnu (ColdFire), mips*-linux-gnu (o32 ABI), sh*-linux-gnu
(not 32 bit). Merge the libstdc+
* Remove the backport for the plugin support.
[ Aurelien Jarno ] +-mips- ldbl-compat. diff: On MIPS provide the long double
* libstdc+
versions of "C" math functions in libstdc++ as we need to keep the
ABI. Closes: #584610.
-- Matthias Klose <email address hidden> Fri, 25 Jun 2010 15:04:36 +0200