This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [patch gfortran]: Fix warning for w64 reasoned by pointer cast


2009/8/12 Tobias Burnus <burnus@net-b.de>:
> On 08/12/2009 12:07 PM, Kai Tietz wrote:
>> Well, using intptr_t would be fine, but still not all target have
>> stdint.h header. In this particular case even the type size_t could be
>> used, but of course __INTPTR_TYPE__ would be more correct.
>> This patch just fixes a warning. But even without this fix, the
>> produced code doesn't have failures, the pointer is just truncated,
>> but as the modulo is done, result remains the same.
>>
>> Ok, when I change to size_t, or __INTPTR_TYPE__?
>>
>
> I am in favour of __INTPTR_TYPE__ ?and I am in favour of fixing
> warnings; however, as __INTPTR_TYPE__ is not available on all platforms
> - some of which might be Fortran platforms -, I think we should use it
> only with some conditional. As this fixes a warning and not an error,
> adding nothing if __INTPTR_TYPE__ does not exist, would be fine with me.
>
> Tobias
>

Is this revised patch ok?

Cheers,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: gcc/libgfortran/intrinsics/string_intrinsics_inc.c
===================================================================
--- gcc.orig/libgfortran/intrinsics/string_intrinsics_inc.c	2009-04-12 20:43:24.000000000 +0200
+++ gcc/libgfortran/intrinsics/string_intrinsics_inc.c	2009-08-12 08:02:15.077270800 +0200
@@ -196,7 +196,7 @@
       /* Handle the first characters until we're aligned on a long word
 	 boundary.  Actually, s + i + 1 must be properly aligned, because
 	 s + i will be the last byte of a long word read.  */
-      starting = ((unsigned long) (s + i + 1)) % long_len;
+      starting = ((unsigned long)
+#ifdef __INTPTR_TYPE__
+      (__INTPTR_TYPE__)
+#endif
+                  (s + i + 1)) % long_len;
       i -= starting;
       for (; starting > 0; --starting)
 	if (s[i + starting] != ' ')

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