This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH: 14035


Mark Mitchell wrote:

Nathan Sidwell wrote:

Mark Mitchell wrote:

This patch fixes PR c++/14035.  This PR was opened because of a cast
where we generated wrong-code for a C-style cast.  In particular, we
generated a copy constructor call instead of a derived-to-base
conversion.

The underlying problem was that we were not handling C-style casts as
one of const_cast, static_cast, or reinterpret_cast as required by
the standard.  (There are a few extra bits, but that's the basic
idea.)  So, I fixed that.



This patch appears to be causing regressions with gth_default.
/home/nathan/egcs/head/i686-pc-linux-gnu/i686-pc-linux-gnu/libstdc++-v3/include/i686-pc-linux-gnu/bits/gthr-default.h: In function `int __gthread_active_p()':
/home/nathan/egcs/head/i686-pc-linux-gnu/i686-pc-linux-gnu/libstdc++-v3/include/i686-pc-linux-gnu/bits/gthr-default.h:108: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object


Rats; I actually had a patch for that, which I forgot to check in. I've attached the patch,

But I hadn't. Here it is.


--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com

2004-10-20  Mark Mitchell  <mark@codesourcery.com>

	* gthr-posix.h (__gthread_active_p): Use __extension__ around cast
	from function pointer to void *.

Index: gthr-posix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gthr-posix.h,v
retrieving revision 1.32
diff -c -5 -p -r1.32 gthr-posix.h
*** gthr-posix.h	15 Oct 2004 14:47:08 -0000	1.32
--- gthr-posix.h	20 Oct 2004 16:55:00 -0000
*************** typedef pthread_mutex_t __gthread_recurs
*** 103,113 ****
  #endif /* _LIBOBJC || _LIBOBJC_WEAK */
  
  static inline int
  __gthread_active_p (void)
  {
!   static void *const __gthread_active_ptr = (void *) &pthread_create;
    return __gthread_active_ptr != 0;
  }
  
  #else /* not SUPPORTS_WEAK */
  
--- 103,114 ----
  #endif /* _LIBOBJC || _LIBOBJC_WEAK */
  
  static inline int
  __gthread_active_p (void)
  {
!   static void *const __gthread_active_ptr 
!     = __extension__ (void *) &pthread_create;
    return __gthread_active_ptr != 0;
  }
  
  #else /* not SUPPORTS_WEAK */
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]