public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96990] New: Regression in aarch64 struct vector member initialization
@ 2020-09-09  2:41 yyc1992 at gmail dot com
  2020-09-09  6:29 ` [Bug target/96990] " pinskia at gcc dot gnu.org
  2020-09-10 17:21 ` rsandifo at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: yyc1992 at gmail dot com @ 2020-09-09  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96990
           Summary: Regression in aarch64 struct vector member
                    initialization
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

The following code used to work on gcc 9.3 but stops working with 10.2 with an
error

```
a.c: In function ‘test_aa64_vec_2’:
a.c:19:24: error: incompatible types when initializing type ‘signed char’ using
type ‘int8x8_t’
   19 |     struct_aa64_3 x = {v1 + v1, v2 - v2};
      |                        ^~
a.c:19:33: error: incompatible types when initializing type ‘signed char’ using
type ‘float32x2_t’
   19 |     struct_aa64_3 x = {v1 + v1, v2 - v2};
      |                                 ^~
```

Any one of the "working" version or compiling with c++ works.
>From the error message it seems that GCC correctly inferred the return type of
the `v1 + v1` or `v2 - v2` but instead got confused about the field type.
Reverssing the order of `v1` and `v2` in the struct causes the error to change
to `float` instead of `signed char` so it seems that gcc thinks the code is
trying to initialize the first vector member (with element type of `signed
char` or `float` instead). I thought such initialization should have an
additional `{}` instead... Given that explicit casting or compiling in c++ mode
helps I think this is a bug...

```
#include <arm_neon.h>

typedef struct {
    int8x8_t v1;
    float32x2_t v2;
} struct_aa64_3;

struct_aa64_3 test_aa64_vec_2(int8x8_t v1, float32x2_t v2)
{
    // works
    /* int8x8_t vi8 = v1 + v1; */
    /* float32x2_t vf = v2 - v2; */
    /* struct_aa64_3 x = {vi8, vf}; */

    // works
    /* struct_aa64_3 x = {(int8x8_t)(v1 + v1), (float32x2_t)(v2 - v2)}; */

    // not
    struct_aa64_3 x = {v1 + v1, v2 - v2};
    return x;
}
```

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

* [Bug target/96990] Regression in aarch64 struct vector member initialization
  2020-09-09  2:41 [Bug c/96990] New: Regression in aarch64 struct vector member initialization yyc1992 at gmail dot com
@ 2020-09-09  6:29 ` pinskia at gcc dot gnu.org
  2020-09-10 17:21 ` rsandifo at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-09-09  6:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think it was only broken for GCC 10.2.0 and has already been fixed.

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

* [Bug target/96990] Regression in aarch64 struct vector member initialization
  2020-09-09  2:41 [Bug c/96990] New: Regression in aarch64 struct vector member initialization yyc1992 at gmail dot com
  2020-09-09  6:29 ` [Bug target/96990] " pinskia at gcc dot gnu.org
@ 2020-09-10 17:21 ` rsandifo at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2020-09-10 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #2 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Yeah, this was fixed by
https://gcc.gnu.org/g:7d599ad27b9bcf5165f87710f1abc64bbabd06ae, which will be
included in GCC 10.3.

Sorry for the inconvenience.

(PR96377 is still open because there's a related unfixed bug on trunk, but the
current GCC 10 branch is unaffected.)

*** This bug has been marked as a duplicate of bug 96377 ***

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

end of thread, other threads:[~2020-09-10 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09  2:41 [Bug c/96990] New: Regression in aarch64 struct vector member initialization yyc1992 at gmail dot com
2020-09-09  6:29 ` [Bug target/96990] " pinskia at gcc dot gnu.org
2020-09-10 17:21 ` rsandifo 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).