This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix mainline bootstrap failure on AIX 5.2
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Bruce Korb <bkorb at veritas dot com>
- Date: Fri, 23 Apr 2004 15:37:55 -0600 (MDT)
- Subject: [PATCH] Fix mainline bootstrap failure on AIX 5.2
The following fixincludes patch resolves the current mainline
bootstrap failure on AIX. The failure mode is a stage2 warning
building collect2 which is built with the -Werror command line
option.
../../gcc/gcc/collect2.c: In function `collect_wait':
../../gcc/gcc/collect2.c:1470: warning: signed and unsigned type in
conditional expression
../../gcc/gcc/collect2.c:1478: warning: signed and unsigned type in
conditional expression
The problem is that the AIX <sys/wait.h> header files defines the
macros WSTOPSIG, WEXITSTATUS and WSIGTERM using the idiom
(int)(x ? (((unsigned)y >> c) : -1))
which indeed has a signed vs. unsigned type mismatch in a ternary
operator. The fixinc patch below solves the problem by modifying
these problematic macros to read
(int)(x ? (int)(((unsigned)y >> c) : -1))
which keeps gcc happy, and allows mainline bootstrap to complete
successfully on powerpc-ibm-aix5.2.0.0. Many thanks to Bruce Korb
for his help with this.
Ok for mainline?
2004-04-23 Roger Sayle <roger@eyesopen.com>
Bruce Korb <bkorb@gnu.org>
* fixinc/inclhack.def (aix_syswait_2): New fix.
* fixinc/fixincl.x: Regenerate.
* fixinc/tests/base/sys/wait.h: Update for new test.
Index: inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.195
diff -c -3 -p -r1.195 inclhack.def
*** inclhack.def 7 Apr 2004 22:25:30 -0000 1.195
--- inclhack.def 23 Apr 2004 22:35:54 -0000
*************** fix = {
*** 494,499 ****
--- 494,513 ----
/*
+ * sys/wait.h on AIX 5.2 defines macros that have both signed and
+ * unsigned types in conditional expressions.
+ */
+ fix = {
+ hackname = aix_syswait_2;
+ files = sys/wait.h;
+ select = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
+ c_fix = format;
+ c_fix_arg = "? (int)%1";
+ test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
+ };
+
+
+ /*
* sys/signal.h on some versions of AIX uses volatile in the typedef of
* sig_atomic_t, which causes gcc to generate a warning about duplicate
* volatile when a sig_atomic_t variable is declared volatile, as
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833