public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
From: "Frank Ch. Eigler" <fche@redhat.com>
To: sid@sources.redhat.com
Subject: [aldyh@redhat.com: sid doesn't build with gcc 4.0.x]
Date: Thu, 30 Jun 2005 20:21:00 -0000	[thread overview]
Message-ID: <20050630202141.GB7997@redhat.com> (raw)


From: Aldy Hernandez <aldyh@redhat.com>
To: cgen@sources.redhat.com [...]
Subject: sid doesn't build with gcc 4.0.x

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

                 reply	other threads:[~2005-06-30 20:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050630202141.GB7997@redhat.com \
    --to=fche@redhat.com \
    --cc=sid@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).