[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-12-12 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

uecker at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from uecker at gcc dot gnu.org ---
Fixed.

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

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

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

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

commit r15-6170-gd46c7f313b5a30ee04080f249e31e12987d50aa2
Author: Martin Uecker 
Date:   Sat Nov 23 08:04:05 2024 +0100

Fix type compatibility for types with flexible array member 2/2
[PR113688,PR114713,PR117724]

For checking or computing TYPE_CANONICAL, ignore the array size when it is
the last element of a structure or union.  To not get errors because of
an inconsistent number of members, zero-sized arrays which are the last
element are not ignored anymore when checking the fields of a struct.

PR c/113688
PR c/114014
PR c/114713
PR c/117724

gcc/ChangeLog:
* tree.cc (gimple_canonical_types_compatible_p): Add exception.

gcc/lto/ChangeLog:
* lto-common.cc (hash_canonical_type): Add exception.

gcc/testsuite/ChangeLog:
* gcc.dg/pr113688.c: New test.
* gcc.dg/pr114014.c: New test.
* gcc.dg/pr114713.c: New test.
* gcc.dg/pr117724.c: New test.

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-28 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #11 from David Binderman  ---
(In reply to Andrew Pinski from comment #10)
> That is a different issue unrelated to this issue here can you file it
> seperately?

Done:

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

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #10 from Andrew Pinski  ---
(In reply to David Binderman from comment #9)
> Another test case:

That is a different issue unrelated to this issue here can you file it
seperately?

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-28 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #9 from David Binderman  ---
Another test case:

struct {
  struct {
int Reserved : 32
  }
};
struct {
  struct {
int Reserved
  }
};

$ ~/gcc/results/bin/gcc -c -w -g bug1069.c
bug1069.c:10:1: error: ‘TYPE_CANONICAL’ is not compatible
   10 | };
  | ^
  constant 32>
...

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-27 Thread andres at anarazel dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #8 from Andres Freund  ---
FWIW, a few of postgres' CI instances (which intentionally track a snapshot
gcc) are hitting this (see e.g. [1]). I reproduced the failure locally, applied
the patch from [2], after which the build succeeds.

[1]
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=flaviventris&dt=2024-11-27%2018%3A57%3A47
[2] https://gcc.gnu.org/pipermail/gcc-patches/2024-November/669873.html

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-25 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

Sam James  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #7 from Sam James  ---
pr57773.c fails for me as well with just 'gcc pr57773.c -g'.

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-23 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #6 from uecker at gcc dot gnu.org ---
PATCH: https://gcc.gnu.org/pipermail/gcc-patches/2024-November/669873.html

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-22 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #5 from uecker at gcc dot gnu.org ---
Preliminary patch (but does not cover all similar cases):

diff --git a/gcc/tree.cc b/gcc/tree.cc
index 1da06c7d4e9..453b56cc37c 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -13977,6 +13977,9 @@ gimple_canonical_types_compatible_p (const_tree t1,
const_tree t2,
  tree max1 = TYPE_MAX_VALUE (i1);
  tree max2 = TYPE_MAX_VALUE (i2);

+ if (!max1 || !max2)
+   return true;
+
  /* The minimum/maximum values have to be the same.  */
  if ((min1 == min2
   || (min1 && min2

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-21 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #4 from uecker at gcc dot gnu.org ---

This seems to be the same underlying issue with FAMs now exposed by the fix to
PR117490.

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #3 from Andrew Pinski  ---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113688#c8

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-21 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #2 from Sam James  ---
```
struct {
  unsigned long len;
  unsigned long size;
  char data[];
};
struct {
  struct {
unsigned long len;
unsigned long size;
char data[6];
  }
};
```

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-21 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

Richard Biener  changed:

   What|Removed |Added

   Last reconfirmed||2024-11-21
   Priority|P3  |P1
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-21 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

--- Comment #1 from Sam James  ---
The original source file is OK with -std=gnu17.

[Bug c/117724] [15 regression] ICE when building libgit2 (error: ‘TYPE_CANONICAL’ is not compatible)

2024-11-21 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117724

Sam James  changed:

   What|Removed |Added

  Known to fail||15.0
   Target Milestone|--- |15.0
  Known to work||14.2.1