This is the mail archive of the 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]

4.0.2/4.1 PATCH: Allow libgfortran compilation on IRIX 5/6 (PR libfortran/15266)

PR libfortran/15266 describes that libgfortran doesn't build on IRIX 5 and
6 due to a prototype conflict for cabs() between <math.h> and exp_c8.c:

/.vol/gcc/src/gcc-4.0-branch-dist/libgfortran/generated/exp_c8.c:38: error: conflicting types for 'cabs'
/.vol/gcc/obj/gcc-4.0.0-20050414/6.5-gcc/gcc/include/math.h:676: error: previous declaration of 'cabs' was here

<math.h> has

extern double  cabs(struct __cabs_s);

while exp_c8.c uses

GFC_REAL_8 cabs (GFC_COMPLEX_8 z);

Initially, I wanted to deploy a fixincludes fix to wrap the <math.h>
declaration in __STDC_VERSION__ < 199901L to make the declaration only
visible for pre-C99 compilations, but it turned out the testcase didn't
work.  After some digging around, I found that my testcase was already
fixed by the existing broken_cabs fix, while the real <math.h> wasn't.
This happens because <math.h> has a TAB between double and cabs, while the
select clause in the broken_cabs fix was enclosed in single quotes, where
\t doesn't expand to TAB, but is taken literally ;-(  Simply changing to
double quotes fixes this problem, the fix is applied and mainline
bootstraps on both IRIX 6.5.10 and 5.3 finished (5.3 testing is still in
progress, but the patch certainly fixes a bootstrap failure).

Ok for mainline and the 4.0 branch once it reopens and 4.0 testing has


Rainer Orth, Faculty of Technology, Bielefeld University

Tue Jun  7 23:14:14 2005  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	PR libfortran/15266
	* inclhack.def (broken_cabs): Mention IRIX 5/6 problem.
	Use double quotes in select so \t matches tabs.
	Add IRIX testcase.
	* fixincl.x: Regenerate.
	* tests/base/math.h [BROKEN_CABS_CHECK]: Adapt for new testcase.

Index: inclhack.def
RCS file: /cvs/gcc/gcc/fixincludes/inclhack.def,v
retrieving revision 1.21
diff -u -p -r1.21 inclhack.def
--- inclhack.def	19 May 2005 07:05:45 -0000	1.21
+++ inclhack.def	9 Jun 2005 18:46:33 -0000
@@ -907,6 +907,8 @@ fix = {
  *  Remove `extern double cabs' declarations from math.h.
  *  This conflicts with C99.  Discovered on AIX.
+ *  IRIX 5 and IRIX 6 before 6.5.18 (where C99 support was introduced)
+ *  declares cabs() to take a struct __cabs_s argument.
  *  SunOS4 has its cabs() declaration followed by a comment which
  *  terminates on the following line.
  *  Darwin hides its broken cabs in architecture-specific subdirs.
@@ -916,7 +918,7 @@ fix = {
     files    = "math.h";
     files    = "architecture/ppc/math.h";
     files    = "architecture/i386/math.h";
-    select   = '^extern[ \t]+double[ \t]+cabs';
+    select   = "^extern[ \t]+double[ \t]+cabs";
     c_fix     = format;
     c_fix_arg = "";
@@ -929,7 +931,8 @@ fix = {
                 "extern double cabs ( _Complex z );\n"
                 "extern double cabs(); /* This is a comment\n"
-                "                         and it ends here. */";
+                "                         and it ends here. */\n"
+		"extern double	cabs(struct __cabs_s);";
Index: tests/base/math.h
RCS file: /cvs/gcc/gcc/fixincludes/tests/base/math.h,v
retrieving revision 1.2
diff -u -p -r1.2 math.h
--- tests/base/math.h	13 Nov 2004 20:41:00 -0000	1.2
+++ tests/base/math.h	9 Jun 2005 18:46:33 -0000
@@ -28,6 +28,7 @@ struct exception;
  /* This is a comment
                          and it ends here. */
 #endif  /* BROKEN_CABS_CHECK */

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