Bug 27650 - internal compiler error while compiling Gecode
Summary: internal compiler error while compiling Gecode
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Danny Smith
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-17 20:50 UTC by Harmon Sequoya Nine
Modified: 2006-11-25 03:14 UTC (History)
2 users (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed: 2006-05-22 21:22:44


Attachments
Pre-processed output of reco-stack.cc, a gecode source file. (91.38 KB, application/octet-stream)
2006-05-18 22:56 UTC, Harmon Sequoya Nine
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Harmon Sequoya Nine 2006-05-17 20:50:46 UTC
On cygwin system, used gcc 3.4.4 to compile gcc 4.1.0.  Installed gcc 4.1.0 in /usr/local.

While compiling Gecode (with "make"), from gecode-1.1.0.tar.gz, encountered the following error:

search/reco-stack.cc:85: internal compiler error: in maybe_emit_vtables, at cp/decl2.c:1548

exact command sequence in top directory of gecode source tree:
$ ./configure CC="/usr/local/bin/gcc.exe" CXX="/usr/local/bin/g++.exe"
(lots of output)
$ make
(some output)
ERROR MESSAGE AS ABOVE
Comment 1 Andrew Pinski 2006-05-18 04:44:03 UTC
Please read http://gcc.gnu.org/bugs.html and provide the preprocessed source.
Comment 2 Harmon Sequoya Nine 2006-05-18 22:56:35 UTC
Created attachment 11487 [details]
Pre-processed output of reco-stack.cc, a gecode source file.

reco-stack.cc is generating an internal compiler error.  The attachment is this file as pre-processed.

This file, and package of which it is a part, can be downloaded from the following URL:

http://www.gecode.org/download/gecode-1.1.0.tar.gz
Comment 3 Harmon Sequoya Nine 2006-05-18 23:01:10 UTC
Command that generated attachment (reco-stack.ii):
/usr/local/bin/g++.exe -v -save-temps -I. -I. -DNDEBUG -Wall -ggdb -O3 -fno-strict-aliasing -finline-limit=3000 -ffast-math -mthreads  -DGECODE_BUILD_SEARCH -c -o search/reco-stack.o  search/reco-stack.cc

Output from this command:
Using built-in specs.
Target: i686-pc-cygwin
Configured with: ../gcc-4.1.0/configure 
Thread model: single
gcc version 4.1.0
 /usr/local/libexec/gcc/i686-pc-cygwin/4.1.0/cc1plus.exe -E -quiet -v -I. -I. -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/../include/w32api -idirafter /usr/local/lib/gcc/i686-pc-cygwin/4.1.0/../../../../../include/w32api -DNDEBUG -DGECODE_BUILD_SEARCH search/reco-stack.cc -mthreads -mtune=pentiumpro -Wall -fno-strict-aliasing -finline-limit=3000 -ffast-math -fworking-directory -O3 -fpch-preprocess -o reco-stack.ii
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-cygwin/4.1.0/../../../../i686-pc-cygwin/include"
ignoring duplicate directory "/usr/local/lib/gcc/i686-pc-cygwin/4.1.0/../../../../../include/w32api"
ignoring duplicate directory "."
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/local/lib/gcc/i686-pc-cygwin/4.1.0/../../../../include/c++/4.1.0
 /usr/local/lib/gcc/i686-pc-cygwin/4.1.0/../../../../include/c++/4.1.0/i686-pc-cygwin
 /usr/local/lib/gcc/i686-pc-cygwin/4.1.0/../../../../include/c++/4.1.0/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-cygwin/4.1.0/include
 /usr/include
 /usr/lib/../include/w32api
Comment 4 Harmon Sequoya Nine 2006-05-18 23:04:49 UTC
Output from gcc command in previous comment was incomplete.  Here is the rest:

End of search list.
 /usr/local/libexec/gcc/i686-pc-cygwin/4.1.0/cc1plus.exe -fpreprocessed reco-stack.ii -quiet -dumpbase reco-stack.cc -mthreads -mtune=pentiumpro -auxbase-strip search/reco-stack.o -ggdb -O3 -Wall -version -fno-strict-aliasing -finline-limit=3000 -ffast-math -o reco-stack.s
GNU C++ version 4.1.0 (i686-pc-cygwin)
	compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 37c50bca8d9aa79de709cfd6b183fd23
search/reco-stack.cc:85: internal compiler error: in maybe_emit_vtables, at cp/decl2.c:1548
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 5 Danny Smith 2006-05-22 21:19:41 UTC
This is a dllimport bug.  Dllimports do not have constant address.  Hence class vtable cannot contain a method with dllimport attribute
I am working on  a patch.
Here is reduced testcase:


// dllimport_virtual.C
struct base
{
  virtual void key_method();
  __attribute__((dllimport)) virtual ~base(); // Does not have a const address
};

// Definition of key_method forces emmission of vtable
void base::key_method() {};
Comment 6 Danny Smith 2006-05-29 22:23:16 UTC
Patch at:
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01504.html
Danny
Comment 7 Harmon Sequoya Nine 2006-06-06 23:02:56 UTC
Bugfix worked for me.  Compilation definitely got farther.  However, there's another bug.  Pls. see bug 26622.

Gecode may be a good compiler test package; it seems to use some advanced C++ features.
Comment 8 Andrew Pinski 2006-06-06 23:14:35 UTC
(In reply to comment #7)
> Bugfix worked for me.  Compilation definitely got farther.  However, there's
> another bug.  Pls. see bug 26622.

As mentioned in that PR, the problem there is unrelated to your code.
The rtl pattern which is being complained about:
(insn 491 490 492 18 ././kernel/core.icc:1448 (set (reg:SI 223)
        (const:SI (plus:SI (mem:SI (symbol_ref:SI ("#i._ZN6Gecode5Space3vtdE") <var_decl 0x19664f10 vtd>) [0 S4 A8])
                (const_int 1024 [0x400])))) -1 (nil)
    (nil))


Why is this wrapping itself inside a const when it cannot be a const as it is loading from memory.
Comment 9 dannysmith@gcc.gnu.org 2006-09-20 23:27:13 UTC
Subject: Bug 27650

Author: dannysmith
Date: Wed Sep 20 23:27:05 2006
New Revision: 117096

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117096
Log:
	PR target/27650
	* class.c (check_for_override): Remove dllimport from virtual
	methods.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c

Comment 10 dannysmith@gcc.gnu.org 2006-09-20 23:32:15 UTC
Subject: Bug 27650

Author: dannysmith
Date: Wed Sep 20 23:32:07 2006
New Revision: 117097

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117097
Log:
	PR target/27650
	* g++.dg/ext/dllimport12.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/ext/dllimport12.C   (with props)
Modified:
    trunk/gcc/testsuite/ChangeLog

Propchange: trunk/gcc/testsuite/g++.dg/ext/dllimport12.C
            ('svn:executable' added)


Comment 11 Danny Smith 2006-09-20 23:37:52 UTC
Fixed on trunk.
Danny
Comment 12 Andrew Pinski 2006-11-25 03:14:22 UTC
Fixed.