This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran,patch] bootstrap broken
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Feng Wang <wf_cs at yahoo dot com>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 17 Sep 2004 18:05:49 +0100
- Subject: Re: [gfortran,patch] bootstrap broken
- Organization: CodeSourcery
- References: <20040914125732.51004.qmail@web15603.mail.cnb.yahoo.com>
On Tuesday 14 September 2004 13:57, Feng Wang wrote:
> Hi, all
> I couldn't build fortran on ia64 at lease 4 days ago and this patch fix
> it with no regression. But everyone else seems not to have this problem. I
> think this is obvious but nobody pointed it. I was really confused. Dones
> everyone build smoothly?
The subject is inaccurate (this is only a problem when not bootstrapping).
However we do need to support gcc 2.95 for building cross-compilers.
> ChangeLog entry
>
> 2004-09-14 Feng Wang <fengwang@nudt.edu.cn>
>
> * gfortran.h (gfc_linebuf): Change the type of line to char *.
> * scanner.c (load_file): Initialize line.
Better would be to just replace the empty array "[]" with "[1]".
Tested on i686-linux.
Applied to mainline.
Paul
2004-09-17 Paul Brook <paul@codesourcery.com>
* gfortran.h (struct gfc_linebuf): Don't use C99 empty arrays.
(gfc_linebuf_header_size): Define.
* scanner.c (load_file): Use it.
Index: gfortran.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/gfortran.h,v
retrieving revision 1.37
diff -u -p -r1.37 gfortran.h
--- gfortran.h 15 Sep 2004 14:09:06 -0000 1.37
+++ gfortran.h 17 Sep 2004 16:30:13 -0000
@@ -469,9 +469,11 @@ typedef struct gfc_linebuf
struct gfc_file *file;
struct gfc_linebuf *next;
- char line[];
+ char line[1];
} gfc_linebuf;
-
+
+#define gfc_linebuf_header_size (offsetof (gfc_linebuf, line))
+
typedef struct
{
char *nextc;
Index: scanner.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/scanner.c,v
retrieving revision 1.10
diff -u -p -r1.10 scanner.c
--- scanner.c 16 Sep 2004 16:00:43 -0000 1.10
+++ scanner.c 17 Sep 2004 16:30:37 -0000
@@ -1034,7 +1034,7 @@ load_file (char *filename, bool initial)
/* Add line. */
- b = gfc_getmem (sizeof (gfc_linebuf) + len + 1);
+ b = gfc_getmem (gfc_linebuf_header_size + len + 1);
#ifdef USE_MAPPED_LOCATION
b->location