public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: g++ internal error: mem_func explicit instantiation
       [not found] <20000727190322.A67415@namesurfer.com>
@ 2000-07-27  9:19 ` Alexander Krotov
  0 siblings, 0 replies; only message in thread
From: Alexander Krotov @ 2000-07-27  9:19 UTC (permalink / raw)
  To: gcc-bugs

On Thu, Jul 27, 2000 at 07:03:22PM +0300, Alexander Krotov wrote:
Hi!

G++ 2.95.2 complains about internal error when compiling
following (simplified) code:

----------------------------------------------------------------------------
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>

class MyClass
{
 public:
        void    probochka()     {}
        void    prob(int x) const {}
};

int main(void)
{
        vector<MyClass> critters;
        for_each(critters.begin(),critters.end(),
               mem_fun_ref<void, MyClass&>(&MyClass::probochka));
}
----------------------------------------------------------------------------

Options -c -v.
gcc version 2.95.2 19991024 (release)
FreeBSD 3.4.

kama /tmp $ g++ -v -c tbb.c 
Reading specs from /usr/local/lib/gcc-lib/i386-portbld-freebsd3.4/2.95.2/specs
gcc version 2.95.2 19991024 (release)
>  /usr/local/lib/gcc-lib/i386-portbld-freebsd3.4/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Di386 -Dunix -D__FreeBSD__=3 -D__i386__ -D__unix__ -D__FreeBSD__=3 -D__i386 -D__unix -Acpu(i386) -Amachine(i386) -Asystem(unix) -Asystem(FreeBSD) -D__EXCEPTIONS -D__ELF__ tbb.c /var/tmp/cce67428.ii
GNU CPP version 2.95.2 19991024 (release) (i386 FreeBSD/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/i386-portbld-freebsd3.4/2.95.2/include/g++
 /usr/local/include
 /usr/local/lib/gcc-lib/i386-portbld-freebsd3.4/2.95.2/../../../../i386-portbld-freebsd3.4/include
 /usr/local/lib/gcc-lib/i386-portbld-freebsd3.4/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/local/lib/gcc-lib/i386-portbld-freebsd3.4/2.95.2/cc1plus /var/tmp/cce67428.ii -quiet -dumpbase tbb.cc -version -o /var/tmp/ccd67428.s
GNU C++ version 2.95.2 19991024 (release) (i386-portbld-freebsd3.4) compiled by GNU C version 2.95.2 19991024 (release).
tbb.c: In function `int main()':
tbb.c:17: Internal compiler error.
tbb.c:17: Please submit a full bug report.
tbb.c:17: See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.

-- 
Alexander Krotov	gsm: +358 40-725 7216
Product Developer	fax: +358  9-478 1030
NameSurfer Ltd.		http://www.namesurfer.com
>From trt@cs.duke.edu Thu Jul 27 10:01:00 2000
From: "Thomas R. Truscott" <trt@cs.duke.edu>
To: gcc-bugs@gcc.gnu.org
Subject: preprocessor in ss-20000724 fumbles arglist expansion
Date: Thu, 27 Jul 2000 10:01:00 -0000
Message-id: <200007271701.NAA01321@larry.cs.duke.edu>
X-SW-Source: 2000-07/msg00718.html
Content-length: 664

[This seems to be a new problem, it was okay in ss-20000703]

When gcc compiles the following:

#define SYMBOL_COMMA ,
#define ECHO(x) x
#define GENERATE(sym)  ECHO(SYMBOL_##sym)
int x GENERATE(COMMA) y;

the preprocessor says 'too many arguments for macro "ECHO"'
(This is the preprocessor used by gcc for default compilations,
which in the gcc source directory is named "cpp"
and not "xcpp" or "tradcpp".  On Linux this binary
is in .../lib/gcc-lib/i686-pc-linux/2.96/cpp and not bin/cpp.
I find this quite confusing.  Anyway,
doing "gcc -c foo.c" on the above code is simplest.)

The correct behavior is to produce "int x , y;" without complaint.

Tom Truscott
>From KCooper@transcept.com Thu Jul 27 10:22:00 2000
From: Karl Cooper <KCooper@transcept.com>
To: "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>
Subject: gcc 2.95.3 for ppc uses GPR 0 in addi
Date: Thu, 27 Jul 2000 10:22:00 -0000
Message-id: <E16DF5C01B78D311BFA500508B44864714EEFE@ROKSDIAMOND>
X-SW-Source: 2000-07/msg00719.html
Content-length: 2175

