]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Make some C++ tests account for llp64 targets
authorJonathan Yong <10walls@gmail.com>
Wed, 11 Feb 2026 05:49:57 +0000 (05:49 +0000)
committerJonathan Yong <10walls@gmail.com>
Wed, 11 Feb 2026 11:05:37 +0000 (11:05 +0000)
Fix spurious warnings with mingw-w64.

gcc/testsuite/ChangeLog:

* g++.dg/expr/cast11.C: Cast to intptr_t instead of long.
* g++.dg/opt/pr55717.C: Ditto.
* g++.dg/warn/Wunused-value-1.C: Ditto.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
gcc/testsuite/g++.dg/expr/cast11.C
gcc/testsuite/g++.dg/opt/pr55717.C
gcc/testsuite/g++.dg/warn/Wunused-value-1.C

index baafebb3c73c55c8473beaa0585487155be472ab..77d6e5facc455734b0db00254f7d12554077667d 100644 (file)
@@ -10,6 +10,8 @@ template<typename T> void g(T const&&) { }
 
 struct B { int i; const char c; } b = {};
 
+typedef __INTPTR_TYPE__ intptr_t;
+
 void f1()
 {
   int i = 0;
@@ -19,7 +21,7 @@ void f1()
   f((long* const)&i);                  // { dg-warning "5:type qualifiers ignored" }
 
   f(static_cast<long const>(i));       // { dg-warning "5:type qualifiers ignored" }
-  f(reinterpret_cast<long const>(&i)); // { dg-warning "5:type qualifiers ignored" }
+  f(reinterpret_cast<intptr_t const>(&i));     // { dg-warning "5:type qualifiers ignored" }
 
   f(static_cast<int* const>(&i));      // { dg-warning "5:type qualifiers ignored" }
   f(const_cast<int* const>(&i));       // { dg-warning "5:type qualifiers ignored" }
index c03badd258f6b635286be61ec2574a7aac041e9c..688b0ae2fb60f9609d5ce87f3dcb5560261440b6 100644 (file)
@@ -3,6 +3,7 @@
 // { dg-options "-O -g" }
 
 typedef unsigned uint32_t __attribute__((mode (__SI__)));
+typedef __INTPTR_TYPE__ intptr_t;
 
 struct DebugOnly {};
 template <class T>
@@ -95,7 +96,7 @@ struct AllocationSiteKey
   uint32_t offset : 24;
   int kind;
   typedef AllocationSiteKey Lookup;
-  static unsigned hash (AllocationSiteKey key) { return (long (key.script->code + key.offset)) ^ key.kind; }
+  static unsigned hash (AllocationSiteKey key) { return (intptr_t (key.script->code + key.offset)) ^ key.kind; }
 };
 void
 TypeCompartment::sweep (FreeOp *)
index 2ba5587fce04db599cb632c692878211ba17c59a..fe34a8c4ea353ddf379fdec7692afd6cfac567f0 100644 (file)
@@ -2,11 +2,13 @@
 // { dg-do compile { target c++11 } }
 // { dg-options "-Wunused" }
 
+typedef __INTPTR_TYPE__ intptr_t;
+
 void
 g ()
 {
-  (long) new int{};
-  long(new int{});
-  (long) new int();
-  long(new int());
+  (intptr_t) new int{};
+  intptr_t(new int{});
+  (intptr_t) new int();
+  intptr_t(new int());
 }