system.h (CONST_CAST): Avoid union for gcc-4.0.x.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Wed, 29 Aug 2007 02:34:22 +0000 (02:34 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Wed, 29 Aug 2007 02:34:22 +0000 (02:34 +0000)
* system.h (CONST_CAST): Avoid union for gcc-4.0.x.

From-SVN: r127878

gcc/ChangeLog
gcc/system.h

index d9724f8eb7958e691ac4cd2b45d74ff3fbfadc2f..7b738c0e090c9342160b40cbb7474dc4ae5f22e3 100644 (file)
@@ -1,3 +1,7 @@
+2007-08-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * system.h (CONST_CAST): Avoid union for gcc-4.0.x.
+
 2007-08-28  Richard Guenther  <rguenther@suse.de>
 
        * tree.h (struct tree_function_decl): Increase size of
index 46da3817d80c940315d76ee43b7d90f6d7909c35..c9a1b6b0573aa28b5cbdd7fde071d3de771a380e 100644 (file)
@@ -774,7 +774,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
    execv, et al.  Another valid use would be in an allocation function
    that creates const objects that need to be initialized.  Most other
    cases should be viewed with extreme caution.  */
-#ifdef __GNUC__
+
+#if defined(__GNUC__) && GCC_VERSION != 4000
+/* GCC 4.0.x has a bug where it may ICE on this expression.  */
 #define CONST_CAST(X) ((__extension__(union {__typeof(X)_q; void *_v;})(X))._v)
 #else
 #define CONST_CAST(X) ((void*)(X))