Red Hat Bugzilla – Bug 205919
ICE related to std::vector<std::vector<...> > >
Last modified: 2007-11-30 17:07:27 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; zh-cn) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3
Description of problem:
This bug seems to relate to accessing elements of a std::vector<std::vector<some_type> > > object using
double subscripting [...][...]. However, when I tried with a simplified code, the falure didn't reproduce, so I
guess vector of vector is just part of the reason of this bug.
Version-Release number of selected component (if applicable):
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
Steps to Reproduce:
1. Just compile the proprocessed code.
internal compiler error: Segmentation fault
where accessing element of std::vector<std::vector<some_type> > > using [...][...] failed.
I found a simple work-around, i.e. to separate the [...][..] into two steps. For example, let V be of the type
std::vector<std::vector<some_type> > >, instead of writing V[i][j], writing
const std::vector<some_type>& w = V[i];
solved the problem.
Created attachment 135915 [details]
This is the preprocessed output.
Created attachment 139437 [details]
Created attachment 139441 [details]
Patch that fixes the bug
This backport fixes the ICE in both the reduced and the original testcases. I
had to cherry-pick only a few portions of the original patch, and the most
important change (the removal of the obsolete new-type-id) isn't appropriate
for GCC 3.4 because it wasn't obsolete then. I've tried to overcome the
problem with a simplification that I hope will work, but my testing isn't
complete yet and I'm not entirely familiar with the workings of this old
new-type-id construct. I'd appreciate a second pair of g++-familiar eyeballs
on this change.
Created attachment 139556 [details]
Safer patch that fixes the bug
This patch is much safer and fixes the problem just the same.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.