public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs
@ 2024-02-28 12:46 ro at gcc dot gnu.org
  2024-02-28 12:47 ` [Bug target/114148] " ro at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ro at gcc dot gnu.org @ 2024-02-28 12:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

            Bug ID: 114148
           Summary: gcc.target/i386/pr106010-7b.c FAILs
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: liuhongt at gcc dot gnu.org
  Target Milestone: ---
            Target: i?86-pc-solaris2.11, amd64-pc-solaris2.11

The gcc.target/i386/pr106010-7b.c test FAILs on Solaris/x86 (32 and 64-bit)
since 20230426:

FAIL: gcc.target/i386/pr106010-7b.c execution test  

The test aborts, which only happens at -g3 -O0:

Thread 2 received signal SIGABRT, Aborted.
[Switching to Thread 1 (LWP 1)]
0xfe02ede5 in __lwp_sigqueue () from /lib/libc.so.1
(gdb) bt
#0  0xfe02ede5 in __lwp_sigqueue () from /lib/libc.so.1
#1  0xfe026aef in thr_kill () from /lib/libc.so.1
#2  0xfdf5e142 in raise () from /lib/libc.so.1
#3  0xfdf2b474 in abort () from /lib/libc.so.1
#4  0x080526b8 in avx_test ()
    at
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/pr106010-7b.c:52
#5  0x08052107 in do_test ()
    at
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/avx-check.h:12
#6  0x0805215d in main ()
    at
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/avx-check.h:40

I've found that removing all but the ps_* and epi8_* tests still lets the test
abort; once you also remove the epi8_* tests, the abort is gone.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/114148] gcc.target/i386/pr106010-7b.c FAILs
  2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
@ 2024-02-28 12:47 ` ro at gcc dot gnu.org
  2024-02-28 12:48 ` ro at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ro at gcc dot gnu.org @ 2024-02-28 12:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

--- Comment #1 from Rainer Orth <ro at gcc dot gnu.org> ---
Created attachment 57557
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57557&action=edit
32- bit i386-pc-solaris2.11 assembler output

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/114148] gcc.target/i386/pr106010-7b.c FAILs
  2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
  2024-02-28 12:47 ` [Bug target/114148] " ro at gcc dot gnu.org
@ 2024-02-28 12:48 ` ro at gcc dot gnu.org
  2024-05-23 12:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ro at gcc dot gnu.org @ 2024-02-28 12:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

--- Comment #2 from Rainer Orth <ro at gcc dot gnu.org> ---
Created attachment 57558
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57558&action=edit
32-bit i686-pc-linux-gnu assembler output

I'm attaching the assembler output for the reduced (all but ps_* and epi8_*
removed) tests for both Solaris and Linux.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/114148] gcc.target/i386/pr106010-7b.c FAILs
  2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
  2024-02-28 12:47 ` [Bug target/114148] " ro at gcc dot gnu.org
  2024-02-28 12:48 ` ro at gcc dot gnu.org
@ 2024-05-23 12:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2024-05-24  1:52 ` liuhongt at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2024-05-23 12:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

--- Comment #3 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
To investigate further, I've added comparison functions to a reduced
version of pr106010-7b.c, with

void
cmp_epi8 (_Complex unsigned char* a, _Complex unsigned char* b)
{
  for (int i = 0; i != N; i++)
    if (a[i] != b[i])
      {
        printf ("cmp_epi8: i = %d: a[i].r = %x a[i].i = %x b[i].r = %x b[i].i =
%x\n",
                i, __real__ a[i], __imag__ a[i], __real__ b[i], __imag__ b[i]);
      }
}

This shows (when using _Complex unsigned char since on Solaris, char is
signed by default)

cmp_epi8: i = 76: a[i].r = 0 a[i].i = 0 b[i].r = 88 b[i].i = 33
cmp_epi8: i = 77: a[i].r = 0 a[i].i = 0 b[i].r = 6 b[i].i = 8
cmp_epi8: i = 80: a[i].r = 0 a[i].i = 0 b[i].r = 3 b[i].i = 0

I've also noticed that the test result depends on the implementation of
malloc used:

* With Solaris libc malloc, libmalloc, and watchmalloc, the test aborts.

* However, when using one of libbsdmalloc, libmapmalloc, libmtmalloc, or
  libumem, the test works.

However, ISTM that the test is simply bogus: in avx_test

* epi8_src, epi8_dst are allocated with malloc, buffer contents undefined

* epi8_dst is cleared

* epi8_dst is initialized from p_init

* in foo_epi8, epi8_src[0] (an undefined value) is copied into first N
  elements of epi8_dst

* epi8_dst is compared to epi8_src (with the remaining members of epi8_src
  still undefined)

