public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: Bug in pointer casting
  1999-07-31 23:33 Bug in pointer casting Gilbert Ramirez
@ 1999-07-01 21:24 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 1999-07-01 21:24 UTC (permalink / raw)
  To: Gilbert Ramirez; +Cc: egcs-bugs

On Jul  1, 1999, Gilbert Ramirez <gram@xiexie.org> wrote:

> template<class T> void cb<T>::operator()(void) {
> 	void (*callback)(T) = (void (*)(T)) ptr; /* <-------- */

> test.cpp:23: Internal compiler error.

Thanks, fixed in the upcoming gcc 2.95

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Bug in pointer casting
@ 1999-07-31 23:33 Gilbert Ramirez
  1999-07-01 21:24 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Gilbert Ramirez @ 1999-07-31 23:33 UTC (permalink / raw)
  To: egcs-bugs

I am using egcs-2.91.66 on Linux 2.2.5, on a PII machine. (Stock RedHat
6.0 installation)

In compiling some code, I have encountered an "internal compiler error"
when casting a void pointer to a pointer to a function taking one
argument and returning void. This happens inside a template class.

I have created a small test file isolating just that one bug.

I invoked egcs via 'egcs -c test.cpp'. The test.cpp file is copied here.
The error is reported for the line with the comment.

------------------------------------------------------
template<class T>
class cb {
	public:
		cb(void*, T);

	void 	*ptr;
	T	val;

	void	operator()(void);
};

template<class T>
cb<T>::cb(void *f, T a)
{
	ptr = f;
	val = a;
}

template<class T>
void cb<T>::operator()(void)
{
	void (*callback)(T) = (void (*)(T)) ptr; /* <-------- */
	callback(val);
}

template cb<int>;
------------------------------------------------------

When invoking egcs with '-v', I get this:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__
-Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix)
-D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386
-D__i386 -D__i386__ test.cpp test.ii
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/i386-redhat-linux/include
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cc1plus test.ii -quiet
-dumpbase test.cc -version -o test.s
GNU C++ version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
(i386-redhat-linux) compiled by GNU C version egcs-2.91.66
19990314/Linux (egcs-1.1.2 release).
test.cpp: In method `void cb<int>::operator ()<int>()':
test.cpp:28:   instantiated from here
test.cpp:23: Internal compiler error.
test.cpp:23: Please submit a full bug report to
`egcs-bugs@egcs.cygnus.com'.
test.cpp:23: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for
details.


Both test.cpp and test.ii are attached to this e-mail.

--gilbert
>From dave@hiauly1.hia.nrc.ca Sat Jul 31 23:33:00 1999
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: egcs-bugs@egcs.cygnus.com
Subject: Internal compiler error - pa.md
Date: Sat, 31 Jul 1999 23:33:00 -0000
Message-id: <199907311826.OAA21450@hiauly1.hia.nrc.ca>
X-SW-Source: 1999-07n/msg00950.html
Content-length: 690

In the current mainline, the following error occurs:

./genattr ../../gcc/config/pa/pa.md > tmp-attr.h
Expected character ".  Found character [.  At file position: 48803
Following characters are:
	(set_attr "type" "load")
   (set_attr "length" "4")])

;; Always use addil rather than ldil;add sequences.  This allows the
;; HP linker to eliminate the dp relocation if the symbolic operand
;; livesAborting.
genattr: Internal compiler error in `dump_and_abort', at ../../gcc/rtl.c:539

Looks like a missing "" in instruction definition.

-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-07-31 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-31 23:33 Bug in pointer casting Gilbert Ramirez
1999-07-01 21:24 ` Alexandre Oliva

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).