c++/627: gcc does not work on compilng QT 2.2.1 on DEC Alpha

Eric.Depagne@obspm.fr Eric.Depagne@obspm.fr
Tue Oct 10 02:26:00 GMT 2000


>Number:         627
>Category:       c++
>Synopsis:       gcc does not work on compilng QT 2.2.1 on DEC Alpha
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 10 02:26:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Eric.Depagne@obspm.fr
>Release:        gcc version 2.9-gnupro-99r1
>Organization:
>Environment:
Dec Alpha. Trun Unix 5.0. gcc
>Description:
I'm currently compilng QT 2.2.1 on my machine, and everything 
went fine, excpet one of the last file. I got the following
message :
c++  -c -I/usr/X11R6/include -I/mag1/depagne/qt2/include -I/usr/X11R6/include -D_POSIX_SOURCE -D_OSF_SOURCE -D_AES_SOURCE -O2 -fPIC -DQT_BUILTIN_GIF_READER=1 -DQT_NO_IMAGEIO_MNG -DQT_NO_SM_SUPPORT  -I/mag1/depagne/qt2/src/3rdparty/zlib -I/mag1/depagne/qt2/src/3rdparty/libpng  -o table/qtable.o table/qtable.cpp
../../src/gcc/reload1.c:1049: Internal compiler error in function reload
Please submit a Problem Report to Cygnus Solutions with send-pr.
*** Exit 1
Stop.
*** Exit 1
Stop.
*** Exit 1
Stop.

>How-To-Repeat:
Just type make in the main directory of the QT 2.2.1 distribution, 
and it works ( hummm.)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="qtable.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="qtable.cpp"

LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioKKioKKiogSW1wbGVtZW50YXRpb24gb2YgUVRhYmxlIHdpZGdl
dCBjbGFzcwoqKgoqKiBDcmVhdGVkIDogMDA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