* sid doesn't build with gcc 4.0.x
@ 2005-06-30 17:29 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2005-06-30 17:29 UTC (permalink / raw)
To: cgen, fche; +Cc: jason, brolley
Hi folks.
Sid is not building with GCC 4.0 or above. The problem is in
component/cgen-cpu/cgen-cpu.h's use of reinterpret_cast. The
reinterpret_cast construct is not allowed amongst integers.
Section 5.2.10 of the C++ specs list the specific set of conversions
allowed by the construct. Converting from an integer to itself is
not among them.
Jason mentioned that y'all probably want to use static_cast.
I also ran into a template problem which I tried fixing. The patch
below showed no regressions when testing with GCC 3.4, but still has
more regressions than 3.4 when building sid with 4.0.
I'm not very C++ savvy (at all). I was hoping one of you cgen fancy
folks could please take a look at this.
The patch below is what you need to at least build with 4.0.
Cheers.
Aldy
* component/interrupt/components.h (bus_size): Fix constructor to
be legitimate C++.
* component/cgen-cpu/cgen-cpu.h (GETMEMSF): Change
reinterpret_cast to static_cast.
(SETMEMSF): Same.
(GETMEMDF): Same.
(SETMEMDF): Same.
Index: component/interrupt/components.h
===================================================================
RCS file: /cvs/src/src/sid/component/interrupt/components.h,v
retrieving revision 1.6
diff -c -p -r1.6 components.h
*** component/interrupt/components.h 6 Feb 2003 20:40:26 -0000 1.6
--- component/interrupt/components.h 30 Jun 2005 15:12:20 -0000
*************** private:
*** 223,229 ****
// functions in template class
template<class bus_size>
! IntController<bus_size>::IntController<bus_size>
(host_int_4 num_irq,
host_int_4 num_fiq,
host_int_4 ctrlr_features):
--- 223,229 ----
// functions in template class
template<class bus_size>
! IntController<bus_size>::IntController
(host_int_4 num_irq,
host_int_4 num_fiq,
host_int_4 ctrlr_features):
Index: component/cgen-cpu/cgen-cpu.h
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/cgen-cpu.h,v
retrieving revision 1.13
diff -c -p -r1.13 cgen-cpu.h
*** component/cgen-cpu/cgen-cpu.h 3 Jun 2005 20:25:39 -0000 1.13
--- component/cgen-cpu/cgen-cpu.h 30 Jun 2005 15:12:20 -0000
*************** public:
*** 172,194 ****
inline SF
GETMEMSF(PCADDR pc, IADDR addr)
{
! return reinterpret_cast<SF>(this->read_insn_memory_4 (pc, addr));
}
inline void
SETMEMSF(PCADDR pc, ADDR addr, SF value)
{
! return this->write_insn_memory_4 (pc, addr, reinterpret_cast<USI>(value));
}
inline DF
GETMEMDF(PCADDR pc, IADDR addr)
{
! return reinterpret_cast<DF>(this->read_insn_memory_8 (pc, addr));
}
inline void
SETMEMDF(PCADDR pc, ADDR addr, DF value)
{
! return this->write_insn_memory_8 (pc, addr, reinterpret_cast<UDI>(value));
}
// IMEM: instruction memory calls
--- 172,194 ----
inline SF
GETMEMSF(PCADDR pc, IADDR addr)
{
! return static_cast<SF>(this->read_insn_memory_4 (pc, addr));
}
inline void
SETMEMSF(PCADDR pc, ADDR addr, SF value)
{
! return this->write_insn_memory_4 (pc, addr, static_cast<USI>(value));
}
inline DF
GETMEMDF(PCADDR pc, IADDR addr)
{
! return static_cast<DF>(this->read_insn_memory_8 (pc, addr));
}
inline void
SETMEMDF(PCADDR pc, ADDR addr, DF value)
{
! return this->write_insn_memory_8 (pc, addr, static_cast<UDI>(value));
}
// IMEM: instruction memory calls
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-06-30 17:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-30 17:29 sid doesn't build with gcc 4.0.x Aldy Hernandez
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).