protoize.c not ISO C
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Sun Oct 31 23:03:00 GMT 1999
> From: Jim Wilson <wilson@cygnus.com>
>
> protoize.c does arithmetic on void * pointers. This happens in
> safe_read and safe_write. I think this is a gcc misfeature that we
> shouldn't be using in the gcc sources. The current code is
> accidentally using this misfeature because of a prototyping change.
>
> This won't show up in a normal make all-bootstrap build, but if you
> try to do a make all-gcc using an ISO C compiler you will see it. I
> did this on irix6 using the SGI C compiler.
>
> Jim
Fixed. I also added -Wpointer-arith to my extended warning builds so
I'll be able to catch this in the future.
--Kaveh
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.4719
diff -u -p -r1.4719 ChangeLog
--- ChangeLog 1999/10/16 08:54:07 1.4719
+++ ChangeLog 1999/10/16 15:30:55
@@ -1,3 +1,8 @@
+Sat Oct 16 11:29:14 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * protoize.c (safe_read, safe_write): Avoid the gcc extension of
+ using arithmetic on void pointers.
+
Sat Oct 16 02:48:22 1999 Jeffrey A Law (law@cygnus.com)
* haifa-sched.c (compute_block_forward_dependencies): Only check
Index: protoize.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/protoize.c,v
retrieving revision 1.44
diff -u -p -r1.44 protoize.c
--- protoize.c 1999/09/10 20:03:36 1.44
+++ protoize.c 1999/10/16 15:30:58
@@ -617,7 +617,8 @@ safe_read (desc, ptr, len)
}
if (nchars == 0)
break;
- ptr += nchars;
+ /* Arithmetic on void pointers is a gcc extention. */
+ ptr = (char *) ptr + nchars;
left -= nchars;
}
return len - left;
@@ -646,7 +647,8 @@ safe_write (desc, ptr, len, out_fname)
pname, shortpath (NULL, out_fname), xstrerror (errno_val));
return;
}
- ptr += written;
+ /* Arithmetic on void pointers is a gcc extention. */
+ ptr = (char *) ptr + written;
len -= written;
}
}
More information about the Gcc-bugs
mailing list