This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: fix bootstrap for solaris2 cc, ?: with different operand struct const-ness
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jsm at polyomino dot org dot uk
- Date: Fri, 17 Aug 2007 12:10:14 -0400 (EDT)
- Subject: [PATCH]: fix bootstrap for solaris2 cc, ?: with different operand struct const-ness
Bootstrapping GCC on sparc-sun-solaris2.10 using cc for stage1, I'm
getting an error message in fixed-value.c:
"fixed-value.c", line 294: operands have incompatible types:
struct {unsigned long long low, long long high} ":" const struct {unsigned long long low, long long high}
cc: acomp failed for fixed-value.c
The line in question has:
double_int temp = subtract_p ? double_int_neg (b->data) : b->data;
Seem like the solaris compiler doesn't like the operands on ?: to be
structs with different const-ness. (Note this is unrelated to my
recent constification patches.) I can't seem to get the solaris cc to
be happy casting the first operand to (const double_int).
GCC has no problem compiling this file warning-free even with -pedantic.
My question: is the solaris compiler wrong to complain about this,
is GCC wrong to silently accept it, or is this some gray area of the
standard where implementations are free to choose either route?
Patch below allows bootstrap to proceed, okay for mainline?
Thanks,
--Kaveh
2007-08-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fixed-value.c (do_fixed_add): Fix assignment for solaris cc.
diff -rup orig/egcc-SVN20070817/gcc/fixed-value.c egcc-SVN20070817/gcc/fixed-value.c
--- orig/egcc-SVN20070817/gcc/fixed-value.c 2007-08-06 20:02:32.000000000 -0400
+++ egcc-SVN20070817/gcc/fixed-value.c 2007-08-17 12:07:51.636446932 -0400
@@ -291,9 +291,15 @@ do_fixed_add (FIXED_VALUE_TYPE *f, const
const FIXED_VALUE_TYPE *b, bool subtract_p, bool sat_p)
{
bool overflow_p = false;
- double_int temp = subtract_p ? double_int_neg (b->data) : b->data;
bool unsigned_p = UNSIGNED_FIXED_POINT_MODE_P (a->mode);
int i_f_bits = GET_MODE_IBIT (a->mode) + GET_MODE_FBIT (a->mode);
+ double_int temp;
+
+ if (subtract_p)
+ temp = double_int_neg (b->data);
+ else
+ temp = b->data;
+
f->mode = a->mode;
f->data = double_int_add (a->data, temp);
if (unsigned_p) /* Unsigned type. */