Why on earth would the rest of epi8_dst and epi8_src be identical if
epi8_src was never initialized?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/114148] gcc.target/i386/pr106010-7b.c FAILs
  2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-23 12:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2024-05-24  1:52 ` liuhongt at gcc dot gnu.org
  2024-05-24  7:47 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-05-24  1:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

--- Comment #4 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to ro@CeBiTec.Uni-Bielefeld.DE from comment #3)
> To investigate further, I've added comparison functions to a reduced
> version of pr106010-7b.c, with
> 
> void
> cmp_epi8 (_Complex unsigned char* a, _Complex unsigned char* b)
> {
>   for (int i = 0; i != N; i++)
>     if (a[i] != b[i])
>       {
> 	printf ("cmp_epi8: i = %d: a[i].r = %x a[i].i = %x b[i].r = %x b[i].i =
> %x\n",
> 		i, __real__ a[i], __imag__ a[i], __real__ b[i], __imag__ b[i]);
>       }
> }
> 
> This shows (when using _Complex unsigned char since on Solaris, char is
> signed by default)
> 
> cmp_epi8: i = 76: a[i].r = 0 a[i].i = 0 b[i].r = 88 b[i].i = 33
> cmp_epi8: i = 77: a[i].r = 0 a[i].i = 0 b[i].r = 6 b[i].i = 8
> cmp_epi8: i = 80: a[i].r = 0 a[i].i = 0 b[i].r = 3 b[i].i = 0
> 
> I've also noticed that the test result depends on the implementation of
> malloc used:
> 
> * With Solaris libc malloc, libmalloc, and watchmalloc, the test aborts.
> 
> * However, when using one of libbsdmalloc, libmapmalloc, libmtmalloc, or
>   libumem, the test works.
> 
> However, ISTM that the test is simply bogus: in avx_test
> 
> * epi8_src, epi8_dst are allocated with malloc, buffer contents undefined
> 
> * epi8_dst is cleared
> 
> * epi8_dst is initialized from p_init
> 
> * in foo_epi8, epi8_src[0] (an undefined value) is copied into first N
>   elements of epi8_dst
> 
> * epi8_dst is compared to epi8_src (with the remaining members of epi8_src
>   still undefined)
uoops, does below patch fix the testcase on Solaris/x86?

   memcpy (pd_src, p_init, 2 * N * sizeof (double));
-  memcpy (ps_dst, p_init, 2 * N * sizeof (float));
-  memcpy (epi64_dst, p_init, 2 * N * sizeof (long long));
-  memcpy (epi32_dst, p_init, 2 * N * sizeof (int));
-  memcpy (epi16_dst, p_init, 2 * N * sizeof (short));
-  memcpy (epi8_dst, p_init, 2 * N * sizeof (char));
+  memcpy (ps_src, p_init, 2 * N * sizeof (float));
+  memcpy (epi64_src, p_init, 2 * N * sizeof (long long));
+  memcpy (epi32_src, p_init, 2 * N * sizeof (int));
+  memcpy (epi16_src, p_init, 2 * N * sizeof (short));
+  memcpy (epi8_src, p_init, 2 * N * sizeof (char));

> 
> Why on earth would the rest of epi8_dst and epi8_src be identical if
> epi8_src was never initialized?
Guess, epi8_src is all zero, and epi8_dst if set as epi8_src[0] by foo_epi8.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/114148] gcc.target/i386/pr106010-7b.c FAILs
  2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-24  1:52 ` liuhongt at gcc dot gnu.org
@ 2024-05-24  7:47 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2024-05-24  7:51 ` cvs-commit at gcc dot gnu.org
  2024-05-24  7:52 ` liuhongt at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2024-05-24  7:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

--- Comment #5 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #4 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
> (In reply to ro@CeBiTec.Uni-Bielefeld.DE from comment #3)
[...]
> uoops, does below patch fix the testcase on Solaris/x86?
>
>    memcpy (pd_src, p_init, 2 * N * sizeof (double));
> -  memcpy (ps_dst, p_init, 2 * N * sizeof (float));
> -  memcpy (epi64_dst, p_init, 2 * N * sizeof (long long));
> -  memcpy (epi32_dst, p_init, 2 * N * sizeof (int));
> -  memcpy (epi16_dst, p_init, 2 * N * sizeof (short));
> -  memcpy (epi8_dst, p_init, 2 * N * sizeof (char));
> +  memcpy (ps_src, p_init, 2 * N * sizeof (float));
> +  memcpy (epi64_src, p_init, 2 * N * sizeof (long long));
> +  memcpy (epi32_src, p_init, 2 * N * sizeof (int));
> +  memcpy (epi16_src, p_init, 2 * N * sizeof (short));
> +  memcpy (epi8_src, p_init, 2 * N * sizeof (char));

It does indeed: tested 32 and 64-bit, and, for good measure, with all
allocators I tried before, too.

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/114148] gcc.target/i386/pr106010-7b.c FAILs
  2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-24  7:47 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2024-05-24  7:51 ` cvs-commit at gcc dot gnu.org
  2024-05-24  7:52 ` liuhongt at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-24  7:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:51f4b47c4f4f61fe31a7bd1fa80e08c2438d76a8

commit r15-814-g51f4b47c4f4f61fe31a7bd1fa80e08c2438d76a8
Author: liuhongt <hongtao.liu@intel.com>
Date:   Fri May 24 09:49:08 2024 +0800

    Fix typo in the testcase.

    gcc/testsuite/ChangeLog:

            PR target/114148
            * gcc.target/i386/pr106010-7b.c: Refine testcase.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/114148] gcc.target/i386/pr106010-7b.c FAILs
  2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-05-24  7:51 ` cvs-commit at gcc dot gnu.org
@ 2024-05-24  7:52 ` liuhongt at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-05-24  7:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114148

Hongtao Liu <liuhongt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #7 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
Fixed in GCC15.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-24  7:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 12:46 [Bug target/114148] New: gcc.target/i386/pr106010-7b.c FAILs ro at gcc dot gnu.org
2024-02-28 12:47 ` [Bug target/114148] " ro at gcc dot gnu.org
2024-02-28 12:48 ` ro at gcc dot gnu.org
2024-05-23 12:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
2024-05-24  1:52 ` liuhongt at gcc dot gnu.org
2024-05-24  7:47 ` ro at CeBiTec dot Uni-Bielefeld.DE
2024-05-24  7:51 ` cvs-commit at gcc dot gnu.org
2024-05-24  7:52 ` liuhongt at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).