This service will be undergoing maintenance at 20:00 UTC, 2017-04-03. It is expected to last about 30 minutes
Bug 178061 - g++ segfaults on typename
g++ segfaults on typename
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-17 12:21 EST by Ethan Tira-Thompson
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 3.4.5-2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-01-17 16:41:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
preprocessed source for the bug (255.55 KB, application/octet-stream)
2006-01-17 13:42 EST, Ethan Tira-Thompson
no flags Details

  None (edit)
Description Ethan Tira-Thompson 2006-01-17 12:21:51 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.12 (KHTML, like Gecko) Safari/416.13

Description of problem:
here is the code which causes the crash:
====================
#include <vector>

template<class PredType>
void foo() {
  bar(typename std::back_insert_iterator<std::vector<int> >(baz));
}
====================
Removing the 'typename' avoids the segfault

Version-Release number of selected component (if applicable):
gcc 3.4.2

How reproducible:
Always

Steps to Reproduce:
1.
2.
3.
  

Additional info:
Comment 1 Ethan Tira-Thompson 2006-01-17 13:42:12 EST
Created attachment 123317 [details]
preprocessed source for the bug
Comment 2 Ethan Tira-Thompson 2006-01-17 13:45:42 EST
Please note that removing the 'typename' keyword simply avoids the crash -- I
realize that the code shown will then result in a compilation error.  The key is
that it should give the error and not segfault.

If that is resolved, I expect it would successfully compile if the full code
were being compiled instead of this minimal snippet.
Comment 3 Jakub Jelinek 2006-01-17 16:41:52 EST
g++ -v; g++ 178061.ii
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.5/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)
foo.cc: In function `void foo()':
foo.cc:5: error: `baz' was not declared in this scope
foo.cc:5: error: there are no arguments to `bar' that depend on a template
parameter, so a declaration of `bar' must be available
foo.cc:5: error: (if you use `-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)

I don't have FC3 gcc around to check it (FC3 support has been moved to Fedora
Legacy already), but as you can see with the latest GCC 3.4.x-RH this is not
reproducible, neither I can reproduce it with GCC 4.0.x (FC4) nor GCC 4.1.x
(rawhide).  But even latest FC3 gcc is gcc-3.4.4-2.fc3, so it is quite likely
it is fixed there too.

Note You need to log in before you can comment on or make changes to this bug.