[Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808

2024-01-31 Thread uecker at gcc dot gnu.org via 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.

[Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808

2024-01-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492

--- Comment #12 from GCC Commits  ---
The master branch has been updated by Martin Uecker :

https://gcc.gnu.org/g:1ead42f9836a13cbbe6a2be685f76750583ae320

commit r14-8316-g1ead42f9836a13cbbe6a2be685f76750583ae320
Author: Martin Uecker 
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.

[Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808

2024-01-20 Thread uecker at gcc dot gnu.org via 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=edit
patch


Untested patch.

[Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808

2024-01-20 Thread uecker at gcc dot gnu.org via 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:

  constant 32>
unit-size  constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f6dad774738 precision:32 min  max >
  constant 32>
unit-size  constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f6dad622690 precision:32 min  max 
pointer_to_this >

[Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808

2024-01-20 Thread uecker at gcc dot gnu.org via 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.

[Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808

2024-01-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492

--- Comment #8 from Andrew Pinski  ---
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.

[Bug c/113492] ICE: in composite_type_internal, at c/c-typeck.cc:557 with -std=c2x -funsigned-bitfields since r14-6808

2024-01-20 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113492

Zdenek Sojka  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  ---
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.