This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Internal compiler error in `instantiate_virtual_regs_1'


Hi,

GNU C++ version 2.95.3 19991030 (prerelease) reports an

  Internal compiler error in `instantiate_virtual_regs_1',
  at function.c:3863

for the following code:


-----------------------------------------------------------
struct TT {
    TT(int) {};
    operator int() const {return 0;}
};

TT getTT() {
    return 0;
}

void main() {
    TT a(0),b(0);
    a==1?a:TT(0);             // internal compiler error
    a==1?b:TT(0);             // internal compiler error
    getTT()==1?b:getTT();     // internal compiler error
    getTT()==getTT()?b:TT(0); // internal compiler error
    getTT()==1?b:b;           // ok
    1==1?b:getTT();           // ok
    1==1?b:TT(0);             // ok
    a==1?b:a;                 // ok
    a==1?TT(0):TT(0);         // ok
}
-----------------------------------------------------------


This seems to occur only under very special conditions, so
it's probably not very important.

This is a complete preprocessed bug.ii that produces the error:

-----------------------------------------------------------
# 1 "bug.cc"
struct TT {
    TT(int) {};
    operator int() const {return 0;}
};
void main() {
    TT a(0);
    a==1?a:TT(0);
}
-----------------------------------------------------------

and this is the output of gcc-2.95.3:

-----------------------------------------------------------
wichmann@isis6:~/c>gcc -v --save-temps a.cc
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)
 /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ a.cc a.ii
GNU CPP version 2.95.3 19991030 (prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
 /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/../../../../include/g++-3
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/../../../../i386-redhat-linux/include
End of omitted list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/cc1plus a.ii -quiet -dumpbase a.cc -version -o a.s
GNU C++ version 2.95.3 19991030 (prerelease) (i386-redhat-linux) compiled by GNU C version 2.95.3 19991030 (prerelease).
bug.cc: In function `int main(...)':
bug.cc:8: Internal compiler error in `instantiate_virtual_regs_1', at function.c:3863
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
-----------------------------------------------------------

The code works with gcc-2.72.3
(tested gcc-2.72.3-linux-i386, gcc-2.72.3-linux-alpha),
but fails with an internal compiler error with gcc-2.9x
(tested egcs-2.91.57-linux-alpha, egcs-2.91.66-linux-i386,
gcc-2.95.2-linux-alpha, gcc-2.95.3-linux-i386).

Thank you for maintaining gcc!

Andreas Wichmann
-- 
----> Andreas Wichmann <----> http://www.itkp.uni-bonn.de/~wichmann <----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]