public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
@ 2024-03-27  3:14 sjames at gcc dot gnu.org
  2024-03-27  3:18 ` [Bug ipa/114493] " pinskia at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-27  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114493
           Summary: internal compiler error: in fld_incomplete_type_of, at
                    ipa-free-lang-data.cc:257
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 57819
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57819&action=edit
odb_pack.c.i.xz

11/12/13/14 all fail. 10 fails b/c of malloc attribute so needs to be checked.

I hit this after adding may_alias to a struct.

```
$ gcc src/libgit2/CMakeFiles/libgit2.dir/odb_pack.c.i -std=c90 -c -flto
during IPA pass: *free_lang_data
/home/sam/git/libgit2/src/libgit2/odb_pack.c:986:1: internal compiler error: in
fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  986 | }
      | ^
0x55e8b946cd88 fld_incomplete_type_of
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/ipa-free-lang-data.cc:257
0x55e8baa704cd fld_simplified_type
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/ipa-free-lang-data.cc:344
0x55e8baa704cd free_lang_data_in_type
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/ipa-free-lang-data.cc:439
0x55e8bb0d2280 free_lang_data_in_cgraph
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/ipa-free-lang-data.cc:1072
0x55e8bb0d2280 free_lang_data
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/ipa-free-lang-data.cc:1109
0x55e8bb0d2280 execute
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/ipa-free-lang-data.cc:1176
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
``

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

* [Bug ipa/114493] internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
@ 2024-03-27  3:18 ` pinskia at gcc dot gnu.org
  2024-03-27  3:40 ` sjames at gcc dot gnu.org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27  3:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=101312

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have seen TYPE_CANONICAL issues with may_alias before.

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

* [Bug ipa/114493] internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
  2024-03-27  3:18 ` [Bug ipa/114493] " pinskia at gcc dot gnu.org
@ 2024-03-27  3:40 ` sjames at gcc dot gnu.org
  2024-03-27  3:50 ` [Bug c/114493] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-27  3:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
Pfff.

```
typedef struct git_midx_writer git_midx_writer;
int git_futils_rmdir_flags;
int __attribute__git_midx_writer_new(git_midx_writer **);
struct __attribute__((__may_alias__)) git_midx_writer {};
```

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

* [Bug c/114493] [11/12/13/14 Regression] internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
  2024-03-27  3:18 ` [Bug ipa/114493] " pinskia at gcc dot gnu.org
  2024-03-27  3:40 ` sjames at gcc dot gnu.org
@ 2024-03-27  3:50 ` pinskia at gcc dot gnu.org
  2024-03-27  4:00 ` pinskia at gcc dot gnu.org
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27  3:50 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.1.0
      Known to fail|                            |9.1.0
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code, lto
     Ever confirmed|0                           |1
            Summary|internal compiler error: in |[11/12/13/14 Regression]
                   |fld_incomplete_type_of, at  |internal compiler error: in
                   |ipa-free-lang-data.cc:257   |fld_incomplete_type_of, at
                   |                            |ipa-free-lang-data.cc:257
          Component|ipa                         |c
   Target Milestone|---                         |11.5
   Last reconfirmed|                            |2024-03-27

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Works with the C++ front-end ...

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

* [Bug c/114493] [11/12/13/14 Regression] internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-27  3:50 ` [Bug c/114493] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2024-03-27  4:00 ` pinskia at gcc dot gnu.org
  2024-03-27  4:01 ` pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27  4:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also related is commit r7-1272-g5545a9071573a5 .

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

