public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/114730] New: should enum types be vector types?
@ 2024-04-16  0:09 pinskia at gcc dot gnu.org
  2024-04-16  1:14 ` [Bug c/114730] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-16  0:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114730
           Summary: should enum types be vector types?
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: documentation
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take this C23 code:
```
#define vect16 __attribute__((vector_size(16)))
enum   tt : long {enumv};
extern vect16 enum tt t;
```

Currently GCC accepts it while clang rejects it.

I can understand why we accept it but then if we change the underlying type to
bool, we still accept it even though vector_size does not apply to bool types.

I was trying to improve the documentation in this area when I found it.

Note I filed https://github.com/llvm/llvm-project/issues/88817 for clang side
of things.

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

* [Bug c/114730] should enum types be vector types?
  2024-04-16  0:09 [Bug c/114730] New: should enum types be vector types? pinskia at gcc dot gnu.org
@ 2024-04-16  1:14 ` pinskia at gcc dot gnu.org
  2024-04-16  7:44 ` rguenth at gcc dot gnu.org
  2024-04-19 16:29 ` jsm28 at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-16  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So it turns out before GCC 9, using enum vectors would ICE (PR 87286).
It was asked then if we should reject them but there was no answer to question
that but rather just fixing the ICE alone.

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

* [Bug c/114730] should enum types be vector types?
  2024-04-16  0:09 [Bug c/114730] New: should enum types be vector types? pinskia at gcc dot gnu.org
  2024-04-16  1:14 ` [Bug c/114730] " pinskia at gcc dot gnu.org
@ 2024-04-16  7:44 ` rguenth at gcc dot gnu.org
  2024-04-19 16:29 ` jsm28 at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-04-16  7:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think we need to reject all integral types whose operation range doesn't
match the corresponding integer mode range.  For enums it depends on the
language standard, in general I'd say it's not wanted.  Some targets have
__int24, we
want to reject that as well for example.

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

* [Bug c/114730] should enum types be vector types?
  2024-04-16  0:09 [Bug c/114730] New: should enum types be vector types? pinskia at gcc dot gnu.org
  2024-04-16  1:14 ` [Bug c/114730] " pinskia at gcc dot gnu.org
  2024-04-16  7:44 ` rguenth at gcc dot gnu.org
@ 2024-04-19 16:29 ` jsm28 at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-04-19 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
When implementing C23 enums with fixed underlying types I tried to ensure that
enums with underlying type bool were handled consistently with bool (cf. bug
96496 where they're not always handled consistently for C++) but it seems I
missed this vector_size check.

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

end of thread, other threads:[~2024-04-19 16:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16  0:09 [Bug c/114730] New: should enum types be vector types? pinskia at gcc dot gnu.org
2024-04-16  1:14 ` [Bug c/114730] " pinskia at gcc dot gnu.org
2024-04-16  7:44 ` rguenth at gcc dot gnu.org
2024-04-19 16:29 ` jsm28 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).