[committed] testsuite: Fix up new51.C test on various targets [PR108533]

Message ID Y9BmzmRTiExVyZFR@tucnak
State Committed
Headers
Series [committed] testsuite: Fix up new51.C test on various targets [PR108533] |

Commit Message

Jakub Jelinek Jan. 24, 2023, 11:16 p.m. UTC
  On Mon, Jan 23, 2023 at 10:26:14PM -0500, Jason Merrill via Gcc-patches wrote:
> 	* g++.dg/init/new51.C: New test.

The test fails on targets where size_t is not unsigned long
due to extra diagnostics.

As the testcase is tested in C++98 too, I'm not using decltype (sizeof 0)
but __SIZE_TYPE__.

Tested on x86_64-linux and i686-linux (plus verified with older snapshots
that it ICEs even with the change with both -m32/-m64), committed to
trunk as obvious.

2023-01-25  Jakub Jelinek  <jakub@redhat.com>

	PR c++/107329
	PR testsuite/108533
	* g++.dg/init/new51.C (size_t): New typedef.
	(RexxClass::operator new, RexxClass::operator delete): Use size_t
	instead of unsigned long.


	Jakub
  

Comments

Jason Merrill Jan. 25, 2023, 2:09 p.m. UTC | #1
On 1/24/23 18:16, Jakub Jelinek wrote:
> On Mon, Jan 23, 2023 at 10:26:14PM -0500, Jason Merrill via Gcc-patches wrote:
>> 	* g++.dg/init/new51.C: New test.
> 
> The test fails on targets where size_t is not unsigned long
> due to extra diagnostics.
> 
> As the testcase is tested in C++98 too, I'm not using decltype (sizeof 0)
> but __SIZE_TYPE__.
> 
> Tested on x86_64-linux and i686-linux (plus verified with older snapshots
> that it ICEs even with the change with both -m32/-m64), committed to
> trunk as obvious.

Thanks.

> 2023-01-25  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR c++/107329
> 	PR testsuite/108533
> 	* g++.dg/init/new51.C (size_t): New typedef.
> 	(RexxClass::operator new, RexxClass::operator delete): Use size_t
> 	instead of unsigned long.
> 
> --- gcc/testsuite/g++.dg/init/new51.C.jj	2023-01-24 11:10:13.000000000 +0100
> +++ gcc/testsuite/g++.dg/init/new51.C	2023-01-25 00:05:10.767472447 +0100
> @@ -1,9 +1,10 @@
>   // PR c++/107329
>   
> +typedef __SIZE_TYPE__ size_t;
>   struct RexxClass {
> -  void *operator new(unsigned long, unsigned long, const char *, RexxClass *,
> +  void *operator new(size_t, size_t, const char *, RexxClass *,
>                        RexxClass *);
> -  void operator delete(void *, unsigned long, const char *, RexxClass *,
> +  void operator delete(void *, size_t, const char *, RexxClass *,
>                          RexxClass *);
>     RexxClass();
>   };
> 
> 	Jakub
>
  

Patch

--- gcc/testsuite/g++.dg/init/new51.C.jj	2023-01-24 11:10:13.000000000 +0100
+++ gcc/testsuite/g++.dg/init/new51.C	2023-01-25 00:05:10.767472447 +0100
@@ -1,9 +1,10 @@ 
 // PR c++/107329
 
+typedef __SIZE_TYPE__ size_t;
 struct RexxClass {
-  void *operator new(unsigned long, unsigned long, const char *, RexxClass *,
+  void *operator new(size_t, size_t, const char *, RexxClass *,
                      RexxClass *);
-  void operator delete(void *, unsigned long, const char *, RexxClass *,
+  void operator delete(void *, size_t, const char *, RexxClass *,
                        RexxClass *);
   RexxClass();
 };