The following C code with user-provided asm code
causes gcc to produce incorrect assembler output:

[kcooper@graylock adderror]$ /usr/bin/gcc-2.95.3 -v --save-temps -c
waitfor.c
Reading specs from /usr/lib/gcc-lib/ppc-redhat-linux/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)
 /usr/lib/gcc-lib/ppc-redhat-linux/2.95.3/cpp -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=95 -DPPC -D__ELF__ -Dpowerpc -D__PPC__ -D__ELF__
-D__powerpc__ -D__PPC -D__powerpc -Acpu(powerpc) -Amachine(powerpc)
-D__CHAR_UNSIGNED__ -D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__
-Amachine(bigendian) -D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux
-Asystem(unix) -Asystem(posix) waitfor.c waitfor.i
GNU CPP version 2.95.3 19991030 (prerelease) (PowerPC GNU/Linux)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 
/usr/lib/gcc-lib/ppc-redhat-linux/2.95.3/../../../../ppc-redhat-linux/includ
e
 /usr/lib/gcc-lib/ppc-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/ppc-redhat-linux/2.95.3/../../../../include/g++-3
End of omitted list.
 /usr/lib/gcc-lib/ppc-redhat-linux/2.95.3/cc1 waitfor.i -quiet -dumpbase
waitfor.c -version -o waitfor.s
GNU C version 2.95.3 19991030 (prerelease) (ppc-redhat-linux) compiled by
GNU C
version 2.95.3 19991030 (prerelease).
 as -mppc -V -Qy -o waitfor.o waitfor.s
GNU assembler version 990418 (ppc-redhat-linux) using BFD version 990418

The preprocessed source is:

[kcooper@graylock adderror]$ cat waitfor.i
# 1 "waitfor.c"

void waitfor (int delta)
{
  asm
  (
    "addi    %%r4,%0,1\n\t"
    "mftb    %%r6\n\t"
    "add     %%r4,%%r4,%%r6\n\t"
    "1: mftb %%r5\n\t"
    "cmpl    0,%%r4,%%r5\n\t"
    "bgt     1b\n\t"
    :
    : "r" (delta)
    : "r4", "r5", "r6"
  );
}


The resulting .s file chooses r0 to load the input parameter,
resulting in an addi  r4,r0,1 instruction which effectively
zeroes the input parameter.

Perhaps the powerpc configuration file should forbid the use
of r0 when it will be the source register in an addi or subi
instruction.

Karl Cooper
Senior Software Engineer
Transcept, Inc.
>From Franz.Sirl-kernel@lauterbach.com Thu Jul 27 10:50:00 2000
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: Karl Cooper <KCooper@transcept.com>
Cc: "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>
Subject: Re: gcc 2.95.3 for ppc uses GPR 0 in addi
Date: Thu, 27 Jul 2000 10:50:00 -0000
Message-id: <4.3.2.7.2.20000727194604.036aac30@mail.lauterbach.com>
References: <E16DF5C01B78D311BFA500508B44864714EEFE@ROKSDIAMOND>
X-SW-Source: 2000-07/msg00720.html
Content-length: 776

At 19:15 27.07.00, Karl Cooper wrote:
>The following C code with user-provided asm code
>causes gcc to produce incorrect assembler output:
>void waitfor (int delta)
>{
>   asm
>   (
>     "addi    %%r4,%0,1\n\t"
>     "mftb    %%r6\n\t"
>     "add     %%r4,%%r4,%%r6\n\t"
>     "1: mftb %%r5\n\t"
>     "cmpl    0,%%r4,%%r5\n\t"
>     "bgt     1b\n\t"
>     :
>     : "r" (delta)
^^^^^^^^^^^^^^^^^^

>     : "r4", "r5", "r6"
>   );
>}
>
>
>The resulting .s file chooses r0 to load the input parameter,
>resulting in an addi  r4,r0,1 instruction which effectively
>zeroes the input parameter.

But you explicitly allowed r0-r31 by using "r", if you want to restrict the 
range to r1-r31, use "b". This is a common programming error when using 
inline assembly on PPC.

Franz.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-07-27  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20000727190322.A67415@namesurfer.com>
2000-07-27  9:19 ` g++ internal error: mem_func explicit instantiation Alexander Krotov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).