Bug 105784 - Compiling kde/qt from CVS hangs on QValueList
Summary: Compiling kde/qt from CVS hangs on QValueList
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: i686
OS: Linux
medium
high
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-09-27 14:31 UTC by Koos
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-10-02 09:48:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Koos 2003-09-27 14:31:30 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.1; Linux)

Description of problem:
Hi, I tried compiling CVS HEAD for kde, but Qt (from qt-copy) already fails running designer. I made a small test case of an hang I found:
#include <iostream>
#include <qvaluelist.h>

struct Data { int x; };

int main(int argc, char**) {
    QValueList<Data> mylist;
    Data data;
    QValueList<Data>::iterator it = mylist.append(data);
    (*it).x = (argc > 1 ? argc : 0);
    std::cout << (*it).x << std::endl;
}

g++ -O2 myvaluelist.cpp -o myvaluelist -I$QTDIR/include -L$QTDIR/lib -lqt-mt
This little program works w/o arguments, but hangs w/ an arg.
W/o -O2, it works.
(installation is severn from 25 sept, gcc-3.3.1-5)

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


How reproducible:
Always

Steps to Reproduce:
1. compile and run the above
2.
3.
    

Additional info:

Comment 1 Paul Nasrat 2003-09-27 14:36:47 UTC
I replicated this on Fedora Core beta 2 by just compiling the above sample.

gdb seemed to indicate it was hanging at line 110 of qvaluelist.h:

    T& operator*() { return node->data; }


Comment 2 Than Ngo 2003-09-29 13:48:23 UTC
Hmm, it's beta software, which Red Hat doses not support. Please report this bug
to trolltech or kde developers. Please tell them which gcc version you use. Thanks

Comment 3 Koos 2003-09-29 13:57:42 UTC
Imo it's a gcc optimization bug.  
  (*it).x = (argc > 1 ? argc : 0) 
It hang if it assigns the if part (argc) and not if it assign the else part (0). How can that be Qt 
fault? 
Btw, Paul Nasrat suggest it's reproducable with the severn's include Qt. 
 

Comment 4 Koos 2003-09-29 17:41:58 UTC
Ok, made another testcase without qt this time, maybe that helps.. 
 
#include <iostream> 
 
struct Data { int x; }; 
template <class T> 
struct Wrapper { 
    Wrapper(Data & d) : data (d) {} 
    Data & operator * () { return data; } 
    Data & data; 
}; 
int main(int argc, char**) { 
    Data data; 
    Wrapper<Data> mywrapper(data); 
    (*mywrapper).x = (argc > 1 ? argc : 0); 
    std::cout << (*mywrapper).x << std::endl; 
} 
 
Compile as 'g++ myvaluelist.cpp -o myvaluelist  -O2' and it hangs if run with an 
argument. 
I've compiled it also with gcc-3.3.1 on an old RH-7.1 system: 
$ gcc -v 
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs 
Configured with: ../gcc-3.3.1/configure --prefix=/usr --infodir=/usr/share/info 
--mandir=/usr/share/man --enable-shared --enable-threads --disable-nls : 
(reconfigured) ../gcc-3.3.1/configure --prefix=/usr --infodir=/usr/share/info --mandir=/
usr/share/man --enable-shared --enable-threads --disable-nls 
--enable-languages=c++,f77 
Thread model: posix 
gcc version 3.3.1 
 
And there isn't a hang. 

Comment 5 Koos 2003-09-29 21:31:48 UTC
Hmm, I got this hang reproduced so soon, that I forgot to reread the code :). 
Apprently it has nothing to do with templates but with operator *() returning a 
reference. 
 
#include <iostream> 
struct Data { int x; }; 
struct Wrapper { 
    Wrapper() {} 
    Data & operator * () { return data; } 
    Data data; 
}; 
int main(int argc, char**) { 
    Wrapper mywrapper; 
    (*mywrapper).x = (argc > 1 ? argc : 0); 
    std::cout << (*mywrapper).x << std::endl; 
} 

Comment 8 Than Ngo 2003-10-02 09:48:36 UTC
it's now fixed in gcc-3.3.1-6, which will be available in rawhide soon. Thanks
for your report.


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