Re: [PATCH v2 1/8] gdb/testsuite: Add Windows replacement for aligned_alloc

Luis <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Hi,

Just wondering if there are any tests planned or if the current tests 
are enough and what their results are.

On 27/07/2026 18:42, Hannes Domani wrote:
> _aligned_malloc has swapped arguments, and you have to use _aligned_free
> to free the memory afterwards.
> 
> This is enough to make i386-sse.exp pass, and i386-avx.exp will pass at
> the end of this series.
> ---
> v2:
>    - Mention which test pass after the change in the commit message
> ---
>   gdb/testsuite/gdb.arch/i386-avx.c         |  2 +-
>   gdb/testsuite/gdb.arch/i386-sse.c         |  2 +-
>   gdb/testsuite/lib/precise-aligned-alloc.c | 20 ++++++++++++++++++++
>   3 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.arch/i386-avx.c b/gdb/testsuite/gdb.arch/i386-avx.c
> index b6cd89e5bea..229093e5164 100644
> --- a/gdb/testsuite/gdb.arch/i386-avx.c
> +++ b/gdb/testsuite/gdb.arch/i386-avx.c
> @@ -116,7 +116,7 @@ main (int argc, char **argv)
>   
>     puts ("Bye!"); /* second breakpoint here */
>   
> -  free (allocated_ptr);
> +  aligned_free (allocated_ptr);
>   
>     return 0;
>   }
> diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c
> index 21264ed74e7..5210aee12c3 100644
> --- a/gdb/testsuite/gdb.arch/i386-sse.c
> +++ b/gdb/testsuite/gdb.arch/i386-sse.c
> @@ -134,7 +134,7 @@ main (int argc, char **argv)
>         puts ("Bye!"); /* second breakpoint here */
>       }
>   
> -  free (allocated_ptr);
> +  aligned_free (allocated_ptr);
>   
>     return 0;
>   }
> diff --git a/gdb/testsuite/lib/precise-aligned-alloc.c b/gdb/testsuite/lib/precise-aligned-alloc.c
> index 888814f12ef..1db35528bc8 100644
> --- a/gdb/testsuite/lib/precise-aligned-alloc.c
> +++ b/gdb/testsuite/lib/precise-aligned-alloc.c
> @@ -21,6 +21,26 @@
>   #include <string.h>
>   #include <stdint.h>
>   
> +#ifdef _WIN32
> +static void *
> +aligned_alloc (size_t alignment, size_t size)
> +{
> +  return _aligned_malloc (size, alignment);
> +}
> +
> +static void
> +aligned_free (void *ptr)
> +{
> +  _aligned_free (ptr);
> +}
> +#else
> +static void
> +aligned_free (void *ptr)
> +{
> +  free (ptr);
> +}
> +#endif
> +
>   /* Return true if address P is ALIGNMENT-byte aligned.  */
>   
>   static int
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.