Bug 138943 - gcc internal error
gcc internal error
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
3
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-11 20:07 EST by Dr Thomas Conway
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-11-12 05:36:04 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)
preprocessor output for the bug (345.48 KB, text/plain)
2004-11-11 20:08 EST, Dr Thomas Conway
no flags Details

  None (edit)
Description Dr Thomas Conway 2004-11-11 20:07:35 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020
Firefox/0.10.1

Description of problem:
The following program causes gcc to abort.
It seems to be related to the stl includes.
Changing the line:
    #include <algorithm>
to
    #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
{
public:
    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>
{
public:
    static void doit(T* p_b, T* p_e)
    {
        swap(*p_e, *p_b);
    }
};


int
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):
gcc-3.4.2-6.fc3

How reproducible:
Always

Steps to Reproduce:
see above.

Additional info:
Comment 1 Dr Thomas Conway 2004-11-11 20:08:49 EST
Created attachment 106544 [details]
preprocessor output for the bug
Comment 2 Dr Thomas Conway 2004-11-11 21:47:11 EST
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. ;-)

Tom
Comment 3 Jakub Jelinek 2004-11-12 05:36:04 EST
http://gcc.gnu.org/PR18436

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