* [Bug c/114493] [11/12/13/14 Regression] internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-27  4:00 ` pinskia at gcc dot gnu.org
@ 2024-03-27  4:01 ` pinskia at gcc dot gnu.org
  2024-03-27  8:37 ` rguenth at gcc dot gnu.org
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27  4:01 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |35980

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Ah yes PR 35980 which describes the exact issue ...


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35980
[Bug 35980] The canonical type of types with may_alias attribute is incorrect

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

* [Bug c/114493] [11/12/13/14 Regression] internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-27  4:01 ` pinskia at gcc dot gnu.org
@ 2024-03-27  8:37 ` rguenth at gcc dot gnu.org
  2024-06-01 21:22 ` [Bug c/114493] [11/12/13/14/15 " matoro_gcc_bugzilla at matoro dot tk
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-27  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org
           Priority|P3                          |P2

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

* [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-03-27  8:37 ` rguenth at gcc dot gnu.org
@ 2024-06-01 21:22 ` matoro_gcc_bugzilla at matoro dot tk
  2024-06-02  2:35 ` [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias sjames at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2024-06-01 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

matoro <matoro_gcc_bugzilla at matoro dot tk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matoro_gcc_bugzilla@matoro.
                   |                            |tk

--- Comment #6 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
Hit this as well building samba on 14.

Minimized:

void _talloc_array();
struct sockaddr_storage
resolve_lmhosts_file_as_sockaddr(struct sockaddr_storage **);
struct __attribute__((__may_alias__)) sockaddr_storage {
} resolve_name_multiple_recv() {
  _talloc_array();
}

$ x86_64-pc-linux-gnu-gcc-14 -flto -c resolve.c.10.i
during IPA pass: *free_lang_data
resolve.c.10.i:7:1: internal compiler error: in fld_incomplete_type_of, at
ipa-free-lang-data.cc:257
    7 | }
      | ^

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

* [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-06-01 21:22 ` [Bug c/114493] [11/12/13/14/15 " matoro_gcc_bugzilla at matoro dot tk
@ 2024-06-02  2:35 ` sjames at gcc dot gnu.org
  2024-06-03 17:47 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-06-02  2:35 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fw at gcc dot gnu.org

--- Comment #7 from Sam James <sjames at gcc dot gnu.org> ---
I've been scratching my head as to why matoro and someone else reported it with
Samba today out of nowhere.

I assume it's because of
https://sourceware.org/git/?p=glibc.git;a=commit;h=26e7005728f0eea2972474e6be2905c467661237.

I think it was suggested that a forward decl might work to mitigate the ICE but
I haven't tried (yet).

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

* [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-06-02  2:35 ` [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias sjames at gcc dot gnu.org
@ 2024-06-03 17:47 ` jakub at gcc dot gnu.org
  2024-06-03 18:05 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-03 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This doesn't ICE in C++, because the C++ FE forcibly updates the corresponding
pointer types in:
#0  fixup_may_alias (klass=<record_type 0x7fffea2dec78 S>) at
../../gcc/cp/class.cc:2328
#1  0x0000000000456835 in fixup_attribute_variants (t=<record_type
0x7fffea2dec78 S>) at ../../gcc/cp/class.cc:2354
#2  0x00000000006f3024 in cp_parser_class_head (parser=0x7fffea2dea80,
nested_name_specifier_p=0x7fffffffd5ff) at ../../gcc/cp/parser.cc:27831

/* KLASS is a class that we're applying may_alias to after the body is
   parsed.  Fixup any POINTER_TO and REFERENCE_TO types.  The
   canonical type(s) will be implicitly updated.  */

static void
fixup_may_alias (tree klass)
{
  tree t, v;

  for (t = TYPE_POINTER_TO (klass); t; t = TYPE_NEXT_PTR_TO (t))
    for (v = TYPE_MAIN_VARIANT (t); v; v = TYPE_NEXT_VARIANT (v))
      TYPE_REF_CAN_ALIAS_ALL (v) = true;
  for (t = TYPE_REFERENCE_TO (klass); t; t = TYPE_NEXT_REF_TO (t))
    for (v = TYPE_MAIN_VARIANT (t); v; v = TYPE_NEXT_VARIANT (v))
      TYPE_REF_CAN_ALIAS_ALL (v) = true;
}

Now, fixup_attribute_variants also does:
  for (variants = TYPE_NEXT_VARIANT (t);
       variants;
       variants = TYPE_NEXT_VARIANT (variants))
    {
      /* These are the two fields that check_qualified_type looks at and
         are affected by attributes.  */
      TYPE_ATTRIBUTES (variants) = attrs;
      unsigned valign = align;
      if (TYPE_USER_ALIGN (variants))
        valign = MAX (valign, TYPE_ALIGN (variants));
      else
        TYPE_USER_ALIGN (variants) = user_align;
      SET_TYPE_ALIGN (variants, valign);
      TYPE_PACKED (variants) = packed;
      if (may_alias)
        fixup_may_alias (variants);
    }
I think the TYPE_ATTRIBUTES update isn't needed, because
decl_attributes (&t, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE);
should update the variants already:
984                       TYPE_ATTRIBUTES (*anode) = r;
985                       /* If this is the main variant, also push the
attributes
986                          out to the other variants.  */
987                       if (*anode == TYPE_MAIN_VARIANT (*anode))
988                         {
989                           for (tree variant = *anode; variant;
990                                variant = TYPE_NEXT_VARIANT (variant))
991                             {
992                               if (TYPE_ATTRIBUTES (variant) == old_attrs)
993                                 TYPE_ATTRIBUTES (variant)
994                                   = TYPE_ATTRIBUTES (*anode);
995                               else if (!find_same_attribute
996                                        (attr, TYPE_ATTRIBUTES (variant)))
997                                 TYPE_ATTRIBUTES (variant) = tree_cons
998                                   (name, args, TYPE_ATTRIBUTES (variant));
999                             }
1000                        }
Seems finish_struct doesn't actually call layout_type on the type variants,
wonder what does that, but I'd think that stuff like TYPE_USER_ALIGN,
TYPE_ALIGN would be finalized when layout_type is performed for those. 
TYPE_PACKED is apparently done in
finish_record_layout even for the variants (called from layout_type).

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

* [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-06-03 17:47 ` jakub at gcc dot gnu.org
@ 2024-06-03 18:05 ` jakub at gcc dot gnu.org
  2024-06-03 18:08 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-03 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That was added for C++ in PR70512.

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

* [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-06-03 18:05 ` jakub at gcc dot gnu.org
@ 2024-06-03 18:08 ` jakub at gcc dot gnu.org
  2024-06-06 20:12 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-03 18:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 58337
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58337&action=edit
gcc15-pr114493.patch

Untested fix.

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

* [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2024-06-03 18:08 ` jakub at gcc dot gnu.org
@ 2024-06-06 20:12 ` cvs-commit at gcc dot gnu.org
  2024-06-06 20:19 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-06 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:d5a3c6d43acb8b2211d9fb59d59482d74c010f01

commit r15-1080-gd5a3c6d43acb8b2211d9fb59d59482d74c010f01
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jun 6 22:12:11 2024 +0200

    c: Fix up pointer types to may_alias structures [PR114493]

    The following testcase ICEs in ipa-free-lang, because the
    fld_incomplete_type_of
              gcc_assert (TYPE_CANONICAL (t2) != t2
                          && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE
(t)));
    assertion doesn't hold.
    This is because t is a struct S * type which was created while struct S
    was still incomplete and without the may_alias attribute (and
TYPE_CANONICAL
    of a pointer type is a type created with can_alias_all = false argument),
    while later on on the struct definition may_alias attribute was used.
    fld_incomplete_type_of then creates an incomplete distinct copy of the
    structure (but with the original attributes) but pointers created for it
    are because of the "may_alias" attribute TYPE_REF_CAN_ALIAS_ALL, including
    their TYPE_CANONICAL, because while that is created with !can_alias_all
    argument, we later set it because of the "may_alias" attribute on the
    to_type.

    This doesn't ICE with C++ since PR70512 fix because the C++ FE sets
    TYPE_REF_CAN_ALIAS_ALL on all pointer types to the class type (and its
    variants) when the may_alias is added.

    The following patch does that in the C FE as well.

    2024-06-06  Jakub Jelinek  <jakub@redhat.com>

            PR c/114493
            * c-decl.cc (c_fixup_may_alias): New function.
            (finish_struct): Call it if "may_alias" attribute is
            specified.

            * gcc.dg/pr114493-1.c: New test.
            * gcc.dg/pr114493-2.c: New test.

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

* [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2024-06-06 20:12 ` cvs-commit at gcc dot gnu.org
@ 2024-06-06 20:19 ` cvs-commit at gcc dot gnu.org
  2024-06-06 20:48 ` [Bug c/114493] [11/12/13 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-06 20:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:56c73729c3eab08ca48f366bd435f98457743e45

commit r14-10286-g56c73729c3eab08ca48f366bd435f98457743e45
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jun 6 22:12:11 2024 +0200

    c: Fix up pointer types to may_alias structures [PR114493]

    The following testcase ICEs in ipa-free-lang, because the
    fld_incomplete_type_of
              gcc_assert (TYPE_CANONICAL (t2) != t2
                          && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE
(t)));
    assertion doesn't hold.
    This is because t is a struct S * type which was created while struct S
    was still incomplete and without the may_alias attribute (and
TYPE_CANONICAL
    of a pointer type is a type created with can_alias_all = false argument),
    while later on on the struct definition may_alias attribute was used.
    fld_incomplete_type_of then creates an incomplete distinct copy of the
    structure (but with the original attributes) but pointers created for it
    are because of the "may_alias" attribute TYPE_REF_CAN_ALIAS_ALL, including
    their TYPE_CANONICAL, because while that is created with !can_alias_all
    argument, we later set it because of the "may_alias" attribute on the
    to_type.

    This doesn't ICE with C++ since PR70512 fix because the C++ FE sets
    TYPE_REF_CAN_ALIAS_ALL on all pointer types to the class type (and its
    variants) when the may_alias is added.

    The following patch does that in the C FE as well.

    2024-06-06  Jakub Jelinek  <jakub@redhat.com>

            PR c/114493
            * c-decl.cc (c_fixup_may_alias): New function.
            (finish_struct): Call it if "may_alias" attribute is
            specified.

            * gcc.dg/pr114493-1.c: New test.
            * gcc.dg/pr114493-2.c: New test.

    (cherry picked from commit d5a3c6d43acb8b2211d9fb59d59482d74c010f01)

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

* [Bug c/114493] [11/12/13 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2024-06-06 20:19 ` cvs-commit at gcc dot gnu.org
@ 2024-06-06 20:48 ` jakub at gcc dot gnu.org
  2024-06-11  6:17 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-06 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
            Summary|[11/12/13/14/15 Regression] |[11/12/13 Regression]
                   |internal compiler error: in |internal compiler error: in
                   |fld_incomplete_type_of with |fld_incomplete_type_of with
                   |may_alias                   |may_alias
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now for 14.2+ and 15+ for now.

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

* [Bug c/114493] [11/12/13 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2024-06-06 20:48 ` [Bug c/114493] [11/12/13 " jakub at gcc dot gnu.org
@ 2024-06-11  6:17 ` cvs-commit at gcc dot gnu.org
  2024-06-11 10:39 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-11  6:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:7813d94393f60ac641265cb3fc3a446f9f3aea7e

commit r13-8838-g7813d94393f60ac641265cb3fc3a446f9f3aea7e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jun 6 22:12:11 2024 +0200

    c: Fix up pointer types to may_alias structures [PR114493]

    The following testcase ICEs in ipa-free-lang, because the
    fld_incomplete_type_of
              gcc_assert (TYPE_CANONICAL (t2) != t2
                          && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE
(t)));
    assertion doesn't hold.
    This is because t is a struct S * type which was created while struct S
    was still incomplete and without the may_alias attribute (and
TYPE_CANONICAL
    of a pointer type is a type created with can_alias_all = false argument),
    while later on on the struct definition may_alias attribute was used.
    fld_incomplete_type_of then creates an incomplete distinct copy of the
    structure (but with the original attributes) but pointers created for it
    are because of the "may_alias" attribute TYPE_REF_CAN_ALIAS_ALL, including
    their TYPE_CANONICAL, because while that is created with !can_alias_all
    argument, we later set it because of the "may_alias" attribute on the
    to_type.

    This doesn't ICE with C++ since PR70512 fix because the C++ FE sets
    TYPE_REF_CAN_ALIAS_ALL on all pointer types to the class type (and its
    variants) when the may_alias is added.

    The following patch does that in the C FE as well.

    2024-06-06  Jakub Jelinek  <jakub@redhat.com>

            PR c/114493
            * c-decl.cc (c_fixup_may_alias): New function.
            (finish_struct): Call it if "may_alias" attribute is
            specified.

            * gcc.dg/pr114493-1.c: New test.
            * gcc.dg/pr114493-2.c: New test.

    (cherry picked from commit d5a3c6d43acb8b2211d9fb59d59482d74c010f01)

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

* [Bug c/114493] [11/12/13 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2024-06-11  6:17 ` cvs-commit at gcc dot gnu.org
@ 2024-06-11 10:39 ` cvs-commit at gcc dot gnu.org
  2024-06-11 10:55 ` [Bug c/114493] [11 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-11 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:d4126b329b2ae4f2b60efa1c7ad51b576de168bd

commit r12-10534-gd4126b329b2ae4f2b60efa1c7ad51b576de168bd
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jun 6 22:12:11 2024 +0200

    c: Fix up pointer types to may_alias structures [PR114493]

    The following testcase ICEs in ipa-free-lang, because the
    fld_incomplete_type_of
              gcc_assert (TYPE_CANONICAL (t2) != t2
                          && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE
(t)));
    assertion doesn't hold.
    This is because t is a struct S * type which was created while struct S
    was still incomplete and without the may_alias attribute (and
TYPE_CANONICAL
    of a pointer type is a type created with can_alias_all = false argument),
    while later on on the struct definition may_alias attribute was used.
    fld_incomplete_type_of then creates an incomplete distinct copy of the
    structure (but with the original attributes) but pointers created for it
    are because of the "may_alias" attribute TYPE_REF_CAN_ALIAS_ALL, including
    their TYPE_CANONICAL, because while that is created with !can_alias_all
    argument, we later set it because of the "may_alias" attribute on the
    to_type.

    This doesn't ICE with C++ since PR70512 fix because the C++ FE sets
    TYPE_REF_CAN_ALIAS_ALL on all pointer types to the class type (and its
    variants) when the may_alias is added.

    The following patch does that in the C FE as well.

    2024-06-06  Jakub Jelinek  <jakub@redhat.com>

            PR c/114493
            * c-decl.cc (c_fixup_may_alias): New function.
            (finish_struct): Call it if "may_alias" attribute is
            specified.

            * gcc.dg/pr114493-1.c: New test.
            * gcc.dg/pr114493-2.c: New test.

    (cherry picked from commit d5a3c6d43acb8b2211d9fb59d59482d74c010f01)

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

* [Bug c/114493] [11 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2024-06-11 10:39 ` cvs-commit at gcc dot gnu.org
@ 2024-06-11 10:55 ` jakub at gcc dot gnu.org
  2024-06-20 13:24 ` cvs-commit at gcc dot gnu.org
  2024-06-20 13:39 ` jakub at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-11 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13 Regression]       |[11 Regression] internal
                   |internal compiler error: in |compiler error: in
                   |fld_incomplete_type_of with |fld_incomplete_type_of with
                   |may_alias                   |may_alias

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed for 12.4+ and 13.4+ too.

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

* [Bug c/114493] [11 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2024-06-11 10:55 ` [Bug c/114493] [11 " jakub at gcc dot gnu.org
@ 2024-06-20 13:24 ` cvs-commit at gcc dot gnu.org
  2024-06-20 13:39 ` jakub at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-20 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:5736bc05ea1546328cad9b6cefb5a389d2a2994e

commit r11-11515-g5736bc05ea1546328cad9b6cefb5a389d2a2994e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jun 6 22:12:11 2024 +0200

    c: Fix up pointer types to may_alias structures [PR114493]

    The following testcase ICEs in ipa-free-lang, because the
    fld_incomplete_type_of
              gcc_assert (TYPE_CANONICAL (t2) != t2
                          && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE
(t)));
    assertion doesn't hold.
    This is because t is a struct S * type which was created while struct S
    was still incomplete and without the may_alias attribute (and
TYPE_CANONICAL
    of a pointer type is a type created with can_alias_all = false argument),
    while later on on the struct definition may_alias attribute was used.
    fld_incomplete_type_of then creates an incomplete distinct copy of the
    structure (but with the original attributes) but pointers created for it
    are because of the "may_alias" attribute TYPE_REF_CAN_ALIAS_ALL, including
    their TYPE_CANONICAL, because while that is created with !can_alias_all
    argument, we later set it because of the "may_alias" attribute on the
    to_type.

    This doesn't ICE with C++ since PR70512 fix because the C++ FE sets
    TYPE_REF_CAN_ALIAS_ALL on all pointer types to the class type (and its
    variants) when the may_alias is added.

    The following patch does that in the C FE as well.

    2024-06-06  Jakub Jelinek  <jakub@redhat.com>

            PR c/114493
            * c-decl.c (c_fixup_may_alias): New function.
            (finish_struct): Call it if "may_alias" attribute is
            specified.

            * gcc.dg/pr114493-1.c: New test.
            * gcc.dg/pr114493-2.c: New test.

    (cherry picked from commit d5a3c6d43acb8b2211d9fb59d59482d74c010f01)

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

* [Bug c/114493] [11 Regression] internal compiler error: in fld_incomplete_type_of with may_alias
  2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2024-06-20 13:24 ` cvs-commit at gcc dot gnu.org
@ 2024-06-20 13:39 ` jakub at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-20 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.5 as well.

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

end of thread, other threads:[~2024-06-20 13:39 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27  3:14 [Bug ipa/114493] New: internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257 sjames at gcc dot gnu.org
2024-03-27  3:18 ` [Bug ipa/114493] " pinskia at gcc dot gnu.org
2024-03-27  3:40 ` sjames at gcc dot gnu.org
2024-03-27  3:50 ` [Bug c/114493] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-03-27  4:00 ` pinskia at gcc dot gnu.org
2024-03-27  4:01 ` pinskia at gcc dot gnu.org
2024-03-27  8:37 ` rguenth at gcc dot gnu.org
2024-06-01 21:22 ` [Bug c/114493] [11/12/13/14/15 " matoro_gcc_bugzilla at matoro dot tk
2024-06-02  2:35 ` [Bug c/114493] [11/12/13/14/15 Regression] internal compiler error: in fld_incomplete_type_of with may_alias sjames at gcc dot gnu.org
2024-06-03 17:47 ` jakub at gcc dot gnu.org
2024-06-03 18:05 ` jakub at gcc dot gnu.org
2024-06-03 18:08 ` jakub at gcc dot gnu.org
2024-06-06 20:12 ` cvs-commit at gcc dot gnu.org
2024-06-06 20:19 ` cvs-commit at gcc dot gnu.org
2024-06-06 20:48 ` [Bug c/114493] [11/12/13 " jakub at gcc dot gnu.org
2024-06-11  6:17 ` cvs-commit at gcc dot gnu.org
2024-06-11 10:39 ` cvs-commit at gcc dot gnu.org
2024-06-11 10:55 ` [Bug c/114493] [11 " jakub at gcc dot gnu.org
2024-06-20 13:24 ` cvs-commit at gcc dot gnu.org
2024-06-20 13:39 ` jakub 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).