[Patch, Applied] Re: array11.C failing on all LP64 targets

Andrew Pinski pinskia@physics.uc.edu
Fri Sep 19 16:48:00 GMT 2003


On Sep 19, 2003, at 07:30, Kaveh R. Ghazi wrote:

> Andrew,
>
> The new testcase you added for PR middle-end/11665 fails on all LP64
> targets because of this:
>
>> Excess errors:
>> g++.dg/init/array11.C:21: warning: cast from pointer to integer of 
>> different size
>
> Instead of casting the pointer to unsigned, you need to cast to
> "unsigned long" as is done in g++.dg/init/struct1.C or perhaps to
> __SIZE_TYPE__.  It's currently failing on mainline and 3.3.x.


I forget all the time about LP64 targets and this is what I get when I
use the testcase from the bug report.

Fixed thus on both 3.3 and the mainline.

ChangeLog:
	* g++.dg/init/array11.C: Change unsigned to __SIZE_TYPE__
	so that it will not complain on LP64 targets.


Patch:
Index: g++.dg/init/array11.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/init/array11.C,v
retrieving revision 1.1
diff -u -p -r1.1 array11.C
--- g++.dg/init/array11.C	8 Sep 2003 03:05:52 -0000	1.1
+++ g++.dg/init/array11.C	19 Sep 2003 14:35:31 -0000
@@ -8,9 +8,12 @@
     constant value when it is not.  */

  int x;
+
+typedef __SIZE_TYPE__ size_t;
+
  struct gdt
  {
-unsigned a,b,c,d,e,f;
+size_t a,b,c,d,e,f;
  };
  void f()
  {
@@ -18,7 +21,7 @@ struct gdt gdt_table[2]=
  {
      {
  		0,
-		( (((unsigned)(&x))<<(24))&(-1<<(8)) ),
+		( (((size_t)(&x))<<(24))&(-1<<(8)) ),
      },
  };
  }



More information about the Gcc mailing list