* [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
@ 2024-01-19 9:16 ` rguenth at gcc dot gnu.org
2024-01-19 16:04 ` [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808 jakub at gcc dot gnu.org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-19 9:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
2024-01-19 9:16 ` [Bug c/113492] " rguenth at gcc dot gnu.org
@ 2024-01-19 16:04 ` jakub at gcc dot gnu.org
2024-01-19 18:10 ` uecker at gcc dot gnu.org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-19 16:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-01-19
CC| |jakub at gcc dot gnu.org
Priority|P3 |P1
Summary|[14 Regression] ICE: in |[14 Regression] ICE: in
|composite_type_internal, at |composite_type_internal, at
|c/c-typeck.cc:557 with |c/c-typeck.cc:557 with
|-std=c2x |-std=c2x
|-funsigned-bitfields |-funsigned-bitfields since
| |r14-6808
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-6808-g8c8d4b565cd7e08c6ec9ca5a4369d8ec5619cad8
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
2024-01-19 9:16 ` [Bug c/113492] " rguenth at gcc dot gnu.org
2024-01-19 16:04 ` [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808 jakub at gcc dot gnu.org
@ 2024-01-19 18:10 ` uecker at gcc dot gnu.org
2024-01-20 6:15 ` zsojka at seznam dot cz
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-01-19 18:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
uecker at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |uecker at gcc dot gnu.org
--- Comment #2 from uecker at gcc dot gnu.org ---
I agree that "int:3" with -funsigned-bitfields should produce a type which is
compatible to one with "unsigned:3" and that forming a composite type has to
work.
I am not entirely sure this should be considered a regression as this C23
feature did not exist before (but was rejected and did not ICE). Anyway, I
will look at this and post a patch. Thanks for reporting.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (2 preceding siblings ...)
2024-01-19 18:10 ` uecker at gcc dot gnu.org
@ 2024-01-20 6:15 ` zsojka at seznam dot cz
2024-01-20 8:30 ` uecker at gcc dot gnu.org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-20 6:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #3 from Zdenek Sojka <zsojka at seznam dot cz> ---
(In reply to uecker from comment #2)
>
> I agree that "int:3" with -funsigned-bitfields should produce a type which
> is compatible to one with "unsigned:3" and that forming a composite type
> has to work.
>
> I am not entirely sure this should be considered a regression as this C23
> feature did not exist before (but was rejected and did not ICE). Anyway, I
> will look at this and post a patch. Thanks for reporting.
Thank you for having a look.
The "regression" part is for the ICEing.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (3 preceding siblings ...)
2024-01-20 6:15 ` zsojka at seznam dot cz
@ 2024-01-20 8:30 ` uecker at gcc dot gnu.org
2024-01-20 8:39 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-01-20 8:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #4 from uecker at gcc dot gnu.org ---
Yes, it is just weird because similar bugs for other new language features,
e.g. an ICE for BitInt are not labeled as a regression and are P3.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (4 preceding siblings ...)
2024-01-20 8:30 ` uecker at gcc dot gnu.org
@ 2024-01-20 8:39 ` pinskia at gcc dot gnu.org
2024-01-20 8:48 ` uecker at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 8:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to uecker from comment #4)
> Yes, it is just weird because similar bugs for other new language features,
> e.g. an ICE for BitInt are not labeled as a regression and are P3.
-std=c2x is not a "new feature" in GCC 14 though, it was there in GCC 13. What
is a new feature is "constructing composite types for structs and unions" but
those rules might not be known by many users so it is only new feature
internally.
Also P3 just means not categorized yet; I forgot where that is documented.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (5 preceding siblings ...)
2024-01-20 8:39 ` pinskia at gcc dot gnu.org
@ 2024-01-20 8:48 ` uecker at gcc dot gnu.org
2024-01-20 9:08 ` [Bug c/113492] " zsojka at seznam dot cz
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-01-20 8:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #6 from uecker at gcc dot gnu.org ---
The point is that no existing code is broken by this because it was rejected
previously and now this only affects very new C23 code using bit-fields in
different structs that a declared in different ways and then only when using
together -funsigned-bitfields. So it is an obscure corner case of an obscure
corner case...
But I will fix it anyway, soon I was just wondering why many similar bugs have
a different rating... If this is just because nobody came around to categorize
it, this makes sense.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (6 preceding siblings ...)
2024-01-20 8:48 ` uecker at gcc dot gnu.org
@ 2024-01-20 9:08 ` zsojka at seznam dot cz
2024-01-20 9:11 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-20 9:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
Zdenek Sojka <zsojka at seznam dot cz> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14 Regression] ICE: in |ICE: in
|composite_type_internal, at |composite_type_internal, at
|c/c-typeck.cc:557 with |c/c-typeck.cc:557 with
|-std=c2x |-std=c2x
|-funsigned-bitfields since |-funsigned-bitfields since
|r14-6808 |r14-6808
--- Comment #7 from Zdenek Sojka <zsojka at seznam dot cz> ---
I am sorry for any confusion. I was not aware of the change between gcc-13 and
gcc-14 that this code should be accepted now.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (7 preceding siblings ...)
2024-01-20 9:08 ` [Bug c/113492] " zsojka at seznam dot cz
@ 2024-01-20 9:11 ` pinskia at gcc dot gnu.org
2024-01-20 9:15 ` uecker at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 9:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note it is an user visible regression. We have had this kind of discussion
before when we go from rejects to ICE without an error. I know I can dig up
some discussions about that.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (8 preceding siblings ...)
2024-01-20 9:11 ` pinskia at gcc dot gnu.org
@ 2024-01-20 9:15 ` uecker at gcc dot gnu.org
2024-01-20 12:34 ` uecker at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-01-20 9:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #9 from uecker at gcc dot gnu.org ---
No need to dig it up, I believe you. I was just wondering.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (9 preceding siblings ...)
2024-01-20 9:15 ` uecker at gcc dot gnu.org
@ 2024-01-20 12:34 ` uecker at gcc dot gnu.org
2024-01-20 15:02 ` uecker at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-01-20 12:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #10 from uecker at gcc dot gnu.org ---
Removing the assertion is enough to fix it. But the cause is strange. We
somehow get two unsigned types in DECL_BIT_FIELD_TYPE which should be the same
but are not, e.g:
<integer_type 0x7f6dad774738 public unsigned SI
size <integer_cst 0x7f6dad624198 type <integer_type 0x7f6dad6220a8
bitsizetype> constant 32>
unit-size <integer_cst 0x7f6dad6241b0 type <integer_type 0x7f6dad622000
sizetype> constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f6dad774738 precision:32 min <integer_cst 0x7f6dad77ebe8 0> max <integer_cst
0x7f6dad769270 4294967295>>
<integer_type 0x7f6dad622690 unsigned int public unsigned SI
size <integer_cst 0x7f6dad624198 type <integer_type 0x7f6dad6220a8
bitsizetype> constant 32>
unit-size <integer_cst 0x7f6dad6241b0 type <integer_type 0x7f6dad622000
sizetype> constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f6dad622690 precision:32 min <integer_cst 0x7f6dad6241c8 0> max <integer_cst
0x7f6dad624180 4294967295>
pointer_to_this <pointer_type 0x7f6dad632690>>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (10 preceding siblings ...)
2024-01-20 12:34 ` uecker at gcc dot gnu.org
@ 2024-01-20 15:02 ` uecker at gcc dot gnu.org
2024-01-21 18:39 ` cvs-commit at gcc dot gnu.org
2024-01-31 20:01 ` uecker at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-01-20 15:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #11 from uecker at gcc dot gnu.org ---
Created attachment 57175
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57175&action=edit
patch
Untested patch.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (11 preceding siblings ...)
2024-01-20 15:02 ` uecker at gcc dot gnu.org
@ 2024-01-21 18:39 ` cvs-commit at gcc dot gnu.org
2024-01-31 20:01 ` uecker at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-21 18:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uecker@gcc.gnu.org>:
https://gcc.gnu.org/g:1ead42f9836a13cbbe6a2be685f76750583ae320
commit r14-8316-g1ead42f9836a13cbbe6a2be685f76750583ae320
Author: Martin Uecker <uecker@tugraz.at>
Date: Sat Jan 20 19:03:57 2024 +0100
C23: Fix ICE for composite type for structs with unsigned bitfields
[PR113492]
This patch fixes a bug when forming a composite type from structs that
contain an unsigned bitfield declared with int while using
-funsigned-bitfields.
In such structs the unsigned integer type was not compatible to the
regular unsigned integer type used elsewhere in the C FE.
PR c/113492
gcc/c:
* c-decl.cc (grokdeclarator): Use c_common_unsigned_type instead of
unsigned_type_for to create the unsigned type for bitfields
declared
with int when using -funsigned-bitfields.
gcc/testsuite:
* gcc.dg/pr113492.c: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808
2024-01-18 20:14 [Bug c/113492] New: [14 Regression] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields zsojka at seznam dot cz
` (12 preceding siblings ...)
2024-01-21 18:39 ` cvs-commit at gcc dot gnu.org
@ 2024-01-31 20:01 ` uecker at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: uecker at gcc dot gnu.org @ 2024-01-31 20:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492
uecker at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #13 from uecker at gcc dot gnu.org ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 15+ messages in thread