This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: More bugs 2.8.1 inherited from 2.8.0
- Subject: Re: More bugs 2.8.1 inherited from 2.8.0
- From: Christian Joesson FOA 72 <chj at lin dot foa dot se>
- Date: Thu, 12 Mar 1998 07:41:20 +0000
- Cc: egcs at cygnus dot com
- Newsgroups: gnu.g++.bug
- Organization: Sweden's Defence Research Est.
- References: <199803111530.QAA25182@top.coli.uni-sb.de>
Well, I'm using RHL 5.0/Intel with glibc-2.0.6-9 and with binutils-2.8.1.0.23 and
egcs-1.0.2-980309-prerelease and the last of the problems looks like it went away.
gcc -O -c bug1.cc bug1.cc:26: sorry, not implemented: initializer
contains unrecognized tree code
gcc -O -c bug2.cc
bug2.cc: In method `int A<Index>::example(Index, int)':
bug2.cc:37: Internal compiler error 40.
bug2.cc:37: Please submit a full bug report to `egcs-bugs@cygnus.com'.
gcc -O -c bug3.cc
bug3.cc: In function `int main()':
bug3.cc:63: no matching function for call to `blub2 (char * ()())'
bug3.cc:36: candidates are: blub2(const char * (*)())
bug3.cc:37: blub2(int (*)())
bug3.cc:64: no matching function for call to `test::bar (char * ()())'
bug3.cc:42: candidates are: test::bar(const char * (*)())
bug3.cc:65: no matching function for call to `test2<const char *>::bar
(char * ()())'
bug3.cc:49: candidates are: test2<const char *>::bar(const char * (*)())
Hey, this looks like it works.
gcc -O -c bug6.cc
Well, nothing much really...
Henrik Theiling wrote:
> Hi!
>
> Another four test programmes that create different kinds of errors.
> All four programmes work fine with gcc 2.7.2 but not with 2.8.0
> and not with 2.8.1. I tested them with (`uname -a`):
>
> Linux machinex 2.0.32 #4 Thu Dec 18 04:13:07 MET 1997 i586
> with
> libc.so.5.4.33
>
> ----------------------------------------------------------------------
> > gcc -O -c bug1.cc
>
> bug1.cc:26: sorry, not implemented: initializer contains unrecognized tree code
>
> Source code:
> // -*- Mode: C++ -*-
> //
> // gcc 2.7.2 does compile this,
> // gcc 2.8.0 doesn't
> //
> // workaround: use `extern inline' instead of a macro
> //
> // The output was:
> // bug1.cc:26: sorry, not implemented: initializer contains unrecognized tree code
>
> #include <math.h>
>
> #define _MY_GOLDENRATIO 0.61803398874989490253
>
> #define hashinto(i,mod) \
> ({ \
> double __f= (i)*_MY_GOLDENRATIO; \
> (t_hash)((mod)*(__f-floor(__f))); \
> })
>
> template <class Index>
> class A {
> public:
> int example (Index a, int b)
> {
> return hashinto (a, b);
> }
> };
>
> ----------------------------------------------------------------------
> > gcc -O -c bug2.cc
>
> bug2.cc: In method `int A<Index>::example(Index, int)':
> bug2.cc:37: Internal compiler error 40.
> bug2.cc:37: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.
>
> Source code:
> // -*- Mode: C++ -*-
> //
> // Assembly routines for the i386 / Linux
> //
> // gcc 2.7.2 does compile this,
> // gcc 2.8.0 doesn't
> //
> // workaround: use `extern inline' instead of a macro
> //
> // The output was:
> // bug2.cc: In method `int A<Index>::example(Index, int)':
> // bug2.cc:37: Internal compiler error 40.
> // bug2.cc:37: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.
>
> typedef unsigned int t_hash;
>
> // ,hashinto' berechnet frac(i*2/(sqrt(5)+1))*mod
> // Diese Methode eignet sich laut Knuth f|r Hashtabellen in
> // Zweierpotenzgrv_e.
> #define hashinto(i,mod) \
> ({ \
> t_hash __result; \
> __asm__ ( \
> "imull $2654435769,%%eax,%%eax\n" \
> "\tmull %2" : \
> "=d" (__result): \
> "a" (i), "cbDS" (mod): \
> "ax", "dx"); \
> __result; \
> })
>
> template <class Index>
> class A {
> public:
> int example (Index a, int b)
> {
> return hashinto (a, b);
> }
> };
>
> ----------------------------------------------------------------------
> > gcc -O -c bug3.cc
>
> bug3.cc: In function `int main()':
> bug3.cc:63: no matching function for call to `blub2 (char * ()())'
> bug3.cc:36: candidates are: blub2(const char * (*)())
> bug3.cc:37: blub2(int (*)())
> bug3.cc:64: no matching function for call to `test::bar (char * ()())'
> bug3.cc:42: candidates are: test::bar(const char * (*)())
> bug3.cc:65: no matching function for call to `test2<const char *>::bar (char * ()())'
> bug3.cc:49: candidates are: test2<const char *>::bar(const char * (*)())
>
> Source code:
> // -*- Mode: C++ -*-
> //
> // Description:
> // Functions pointers as parameters aren't accepted although they
> // should be because they only differ in const-value of the function
> // result (the parameter wants const, the function returns non-const).
> // This only occurs when a function is overloaded or implicitly
> // overloaded because it's inside a class.
> //
> // This is a nasty one. Very annoying for my own libraries (won't
> // compile anymore, no quick fix possible).
> //
> // I don't know any simple workaround.
> //
> // gcc-2.7.2 compiles this
> // gcc-2.8.0 doesn't:
> //
> // bug3.cc: In function `int main()':
> // bug3.cc:63: no matching function for call to `blub2 (char * ()())'
> // bug3.cc:36: candidates are: blub2(const char * (*)())
> // bug3.cc:37: blub2(int (*)())
> // bug3.cc:64: no matching function for call to `test::bar (char * ()())'
> // bug3.cc:42: candidates are: test::bar(const char * (*)())
> // bug3.cc:65: no matching function for call to `test2<const char *>::bar (char * ()())'
> // bug3.cc:49: candidates are: test2<const char *>::bar(const char * (*)())
>
> #include <stdio.h>
>
> char *foo() { return "hallo"; }
> const char *foo2() { return "hallo"; }
>
> // It works outside classes when not overloaded:
> void blub (const char *(*blah)()) { printf ("%s\n", blah()); }
>
> // but not when overloaded:
> void blub2 (const char *(*blah)()) { printf ("%s\n", blah()); }
> void blub2 (int (*blah)()) { printf ("%d\n", blah()); }
>
> // and not inside classes:
> class test {
> public:
> void bar (const char *(*blah) ()) { printf ("%s\n", blah()); }
> };
>
> // and not inside template classes (that's were I found it):
> template <class T>
> class test2 {
> public:
> void bar (T (*blah) ()) { printf ("%s\n", blah()); }
> };
>
> main()
> {
> test t;
> test2<const char *> t2;
> /* precise type matches */
> blub (foo2);
> blub2 (foo2);
> t.bar (foo2);
> t2.bar (foo2);
> /* compatible const mismatches */
> blub (foo);
> blub2 (foo); /* error! */
> t.bar (foo); /* error! */
> t2.bar (foo); /* error! */
> }
>
> ----------------------------------------------------------------------
> > gcc -O -c bug6.cc
> This only happens when optimisation is switched on.
>
> bug6.cc: In method `void foo(const header &)::m::call(char *)':
> bug6.cc:38: Internal compiler error.
> bug6.cc:38: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.
>
> Source code:
> #include <stdlib.h>
>
> template <class T>
> class vector {
> protected:
> T z;
> public:
> vector(T zero):z(zero) {}
> };
>
> template <class T>
> class mapper {
> public:
> virtual void call(T) {}
> };
>
> class header: public vector<char *> {
> public:
> header(): vector<char*>(NULL) {}
> void map (mapper<char*> m) const {
> m.call(z);
> }
> };
>
> void foo (const header &h)
> {
> class m: public mapper<char *> {
> public:
> virtual void call (char*) {
> }
> } gg;
> h.map (gg);
> }
>
> main () {
> header b;
> foo (b);
> }
>
> Bye,
> Henrik
--
Christian Jvnsson chj@lin.foa.se
Sweden's Defence Research Establishment
Dep't of Communication Systems FOA 72