[PR26155] g++ crashes when trying to compile c++ header with namespace error

Bug #321883 reported by Pauli
2
Affects Status Importance Assigned to Milestone
gcc
Fix Released
Medium
gcc-4.3 (Ubuntu)
Won't Fix
Low
Unassigned
gcc-4.7 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: gcc-4.3

I tried to compile accidetaly file where I did something evil with namespaces

Basic idea is this header file:

#include <boost/filesystem/path.hpp>

using namespace fs = boost::filesystem;

namespace fs {
// declare some extensions to boost filesystem
}

ProblemType: Crash
Architecture: i386
DistroRelease: Ubuntu 8.10
ExecutablePath: /usr/lib/gcc/i486-linux-gnu/4.3.2/cc1plus
Package: g++-4.3 4.3.2-1ubuntu11
SourcePackage: gcc-4.3
Uname: Linux 2.6.27-9-generic i686

Tags: apport-crash

Related branches

Revision history for this message
In , Pinskia (pinskia) wrote :

I thought this was filed before but I cannot find it.
Testcase:
namespace std
{
  namespace __gnu_debug {
namespace debug = std::__gnu_debug;
namespace debug
{
-----
Error we get:
t.ii:6: error: namespace alias ‘std::__gnu_debug::debug’ not allowed here, assuming ‘std::__gnu_debug’
t.ii:6: internal compiler error: in resume_scope, at cp/name-lookup.c:1372
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Revision history for this message
In , Bkoz (bkoz) wrote :

Created attachment 10805
patch

Revision history for this message
In , Pinskia (pinskia) wrote :

Comment on attachment 10805
patch

This patch was submitted to the wrong bug.

Revision history for this message
In , Reichelt (reichelt) wrote :

Confirmed.

Even simpler testcase:

=======================
namespace N
{
  namespace M = N;
  namespace M {}
}
=======================

Revision history for this message
Pauli (paniemin) wrote :
Revision history for this message
In , Matthias Klose (doko) wrote :

confirmed with 4.3.4 and 4.4.0

summary: - g++ crashes when trying to compile c++ header with namespace error
+ [PR26155] g++ crashes when trying to compile c++ header with namespace
+ error
Changed in gcc-4.3 (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Changed in gcc:
status: Unknown → Confirmed
Revision history for this message
In , Debian GCC maintainers (debian-gcc) wrote :

confirmed with trunk 20091228

Revision history for this message
In , Paolo-carlini (paolo-carlini) wrote :

On it.

Changed in gcc:
importance: Unknown → Medium
status: Confirmed → In Progress
Revision history for this message
In , Paolo-k (paolo-k) wrote :

Author: paolo
Date: Fri Jun 1 16:11:38 2012
New Revision: 188113

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188113
Log:
/cp
2012-06-01 Paolo Carlini <email address hidden>

 PR c++/26155
 * name-lookup.c (push_namespace): When error recovery is
 impossible just error out in duplicate_decls.

/testsuite
2012-06-01 Paolo Carlini <email address hidden>

 PR c++/26155
 * g++.dg/parse/namespace-alias-1.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/parse/namespace-alias-1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/testsuite/ChangeLog

Revision history for this message
In , Paolo-carlini (paolo-carlini) wrote :

Fixed.

Changed in gcc:
status: In Progress → Fix Released
Matthias Klose (doko)
Changed in gcc-4.7 (Ubuntu):
status: New → Fix Committed
Changed in gcc-4.3 (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.7 - 4.7.0-13ubuntu1

---------------
gcc-4.7 (4.7.0-13ubuntu1) quantal; urgency=low

  * Regenerate the control file.

gcc-4.7 (4.7.0-13) unstable; urgency=low

  * Update to SVN 20120612 (r188457) from the gcc-4_7-branch.
    - Fix PR c++/53602 (LP: #1007616).

  * Document the changed ssp-buffer-size default in Ubuntu 10.10 and
    later (Kees Cook). LP: #990141.
  * Fix PR c++/26155, ICE after error with namespace alias. LP: #321883.
  * Fix PR c++/53599 (reverting the fix for PR c++/53137).
    Closes: #676729. LP: #1010896.
  * Fix manual page names for cross builds (Thibaut Girka). Closes: #675516.
  * Remove dpkg-cross build dependency for cross builds (Thibaut Girka).
    Closes: #675511.
 -- Matthias Klose <email address hidden> Tue, 12 Jun 2012 17:54:25 +0200

Changed in gcc-4.7 (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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