Bug 138943 - gcc internal error
Summary: gcc internal error
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
(Show other bugs)
Version: 3
Hardware: i686 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-11-12 01:07 UTC by Dr Thomas Conway
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-11-12 10:36:04 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
preprocessor output for the bug (345.48 KB, text/plain)
2004-11-12 01:08 UTC, Dr Thomas Conway
no flags Details

Description Dr Thomas Conway 2004-11-12 01:07:35 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020

Description of problem:
The following program causes gcc to abort.
It seems to be related to the stl includes.
Changing the line:
    #include <algorithm>
    #include <utility>
seems to make the problem go away.
The preprocessed output is bigish, attachment will follow....

$ gcc -c x.cc
x.cc: In static member function `static void MyClass<T>::doit(T*, T*)
[with T = std::pair<long int, long int>]':
x.cc:29:   instantiated from here
x.cc:20: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/cc87LOEd.out file, please attach
this to your bugreport.

#include <algorithm>

template <class T>
class MyBase
    static void swap(T& p_a, T& p_b)
        T t = p_a; p_a = p_b; p_b = t;

template <class T>
class MyClass : public MyBase<T>
    static void doit(T* p_b, T* p_e)
        swap(*p_e, *p_b);

main(int argc, const char** argv)
    std::pair<long,long> *a, *b;
    MyClass<std::pair<long,long> >::doit(a, b);

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

How reproducible:

Steps to Reproduce:
see above.

Additional info:

Comment 1 Dr Thomas Conway 2004-11-12 01:08:49 UTC
Created attachment 106544 [details]
preprocessor output for the bug

Comment 2 Dr Thomas Conway 2004-11-12 02:47:11 UTC
Discussing the code with a colleague we realized it's almost certainly
a bug in 2 stage name lookup: the code is "wrong" because the call to
swap inside doit should be explicitly qualified as MyBase<T>::swap.
Making this change makes the crash go away.

So, the code is buggy, and the compiler reports its error message
for the correct line. Now all we need is for it not to crash. ;-)


Comment 3 Jakub Jelinek 2004-11-12 10:36:04 UTC

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